#include #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; typedef unsigned long long ull; int main(){ string s;int m;cin>>s>>m; ull B=26; int cnt=0; rep(i,m){ string c;cin>>c; if(c.size()>s.size())continue; ull t=1; rep(j,c.size())t*=B; ull ah=0,bh=0; rep(j,c.size())ah=ah*B+(c[j]-'A'); rep(j,c.size())bh=bh*B+(s[j]-'A'); rep(j,s.size()-c.size()+1){ if(ah==bh)cnt++; if(j+c.size()