結果

問題 No.342 一番ワロタww
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-05-20 20:58:06
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 748 bytes
コンパイル時間 3,640 ms
コンパイル使用メモリ 76,272 KB
実行使用メモリ 56,516 KB
最終ジャッジ日時 2023-09-11 00:08:52
合計ジャッジ時間 6,992 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 121 ms
55,628 KB
testcase_02 AC 121 ms
55,720 KB
testcase_03 AC 120 ms
55,348 KB
testcase_04 AC 121 ms
55,484 KB
testcase_05 AC 122 ms
55,464 KB
testcase_06 AC 124 ms
55,724 KB
testcase_07 RE -
testcase_08 AC 125 ms
55,680 KB
testcase_09 AC 124 ms
55,736 KB
testcase_10 AC 126 ms
55,508 KB
testcase_11 AC 126 ms
55,592 KB
testcase_12 AC 124 ms
55,512 KB
testcase_13 AC 123 ms
55,432 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 124 ms
55,780 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.next();
		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