結果
問題 | No.436 ccw |
ユーザー |
![]() |
提出日時 | 2018-01-31 23:21:37 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 426 bytes |
コンパイル時間 | 625 ms |
コンパイル使用メモリ | 59,356 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 00:01:12 |
合計ジャッジ時間 | 1,569 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; string s; int main(){ cin >> s; int cnt_c = 0, cnt_w = 0; for(int i=0, n = s.size(); i<n; ++i){ if(s[i] == 'c') cnt_c++; if(s[i] == 'w') cnt_w++; } if(cnt_c <= cnt_w){ cout << cnt_c-1 << endl; }else if(cnt_c > cnt_w){ cout << cnt_w << endl; } return 0; }