Skip to main content
added 1853 characters in body
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

OutputsTry it online or verify all test cases.

Or alternatively with just a sort-by without filter:

ŒéΣláDêAQig]н

Try it online or verify all test cases.

Both output an empty string as falsey. (couldCould have been 12 bytes if we would be allowed to output -1 as falsey with ŒéΣág}.ΔlêAå).

Try it online or verify all test cases.)

Œ       # Get all substrings of the (implicit) input-string
 ʒ      # Filter this list by:
  l     #  Convert the current substring to lowercase
   ê    #  Uniquify and sort all characters in the string
    A   #  Push "abcdefghijklmnopqrstuvwxyz"
     å  #  Check if the lowercase alphabet is in the uniquify-sorted substring
 }é     # After the filter: sort any remaining substrings from shortest to longest
   Σ    # Then sort it again by:
    á   #  Leave just all the letters of the substring
     g  #  Pop and push the length for the amount of letters
   }н   # After the sort-by: pop and leave just the first
        # (or an empty string if the list is empty)
        # (which is output implicitly as result)
Œ           # Get all substrings of the (implicit) input-string
 é          # Sort them by length (shortest to longest)
  Σ         # Then sort it again by:
   l        #  Convert the current substring to lowercase
    á       #  Leave just all the letters of the substring
     D      #  Duplicate it
      ê     #  Uniquify and sort all characters in the letters in the string
       AQi  #  Pop, and if it's equal to the lowercase alphabet:
          g #   Pop and push the length for the amount of letters
  ]         # Close both the if-statement and sort-by
            # (note, integers are always sorted before strings, even if there are
            # digits in the input-string)
   н        # Pop and leave just the first result
            # (or an empty string if the list is empty)
            # (which is output implicitly as result)

Outputs an empty string as falsey (could have been 12 bytes if we would be allowed to output -1 as falsey with ŒéΣág}.ΔlêAå).

Try it online or verify all test cases.

Œ       # Get all substrings of the (implicit) input-string
 ʒ      # Filter this list by:
  l     #  Convert the current substring to lowercase
   ê    #  Uniquify and sort all characters in the string
    A   #  Push "abcdefghijklmnopqrstuvwxyz"
     å  #  Check if the lowercase alphabet is in the uniquify-sorted substring
 }é     # After the filter: sort any remaining substrings from shortest to longest
   Σ    # Then sort it again by:
    á   #  Leave just all the letters of the substring
     g  #  Pop and push the length
   }н   # After the sort-by: pop and leave just the first
        # (or an empty string if the list is empty)
        # (which is output implicitly as result)

Try it online or verify all test cases.

Or alternatively with just a sort-by without filter:

ŒéΣláDêAQig]н

Try it online or verify all test cases.

Both output an empty string as falsey. (Could have been 12 bytes if we would be allowed to output -1 as falsey with ŒéΣág}.ΔlêAå.)

Œ       # Get all substrings of the (implicit) input-string
 ʒ      # Filter this list by:
  l     #  Convert the current substring to lowercase
   ê    #  Uniquify and sort all characters in the string
    A   #  Push "abcdefghijklmnopqrstuvwxyz"
     å  #  Check if the lowercase alphabet is in the uniquify-sorted substring
 }é     # After the filter: sort any remaining substrings from shortest to longest
   Σ    # Then sort it again by:
    á   #  Leave just all the letters of the substring
     g  #  Pop and push the length for the amount of letters
   }н   # After the sort-by: pop and leave just the first
        # (or an empty string if the list is empty)
        # (which is output implicitly as result)
Œ           # Get all substrings of the (implicit) input-string
 é          # Sort them by length (shortest to longest)
  Σ         # Then sort it again by:
   l        #  Convert the current substring to lowercase
    á       #  Leave just all the letters of the substring
     D      #  Duplicate it
      ê     #  Uniquify and sort all characters in the letters in the string
       AQi  #  Pop, and if it's equal to the lowercase alphabet:
          g #   Pop and push the length for the amount of letters
  ]         # Close both the if-statement and sort-by
            # (note, integers are always sorted before strings, even if there are
            # digits in the input-string)
   н        # Pop and leave just the first result
            # (or an empty string if the list is empty)
            # (which is output implicitly as result)
