S = gets.chomp counter = Hash.new(0) S.chars.sort.each do |ch| counter[ch] += 1 end corrects = [] base = 'abcdefghijklm' base.chars.each do |ch| cand = (base + ch).chars.sort.join corrects << cand end ans = [] base.chars.each do |ch| t = (S + ch).chars.sort.join if corrects.include?(t) ans << ch end end if ans.empty? puts 'Impossible' else puts ans end