以下是代码,求各位大佬帮忙指出以下错误,谢谢
#include<bits/stdc++.h>
using namespace std;
string a[10010];
int main(){
int sum=1;
while(cin>>a[sum]){
sum++;
}
sum--;
int biggest=0,smallest=1e6+10;
string biggestrec,smallestrec;
for(int i=1;i<=sum;++i){
if(a[i].length()>biggest){
biggest=a[i].length();
biggestrec=a[i];
}
if(a[i].length()<smallest){
smallestrec=a[i];
smallest=a[i].length();
}
}
cout<<biggestrec<<endl<<smallestrec;
return 0;
}