結果
| 問題 |
No.436 ccw
|
| コンテスト | |
| ユーザー |
れいん
|
| 提出日時 | 2024-11-17 01:19:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 378 bytes |
| コンパイル時間 | 2,105 ms |
| コンパイル使用メモリ | 191,904 KB |
| 最終ジャッジ日時 | 2025-02-25 05:03:01 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
string S;
cin >> S;
int N = S.size();
int c = 0;
int w = 0;
for (int i = 0; i < N; i++)
{
if (S[i] == 'c')
{
c++;
}
if (S[i] == 'w')
{
w++;
}
}
int ans = min(c - 1, w);
ans = max(ans, 0);
cout << ans;
}
れいん