The challenge: The shortest code, by character count, that detects and removes duplicate characters in a String. Removal includes ALL instances of the duplicated character (so if you find 3 n's, all three have to go), and original character order needs to be preserved.
Example Input 1:
nbHHkRvrXbvknExample Output 1:
RrX
Example Input 2:
nbHHkRbvnrXbvknExample Output 2:
RrX
(the second example removes letters that occur three times; some solutions have failed to account for this)
(This is based on my other question where I needed the fastest way to do this in C#, but I think it makes good Code Golf across languages.)
Javascript 1.8
or alternately- similar to the python example:
Ruby —
61 53 51 563561 chars, the ruler says. (Gives me an idea for another code golf...)
... 35 by Nakilon
TCL
123 chars. It might be possible to get it shorter, but this is good enough for me.
Scala
54 chars for the method body only, 66 with (statically typed) method declaration:
C# (53 Characters)
Where s is your input string:
Or 59 with re-assignment:
another APL solution
As a dynamic function (18 charachters)
line assuming that input is in variable x (16 characters):