Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ~@dvjsharma~ || ~@dvjsharmaa~ //
- #include<bits/stdc++.h>
- using namespace std;
- #define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
- #define scan(arr) for(auto &x : arr) cin>>x;
- #define print(arr) for(auto &x : arr) cout<<x<<" "; cout<<endl;
- #define all(x) x.begin(), x.end()
- #define ll long long
- #define int long long int
- #define endl "\n"
- #define NO cout<<"NO"<<"\n"
- #define YES cout<<"YES"<<"\n"
- #define No cout<<"No"<<"\n"
- #define Yes cout<<"Yes"<<"\n"
- #define vi vector<int>
- #define vvi vector<vector<int>>
- #define pb push_back
- #define ppb pop_back
- #define mod 1e9+7
- int lenint(int n); //length of any intezer
- int ati(int arr[],int n); //array to intezer
- int reversal(int n); //reverse intezers
- string binary(int n); //int to binary(string)
- int digit_sum(int n); //sum of int digits
- //**************************************************//
- int checkif(char a,string s2){
- // cout<<a<<s2<<endl;
- if(s2.find(a)==true){
- return 1;
- }
- return 0;
- }
- void solve(){
- string s1; cin>>s1;
- string s2; cin>>s2;
- int arr[s1.size()]={-1};
- // int hsh1[26],hsh2[26];
- // for(int i=0; i<s1.size(); i++){
- // hsh1[s1[i]-'a']++;
- // }
- // for(int i=0; i<s2.size(); i++){
- // hsh2[s2[i]-'a']++;
- // }
- for(int i=0; i<s1.size(); i++){
- arr[i]=checkif(s1[i],s2);
- }
- int count=0;
- for(int i=0; i<s1.size(); i++){
- if(arr[i]>0){
- count++;
- }
- }
- // print(arr);
- // cout<<count<<endl;
- if(count==s1.size()){
- YES;
- }
- else{
- NO;
- }
- }
- //**************************************************//
- signed main(){
- fastio();
- int tc=1;
- cin>>tc;
- while(tc--){
- solve();
- }
- return 0;
- }
- int lenint(ll n){
- return floor(log10(n) + 1);
- }
- int ati(int a[],int n){
- int x=0;
- for(int i=0; i<n; i++){
- x+=a[i];
- x*=10;
- }
- return(x/10);
- }
- int reversal(int n){
- int x=0,j=(int)pow(10,(int)log10(n));
- while(n){
- x+=(n%10)*j;
- n/=10;
- j/=10;
- }
- return x;
- }
- string binary(int n){
- string str="";
- int binaryNum[32];
- int i = 0;
- while (n > 0) {
- int x=n%2;
- str.push_back(x+'0');
- n = n / 2;
- }
- reverse(all(str));
- return str;
- }
- int digit_sum(int n){
- int x=0;
- while(n){
- x+=n%10;
- n/=10;
- }
- return x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement