結果
| 問題 | 
                            No.342 一番ワロタww
                             | 
                    
| コンテスト | |
| ユーザー | 
                             matsuyoshi30
                         | 
                    
| 提出日時 | 2016-02-13 05:37:12 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,199 bytes | 
| コンパイル時間 | 2,135 ms | 
| コンパイル使用メモリ | 77,620 KB | 
| 実行使用メモリ | 56,212 KB | 
| 最終ジャッジ日時 | 2024-09-22 06:11:21 | 
| 合計ジャッジ時間 | 5,012 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | AC * 2 WA * 12 | 
ソースコード
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        int n = s.length();
        in.close();
        List<String> str = new ArrayList<String>();
        List<Integer> len = new ArrayList<Integer>();
        int max = 0;
        int i = 0;
        while(i < n) {
            int j = s.indexOf('w', i);
            if(j == -1) {
                break;
            } else if(j == 0) {
            } else {
                str.add(s.substring(i, j));
                i = j;
            }
            int temp = 0;
            while(i < n && s.charAt(i) == 'w') {
                temp++;
                i++;
            }
            if(j > 0) {
                len.add(temp);
                max = Math.max(max, temp);
            }
        }
        if(str.size() == 0) {
            System.out.println();
        } else {
            for(int j=0; j<str.size(); j++) {
                if(len.get(j) == max) {
                    System.out.println(str.get(j));
                }
            }
        }
    }
}
            
            
            
        
            
matsuyoshi30