結果

問題 No.163 cAPSlOCK
ユーザー fal_rndfal_rnd
提出日時 2016-10-28 07:53:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 145 ms / 5,000 ms
コード長 442 bytes
コンパイル時間 2,310 ms
コンパイル使用メモリ 74,512 KB
実行使用メモリ 41,544 KB
最終ジャッジ日時 2024-05-03 07:08:08
合計ジャッジ時間 6,364 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
41,284 KB
testcase_01 AC 129 ms
41,280 KB
testcase_02 AC 131 ms
41,192 KB
testcase_03 AC 139 ms
41,176 KB
testcase_04 AC 134 ms
41,068 KB
testcase_05 AC 130 ms
41,544 KB
testcase_06 AC 131 ms
41,356 KB
testcase_07 AC 133 ms
41,372 KB
testcase_08 AC 138 ms
41,248 KB
testcase_09 AC 135 ms
41,076 KB
testcase_10 AC 116 ms
40,052 KB
testcase_11 AC 132 ms
41,300 KB
testcase_12 AC 127 ms
40,680 KB
testcase_13 AC 131 ms
41,164 KB
testcase_14 AC 130 ms
41,076 KB
testcase_15 AC 118 ms
40,088 KB
testcase_16 AC 134 ms
41,340 KB
testcase_17 AC 129 ms
41,036 KB
testcase_18 AC 131 ms
41,108 KB
testcase_19 AC 131 ms
41,260 KB
testcase_20 AC 129 ms
41,044 KB
testcase_21 AC 132 ms
41,088 KB
testcase_22 AC 145 ms
41,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.regex.*;
class A{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args){
		StringBuilder sb = new StringBuilder(101);
		Matcher m = Pattern.compile("([a-z]+|[A-Z]+)").matcher(s.next());
		while(m.find()){
			String st = m.group();
			if(st.matches("[a-z]+")){
				sb.append(st.toUpperCase());
			}else{
				sb.append(st.toLowerCase());
			}
		}
		System.out.println(sb);
	}
}
0