結果

問題 No.345 最小チワワ問題
ユーザー FVRChanFVRChan
提出日時 2017-09-29 10:12:55
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 360 bytes
コンパイル時間 2,300 ms
コンパイル使用メモリ 74,828 KB
実行使用メモリ 56,024 KB
最終ジャッジ日時 2024-04-27 16:14:04
合計ジャッジ時間 7,984 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
53,976 KB
testcase_01 AC 141 ms
54,352 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 139 ms
53,884 KB
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 142 ms
54,100 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 130 ms
54,196 KB
testcase_21 RE -
testcase_22 AC 132 ms
54,180 KB
testcase_23 RE -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 RE -
testcase_29 WA -
testcase_30 WA -
testcase_31 RE -
権限があれば一括ダウンロードができます

ソースコード

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