2025一开始思路比较复杂,还想着把“(max)”插入字符串,然后就“烫烫烫”了,后面看了大佬们的答案,原来还有这么简单的方法,可恨我咋就没想到
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s;
while (cin >> s)
{
char ch[100];
strcpy(ch, s.c_str());
int len = s.length();
char max=ch[0];
for (int i = 0; i < len; i++)
{
if (ch[i] > max)
max = ch[i];
}
for (int i = 0; i < len; i++)
{
cout << ch[i];
if (ch[i] == max)
cout << "(max)";
}
cout << endl;
}
return 0;
}
2026.
#include <iostream>
#include <string>
using namespace std;
int main()
{
char ch[100];
string s;
while (gets(ch))
{
//strcpy(ch, s.c_str());
int len = strlen(ch);
for (int i = 0; i < len; i++)
{
if (i ==