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.

ab bc

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.

Test cases

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
  • 2
    \$\begingroup\$ I think it would be good to include some test cases where characters in the pre-blurred string repeat. \$\endgroup\$
    – xnor
    May 3, 2020 at 2:31
  • \$\begingroup\$ I meant truthy ones like a aa a or even just eight spaces. (Edit: Oops, I mean aa aa) \$\endgroup\$
    – xnor
    May 3, 2020 at 2:35
  • 3
    \$\begingroup\$ I'd argue the empty string is not blurry because one doesn't simply remove the first and last two characters from a string shorter than 4. \$\endgroup\$ May 3, 2020 at 4:52
  • \$\begingroup\$ I don't understand how is " b bc cd" or "ab bc c " or "a c cd" or "" or " "*8 blurry. What are the strings that originated those? \$\endgroup\$
    – RGS
    May 3, 2020 at 6:54
  • \$\begingroup\$ Depending on the answer to my comment above, it might be good to edit the challenge to explicitly specify we are defining a blurry string in a way that is different from what was done in the challenge in which this one is inspired \$\endgroup\$
    – RGS
    May 3, 2020 at 6:57

12 Answers 12


Retina, 14 bytes

a`.((.) \2)*.|

Try it online!


a forces the match to be on the entire string

.((.) \2)*. just means any character (.) followed by a captured group repeated 0 to many times ((...)*) of any character saved into a second captured group ((.)) followed by a space and the same character that was matched in the second capture group (\2). The final . just matches the last character

| allows the empty string to match by having an alternative match of the empty string


Python 3, 60 54 bytes

-6 bytes thanks to Surculose Sputum!

while b:x,y,z,*b=b;x[x!=z][y>' ']

Try it online! Output is via exit code.

By using different sets of errors for truthy/falsy inputs this can be 52 bytes, as suggested by Surculose Sputum.


Python 2, 57 bytes

lambda x:x==''.join(c+' '+c for c in x[::3]+x[-1:])[2:-2]

Try it online!

Uses the same approach as my Pyth answer. The blurring portion of the code is based off of @Surculose Sputum's answer to the original "Blur a string" challenge.


Haskell, 68 bytes

p#(' ':x:y:s)|p==x=y#s
f _=2<1

Try it online!


f is the entry point. No real tricks; loop through recursively ensuring that every third character is a space, while keeping track of the second character of the previous chunk each time and ensuring that it's equal to the first of the next chunk.

  • 1
    \$\begingroup\$ You can combine the first and last case for both (#) and f. Try it online! \$\endgroup\$
    – Wheat Wizard
    May 3, 2020 at 23:57

Pyth, 13 bytes


Try it online!

      %3Q      Take every 3rd character of the input string
                (eg. "ab bc cd" becomes "abc")
     +   >1Q   Append the last character of the input string
 jd.:       2  "Blur" the resulting string 
                (ie. find all substrings of length 2 and join on spaces)
q              Return true if that matches the input string
  • \$\begingroup\$ For -1 byte, >1Q is the same as eQ \$\endgroup\$
    – ar4093
    May 4, 2020 at 6:49
  • \$\begingroup\$ @ar4093 Yep, except that eQ throws an Index Out of Range error for the empty string :/ \$\endgroup\$ May 4, 2020 at 13:58

05AB1E, 16 13 12 bytes


Try it online!

Uses the blurring program here to re-blur the string. -1 byte thanks to Kevin Cruijssen!

Old Answer Explained

3ô                  # Split the input into chunks of 3
  `©                # Item split the above and store the last item in the register
    )               # Wrap everything back into a list
     €н             # Get the first character from each item in then above list
       `            # Item split the list generated from the above map
        ®θJ         # Join the above with the last letter from the register
           üJðý     # Blatant port of https://codegolf.stackexchange.com/a/203906/78850 -- i.e. blur the string
               Q    # Check to see if the blurred string is the input

Perl 5 with -plF/^(.((.)\x20\3)*.|)$/, 7 bytes


Try it online!


Continuing the theme of abusing -F, I ended up with the same expression used in the Retina answer. The -F argument splits the input string on the valid expression and will place an even number of elements in @F, if the regular expression doesn't match, @F will just contain one entry, the whole string. When numeric operators are applied to a list (@F in this case) the length is implicitly used, so we XOR with 1 to give 0 for the failing test cases and a positive integer for all others.


Charcoal, 26 21 bytes

⁼✂θ¹±¹¦¹⭆✂θ¹±¹¦³⁺⁺ι ι

Try it online! Link is to verbose version of code. Outputs a Charcoal boolean, - for a blurry string, nothing if not. Explanation:

  θ                     Input string
 ✂ ¹±¹¦¹                Slice off the first and last characters
⁼                       Is equal to
          θ             Input string
         ✂ ¹±¹¦³        Every other third character
        ⭆               Map over characters and join
                ⁺⁺ι ι   Wrap a space in that character
                        Implicitly print

Japt, 13 bytes

The empty string being truthy cost a couple of bytes :\

¶¬ë3 pUÌ ä+ ¸

Try it (includes all test cases)

¶¬ë3 pUÌ ä+ ¸     :Implicit input of string U
¶                 :Test for equality with
 ¬                :Split to an array
  ë3              :Take every 3rd element, starting with the first
     p            :Push
      UÌ          :  Last character of U
         ä+       :Consecutive pairs, reduced by concatenation
            ¸     :Join with spaces

Red, 52 51 bytes

func[a][s:[skip]parse a[opt[s any[copy t s" "t]s]]]

Try it online!


Jelly, 8 bytes


A monadic Link accepting a list of characters which yields 1 (blurry), or 0 (not blurry).

Try it online! Or see the test-suite.


m3żḊ$K⁼Ṗ - Link: list of characters, S
m3       - modulo-3-slice (S)
    $    - last two links as a monad (f(X)):
   Ḋ     -   remove the head (X)
  ż      -   zip together (X and that)
     K   - join with spaces
       Ṗ - remove the tail (S)
      ⁼  - equal?

JavaScript (Node.js), 29 bytes

s=>/^.((.) \2)*.$|^$/.test(s)

Try it online!

Pure port


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.