/*
numbers mapping:
a = 1
b = 2
...
j = 10#
...
z = 26#
*/
function decryptString(str) {
let result = "";
let i = 0;
while (i < str.length) {
if (i + 2 < str.length && str[i + 2] === '#') {
let num = (parseInt(str[i], 10) * 10) + parseInt(str[i + 1], 10);
result += String.fromCharCode(num + 96);
i += 3;
} else {
result += String.fromCharCode(parseInt(str[i], 10) + 96);
i += 1;
}
}
return result;
}
let decrypted = decryptString("12310#11#26#");
console.log(decrypted);
/*
run:
abcjkz
*/