結果

問題 No.163 cAPSlOCK
ユーザー gomagoma
提出日時 2017-09-19 20:46:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 441 bytes
コンパイル時間 1,921 ms
コンパイル使用メモリ 74,684 KB
実行使用メモリ 54,428 KB
最終ジャッジ日時 2024-04-25 18:18:18
合計ジャッジ時間 5,274 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
52,716 KB
testcase_01 AC 101 ms
53,028 KB
testcase_02 AC 114 ms
54,120 KB
testcase_03 AC 106 ms
52,772 KB
testcase_04 AC 121 ms
54,168 KB
testcase_05 AC 104 ms
53,032 KB
testcase_06 AC 108 ms
53,560 KB
testcase_07 AC 118 ms
53,896 KB
testcase_08 AC 118 ms
54,132 KB
testcase_09 AC 111 ms
53,572 KB
testcase_10 AC 105 ms
53,060 KB
testcase_11 AC 114 ms
54,080 KB
testcase_12 AC 106 ms
52,800 KB
testcase_13 AC 120 ms
54,288 KB
testcase_14 AC 121 ms
53,872 KB
testcase_15 AC 110 ms
54,208 KB
testcase_16 AC 121 ms
54,236 KB
testcase_17 AC 116 ms
54,428 KB
testcase_18 AC 107 ms
53,568 KB
testcase_19 AC 112 ms
54,040 KB
testcase_20 AC 111 ms
54,216 KB
testcase_21 AC 111 ms
54,144 KB
testcase_22 AC 125 ms
54,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		char[] ans = new char[str.length()];

		for (int i = 0; i < str.length(); i++) {
			if (Character.isUpperCase(str.charAt(i))) {
				ans[i] = Character.toLowerCase(str.charAt(i));
			} else {
				ans[i] = Character.toUpperCase(str.charAt(i));
			}
			System.out.print(ans[i]);
		}
	}
}
0