結果

問題 No.163 cAPSlOCK
ユーザー YamaKasaYamaKasa
提出日時 2018-04-19 15:47:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 667 bytes
コンパイル時間 2,316 ms
コンパイル使用メモリ 72,024 KB
実行使用メモリ 56,344 KB
最終ジャッジ日時 2023-09-09 11:42:00
合計ジャッジ時間 6,682 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,452 KB
testcase_01 AC 118 ms
55,652 KB
testcase_02 AC 117 ms
55,808 KB
testcase_03 AC 130 ms
55,844 KB
testcase_04 AC 126 ms
55,784 KB
testcase_05 AC 117 ms
55,856 KB
testcase_06 AC 118 ms
55,404 KB
testcase_07 AC 127 ms
55,480 KB
testcase_08 AC 130 ms
55,492 KB
testcase_09 AC 123 ms
56,344 KB
testcase_10 AC 119 ms
55,596 KB
testcase_11 AC 116 ms
55,720 KB
testcase_12 AC 122 ms
55,668 KB
testcase_13 AC 124 ms
55,644 KB
testcase_14 AC 125 ms
55,444 KB
testcase_15 AC 124 ms
55,816 KB
testcase_16 AC 127 ms
55,508 KB
testcase_17 AC 120 ms
55,616 KB
testcase_18 AC 119 ms
55,732 KB
testcase_19 AC 116 ms
55,404 KB
testcase_20 AC 119 ms
55,832 KB
testcase_21 AC 114 ms
55,844 KB
testcase_22 AC 128 ms
55,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		//System.out.println("パスワード");
		Scanner scanner = new Scanner(System.in);
		String pw = scanner.next();
		scanner.close();
		String[] pw_1 = new String[pw.length()];
		for(int i = 0; i < pw.length(); i++) {
			String c = pw.substring(i,i+1);
			if( c.matches("[A-Z]{1}")) {
				pw_1[i] = c.toLowerCase();
			}else if(c.matches("[a-z]{1}")) {
				pw_1[i] = c.toUpperCase();
			}else {
				//System.out.println("無効な文字列です");
				//System.exit(1);
			}
		}
		for( int i = 0; i < pw.length(); i++) {
			String s = pw_1[i];
			System.out.print(s);
		}
	}
}
0