結果

問題 No.430 文字列検索
ユーザー はむ吉🐹
提出日時 2016-10-03 22:27:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1,989 ms / 2,000 ms
コード長 569 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 56,512 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-10 00:08:44
合計ジャッジ時間 12,448 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdlib>
#include <iostream>
#include <string>
#pragma GCC optimize ("-O3")


int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::string s;
    std::cin >> s;
    int m;
    std::cin >> m;
    long long answer = 0;
    for (auto i = 0; i < m; i++)
    {
        std::string c;
        std::cin >> c;
        auto pos = s.find(c, 0);
        while (pos != std::string::npos)
        {
            answer++;
            pos = s.find(c, pos + 1);
        }
    }
    std::cout << answer << std::endl;
    return EXIT_SUCCESS;
}
0