A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

using C++ Print "YES" (without the quotes), if these two strings are equivalent, and "NO" (without the quotes) otherwise
Q:

using C++ Print "YES" (without the quotes), if these two strings are equivalent, and "NO" (without the quotes) otherwise

0

using  C++ Print "YES" (without the quotes), if these two strings are equivalent, and "NO" (without the quotes) otherwise ?

input : The first two lines of the input contain two strings given by the teacher. Each of them has the length from 1 to 200 000 and consists of lowercase English letters. The strings have the same length.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define   mt         make_tuple
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define   angle(n)      atan2((n.imag()),(n.real()))
#define   vec(a,b)       ((b)-(a))
#define   length(a)      hypot( (a.imag()),(a.real()) )
#define   normalize(a)      (a)/(length(a))
#define    dp(a,b)          (((conj(a))*(b)).real())
#define    cp(a,b)          (((conj(a))*(b)).imag())
#define    lengthsqrt(a)       dp(a,a)
#define    rotate0( a,ang)    ((a)*exp( point(0,ang) ))
#define    rotateA(about,p,ang)   (rotate0(vec(about,p),ang)+about)
#define    lcm(a,b)                ((a*b)/(__gcd(a,b)))
#define    reflection0(m,v)         (conj((v)/(m))*(m))
#define     reflectionA(m,v,p0)     (conj( (vec(p0,v))/(vec(p0,m)) ) * (vec(p0,m)) ) + p0
#define     same(p1,p2)               ( dp(  vec(p1,p2),vec(p1,p2)) < eps )
#define     point                    complex<double>
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-10);
using namespace std;
int dcmp(double a,double b){   return fabs(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
ll getBit(ll num, int idx) {return ((num >> idx) & 1ll) == 1ll;}
ll setBit1(ll num, int idx) {return num | (1ll<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(ll num, int idx) {return num ^ (1ll<<idx);}
int countNumBit1(ll mask) {int ret=0; while (mask) 	{mask &= (mask-1ll);++ret;	}return ret;}
string fun(string s1)
{
   if(sz(s1)%2!=0)
    return s1;
    string s2= fun(s1.substr(0,sz(s1)/2));
    string s3= fun(s1.substr(sz(s1)/2,sz(s1)/2));
    if(s2<s3)
        return s2+s3;
        return s3+s2;
}
int main()
{
    string s1,s2;
    cin>>s1>>s2;
    if(sz(s1)%2!=0)
    {
        if(s1==s2)
            cout<<"YES\n";
        else
           cout<<"NO\n";
        return 0;
    }
    else
{
   if( fun(s1)==fun(s2))
    cout<<"YES\n";
   else
    cout<<"NO\n";
}
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now