結果
| 問題 | 
                            No.729 文字swap
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-09-21 21:24:06 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 527 bytes | 
| コンパイル時間 | 2,175 ms | 
| コンパイル使用メモリ | 76,628 KB | 
| 実行使用メモリ | 41,488 KB | 
| 最終ジャッジ日時 | 2024-09-19 03:08:30 | 
| 合計ジャッジ時間 | 4,739 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | WA * 11 | 
ソースコード
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] str = sc.next().split("");
        int from = sc.nextInt();
        int to = sc.nextInt();
        // 入れ替える文字を対比
        String fromStr = str[from];
        String toStr = str[to];
        // 文字入れ替え
        str[from] = toStr;
        str[to] = fromStr;
        String res = String.join(",", str);
        System.out.println(res);
    }
}