while True: try: s=input() l=[] dic={"abc":'2',"def":'3',"ghi":'4',"jkl":'5',"mno":'6',"pqrs":'7',"tuv":'8',"wxyz":'9'} for i in s: if i.isdigit(): l.append(i) elif i.isupper(): if i == 'Z': ...