#include <stdio.h>
int main()
{
char tmp[1000];
char str[1000];
char c;
int num = 0, lnum = 0;
c = getchar();
while (c != EOF) {
if (c == 10) {
if (num > lnum) {
for (int i = 0; i < num; i++) {
str[i] = tmp[i];
tmp[i] = "";
}
lnum = num;
num = 0;
c = getchar();
}
else {
for (int i = 0; i < num; i++) {
tmp[i] = "";
}
num = 0;
c = getchar();
}
}
else {
tmp[num] = c;
num++;
c = getchar();
}
}
printf("%d\n", lnum);
for (int i = 0; i < lnum; i++) {
printf("%c", str[i]);
}
return 0;
}