#include #include //#include using ll=long long; using lu=unsigned long long; #define rep(i,a,b) for(int i=a;i; using PD=pair; using PL=pair; using PH=pair; using PS=pair; int mod1=998244353; int mod2=1000000007; const ll INF = 5000000000000000000; const int big = 2147483647; ll N=1; struct st{ ll x,y,z; st(ll x=0,ll y=0,ll z=0):x(x),y(y),z(z){} bool operator>(const st &a) const { if (x != a.x) return x > a.x; if (y != a.y) return y > a.y; return z > a.z; } }; mt19937_64 rng(1644); ll mod=(1ll<<61)-1; int main(){//13:14 ll n=0,q,y=0,i=0,z=0,x=0,d=0,k=0,nk,sum=0; ll ans=INF,sum2=0,rs=-INF,cs=0,l=0,h=0,r=0; ll a=0,b=0,c=0,j=0,m=0,K=0; ll M=0,R,w,L; string s; cin>>s; N=s.size(); cin>>M; ll cnt=0; rep(i,0,M){ string t; cin>>t; n=t.size(); ll has=0; rep(j,0,t.size()){ (has*=26); (has+=(t[j]-'A')+1); } mod=1; while(n>0){ n--; mod*=26; } //cout<