s = gets.chomp h = Hash.new(0) s.scan(/./){|i| h[i] += 1} j = 0 m = 0 h.each do |k,v| if v > 2 j += 2 elsif v == 1 j += 1 m = k end end if j == 1 puts m elsif puts "Impossible" end