結果

問題 No.342 一番ワロタww
ユーザー uafr_csuafr_cs
提出日時 2016-02-12 23:30:07
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 984 bytes
コンパイル時間 3,305 ms
コンパイル使用メモリ 78,796 KB
実行使用メモリ 57,848 KB
最終ジャッジ日時 2023-10-22 03:34:59
合計ジャッジ時間 5,982 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 112 ms
57,148 KB
testcase_02 AC 114 ms
57,380 KB
testcase_03 AC 109 ms
57,496 KB
testcase_04 AC 111 ms
57,500 KB
testcase_05 AC 116 ms
57,532 KB
testcase_06 AC 112 ms
57,328 KB
testcase_07 WA -
testcase_08 AC 114 ms
57,504 KB
testcase_09 AC 113 ms
57,492 KB
testcase_10 AC 112 ms
57,280 KB
testcase_11 AC 116 ms
57,508 KB
testcase_12 AC 114 ms
57,344 KB
testcase_13 AC 112 ms
57,244 KB
testcase_14 WA -
testcase_15 AC 113 ms
57,624 KB
testcase_16 AC 117 ms
57,236 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.next().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 = -1;
		
		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