/*
对于输入的每个字符串,查找其中的最大字母,在该字母后面插入字符串"(max)"。
样例输入
abcdefgfedcba
xxxxx
样例输出
abcdefg(max)fedcba
x(max)x(max)x(max)x(max)x(max)
*/
#include <stdio.h>
#include<string.h>
int main()
{
    int i;
    char str[100],maxch;
    gets(str);
    maxch=str[0];
    for(i=0;str[i]!='\0';i++){
        if(str[i]>maxch){
            maxch=str[i];
        }
    }
    for(i=0;str[i]!='\0';i++){
        printf("%c",str[i]);
        if(str[i]==maxch){
            printf("(max)");
        }
    }
    printf("\n");
    return 0;
}

 

相关文章:

  • 2021-11-09
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2022-01-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2022-12-23
  • 2022-03-08
  • 2022-12-23
相关资源
相似解决方案