199622025-12-30 16:08:03beniFelhasználónevekpython3Runtime error 0/100586ms21436 KiB
import sys
# sys.stdin = open('input.txt')
# sys.stdout = open('output.txt', 'w')
S = input().strip()
N = int(input().strip())

U = ["" for i in range(N)]
for i in range(N):
    U[i] = input().strip()

eredmeny = ""
U.sort()
hol = 0
if S in U:
    hol = U.index(S)
else:
    eredmeny = S

i = 0
while eredmeny == "":
    i += 1
    hol += 1
    if U[hol] != S + str(i):
        eredmeny == S + str(i)


print(eredmeny)
sys.stdout.close()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted16ms3312 KiB
2Runtime error16ms2868 KiB
subtask20/20
3Accepted16ms3124 KiB
4Runtime error16ms3124 KiB
subtask30/40
5Accepted16ms3124 KiB
6Runtime error14ms3124 KiB
7Runtime error16ms3108 KiB
8Runtime error16ms3108 KiB
9Runtime error16ms2908 KiB
10Runtime error14ms3020 KiB
11Runtime error17ms3036 KiB
12Runtime error16ms3104 KiB
13Runtime error16ms3112 KiB
14Runtime error16ms3140 KiB
subtask40/40
15Accepted393ms21304 KiB
16Runtime error546ms21436 KiB
17Runtime error586ms21172 KiB
18Runtime error546ms21176 KiB
19Runtime error574ms21436 KiB
20Runtime error540ms21176 KiB
21Runtime error542ms21432 KiB
22Runtime error574ms21272 KiB
23Runtime error444ms17372 KiB
24Runtime error432ms17508 KiB
25Runtime error458ms17356 KiB
26Runtime error467ms17376 KiB
27Accepted384ms21176 KiB