結果

問題 No.436 ccw
ユーザー Elk
提出日時 2018-07-18 00:01:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 1,445 ms
コンパイル使用メモリ 166,088 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 13:55:21
合計ジャッジ時間 2,384 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    string str;
    int c_cnt = 0, w_cnt = 0, i;

    cin >> str;

    for(i = 0; i < str.size(); i++){
        if(str[i] == 'c'){
            c_cnt++;
        }else{
            w_cnt++;
        }
    }
    if(w_cnt >= c_cnt){
        cout << c_cnt - 1 << endl;
    }else{
        cout << w_cnt << endl;
    }

    return 0;
}
0