Problem: 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:    * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;   * the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names `aa`, `ab`, `ac`, ..., `zy`, `zz`;   * the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names `aaa`, `aab`, `aac`, ..., `zzy`, `zzz`;   * the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names `aaaa`, `aaab`, `aaac`, ..., `zzzy`, `zzzz`;   * the dogs numbered 475255,475256,\cdots  were respectively given the names `aaaaa`, `aaaab`, ...;   * and so on.  To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:  `a`, `b`, ..., `z`, `aa`, `ab`, ..., `az`, `ba`, `bb`, ..., `bz`, ..., `za`, `zb`, ..., `zz`, `aaa`, `aab`, ..., `aaz`, `aba`, `abb`, ..., `abz`, ..., `zzz`, `aaaa`, ...  Now, Roger asks you:  "What is the name for the dog numbered N?"

Submission attempts (in order):
n = int(input())
mod = 26
x = 1
l = list()
while True:
    if n <= mod:
        for i in range(x):
            l.append(n%26)
            n = n//26
        break
    else:
        n -= mod
        mod *= 26
        x += 1
l.reverse()

print(l)
l2 = list()
if l.count(0) == x:
    print("z"*x)
    exit()
for i in range(len(l)):
    if i == x-1:
        if l[i] == 0:
            l2.append("z")
        else:
            l2.append(chr(l[i]+96))
    else:
        l2.append(chr(l[i]+97))
print("".join(l2))

n = int(input())
mod = 26
x = 1
l = list()
while True:
    if n <= mod:
        print(n)
        for i in range(x):
            l.append(n%26)
            n = n//26
        break
    else:
        n -= mod
        mod *= 26
        x += 1
l.reverse()

l2 = list()
print(l)
# if l.count(0) == x:
#     print("z"*x)
#     exit()

#     if l[i] == 0:
#         l[i-1] -= 1
#         l[i] = 26
if l.count(0) == x:
    print("z"*x)
    exit()
for i in range(x-1):
    l[i] += 1
for i in range(x-1,-1,-1):
    if l[i] == 0:
        l[i-1] -= 1
        l[i] = 25
print(l)
for i in range(len(l)):
    l2.append(chr(l[i]+96))
print("".join(l2))

n = int(input())
mod = 26
x = 1
l = list()
while True:
    if n <= mod:
        print(n)
        for i in range(x):
            l.append(n%26)
            n = n//26
        break
    else:
        n -= mod
        mod *= 26
        x += 1
l.reverse()

l2 = list()
print(l)
# if l.count(0) == x:
#     print("z"*x)
#     exit()

#     if l[i] == 0:
#         l[i-1] -= 1
#         l[i] = 26
if l.count(0) == x:
    print("z"*x)
    exit()
for i in range(x-1):
    l[i] += 1
for i in range(x-1,-1,-1):
    if l[i] == 0:
        l[i-1] -= 1
        l[i] = 26
print(l)
for i in range(len(l)):
    l2.append(chr(l[i]+96))
print("".join(l2))

n = int(input())
mod = 26
x = 1
l = list()
while True:
    if n <= mod:
        print(n)
        for i in range(x):
            l.append(n%26)
            n = n//26
        break
    else:
        n -= mod
        mod *= 26
        x += 1
l.reverse()

l2 = list()
# if l.count(0) == x:
#     print("z"*x)
#     exit()

#     if l[i] == 0:
#         l[i-1] -= 1
#         l[i] = 26
if l.count(0) == x:
    print("z"*x)
    exit()
for i in range(x-1):
    l[i] += 1
for i in range(x-1,-1,-1):
    if l[i] == 0:
        l[i-1] -= 1
        l[i] = 26
for i in range(len(l)):
    l2.append(chr(l[i]+96))
print("".join(l2))

n = int(input())
mod = 26
x = 1
l = list()
while True:
    if n <= mod:
        for i in range(x):
            l.append(n%26)
            n = n//26
        break
    else:
        n -= mod
        mod *= 26
        x += 1
l.reverse()

l2 = list()
# if l.count(0) == x:
#     print("z"*x)
#     exit()

#     if l[i] == 0:
#         l[i-1] -= 1
#         l[i] = 26
if l.count(0) == x:
    print("z"*x)
    exit()
for i in range(x-1):
    l[i] += 1
for i in range(x-1,-1,-1):
    if l[i] == 0:
        l[i-1] -= 1
        l[i] = 26
for i in range(len(l)):
    l2.append(chr(l[i]+96))
print("".join(l2))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted