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

Return to Revisions

4 of 4
Commonmark migration

Perl 6, 46 bytes

{!/[(.).*]**4<?{[+^] 0ドル Xeq[...] ~<<0ドル[^2]}>/}

Try it online!

A regex solution that finds if there are four characters in the string such that the two later characters are in different sections of the circle, as defined by the first two characters.

Explanation

{ } # Anonymous code block returning
 !/ / # If the input does not match
 [(.).*]**4 # Any 4 characters
 <?{ } # Where
 [...] # The range from
 ~<<0ドル[^2] # The first character to the second
 Xeq # Contains which of 
 0ドル # The four characters
 [+^] # Reduce the list of booleans by xor
 # Effectively, if only one of the 3rd or 4th character is in that range
Jo King
  • 48.1k
  • 6
  • 130
  • 187

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