結果

問題 No.163 cAPSlOCK
ユーザー ちよちゃんちよちゃん
提出日時 2016-05-25 14:11:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 5,000 ms
コード長 735 bytes
コンパイル時間 6,036 ms
コンパイル使用メモリ 75,200 KB
実行使用メモリ 41,460 KB
最終ジャッジ日時 2024-04-16 16:34:47
合計ジャッジ時間 8,922 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
41,080 KB
testcase_01 AC 128 ms
41,192 KB
testcase_02 AC 128 ms
41,196 KB
testcase_03 AC 143 ms
41,056 KB
testcase_04 AC 139 ms
41,132 KB
testcase_05 AC 119 ms
39,920 KB
testcase_06 AC 129 ms
41,060 KB
testcase_07 AC 139 ms
41,324 KB
testcase_08 AC 138 ms
41,088 KB
testcase_09 AC 137 ms
41,460 KB
testcase_10 AC 135 ms
41,076 KB
testcase_11 AC 132 ms
41,284 KB
testcase_12 AC 138 ms
41,224 KB
testcase_13 AC 138 ms
41,356 KB
testcase_14 AC 137 ms
41,264 KB
testcase_15 AC 135 ms
41,320 KB
testcase_16 AC 137 ms
41,388 KB
testcase_17 AC 135 ms
41,220 KB
testcase_18 AC 134 ms
41,280 KB
testcase_19 AC 130 ms
41,232 KB
testcase_20 AC 137 ms
41,000 KB
testcase_21 AC 134 ms
41,300 KB
testcase_22 AC 139 ms
41,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Yuki163 {
	
	public static void main(String[] args) {
		
		Scanner scan = new Scanner(System.in);
		String str = scan.next();
		scan.close();
		String[] strarr = str.split("");
		String bigEng = "[A-Z]";
		String smallEng = "[a-z]";
		Pattern p1 = Pattern.compile(bigEng);
		Pattern p2 = Pattern.compile(smallEng);
		
		for (int i = 0; i < strarr.length; i++ ){
			Matcher m = p1.matcher(strarr[i]);
			Matcher m1 = p2.matcher(strarr[i]);

			if(m.find()){
				strarr[i] = strarr[i].toLowerCase();
			}else if(m1.find()){
				strarr[i] = strarr[i].toUpperCase();
			}
		    System.out.print(strarr[i]);
		}
	}
}
0