結果

問題 No.1469 programing
ユーザー harurunharurun
提出日時 2021-04-03 12:23:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 429 ms / 3,000 ms
コード長 626 bytes
コンパイル時間 3,788 ms
コンパイル使用メモリ 71,688 KB
実行使用メモリ 95,240 KB
最終ジャッジ日時 2023-08-26 04:19:31
合計ジャッジ時間 8,059 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
55,972 KB
testcase_01 AC 116 ms
55,712 KB
testcase_02 AC 115 ms
55,620 KB
testcase_03 AC 118 ms
56,164 KB
testcase_04 AC 119 ms
55,664 KB
testcase_05 AC 130 ms
55,992 KB
testcase_06 AC 124 ms
56,372 KB
testcase_07 AC 129 ms
55,696 KB
testcase_08 AC 191 ms
57,140 KB
testcase_09 AC 213 ms
58,984 KB
testcase_10 AC 216 ms
56,672 KB
testcase_11 AC 238 ms
58,724 KB
testcase_12 AC 225 ms
59,432 KB
testcase_13 AC 118 ms
55,500 KB
testcase_14 AC 261 ms
58,948 KB
testcase_15 AC 244 ms
58,964 KB
testcase_16 AC 274 ms
60,012 KB
testcase_17 AC 429 ms
95,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.lang.String;
class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    String S;
    try{
      S=scan.next();
    }catch(Exception e){
      System.out.println();
      return;
    }
    int len=S.length();
    if(len<2){
      System.out.println(S);
      return;
    }
    StringBuilder ans=new StringBuilder();
    ans.append(S.charAt(0));
    char a=S.charAt(0);
    for(int i=1;i<len;i++){
      if(S.charAt(i)!=a){
        ans.append(S.charAt(i));
      }
      a=S.charAt(i);
    }
    System.out.println(ans.toString());
    return;
  }
}
0