結果

問題 No.342 一番ワロタww
ユーザー ぴろず
提出日時 2016-02-12 22:37:02
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 838 bytes
コンパイル時間 2,183 ms
コンパイル使用メモリ 78,684 KB
実行使用メモリ 54,308 KB
最終ジャッジ日時 2024-09-22 04:43:55
合計ジャッジ時間 4,943 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 3
権限があれば一括ダウンロードができます

ソースコード

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.next());
		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