結果
| 問題 | 
                            No.345 最小チワワ問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             RCCW
                         | 
                    
| 提出日時 | 2017-02-07 23:32:21 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 390 bytes | 
| コンパイル時間 | 1,725 ms | 
| コンパイル使用メモリ | 158,456 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-25 15:34:30 | 
| 合計ジャッジ時間 | 2,680 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 2 | 
| other | AC * 12 WA * 17 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void) {
	string s;
	cin >> s;
	bool flag = 0;
	int count = 0;
	int now;
	for (int i = 0; i < s.length(); ++i) {
		if (s[i] == 'c') {
			now=i;
			while (i < s.length()) {
				i++;
				if(s[i]=='w'&&count==0){
					count++;
				}else if(s[i]=='w'&&count==1){
					cout<<i-now<<endl;
					return 0;
				}
			}
		}
	}
	cout<<-1<<endl;
}
            
            
            
        
            
RCCW