結果

問題 No.163 cAPSlOCK
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-23 22:47:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 114 ms / 5,000 ms
コード長 578 bytes
コンパイル時間 3,499 ms
コンパイル使用メモリ 77,780 KB
実行使用メモリ 54,244 KB
最終ジャッジ日時 2024-04-20 00:03:00
合計ジャッジ時間 7,170 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
53,740 KB
testcase_01 AC 98 ms
52,900 KB
testcase_02 AC 107 ms
53,856 KB
testcase_03 AC 99 ms
53,108 KB
testcase_04 AC 106 ms
53,976 KB
testcase_05 AC 95 ms
52,908 KB
testcase_06 AC 103 ms
53,940 KB
testcase_07 AC 98 ms
53,004 KB
testcase_08 AC 104 ms
54,140 KB
testcase_09 AC 101 ms
53,948 KB
testcase_10 AC 103 ms
53,740 KB
testcase_11 AC 104 ms
53,804 KB
testcase_12 AC 104 ms
53,868 KB
testcase_13 AC 114 ms
54,244 KB
testcase_14 AC 111 ms
53,988 KB
testcase_15 AC 107 ms
53,852 KB
testcase_16 AC 108 ms
54,076 KB
testcase_17 AC 94 ms
52,720 KB
testcase_18 AC 105 ms
53,984 KB
testcase_19 AC 105 ms
54,200 KB
testcase_20 AC 104 ms
54,164 KB
testcase_21 AC 102 ms
54,100 KB
testcase_22 AC 96 ms
52,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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

    Scanner sc = new Scanner(System.in);

    String str = sc.next();
    char[] chars = new char[str.length()];
    String newStr;

    for(int n = 0; n < str.length(); n++){
      char c = str.charAt(n);
      if (Character.isUpperCase(c)){
        char newC = Character.toLowerCase(c);
        chars[n] = newC;
      }else{
        char newC = Character.toUpperCase(c);
        chars[n] = newC;
      }
    }

    newStr = new String(chars);
    System.out.println(newStr);
  }
}
0