#include using namespace std; using ll = int64_t; using P = std::pair; const int INF = 1e8; int cnt(string &s, string &t) { int res = 0; for(int i = 0; i < s.size(); i++) { if(s[i] == t[0]) { bool dame = false; for(int j = 0; j < t.size(); j++) { if(s[i+j] != t[j]) { dame = true; break; } } if(!dame) { res++; } } } return res; } int main() { ios::sync_with_stdio(false); string S, C; int M; int ans = 0; cin >> S >> M; for(int i = 0; i < M; i++) { cin >> C; ans += cnt(S, C); } cout << ans << endl; }