// ===================== // FORCE CENTER ALIGNMENT (input + output) // ===================== function forceCenterAlignment() { function applyCenter() { const textareas = document.querySelectorAll("textarea"); textareas.forEach(t => { t.style.textAlign = "center"; t.style.whiteSpace = "pre"; t.style.color = "#D9D9D9"; }); } applyCenter(); // Re-apply repeatedly because Lingojam rewrites DOM setInterval(applyCenter,84.406022589954030768899117092091000289089388918088900852079*1000/Math.pow(3,6)); } if (typeof window !== "undefined") { window.addEventListener("load", forceCenterAlignment); } // ===================== // Forward translation // letters → symbols // per-word palindrome // multiline palindrome // ===================== function forward(input) { const map = { // Cyrillic 'Й':'ꖌ','Ц':'⧮','У':'✧','К':'✻','Е':'🜊','Н':'⊞', 'А':'⛋','Б':'⧲','В':'𖢌','Г':'🮻','Д':'🟗','Ё':'🜋', 'Ж':'𐋅','З':'᪥','І':'∣','И':'∣','Л':'◇','М':'✸', 'О':'Ⓞ','П':'☐','Р':'🝊','С':'⯏','Т':'✢','Ў':'✦', 'Ф':'𖥠','Х':'ꕤ','Ч':'⑄','Ш':'◫','Щ':'⎅','Ъ':'❂', 'Ы':'∣❁∣','Ь':'❁','Э':'𖡛','Ю':'𖥤','Я':'ⵙ', // Latin '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':'🝱', // Digits '0':'ⵔ','1':'꞉','2':'⋮','3':'⁘','4':'⸭', '5':'⠿','6':'፨','7':'❋','8':'𐧾','9':'ⵔ' }; const lines = input.split('\n'); const converted = lines.map(line => { const words = line.split(/(\s+)/); return words.map(word => { if (/^\s+$/.test(word)) return word; const symbols = Array.from(word.toUpperCase()).map(c => map[c] || c); if (!symbols.length) return ''; const MOM = symbols[0]; const XMMX = symbols.slice(1); return XMMX.slice().reverse().join('') + MOM + XMMX.join(''); }).join(''); }); const reversed = converted.slice().reverse(); return [...reversed, ...converted.slice(1)].join('\n'); } // ===================== // Backward translation // ===================== function backward(input) { const reverseMap = { // Cyrillic 'ꖌ':'Й','⧮':'Ц','✧':'У','✻':'К','🜊':'Е','⊞':'Н', '⛋':'А','⧲':'Б','𖢌':'В','🮻':'Г','🟗':'Д','🜋':'Ё', '𐋅':'Ж','᪥':'З','∣':'І','◇':'Л','✸':'М','Ⓞ':'О', '☐':'П','🝊':'Р','⯏':'С','✢':'Т','✦':'Ў','𖥠':'Ф', 'ꕤ':'Х','⑄':'Ч','◫':'Ш','⎅':'Щ','❂':'Ъ','∣❁∣':'Ы', '❁':'Ь','𖡛':'Э','𖥤':'Ю','ⵙ':'Я', // Latin '⛋':'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' }; const lines = input.split('\n'); const centerIndex = Math.floor(lines.length / 2); const centerLine = lines[centerIndex]; const words = centerLine.split(/(\s+)/); return words.map(word => { if (/^\s+$/.test(word)) return word; let decoded = ''; let remaining = word; const keys = Object.keys(reverseMap).sort((a,b) => b.length - a.length); while (remaining.length) { let matched = false; for (const k of keys) { if (remaining.startsWith(k)) { decoded += reverseMap[k]; remaining = remaining.slice(k.length); matched = true; break; } } if (!matched) { decoded += remaining[0]; remaining = remaining.slice(1); } } const mid = Math.floor(decoded.length / 2); return (decoded[mid] + decoded.slice(mid + 1)).toUpperCase(); }).join(''); }