結果
| 問題 | 
                            No.342 一番ワロタww
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ぴろず
                         | 
                    
| 提出日時 | 2016-02-12 22:32:00 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 772 bytes | 
| コンパイル時間 | 2,122 ms | 
| コンパイル使用メモリ | 75,792 KB | 
| 実行使用メモリ | 56,160 KB | 
| 最終ジャッジ日時 | 2024-09-22 04:42:23 | 
| 合計ジャッジ時間 | 5,030 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 11 WA * 3 | 
ソースコード
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;
			}
		}
		for(String s:ans) {
			System.out.println(s);
		}
	}
}
            
            
            
        
            
ぴろず