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 fac=[1,1] inv=[1,1] ifac=[1,1] for i in range(2,3*(10**5)): fac.append(fac[-1]*i%MOD) inv.append(MOD-MOD//i*inv[MOD%i]%MOD) ifac.append(ifac[-1]*inv[i]%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]*(len(S)+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(S)+1): ans=(ans+poly[i]*fac[i])%MOD print(ans)