Problem:
Score : 100 points

Problem Statement

You are given a string S consisting of letters b, d, p and q.
Determine whether S is a mirror string.

Here, a mirror string is a string S such that the following sequence of operations on S results in the same string S:

Reverse the order of the characters in S.

Replace each occurrence of b by d, d by b, p by q, and q by p, simultaneously.

Constraints

1 \leq |S| \leq 10^5

S consists of letters b, d, p, and q.

Input

The input is given from Standard Input in the following format:

S

Output

If S is a mirror string, print Yes. Otherwise, print No.

Sample Input 1

pdbq

Sample Output 1

Yes

Sample Input 2

ppqb

Sample Output 2

No

Solution in JavaScript (node.js v5.12) (judge verdict: Runtime Error)

// inputに入力データ全体が入る
let inputCnt;
function Main(input) {

    //配列inputに順番に代入
	input = input.replace( /\n/g , " " );
	input = input.split(" ");
	inputCnt = 0;
	
	//for(var i = 0; i < input.length; i++)console.log('%s',input[i]);
		
	let s = inS();
   
	if(check(s[0]) == s[3] && check(s[1]) == s[2])out("Yes");
	else out("No"); 
}

function check(t){
    if(t == "d")return "b"
    if(t == "b")return "d"
    if(t == "p")return "q"
    if(t == "p")return "q"
}

// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
	input = document.getElementById("input").value;
	Main(input);
}
function out(output){
    console.log(output);
}
function inI(){
    return parseInt(inS(), 10);
}
function inF(){
    return parseFloat(inS());
}
function inS(){
    return input[inputCnt++];
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));