| Task: | Palindromi |
| Sender: | Viiviiii |
| Submission time: | 2025-10-29 21:45:39 +0200 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | 100 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 100 |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.04 s | details |
| #2 | ACCEPTED | 0.04 s | details |
| #3 | ACCEPTED | 0.04 s | details |
| #4 | ACCEPTED | 0.04 s | details |
| #5 | ACCEPTED | 0.04 s | details |
| #6 | ACCEPTED | 0.04 s | details |
| #7 | ACCEPTED | 0.04 s | details |
| #8 | ACCEPTED | 0.04 s | details |
| #9 | ACCEPTED | 0.04 s | details |
| #10 | ACCEPTED | 0.04 s | details |
Code
word = input("")
word_lenght = len(word)
times = 0
true = 0
new_half = ""
new_another_half = ""
pair=0
if word_lenght > 100 :
exit()
else:
if word_lenght%2==0:
half_lenght=word_lenght//2
half_word = (word[0:half_lenght])
another_half = (word[half_lenght:])
atm_letter = 0
atm_letter_negative = -1
while atm_letter<half_lenght:
a = half_word[atm_letter]
b = another_half[atm_letter_negative]
atm_letter +=1
atm_letter_negative -=1
if a != b:
if pair%2==0:
b = a
pair+=1
times+=1
else:
a = b
times+=1
new_half = new_half + a
new_another_half = new_another_half + b
new_another_half_lenght = len(new_another_half)
new_new_another_half_letter=0
new_new_another_half = ""
number=-1
while new_new_another_half_letter < new_another_half_lenght:
new_new_another_half += new_another_half[number]
number -=1
new_new_another_half_letter +=1
else:
half_lenght=word_lenght//2
half_word = (word[0:half_lenght])
another_half = (word[half_lenght+1:])
atm_letter = 0
atm_letter_negative = -1
while atm_letter<half_lenght:
a = half_word[atm_letter]
b = another_half[atm_letter_negative]
atm_letter +=1
atm_letter_negative -=1
if a != b:
if pair%2==0:
b = a
pair+=1
times+=1
else:
a = b
times+=1
new_half = new_half + a
new_another_half = new_another_half + b
new_half += word[half_lenght]
new_another_half_lenght = len(new_another_half)
new_new_another_half_letter=0
new_new_another_half = ""
number=-1
while new_new_another_half_letter < new_another_half_lenght:
new_new_another_half += new_another_half[number]
number -=1
new_new_another_half_letter +=1
print(times)
Test details
Test 1 (public)
Verdict: ACCEPTED
| input |
|---|
| datatahti |
| correct output |
|---|
| 3 |
| user output |
|---|
| 3 |
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: ACCEPTED
| input |
|---|
| abc |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 6 (public)
Verdict: ACCEPTED
| input |
|---|
| aybabtu |
| correct output |
|---|
| 2 |
| user output |
|---|
| 2 |
Test 7 (public)
Verdict: ACCEPTED
| input |
|---|
| abacabaca |
| correct output |
|---|
| 2 |
| user output |
|---|
| 2 |
Test 8 (public)
Verdict: ACCEPTED
| input |
|---|
| bbbbaaaababbbbbaabaaabaaaaabab... |
| correct output |
|---|
| 23 |
| user output |
|---|
| 23 |
Test 9 (public)
Verdict: ACCEPTED
| input |
|---|
| acbaaabaabaddaccdcccbcdbdddacd... |
| correct output |
|---|
| 38 |
| user output |
|---|
| 38 |
Test 10 (public)
Verdict: ACCEPTED
| input |
|---|
| uaqtmfftecryanvpshxsodjrllqnqp... |
| correct output |
|---|
| 49 |
| user output |
|---|
| 49 |
