結果
問題 |
No.342 一番ワロタww
|
ユーザー |
![]() |
提出日時 | 2016-02-18 22:56:28 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 54 ms / 5,000 ms |
コード長 | 705 bytes |
コンパイル時間 | 2,212 ms |
コンパイル使用メモリ | 75,764 KB |
実行使用メモリ | 36,980 KB |
最終ジャッジ日時 | 2024-10-15 13:21:20 |
合計ジャッジ時間 | 3,802 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
import java.io.*; import java.util.*; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader ir=new BufferedReader(new InputStreamReader(System.in,"UTF-8")); 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++; 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){ System.out.println(ss); } } }