[Plain] Description
For each input string, find the maximum letter (maximum ASCII code) and insert the string "(max)" after the letter )".
Input
The input data includes multiple test instances. Each instance consists of a string of up to 100 characters in length. The string consists of only uppercase and lowercase letters.
Output
Each test instance outputs a line of strings. The output result is the result after the string "(max)" is inserted. If there are multiple largest letters, insert "(max)" after each maximum letter )".
Sample Input
Abcdefgedcba
Xxxxx
Sample Output
Abcdefg (max) fedcba
X (max)
Description
For each input string, find the maximum letter (maximum ASCII code) and insert the string "(max)" after the letter )".
Input
The input data includes multiple test instances. Each instance consists of a string of up to 100 characters in length. The string consists of only uppercase and lowercase letters.
Output
Each test instance outputs a line of strings. The output result is the result after the string "(max)" is inserted. If there are multiple largest letters, insert "(max)" after each maximum letter )".
Sample Input
Abcdefgedcba
Xxxxx
Sample Output
Abcdefg (max) fedcba
X (max)
[Plain] # include <stdio. h>
# Include <string. h>
Int main ()
{
Int I;
Int length;
Char max;
Char string [100];
While (gets (string )! = NULL)
{
Length = strlen (string );
Max = string [0];
For (I = 0; I <length; I ++)
{
If (string [I]> max)
{
Max = string [I];
}
}
For (I = 0; I <length; I ++)
{
Printf ("% c", string [I]);
If (max = string [I])
{
Printf ("(max )");
}
}
Printf ("\ n ");
}
Return 0;
}
# Include <stdio. h>
# Include <string. h>
Int main ()
{
Int I;
Int length;
Char max;
Char string [100];
While (gets (string )! = NULL)
{
Length = strlen (string );
Max = string [0];
For (I = 0; I <length; I ++)
{
If (string [I]> max)
{
Max = string [I];
}
}
For (I = 0; I <length; I ++)
{
Printf ("% c", string [I]);
If (max = string [I])
{
Printf ("(max )");
}
}
Printf ("\ n ");
}
Return 0;
}