Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Is it double speak?

In an earlier challenge I asked code golfers to produce strings which copy each character in a string. For example:

TThhiiss iiss ddoouubbllee ssppeeaakk!!

This challenge is simply to detect if some text meets the definition of a double speak string.

  • There is an even number of characters.
  • When split into pairs, every pair consists of two of the same character.

The challenge

  • It's code golf, do it in few bytes.
  • Use any language you choose.
  • Please include a link to an online interpreter.
  • The code will accept some text.
  • For simplicity, the input will only consist of printable ASCII characters
  • It will return an indication of whether or not the input is double speak. It could be:
  • A boolean
  • Strings ('true', 'false', 'yes', 'no' etc)
  • Integers 0 or 1

Test Cases:

input -> output
aba -> false
aab -> false
abba -> false
aabb -> true
aaabb -> false
tthhiiss -> true
ttthhhiiisss -> false

Answer*

Draft saved
Draft discarded
Cancel
2
  • 1
    \$\begingroup\$ de-duplicate Try it online! \$\endgroup\$ Commented Aug 7, 2019 at 4:19
  • 1
    \$\begingroup\$ @mazzy Thanks! I was missing the $ before the statement block and couldn't figure out why it wasn't working. \$\endgroup\$ Commented Aug 7, 2019 at 12:37

AltStyle によって変換されたページ (->オリジナル) /