exchange character


Submit solution

Points: 20
Time limit: 2.0s
Memory limit: 64M

Authors:
Problem type
Allowed languages
Java 19, Java 8

題目說明

請讓使用者輸入一字串,以及指定字串中第n1字元、n2字元,輸出n1、n2交換結果。

提示: 可使用substring函式

輸入

由鍵盤輸入一段文字s、一整數n1、一整數n2。 (n1, n2 皆小於等於字串長度,不需考量超出情況,且 n1 < n2)

輸出

n1、n2字元交換結果

sample input & output

輸入 輸出
DataSet1 HELLO 1 2 EHLLO
DataSet2 1234567 3 5 1254367
DataSet3 AaBbCcDdEe 3 10 AaebCcDdEB

Comments

There are no comments at the moment.