0
点赞
收藏
分享

微信扫一扫

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

兽怪海北 2022-02-11 阅读 44


​​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 条评论