s = gets.chomp h = %w[< >].zip(%w[> <]).to_h puts s.each_char.map { |e| h[e] }.join.reverse