Submission details
Task:Babaza Game
Sender:aalto26am_046
Submission time:2026-08-31 17:36:37 +0300
Language:Python3 (PyPy3)
Status:READY
Result:
Test results
testverdicttime
#10.04 sdetails
#2ACCEPTED0.04 sdetails
#3ACCEPTED0.04 sdetails
#4ACCEPTED0.04 sdetails
#50.04 sdetails
#6ACCEPTED0.04 sdetails
#7ACCEPTED0.04 sdetails
#8ACCEPTED0.04 sdetails
#9ACCEPTED0.04 sdetails
#10ACCEPTED0.04 sdetails
#11ACCEPTED0.04 sdetails
#12ACCEPTED0.04 sdetails
#13ACCEPTED0.04 sdetails
#140.04 sdetails

Code

start = input()
end = input()
wl = len(start)
lst = [start]


s = []
e = []

for i in range(wl):
    s.append(ord(start[i]))
    e.append(ord(end[i]))


unique = -1
for i in range (65, 85):
    if i in s or i in e:
        continue
    else:
        unique = i
        break






strat = 0

was_diff = False
for i in range(wl):
    if e[i] != s[i]:
        strat = max(1,strat)
        if was_diff:
            strat = max(2,strat)
            

            
        was_diff = True
    else:
        was_diff = False


def check(word):
    for i in range(len(word)-1):
        if word[i] == word[i+1]:
            return False
    return True

def tochr(word):
    # print("adding" + "".join([chr(w) for w in word]))
    return "".join([chr(w) for w in word])
    
        

was_diff = False


next = s.copy()
if strat == 2:

    for j in range(2):
        changed = False
        for i in range(wl):
            if e[i] != next[i]:
                if not changed and not (i>=1 and e[i] == next[i-1]) and not (i<wl -1 and e[i] == next[i+1]):
                    next[i] = e[i]
                    changed = True

                else:
                    changed = False
            else:
                changed = False

        lst.append(tochr(next))

    # print(lst)
    val = False
    for i in range(len(next)):
        if next[i] != e[i]:
            # print(next,e)
            val = True
    if val:
        lst = [start]

        # the bruteforce
        next = s.copy()

        for i in range(0,wl,2):
            next[i] = unique
        lst.append(tochr(next))

        for i in range(1,wl,2):
            next[i] = e[i]
        lst.append(tochr(next))
        lst.append(end)


                

                

    

    # for i in range(0,wl,2):
    #     next[i] = e[i]


    # if not check(next) :
    #     for i in range(1,wl,2):
    #         next = s.copy()
    #         next[i] = e[i]
    #         if not check(next):


                # # the bruteforce
                # next = s.copy()

                # for i in range(0,wl,2):
                #     next[i] = unique
                # lst.append(tochr(next))

                # for i in range(1,wl,2):
                #     next[i] = e[i]
                # lst.append(tochr(next))


    #         else:
    #             lst.append(tochr(next))

    # else:
    #     lst.append(tochr(next))


                
            



    







for l in lst:
    print(l)

# print(lst)

Test details

Test 1

Verdict:

input
A
B

correct output
A
B

user output
A

Test 2

Verdict: ACCEPTED

input
BABAZA
BACBCB

correct output
BABAZA
BACACA
BACBCB

user output
BABAZA
BACACA
BACBCB

Test 3

Verdict: ACCEPTED

input
AB
BA

correct output
AB
CB
CA
BA

user output
AB
CB
CA
BA

Test 4

Verdict: ACCEPTED

input
ABC
BCD

correct output
ABC
DBD
DCD
BCD

user output
ABC
EBE
ECE
BCD

Test 5

Verdict:

input
AXYB
CXYD

correct output
AXYB
CXYD

user output
AXYB

Test 6

Verdict: ACCEPTED

input
LMIJLF
PAQBMH

correct output
LMIJLF
PMQJMF
PAQBMH

user output
LMIJLF
PMQJMF
PAQBMH

Test 7

Verdict: ACCEPTED

input
PNIWLSLIH
CRLVPUFHD

correct output
PNIWLSLIH
CNLWPSFID
CRLVPUFHD

user output
PNIWLSLIH
CNLWPSFID
CRLVPUFHD

Test 8

Verdict: ACCEPTED

input
ZDYIAVTKL
ZJKVXGAUM

correct output
ZDYIAVTKL
ZJYVAGTUL
ZJKVXGAUM

user output
ZDYIAVTKL
ZJYVAGTUL
ZJKVXGAUM

Test 9

Verdict: ACCEPTED

input
FBIXISJH
NXZIESMG

correct output
FBIXISJH
NBZXESMH
NXZIESMG

user output
FBIXISJH
NBZXESMH
NXZIESMG

Test 10

Verdict: ACCEPTED

input
OPGW
QJIE

correct output
OPGW
QPIW
QJIE

user output
OPGW
QPIW
QJIE

Test 11

Verdict: ACCEPTED

input
DUKNPKQZBL
NZPBMOEBIC

correct output
DUKNPKQZBL
NUPNMKEZIL
NZPBMOEBIC

user output
DUKNPKQZBL
NUPNMKEZIL
NZPBMOEBIC

Test 12

Verdict: ACCEPTED

input
ZWDTX
HZOXI

correct output
ZWDTX
HWOTI
HZOXI

user output
ZWDTX
HWOTI
HZOXI

Test 13

Verdict: ACCEPTED

input
URJF
ITIQ

correct output
URJF
IRIF
ITIQ

user output
URJF
IRIF
ITIQ

Test 14

Verdict:

input
WYWBWU
IRYVBA

correct output
WYWBWU
WRWVWA
IRYVBA

user output
WYWBWU
CYCBCU
CRCVCA
IRYVBA