from itertools import groupby s = input() freq = [len(list(group)) for key, group in groupby(s)] num2 = len(list(filter(lambda x :x==2,freq))) if num2==6: print(list(filter(lambda x: x == 1, freq))[0]) else: print("Impossible")