S = input() _set = set(S) can_pair = len(_set) == 7 ans = "Impossible" if can_pair: chars = {} for s in _set: cnt = S.count(s) if cnt > 2: break chars[s] = cnt else: ans = min(chars.items(),key=lambda x:x[1])[0] print(ans)