step1_入门_ACM入门练习 查找最大元素

阅读 49

2022-02-11


​​http://acm.hdu.edu.cn/showproblem.php?pid=2025​​

#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int main(){
string str;
while(cin>>str){
char mx=str[0];
for(int i=1;i<str.length();i++){
mx=mx>str[i]?mx:str[i];
}
for(int i=0;i<str.length();i++){
cout<<str[i];
if(str[i]==mx){
cout<<"(max)";
}
}cout<<endl;
}
return 0;
}



相关推荐

精彩评论(0)

0 0 举报