結果
問題 | No.436 ccw |
ユーザー |
![]() |
提出日時 | 2016-10-28 22:26:40 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 214 ms / 2,000 ms |
コード長 | 600 bytes |
コンパイル時間 | 2,487 ms |
コンパイル使用メモリ | 74,564 KB |
実行使用メモリ | 45,952 KB |
最終ジャッジ日時 | 2024-11-24 05:44:43 |
合計ジャッジ時間 | 6,837 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
package no436;import java.util.Scanner;public class Main {public static void main(String[] args) {Scanner sc = new Scanner(System.in);String s = sc.next();int min = Integer.MAX_VALUE;int max = Integer.MIN_VALUE;for(int i=0;i<s.length()-2;i++) {if (s.substring(i, i+3).equals("ccw")) {min = Math.min(min, i);max = Math.max(max, i);}}if (min == Integer.MAX_VALUE) {System.out.println(0);}else{// System.out.println(max + 1);// System.out.println(s.length() - min - 2);System.out.println(Math.min(max + 1, s.length() - min - 2));}}}