Post Undeleted by Kevin Cruijssen
Fixed
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E, 913 bytes

ŒʒlêAå}éнéΣág}н

Outputs an empty string as falsey (could have been 812 bytes if we would be allowed to output -1 as falsey with ŒéŒéΣág}.ΔlêAå).

Try it onlineTry it online or verify all test casesverify all test cases.

Explanation:

Œ       # Get all substrings of the (implicit) input-string
 ʒ      # Filter this list by:
  l     #  Convert the current substring to lowercase
   ê    #  Uniquify and sort all characters in the string
    A   #  Push "abcdefghijklmnopqrstuvwxyz"
     å  #  Check if the lowercase alphabet is in the uniquify-sorted substring
 }é     # After the filter: sort any remaining substrings from shortest to longest
   нΣ    # Then sort it again by:
    á   #  Leave just all the letters of the substring
     g  #  Pop and push the length
   }н   # After the sort-by: pop and leave just the first/shortest
        # (or an empty string if the list is empty)
        # (which is output implicitly as result)

05AB1E, 9 bytes

ŒʒlêAå}éн

Outputs an empty string as falsey (could have been 8 bytes if we would be allowed to output -1 as falsey with Œé.ΔlêAå).

Try it online or verify all test cases.

Explanation:

Œ       # Get all substrings of the (implicit) input-string
 ʒ      # Filter this list by:
  l     #  Convert the current substring to lowercase
   ê    #  Uniquify and sort all characters in the string
    A   #  Push "abcdefghijklmnopqrstuvwxyz"
     å  #  Check if the lowercase alphabet is in the uniquify-sorted substring
 }é     # After the filter: sort any remaining substrings from shortest to longest
   н    # Pop and leave just the first/shortest
        # (or an empty string if the list is empty)
        # (which is output implicitly as result)

05AB1E, 13 bytes

ŒʒlêAå}éΣág}н

Outputs an empty string as falsey (could have been 12 bytes if we would be allowed to output -1 as falsey with ŒéΣág}.ΔlêAå).

Try it online or verify all test cases.

Explanation:

Œ       # Get all substrings of the (implicit) input-string
 ʒ      # Filter this list by:
  l     #  Convert the current substring to lowercase
   ê    #  Uniquify and sort all characters in the string
    A   #  Push "abcdefghijklmnopqrstuvwxyz"
     å  #  Check if the lowercase alphabet is in the uniquify-sorted substring
 }é     # After the filter: sort any remaining substrings from shortest to longest
   Σ    # Then sort it again by:
    á   #  Leave just all the letters of the substring
     g  #  Pop and push the length
   }н   # After the sort-by: pop and leave just the first
        # (or an empty string if the list is empty)
        # (which is output implicitly as result)
Post Deleted by Kevin Cruijssen
Source Link
Kevin Cruijssen
  • 131.4k
  • 13
  • 144
  • 384

05AB1E, 9 bytes

ŒʒlêAå}éн

Outputs an empty string as falsey (could have been 8 bytes if we would be allowed to output -1 as falsey with Œé.ΔlêAå).

Try it online or verify all test cases.

Explanation:

Œ       # Get all substrings of the (implicit) input-string
 ʒ      # Filter this list by:
  l     #  Convert the current substring to lowercase
   ê    #  Uniquify and sort all characters in the string
    A   #  Push "abcdefghijklmnopqrstuvwxyz"
     å  #  Check if the lowercase alphabet is in the uniquify-sorted substring
 }é     # After the filter: sort any remaining substrings from shortest to longest
   н    # Pop and leave just the first/shortest
        # (or an empty string if the list is empty)
        # (which is output implicitly as result)