結果
| 問題 | No.430 文字列検索 | 
| コンテスト | |
| ユーザー |  ebicochineal | 
| 提出日時 | 2016-10-22 00:16:59 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1,907 ms / 2,000 ms | 
| コード長 | 1,652 bytes | 
| コンパイル時間 | 857 ms | 
| コンパイル使用メモリ | 73,956 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-11-10 00:11:25 | 
| 合計ジャッジ時間 | 13,568 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 14 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
typedef long long int LLI;
typedef unsigned long long int ULLI;
using namespace std;
string replace5126(string str, string old_s, string new_s) {
    int i;
    if (old_s == "") { return str; }
    while ((i = str.find(old_s)) > -1) { str.replace(i, old_s.size(), new_s); }
    return str;
}
int count5126(string str, string a) {
    int i = 0, cnt = 0;
    if (a == "") { return -1; }
    while ((i = str.find(a, i)) > -1) { ++cnt; i += a.size(); }
    return cnt;
}
int count5126_2(string str, string a) {
    int i = 0, cnt = 0; bool f = false;
    if (a == "") { return -1; }
    if (a.size() == 1) { return count(ALL(str), a[0]); }
    while ((i = str.find(a, i)) > -1) { ++cnt; i += 1; }
    return cnt;
}
vector<string> split5126(string str, string sep) {
    int s = 0, p = 0;
    vector<string> v;
    if (sep == "") {
        v.push_back(str);
        return v;
    }
    while ((p = str.find(sep, s)) > -1) {
        v.push_back(str.substr(s, p - s));
        s = p + sep.size();
    }
    v.push_back(str.substr(s, str.size()));
    return v;
}
string slice5126(string str, int a, int b) {
    int s = a < 0 ? str.size() + a : a;
    int e = b < 0 ? str.size() + b : b;
    e = b == 0 ? str.size() : e;
    return str.substr(s, (s > e ? s : e) - s);
}
int main() {
    string s, t; int ans = 0, m;
    cin >> s >> m;
    for (int i = 0; i < m; ++i) {
        cin >> t;
        ans += count5126_2(s, t);
    }
    cout << ans << endl;
    return 0;
}
            
            
            
        