結果

問題 No.342 一番ワロタww
ユーザー holegumaholeguma
提出日時 2016-02-18 22:52:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,118 bytes
コンパイル時間 2,440 ms
コンパイル使用メモリ 78,176 KB
実行使用メモリ 53,600 KB
最終ジャッジ日時 2023-10-23 18:18:17
合計ジャッジ時間 4,223 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
53,600 KB
testcase_01 AC 54 ms
53,504 KB
testcase_02 AC 53 ms
51,544 KB
testcase_03 AC 56 ms
53,588 KB
testcase_04 AC 55 ms
52,516 KB
testcase_05 AC 55 ms
53,596 KB
testcase_06 AC 55 ms
53,596 KB
testcase_07 AC 54 ms
53,596 KB
testcase_08 AC 56 ms
53,584 KB
testcase_09 AC 56 ms
53,584 KB
testcase_10 AC 55 ms
53,596 KB
testcase_11 AC 56 ms
52,524 KB
testcase_12 AC 55 ms
52,520 KB
testcase_13 AC 55 ms
53,588 KB
testcase_14 AC 54 ms
53,588 KB
testcase_15 AC 55 ms
53,584 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

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++;
		ma=l-1;
		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