= Python Challenge -- Level 2 -- Native Solution = ==== Code ==== {{{ #!d import tango.io.Stdout; void main () { char[] text = ""; size_t[char[]] quantity; foreach (char letter; text) quantity["" ~ letter] += 1; foreach (char letter; text) if (quantity[""~letter] == 1) Stdout.print(key); Stdout.flush(); } }}} ==== Explanation ==== {{{ #!d char[] text = ""; }}} The source text from the challenge page should be put between the quotes. {{{ #!d size_t[char[]] quantity; }}} An associative array is the easiest way to store information on each individual character. {{{ #!d foreach (inout char letter; text) }}} The code is executed for every character. {{{ #!d quantity["" ~ letter]++; }}} Increment the counter for the number of occurences of the current character. The concatenation is a workaround for the lack of implicit conversion between char and char![]. {{{ #!d foreach (char letter; text) }}} Go again through all the text. The code is executed once for each character. {{{ #!d if (quantity[letter] == 1) }}} We only want characters that only were in the source text once. {{{ #!d Stdout.print(key); Stdout.flush(); }}} Print the character to the screen, flushing upon completion.