結果

問題 No.163 cAPSlOCK
ユーザー HaleakalaHaleakala
提出日時 2018-02-18 18:40:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 657 bytes
コンパイル時間 2,946 ms
コンパイル使用メモリ 71,920 KB
実行使用メモリ 56,356 KB
最終ジャッジ日時 2023-09-12 16:36:31
合計ジャッジ時間 6,835 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
55,728 KB
testcase_01 AC 116 ms
56,088 KB
testcase_02 AC 118 ms
55,960 KB
testcase_03 AC 126 ms
56,052 KB
testcase_04 AC 124 ms
55,820 KB
testcase_05 AC 118 ms
55,776 KB
testcase_06 AC 116 ms
56,032 KB
testcase_07 AC 120 ms
56,356 KB
testcase_08 AC 121 ms
56,052 KB
testcase_09 AC 121 ms
55,748 KB
testcase_10 AC 117 ms
55,816 KB
testcase_11 AC 120 ms
55,548 KB
testcase_12 AC 122 ms
56,204 KB
testcase_13 AC 123 ms
56,084 KB
testcase_14 AC 122 ms
55,956 KB
testcase_15 AC 124 ms
55,776 KB
testcase_16 AC 126 ms
56,112 KB
testcase_17 AC 120 ms
56,304 KB
testcase_18 AC 119 ms
55,716 KB
testcase_19 AC 119 ms
56,180 KB
testcase_20 AC 121 ms
56,176 KB
testcase_21 AC 119 ms
55,828 KB
testcase_22 AC 126 ms
55,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Answer {
	public static void main(String str[]) {
        Scanner sc = new Scanner(System.in);

        String s = sc.nextLine();
        char[] chars = new char[s.length()];

        for(int i=0; i<s.length(); i++) {
        	char c = s.charAt(i);
        	if(Character.isUpperCase(c)) {
        		chars[i] = Character.toLowerCase(c);
        	} else if(Character.isLowerCase(c)) {
        		chars[i] = Character.toUpperCase(c);
        	} else {
        		chars[i] = c;
        	}
        }

        for(int i=0; i<s.length(); i++) {
        	System.out.print(chars[i]);
        }
        System.out.println();
	}
}
0