結果

問題 No.342 一番ワロタww
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-05-20 21:05:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 755 bytes
コンパイル時間 1,871 ms
コンパイル使用メモリ 79,508 KB
実行使用メモリ 42,264 KB
最終ジャッジ日時 2024-04-23 13:37:28
合計ジャッジ時間 4,368 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
41,452 KB
testcase_01 AC 117 ms
41,596 KB
testcase_02 AC 112 ms
42,264 KB
testcase_03 AC 114 ms
41,540 KB
testcase_04 AC 101 ms
41,852 KB
testcase_05 AC 99 ms
41,696 KB
testcase_06 AC 113 ms
41,468 KB
testcase_07 AC 115 ms
41,928 KB
testcase_08 AC 102 ms
41,416 KB
testcase_09 AC 114 ms
41,444 KB
testcase_10 AC 113 ms
41,584 KB
testcase_11 AC 112 ms
42,056 KB
testcase_12 AC 98 ms
42,244 KB
testcase_13 AC 109 ms
41,640 KB
testcase_14 AC 107 ms
41,884 KB
testcase_15 AC 110 ms
41,544 KB
testcase_16 AC 111 ms
41,544 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);
		
		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