結果

問題 No.1469 programing
ユーザー harurunharurun
提出日時 2021-04-03 17:24:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 441 ms / 3,000 ms
コード長 471 bytes
コンパイル時間 1,978 ms
コンパイル使用メモリ 71,688 KB
実行使用メモリ 93,988 KB
最終ジャッジ日時 2023-08-26 09:08:02
合計ジャッジ時間 6,811 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,664 KB
testcase_01 AC 117 ms
55,280 KB
testcase_02 AC 118 ms
55,548 KB
testcase_03 AC 120 ms
55,508 KB
testcase_04 AC 122 ms
56,028 KB
testcase_05 AC 129 ms
55,532 KB
testcase_06 AC 122 ms
55,776 KB
testcase_07 AC 131 ms
55,944 KB
testcase_08 AC 209 ms
56,892 KB
testcase_09 AC 218 ms
58,784 KB
testcase_10 AC 212 ms
56,732 KB
testcase_11 AC 243 ms
58,692 KB
testcase_12 AC 233 ms
56,860 KB
testcase_13 AC 117 ms
55,608 KB
testcase_14 AC 274 ms
59,068 KB
testcase_15 AC 252 ms
59,496 KB
testcase_16 AC 272 ms
59,064 KB
testcase_17 AC 441 ms
93,988 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=scan.next();
    int len=S.length();
    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