結果

問題 No.1469 programing
ユーザー ks2mks2m
提出日時 2021-04-09 21:22:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 387 ms / 3,000 ms
コード長 397 bytes
コンパイル時間 1,940 ms
コンパイル使用メモリ 72,488 KB
実行使用メモリ 106,780 KB
最終ジャッジ日時 2023-09-07 09:38:34
合計ジャッジ時間 6,630 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
56,216 KB
testcase_01 AC 111 ms
55,920 KB
testcase_02 AC 101 ms
55,668 KB
testcase_03 AC 105 ms
56,100 KB
testcase_04 AC 101 ms
56,228 KB
testcase_05 AC 121 ms
55,892 KB
testcase_06 AC 112 ms
56,092 KB
testcase_07 AC 109 ms
55,740 KB
testcase_08 AC 182 ms
56,256 KB
testcase_09 AC 187 ms
59,088 KB
testcase_10 AC 184 ms
58,424 KB
testcase_11 AC 200 ms
58,260 KB
testcase_12 AC 186 ms
58,896 KB
testcase_13 AC 99 ms
55,716 KB
testcase_14 AC 216 ms
59,208 KB
testcase_15 AC 191 ms
59,124 KB
testcase_16 AC 226 ms
57,456 KB
testcase_17 AC 387 ms
106,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		sc.close();

		StringBuilder sb = new StringBuilder();
		sb.append(s[0]);
		for (int i = 1; i < s.length; i++) {
			if (s[i - 1] != s[i]) {
				sb.append(s[i]);
			}
		}
		System.out.println(sb.toString());
	}
}
0