#include using namespace std; int f(string s, string t) { int p = 0, cnt = 0; while (1) { p = s.find(t); if (p >= 0) { ++cnt; s.erase(0, p+1); } else { break; } } return cnt; } int main() { string s, t; int ans = 0, m; cin >> s >> m; for (int i = 0; i < m; ++i) { cin >> t; ans += f(s, t); } cout << ans << endl; return 0; }