How can i fetch the different characters in a String

After that i can compare it with others and then maybe i can solve this problem