while 1: t=input();r=1 for _ in t:t=[min(x,t[ord(x)-97])for x in t] while any(r%t.count(x)for x in t):r+=1 print(r)