位移密码算法挑战
function rot13(str) { // LBH QVQ VG!
var cipher=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
var rot = "";
for(var i = 0; i < str.length; i++){
var index = -1 ;
index = cipher.indexOf(str[i]);
if( index >= 0 ){
rot += cipher[(index + 13) % 26];
}else{
rot += str[i];
}
}
return rot;
}
// Change the inputs below to test
rot13("SERR PBQR PNZC");