//* Problem  : A - Advanced Fruits
//* Contest  : Ulm Local 1999
//* Type     : Judge (TestLib i/o format)
//* Date     : 2008.06.06
//* Author   : alt
//* Language : C++
//* Compiler : Microsoft Visual C++ 8.0


#include <stdio.h>
#include <iostream>
#include <string>
#include "testlib.h"
using namespace std;

int nt = 0;

char x[128], y[128];

int is_subsequence(const char *a, int na, const char *b, int nb)
{
	int i = 0, j = 0;
	while (j < nb)
	{
		while (i < na && a[i] != b[j]) i++;
		if (i >= na) return 0;
		i++; j++;
	}
	return 1;
}

void check(string si, string sa, int len)
{
	if (sa.length() != len)
		quitf(_wa, "Wrong Answer. Test #%d. Wrong length of resulting string. Expected %d, received %d", nt, len, sa.length());
	sscanf(si.c_str(), "%s %s", x, y);
	if (!is_subsequence(sa.c_str(), sa.length(), x, strlen(x)))
		quitf(_wa, "Wrong Answer. Test #%d. '%s' is not a subsequence of '%s'", nt, x, sa.c_str());
	if (!is_subsequence(sa.c_str(), sa.length(), y, strlen(y)))
		quitf(_wa, "Wrong Answer. Test #%d. '%s' is not a subsequence of '%s'", nt, y, sa.c_str());
}

int main(int argc, char *argv[])
{
	registerTestlibCmd(argc, argv);

	while (!inf.eof())
	{
		string si = inf.readString();
		if (si == "") break;
		nt++;
		string sa = ans.readString();
		string so = ouf.readString();
		check(si, sa, so.length());
	}
	quitf(_ok, "%d cases", nt);
	return 0;
}
