結果

問題 No.342 一番ワロタww
ユーザー uafr_csuafr_cs
提出日時 2016-02-12 23:34:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 1,021 bytes
コンパイル時間 2,266 ms
コンパイル使用メモリ 78,752 KB
実行使用メモリ 41,532 KB
最終ジャッジ日時 2024-04-23 13:16:21
合計ジャッジ時間 5,294 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
41,132 KB
testcase_01 AC 147 ms
41,532 KB
testcase_02 AC 116 ms
40,948 KB
testcase_03 AC 109 ms
39,696 KB
testcase_04 AC 119 ms
41,100 KB
testcase_05 AC 115 ms
40,368 KB
testcase_06 AC 125 ms
40,748 KB
testcase_07 AC 111 ms
39,852 KB
testcase_08 AC 130 ms
41,164 KB
testcase_09 AC 114 ms
39,760 KB
testcase_10 AC 110 ms
40,236 KB
testcase_11 AC 119 ms
40,872 KB
testcase_12 AC 116 ms
41,288 KB
testcase_13 AC 122 ms
41,224 KB
testcase_14 AC 121 ms
40,684 KB
testcase_15 AC 122 ms
41,344 KB
testcase_16 AC 127 ms
41,328 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;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final String input = sc.nextLine().replaceFirst("^[[:space:]]+", "").replaceFirst("^w+", "");
		final Pattern pat = Pattern.compile("(([^w]+)(w+))");
		
		//System.out.println(input + " " + pat);
		final Matcher mat = pat.matcher(input);
		
		LinkedList<String> answer = new LinkedList<String>();
		int max_len = 0;
		
		while(mat.find()){
			final String in = mat.group(2);
			final int w_len = mat.group(3).length();
			
			if(max_len > w_len){ continue; }
			if(max_len < w_len){ max_len = w_len; answer.clear(); }
			
			answer.add(in);
		}
		
		if(answer.size() == 0){ System.out.println(); }
		else{
			for(final String ans : answer){
				System.out.println(ans);
			}
		}
		
	}

}
0