stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<iostream>

#include<cstring>

using namespace std;

char a[100100],b[100010];

int main()

{

	cin>>a;

	int j=0;

	int l=strlen(a);

	for(int i=l-1;i>=0;i--)

	{

		b[j]=a[i];	

		if(b[j]=='p')

		b[j]='q';

		else if(b[j]=='q')

		b[j]='p';

		else if(b[j]=='b')

		b[j]='d';

		else if(b[j]=='d')

		b[j]='b';

		j++;

	}

	if(!strcmp(a,b))

	cout<<"Yes";

	else cout<<"No";

	return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#pragma GCC optimize(2)

#include<bits/stdc++.h>

#define For(i,a,b) for(int i=(a);i<=(b);i++)

#define Rep(i,a,b) for(int i=(a);i>=(b);i--)

using namespace std;

#define TP int

inline TP read(){

    char c=getchar();TP x=0;bool f=0;

    while(!isdigit(c))f^=!(c^45),c=getchar();

    while(isdigit(c))x=(x<<1)+(x<<3)+(c^48),c=getchar();

    if(f)x=-x;return x;

}

int dic[12093];

char s[1000010];

int main()

{

	dic['b']=0;dic['p']=1;dic['d']=2;dic['q']=3;

	cin>>(s+1);

    for(int l=strlen(s+1),i=1;i<=(l>>1)+1;i++)

    {

        if(dic[s[i]]!=((dic[s[l-i+1]]+2)%4))return puts("No"),0;

    }puts("Yes");

    return 0;

}


// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

string a,b;

int main() {

    cin>>a;

    b=a;

    int j=a.size();

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

        a[--j]=b[i];

    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\n";

    else cout<<"No\n";

    return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<string>

#include<algorithm>

using namespace std;

string s,x,k;

int len;

int main()

{

	cin>>s;

	x=s;

	len=s.length();

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

	{

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

	}



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

	{

		if(s[i]=='b')

		{

			s[i]='d';

			continue;

		}

		if(s[i]=='d')

		{

			s[i]='b';

			continue;

		}

		if(s[i]=='p')

		{

			s[i]='q';

			continue;

		}

		if(s[i]=='q')

		{

			s[i]='p';

			continue;

		}

	}

	if(x==s)

	{

		cout<<"Yes";

	}

	else

	{

		cout<<"No";

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

string a,b;

int t;

char c[1000000];

int main()

{

	cin>>a;

	int l=a.size();

	b=a;

	for(int i=l-1;i>=0;i--)

		c[l-i-1]=a[i];

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

	{

		if(c[i]=='b')

			c[i]='d';

		else if(c[i]=='d')

			c[i]='b';

		else if(c[i]=='p')

			c[i]='q';

		else if(c[i]=='q')

			c[i]='p';

	}

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

	{

		if(c[i]!=b[i])

			t=1;

	}

	if(t==0)

		cout<<"Yes"<<'\n';

	else

		cout<<"No"<<'\n';

	return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

char a[100009];

int main()

{

	int x;

	cin >> a;

	x = strlen(a);

	if(x % 2 == 1)

	{

		cout << "No" << endl;

		return 0;

	}

	for(int i = 0; i <= x/2-1; i++)

	{

		if(a[i] == 'p' && a[x-i-1] != 'q')

		{

			cout << "No" << endl;

			return 0;

		}

		if(a[i] == 'q' && a[x-i-1] != 'p')

		{

			cout << "No" << endl;

			return 0;

		}

		if(a[i] == 'b' && a[x-i-1] != 'd')

		{

			cout << "No" << endl;

			return 0;

		}

		if(a[i] == 'd' && a[x-i-1] != 'b')

		{

			cout << "No" << endl;

			return 0;

		}

	}

	cout << "Yes" << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

char a[100100],s1[100100];

int m;

bool mark;

int main(){

	cin>>a;

	m=strlen(a);

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

		s1[i]=a[i];

	for(int i=0;i<m;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';

	}/*

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

		cout<<s1[i];

	cout<<endl;

	for(int i=m-1;i>=0;i--)

		cout<<a[i];

	cout<<endl;*/

	mark=1;

	for(int i=0;i<m;i++){

		if(a[i]!=s1[m-i-1])

			mark=0;

	}

	if(mark==0)

	cout<<"No";

	else

	cout<<"Yes";

	return 0;

} 

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<string>

using namespace std;

char a[100005];

string s,s2,s3;

int main()

{

	scanf("%s",&a);

	s=a;

	for (int j=0;j<=s.size()-1;j++)

	{

		if(s[j]=='b')

		s2+='d';

		if(s[j]=='d')

		s2+='b';

		if(s[j]=='p')

		s2+='q';

		if(s[j]=='q')

		s2+='p';

	}

	for (int j=s2.size()-1;j>=0;j--)

	{

		s3+=s2[j];

	}

	if(s3==s)

	printf("Yes");

	else printf("No");

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<iostream>

#include<algorithm>

#include<cstring>

#include<cctype>

#include<map>

using namespace std;

const int MAXN=100000+7;

string a;

map<char,char> t;

void Change(string &s){

	for(int i=0;i<(int)s.size();i++) s[i]=t[s[i]];

}

void Reserve(string &s){

	int r=(int)s.size()-1;

	int l=0;

	while(l<r){

		swap(s[l],s[r]);

		l++; r--;

	}

}

int main(){

	t.insert(make_pair('b','d'));

	t.insert(make_pair('d','b'));

	t.insert(make_pair('p','q'));

	t.insert(make_pair('q','p'));

	cin>>a;

	string tmp=a,s=a;

	Reserve(tmp);

	if(tmp==a){

		//cout<<tmp<<endl;

		puts("Yes"); return 0;

	}

	Change(tmp); Change(s);

	string res=s; Reserve(res);

	if(tmp==a||s==a||res==a){

		//cout<<tmp<<' '<<s<<endl;

		puts("Yes"); return 0;

	}

	//cout<<tmp<<' '<<s<<' '<<res<<endl;

	puts("No");

	return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<string>

#include<algorithm>

using namespace std;



char f(char c) {

    if(c == 'b') {

        return 'd';

    }

    if(c == 'd') {

        return 'b';

    }

    if(c == 'p') {

        return 'q';

    }

    if(c == 'q') {

        return 'p';

    }

    return c;

}



string deal(string s) {

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



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

        s[i] = f(s[i]);

    }

    return s;

}



int main() {

    string s;



    cin >> s;

    

    if(s == deal(s)) {

        cout << "Yes" << endl;

    } else {

        cout << "No" << endl;

    }

    

    return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <iostream>

#include <string>

#include <cstring>

#include <cmath>

#include <algorithm>

#include <iomanip>

#define rr register

#define int long long

#define f_for(i,a,b) for(rr int i=a;i<=b;i++)

using namespace std;

const int maxx=1e4;

int n,m;

string a,b;

signed main(){

	cin>>a;

	b=a;

	bool t=true;

	int len=a.length()-1;

/*	f_for(i,0,len)

		a[len-i]=a[i];

	f_for(i,0,len)

		cout<<a[i];*/

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

		switch(a[i]){

			

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

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

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

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

		}

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

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

			t=false;

	if(t)

		cout<<"Yes"<<endl;

	else

		cout<<"No"<<endl;

}


// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cmath>

#include<cstdio>

#include<cstring>

#include<iostream>

using namespace std;

char ch[100002];

bool p,d;

int a;



int main(){

	scanf("%s",&ch);

	a=strlen(ch);

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

		if(ch[i]!=ch[a-i-1]){

			p=true;

			break;

		}

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

				if((ch[i]=='p'&&ch[a-i-1]!='q')||(ch[i]=='q'&&ch[a-i-1]!='p')||(ch[i]=='b'&&ch[a-i-1]!='d')||(ch[i]=='d'&&ch[a-i-1]!='b')){

					d=true;

					break;

				}

	if(p&&d) printf("No");

	else printf("Yes");

	return 0;

}


// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

	string s,s1,s2;

	cin>>s;

	s1=s2=s;

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

	for (auto &i : s1)

	{

		if (i=='b')

			i='d';

		else

		if (i=='d')

			i='b';

		else

		if (i=='p')

			i='q';

		else

		if (i=='q')

			i='p';

	}

		

	if (s==s1)

	{

		cout<<"Yes";

	}

	else

		cout<<"No";

	return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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一定要加,不然就白做了

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

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

    }

    if(a==b) cout<<"Yes";//判断

    else cout<<"No";

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

int main()

{

    string str;

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    cout.tie(nullptr);

    cin>>str;

    string tmp=str;

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

    for(string::iterator it=str.begin();it!=str.end();++it)

        switch(*it)

        {

            case 'p':*it='q';break;

            case 'q':*it='p';break;

            case 'b':*it='d';break;

            case 'd':*it='b';break;

        }

    if(str==tmp) cout<<"Yes"<<endl;

    else cout<<"No"<<endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define itn int

#define For(a,b,c,t)  for(ri a=b;a<=c;a+=t)

#define ri register int

#define Memset(a,b)  memset(a,b,sizeof(a))

#define li long long

#define il inline

using namespace std;

string a,b;

int main()

{

	cin>>a;

	int l=a.size();

	b=a;

	//printf("\n");

	For(i,0,l-1,1)

	{

		if(b[i]=='b')

		  b[i]='d';

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

		  b[i]='b';

		else if(b[i]=='q')

		  b[i]='p';

		else if(b[i]=='p')

		  b[i]='q';

		//printf("%c",b[i]);

	}

	//printf("\n");

	For(i,0,l-1,1)

	{

		if(a[i]!=b[l-1-i])

		{

			printf("No");

			exit(0);

		}

	}

	printf("Yes");

	return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main(){

    string s;

    cin>>s;

    string b=s;

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

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

    {

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

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

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

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

    }

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

    else cout<<"No";

    return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main() {

    string s,s1;

    cin>>s;

    s1=s;

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

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

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

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

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

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

    }

    if(s==s1) {

        cout<<"Yes"<<endl;

    } else {

        cout<<"No"<<endl;

    }

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cstring>

using namespace std;

int main()

{

	char s[100100];

	scanf("%s",s);

	int l=strlen(s);

	if(l%2!=0)

	{

		cout<<"No\n";

		return 0;

	}

	bool f=0;

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

	{

		if(s[i]=='p'&&s[l-i-1]!='q')

		{

			f=1;break;

		}

		if(s[i]=='q'&&s[l-i-1]!='p')

		{

			f=1;break;

		}

		if(s[i]=='b'&&s[l-i-1]!='d')

		{

			f=1;break;

		}

		if(s[i]=='d'&&s[l-i-1]!='b')

		{

			f=1;break;

		}

	}

	if(!f)

	cout<<"Yes\n";

	else

	cout<<"No\n";

	return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

string s;

char t[10000000];

int len;

int main()

{

	cin>>s;

	len=s.size();

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

	{

		if(s[i]=='b') t[len-i-1]='d';

		else if(s[i]=='d') t[len-i-1]='b';

		else if(s[i]=='p') t[len-i-1]='q';

		else if(s[i]=='q') t[len-i-1]='p';

	}

//	cout<<endl;

//	cout<<"s="<<s<<endl;

//	cout<<"t="<<t<<endl;

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

		if(s[i]!=t[i])

		{

			cout<<"No\n";

			return 0;

		}

	cout<<"Yes\n";

	return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

char s[100007];

int g[128];

int main()

{

    g['b'] = 0 , g['p'] = 1 , g['d'] = 2 , g['q'] = 3;

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

    for(int l = strlen(s+1),i=1;i<=(l>>1)+1;i++)

    {

        if(g[s[i]]^((g[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    }  

    return printf("Yes\n"),0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

string s1,s2;

int main(){

	cin>>s1;

	s2=s1;

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

	for(int i=0;i<s1.length();i++){

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

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

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

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

	}

	for(int i=0;i<s1.length();i++){

		if(s1[i]!=s2[i]){

			cout<<"No"<<endl;

			return 0;

		}

	}

	cout<<"Yes"<<endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#include<algorithm>

#include<cstring>

#include<cstdio>

#include<cmath>

char s[100007];

int get[128];

int main()

{

    get['b'] = 0 , get['p'] = 1 , get['d'] = 2 , get['q'] = 3;

    scanf("%s",s+1); // 从 s[1] 开始的

    for(int l = strlen(s+1), i = 1; i <= (l>>1) + 1; ++i)

    {

        if(get[s[i]]^((get[s[l-i+1]]+2)%4)) return printf("No\n"),0;

    } // 这个 +2 %4 刚好让 b 转到 d 上， d 转到 b 上， p 转到 q 上， q 转到 p 上 

    return printf("Yes\n"),0;

}

// Fastest known solution for this problem: