結果

問題 No.342 一番ワロタww
ユーザー holegumaholeguma
提出日時 2016-02-18 22:52:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 52 ms / 5,000 ms
コード長 1,108 bytes
コンパイル時間 2,435 ms
コンパイル使用メモリ 78,500 KB
実行使用メモリ 37,356 KB
最終ジャッジ日時 2024-04-23 13:22:22
合計ジャッジ時間 3,493 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
37,220 KB
testcase_01 AC 49 ms
37,356 KB
testcase_02 AC 49 ms
37,076 KB
testcase_03 AC 49 ms
37,060 KB
testcase_04 AC 50 ms
37,012 KB
testcase_05 AC 50 ms
37,256 KB
testcase_06 AC 47 ms
37,208 KB
testcase_07 AC 48 ms
36,880 KB
testcase_08 AC 48 ms
37,176 KB
testcase_09 AC 47 ms
36,932 KB
testcase_10 AC 48 ms
37,032 KB
testcase_11 AC 48 ms
36,768 KB
testcase_12 AC 48 ms
36,772 KB
testcase_13 AC 50 ms
37,252 KB
testcase_14 AC 51 ms
37,216 KB
testcase_15 AC 52 ms
37,076 KB
testcase_16 AC 49 ms
36,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;

public class Main{

    static PrintWriter out;
    static BufferedReader ir;

    static void solve() throws IOException{
		String s=ir.readLine();
		ArrayList<String> ans=new ArrayList<>();
		ans.add("");
		int l=0,ma=0;
		while(l<s.length()&&s.charAt(l)=='w') l++;
		for(int i=l;i<s.length();i++){
			if(s.charAt(i)=='w'){
				int st=i;
				while(i<s.length()&&s.charAt(i)=='w') i++;
				if(i-st>ma){
					ma=i-st;
					ans.clear();
					ans.add(s.substring(l,st));
				}
				else if(i-st==ma) ans.add(s.substring(l,st));
				l=i--;
			}
		}
		for(String ss : ans){
			out.println(ss);
		}
	}

	public static void main(String[] args) throws Exception{
		ir=new BufferedReader(new InputStreamReader(System.in,"UTF-8"));
		out=new PrintWriter(System.out);
		solve();
		out.flush();
	}
}
0