/* Akshit Chopra , BITS Pilani*/ #include using namespace std; #define endl '\n' #define spc ' ' #define pi 2*acos(0.0) #define sqr(a) (((a) * (a))) #define mpr make_pair #define fi first #define sc second #define pb push_back #define ffor(i,a,b) for( __typeof(b) i = a; i<=b ; ++i ) #define rfor(i,a,b) for( __typeof(b) i = a; i>=b ; --i ) #define min3(a,b,c) min(a,min(b,c)) #define max3(a,b,c) max(a,max(b,c)) #define count_one(a) __builtin_popcountll(a) #define isPower_2(a) (((a)&&(a-1)) == 0) #define sz(a) (int)(a.size()) #define all(c) (c).begin(),(c).end() #define allr(c) (c).rbegin(),(c).rend() #define loop(c,i) for(__typeof(c.begin()) i = c.begin(); i != c.end(); i++) #define loopr(c,i) for(__typeof(c.rbegin()) i = c.rbegin(); i != c.rend(); i++) #define UNIQUE(a) sort(all(a)), (a).erase(unique(all(a)),(a).end()) #define present(c,x) ((c).find(x) != (c).end()) #define cpresent(c,x) (find(all(c),x) != (c).end()) const int inf = 1e9; typedef long long LL; typedef vector vi; typedef vector >vpii; typedef vector vll; typedef vector > vpll; typedef pair pii; typedef pair pll; void io() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(15); } //Fast Reader // templateinline bool read(T &x){int c=getchar_unlocked();int sgn=1;while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar_unlocked();}for(x=0;~c&&'0'<=c&&c<='9';c=getchar_unlocked())x=x*10+c-'0'; x*=sgn; return ~c;} double tick(){static clock_t oldt;clock_t newt=clock();double diff=1.0*(newt-oldt)/CLOCKS_PER_SEC;oldt = newt;return diff;} LL mulmod(LL a,LL b, LL m){LL q=(LL)(((long double)a*(long double)b)/(long double)m);LL r=a*b-q*m;if(r>m)r%=m;if(r<0)r+=m;return r;}/* for TOO LARGE mod of the order 10^18 etc */ templateT mod(T a,T b){while(a < 0)a+=b ;return a%b ;} template T power(T e, T n, T m){T x=1,p=e;while(n){if(n&1)x=mod(x*p, m);p=mod(p*p, m);n>>=1;}return x;} template T power(T e,T n){T x=1,p=e;while(n){if(n&1)x=x*p;p=p*p;n>>=1;}return x;} template T InverseEuler(T a, T m){return (a==1? 1 : power(a, m-2, m));}/*use IFF m is a prime number */ templateinline T gcd(T a, T b){T c;while (b){ c = b;b = a % b;a = c;}return a;} template T lcm(T a, T b){return (a*(b/gcd(a,b)));} LL exEuclid(LL a,LL b,LL &x,LL &y) { if(a == 0) { x = 0 ; y = 1 ; return b ; } if(b == 0) { x = 1 ; y = 0 ; return a ; } LL x1,y1 ; LL g = exEuclid(b%a , a , x1,y1) ; x = y1 - (b/a)*x1 ; y = x1 ; return g ; // return gcd of a,b ; } // #define MAX 50005 // #define mod 1000000009 // bool sv[MAX] ; // //vector primes ; // void sieve() // { // sv[1] = 1 ; // sv[2] = 0 ; // for(LL i=3;i> h[i] ; string s ; cin >> s ; int ans = 0 ; for(int i = 0 ; i < s.length() ; i++){ ans = max(ans , h[s[i] - 'a' + 1]) ; } ans = ans*s.length() ; cout << ans << endl; return 0 ; }