高级守护
1139 输出单词怎么做求解
/*
Ijk ssa ass
Ijk
Ijk
*/
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
string s[105];
string a;
int z=1;
int t,cnt;
long long b[105];
int maxn=-0x3f3f3f3f,minn=0x3f3f3f3f;
int pod,pos;
int main()
{
getline(cin,a);
for(int i=0;i<=a.size();i++){
if(a[i]==' '){
z++;
continue;
}
else{
s[z]+=a[i];
}
}
for(int i=1;i<=z;i++){
b[i]=s[i].size();
if(i==z){
b[i]--;
}
}
//1 1 1 1 1.m=1 2.m=1
for(int i=1;i<=z;i++){
if(b[i]>maxn){//m=1,b=1
maxn=b[i];
pod=i;
}
if(b[i]<minn){//m=1,b=1
minn=b[i];
pos=i;
}
}
cout<<s[pod]<<endl<<s[pos];
return 0;
}