stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

#define maxn 500000

char a[maxn],b[maxn];

int s=1;

int main(){

    while(cin>>a[s]){

        s++;

    }

    for(int i=1;i<=s-1;i++){

        b[i]=a[i];

    }

    for(int i=1;i<=s/2;i++){

        swap(a[i],a[s-i]);

    }



    for(int i=1;i<=s-1;i++){

        if(a[i]=='b'){a[i]='d';continue;

        }

         if(a[i]=='d'){a[i]='b';continue;

         }

        if(a[i]=='p'){a[i]='q';continue;

        }

        if(a[i]=='q'){a[i]='p';continue;

        }

    }

    

    for(int i=1;i<=s-1;i++){

        if(a[i]!=b[i]){

            cout<<"No"<<endl;return 0;

        }

    }

    cout<<"Yes"<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.328381268135917x):
#include<cstdio>

#define pritnf printf

#define scnaf scanf

#define retrun return

#define sizoef sizeof

#define inl inline

#define br break

#define con continue

#define mst(mst_a,mst_b) memset(mst_a,mst_b,sizeof(mst_a))

#define fora(fora_x,fora_a,fora_b) for(re nti (fora_x)=(fora_a);(fora_x)<=(fora_b);++(fora_x))

#define forb(forb_x,forb_a,forb_b) for(re nit (forb_x)=(forb_a);(forb_x)>=(forb_b);--(forb_x))

#define foral(foral_x,foral_a,foral_b) for(re ll (foral_x)=(foral_a);(foral_x)<=(foral_b);++(foral_x))

#define forbl(forbl_x,forbl_a,forbl_b) for(re ll (forbl_x)=(forbl_a);(forbl_x)>=(forbl_b);--(forbl_x))

#define re register

#define stt struct

#define nms namespace

#define gc getchar

#define sl(sl_a) strlen(sl_a)

#define gt(gt_a) goto gt_a

#define rt return

#define infa (0x3f3f3f3f)

#define infb (0x7fffffff)

#define infd (0x7f)

#define in(in_a) freopen("D:/""/in"in_a".in","r",stdin)

#define out(out_a) freopen("D:/""/out"out_a".out","w",stdout)

#define filein(filein_a) freopen(filein_a".in","r",stdin)

#define fileout(fileout_a) freopen(fileout_a".out","w",stdout)

#define file(file_a) filein(file_a);fileout(file_a)

typedef long long ll;

typedef int itn,nti,tin,tni,nit;

using namespace std;

const nit maxa=100004;

const nit maxb=1000004;

const nit maxc=4;

const tni maxd=10004;

#include<cstring>



tni s,ls;

char x[maxa];

bool f=1;



tni main()

