a = gets.chomp.split(//) h = {} a.uniq.each do |c| h[c] = a.count(c) end if h.values.count(2) == 6 puts h.key(1) else puts 'Impossible' end