結果

問題 No.342 一番ワロタww
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-05-20 21:02:37
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 753 bytes
コンパイル時間 2,514 ms
コンパイル使用メモリ 76,108 KB
実行使用メモリ 56,056 KB
最終ジャッジ日時 2023-09-11 00:09:04
合計ジャッジ時間 5,205 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 123 ms
55,428 KB
testcase_02 AC 125 ms
55,520 KB
testcase_03 AC 124 ms
55,692 KB
testcase_04 AC 120 ms
55,728 KB
testcase_05 AC 124 ms
55,548 KB
testcase_06 AC 123 ms
55,924 KB
testcase_07 AC 125 ms
55,732 KB
testcase_08 AC 126 ms
55,564 KB
testcase_09 AC 124 ms
55,772 KB
testcase_10 AC 125 ms
55,512 KB
testcase_11 AC 126 ms
55,388 KB
testcase_12 AC 124 ms
55,740 KB
testcase_13 AC 123 ms
55,776 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 122 ms
55,440 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]+",0)));
		listB.remove(0);

		int max = Integer.MIN_VALUE;
		for (int i=0; i<listB.size(); i++) {
			if (listB.get(i).length() > max) {
				max = listB.get(i).length();
			}
		}
		
		if (listA.size()==0) {
			out.println(""); return;
		}
		
		for (int i=0; i<listA.size(); i++) {
			if (listB.get(i).length() == max) out.println(listA.get(i));
		}
	}
}
0