-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1.py
136 lines (125 loc) · 4.16 KB
/
1.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import sys
def isDigit(s, i):
if s[i]>='0' and s[i]<='9':
return True
elif (s[i]=='o' or s[i]=='O') and i+2<len(s):
if s[i+1]=='n' or s[i+1]=='N':
if s[i+2]=='e' or s[i+2]=='E':
return True
return False
elif (s[i]=='t' or s[i]=='T') and i+2<len(s):
if s[i+1]=='w' or s[i+1]=='W':
if s[i+2]=='o' or s[i+2]=='O':
return True
elif (s[i+1]=='h' or s[i+1]=='H') and i+3<len(s):
if s[i+2]=='r' or s[i+2]=='R':
if s[i+3]=='e' or s[i+3]=='E':
return True
return False
elif (s[i]=='f' or s[i]=='F') and i+3<len(s):
if s[i+1]=='o' or s[i+1]=='O':
if s[i+2]=='u' or s[i+2]=='U':
if s[i+3]=='r' or s[i+3]=='R':
return True
elif s[i+1]=='i' or s[i+1]=='I':
if s[i+2]=='v' or s[i+2]=='V':
if s[i+3]=='e' or s[i+3]=='E':
return True
return False
elif (s[i]=='s' or s[i]=='S') and i+2<len(s):
if s[i+1]=='i' or s[i+1]=='I':
if s[i+2]=='x' or s[i+2]=='X':
return True
elif (s[i+1]=='e' or s[i+1]=='E') and i+4<len(s):
if s[i+2]=='v' or s[i+2]=='V':
if s[i+3]=='e' or s[i+3]=='E':
if s[i+4]=='n' or s[i+4]=='N':
return True
return False
elif (s[i]=='e' or s[i]=='E') and i+4<len(s):
if s[i+1]=='i' or s[i+1]=='I':
if s[i+2]=='g' or s[i+2]=='G':
if s[i+3]=='h' or s[i+3]=='H':
if s[i+4]=='t' or s[i+4]=='T':
return True
return False
elif (s[i]=='n' or s[i]=='N') and i+3<len(s):
if s[i+1]=='i' or s[i+1]=='I':
if s[i+2]=='n' or s[i+2]=='N':
if s[i+3]=='e' or s[i+3]=='E':
return True
return False
else:
return False
def getDigit(s, i):
if s[i]>='0' and s[i]<='9':
return int(s[i])
elif s[i]=='o' or s[i]=='O':
if s[i+1]=='n' or s[i+1]=='N':
if s[i+2]=='e' or s[i+2]=='E':
return 1
return 0
elif s[i]=='t' or s[i]=='T':
if s[i+1]=='w' or s[i+1]=='W':
if s[i+2]=='o' or s[i+2]=='O':
return 2
elif s[i+1]=='h' or s[i+1]=='H':
if s[i+2]=='r' or s[i+2]=='R':
if s[i+3]=='e' or s[i+3]=='E':
return 3
return 0
elif s[i]=='f' or s[i]=='F':
if s[i+1]=='o' or s[i+1]=='O':
if s[i+2]=='u' or s[i+2]=='U':
if s[i+3]=='r' or s[i+3]=='R':
return 4
elif s[i+1]=='i' or s[i+1]=='I':
if s[i+2]=='v' or s[i+2]=='V':
if s[i+3]=='e' or s[i+3]=='E':
return 5
return 0
elif s[i]=='s' or s[i]=='S':
if s[i+1]=='i' or s[i+1]=='I':
if s[i+2]=='x' or s[i+2]=='X':
return 6
elif s[i+1]=='e' or s[i+1]=='E':
if s[i+2]=='v' or s[i+2]=='V':
if s[i+3]=='e' or s[i+3]=='E':
if s[i+4]=='n' or s[i+4]=='N':
return 7
return 0
elif s[i]=='e' or s[i]=='E':
if s[i+1]=='i' or s[i+1]=='I':
if s[i+2]=='g' or s[i+2]=='G':
if s[i+3]=='h' or s[i+3]=='H':
if s[i+4]=='t' or s[i+4]=='T':
return 8
return 0
elif s[i]=='n' or s[i]=='N':
if s[i+1]=='i' or s[i+1]=='I':
if s[i+2]=='n' or s[i+2]=='N':
if s[i+3]=='e' or s[i+3]=='E':
return 9
content=[]
for line in sys.stdin:
content.append(line)
res =[]
for k in range(len(content)):
a=0
b=0
first=True
s=content[k]
for i in range(len(s)):
if isDigit(s, i) and first:
a=getDigit(s, i)
first=False
elif isDigit(s, i) and not first:
b=getDigit(s, i)
if a!=0 and b!=0:
res.append(10*a+b)
else:
res.append(10*a+a)
result = 0
for i in range(len(res)):
result +=res[i]
print(result)