>>700
Squeak Smalltalk で。

| str bag set |
str := 'Hello, world'.
bag := str asBag.
set := bag removeAllSuchThat: [:chr | (bag occurrencesOf: chr) = 1]; asSet.
^str inject: '' into: [:acc :chr |
  acc, ((set includes: chr) ifTrue: [set remove: chr. ''] ifFalse: [chr asString])]
"=> 'Hel, world' "