結果

問題 No.342 一番ワロタww
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-05-20 21:07:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 753 bytes
コンパイル時間 2,326 ms
コンパイル使用メモリ 76,812 KB
実行使用メモリ 42,124 KB
最終ジャッジ日時 2024-04-23 13:37:44
合計ジャッジ時間 5,479 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
41,316 KB
testcase_01 AC 128 ms
41,680 KB
testcase_02 AC 131 ms
41,712 KB
testcase_03 AC 132 ms
41,624 KB
testcase_04 AC 131 ms
41,524 KB
testcase_05 AC 130 ms
41,304 KB
testcase_06 AC 131 ms
41,684 KB
testcase_07 AC 130 ms
41,584 KB
testcase_08 AC 133 ms
42,124 KB
testcase_09 AC 115 ms
41,876 KB
testcase_10 AC 130 ms
41,756 KB
testcase_11 AC 131 ms
41,520 KB
testcase_12 AC 127 ms
41,532 KB
testcase_13 AC 130 ms
41,112 KB
testcase_14 AC 128 ms
41,316 KB
testcase_15 AC 124 ms
41,748 KB
testcase_16 AC 116 ms
41,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import static java.lang.System.*;
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String s = sc.nextLine();
		s = s.replaceFirst("^w+","");
		s = s.replaceAll("[^w]+$","");
		
		List<String> listA = new LinkedList(Arrays.asList(s.split("w+")));
		List<String> listB = new LinkedList(Arrays.asList(s.split("[^w]+")));
		listB.remove(0);
		
		if (listB.size()==0) {
			out.println(""); return;
		}
		
		int max = Integer.MIN_VALUE;
		for (int i=0; i<listB.size(); i++) {
			if (listB.get(i).length() > max) {
				max = listB.get(i).length();
			}
		}
		
		for (int i=0; i<listA.size(); i++) {
			if (listB.get(i).length() == max) out.println(listA.get(i));
		}
	}
}
0