# 入力された値を文字列で受け取る input = gets(chomp: true) # 配列を反転させて出力 puts input.reverse