I'm writing an algorithm that finds the first instance of each letter present in a string and then outputs each present letter in an alphabetical sequence.
For example: given the string "aaaaaaabbbbbbbbb" it would output "ab", and given the string "ddcaaaaahhhttt" it would output "acdht".
It seems to be having trouble giving a correct output; the print loop at the bottom giving "P<[random_character]". I assume it's a problem with how I'm assigning my values, but perhaps not? What am I doing wrong?