結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
53,536 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 55 ms
53,592 KB
testcase_15 AC 55 ms
53,596 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;
		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++;
				l=i;
				if(i-st+1>ma){
					ma=i-st+1;
					ans.clear();
					ans.add(s.substring(l,st));
				}
				else if(i-st+1==ma) ans.add(s.substring(l,st));
			}
		}
		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