結果
| 問題 | 
                            No.345 最小チワワ問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             TatsuDX
                         | 
                    
| 提出日時 | 2016-09-03 14:49:58 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 456 bytes | 
| コンパイル時間 | 3,502 ms | 
| コンパイル使用メモリ | 74,132 KB | 
| 実行使用メモリ | 56,164 KB | 
| 最終ジャッジ日時 | 2024-11-15 18:40:13 | 
| 合計ジャッジ時間 | 8,179 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 15 WA * 14 | 
ソースコード
import java.util.Scanner;
public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a, b, c;
		a = s.indexOf("c");
		if (a < 0) {
			System.out.println(-1);
			return;
		}
		b = s.indexOf("w", a + 1);
		if (b < 0) {
			System.out.println(-1);
			return;
		}
		c = s.indexOf("w", b + 1);
		if (c < 0) {
			System.out.println(-1);
			return;
		}
		System.out.println(c - a + 1);
	}
}
            
            
            
        
            
TatsuDX