#include<stdio.h>
#include<string.h>
int main()
{
char str[1000], max;
int i, a, t;
while( gets( str ) )
{
t = strlen( str );
max = str[0];
for( i = 0; i < t; i++ )
{
if( max < str[i] )
{
max = str[i];
}
}
for( i = 0; i < t; i++ )
{
printf( "%c", str[i] );
if( str[i]==max )printf( "(max)" );
}
puts( "" );
}
return 0;
}