結果

問題 No.163 cAPSlOCK
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-22 22:39:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 426 bytes
コンパイル時間 2,495 ms
コンパイル使用メモリ 76,988 KB
実行使用メモリ 54,188 KB
最終ジャッジ日時 2024-04-10 10:31:25
合計ジャッジ時間 6,590 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
54,004 KB
testcase_01 AC 129 ms
53,904 KB
testcase_02 AC 128 ms
54,188 KB
testcase_03 AC 133 ms
54,032 KB
testcase_04 AC 132 ms
54,036 KB
testcase_05 AC 129 ms
53,840 KB
testcase_06 AC 129 ms
54,008 KB
testcase_07 AC 131 ms
53,976 KB
testcase_08 AC 132 ms
54,140 KB
testcase_09 AC 131 ms
53,840 KB
testcase_10 AC 131 ms
54,184 KB
testcase_11 AC 130 ms
53,960 KB
testcase_12 AC 130 ms
54,000 KB
testcase_13 AC 131 ms
53,944 KB
testcase_14 AC 132 ms
53,972 KB
testcase_15 AC 133 ms
53,948 KB
testcase_16 AC 132 ms
54,056 KB
testcase_17 AC 129 ms
54,156 KB
testcase_18 AC 130 ms
53,908 KB
testcase_19 AC 129 ms
54,080 KB
testcase_20 AC 131 ms
53,908 KB
testcase_21 AC 132 ms
54,068 KB
testcase_22 AC 131 ms
53,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String ans = "";
    for(int i = 0; i < s.length(); i++) {
      String c = String.valueOf(s.charAt(i));
      if(c.equals(c.toUpperCase())) {
        ans += c.toLowerCase();
      } else {
        ans += c.toUpperCase();
      }
    }
    System.out.println(ans);
  }
}
0