#include <stdio.h>

#include <stdio.h>

enum { MAXLEN = 1024 };

int getline(int limit, char line[]);
void str_copy (char s[], const char t[]);

int main () {
    int n, max = 0; /* 记录当前行和最长行的长度 */
    char line[MAXLEN], maxline[MAXLEN];

    while ((n = getline(MAXLEN, line)) > 0)
        if (n > max) {
            str_copy(maxline, line);
            max = n;
        }

    if (max > 0)
        printf("%s\n", maxline);
    return 0; 
}

void str_copy (char s[], const char t[]) {
    int i = 0;
    while ((s[i] = t[i]) != '\0') ++i;
}

int getline(int limit, char line[]) {
    int c, i = 0;

    while (i < limit - 2 && (c = getchar()) != EOF && c != '\n') {
        line[i] = c;
        ++i;
    }

    if (c == '\n') {
        line[i] = '\n';
        ++i;
    }
    line[i] = '\0';

    return i;
}

