#include #include #include #include #include #include using namespace std; int ans; int bm(string s, string t,int index) { int n = s.size(); int m = t.size(); map f; for (int i = 0; i= 0 && t[k] == s[p]) { k--; p--; } if (k == -1) { ans++; return p + 1; } else { if (f.find(s[p]) == f.end()) p += m; else p += max(f[s[p]], m - k); } } return -1; } int main() { string s; cin >> s; int m; cin >> m; for (int i = 0; i < m; i++) { string target; cin >> target; int index = 0; while (1) { index = bm(s, target, index); if (index == -1)break; index++; } } cout << ans << endl; return 0; }