結果

問題 No.345 最小チワワ問題
ユーザー FVRChan
提出日時 2017-09-29 10:12:55
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 360 bytes
コンパイル時間 2,301 ms
コンパイル使用メモリ 74,512 KB
実行使用メモリ 54,320 KB
最終ジャッジ日時 2024-11-15 19:47:47
合計ジャッジ時間 7,180 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 4 WA * 13 RE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

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.lastIndexOf('c'),s.lastIndexOf('w')+1);
		if(s.lastIndexOf('w') == s.indexOf('w')){
			System.out.println(-1);
		}else{
			System.out.println(s.length());
		}
	}
}
0