- #include<iostream>
- using namespace std;
- int main(){
- int Q;
- cin>>Q;
- while (Q){
- string a;
- string b;
- cin>>a;
- cin>>b;
- int tmpIndex=-1;
- int cnt=0;
- for (int i=0;i<b.length();i++){
- for (int j=0;j<a.length();j++){
- if (b[i]==a[j]||b[i]==a[j]-32){
- if (j>tmpIndex){
- cout<<a[j]<<" ";
- a[j]='0';
- cnt++;
- tmpIndex=j;
- break;
- }
- }
- }
- }
- int cnt1=0;
- if (cnt==b.length()){
- for (int i=0;i<a.length();i++){
- if (a[i]!='0'&&a[i]>='a'&&a[i]<='z'){
- cnt1++;
- }
- }
- if (cnt1==a.length()-b.length()){
- cout<<"YES"<<endl;
- }
- else cout<<"NO"<<endl;
- }
- else cout<<"NO"<<endl;
- Q--;
- }
- return 0;
- }
[text] bien doi xau
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: