{"ScriptPreparationCode":null,"TestCases":[{"Name":"FCC","Code":"// Solution with Regular expression and Array of ASCII character codes\r\nfunction rot13(str) {\r\n var rotCharArray = [];\r\n var regEx = /[A-Z]/ ;\r\n str = str.split(\u0022\u0022);\r\n for (var x in str) {\r\n if (regEx.test(str[x])) {\r\n // A more general approach\r\n // possible because of modular arithmetic\r\n // and cyclic nature of rot13 transform\r\n rotCharArray.push((str[x].charCodeAt() - 65 \u002B 13) % 26 \u002B 65);\r\n } else {\r\n rotCharArray.push(str[x].charCodeAt());\r\n }\r\n }\r\n str = String.fromCharCode.apply(String, rotCharArray);\r\n return str;\r\n}\r\n\r\n// Change the inputs below to test\r\nrot13(\u0022LBH QVQ VG!\u0022);","IsDeferred":false},{"Name":"self","Code":"function rot13(str) { // LBH QVQ VG!\r\n var decode = [];\r\n var decodeString = \u0022\u0022;\r\n for (i = 0; i \u003C str.length; i\u002B\u002B) {\r\n decode.push(str.charCodeAt(i));\r\n if (decode[i] \u003E= 78 \u0026\u0026 decode[i] \u003C= 90) {\r\n decode[i] = decode[i] - 13;\r\n } else if (decode[i] \u003E= 65 \u0026\u0026 decode[i] \u003C 78) {\r\n decode[i] = decode[i] \u002B 13;\r\n }\r\n decodeString \u002B= String.fromCharCode(decode[i]);\r\n }\r\n return decodeString;\r\n}\r\n\r\n// Change the inputs below to test\r\nrot13(\u0022SERR PBQR PNZC\u0022);\r\n","IsDeferred":false}]}