Submission details
Task:Palindromi
Sender:j-l
Submission time:2025-11-01 16:53:41 +0200
Language:Node.js
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.11 sdetails
#20.11 sdetails
#30.11 sdetails
#40.11 sdetails
#50.11 sdetails
#60.11 sdetails
#70.12 sdetails
#80.12 sdetails
#90.12 sdetails
#100.12 sdetails

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 (Math.ceil(wordOrigin.length/2) > txtlength) {
        result1 = result1+wordOrigin.charAt(txtlength);
        result2 = wordOrigin.charAt(txtlength+(Math.floor(wordOrigin.length/2)))+result2;
        console.log(result1);
        console.log(result2);
        txtlength += 1;
    };
    txtlength = 0;
    while(result1.length != 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:

input
datatahti

correct output
3

user output
d
t
da
at
dat
...

Test 2 (public)

Verdict:

input
saippuakauppias

correct output
0

user output
s
k
sa
ak
sai
...

Test 3 (public)

Verdict:

input
a

correct output
0

user output
a
a
0

Test 4 (public)

Verdict:

input
aa

correct output
0

user output
a
a
0

Test 5 (public)

Verdict:

input
abc

correct output
1

user output
a
b
ab
cb
1

Test 6 (public)

Verdict:

input
aybabtu

correct output
2

user output
a
a
ay
ba
ayb
...

Test 7 (public)

Verdict:

input
abacabaca

correct output
2

user output
a
a
ab
ba
aba
...

Test 8 (public)

Verdict:

input
bbbbaaaababbbbbaabaaabaaaaabab...

correct output
23

user output
b
a
bb
aa
bbb
...

Test 9 (public)

Verdict:

input
acbaaabaabaddaccdcccbcdbdddacd...

correct output
38

user output
a
d
ac
bd
acb
...

Test 10 (public)

Verdict:

input
uaqtmfftecryanvpshxsodjrllqnqp...

correct output
49

user output
u
w
ua
mw
uaq
...