// 小写转大写 大写转小写 // 数字 0-9 9-0 // a97 A65 // z112 Z90 // 加密(往前) 解密(往后) // 加解密各有两套 (大写字母加解密,小写字母加解密) // 加密:a B/ A b // 解密:b A/B a // 边界情况 加密 z Z;解密 a A;9 0 const rl = require("readline").createInterface({ input: process.stdin, output: process.stdout, }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; // 加密 const encode = (str) => { let arr = str.split(""); arr = arr.map((item) => { if (!isNaN(item)) { if (item == "9") { item = "0"; } else { item = String(Number(item) + 1); } } else { if (item == "z") { item = "A"; } else if (item == "Z") { item = "a"; } else { if (item.charCodeAt() > 90) { /* 小写 */ item = String.fromCharCode(item.charCodeAt() - 31); } else { /* 大写 */ item = String.fromCharCode(item.charCodeAt() + 33); } } } return item; }); return arr.join(""); }; //解密 const decode = (str) => { let arr = str.split(""); arr = arr.map((item) => { if (!isNaN(item)) { if (item == "0") { item = "9"; } else { item = String(Number(item) - 1); } } else { if (item == "A") { item = "z"; } else if (item == "a") { item = "Z"; } else { if (item.charCodeAt() > 90) { /* 小写 */ item = String.fromCharCode(item.charCodeAt() - 33); } else { /* 大写 */ item = String.fromCharCode(item.charCodeAt() + 31); } } } return item; }); return arr.join(""); }; void (async function () { let len = 0; let targetStr = ""; while ((line = await readline())) { len++; if (len == 1) { targetStr += encode(line); } else { targetStr += "\n" + decode(line); } } console.log(targetStr); })();