Submission #166207

# Submission time Handle Problem Language Result Execution time Memory
166207 2019-12-01T07:07:35 Z boboquack Mobitel (COCI14_mobitel) Python 3
50 / 50
74 ms 3428 KB
d={
'a':'2',
'b':'22',
'c':'222',
'd':'3',
'e':'33',
'f':'333',
'g':'4',
'h':'44',
'i':'444',
'j':'5',
'k':'55',
'l':'555',
'm':'6',
'n':'66',
'o':'666',
'p':'7',
'q':'77',
'r':'777',
's':'7777',
't':'8',
'u':'88',
'v':'888',
'w':'9',
'x':'99',
'y':'999',
'z':'9999',
}
n=input()
e={i:d[i].replace(d[i][0],str(n.index(d[i][0])//2+1)) for i in d}
s='#'.join(e[i] for i in input())
t=''
for i in range(len(s)):
    if s[i]!='#' or s[i-1]==s[i+1]:
        t+=s[i]
print(t)
# Verdict Execution time Memory Grader output
1 Correct 26 ms 3360 KB Output is correct
2 Correct 25 ms 3364 KB Output is correct
3 Correct 25 ms 3368 KB Output is correct
4 Correct 25 ms 3360 KB Output is correct
5 Correct 26 ms 3428 KB Output is correct
6 Correct 74 ms 3336 KB Output is correct
7 Correct 27 ms 3292 KB Output is correct
8 Correct 26 ms 3364 KB Output is correct
9 Correct 27 ms 3360 KB Output is correct
10 Correct 26 ms 3356 KB Output is correct