“ correct answer ” .

C2024010 2024-07-20 11:18:54 2024-07-20 11:20:36

#include<bits/stdc++.h>

using namespace std;

int main() {

string s;

long long cnt,maxn=0,minn=1e100,Location_min,Location_max;

getline(cin,s);

for(int i=0;i<s.size();i++){

	if(s[i]==' '){

		if(cnt>maxn){

			maxn=cnt;

			Location_max=i-cnt+1;

		}

		if(cnt<minn){

			minn=cnt;

			Location_min=i-cnt;

		}

		cnt=0;


	}
	cnt++;


}
for(int i=Location_max;s[i]!=' ';i++){

	cout<<s[i];

}cout<<endl;

for(int i=Location_min;s[i]!=' ';i++){

	cout<<s[i];
}

return 0;

}