12
1
I came upon this question, because it seems to be very common use-case to find unique characters in string. But what if we want to get rid of them?
Input contains only lower case alphabets. Only letters from a to z are used. Input length may be from 1 to 1000 characters.
Example:
input: helloworld
output: llool
Objective: Shortest code wins
Language: Any of the top 20 of TIOBE languages
+1. I naively thought I could take this thing with my Ruby answer. – Steven Rumbalski – 2012-10-11T14:27:08.753
i tried this on chinese text and it did not do the trick. =( – ixtmixilix – 2012-10-12T00:12:34.153
@ixtmixilix - then run perl with the
-CDS
option – mob – 2012-10-12T00:38:11.630@ixtmixilix I don't know enough about unicode and Perl's support of it to suggest a way to make it work with chinese text I'm afraid. Luckily for me the question says only lower case a to z. – Gareth – 2012-10-12T00:38:41.863
1Replace all the
$1
with$&
and you can lose a couple pairs of parentheses. – mob – 2012-10-12T00:39:01.410