This code is written in C++ and for reasons that I don\'t quite understand it is written twice.
I would expect that after inputting a random char it would display the char once
It happens because cin.get() reads new-line character too. Try to press Enter without any symbols or type some string, like abc.
You need to handle it, e.g.:
while (letter = cin.get()) {
if (!isalpha(letter)) { continue; }
// handling user inputted alpha
}