Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include <iostream>

#include <cstring>
#include <fstream>

using namespace std;

int main()
{
ifstream fin("lgmax.in");
ofstream fout("lgmax.out");
char v[300],maxim[300] = {'\0'};
int i,j = 0,n;
fin>>n;
fin.get();
for(i=1;i<=n;i++){
fin.get(v,300);
fin.get();
if(j < strlen(v)){
j = strlen(v);
strcpy(maxim,v);
}
}
fout<<maxim;
fin.close();
fout.close();
return 0;
}

You might also like