Code Golf: Longest 3-character substring
Started: 1576368000, F jS, Y g:i:s A
Ends: 1576972800, F jS, Y g:i:s A
Time Remaining:
Description
Write a function called burrito that takes in a string and returns a contiguous substring within that string. This substring should be the longest possible substring that contains at most 3 unique characters.
>>> burrito("abcdcdfdb")
"cdcdfd"
>>> burrito("mississippi")
"ississippi"
>>> burrito("a b c b a")
" b c b "
>>> burrito("cat")
"cat"
"cdcdfd"
>>> burrito("mississippi")
"ississippi"
>>> burrito("a b c b a")
" b c b "
>>> burrito("cat")
"cat"
Note that the string can contain any type of character, not just letters.
If there is a tie, you can return any valid answer (no verification tests will have ambiguous input)
The string will always be non-empty
You must be logged in to submit an entry.