結果

問題 No.342 一番ワロタww
ユーザー matsuyoshi30matsuyoshi30
提出日時 2016-02-13 05:41:54
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,179 bytes
コンパイル時間 2,352 ms
コンパイル使用メモリ 77,852 KB
実行使用メモリ 57,904 KB
最終ジャッジ日時 2023-10-22 04:54:13
合計ジャッジ時間 5,114 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
57,648 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 129 ms
57,436 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

        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));
                }
            }
        }
    }
}
0