Skip to main content
added 863 characters in body
Source Link
att
  • 21.7k
  • 2
  • 16
  • 62

Wolfram Language (Mathematica), 3131 29 bytes

Attributes@f=Flat
a__~f~a__=f@af[a___,b__,b__,c___]=f[a,b,c]

Try it online!Try it online!

Input [characters...]. Return the characters of the reduced string, wrapped in f.

NonCommutativeMultiply (**) is a conveniently Flat undefined operator. Unfortunately, it needs to be Unprotected before we can add a definition. Try it online!

Wolfram Language (Mathematica), 31 bytes

Attributes@f=Flat
a__~f~a__=f@a

Try it online!

Input [characters...]. Return the characters of the reduced string, wrapped in f.

Wolfram Language (Mathematica), 31 29 bytes

f[a___,b__,b__,c___]=f[a,b,c]

Try it online!

Input [characters...]. Return the characters of the reduced string, wrapped in f.

NonCommutativeMultiply (**) is a conveniently Flat undefined operator. Unfortunately, it needs to be Unprotected before we can add a definition. Try it online!

Source Link
att
  • 21.7k
  • 2
  • 16
  • 62

Wolfram Language (Mathematica), 31 bytes

Attributes@f=Flat
a__~f~a__=f@a

Try it online!

Input [characters...]. Return the characters of the reduced string, wrapped in f.