s = list(str(input())) from collections import Counter C = Counter(s) D = list(C.items()) D.sort(key=lambda x: x[1]) if len(D) != 7: print('Impossible') exit() for i in range(7): k, v = D[i] if i == 0: if v != 1: print('Impossible') exit() else: ans = k else: if v != 2: print('Impossible') exit() else: print(ans)