結果
| 問題 |
No.342 一番ワロタww
|
| コンテスト | |
| ユーザー |
ぴろず
|
| 提出日時 | 2016-02-13 00:44:26 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 131 ms / 5,000 ms |
| コード長 | 854 bytes |
| コンパイル時間 | 2,377 ms |
| コンパイル使用メモリ | 78,928 KB |
| 実行使用メモリ | 41,416 KB |
| 最終ジャッジ日時 | 2024-10-15 13:16:51 |
| 合計ジャッジ時間 | 5,124 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
package no342;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static final char kusa = 'w';
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Pattern p = Pattern.compile("[^w]+w*");
Matcher m = p.matcher(sc.nextLine());
int max = 0;
ArrayList<String> ans = new ArrayList<>();
while(m.find()) {
String s = m.group();
int count = 0;
for(int i=0;i<s.length();i++) {
if (s.charAt(i) == kusa) {
count++;
}
}
if (max <= count) {
if (max < count) {
ans.clear();
}
ans.add(s.substring(0,s.length()-count));
max = count;
}
}
if (max == 0 || ans.size() == 0) {
System.out.println();
}else{
for(String s:ans) {
System.out.println(s);
}
}
}
}
ぴろず