#include<iostream>
#include<cmath>
#include<cstdio>
 
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<29)
 
using namespace std;
 
void compute(string text,string S)
{
  int nt = text.size(),nS = S.size();
  int mlen = inf;
  string ans;
  bool found[nS];
  int CNT = 0;
  int fpos[nS];
  rep(i,nS)found[i] = false;
 
  rep(i,nt)
    {
      bool update = false;
      int cnt = 0,mn,mx;
      mn = inf,mx = -inf;
      rep(j,nS)
	{
	  if(S[j] == text[i])
	    {
	      update = true;
	      found[j] = true;
	      fpos[j] = i;
	    }
	  if(found[j])
	    {
	      cnt++;
	      mn = min(mn,fpos[j]);
	      mx = max(mx,fpos[j]);
	    }
	}
      if(cnt == nS)
	{
	  int cost = mx - mn + 1;
	  if(cost < mlen)
	    {
	      mlen = cost;
	      ans = text.substr(mn,cost);
	      CNT = 1;
	    }
	  else if(cost == mlen && update)CNT++;	    
	}
    }
  cout << CNT << endl << endl;
  if(!CNT)return;

  rep(i,ans.size())
    if((i+1)%72 == 0 && i != 0)
      printf("%c\n",ans[i]);
    else
      printf("%c",ans[i]);
  if(ans.size()%72 != 0)puts("\n");
  else puts("");
}
 
int main()
{
  string blank;
  while(getline(cin,blank))
    {
      string text,S;
      text += blank;
      while(getline(cin,blank))
	{
	  if(blank.empty())break;
	  text += blank;
	}
      if(text.empty())goto Fin;
      while(getline(cin,blank))
	if(blank.empty())break;
	else S += blank;
      compute(text,S);
    }
 Fin:;
  return 0;
}