# 入力された値を文字列で受け取る # 1行目 str = gets.chomp # 2行目 a, b = gets.chomp.split.map { _1.to_i } str[a], str[b] = str[b], str[a] puts str