What have you set as end line marker in the Serial Monitor?
Are you sending \r\n ?
If so try to understand what it means to your code if you type a and send that
Into your code (which will receive ‘a’ ‘\r’ and ‘\n’ in a row, knowing that ‘\n’ is not > ‘e’)