why not better work it out an even more simple way... get your string's length and create an array of characters as long as the string, which will substitute your string in the rest of the program. This way you can compare your guess individually with each element in the array...
i don't know... maybe it can make things a bit more simple...