Skip to main content
deleted 9 characters in body
Source Link
Neil
  • 177.2k
  • 12
  • 74
  • 281

Retina 0.8.2, 2929 23 bytes

^
aaabbbbac$
O`c|..¶aaabbbbac
cc|(D`c|..)\1
1A`

Try it online!Try it online! Link includes test cases. Explanation:

^$
aaabbbbac¶aaabbbbac

AddAppend another copy of the whole list on a separate line.

O`c|D`c|..

Sort theRemove duplicate elements from the copy.

cc|(..)\1
1A`

Delete duplicates. Fortunately it's not possible to match at an odd positionRemove the original input.

Retina 0.8.2, 29 bytes

^
aaabbbbac
O`c|..
cc|(..)\1

Try it online! Link includes test cases. Explanation:

^
aaabbbbac

Add another copy of the whole list.

O`c|..

Sort the elements.

cc|(..)\1

Delete duplicates. Fortunately it's not possible to match at an odd position.

Retina 0.8.2, 29 23 bytes

$
¶aaabbbbac
D`c|..
1A`

Try it online! Link includes test cases. Explanation:

$
¶aaabbbbac

Append another copy of the whole list on a separate line.

D`c|..

Remove duplicate elements from the copy.

1A`

Remove the original input.

Source Link
Neil
  • 177.2k
  • 12
  • 74
  • 281

Retina 0.8.2, 29 bytes

^
aaabbbbac
O`c|..
cc|(..)\1

Try it online! Link includes test cases. Explanation:

^
aaabbbbac

Add another copy of the whole list.

O`c|..

Sort the elements.

cc|(..)\1

Delete duplicates. Fortunately it's not possible to match at an odd position.