#include using namespace std; #define ALL(a) (a).begin(),(a).end() #define ALLR(a) (a).rbegin(),(a).rend() #define spa << " " << #define test cout<<"test"<= (ll)(m); i--) typedef long long ll; typedef long double ld; const ll MOD = 1e9+7; //const ll MOD = 998244353; const ll INF = 1e18; using P = pair; template void chmin(T &a,T b){if(a>b)a=b;} template void chmax(T &a,T b){if(a void ans(bool x,T1 y,T2 z){if(x)cout<>v,ll h,ll w){for(ll i=0;iv,ll h,ll w){for(ll i=0;iv,ll n){cout<>vec(ll x, ll y, ll w){ vector>v(x,vector(y,w));return v;} ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;} //m.emplace(x,0).fi->se++; template struct RollingHash{ vector hash,p; RollingHash(string s){ ll n = (ll)s.size(); hash.assign(n+1,0); p.assign(n+1,1); for(ll i=0;i; string s;cin>>s; RH rh(s); ll d=s.size(); ll n;cin>>n; vectort(n); rep(i,0,n)cin>>t[i]; rep(i,0,n){ RH rh_tmp(t[i]); ll m=t[i].size()-1; buf=rh_tmp.get(0,0+m); rep(j,0,d-m){ if(rh.get(j,j+m)==buf){ res++; } } } cout<