import numpy as np MOD=998244353 def convolve(f,g): fft=np.fft.rfft ifft=np.fft.irfft Lf=len(f) Lg=len(g) L=Lf+Lg-1 fft_len=1<>15 gh=g>>15 def conv(f,g): return ifft(fft(f,fft_len)*fft(g,fft_len))[:L] # (ax+b)(cx+d)=acxx+(ad+bc)x+bd=acxx+{(a+b)(c+d)-(ac+bd)}x+bd x=conv(fl,gl)%MOD y=conv(fl+fh,gl+gh)%MOD z=conv(fh,gh)%MOD a,b,c=map(lambda x : (x+.5).astype(np.int64) ,[x,y,z]) return (a+((b-a-c)<<15)+(c<<30))%MOD MAX=3*(10**5)+10 fac=[1]*MAX ifac=[1]*MAX for i in range(2,MAX): fac[i]=fac[i-1]*i%MOD ifac[-1]=pow(fac[-1],MOD-2,MOD) for i in range(MAX-2,0,-1): ifac[i]=(i+1)*ifac[i+1]%MOD S=input() cnt=[0]*27 for s in S: cnt[ord(s)-ord('a')]+=1 poly=np.array([1],np.int64) for i in range(27): f=np.array([0]*(cnt[i]+1),np.int64) for j in range(cnt[i]+1): f[j]=ifac[j] poly=convolve(poly,f)[:len(S)+1] ans=0 for i in range(1,len(poly)): ans=(ans+poly[i]*fac[i])%MOD print(ans)