If you don't quite understand that and are skeptical as to whether it works, here is the algorithm in use in the output of a small program I just made.
Code:
Write a string to see how many letters in the alphabet it uses:
I love C++ programming!
You have 12 different letters in your string.
Write a string to see how many letters in the alphabet it uses:
I love C programming!
You have 12 different letters in your string.
Write a string to see how many letters in the alphabet it uses:
Hello World!
You have 7 different letters in your string.
Write a string to see how many letters in the alphabet it uses:
Supercalifragilisticexpialidocious
You have 15 different letters in your string.
Write a string to see how many letters in the alphabet it uses:
The quick brown fox jumps over the lazy dog!
You have 26 different letters in your string.
Write a string to see how many letters in the alphabet it uses: