题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2025
会寝室不想看书,没事刷刷水题,嘿嘿。题目没什么好说的,写过了看看网上的代码觉得都差不多,稍稍修改下,直接贴上。
代码:
#include<stdio.h> #include<string.h> int main() { char max,str[101]; int len,i; while(~scanf("%s",str)) { len=strlen(str); max='a'; for(i=0;i<=len-1;i++) { if(str[i]>max) { max=str[i]; } } for(i=0;i<=len-1;i++) { printf("%c",str[i]); if(str[i]==max) { printf("(max)"); } } printf("\n"); } return 0; }