while 1: a=b=input();i=0 while(a==b)*i<1:b=b.translate("?"*97+a);i+=1 print(i)