結果

問題 No.345 最小チワワ問題
ユーザー chiyoda
提出日時 2016-06-21 01:30:17
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 437 bytes
コンパイル時間 2,488 ms
コンパイル使用メモリ 74,316 KB
実行使用メモリ 41,620 KB
最終ジャッジ日時 2024-10-11 18:13:49
合計ジャッジ時間 7,343 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    int c = S.indexOf("c");
    if (c >= 0) {
      int w1 = S.indexOf("w", c + 1);
      if (w1 >= 0) {
        int w2 = S.indexOf("w", w1 + 1);
        if (w2 >= 0) {
          System.out.println(w2 - c +1);
          return;
        }
      }
    } 

    System.out.println(-1);
  }
}
0