This is based off this challenge.
Given an input string, check whether the string is blurry.
What's a blurry string?
A blurry string is a string that's contained in the set of all blurrified pure-ASCII strings.
Take a non-blurrified pure-ASCII string
abc as an example. You repeat every character of this twice:
And then insert spaces at every odd-even index.
a ab bc c
Then, remove the preceding 2 and succeeding 2 extra characters. If there isn't enough space left, ignore the abundant removing instructions.
As an example, all of these strings are blurry (the empty line stands for an empty string):
Before After "a" -> "ab" ->ab "abc" ->ab bc "abcd"->ab bc cd ... (Before = the string before blurrification) (After = the string after blurrification, i.e. the strings in the set of all blurry strings.)
- The input string consists purely of printable ASCII characters. The only whitespace it will contain is the space character.
- You don't have to remove extra characters before the check.
- Your output can consist of any trailing whitespace, as long as it's possible to tell a truthy result from a falsy result.
- It's noteworthy that the definition of "blurry" in this challenge is different than the previous challenge.
Here is a program I use to check my test cases.
"" -> True "ab" -> True "ab bc" -> True "aa aa" -> True "ab bc cd" -> True " b bc cd" -> True "ab bc c " -> True "a c cd" -> True " " -> True "a" -> False "abc" -> False "ab bc cd"-> False "ab#bc#cd" -> False "abbccd" -> False "a ab bc cd"-> False "a a ab b b"-> False "ba cb dc" -> False "ba bc dc" -> False "FFaallssee"-> False "a aa a" -> False