代码求调
查看原帖
代码求调
1356594
zhenghaoHoney楼主2024/8/23 15:23
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

string s,mx,mn;
int x,mx2,mn2;
int main(){
	while(cin>>s)
	{
		x=s.size();
		if(s[x-x+1]>='a'&&s[x-1]<='z'||s[x-1]>='A'&&s[x-1]<='Z')
		{
			mx2=max(x,mx2);
			mx=s;
			mn2=min(x,mn2);
			mn=s;		
		}
		else
		{
			if(mx2<x-1)
			{
				mx2=x-1;
				mx=s;
			}
			if(mn2>x-1)
			{
				mn2=x-1;
				mn=s;
			}
		}	
	} 
	cout<<mx<<endl<<mn;
	return 0;
}
2024/8/23 15:23
加载中...