結果

問題 No.1643 Not Substring
ユーザー ks2mks2m
提出日時 2021-08-13 21:23:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 2,719 ms
コンパイル使用メモリ 75,004 KB
実行使用メモリ 54,304 KB
最終ジャッジ日時 2024-04-14 19:23:54
合計ジャッジ時間 6,857 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
54,148 KB
testcase_01 AC 129 ms
54,100 KB
testcase_02 AC 130 ms
53,980 KB
testcase_03 AC 130 ms
54,152 KB
testcase_04 AC 130 ms
54,016 KB
testcase_05 AC 130 ms
54,228 KB
testcase_06 AC 132 ms
53,836 KB
testcase_07 AC 130 ms
54,220 KB
testcase_08 AC 128 ms
54,180 KB
testcase_09 AC 131 ms
54,040 KB
testcase_10 AC 128 ms
54,116 KB
testcase_11 AC 129 ms
54,008 KB
testcase_12 AC 128 ms
54,192 KB
testcase_13 AC 128 ms
53,936 KB
testcase_14 AC 131 ms
54,148 KB
testcase_15 AC 128 ms
53,728 KB
testcase_16 AC 129 ms
54,304 KB
testcase_17 AC 129 ms
54,000 KB
testcase_18 AC 129 ms
54,196 KB
testcase_19 AC 130 ms
53,920 KB
testcase_20 AC 131 ms
54,132 KB
testcase_21 AC 128 ms
54,268 KB
testcase_22 AC 137 ms
54,196 KB
testcase_23 AC 127 ms
53,828 KB
testcase_24 AC 130 ms
54,120 KB
testcase_25 AC 128 ms
53,992 KB
testcase_26 AC 127 ms
53,876 KB
testcase_27 AC 129 ms
54,200 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();

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