#include <algorithm>
#include <fstream>

using namespace std;

const char Input[] = "mesaje.in";
const char Output[] = "mesaje.out";

const int Nr_cuv = 15003;
const int Nr_mes = 133;
const int Lng_cuv = 23;
const int Lng_mes = 30003;

char m[Nr_cuv][Lng_cuv];
int N, M, XXX, YYY;
int ord[Nr_cuv];
pair <long long int, long long int> p[Nr_cuv];

int cmp_pow( int ind1, int ind2 ) {

    if( p[ind1].first > p[ind2].first )
        return 1;
    if( p[ind1].first < p[ind2].first )
        return 0;

    if( p[ind1].second > p[ind2].second )
        return 1;
    if( p[ind1].second < p[ind2].second )
        return 0;

    return ind1 < ind2;
}

int cmp_str( char a[], char b[] ) {

    int i;

    for( i = 0; i <= a[0]; ++i )
        if( a[i] != b[i] )
            return 0;

    return 1;
}

int main() {

    ifstream fin( Input );
    ofstream fout( Output );

    char c[Lng_cuv], s[Lng_mes];
    int i, j, cnt, ind, lng;

    fin.getline( s, Lng_mes );

    N = 1;
    lng = strlen( s );

    for( i = 0; i < lng; ++i )
        if( s[i] == ' ' )
            ++N;
        else
            m[N][++m[N][0]] = s[i];

    M = 1;

    while( fin.getline( s, Lng_mes ) ) {

        ++M;
        cnt = 0;
        ind = 0;
        lng = strlen( s );
        c[0] = 0;

        for( i = 0; i < lng; ++i )
            if( s[i] == ' ' ) {

                if( cmp_str( c, m[++ind] ) ) {

                    ord[++cnt] = ind;

                    if( M < 64 )
                        p[ind].first += 1LL << (M - 1);
                    else
                        p[ind].second += 1LL << (M - 64);
                }
                c[0] = 0;
            }
            else
                c[++c[0]] = s[i];

        if( cmp_str( c, m[++ind] ) ) {

            ord[++cnt] = ind;

            if( M < 64 )
                p[ind].first += 1LL << (M - 1);
            else
                p[ind].second += 1LL << (M - 64);
        }

        if( cnt ) {

            XXX = cnt;
            YYY = M;
            ord[0] = cnt;
        }
    }

    if( M == 1 || XXX == 0 ) {

        fout << N << "\n";
        for( i = 1; i <= N; ++i, fout << " " )
            for( j = m[i][0]; j > 0; --j )
                fout << m[i][j];
    }
    else {

        sort( ord + 1, ord + ord[0] + 1, cmp_pow );

        fout << XXX << "\n";
        for( i = 1; i <= ord[0]; ++i, fout << " " )
            for( j = m[ord[i]][0]; j > 0; --j )
                fout << m[ord[i]][j];
    }

    fin.close();
    fout.close();

    return 0;
}
