結果
問題 |
No.342 一番ワロタww
|
ユーザー |
![]() |
提出日時 | 2016-02-12 22:39:04 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 842 bytes |
コンパイル時間 | 2,124 ms |
コンパイル使用メモリ | 78,904 KB |
実行使用メモリ | 54,564 KB |
最終ジャッジ日時 | 2024-09-22 04:44:27 |
合計ジャッジ時間 | 5,010 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 WA * 2 |
ソースコード
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 (ans.size() == 0) { System.out.println(); }else{ for(String s:ans) { System.out.println(s); } } } }