function solution(content, offset) {
return content.replace(/[a-zA-Z]/g,(char) => {
const isUppercase = char === char.toUpperCase()
const charCode = char.charCodeAt(0)
const base = isUppercase ? 'A'.charCodeAt(0) : 'a'.charCodeAt(0)
const newCharCode = (charCode - base + offset + 26) % 26 + base
return String.fromCharCode(newCharCode)
})
}
function encrypt(text) {
// Simple encryption logic (for demonstration purposes)
return solution(text, 3);
}
function decrypt(text) {
// Simple encryption logic (for demonstration purposes)
return solution(text, -3);
}