結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
36,892 KB
testcase_01 AC 48 ms
37,156 KB
testcase_02 AC 49 ms
37,204 KB
testcase_03 AC 49 ms
36,856 KB
testcase_04 AC 49 ms
36,916 KB
testcase_05 AC 49 ms
36,920 KB
testcase_06 AC 48 ms
37,144 KB
testcase_07 AC 52 ms
37,344 KB
testcase_08 AC 52 ms
37,204 KB
testcase_09 AC 53 ms
36,924 KB
testcase_10 AC 50 ms
36,772 KB
testcase_11 AC 49 ms
36,816 KB
testcase_12 AC 48 ms
36,624 KB
testcase_13 AC 49 ms
36,976 KB
testcase_14 AC 47 ms
37,104 KB
testcase_15 AC 47 ms
36,852 KB
testcase_16 AC 48 ms
36,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main{

    public static void main(String[] args) throws IOException{
                BufferedReader ir=new BufferedReader(new InputStreamReader(System.in,"UTF-8"));
		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){
			System.out.println(ss);
		}
	}
}
0