Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool da(string a, string b){
- int j_old=0;
- int br=0;
- for(int i=0;i<a.size();i++){
- for(int j=j_old;j<b.size();j++){
- if(a[i]==b[j]){
- a[i]=' ';
- b[j]=' ';
- j_old=j;
- br++;
- break;
- }
- }
- }
- if(br==a.size())
- return true;
- else
- return false;
- }
- int main() {
- int n;
- cin>>n;
- while (n--){
- string s,t;
- cin>>s>>t;
- if (da(s,t)==true) cout <<"DA"<<" ";
- else cout << "NE"<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement