結果
問題 |
No.342 一番ワロタww
|
ユーザー |
![]() |
提出日時 | 2016-02-18 22:49:49 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,116 bytes |
コンパイル時間 | 2,208 ms |
コンパイル使用メモリ | 78,848 KB |
実行使用メモリ | 50,608 KB |
最終ジャッジ日時 | 2024-09-22 12:07:58 |
合計ジャッジ時間 | 3,962 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 13 WA * 1 |
ソースコード
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.InputMismatchException; import java.util.NoSuchElementException; import java.math.BigInteger; public class Main{ static PrintWriter out; static BufferedReader ir; static void solve() throws IOException{ String s=ir.readLine(); ArrayList<String> ans=new ArrayList<>(); ans.add(""); int l=0,ma=0; while(l<s.length()&&s.charAt(l)=='w') l++; ma=l; for(int i=l;i<s.length();i++){ if(s.charAt(i)=='w'){ int st=i; while(i<s.length()&&s.charAt(i)=='w') i++; if(i-st>ma){ ma=i-st; ans.clear(); ans.add(s.substring(l,st)); } else if(i-st==ma) ans.add(s.substring(l,st)); l=i--; } } for(String ss : ans){ out.println(ss); } } public static void main(String[] args) throws Exception{ ir=new BufferedReader(new InputStreamReader(System.in,"UTF-8")); out=new PrintWriter(System.out); solve(); out.flush(); } }