题目:
假设S为优秀01序列:
则:
1) 若T也为优秀01序列,则S+T或T+S也为优秀序列。
2)S的反码序列,开头的0全部去掉后,rev(S)也为优秀序列,如:
S:11010 rev(S)=101.
现在要求输入:
一个整数N,表示输入多少组S和T序列,
接下来依次输入每组的S,T,判断各组的T是否为优秀01序列,若是,输出YES,否则输出NO。
(默认S是优秀01序列)
例子:
2
110
110001
11
0110
NO
NO
代码:
#include<string>
#include<iostream>
using namespace std;
bool compare(string a,string str, int start);
string rev(string s);
int main(){
int n;
string s,t;
cin>>n;
cin>>s>>t;
string re= rev(s);
int size_s=s.size();
int size_tt=t.size();
int size_re=r