結果

問題 No.342 一番ワロタww
ユーザー ぴろずぴろず
提出日時 2016-02-12 22:39:04
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 842 bytes
コンパイル時間 2,139 ms
コンパイル使用メモリ 78,504 KB
実行使用メモリ 57,652 KB
最終ジャッジ日時 2023-10-22 03:15:52
合計ジャッジ時間 5,122 ms
ジャッジサーバーID
(参考情報)
judge14 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 126 ms
57,368 KB
testcase_02 AC 129 ms
57,336 KB
testcase_03 AC 127 ms
57,356 KB
testcase_04 AC 126 ms
57,404 KB
testcase_05 AC 127 ms
57,368 KB
testcase_06 AC 124 ms
57,160 KB
testcase_07 AC 127 ms
57,400 KB
testcase_08 AC 127 ms
57,368 KB
testcase_09 AC 130 ms
57,436 KB
testcase_10 AC 128 ms
57,344 KB
testcase_11 AC 128 ms
57,320 KB
testcase_12 AC 127 ms
55,324 KB
testcase_13 AC 127 ms
57,340 KB
testcase_14 WA -
testcase_15 AC 127 ms
57,168 KB
testcase_16 AC 125 ms
57,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no342;

import java.util.ArrayList;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

	public static final char kusa = 'w';
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Pattern p = Pattern.compile("[^w]+w*");
		Matcher m = p.matcher(sc.nextLine());
		int max = 0;
		ArrayList<String> ans = new ArrayList<>();
		while(m.find()) {
			String s = m.group();
			int count = 0;
			for(int i=0;i<s.length();i++) {
				if (s.charAt(i) == kusa) {
					count++;
				}
			}
			if (max <= count) {
				if (max < count) {
					ans.clear();
				}
				ans.add(s.substring(0,s.length()-count));
				max = count;
			}
		}
		if (ans.size() == 0) {
			System.out.println();
		}else{
			for(String s:ans) {
				System.out.println(s);
			}
		}
	}
}
0