I suppose your "first" variable is of string type and not a char, try to use

Code:
 if(strcmp(first,"z")==0)
instead of just

Code:
if(first=="z")
....