結果

問題 No.436 ccw
ユーザー tenkyu9
提出日時 2018-03-18 07:20:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 779 ms
コンパイル使用メモリ 80,596 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 21:07:37
合計ジャッジ時間 1,804 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<climits>
using namespace std;
typedef long long int ll;

int main(){

	int c=0, w=0;
	bool flag=true;
	string s;
	cin >> s;
	for(int i=0; i<s.size(); i++){
		if(s[i]=='w') flag=false;
		if(flag){
			c++;
		} else {
			w++;
		}
	}
	if(c<=w){
		cout << c-1 << endl;
	} else {
		cout << w << endl;
	}
  
  return 0;
}
0