reverse();

#include<cstring>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<string>
using namespace std;
string s1,s2;
bool ok(string ss1,string ss2)
{
    int i=0,j=0;
    while(ss1[i]!='\0'&&ss2[j]!='\0')
    {
        if(ss1[i]==ss2[j])
            j++;
        i++;
    }
    if(j<ss2.length())
        return false;
    else 
        return true;
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        cin>>s1>>s2;
        if(ok(s1,s2))
        {
            printf("%s\n","YES"); 
            continue;
        }
        reverse(s2.begin(),s2.end());
        if(ok(s1,s2))
            printf("%s\n","YES");
        else
            printf("%s\n","NO");
        
    }
    system("pause");
    return 0;
} 
View Code

 

 

 

posted on 2014-05-17 18:12  903SW-BAO  阅读(286)  评论(0编辑  收藏  举报