input = gets.chomp a = input.reverse puts a.gsub(/<|>/, '<' => '>', '>' => '<')