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 Answer

Commonmark migration
Source Link

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

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

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

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
added 2 characters in body
Source Link
Jo King
  • 48.1k
  • 6
  • 130
  • 187

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 the same sectiondifferent 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

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 the same section 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

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
added explanation
Source Link
Jo King
  • 48.1k
  • 6
  • 130
  • 187

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 the same section 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

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 the same section of the circle, as defined by the first two characters.

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 the same section 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
Source Link
Jo King
  • 48.1k
  • 6
  • 130
  • 187
Loading

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