結果
問題 |
No.345 最小チワワ問題
|
ユーザー |
![]() |
提出日時 | 2017-09-29 10:12:12 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 356 bytes |
コンパイル時間 | 2,926 ms |
コンパイル使用メモリ | 74,408 KB |
実行使用メモリ | 41,480 KB |
最終ジャッジ日時 | 2024-11-15 19:47:40 |
合計ジャッジ時間 | 7,694 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 WA * 19 RE * 6 |
ソースコード
import java.util.Scanner; public class Main{ private static Scanner sc=new Scanner(System.in); public static void main(String args[])throws Exception{ String s=sc.nextLine(); s=s.substring(s.indexOf('c'),s.lastIndexOf('w')+1); if(s.lastIndexOf('w') == s.indexOf('w')){ System.out.println(-1); }else{ System.out.println(s.length()); } } }