import std.stdio;
import std.ascii;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

bool first = true;

string s, p;
bool input() {
    s = readln.chomp;
    if (s == "") return false;
    string buf;
    while (buf = readln.chomp, buf != "") {
        s ~= buf;
    }
    p = readln.chomp;
    readln;
    return true;
}

void solve() {
    int[char] x;
    bool[char] pset;
    foreach (c; p) pset[c] = true;
    int count = 0;
    int AnsPos = -1, AnsLen = int.max / 2, AnsCount = 0;
    int lb = 0, ub = 0;
    while (true) {
        //writeln([lb, ub]);
        if (count == p.length) {
            if (AnsLen > ub - lb) { 
                AnsPos = lb;
                AnsLen = ub - lb; 
                AnsCount = 1;
            } else if (AnsLen == ub - lb) {
                AnsCount++;
            }
            if (s[lb] in pset) {
                x[ s[lb] ]--;
                if (x[ s[lb] ] == 0) count--;
            }
            lb++;
        } else if (ub < s.length) {
            if (s[ub] in pset) {
                x[ s[ub] ]++;
                if (x[ s[ub] ] == 1) count++;
            }
            ub++;
        } else {
            break;
        }
    }
    if (first) first = false;
    else writeln;
    writeln(AnsCount);
    if (AnsCount > 0) {
        writeln;
        while (true) {
            //writeln([s.length], " ", [AnsPos, AnsLen]);
            if (AnsPos + 72 < AnsPos + AnsLen) {
                writeln(s[AnsPos .. AnsPos + 72]);
                AnsPos += 72;
                AnsLen -= 72;
            } else {
                writeln(s[AnsPos .. AnsPos + AnsLen]);
                break;
            }
        }
    }
}

void main() {
    while (input) solve;
}