結果

問題 No.163 cAPSlOCK
ユーザー matsuyoshi30matsuyoshi30
提出日時 2016-01-01 13:48:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 175 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 2,502 ms
コンパイル使用メモリ 77,216 KB
実行使用メモリ 58,488 KB
最終ジャッジ日時 2023-10-19 13:01:44
合計ジャッジ時間 7,159 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 166 ms
58,216 KB
testcase_01 AC 170 ms
58,120 KB
testcase_02 AC 169 ms
58,384 KB
testcase_03 AC 171 ms
58,380 KB
testcase_04 AC 173 ms
58,372 KB
testcase_05 AC 169 ms
58,136 KB
testcase_06 AC 169 ms
58,392 KB
testcase_07 AC 169 ms
58,416 KB
testcase_08 AC 169 ms
58,488 KB
testcase_09 AC 170 ms
56,268 KB
testcase_10 AC 167 ms
56,296 KB
testcase_11 AC 166 ms
58,380 KB
testcase_12 AC 167 ms
58,212 KB
testcase_13 AC 164 ms
58,328 KB
testcase_14 AC 165 ms
58,348 KB
testcase_15 AC 175 ms
56,512 KB
testcase_16 AC 170 ms
58,388 KB
testcase_17 AC 170 ms
58,352 KB
testcase_18 AC 168 ms
58,172 KB
testcase_19 AC 170 ms
58,380 KB
testcase_20 AC 166 ms
58,352 KB
testcase_21 AC 168 ms
58,336 KB
testcase_22 AC 167 ms
58,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Caps {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.next();
        int n = str.length();
        String caps = "";
        for(int i = 0; i < n; i++) {
            if(Character.isUpperCase(str.charAt(i))) {
                caps += Character.toLowerCase(str.charAt(i));
            } else {
                caps += Character.toUpperCase(str.charAt(i));
            }
        }
        System.out.println(caps);
    }
}
0