@Xiaotong is correct, you need to explicitly handle the shift keys, there is some more complete code here:
How to compare inputText to CorAns
But note that it is horribly old-fashioned and will only work on ASCII-style text (ie wouldn’t handle any special characters with accents, etc).