Two testcases are not passing

code https://ide.codingblocks.com/s/155166
Hackerblock https://hack.codingblocks.com/app/contests/987/p/193

Hi @harshkumar.877587
toupper takes an int and returns an int.
So if you pass an int that is ascii code for ‘a’ -‘z’ then it will return the ascii code for corresponding upper case ‘A’ - ‘Z’.
Otherwise it will return the same int.
Same for tolower()
Now the toupper() condition always gets true in case of invalid chars other than alphabets.
For ex if you take ch=9
toupper returns 9 i.e ch4 = 9 (ascii value)
and match gets correct and prints ‘U’.
You need to take care of that.
Try to use if
‘A’ <= ch <= ‘Z’ and ‘a’ <= ch <= ‘z’ conditions for upper and lower case respectively instead of toupper and tolower.

Hope it helps
Mark resolved if satisfied :slight_smile: