S=gets.chomp # type: [s, i, i] v = (?a..?m).map{|x| [x, 0]}.zip(S.chars.group_by{|x| x}.map{|k, v| [k, v.size]}).map{|x| [x[0], x[1] || [x[0][0], 0]] }.map{|x| [x[0][0], x[0][1], x[1][1]] } if v.all?{|t| t[2] - t[1] == 1} then puts (?a..?m).to_a else r = v.find {|x| x[2] == 2} puts r ? r[0] : "Impossible" end