結果

問題 No.436 ccw
ユーザー traindoggo
提出日時 2024-02-06 21:52:15
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 287 bytes
コンパイル時間 1,716 ms
コンパイル使用メモリ 193,212 KB
最終ジャッジ日時 2025-02-19 02:36:46
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  string s;
  cin >> s;

  int c{}, w{};
  for (int i = 0; i < (int)s.size(); ++i) {
    if (s[i] == 'c') c++;
    if (s[i] == 'w') w++;
  }

  if (c <= w) {
    cout << (c - 1) << endl;
  } else {
    cout << w << endl;
  }
}
0