标签:
1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 #define N 105 6 char s[N]; 7 int main() 8 { 9 while(~scanf("%s", s)) 10 { 11 int len = strlen(s); 12 int d, max1 = -1; 13 for(int i = 0; i < len; i++) 14 { 15 if(s[i] >= max1) 16 { 17 max1 = s[i]; 18 d = i; //先找出最大元素的下标 19 } 20 } 21 for(int i = 0; i < len; i++) 22 { 23 printf("%c", s[i]); 24 //如果这个元素为最大元素,则还输出(max) 25 if(s[i] == max1) printf("(max)"); 26 } 27 printf("\n"); 28 } 29 return 0; 30 }
标签:
原文地址:http://www.cnblogs.com/loveprincess/p/4818066.html