結果

問題 No.163 cAPSlOCK
ユーザー papipenpapipen
提出日時 2017-03-24 14:25:49
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 477 bytes
コンパイル時間 2,511 ms
コンパイル使用メモリ 72,216 KB
実行使用メモリ 57,956 KB
最終ジャッジ日時 2023-09-20 05:41:30
合計ジャッジ時間 6,856 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,648 KB
testcase_01 AC 124 ms
55,976 KB
testcase_02 AC 125 ms
55,580 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 120 ms
56,136 KB
testcase_06 AC 122 ms
55,724 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 119 ms
55,820 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 124 ms
55,520 KB
testcase_20 WA -
testcase_21 AC 121 ms
55,648 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class Capslock{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String str1 = sc.next();
    String str2 = str1.toUpperCase();
    int c = str1.length();
    for(int i = 0; i < c; i++){
      String str3 = str1.substring(i,i+1);
      String str4 = str2.substring(i,i+1);
      if((str3).equals(str4)){
        str2 = str2.replaceFirst(str3,str3.toLowerCase());
      }
    }
    System.out.println(str2);
  }
}
0