結果

問題 No.342 一番ワロタww
ユーザー uafr_csuafr_cs
提出日時 2016-02-12 22:42:20
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,544 bytes
コンパイル時間 2,363 ms
コンパイル使用メモリ 78,692 KB
実行使用メモリ 57,608 KB
最終ジャッジ日時 2023-10-22 03:16:39
合計ジャッジ時間 5,536 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
57,444 KB
testcase_01 WA -
testcase_02 AC 133 ms
57,208 KB
testcase_03 AC 137 ms
57,152 KB
testcase_04 WA -
testcase_05 AC 129 ms
57,440 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 132 ms
57,428 KB
testcase_09 WA -
testcase_10 AC 131 ms
57,216 KB
testcase_11 AC 132 ms
55,424 KB
testcase_12 AC 134 ms
57,476 KB
testcase_13 WA -
testcase_14 AC 133 ms
55,600 KB
testcase_15 AC 132 ms
57,564 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		char[] inputs = sc.next().toCharArray();
		
		int max_length = 0;
		
		int start = 0;
		int length = 0;
		LinkedList<String> answer = new LinkedList<String>();
		
		for(int i = 0; i < inputs.length; i++){
			if(inputs[i] == 'w'){
				length++;
			}else if(length != 0){
				if(start + length >= i){ start = i; length = 0; continue; }
				//System.out.println(":" + length);
				
				if(max_length < length){
					answer.clear();
				}else if(max_length > length){
					continue;
				}
				
				//System.out.println(i);
				{
					StringBuilder sb = new StringBuilder();
					for(int j = start; j < (i - length); j++){
						sb.append(inputs[j]);
					}
					
					if(!sb.toString().equals("")){
						answer.add(sb.toString());
					}
				}
				
				
				max_length = length;
				start = i;
				length = 0;
			}
		}
		
		if(max_length != 0 && length != 0 && max_length <= length){
			if(max_length < length){ answer.clear(); }
			
			StringBuilder sb = new StringBuilder();
			for(int j = start; j < (inputs.length - length); j++){
				sb.append(inputs[j]);
			}
			if(!sb.toString().equals("")){
				answer.add(sb.toString());
			}
		}
		
		if(answer.size() == 0){
			System.out.println();
		}else{
			for(final String str : answer){
				System.out.println(str);
			}
		}
	}

}
0