CC • 1年前
#include <bits/stdc++.h>
using namespace std;
void change(string &s)
{
int n = s.length();
string tmp = "";
for (int i = 0; i < n; i++)
{
if (isalpha(s[i]))
{
tmp += s[i];
}
}
s = tmp;
}
int main()
{
string s, smx, smi;
int mx = -1, mi = 1000;
while (cin >> s)
{
change(s);
int n = s.length();
if (n > mx)
{
mx = n;
smx = s;
}
if (n < mi)
{
mi = n;
smi = s;
}
}
cout << smx << '\n' << smi;
return 0;
}
评论:
请先登录,才能进行评论