結果

問題 No.436 ccw
ユーザー a01sa01to
提出日時 2024-08-12 00:20:52
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 539 bytes
コンパイル時間 2,820 ms
コンパイル使用メモリ 243,296 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-08-12 00:20:57
合計ジャッジ時間 4,094 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

int main() {
  string s;
  cin >> s;
  int cnt1 = 0, cnt2 = 0;
  rep(i, s.size()) {
    if (s[i] == 'c')
      cnt1++;
    else
      break;
  }
  for (int i = s.size() - 1; i >= 0; --i) {
    if (s[i] == 'w')
      cnt2++;
    else
      break;
  }
  cout << min(cnt1 - 1, cnt2) << endl;
  return 0;
}
0