Untitled
Anonymous
plain_text
03/05/2023 1:57 PM
652 B
40
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...