-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path1287.py
More file actions
35 lines (31 loc) · 765 Bytes
/
Copy path1287.py
File metadata and controls
35 lines (31 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def strtoint(palavra):
inteiro = ''
lista_int = '1234567890'
check = 0
for letra in palavra:
if letra in lista_int:
inteiro += letra
else:
if letra == 'l':
inteiro += '1'
elif letra == 'o' or letra == 'O':
inteiro += '0'
elif letra != ',' and letra != ' ':
check = 1
break
try:
inteiro = int(inteiro)
if inteiro > 2147483647:
check = 1
except ValueError:
inteiro = 'error'
if check:
inteiro = 'error'
return inteiro
while True:
try:
entrada = input()
entrada = strtoint(entrada)
print(entrada)
except EOFError:
break