Untitled
unknown
plain_text
3 years ago
489 B
26
Indexable
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream in("func.txt");
ofstream out("result.txt");
int n, max = 0;
string str, maxStr;
in >> n;
for (int i = 1; i <= n; i++)
{
in >> str;
if (str.length() > max)
{
maxStr = str;
max = str.length();
}
}
out << max << endl << maxStr;
cout << max << endl << maxStr;
}
Editor is loading...