noma,nomb=input().split(" ")
lonun=len(noma)
londe=len(nomb)
sma=0
smb=0
for i in range(lonun):
    t=noma[i]
    sma+=ord(t)-65
for i in range(londe):
    t=nomb[i]
    smb+=ord(t)-65
if sma>=10:
    while sma>=10:
        somme = sum(int(chiffre) for chiffre in str(sma))
        sma=somme
if smb>=10:
    while smb>=10:
        somme = sum(int(chiffre) for chiffre in str(smb))
        smb=somme


print(sma,end=" ")
print(smb)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: