結果

問題 No.342 一番ワロタww
ユーザー GrenacheGrenache
提出日時 2016-02-13 00:29:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 1,180 bytes
コンパイル時間 3,211 ms
コンパイル使用メモリ 74,400 KB
実行使用メモリ 56,256 KB
最終ジャッジ日時 2023-08-05 16:08:17
合計ジャッジ時間 6,114 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
55,860 KB
testcase_01 AC 115 ms
55,676 KB
testcase_02 AC 117 ms
56,180 KB
testcase_03 AC 114 ms
55,920 KB
testcase_04 AC 112 ms
55,648 KB
testcase_05 AC 114 ms
56,216 KB
testcase_06 AC 113 ms
55,724 KB
testcase_07 AC 115 ms
56,232 KB
testcase_08 AC 111 ms
56,076 KB
testcase_09 AC 111 ms
55,812 KB
testcase_10 AC 117 ms
55,976 KB
testcase_11 AC 115 ms
55,940 KB
testcase_12 AC 115 ms
56,256 KB
testcase_13 AC 115 ms
55,640 KB
testcase_14 AC 114 ms
55,656 KB
testcase_15 AC 118 ms
55,460 KB
testcase_16 AC 117 ms
56,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


public class Main_yukicoder342 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.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){
//        		str.add(s.substring(i, n));
//        		len.add(0);
        		break;
        	} else if (j == 0) {
        	} else {
        		str.add(s.substring(i, j));
        		i = j;
        	}

        	int tmp = 0;
        	while (i < n && s.charAt(i) == 'w') {
        		tmp++;
        		i++;
        	}
        	if (j > 0) {
        		len.add(tmp);
        		max = Math.max(max, tmp);
        	}
        }

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

        sc.close();
    }
}
0