#include #include #include #include #include #define REP(i,n) for(int i=0;i -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 split5126(string str, string sep) { int s = 0, p = 0; vector 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; }