while 1: s=input() while 1: f=0 for i in range(len(s)-1): if abs(ord(s[i])-ord(s[i+1]))==32: s=s[:i]+"**"+s[i+2:] f=1 t="" for c in s: if c!="*":t+=c s=t if f==0:break if s=="": print(1) else: print(0)