| Task: | Palindromi |
| Sender: | j-l |
| Submission time: | 2025-11-01 16:47:00 +0200 |
| Language: | Node.js |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.11 s | details |
| #2 | ACCEPTED | 0.11 s | details |
| #3 | ACCEPTED | 0.11 s | details |
| #4 | ACCEPTED | 0.12 s | details |
| #5 | WRONG ANSWER | 0.11 s | details |
| #6 | WRONG ANSWER | 0.11 s | details |
| #7 | WRONG ANSWER | 0.11 s | details |
| #8 | WRONG ANSWER | 0.11 s | details |
| #9 | WRONG ANSWER | 0.11 s | details |
| #10 | WRONG ANSWER | 0.11 s | details |
Code
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
function palindromi(wordOrigin){
let txtlength = 0;
let result1 = "";
let result2 = "";
let changes = 0;
while ((wordOrigin.length/2) > txtlength) {
result1 = result1+wordOrigin.charAt(txtlength);
result2 = wordOrigin.charAt(txtlength+(Math.floor(wordOrigin.length/2)))+result2;
if (result1.charAt(txtlength) != result2.charAt(txtlength)) {
changes += 1;
};
txtlength += 1;
};
if (result1 === result2) {
return 0;
};
txtlength = 0;
while ((wordOrigin.length/2) > txtlength) {
if (result1.charAt(txtlength) != result2.charAt(txtlength)) {
changes += 1;
};
txtlength += 1;
};
return changes;
};
rl.question("", (text) => {
console.log(palindromi(text));
rl.close();
});Test details
Test 1 (public)
Verdict: WRONG ANSWER
| input |
|---|
| datatahti |
| correct output |
|---|
| 3 |
| user output |
|---|
| 6 |
Test 2 (public)
Verdict: ACCEPTED
| input |
|---|
| saippuakauppias |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 3 (public)
Verdict: ACCEPTED
| input |
|---|
| a |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 4 (public)
Verdict: ACCEPTED
| input |
|---|
| aa |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 5 (public)
Verdict: WRONG ANSWER
| input |
|---|
| abc |
| correct output |
|---|
| 1 |
| user output |
|---|
| 2 |
Test 6 (public)
Verdict: WRONG ANSWER
| input |
|---|
| aybabtu |
| correct output |
|---|
| 2 |
| user output |
|---|
| 4 |
Test 7 (public)
Verdict: WRONG ANSWER
| input |
|---|
| abacabaca |
| correct output |
|---|
| 2 |
| user output |
|---|
| 4 |
Test 8 (public)
Verdict: WRONG ANSWER
| input |
|---|
| bbbbaaaababbbbbaabaaabaaaaabab... |
| correct output |
|---|
| 23 |
| user output |
|---|
| 46 |
Test 9 (public)
Verdict: WRONG ANSWER
| input |
|---|
| acbaaabaabaddaccdcccbcdbdddacd... |
| correct output |
|---|
| 38 |
| user output |
|---|
| 73 |
Test 10 (public)
Verdict: WRONG ANSWER
| input |
|---|
| uaqtmfftecryanvpshxsodjrllqnqp... |
| correct output |
|---|
| 49 |
| user output |
|---|
| 97 |
