2014
02-14

Match

Given three strings, find the length of the longest string which is a substring of each of the three input strings. In this problem "substring" has the usual definition. A string X is a substring of a string Y if and only if string X can be created from string Y by deleting zero or more consecutive characters from the start of string Y, and deleting zero or more consecutive characters from the end of string Y.

The first line of the input is the number of test cases (less than 3000). For each case there is three lines each contains a string. The string only contains ‘a’-'z’ and up to 1000 characters long. There is a blank line before each test case.

The first line of the input is the number of test cases (less than 3000). For each case there is three lines each contains a string. The string only contains ‘a’-'z’ and up to 1000 characters long. There is a blank line before each test case.

3

aebcd
fdsalebcser

sdafawerrsdfsdfwe
erfasdfafsd
egreetsdwere

aaaaa
aaaaa
aaaaa

3
2
5

1. /*
* =====================================================================================
*
* Filename: 1366.cc
*
* Description:
*
* Version: 1.0
* Created: 2014年01月06日 14时52分14秒
* Revision: none
* Compiler: gcc
*
* Author: Wenxian Ni (Hello World~), niwenxianq@qq.com
* Organization: AMS/ICT
*
* =====================================================================================
*/

#include
#include

using namespace std;

int main()
{
stack st;
int n,i,j;
int test;
int a[100001];
int b[100001];
while(cin>>n)
{
for(i=1;i>a[i];
for(i=1;i>b[i];
//st.clear();
while(!st.empty())
st.pop();
i = 1;
j = 1;

while(in)
break;
}
while(!st.empty()&&st.top()==b[j])
{
st.pop();
j++;
}
}
if(st.empty())
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}