結果
| 問題 | 
                            No.346 チワワ数え上げ問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-02-26 22:33:24 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 321 bytes | 
| コンパイル時間 | 455 ms | 
| コンパイル使用メモリ | 57,916 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-22 14:10:32 | 
| 合計ジャッジ時間 | 7,706 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 13 WA * 9 TLE * 1 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main() {
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != 'c') {
			continue;
		}
		int nw = count(s.begin() + i, s.end(), 'w');
		ans += nw * (nw - 1) / 2;
	}
	cout << ans << endl;
	return 0;
}