Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
489 B
19
Indexable
Never
#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;
}