結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
57,500 KB
testcase_01 AC 138 ms
57,472 KB
testcase_02 AC 136 ms
57,408 KB
testcase_03 AC 136 ms
57,168 KB
testcase_04 AC 134 ms
57,416 KB
testcase_05 AC 134 ms
57,424 KB
testcase_06 AC 134 ms
57,456 KB
testcase_07 WA -
testcase_08 AC 133 ms
57,388 KB
testcase_09 WA -
testcase_10 AC 132 ms
57,236 KB
testcase_11 AC 133 ms
57,536 KB
testcase_12 AC 136 ms
57,176 KB
testcase_13 AC 133 ms
57,440 KB
testcase_14 AC 132 ms
57,428 KB
testcase_15 AC 134 ms
57,388 KB
testcase_16 AC 135 ms
57,404 KB
権限があれば一括ダウンロードができます

ソースコード

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;
			}
		}
		//System.out.println(max_length + " " + length);
		
		if(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