結果

問題 No.163 cAPSlOCK
ユーザー goma
提出日時 2017-09-19 20:46:02
言語 Java
(openjdk 23)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 441 bytes
コンパイル時間 2,371 ms
コンパイル使用メモリ 75,144 KB
実行使用メモリ 41,452 KB
最終ジャッジ日時 2024-11-08 05:45:30
合計ジャッジ時間 6,353 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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