https://codeforc.es/contest/1194/problem/C
我是个傻子,被死死的卡在测试2,没考虑s和t本来就相等的情况
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100000+5;
int a[27],b[27];
int main()
{
string s,t,p;
int n;
cin>>n;
while(n--)
{ memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
cin>>s>>t>>p;
int j=0;
int x=t.length();
for(int i=0;j<t.length()&&i<s.length();i++)
{
if(s[i]==t[j])
{t.erase(j,1);}//cout<<"j="<<j<<" "<<t<<endl;
else
{j++;i--;}
//cout<<t<<endl;
}
/*cout<<"t="<<t<<endl;
cout<<"t:"<<t.length()<<endl;
cout<<"x:"<<x<<endl;
cout<<"x-s.length():"<<x-s.length()<<endl;*/
if(t.length()!=(x-s.length()))
{
cout<<"NO"<<endl;
}
else if(t.length()==0)
{
cout<<"YES"<<endl;
}
else{
for(int i=0;i<t.length();i++) a[t[i]-96]++;
for(int i=0;i<p.length();i++) b[p[i]-96]++;
int f=0;
for(int i=0;i<t.length();i++)
{
if(a[t[i]-96]<=b[t[i]-96])
f=1;
else
{
f=0;break;
}
}
if(f==1) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}
//string str="a";
//cout<<(int)str[0]-96<<endl;
return 0;
}