結果

問題 No.342 一番ワロタww
ユーザー uafr_csuafr_cs
提出日時 2016-02-12 22:35:00
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,366 bytes
コンパイル時間 4,270 ms
コンパイル使用メモリ 78,340 KB
実行使用メモリ 41,084 KB
最終ジャッジ日時 2023-10-22 03:14:51
合計ジャッジ時間 6,855 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
40,888 KB
testcase_01 WA -
testcase_02 AC 129 ms
40,972 KB
testcase_03 AC 126 ms
40,836 KB
testcase_04 AC 114 ms
39,764 KB
testcase_05 AC 128 ms
40,868 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 128 ms
41,084 KB
testcase_09 AC 129 ms
40,768 KB
testcase_10 AC 128 ms
40,972 KB
testcase_11 AC 128 ms
40,872 KB
testcase_12 AC 128 ms
40,984 KB
testcase_13 AC 130 ms
40,908 KB
testcase_14 AC 130 ms
40,956 KB
testcase_15 AC 129 ms
40,972 KB
testcase_16 AC 128 ms
40,992 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(max_length < length){
					answer.clear();
				}
				
				//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){
			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