{

    scanf("%s",x+1);

    s=sl(x+1);

    //

    ls=s>>1;

    fora(i,1,ls)

    {

        if(x[i]!=x[s-i+1])

        {

            f=0;

            br;

        }

    }

    //

    if(f)

    {

        pritnf("Yes\n");

        rt 0;

    }

    //

    if(!(s%2))

    {

        f=1;

        fora(i,1,ls)

        {

            if(((x[i]=='p')&&(x[s-i+1]!='q'))||((x[i]=='q')&&(x[s-i+1]!='p'))||((x[i]=='b')&&(x[s-i+1]!='d'))||((x[i]=='d')&&(x[s-i+1]!='b')))

            {

                f=0;

                br;

            }

        }

        //

        if(f)

        {

            printf("Yes\n");

            rt 0;

        }

    }

    //

    printf("No\n");

    rt 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

string s1,s2;

int main(){

	getline(cin,s1);

	s2=s1;

	reverse(s2.begin(),s2.end());

	for(int i=0;i<s2.size();++i)

		s2[i]=='b'?s2[i]='d':s2[i]=='d'?s2[i]='b':s2[i]=='p'?s2[i]='q':s2[i]='p';

	if(s1==s2)	puts("Yes");

	else	puts("No");

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.3003383501112x):
#include<cstdio>

#define pritnf printf

#define scnaf scanf

#define retrun return

#define sizoef sizeof

#define inl inline

#define br break

#define con continue

#define mst(mst_a,mst_b) memset(mst_a,mst_b,sizeof(mst_a))

#define fora(fora_x,fora_a,fora_b) for(re nti (fora_x)=(fora_a);(fora_x)<=(fora_b);++(fora_x))

#define forb(forb_x,forb_a,forb_b) for(re nit (forb_x)=(forb_a);(forb_x)>=(forb_b);--(forb_x))

#define foral(foral_x,foral_a,foral_b) for(re ll (foral_x)=(foral_a);(foral_x)<=(foral_b);++(foral_x))

#define forbl(forbl_x,forbl_a,forbl_b) for(re ll (forbl_x)=(forbl_a);(forbl_x)>=(forbl_b);--(forbl_x))

#define re register

#define stt struct

#define nms namespace

#define gc getchar

#define sl(sl_a) strlen(sl_a)

#define gt(gt_a) goto gt_a

#define rt return

#define infa (0x3f3f3f3f)

#define infb (0x7fffffff)

#define infd (0x7f)

#define in(in_a) freopen("D:/""/in"in_a".in","r",stdin)

#define out(out_a) freopen("D:/""/out"out_a".out","w",stdout)

#define filein(filein_a) freopen(filein_a".in","r",stdin)

#define fileout(fileout_a) freopen(fileout_a".out","w",stdout)

#define file(file_a) filein(file_a);fileout(file_a)

typedef long long ll;

typedef int itn,nti,tin,tni,nit;

using namespace std;

const nit maxa=100004;

const nit maxb=1000004;

const nit maxc=4;

const tni maxd=10004;

#include<cstring>



tni s,ls;

char x[maxa];

bool f=1;



tni main()

{

    scanf("%s",x+1);

    s=sl(x+1);

    //

    ls=s>>1;

    fora(i,1,ls)

    {

        if(x[i]!=x[s-i+1])

        {

            f=0;

            br;

        }

    }

    //

    if(f)

    {

        pritnf("Yes\n");

        rt 0;

    }

    //

    if(!(s%2))

    {

        f=1;

        fora(i,1,ls)

        {

            if(((x[i]=='p')&&(x[s-i+1]!='q'))||((x[i]=='q')&&(x[s-i+1]!='p'))||((x[i]=='b')&&(x[s-i+1]!='d'))||((x[i]=='d')&&(x[s-i+1]!='b')))

            {

                f=0;

                br;

            }

        }

        //

        if(f)

        {

            printf("Yes\n");

            rt 0;

        }

    }

    //

    printf("No\n");

    rt 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cstring>

#define rep(i,a,b,k) for(register ll i=a;i<=b;i+=k)

#define drep(i,a,b,k) for(register ll i=a;i>=b;i-=k)

#define ll long long

#define mod 1000000007

using namespace std;

char a[100005];

int len;

bool flag=1;

int main()

{

	scanf("%s",&a);

	len=strlen(a)-1;

	if(!(len&1))

		puts("No"),exit(0);

	for(int i=0,j=len;i<j;i++,j--)

	{

		if((a[i]=='p'&&a[j]=='q')||(a[i]=='q'&&a[j]=='p')||(a[i]=='d'&&a[j]=='b')||(a[i]=='b'&&a[j]=='d'));

		else

		{

			flag=0;

			break;

		}

	}

	if(flag)

		puts("Yes"),exit(0);

	puts("No");

}

// Faster C++ solution for the same problem (measured speedup: 5.26327987905274x):
#include<cstdio>

#define pritnf printf

#define scnaf scanf

#define retrun return

#define sizoef sizeof

#define inl inline

#define br break

#define con continue

#define mst(mst_a,mst_b) memset(mst_a,mst_b,sizeof(mst_a))

#define fora(fora_x,fora_a,fora_b) for(re nti (fora_x)=(fora_a);(fora_x)<=(fora_b);++(fora_x))

#define forb(forb_x,forb_a,forb_b) for(re nit (forb_x)=(forb_a);(forb_x)>=(forb_b);--(forb_x))

#define foral(foral_x,foral_a,foral_b) for(re ll (foral_x)=(foral_a);(foral_x)<=(foral_b);++(foral_x))

#define forbl(forbl_x,forbl_a,forbl_b) for(re ll (forbl_x)=(forbl_a);(forbl_x)>=(forbl_b);--(forbl_x))

#define re register

#define stt struct

#define nms namespace

#define gc getchar

#define sl(sl_a) strlen(sl_a)

#define gt(gt_a) goto gt_a

#define rt return

#define infa (0x3f3f3f3f)

#define infb (0x7fffffff)

#define infd (0x7f)

#define in(in_a) freopen("D:/""/in"in_a".in","r",stdin)

#define out(out_a) freopen("D:/""/out"out_a".out","w",stdout)

#define filein(filein_a) freopen(filein_a".in","r",stdin)

#define fileout(fileout_a) freopen(fileout_a".out","w",stdout)

#define file(file_a) filein(file_a);fileout(file_a)

typedef long long ll;

typedef int itn,nti,tin,tni,nit;

using namespace std;

const nit maxa=100004;

const nit maxb=1000004;

const nit maxc=4;

const tni maxd=10004;

#include<cstring>



tni s,ls;

char x[maxa];

bool f=1;



tni main()

{

    scanf("%s",x+1);

    s=sl(x+1);

    //

    ls=s>>1;

    fora(i,1,ls)

    {

        if(x[i]!=x[s-i+1])

        {

            f=0;

            br;

        }

    }

    //

    if(f)

    {

        pritnf("Yes\n");

        rt 0;

    }

    //

    if(!(s%2))

    {

        f=1;

        fora(i,1,ls)

        {

            if(((x[i]=='p')&&(x[s-i+1]!='q'))||((x[i]=='q')&&(x[s-i+1]!='p'))||((x[i]=='b')&&(x[s-i+1]!='d'))||((x[i]=='d')&&(x[s-i+1]!='b')))

            {

                f=0;

                br;

            }

        }

        //

        if(f)

        {

            printf("Yes\n");

            rt 0;

        }

    }

    //

    printf("No\n");

    rt 0;

}
// Slower C++ solution:
#include<iostream>

#include<string>

using namespace std;

int main()

{

	string s,ss;

	cin>>s;

	ss=s;

	int len=s.length();

	for(int i=0;i<len/2;i++)

		swap(s[i],s[len-i-1]);

	for(int i=0;i<len;i++)

		switch(s[i])

		{

			case'b':s[i]='d';break;

			case'd':s[i]='b';break;

			case'p':s[i]='q';break;

			case'q':s[i]='p';break;

		}

	if(ss==s)cout<<"Yes";

		else cout<<"No";

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.362554000991935x):
#include<cstdio>

#define pritnf printf

#define scnaf scanf

#define retrun return

#define sizoef sizeof

#define inl inline

#define br break

#define con continue

#define mst(mst_a,mst_b) memset(mst_a,mst_b,sizeof(mst_a))

#define fora(fora_x,fora_a,fora_b) for(re nti (fora_x)=(fora_a);(fora_x)<=(fora_b);++(fora_x))

#define forb(forb_x,forb_a,forb_b) for(re nit (forb_x)=(forb_a);(forb_x)>=(forb_b);--(forb_x))

#define foral(foral_x,foral_a,foral_b) for(re ll (foral_x)=(foral_a);(foral_x)<=(foral_b);++(foral_x))

#define forbl(forbl_x,forbl_a,forbl_b) for(re ll (forbl_x)=(forbl_a);(forbl_x)>=(forbl_b);--(forbl_x))

#define re register

#define stt struct

#define nms namespace

#define gc getchar

#define sl(sl_a) strlen(sl_a)

#define gt(gt_a) goto gt_a

#define rt return

#define infa (0x3f3f3f3f)

#define infb (0x7fffffff)

#define infd (0x7f)

#define in(in_a) freopen("D:/""/in"in_a".in","r",stdin)

#define out(out_a) freopen("D:/""/out"out_a".out","w",stdout)

#define filein(filein_a) freopen(filein_a".in","r",stdin)

#define fileout(fileout_a) freopen(fileout_a".out","w",stdout)

#define file(file_a) filein(file_a);fileout(file_a)

typedef long long ll;

typedef int itn,nti,tin,tni,nit;

using namespace std;

const nit maxa=100004;

const nit maxb=1000004;

const nit maxc=4;

const tni maxd=10004;

#include<cstring>



tni s,ls;

char x[maxa];

bool f=1;



tni main()

{

    scanf("%s",x+1);

    s=sl(x+1);

    //

    ls=s>>1;

    fora(i,1,ls)

    {

        if(x[i]!=x[s-i+1])

        {

            f=0;

            br;

        }

    }

    //

    if(f)

    {

        pritnf("Yes\n");

        rt 0;

    }

    //

    if(!(s%2))

    {

        f=1;

        fora(i,1,ls)

        {

            if(((x[i]=='p')&&(x[s-i+1]!='q'))||((x[i]=='q')&&(x[s-i+1]!='p'))||((x[i]=='b')&&(x[s-i+1]!='d'))||((x[i]=='d')&&(x[s-i+1]!='b')))

            {

                f=0;

                br;

            }

        }

        //

        if(f)

        {

            printf("Yes\n");

            rt 0;

        }

    }

    //

    printf("No\n");

    rt 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

const int maxn=100100;

char a[maxn],b[maxn];

int main(){

	scanf("%s",b+1);

	int len=strlen(b+1);

	for(int i=1;i<=len;i++){

		a[i]=b[i];

		if(a[i]=='b') a[i]='d';

		else if(a[i]=='d') a[i]='b';

		else if(a[i]=='p') a[i]='q';

		else if(a[i]=='q') a[i]='p';

	}

	int flag=0;

	for(int i=1;i<=len;i++){

		if(b[i]!=a[len-i+1]){

			flag=1;

//			cout<<a[i]<<" "<<a[len-i+1];

			break;

		}

	}

	if(flag==1) cout<<"No";

	else cout<<"Yes";

	return 0;

} 

// Faster C++ solution for the same problem (measured speedup: 5.318349886780258x):
#include<cstdio>

#define pritnf printf

#define scnaf scanf

#define retrun return

#define sizoef sizeof

#define inl inline

#define br break

#define con continue

#define mst(mst_a,mst_b) memset(mst_a,mst_b,sizeof(mst_a))

#define fora(fora_x,fora_a,fora_b) for(re nti (fora_x)=(fora_a);(fora_x)<=(fora_b);++(fora_x))

#define forb(forb_x,forb_a,forb_b) for(re nit (forb_x)=(forb_a);(forb_x)>=(forb_b);--(forb_x))

#define foral(foral_x,foral_a,foral_b) for(re ll (foral_x)=(foral_a);(foral_x)<=(foral_b);++(foral_x))

#define forbl(forbl_x,forbl_a,forbl_b) for(re ll (forbl_x)=(forbl_a);(forbl_x)>=(forbl_b);--(forbl_x))

#define re register

#define stt struct

#define nms namespace

#define gc getchar

#define sl(sl_a) strlen(sl_a)

#define gt(gt_a) goto gt_a

#define rt return

#define infa (0x3f3f3f3f)

#define infb (0x7fffffff)

#define infd (0x7f)

#define in(in_a) freopen("D:/""/in"in_a".in","r",stdin)

#define out(out_a) freopen("D:/""/out"out_a".out","w",stdout)

#define filein(filein_a) freopen(filein_a".in","r",stdin)

#define fileout(fileout_a) freopen(fileout_a".out","w",stdout)

#define file(file_a) filein(file_a);fileout(file_a)

typedef long long ll;

typedef int itn,nti,tin,tni,nit;

using namespace std;

const nit maxa=100004;

const nit maxb=1000004;

const nit maxc=4;

const tni maxd=10004;

#include<cstring>



tni s,ls;

char x[maxa];

bool f=1;



tni main()

{

    scanf("%s",x+1);

    s=sl(x+1);

    //

    ls=s>>1;

    fora(i,1,ls)

    {

        if(x[i]!=x[s-i+1])

        {

            f=0;

            br;

        }

    }

    //

    if(f)

    {

        pritnf("Yes\n");

        rt 0;

    }

    //

    if(!(s%2))

    {

        f=1;

        fora(i,1,ls)

        {

            if(((x[i]=='p')&&(x[s-i+1]!='q'))||((x[i]=='q')&&(x[s-i+1]!='p'))||((x[i]=='b')&&(x[s-i+1]!='d'))||((x[i]=='d')&&(x[s-i+1]!='b')))

            {

                f=0;

                br;

            }

        }

        //

        if(f)

        {

            printf("Yes\n");

            rt 0;

        }

    }

    //

    printf("No\n");

    rt 0;

}
// Slower C++ solution:
#include <iostream>

#include <string.h>

using namespace std;



char s[100010];

char s1[100010];



int main()

{

    cin>>s;

    int l = strlen(s);

    if(l&1)

    {

        cout<<"No"<<endl;

        return 0;

    }

    for(int i=0;i<l;i++) s1[i] = s[l-i-1]; 

    for(int i=0;i<l;i++)

    {

        if(s1[i] == 'b') s1[i] = 'd';

        else if(s1[i] == 'd') s1[i] = 'b';

        else if(s1[i] == 'p') s1[i] = 'q';

        else s1[i] = 'p';

    }

    if(!strcmp(s1, s)) cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.329705419212272x):
#include<cstdio>

#define pritnf printf

#define scnaf scanf

#define retrun return

#define sizoef sizeof

#define inl inline

#define br break

#define con continue

#define mst(mst_a,mst_b) memset(mst_a,mst_b,sizeof(mst_a))

#define fora(fora_x,fora_a,fora_b) for(re nti (fora_x)=(fora_a);(fora_x)<=(fora_b);++(fora_x))

#define forb(forb_x,forb_a,forb_b) for(re nit (forb_x)=(forb_a);(forb_x)>=(forb_b);--(forb_x))

#define foral(foral_x,foral_a,foral_b) for(re ll (foral_x)=(foral_a);(foral_x)<=(foral_b);++(foral_x))

#define forbl(forbl_x,forbl_a,forbl_b) for(re ll (forbl_x)=(forbl_a);(forbl_x)>=(forbl_b);--(forbl_x))

#define re register

#define stt struct

#define nms namespace

#define gc getchar

#define sl(sl_a) strlen(sl_a)

#define gt(gt_a) goto gt_a

#define rt return

#define infa (0x3f3f3f3f)

#define infb (0x7fffffff)

#define infd (0x7f)

#define in(in_a) freopen("D:/""/in"in_a".in","r",stdin)

#define out(out_a) freopen("D:/""/out"out_a".out","w",stdout)

#define filein(filein_a) freopen(filein_a".in","r",stdin)

#define fileout(fileout_a) freopen(fileout_a".out","w",stdout)

#define file(file_a) filein(file_a);fileout(file_a)

typedef long long ll;

typedef int itn,nti,tin,tni,nit;

using namespace std;

const nit maxa=100004;

const nit maxb=1000004;

const nit maxc=4;

const tni maxd=10004;

#include<cstring>



tni s,ls;

char x[maxa];

bool f=1;



tni main()

{

    scanf("%s",x+1);

    s=sl(x+1);

    //

    ls=s>>1;

    fora(i,1,ls)

    {

        if(x[i]!=x[s-i+1])

        {

            f=0;

            br;

        }

    }

    //

    if(f)

    {

        pritnf("Yes\n");

        rt 0;

    }

    //

    if(!(s%2))

    {

        f=1;

        fora(i,1,ls)

        {

            if(((x[i]=='p')&&(x[s-i+1]!='q'))||((x[i]=='q')&&(x[s-i+1]!='p'))||((x[i]=='b')&&(x[s-i+1]!='d'))||((x[i]=='d')&&(x[s-i+1]!='b')))

            {

                f=0;

                br;

            }

        }

        //

        if(f)

        {

            printf("Yes\n");

            rt 0;

        }

    }

    //

    printf("No\n");

    rt 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

    string a;

    cin>>a;

    string b=a;

    reverse(a.begin(),a.end());

    for(int i=0;i<a.size();++i)

    {

        if(a[i]=='b') a[i]='d';

        else if(a[i]=='d') a[i]='b';

        else if(a[i]=='p') a[i]='q';

        else if(a[i]=='q') a[i]='p';

    }

    if(a==b) cout<<"Yes";

    else cout<<"No";

}

// Faster C++ solution for the same problem (measured speedup: 5.3581915063125525x):
#include<cstdio>

#define pritnf printf

#define scnaf scanf

#define retrun return

#define sizoef sizeof

#define inl inline

#define br break

#define con continue

#define mst(mst_a,mst_b) memset(mst_a,mst_b,sizeof(mst_a))

#define fora(fora_x,fora_a,fora_b) for(re nti (fora_x)=(fora_a);(fora_x)<=(fora_b);++(fora_x))

#define forb(forb_x,forb_a,forb_b) for(re nit (forb_x)=(forb_a);(forb_x)>=(forb_b);--(forb_x))

#define foral(foral_x,foral_a,foral_b) for(re ll (foral_x)=(foral_a);(foral_x)<=(foral_b);++(foral_x))

#define forbl(forbl_x,forbl_a,forbl_b) for(re ll (forbl_x)=(forbl_a);(forbl_x)>=(forbl_b);--(forbl_x))

#define re register

#define stt struct

#define nms namespace

#define gc getchar

#define sl(sl_a) strlen(sl_a)

#define gt(gt_a) goto gt_a

#define rt return

#define infa (0x3f3f3f3f)

#define infb (0x7fffffff)

#define infd (0x7f)

#define in(in_a) freopen("D:/""/in"in_a".in","r",stdin)

#define out(out_a) freopen("D:/""/out"out_a".out","w",stdout)

#define filein(filein_a) freopen(filein_a".in","r",stdin)

#define fileout(fileout_a) freopen(fileout_a".out","w",stdout)

#define file(file_a) filein(file_a);fileout(file_a)

typedef long long ll;

typedef int itn,nti,tin,tni,nit;

using namespace std;

const nit maxa=100004;

const nit maxb=1000004;

const nit maxc=4;

const tni maxd=10004;

#include<cstring>



tni s,ls;

char x[maxa];

bool f=1;



tni main()

{

    scanf("%s",x+1);

    s=sl(x+1);

    //

    ls=s>>1;

    fora(i,1,ls)

    {

        if(x[i]!=x[s-i+1])

        {

            f=0;

            br;

        }

    }

    //

    if(f)

    {

        pritnf("Yes\n");

        rt 0;

    }

    //

    if(!(s%2))

    {

        f=1;

        fora(i,1,ls)

        {

            if(((x[i]=='p')&&(x[s-i+1]!='q'))||((x[i]=='q')&&(x[s-i+1]!='p'))||((x[i]=='b')&&(x[s-i+1]!='d'))||((x[i]=='d')&&(x[s-i+1]!='b')))

            {

                f=0;

                br;

            }

        }

        //

        if(f)

        {

            printf("Yes\n");

            rt 0;

        }

    }

    //

    printf("No\n");

    rt 0;

}
// Slower C++ solution:
#include<cstdio>

#include<cstring>

#include<map>

using namespace std;

map<char,char>mp;

int main()

{

    mp['p']='q';

    mp['q']='p';

    mp['b']='d';

    mp['d']='b';

    char s[100010];

    scanf("%s",s);

    for(int i=0;i<strlen(s);i++)

    {

        if(mp[s[i]]!=s[strlen(s)-i-1])return !printf("No");

    }

    return !printf("Yes");

}

// Faster C++ solution for the same problem (measured speedup: 4.9365834942297955x):
#include<cstdio>

#define pritnf printf

#define scnaf scanf

#define retrun return

#define sizoef sizeof

#define inl inline

#define br break

#define con continue

#define mst(mst_a,mst_b) memset(mst_a,mst_b,sizeof(mst_a))

#define fora(fora_x,fora_a,fora_b) for(re nti (fora_x)=(fora_a);(fora_x)<=(fora_b);++(fora_x))

#define forb(forb_x,forb_a,forb_b) for(re nit (forb_x)=(forb_a);(forb_x)>=(forb_b);--(forb_x))

#define foral(foral_x,foral_a,foral_b) for(re ll (foral_x)=(foral_a);(foral_x)<=(foral_b);++(foral_x))

#define forbl(forbl_x,forbl_a,forbl_b) for(re ll (forbl_x)=(forbl_a);(forbl_x)>=(forbl_b);--(forbl_x))

#define re register

#define stt struct

#define nms namespace

#define gc getchar

#define sl(sl_a) strlen(sl_a)

#define gt(gt_a) goto gt_a

#define rt return

#define infa (0x3f3f3f3f)

#define infb (0x7fffffff)

#define infd (0x7f)

#define in(in_a) freopen("D:/""/in"in_a".in","r",stdin)

#define out(out_a) freopen("D:/""/out"out_a".out","w",stdout)

#define filein(filein_a) freopen(filein_a".in","r",stdin)

#define fileout(fileout_a) freopen(fileout_a".out","w",stdout)

#define file(file_a) filein(file_a);fileout(file_a)

typedef long long ll;

typedef int itn,nti,tin,tni,nit;

using namespace std;

const nit maxa=100004;

const nit maxb=1000004;

const nit maxc=4;

const tni maxd=10004;

#include<cstring>



tni s,ls;

char x[maxa];

bool f=1;



tni main()

{

    scanf("%s",x+1);

    s=sl(x+1);

    //

    ls=s>>1;

    fora(i,1,ls)

    {

        if(x[i]!=x[s-i+1])

        {

            f=0;

            br;

        }

    }

    //

    if(f)

    {

        pritnf("Yes\n");

        rt 0;

    }

    //

    if(!(s%2))

    {

        f=1;

        fora(i,1,ls)

        {

            if(((x[i]=='p')&&(x[s-i+1]!='q'))||((x[i]=='q')&&(x[s-i+1]!='p'))||((x[i]=='b')&&(x[s-i+1]!='d'))||((x[i]=='d')&&(x[s-i+1]!='b')))

            {

                f=0;

                br;

            }

        }

        //

        if(f)

        {

            printf("Yes\n");

            rt 0;

        }

    }

    //

    printf("No\n");

    rt 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

string a,b;

int main() {

	cin>>a;b=a;

	reverse(a.begin(),a.end());

	for(int i=0; i<a.size(); i++) {

		if(a[i]=='b') a[i]='d';

		else if(a[i]=='d') a[i]='b';

		else if(a[i]=='p') a[i]='q';

		else if(a[i]=='q') a[i]='p';

	}

	if(a==b) cout<<"Yes"<<endl;

	else cout<<"No"<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.335998836009788x):
#include<cstdio>

#define pritnf printf

#define scnaf scanf

#define retrun return

#define sizoef sizeof

#define inl inline

#define br break

#define con continue

#define mst(mst_a,mst_b) memset(mst_a,mst_b,sizeof(mst_a))

#define fora(fora_x,fora_a,fora_b) for(re nti (fora_x)=(fora_a);(fora_x)<=(fora_b);++(fora_x))

#define forb(forb_x,forb_a,forb_b) for(re nit (forb_x)=(forb_a);(forb_x)>=(forb_b);--(forb_x))

#define foral(foral_x,foral_a,foral_b) for(re ll (foral_x)=(foral_a);(foral_x)<=(foral_b);++(foral_x))

#define forbl(forbl_x,forbl_a,forbl_b) for(re ll (forbl_x)=(forbl_a);(forbl_x)>=(forbl_b);--(forbl_x))

#define re register

#define stt struct

#define nms namespace

#define gc getchar

#define sl(sl_a) strlen(sl_a)

#define gt(gt_a) goto gt_a

#define rt return

#define infa (0x3f3f3f3f)

#define infb (0x7fffffff)

#define infd (0x7f)

#define in(in_a) freopen("D:/""/in"in_a".in","r",stdin)

#define out(out_a) freopen("D:/""/out"out_a".out","w",stdout)

#define filein(filein_a) freopen(filein_a".in","r",stdin)

#define fileout(fileout_a) freopen(fileout_a".out","w",stdout)

#define file(file_a) filein(file_a);fileout(file_a)

typedef long long ll;

typedef int itn,nti,tin,tni,nit;

using namespace std;

const nit maxa=100004;

const nit maxb=1000004;

const nit maxc=4;

const tni maxd=10004;

#include<cstring>



tni s,ls;

char x[maxa];

bool f=1;



tni main()

{

    scanf("%s",x+1);

    s=sl(x+1);

    //

    ls=s>>1;

    fora(i,1,ls)

    {

        if(x[i]!=x[s-i+1])

        {

            f=0;

            br;

        }

    }

    //

    if(f)

    {

        pritnf("Yes\n");

        rt 0;

    }

    //

    if(!(s%2))

    {

        f=1;

        fora(i,1,ls)

        {

            if(((x[i]=='p')&&(x[s-i+1]!='q'))||((x[i]=='q')&&(x[s-i+1]!='p'))||((x[i]=='b')&&(x[s-i+1]!='d'))||((x[i]=='d')&&(x[s-i+1]!='b')))

            {

                f=0;

                br;

            }

        }

        //

        if(f)

        {

            printf("Yes\n");

            rt 0;

        }

    }

    //

    printf("No\n");

    rt 0;

}