text
stringlengths 525
23.5k
| conversation_id
int64 129
108k
| embedding
list | cluster
int64 6
6
|
|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
Memory is performing a walk on the two-dimensional plane, starting at the origin. He is given a string s with his directions for motion:
* An 'L' indicates he should move one unit left.
* An 'R' indicates he should move one unit right.
* A 'U' indicates he should move one unit up.
* A 'D' indicates he should move one unit down.
But now Memory wants to end at the origin. To do this, he has a special trident. This trident can replace any character in s with any of 'L', 'R', 'U', or 'D'. However, because he doesn't want to wear out the trident, he wants to make the minimum number of edits possible. Please tell Memory what is the minimum number of changes he needs to make to produce a string that, when walked, will end at the origin, or if there is no such string.
Input
The first and only line contains the string s (1 β€ |s| β€ 100 000) β the instructions Memory is given.
Output
If there is a string satisfying the conditions, output a single integer β the minimum number of edits required. In case it's not possible to change the sequence in such a way that it will bring Memory to to the origin, output -1.
Examples
Input
RRU
Output
-1
Input
UDUR
Output
1
Input
RUUR
Output
2
Note
In the first sample test, Memory is told to walk right, then right, then up. It is easy to see that it is impossible to edit these instructions to form a valid walk.
In the second sample test, Memory is told to walk up, then down, then up, then right. One possible solution is to change s to "LDUR". This string uses 1 edit, which is the minimum possible. It also ends at the origin.
Tags: implementation, strings
Correct Solution:
```
l=input()
if(len(l)%2!=0):
print(-1)
elif(l.count('R')==l.count('L') and l.count('U')==l.count('D')):
print(0)
else:
s=0
a=max(l.count('R'),l.count('L'))-min(l.count('R'),l.count('L'))
b=max(l.count('U'),l.count('D'))-min(l.count('U'),l.count('D'))
if(a>b):
a-=b
s+=b
if(a%2!=0):
print(-1)
else:
print(s+a//2)
else:
b-=a
s+=a
if(b%2==0):
print(s+b//2)
else:
print(-1)
```
| 35,614
|
[
0.17626953125,
-0.119140625,
-0.1119384765625,
0.201171875,
-0.4609375,
-0.449462890625,
0.08917236328125,
-0.079833984375,
0.2427978515625,
0.84375,
0.85595703125,
-0.046295166015625,
0.06512451171875,
-0.45166015625,
-0.6416015625,
0.110595703125,
-0.77099609375,
-0.65087890625,
-0.45556640625,
-0.0821533203125,
0.22265625,
-0.3837890625,
-1.255859375,
-0.190673828125,
-0.11993408203125,
0.8056640625,
0.29443359375,
0.47119140625,
1.28125,
1.2109375,
0.12286376953125,
-0.2479248046875,
0.4130859375,
-0.9248046875,
-0.4716796875,
-0.486083984375,
0.62548828125,
-0.7119140625,
-0.2276611328125,
-0.26123046875,
0.28955078125,
-0.37109375,
0.67431640625,
-0.501953125,
-1.3212890625,
-0.224365234375,
-0.55419921875,
-0.7158203125,
-0.286865234375,
-0.487060546875,
0.281982421875,
-0.1634521484375,
0.5439453125,
-0.09326171875,
0.1285400390625,
-0.03228759765625,
0.03900146484375,
0.282958984375,
-0.677734375,
0.07745361328125,
0.2364501953125,
0.2308349609375,
0.06982421875,
-0.666015625,
0.044189453125,
0.328369140625,
-0.035736083984375,
-0.01372528076171875,
-0.140869140625,
-0.6513671875,
-0.3994140625,
0.0794677734375,
-0.389892578125,
-0.7763671875,
-0.19970703125,
0.578125,
0.40185546875,
-0.0374755859375,
-0.56982421875,
0.55419921875,
0.0858154296875,
0.931640625,
0.24951171875,
0.2181396484375,
-0.492919921875,
-0.625,
0.053802490234375,
0.265380859375,
0.2724609375,
-0.08990478515625,
-0.306396484375,
0.494140625,
-0.455810546875,
-0.11419677734375,
0.261474609375,
0.85205078125,
-0.23291015625,
0.529296875,
0.72216796875,
-0.1409912109375,
0.529296875,
1.0771484375,
-0.66455078125,
0.853515625,
-0.426025390625,
0.055816650390625,
0.339599609375,
0.035552978515625,
-0.459228515625,
-0.350341796875,
-0.08526611328125,
-0.1788330078125,
0.59033203125,
0.568359375,
-0.266845703125,
0.84765625,
0.0281524658203125,
0.62841796875,
-0.5908203125,
0.53076171875,
0.68798828125,
-0.07177734375,
0.30322265625,
-0.2496337890625,
-0.0802001953125,
-0.427001953125,
-0.1934814453125,
0.9404296875,
-0.3818359375,
-0.049224853515625,
0.302490234375,
0.014434814453125,
-0.0828857421875,
0.387939453125,
-0.278076171875,
0.62841796875,
-0.446044921875,
0.51318359375,
1.06640625,
-0.61572265625,
0.619140625,
-0.12274169921875,
-0.03436279296875,
1.3671875,
0.90673828125,
0.281494140625,
0.38037109375,
0.2890625,
-0.8359375,
0.17041015625,
-0.8857421875,
0.681640625,
0.38134765625,
0.11029052734375,
0.18603515625,
0.040985107421875,
-0.27978515625,
0.66259765625,
-0.004756927490234375,
0.416259765625,
-0.2305908203125,
0.2088623046875,
-0.2529296875,
1.09375,
-0.2083740234375,
0.7626953125,
-0.326171875,
-0.2125244140625,
-0.5732421875,
-0.62353515625,
0.33056640625,
0.0221405029296875,
-0.282958984375,
0.418212890625,
0.1510009765625,
1.279296875,
1.19921875,
0.350830078125,
0.12054443359375,
0.2200927734375,
-0.5048828125,
0.15087890625,
0.461669921875,
0.7939453125,
-0.305908203125,
0.1326904296875,
0.1546630859375,
-0.15625,
-0.7294921875,
-0.1092529296875,
0.036956787109375,
0.7861328125,
-0.3583984375,
0.3125,
0.35693359375,
0.3896484375,
-1.0439453125,
-0.1986083984375,
-0.51171875,
-1.0322265625,
-0.430908203125,
0.498291015625,
-0.202880859375,
0.49560546875,
-0.240234375,
-0.58447265625,
0.458740234375,
0.99609375,
-0.08074951171875,
0.18603515625,
0.3974609375,
0.0257720947265625,
-0.038543701171875,
0.320068359375,
0.10760498046875,
-0.311279296875,
-0.46240234375,
0.426513671875,
-0.12103271484375,
0.007068634033203125,
0.15185546875,
0.435546875,
0.501953125,
0.43798828125,
-0.11566162109375,
-0.11053466796875,
0.73095703125,
0.99169921875,
-0.2039794921875,
0.53466796875,
0.0926513671875,
0.9765625,
0.255126953125,
0.56494140625,
0.59521484375,
0.46630859375,
0.568359375,
0.8681640625,
-0.34326171875,
0.127197265625,
0.3701171875,
0.61865234375,
0.77783203125,
0.367919921875,
0.19921875,
0.429931640625,
-0.07598876953125,
-0.432373046875,
-0.2276611328125,
0.099365234375,
-0.311279296875,
0.43798828125,
-0.03253173828125,
0.155029296875,
-0.30029296875,
-0.47021484375,
0.09130859375,
0.71142578125,
-0.8603515625,
-0.90380859375,
0.243896484375,
0.277099609375,
0.4814453125,
-0.1131591796875,
0.389892578125,
0.6484375,
0.33349609375,
0.335693359375,
-0.1571044921875,
-0.43115234375,
-0.791015625,
-0.796875,
-0.88525390625,
-0.43701171875,
-0.62646484375,
0.0188446044921875,
0.681640625,
-0.89697265625,
0.363037109375,
-0.51025390625,
0.050750732421875,
-0.0740966796875,
-0.306640625,
0.88037109375,
-0.33642578125,
0.51806640625,
-0.6083984375,
0.65087890625,
0.023101806640625,
0.86279296875,
-0.495849609375,
-0.37548828125,
-0.51806640625,
-0.87060546875,
0.0504150390625,
-0.055511474609375,
0.84912109375,
0.004085540771484375,
-0.82958984375,
-0.75341796875,
-0.3271484375,
-0.106201171875,
-0.54541015625,
0.28759765625,
-0.564453125,
1.2119140625,
0.65087890625,
-0.74462890625,
0.669921875,
0.8466796875,
-0.865234375,
0.515625,
0.27001953125,
0.285400390625,
-0.74267578125,
1.5,
0.419677734375,
0.418212890625,
-0.59619140625,
-0.77197265625,
-0.54052734375,
0.326171875,
0.36962890625,
-0.337158203125,
-0.3701171875,
0.55029296875,
0.092529296875,
-0.91015625,
0.73193359375,
-0.9150390625,
-0.4423828125,
-0.255859375,
-0.259033203125,
1.1845703125,
0.86083984375,
0.1455078125,
0.0159454345703125,
-0.18896484375,
-0.483642578125,
0.70849609375,
0.458984375,
-0.34521484375,
-0.009979248046875,
0.418701171875,
-0.1226806640625,
0.1680908203125,
0.1651611328125,
-0.480224609375,
-0.053436279296875,
-0.1090087890625,
0.359375,
0.8544921875,
0.374267578125,
0.444091796875,
0.587890625,
0.5439453125,
-0.63623046875,
-0.4775390625,
-0.07598876953125,
0.826171875,
0.438232421875,
0.447021484375,
-0.02911376953125,
-0.260498046875,
-0.5263671875,
-0.90673828125,
0.355224609375,
0.1937255859375,
0.6162109375,
-0.8076171875,
0.92919921875,
0.13720703125,
-0.54052734375,
0.216064453125,
-0.7890625,
0.093994140625,
1.1220703125,
-0.09234619140625,
0.74169921875,
-0.583984375,
0.275146484375,
-0.08428955078125,
-0.10791015625,
0.40478515625,
0.30615234375,
0.27099609375,
-0.61474609375,
-0.412353515625,
-0.615234375,
0.109130859375,
-0.26904296875,
-0.787109375,
0.1131591796875,
-0.43408203125,
-0.25830078125,
-0.89990234375,
0.734375,
0.9296875,
0.50927734375,
-0.1273193359375,
0.6025390625,
-0.0201416015625,
0.16064453125,
0.48828125,
-0.29052734375,
0.363037109375,
-0.8828125,
0.63623046875,
-0.121826171875,
-0.39306640625,
-0.418701171875,
-0.458740234375,
-0.68994140625,
0.2236328125,
0.10870361328125,
-0.263671875,
-0.77734375,
0.057403564453125,
0.326904296875,
0.2188720703125,
-0.34521484375,
-0.07965087890625,
-0.1343994140625,
0.56591796875,
0.64111328125,
-0.9814453125,
-0.06683349609375,
-1.0986328125,
0.76904296875,
0.252685546875,
-0.4619140625,
-0.258544921875,
-0.65380859375,
-0.865234375,
-0.74658203125,
-0.1524658203125,
0.50390625,
0.1165771484375,
0.0200042724609375,
-1.091796875,
0.4345703125,
0.2332763671875,
-0.07135009765625,
0.1805419921875,
-0.195556640625,
0.276611328125,
-0.1871337890625,
0.625,
-0.44482421875,
-0.393798828125,
0.267333984375,
-1.109375,
0.52099609375,
-0.322509765625,
0.440673828125,
0.1611328125,
-0.4794921875,
0.208251953125,
0.50830078125,
-0.7216796875,
0.38037109375,
-0.61181640625,
0.1966552734375,
-0.9423828125,
-0.2081298828125,
0.61865234375,
-0.354736328125,
-0.27978515625,
1.20703125,
0.0736083984375,
-0.352294921875,
0.11041259765625,
0.798828125,
-0.201904296875,
0.07330322265625,
-0.56787109375,
0.79541015625,
-0.63720703125,
-0.61767578125,
-0.44384765625,
-0.69921875,
0.943359375,
-0.00827789306640625,
-0.4365234375,
-0.2127685546875,
-1.2236328125,
-0.273193359375,
0.317138671875,
-0.5400390625,
0.0268707275390625,
0.319091796875,
-0.1951904296875,
0.165771484375,
-0.25537109375,
-0.35693359375,
-0.4990234375,
-0.79248046875,
0.04144287109375,
0.218505859375,
0.5380859375,
0.32470703125,
-0.1181640625,
-0.44189453125,
0.281982421875,
-0.20947265625,
-0.26123046875,
-0.377197265625,
-0.499267578125,
-0.1859130859375,
-0.2333984375,
-0.02874755859375,
-0.1033935546875,
-0.0787353515625,
0.72021484375,
0.9794921875,
0.0199432373046875,
0.136962890625,
0.422607421875,
-0.483642578125,
1.150390625,
0.12445068359375,
-0.9423828125,
0.0035114288330078125,
0.337890625,
0.15234375,
0.287353515625,
-0.042327880859375,
-0.720703125,
-0.78173828125,
-1.119140625,
0.296142578125,
-0.5927734375,
0.0711669921875,
-0.9228515625,
-0.79443359375,
-0.153564453125,
0.343994140625,
-0.114013671875,
-0.892578125,
0.4072265625,
-0.92041015625,
0.3193359375,
-1.056640625,
-0.10162353515625,
-0.6396484375,
-0.52197265625,
-0.177490234375,
1.1953125,
-0.04974365234375,
0.5859375,
0.3076171875,
0.07489013671875,
0.11285400390625,
-0.217529296875,
-0.6201171875,
-0.44873046875,
-0.110595703125,
0.34765625,
-0.361328125,
-0.3046875,
-0.306396484375,
0.58740234375,
-0.81689453125,
0.408203125,
-0.424072265625,
-0.2548828125,
-0.273681640625,
-0.7080078125,
1.3720703125,
-0.42333984375,
0.33642578125,
0.0953369140625,
0.66943359375,
0.673828125,
-0.2646484375,
-0.024322509765625,
-0.8056640625,
-0.75390625,
-1.04296875,
0.74462890625,
-0.56640625,
0.0271759033203125,
-0.72216796875,
-0.429931640625,
1.0322265625,
-0.73876953125,
0.412841796875,
1.2392578125,
0.00580596923828125,
0.65478515625,
-0.9072265625,
0.37744140625,
0.4189453125,
-0.65234375,
-0.0732421875,
0.177490234375,
-0.89990234375,
0.08746337890625,
-0.5556640625,
-1.19140625,
-0.81689453125,
0.255859375,
1.154296875,
0.05902099609375,
0.701171875,
-0.4287109375,
-0.9111328125,
-0.51416015625,
1.2939453125,
0.1800537109375,
-0.0728759765625,
0.7177734375,
-0.139892578125,
0.0673828125,
-0.1600341796875,
-0.09161376953125,
-0.56982421875,
-0.40234375,
1.1328125,
-0.28662109375,
-0.82080078125,
0.97119140625,
0.78564453125,
-0.9150390625,
-1.021484375,
-0.1929931640625,
-0.05792236328125,
-0.07464599609375,
-0.97705078125,
0.1669921875,
0.51416015625,
-0.54296875,
0.25634765625,
0.30224609375,
0.036895751953125,
0.52392578125,
0.08734130859375,
-0.018157958984375,
-0.354248046875,
0.1309814453125,
0.423828125,
-0.494140625,
-0.293212890625,
-0.9521484375,
-0.45458984375,
-0.3046875,
0.1439208984375,
0.66650390625,
-0.310791015625,
-0.05615234375,
0.447021484375,
0.01088714599609375,
0.501953125,
-0.0733642578125,
-0.32470703125,
0.455078125,
-0.66943359375,
-0.3427734375,
-0.006092071533203125,
0.79150390625,
-0.0552978515625,
0.48583984375,
-0.438232421875,
0.1575927734375,
0.426513671875,
0.56005859375,
-0.587890625,
-1.2109375,
-0.26318359375,
-1.3349609375,
-0.6162109375,
-0.301513671875,
-0.91357421875,
0.042816162109375,
0.2666015625,
-0.1181640625,
-0.5576171875,
-0.1455078125,
0.5888671875,
-0.318359375,
0.317138671875,
-0.35302734375,
0.416748046875,
-0.62255859375,
-0.22802734375,
-0.978515625,
-0.2275390625,
-0.4111328125,
-0.236328125,
-0.67822265625,
0.2230224609375,
-0.354248046875,
0.21142578125,
-0.08349609375,
0.416748046875,
-0.0006070137023925781,
-0.303466796875,
0.11639404296875,
0.2802734375,
0.0653076171875,
0.74169921875,
0.84423828125,
0.05859375,
0.5205078125,
-0.330078125,
-0.3046875,
-0.6162109375,
0.87158203125,
0.4638671875,
-0.373291015625,
-0.268310546875,
-0.237548828125,
0.0987548828125,
-1.10546875,
0.459228515625,
-0.1256103515625,
0.517578125,
0.1478271484375,
-0.0016832351684570312,
0.72021484375,
1.1376953125,
0.1397705078125,
0.1693115234375,
0.14306640625,
-0.106201171875,
0.7060546875,
0.3720703125,
0.0187835693359375,
0.7353515625,
-0.37451171875,
-0.51123046875,
0.08807373046875,
0.2091064453125,
-0.1285400390625,
0.34765625,
-0.72802734375,
-0.3427734375,
-0.5595703125,
-0.1044921875,
-0.361328125,
0.411865234375,
0.341064453125,
-0.492431640625,
-0.0015287399291992188,
-0.3154296875,
-0.5859375,
-0.01322174072265625,
-1.072265625,
-0.9599609375,
0.207275390625,
-0.31982421875,
-0.411865234375,
-0.46923828125,
-0.196533203125,
-0.38330078125,
-0.1815185546875,
0.369873046875,
-0.270751953125,
0.421875,
-0.424560546875,
1.0107421875,
-0.5107421875,
0.094482421875,
0.452880859375,
0.59765625,
-0.73828125,
-0.6328125,
-0.0162811279296875,
1.0009765625,
0.2451171875,
-0.256591796875,
-0.701171875,
-0.1396484375,
-0.01267242431640625,
-0.02996826171875,
-0.59912109375,
0.431396484375,
0.009613037109375,
0.513671875,
-0.560546875,
-0.54150390625,
-0.08648681640625,
0.46826171875,
-0.049560546875,
-0.33935546875,
-0.25830078125,
0.869140625,
0.48095703125,
-0.044708251953125,
0.496826171875,
0.01471710205078125,
0.64404296875,
-0.465576171875,
0.06890869140625,
-0.133544921875,
1.1015625,
0.70166015625,
0.20654296875,
-0.13916015625,
0.67919921875,
0.476806640625,
-0.27392578125,
-0.06976318359375,
0.71826171875,
0.2039794921875,
-0.213134765625,
0.0238800048828125,
-0.240234375,
-0.1453857421875,
-0.08123779296875,
-0.55419921875,
0.1639404296875,
-0.299072265625,
-0.047943115234375,
-0.560546875,
-0.5517578125,
1.056640625,
-0.303466796875,
-0.34228515625,
0.4384765625,
-0.452880859375,
0.11871337890625,
0.95263671875,
-0.058624267578125,
-0.1217041015625,
0.477783203125,
0.5869140625,
0.62353515625,
0.460205078125,
0.437744140625,
0.441650390625,
-0.255126953125,
0.10400390625,
0.19140625,
-0.11895751953125,
-0.382080078125,
-0.7724609375,
-0.7705078125,
0.497314453125,
-0.55322265625,
-0.156005859375,
0.37451171875,
-0.603515625,
-0.128662109375,
-0.1533203125,
0.74755859375,
-0.80419921875,
0.058258056640625,
0.004764556884765625,
-0.257568359375,
-0.83984375,
1.25,
-0.08135986328125,
0.50634765625,
0.0235443115234375,
1.3251953125,
-0.1219482421875,
1.1240234375,
0.4033203125,
-0.19091796875,
0.288818359375,
0.31005859375,
-0.4248046875,
-0.537109375,
-0.1898193359375,
-0.2320556640625,
-0.1630859375,
-0.9013671875,
-0.1676025390625,
0.09698486328125,
0.83935546875,
-0.01340484619140625,
-0.6875,
0.028961181640625,
0.0257415771484375,
-0.77099609375,
0.50390625,
-0.0499267578125,
0.1824951171875,
0.030181884765625,
-0.0293731689453125,
0.050567626953125,
-0.429931640625,
0.1964111328125,
-0.4501953125,
0.299072265625,
-0.56591796875,
0.01445770263671875,
-0.380859375,
-0.5849609375,
-0.406982421875,
0.07452392578125,
-0.320556640625,
-0.57763671875,
0.1082763671875,
0.32470703125,
0.479736328125,
0.220947265625,
-0.450439453125,
0.28515625,
0.93994140625,
1.0361328125,
0.09368896484375,
0.4853515625,
0.195068359375,
0.222900390625,
0.0161590576171875,
-0.279541015625,
0.4580078125,
-0.333740234375,
-0.04534912109375,
0.0077362060546875,
0.12939453125,
-0.76416015625,
-1.2314453125,
0.2032470703125,
0.201171875,
0.450927734375,
-0.465087890625,
-0.814453125,
-0.297119140625,
-0.91455078125,
-0.06427001953125,
-0.72509765625,
0.6337890625,
0.0660400390625,
-0.141845703125,
-0.0740966796875,
-0.701171875,
4.453125,
1.328125,
0.8447265625,
0.39013671875,
-0.06353759765625,
1.2744140625,
0.53564453125,
-0.517578125,
-0.458740234375,
-0.6826171875,
0.72705078125,
-0.0194854736328125,
0.032012939453125,
0.548828125,
0.457275390625,
0.339599609375,
-0.6201171875,
0.326416015625,
-0.2154541015625,
-0.94287109375,
-0.6591796875,
0.4404296875,
-0.372314453125,
0.392333984375,
-0.191162109375,
0.397216796875,
0.454345703125,
-1.080078125,
-0.417236328125,
-0.7666015625,
0.167236328125,
-0.65771484375,
0.869140625,
0.12744140625,
-0.320068359375,
0.3720703125,
-0.121826171875,
-0.66259765625,
-0.33837890625,
-0.05206298828125,
-0.035614013671875,
-0.2244873046875,
0.072265625,
-0.57666015625,
-0.00243377685546875,
0.47314453125,
-0.28662109375,
0.448974609375,
0.10211181640625,
-1.013671875,
1.1455078125,
-0.2607421875,
0.5634765625,
-0.5302734375,
-1.005859375,
0.10015869140625,
0.316650390625,
0.05047607421875,
-0.498046875,
0.370849609375,
0.44873046875,
0.1917724609375,
-0.203125,
0.28564453125,
-0.63916015625,
0.92724609375,
-0.322265625,
0.19921875,
-0.59716796875,
-0.158935546875,
-0.304443359375,
-0.6259765625,
-0.416748046875,
-0.11785888671875,
0.701171875,
0.1630859375,
-0.32373046875,
0.423583984375,
0.349853515625,
-0.76513671875,
0.2021484375,
-0.369384765625,
-0.3134765625,
-0.1793212890625,
0.3369140625,
0.89599609375,
-0.7451171875,
-0.24072265625,
-0.348388671875,
0.38525390625,
0.57275390625,
0.83544921875,
-0.2474365234375,
-0.75048828125,
0.2236328125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Memory is performing a walk on the two-dimensional plane, starting at the origin. He is given a string s with his directions for motion:
* An 'L' indicates he should move one unit left.
* An 'R' indicates he should move one unit right.
* A 'U' indicates he should move one unit up.
* A 'D' indicates he should move one unit down.
But now Memory wants to end at the origin. To do this, he has a special trident. This trident can replace any character in s with any of 'L', 'R', 'U', or 'D'. However, because he doesn't want to wear out the trident, he wants to make the minimum number of edits possible. Please tell Memory what is the minimum number of changes he needs to make to produce a string that, when walked, will end at the origin, or if there is no such string.
Input
The first and only line contains the string s (1 β€ |s| β€ 100 000) β the instructions Memory is given.
Output
If there is a string satisfying the conditions, output a single integer β the minimum number of edits required. In case it's not possible to change the sequence in such a way that it will bring Memory to to the origin, output -1.
Examples
Input
RRU
Output
-1
Input
UDUR
Output
1
Input
RUUR
Output
2
Note
In the first sample test, Memory is told to walk right, then right, then up. It is easy to see that it is impossible to edit these instructions to form a valid walk.
In the second sample test, Memory is told to walk up, then down, then up, then right. One possible solution is to change s to "LDUR". This string uses 1 edit, which is the minimum possible. It also ends at the origin.
Tags: implementation, strings
Correct Solution:
```
s=input()
r=l=d=u=0
for i in s:
if i=='R':
r+=1
if i=='L':
l+=1
if i=='D':
d+=1
if i=='U':
u+=1
if (u+d+r+l)%2==0:
#print("u={},r={},l={},d={}".format(u,r,l,d))
if u==d and r==l:
print("0")
else:
print((abs(r-l)+abs(u-d))//2)
else:
print("-1")
```
| 35,615
|
[
0.1568603515625,
-0.0701904296875,
-0.11505126953125,
0.2254638671875,
-0.425537109375,
-0.43359375,
0.0762939453125,
-0.096435546875,
0.257568359375,
0.875,
0.85693359375,
-0.060760498046875,
0.0694580078125,
-0.5185546875,
-0.6318359375,
0.09271240234375,
-0.74462890625,
-0.63525390625,
-0.444580078125,
-0.0889892578125,
0.2288818359375,
-0.397216796875,
-1.306640625,
-0.162841796875,
-0.1497802734375,
0.80859375,
0.294189453125,
0.43701171875,
1.2392578125,
1.2001953125,
0.10113525390625,
-0.25927734375,
0.463134765625,
-0.94384765625,
-0.47900390625,
-0.48193359375,
0.6513671875,
-0.67626953125,
-0.2337646484375,
-0.258056640625,
0.302490234375,
-0.35400390625,
0.68896484375,
-0.505859375,
-1.2998046875,
-0.242431640625,
-0.556640625,
-0.74072265625,
-0.319580078125,
-0.482421875,
0.279052734375,
-0.1954345703125,
0.5625,
-0.0687255859375,
0.1490478515625,
0.0015172958374023438,
0.054656982421875,
0.278564453125,
-0.6953125,
0.09490966796875,
0.2286376953125,
0.2117919921875,
0.04248046875,
-0.7109375,
0.060638427734375,
0.328125,
-0.0033740997314453125,
-0.0308380126953125,
-0.1314697265625,
-0.63916015625,
-0.429931640625,
0.0926513671875,
-0.385986328125,
-0.7275390625,
-0.1748046875,
0.5458984375,
0.363037109375,
-0.022308349609375,
-0.57373046875,
0.591796875,
0.038665771484375,
0.89306640625,
0.249755859375,
0.252197265625,
-0.497802734375,
-0.60595703125,
0.03118896484375,
0.26708984375,
0.273681640625,
-0.099853515625,
-0.302001953125,
0.505859375,
-0.442626953125,
-0.10357666015625,
0.290283203125,
0.873046875,
-0.2415771484375,
0.53466796875,
0.73046875,
-0.1259765625,
0.5126953125,
1.044921875,
-0.67919921875,
0.88330078125,
-0.4326171875,
0.01422882080078125,
0.325439453125,
0.061004638671875,
-0.4599609375,
-0.365478515625,
-0.08880615234375,
-0.176025390625,
0.59130859375,
0.5546875,
-0.277099609375,
0.8095703125,
0.0726318359375,
0.638671875,
-0.55810546875,
0.5078125,
0.65625,
-0.08685302734375,
0.328857421875,
-0.257080078125,
-0.07757568359375,
-0.439208984375,
-0.16455078125,
0.935546875,
-0.4150390625,
-0.031829833984375,
0.345947265625,
0.033355712890625,
-0.058349609375,
0.387939453125,
-0.274658203125,
0.6611328125,
-0.4296875,
0.490234375,
1.060546875,
-0.5771484375,
0.63330078125,
-0.1612548828125,
-0.026153564453125,
1.392578125,
0.87060546875,
0.2509765625,
0.3779296875,
0.29248046875,
-0.8505859375,
0.151123046875,
-0.9091796875,
0.64599609375,
0.379638671875,
0.10150146484375,
0.175537109375,
0.0662841796875,
-0.297607421875,
0.70263671875,
0.013885498046875,
0.381103515625,
-0.230224609375,
0.174560546875,
-0.265625,
1.0888671875,
-0.26318359375,
0.78759765625,
-0.291259765625,
-0.1810302734375,
-0.56103515625,
-0.6376953125,
0.3134765625,
0.060882568359375,
-0.309814453125,
0.4130859375,
0.13916015625,
1.279296875,
1.19921875,
0.371337890625,
0.1048583984375,
0.202880859375,
-0.465087890625,
0.119384765625,
0.52099609375,
0.81005859375,
-0.280517578125,
0.152099609375,
0.1632080078125,
-0.1396484375,
-0.71533203125,
-0.1348876953125,
0.0050201416015625,
0.80126953125,
-0.3583984375,
0.301513671875,
0.3349609375,
0.373046875,
-1.03125,
-0.25390625,
-0.46875,
-1.01171875,
-0.437255859375,
0.51806640625,
-0.1422119140625,
0.53271484375,
-0.27197265625,
-0.65478515625,
0.44384765625,
0.98388671875,
-0.1341552734375,
0.16259765625,
0.364013671875,
0.043182373046875,
-0.04022216796875,
0.30419921875,
0.1199951171875,
-0.30615234375,
-0.46142578125,
0.424560546875,
-0.10211181640625,
0.00042366981506347656,
0.1302490234375,
0.47216796875,
0.515625,
0.45947265625,
-0.1324462890625,
-0.05596923828125,
0.73486328125,
1.00390625,
-0.18017578125,
0.51318359375,
0.09326171875,
0.96630859375,
0.26904296875,
0.58349609375,
0.591796875,
0.4521484375,
0.56591796875,
0.8837890625,
-0.344482421875,
0.10595703125,
0.380126953125,
0.62744140625,
0.767578125,
0.400146484375,
0.1746826171875,
0.39306640625,
-0.07073974609375,
-0.42578125,
-0.2298583984375,
0.09442138671875,
-0.299560546875,
0.4443359375,
-0.02435302734375,
0.139404296875,
-0.283203125,
-0.50341796875,
0.11981201171875,
0.72119140625,
-0.86669921875,
-0.8818359375,
0.272216796875,
0.266845703125,
0.48486328125,
-0.1029052734375,
0.386474609375,
0.634765625,
0.343017578125,
0.31787109375,
-0.1575927734375,
-0.456787109375,
-0.8115234375,
-0.8095703125,
-0.87548828125,
-0.412109375,
-0.59814453125,
-0.025238037109375,
0.6533203125,
-0.94140625,
0.360107421875,
-0.51416015625,
0.05126953125,
-0.06365966796875,
-0.31884765625,
0.8583984375,
-0.32470703125,
0.49658203125,
-0.63330078125,
0.66162109375,
0.03656005859375,
0.8466796875,
-0.498291015625,
-0.356201171875,
-0.436279296875,
-0.88427734375,
0.055755615234375,
-0.11505126953125,
0.78759765625,
-0.0159912109375,
-0.8212890625,
-0.7275390625,
-0.3583984375,
-0.1331787109375,
-0.552734375,
0.26220703125,
-0.55322265625,
1.21484375,
0.66162109375,
-0.7607421875,
0.66943359375,
0.830078125,
-0.83642578125,
0.52587890625,
0.27734375,
0.2607421875,
-0.7294921875,
1.5224609375,
0.446533203125,
0.4150390625,
-0.6064453125,
-0.74951171875,
-0.55078125,
0.3125,
0.32861328125,
-0.32421875,
-0.381103515625,
0.5703125,
0.07598876953125,
-0.9150390625,
0.69775390625,
-0.8896484375,
-0.47119140625,
-0.2423095703125,
-0.2276611328125,
1.21484375,
0.8818359375,
0.1439208984375,
0.0195770263671875,
-0.193115234375,
-0.475341796875,
0.69384765625,
0.45556640625,
-0.357666015625,
-0.04071044921875,
0.43603515625,
-0.1522216796875,
0.13232421875,
0.194091796875,
-0.495849609375,
-0.05511474609375,
-0.12115478515625,
0.31298828125,
0.875,
0.356201171875,
0.421875,
0.57275390625,
0.60009765625,
-0.6767578125,
-0.51123046875,
-0.09490966796875,
0.82373046875,
0.445556640625,
0.467529296875,
-0.0100250244140625,
-0.33056640625,
-0.5322265625,
-0.90673828125,
0.34375,
0.1759033203125,
0.62841796875,
-0.7861328125,
0.92626953125,
0.1771240234375,
-0.54541015625,
0.264892578125,
-0.77880859375,
0.0665283203125,
1.1259765625,
-0.08642578125,
0.7080078125,
-0.6005859375,
0.322998046875,
-0.0919189453125,
-0.1063232421875,
0.390625,
0.327880859375,
0.259521484375,
-0.6181640625,
-0.41845703125,
-0.62890625,
0.11700439453125,
-0.248779296875,
-0.74462890625,
0.12457275390625,
-0.423095703125,
-0.276123046875,
-0.892578125,
0.70947265625,
0.9052734375,
0.48681640625,
-0.0802001953125,
0.59130859375,
-0.034210205078125,
0.2001953125,
0.494873046875,
-0.28271484375,
0.34375,
-0.90625,
0.60791015625,
-0.0885009765625,
-0.380126953125,
-0.42333984375,
-0.446533203125,
-0.70361328125,
0.26416015625,
0.1295166015625,
-0.29248046875,
-0.80029296875,
0.07916259765625,
0.2763671875,
0.2213134765625,
-0.294921875,
-0.056549072265625,
-0.14013671875,
0.57421875,
0.666015625,
-1.00390625,
-0.08929443359375,
-1.0859375,
0.755859375,
0.270751953125,
-0.460693359375,
-0.262939453125,
-0.58544921875,
-0.85986328125,
-0.75732421875,
-0.1431884765625,
0.48046875,
0.14599609375,
0.038299560546875,
-1.0849609375,
0.439208984375,
0.238525390625,
-0.1036376953125,
0.1875,
-0.155517578125,
0.2744140625,
-0.1981201171875,
0.6240234375,
-0.40185546875,
-0.38330078125,
0.288818359375,
-1.0751953125,
0.468994140625,
-0.30224609375,
0.41650390625,
0.1319580078125,
-0.40087890625,
0.1861572265625,
0.5029296875,
-0.73779296875,
0.39892578125,
-0.58544921875,
0.22265625,
-0.927734375,
-0.249755859375,
0.60888671875,
-0.3076171875,
-0.296142578125,
1.2158203125,
0.06951904296875,
-0.34765625,
0.1346435546875,
0.76171875,
-0.2249755859375,
0.0887451171875,
-0.59716796875,
0.77197265625,
-0.61962890625,
-0.607421875,
-0.495361328125,
-0.70458984375,
0.970703125,
-0.0189056396484375,
-0.4501953125,
-0.2216796875,
-1.1708984375,
-0.256103515625,
0.262939453125,
-0.5380859375,
0.0085601806640625,
0.30859375,
-0.174560546875,
0.17041015625,
-0.26123046875,
-0.364990234375,
-0.494873046875,
-0.787109375,
0.06365966796875,
0.230712890625,
0.5390625,
0.32666015625,
-0.1197509765625,
-0.454833984375,
0.27099609375,
-0.2076416015625,
-0.26806640625,
-0.36376953125,
-0.43115234375,
-0.1971435546875,
-0.2288818359375,
-0.0034389495849609375,
-0.05621337890625,
-0.0653076171875,
0.69921875,
0.9990234375,
0.028533935546875,
0.122314453125,
0.38427734375,
-0.52978515625,
1.15625,
0.15673828125,
-0.94775390625,
0.007068634033203125,
0.347900390625,
0.1558837890625,
0.333984375,
-0.024688720703125,
-0.70947265625,
-0.73876953125,
-1.0908203125,
0.2939453125,
-0.61669921875,
0.098388671875,
-0.95654296875,
-0.802734375,
-0.1385498046875,
0.36572265625,
-0.1005859375,
-0.85009765625,
0.388427734375,
-0.921875,
0.277587890625,
-1.0888671875,
-0.12103271484375,
-0.65380859375,
-0.5087890625,
-0.178466796875,
1.2138671875,
-0.0797119140625,
0.5810546875,
0.321044921875,
0.0633544921875,
0.1385498046875,
-0.1881103515625,
-0.6064453125,
-0.43212890625,
-0.0943603515625,
0.35791015625,
-0.374755859375,
-0.30615234375,
-0.32275390625,
0.59912109375,
-0.84423828125,
0.380859375,
-0.384521484375,
-0.251220703125,
-0.27490234375,
-0.6923828125,
1.3818359375,
-0.4345703125,
0.348876953125,
0.046051025390625,
0.6357421875,
0.6708984375,
-0.2386474609375,
-0.0517578125,
-0.79443359375,
-0.724609375,
-1.029296875,
0.7373046875,
-0.56201171875,
0.02569580078125,
-0.71533203125,
-0.445556640625,
1.0205078125,
-0.73095703125,
0.407958984375,
1.2431640625,
0.05462646484375,
0.6640625,
-0.888671875,
0.403564453125,
0.445556640625,
-0.6259765625,
-0.11700439453125,
0.1934814453125,
-0.88818359375,
0.07769775390625,
-0.556640625,
-1.2041015625,
-0.8251953125,
0.22119140625,
1.1650390625,
0.056610107421875,
0.6689453125,
-0.443359375,
-0.87939453125,
-0.489013671875,
1.28515625,
0.1629638671875,
-0.09735107421875,
0.73583984375,
-0.10455322265625,
0.042144775390625,
-0.175048828125,
-0.06890869140625,
-0.5849609375,
-0.418701171875,
1.1640625,
-0.30322265625,
-0.8251953125,
0.97314453125,
0.7578125,
-0.95263671875,
-1.0166015625,
-0.1749267578125,
-0.05255126953125,
-0.07061767578125,
-0.9560546875,
0.19384765625,
0.50439453125,
-0.58740234375,
0.215576171875,
0.314453125,
0.07745361328125,
0.5556640625,
0.07501220703125,
-0.0028629302978515625,
-0.359130859375,
0.141845703125,
0.452880859375,
-0.464111328125,
-0.290283203125,
-0.92431640625,
-0.43017578125,
-0.319580078125,
0.131103515625,
0.6640625,
-0.330078125,
-0.031494140625,
0.456298828125,
0.007289886474609375,
0.473388671875,
-0.0911865234375,
-0.334716796875,
0.48779296875,
-0.6630859375,
-0.3544921875,
-0.004978179931640625,
0.78564453125,
-0.0753173828125,
0.49462890625,
-0.50048828125,
0.15283203125,
0.41015625,
0.5703125,
-0.59326171875,
-1.2255859375,
-0.258544921875,
-1.3134765625,
-0.60546875,
-0.328857421875,
-0.9619140625,
0.055938720703125,
0.29833984375,
-0.121826171875,
-0.55517578125,
-0.1722412109375,
0.6064453125,
-0.3681640625,
0.31787109375,
-0.356689453125,
0.447998046875,
-0.60888671875,
-0.2177734375,
-0.9599609375,
-0.239501953125,
-0.44677734375,
-0.252685546875,
-0.67578125,
0.2420654296875,
-0.34228515625,
0.203125,
-0.0867919921875,
0.39208984375,
-0.00420379638671875,
-0.25634765625,
0.10467529296875,
0.3115234375,
0.018096923828125,
0.7431640625,
0.81640625,
0.08624267578125,
0.53662109375,
-0.292236328125,
-0.26123046875,
-0.609375,
0.892578125,
0.4384765625,
-0.368896484375,
-0.30322265625,
-0.2347412109375,
0.1011962890625,
-1.0947265625,
0.50048828125,
-0.10418701171875,
0.53076171875,
0.14599609375,
-0.01482391357421875,
0.6962890625,
1.1796875,
0.144287109375,
0.174560546875,
0.15185546875,
-0.0870361328125,
0.6640625,
0.361328125,
0.0216217041015625,
0.72802734375,
-0.34130859375,
-0.5234375,
0.11114501953125,
0.19970703125,
-0.125732421875,
0.33349609375,
-0.681640625,
-0.35498046875,
-0.57275390625,
-0.093505859375,
-0.3193359375,
0.371337890625,
0.345458984375,
-0.513671875,
0.0185394287109375,
-0.29736328125,
-0.59814453125,
-0.014251708984375,
-1.08203125,
-0.984375,
0.2470703125,
-0.28271484375,
-0.40673828125,
-0.486083984375,
-0.17529296875,
-0.381103515625,
-0.1715087890625,
0.362060546875,
-0.266845703125,
0.4599609375,
-0.40966796875,
0.96728515625,
-0.483642578125,
0.0599365234375,
0.46240234375,
0.568359375,
-0.77392578125,
-0.65478515625,
-0.00687408447265625,
1.0029296875,
0.2437744140625,
-0.2548828125,
-0.69677734375,
-0.1424560546875,
0.019378662109375,
-0.00508880615234375,
-0.591796875,
0.43603515625,
-0.006961822509765625,
0.55078125,
-0.55810546875,
-0.513671875,
-0.06878662109375,
0.472900390625,
-0.016143798828125,
-0.33740234375,
-0.26123046875,
0.85986328125,
0.52197265625,
-0.025726318359375,
0.52001953125,
-0.042083740234375,
0.65380859375,
-0.43896484375,
0.059783935546875,
-0.1380615234375,
1.1083984375,
0.7021484375,
0.240478515625,
-0.1358642578125,
0.68408203125,
0.487060546875,
-0.2802734375,
-0.07177734375,
0.7060546875,
0.22607421875,
-0.2308349609375,
0.027069091796875,
-0.2464599609375,
-0.131103515625,
-0.08526611328125,
-0.56884765625,
0.1800537109375,
-0.340087890625,
-0.04638671875,
-0.5751953125,
-0.5595703125,
1.0732421875,
-0.29150390625,
-0.33447265625,
0.422119140625,
-0.416015625,
0.10589599609375,
0.912109375,
-0.072509765625,
-0.1424560546875,
0.439208984375,
0.5791015625,
0.61669921875,
0.45703125,
0.4443359375,
0.427490234375,
-0.2374267578125,
0.056793212890625,
0.2392578125,
-0.13134765625,
-0.41552734375,
-0.744140625,
-0.77783203125,
0.53369140625,
-0.53955078125,
-0.16259765625,
0.402587890625,
-0.59375,
-0.143310546875,
-0.150634765625,
0.76220703125,
-0.79931640625,
0.04901123046875,
0.00908660888671875,
-0.271240234375,
-0.8701171875,
1.240234375,
-0.109130859375,
0.47509765625,
-0.0163116455078125,
1.3115234375,
-0.14794921875,
1.10546875,
0.442138671875,
-0.18359375,
0.2529296875,
0.34033203125,
-0.448486328125,
-0.53564453125,
-0.18994140625,
-0.2822265625,
-0.212890625,
-0.939453125,
-0.1705322265625,
0.06304931640625,
0.82470703125,
-0.01323699951171875,
-0.69091796875,
0.002407073974609375,
0.059539794921875,
-0.79150390625,
0.51123046875,
-0.062042236328125,
0.1800537109375,
0.0175628662109375,
-0.0589599609375,
0.035369873046875,
-0.4501953125,
0.193359375,
-0.44580078125,
0.30859375,
-0.54833984375,
0.0101776123046875,
-0.397216796875,
-0.55224609375,
-0.4345703125,
0.048309326171875,
-0.310791015625,
-0.599609375,
0.118408203125,
0.316162109375,
0.436279296875,
0.2164306640625,
-0.435546875,
0.2841796875,
0.962890625,
1.0439453125,
0.031951904296875,
0.488525390625,
0.1602783203125,
0.2119140625,
0.0269622802734375,
-0.293212890625,
0.441162109375,
-0.34375,
-0.01386260986328125,
-0.0285491943359375,
0.1439208984375,
-0.75732421875,
-1.173828125,
0.20947265625,
0.1820068359375,
0.451416015625,
-0.469482421875,
-0.82958984375,
-0.29345703125,
-0.91650390625,
-0.06829833984375,
-0.7451171875,
0.65869140625,
0.059539794921875,
-0.1439208984375,
-0.08453369140625,
-0.73095703125,
4.4609375,
1.3115234375,
0.84130859375,
0.41552734375,
-0.0992431640625,
1.2529296875,
0.54345703125,
-0.5009765625,
-0.44384765625,
-0.685546875,
0.73974609375,
-0.0298919677734375,
0.046295166015625,
0.54541015625,
0.442626953125,
0.32763671875,
-0.61865234375,
0.330810546875,
-0.1895751953125,
-0.96630859375,
-0.6171875,
0.440673828125,
-0.368408203125,
0.364501953125,
-0.1951904296875,
0.365234375,
0.482177734375,
-1.0703125,
-0.440185546875,
-0.7412109375,
0.2061767578125,
-0.64501953125,
0.86572265625,
0.11077880859375,
-0.302001953125,
0.367919921875,
-0.111083984375,
-0.6552734375,
-0.318603515625,
-0.0200653076171875,
-0.051483154296875,
-0.21044921875,
0.0960693359375,
-0.58251953125,
-0.022735595703125,
0.4560546875,
-0.29443359375,
0.440185546875,
0.0999755859375,
-1.0302734375,
1.1640625,
-0.25146484375,
0.5830078125,
-0.54150390625,
-0.970703125,
0.06060791015625,
0.337890625,
0.034942626953125,
-0.484130859375,
0.353515625,
0.488525390625,
0.210693359375,
-0.2069091796875,
0.335205078125,
-0.63232421875,
0.9296875,
-0.31396484375,
0.1585693359375,
-0.5546875,
-0.1461181640625,
-0.342529296875,
-0.6513671875,
-0.382080078125,
-0.11907958984375,
0.7265625,
0.135498046875,
-0.334716796875,
0.42578125,
0.3515625,
-0.7724609375,
0.1649169921875,
-0.371337890625,
-0.303955078125,
-0.1871337890625,
0.330078125,
0.9033203125,
-0.7763671875,
-0.2393798828125,
-0.364013671875,
0.401611328125,
0.56689453125,
0.8515625,
-0.2481689453125,
-0.7734375,
0.1917724609375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Memory is performing a walk on the two-dimensional plane, starting at the origin. He is given a string s with his directions for motion:
* An 'L' indicates he should move one unit left.
* An 'R' indicates he should move one unit right.
* A 'U' indicates he should move one unit up.
* A 'D' indicates he should move one unit down.
But now Memory wants to end at the origin. To do this, he has a special trident. This trident can replace any character in s with any of 'L', 'R', 'U', or 'D'. However, because he doesn't want to wear out the trident, he wants to make the minimum number of edits possible. Please tell Memory what is the minimum number of changes he needs to make to produce a string that, when walked, will end at the origin, or if there is no such string.
Input
The first and only line contains the string s (1 β€ |s| β€ 100 000) β the instructions Memory is given.
Output
If there is a string satisfying the conditions, output a single integer β the minimum number of edits required. In case it's not possible to change the sequence in such a way that it will bring Memory to to the origin, output -1.
Examples
Input
RRU
Output
-1
Input
UDUR
Output
1
Input
RUUR
Output
2
Note
In the first sample test, Memory is told to walk right, then right, then up. It is easy to see that it is impossible to edit these instructions to form a valid walk.
In the second sample test, Memory is told to walk up, then down, then up, then right. One possible solution is to change s to "LDUR". This string uses 1 edit, which is the minimum possible. It also ends at the origin.
Tags: implementation, strings
Correct Solution:
```
S = input()
l = 0
r = 0
u = 0
d = 0
if len(S)%2!=0:
print(-1)
else:
for i in S:
if i=='L':
l+=1
elif i=='R':
r+=1
elif i=='U':
u+=1
else:
d+=1
lr = abs(l-r)
ud = abs(u-d)
print(int((lr+ud)/2))
```
| 35,616
|
[
0.1512451171875,
-0.08807373046875,
-0.10992431640625,
0.199462890625,
-0.4365234375,
-0.426513671875,
0.07666015625,
-0.08575439453125,
0.2486572265625,
0.8583984375,
0.828125,
-0.06903076171875,
0.054290771484375,
-0.474853515625,
-0.62744140625,
0.090087890625,
-0.7685546875,
-0.65771484375,
-0.478271484375,
-0.084716796875,
0.2335205078125,
-0.409423828125,
-1.291015625,
-0.1866455078125,
-0.12127685546875,
0.7900390625,
0.290283203125,
0.47314453125,
1.259765625,
1.2001953125,
0.11614990234375,
-0.24560546875,
0.445068359375,
-0.95361328125,
-0.45458984375,
-0.450927734375,
0.64453125,
-0.7109375,
-0.2093505859375,
-0.2398681640625,
0.283935546875,
-0.338134765625,
0.67041015625,
-0.513671875,
-1.3076171875,
-0.2176513671875,
-0.56591796875,
-0.72509765625,
-0.3076171875,
-0.50048828125,
0.290283203125,
-0.1898193359375,
0.55126953125,
-0.0670166015625,
0.11236572265625,
-0.00240325927734375,
0.055999755859375,
0.27880859375,
-0.6904296875,
0.1009521484375,
0.2303466796875,
0.2337646484375,
0.0684814453125,
-0.693359375,
0.0516357421875,
0.33935546875,
-0.018402099609375,
-0.0343017578125,
-0.143798828125,
-0.62255859375,
-0.441162109375,
0.1002197265625,
-0.3642578125,
-0.7353515625,
-0.198974609375,
0.57080078125,
0.35693359375,
-0.048187255859375,
-0.55859375,
0.56884765625,
0.0457763671875,
0.91796875,
0.24755859375,
0.2493896484375,
-0.497802734375,
-0.626953125,
0.030792236328125,
0.245361328125,
0.28759765625,
-0.10113525390625,
-0.305908203125,
0.5078125,
-0.469482421875,
-0.10028076171875,
0.298095703125,
0.86474609375,
-0.2353515625,
0.55810546875,
0.72216796875,
-0.11981201171875,
0.51806640625,
1.06640625,
-0.67822265625,
0.849609375,
-0.427734375,
0.051177978515625,
0.328125,
0.052947998046875,
-0.44921875,
-0.345947265625,
-0.0792236328125,
-0.1763916015625,
0.61474609375,
0.5654296875,
-0.283447265625,
0.82666015625,
0.0640869140625,
0.634765625,
-0.591796875,
0.52490234375,
0.6630859375,
-0.074462890625,
0.29638671875,
-0.2362060546875,
-0.08251953125,
-0.43310546875,
-0.1646728515625,
0.91015625,
-0.400634765625,
-0.0293731689453125,
0.35302734375,
0.010589599609375,
-0.08538818359375,
0.38671875,
-0.291748046875,
0.65185546875,
-0.430908203125,
0.49609375,
1.0615234375,
-0.61083984375,
0.65087890625,
-0.1529541015625,
-0.0220489501953125,
1.390625,
0.892578125,
0.2431640625,
0.385498046875,
0.30224609375,
-0.8349609375,
0.15380859375,
-0.91357421875,
0.65478515625,
0.391357421875,
0.0958251953125,
0.176513671875,
0.055511474609375,
-0.30615234375,
0.68994140625,
0.003284454345703125,
0.406982421875,
-0.2249755859375,
0.1949462890625,
-0.26806640625,
1.087890625,
-0.22509765625,
0.78564453125,
-0.2900390625,
-0.2049560546875,
-0.54443359375,
-0.6318359375,
0.30029296875,
0.045318603515625,
-0.2958984375,
0.396484375,
0.1334228515625,
1.2841796875,
1.2138671875,
0.366943359375,
0.109130859375,
0.229248046875,
-0.50732421875,
0.11761474609375,
0.4990234375,
0.806640625,
-0.298583984375,
0.130126953125,
0.1573486328125,
-0.13525390625,
-0.7216796875,
-0.12841796875,
0.030517578125,
0.8056640625,
-0.367919921875,
0.303955078125,
0.340576171875,
0.377197265625,
-1.044921875,
-0.236083984375,
-0.513671875,
-1.0107421875,
-0.427490234375,
0.50634765625,
-0.1719970703125,
0.51513671875,
-0.267578125,
-0.61865234375,
0.458984375,
0.99072265625,
-0.107666015625,
0.153076171875,
0.380126953125,
0.0201263427734375,
-0.029022216796875,
0.3173828125,
0.096923828125,
-0.32568359375,
-0.48291015625,
0.443115234375,
-0.093994140625,
0.0213623046875,
0.1541748046875,
0.443115234375,
0.51708984375,
0.463134765625,
-0.1251220703125,
-0.0682373046875,
0.720703125,
0.99267578125,
-0.17529296875,
0.53466796875,
0.09014892578125,
0.96435546875,
0.257080078125,
0.58740234375,
0.6064453125,
0.444580078125,
0.56103515625,
0.87060546875,
-0.326904296875,
0.111083984375,
0.3671875,
0.626953125,
0.79150390625,
0.379638671875,
0.160888671875,
0.4384765625,
-0.0677490234375,
-0.412109375,
-0.223876953125,
0.0806884765625,
-0.321044921875,
0.4501953125,
-0.039031982421875,
0.149658203125,
-0.291259765625,
-0.4814453125,
0.12432861328125,
0.728515625,
-0.8916015625,
-0.90185546875,
0.2646484375,
0.27001953125,
0.46630859375,
-0.11077880859375,
0.383544921875,
0.64697265625,
0.306396484375,
0.31689453125,
-0.1474609375,
-0.457763671875,
-0.7998046875,
-0.78662109375,
-0.89111328125,
-0.413330078125,
-0.625,
-0.01580810546875,
0.6767578125,
-0.9150390625,
0.363525390625,
-0.5205078125,
0.053009033203125,
-0.06195068359375,
-0.28662109375,
0.85888671875,
-0.355712890625,
0.51318359375,
-0.6328125,
0.66552734375,
0.056854248046875,
0.86328125,
-0.509765625,
-0.377685546875,
-0.460205078125,
-0.87353515625,
0.0692138671875,
-0.111572265625,
0.82958984375,
-0.0259857177734375,
-0.8310546875,
-0.7451171875,
-0.3408203125,
-0.09820556640625,
-0.548828125,
0.286865234375,
-0.54052734375,
1.2119140625,
0.68212890625,
-0.7548828125,
0.6806640625,
0.82080078125,
-0.81494140625,
0.513671875,
0.28515625,
0.262451171875,
-0.74560546875,
1.5224609375,
0.432861328125,
0.435791015625,
-0.6083984375,
-0.7578125,
-0.548828125,
0.31689453125,
0.34130859375,
-0.335205078125,
-0.39111328125,
0.5732421875,
0.10321044921875,
-0.90966796875,
0.712890625,
-0.91162109375,
-0.45751953125,
-0.26708984375,
-0.23095703125,
1.20703125,
0.865234375,
0.1412353515625,
-0.0023517608642578125,
-0.1829833984375,
-0.461181640625,
0.71044921875,
0.470947265625,
-0.35986328125,
-0.0240936279296875,
0.426513671875,
-0.1304931640625,
0.1195068359375,
0.184326171875,
-0.5009765625,
-0.045318603515625,
-0.10919189453125,
0.317626953125,
0.8564453125,
0.370849609375,
0.420166015625,
0.583984375,
0.5771484375,
-0.6630859375,
-0.50439453125,
-0.09228515625,
0.82861328125,
0.443603515625,
0.4501953125,
0.0024967193603515625,
-0.307373046875,
-0.51123046875,
-0.91064453125,
0.351318359375,
0.203125,
0.625,
-0.80029296875,
0.91162109375,
0.1624755859375,
-0.55078125,
0.234375,
-0.78759765625,
0.076171875,
1.115234375,
-0.0667724609375,
0.7216796875,
-0.5634765625,
0.311767578125,
-0.09783935546875,
-0.07421875,
0.3935546875,
0.314208984375,
0.264404296875,
-0.6015625,
-0.41650390625,
-0.6162109375,
0.1109619140625,
-0.26318359375,
-0.77001953125,
0.127685546875,
-0.416259765625,
-0.27099609375,
-0.8935546875,
0.72314453125,
0.91259765625,
0.50732421875,
-0.11370849609375,
0.576171875,
-0.0198974609375,
0.18115234375,
0.486328125,
-0.2919921875,
0.3515625,
-0.88671875,
0.6220703125,
-0.087158203125,
-0.369873046875,
-0.431396484375,
-0.452392578125,
-0.71240234375,
0.2471923828125,
0.1094970703125,
-0.27099609375,
-0.80126953125,
0.08734130859375,
0.295654296875,
0.2203369140625,
-0.306884765625,
-0.0772705078125,
-0.14404296875,
0.57421875,
0.65185546875,
-0.9951171875,
-0.07281494140625,
-1.0966796875,
0.76318359375,
0.239990234375,
-0.44775390625,
-0.25341796875,
-0.60693359375,
-0.8466796875,
-0.7587890625,
-0.146484375,
0.49169921875,
0.1414794921875,
0.038055419921875,
-1.07421875,
0.44921875,
0.228515625,
-0.0863037109375,
0.15771484375,
-0.1876220703125,
0.275146484375,
-0.1923828125,
0.63134765625,
-0.44091796875,
-0.40234375,
0.290283203125,
-1.0791015625,
0.51953125,
-0.28564453125,
0.41845703125,
0.1392822265625,
-0.442626953125,
0.2012939453125,
0.50732421875,
-0.72900390625,
0.384765625,
-0.59912109375,
0.2275390625,
-0.927734375,
-0.251708984375,
0.607421875,
-0.348388671875,
-0.27734375,
1.220703125,
0.09375,
-0.345458984375,
0.1151123046875,
0.7685546875,
-0.21337890625,
0.083740234375,
-0.6015625,
0.7841796875,
-0.62255859375,
-0.60888671875,
-0.477294921875,
-0.70361328125,
0.958984375,
-0.0185394287109375,
-0.44482421875,
-0.2100830078125,
-1.2099609375,
-0.257080078125,
0.290771484375,
-0.533203125,
0.0125732421875,
0.311767578125,
-0.202392578125,
0.14111328125,
-0.2734375,
-0.35009765625,
-0.485595703125,
-0.791015625,
0.065185546875,
0.23095703125,
0.51513671875,
0.323486328125,
-0.10052490234375,
-0.462646484375,
0.298583984375,
-0.1993408203125,
-0.290283203125,
-0.375,
-0.474365234375,
-0.1927490234375,
-0.24560546875,
-0.019317626953125,
-0.069580078125,
-0.06866455078125,
0.7236328125,
0.9697265625,
0.0401611328125,
0.13232421875,
0.428955078125,
-0.51611328125,
1.1484375,
0.1505126953125,
-0.9384765625,
-0.00917816162109375,
0.347900390625,
0.1727294921875,
0.301513671875,
-0.0205535888671875,
-0.7109375,
-0.7705078125,
-1.1064453125,
0.29736328125,
-0.6259765625,
0.1011962890625,
-0.94921875,
-0.82666015625,
-0.140869140625,
0.337646484375,
-0.120849609375,
-0.87744140625,
0.399658203125,
-0.931640625,
0.27978515625,
-1.091796875,
-0.10400390625,
-0.66455078125,
-0.51025390625,
-0.1807861328125,
1.2060546875,
-0.0517578125,
0.5888671875,
0.322021484375,
0.0499267578125,
0.1253662109375,
-0.21826171875,
-0.61376953125,
-0.43505859375,
-0.10400390625,
0.35205078125,
-0.370361328125,
-0.299560546875,
-0.299560546875,
0.58154296875,
-0.84423828125,
0.379638671875,
-0.39404296875,
-0.27294921875,
-0.26171875,
-0.70458984375,
1.39453125,
-0.429931640625,
0.372314453125,
0.0826416015625,
0.68115234375,
0.68310546875,
-0.263916015625,
-0.045257568359375,
-0.7958984375,
-0.7333984375,
-1.0517578125,
0.734375,
-0.5537109375,
0.0033721923828125,
-0.712890625,
-0.4404296875,
1.0029296875,
-0.73583984375,
0.39599609375,
1.2705078125,
0.039764404296875,
0.666015625,
-0.90185546875,
0.404541015625,
0.444580078125,
-0.6328125,
-0.076416015625,
0.1749267578125,
-0.888671875,
0.089599609375,
-0.5498046875,
-1.1875,
-0.84033203125,
0.228759765625,
1.1591796875,
0.07330322265625,
0.69189453125,
-0.442138671875,
-0.90380859375,
-0.478759765625,
1.26953125,
0.192138671875,
-0.086669921875,
0.7421875,
-0.125,
0.06951904296875,
-0.177734375,
-0.057647705078125,
-0.57470703125,
-0.41796875,
1.1513671875,
-0.3017578125,
-0.8173828125,
0.96728515625,
0.7841796875,
-0.93408203125,
-1.033203125,
-0.1829833984375,
-0.06683349609375,
-0.0526123046875,
-0.978515625,
0.1922607421875,
0.505859375,
-0.57080078125,
0.227783203125,
0.321044921875,
0.08154296875,
0.53515625,
0.06182861328125,
-0.019805908203125,
-0.36181640625,
0.1353759765625,
0.4443359375,
-0.472412109375,
-0.3173828125,
-0.95751953125,
-0.432861328125,
-0.326416015625,
0.124755859375,
0.66796875,
-0.310546875,
-0.010223388671875,
0.432861328125,
0.0092315673828125,
0.47900390625,
-0.08087158203125,
-0.341064453125,
0.469482421875,
-0.6796875,
-0.343017578125,
-0.01230621337890625,
0.79833984375,
-0.057525634765625,
0.476806640625,
-0.484619140625,
0.1429443359375,
0.412353515625,
0.56298828125,
-0.58935546875,
-1.2216796875,
-0.2666015625,
-1.3193359375,
-0.62060546875,
-0.321533203125,
-0.95947265625,
0.0206146240234375,
0.27783203125,
-0.108154296875,
-0.54296875,
-0.1695556640625,
0.587890625,
-0.346435546875,
0.31396484375,
-0.36962890625,
0.436279296875,
-0.63232421875,
-0.2232666015625,
-0.98828125,
-0.2347412109375,
-0.419921875,
-0.2342529296875,
-0.67529296875,
0.235107421875,
-0.353759765625,
0.2215576171875,
-0.08575439453125,
0.389892578125,
0.0007486343383789062,
-0.27734375,
0.1317138671875,
0.320068359375,
0.0369873046875,
0.73388671875,
0.85009765625,
0.05255126953125,
0.53125,
-0.3056640625,
-0.27490234375,
-0.61572265625,
0.88330078125,
0.448486328125,
-0.36279296875,
-0.309814453125,
-0.19921875,
0.11334228515625,
-1.11328125,
0.4814453125,
-0.1138916015625,
0.5498046875,
0.1514892578125,
-0.0294342041015625,
0.71240234375,
1.1533203125,
0.1304931640625,
0.1732177734375,
0.1378173828125,
-0.08587646484375,
0.67138671875,
0.370361328125,
0.0013608932495117188,
0.736328125,
-0.342529296875,
-0.49560546875,
0.125732421875,
0.2095947265625,
-0.1343994140625,
0.3447265625,
-0.701171875,
-0.363037109375,
-0.56005859375,
-0.09552001953125,
-0.345703125,
0.388671875,
0.337890625,
-0.51318359375,
0.0246429443359375,
-0.29638671875,
-0.5869140625,
-0.00771331787109375,
-1.0654296875,
-0.96484375,
0.215087890625,
-0.286865234375,
-0.4150390625,
-0.4833984375,
-0.1951904296875,
-0.392822265625,
-0.1798095703125,
0.369873046875,
-0.258056640625,
0.444580078125,
-0.421875,
0.9736328125,
-0.50634765625,
0.08380126953125,
0.453857421875,
0.56640625,
-0.72998046875,
-0.6337890625,
-0.00928497314453125,
0.98388671875,
0.254638671875,
-0.28466796875,
-0.69921875,
-0.1461181640625,
0.0206756591796875,
-0.007701873779296875,
-0.5986328125,
0.43359375,
-0.0137481689453125,
0.5400390625,
-0.544921875,
-0.5185546875,
-0.0767822265625,
0.4677734375,
-0.01290130615234375,
-0.318603515625,
-0.26123046875,
0.8642578125,
0.492431640625,
-0.040008544921875,
0.50341796875,
-0.0203857421875,
0.64892578125,
-0.447021484375,
0.0582275390625,
-0.15234375,
1.1123046875,
0.69873046875,
0.2239990234375,
-0.1329345703125,
0.67138671875,
0.48681640625,
-0.2685546875,
-0.07183837890625,
0.68505859375,
0.216064453125,
-0.23583984375,
0.03515625,
-0.2293701171875,
-0.141845703125,
-0.0999755859375,
-0.578125,
0.160400390625,
-0.328857421875,
-0.0474853515625,
-0.580078125,
-0.56103515625,
1.0498046875,
-0.2880859375,
-0.336181640625,
0.447998046875,
-0.4345703125,
0.1307373046875,
0.931640625,
-0.055328369140625,
-0.1436767578125,
0.43115234375,
0.60302734375,
0.6025390625,
0.486328125,
0.419921875,
0.45556640625,
-0.256591796875,
0.06475830078125,
0.2181396484375,
-0.1082763671875,
-0.415771484375,
-0.76611328125,
-0.78515625,
0.5263671875,
-0.55908203125,
-0.145751953125,
0.390380859375,
-0.5986328125,
-0.1253662109375,
-0.131591796875,
0.7646484375,
-0.8076171875,
0.06585693359375,
-0.007312774658203125,
-0.285888671875,
-0.8662109375,
1.2412109375,
-0.09844970703125,
0.5107421875,
-0.005710601806640625,
1.29296875,
-0.1470947265625,
1.1318359375,
0.4287109375,
-0.1953125,
0.2880859375,
0.335205078125,
-0.450927734375,
-0.5400390625,
-0.183837890625,
-0.2529296875,
-0.187744140625,
-0.91796875,
-0.1541748046875,
0.0760498046875,
0.84130859375,
-0.006862640380859375,
-0.6787109375,
-0.003902435302734375,
0.040557861328125,
-0.78369140625,
0.529296875,
-0.059539794921875,
0.2022705078125,
0.00444793701171875,
-0.047149658203125,
0.04962158203125,
-0.447509765625,
0.223388671875,
-0.45703125,
0.307861328125,
-0.56689453125,
-0.00519561767578125,
-0.38134765625,
-0.56005859375,
-0.425537109375,
0.0704345703125,
-0.3408203125,
-0.5927734375,
0.09716796875,
0.332763671875,
0.458984375,
0.2188720703125,
-0.434326171875,
0.263671875,
0.9765625,
1.0498046875,
0.0914306640625,
0.482666015625,
0.14794921875,
0.1939697265625,
0.01392364501953125,
-0.296875,
0.447998046875,
-0.332275390625,
-0.0195465087890625,
0.0037517547607421875,
0.136474609375,
-0.7568359375,
-1.2158203125,
0.1981201171875,
0.1846923828125,
0.45263671875,
-0.4716796875,
-0.8388671875,
-0.282958984375,
-0.921875,
-0.074951171875,
-0.72509765625,
0.64990234375,
0.050323486328125,
-0.1334228515625,
-0.068359375,
-0.7333984375,
4.44921875,
1.31640625,
0.83154296875,
0.402587890625,
-0.0811767578125,
1.2412109375,
0.53173828125,
-0.521484375,
-0.455322265625,
-0.6806640625,
0.7294921875,
-0.038482666015625,
0.057403564453125,
0.56591796875,
0.451416015625,
0.3271484375,
-0.62744140625,
0.31787109375,
-0.208984375,
-0.95166015625,
-0.62451171875,
0.4580078125,
-0.378662109375,
0.394775390625,
-0.1929931640625,
0.3837890625,
0.469482421875,
-1.0830078125,
-0.4384765625,
-0.7509765625,
0.1962890625,
-0.61962890625,
0.87255859375,
0.1414794921875,
-0.306640625,
0.37109375,
-0.11358642578125,
-0.64892578125,
-0.329833984375,
-0.032440185546875,
-0.03363037109375,
-0.225830078125,
0.09613037109375,
-0.58544921875,
-0.01224517822265625,
0.447021484375,
-0.30224609375,
0.44921875,
0.09075927734375,
-1.0283203125,
1.1494140625,
-0.24462890625,
0.5625,
-0.51416015625,
-0.9794921875,
0.07391357421875,
0.344970703125,
0.03466796875,
-0.4892578125,
0.3642578125,
0.47412109375,
0.1861572265625,
-0.20556640625,
0.31103515625,
-0.64208984375,
0.9521484375,
-0.307373046875,
0.19677734375,
-0.5830078125,
-0.162353515625,
-0.32666015625,
-0.6533203125,
-0.407958984375,
-0.1202392578125,
0.72216796875,
0.1702880859375,
-0.331787109375,
0.40869140625,
0.3359375,
-0.783203125,
0.180419921875,
-0.3779296875,
-0.309326171875,
-0.1636962890625,
0.34619140625,
0.87646484375,
-0.7421875,
-0.228759765625,
-0.357666015625,
0.407958984375,
0.59130859375,
0.8408203125,
-0.26025390625,
-0.77392578125,
0.212890625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Memory is performing a walk on the two-dimensional plane, starting at the origin. He is given a string s with his directions for motion:
* An 'L' indicates he should move one unit left.
* An 'R' indicates he should move one unit right.
* A 'U' indicates he should move one unit up.
* A 'D' indicates he should move one unit down.
But now Memory wants to end at the origin. To do this, he has a special trident. This trident can replace any character in s with any of 'L', 'R', 'U', or 'D'. However, because he doesn't want to wear out the trident, he wants to make the minimum number of edits possible. Please tell Memory what is the minimum number of changes he needs to make to produce a string that, when walked, will end at the origin, or if there is no such string.
Input
The first and only line contains the string s (1 β€ |s| β€ 100 000) β the instructions Memory is given.
Output
If there is a string satisfying the conditions, output a single integer β the minimum number of edits required. In case it's not possible to change the sequence in such a way that it will bring Memory to to the origin, output -1.
Examples
Input
RRU
Output
-1
Input
UDUR
Output
1
Input
RUUR
Output
2
Note
In the first sample test, Memory is told to walk right, then right, then up. It is easy to see that it is impossible to edit these instructions to form a valid walk.
In the second sample test, Memory is told to walk up, then down, then up, then right. One possible solution is to change s to "LDUR". This string uses 1 edit, which is the minimum possible. It also ends at the origin.
Tags: implementation, strings
Correct Solution:
```
#!/usr/bin/env python
#-*-coding:utf-8 -*-
x=y=0
for d in input():
if'L'==d:x-=1
elif'R'==d:x+=1
elif'D'==d:y-=1
else:y+=1
y=abs(x)+abs(y)
print(-1 if 1&y else y>>1)
```
| 35,617
|
[
0.1600341796875,
-0.10662841796875,
-0.1292724609375,
0.202880859375,
-0.4541015625,
-0.453125,
0.11761474609375,
-0.08349609375,
0.2288818359375,
0.849609375,
0.81396484375,
-0.04449462890625,
0.050933837890625,
-0.421630859375,
-0.6376953125,
0.083984375,
-0.75390625,
-0.64111328125,
-0.448974609375,
-0.0770263671875,
0.2259521484375,
-0.386474609375,
-1.298828125,
-0.173583984375,
-0.138671875,
0.81298828125,
0.291748046875,
0.457275390625,
1.2880859375,
1.2236328125,
0.07861328125,
-0.238037109375,
0.451904296875,
-0.958984375,
-0.44873046875,
-0.470947265625,
0.650390625,
-0.689453125,
-0.257080078125,
-0.25732421875,
0.290283203125,
-0.360107421875,
0.67919921875,
-0.48681640625,
-1.337890625,
-0.1995849609375,
-0.56884765625,
-0.68896484375,
-0.282958984375,
-0.482666015625,
0.3447265625,
-0.1451416015625,
0.5322265625,
-0.10430908203125,
0.11175537109375,
-0.0003650188446044922,
0.0173492431640625,
0.31005859375,
-0.66357421875,
0.06256103515625,
0.255126953125,
0.237548828125,
0.06854248046875,
-0.7060546875,
0.033660888671875,
0.3447265625,
-0.015899658203125,
0.016265869140625,
-0.123779296875,
-0.57421875,
-0.4140625,
0.1090087890625,
-0.409912109375,
-0.75,
-0.2037353515625,
0.537109375,
0.37646484375,
-0.0282135009765625,
-0.560546875,
0.5634765625,
0.06744384765625,
0.9560546875,
0.239013671875,
0.2108154296875,
-0.49951171875,
-0.63037109375,
0.032806396484375,
0.29345703125,
0.279541015625,
-0.08056640625,
-0.32861328125,
0.4775390625,
-0.471923828125,
-0.1064453125,
0.28955078125,
0.84423828125,
-0.190673828125,
0.56103515625,
0.6904296875,
-0.1337890625,
0.5224609375,
1.111328125,
-0.68115234375,
0.828125,
-0.4052734375,
0.0587158203125,
0.334716796875,
0.03167724609375,
-0.474365234375,
-0.326416015625,
-0.07574462890625,
-0.1788330078125,
0.57080078125,
0.54296875,
-0.259521484375,
0.86572265625,
0.05633544921875,
0.63134765625,
-0.5673828125,
0.52783203125,
0.6435546875,
-0.09869384765625,
0.291259765625,
-0.26416015625,
-0.09075927734375,
-0.45556640625,
-0.1783447265625,
0.9189453125,
-0.37451171875,
-0.0240478515625,
0.373291015625,
0.054962158203125,
-0.11834716796875,
0.36767578125,
-0.287109375,
0.662109375,
-0.435791015625,
0.53369140625,
1.0419921875,
-0.61474609375,
0.603515625,
-0.157958984375,
-0.019683837890625,
1.375,
0.90576171875,
0.239501953125,
0.38037109375,
0.2587890625,
-0.80712890625,
0.154052734375,
-0.86279296875,
0.67138671875,
0.402587890625,
0.08294677734375,
0.17919921875,
0.044158935546875,
-0.275634765625,
0.71826171875,
0.056427001953125,
0.41259765625,
-0.27490234375,
0.1826171875,
-0.260498046875,
1.0791015625,
-0.2255859375,
0.77978515625,
-0.262939453125,
-0.2349853515625,
-0.55126953125,
-0.6240234375,
0.312255859375,
0.038848876953125,
-0.2724609375,
0.39892578125,
0.1595458984375,
1.259765625,
1.2197265625,
0.38623046875,
0.118896484375,
0.228271484375,
-0.46923828125,
0.1363525390625,
0.48681640625,
0.79931640625,
-0.32373046875,
0.13037109375,
0.1524658203125,
-0.1531982421875,
-0.73828125,
-0.1544189453125,
0.0157470703125,
0.77685546875,
-0.402099609375,
0.33056640625,
0.33740234375,
0.38134765625,
-1.0087890625,
-0.2454833984375,
-0.5029296875,
-0.984375,
-0.442626953125,
0.50830078125,
-0.1751708984375,
0.50146484375,
-0.26220703125,
-0.6025390625,
0.459716796875,
1.0146484375,
-0.08477783203125,
0.1480712890625,
0.40576171875,
0.005218505859375,
-0.07537841796875,
0.2939453125,
0.1480712890625,
-0.33984375,
-0.467529296875,
0.464599609375,
-0.13623046875,
0.024932861328125,
0.180419921875,
0.463623046875,
0.54443359375,
0.455078125,
-0.1114501953125,
-0.04833984375,
0.71337890625,
0.98388671875,
-0.178955078125,
0.5048828125,
0.105712890625,
0.8994140625,
0.2705078125,
0.5634765625,
0.6318359375,
0.43896484375,
0.5791015625,
0.88671875,
-0.33349609375,
0.145263671875,
0.35400390625,
0.59619140625,
0.736328125,
0.34326171875,
0.178466796875,
0.443115234375,
-0.0927734375,
-0.447998046875,
-0.2237548828125,
0.08148193359375,
-0.323974609375,
0.441650390625,
-0.0215606689453125,
0.1650390625,
-0.3037109375,
-0.477783203125,
0.099853515625,
0.71240234375,
-0.88818359375,
-0.88818359375,
0.265380859375,
0.24072265625,
0.451904296875,
-0.10205078125,
0.392333984375,
0.65087890625,
0.283447265625,
0.309814453125,
-0.1529541015625,
-0.456787109375,
-0.8173828125,
-0.79052734375,
-0.873046875,
-0.42626953125,
-0.6396484375,
0.0076446533203125,
0.671875,
-0.92724609375,
0.39111328125,
-0.494384765625,
0.06793212890625,
-0.06488037109375,
-0.292236328125,
0.83642578125,
-0.3583984375,
0.52734375,
-0.61767578125,
0.66259765625,
0.059539794921875,
0.88134765625,
-0.5234375,
-0.400634765625,
-0.5107421875,
-0.87451171875,
0.069091796875,
-0.08343505859375,
0.84033203125,
-0.0156097412109375,
-0.85302734375,
-0.70703125,
-0.34033203125,
-0.11328125,
-0.5654296875,
0.279052734375,
-0.5556640625,
1.2041015625,
0.6572265625,
-0.7607421875,
0.6982421875,
0.822265625,
-0.83935546875,
0.505859375,
0.3017578125,
0.259765625,
-0.75146484375,
1.564453125,
0.437744140625,
0.449951171875,
-0.6240234375,
-0.759765625,
-0.53076171875,
0.35107421875,
0.366455078125,
-0.308349609375,
-0.419677734375,
0.56005859375,
0.07696533203125,
-0.927734375,
0.71484375,
-0.93310546875,
-0.485595703125,
-0.26806640625,
-0.251708984375,
1.19921875,
0.833984375,
0.153076171875,
0.00504302978515625,
-0.1551513671875,
-0.471923828125,
0.708984375,
0.477783203125,
-0.341552734375,
-0.003627777099609375,
0.419189453125,
-0.11126708984375,
0.1607666015625,
0.1795654296875,
-0.5048828125,
-0.004024505615234375,
-0.125732421875,
0.357177734375,
0.85595703125,
0.355712890625,
0.420166015625,
0.5615234375,
0.59326171875,
-0.6689453125,
-0.47509765625,
-0.10491943359375,
0.83837890625,
0.44970703125,
0.46875,
-0.0289459228515625,
-0.32470703125,
-0.5244140625,
-0.89208984375,
0.33056640625,
0.179931640625,
0.6298828125,
-0.77392578125,
0.919921875,
0.15380859375,
-0.564453125,
0.2435302734375,
-0.75048828125,
0.10357666015625,
1.142578125,
-0.04278564453125,
0.7177734375,
-0.55126953125,
0.295654296875,
-0.08331298828125,
-0.10443115234375,
0.39453125,
0.3232421875,
0.2491455078125,
-0.611328125,
-0.42724609375,
-0.6328125,
0.095947265625,
-0.25244140625,
-0.76806640625,
0.162109375,
-0.40576171875,
-0.264892578125,
-0.89697265625,
0.740234375,
0.9345703125,
0.470947265625,
-0.112548828125,
0.59130859375,
-0.032928466796875,
0.206298828125,
0.478759765625,
-0.265625,
0.337890625,
-0.8701171875,
0.6181640625,
-0.09100341796875,
-0.385009765625,
-0.44775390625,
-0.462890625,
-0.68310546875,
0.2249755859375,
0.0899658203125,
-0.257568359375,
-0.78515625,
0.0655517578125,
0.34130859375,
0.25,
-0.351806640625,
-0.049468994140625,
-0.158203125,
0.564453125,
0.64013671875,
-1.0068359375,
-0.060699462890625,
-1.072265625,
0.75634765625,
0.234130859375,
-0.4150390625,
-0.24365234375,
-0.6357421875,
-0.86962890625,
-0.7880859375,
-0.1593017578125,
0.517578125,
0.1278076171875,
0.0301055908203125,
-1.08984375,
0.4423828125,
0.2080078125,
-0.06768798828125,
0.1690673828125,
-0.188720703125,
0.2958984375,
-0.182861328125,
0.634765625,
-0.4111328125,
-0.372802734375,
0.310302734375,
-1.0849609375,
0.5087890625,
-0.322265625,
0.40478515625,
0.12890625,
-0.421142578125,
0.2054443359375,
0.55517578125,
-0.70654296875,
0.405029296875,
-0.58251953125,
0.2410888671875,
-0.94287109375,
-0.2476806640625,
0.5927734375,
-0.32861328125,
-0.293701171875,
1.2255859375,
0.13037109375,
-0.34033203125,
0.10009765625,
0.7421875,
-0.19189453125,
0.0712890625,
-0.58447265625,
0.7900390625,
-0.61083984375,
-0.61767578125,
-0.49560546875,
-0.70263671875,
0.947265625,
-0.062347412109375,
-0.444091796875,
-0.1875,
-1.2353515625,
-0.290771484375,
0.310546875,
-0.52294921875,
0.0234832763671875,
0.2998046875,
-0.1844482421875,
0.1571044921875,
-0.273681640625,
-0.39453125,
-0.476806640625,
-0.79296875,
0.04632568359375,
0.274169921875,
0.53515625,
0.31298828125,
-0.1396484375,
-0.4345703125,
0.300048828125,
-0.1451416015625,
-0.3115234375,
-0.405029296875,
-0.4736328125,
-0.17431640625,
-0.27734375,
-0.034912109375,
-0.0765380859375,
-0.10888671875,
0.71826171875,
0.94189453125,
0.040985107421875,
0.134765625,
0.40771484375,
-0.5185546875,
1.1435546875,
0.1119384765625,
-0.96533203125,
-0.004505157470703125,
0.34033203125,
0.1898193359375,
0.337890625,
0.017852783203125,
-0.72998046875,
-0.79541015625,
-1.0849609375,
0.28564453125,
-0.6455078125,
0.106689453125,
-0.90869140625,
-0.80029296875,
-0.171142578125,
0.3701171875,
-0.07940673828125,
-0.8564453125,
0.3759765625,
-0.90576171875,
0.280517578125,
-1.0810546875,
-0.10162353515625,
-0.6064453125,
-0.4951171875,
-0.171142578125,
1.2412109375,
-0.06298828125,
0.56494140625,
0.29296875,
0.0706787109375,
0.1038818359375,
-0.2364501953125,
-0.60009765625,
-0.444580078125,
-0.09600830078125,
0.3623046875,
-0.38671875,
-0.3388671875,
-0.326171875,
0.5810546875,
-0.83203125,
0.37890625,
-0.400146484375,
-0.279296875,
-0.24853515625,
-0.7041015625,
1.392578125,
-0.40576171875,
0.328125,
0.0748291015625,
0.6748046875,
0.64306640625,
-0.282470703125,
-0.022552490234375,
-0.79736328125,
-0.7216796875,
-1.056640625,
0.73388671875,
-0.56884765625,
0.0258636474609375,
-0.7197265625,
-0.444091796875,
1.0146484375,
-0.72705078125,
0.40283203125,
1.2451171875,
0.0280303955078125,
0.65576171875,
-0.87646484375,
0.39306640625,
0.4384765625,
-0.65283203125,
-0.058258056640625,
0.2021484375,
-0.86962890625,
0.09490966796875,
-0.52587890625,
-1.18359375,
-0.8447265625,
0.2247314453125,
1.19140625,
0.0694580078125,
0.71533203125,
-0.42578125,
-0.92626953125,
-0.468994140625,
1.3056640625,
0.1917724609375,
-0.0731201171875,
0.7333984375,
-0.138427734375,
0.0496826171875,
-0.143798828125,
-0.05877685546875,
-0.572265625,
-0.4189453125,
1.1572265625,
-0.30419921875,
-0.8232421875,
0.96484375,
0.80712890625,
-0.8955078125,
-1.0595703125,
-0.1947021484375,
-0.05792236328125,
-0.07073974609375,
-0.9619140625,
0.1885986328125,
0.50439453125,
-0.5654296875,
0.23291015625,
0.30224609375,
0.118896484375,
0.5205078125,
0.095947265625,
-0.044647216796875,
-0.3505859375,
0.091064453125,
0.450439453125,
-0.51513671875,
-0.273193359375,
-0.8935546875,
-0.406982421875,
-0.3310546875,
0.114990234375,
0.6962890625,
-0.3037109375,
0.0010967254638671875,
0.42822265625,
-0.01004791259765625,
0.470947265625,
-0.07171630859375,
-0.3388671875,
0.486328125,
-0.6767578125,
-0.332763671875,
-0.038116455078125,
0.798828125,
-0.08294677734375,
0.44873046875,
-0.453857421875,
0.15869140625,
0.4130859375,
0.53076171875,
-0.583984375,
-1.1953125,
-0.248779296875,
-1.3271484375,
-0.59521484375,
-0.302490234375,
-0.966796875,
-0.0194854736328125,
0.309326171875,
-0.1510009765625,
-0.5859375,
-0.1607666015625,
0.6328125,
-0.32177734375,
0.310546875,
-0.3662109375,
0.44140625,
-0.6494140625,
-0.215087890625,
-0.97412109375,
-0.24853515625,
-0.444091796875,
-0.2208251953125,
-0.67822265625,
0.205078125,
-0.341064453125,
0.22900390625,
-0.07769775390625,
0.419677734375,
-0.01983642578125,
-0.296142578125,
0.11163330078125,
0.312255859375,
0.0411376953125,
0.71826171875,
0.85546875,
0.052459716796875,
0.51513671875,
-0.296142578125,
-0.306396484375,
-0.61279296875,
0.84423828125,
0.450439453125,
-0.370361328125,
-0.2685546875,
-0.250244140625,
0.125732421875,
-1.10546875,
0.453125,
-0.07928466796875,
0.53857421875,
0.1435546875,
-0.0745849609375,
0.69482421875,
1.1455078125,
0.1304931640625,
0.169677734375,
0.14892578125,
-0.0758056640625,
0.69970703125,
0.35888671875,
0.0012187957763671875,
0.7060546875,
-0.326904296875,
-0.5283203125,
0.1044921875,
0.2177734375,
-0.1390380859375,
0.373779296875,
-0.7060546875,
-0.359619140625,
-0.58740234375,
-0.0953369140625,
-0.36767578125,
0.354736328125,
0.34130859375,
-0.498291015625,
-0.0025272369384765625,
-0.31201171875,
-0.58837890625,
-0.0294952392578125,
-1.0361328125,
-0.96240234375,
0.2447509765625,
-0.31787109375,
-0.372802734375,
-0.5224609375,
-0.176025390625,
-0.383544921875,
-0.14892578125,
0.37451171875,
-0.2484130859375,
0.41455078125,
-0.443115234375,
0.94091796875,
-0.50146484375,
0.10357666015625,
0.465576171875,
0.54541015625,
-0.71630859375,
-0.62158203125,
-0.0029010772705078125,
1.0263671875,
0.22998046875,
-0.280517578125,
-0.724609375,
-0.1295166015625,
-0.018585205078125,
-0.0196990966796875,
-0.60546875,
0.43017578125,
0.016876220703125,
0.52001953125,
-0.57275390625,
-0.51806640625,
-0.0806884765625,
0.492919921875,
-0.01139068603515625,
-0.338623046875,
-0.249755859375,
0.8671875,
0.471923828125,
-0.0022411346435546875,
0.484130859375,
-0.0290374755859375,
0.61572265625,
-0.441650390625,
0.0302734375,
-0.152099609375,
1.099609375,
0.67919921875,
0.212646484375,
-0.1361083984375,
0.67529296875,
0.5107421875,
-0.293212890625,
-0.090087890625,
0.6865234375,
0.22314453125,
-0.222412109375,
0.036712646484375,
-0.2281494140625,
-0.15576171875,
-0.10626220703125,
-0.58740234375,
0.1756591796875,
-0.31787109375,
-0.072021484375,
-0.56689453125,
-0.57421875,
1.06640625,
-0.320068359375,
-0.343505859375,
0.4228515625,
-0.451904296875,
0.1351318359375,
0.92919921875,
-0.07293701171875,
-0.131591796875,
0.439697265625,
0.5859375,
0.6162109375,
0.46337890625,
0.40625,
0.44970703125,
-0.26416015625,
0.0733642578125,
0.2374267578125,
-0.135498046875,
-0.406005859375,
-0.74853515625,
-0.79150390625,
0.552734375,
-0.52685546875,
-0.11138916015625,
0.394775390625,
-0.5751953125,
-0.11798095703125,
-0.138671875,
0.75537109375,
-0.83544921875,
0.0595703125,
-0.0240478515625,
-0.305419921875,
-0.869140625,
1.19921875,
-0.1044921875,
0.485107421875,
-0.0078887939453125,
1.30859375,
-0.1632080078125,
1.1279296875,
0.412841796875,
-0.1669921875,
0.2841796875,
0.3193359375,
-0.42529296875,
-0.55078125,
-0.1927490234375,
-0.243408203125,
-0.184814453125,
-0.9052734375,
-0.175537109375,
0.1435546875,
0.8369140625,
-0.0015506744384765625,
-0.67578125,
-0.004608154296875,
0.06121826171875,
-0.7783203125,
0.499267578125,
-0.054779052734375,
0.1463623046875,
0.01195526123046875,
-0.0138397216796875,
0.05853271484375,
-0.468994140625,
0.205078125,
-0.464111328125,
0.28125,
-0.5751953125,
-0.0020160675048828125,
-0.360595703125,
-0.58154296875,
-0.42041015625,
0.0430908203125,
-0.364013671875,
-0.6044921875,
0.10137939453125,
0.3046875,
0.493408203125,
0.199951171875,
-0.43701171875,
0.2978515625,
0.9443359375,
1.0625,
0.093994140625,
0.474609375,
0.1336669921875,
0.1966552734375,
0.0001347064971923828,
-0.2998046875,
0.439453125,
-0.319580078125,
-0.029815673828125,
-0.01410675048828125,
0.12066650390625,
-0.7265625,
-1.2412109375,
0.2060546875,
0.2113037109375,
0.47900390625,
-0.5185546875,
-0.81396484375,
-0.290771484375,
-0.91259765625,
-0.06719970703125,
-0.69189453125,
0.642578125,
0.07244873046875,
-0.1361083984375,
-0.041778564453125,
-0.75439453125,
4.4609375,
1.326171875,
0.85498046875,
0.379150390625,
-0.06939697265625,
1.2216796875,
0.53369140625,
-0.50048828125,
-0.45263671875,
-0.67333984375,
0.72412109375,
-0.052703857421875,
0.03021240234375,
0.541015625,
0.432861328125,
0.30908203125,
-0.63134765625,
0.320068359375,
-0.21875,
-0.9365234375,
-0.63671875,
0.443115234375,
-0.365478515625,
0.398681640625,
-0.1561279296875,
0.38671875,
0.473876953125,
-1.044921875,
-0.406005859375,
-0.75341796875,
0.17724609375,
-0.6513671875,
0.8740234375,
0.12457275390625,
-0.298095703125,
0.39892578125,
-0.149658203125,
-0.65478515625,
-0.335205078125,
0.00009000301361083984,
-0.01300048828125,
-0.2369384765625,
0.08392333984375,
-0.59326171875,
0.02777099609375,
0.467041015625,
-0.296630859375,
0.400146484375,
0.11468505859375,
-1.0009765625,
1.138671875,
-0.2344970703125,
0.5634765625,
-0.546875,
-0.94140625,
0.09674072265625,
0.338623046875,
0.04913330078125,
-0.490234375,
0.371826171875,
0.45751953125,
0.1876220703125,
-0.208740234375,
0.331298828125,
-0.640625,
0.95361328125,
-0.345703125,
0.19580078125,
-0.5673828125,
-0.1646728515625,
-0.32861328125,
-0.62646484375,
-0.39794921875,
-0.1124267578125,
0.66796875,
0.14501953125,
-0.28271484375,
0.44287109375,
0.305908203125,
-0.78857421875,
0.18701171875,
-0.36181640625,
-0.31640625,
-0.190185546875,
0.30517578125,
0.89306640625,
-0.76904296875,
-0.234619140625,
-0.34033203125,
0.419921875,
0.578125,
0.810546875,
-0.2396240234375,
-0.7734375,
0.205810546875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Memory is performing a walk on the two-dimensional plane, starting at the origin. He is given a string s with his directions for motion:
* An 'L' indicates he should move one unit left.
* An 'R' indicates he should move one unit right.
* A 'U' indicates he should move one unit up.
* A 'D' indicates he should move one unit down.
But now Memory wants to end at the origin. To do this, he has a special trident. This trident can replace any character in s with any of 'L', 'R', 'U', or 'D'. However, because he doesn't want to wear out the trident, he wants to make the minimum number of edits possible. Please tell Memory what is the minimum number of changes he needs to make to produce a string that, when walked, will end at the origin, or if there is no such string.
Input
The first and only line contains the string s (1 β€ |s| β€ 100 000) β the instructions Memory is given.
Output
If there is a string satisfying the conditions, output a single integer β the minimum number of edits required. In case it's not possible to change the sequence in such a way that it will bring Memory to to the origin, output -1.
Examples
Input
RRU
Output
-1
Input
UDUR
Output
1
Input
RUUR
Output
2
Note
In the first sample test, Memory is told to walk right, then right, then up. It is easy to see that it is impossible to edit these instructions to form a valid walk.
In the second sample test, Memory is told to walk up, then down, then up, then right. One possible solution is to change s to "LDUR". This string uses 1 edit, which is the minimum possible. It also ends at the origin.
Tags: implementation, strings
Correct Solution:
```
t=input()
t=list(t)
x,y=0,0
for i in range(0,len(t)):
if(t[i]=='U'):
x+=1
if(t[i]=='D'):
x-=1
if(t[i]=='L'):
y+=1
if(t[i]=='R'):
y-=1
if(x<0):
x*=-1
if(y<0):
y*=-1
if(len(t)%2!=0):
print(-1)
else:
print((x+y)//2)
```
| 35,618
|
[
0.1456298828125,
-0.103271484375,
-0.07757568359375,
0.1993408203125,
-0.436279296875,
-0.44384765625,
0.06707763671875,
-0.09130859375,
0.22900390625,
0.88134765625,
0.8310546875,
-0.048828125,
0.0384521484375,
-0.509765625,
-0.61181640625,
0.09033203125,
-0.74853515625,
-0.654296875,
-0.47412109375,
-0.09832763671875,
0.264892578125,
-0.4140625,
-1.291015625,
-0.169189453125,
-0.11260986328125,
0.77197265625,
0.277587890625,
0.450439453125,
1.263671875,
1.2109375,
0.11065673828125,
-0.2222900390625,
0.457763671875,
-0.90576171875,
-0.487060546875,
-0.451416015625,
0.6455078125,
-0.662109375,
-0.2232666015625,
-0.27392578125,
0.29736328125,
-0.375732421875,
0.6953125,
-0.48779296875,
-1.3173828125,
-0.2449951171875,
-0.5458984375,
-0.73486328125,
-0.311767578125,
-0.54541015625,
0.27392578125,
-0.1749267578125,
0.54052734375,
-0.0667724609375,
0.08544921875,
0.0260772705078125,
0.06658935546875,
0.283935546875,
-0.67724609375,
0.08087158203125,
0.221923828125,
0.2392578125,
0.047454833984375,
-0.72607421875,
0.068603515625,
0.340576171875,
0.013397216796875,
-0.02850341796875,
-0.11328125,
-0.61376953125,
-0.4736328125,
0.058563232421875,
-0.37109375,
-0.759765625,
-0.180908203125,
0.5810546875,
0.403564453125,
-0.006954193115234375,
-0.54345703125,
0.5576171875,
0.037811279296875,
0.92822265625,
0.2174072265625,
0.26513671875,
-0.47802734375,
-0.62890625,
0.09625244140625,
0.27978515625,
0.287109375,
-0.1265869140625,
-0.3427734375,
0.48291015625,
-0.46826171875,
-0.09326171875,
0.26708984375,
0.85546875,
-0.2266845703125,
0.5390625,
0.7265625,
-0.13916015625,
0.50244140625,
1.0693359375,
-0.70556640625,
0.86767578125,
-0.427490234375,
0.044158935546875,
0.341552734375,
0.047332763671875,
-0.484619140625,
-0.38037109375,
-0.07696533203125,
-0.17138671875,
0.599609375,
0.572265625,
-0.271484375,
0.8056640625,
0.06549072265625,
0.634765625,
-0.580078125,
0.51708984375,
0.66162109375,
-0.06719970703125,
0.324462890625,
-0.2308349609375,
-0.07012939453125,
-0.4423828125,
-0.1741943359375,
0.90869140625,
-0.387451171875,
-0.036773681640625,
0.318603515625,
0.02801513671875,
-0.093505859375,
0.3955078125,
-0.27587890625,
0.64599609375,
-0.39453125,
0.50146484375,
1.0400390625,
-0.59375,
0.6318359375,
-0.1431884765625,
-0.048309326171875,
1.3916015625,
0.9150390625,
0.2435302734375,
0.369384765625,
0.26806640625,
-0.86181640625,
0.1492919921875,
-0.90966796875,
0.6689453125,
0.36767578125,
0.06854248046875,
0.171142578125,
0.0447998046875,
-0.287353515625,
0.67724609375,
0.0260009765625,
0.378662109375,
-0.264892578125,
0.1546630859375,
-0.272216796875,
1.0810546875,
-0.2352294921875,
0.7900390625,
-0.260498046875,
-0.1973876953125,
-0.5634765625,
-0.61962890625,
0.27685546875,
0.04486083984375,
-0.287353515625,
0.419189453125,
0.159912109375,
1.2939453125,
1.1953125,
0.36962890625,
0.1024169921875,
0.2056884765625,
-0.505859375,
0.11285400390625,
0.490966796875,
0.80224609375,
-0.30224609375,
0.1400146484375,
0.2095947265625,
-0.147216796875,
-0.6806640625,
-0.1279296875,
0.0124664306640625,
0.77490234375,
-0.38134765625,
0.315673828125,
0.310791015625,
0.328857421875,
-1.021484375,
-0.247802734375,
-0.52880859375,
-1.0126953125,
-0.45263671875,
0.5107421875,
-0.1861572265625,
0.496826171875,
-0.28955078125,
-0.6162109375,
0.427001953125,
0.974609375,
-0.11846923828125,
0.1802978515625,
0.344970703125,
0.048828125,
-0.009307861328125,
0.3193359375,
0.11187744140625,
-0.294677734375,
-0.449951171875,
0.417724609375,
-0.0911865234375,
0.0191497802734375,
0.1533203125,
0.446044921875,
0.501953125,
0.486572265625,
-0.09869384765625,
-0.058990478515625,
0.71337890625,
1.00390625,
-0.1680908203125,
0.5234375,
0.0928955078125,
0.9755859375,
0.2486572265625,
0.59912109375,
0.6298828125,
0.440673828125,
0.576171875,
0.85400390625,
-0.352294921875,
0.09613037109375,
0.345947265625,
0.634765625,
0.7548828125,
0.413330078125,
0.1905517578125,
0.42822265625,
-0.055755615234375,
-0.4560546875,
-0.233642578125,
0.11767578125,
-0.31396484375,
0.476318359375,
-0.032867431640625,
0.135498046875,
-0.27099609375,
-0.484130859375,
0.1124267578125,
0.6962890625,
-0.8662109375,
-0.91552734375,
0.293701171875,
0.26904296875,
0.45263671875,
-0.13525390625,
0.40087890625,
0.68505859375,
0.34228515625,
0.289306640625,
-0.138671875,
-0.44091796875,
-0.8125,
-0.8037109375,
-0.91064453125,
-0.407470703125,
-0.5908203125,
-0.0171051025390625,
0.65771484375,
-0.935546875,
0.34912109375,
-0.5419921875,
0.048583984375,
-0.052154541015625,
-0.30615234375,
0.869140625,
-0.345458984375,
0.50634765625,
-0.609375,
0.6337890625,
0.03192138671875,
0.830078125,
-0.51416015625,
-0.397705078125,
-0.48681640625,
-0.89013671875,
0.0780029296875,
-0.10479736328125,
0.841796875,
-0.0218048095703125,
-0.84326171875,
-0.7392578125,
-0.3505859375,
-0.1337890625,
-0.52001953125,
0.28515625,
-0.5537109375,
1.2333984375,
0.68603515625,
-0.77685546875,
0.6865234375,
0.8173828125,
-0.837890625,
0.501953125,
0.27587890625,
0.263671875,
-0.74755859375,
1.5380859375,
0.47705078125,
0.38818359375,
-0.59521484375,
-0.7392578125,
-0.5361328125,
0.34130859375,
0.3408203125,
-0.307861328125,
-0.401123046875,
0.56396484375,
0.08624267578125,
-0.90283203125,
0.70263671875,
-0.89990234375,
-0.453125,
-0.2279052734375,
-0.2529296875,
1.2236328125,
0.8876953125,
0.165771484375,
0.040008544921875,
-0.1702880859375,
-0.451904296875,
0.70556640625,
0.48193359375,
-0.37158203125,
-0.0175323486328125,
0.421142578125,
-0.09881591796875,
0.1387939453125,
0.1868896484375,
-0.509765625,
-0.048187255859375,
-0.1396484375,
0.331298828125,
0.916015625,
0.364990234375,
0.430908203125,
0.57958984375,
0.57763671875,
-0.66064453125,
-0.48876953125,
-0.09283447265625,
0.83740234375,
0.446533203125,
0.4267578125,
-0.036529541015625,
-0.298095703125,
-0.5166015625,
-0.90185546875,
0.34033203125,
0.16650390625,
0.63037109375,
-0.8251953125,
0.9287109375,
0.158203125,
-0.54248046875,
0.22216796875,
-0.77001953125,
0.08160400390625,
1.1181640625,
-0.0623779296875,
0.7197265625,
-0.587890625,
0.26611328125,
-0.07958984375,
-0.08245849609375,
0.412109375,
0.34716796875,
0.2308349609375,
-0.59716796875,
-0.42529296875,
-0.60205078125,
0.14404296875,
-0.30859375,
-0.71533203125,
0.135009765625,
-0.412841796875,
-0.314208984375,
-0.88623046875,
0.70751953125,
0.94189453125,
0.485107421875,
-0.11468505859375,
0.59423828125,
-0.03460693359375,
0.163818359375,
0.492431640625,
-0.283203125,
0.33251953125,
-0.89990234375,
0.6357421875,
-0.091064453125,
-0.374267578125,
-0.39599609375,
-0.47998046875,
-0.6748046875,
0.2322998046875,
0.1075439453125,
-0.2369384765625,
-0.802734375,
0.09332275390625,
0.28564453125,
0.2379150390625,
-0.294921875,
-0.0653076171875,
-0.160400390625,
0.57080078125,
0.65771484375,
-0.97265625,
-0.08184814453125,
-1.0751953125,
0.73681640625,
0.24072265625,
-0.45263671875,
-0.2705078125,
-0.59326171875,
-0.8515625,
-0.771484375,
-0.11712646484375,
0.53173828125,
0.130615234375,
-0.003849029541015625,
-1.0654296875,
0.445556640625,
0.2269287109375,
-0.0882568359375,
0.1329345703125,
-0.1640625,
0.2666015625,
-0.1893310546875,
0.65625,
-0.396240234375,
-0.372314453125,
0.255615234375,
-1.0966796875,
0.52099609375,
-0.32666015625,
0.419189453125,
0.13818359375,
-0.425048828125,
0.1861572265625,
0.5126953125,
-0.73095703125,
0.399169921875,
-0.63232421875,
0.233642578125,
-0.94970703125,
-0.251708984375,
0.58447265625,
-0.33349609375,
-0.242431640625,
1.22265625,
0.0966796875,
-0.328125,
0.13525390625,
0.7607421875,
-0.25244140625,
0.0909423828125,
-0.56494140625,
0.771484375,
-0.6748046875,
-0.61083984375,
-0.481689453125,
-0.70703125,
0.9638671875,
-0.012298583984375,
-0.445068359375,
-0.2335205078125,
-1.169921875,
-0.281982421875,
0.27734375,
-0.53515625,
0.01006317138671875,
0.32666015625,
-0.2138671875,
0.152587890625,
-0.25732421875,
-0.407958984375,
-0.47802734375,
-0.7890625,
0.0394287109375,
0.237548828125,
0.51953125,
0.2958984375,
-0.0904541015625,
-0.46630859375,
0.280517578125,
-0.2086181640625,
-0.2822265625,
-0.3935546875,
-0.485107421875,
-0.198486328125,
-0.262939453125,
-0.006534576416015625,
-0.10565185546875,
-0.08544921875,
0.677734375,
0.9677734375,
0.045379638671875,
0.12078857421875,
0.4150390625,
-0.5107421875,
1.140625,
0.1573486328125,
-0.94873046875,
0.0190582275390625,
0.340087890625,
0.1588134765625,
0.3193359375,
-0.0083160400390625,
-0.71728515625,
-0.7255859375,
-1.0927734375,
0.2939453125,
-0.6328125,
0.0928955078125,
-0.931640625,
-0.80859375,
-0.12371826171875,
0.3447265625,
-0.07275390625,
-0.86474609375,
0.362060546875,
-0.92578125,
0.301025390625,
-1.10546875,
-0.09320068359375,
-0.634765625,
-0.4951171875,
-0.141357421875,
1.208984375,
-0.09173583984375,
0.5771484375,
0.32080078125,
0.05908203125,
0.11932373046875,
-0.20458984375,
-0.63232421875,
-0.456787109375,
-0.09271240234375,
0.355224609375,
-0.34326171875,
-0.318359375,
-0.3076171875,
0.61279296875,
-0.81103515625,
0.406982421875,
-0.378662109375,
-0.260009765625,
-0.28076171875,
-0.70458984375,
1.37109375,
-0.404541015625,
0.383056640625,
0.08251953125,
0.6455078125,
0.64111328125,
-0.269775390625,
-0.0210113525390625,
-0.79052734375,
-0.74951171875,
-1.0283203125,
0.775390625,
-0.58837890625,
0.031646728515625,
-0.697265625,
-0.465087890625,
1.017578125,
-0.748046875,
0.3955078125,
1.26953125,
0.040191650390625,
0.68115234375,
-0.8515625,
0.398193359375,
0.424072265625,
-0.6435546875,
-0.11920166015625,
0.175537109375,
-0.88916015625,
0.0826416015625,
-0.578125,
-1.212890625,
-0.81787109375,
0.2244873046875,
1.1279296875,
0.061126708984375,
0.70166015625,
-0.44873046875,
-0.8759765625,
-0.52978515625,
1.275390625,
0.18359375,
-0.1170654296875,
0.70703125,
-0.1346435546875,
0.049041748046875,
-0.182861328125,
-0.09991455078125,
-0.59326171875,
-0.43212890625,
1.13671875,
-0.3232421875,
-0.85205078125,
0.9951171875,
0.78271484375,
-0.90869140625,
-1.0283203125,
-0.2176513671875,
-0.03460693359375,
-0.056610107421875,
-0.98583984375,
0.1773681640625,
0.5146484375,
-0.58349609375,
0.255615234375,
0.317626953125,
0.05963134765625,
0.51904296875,
0.08221435546875,
0.030426025390625,
-0.345947265625,
0.1392822265625,
0.432373046875,
-0.467041015625,
-0.298583984375,
-0.9580078125,
-0.400146484375,
-0.290771484375,
0.137939453125,
0.68408203125,
-0.3173828125,
-0.013336181640625,
0.440673828125,
-0.034759521484375,
0.48974609375,
-0.12054443359375,
-0.343505859375,
0.471435546875,
-0.6748046875,
-0.35107421875,
-0.028350830078125,
0.77978515625,
-0.03509521484375,
0.491943359375,
-0.505859375,
0.1859130859375,
0.43212890625,
0.583984375,
-0.5927734375,
-1.234375,
-0.26708984375,
-1.3388671875,
-0.6337890625,
-0.295166015625,
-0.939453125,
0.0267791748046875,
0.275390625,
-0.1090087890625,
-0.54833984375,
-0.1427001953125,
0.5986328125,
-0.331298828125,
0.317138671875,
-0.38037109375,
0.46142578125,
-0.62255859375,
-0.22802734375,
-0.99609375,
-0.260986328125,
-0.43115234375,
-0.2115478515625,
-0.66015625,
0.23779296875,
-0.37060546875,
0.207275390625,
-0.0823974609375,
0.42626953125,
0.020416259765625,
-0.255615234375,
0.099365234375,
0.3291015625,
0.03546142578125,
0.734375,
0.81591796875,
0.07562255859375,
0.5322265625,
-0.308349609375,
-0.2498779296875,
-0.625,
0.90478515625,
0.4697265625,
-0.352783203125,
-0.2861328125,
-0.226806640625,
0.08282470703125,
-1.1171875,
0.48095703125,
-0.0887451171875,
0.54736328125,
0.148193359375,
-0.0149993896484375,
0.72998046875,
1.1513671875,
0.1319580078125,
0.189208984375,
0.149658203125,
-0.0928955078125,
0.69970703125,
0.35888671875,
0.03314208984375,
0.7294921875,
-0.338623046875,
-0.49609375,
0.13134765625,
0.1802978515625,
-0.11669921875,
0.3310546875,
-0.7138671875,
-0.33740234375,
-0.55810546875,
-0.08184814453125,
-0.314697265625,
0.371826171875,
0.356201171875,
-0.5087890625,
0.0149383544921875,
-0.32470703125,
-0.587890625,
-0.01409912109375,
-1.0576171875,
-0.99951171875,
0.230712890625,
-0.283203125,
-0.3779296875,
-0.467041015625,
-0.1756591796875,
-0.388427734375,
-0.155029296875,
0.3916015625,
-0.2415771484375,
0.4677734375,
-0.4072265625,
0.9990234375,
-0.50537109375,
0.07696533203125,
0.44189453125,
0.58349609375,
-0.7568359375,
-0.62841796875,
0.006145477294921875,
1.0048828125,
0.260498046875,
-0.2325439453125,
-0.72705078125,
-0.150634765625,
0.0347900390625,
-0.00994110107421875,
-0.587890625,
0.408935546875,
0.016998291015625,
0.5478515625,
-0.5693359375,
-0.5234375,
-0.060821533203125,
0.455078125,
-0.0264129638671875,
-0.300537109375,
-0.244873046875,
0.86669921875,
0.53857421875,
-0.00885772705078125,
0.52734375,
-0.06072998046875,
0.66455078125,
-0.4580078125,
0.05731201171875,
-0.1273193359375,
1.1162109375,
0.7041015625,
0.2388916015625,
-0.14013671875,
0.68798828125,
0.5048828125,
-0.28125,
-0.056671142578125,
0.720703125,
0.1817626953125,
-0.2239990234375,
0.0655517578125,
-0.257080078125,
-0.13427734375,
-0.1270751953125,
-0.5439453125,
0.1834716796875,
-0.362548828125,
-0.056854248046875,
-0.56396484375,
-0.58544921875,
1.0830078125,
-0.31689453125,
-0.332275390625,
0.423095703125,
-0.456298828125,
0.12335205078125,
0.89208984375,
-0.061492919921875,
-0.1505126953125,
0.443115234375,
0.5732421875,
0.619140625,
0.4697265625,
0.44091796875,
0.43701171875,
-0.276123046875,
0.05450439453125,
0.2181396484375,
-0.1357421875,
-0.384765625,
-0.755859375,
-0.80615234375,
0.52294921875,
-0.5654296875,
-0.187744140625,
0.39208984375,
-0.62890625,
-0.12060546875,
-0.1531982421875,
0.751953125,
-0.794921875,
0.059783935546875,
-0.01201629638671875,
-0.2607421875,
-0.86279296875,
1.2353515625,
-0.104736328125,
0.485107421875,
0.01361083984375,
1.2958984375,
-0.1380615234375,
1.134765625,
0.42333984375,
-0.2110595703125,
0.293212890625,
0.32177734375,
-0.451904296875,
-0.5419921875,
-0.2022705078125,
-0.261962890625,
-0.206298828125,
-0.8994140625,
-0.159423828125,
0.03729248046875,
0.787109375,
-0.0202484130859375,
-0.66845703125,
-0.01007843017578125,
0.03955078125,
-0.7802734375,
0.52001953125,
-0.051483154296875,
0.178955078125,
0.0285186767578125,
-0.035003662109375,
0.063232421875,
-0.467529296875,
0.21826171875,
-0.449462890625,
0.30126953125,
-0.55908203125,
0.00366973876953125,
-0.40234375,
-0.54443359375,
-0.383056640625,
0.054901123046875,
-0.35791015625,
-0.56396484375,
0.133056640625,
0.345703125,
0.450927734375,
0.2021484375,
-0.455322265625,
0.312255859375,
0.97705078125,
1.021484375,
0.0797119140625,
0.51708984375,
0.1175537109375,
0.2286376953125,
0.02093505859375,
-0.320068359375,
0.4296875,
-0.3544921875,
-0.002956390380859375,
-0.0306549072265625,
0.1259765625,
-0.75244140625,
-1.1845703125,
0.154052734375,
0.2015380859375,
0.437255859375,
-0.50830078125,
-0.84716796875,
-0.29638671875,
-0.9140625,
-0.08575439453125,
-0.71142578125,
0.63671875,
0.056854248046875,
-0.133056640625,
-0.0621337890625,
-0.70751953125,
4.453125,
1.333984375,
0.82861328125,
0.420654296875,
-0.06292724609375,
1.263671875,
0.5234375,
-0.50732421875,
-0.480712890625,
-0.6669921875,
0.76171875,
-0.054229736328125,
0.044921875,
0.5546875,
0.428955078125,
0.32568359375,
-0.6611328125,
0.270751953125,
-0.2041015625,
-0.953125,
-0.63720703125,
0.481689453125,
-0.3408203125,
0.348876953125,
-0.1917724609375,
0.37744140625,
0.479736328125,
-1.0966796875,
-0.4462890625,
-0.7353515625,
0.1695556640625,
-0.64501953125,
0.83984375,
0.1622314453125,
-0.3125,
0.384521484375,
-0.0755615234375,
-0.65625,
-0.308837890625,
-0.06121826171875,
-0.0474853515625,
-0.184326171875,
0.0758056640625,
-0.5654296875,
-0.014923095703125,
0.469482421875,
-0.285888671875,
0.447509765625,
0.11663818359375,
-0.990234375,
1.140625,
-0.25048828125,
0.59375,
-0.5283203125,
-0.96630859375,
0.07513427734375,
0.325927734375,
0.0565185546875,
-0.471435546875,
0.3671875,
0.48193359375,
0.192626953125,
-0.2113037109375,
0.334716796875,
-0.64990234375,
0.93310546875,
-0.3359375,
0.1741943359375,
-0.56689453125,
-0.15625,
-0.322509765625,
-0.65087890625,
-0.39111328125,
-0.1182861328125,
0.70361328125,
0.1514892578125,
-0.330810546875,
0.417724609375,
0.32958984375,
-0.76318359375,
0.2052001953125,
-0.368408203125,
-0.291015625,
-0.167724609375,
0.33837890625,
0.8662109375,
-0.74951171875,
-0.220703125,
-0.380859375,
0.4091796875,
0.578125,
0.86279296875,
-0.2347412109375,
-0.7685546875,
0.181640625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Memory is performing a walk on the two-dimensional plane, starting at the origin. He is given a string s with his directions for motion:
* An 'L' indicates he should move one unit left.
* An 'R' indicates he should move one unit right.
* A 'U' indicates he should move one unit up.
* A 'D' indicates he should move one unit down.
But now Memory wants to end at the origin. To do this, he has a special trident. This trident can replace any character in s with any of 'L', 'R', 'U', or 'D'. However, because he doesn't want to wear out the trident, he wants to make the minimum number of edits possible. Please tell Memory what is the minimum number of changes he needs to make to produce a string that, when walked, will end at the origin, or if there is no such string.
Input
The first and only line contains the string s (1 β€ |s| β€ 100 000) β the instructions Memory is given.
Output
If there is a string satisfying the conditions, output a single integer β the minimum number of edits required. In case it's not possible to change the sequence in such a way that it will bring Memory to to the origin, output -1.
Examples
Input
RRU
Output
-1
Input
UDUR
Output
1
Input
RUUR
Output
2
Note
In the first sample test, Memory is told to walk right, then right, then up. It is easy to see that it is impossible to edit these instructions to form a valid walk.
In the second sample test, Memory is told to walk up, then down, then up, then right. One possible solution is to change s to "LDUR". This string uses 1 edit, which is the minimum possible. It also ends at the origin.
Tags: implementation, strings
Correct Solution:
```
s = input()
if len(s)%2 != 0:
print('-1')
exit()
L = 0
R = 0
U = 0
D = 0
for a in s:
if a == 'L':
L+=1
elif a == 'R':
R+=1
elif a == 'D':
D+=1
else:
U+=1
rem_L_R = abs(L-R)
rem_U_D = abs(U-D)
print(int(rem_U_D/2 + rem_L_R/2))
```
| 35,619
|
[
0.171142578125,
-0.08905029296875,
-0.10626220703125,
0.209716796875,
-0.442138671875,
-0.453125,
0.076904296875,
-0.0816650390625,
0.257080078125,
0.85693359375,
0.857421875,
-0.067138671875,
0.054168701171875,
-0.4931640625,
-0.642578125,
0.10906982421875,
-0.76611328125,
-0.658203125,
-0.47265625,
-0.08935546875,
0.2408447265625,
-0.41796875,
-1.2763671875,
-0.1676025390625,
-0.1322021484375,
0.79150390625,
0.302978515625,
0.475830078125,
1.2626953125,
1.193359375,
0.09710693359375,
-0.2420654296875,
0.465087890625,
-0.947265625,
-0.443359375,
-0.465576171875,
0.65625,
-0.7138671875,
-0.19775390625,
-0.26123046875,
0.2958984375,
-0.353271484375,
0.68310546875,
-0.5068359375,
-1.322265625,
-0.2236328125,
-0.5595703125,
-0.70166015625,
-0.299560546875,
-0.4853515625,
0.287109375,
-0.1837158203125,
0.5400390625,
-0.07012939453125,
0.119873046875,
-0.0027256011962890625,
0.0606689453125,
0.28125,
-0.6923828125,
0.08868408203125,
0.2398681640625,
0.2340087890625,
0.06195068359375,
-0.69775390625,
0.0599365234375,
0.34423828125,
0.002197265625,
-0.0199127197265625,
-0.13134765625,
-0.6240234375,
-0.412353515625,
0.08355712890625,
-0.364501953125,
-0.7373046875,
-0.181396484375,
0.56689453125,
0.363037109375,
-0.03985595703125,
-0.56689453125,
0.57861328125,
0.04254150390625,
0.9169921875,
0.26220703125,
0.24365234375,
-0.493896484375,
-0.61962890625,
0.04327392578125,
0.2646484375,
0.291748046875,
-0.09661865234375,
-0.324462890625,
0.489990234375,
-0.455322265625,
-0.1090087890625,
0.302001953125,
0.869140625,
-0.2288818359375,
0.537109375,
0.7333984375,
-0.12469482421875,
0.52783203125,
1.07421875,
-0.689453125,
0.8447265625,
-0.428955078125,
0.050079345703125,
0.332763671875,
0.04925537109375,
-0.475830078125,
-0.357177734375,
-0.1009521484375,
-0.1629638671875,
0.6044921875,
0.56689453125,
-0.284423828125,
0.8505859375,
0.060638427734375,
0.64013671875,
-0.5791015625,
0.5078125,
0.6611328125,
-0.0684814453125,
0.30419921875,
-0.26171875,
-0.08746337890625,
-0.42724609375,
-0.1796875,
0.92822265625,
-0.405029296875,
-0.031097412109375,
0.346923828125,
0.019378662109375,
-0.0875244140625,
0.389892578125,
-0.28759765625,
0.6513671875,
-0.407958984375,
0.50927734375,
1.0732421875,
-0.61962890625,
0.64306640625,
-0.1439208984375,
-0.02667236328125,
1.384765625,
0.8955078125,
0.23828125,
0.3876953125,
0.303466796875,
-0.8369140625,
0.1563720703125,
-0.904296875,
0.65771484375,
0.382568359375,
0.0953369140625,
0.1800537109375,
0.047271728515625,
-0.30859375,
0.697265625,
0.00859832763671875,
0.409423828125,
-0.2451171875,
0.190673828125,
-0.27734375,
1.0849609375,
-0.238037109375,
0.7861328125,
-0.27197265625,
-0.209228515625,
-0.546875,
-0.62353515625,
0.28125,
0.037078857421875,
-0.30224609375,
0.405517578125,
0.1463623046875,
1.2744140625,
1.2119140625,
0.373291015625,
0.103271484375,
0.2222900390625,
-0.5205078125,
0.1380615234375,
0.5,
0.7978515625,
-0.287841796875,
0.133544921875,
0.15380859375,
-0.145263671875,
-0.72412109375,
-0.1317138671875,
0.037139892578125,
0.80322265625,
-0.374755859375,
0.324951171875,
0.31787109375,
0.36328125,
-1.044921875,
-0.223388671875,
-0.50634765625,
-1.0146484375,
-0.442138671875,
0.50244140625,
-0.1566162109375,
0.5107421875,
-0.2666015625,
-0.62890625,
0.4599609375,
1.00390625,
-0.103515625,
0.1668701171875,
0.387451171875,
-0.0012111663818359375,
-0.034912109375,
0.315185546875,
0.1015625,
-0.32763671875,
-0.475830078125,
0.4482421875,
-0.10015869140625,
0.031402587890625,
0.153076171875,
0.44775390625,
0.5048828125,
0.472412109375,
-0.10992431640625,
-0.057098388671875,
0.72314453125,
0.970703125,
-0.169921875,
0.52978515625,
0.095947265625,
0.95458984375,
0.2470703125,
0.5712890625,
0.5908203125,
0.4404296875,
0.57470703125,
0.8798828125,
-0.34375,
0.1107177734375,
0.3603515625,
0.60498046875,
0.77685546875,
0.390625,
0.17138671875,
0.438720703125,
-0.06976318359375,
-0.44091796875,
-0.2281494140625,
0.0826416015625,
-0.32421875,
0.455322265625,
-0.02996826171875,
0.16455078125,
-0.27880859375,
-0.483642578125,
0.11407470703125,
0.73291015625,
-0.88818359375,
-0.8974609375,
0.27001953125,
0.257080078125,
0.4599609375,
-0.10894775390625,
0.393310546875,
0.65576171875,
0.328125,
0.293701171875,
-0.1357421875,
-0.450439453125,
-0.79833984375,
-0.78369140625,
-0.8935546875,
-0.423095703125,
-0.62060546875,
0.0003552436828613281,
0.6748046875,
-0.91845703125,
0.36962890625,
-0.50634765625,
0.0467529296875,
-0.049774169921875,
-0.30322265625,
0.8642578125,
-0.365478515625,
0.5048828125,
-0.62060546875,
0.65576171875,
0.024658203125,
0.849609375,
-0.51611328125,
-0.3798828125,
-0.46142578125,
-0.8720703125,
0.05133056640625,
-0.11651611328125,
0.8369140625,
-0.0174407958984375,
-0.83154296875,
-0.755859375,
-0.34375,
-0.10302734375,
-0.537109375,
0.28759765625,
-0.5595703125,
1.224609375,
0.677734375,
-0.74853515625,
0.68701171875,
0.8359375,
-0.8291015625,
0.5107421875,
0.301025390625,
0.259765625,
-0.74609375,
1.509765625,
0.43603515625,
0.41943359375,
-0.60400390625,
-0.75341796875,
-0.53466796875,
0.313720703125,
0.340576171875,
-0.328125,
-0.388427734375,
0.57861328125,
0.09381103515625,
-0.9140625,
0.71484375,
-0.92333984375,
-0.46484375,
-0.26416015625,
-0.226318359375,
1.1953125,
0.8720703125,
0.156005859375,
-0.00695037841796875,
-0.184814453125,
-0.473388671875,
0.71923828125,
0.459716796875,
-0.36181640625,
-0.0235595703125,
0.415283203125,
-0.1312255859375,
0.148681640625,
0.1934814453125,
-0.4951171875,
-0.04681396484375,
-0.1165771484375,
0.330322265625,
0.869140625,
0.360107421875,
0.44140625,
0.587890625,
0.58154296875,
-0.65576171875,
-0.49658203125,
-0.09429931640625,
0.82568359375,
0.442138671875,
0.4521484375,
-0.015625,
-0.301513671875,
-0.50732421875,
-0.9189453125,
0.33203125,
0.18994140625,
0.615234375,
-0.8076171875,
0.91650390625,
0.1539306640625,
-0.560546875,
0.241455078125,
-0.77978515625,
0.10028076171875,
1.13671875,
-0.10260009765625,
0.7333984375,
-0.56591796875,
0.310546875,
-0.07965087890625,
-0.0980224609375,
0.405029296875,
0.316650390625,
0.255615234375,
-0.5908203125,
-0.435791015625,
-0.62890625,
0.117431640625,
-0.286865234375,
-0.77880859375,
0.1239013671875,
-0.43017578125,
-0.281494140625,
-0.90087890625,
0.7265625,
0.91650390625,
0.4951171875,
-0.1220703125,
0.57763671875,
-0.0362548828125,
0.2001953125,
0.48876953125,
-0.2734375,
0.35546875,
-0.8896484375,
0.63232421875,
-0.0836181640625,
-0.37158203125,
-0.42529296875,
-0.44970703125,
-0.6845703125,
0.2447509765625,
0.10052490234375,
-0.257568359375,
-0.80908203125,
0.071044921875,
0.2958984375,
0.2210693359375,
-0.3251953125,
-0.050079345703125,
-0.150390625,
0.55908203125,
0.6376953125,
-0.98193359375,
-0.0738525390625,
-1.09375,
0.7685546875,
0.25341796875,
-0.4462890625,
-0.25439453125,
-0.611328125,
-0.86376953125,
-0.763671875,
-0.14697265625,
0.5,
0.1419677734375,
0.019744873046875,
-1.068359375,
0.44091796875,
0.230224609375,
-0.08746337890625,
0.1610107421875,
-0.177978515625,
0.279541015625,
-0.200439453125,
0.61962890625,
-0.4296875,
-0.3857421875,
0.267333984375,
-1.07421875,
0.5224609375,
-0.30517578125,
0.406005859375,
0.165283203125,
-0.4453125,
0.2086181640625,
0.517578125,
-0.7353515625,
0.40185546875,
-0.61865234375,
0.2291259765625,
-0.94775390625,
-0.239013671875,
0.6005859375,
-0.337158203125,
-0.290283203125,
1.2373046875,
0.11627197265625,
-0.340576171875,
0.10540771484375,
0.76806640625,
-0.216552734375,
0.09521484375,
-0.5810546875,
0.7890625,
-0.62939453125,
-0.619140625,
-0.4921875,
-0.71435546875,
0.9521484375,
-0.027252197265625,
-0.4541015625,
-0.2158203125,
-1.19921875,
-0.28125,
0.2958984375,
-0.5234375,
0.0207672119140625,
0.319580078125,
-0.1998291015625,
0.1654052734375,
-0.260498046875,
-0.37451171875,
-0.47900390625,
-0.78125,
0.04736328125,
0.23486328125,
0.5224609375,
0.322998046875,
-0.10955810546875,
-0.469482421875,
0.275146484375,
-0.19775390625,
-0.299560546875,
-0.38330078125,
-0.46923828125,
-0.210693359375,
-0.253662109375,
-0.02911376953125,
-0.07537841796875,
-0.0802001953125,
0.7236328125,
0.97509765625,
0.033447265625,
0.1326904296875,
0.428466796875,
-0.51611328125,
1.1533203125,
0.15576171875,
-0.94287109375,
0.0014791488647460938,
0.340087890625,
0.175048828125,
0.322998046875,
-0.021636962890625,
-0.70703125,
-0.76708984375,
-1.087890625,
0.2861328125,
-0.63134765625,
0.08477783203125,
-0.9638671875,
-0.810546875,
-0.15966796875,
0.35400390625,
-0.10540771484375,
-0.85693359375,
0.401611328125,
-0.92578125,
0.282470703125,
-1.0859375,
-0.09356689453125,
-0.6572265625,
-0.50732421875,
-0.186767578125,
1.2119140625,
-0.05487060546875,
0.5859375,
0.319580078125,
0.051422119140625,
0.11865234375,
-0.217041015625,
-0.6181640625,
-0.44189453125,
-0.09564208984375,
0.3427734375,
-0.360595703125,
-0.306396484375,
-0.31103515625,
0.5986328125,
-0.8349609375,
0.396240234375,
-0.387451171875,
-0.2479248046875,
-0.276611328125,
-0.7099609375,
1.3876953125,
-0.41796875,
0.366943359375,
0.09918212890625,
0.66748046875,
0.68359375,
-0.28125,
-0.0133209228515625,
-0.78955078125,
-0.732421875,
-1.0498046875,
0.7431640625,
-0.556640625,
0.035980224609375,
-0.716796875,
-0.452880859375,
1.0107421875,
-0.7265625,
0.397216796875,
1.2626953125,
0.045867919921875,
0.666015625,
-0.8916015625,
0.403564453125,
0.43310546875,
-0.6474609375,
-0.08135986328125,
0.1929931640625,
-0.8740234375,
0.07879638671875,
-0.55810546875,
-1.20703125,
-0.8349609375,
0.2342529296875,
1.1650390625,
0.08465576171875,
0.705078125,
-0.449951171875,
-0.9091796875,
-0.46923828125,
1.291015625,
0.1866455078125,
-0.09429931640625,
0.7490234375,
-0.1351318359375,
0.057861328125,
-0.17626953125,
-0.06646728515625,
-0.56103515625,
-0.412353515625,
1.1376953125,
-0.31103515625,
-0.8203125,
0.9775390625,
0.78369140625,
-0.935546875,
-1.0498046875,
-0.21337890625,
-0.06793212890625,
-0.0650634765625,
-0.98974609375,
0.1790771484375,
0.482666015625,
-0.57861328125,
0.232177734375,
0.300537109375,
0.07342529296875,
0.529296875,
0.0628662109375,
-0.0181121826171875,
-0.348876953125,
0.1260986328125,
0.427001953125,
-0.4794921875,
-0.3017578125,
-0.95654296875,
-0.4404296875,
-0.316162109375,
0.1490478515625,
0.6728515625,
-0.31298828125,
0.0004165172576904297,
0.454833984375,
-0.006267547607421875,
0.481201171875,
-0.0777587890625,
-0.3330078125,
0.468994140625,
-0.66845703125,
-0.34326171875,
-0.0198211669921875,
0.7919921875,
-0.05255126953125,
0.4990234375,
-0.470458984375,
0.1279296875,
0.41162109375,
0.57958984375,
-0.57763671875,
-1.228515625,
-0.277587890625,
-1.3447265625,
-0.60693359375,
-0.322509765625,
-0.97900390625,
0.027557373046875,
0.2822265625,
-0.10919189453125,
-0.541015625,
-0.18408203125,
0.60302734375,
-0.33154296875,
0.314208984375,
-0.36962890625,
0.423828125,
-0.61962890625,
-0.226318359375,
-0.99951171875,
-0.2384033203125,
-0.43408203125,
-0.2420654296875,
-0.634765625,
0.2213134765625,
-0.3408203125,
0.2008056640625,
-0.11083984375,
0.404541015625,
0.025115966796875,
-0.274658203125,
0.1357421875,
0.323974609375,
0.03167724609375,
0.732421875,
0.8505859375,
0.06494140625,
0.51953125,
-0.331298828125,
-0.280517578125,
-0.615234375,
0.88525390625,
0.45361328125,
-0.382568359375,
-0.297607421875,
-0.1982421875,
0.11077880859375,
-1.1025390625,
0.471923828125,
-0.12457275390625,
0.53662109375,
0.1568603515625,
-0.0247802734375,
0.7138671875,
1.142578125,
0.11627197265625,
0.1549072265625,
0.155029296875,
-0.0703125,
0.66650390625,
0.365234375,
0.0235748291015625,
0.736328125,
-0.34912109375,
-0.509765625,
0.1207275390625,
0.2022705078125,
-0.12127685546875,
0.33203125,
-0.7158203125,
-0.35693359375,
-0.55712890625,
-0.0916748046875,
-0.3505859375,
0.376708984375,
0.34912109375,
-0.51123046875,
0.0243072509765625,
-0.296630859375,
-0.59228515625,
-0.00875091552734375,
-1.0537109375,
-0.97607421875,
0.2183837890625,
-0.280517578125,
-0.400634765625,
-0.48046875,
-0.16162109375,
-0.368896484375,
-0.1824951171875,
0.3603515625,
-0.25830078125,
0.431884765625,
-0.412109375,
1.0048828125,
-0.49853515625,
0.07769775390625,
0.468017578125,
0.56982421875,
-0.73974609375,
-0.6318359375,
-0.003009796142578125,
0.99560546875,
0.263916015625,
-0.285888671875,
-0.69580078125,
-0.154541015625,
0.01458740234375,
-0.00032830238342285156,
-0.58837890625,
0.421630859375,
0.01000213623046875,
0.55908203125,
-0.5595703125,
-0.52197265625,
-0.07562255859375,
0.462646484375,
-0.0203094482421875,
-0.326416015625,
-0.276123046875,
0.87158203125,
0.51904296875,
-0.0234222412109375,
0.509765625,
-0.019500732421875,
0.65673828125,
-0.4580078125,
0.0635986328125,
-0.158935546875,
1.1162109375,
0.69873046875,
0.211669921875,
-0.1353759765625,
0.673828125,
0.487060546875,
-0.286376953125,
-0.065185546875,
0.69482421875,
0.21435546875,
-0.2386474609375,
0.0280303955078125,
-0.2288818359375,
-0.1455078125,
-0.10711669921875,
-0.5849609375,
0.152587890625,
-0.325927734375,
-0.045745849609375,
-0.5830078125,
-0.5693359375,
1.0595703125,
-0.296630859375,
-0.337890625,
0.441650390625,
-0.42431640625,
0.12384033203125,
0.9130859375,
-0.0826416015625,
-0.1405029296875,
0.43896484375,
0.5966796875,
0.60009765625,
0.48046875,
0.446533203125,
0.447021484375,
-0.26416015625,
0.06207275390625,
0.2264404296875,
-0.11883544921875,
-0.40380859375,
-0.7646484375,
-0.79150390625,
0.525390625,
-0.55517578125,
-0.149169921875,
0.387451171875,
-0.59814453125,
-0.110595703125,
-0.1395263671875,
0.75732421875,
-0.82080078125,
0.060821533203125,
0.0010461807250976562,
-0.270751953125,
-0.86279296875,
1.2509765625,
-0.10888671875,
0.50927734375,
0.0088348388671875,
1.3056640625,
-0.1485595703125,
1.1259765625,
0.419189453125,
-0.2041015625,
0.279296875,
0.32568359375,
-0.457275390625,
-0.5576171875,
-0.1832275390625,
-0.25927734375,
-0.196533203125,
-0.916015625,
-0.168701171875,
0.0880126953125,
0.837890625,
-0.0308685302734375,
-0.6748046875,
0.006786346435546875,
0.039520263671875,
-0.7900390625,
0.51904296875,
-0.05487060546875,
0.2015380859375,
0.0193634033203125,
-0.03289794921875,
0.054046630859375,
-0.440185546875,
0.1993408203125,
-0.44921875,
0.309814453125,
-0.572265625,
0.0075531005859375,
-0.395751953125,
-0.56201171875,
-0.417236328125,
0.077392578125,
-0.348388671875,
-0.60888671875,
0.10931396484375,
0.327880859375,
0.457275390625,
0.2100830078125,
-0.4453125,
0.28125,
0.95361328125,
1.0439453125,
0.07257080078125,
0.48681640625,
0.1297607421875,
0.2020263671875,
0.00804901123046875,
-0.29150390625,
0.445068359375,
-0.33349609375,
-0.00592803955078125,
-0.01235198974609375,
0.133056640625,
-0.76123046875,
-1.2060546875,
0.1861572265625,
0.189697265625,
0.46240234375,
-0.50146484375,
-0.8369140625,
-0.305908203125,
-0.91748046875,
-0.0740966796875,
-0.72900390625,
0.6650390625,
0.0518798828125,
-0.1463623046875,
-0.0750732421875,
-0.73095703125,
4.4453125,
1.330078125,
0.83349609375,
0.38720703125,
-0.059600830078125,
1.236328125,
0.52978515625,
-0.51806640625,
-0.45654296875,
-0.6650390625,
0.75,
-0.0189666748046875,
0.055633544921875,
0.58154296875,
0.47021484375,
0.33544921875,
-0.6279296875,
0.32861328125,
-0.22021484375,
-0.95458984375,
-0.6328125,
0.45654296875,
-0.353759765625,
0.38818359375,
-0.19287109375,
0.39208984375,
0.477294921875,
-1.0771484375,
-0.4296875,
-0.755859375,
0.191162109375,
-0.623046875,
0.8681640625,
0.150634765625,
-0.292236328125,
0.37451171875,
-0.11468505859375,
-0.65869140625,
-0.31982421875,
-0.0271453857421875,
-0.0435791015625,
-0.2236328125,
0.0863037109375,
-0.5732421875,
-0.0088958740234375,
0.454345703125,
-0.29541015625,
0.457275390625,
0.094970703125,
-1.0283203125,
1.1416015625,
-0.2476806640625,
0.5791015625,
-0.5205078125,
-0.99169921875,
0.07861328125,
0.34765625,
0.03656005859375,
-0.4833984375,
0.357666015625,
0.469970703125,
0.185791015625,
-0.2117919921875,
0.32177734375,
-0.6259765625,
0.95361328125,
-0.315185546875,
0.177001953125,
-0.58251953125,
-0.17822265625,
-0.32666015625,
-0.64794921875,
-0.418212890625,
-0.105712890625,
0.7060546875,
0.156982421875,
-0.336669921875,
0.39990234375,
0.321044921875,
-0.77197265625,
0.1805419921875,
-0.35302734375,
-0.301025390625,
-0.1556396484375,
0.343994140625,
0.87158203125,
-0.755859375,
-0.22900390625,
-0.332763671875,
0.41015625,
0.60302734375,
0.82666015625,
-0.259765625,
-0.80517578125,
0.19873046875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Tags: implementation
Correct Solution:
```
import sys
def main():
input = sys.stdin.readline().strip()
prev = -1
maxStep = 0
for i,ch in enumerate(input):
if (ch == 'A' or ch == 'E' or
ch =='I' or ch == 'O' or ch =='U' or ch=='Y'):
maxStep = max(abs(i-prev),maxStep)
prev = i
maxStep = max(len(input) - prev,maxStep)
print(maxStep)
if __name__ == ("__main__"):
main()
```
| 35,628
|
[
0.1683349609375,
-0.08966064453125,
-0.2548828125,
0.66357421875,
-0.444580078125,
-0.256591796875,
0.471435546875,
0.0229034423828125,
0.185302734375,
0.76611328125,
0.4912109375,
0.02655029296875,
0.1534423828125,
-0.7197265625,
-0.66796875,
0.25,
-0.93603515625,
-0.433349609375,
-0.65478515625,
-0.1641845703125,
0.1531982421875,
-0.419677734375,
-1.111328125,
0.0170745849609375,
-0.047515869140625,
0.58251953125,
0.4599609375,
-0.0487060546875,
1.08203125,
1.0625,
0.296875,
-0.2783203125,
-0.00823974609375,
-1.099609375,
-0.409423828125,
-0.31201171875,
0.26953125,
-0.69482421875,
-0.4833984375,
-0.30712890625,
0.354736328125,
-0.06732177734375,
0.77978515625,
-0.7509765625,
-1.1884765625,
-0.1290283203125,
-0.314697265625,
-0.32470703125,
-0.310546875,
-0.5947265625,
0.444580078125,
-0.2388916015625,
0.5234375,
-0.1580810546875,
-0.2437744140625,
-0.283447265625,
0.266357421875,
-0.178466796875,
-0.97705078125,
0.093994140625,
-0.0287628173828125,
0.470703125,
0.225830078125,
-0.5966796875,
-0.1505126953125,
0.5068359375,
-0.11895751953125,
-0.1256103515625,
-0.163818359375,
-0.61669921875,
-0.2958984375,
0.468017578125,
-0.418701171875,
-0.464599609375,
-0.5458984375,
0.050445556640625,
0.024932861328125,
0.039031982421875,
-0.6171875,
0.83740234375,
0.2027587890625,
0.880859375,
-0.287109375,
0.085205078125,
-0.420654296875,
-0.47265625,
-0.09100341796875,
0.1796875,
0.15625,
-0.11431884765625,
-0.302978515625,
0.5625,
-0.37646484375,
0.12286376953125,
0.501953125,
0.56201171875,
-0.403564453125,
0.4990234375,
0.454833984375,
0.06524658203125,
0.669921875,
1.146484375,
-0.48486328125,
0.76513671875,
-0.4521484375,
0.283203125,
0.283447265625,
-0.146240234375,
-0.08526611328125,
-0.50634765625,
-0.2344970703125,
0.0296173095703125,
0.29052734375,
0.2340087890625,
-0.61572265625,
0.7607421875,
0.1207275390625,
0.36181640625,
-0.78857421875,
0.81591796875,
0.2349853515625,
0.0711669921875,
0.541015625,
0.0052337646484375,
0.2020263671875,
-0.67578125,
-0.5390625,
1.044921875,
-0.431640625,
0.341552734375,
0.144287109375,
-0.235107421875,
-0.42626953125,
0.444091796875,
-0.5166015625,
0.6455078125,
-0.388427734375,
0.71240234375,
0.51025390625,
-0.966796875,
0.46630859375,
-0.235107421875,
0.1483154296875,
1.3818359375,
0.603515625,
-0.1241455078125,
0.468505859375,
0.370361328125,
-0.6689453125,
0.308837890625,
-0.9150390625,
0.8017578125,
0.1279296875,
0.2103271484375,
-0.1475830078125,
0.2205810546875,
-0.259033203125,
0.3818359375,
0.19384765625,
0.1663818359375,
-0.37646484375,
0.04693603515625,
-0.45458984375,
0.86181640625,
-0.41552734375,
0.6025390625,
-0.4033203125,
-0.0914306640625,
-0.379638671875,
-0.283447265625,
0.1475830078125,
0.172607421875,
0.08184814453125,
0.837890625,
0.13671875,
1.255859375,
0.990234375,
0.17822265625,
0.354736328125,
0.46923828125,
-0.306396484375,
0.134033203125,
0.061248779296875,
0.921875,
-0.02667236328125,
0.269287109375,
0.16015625,
-0.10589599609375,
-0.50439453125,
-0.133056640625,
-0.133056640625,
0.44482421875,
-0.63818359375,
-0.0968017578125,
0.05120849609375,
0.0299072265625,
-0.859375,
-0.060394287109375,
-0.24658203125,
-0.99072265625,
-0.310546875,
0.69140625,
0.348388671875,
0.361083984375,
-0.25927734375,
-0.755859375,
0.40625,
1.400390625,
-0.420166015625,
0.26123046875,
0.2210693359375,
-0.2802734375,
0.0274505615234375,
0.158935546875,
0.341552734375,
-0.259521484375,
-0.60888671875,
0.77099609375,
-0.265869140625,
0.371337890625,
0.218505859375,
0.69091796875,
0.32080078125,
0.6318359375,
-0.33740234375,
-0.56689453125,
0.2310791015625,
1.1396484375,
-0.032562255859375,
0.57080078125,
-0.04052734375,
0.7763671875,
0.39453125,
0.828125,
0.515625,
-0.194091796875,
0.293701171875,
0.94775390625,
0.259765625,
0.221923828125,
0.18115234375,
0.411865234375,
0.6220703125,
0.234130859375,
0.06341552734375,
0.375732421875,
0.042938232421875,
-0.0192718505859375,
-0.472900390625,
0.2003173828125,
-0.59375,
1.0595703125,
0.04547119140625,
0.185302734375,
-0.415771484375,
-0.1444091796875,
0.10882568359375,
0.49072265625,
-0.671875,
-0.755859375,
0.07342529296875,
0.049041748046875,
0.296630859375,
0.1837158203125,
0.494873046875,
0.7841796875,
0.06427001953125,
0.58935546875,
-0.30322265625,
-0.317138671875,
-0.7294921875,
-0.7705078125,
-0.96337890625,
-0.44970703125,
-0.69580078125,
-0.289306640625,
0.455078125,
-0.92333984375,
0.69287109375,
-0.39599609375,
0.0892333984375,
-0.315185546875,
-0.412353515625,
0.65869140625,
-0.1104736328125,
0.65380859375,
-0.50927734375,
0.287841796875,
0.0556640625,
0.966796875,
-0.3408203125,
-0.265380859375,
-0.411865234375,
-0.5703125,
0.284423828125,
0.05291748046875,
0.61279296875,
0.290771484375,
-0.58251953125,
-0.72412109375,
-0.63037109375,
-0.3330078125,
-0.4794921875,
0.347412109375,
-0.400390625,
0.8056640625,
0.578125,
-0.75048828125,
0.5478515625,
1.0673828125,
-1.1337890625,
0.64990234375,
0.482177734375,
-0.133544921875,
-0.5478515625,
1.0947265625,
0.206298828125,
0.52490234375,
-0.541015625,
-0.69189453125,
-0.30712890625,
0.308837890625,
-0.1072998046875,
-0.69384765625,
-0.49658203125,
0.70947265625,
-0.2203369140625,
-0.92431640625,
0.388916015625,
-1.0498046875,
-0.316650390625,
-0.486572265625,
-0.09246826171875,
0.95654296875,
0.99462890625,
0.429931640625,
-0.287109375,
-0.42724609375,
-0.0908203125,
0.712890625,
0.6171875,
-0.1988525390625,
0.06011962890625,
0.89453125,
0.1361083984375,
0.251708984375,
0.14697265625,
-0.36767578125,
0.0194854736328125,
-0.1826171875,
0.1318359375,
0.469482421875,
0.381103515625,
-0.01410675048828125,
0.434326171875,
0.55078125,
-0.86474609375,
-0.462646484375,
-0.380615234375,
0.74560546875,
-0.046783447265625,
0.439208984375,
0.33349609375,
-0.06646728515625,
-0.60498046875,
-0.94580078125,
0.405517578125,
0.370849609375,
0.6435546875,
-1.1171875,
0.884765625,
0.334716796875,
-0.365966796875,
0.043609619140625,
-0.489990234375,
-0.1395263671875,
1.193359375,
0.118896484375,
0.69580078125,
-0.767578125,
0.482421875,
0.18359375,
0.239501953125,
1.0234375,
0.267333984375,
0.181884765625,
-0.200927734375,
-0.50927734375,
-0.376953125,
0.1234130859375,
-0.28515625,
-0.28369140625,
0.408447265625,
0.06365966796875,
-0.29248046875,
-0.66064453125,
0.4501953125,
0.75439453125,
0.418701171875,
-0.296630859375,
0.53564453125,
0.19677734375,
0.421142578125,
0.48388671875,
-0.0699462890625,
0.34814453125,
-0.74365234375,
0.720703125,
-0.03546142578125,
-0.209716796875,
-0.40380859375,
-0.20849609375,
0.1251220703125,
0.1346435546875,
0.431640625,
0.061920166015625,
-0.79248046875,
0.030975341796875,
0.196533203125,
0.5673828125,
-0.43798828125,
-0.3818359375,
-0.449951171875,
0.473876953125,
0.172119140625,
-0.79931640625,
0.3935546875,
-0.90478515625,
0.5859375,
0.1326904296875,
-0.0679931640625,
-0.2188720703125,
-0.55322265625,
-0.88134765625,
-0.72216796875,
-0.07855224609375,
1.1767578125,
0.07122802734375,
-0.1702880859375,
-1.115234375,
0.159423828125,
0.28662109375,
-0.1746826171875,
-0.262451171875,
-0.409423828125,
0.2205810546875,
-0.058197021484375,
0.39599609375,
-0.80615234375,
-0.92724609375,
0.01702880859375,
-1.3427734375,
0.751953125,
-0.5322265625,
0.76220703125,
-0.4248046875,
-0.296630859375,
0.0107879638671875,
-0.1441650390625,
-0.395263671875,
-0.02752685546875,
-0.36083984375,
0.49560546875,
-0.865234375,
-0.60009765625,
0.4482421875,
-0.430908203125,
-0.36376953125,
1.0068359375,
-0.0298919677734375,
-0.375,
-0.01042938232421875,
0.443603515625,
-0.55029296875,
0.36083984375,
-0.5009765625,
0.70556640625,
-0.3115234375,
-0.7919921875,
-0.355712890625,
-0.75390625,
0.75,
-0.0408935546875,
-0.89111328125,
-0.1470947265625,
-1.1767578125,
-0.192626953125,
0.007457733154296875,
-0.419189453125,
0.241943359375,
0.364013671875,
-0.3125,
0.23291015625,
-0.428466796875,
-0.266845703125,
-0.364013671875,
-0.650390625,
-0.56689453125,
0.179931640625,
0.094970703125,
0.91796875,
-0.1920166015625,
-0.10302734375,
0.1505126953125,
-0.1353759765625,
0.005992889404296875,
-0.35009765625,
-0.439208984375,
-0.0765380859375,
-0.269775390625,
-0.38427734375,
0.31103515625,
-0.031280517578125,
0.57080078125,
0.89013671875,
0.007266998291015625,
0.382568359375,
0.60986328125,
-0.537109375,
0.75341796875,
-0.25830078125,
-0.6376953125,
-0.315185546875,
0.779296875,
0.132080078125,
0.69384765625,
0.286865234375,
-1.1083984375,
-0.71484375,
-0.66845703125,
-0.1734619140625,
-0.66259765625,
0.0027923583984375,
-1.0595703125,
-0.29638671875,
-0.607421875,
0.3701171875,
0.051177978515625,
-0.6650390625,
-0.0894775390625,
-0.7451171875,
0.244140625,
-0.85986328125,
-0.1422119140625,
-0.763671875,
-0.390869140625,
0.2451171875,
0.71142578125,
0.13232421875,
0.7060546875,
0.2291259765625,
0.0606689453125,
0.231201171875,
-0.117919921875,
-0.4853515625,
-0.50927734375,
-0.4306640625,
0.35205078125,
-0.28955078125,
0.0277862548828125,
-0.48974609375,
0.7099609375,
-0.83837890625,
0.2169189453125,
-0.50537109375,
-0.1346435546875,
0.182373046875,
0.042083740234375,
1.1640625,
0.046905517578125,
0.10528564453125,
-0.044708251953125,
0.5615234375,
0.481689453125,
-0.296875,
-0.517578125,
-0.200927734375,
-0.578125,
-0.8466796875,
0.87158203125,
-0.4990234375,
0.0714111328125,
-0.391845703125,
-0.3837890625,
1.0625,
-0.50634765625,
0.405029296875,
1.2705078125,
0.0272064208984375,
0.67431640625,
-0.34619140625,
0.61328125,
0.454833984375,
-0.3818359375,
-0.1585693359375,
0.1092529296875,
-0.66796875,
0.0850830078125,
-0.6025390625,
-0.97314453125,
-0.74169921875,
0.295166015625,
1.2802734375,
-0.06292724609375,
0.81396484375,
0.1226806640625,
-1.0693359375,
-0.73046875,
1.2080078125,
0.474853515625,
0.17724609375,
1.171875,
-0.2265625,
0.13623046875,
-0.2117919921875,
-0.1871337890625,
-0.415283203125,
-0.505859375,
1.05078125,
-0.92919921875,
-0.61376953125,
0.65380859375,
0.8603515625,
-1.1455078125,
-1.1005859375,
-0.6015625,
-0.275390625,
0.277587890625,
-0.5830078125,
0.06494140625,
0.328857421875,
-0.306396484375,
0.050628662109375,
0.343017578125,
0.11016845703125,
0.441650390625,
0.0931396484375,
-0.057281494140625,
-0.4111328125,
0.431640625,
0.490966796875,
-0.845703125,
-0.01125335693359375,
-0.9755859375,
0.172607421875,
-0.156982421875,
-0.0245819091796875,
0.92822265625,
-0.1842041015625,
0.372314453125,
0.14599609375,
-0.2646484375,
0.32568359375,
-0.62353515625,
-0.328369140625,
0.62841796875,
-0.347900390625,
-0.4228515625,
-0.2474365234375,
0.61767578125,
-0.137451171875,
0.101318359375,
-0.4033203125,
-0.0009303092956542969,
0.1903076171875,
0.395263671875,
-0.486328125,
-1.0009765625,
-0.180419921875,
-1.3515625,
-0.5478515625,
-0.47900390625,
-0.283203125,
0.15087890625,
0.400146484375,
-0.29736328125,
-0.64013671875,
0.11334228515625,
0.4296875,
-0.37744140625,
0.73828125,
-0.822265625,
0.355712890625,
-0.390625,
-0.21142578125,
-0.8359375,
-0.02130126953125,
-0.3037109375,
-0.1575927734375,
-0.52587890625,
0.183837890625,
-0.194091796875,
0.398681640625,
-0.0007190704345703125,
0.1253662109375,
-0.376953125,
-0.66357421875,
-0.06890869140625,
0.09832763671875,
-0.11053466796875,
0.90283203125,
0.81005859375,
-0.434814453125,
0.2413330078125,
-0.03961181640625,
-0.297119140625,
-0.61279296875,
0.49365234375,
0.59326171875,
-0.422119140625,
-0.302734375,
0.1783447265625,
0.390380859375,
-1.025390625,
0.202392578125,
-0.478271484375,
0.449462890625,
0.0972900390625,
-0.270751953125,
0.775390625,
1.0791015625,
-0.2110595703125,
0.154541015625,
-0.11322021484375,
0.0221710205078125,
0.8701171875,
-0.02203369140625,
0.07073974609375,
0.413330078125,
-0.00556182861328125,
-0.453857421875,
0.08563232421875,
0.3681640625,
-0.15234375,
-0.0699462890625,
-0.039642333984375,
-0.489990234375,
-0.8388671875,
-0.126708984375,
-0.2646484375,
0.491943359375,
0.52880859375,
-0.342041015625,
0.3154296875,
-0.244873046875,
-0.36669921875,
0.5517578125,
-1.3486328125,
-0.857421875,
0.034637451171875,
0.10699462890625,
-0.405517578125,
-0.1531982421875,
-0.4658203125,
-0.1170654296875,
-0.331787109375,
0.337158203125,
-0.225341796875,
0.3408203125,
-0.332763671875,
0.61865234375,
-0.17724609375,
-0.33154296875,
-0.192138671875,
0.59814453125,
-0.24072265625,
-0.8310546875,
-0.060333251953125,
0.99169921875,
0.26318359375,
-0.08587646484375,
-0.030609130859375,
0.1602783203125,
-0.01322174072265625,
0.19287109375,
-0.59814453125,
0.3046875,
-0.322998046875,
0.51416015625,
-1.1435546875,
-0.388671875,
0.01271820068359375,
0.406494140625,
0.268310546875,
-0.5849609375,
-0.240478515625,
0.8154296875,
0.69580078125,
-0.048004150390625,
0.33154296875,
0.10064697265625,
0.43359375,
-0.1795654296875,
0.058380126953125,
-0.2327880859375,
0.63427734375,
0.873046875,
0.5673828125,
-0.10101318359375,
0.162109375,
0.73779296875,
-0.365234375,
-0.55029296875,
0.33056640625,
0.061126708984375,
-0.1639404296875,
0.53271484375,
-0.095458984375,
-0.07073974609375,
-0.34716796875,
-0.414306640625,
0.32177734375,
-0.2357177734375,
-0.04534912109375,
-0.11053466796875,
-0.5732421875,
1.2060546875,
-0.327880859375,
-0.1295166015625,
0.1915283203125,
-0.63720703125,
0.464111328125,
0.73974609375,
-0.28125,
-0.325927734375,
0.71875,
0.73193359375,
0.53076171875,
0.59814453125,
0.5068359375,
0.10943603515625,
-0.81396484375,
0.221923828125,
-0.1669921875,
0.31103515625,
-0.59814453125,
-0.338134765625,
-1.279296875,
0.39794921875,
-0.055908203125,
-0.318115234375,
0.73291015625,
-0.85546875,
0.0197296142578125,
0.045806884765625,
0.5009765625,
-0.806640625,
0.379638671875,
0.57861328125,
-0.263916015625,
-0.56201171875,
0.8564453125,
-0.042816162109375,
0.24267578125,
0.0810546875,
1.3203125,
-0.09051513671875,
1.365234375,
0.40283203125,
0.1597900390625,
0.343994140625,
0.472900390625,
-0.8134765625,
-0.91015625,
-0.3388671875,
-0.367919921875,
0.018096923828125,
-0.4580078125,
-0.2401123046875,
-0.1416015625,
0.8369140625,
0.01049041748046875,
-0.93310546875,
-0.335205078125,
0.004215240478515625,
-1.1103515625,
0.62548828125,
0.461181640625,
0.30712890625,
0.16015625,
-0.1158447265625,
0.01251220703125,
-0.4111328125,
0.07427978515625,
-0.5751953125,
0.5888671875,
-0.89306640625,
-0.43408203125,
-0.29150390625,
-0.6318359375,
-0.62255859375,
0.2158203125,
-0.7568359375,
-0.7099609375,
0.4833984375,
0.46435546875,
0.280029296875,
0.376708984375,
-0.228271484375,
-0.2265625,
0.9248046875,
0.853515625,
0.1966552734375,
0.71728515625,
0.310791015625,
-0.402099609375,
-0.168701171875,
-1.04296875,
0.44873046875,
-0.25537109375,
-0.10076904296875,
-0.52001953125,
0.330322265625,
-0.60888671875,
-1.47265625,
-0.1168212890625,
0.4462890625,
0.2076416015625,
-0.78564453125,
-1.0966796875,
-0.151123046875,
-1.3896484375,
-0.39208984375,
-0.67578125,
0.9560546875,
-0.01100921630859375,
0.01213836669921875,
-0.09759521484375,
-1.1953125,
4.44140625,
0.7646484375,
0.67919921875,
0.25927734375,
0.330078125,
1.2998046875,
0.5400390625,
-0.367919921875,
-0.67822265625,
-0.265869140625,
0.40234375,
-0.197265625,
0.055877685546875,
0.78369140625,
0.70751953125,
0.351806640625,
-0.63720703125,
-0.2325439453125,
-0.048675537109375,
-0.9326171875,
-0.59619140625,
-0.0963134765625,
0.1619873046875,
0.5263671875,
0.381103515625,
0.57666015625,
0.56005859375,
-0.86474609375,
0.0640869140625,
-0.6796875,
0.451416015625,
-0.8427734375,
0.75537109375,
0.384521484375,
-0.470947265625,
0.57861328125,
0.040985107421875,
-0.2108154296875,
-0.22998046875,
0.311767578125,
-0.198974609375,
-0.11883544921875,
0.1514892578125,
-0.3681640625,
0.065673828125,
-0.014404296875,
-0.5166015625,
0.306640625,
0.302490234375,
-0.96826171875,
0.63525390625,
-0.105224609375,
0.213134765625,
-0.441650390625,
-0.83251953125,
0.420166015625,
-0.0168609619140625,
0.15771484375,
-0.133544921875,
1.001953125,
0.283203125,
0.02227783203125,
-0.1160888671875,
0.405029296875,
-0.9775390625,
1.095703125,
-0.1728515625,
0.453369140625,
-0.464599609375,
0.01025390625,
-0.17333984375,
-0.7138671875,
-0.493896484375,
-0.69775390625,
0.462158203125,
0.6318359375,
0.2393798828125,
0.65673828125,
0.587890625,
-0.88037109375,
0.09014892578125,
0.207763671875,
-0.1756591796875,
-0.050750732421875,
0.67333984375,
1.2861328125,
-0.7060546875,
-0.313232421875,
-0.267822265625,
0.55322265625,
0.806640625,
0.70361328125,
0.126708984375,
-0.7734375,
-0.22021484375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Tags: implementation
Correct Solution:
```
a=input()
vowels=['A','E','I','O','U','Y']
ls=[]
for i in range (len(a)):
if a[i] in vowels:
ls.append(i)
if ls==[]:
print (len(a)+1)
else:
mx=0
for i in range (1,len(ls)):
mx=max(mx,ls[i]-ls[i-1])
print (max(mx,ls[0]+1,len(a)-ls[len(ls)-1]))
```
| 35,629
|
[
0.1641845703125,
-0.152099609375,
-0.370849609375,
0.66748046875,
-0.4697265625,
-0.307373046875,
0.52587890625,
0.01134490966796875,
0.2357177734375,
0.732421875,
0.486083984375,
0.00609588623046875,
0.11614990234375,
-0.740234375,
-0.6796875,
0.2132568359375,
-0.97265625,
-0.3876953125,
-0.634765625,
-0.169677734375,
0.210693359375,
-0.369140625,
-1.05859375,
0.0269775390625,
-0.075927734375,
0.62255859375,
0.4560546875,
-0.0015649795532226562,
1.09375,
1.0146484375,
0.32373046875,
-0.265380859375,
0.002666473388671875,
-1.1396484375,
-0.433349609375,
-0.319580078125,
0.17822265625,
-0.673828125,
-0.48828125,
-0.372802734375,
0.416748046875,
-0.089599609375,
0.72998046875,
-0.6640625,
-1.087890625,
-0.16796875,
-0.2459716796875,
-0.321533203125,
-0.266357421875,
-0.59521484375,
0.46826171875,
-0.254638671875,
0.53857421875,
-0.1661376953125,
-0.283447265625,
-0.314453125,
0.2529296875,
-0.190185546875,
-0.99169921875,
0.12091064453125,
-0.1046142578125,
0.5302734375,
0.2049560546875,
-0.5986328125,
-0.2432861328125,
0.45947265625,
-0.11907958984375,
-0.11932373046875,
-0.1180419921875,
-0.6982421875,
-0.272705078125,
0.449951171875,
-0.4716796875,
-0.45703125,
-0.494384765625,
0.10162353515625,
-0.04644775390625,
0.027374267578125,
-0.6806640625,
0.80322265625,
0.23486328125,
0.91064453125,
-0.28076171875,
0.153564453125,
-0.3798828125,
-0.439208984375,
-0.12152099609375,
0.148193359375,
0.198974609375,
-0.111083984375,
-0.375244140625,
0.53466796875,
-0.405517578125,
0.044525146484375,
0.57470703125,
0.488037109375,
-0.33984375,
0.49609375,
0.51708984375,
0.050537109375,
0.685546875,
1.0703125,
-0.5126953125,
0.8408203125,
-0.433349609375,
0.302734375,
0.2095947265625,
-0.1241455078125,
-0.03326416015625,
-0.5703125,
-0.24462890625,
-0.00860595703125,
0.30615234375,
0.260498046875,
-0.5966796875,
0.8935546875,
0.04547119140625,
0.472412109375,
-0.78662109375,
0.77880859375,
0.224853515625,
0.15966796875,
0.57861328125,
0.040740966796875,
0.289794921875,
-0.59228515625,
-0.54296875,
1.021484375,
-0.49365234375,
0.256591796875,
0.09283447265625,
-0.247802734375,
-0.41455078125,
0.45068359375,
-0.437744140625,
0.6171875,
-0.437255859375,
0.75048828125,
0.54833984375,
-0.96337890625,
0.5185546875,
-0.280029296875,
0.092041015625,
1.447265625,
0.568359375,
-0.15087890625,
0.447021484375,
0.33203125,
-0.6572265625,
0.35888671875,
-0.9794921875,
0.7802734375,
0.11956787109375,
0.262451171875,
-0.166259765625,
0.1884765625,
-0.317138671875,
0.2822265625,
0.1900634765625,
0.12109375,
-0.385986328125,
-0.100341796875,
-0.58349609375,
0.837890625,
-0.387939453125,
0.60986328125,
-0.44921875,
-0.10955810546875,
-0.302490234375,
-0.293212890625,
0.09454345703125,
0.1458740234375,
0.1417236328125,
0.90576171875,
0.10546875,
1.248046875,
0.9365234375,
0.0947265625,
0.38232421875,
0.45166015625,
-0.166015625,
0.1734619140625,
0.004131317138671875,
0.8486328125,
0.0016336441040039062,
0.248046875,
0.173828125,
-0.07806396484375,
-0.4375,
-0.130126953125,
-0.142333984375,
0.48828125,
-0.57373046875,
-0.181640625,
0.0021305084228515625,
0.10675048828125,
-0.708984375,
0.059844970703125,
-0.258056640625,
-1.037109375,
-0.2493896484375,
0.71533203125,
0.337646484375,
0.363037109375,
-0.252685546875,
-0.74609375,
0.421875,
1.4013671875,
-0.36279296875,
0.283935546875,
0.2103271484375,
-0.2086181640625,
-0.06939697265625,
0.176513671875,
0.380615234375,
-0.210693359375,
-0.5673828125,
0.79833984375,
-0.350341796875,
0.40625,
0.225341796875,
0.689453125,
0.332763671875,
0.6728515625,
-0.35888671875,
-0.58642578125,
0.33056640625,
1.1279296875,
-0.05419921875,
0.6181640625,
-0.006221771240234375,
0.7880859375,
0.433349609375,
0.7724609375,
0.50390625,
-0.1800537109375,
0.293212890625,
0.98779296875,
0.2841796875,
0.2205810546875,
0.26123046875,
0.42724609375,
0.69921875,
0.2900390625,
0.042999267578125,
0.416259765625,
0.0097198486328125,
0.028106689453125,
-0.5732421875,
0.268310546875,
-0.6103515625,
1.1005859375,
0.10791015625,
0.271484375,
-0.401123046875,
-0.234130859375,
0.0921630859375,
0.485595703125,
-0.64501953125,
-0.83642578125,
0.0721435546875,
0.050262451171875,
0.3486328125,
0.19140625,
0.54345703125,
0.77587890625,
0.1285400390625,
0.57275390625,
-0.28759765625,
-0.31298828125,
-0.822265625,
-0.77099609375,
-0.90087890625,
-0.421875,
-0.70068359375,
-0.2470703125,
0.53076171875,
-0.974609375,
0.736328125,
-0.360107421875,
0.0838623046875,
-0.36376953125,
-0.4013671875,
0.67041015625,
-0.11065673828125,
0.61767578125,
-0.50537109375,
0.234619140625,
0.07220458984375,
0.947265625,
-0.340087890625,
-0.2177734375,
-0.294677734375,
-0.53173828125,
0.256591796875,
0.046966552734375,
0.54345703125,
0.365234375,
-0.6025390625,
-0.748046875,
-0.56982421875,
-0.40185546875,
-0.47802734375,
0.34130859375,
-0.437744140625,
0.83203125,
0.55810546875,
-0.7333984375,
0.48291015625,
1.0478515625,
-1.1787109375,
0.7353515625,
0.495361328125,
-0.156005859375,
-0.45263671875,
1.0556640625,
0.19384765625,
0.499755859375,
-0.4921875,
-0.72998046875,
-0.3740234375,
0.22119140625,
-0.06036376953125,
-0.6484375,
-0.40478515625,
0.7138671875,
-0.33349609375,
-0.93505859375,
0.412841796875,
-1.07421875,
-0.3515625,
-0.43408203125,
-0.059356689453125,
0.875,
1.017578125,
0.49462890625,
-0.2376708984375,
-0.486328125,
-0.09039306640625,
0.69189453125,
0.65283203125,
-0.16259765625,
-0.00787353515625,
0.92236328125,
0.1923828125,
0.33349609375,
0.276123046875,
-0.365966796875,
0.0350341796875,
-0.1351318359375,
0.0955810546875,
0.46484375,
0.34912109375,
-0.03436279296875,
0.409912109375,
0.61279296875,
-0.84130859375,
-0.45849609375,
-0.41357421875,
0.78173828125,
0.0021457672119140625,
0.435791015625,
0.36767578125,
-0.08538818359375,
-0.6572265625,
-1.0068359375,
0.44482421875,
0.380126953125,
0.62890625,
-1.1494140625,
0.8720703125,
0.378173828125,
-0.37646484375,
-0.01421356201171875,
-0.49169921875,
-0.06915283203125,
1.173828125,
0.023040771484375,
0.7197265625,
-0.77587890625,
0.53857421875,
0.1990966796875,
0.1363525390625,
0.94140625,
0.309814453125,
0.22265625,
-0.1944580078125,
-0.54833984375,
-0.2890625,
0.1773681640625,
-0.2744140625,
-0.27734375,
0.379150390625,
0.048797607421875,
-0.2459716796875,
-0.6279296875,
0.392822265625,
0.72802734375,
0.3984375,
-0.358154296875,
0.55322265625,
0.1715087890625,
0.3935546875,
0.481201171875,
-0.085693359375,
0.349609375,
-0.7197265625,
0.7255859375,
-0.032135009765625,
-0.26416015625,
-0.269287109375,
-0.1553955078125,
0.11016845703125,
0.133056640625,
0.41796875,
0.01168060302734375,
-0.82275390625,
0.06689453125,
0.213134765625,
0.537109375,
-0.369873046875,
-0.3701171875,
-0.437744140625,
0.47314453125,
0.11773681640625,
-0.7705078125,
0.389892578125,
-0.873046875,
0.61572265625,
0.1722412109375,
-0.0692138671875,
-0.2313232421875,
-0.64111328125,
-0.8525390625,
-0.63134765625,
-0.03643798828125,
1.150390625,
0.1031494140625,
-0.1959228515625,
-1.1591796875,
0.2344970703125,
0.281005859375,
-0.18896484375,
-0.168701171875,
-0.42041015625,
0.2027587890625,
-0.10113525390625,
0.33056640625,
-0.814453125,
-0.8955078125,
-0.01180267333984375,
-1.326171875,
0.76171875,
-0.54345703125,
0.77099609375,
-0.35205078125,
-0.343017578125,
0.12371826171875,
-0.2296142578125,
-0.39990234375,
-0.0631103515625,
-0.382080078125,
0.43310546875,
-0.8330078125,
-0.57177734375,
0.403564453125,
-0.339111328125,
-0.373291015625,
1.0576171875,
0.0040130615234375,
-0.40087890625,
-0.038818359375,
0.470703125,
-0.578125,
0.3935546875,
-0.4580078125,
0.6142578125,
-0.35986328125,
-0.75830078125,
-0.2685546875,
-0.81005859375,
0.771484375,
-0.09197998046875,
-0.93994140625,
-0.1947021484375,
-1.1162109375,
-0.224609375,
0.08428955078125,
-0.44140625,
0.272705078125,
0.308349609375,
-0.359619140625,
0.21142578125,
-0.427001953125,
-0.325927734375,
-0.47412109375,
-0.56005859375,
-0.5751953125,
0.21044921875,
0.109130859375,
0.888671875,
-0.06524658203125,
-0.1351318359375,
0.156494140625,
-0.188232421875,
0.06292724609375,
-0.319091796875,
-0.47900390625,
0.02294921875,
-0.3798828125,
-0.29345703125,
0.338134765625,
-0.04095458984375,
0.5224609375,
0.90771484375,
0.027374267578125,
0.31298828125,
0.5166015625,
-0.56298828125,
0.7685546875,
-0.284912109375,
-0.59423828125,
-0.310546875,
0.7802734375,
0.140869140625,
0.73828125,
0.232177734375,
-1.015625,
-0.69384765625,
-0.73291015625,
-0.1826171875,
-0.61474609375,
0.043548583984375,
-1.0751953125,
-0.176025390625,
-0.61474609375,
0.43408203125,
-0.01517486572265625,
-0.67041015625,
-0.04840087890625,
-0.7529296875,
0.31787109375,
-0.8515625,
-0.1883544921875,
-0.765625,
-0.385009765625,
0.2198486328125,
0.72607421875,
0.167236328125,
0.65234375,
0.271240234375,
0.0017042160034179688,
0.2548828125,
-0.1864013671875,
-0.468017578125,
-0.515625,
-0.418212890625,
0.366943359375,
-0.211669921875,
-0.0172271728515625,
-0.47900390625,
0.72705078125,
-0.83935546875,
0.1527099609375,
-0.450439453125,
-0.1484375,
0.219970703125,
-0.06640625,
1.1865234375,
0.07733154296875,
0.06427001953125,
-0.0870361328125,
0.494140625,
0.446533203125,
-0.298095703125,
-0.54833984375,
-0.16357421875,
-0.6416015625,
-0.86279296875,
0.81103515625,
-0.49658203125,
0.07843017578125,
-0.435302734375,
-0.463134765625,
1.1328125,
-0.45947265625,
0.418701171875,
1.177734375,
-0.0262908935546875,
0.7177734375,
-0.39453125,
0.5791015625,
0.477294921875,
-0.313720703125,
-0.164306640625,
0.09722900390625,
-0.68896484375,
0.06500244140625,
-0.6552734375,
-0.93896484375,
-0.7587890625,
0.328125,
1.2451171875,
-0.067138671875,
0.8154296875,
0.19873046875,
-1.0185546875,
-0.6943359375,
1.1943359375,
0.5498046875,
0.0938720703125,
1.1220703125,
-0.2388916015625,
0.0657958984375,
-0.21240234375,
-0.1719970703125,
-0.41943359375,
-0.450927734375,
1.0419921875,
-1.01171875,
-0.56982421875,
0.71728515625,
0.84033203125,
-1.140625,
-1.0439453125,
-0.658203125,
-0.2039794921875,
0.25439453125,
-0.55126953125,
0.0933837890625,
0.294189453125,
-0.372314453125,
0.041168212890625,
0.268798828125,
0.04443359375,
0.441162109375,
0.162841796875,
-0.006519317626953125,
-0.418701171875,
0.43212890625,
0.50146484375,
-0.83642578125,
-0.004749298095703125,
-0.93798828125,
0.2164306640625,
-0.124755859375,
-0.0841064453125,
0.92724609375,
-0.2724609375,
0.38134765625,
0.12078857421875,
-0.30322265625,
0.30078125,
-0.68310546875,
-0.3564453125,
0.66650390625,
-0.322265625,
-0.414794921875,
-0.221435546875,
0.67138671875,
-0.11395263671875,
0.0948486328125,
-0.3955078125,
-0.033782958984375,
0.16015625,
0.425048828125,
-0.441650390625,
-1.0224609375,
-0.20068359375,
-1.3798828125,
-0.56982421875,
-0.58642578125,
-0.283447265625,
0.2344970703125,
0.396484375,
-0.1781005859375,
-0.6376953125,
0.1903076171875,
0.468505859375,
-0.384033203125,
0.77294921875,
-0.83349609375,
0.31396484375,
-0.352783203125,
-0.11944580078125,
-0.76171875,
-0.0400390625,
-0.352783203125,
-0.2069091796875,
-0.55859375,
0.193359375,
-0.19921875,
0.47802734375,
-0.0704345703125,
0.2119140625,
-0.37060546875,
-0.62255859375,
-0.2386474609375,
0.035675048828125,
-0.11224365234375,
0.87841796875,
0.7607421875,
-0.441650390625,
0.222412109375,
-0.04229736328125,
-0.29931640625,
-0.52978515625,
0.4521484375,
0.5849609375,
-0.43359375,
-0.341796875,
0.184814453125,
0.452392578125,
-0.99267578125,
0.16748046875,
-0.5693359375,
0.49365234375,
0.12054443359375,
-0.2086181640625,
0.85595703125,
1.056640625,
-0.24267578125,
0.1363525390625,
-0.1519775390625,
-0.052276611328125,
0.87158203125,
0.025634765625,
0.05572509765625,
0.383056640625,
0.05059814453125,
-0.56787109375,
0.036834716796875,
0.287109375,
-0.17431640625,
0.0174560546875,
-0.06683349609375,
-0.49560546875,
-0.876953125,
-0.0794677734375,
-0.274658203125,
0.46044921875,
0.513671875,
-0.30419921875,
0.314697265625,
-0.267578125,
-0.42529296875,
0.51171875,
-1.3076171875,
-0.85400390625,
0.07281494140625,
0.09710693359375,
-0.37158203125,
-0.135498046875,
-0.4912109375,
-0.125244140625,
-0.349853515625,
0.3193359375,
-0.315185546875,
0.38232421875,
-0.3701171875,
0.6005859375,
-0.1031494140625,
-0.352783203125,
-0.1732177734375,
0.654296875,
-0.32080078125,
-0.857421875,
-0.073486328125,
0.98876953125,
0.2398681640625,
-0.08306884765625,
-0.000514984130859375,
0.135986328125,
-0.00469970703125,
0.22265625,
-0.6318359375,
0.233642578125,
-0.318115234375,
0.466796875,
-1.203125,
-0.41845703125,
0.0888671875,
0.43017578125,
0.20068359375,
-0.53466796875,
-0.26708984375,
0.779296875,
0.64990234375,
-0.0031337738037109375,
0.268310546875,
0.1033935546875,
0.436279296875,
-0.1630859375,
0.060882568359375,
-0.337158203125,
0.63671875,
0.85986328125,
0.55029296875,
-0.046356201171875,
0.1951904296875,
0.65966796875,
-0.410400390625,
-0.5625,
0.40869140625,
0.06640625,
-0.14306640625,
0.49951171875,
-0.147216796875,
0.007633209228515625,
-0.26123046875,
-0.386474609375,
0.294677734375,
-0.266357421875,
-0.04443359375,
-0.0911865234375,
-0.560546875,
1.234375,
-0.4287109375,
-0.12054443359375,
0.07928466796875,
-0.67041015625,
0.5029296875,
0.76123046875,
-0.1544189453125,
-0.33349609375,
0.736328125,
0.67138671875,
0.48583984375,
0.64404296875,
0.50537109375,
0.0626220703125,
-0.849609375,
0.25537109375,
-0.127685546875,
0.2427978515625,
-0.55078125,
-0.37158203125,
-1.2919921875,
0.340087890625,
0.01169586181640625,
-0.30712890625,
0.77001953125,
-0.8466796875,
-0.045654296875,
-0.0265655517578125,
0.4755859375,
-0.78759765625,
0.432373046875,
0.51806640625,
-0.24267578125,
-0.517578125,
0.951171875,
-0.06268310546875,
0.3125,
0.0791015625,
1.3251953125,
-0.051177978515625,
1.34765625,
0.374755859375,
0.109130859375,
0.316650390625,
0.44677734375,
-0.7744140625,
-0.8984375,
-0.35400390625,
-0.454345703125,
0.0036373138427734375,
-0.458251953125,
-0.291015625,
-0.25390625,
0.791015625,
-0.04058837890625,
-0.984375,
-0.293212890625,
0.01300048828125,
-1.1572265625,
0.556640625,
0.453857421875,
0.35498046875,
0.1942138671875,
-0.09930419921875,
-0.049560546875,
-0.406982421875,
0.02862548828125,
-0.53515625,
0.49951171875,
-0.9208984375,
-0.418701171875,
-0.260986328125,
-0.63818359375,
-0.67578125,
0.27392578125,
-0.697265625,
-0.7177734375,
0.4716796875,
0.47021484375,
0.30517578125,
0.380859375,
-0.299072265625,
-0.2060546875,
0.8974609375,
0.8896484375,
0.1251220703125,
0.69677734375,
0.36279296875,
-0.3603515625,
-0.1390380859375,
-0.94970703125,
0.455078125,
-0.23779296875,
-0.0555419921875,
-0.54150390625,
0.351806640625,
-0.6103515625,
-1.400390625,
-0.08917236328125,
0.43359375,
0.15478515625,
-0.791015625,
-1.1064453125,
-0.14990234375,
-1.3330078125,
-0.317626953125,
-0.6875,
1.015625,
0.035125732421875,
0.0253753662109375,
-0.05120849609375,
-1.171875,
4.43359375,
0.77197265625,
0.72216796875,
0.2340087890625,
0.283447265625,
1.2978515625,
0.58984375,
-0.38720703125,
-0.62451171875,
-0.2091064453125,
0.403076171875,
-0.1346435546875,
0.122314453125,
0.78076171875,
0.70458984375,
0.378173828125,
-0.568359375,
-0.218017578125,
-0.0188446044921875,
-0.97705078125,
-0.6279296875,
-0.0611572265625,
0.259521484375,
0.5029296875,
0.435302734375,
0.49658203125,
0.52099609375,
-0.8564453125,
0.1041259765625,
-0.75634765625,
0.447509765625,
-0.85546875,
0.7744140625,
0.438232421875,
-0.476806640625,
0.60302734375,
0.12432861328125,
-0.189453125,
-0.2080078125,
0.327880859375,
-0.2022705078125,
-0.1285400390625,
0.1729736328125,
-0.372314453125,
0.05328369140625,
-0.042022705078125,
-0.53173828125,
0.43603515625,
0.369384765625,
-0.97509765625,
0.60791015625,
-0.16796875,
0.1494140625,
-0.4560546875,
-0.93115234375,
0.44384765625,
-0.09979248046875,
0.14697265625,
-0.1910400390625,
0.9453125,
0.26513671875,
-0.0269775390625,
-0.187744140625,
0.49853515625,
-1.01953125,
1.0146484375,
-0.1842041015625,
0.406494140625,
-0.42919921875,
0.0276641845703125,
-0.16748046875,
-0.6669921875,
-0.5029296875,
-0.71435546875,
0.468505859375,
0.544921875,
0.16552734375,
0.63671875,
0.59375,
-0.876953125,
0.07562255859375,
0.261962890625,
-0.1539306640625,
0.01045989990234375,
0.6474609375,
1.3212890625,
-0.7734375,
-0.354248046875,
-0.318359375,
0.63037109375,
0.83544921875,
0.63720703125,
0.1304931640625,
-0.7919921875,
-0.1903076171875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Tags: implementation
Correct Solution:
```
s = input()
a = []
for i in range(len(s)):
if s[i] == 'A' or s[i] == 'E' or s[i] == 'U' or s[i] == 'I' or s[i] == 'O' or s[i] == 'Y' :
a.append(1)
else:
a.append(0)
a.append(1)
num = 0
maximum = 0
for i in range(len(a)):
num += 1
if a[i] == 1 :
maximum = max(maximum, num)
num = 0
print(maximum)
```
| 35,630
|
[
0.1885986328125,
-0.16748046875,
-0.3349609375,
0.67041015625,
-0.45068359375,
-0.314208984375,
0.53076171875,
0.002002716064453125,
0.2288818359375,
0.76806640625,
0.53173828125,
-0.006450653076171875,
0.1517333984375,
-0.7333984375,
-0.615234375,
0.1845703125,
-0.92724609375,
-0.392822265625,
-0.65966796875,
-0.1614990234375,
0.1900634765625,
-0.37060546875,
-1.12109375,
0.050537109375,
-0.10040283203125,
0.62939453125,
0.40966796875,
-0.0149993896484375,
1.087890625,
1.013671875,
0.316650390625,
-0.29638671875,
0.038726806640625,
-1.1279296875,
-0.429443359375,
-0.34814453125,
0.2452392578125,
-0.65625,
-0.467041015625,
-0.297607421875,
0.423095703125,
-0.08135986328125,
0.78369140625,
-0.69482421875,
-1.0927734375,
-0.18017578125,
-0.30322265625,
-0.3662109375,
-0.310302734375,
-0.57275390625,
0.472412109375,
-0.282470703125,
0.55224609375,
-0.17431640625,
-0.2423095703125,
-0.3232421875,
0.2274169921875,
-0.1956787109375,
-1.029296875,
0.1685791015625,
-0.0638427734375,
0.4990234375,
0.2086181640625,
-0.56787109375,
-0.239990234375,
0.40869140625,
-0.07354736328125,
-0.1270751953125,
-0.15283203125,
-0.65625,
-0.2421875,
0.4814453125,
-0.485595703125,
-0.428955078125,
-0.50732421875,
0.0849609375,
0.006191253662109375,
0.01271820068359375,
-0.685546875,
0.84619140625,
0.2149658203125,
0.87939453125,
-0.268798828125,
0.15087890625,
-0.418701171875,
-0.4609375,
-0.09375,
0.1981201171875,
0.2119140625,
-0.131591796875,
-0.330322265625,
0.5576171875,
-0.3779296875,
0.08575439453125,
0.56884765625,
0.51708984375,
-0.363037109375,
0.477783203125,
0.5009765625,
0.051055908203125,
0.74462890625,
1.0546875,
-0.470947265625,
0.82763671875,
-0.47021484375,
0.2705078125,
0.25146484375,
-0.1473388671875,
-0.049041748046875,
-0.53271484375,
-0.2188720703125,
0.021392822265625,
0.296630859375,
0.25537109375,
-0.619140625,
0.84423828125,
0.07574462890625,
0.461669921875,
-0.775390625,
0.7685546875,
0.2476806640625,
0.1375732421875,
0.55078125,
0.049652099609375,
0.177978515625,
-0.5947265625,
-0.487548828125,
1.0458984375,
-0.4169921875,
0.3046875,
0.09912109375,
-0.2490234375,
-0.427001953125,
0.4296875,
-0.4765625,
0.63818359375,
-0.397705078125,
0.7587890625,
0.5751953125,
-0.92919921875,
0.525390625,
-0.280029296875,
0.10919189453125,
1.3896484375,
0.5791015625,
-0.115234375,
0.51025390625,
0.3330078125,
-0.6640625,
0.329833984375,
-0.9560546875,
0.77880859375,
0.09368896484375,
0.26708984375,
-0.1683349609375,
0.2054443359375,
-0.290283203125,
0.300537109375,
0.1964111328125,
0.097412109375,
-0.3603515625,
-0.0439453125,
-0.5322265625,
0.87255859375,
-0.41357421875,
0.65625,
-0.438232421875,
-0.0992431640625,
-0.3662109375,
-0.302978515625,
0.04840087890625,
0.1842041015625,
0.100830078125,
0.91064453125,
0.11651611328125,
1.3056640625,
0.9833984375,
0.10003662109375,
0.356689453125,
0.451416015625,
-0.232177734375,
0.1571044921875,
0.07550048828125,
0.9208984375,
0.03277587890625,
0.261474609375,
0.1497802734375,
-0.0751953125,
-0.440185546875,
-0.1781005859375,
-0.1685791015625,
0.431640625,
-0.57568359375,
-0.1802978515625,
-0.004764556884765625,
0.0889892578125,
-0.74951171875,
-0.024871826171875,
-0.234375,
-1.03125,
-0.2939453125,
0.6923828125,
0.356689453125,
0.36328125,
-0.268310546875,
-0.8046875,
0.40478515625,
1.365234375,
-0.4052734375,
0.25927734375,
0.1903076171875,
-0.2071533203125,
-0.0293426513671875,
0.147705078125,
0.408447265625,
-0.2366943359375,
-0.6005859375,
0.81689453125,
-0.31689453125,
0.35986328125,
0.16064453125,
0.65869140625,
0.283935546875,
0.6982421875,
-0.3095703125,
-0.56494140625,
0.310302734375,
1.1884765625,
-0.036895751953125,
0.5615234375,
0.030487060546875,
0.77294921875,
0.434814453125,
0.8212890625,
0.56591796875,
-0.1964111328125,
0.273681640625,
0.95361328125,
0.2734375,
0.2177734375,
0.208984375,
0.42333984375,
0.69921875,
0.255615234375,
0.0733642578125,
0.41845703125,
0.028656005859375,
0.048980712890625,
-0.4931640625,
0.2034912109375,
-0.5859375,
1.0791015625,
0.10723876953125,
0.25146484375,
-0.42529296875,
-0.193603515625,
0.0565185546875,
0.49609375,
-0.65771484375,
-0.7890625,
0.010284423828125,
0.036590576171875,
0.30712890625,
0.1990966796875,
0.541015625,
0.76025390625,
0.0987548828125,
0.52880859375,
-0.27978515625,
-0.265869140625,
-0.810546875,
-0.76611328125,
-0.9619140625,
-0.457275390625,
-0.6845703125,
-0.212158203125,
0.4990234375,
-0.9248046875,
0.703125,
-0.424072265625,
0.07965087890625,
-0.3037109375,
-0.419921875,
0.6591796875,
-0.11187744140625,
0.6630859375,
-0.5029296875,
0.24365234375,
0.08685302734375,
0.919921875,
-0.357177734375,
-0.236328125,
-0.2939453125,
-0.56884765625,
0.2293701171875,
0.0214080810546875,
0.5986328125,
0.27978515625,
-0.56201171875,
-0.72607421875,
-0.61962890625,
-0.37158203125,
-0.50634765625,
0.3388671875,
-0.4013671875,
0.84375,
0.5771484375,
-0.74169921875,
0.5009765625,
1.0302734375,
-1.1513671875,
0.744140625,
0.462158203125,
-0.1573486328125,
-0.5087890625,
1.0478515625,
0.23876953125,
0.50146484375,
-0.50244140625,
-0.68115234375,
-0.3291015625,
0.25341796875,
-0.099365234375,
-0.71337890625,
-0.464599609375,
0.697265625,
-0.317626953125,
-0.89306640625,
0.370361328125,
-1.068359375,
-0.3125,
-0.438232421875,
-0.08441162109375,
0.93115234375,
1.0283203125,
0.4453125,
-0.238525390625,
-0.466796875,
-0.08819580078125,
0.74072265625,
0.64501953125,
-0.192138671875,
-0.022186279296875,
0.89306640625,
0.1898193359375,
0.3203125,
0.2491455078125,
-0.279541015625,
0.0181884765625,
-0.1370849609375,
0.07659912109375,
0.4755859375,
0.35107421875,
-0.062164306640625,
0.425537109375,
0.61572265625,
-0.87109375,
-0.45458984375,
-0.41748046875,
0.72314453125,
-0.03118896484375,
0.44921875,
0.361083984375,
-0.0933837890625,
-0.65771484375,
-0.96826171875,
0.43115234375,
0.371337890625,
0.615234375,
-1.1572265625,
0.87451171875,
0.334716796875,
-0.372314453125,
-0.00527191162109375,
-0.4609375,
-0.09478759765625,
1.1494140625,
0.046295166015625,
0.6962890625,
-0.7890625,
0.55322265625,
0.234130859375,
0.2078857421875,
0.9169921875,
0.33349609375,
0.214599609375,
-0.2083740234375,
-0.4990234375,
-0.311279296875,
0.13037109375,
-0.25390625,
-0.3056640625,
0.377197265625,
0.09649658203125,
-0.263916015625,
-0.6728515625,
0.4208984375,
0.73681640625,
0.44287109375,
-0.300048828125,
0.50390625,
0.2274169921875,
0.40380859375,
0.513671875,
-0.07501220703125,
0.281005859375,
-0.7392578125,
0.68359375,
-0.034271240234375,
-0.2340087890625,
-0.388671875,
-0.1607666015625,
0.08050537109375,
0.11602783203125,
0.437744140625,
0.031829833984375,
-0.84326171875,
0.06512451171875,
0.1580810546875,
0.56689453125,
-0.388427734375,
-0.404296875,
-0.39990234375,
0.413330078125,
0.1748046875,
-0.8095703125,
0.37109375,
-0.88671875,
0.6376953125,
0.1717529296875,
-0.10772705078125,
-0.260009765625,
-0.65185546875,
-0.806640625,
-0.66552734375,
-0.054962158203125,
1.1630859375,
0.0765380859375,
-0.160888671875,
-1.1826171875,
0.2183837890625,
0.333251953125,
-0.2056884765625,
-0.156982421875,
-0.416259765625,
0.25244140625,
-0.0972900390625,
0.362548828125,
-0.88818359375,
-0.89306640625,
-0.003582000732421875,
-1.287109375,
0.677734375,
-0.56298828125,
0.76025390625,
-0.38818359375,
-0.3046875,
0.086181640625,
-0.171875,
-0.377197265625,
-0.0251007080078125,
-0.38134765625,
0.46435546875,
-0.849609375,
-0.60009765625,
0.444091796875,
-0.371337890625,
-0.361328125,
1.0673828125,
-0.038360595703125,
-0.38134765625,
-0.033447265625,
0.39990234375,
-0.58935546875,
0.364990234375,
-0.496337890625,
0.634765625,
-0.350341796875,
-0.78271484375,
-0.34423828125,
-0.810546875,
0.79248046875,
-0.0703125,
-0.923828125,
-0.1644287109375,
-1.123046875,
-0.1680908203125,
0.08544921875,
-0.4765625,
0.27197265625,
0.318359375,
-0.338623046875,
0.191650390625,
-0.394287109375,
-0.334716796875,
-0.424560546875,
-0.54736328125,
-0.53564453125,
0.176025390625,
0.10662841796875,
0.87646484375,
-0.09912109375,
-0.17333984375,
0.1483154296875,
-0.125244140625,
0.08843994140625,
-0.324462890625,
-0.46142578125,
0.004337310791015625,
-0.302978515625,
-0.30078125,
0.380126953125,
-0.0872802734375,
0.51513671875,
0.93994140625,
0.00506591796875,
0.3662109375,
0.499267578125,
-0.51806640625,
0.7568359375,
-0.26123046875,
-0.62744140625,
-0.32421875,
0.75439453125,
0.1407470703125,
0.69482421875,
0.2177734375,
-1.0400390625,
-0.7470703125,
-0.68310546875,
-0.140869140625,
-0.6298828125,
0.03411865234375,
-1.0908203125,
-0.21337890625,
-0.61767578125,
0.3828125,
0.02020263671875,
-0.6591796875,
-0.0262603759765625,
-0.7734375,
0.29931640625,
-0.85595703125,
-0.1922607421875,
-0.77294921875,
-0.357421875,
0.263671875,
0.701171875,
0.13720703125,
0.70654296875,
0.2880859375,
-0.01509857177734375,
0.2467041015625,
-0.149169921875,
-0.438232421875,
-0.50732421875,
-0.456298828125,
0.338134765625,
-0.289794921875,
0.00870513916015625,
-0.50048828125,
0.71044921875,
-0.83984375,
0.1947021484375,
-0.43212890625,
-0.1600341796875,
0.1636962890625,
-0.0374755859375,
1.1953125,
0.1064453125,
0.138916015625,
-0.128173828125,
0.4833984375,
0.490234375,
-0.2734375,
-0.5888671875,
-0.2158203125,
-0.61279296875,
-0.86474609375,
0.81591796875,
-0.50341796875,
0.12237548828125,
-0.44091796875,
-0.463134765625,
1.087890625,
-0.45654296875,
0.379638671875,
1.25,
0.0214080810546875,
0.7333984375,
-0.333251953125,
0.6240234375,
0.490478515625,
-0.3408203125,
-0.1463623046875,
0.07989501953125,
-0.6591796875,
0.046356201171875,
-0.61083984375,
-0.9580078125,
-0.7744140625,
0.3330078125,
1.2177734375,
-0.07269287109375,
0.78466796875,
0.1815185546875,
-1.025390625,
-0.72314453125,
1.1787109375,
0.55517578125,
0.08905029296875,
1.1396484375,
-0.2427978515625,
0.0968017578125,
-0.251953125,
-0.1312255859375,
-0.3720703125,
-0.458984375,
1.0654296875,
-0.92041015625,
-0.611328125,
0.73193359375,
0.83837890625,
-1.1611328125,
-1.0341796875,
-0.58984375,
-0.272705078125,
0.2198486328125,
-0.5478515625,
0.1343994140625,
0.32568359375,
-0.403564453125,
0.0496826171875,
0.2822265625,
0.07427978515625,
0.454833984375,
0.1356201171875,
0.01160430908203125,
-0.42578125,
0.45947265625,
0.4755859375,
-0.86181640625,
0.004695892333984375,
-0.986328125,
0.182861328125,
-0.103515625,
-0.06640625,
0.9365234375,
-0.2391357421875,
0.3447265625,
0.1390380859375,
-0.306640625,
0.3134765625,
-0.65966796875,
-0.351318359375,
0.64208984375,
-0.3828125,
-0.4072265625,
-0.216796875,
0.64794921875,
-0.12396240234375,
0.0645751953125,
-0.369384765625,
-0.07122802734375,
0.1539306640625,
0.443115234375,
-0.492431640625,
-0.98388671875,
-0.1815185546875,
-1.35546875,
-0.5478515625,
-0.5908203125,
-0.229248046875,
0.20166015625,
0.398681640625,
-0.207763671875,
-0.634765625,
0.1644287109375,
0.478515625,
-0.40234375,
0.8154296875,
-0.83447265625,
0.32666015625,
-0.373046875,
-0.14697265625,
-0.79345703125,
-0.0301971435546875,
-0.318359375,
-0.146240234375,
-0.6337890625,
0.2451171875,
-0.2398681640625,
0.48046875,
-0.07879638671875,
0.2200927734375,
-0.392822265625,
-0.673828125,
-0.1844482421875,
0.057952880859375,
-0.166259765625,
0.86376953125,
0.734375,
-0.458740234375,
0.1827392578125,
-0.080810546875,
-0.269287109375,
-0.59912109375,
0.50341796875,
0.60791015625,
-0.449462890625,
-0.325927734375,
0.194580078125,
0.416015625,
-1.001953125,
0.150634765625,
-0.5498046875,
0.4580078125,
0.10357666015625,
-0.238525390625,
0.84326171875,
1.0478515625,
-0.24951171875,
0.153076171875,
-0.1375732421875,
-0.05462646484375,
0.82177734375,
0.046173095703125,
0.0826416015625,
0.40087890625,
0.040435791015625,
-0.5146484375,
0.062744140625,
0.323486328125,
-0.1090087890625,
-0.034759521484375,
-0.04254150390625,
-0.52001953125,
-0.8505859375,
-0.12200927734375,
-0.299072265625,
0.464599609375,
0.51416015625,
-0.301025390625,
0.3203125,
-0.250732421875,
-0.3759765625,
0.51806640625,
-1.3486328125,
-0.90380859375,
0.07421875,
0.1358642578125,
-0.407958984375,
-0.1434326171875,
-0.51416015625,
-0.1376953125,
-0.287109375,
0.29931640625,
-0.260498046875,
0.4140625,
-0.347900390625,
0.59130859375,
-0.161376953125,
-0.362060546875,
-0.1673583984375,
0.6630859375,
-0.347412109375,
-0.884765625,
-0.07220458984375,
0.99169921875,
0.251708984375,
-0.1148681640625,
-0.06640625,
0.1922607421875,
0.0013513565063476562,
0.2064208984375,
-0.6025390625,
0.269775390625,
-0.362548828125,
0.47802734375,
-1.1845703125,
-0.357421875,
0.07232666015625,
0.401123046875,
0.267822265625,
-0.58984375,
-0.27734375,
0.80126953125,
0.67919921875,
-0.0347900390625,
0.327880859375,
0.0799560546875,
0.434814453125,
-0.198486328125,
0.038055419921875,
-0.274658203125,
0.72021484375,
0.87109375,
0.6240234375,
-0.04541015625,
0.158203125,
0.70458984375,
-0.384521484375,
-0.5986328125,
0.3779296875,
0.07080078125,
-0.11798095703125,
0.576171875,
-0.1116943359375,
0.003604888916015625,
-0.303466796875,
-0.429443359375,
0.360107421875,
-0.25634765625,
-0.074951171875,
-0.08319091796875,
-0.57958984375,
1.2236328125,
-0.38525390625,
-0.06829833984375,
0.160888671875,
-0.6455078125,
0.43896484375,
0.7822265625,
-0.25439453125,
-0.338134765625,
0.7431640625,
0.72802734375,
0.5322265625,
0.64404296875,
0.496826171875,
0.0806884765625,
-0.82275390625,
0.2054443359375,
-0.097412109375,
0.25439453125,
-0.556640625,
-0.390625,
-1.296875,
0.325927734375,
-0.0009131431579589844,
-0.33544921875,
0.79296875,
-0.8955078125,
-0.007305145263671875,
-0.0303192138671875,
0.483642578125,
-0.8232421875,
0.445556640625,
0.5263671875,
-0.2880859375,
-0.492431640625,
0.86572265625,
-0.07940673828125,
0.285400390625,
0.075439453125,
1.3212890625,
-0.060577392578125,
1.34765625,
0.448974609375,
0.15234375,
0.302978515625,
0.447021484375,
-0.7568359375,
-0.8525390625,
-0.391357421875,
-0.43212890625,
-0.01026153564453125,
-0.455078125,
-0.296142578125,
-0.2303466796875,
0.845703125,
-0.05291748046875,
-1.00390625,
-0.32275390625,
0.02215576171875,
-1.19921875,
0.54541015625,
0.446533203125,
0.3427734375,
0.199462890625,
-0.121826171875,
-0.01422119140625,
-0.406494140625,
0.051971435546875,
-0.54345703125,
0.4736328125,
-0.92333984375,
-0.43994140625,
-0.26416015625,
-0.60595703125,
-0.58544921875,
0.2247314453125,
-0.703125,
-0.73388671875,
0.446044921875,
0.505859375,
0.29638671875,
0.37158203125,
-0.262939453125,
-0.202392578125,
0.92041015625,
0.9169921875,
0.1431884765625,
0.72998046875,
0.34619140625,
-0.41455078125,
-0.1014404296875,
-0.986328125,
0.444091796875,
-0.255615234375,
-0.03155517578125,
-0.56884765625,
0.36669921875,
-0.591796875,
-1.4072265625,
-0.1524658203125,
0.478271484375,
0.1651611328125,
-0.74365234375,
-1.1083984375,
-0.195068359375,
-1.34765625,
-0.374755859375,
-0.67138671875,
0.99951171875,
-0.033203125,
-0.01212310791015625,
-0.069091796875,
-1.2177734375,
4.42578125,
0.80615234375,
0.71484375,
0.275634765625,
0.322998046875,
1.30078125,
0.59814453125,
-0.407470703125,
-0.6328125,
-0.2008056640625,
0.404541015625,
-0.162353515625,
0.07708740234375,
0.73974609375,
0.7216796875,
0.334228515625,
-0.591796875,
-0.2186279296875,
-0.028228759765625,
-0.9794921875,
-0.60693359375,
-0.0848388671875,
0.207763671875,
0.58349609375,
0.425048828125,
0.5078125,
0.53076171875,
-0.83935546875,
0.055267333984375,
-0.70654296875,
0.430419921875,
-0.859375,
0.8095703125,
0.417236328125,
-0.472412109375,
0.59375,
0.1424560546875,
-0.208251953125,
-0.251953125,
0.30029296875,
-0.202880859375,
-0.08172607421875,
0.192138671875,
-0.41796875,
0.0885009765625,
-0.0287017822265625,
-0.55908203125,
0.38720703125,
0.3564453125,
-0.9873046875,
0.6181640625,
-0.1435546875,
0.1741943359375,
-0.4912109375,
-0.86328125,
0.415283203125,
-0.0802001953125,
0.1873779296875,
-0.150146484375,
0.92333984375,
0.28125,
0.01947021484375,
-0.151611328125,
0.45556640625,
-1.029296875,
1.0302734375,
-0.220703125,
0.404052734375,
-0.431640625,
0.0211029052734375,
-0.192138671875,
-0.68017578125,
-0.448974609375,
-0.71435546875,
0.482421875,
0.548828125,
0.144287109375,
0.65283203125,
0.587890625,
-0.87744140625,
0.034332275390625,
0.2462158203125,
-0.1455078125,
-0.002166748046875,
0.67626953125,
1.3505859375,
-0.76220703125,
-0.318603515625,
-0.296142578125,
0.6142578125,
0.82177734375,
0.7041015625,
0.09368896484375,
-0.74853515625,
-0.2091064453125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Tags: implementation
Correct Solution:
```
def Main():
v = [ 'A', 'E', 'I', 'O', 'U','Y']
s = input()
# s = ' ' + s
# s = s + ' '
A = []
cnt = 0
# print(s)
for i in range(len(s) ):
if s[i] == 'A' or s[i] == 'E' or s[i] == 'I' or s[i] == 'O' or s[i] == 'U' or s[i] == 'Y':
A.append(cnt)
cnt = 0
else:
cnt += 1
A.append(cnt)
# print(A)
A.sort()
print(A[len(A) - 1] + 1)
# print(A)
if __name__ == '__main__':
Main()
```
| 35,631
|
[
0.1661376953125,
-0.169921875,
-0.35302734375,
0.650390625,
-0.4052734375,
-0.245361328125,
0.53662109375,
-0.00896453857421875,
0.2178955078125,
0.71142578125,
0.5478515625,
-0.04058837890625,
0.0943603515625,
-0.78076171875,
-0.6728515625,
0.1455078125,
-0.93212890625,
-0.37451171875,
-0.67138671875,
-0.1685791015625,
0.1639404296875,
-0.36376953125,
-1.119140625,
0.0131378173828125,
-0.034576416015625,
0.59423828125,
0.40283203125,
-0.0196990966796875,
1.0556640625,
0.96240234375,
0.33349609375,
-0.26025390625,
0.05572509765625,
-1.103515625,
-0.400634765625,
-0.31298828125,
0.223876953125,
-0.65869140625,
-0.436279296875,
-0.251220703125,
0.430419921875,
-0.09197998046875,
0.73193359375,
-0.666015625,
-1.1044921875,
-0.2205810546875,
-0.25537109375,
-0.34912109375,
-0.26318359375,
-0.56591796875,
0.44921875,
-0.259521484375,
0.55810546875,
-0.153564453125,
-0.254638671875,
-0.343994140625,
0.275146484375,
-0.1865234375,
-0.97509765625,
0.1773681640625,
-0.036651611328125,
0.475341796875,
0.197509765625,
-0.5546875,
-0.2509765625,
0.38134765625,
-0.11053466796875,
-0.1302490234375,
-0.1300048828125,
-0.65087890625,
-0.3017578125,
0.451171875,
-0.441162109375,
-0.492431640625,
-0.486328125,
0.086669921875,
0.01407623291015625,
-0.0312042236328125,
-0.67041015625,
0.8544921875,
0.2020263671875,
0.89697265625,
-0.2281494140625,
0.125732421875,
-0.384765625,
-0.458984375,
-0.091796875,
0.2122802734375,
0.16259765625,
-0.10870361328125,
-0.322021484375,
0.52490234375,
-0.456298828125,
0.05621337890625,
0.58251953125,
0.51171875,
-0.385498046875,
0.51416015625,
0.53271484375,
0.058349609375,
0.72265625,
1.05859375,
-0.5263671875,
0.8408203125,
-0.462158203125,
0.307373046875,
0.23876953125,
-0.1695556640625,
-0.08062744140625,
-0.552734375,
-0.2000732421875,
-0.0073699951171875,
0.2568359375,
0.2464599609375,
-0.6015625,
0.83349609375,
0.06671142578125,
0.501953125,
-0.77392578125,
0.74951171875,
0.259765625,
0.1077880859375,
0.5712890625,
0.0208587646484375,
0.1951904296875,
-0.5068359375,
-0.52197265625,
1.02734375,
-0.4951171875,
0.318359375,
0.134765625,
-0.23876953125,
-0.46044921875,
0.4599609375,
-0.5322265625,
0.59375,
-0.40869140625,
0.77001953125,
0.5322265625,
-0.9267578125,
0.56396484375,
-0.243896484375,
0.087890625,
1.3935546875,
0.56591796875,
-0.1416015625,
0.4521484375,
0.3671875,
-0.6572265625,
0.409423828125,
-0.935546875,
0.728515625,
0.11285400390625,
0.271728515625,
-0.2318115234375,
0.2215576171875,
-0.284912109375,
0.320556640625,
0.2073974609375,
0.028839111328125,
-0.368408203125,
-0.019561767578125,
-0.53369140625,
0.82666015625,
-0.42822265625,
0.6259765625,
-0.4736328125,
-0.0718994140625,
-0.352783203125,
-0.282958984375,
0.03271484375,
0.1529541015625,
0.12274169921875,
0.892578125,
0.1273193359375,
1.2548828125,
0.900390625,
0.13525390625,
0.369384765625,
0.50634765625,
-0.1937255859375,
0.1541748046875,
0.036834716796875,
0.876953125,
-0.0247955322265625,
0.244140625,
0.1302490234375,
-0.1304931640625,
-0.470703125,
-0.11138916015625,
-0.146484375,
0.467041015625,
-0.54052734375,
-0.152099609375,
-0.005786895751953125,
0.06915283203125,
-0.7880859375,
-0.01491546630859375,
-0.2393798828125,
-1.0107421875,
-0.254638671875,
0.669921875,
0.359619140625,
0.357666015625,
-0.2357177734375,
-0.783203125,
0.4228515625,
1.3583984375,
-0.406005859375,
0.28759765625,
0.1871337890625,
-0.221923828125,
-0.037322998046875,
0.1590576171875,
0.3798828125,
-0.20068359375,
-0.603515625,
0.79248046875,
-0.261962890625,
0.341796875,
0.1595458984375,
0.69384765625,
0.2371826171875,
0.73681640625,
-0.33447265625,
-0.52392578125,
0.338134765625,
1.134765625,
-0.061187744140625,
0.59765625,
0.0770263671875,
0.77783203125,
0.41015625,
0.80224609375,
0.552734375,
-0.1962890625,
0.259765625,
0.94140625,
0.28515625,
0.215576171875,
0.2396240234375,
0.408203125,
0.71826171875,
0.276123046875,
0.053192138671875,
0.433837890625,
0.07708740234375,
0.035186767578125,
-0.521484375,
0.240478515625,
-0.56298828125,
1.0498046875,
0.0699462890625,
0.21240234375,
-0.449951171875,
-0.1688232421875,
0.062255859375,
0.474853515625,
-0.63232421875,
-0.82373046875,
0.03643798828125,
0.00922393798828125,
0.28369140625,
0.207763671875,
0.54736328125,
0.7646484375,
0.09088134765625,
0.5830078125,
-0.268798828125,
-0.29541015625,
-0.77685546875,
-0.70458984375,
-0.93701171875,
-0.408447265625,
-0.76416015625,
-0.2215576171875,
0.49365234375,
-0.8994140625,
0.71826171875,
-0.40185546875,
0.0704345703125,
-0.34228515625,
-0.468017578125,
0.6748046875,
-0.0826416015625,
0.62890625,
-0.4755859375,
0.2308349609375,
0.0294342041015625,
0.9013671875,
-0.337646484375,
-0.2237548828125,
-0.3173828125,
-0.55908203125,
0.25146484375,
0.029510498046875,
0.5810546875,
0.25830078125,
-0.52783203125,
-0.7314453125,
-0.67724609375,
-0.371337890625,
-0.4736328125,
0.32958984375,
-0.396240234375,
0.8408203125,
0.57421875,
-0.71728515625,
0.48193359375,
1.0185546875,
-1.099609375,
0.73193359375,
0.484619140625,
-0.12164306640625,
-0.4990234375,
1.0068359375,
0.2296142578125,
0.529296875,
-0.48291015625,
-0.6953125,
-0.349853515625,
0.237060546875,
-0.08367919921875,
-0.66845703125,
-0.491943359375,
0.7373046875,
-0.2998046875,
-0.91552734375,
0.319091796875,
-1.0234375,
-0.31005859375,
-0.46630859375,
-0.09381103515625,
0.88720703125,
0.97998046875,
0.4072265625,
-0.258544921875,
-0.447265625,
-0.052001953125,
0.67333984375,
0.65478515625,
-0.224365234375,
-0.0178985595703125,
0.8759765625,
0.170166015625,
0.3291015625,
0.223876953125,
-0.31396484375,
0.037445068359375,
-0.142578125,
0.067138671875,
0.461181640625,
0.307861328125,
-0.046234130859375,
0.4375,
0.5546875,
-0.86474609375,
-0.454833984375,
-0.475341796875,
0.76220703125,
-0.06231689453125,
0.419677734375,
0.36865234375,
-0.1536865234375,
-0.6083984375,
-0.94677734375,
0.440673828125,
0.396240234375,
0.5986328125,
-1.1376953125,
0.8955078125,
0.352294921875,
-0.372314453125,
-0.041168212890625,
-0.460205078125,
-0.08441162109375,
1.1279296875,
0.05511474609375,
0.67529296875,
-0.67919921875,
0.560546875,
0.2191162109375,
0.2236328125,
0.95166015625,
0.353271484375,
0.1871337890625,
-0.2276611328125,
-0.478759765625,
-0.322021484375,
0.10614013671875,
-0.24853515625,
-0.290283203125,
0.404541015625,
0.0936279296875,
-0.2705078125,
-0.67822265625,
0.451904296875,
0.70458984375,
0.47900390625,
-0.2763671875,
0.5205078125,
0.25244140625,
0.391845703125,
0.494873046875,
-0.106689453125,
0.3046875,
-0.76123046875,
0.6953125,
-0.0535888671875,
-0.2486572265625,
-0.346923828125,
-0.1458740234375,
0.08392333984375,
0.1337890625,
0.37744140625,
0.056732177734375,
-0.810546875,
0.0972900390625,
0.1885986328125,
0.57373046875,
-0.415283203125,
-0.319580078125,
-0.430908203125,
0.440673828125,
0.15283203125,
-0.765625,
0.39697265625,
-0.8876953125,
0.61767578125,
0.152587890625,
-0.10601806640625,
-0.217529296875,
-0.63623046875,
-0.845703125,
-0.6337890625,
-0.049560546875,
1.10546875,
0.068115234375,
-0.167724609375,
-1.1279296875,
0.2171630859375,
0.26611328125,
-0.218994140625,
-0.1754150390625,
-0.372802734375,
0.2335205078125,
-0.09100341796875,
0.300048828125,
-0.880859375,
-0.86474609375,
0.00975799560546875,
-1.2880859375,
0.6875,
-0.54052734375,
0.80810546875,
-0.378173828125,
-0.30908203125,
0.0672607421875,
-0.2113037109375,
-0.40625,
-0.0260467529296875,
-0.41162109375,
0.48095703125,
-0.82958984375,
-0.61376953125,
0.41845703125,
-0.339111328125,
-0.3154296875,
1.03125,
-0.05377197265625,
-0.387451171875,
-0.0372314453125,
0.42919921875,
-0.58349609375,
0.310791015625,
-0.498779296875,
0.58740234375,
-0.342529296875,
-0.75830078125,
-0.319091796875,
-0.8203125,
0.794921875,
-0.11468505859375,
-0.9150390625,
-0.13916015625,
-1.1064453125,
-0.209716796875,
0.0302276611328125,
-0.47119140625,
0.249755859375,
0.2841796875,
-0.3671875,
0.1851806640625,
-0.3671875,
-0.262451171875,
-0.4169921875,
-0.59326171875,
-0.51220703125,
0.174072265625,
0.08172607421875,
0.921875,
-0.11669921875,
-0.130859375,
0.1683349609375,
-0.1263427734375,
0.0302276611328125,
-0.312255859375,
-0.462646484375,
-0.010894775390625,
-0.302978515625,
-0.317138671875,
0.369140625,
-0.053680419921875,
0.52880859375,
0.8828125,
0.04925537109375,
0.291259765625,
0.50390625,
-0.51904296875,
0.755859375,
-0.242919921875,
-0.58544921875,
-0.29541015625,
0.8095703125,
0.1220703125,
0.71044921875,
0.1976318359375,
-1.0244140625,
-0.7509765625,
-0.671875,
-0.135986328125,
-0.6162109375,
0.041107177734375,
-1.080078125,
-0.193115234375,
-0.57861328125,
0.3466796875,
-0.0439453125,
-0.6279296875,
0.055145263671875,
-0.73974609375,
0.252685546875,
-0.845703125,
-0.19775390625,
-0.7646484375,
-0.374267578125,
0.25048828125,
0.74658203125,
0.1474609375,
0.65576171875,
0.286376953125,
0.036102294921875,
0.256591796875,
-0.160888671875,
-0.45068359375,
-0.450927734375,
-0.45166015625,
0.3671875,
-0.2666015625,
0.02996826171875,
-0.47314453125,
0.69580078125,
-0.79931640625,
0.13330078125,
-0.395751953125,
-0.174560546875,
0.190673828125,
0.01348114013671875,
1.1728515625,
0.06756591796875,
0.10211181640625,
-0.054595947265625,
0.45654296875,
0.47412109375,
-0.313232421875,
-0.53759765625,
-0.228271484375,
-0.650390625,
-0.85791015625,
0.7890625,
-0.490966796875,
0.0963134765625,
-0.4365234375,
-0.4658203125,
1.0771484375,
-0.459716796875,
0.386474609375,
1.185546875,
0.0338134765625,
0.6875,
-0.353271484375,
0.640625,
0.49853515625,
-0.32861328125,
-0.1728515625,
0.045196533203125,
-0.61767578125,
0.0987548828125,
-0.65771484375,
-0.95849609375,
-0.80517578125,
0.333984375,
1.2099609375,
-0.0266265869140625,
0.81689453125,
0.1732177734375,
-1.0205078125,
-0.69189453125,
1.1005859375,
0.50537109375,
0.09912109375,
1.1337890625,
-0.23388671875,
0.09136962890625,
-0.22509765625,
-0.1610107421875,
-0.365478515625,
-0.46337890625,
1.048828125,
-0.994140625,
-0.55859375,
0.66943359375,
0.7939453125,
-1.115234375,
-0.97314453125,
-0.67626953125,
-0.2098388671875,
0.2330322265625,
-0.56982421875,
0.106201171875,
0.323974609375,
-0.397705078125,
0.02520751953125,
0.229248046875,
0.06976318359375,
0.447021484375,
0.140625,
-0.03961181640625,
-0.44921875,
0.380615234375,
0.475830078125,
-0.80712890625,
0.00893402099609375,
-0.9365234375,
0.1885986328125,
-0.08740234375,
-0.05169677734375,
0.91162109375,
-0.2158203125,
0.3984375,
0.140625,
-0.294677734375,
0.310302734375,
-0.61474609375,
-0.3515625,
0.65283203125,
-0.30419921875,
-0.373291015625,
-0.2369384765625,
0.64990234375,
-0.1632080078125,
0.06549072265625,
-0.350830078125,
-0.1082763671875,
0.1470947265625,
0.466064453125,
-0.50927734375,
-0.96044921875,
-0.19287109375,
-1.37890625,
-0.5966796875,
-0.55517578125,
-0.311279296875,
0.2413330078125,
0.387939453125,
-0.238037109375,
-0.5546875,
0.18896484375,
0.513671875,
-0.388671875,
0.8203125,
-0.81787109375,
0.29833984375,
-0.3515625,
-0.1351318359375,
-0.8251953125,
-0.06500244140625,
-0.29736328125,
-0.164794921875,
-0.5791015625,
0.2437744140625,
-0.1988525390625,
0.436767578125,
-0.07220458984375,
0.22412109375,
-0.4228515625,
-0.6640625,
-0.2083740234375,
0.054412841796875,
-0.11572265625,
0.8515625,
0.68603515625,
-0.443115234375,
0.2205810546875,
-0.06536865234375,
-0.262939453125,
-0.57421875,
0.48828125,
0.6005859375,
-0.438232421875,
-0.33154296875,
0.1898193359375,
0.411376953125,
-1.0068359375,
0.207763671875,
-0.53564453125,
0.4716796875,
0.037841796875,
-0.2177734375,
0.818359375,
1.0703125,
-0.296875,
0.1409912109375,
-0.1309814453125,
-0.036041259765625,
0.82568359375,
0.0037441253662109375,
0.041351318359375,
0.39111328125,
0.10076904296875,
-0.52978515625,
0.03546142578125,
0.287109375,
-0.1448974609375,
-0.008544921875,
-0.027374267578125,
-0.43701171875,
-0.85693359375,
-0.147216796875,
-0.286865234375,
0.5126953125,
0.52685546875,
-0.311279296875,
0.337158203125,
-0.217529296875,
-0.35693359375,
0.55078125,
-1.2587890625,
-0.888671875,
0.04241943359375,
0.05706787109375,
-0.356201171875,
-0.09222412109375,
-0.483154296875,
-0.11993408203125,
-0.282470703125,
0.3369140625,
-0.2293701171875,
0.4111328125,
-0.322021484375,
0.56689453125,
-0.11407470703125,
-0.383056640625,
-0.177734375,
0.69677734375,
-0.26171875,
-0.8369140625,
-0.09100341796875,
0.951171875,
0.238037109375,
-0.1090087890625,
-0.016632080078125,
0.1689453125,
0.0039005279541015625,
0.25732421875,
-0.53857421875,
0.261474609375,
-0.337646484375,
0.51708984375,
-1.18359375,
-0.356201171875,
0.06396484375,
0.363525390625,
0.287841796875,
-0.54638671875,
-0.333740234375,
0.8359375,
0.65576171875,
-0.0155792236328125,
0.313232421875,
0.06658935546875,
0.379638671875,
-0.1900634765625,
0.00775146484375,
-0.31396484375,
0.6357421875,
0.83203125,
0.54638671875,
-0.026214599609375,
0.1922607421875,
0.68505859375,
-0.414306640625,
-0.580078125,
0.3642578125,
0.0433349609375,
-0.11041259765625,
0.5966796875,
-0.087158203125,
-0.002666473388671875,
-0.2958984375,
-0.43212890625,
0.34716796875,
-0.25341796875,
-0.04937744140625,
-0.07147216796875,
-0.5146484375,
1.24609375,
-0.393798828125,
-0.07440185546875,
0.1424560546875,
-0.66650390625,
0.458984375,
0.71875,
-0.230224609375,
-0.345703125,
0.71728515625,
0.6787109375,
0.493896484375,
0.67822265625,
0.493896484375,
0.08209228515625,
-0.85791015625,
0.2115478515625,
-0.131103515625,
0.254638671875,
-0.525390625,
-0.384033203125,
-1.275390625,
0.37060546875,
-0.0134735107421875,
-0.341552734375,
0.7392578125,
-0.841796875,
-0.0611572265625,
0.001132965087890625,
0.4599609375,
-0.837890625,
0.51123046875,
0.53173828125,
-0.2315673828125,
-0.50927734375,
0.88134765625,
-0.10296630859375,
0.283203125,
0.0892333984375,
1.265625,
-0.075439453125,
1.3818359375,
0.387939453125,
0.144775390625,
0.303955078125,
0.431396484375,
-0.787109375,
-0.80712890625,
-0.36181640625,
-0.4619140625,
-0.0325927734375,
-0.435546875,
-0.2440185546875,
-0.2440185546875,
0.81884765625,
-0.06475830078125,
-0.98046875,
-0.3564453125,
0.0117340087890625,
-1.1611328125,
0.5810546875,
0.459716796875,
0.350830078125,
0.1968994140625,
-0.149658203125,
0.002841949462890625,
-0.412353515625,
0.0469970703125,
-0.5556640625,
0.509765625,
-0.9169921875,
-0.412841796875,
-0.295166015625,
-0.62939453125,
-0.58642578125,
0.24365234375,
-0.703125,
-0.76171875,
0.46630859375,
0.47119140625,
0.28369140625,
0.38330078125,
-0.27880859375,
-0.21728515625,
0.90087890625,
0.92529296875,
0.1551513671875,
0.6962890625,
0.357177734375,
-0.35595703125,
-0.1259765625,
-0.935546875,
0.431884765625,
-0.268798828125,
-0.036834716796875,
-0.55419921875,
0.37353515625,
-0.5341796875,
-1.3896484375,
-0.1614990234375,
0.476806640625,
0.14697265625,
-0.775390625,
-1.0859375,
-0.208251953125,
-1.2939453125,
-0.378173828125,
-0.66064453125,
0.96484375,
-0.050506591796875,
0.0009899139404296875,
-0.0209808349609375,
-1.1923828125,
4.48828125,
0.771484375,
0.6611328125,
0.25146484375,
0.2978515625,
1.296875,
0.5625,
-0.383544921875,
-0.64208984375,
-0.162353515625,
0.3583984375,
-0.2071533203125,
0.07958984375,
0.76123046875,
0.65087890625,
0.3701171875,
-0.6298828125,
-0.2376708984375,
-0.027862548828125,
-0.92822265625,
-0.62890625,
-0.1273193359375,
0.1708984375,
0.54638671875,
0.420654296875,
0.51611328125,
0.52880859375,
-0.83447265625,
0.017333984375,
-0.6806640625,
0.482177734375,
-0.87939453125,
0.81494140625,
0.438720703125,
-0.484619140625,
0.6474609375,
0.15771484375,
-0.19189453125,
-0.226318359375,
0.2958984375,
-0.18017578125,
-0.052886962890625,
0.171875,
-0.366455078125,
0.0699462890625,
-0.06292724609375,
-0.60205078125,
0.409912109375,
0.310791015625,
-0.9892578125,
0.64013671875,
-0.1363525390625,
0.17333984375,
-0.41796875,
-0.84716796875,
0.474365234375,
-0.07183837890625,
0.1510009765625,
-0.1630859375,
0.92822265625,
0.308837890625,
-0.04522705078125,
-0.138427734375,
0.399658203125,
-1.009765625,
0.99365234375,
-0.1739501953125,
0.45947265625,
-0.40625,
0.00433349609375,
-0.205078125,
-0.67431640625,
-0.489501953125,
-0.6572265625,
0.52099609375,
0.54052734375,
0.194091796875,
0.61474609375,
0.56982421875,
-0.9072265625,
0.11181640625,
0.258056640625,
-0.163330078125,
-0.0037689208984375,
0.71240234375,
1.2900390625,
-0.77001953125,
-0.331787109375,
-0.304931640625,
0.552734375,
0.87744140625,
0.66357421875,
0.131103515625,
-0.78759765625,
-0.181640625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Tags: implementation
Correct Solution:
```
a = input()
b = ['A', 'E', 'I', 'O', 'U', 'Y']
c = []
c.append(-1)
for i in range(len(a)):
if a[i] in b:
c.append(i)
c.append(len(a))
ans = 0
for i in range(len(c) - 1):
ans = max(ans, c[i + 1] - c[i])
print(ans)
```
| 35,632
|
[
0.169189453125,
-0.177734375,
-0.3212890625,
0.66796875,
-0.458251953125,
-0.32568359375,
0.5390625,
-0.0251312255859375,
0.240966796875,
0.7568359375,
0.487548828125,
-0.0024738311767578125,
0.083251953125,
-0.72509765625,
-0.630859375,
0.1956787109375,
-0.923828125,
-0.423095703125,
-0.6171875,
-0.1783447265625,
0.197021484375,
-0.374755859375,
-1.1220703125,
0.02532958984375,
-0.08905029296875,
0.630859375,
0.441162109375,
-0.01654052734375,
1.0634765625,
1.01171875,
0.30908203125,
-0.254638671875,
0.035675048828125,
-1.158203125,
-0.439453125,
-0.308349609375,
0.2332763671875,
-0.64111328125,
-0.4716796875,
-0.28759765625,
0.4052734375,
-0.108154296875,
0.744140625,
-0.66162109375,
-1.1181640625,
-0.17138671875,
-0.252197265625,
-0.341796875,
-0.298828125,
-0.6220703125,
0.4638671875,
-0.256103515625,
0.541015625,
-0.167724609375,
-0.263671875,
-0.3212890625,
0.252685546875,
-0.2122802734375,
-1.0107421875,
0.166748046875,
-0.07275390625,
0.48583984375,
0.216064453125,
-0.59033203125,
-0.2451171875,
0.45166015625,
-0.1240234375,
-0.12548828125,
-0.1373291015625,
-0.64013671875,
-0.2626953125,
0.457763671875,
-0.492431640625,
-0.458251953125,
-0.51171875,
0.059478759765625,
0.00681304931640625,
0.0009946823120117188,
-0.69677734375,
0.81201171875,
0.2349853515625,
0.88623046875,
-0.308837890625,
0.142333984375,
-0.390869140625,
-0.4423828125,
-0.09844970703125,
0.2099609375,
0.2415771484375,
-0.08416748046875,
-0.375,
0.525390625,
-0.4140625,
0.09051513671875,
0.5712890625,
0.513671875,
-0.364990234375,
0.52197265625,
0.478515625,
0.10516357421875,
0.744140625,
1.0869140625,
-0.50537109375,
0.82470703125,
-0.45458984375,
0.29248046875,
0.2490234375,
-0.1475830078125,
-0.026336669921875,
-0.513671875,
-0.204345703125,
-0.007793426513671875,
0.25830078125,
0.25,
-0.6171875,
0.84521484375,
0.05950927734375,
0.42236328125,
-0.77294921875,
0.78173828125,
0.274169921875,
0.1414794921875,
0.5107421875,
0.055755615234375,
0.2330322265625,
-0.58154296875,
-0.51416015625,
0.978515625,
-0.447265625,
0.332763671875,
0.09759521484375,
-0.23583984375,
-0.44287109375,
0.446533203125,
-0.4765625,
0.61181640625,
-0.425048828125,
0.74658203125,
0.56982421875,
-0.92626953125,
0.53857421875,
-0.308837890625,
0.07623291015625,
1.41015625,
0.5654296875,
-0.12225341796875,
0.50341796875,
0.294189453125,
-0.6572265625,
0.36181640625,
-0.93798828125,
0.7587890625,
0.12103271484375,
0.259521484375,
-0.192138671875,
0.2247314453125,
-0.277587890625,
0.33154296875,
0.20556640625,
0.1033935546875,
-0.3662109375,
-0.06817626953125,
-0.55322265625,
0.88330078125,
-0.416015625,
0.62646484375,
-0.474365234375,
-0.12890625,
-0.336669921875,
-0.29931640625,
0.07757568359375,
0.1773681640625,
0.12164306640625,
0.88720703125,
0.11865234375,
1.302734375,
0.94873046875,
0.1248779296875,
0.401123046875,
0.47412109375,
-0.2073974609375,
0.1773681640625,
0.04888916015625,
0.9091796875,
0.0007691383361816406,
0.266357421875,
0.1429443359375,
-0.083984375,
-0.41943359375,
-0.1614990234375,
-0.138916015625,
0.447265625,
-0.6220703125,
-0.1527099609375,
0.017333984375,
0.0859375,
-0.74365234375,
-0.00397491455078125,
-0.2288818359375,
-1.01171875,
-0.29541015625,
0.71240234375,
0.36083984375,
0.37744140625,
-0.279541015625,
-0.73876953125,
0.384033203125,
1.3759765625,
-0.4013671875,
0.2462158203125,
0.216796875,
-0.2271728515625,
0.005046844482421875,
0.159912109375,
0.39013671875,
-0.238037109375,
-0.57470703125,
0.818359375,
-0.274169921875,
0.372802734375,
0.160400390625,
0.662109375,
0.272216796875,
0.6806640625,
-0.3173828125,
-0.56689453125,
0.30712890625,
1.1845703125,
-0.049591064453125,
0.5908203125,
0.01171112060546875,
0.7431640625,
0.451416015625,
0.81689453125,
0.57470703125,
-0.1571044921875,
0.2890625,
0.9287109375,
0.285888671875,
0.2076416015625,
0.2388916015625,
0.427490234375,
0.6845703125,
0.240478515625,
0.09368896484375,
0.476318359375,
0.01499176025390625,
0.0499267578125,
-0.5,
0.2320556640625,
-0.615234375,
1.1025390625,
0.12451171875,
0.2471923828125,
-0.407470703125,
-0.17626953125,
0.097900390625,
0.5087890625,
-0.62255859375,
-0.79052734375,
0.020843505859375,
0.037078857421875,
0.31103515625,
0.207763671875,
0.5576171875,
0.75830078125,
0.09136962890625,
0.54833984375,
-0.280029296875,
-0.281005859375,
-0.80615234375,
-0.775390625,
-0.95849609375,
-0.43310546875,
-0.70068359375,
-0.2305908203125,
0.51513671875,
-0.93603515625,
0.6826171875,
-0.392333984375,
0.06646728515625,
-0.33154296875,
-0.429931640625,
0.64208984375,
-0.1070556640625,
0.67431640625,
-0.51123046875,
0.26513671875,
0.077880859375,
0.90478515625,
-0.34033203125,
-0.22802734375,
-0.2998046875,
-0.5830078125,
0.267578125,
0.04119873046875,
0.56396484375,
0.25244140625,
-0.57666015625,
-0.75439453125,
-0.640625,
-0.352783203125,
-0.483154296875,
0.3046875,
-0.430419921875,
0.82177734375,
0.5908203125,
-0.744140625,
0.49658203125,
1.0126953125,
-1.1279296875,
0.75537109375,
0.505859375,
-0.1549072265625,
-0.51123046875,
1.0439453125,
0.240966796875,
0.50048828125,
-0.49609375,
-0.71240234375,
-0.343505859375,
0.25341796875,
-0.0693359375,
-0.69775390625,
-0.480224609375,
0.68994140625,
-0.317138671875,
-0.8984375,
0.3662109375,
-1.060546875,
-0.34423828125,
-0.425537109375,
-0.11181640625,
0.900390625,
1.015625,
0.4267578125,
-0.238037109375,
-0.48193359375,
-0.0589599609375,
0.70703125,
0.68212890625,
-0.155029296875,
-0.0005125999450683594,
0.8955078125,
0.1632080078125,
0.312744140625,
0.227783203125,
-0.314453125,
0.0079345703125,
-0.117919921875,
0.07916259765625,
0.47021484375,
0.34765625,
-0.046905517578125,
0.39697265625,
0.6240234375,
-0.87060546875,
-0.448486328125,
-0.409423828125,
0.7490234375,
-0.0267791748046875,
0.44775390625,
0.356201171875,
-0.1444091796875,
-0.6728515625,
-0.99951171875,
0.446044921875,
0.388671875,
0.63232421875,
-1.14453125,
0.87890625,
0.353271484375,
-0.3681640625,
0.018707275390625,
-0.456298828125,
-0.07000732421875,
1.1591796875,
0.040679931640625,
0.7158203125,
-0.7578125,
0.50341796875,
0.208984375,
0.212890625,
0.9658203125,
0.35888671875,
0.2266845703125,
-0.1875,
-0.51953125,
-0.2900390625,
0.165283203125,
-0.2469482421875,
-0.282470703125,
0.368408203125,
0.050994873046875,
-0.249267578125,
-0.6611328125,
0.427001953125,
0.72119140625,
0.414794921875,
-0.310302734375,
0.52392578125,
0.196533203125,
0.407958984375,
0.486328125,
-0.07373046875,
0.30419921875,
-0.75,
0.7177734375,
0.00396728515625,
-0.2685546875,
-0.364013671875,
-0.1671142578125,
0.07781982421875,
0.1279296875,
0.406005859375,
0.043731689453125,
-0.84521484375,
0.1138916015625,
0.167236328125,
0.580078125,
-0.369384765625,
-0.392578125,
-0.39599609375,
0.438232421875,
0.1522216796875,
-0.8076171875,
0.42822265625,
-0.87646484375,
0.60986328125,
0.181884765625,
-0.06201171875,
-0.25,
-0.62109375,
-0.8125,
-0.65087890625,
-0.06268310546875,
1.1630859375,
0.0545654296875,
-0.1790771484375,
-1.1513671875,
0.2032470703125,
0.29345703125,
-0.186279296875,
-0.1666259765625,
-0.401123046875,
0.2235107421875,
-0.127685546875,
0.342041015625,
-0.82568359375,
-0.90234375,
0.0302886962890625,
-1.2978515625,
0.68896484375,
-0.537109375,
0.7431640625,
-0.378173828125,
-0.30322265625,
0.0684814453125,
-0.1983642578125,
-0.352783203125,
-0.03619384765625,
-0.373046875,
0.45166015625,
-0.82470703125,
-0.57763671875,
0.430419921875,
-0.37841796875,
-0.37451171875,
1.0517578125,
-0.0010356903076171875,
-0.380859375,
-0.052642822265625,
0.3955078125,
-0.5556640625,
0.375,
-0.48193359375,
0.6240234375,
-0.361572265625,
-0.7578125,
-0.303466796875,
-0.78271484375,
0.78271484375,
-0.10247802734375,
-0.92041015625,
-0.1978759765625,
-1.1259765625,
-0.2362060546875,
0.06317138671875,
-0.482177734375,
0.26416015625,
0.316650390625,
-0.373779296875,
0.1981201171875,
-0.42822265625,
-0.329833984375,
-0.434814453125,
-0.568359375,
-0.54150390625,
0.2349853515625,
0.09820556640625,
0.88916015625,
-0.0789794921875,
-0.1607666015625,
0.1571044921875,
-0.1231689453125,
0.0667724609375,
-0.380126953125,
-0.497802734375,
0.014739990234375,
-0.34228515625,
-0.339111328125,
0.359375,
-0.06390380859375,
0.51513671875,
0.912109375,
0.0293731689453125,
0.369873046875,
0.5205078125,
-0.5517578125,
0.751953125,
-0.26611328125,
-0.62255859375,
-0.353271484375,
0.8017578125,
0.164306640625,
0.69873046875,
0.26025390625,
-1.037109375,
-0.7705078125,
-0.69384765625,
-0.156005859375,
-0.61767578125,
0.0374755859375,
-1.0517578125,
-0.2403564453125,
-0.5966796875,
0.38525390625,
0.031280517578125,
-0.64306640625,
-0.05181884765625,
-0.76123046875,
0.29296875,
-0.83837890625,
-0.147216796875,
-0.7822265625,
-0.35595703125,
0.236083984375,
0.71435546875,
0.166259765625,
0.6396484375,
0.296142578125,
0.0048980712890625,
0.279296875,
-0.1602783203125,
-0.44482421875,
-0.49365234375,
-0.41650390625,
0.334228515625,
-0.26904296875,
0.0019359588623046875,
-0.49267578125,
0.7314453125,
-0.85693359375,
0.1632080078125,
-0.430419921875,
-0.169921875,
0.1591796875,
-0.0687255859375,
1.181640625,
0.08563232421875,
0.09991455078125,
-0.12359619140625,
0.481201171875,
0.473388671875,
-0.276611328125,
-0.54345703125,
-0.2154541015625,
-0.62890625,
-0.8701171875,
0.78564453125,
-0.486083984375,
0.1082763671875,
-0.43603515625,
-0.416015625,
1.0830078125,
-0.426513671875,
0.411865234375,
1.2158203125,
-0.00695037841796875,
0.72119140625,
-0.356689453125,
0.6083984375,
0.435546875,
-0.341064453125,
-0.1595458984375,
0.060638427734375,
-0.6513671875,
0.06707763671875,
-0.59716796875,
-0.97314453125,
-0.78662109375,
0.34423828125,
1.24609375,
-0.07794189453125,
0.81103515625,
0.203857421875,
-1.041015625,
-0.708984375,
1.1552734375,
0.5244140625,
0.09051513671875,
1.1513671875,
-0.28466796875,
0.07452392578125,
-0.2705078125,
-0.1629638671875,
-0.38232421875,
-0.455322265625,
1.064453125,
-0.9658203125,
-0.57421875,
0.67724609375,
0.82958984375,
-1.1123046875,
-1.0458984375,
-0.63818359375,
-0.2476806640625,
0.22412109375,
-0.5322265625,
0.10565185546875,
0.31201171875,
-0.401123046875,
0.054931640625,
0.27197265625,
0.04876708984375,
0.405517578125,
0.1717529296875,
-0.006328582763671875,
-0.40234375,
0.453369140625,
0.50341796875,
-0.83154296875,
-0.010955810546875,
-0.95654296875,
0.2379150390625,
-0.11334228515625,
-0.06591796875,
0.9228515625,
-0.2418212890625,
0.3671875,
0.11029052734375,
-0.3095703125,
0.29736328125,
-0.6484375,
-0.3564453125,
0.66259765625,
-0.333740234375,
-0.39501953125,
-0.2001953125,
0.626953125,
-0.13525390625,
0.08135986328125,
-0.363525390625,
-0.0523681640625,
0.15087890625,
0.4169921875,
-0.465576171875,
-0.994140625,
-0.1827392578125,
-1.36328125,
-0.5830078125,
-0.5654296875,
-0.278076171875,
0.1956787109375,
0.389404296875,
-0.2030029296875,
-0.671875,
0.1656494140625,
0.50634765625,
-0.365234375,
0.78662109375,
-0.826171875,
0.308837890625,
-0.345458984375,
-0.156005859375,
-0.79833984375,
-0.06390380859375,
-0.332275390625,
-0.17333984375,
-0.599609375,
0.2298583984375,
-0.2218017578125,
0.485107421875,
-0.06610107421875,
0.1959228515625,
-0.391357421875,
-0.6640625,
-0.2056884765625,
0.06268310546875,
-0.08856201171875,
0.849609375,
0.74951171875,
-0.4765625,
0.1903076171875,
-0.034454345703125,
-0.304931640625,
-0.58642578125,
0.49560546875,
0.59716796875,
-0.4462890625,
-0.32666015625,
0.205322265625,
0.443603515625,
-1.0126953125,
0.175048828125,
-0.515625,
0.48193359375,
0.11859130859375,
-0.258056640625,
0.85302734375,
1.0498046875,
-0.2802734375,
0.1456298828125,
-0.142578125,
-0.01361083984375,
0.85400390625,
0.02471923828125,
0.08978271484375,
0.41796875,
0.06390380859375,
-0.556640625,
0.035980224609375,
0.298828125,
-0.1558837890625,
-0.0066986083984375,
-0.03631591796875,
-0.4765625,
-0.87060546875,
-0.12420654296875,
-0.281005859375,
0.4833984375,
0.50927734375,
-0.289794921875,
0.289794921875,
-0.22607421875,
-0.37109375,
0.5400390625,
-1.3564453125,
-0.896484375,
0.078857421875,
0.131103515625,
-0.3916015625,
-0.17333984375,
-0.48876953125,
-0.119140625,
-0.283203125,
0.310546875,
-0.30322265625,
0.41259765625,
-0.379150390625,
0.57861328125,
-0.140869140625,
-0.338623046875,
-0.15380859375,
0.66015625,
-0.345458984375,
-0.853515625,
-0.10638427734375,
1.017578125,
0.242919921875,
-0.10711669921875,
-0.037353515625,
0.1871337890625,
0.01078033447265625,
0.2132568359375,
-0.62060546875,
0.249267578125,
-0.332763671875,
0.49609375,
-1.1982421875,
-0.414306640625,
0.048553466796875,
0.41845703125,
0.25390625,
-0.5537109375,
-0.2958984375,
0.81591796875,
0.6357421875,
-0.0245361328125,
0.306640625,
0.0703125,
0.3935546875,
-0.1905517578125,
0.0465087890625,
-0.265869140625,
0.65380859375,
0.8603515625,
0.578125,
-0.051055908203125,
0.1689453125,
0.6884765625,
-0.391845703125,
-0.57958984375,
0.391845703125,
0.07769775390625,
-0.1290283203125,
0.53515625,
-0.1099853515625,
-0.01541900634765625,
-0.290283203125,
-0.40380859375,
0.30908203125,
-0.269775390625,
-0.077880859375,
-0.0787353515625,
-0.57470703125,
1.2314453125,
-0.370361328125,
-0.10736083984375,
0.15576171875,
-0.6591796875,
0.481689453125,
0.75,
-0.2174072265625,
-0.355712890625,
0.75341796875,
0.70068359375,
0.5205078125,
0.6728515625,
0.496826171875,
0.05859375,
-0.8359375,
0.1925048828125,
-0.1070556640625,
0.2578125,
-0.54150390625,
-0.375732421875,
-1.271484375,
0.348388671875,
-0.015533447265625,
-0.369384765625,
0.77587890625,
-0.83740234375,
-0.035430908203125,
-0.034759521484375,
0.50048828125,
-0.8388671875,
0.4892578125,
0.53271484375,
-0.27392578125,
-0.50439453125,
0.865234375,
-0.0789794921875,
0.288818359375,
0.078125,
1.328125,
-0.02117919921875,
1.3623046875,
0.39697265625,
0.1312255859375,
0.34228515625,
0.431396484375,
-0.74755859375,
-0.87158203125,
-0.360595703125,
-0.418212890625,
-0.007045745849609375,
-0.472412109375,
-0.3134765625,
-0.2122802734375,
0.8173828125,
-0.0226898193359375,
-0.982421875,
-0.305419921875,
0.03802490234375,
-1.169921875,
0.537109375,
0.4521484375,
0.326416015625,
0.223876953125,
-0.084716796875,
-0.0013103485107421875,
-0.42578125,
0.040802001953125,
-0.5439453125,
0.50830078125,
-0.93505859375,
-0.452880859375,
-0.28125,
-0.61962890625,
-0.5927734375,
0.2467041015625,
-0.755859375,
-0.75048828125,
0.4658203125,
0.52587890625,
0.296875,
0.3642578125,
-0.276123046875,
-0.2142333984375,
0.92333984375,
0.89208984375,
0.135986328125,
0.7265625,
0.3271484375,
-0.367431640625,
-0.11669921875,
-0.97314453125,
0.420654296875,
-0.2379150390625,
-0.056304931640625,
-0.55224609375,
0.367431640625,
-0.5595703125,
-1.41796875,
-0.152099609375,
0.4521484375,
0.1669921875,
-0.80615234375,
-1.1025390625,
-0.194580078125,
-1.3603515625,
-0.364013671875,
-0.671875,
0.98095703125,
-0.02325439453125,
0.0301971435546875,
-0.057464599609375,
-1.2099609375,
4.44140625,
0.76708984375,
0.6611328125,
0.258056640625,
0.333251953125,
1.287109375,
0.62353515625,
-0.41845703125,
-0.6708984375,
-0.187255859375,
0.389404296875,
-0.1793212890625,
0.1016845703125,
0.7607421875,
0.70703125,
0.365478515625,
-0.6220703125,
-0.2266845703125,
-0.044830322265625,
-0.97412109375,
-0.6181640625,
-0.051422119140625,
0.2255859375,
0.572265625,
0.439453125,
0.5126953125,
0.54052734375,
-0.81884765625,
0.0784912109375,
-0.6962890625,
0.44970703125,
-0.86083984375,
0.818359375,
0.4296875,
-0.483642578125,
0.60498046875,
0.09661865234375,
-0.2247314453125,
-0.1890869140625,
0.297119140625,
-0.200439453125,
-0.0921630859375,
0.179443359375,
-0.36328125,
0.0849609375,
-0.0273590087890625,
-0.544921875,
0.403564453125,
0.3134765625,
-1.009765625,
0.61376953125,
-0.15478515625,
0.18505859375,
-0.44873046875,
-0.88818359375,
0.4287109375,
-0.07891845703125,
0.143310546875,
-0.1412353515625,
0.94677734375,
0.292724609375,
-0.0175933837890625,
-0.1490478515625,
0.4560546875,
-1.0126953125,
1.0224609375,
-0.1837158203125,
0.420166015625,
-0.379638671875,
0.030426025390625,
-0.1585693359375,
-0.66357421875,
-0.490966796875,
-0.69189453125,
0.476318359375,
0.5361328125,
0.1871337890625,
0.62890625,
0.57373046875,
-0.89111328125,
0.018157958984375,
0.2275390625,
-0.142333984375,
-0.016204833984375,
0.66357421875,
1.328125,
-0.73681640625,
-0.316162109375,
-0.296875,
0.6240234375,
0.80224609375,
0.65185546875,
0.08953857421875,
-0.75439453125,
-0.2083740234375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Tags: implementation
Correct Solution:
```
s=str(input())
res,last=0,-1
for i in range(len(s)):
if(s[i] in 'AEIOUY'):
res=max(res,i-last)
last=i
if(last==-1):
print(len(s)+1)
else:
print(max(res,len(s)-last))
```
| 35,633
|
[
0.203857421875,
-0.1629638671875,
-0.360107421875,
0.724609375,
-0.419921875,
-0.314453125,
0.56103515625,
-0.0136260986328125,
0.1983642578125,
0.73046875,
0.52392578125,
-0.00507354736328125,
0.0870361328125,
-0.69384765625,
-0.62939453125,
0.1947021484375,
-0.90673828125,
-0.374267578125,
-0.650390625,
-0.1912841796875,
0.2164306640625,
-0.341064453125,
-1.095703125,
0.01061248779296875,
-0.07720947265625,
0.60205078125,
0.442138671875,
0.0122528076171875,
1.078125,
1.046875,
0.280029296875,
-0.22802734375,
0.0513916015625,
-1.16015625,
-0.45751953125,
-0.296630859375,
0.253173828125,
-0.65478515625,
-0.4560546875,
-0.2802734375,
0.392578125,
-0.07025146484375,
0.748046875,
-0.64306640625,
-1.107421875,
-0.200439453125,
-0.249267578125,
-0.3203125,
-0.355712890625,
-0.546875,
0.458251953125,
-0.260009765625,
0.56982421875,
-0.1693115234375,
-0.276611328125,
-0.406982421875,
0.24462890625,
-0.156982421875,
-0.97509765625,
0.11962890625,
-0.053192138671875,
0.47412109375,
0.225830078125,
-0.5849609375,
-0.247802734375,
0.4287109375,
-0.1378173828125,
-0.09515380859375,
-0.16845703125,
-0.66162109375,
-0.281494140625,
0.47216796875,
-0.470947265625,
-0.46826171875,
-0.54248046875,
0.03607177734375,
0.015960693359375,
-0.0279388427734375,
-0.6435546875,
0.81201171875,
0.2493896484375,
0.8544921875,
-0.286376953125,
0.0872802734375,
-0.386474609375,
-0.41455078125,
-0.08935546875,
0.238525390625,
0.2247314453125,
-0.124755859375,
-0.343994140625,
0.52978515625,
-0.4541015625,
0.10455322265625,
0.54443359375,
0.488525390625,
-0.326171875,
0.52294921875,
0.472900390625,
0.1295166015625,
0.69921875,
1.0859375,
-0.5185546875,
0.83544921875,
-0.441162109375,
0.31005859375,
0.2509765625,
-0.145263671875,
-0.0250701904296875,
-0.5009765625,
-0.23779296875,
-0.00948333740234375,
0.283447265625,
0.253662109375,
-0.587890625,
0.82470703125,
0.0302886962890625,
0.388671875,
-0.7666015625,
0.81689453125,
0.2379150390625,
0.10711669921875,
0.53125,
0.0031986236572265625,
0.2308349609375,
-0.56884765625,
-0.495361328125,
1.00390625,
-0.451171875,
0.34765625,
0.11419677734375,
-0.251953125,
-0.412109375,
0.467529296875,
-0.46484375,
0.64599609375,
-0.390625,
0.763671875,
0.51806640625,
-0.92626953125,
0.52490234375,
-0.3076171875,
0.10003662109375,
1.3662109375,
0.5556640625,
-0.156005859375,
0.485595703125,
0.31982421875,
-0.6728515625,
0.317138671875,
-0.92041015625,
0.7578125,
0.1343994140625,
0.269287109375,
-0.1656494140625,
0.2056884765625,
-0.294677734375,
0.336669921875,
0.1676025390625,
0.1153564453125,
-0.388427734375,
-0.10992431640625,
-0.5390625,
0.8388671875,
-0.455322265625,
0.57373046875,
-0.466796875,
-0.083251953125,
-0.345458984375,
-0.2939453125,
0.07855224609375,
0.225341796875,
0.10345458984375,
0.8779296875,
0.04595947265625,
1.31640625,
0.9453125,
0.1357421875,
0.3388671875,
0.49365234375,
-0.2288818359375,
0.1732177734375,
0.06390380859375,
0.8779296875,
-0.04345703125,
0.200927734375,
0.138427734375,
-0.0433349609375,
-0.45361328125,
-0.136474609375,
-0.156494140625,
0.4521484375,
-0.56201171875,
-0.166259765625,
-0.007228851318359375,
0.092529296875,
-0.77294921875,
-0.00569915771484375,
-0.22216796875,
-0.998046875,
-0.32958984375,
0.70458984375,
0.3515625,
0.37451171875,
-0.255859375,
-0.75634765625,
0.3876953125,
1.36328125,
-0.363037109375,
0.2529296875,
0.177001953125,
-0.26171875,
-0.0066070556640625,
0.1627197265625,
0.407958984375,
-0.2484130859375,
-0.5693359375,
0.8427734375,
-0.275390625,
0.3857421875,
0.1790771484375,
0.6728515625,
0.25439453125,
0.7177734375,
-0.299560546875,
-0.54541015625,
0.3359375,
1.1240234375,
-0.043365478515625,
0.56005859375,
0.0236968994140625,
0.71826171875,
0.399169921875,
0.7705078125,
0.55078125,
-0.1724853515625,
0.2490234375,
0.9296875,
0.283203125,
0.1754150390625,
0.2105712890625,
0.40478515625,
0.65966796875,
0.2108154296875,
0.045654296875,
0.4443359375,
0.017333984375,
0.0092926025390625,
-0.439453125,
0.2000732421875,
-0.62060546875,
1.0654296875,
0.1181640625,
0.22900390625,
-0.43408203125,
-0.1705322265625,
0.10528564453125,
0.486572265625,
-0.6220703125,
-0.78759765625,
0.0191497802734375,
0.02294921875,
0.278076171875,
0.1961669921875,
0.57666015625,
0.7490234375,
0.07763671875,
0.54833984375,
-0.321044921875,
-0.300048828125,
-0.80419921875,
-0.74365234375,
-0.91748046875,
-0.3974609375,
-0.67822265625,
-0.2266845703125,
0.458740234375,
-0.94091796875,
0.75537109375,
-0.38671875,
0.079833984375,
-0.34619140625,
-0.457763671875,
0.609375,
-0.1490478515625,
0.6611328125,
-0.47998046875,
0.266357421875,
0.033660888671875,
0.91259765625,
-0.344970703125,
-0.235107421875,
-0.333251953125,
-0.55615234375,
0.250244140625,
0.016143798828125,
0.56005859375,
0.2734375,
-0.5771484375,
-0.74658203125,
-0.65380859375,
-0.41748046875,
-0.5224609375,
0.361328125,
-0.415283203125,
0.791015625,
0.6025390625,
-0.7216796875,
0.48095703125,
0.97998046875,
-1.14453125,
0.75390625,
0.495849609375,
-0.144775390625,
-0.496826171875,
1.0107421875,
0.197021484375,
0.50732421875,
-0.466552734375,
-0.66357421875,
-0.331787109375,
0.271484375,
-0.11151123046875,
-0.69921875,
-0.461669921875,
0.712890625,
-0.3232421875,
-0.86279296875,
0.35546875,
-1.048828125,
-0.32763671875,
-0.43408203125,
-0.116943359375,
0.93994140625,
1.015625,
0.4287109375,
-0.26904296875,
-0.451171875,
-0.1063232421875,
0.69677734375,
0.630859375,
-0.15478515625,
-0.04608154296875,
0.88525390625,
0.141357421875,
0.322998046875,
0.1839599609375,
-0.300537109375,
0.0164031982421875,
-0.1500244140625,
0.054840087890625,
0.481689453125,
0.3349609375,
-0.04180908203125,
0.426513671875,
0.64111328125,
-0.88916015625,
-0.451904296875,
-0.43505859375,
0.75146484375,
-0.08203125,
0.40478515625,
0.30419921875,
-0.14404296875,
-0.63134765625,
-0.98828125,
0.460693359375,
0.43310546875,
0.57861328125,
-1.095703125,
0.86474609375,
0.344970703125,
-0.38037109375,
-0.0162811279296875,
-0.431396484375,
-0.08209228515625,
1.154296875,
0.039520263671875,
0.68603515625,
-0.72802734375,
0.52294921875,
0.2427978515625,
0.21142578125,
0.970703125,
0.287841796875,
0.189208984375,
-0.2340087890625,
-0.53466796875,
-0.329345703125,
0.14453125,
-0.27685546875,
-0.3173828125,
0.3583984375,
0.06256103515625,
-0.26611328125,
-0.63623046875,
0.40576171875,
0.6982421875,
0.375244140625,
-0.3173828125,
0.54345703125,
0.215087890625,
0.409423828125,
0.4599609375,
-0.08355712890625,
0.357421875,
-0.73828125,
0.68994140625,
-0.054534912109375,
-0.290283203125,
-0.376220703125,
-0.165283203125,
0.1146240234375,
0.10589599609375,
0.3935546875,
0.025970458984375,
-0.7734375,
0.1070556640625,
0.1844482421875,
0.5830078125,
-0.376220703125,
-0.34423828125,
-0.383056640625,
0.4208984375,
0.145263671875,
-0.77587890625,
0.43701171875,
-0.9013671875,
0.62353515625,
0.1480712890625,
-0.0232086181640625,
-0.1781005859375,
-0.59814453125,
-0.83642578125,
-0.619140625,
-0.057952880859375,
1.1796875,
0.066162109375,
-0.2113037109375,
-1.12109375,
0.1868896484375,
0.269287109375,
-0.19775390625,
-0.2210693359375,
-0.363037109375,
0.1968994140625,
-0.1422119140625,
0.3359375,
-0.8583984375,
-0.93798828125,
0.03375244140625,
-1.263671875,
0.654296875,
-0.57958984375,
0.7353515625,
-0.36376953125,
-0.304931640625,
0.0660400390625,
-0.24609375,
-0.343994140625,
-0.038787841796875,
-0.3818359375,
0.487060546875,
-0.82275390625,
-0.61083984375,
0.38916015625,
-0.35986328125,
-0.37646484375,
1.0625,
-0.01580810546875,
-0.34765625,
-0.04327392578125,
0.400390625,
-0.521484375,
0.334716796875,
-0.5078125,
0.630859375,
-0.37890625,
-0.7919921875,
-0.319580078125,
-0.8134765625,
0.76220703125,
-0.08001708984375,
-0.8857421875,
-0.1280517578125,
-1.0712890625,
-0.235107421875,
0.044342041015625,
-0.43701171875,
0.2548828125,
0.280517578125,
-0.330810546875,
0.2646484375,
-0.40576171875,
-0.27587890625,
-0.43115234375,
-0.5859375,
-0.52734375,
0.192626953125,
0.1556396484375,
0.880859375,
-0.0721435546875,
-0.09576416015625,
0.1593017578125,
-0.09466552734375,
0.039581298828125,
-0.34228515625,
-0.49072265625,
0.01125335693359375,
-0.298095703125,
-0.32080078125,
0.373291015625,
-0.04888916015625,
0.5654296875,
0.943359375,
-0.007785797119140625,
0.3720703125,
0.5068359375,
-0.53955078125,
0.7333984375,
-0.263427734375,
-0.57666015625,
-0.31689453125,
0.818359375,
0.1478271484375,
0.6865234375,
0.267578125,
-1.025390625,
-0.76513671875,
-0.69775390625,
-0.1309814453125,
-0.595703125,
0.031280517578125,
-1.080078125,
-0.1802978515625,
-0.58251953125,
0.365966796875,
0.020050048828125,
-0.5869140625,
0.0014066696166992188,
-0.7255859375,
0.257568359375,
-0.826171875,
-0.1766357421875,
-0.73876953125,
-0.384765625,
0.232421875,
0.7041015625,
0.1336669921875,
0.642578125,
0.295166015625,
0.0070953369140625,
0.286865234375,
-0.1751708984375,
-0.384033203125,
-0.489013671875,
-0.473876953125,
0.357421875,
-0.240966796875,
0.0004544258117675781,
-0.483642578125,
0.712890625,
-0.81298828125,
0.16552734375,
-0.418212890625,
-0.1573486328125,
0.185546875,
-0.036529541015625,
1.177734375,
0.069580078125,
0.0711669921875,
-0.0038280487060546875,
0.521484375,
0.4716796875,
-0.309814453125,
-0.5341796875,
-0.2197265625,
-0.65087890625,
-0.82275390625,
0.779296875,
-0.469482421875,
0.09271240234375,
-0.42138671875,
-0.44873046875,
1.0634765625,
-0.4501953125,
0.444580078125,
1.181640625,
0.035491943359375,
0.7001953125,
-0.3349609375,
0.62353515625,
0.462890625,
-0.2841796875,
-0.2059326171875,
0.0693359375,
-0.6650390625,
0.02716064453125,
-0.59912109375,
-0.97021484375,
-0.7939453125,
0.291015625,
1.2705078125,
-0.0958251953125,
0.7978515625,
0.216552734375,
-1.025390625,
-0.71337890625,
1.14453125,
0.546875,
0.11822509765625,
1.12890625,
-0.310546875,
0.0592041015625,
-0.27587890625,
-0.1676025390625,
-0.395751953125,
-0.447021484375,
1.0537109375,
-0.9736328125,
-0.5791015625,
0.66796875,
0.83349609375,
-1.0810546875,
-1.017578125,
-0.6435546875,
-0.2291259765625,
0.22900390625,
-0.53564453125,
0.0992431640625,
0.2958984375,
-0.380126953125,
0.03173828125,
0.285888671875,
0.10430908203125,
0.434326171875,
0.183349609375,
-0.048858642578125,
-0.425537109375,
0.392578125,
0.4267578125,
-0.8203125,
0.0311431884765625,
-0.96435546875,
0.1998291015625,
-0.1282958984375,
-0.03302001953125,
0.900390625,
-0.2115478515625,
0.35498046875,
0.07769775390625,
-0.294921875,
0.295166015625,
-0.6552734375,
-0.37060546875,
0.64404296875,
-0.327392578125,
-0.384033203125,
-0.1663818359375,
0.67724609375,
-0.1435546875,
0.06170654296875,
-0.414306640625,
-0.07476806640625,
0.1553955078125,
0.41845703125,
-0.453125,
-0.94580078125,
-0.1639404296875,
-1.357421875,
-0.501953125,
-0.57763671875,
-0.267578125,
0.1873779296875,
0.400634765625,
-0.218505859375,
-0.6484375,
0.2127685546875,
0.51953125,
-0.35546875,
0.77734375,
-0.79248046875,
0.2958984375,
-0.320068359375,
-0.124267578125,
-0.78125,
-0.07696533203125,
-0.306884765625,
-0.11639404296875,
-0.60791015625,
0.2274169921875,
-0.1798095703125,
0.432373046875,
-0.0966796875,
0.176025390625,
-0.39208984375,
-0.6162109375,
-0.185546875,
0.050567626953125,
-0.060272216796875,
0.85400390625,
0.73974609375,
-0.436767578125,
0.208251953125,
-0.057037353515625,
-0.2939453125,
-0.58837890625,
0.48291015625,
0.6455078125,
-0.442138671875,
-0.27490234375,
0.207763671875,
0.44091796875,
-1.0009765625,
0.21875,
-0.4970703125,
0.447998046875,
0.125732421875,
-0.2406005859375,
0.81787109375,
1.078125,
-0.26025390625,
0.12139892578125,
-0.1654052734375,
-0.017913818359375,
0.8310546875,
0.004703521728515625,
0.09112548828125,
0.40185546875,
0.061767578125,
-0.5859375,
0.034881591796875,
0.271240234375,
-0.16552734375,
-0.06378173828125,
0.00363922119140625,
-0.43115234375,
-0.81103515625,
-0.135986328125,
-0.2822265625,
0.473876953125,
0.53173828125,
-0.26904296875,
0.33935546875,
-0.26220703125,
-0.385986328125,
0.5341796875,
-1.353515625,
-0.87353515625,
0.0140838623046875,
0.1695556640625,
-0.38671875,
-0.1336669921875,
-0.465576171875,
-0.14208984375,
-0.312744140625,
0.35107421875,
-0.2315673828125,
0.414306640625,
-0.4150390625,
0.5966796875,
-0.09893798828125,
-0.357421875,
-0.201904296875,
0.6875,
-0.305908203125,
-0.86083984375,
-0.11456298828125,
0.978515625,
0.243896484375,
-0.0914306640625,
-0.037506103515625,
0.156005859375,
-0.036773681640625,
0.219482421875,
-0.609375,
0.2083740234375,
-0.308349609375,
0.497802734375,
-1.146484375,
-0.392333984375,
0.10107421875,
0.42724609375,
0.27587890625,
-0.53955078125,
-0.30712890625,
0.783203125,
0.66162109375,
0.020660400390625,
0.278564453125,
0.08282470703125,
0.35791015625,
-0.166748046875,
0.03961181640625,
-0.298828125,
0.62744140625,
0.8740234375,
0.5400390625,
-0.03680419921875,
0.1673583984375,
0.68603515625,
-0.4462890625,
-0.5673828125,
0.400146484375,
0.06439208984375,
-0.1307373046875,
0.5625,
-0.06561279296875,
0.0119476318359375,
-0.35693359375,
-0.39599609375,
0.2919921875,
-0.2467041015625,
-0.059783935546875,
-0.12359619140625,
-0.53076171875,
1.244140625,
-0.337158203125,
-0.132080078125,
0.143798828125,
-0.63037109375,
0.44140625,
0.736328125,
-0.253173828125,
-0.36669921875,
0.73876953125,
0.67333984375,
0.53955078125,
0.67578125,
0.5263671875,
0.04852294921875,
-0.81103515625,
0.261474609375,
-0.10760498046875,
0.2418212890625,
-0.5439453125,
-0.36181640625,
-1.2578125,
0.372802734375,
0.00717926025390625,
-0.3916015625,
0.7236328125,
-0.8037109375,
-0.040374755859375,
0.0174102783203125,
0.457275390625,
-0.79638671875,
0.44384765625,
0.51611328125,
-0.228759765625,
-0.474853515625,
0.86083984375,
-0.08837890625,
0.266357421875,
0.053955078125,
1.33984375,
-0.06427001953125,
1.3896484375,
0.40380859375,
0.1529541015625,
0.32470703125,
0.442626953125,
-0.81689453125,
-0.86865234375,
-0.376708984375,
-0.440185546875,
-0.005603790283203125,
-0.451171875,
-0.233642578125,
-0.17724609375,
0.82568359375,
-0.0077362060546875,
-0.96630859375,
-0.3359375,
0.0237274169921875,
-1.1533203125,
0.54052734375,
0.4501953125,
0.321044921875,
0.1820068359375,
-0.10589599609375,
0.03485107421875,
-0.4384765625,
0.0389404296875,
-0.54833984375,
0.52197265625,
-0.916015625,
-0.445068359375,
-0.23388671875,
-0.642578125,
-0.654296875,
0.246826171875,
-0.720703125,
-0.74853515625,
0.44482421875,
0.487060546875,
0.27734375,
0.3271484375,
-0.23193359375,
-0.257080078125,
0.888671875,
0.8681640625,
0.1944580078125,
0.67919921875,
0.32421875,
-0.40234375,
-0.1328125,
-0.98583984375,
0.40673828125,
-0.260009765625,
-0.11688232421875,
-0.55029296875,
0.368408203125,
-0.5625,
-1.4033203125,
-0.11669921875,
0.482177734375,
0.1822509765625,
-0.82421875,
-1.087890625,
-0.1846923828125,
-1.3466796875,
-0.38037109375,
-0.623046875,
0.99755859375,
0.004047393798828125,
0.0238800048828125,
-0.06341552734375,
-1.2333984375,
4.48828125,
0.78369140625,
0.66357421875,
0.239990234375,
0.28369140625,
1.2763671875,
0.6005859375,
-0.408935546875,
-0.6845703125,
-0.1556396484375,
0.39501953125,
-0.1591796875,
0.07373046875,
0.759765625,
0.7373046875,
0.33056640625,
-0.60302734375,
-0.165283203125,
-0.050384521484375,
-0.8974609375,
-0.57177734375,
-0.0980224609375,
0.20068359375,
0.56982421875,
0.46484375,
0.5185546875,
0.52734375,
-0.796875,
0.07489013671875,
-0.6787109375,
0.454345703125,
-0.869140625,
0.75439453125,
0.378173828125,
-0.50634765625,
0.57275390625,
0.1490478515625,
-0.235107421875,
-0.1978759765625,
0.311279296875,
-0.1673583984375,
-0.1368408203125,
0.123779296875,
-0.34033203125,
0.07562255859375,
-0.0648193359375,
-0.54638671875,
0.3681640625,
0.301513671875,
-0.98193359375,
0.59619140625,
-0.123779296875,
0.1710205078125,
-0.477783203125,
-0.82666015625,
0.44482421875,
-0.0859375,
0.1502685546875,
-0.1512451171875,
0.93994140625,
0.321044921875,
-0.023895263671875,
-0.18359375,
0.4599609375,
-0.97119140625,
1.095703125,
-0.19921875,
0.417724609375,
-0.388671875,
0.0165863037109375,
-0.160400390625,
-0.6591796875,
-0.51171875,
-0.66796875,
0.490478515625,
0.49755859375,
0.2354736328125,
0.6865234375,
0.56298828125,
-0.8828125,
0.035552978515625,
0.250244140625,
-0.166748046875,
0.011016845703125,
0.681640625,
1.302734375,
-0.76416015625,
-0.31689453125,
-0.359619140625,
0.60595703125,
0.80126953125,
0.650390625,
0.1656494140625,
-0.76904296875,
-0.2440185546875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Tags: implementation
Correct Solution:
```
str = str(input())
list = list(str)
res = 0
max = 0
for i in list:
if ((i != 'A') and (i != 'E') and (i != 'I') and (i != 'O') and (i != 'U') and (i != 'Y') ):
res += 1
if res > max:
max = res
else:
res = 0
print(max + 1)
```
| 35,634
|
[
0.1756591796875,
-0.16259765625,
-0.33056640625,
0.64208984375,
-0.43115234375,
-0.3359375,
0.5234375,
0.0191497802734375,
0.2327880859375,
0.74560546875,
0.5,
0.02777099609375,
0.14453125,
-0.67822265625,
-0.61669921875,
0.222412109375,
-0.935546875,
-0.39013671875,
-0.64111328125,
-0.2135009765625,
0.1707763671875,
-0.365234375,
-1.1494140625,
0.025238037109375,
-0.11572265625,
0.6162109375,
0.4052734375,
-0.00794219970703125,
1.0458984375,
1.0556640625,
0.309814453125,
-0.286376953125,
0.056915283203125,
-1.146484375,
-0.470703125,
-0.30859375,
0.254150390625,
-0.6357421875,
-0.4697265625,
-0.29443359375,
0.40234375,
-0.06878662109375,
0.74072265625,
-0.6865234375,
-1.1435546875,
-0.177978515625,
-0.2744140625,
-0.3505859375,
-0.33154296875,
-0.5888671875,
0.489013671875,
-0.2607421875,
0.580078125,
-0.177734375,
-0.260009765625,
-0.343017578125,
0.267333984375,
-0.192138671875,
-0.9970703125,
0.1197509765625,
-0.0694580078125,
0.49267578125,
0.2034912109375,
-0.5791015625,
-0.260009765625,
0.430419921875,
-0.1263427734375,
-0.10894775390625,
-0.1837158203125,
-0.662109375,
-0.23681640625,
0.45263671875,
-0.4775390625,
-0.44921875,
-0.54248046875,
0.0621337890625,
0.0296173095703125,
-0.0181121826171875,
-0.662109375,
0.8095703125,
0.2410888671875,
0.876953125,
-0.27587890625,
0.1470947265625,
-0.431640625,
-0.42236328125,
-0.09844970703125,
0.2171630859375,
0.240478515625,
-0.12103271484375,
-0.353271484375,
0.52880859375,
-0.43310546875,
0.130615234375,
0.56494140625,
0.48876953125,
-0.32373046875,
0.5234375,
0.469482421875,
0.09210205078125,
0.76123046875,
1.076171875,
-0.5146484375,
0.7998046875,
-0.473388671875,
0.26611328125,
0.288330078125,
-0.1414794921875,
-0.038482666015625,
-0.52978515625,
-0.216064453125,
0.01248931884765625,
0.2587890625,
0.28662109375,
-0.60107421875,
0.8583984375,
0.08294677734375,
0.393310546875,
-0.771484375,
0.7939453125,
0.265869140625,
0.1292724609375,
0.51953125,
0.01220703125,
0.2242431640625,
-0.599609375,
-0.463623046875,
1.0361328125,
-0.429931640625,
0.337158203125,
0.11737060546875,
-0.2412109375,
-0.41650390625,
0.42724609375,
-0.480712890625,
0.62109375,
-0.42333984375,
0.7744140625,
0.5498046875,
-0.95068359375,
0.5205078125,
-0.26513671875,
0.10125732421875,
1.396484375,
0.57666015625,
-0.11480712890625,
0.51171875,
0.299072265625,
-0.66943359375,
0.319091796875,
-0.91845703125,
0.76708984375,
0.151611328125,
0.26318359375,
-0.1617431640625,
0.2310791015625,
-0.2431640625,
0.33740234375,
0.1766357421875,
0.06402587890625,
-0.36083984375,
-0.06353759765625,
-0.56103515625,
0.880859375,
-0.427490234375,
0.60888671875,
-0.45166015625,
-0.06787109375,
-0.378173828125,
-0.2998046875,
0.0831298828125,
0.22998046875,
0.11480712890625,
0.9228515625,
0.0933837890625,
1.2880859375,
0.9912109375,
0.12371826171875,
0.357421875,
0.481689453125,
-0.2425537109375,
0.142333984375,
0.0863037109375,
0.927734375,
-0.00884246826171875,
0.2210693359375,
0.166259765625,
-0.08270263671875,
-0.464599609375,
-0.1920166015625,
-0.15869140625,
0.449462890625,
-0.61474609375,
-0.1617431640625,
0.034454345703125,
0.093994140625,
-0.73388671875,
-0.0064239501953125,
-0.26953125,
-1.02734375,
-0.3076171875,
0.6787109375,
0.326171875,
0.41064453125,
-0.247802734375,
-0.7470703125,
0.3828125,
1.3642578125,
-0.415283203125,
0.259033203125,
0.178955078125,
-0.214111328125,
-0.042816162109375,
0.1505126953125,
0.39453125,
-0.2335205078125,
-0.56787109375,
0.8369140625,
-0.26171875,
0.367919921875,
0.1810302734375,
0.6640625,
0.282470703125,
0.72021484375,
-0.323974609375,
-0.58935546875,
0.296630859375,
1.1708984375,
-0.03387451171875,
0.60498046875,
0.02032470703125,
0.7734375,
0.45166015625,
0.85595703125,
0.60009765625,
-0.146240234375,
0.283935546875,
0.94775390625,
0.29638671875,
0.2103271484375,
0.199951171875,
0.421875,
0.6943359375,
0.244140625,
0.09393310546875,
0.399658203125,
0.0202484130859375,
0.0186004638671875,
-0.4677734375,
0.200927734375,
-0.572265625,
1.0498046875,
0.10430908203125,
0.23876953125,
-0.451416015625,
-0.180908203125,
0.08770751953125,
0.5224609375,
-0.62939453125,
-0.76611328125,
0.0137176513671875,
0.04248046875,
0.3017578125,
0.169189453125,
0.5576171875,
0.73974609375,
0.09521484375,
0.568359375,
-0.334716796875,
-0.31591796875,
-0.833984375,
-0.7646484375,
-0.96240234375,
-0.432861328125,
-0.68408203125,
-0.2236328125,
0.485595703125,
-0.919921875,
0.73681640625,
-0.389404296875,
0.0655517578125,
-0.34619140625,
-0.451171875,
0.642578125,
-0.147216796875,
0.64404296875,
-0.49072265625,
0.2315673828125,
0.07635498046875,
0.89599609375,
-0.376220703125,
-0.23681640625,
-0.31591796875,
-0.591796875,
0.250244140625,
0.0098876953125,
0.5634765625,
0.2384033203125,
-0.60498046875,
-0.75537109375,
-0.62744140625,
-0.363525390625,
-0.50537109375,
0.34814453125,
-0.43115234375,
0.861328125,
0.5751953125,
-0.76025390625,
0.47119140625,
1.041015625,
-1.142578125,
0.77197265625,
0.469482421875,
-0.2052001953125,
-0.50390625,
1.0517578125,
0.2347412109375,
0.52197265625,
-0.51513671875,
-0.67626953125,
-0.322265625,
0.27392578125,
-0.08807373046875,
-0.693359375,
-0.505859375,
0.712890625,
-0.315185546875,
-0.90478515625,
0.37451171875,
-1.029296875,
-0.318359375,
-0.41357421875,
-0.1153564453125,
0.92333984375,
1.0048828125,
0.448974609375,
-0.2178955078125,
-0.48388671875,
-0.09136962890625,
0.73046875,
0.66064453125,
-0.138427734375,
0.0038356781005859375,
0.87646484375,
0.1485595703125,
0.302490234375,
0.1795654296875,
-0.31103515625,
0.042999267578125,
-0.13671875,
0.0626220703125,
0.470947265625,
0.35400390625,
-0.08758544921875,
0.416748046875,
0.63720703125,
-0.87060546875,
-0.442138671875,
-0.40478515625,
0.7314453125,
-0.049407958984375,
0.489990234375,
0.314697265625,
-0.15673828125,
-0.640625,
-0.96044921875,
0.443603515625,
0.3837890625,
0.60546875,
-1.166015625,
0.890625,
0.342041015625,
-0.368896484375,
-0.00251007080078125,
-0.451416015625,
-0.12200927734375,
1.1669921875,
0.038848876953125,
0.70751953125,
-0.7666015625,
0.54541015625,
0.233154296875,
0.252685546875,
0.955078125,
0.30517578125,
0.2288818359375,
-0.1990966796875,
-0.51123046875,
-0.35009765625,
0.146728515625,
-0.2763671875,
-0.307861328125,
0.389892578125,
0.0743408203125,
-0.2374267578125,
-0.65966796875,
0.42529296875,
0.71728515625,
0.408447265625,
-0.317138671875,
0.5078125,
0.2288818359375,
0.420166015625,
0.48486328125,
-0.0655517578125,
0.313720703125,
-0.73779296875,
0.6337890625,
-0.045867919921875,
-0.28466796875,
-0.4169921875,
-0.19189453125,
0.1119384765625,
0.1314697265625,
0.450927734375,
0.035858154296875,
-0.84130859375,
0.1005859375,
0.1539306640625,
0.560546875,
-0.3583984375,
-0.411865234375,
-0.372314453125,
0.438232421875,
0.1690673828125,
-0.8017578125,
0.432373046875,
-0.86767578125,
0.62548828125,
0.2122802734375,
-0.07928466796875,
-0.2188720703125,
-0.62548828125,
-0.84521484375,
-0.63720703125,
-0.11700439453125,
1.166015625,
0.0745849609375,
-0.1966552734375,
-1.169921875,
0.1954345703125,
0.307861328125,
-0.18896484375,
-0.172119140625,
-0.41259765625,
0.1973876953125,
-0.1346435546875,
0.344482421875,
-0.87060546875,
-0.92138671875,
0.0406494140625,
-1.306640625,
0.640625,
-0.56884765625,
0.751953125,
-0.3984375,
-0.3017578125,
0.0758056640625,
-0.1990966796875,
-0.365966796875,
-0.033233642578125,
-0.403564453125,
0.496337890625,
-0.8544921875,
-0.60009765625,
0.438232421875,
-0.36181640625,
-0.37158203125,
1.0732421875,
-0.0173797607421875,
-0.35302734375,
0.0007109642028808594,
0.40869140625,
-0.5576171875,
0.337646484375,
-0.54052734375,
0.619140625,
-0.370361328125,
-0.7939453125,
-0.31982421875,
-0.8095703125,
0.78125,
-0.06793212890625,
-0.9267578125,
-0.195068359375,
-1.130859375,
-0.2264404296875,
0.05889892578125,
-0.445068359375,
0.241455078125,
0.291015625,
-0.321533203125,
0.2349853515625,
-0.40869140625,
-0.346435546875,
-0.42431640625,
-0.552734375,
-0.5244140625,
0.2281494140625,
0.10589599609375,
0.888671875,
-0.09814453125,
-0.164306640625,
0.1441650390625,
-0.084228515625,
0.09283447265625,
-0.352294921875,
-0.47607421875,
0.005359649658203125,
-0.297607421875,
-0.306884765625,
0.329833984375,
-0.0672607421875,
0.5185546875,
0.92529296875,
0.0152740478515625,
0.333984375,
0.477783203125,
-0.5615234375,
0.71630859375,
-0.25927734375,
-0.60595703125,
-0.355224609375,
0.78369140625,
0.16259765625,
0.67919921875,
0.30126953125,
-1.013671875,
-0.7314453125,
-0.6962890625,
-0.1630859375,
-0.60986328125,
0.052886962890625,
-1.0693359375,
-0.235107421875,
-0.5791015625,
0.37744140625,
0.05755615234375,
-0.66064453125,
-0.05596923828125,
-0.76953125,
0.26708984375,
-0.8642578125,
-0.1571044921875,
-0.75830078125,
-0.343505859375,
0.2215576171875,
0.7119140625,
0.1473388671875,
0.650390625,
0.2164306640625,
0.00963592529296875,
0.28271484375,
-0.1571044921875,
-0.43115234375,
-0.53125,
-0.449951171875,
0.339599609375,
-0.268310546875,
0.03717041015625,
-0.478759765625,
0.703125,
-0.85205078125,
0.1729736328125,
-0.48095703125,
-0.1689453125,
0.151123046875,
-0.07232666015625,
1.1982421875,
0.0968017578125,
0.083740234375,
-0.09918212890625,
0.52099609375,
0.474365234375,
-0.309326171875,
-0.5244140625,
-0.2469482421875,
-0.64794921875,
-0.8408203125,
0.81689453125,
-0.501953125,
0.089599609375,
-0.453125,
-0.451171875,
1.0703125,
-0.476806640625,
0.4248046875,
1.2041015625,
-0.0157318115234375,
0.7021484375,
-0.340087890625,
0.62158203125,
0.424072265625,
-0.316650390625,
-0.1629638671875,
0.08917236328125,
-0.6884765625,
-0.0023956298828125,
-0.58740234375,
-0.98095703125,
-0.79150390625,
0.308837890625,
1.2607421875,
-0.1007080078125,
0.8193359375,
0.1763916015625,
-1.0234375,
-0.736328125,
1.1748046875,
0.54052734375,
0.122802734375,
1.1708984375,
-0.2432861328125,
0.08990478515625,
-0.274169921875,
-0.1434326171875,
-0.387939453125,
-0.454833984375,
1.0908203125,
-0.93505859375,
-0.5859375,
0.6513671875,
0.83984375,
-1.1533203125,
-1.03125,
-0.63720703125,
-0.2685546875,
0.21044921875,
-0.56591796875,
0.11187744140625,
0.3125,
-0.389892578125,
0.047210693359375,
0.269775390625,
0.0263671875,
0.41845703125,
0.1922607421875,
-0.0036640167236328125,
-0.406005859375,
0.413330078125,
0.4794921875,
-0.822265625,
0.00019681453704833984,
-0.9501953125,
0.1883544921875,
-0.099853515625,
-0.07061767578125,
0.91162109375,
-0.2381591796875,
0.327880859375,
0.10162353515625,
-0.3271484375,
0.298095703125,
-0.67626953125,
-0.383544921875,
0.64501953125,
-0.38330078125,
-0.397216796875,
-0.2000732421875,
0.6201171875,
-0.115966796875,
0.04351806640625,
-0.382568359375,
-0.04791259765625,
0.1260986328125,
0.42333984375,
-0.5107421875,
-1.0087890625,
-0.188720703125,
-1.3583984375,
-0.525390625,
-0.544921875,
-0.277099609375,
0.161865234375,
0.37451171875,
-0.1932373046875,
-0.67529296875,
0.187255859375,
0.486083984375,
-0.3720703125,
0.8115234375,
-0.837890625,
0.314453125,
-0.36328125,
-0.1619873046875,
-0.7578125,
-0.0232391357421875,
-0.27685546875,
-0.1199951171875,
-0.626953125,
0.2369384765625,
-0.248046875,
0.494873046875,
-0.07568359375,
0.198974609375,
-0.374755859375,
-0.681640625,
-0.1531982421875,
0.047119140625,
-0.101318359375,
0.87451171875,
0.7138671875,
-0.4609375,
0.2200927734375,
-0.069091796875,
-0.26611328125,
-0.5947265625,
0.5234375,
0.6162109375,
-0.433349609375,
-0.285888671875,
0.1995849609375,
0.431396484375,
-0.99169921875,
0.16064453125,
-0.482666015625,
0.44677734375,
0.1124267578125,
-0.2261962890625,
0.8291015625,
1.0732421875,
-0.246337890625,
0.1373291015625,
-0.1683349609375,
-0.056121826171875,
0.8515625,
0.0164337158203125,
0.10345458984375,
0.384033203125,
0.046661376953125,
-0.5341796875,
0.059906005859375,
0.347900390625,
-0.14794921875,
-0.0192718505859375,
-0.00531005859375,
-0.4619140625,
-0.83984375,
-0.12841796875,
-0.305419921875,
0.448486328125,
0.51953125,
-0.3046875,
0.3154296875,
-0.287841796875,
-0.341064453125,
0.51025390625,
-1.3623046875,
-0.91064453125,
0.06146240234375,
0.173095703125,
-0.3505859375,
-0.16064453125,
-0.478271484375,
-0.1522216796875,
-0.279541015625,
0.333984375,
-0.2607421875,
0.415771484375,
-0.393310546875,
0.6162109375,
-0.134033203125,
-0.366455078125,
-0.156005859375,
0.6435546875,
-0.33154296875,
-0.87841796875,
-0.073974609375,
0.97412109375,
0.2403564453125,
-0.1046142578125,
-0.039276123046875,
0.1834716796875,
-0.0001742839813232422,
0.2054443359375,
-0.6005859375,
0.261962890625,
-0.310302734375,
0.50146484375,
-1.1572265625,
-0.41455078125,
0.0672607421875,
0.4326171875,
0.280517578125,
-0.56103515625,
-0.268798828125,
0.77685546875,
0.65869140625,
-0.01824951171875,
0.3212890625,
0.06768798828125,
0.402587890625,
-0.206787109375,
0.033660888671875,
-0.2376708984375,
0.7021484375,
0.86572265625,
0.57958984375,
-0.01910400390625,
0.1624755859375,
0.6875,
-0.38330078125,
-0.576171875,
0.421142578125,
0.043212890625,
-0.1337890625,
0.54443359375,
-0.05157470703125,
-0.00157928466796875,
-0.272705078125,
-0.398193359375,
0.33935546875,
-0.268310546875,
-0.0908203125,
-0.091552734375,
-0.5703125,
1.2158203125,
-0.33837890625,
-0.11798095703125,
0.184326171875,
-0.63671875,
0.39990234375,
0.78125,
-0.271484375,
-0.34521484375,
0.779296875,
0.7041015625,
0.5146484375,
0.67626953125,
0.494873046875,
0.06890869140625,
-0.80908203125,
0.18994140625,
-0.09979248046875,
0.2357177734375,
-0.55712890625,
-0.421142578125,
-1.3173828125,
0.357666015625,
-0.01422882080078125,
-0.3603515625,
0.79541015625,
-0.8662109375,
-0.0250396728515625,
-0.042449951171875,
0.455078125,
-0.77734375,
0.4580078125,
0.52978515625,
-0.276611328125,
-0.51220703125,
0.84912109375,
-0.043914794921875,
0.32275390625,
0.06829833984375,
1.3486328125,
-0.03521728515625,
1.3798828125,
0.42626953125,
0.1456298828125,
0.29736328125,
0.458251953125,
-0.7783203125,
-0.8916015625,
-0.35595703125,
-0.45703125,
-0.01715087890625,
-0.45849609375,
-0.265869140625,
-0.203369140625,
0.85498046875,
-0.032562255859375,
-1.0146484375,
-0.3330078125,
0.0391845703125,
-1.181640625,
0.5927734375,
0.4521484375,
0.30859375,
0.2269287109375,
-0.08782958984375,
0.0149993896484375,
-0.430419921875,
0.063720703125,
-0.52783203125,
0.4921875,
-0.94287109375,
-0.44775390625,
-0.271484375,
-0.625,
-0.60009765625,
0.2314453125,
-0.716796875,
-0.73291015625,
0.43505859375,
0.5419921875,
0.2783203125,
0.342529296875,
-0.2178955078125,
-0.2049560546875,
0.93359375,
0.89794921875,
0.15869140625,
0.759765625,
0.316162109375,
-0.400634765625,
-0.07330322265625,
-1.0087890625,
0.44580078125,
-0.26025390625,
-0.0736083984375,
-0.5263671875,
0.3447265625,
-0.5595703125,
-1.4248046875,
-0.126220703125,
0.51220703125,
0.18017578125,
-0.77734375,
-1.0927734375,
-0.1693115234375,
-1.330078125,
-0.374267578125,
-0.6884765625,
0.9755859375,
-0.007244110107421875,
-0.021453857421875,
-0.06439208984375,
-1.23828125,
4.4375,
0.79443359375,
0.6826171875,
0.28271484375,
0.306396484375,
1.30078125,
0.63671875,
-0.347412109375,
-0.6357421875,
-0.165771484375,
0.39111328125,
-0.175537109375,
0.056915283203125,
0.74951171875,
0.728515625,
0.33642578125,
-0.60498046875,
-0.1671142578125,
-0.0243988037109375,
-0.89990234375,
-0.57861328125,
-0.096923828125,
0.197021484375,
0.5771484375,
0.4072265625,
0.46044921875,
0.5341796875,
-0.80322265625,
0.0638427734375,
-0.67138671875,
0.447998046875,
-0.87353515625,
0.80322265625,
0.40234375,
-0.482421875,
0.580078125,
0.1302490234375,
-0.223388671875,
-0.228759765625,
0.32958984375,
-0.2330322265625,
-0.090087890625,
0.2064208984375,
-0.37841796875,
0.06646728515625,
-0.00850677490234375,
-0.53564453125,
0.385498046875,
0.36181640625,
-0.97607421875,
0.61572265625,
-0.1217041015625,
0.2061767578125,
-0.47265625,
-0.85107421875,
0.40380859375,
-0.04388427734375,
0.159912109375,
-0.1563720703125,
0.88671875,
0.287353515625,
0.0014371871948242188,
-0.1416015625,
0.4814453125,
-1.0185546875,
1.0498046875,
-0.19970703125,
0.444580078125,
-0.39990234375,
0.00919342041015625,
-0.17333984375,
-0.64990234375,
-0.44482421875,
-0.6884765625,
0.488037109375,
0.517578125,
0.190185546875,
0.69091796875,
0.5634765625,
-0.89208984375,
0.02569580078125,
0.221435546875,
-0.1820068359375,
-0.01297760009765625,
0.7001953125,
1.318359375,
-0.75,
-0.306396484375,
-0.314697265625,
0.65869140625,
0.80517578125,
0.6787109375,
0.12017822265625,
-0.7138671875,
-0.2125244140625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Tags: implementation
Correct Solution:
```
n=input()
l=len(n)
a="AEIOUY"
j=-1
ans=0
for i in range(l):
if n[i] in a:
ans=max(ans,i-j)
j=i
ans=max(l-j,ans)
if j==-1:
print(l+1)
else:
print(ans)
```
| 35,635
|
[
0.21923828125,
-0.153076171875,
-0.34130859375,
0.72412109375,
-0.430908203125,
-0.323974609375,
0.5654296875,
-0.0010118484497070312,
0.21337890625,
0.7490234375,
0.505859375,
0.0247039794921875,
0.08489990234375,
-0.7080078125,
-0.61767578125,
0.2412109375,
-0.87646484375,
-0.378173828125,
-0.6259765625,
-0.200927734375,
0.1883544921875,
-0.326416015625,
-1.119140625,
0.040252685546875,
-0.08392333984375,
0.6396484375,
0.47900390625,
-0.0090179443359375,
1.04296875,
1.0673828125,
0.302734375,
-0.2430419921875,
0.044525146484375,
-1.1201171875,
-0.468017578125,
-0.322998046875,
0.2447509765625,
-0.63330078125,
-0.449462890625,
-0.263916015625,
0.3779296875,
-0.11041259765625,
0.724609375,
-0.6494140625,
-1.123046875,
-0.20703125,
-0.254150390625,
-0.3271484375,
-0.33447265625,
-0.57275390625,
0.4384765625,
-0.286865234375,
0.57177734375,
-0.1695556640625,
-0.261474609375,
-0.360595703125,
0.301513671875,
-0.1639404296875,
-0.99951171875,
0.114990234375,
-0.045135498046875,
0.462646484375,
0.1883544921875,
-0.59228515625,
-0.280517578125,
0.4384765625,
-0.142333984375,
-0.0975341796875,
-0.1480712890625,
-0.6328125,
-0.306396484375,
0.476318359375,
-0.4775390625,
-0.45556640625,
-0.5185546875,
0.0232086181640625,
0.0181427001953125,
-0.0010709762573242188,
-0.68896484375,
0.78955078125,
0.2174072265625,
0.89306640625,
-0.287353515625,
0.10955810546875,
-0.380615234375,
-0.4150390625,
-0.06634521484375,
0.2294921875,
0.208251953125,
-0.1248779296875,
-0.337158203125,
0.52685546875,
-0.4453125,
0.09161376953125,
0.552734375,
0.497314453125,
-0.33544921875,
0.52294921875,
0.4775390625,
0.121826171875,
0.70849609375,
1.0751953125,
-0.55712890625,
0.82861328125,
-0.46484375,
0.281005859375,
0.239990234375,
-0.158935546875,
-0.0292205810546875,
-0.51513671875,
-0.22265625,
-0.0286102294921875,
0.283935546875,
0.25830078125,
-0.58251953125,
0.7998046875,
0.043548583984375,
0.394775390625,
-0.76171875,
0.77734375,
0.282470703125,
0.1051025390625,
0.55615234375,
0.014801025390625,
0.25390625,
-0.5517578125,
-0.51953125,
1.013671875,
-0.48046875,
0.34521484375,
0.1309814453125,
-0.22265625,
-0.427490234375,
0.44287109375,
-0.4990234375,
0.65625,
-0.39208984375,
0.74560546875,
0.515625,
-0.8984375,
0.54296875,
-0.323486328125,
0.11968994140625,
1.388671875,
0.55419921875,
-0.12744140625,
0.52099609375,
0.34375,
-0.6904296875,
0.31201171875,
-0.9248046875,
0.75537109375,
0.09222412109375,
0.255859375,
-0.1993408203125,
0.2049560546875,
-0.2578125,
0.3125,
0.1844482421875,
0.09832763671875,
-0.3974609375,
-0.09881591796875,
-0.544921875,
0.8251953125,
-0.4404296875,
0.58056640625,
-0.49462890625,
-0.094970703125,
-0.3408203125,
-0.322021484375,
0.06158447265625,
0.2081298828125,
0.07867431640625,
0.88427734375,
0.06634521484375,
1.3271484375,
0.9365234375,
0.11749267578125,
0.350830078125,
0.51025390625,
-0.22802734375,
0.177978515625,
0.0679931640625,
0.87548828125,
-0.0300445556640625,
0.2410888671875,
0.129638671875,
-0.04815673828125,
-0.44873046875,
-0.1168212890625,
-0.125732421875,
0.466796875,
-0.59033203125,
-0.12255859375,
0.012939453125,
0.1158447265625,
-0.8076171875,
0.0016717910766601562,
-0.2178955078125,
-1.00390625,
-0.34130859375,
0.67919921875,
0.35205078125,
0.377197265625,
-0.2459716796875,
-0.759765625,
0.4130859375,
1.3642578125,
-0.37744140625,
0.2333984375,
0.193603515625,
-0.230712890625,
-0.007659912109375,
0.1895751953125,
0.392333984375,
-0.2481689453125,
-0.5693359375,
0.857421875,
-0.264892578125,
0.376708984375,
0.18701171875,
0.70361328125,
0.2431640625,
0.72216796875,
-0.330322265625,
-0.58203125,
0.328369140625,
1.119140625,
-0.073486328125,
0.578125,
0.0297088623046875,
0.759765625,
0.428466796875,
0.802734375,
0.580078125,
-0.2000732421875,
0.286865234375,
0.9560546875,
0.259033203125,
0.2001953125,
0.2132568359375,
0.447998046875,
0.6572265625,
0.2288818359375,
0.08526611328125,
0.43017578125,
-0.01110076904296875,
0.00170135498046875,
-0.444091796875,
0.220947265625,
-0.58203125,
1.080078125,
0.14453125,
0.2330322265625,
-0.443603515625,
-0.171630859375,
0.1011962890625,
0.4912109375,
-0.609375,
-0.791015625,
-0.0020580291748046875,
0.04388427734375,
0.28173828125,
0.1898193359375,
0.5458984375,
0.75,
0.09368896484375,
0.541015625,
-0.293701171875,
-0.291015625,
-0.822265625,
-0.78125,
-0.94921875,
-0.380859375,
-0.68896484375,
-0.2247314453125,
0.471923828125,
-0.92822265625,
0.73974609375,
-0.3779296875,
0.056793212890625,
-0.338623046875,
-0.4990234375,
0.6162109375,
-0.1591796875,
0.6533203125,
-0.486572265625,
0.260498046875,
0.0833740234375,
0.896484375,
-0.341552734375,
-0.254150390625,
-0.314208984375,
-0.56298828125,
0.2386474609375,
0.02667236328125,
0.5439453125,
0.276611328125,
-0.57568359375,
-0.76416015625,
-0.65087890625,
-0.407470703125,
-0.51806640625,
0.343017578125,
-0.4306640625,
0.8271484375,
0.6005859375,
-0.7646484375,
0.486328125,
0.974609375,
-1.12890625,
0.76416015625,
0.474365234375,
-0.11968994140625,
-0.483642578125,
1.0380859375,
0.20556640625,
0.51171875,
-0.482666015625,
-0.66357421875,
-0.316162109375,
0.2724609375,
-0.1136474609375,
-0.7021484375,
-0.451171875,
0.705078125,
-0.340087890625,
-0.8544921875,
0.3505859375,
-1.0498046875,
-0.343994140625,
-0.414306640625,
-0.1505126953125,
0.93701171875,
1.0126953125,
0.400390625,
-0.247802734375,
-0.45703125,
-0.10260009765625,
0.69189453125,
0.64697265625,
-0.1710205078125,
-0.028594970703125,
0.88720703125,
0.159912109375,
0.30810546875,
0.1802978515625,
-0.29150390625,
-0.00612640380859375,
-0.1405029296875,
0.0672607421875,
0.50537109375,
0.31982421875,
-0.025421142578125,
0.407470703125,
0.6259765625,
-0.857421875,
-0.44775390625,
-0.453125,
0.75146484375,
-0.08355712890625,
0.427001953125,
0.30810546875,
-0.1636962890625,
-0.64892578125,
-1.009765625,
0.45361328125,
0.401611328125,
0.62939453125,
-1.107421875,
0.87841796875,
0.36474609375,
-0.36962890625,
-0.0027523040771484375,
-0.4423828125,
-0.05682373046875,
1.12890625,
0.01343536376953125,
0.67724609375,
-0.75341796875,
0.541015625,
0.2318115234375,
0.1954345703125,
0.97607421875,
0.289794921875,
0.2227783203125,
-0.2076416015625,
-0.552734375,
-0.3232421875,
0.155517578125,
-0.265380859375,
-0.34521484375,
0.35888671875,
0.0110931396484375,
-0.24267578125,
-0.6494140625,
0.43310546875,
0.69189453125,
0.39697265625,
-0.287109375,
0.52880859375,
0.190673828125,
0.412353515625,
0.458740234375,
-0.06500244140625,
0.31689453125,
-0.7607421875,
0.69873046875,
-0.03717041015625,
-0.322998046875,
-0.373046875,
-0.162109375,
0.09771728515625,
0.0946044921875,
0.399169921875,
0.05126953125,
-0.79248046875,
0.120361328125,
0.1824951171875,
0.57470703125,
-0.39111328125,
-0.3720703125,
-0.394775390625,
0.4169921875,
0.20263671875,
-0.78564453125,
0.4091796875,
-0.88916015625,
0.60546875,
0.1651611328125,
-0.029388427734375,
-0.226318359375,
-0.6298828125,
-0.89013671875,
-0.6513671875,
-0.06365966796875,
1.173828125,
0.056732177734375,
-0.2066650390625,
-1.1318359375,
0.210693359375,
0.286376953125,
-0.1942138671875,
-0.195068359375,
-0.365478515625,
0.174072265625,
-0.1650390625,
0.32763671875,
-0.8544921875,
-0.90234375,
0.0260467529296875,
-1.2919921875,
0.63916015625,
-0.55615234375,
0.69091796875,
-0.3701171875,
-0.2958984375,
0.052978515625,
-0.2296142578125,
-0.35693359375,
-0.03851318359375,
-0.382568359375,
0.4599609375,
-0.82421875,
-0.5810546875,
0.40673828125,
-0.337890625,
-0.346923828125,
1.0517578125,
-0.0243377685546875,
-0.3623046875,
-0.0518798828125,
0.38916015625,
-0.53662109375,
0.365234375,
-0.474609375,
0.6044921875,
-0.375732421875,
-0.7919921875,
-0.30419921875,
-0.8251953125,
0.7666015625,
-0.116943359375,
-0.91015625,
-0.12066650390625,
-1.0849609375,
-0.19580078125,
0.045684814453125,
-0.4599609375,
0.272216796875,
0.28369140625,
-0.323974609375,
0.23779296875,
-0.429931640625,
-0.27880859375,
-0.43798828125,
-0.5673828125,
-0.5380859375,
0.216552734375,
0.1588134765625,
0.87255859375,
-0.059661865234375,
-0.09124755859375,
0.1732177734375,
-0.107421875,
0.06097412109375,
-0.36669921875,
-0.46337890625,
0.007488250732421875,
-0.32666015625,
-0.327880859375,
0.36767578125,
-0.043243408203125,
0.55078125,
0.9443359375,
-0.0028514862060546875,
0.382080078125,
0.494873046875,
-0.546875,
0.74951171875,
-0.244384765625,
-0.599609375,
-0.33349609375,
0.8193359375,
0.1302490234375,
0.6982421875,
0.270751953125,
-1.0224609375,
-0.76123046875,
-0.67626953125,
-0.1370849609375,
-0.58984375,
0.0164947509765625,
-1.04296875,
-0.2003173828125,
-0.560546875,
0.391845703125,
0.007595062255859375,
-0.615234375,
0.0240478515625,
-0.73779296875,
0.240966796875,
-0.84765625,
-0.154541015625,
-0.76806640625,
-0.343994140625,
0.235107421875,
0.70361328125,
0.1636962890625,
0.64013671875,
0.281494140625,
-0.0017499923706054688,
0.30322265625,
-0.1502685546875,
-0.4130859375,
-0.49658203125,
-0.42529296875,
0.3583984375,
-0.25,
0.02923583984375,
-0.486572265625,
0.71533203125,
-0.81689453125,
0.1583251953125,
-0.38134765625,
-0.1666259765625,
0.1552734375,
-0.0435791015625,
1.1943359375,
0.06982421875,
0.08056640625,
-0.045562744140625,
0.4619140625,
0.4697265625,
-0.338134765625,
-0.537109375,
-0.212646484375,
-0.61279296875,
-0.8408203125,
0.796875,
-0.4716796875,
0.1060791015625,
-0.453369140625,
-0.443115234375,
1.0771484375,
-0.474365234375,
0.423095703125,
1.193359375,
0.043243408203125,
0.71923828125,
-0.35205078125,
0.6279296875,
0.44140625,
-0.311767578125,
-0.1798095703125,
0.0611572265625,
-0.65185546875,
0.0292205810546875,
-0.6044921875,
-0.97509765625,
-0.802734375,
0.34228515625,
1.248046875,
-0.07562255859375,
0.7763671875,
0.2066650390625,
-1.056640625,
-0.7119140625,
1.1171875,
0.51318359375,
0.11956787109375,
1.1591796875,
-0.277099609375,
0.047210693359375,
-0.25634765625,
-0.1527099609375,
-0.408447265625,
-0.45751953125,
1.0478515625,
-0.9638671875,
-0.55078125,
0.66943359375,
0.80712890625,
-1.0810546875,
-0.998046875,
-0.6259765625,
-0.2283935546875,
0.2099609375,
-0.5556640625,
0.1129150390625,
0.323974609375,
-0.39794921875,
0.071044921875,
0.286376953125,
0.053802490234375,
0.427490234375,
0.1845703125,
-0.0197601318359375,
-0.420166015625,
0.40625,
0.479736328125,
-0.82666015625,
0.0113677978515625,
-0.96630859375,
0.18017578125,
-0.1031494140625,
-0.05908203125,
0.87451171875,
-0.2259521484375,
0.34375,
0.10382080078125,
-0.324462890625,
0.30517578125,
-0.65087890625,
-0.37353515625,
0.62744140625,
-0.325927734375,
-0.381103515625,
-0.1815185546875,
0.66015625,
-0.1429443359375,
0.075439453125,
-0.408203125,
-0.035858154296875,
0.1400146484375,
0.427978515625,
-0.462158203125,
-0.93896484375,
-0.186767578125,
-1.357421875,
-0.55908203125,
-0.5615234375,
-0.29296875,
0.1953125,
0.402099609375,
-0.219482421875,
-0.638671875,
0.20654296875,
0.496826171875,
-0.381591796875,
0.80029296875,
-0.8046875,
0.29150390625,
-0.3427734375,
-0.1134033203125,
-0.79248046875,
-0.06939697265625,
-0.36767578125,
-0.1270751953125,
-0.59228515625,
0.2147216796875,
-0.1966552734375,
0.447509765625,
-0.10443115234375,
0.1942138671875,
-0.373291015625,
-0.623046875,
-0.159423828125,
0.0760498046875,
-0.09051513671875,
0.8564453125,
0.72314453125,
-0.423583984375,
0.1776123046875,
-0.055206298828125,
-0.29052734375,
-0.5771484375,
0.51025390625,
0.6220703125,
-0.428466796875,
-0.293212890625,
0.208984375,
0.434814453125,
-1.0224609375,
0.212158203125,
-0.4833984375,
0.489990234375,
0.0977783203125,
-0.2471923828125,
0.84423828125,
1.080078125,
-0.270263671875,
0.136962890625,
-0.15966796875,
0.00667572021484375,
0.8330078125,
-0.00021255016326904297,
0.068603515625,
0.42431640625,
0.037994384765625,
-0.56201171875,
0.03631591796875,
0.275146484375,
-0.1802978515625,
-0.046600341796875,
-0.02349853515625,
-0.41650390625,
-0.853515625,
-0.1376953125,
-0.293212890625,
0.482666015625,
0.55810546875,
-0.315673828125,
0.3056640625,
-0.2314453125,
-0.3994140625,
0.556640625,
-1.3876953125,
-0.88525390625,
0.044525146484375,
0.1761474609375,
-0.3701171875,
-0.11309814453125,
-0.47021484375,
-0.1470947265625,
-0.2958984375,
0.319091796875,
-0.307373046875,
0.3916015625,
-0.389404296875,
0.5771484375,
-0.1319580078125,
-0.3671875,
-0.181884765625,
0.685546875,
-0.310546875,
-0.8583984375,
-0.1312255859375,
0.99365234375,
0.276123046875,
-0.08056640625,
-0.023590087890625,
0.1729736328125,
-0.035736083984375,
0.2371826171875,
-0.599609375,
0.2249755859375,
-0.324951171875,
0.5283203125,
-1.1533203125,
-0.38232421875,
0.0643310546875,
0.439208984375,
0.2822265625,
-0.54931640625,
-0.285400390625,
0.81396484375,
0.65380859375,
0.01148223876953125,
0.286865234375,
0.089111328125,
0.345947265625,
-0.1783447265625,
0.06158447265625,
-0.284912109375,
0.62744140625,
0.87060546875,
0.5732421875,
-0.007801055908203125,
0.15185546875,
0.68896484375,
-0.4150390625,
-0.5087890625,
0.380859375,
0.06744384765625,
-0.11297607421875,
0.56201171875,
-0.071533203125,
-0.01459503173828125,
-0.308349609375,
-0.3828125,
0.31103515625,
-0.2587890625,
-0.08038330078125,
-0.10675048828125,
-0.5419921875,
1.2607421875,
-0.36767578125,
-0.11669921875,
0.1539306640625,
-0.63720703125,
0.455810546875,
0.7373046875,
-0.260498046875,
-0.3447265625,
0.7451171875,
0.6982421875,
0.521484375,
0.68359375,
0.5244140625,
0.071533203125,
-0.8466796875,
0.22998046875,
-0.08331298828125,
0.257080078125,
-0.53515625,
-0.366943359375,
-1.265625,
0.364501953125,
0.0056304931640625,
-0.36181640625,
0.740234375,
-0.83935546875,
-0.068603515625,
0.00868988037109375,
0.482421875,
-0.794921875,
0.4482421875,
0.52001953125,
-0.235595703125,
-0.494873046875,
0.86572265625,
-0.062744140625,
0.257080078125,
0.06610107421875,
1.3310546875,
-0.035064697265625,
1.380859375,
0.38525390625,
0.17578125,
0.308837890625,
0.42626953125,
-0.79541015625,
-0.84619140625,
-0.37060546875,
-0.442138671875,
-0.04815673828125,
-0.458984375,
-0.2607421875,
-0.2249755859375,
0.82666015625,
-0.01116180419921875,
-0.98779296875,
-0.3359375,
0.057220458984375,
-1.1630859375,
0.55029296875,
0.429443359375,
0.31103515625,
0.2105712890625,
-0.1168212890625,
0.0206756591796875,
-0.437255859375,
0.0670166015625,
-0.54150390625,
0.480224609375,
-0.92724609375,
-0.411865234375,
-0.27001953125,
-0.62548828125,
-0.63037109375,
0.250244140625,
-0.71240234375,
-0.748046875,
0.45068359375,
0.470458984375,
0.281494140625,
0.377197265625,
-0.2266845703125,
-0.2265625,
0.88671875,
0.87841796875,
0.168212890625,
0.72119140625,
0.3095703125,
-0.357421875,
-0.1231689453125,
-0.97607421875,
0.415283203125,
-0.23681640625,
-0.1129150390625,
-0.5654296875,
0.37060546875,
-0.59033203125,
-1.3974609375,
-0.12384033203125,
0.47265625,
0.1943359375,
-0.8388671875,
-1.099609375,
-0.227294921875,
-1.322265625,
-0.367431640625,
-0.64111328125,
1.00390625,
-0.0230865478515625,
0.032196044921875,
-0.09381103515625,
-1.2080078125,
4.47265625,
0.7880859375,
0.64111328125,
0.286376953125,
0.310546875,
1.2705078125,
0.6240234375,
-0.418701171875,
-0.6787109375,
-0.15625,
0.383544921875,
-0.15771484375,
0.0775146484375,
0.7744140625,
0.7275390625,
0.34228515625,
-0.5947265625,
-0.1917724609375,
-0.053863525390625,
-0.93359375,
-0.58251953125,
-0.11590576171875,
0.196044921875,
0.5537109375,
0.46630859375,
0.525390625,
0.5224609375,
-0.82275390625,
0.0626220703125,
-0.66455078125,
0.4208984375,
-0.8701171875,
0.78125,
0.40576171875,
-0.490478515625,
0.576171875,
0.12200927734375,
-0.2103271484375,
-0.1849365234375,
0.31982421875,
-0.2220458984375,
-0.12274169921875,
0.13916015625,
-0.353271484375,
0.05389404296875,
-0.043304443359375,
-0.52197265625,
0.38427734375,
0.283447265625,
-0.986328125,
0.60205078125,
-0.11236572265625,
0.1619873046875,
-0.45849609375,
-0.83642578125,
0.443603515625,
-0.10296630859375,
0.1734619140625,
-0.1241455078125,
0.94140625,
0.33349609375,
-0.00830841064453125,
-0.1795654296875,
0.44091796875,
-1,
1.0849609375,
-0.2044677734375,
0.419921875,
-0.392822265625,
0.0469970703125,
-0.1796875,
-0.6611328125,
-0.52001953125,
-0.6728515625,
0.53076171875,
0.49365234375,
0.2105712890625,
0.66845703125,
0.5625,
-0.8779296875,
0.033721923828125,
0.23291015625,
-0.167724609375,
-0.0005822181701660156,
0.65576171875,
1.3330078125,
-0.74755859375,
-0.325927734375,
-0.322021484375,
0.6259765625,
0.7939453125,
0.6630859375,
0.1529541015625,
-0.80517578125,
-0.256591796875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Submitted Solution:
```
s = input()
ans = 1
cnt = 0
for c in s:
cnt += 1
if c in ['A', 'I','U','E','O','Y']:
ans = max(cnt, ans)
cnt = 0
ans = max(ans, cnt+1)
print(ans)
```
Yes
| 35,636
|
[
0.293212890625,
-0.1160888671875,
-0.410400390625,
0.63671875,
-0.49462890625,
-0.190185546875,
0.494384765625,
0.06402587890625,
0.1871337890625,
0.7001953125,
0.51953125,
0.0029468536376953125,
0.037445068359375,
-0.76171875,
-0.6259765625,
0.17822265625,
-0.84521484375,
-0.395751953125,
-0.56494140625,
-0.2327880859375,
0.0635986328125,
-0.321533203125,
-1.0771484375,
0.05902099609375,
-0.10992431640625,
0.61669921875,
0.46142578125,
-0.059234619140625,
1.0830078125,
0.97802734375,
0.2496337890625,
-0.2498779296875,
0.11822509765625,
-0.9892578125,
-0.4365234375,
-0.361572265625,
0.328125,
-0.64599609375,
-0.467529296875,
-0.393798828125,
0.204833984375,
-0.10552978515625,
0.74365234375,
-0.55712890625,
-1.0546875,
-0.30126953125,
-0.19970703125,
-0.423095703125,
-0.267578125,
-0.5419921875,
0.5322265625,
-0.324462890625,
0.52587890625,
-0.244140625,
-0.08740234375,
-0.2086181640625,
0.364990234375,
-0.0189971923828125,
-1.048828125,
0.0267486572265625,
0.0289306640625,
0.5712890625,
0.115478515625,
-0.70068359375,
-0.317138671875,
0.5439453125,
-0.0634765625,
-0.12115478515625,
-0.16064453125,
-0.37744140625,
-0.328125,
0.323974609375,
-0.51806640625,
-0.339111328125,
-0.342041015625,
0.0506591796875,
-0.0009632110595703125,
0.0740966796875,
-0.79736328125,
0.77685546875,
0.2294921875,
1.0693359375,
-0.1552734375,
0.11688232421875,
-0.45263671875,
-0.303466796875,
0.014923095703125,
0.27587890625,
0.26416015625,
-0.06341552734375,
-0.287353515625,
0.421142578125,
-0.4140625,
0.02105712890625,
0.6552734375,
0.4697265625,
-0.35498046875,
0.513671875,
0.58642578125,
0.0295562744140625,
0.73828125,
0.93798828125,
-0.54638671875,
0.95068359375,
-0.50341796875,
0.26123046875,
0.2452392578125,
-0.2174072265625,
0.01027679443359375,
-0.603515625,
-0.1671142578125,
-0.01091766357421875,
0.2415771484375,
0.34619140625,
-0.61669921875,
0.7138671875,
-0.033355712890625,
0.460205078125,
-0.74658203125,
0.6318359375,
0.1705322265625,
0.0299530029296875,
0.61279296875,
0.0109405517578125,
0.43359375,
-0.4453125,
-0.67431640625,
0.9609375,
-0.47119140625,
0.288818359375,
0.1270751953125,
-0.2047119140625,
-0.46044921875,
0.4755859375,
-0.47705078125,
0.56103515625,
-0.380126953125,
0.6845703125,
0.476318359375,
-0.94287109375,
0.59130859375,
-0.14013671875,
0.1455078125,
1.494140625,
0.50634765625,
-0.225830078125,
0.3232421875,
0.3935546875,
-0.65087890625,
0.51904296875,
-0.89990234375,
0.697265625,
-0.04095458984375,
0.1387939453125,
-0.393310546875,
0.239990234375,
-0.26025390625,
0.325927734375,
0.33544921875,
0.03070068359375,
-0.397216796875,
0.023529052734375,
-0.6826171875,
0.80712890625,
-0.4541015625,
0.50146484375,
-0.4453125,
0.00789642333984375,
-0.2239990234375,
-0.276611328125,
-0.03173828125,
0.1837158203125,
0.285400390625,
0.912109375,
0.1988525390625,
1.30859375,
0.93115234375,
0.2137451171875,
0.2998046875,
0.494873046875,
-0.253173828125,
0.119384765625,
0.098388671875,
0.87255859375,
-0.06591796875,
0.25390625,
-0.0018262863159179688,
0.07916259765625,
-0.30224609375,
-0.14208984375,
-0.2109375,
0.5556640625,
-0.5712890625,
-0.057373046875,
-0.12408447265625,
0.0596923828125,
-0.7119140625,
-0.031341552734375,
-0.109619140625,
-1.0009765625,
-0.34814453125,
0.71875,
0.380615234375,
0.525390625,
-0.30908203125,
-0.869140625,
0.318603515625,
1.349609375,
-0.361572265625,
0.3525390625,
0.2578125,
-0.09649658203125,
-0.059356689453125,
-0.0599365234375,
0.445556640625,
-0.272216796875,
-0.59765625,
0.74365234375,
-0.258056640625,
0.31396484375,
0.235595703125,
0.66015625,
0.2489013671875,
0.708984375,
-0.44775390625,
-0.5185546875,
0.33837890625,
1.2509765625,
-0.08367919921875,
0.6240234375,
0.1824951171875,
0.76416015625,
0.431396484375,
0.8466796875,
0.62646484375,
-0.10687255859375,
0.50634765625,
0.9443359375,
0.1361083984375,
0.210205078125,
0.1893310546875,
0.483642578125,
0.69873046875,
0.3408203125,
0.0258331298828125,
0.490478515625,
-0.043792724609375,
-0.039886474609375,
-0.54638671875,
0.273193359375,
-0.59228515625,
1.01953125,
0.09613037109375,
0.36572265625,
-0.56884765625,
-0.153564453125,
0.1864013671875,
0.48876953125,
-0.57666015625,
-1.095703125,
0.052642822265625,
-0.0234527587890625,
0.254638671875,
0.2412109375,
0.4404296875,
0.60986328125,
0.06512451171875,
0.64599609375,
-0.2705078125,
-0.263916015625,
-0.771484375,
-0.81640625,
-1.119140625,
-0.451416015625,
-0.77001953125,
-0.296630859375,
0.403076171875,
-0.90234375,
0.66455078125,
-0.467041015625,
0.053009033203125,
-0.50537109375,
-0.36328125,
0.73291015625,
-0.2069091796875,
0.6806640625,
-0.447021484375,
0.2296142578125,
0.04425048828125,
0.84228515625,
-0.36865234375,
-0.233154296875,
-0.333251953125,
-0.5390625,
0.31103515625,
-0.10162353515625,
0.48681640625,
0.40234375,
-0.58154296875,
-0.76416015625,
-0.591796875,
-0.30224609375,
-0.47705078125,
0.2196044921875,
-0.42236328125,
0.8564453125,
0.463623046875,
-0.822265625,
0.47998046875,
0.9716796875,
-1.0986328125,
0.802734375,
0.56884765625,
-0.0265655517578125,
-0.45458984375,
1.1103515625,
0.2578125,
0.56640625,
-0.51025390625,
-0.638671875,
-0.392333984375,
0.221923828125,
-0.09857177734375,
-0.65283203125,
-0.488525390625,
0.740234375,
-0.30419921875,
-0.93017578125,
0.426025390625,
-1.1181640625,
-0.367919921875,
-0.417236328125,
-0.33935546875,
0.9443359375,
1.0185546875,
0.51220703125,
-0.2020263671875,
-0.6396484375,
-0.1497802734375,
0.619140625,
0.712890625,
-0.293212890625,
-0.043121337890625,
0.94580078125,
0.15234375,
0.468017578125,
0.333251953125,
-0.3466796875,
-0.024871826171875,
-0.12548828125,
-0.0012264251708984375,
0.58740234375,
0.292724609375,
0.00511932373046875,
0.367919921875,
0.66015625,
-0.9345703125,
-0.4150390625,
-0.5283203125,
0.7021484375,
-0.111328125,
0.40478515625,
0.5068359375,
-0.08782958984375,
-0.76123046875,
-0.92529296875,
0.463134765625,
0.1842041015625,
0.5654296875,
-1.0693359375,
0.93212890625,
0.290771484375,
-0.482666015625,
0.12384033203125,
-0.4814453125,
0.0992431640625,
1.1123046875,
0.066162109375,
0.59619140625,
-0.88134765625,
0.52197265625,
0.09564208984375,
0.08831787109375,
0.93115234375,
0.2734375,
0.3427734375,
-0.219970703125,
-0.55224609375,
-0.2464599609375,
0.2220458984375,
-0.2198486328125,
-0.41357421875,
0.397705078125,
-0.056365966796875,
-0.40283203125,
-0.7109375,
0.5205078125,
0.64013671875,
0.42919921875,
-0.261474609375,
0.4921875,
0.1417236328125,
0.353759765625,
0.53564453125,
0.044189453125,
0.257568359375,
-0.74169921875,
0.76611328125,
0.0721435546875,
-0.380615234375,
-0.32177734375,
-0.1927490234375,
0.06719970703125,
0.13623046875,
0.366455078125,
0.09033203125,
-0.8564453125,
0.1412353515625,
0.258544921875,
0.59814453125,
-0.56494140625,
-0.33837890625,
-0.39599609375,
0.39404296875,
0.22607421875,
-0.78857421875,
0.318115234375,
-1.001953125,
0.50048828125,
0.303955078125,
-0.08636474609375,
-0.31298828125,
-0.489501953125,
-0.91845703125,
-0.822265625,
-0.0936279296875,
1.19140625,
0.060394287109375,
-0.1754150390625,
-1.23828125,
0.25341796875,
0.362060546875,
-0.379638671875,
-0.1505126953125,
-0.4208984375,
0.1500244140625,
-0.1978759765625,
0.347412109375,
-0.8154296875,
-0.90283203125,
0.06341552734375,
-1.22265625,
0.6630859375,
-0.5009765625,
0.71240234375,
-0.287841796875,
-0.284912109375,
0.17041015625,
-0.1226806640625,
-0.34716796875,
-0.1072998046875,
-0.296875,
0.53662109375,
-0.86474609375,
-0.640625,
0.400390625,
-0.279541015625,
-0.401123046875,
1.134765625,
0.041595458984375,
-0.374755859375,
-0.0109405517578125,
0.312744140625,
-0.578125,
0.475341796875,
-0.5048828125,
0.564453125,
-0.27978515625,
-0.72119140625,
-0.260986328125,
-0.80712890625,
0.77978515625,
-0.2113037109375,
-0.81298828125,
-0.255615234375,
-1.14453125,
-0.278564453125,
-0.037109375,
-0.455078125,
0.2093505859375,
0.28369140625,
-0.30126953125,
0.186279296875,
-0.4150390625,
-0.404541015625,
-0.33203125,
-0.57470703125,
-0.466552734375,
0.1553955078125,
0.1505126953125,
0.8193359375,
-0.0987548828125,
-0.10589599609375,
0.08319091796875,
-0.1868896484375,
-0.029541015625,
-0.44970703125,
-0.47509765625,
0.0631103515625,
-0.498046875,
-0.369384765625,
0.448486328125,
-0.0535888671875,
0.54833984375,
0.92529296875,
-0.036590576171875,
0.382568359375,
0.4453125,
-0.64501953125,
0.91162109375,
-0.337158203125,
-0.76904296875,
-0.1671142578125,
0.85107421875,
0.236083984375,
0.84033203125,
0.07403564453125,
-0.96044921875,
-0.86572265625,
-0.6611328125,
-0.0675048828125,
-0.77099609375,
-0.05487060546875,
-1.111328125,
-0.2139892578125,
-0.60595703125,
0.44287109375,
-0.09368896484375,
-0.50048828125,
0.115234375,
-0.8408203125,
0.366943359375,
-0.95947265625,
-0.205322265625,
-0.73974609375,
-0.24365234375,
0.122314453125,
0.82666015625,
0.1370849609375,
0.64404296875,
0.259765625,
0.10992431640625,
0.2086181640625,
-0.06439208984375,
-0.41259765625,
-0.51025390625,
-0.36376953125,
0.30029296875,
-0.2578125,
-0.036529541015625,
-0.4990234375,
0.6103515625,
-0.81982421875,
0.08575439453125,
-0.365478515625,
-0.1995849609375,
0.265380859375,
-0.049591064453125,
1.283203125,
-0.0090789794921875,
0.1170654296875,
-0.07525634765625,
0.3603515625,
0.6044921875,
-0.317138671875,
-0.48193359375,
-0.262451171875,
-0.623046875,
-0.92431640625,
0.83349609375,
-0.388427734375,
0.1317138671875,
-0.4765625,
-0.47705078125,
1.0673828125,
-0.54345703125,
0.45263671875,
1.087890625,
-0.0189056396484375,
0.63720703125,
-0.369140625,
0.6904296875,
0.5556640625,
-0.24609375,
-0.1766357421875,
-0.0018186569213867188,
-0.71044921875,
0.0257720947265625,
-0.7177734375,
-1.0361328125,
-0.857421875,
0.35693359375,
1.1162109375,
-0.08343505859375,
0.85009765625,
0.152587890625,
-1.13671875,
-0.6513671875,
1.12109375,
0.411376953125,
-0.0089569091796875,
1.0869140625,
-0.2080078125,
-0.1416015625,
-0.154296875,
-0.190185546875,
-0.470458984375,
-0.447509765625,
1.1572265625,
-1.03515625,
-0.5712890625,
0.74853515625,
0.81396484375,
-1.2783203125,
-1.0634765625,
-0.75830078125,
-0.1759033203125,
0.316650390625,
-0.69873046875,
0.1536865234375,
0.251953125,
-0.305419921875,
0.08502197265625,
0.1934814453125,
-0.03631591796875,
0.468505859375,
0.2359619140625,
0.075439453125,
-0.53955078125,
0.29248046875,
0.515625,
-0.7822265625,
-0.1478271484375,
-0.91259765625,
0.26123046875,
-0.030731201171875,
0.0009045600891113281,
0.89111328125,
-0.311767578125,
0.42333984375,
0.299072265625,
-0.417724609375,
0.306640625,
-0.7119140625,
-0.2113037109375,
0.70068359375,
-0.3759765625,
-0.29541015625,
-0.259765625,
0.697265625,
-0.11444091796875,
0.167236328125,
-0.50732421875,
-0.12432861328125,
0.2459716796875,
0.469482421875,
-0.5146484375,
-0.7802734375,
-0.255615234375,
-1.2998046875,
-0.6962890625,
-0.479248046875,
-0.333984375,
0.2880859375,
0.50830078125,
-0.1580810546875,
-0.5576171875,
0.2325439453125,
0.5302734375,
-0.35205078125,
0.83642578125,
-0.8310546875,
0.367919921875,
-0.440673828125,
-0.032470703125,
-0.748046875,
-0.09808349609375,
-0.52392578125,
-0.27685546875,
-0.488525390625,
0.247314453125,
-0.1685791015625,
0.3955078125,
-0.2305908203125,
0.2362060546875,
-0.30908203125,
-0.4375,
-0.1083984375,
0.2529296875,
-0.3037109375,
0.939453125,
0.6630859375,
-0.370849609375,
0.2130126953125,
-0.0841064453125,
-0.2900390625,
-0.4599609375,
0.662109375,
0.56689453125,
-0.338134765625,
-0.39453125,
0.259521484375,
0.334716796875,
-0.98486328125,
0.247802734375,
-0.52587890625,
0.436279296875,
0.035736083984375,
-0.265380859375,
0.7314453125,
1.125,
-0.453369140625,
0.237060546875,
-0.0311737060546875,
0.0002677440643310547,
0.91796875,
0.04754638671875,
0.0638427734375,
0.426513671875,
0.0677490234375,
-0.7275390625,
0.004947662353515625,
0.3486328125,
-0.1148681640625,
-0.02490234375,
-0.079833984375,
-0.482666015625,
-0.96484375,
-0.080322265625,
-0.282470703125,
0.5107421875,
0.6455078125,
-0.330078125,
0.341064453125,
-0.237060546875,
-0.496826171875,
0.53857421875,
-1.4013671875,
-0.98779296875,
0.1690673828125,
0.1800537109375,
-0.468505859375,
0.00875091552734375,
-0.4267578125,
0.00681304931640625,
-0.2474365234375,
0.2110595703125,
-0.272705078125,
0.2841796875,
-0.330322265625,
0.58349609375,
-0.0831298828125,
-0.330322265625,
-0.2135009765625,
0.7001953125,
-0.371337890625,
-0.82421875,
-0.15380859375,
0.95654296875,
0.20068359375,
-0.2015380859375,
-0.00031638145446777344,
0.19677734375,
-0.1605224609375,
0.1854248046875,
-0.57763671875,
0.2144775390625,
-0.101806640625,
0.5302734375,
-1.0517578125,
-0.33154296875,
-0.0035686492919921875,
0.396240234375,
0.0865478515625,
-0.611328125,
-0.37646484375,
0.77099609375,
0.7197265625,
0.083740234375,
0.349609375,
0.042266845703125,
0.462646484375,
-0.24072265625,
0.12841796875,
-0.3740234375,
0.64599609375,
0.83837890625,
0.6328125,
0.0230255126953125,
0.321044921875,
0.72900390625,
-0.338623046875,
-0.385498046875,
0.483154296875,
0.09808349609375,
-0.1185302734375,
0.58642578125,
-0.1947021484375,
0.0198822021484375,
-0.1737060546875,
-0.432373046875,
0.28857421875,
-0.335205078125,
0.057830810546875,
-0.1466064453125,
-0.533203125,
1.271484375,
-0.44580078125,
-0.049713134765625,
0.05322265625,
-0.57763671875,
0.501953125,
0.71337890625,
-0.07470703125,
-0.278564453125,
0.83203125,
0.8310546875,
0.59033203125,
0.720703125,
0.51318359375,
-0.027923583984375,
-0.99755859375,
0.168701171875,
0.09259033203125,
0.1358642578125,
-0.509765625,
-0.322021484375,
-1.4375,
0.53515625,
0.10986328125,
-0.241455078125,
0.63623046875,
-0.92138671875,
-0.110107421875,
-0.039520263671875,
0.509765625,
-0.8974609375,
0.36865234375,
0.474365234375,
-0.2186279296875,
-0.5400390625,
0.982421875,
-0.049652099609375,
0.281494140625,
0.1102294921875,
1.2822265625,
0.024322509765625,
1.3974609375,
0.60205078125,
0.24365234375,
0.300048828125,
0.55908203125,
-0.7265625,
-0.80517578125,
-0.268310546875,
-0.461669921875,
-0.15576171875,
-0.468994140625,
-0.30908203125,
-0.27001953125,
0.81591796875,
0.00969696044921875,
-0.9189453125,
-0.45751953125,
0.054840087890625,
-1.0263671875,
0.65380859375,
0.30810546875,
0.467529296875,
0.298095703125,
-0.05108642578125,
-0.15576171875,
-0.4716796875,
0.050445556640625,
-0.38525390625,
0.482177734375,
-0.90625,
-0.433349609375,
-0.2469482421875,
-0.54248046875,
-0.62548828125,
0.285400390625,
-0.71728515625,
-0.79052734375,
0.51416015625,
0.443115234375,
0.1766357421875,
0.291259765625,
-0.38720703125,
-0.1534423828125,
0.85888671875,
0.84375,
0.038818359375,
0.75830078125,
0.3544921875,
-0.24658203125,
-0.2030029296875,
-0.89501953125,
0.50830078125,
-0.1689453125,
-0.03399658203125,
-0.6015625,
0.34619140625,
-0.6123046875,
-1.2587890625,
-0.1771240234375,
0.42138671875,
0.10052490234375,
-0.90478515625,
-1.232421875,
-0.39208984375,
-1.1552734375,
-0.292724609375,
-0.654296875,
0.951171875,
0.03240966796875,
-0.047882080078125,
-0.06939697265625,
-1.2158203125,
4.38671875,
0.76318359375,
0.5205078125,
0.12646484375,
0.376953125,
1.25390625,
0.607421875,
-0.439453125,
-0.6318359375,
-0.25146484375,
0.34912109375,
-0.1221923828125,
0.10791015625,
0.7529296875,
0.7421875,
0.420166015625,
-0.6259765625,
-0.4892578125,
0.044921875,
-0.97314453125,
-0.6025390625,
-0.07574462890625,
0.281494140625,
0.424560546875,
0.4091796875,
0.60791015625,
0.7294921875,
-0.88916015625,
0.00008875131607055664,
-0.6796875,
0.51806640625,
-0.849609375,
0.84619140625,
0.4521484375,
-0.5107421875,
0.658203125,
0.1156005859375,
-0.25732421875,
-0.236328125,
0.456298828125,
-0.284423828125,
0.006862640380859375,
0.279052734375,
-0.320068359375,
0.029022216796875,
0.11541748046875,
-0.5048828125,
0.470947265625,
0.313720703125,
-1,
0.72021484375,
-0.059967041015625,
0.233642578125,
-0.358154296875,
-0.8154296875,
0.41796875,
-0.077392578125,
0.0963134765625,
-0.15283203125,
0.9404296875,
0.297607421875,
0.0206756591796875,
-0.2626953125,
0.5888671875,
-1.046875,
0.92919921875,
-0.044921875,
0.350341796875,
-0.439453125,
0.056182861328125,
-0.333251953125,
-0.6640625,
-0.52734375,
-0.791015625,
0.58837890625,
0.53125,
0.19287109375,
0.59716796875,
0.5830078125,
-0.8466796875,
0.09735107421875,
0.1114501953125,
-0.06951904296875,
-0.10552978515625,
0.6484375,
1.38671875,
-0.76953125,
-0.394775390625,
-0.2685546875,
0.7138671875,
0.78662109375,
0.6982421875,
0.139892578125,
-0.85205078125,
-0.416748046875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Submitted Solution:
```
s=input()
v="AEIOUY"
prev=-1
maxi=0
for i in range(len(s)):
if s[i] in v:
maxi=max(maxi,i-prev)
prev=i
maxi=max(maxi,len(s)-prev)
print(maxi)
```
Yes
| 35,637
|
[
0.3115234375,
-0.1285400390625,
-0.406494140625,
0.6328125,
-0.55517578125,
-0.1866455078125,
0.450439453125,
0.08270263671875,
0.1890869140625,
0.69482421875,
0.5751953125,
0.0345458984375,
0.00841522216796875,
-0.7294921875,
-0.54345703125,
0.2255859375,
-0.80517578125,
-0.41064453125,
-0.56591796875,
-0.3076171875,
0.0121917724609375,
-0.25,
-1.10546875,
0.04833984375,
-0.1575927734375,
0.60107421875,
0.43505859375,
-0.07684326171875,
1.0908203125,
1.0205078125,
0.320556640625,
-0.26025390625,
0.15185546875,
-0.97998046875,
-0.434326171875,
-0.33251953125,
0.396728515625,
-0.6318359375,
-0.461669921875,
-0.397705078125,
0.1597900390625,
-0.05029296875,
0.7060546875,
-0.5869140625,
-1.068359375,
-0.302734375,
-0.199462890625,
-0.470458984375,
-0.292724609375,
-0.6015625,
0.53515625,
-0.2841796875,
0.498779296875,
-0.286376953125,
-0.130859375,
-0.180419921875,
0.39306640625,
-0.09442138671875,
-1.056640625,
-0.0168914794921875,
-0.056793212890625,
0.64990234375,
0.1434326171875,
-0.64404296875,
-0.3515625,
0.5576171875,
-0.05059814453125,
-0.18115234375,
-0.18359375,
-0.471435546875,
-0.290771484375,
0.34765625,
-0.48681640625,
-0.29296875,
-0.3271484375,
0.050811767578125,
-0.00952911376953125,
0.01303863525390625,
-0.7822265625,
0.7490234375,
0.19873046875,
1.1025390625,
-0.09747314453125,
0.1146240234375,
-0.47265625,
-0.295654296875,
0.017181396484375,
0.2403564453125,
0.255615234375,
-0.07025146484375,
-0.26318359375,
0.446533203125,
-0.449951171875,
0.0181427001953125,
0.681640625,
0.496337890625,
-0.326416015625,
0.4912109375,
0.5615234375,
-0.0272979736328125,
0.78955078125,
0.89501953125,
-0.58349609375,
0.97509765625,
-0.49609375,
0.30322265625,
0.2783203125,
-0.207275390625,
-0.017669677734375,
-0.62939453125,
-0.1712646484375,
-0.06561279296875,
0.26025390625,
0.376953125,
-0.5810546875,
0.72802734375,
-0.020751953125,
0.419189453125,
-0.78076171875,
0.6171875,
0.127685546875,
0.0237884521484375,
0.60888671875,
0.00981903076171875,
0.411376953125,
-0.481201171875,
-0.671875,
1.0068359375,
-0.483154296875,
0.321533203125,
0.112548828125,
-0.156005859375,
-0.43310546875,
0.425537109375,
-0.443359375,
0.58935546875,
-0.3896484375,
0.69921875,
0.477783203125,
-0.9228515625,
0.55224609375,
-0.1434326171875,
0.1634521484375,
1.50390625,
0.498046875,
-0.20068359375,
0.32421875,
0.384033203125,
-0.6982421875,
0.5126953125,
-0.8779296875,
0.6513671875,
-0.056732177734375,
0.0992431640625,
-0.386474609375,
0.2413330078125,
-0.221923828125,
0.305419921875,
0.334228515625,
0.051116943359375,
-0.414306640625,
0.0341796875,
-0.63134765625,
0.83447265625,
-0.446044921875,
0.479736328125,
-0.373291015625,
-0.0148468017578125,
-0.2093505859375,
-0.256591796875,
-0.019195556640625,
0.1622314453125,
0.274658203125,
0.8916015625,
0.1707763671875,
1.3291015625,
0.91748046875,
0.1939697265625,
0.3466796875,
0.487548828125,
-0.279541015625,
0.1287841796875,
0.08349609375,
0.89013671875,
-0.08001708984375,
0.232421875,
0.0187530517578125,
0.12066650390625,
-0.261474609375,
-0.17041015625,
-0.220947265625,
0.5966796875,
-0.6025390625,
-0.002399444580078125,
-0.1202392578125,
0.08184814453125,
-0.63232421875,
-0.07427978515625,
-0.09130859375,
-1.0849609375,
-0.427490234375,
0.6982421875,
0.42626953125,
0.53125,
-0.313232421875,
-0.88525390625,
0.275146484375,
1.318359375,
-0.3544921875,
0.32470703125,
0.2408447265625,
-0.144287109375,
-0.06231689453125,
-0.08636474609375,
0.40673828125,
-0.30029296875,
-0.51513671875,
0.75537109375,
-0.259521484375,
0.391357421875,
0.251953125,
0.669921875,
0.262939453125,
0.6650390625,
-0.5078125,
-0.471435546875,
0.320556640625,
1.2353515625,
-0.07232666015625,
0.58544921875,
0.2435302734375,
0.7802734375,
0.41845703125,
0.88232421875,
0.62841796875,
-0.12939453125,
0.5322265625,
0.95361328125,
0.11566162109375,
0.24072265625,
0.17724609375,
0.55029296875,
0.6689453125,
0.3525390625,
0.006069183349609375,
0.52880859375,
-0.025634765625,
-0.056488037109375,
-0.52197265625,
0.2335205078125,
-0.60302734375,
0.9873046875,
0.061248779296875,
0.383544921875,
-0.483154296875,
-0.1741943359375,
0.1737060546875,
0.45166015625,
-0.5869140625,
-1.0673828125,
-0.03704833984375,
-0.049560546875,
0.25390625,
0.24462890625,
0.485107421875,
0.64208984375,
0.1064453125,
0.6259765625,
-0.25830078125,
-0.2066650390625,
-0.77685546875,
-0.82958984375,
-1.1396484375,
-0.4619140625,
-0.72021484375,
-0.270263671875,
0.349609375,
-0.86962890625,
0.63623046875,
-0.47216796875,
0.07647705078125,
-0.51025390625,
-0.369140625,
0.7431640625,
-0.2288818359375,
0.685546875,
-0.387939453125,
0.254638671875,
0.09967041015625,
0.849609375,
-0.37646484375,
-0.281005859375,
-0.280517578125,
-0.481689453125,
0.260986328125,
-0.10479736328125,
0.486083984375,
0.468505859375,
-0.6044921875,
-0.7587890625,
-0.60693359375,
-0.297119140625,
-0.4912109375,
0.257080078125,
-0.41796875,
0.89306640625,
0.4814453125,
-0.833984375,
0.458251953125,
0.9384765625,
-1.091796875,
0.8720703125,
0.52587890625,
-0.04437255859375,
-0.470703125,
1.1875,
0.2156982421875,
0.54541015625,
-0.56396484375,
-0.67236328125,
-0.349853515625,
0.262939453125,
-0.0828857421875,
-0.63525390625,
-0.447509765625,
0.71142578125,
-0.262451171875,
-0.93359375,
0.46484375,
-1.1103515625,
-0.297119140625,
-0.40380859375,
-0.33349609375,
0.9580078125,
1.0673828125,
0.52783203125,
-0.189697265625,
-0.71142578125,
-0.1849365234375,
0.6064453125,
0.6279296875,
-0.21435546875,
-0.00820159912109375,
0.9482421875,
0.12054443359375,
0.5244140625,
0.313232421875,
-0.338623046875,
-0.0037555694580078125,
-0.10821533203125,
-0.018402099609375,
0.54052734375,
0.306640625,
0.041839599609375,
0.374755859375,
0.6748046875,
-0.94775390625,
-0.409912109375,
-0.477783203125,
0.66845703125,
-0.0821533203125,
0.38671875,
0.4453125,
-0.0255584716796875,
-0.72412109375,
-0.935546875,
0.444091796875,
0.2275390625,
0.517578125,
-1.03515625,
0.91259765625,
0.298095703125,
-0.48193359375,
0.1395263671875,
-0.489013671875,
0.05657958984375,
1.130859375,
0.034210205078125,
0.576171875,
-0.85009765625,
0.5302734375,
0.068603515625,
0.0430908203125,
0.85546875,
0.1785888671875,
0.333740234375,
-0.284423828125,
-0.57177734375,
-0.2646484375,
0.1944580078125,
-0.2415771484375,
-0.381103515625,
0.4404296875,
-0.1131591796875,
-0.394775390625,
-0.72265625,
0.51904296875,
0.65869140625,
0.484130859375,
-0.242919921875,
0.48681640625,
0.1259765625,
0.285888671875,
0.55517578125,
0.0352783203125,
0.263916015625,
-0.720703125,
0.74658203125,
0.1507568359375,
-0.35302734375,
-0.313720703125,
-0.21240234375,
0.06988525390625,
0.140625,
0.42724609375,
0.11712646484375,
-0.81884765625,
0.16162109375,
0.2484130859375,
0.62744140625,
-0.5830078125,
-0.4453125,
-0.40673828125,
0.38330078125,
0.2261962890625,
-0.77685546875,
0.286376953125,
-1.0263671875,
0.53125,
0.2437744140625,
-0.1522216796875,
-0.320556640625,
-0.50146484375,
-0.99951171875,
-0.80078125,
-0.0322265625,
1.2412109375,
0.0294036865234375,
-0.1995849609375,
-1.2294921875,
0.2388916015625,
0.3740234375,
-0.35107421875,
-0.1800537109375,
-0.4326171875,
0.137451171875,
-0.2264404296875,
0.36767578125,
-0.84375,
-0.935546875,
0.07843017578125,
-1.283203125,
0.67333984375,
-0.50830078125,
0.70556640625,
-0.31298828125,
-0.33056640625,
0.1639404296875,
-0.0926513671875,
-0.376953125,
-0.052703857421875,
-0.251953125,
0.54150390625,
-0.92138671875,
-0.630859375,
0.419921875,
-0.29833984375,
-0.358642578125,
1.13671875,
0.076171875,
-0.39306640625,
0.0033721923828125,
0.28125,
-0.623046875,
0.483154296875,
-0.490478515625,
0.5341796875,
-0.26611328125,
-0.69140625,
-0.283203125,
-0.82421875,
0.7548828125,
-0.216552734375,
-0.72998046875,
-0.3115234375,
-1.134765625,
-0.2327880859375,
-0.077392578125,
-0.48046875,
0.209716796875,
0.301025390625,
-0.346923828125,
0.220703125,
-0.42138671875,
-0.371826171875,
-0.331787109375,
-0.51123046875,
-0.50341796875,
0.165283203125,
0.1832275390625,
0.833984375,
-0.08721923828125,
-0.1439208984375,
0.10052490234375,
-0.2261962890625,
-0.016021728515625,
-0.51171875,
-0.4208984375,
0.0631103515625,
-0.492431640625,
-0.328125,
0.444091796875,
-0.0526123046875,
0.564453125,
0.8818359375,
-0.037445068359375,
0.485595703125,
0.453857421875,
-0.671875,
0.92138671875,
-0.337646484375,
-0.7802734375,
-0.141845703125,
0.822265625,
0.201416015625,
0.85205078125,
0.08453369140625,
-0.9365234375,
-0.86767578125,
-0.6875,
-0.0787353515625,
-0.7666015625,
-0.053314208984375,
-1.0927734375,
-0.20849609375,
-0.5869140625,
0.473876953125,
-0.05682373046875,
-0.53173828125,
0.154541015625,
-0.81787109375,
0.385986328125,
-0.92431640625,
-0.213134765625,
-0.73583984375,
-0.219482421875,
0.1314697265625,
0.78369140625,
0.140869140625,
0.6435546875,
0.27001953125,
0.08258056640625,
0.185302734375,
-0.06890869140625,
-0.40673828125,
-0.529296875,
-0.38037109375,
0.2255859375,
-0.2008056640625,
-0.06121826171875,
-0.50341796875,
0.62548828125,
-0.7958984375,
0.1563720703125,
-0.41845703125,
-0.1419677734375,
0.2401123046875,
-0.08746337890625,
1.2373046875,
0.0614013671875,
0.135498046875,
-0.037200927734375,
0.40869140625,
0.6630859375,
-0.292236328125,
-0.456787109375,
-0.257568359375,
-0.63720703125,
-0.923828125,
0.87353515625,
-0.373779296875,
0.138916015625,
-0.52685546875,
-0.482177734375,
1.1259765625,
-0.52197265625,
0.441650390625,
1.12109375,
-0.003841400146484375,
0.62890625,
-0.431396484375,
0.65380859375,
0.57275390625,
-0.2196044921875,
-0.148193359375,
0.0162506103515625,
-0.73779296875,
0.034210205078125,
-0.68505859375,
-1.0048828125,
-0.8583984375,
0.360107421875,
1.1279296875,
-0.11566162109375,
0.80712890625,
0.147705078125,
-1.1474609375,
-0.64990234375,
1.11328125,
0.45263671875,
-0.047454833984375,
1.1064453125,
-0.180419921875,
-0.1651611328125,
-0.1436767578125,
-0.173583984375,
-0.4248046875,
-0.44970703125,
1.2216796875,
-1.03125,
-0.5556640625,
0.83984375,
0.8330078125,
-1.2998046875,
-1.0791015625,
-0.7373046875,
-0.1707763671875,
0.277099609375,
-0.6845703125,
0.1629638671875,
0.2437744140625,
-0.3759765625,
0.1407470703125,
0.216552734375,
-0.035125732421875,
0.484619140625,
0.306396484375,
0.12310791015625,
-0.50439453125,
0.251953125,
0.50390625,
-0.810546875,
-0.16796875,
-0.92333984375,
0.2471923828125,
-0.0770263671875,
-0.038818359375,
0.82568359375,
-0.318359375,
0.433837890625,
0.28759765625,
-0.416748046875,
0.3173828125,
-0.732421875,
-0.2421875,
0.6484375,
-0.403076171875,
-0.343994140625,
-0.281982421875,
0.6708984375,
-0.13330078125,
0.2305908203125,
-0.50146484375,
-0.1148681640625,
0.281982421875,
0.427978515625,
-0.47998046875,
-0.76953125,
-0.248291015625,
-1.2919921875,
-0.701171875,
-0.5654296875,
-0.321533203125,
0.27783203125,
0.490478515625,
-0.122802734375,
-0.599609375,
0.263671875,
0.52392578125,
-0.386474609375,
0.822265625,
-0.849609375,
0.341064453125,
-0.45068359375,
-0.02880859375,
-0.71435546875,
-0.10430908203125,
-0.52392578125,
-0.233154296875,
-0.52197265625,
0.224609375,
-0.1693115234375,
0.41064453125,
-0.222412109375,
0.1932373046875,
-0.3056640625,
-0.41259765625,
-0.0283660888671875,
0.317626953125,
-0.399169921875,
0.892578125,
0.66650390625,
-0.34326171875,
0.19091796875,
-0.09979248046875,
-0.2381591796875,
-0.418701171875,
0.623046875,
0.541015625,
-0.328369140625,
-0.3994140625,
0.2388916015625,
0.344482421875,
-0.93798828125,
0.2113037109375,
-0.53564453125,
0.433349609375,
0.0777587890625,
-0.2626953125,
0.677734375,
1.095703125,
-0.419189453125,
0.279541015625,
-0.007099151611328125,
-0.049713134765625,
0.931640625,
0.0670166015625,
0.1160888671875,
0.413330078125,
0.037445068359375,
-0.65234375,
0.0013761520385742188,
0.34423828125,
-0.11138916015625,
-0.0146331787109375,
-0.0888671875,
-0.498291015625,
-1.0048828125,
-0.125732421875,
-0.2095947265625,
0.42529296875,
0.65380859375,
-0.364501953125,
0.3740234375,
-0.270751953125,
-0.456787109375,
0.5478515625,
-1.466796875,
-0.97607421875,
0.2176513671875,
0.169921875,
-0.42578125,
0.04644775390625,
-0.44482421875,
0.02630615234375,
-0.2354736328125,
0.210205078125,
-0.28466796875,
0.28515625,
-0.326416015625,
0.552734375,
-0.03436279296875,
-0.30859375,
-0.211669921875,
0.6875,
-0.403076171875,
-0.82275390625,
-0.1697998046875,
0.90673828125,
0.1265869140625,
-0.2269287109375,
0.00004076957702636719,
0.206298828125,
-0.1715087890625,
0.2271728515625,
-0.6005859375,
0.1793212890625,
-0.1434326171875,
0.52001953125,
-1.029296875,
-0.31298828125,
0.0230560302734375,
0.429931640625,
0.075927734375,
-0.60302734375,
-0.347412109375,
0.77587890625,
0.7314453125,
0.1666259765625,
0.375,
0.0711669921875,
0.4697265625,
-0.1988525390625,
0.11468505859375,
-0.337646484375,
0.67138671875,
0.87353515625,
0.6435546875,
-0.003086090087890625,
0.312255859375,
0.763671875,
-0.33203125,
-0.361083984375,
0.499267578125,
0.085693359375,
-0.1702880859375,
0.62060546875,
-0.1995849609375,
0.00922393798828125,
-0.25048828125,
-0.433837890625,
0.201416015625,
-0.31005859375,
-0.00814056396484375,
-0.1400146484375,
-0.483642578125,
1.26171875,
-0.413330078125,
-0.059051513671875,
0.05401611328125,
-0.58740234375,
0.5458984375,
0.6884765625,
-0.05584716796875,
-0.26953125,
0.8251953125,
0.82861328125,
0.58740234375,
0.68994140625,
0.51318359375,
0.02301025390625,
-0.99462890625,
0.250244140625,
0.07330322265625,
0.11474609375,
-0.5048828125,
-0.349609375,
-1.505859375,
0.5439453125,
0.12213134765625,
-0.250732421875,
0.57763671875,
-0.95068359375,
-0.114013671875,
0.0194244384765625,
0.501953125,
-0.86328125,
0.336181640625,
0.4501953125,
-0.2015380859375,
-0.490234375,
0.962890625,
0.00519561767578125,
0.2176513671875,
0.04315185546875,
1.2861328125,
0.01264190673828125,
1.390625,
0.6171875,
0.1893310546875,
0.240234375,
0.6171875,
-0.70654296875,
-0.83447265625,
-0.269287109375,
-0.50146484375,
-0.148681640625,
-0.5087890625,
-0.323974609375,
-0.25341796875,
0.8662109375,
0.021453857421875,
-0.87158203125,
-0.474365234375,
0.058349609375,
-1.0244140625,
0.650390625,
0.2734375,
0.429931640625,
0.2264404296875,
-0.0511474609375,
-0.1527099609375,
-0.51318359375,
0.0291290283203125,
-0.428466796875,
0.4384765625,
-0.93701171875,
-0.45654296875,
-0.2435302734375,
-0.51171875,
-0.6318359375,
0.284912109375,
-0.681640625,
-0.7216796875,
0.53173828125,
0.4619140625,
0.1778564453125,
0.293701171875,
-0.307861328125,
-0.1585693359375,
0.8818359375,
0.826171875,
0.0458984375,
0.74169921875,
0.341552734375,
-0.304443359375,
-0.139404296875,
-0.89453125,
0.492919921875,
-0.16064453125,
-0.05426025390625,
-0.60888671875,
0.332275390625,
-0.64111328125,
-1.2802734375,
-0.166748046875,
0.384521484375,
0.04229736328125,
-0.86279296875,
-1.2705078125,
-0.4228515625,
-1.0947265625,
-0.2276611328125,
-0.68603515625,
0.9775390625,
0.06280517578125,
-0.1031494140625,
-0.047637939453125,
-1.154296875,
4.3828125,
0.82080078125,
0.501953125,
0.1815185546875,
0.38671875,
1.224609375,
0.59765625,
-0.483642578125,
-0.6123046875,
-0.279296875,
0.3984375,
-0.09698486328125,
0.1044921875,
0.79736328125,
0.7607421875,
0.44677734375,
-0.58544921875,
-0.458251953125,
0.016357421875,
-0.93603515625,
-0.6396484375,
-0.062103271484375,
0.273193359375,
0.399169921875,
0.434814453125,
0.62744140625,
0.72509765625,
-0.86474609375,
0.006793975830078125,
-0.7373046875,
0.52734375,
-0.84326171875,
0.8359375,
0.40625,
-0.49267578125,
0.65869140625,
0.132080078125,
-0.306396484375,
-0.230712890625,
0.464599609375,
-0.2890625,
-0.0152740478515625,
0.295654296875,
-0.340576171875,
-0.01885986328125,
0.1258544921875,
-0.4677734375,
0.464599609375,
0.302978515625,
-0.9873046875,
0.7119140625,
-0.10980224609375,
0.245361328125,
-0.38916015625,
-0.82080078125,
0.46142578125,
-0.0848388671875,
0.0869140625,
-0.12139892578125,
0.97216796875,
0.291015625,
0.0767822265625,
-0.3125,
0.64453125,
-1.1103515625,
0.87744140625,
-0.091064453125,
0.328857421875,
-0.51806640625,
0.0193328857421875,
-0.336181640625,
-0.6357421875,
-0.444580078125,
-0.76806640625,
0.60400390625,
0.489990234375,
0.17578125,
0.59423828125,
0.544921875,
-0.849609375,
0.09344482421875,
0.09100341796875,
-0.0282135009765625,
-0.11163330078125,
0.6103515625,
1.375,
-0.7421875,
-0.450439453125,
-0.274169921875,
0.73046875,
0.72216796875,
0.6611328125,
0.1976318359375,
-0.8291015625,
-0.50244140625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Submitted Solution:
```
import sys
fin = sys.stdin
fout = sys.stdout
m = -1
gl = {'A', 'E', 'I', 'O', 'U', 'Y'}
s = fin.readline().strip()
cur = -1
for i in range(len(s)):
if s[i] in gl:
m = max(m, i - cur)
cur = i
m = max(m, len(s) - cur)
fout.write(str(m))
```
Yes
| 35,638
|
[
0.2384033203125,
-0.1597900390625,
-0.392578125,
0.6376953125,
-0.49853515625,
-0.1884765625,
0.45556640625,
0.04693603515625,
0.191650390625,
0.69970703125,
0.525390625,
-0.046142578125,
0.07904052734375,
-0.765625,
-0.60595703125,
0.207275390625,
-0.87890625,
-0.4775390625,
-0.576171875,
-0.1890869140625,
0.169677734375,
-0.325927734375,
-0.99560546875,
0.1220703125,
-0.09490966796875,
0.57373046875,
0.449951171875,
-0.033843994140625,
1.05859375,
0.96533203125,
0.2239990234375,
-0.278564453125,
0.06170654296875,
-1.0908203125,
-0.39892578125,
-0.382080078125,
0.30517578125,
-0.67626953125,
-0.53173828125,
-0.467529296875,
0.182861328125,
-0.06597900390625,
0.76318359375,
-0.59326171875,
-1.0390625,
-0.27978515625,
-0.2059326171875,
-0.482666015625,
-0.236328125,
-0.5419921875,
0.50341796875,
-0.259033203125,
0.45166015625,
-0.260986328125,
-0.1268310546875,
-0.2332763671875,
0.297119140625,
-0.051788330078125,
-1.01171875,
-0.01690673828125,
-0.044952392578125,
0.56884765625,
0.1375732421875,
-0.68115234375,
-0.2105712890625,
0.64794921875,
0.000019669532775878906,
-0.0992431640625,
-0.170654296875,
-0.436279296875,
-0.36328125,
0.365234375,
-0.57470703125,
-0.431396484375,
-0.397216796875,
-0.045440673828125,
0.039215087890625,
0.1890869140625,
-0.80908203125,
0.79345703125,
0.23681640625,
1.0791015625,
-0.164306640625,
0.12298583984375,
-0.447509765625,
-0.32177734375,
0.0259552001953125,
0.2236328125,
0.216064453125,
-0.0750732421875,
-0.29248046875,
0.401123046875,
-0.3896484375,
0.031585693359375,
0.60791015625,
0.439208984375,
-0.335205078125,
0.455810546875,
0.50830078125,
0.0794677734375,
0.7119140625,
0.99951171875,
-0.5576171875,
0.95166015625,
-0.41943359375,
0.2332763671875,
0.30126953125,
-0.1839599609375,
-0.0653076171875,
-0.58251953125,
-0.1639404296875,
-0.0723876953125,
0.2008056640625,
0.364501953125,
-0.611328125,
0.67333984375,
0.0213470458984375,
0.5,
-0.7587890625,
0.662109375,
0.2125244140625,
0.052398681640625,
0.6357421875,
-0.07904052734375,
0.394287109375,
-0.474365234375,
-0.69140625,
0.93603515625,
-0.46435546875,
0.1944580078125,
0.08905029296875,
-0.180419921875,
-0.49169921875,
0.444091796875,
-0.4541015625,
0.62353515625,
-0.355712890625,
0.6484375,
0.50146484375,
-0.91064453125,
0.55078125,
-0.2286376953125,
0.10418701171875,
1.556640625,
0.489013671875,
-0.1951904296875,
0.350830078125,
0.475830078125,
-0.60693359375,
0.5498046875,
-0.91015625,
0.6845703125,
-0.01435089111328125,
0.0953369140625,
-0.31591796875,
0.2135009765625,
-0.284423828125,
0.41064453125,
0.328857421875,
0.10040283203125,
-0.411376953125,
0.06585693359375,
-0.623046875,
0.78515625,
-0.42138671875,
0.6181640625,
-0.438720703125,
-0.10430908203125,
-0.258544921875,
-0.2066650390625,
0.0213775634765625,
0.178466796875,
0.280029296875,
0.931640625,
0.2120361328125,
1.263671875,
0.9462890625,
0.1558837890625,
0.31005859375,
0.51708984375,
-0.3564453125,
0.191650390625,
0.1368408203125,
0.88427734375,
-0.0307769775390625,
0.316162109375,
0.09857177734375,
0.0246429443359375,
-0.330078125,
-0.1497802734375,
-0.2376708984375,
0.5654296875,
-0.60986328125,
-0.06292724609375,
-0.1063232421875,
0.0166168212890625,
-0.64208984375,
-0.075927734375,
-0.1944580078125,
-1.0322265625,
-0.35498046875,
0.779296875,
0.390869140625,
0.4560546875,
-0.25634765625,
-0.91455078125,
0.371337890625,
1.4736328125,
-0.346435546875,
0.379638671875,
0.239013671875,
-0.1728515625,
-0.1141357421875,
-0.05743408203125,
0.4716796875,
-0.2471923828125,
-0.47607421875,
0.71142578125,
-0.259033203125,
0.342041015625,
0.219970703125,
0.662109375,
0.251953125,
0.66259765625,
-0.46728515625,
-0.5029296875,
0.31787109375,
1.185546875,
-0.1146240234375,
0.5693359375,
0.07867431640625,
0.75146484375,
0.358642578125,
0.845703125,
0.5380859375,
-0.1416015625,
0.56689453125,
0.95556640625,
0.12054443359375,
0.2274169921875,
0.07110595703125,
0.51806640625,
0.5458984375,
0.283203125,
0.10198974609375,
0.41064453125,
-0.07574462890625,
-0.0247039794921875,
-0.5556640625,
0.28466796875,
-0.59814453125,
1.09375,
0.0614013671875,
0.26171875,
-0.5185546875,
-0.251953125,
0.1409912109375,
0.450927734375,
-0.64404296875,
-1.0126953125,
0.1494140625,
0.015350341796875,
0.27978515625,
0.1864013671875,
0.485107421875,
0.6328125,
0.0218505859375,
0.63525390625,
-0.2880859375,
-0.2705078125,
-0.78466796875,
-0.82177734375,
-1.0419921875,
-0.469970703125,
-0.78076171875,
-0.2919921875,
0.366455078125,
-0.9052734375,
0.5703125,
-0.435546875,
0.165283203125,
-0.402099609375,
-0.308837890625,
0.73828125,
-0.2127685546875,
0.5693359375,
-0.43359375,
0.224609375,
0.0149993896484375,
0.95166015625,
-0.313720703125,
-0.18212890625,
-0.371826171875,
-0.42626953125,
0.317626953125,
-0.075927734375,
0.4677734375,
0.434326171875,
-0.5244140625,
-0.7646484375,
-0.650390625,
-0.3564453125,
-0.4775390625,
0.1751708984375,
-0.362548828125,
0.8486328125,
0.46240234375,
-0.921875,
0.56396484375,
1.0078125,
-1.060546875,
0.7548828125,
0.525390625,
-0.05609130859375,
-0.445556640625,
1.1953125,
0.199462890625,
0.51025390625,
-0.5224609375,
-0.6865234375,
-0.31494140625,
0.230712890625,
-0.145263671875,
-0.64208984375,
-0.5029296875,
0.7470703125,
-0.269287109375,
-0.8984375,
0.457763671875,
-1.109375,
-0.27587890625,
-0.36962890625,
-0.3837890625,
0.94482421875,
1.0751953125,
0.52392578125,
-0.260498046875,
-0.61767578125,
-0.1395263671875,
0.69287109375,
0.62841796875,
-0.273681640625,
0.00017273426055908203,
1.0087890625,
0.1356201171875,
0.46240234375,
0.345947265625,
-0.36474609375,
0.027374267578125,
-0.2071533203125,
-0.0341796875,
0.52978515625,
0.325927734375,
0.068115234375,
0.3740234375,
0.62060546875,
-0.99267578125,
-0.446533203125,
-0.5234375,
0.68798828125,
-0.0869140625,
0.403564453125,
0.53662109375,
0.0360107421875,
-0.77978515625,
-0.89892578125,
0.37158203125,
0.1727294921875,
0.58154296875,
-1.02734375,
0.9326171875,
0.22314453125,
-0.4990234375,
0.11065673828125,
-0.5029296875,
0.037078857421875,
1.15625,
0.0008101463317871094,
0.61767578125,
-0.875,
0.57080078125,
0.09771728515625,
0.07476806640625,
0.91162109375,
0.290283203125,
0.3193359375,
-0.208984375,
-0.52783203125,
-0.322998046875,
0.1787109375,
-0.2474365234375,
-0.362060546875,
0.38916015625,
-0.04248046875,
-0.41552734375,
-0.73193359375,
0.5048828125,
0.69580078125,
0.39794921875,
-0.205322265625,
0.52099609375,
0.1171875,
0.3408203125,
0.50927734375,
0.061187744140625,
0.33740234375,
-0.72265625,
0.82666015625,
0.001010894775390625,
-0.344482421875,
-0.31298828125,
-0.2130126953125,
0.08026123046875,
0.1358642578125,
0.401123046875,
0.10906982421875,
-0.908203125,
0.1832275390625,
0.3505859375,
0.5263671875,
-0.58154296875,
-0.345947265625,
-0.438720703125,
0.393310546875,
0.161865234375,
-0.75244140625,
0.3017578125,
-0.96484375,
0.466796875,
0.27587890625,
-0.07000732421875,
-0.31201171875,
-0.47802734375,
-0.904296875,
-0.85888671875,
-0.01326751708984375,
1.162109375,
0.1265869140625,
-0.2010498046875,
-1.2587890625,
0.288818359375,
0.377685546875,
-0.3388671875,
-0.1871337890625,
-0.449951171875,
0.166748046875,
-0.1708984375,
0.273681640625,
-0.7998046875,
-0.8779296875,
0.041839599609375,
-1.3125,
0.666015625,
-0.5390625,
0.73388671875,
-0.28955078125,
-0.354736328125,
0.1546630859375,
-0.1346435546875,
-0.38671875,
-0.086181640625,
-0.308349609375,
0.52099609375,
-0.857421875,
-0.72216796875,
0.40380859375,
-0.312744140625,
-0.39501953125,
1.095703125,
0.0565185546875,
-0.465087890625,
0.0345458984375,
0.341796875,
-0.5791015625,
0.489990234375,
-0.53662109375,
0.5634765625,
-0.271240234375,
-0.7138671875,
-0.353759765625,
-0.78466796875,
0.86474609375,
-0.07342529296875,
-0.81103515625,
-0.262939453125,
-1.1396484375,
-0.255126953125,
-0.02899169921875,
-0.4599609375,
0.17626953125,
0.310791015625,
-0.32373046875,
0.1710205078125,
-0.489990234375,
-0.388916015625,
-0.300537109375,
-0.58154296875,
-0.51318359375,
0.17578125,
0.15771484375,
0.849609375,
-0.1807861328125,
-0.1585693359375,
0.068115234375,
-0.238525390625,
-0.0914306640625,
-0.412353515625,
-0.390869140625,
0.03338623046875,
-0.473388671875,
-0.406005859375,
0.3505859375,
-0.05743408203125,
0.5751953125,
0.88037109375,
-0.004730224609375,
0.358642578125,
0.498291015625,
-0.6552734375,
0.89697265625,
-0.288330078125,
-0.7490234375,
-0.11920166015625,
0.8125,
0.1824951171875,
0.8095703125,
0.047637939453125,
-0.9345703125,
-0.75439453125,
-0.6552734375,
-0.0390625,
-0.79736328125,
-0.0302734375,
-1.1318359375,
-0.2308349609375,
-0.61865234375,
0.356201171875,
-0.09808349609375,
-0.548828125,
0.030426025390625,
-0.7822265625,
0.33984375,
-0.94677734375,
-0.18603515625,
-0.78125,
-0.328125,
0.162353515625,
0.88330078125,
0.12109375,
0.61376953125,
0.209716796875,
0.164306640625,
0.1678466796875,
-0.1142578125,
-0.460693359375,
-0.49951171875,
-0.431640625,
0.34765625,
-0.256103515625,
-0.09796142578125,
-0.61474609375,
0.57275390625,
-0.84130859375,
0.1536865234375,
-0.465576171875,
-0.1649169921875,
0.3134765625,
-0.01812744140625,
1.248046875,
-0.0115509033203125,
0.1920166015625,
-0.12127685546875,
0.46728515625,
0.59912109375,
-0.261474609375,
-0.46484375,
-0.242431640625,
-0.59375,
-0.927734375,
0.8271484375,
-0.41650390625,
0.08697509765625,
-0.47509765625,
-0.477783203125,
1.0146484375,
-0.5361328125,
0.423583984375,
1.083984375,
-0.0171356201171875,
0.57080078125,
-0.36767578125,
0.72412109375,
0.59814453125,
-0.38134765625,
-0.1129150390625,
0.07000732421875,
-0.70849609375,
0.07269287109375,
-0.72412109375,
-1.052734375,
-0.7509765625,
0.320556640625,
1.2216796875,
-0.04345703125,
0.83203125,
0.1710205078125,
-1.0615234375,
-0.560546875,
1.173828125,
0.362060546875,
0.054290771484375,
1.078125,
-0.2467041015625,
-0.09075927734375,
-0.025177001953125,
-0.24169921875,
-0.427001953125,
-0.4208984375,
1.095703125,
-1.1044921875,
-0.6220703125,
0.90673828125,
0.7451171875,
-1.2568359375,
-1.1123046875,
-0.77587890625,
-0.2098388671875,
0.365966796875,
-0.6728515625,
0.034820556640625,
0.2225341796875,
-0.250244140625,
0.0716552734375,
0.2479248046875,
0.00562286376953125,
0.521484375,
0.19580078125,
0.070556640625,
-0.494140625,
0.37353515625,
0.533203125,
-0.7705078125,
-0.1065673828125,
-0.89013671875,
0.351318359375,
-0.068359375,
0.057891845703125,
0.8974609375,
-0.337890625,
0.54345703125,
0.265380859375,
-0.365234375,
0.347900390625,
-0.6279296875,
-0.2281494140625,
0.5859375,
-0.394775390625,
-0.341064453125,
-0.26806640625,
0.546875,
-0.0914306640625,
0.209716796875,
-0.476806640625,
-0.100341796875,
0.240478515625,
0.4970703125,
-0.454833984375,
-0.82861328125,
-0.19775390625,
-1.29296875,
-0.61376953125,
-0.391357421875,
-0.337890625,
0.34130859375,
0.5341796875,
-0.1798095703125,
-0.59033203125,
0.222412109375,
0.482421875,
-0.34765625,
0.7998046875,
-0.8662109375,
0.34033203125,
-0.36865234375,
-0.00754547119140625,
-0.78515625,
-0.0193023681640625,
-0.53173828125,
-0.354736328125,
-0.416259765625,
0.2191162109375,
-0.159912109375,
0.41357421875,
-0.1593017578125,
0.2064208984375,
-0.293212890625,
-0.4404296875,
-0.136962890625,
0.1744384765625,
-0.309326171875,
0.9228515625,
0.63916015625,
-0.384765625,
0.330810546875,
-0.074462890625,
-0.28125,
-0.4541015625,
0.57568359375,
0.60498046875,
-0.302490234375,
-0.376953125,
0.10614013671875,
0.427001953125,
-0.94677734375,
0.319091796875,
-0.466796875,
0.406494140625,
0.0215911865234375,
-0.22119140625,
0.72509765625,
1.05078125,
-0.33154296875,
0.2154541015625,
-0.0161285400390625,
-0.002468109130859375,
0.859375,
0.011749267578125,
0.1141357421875,
0.41552734375,
0.029144287109375,
-0.66650390625,
0.09149169921875,
0.308349609375,
-0.006397247314453125,
-0.0180511474609375,
-0.0833740234375,
-0.5126953125,
-0.99658203125,
-0.12890625,
-0.25048828125,
0.4853515625,
0.671875,
-0.353271484375,
0.328125,
-0.289794921875,
-0.4326171875,
0.5078125,
-1.34375,
-0.97509765625,
0.1666259765625,
0.11175537109375,
-0.47607421875,
-0.05047607421875,
-0.414306640625,
-0.01177215576171875,
-0.2646484375,
0.2242431640625,
-0.2393798828125,
0.31005859375,
-0.3271484375,
0.64501953125,
-0.1112060546875,
-0.26611328125,
-0.229248046875,
0.62744140625,
-0.3740234375,
-0.7587890625,
-0.1002197265625,
1.01953125,
0.147216796875,
-0.20703125,
-0.045074462890625,
0.156005859375,
-0.104248046875,
0.13623046875,
-0.6142578125,
0.2489013671875,
-0.10418701171875,
0.5693359375,
-1.1015625,
-0.32080078125,
-0.003673553466796875,
0.42626953125,
0.0200347900390625,
-0.5400390625,
-0.3134765625,
0.8671875,
0.70947265625,
0.1868896484375,
0.38427734375,
0.07208251953125,
0.5205078125,
-0.2218017578125,
0.11871337890625,
-0.376708984375,
0.60498046875,
0.89208984375,
0.6123046875,
-0.102294921875,
0.437255859375,
0.7158203125,
-0.437744140625,
-0.400634765625,
0.470458984375,
0.142822265625,
-0.1663818359375,
0.62548828125,
-0.237548828125,
0.05084228515625,
-0.185791015625,
-0.46875,
0.34130859375,
-0.3271484375,
0.059539794921875,
-0.1236572265625,
-0.51318359375,
1.2373046875,
-0.5078125,
-0.043060302734375,
0.059783935546875,
-0.64306640625,
0.49853515625,
0.67919921875,
0.032745361328125,
-0.270751953125,
0.80126953125,
0.822265625,
0.60498046875,
0.623046875,
0.57568359375,
-0.01247406005859375,
-1.02734375,
0.242431640625,
0.06500244140625,
0.1796875,
-0.54052734375,
-0.290771484375,
-1.4990234375,
0.5048828125,
0.09222412109375,
-0.2052001953125,
0.59912109375,
-0.923828125,
-0.10540771484375,
-0.054779052734375,
0.57080078125,
-0.92529296875,
0.328857421875,
0.44921875,
-0.2431640625,
-0.517578125,
0.91455078125,
-0.005313873291015625,
0.2578125,
0.09332275390625,
1.318359375,
-0.0057525634765625,
1.4169921875,
0.583984375,
0.2088623046875,
0.33203125,
0.57763671875,
-0.74853515625,
-0.798828125,
-0.266357421875,
-0.37939453125,
-0.125,
-0.46533203125,
-0.304931640625,
-0.24462890625,
0.78955078125,
0.07562255859375,
-0.83447265625,
-0.496337890625,
-0.006565093994140625,
-1.0751953125,
0.67578125,
0.311279296875,
0.47265625,
0.2587890625,
-0.0682373046875,
-0.2044677734375,
-0.4814453125,
0.025665283203125,
-0.3662109375,
0.525390625,
-0.9013671875,
-0.432373046875,
-0.277587890625,
-0.51953125,
-0.681640625,
0.27978515625,
-0.65185546875,
-0.720703125,
0.53857421875,
0.4287109375,
0.2200927734375,
0.296875,
-0.291259765625,
-0.224609375,
0.853515625,
0.85009765625,
0.0257415771484375,
0.80712890625,
0.3095703125,
-0.27001953125,
-0.25927734375,
-0.90673828125,
0.48388671875,
-0.2041015625,
-0.0557861328125,
-0.5869140625,
0.31640625,
-0.64892578125,
-1.341796875,
-0.1707763671875,
0.39892578125,
0.09820556640625,
-0.845703125,
-1.248046875,
-0.359375,
-1.1494140625,
-0.277587890625,
-0.72265625,
0.98095703125,
0.088134765625,
-0.04913330078125,
-0.044952392578125,
-1.1640625,
4.38671875,
0.7880859375,
0.607421875,
0.05145263671875,
0.382080078125,
1.232421875,
0.52294921875,
-0.469970703125,
-0.66259765625,
-0.379638671875,
0.3876953125,
-0.1790771484375,
0.060089111328125,
0.85546875,
0.7666015625,
0.437255859375,
-0.6318359375,
-0.54736328125,
0.05743408203125,
-1.0068359375,
-0.572265625,
-0.07196044921875,
0.2705078125,
0.36767578125,
0.392822265625,
0.599609375,
0.7392578125,
-0.92578125,
0.0816650390625,
-0.6875,
0.52099609375,
-0.8876953125,
0.814453125,
0.373291015625,
-0.513671875,
0.73779296875,
0.0211181640625,
-0.2391357421875,
-0.2401123046875,
0.417724609375,
-0.260009765625,
0.056793212890625,
0.200439453125,
-0.304931640625,
0.0482177734375,
0.1834716796875,
-0.50146484375,
0.39599609375,
0.45263671875,
-1.01953125,
0.75927734375,
-0.07818603515625,
0.2156982421875,
-0.38671875,
-0.8251953125,
0.43994140625,
-0.0033435821533203125,
0.156494140625,
-0.1937255859375,
0.92333984375,
0.33740234375,
0.10821533203125,
-0.239501953125,
0.60302734375,
-0.94384765625,
0.95068359375,
-0.10870361328125,
0.347412109375,
-0.484375,
0.01373291015625,
-0.277587890625,
-0.58544921875,
-0.5087890625,
-0.73486328125,
0.56103515625,
0.51708984375,
0.234619140625,
0.568359375,
0.6015625,
-0.81884765625,
0.06280517578125,
0.1103515625,
-0.06683349609375,
-0.0887451171875,
0.6376953125,
1.4072265625,
-0.7451171875,
-0.425048828125,
-0.297119140625,
0.65380859375,
0.76123046875,
0.7373046875,
0.12158203125,
-0.88134765625,
-0.364501953125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Submitted Solution:
```
s = input()
init = -1
ans = 0
for i in range(len(s)):
if s[i] in 'AEIOU':
ans = max(ans,i - init)
init = i
print(ans)
```
No
| 35,641
|
[
0.291748046875,
-0.12939453125,
-0.418701171875,
0.599609375,
-0.50146484375,
-0.192626953125,
0.52099609375,
0.086669921875,
0.1673583984375,
0.67529296875,
0.53564453125,
-0.013641357421875,
0.080322265625,
-0.7412109375,
-0.62158203125,
0.1927490234375,
-0.861328125,
-0.351806640625,
-0.57421875,
-0.256103515625,
0.051727294921875,
-0.313232421875,
-1.0869140625,
0.0699462890625,
-0.07037353515625,
0.62060546875,
0.463623046875,
-0.026580810546875,
1.05859375,
0.98779296875,
0.232666015625,
-0.2578125,
0.14990234375,
-0.99755859375,
-0.439208984375,
-0.362060546875,
0.3125,
-0.60302734375,
-0.478271484375,
-0.4130859375,
0.2218017578125,
-0.05865478515625,
0.73486328125,
-0.53076171875,
-1.0771484375,
-0.2939453125,
-0.1922607421875,
-0.46337890625,
-0.287109375,
-0.53125,
0.51953125,
-0.32080078125,
0.541015625,
-0.231201171875,
-0.1219482421875,
-0.251220703125,
0.365234375,
-0.0421142578125,
-1.0751953125,
0.00849151611328125,
-0.0117950439453125,
0.56201171875,
0.1419677734375,
-0.66015625,
-0.3310546875,
0.5556640625,
-0.040985107421875,
-0.140869140625,
-0.1744384765625,
-0.41943359375,
-0.336181640625,
0.365966796875,
-0.52880859375,
-0.382080078125,
-0.3701171875,
0.033355712890625,
-0.032684326171875,
0.09942626953125,
-0.7763671875,
0.77978515625,
0.215576171875,
1.0341796875,
-0.140869140625,
0.08184814453125,
-0.462890625,
-0.30419921875,
0.0247955322265625,
0.269775390625,
0.268310546875,
-0.076904296875,
-0.26318359375,
0.41162109375,
-0.432373046875,
0.055755615234375,
0.67626953125,
0.461669921875,
-0.361572265625,
0.494140625,
0.54931640625,
0.0384521484375,
0.74658203125,
0.93505859375,
-0.5673828125,
0.955078125,
-0.498779296875,
0.251220703125,
0.236083984375,
-0.1773681640625,
-0.043182373046875,
-0.56787109375,
-0.1934814453125,
-0.05419921875,
0.232177734375,
0.329345703125,
-0.5908203125,
0.70703125,
-0.078369140625,
0.44921875,
-0.7548828125,
0.65478515625,
0.1671142578125,
0.087646484375,
0.64306640625,
-0.026702880859375,
0.415771484375,
-0.467041015625,
-0.6982421875,
0.96435546875,
-0.484619140625,
0.306884765625,
0.0731201171875,
-0.1961669921875,
-0.41552734375,
0.513671875,
-0.470947265625,
0.58056640625,
-0.327880859375,
0.677734375,
0.47802734375,
-0.93212890625,
0.56591796875,
-0.2235107421875,
0.11370849609375,
1.4931640625,
0.497314453125,
-0.207275390625,
0.33349609375,
0.3720703125,
-0.65234375,
0.4775390625,
-0.916015625,
0.6982421875,
0.020782470703125,
0.1395263671875,
-0.35595703125,
0.2413330078125,
-0.28955078125,
0.36083984375,
0.3359375,
0.026031494140625,
-0.42578125,
-0.0013599395751953125,
-0.6875,
0.7529296875,
-0.42431640625,
0.473388671875,
-0.449462890625,
-0.036407470703125,
-0.177001953125,
-0.25341796875,
-0.036956787109375,
0.2215576171875,
0.312255859375,
0.892578125,
0.1563720703125,
1.2734375,
0.9228515625,
0.23828125,
0.31396484375,
0.50244140625,
-0.288818359375,
0.1422119140625,
0.09954833984375,
0.88525390625,
-0.037872314453125,
0.2476806640625,
0.00933837890625,
0.09710693359375,
-0.31591796875,
-0.1480712890625,
-0.215576171875,
0.5576171875,
-0.5771484375,
-0.06756591796875,
-0.0723876953125,
0.0838623046875,
-0.71240234375,
-0.041656494140625,
-0.1285400390625,
-1.025390625,
-0.38671875,
0.71923828125,
0.40283203125,
0.5107421875,
-0.264404296875,
-0.90966796875,
0.31298828125,
1.3916015625,
-0.33056640625,
0.2666015625,
0.2318115234375,
-0.1474609375,
-0.052001953125,
0.02020263671875,
0.461669921875,
-0.319091796875,
-0.5927734375,
0.76220703125,
-0.2529296875,
0.353271484375,
0.24853515625,
0.671875,
0.2276611328125,
0.73291015625,
-0.466796875,
-0.4873046875,
0.341796875,
1.2041015625,
-0.0814208984375,
0.58349609375,
0.1534423828125,
0.7529296875,
0.39599609375,
0.828125,
0.58154296875,
-0.10150146484375,
0.4970703125,
0.95361328125,
0.1170654296875,
0.2025146484375,
0.1312255859375,
0.54736328125,
0.650390625,
0.301025390625,
0.0103607177734375,
0.462158203125,
-0.03570556640625,
0.00403594970703125,
-0.52099609375,
0.290771484375,
-0.6337890625,
1.05078125,
0.1011962890625,
0.34130859375,
-0.5751953125,
-0.1343994140625,
0.1959228515625,
0.489501953125,
-0.59130859375,
-1.0908203125,
0.055938720703125,
-0.015625,
0.268798828125,
0.224853515625,
0.469970703125,
0.6171875,
0.06451416015625,
0.62744140625,
-0.3134765625,
-0.28515625,
-0.7451171875,
-0.7802734375,
-1.06640625,
-0.4248046875,
-0.72265625,
-0.28125,
0.42431640625,
-0.8876953125,
0.69482421875,
-0.465087890625,
0.0692138671875,
-0.4755859375,
-0.335693359375,
0.68212890625,
-0.20947265625,
0.65673828125,
-0.4033203125,
0.25927734375,
0.07196044921875,
0.86865234375,
-0.392822265625,
-0.239013671875,
-0.346435546875,
-0.51220703125,
0.316162109375,
-0.11181640625,
0.49560546875,
0.43359375,
-0.56396484375,
-0.73876953125,
-0.6044921875,
-0.34716796875,
-0.5078125,
0.24072265625,
-0.449462890625,
0.8544921875,
0.5224609375,
-0.84423828125,
0.52099609375,
0.931640625,
-1.08203125,
0.81005859375,
0.50244140625,
-0.045166015625,
-0.430908203125,
1.1142578125,
0.228515625,
0.52294921875,
-0.498779296875,
-0.63525390625,
-0.3291015625,
0.216552734375,
-0.1470947265625,
-0.64111328125,
-0.475341796875,
0.7119140625,
-0.31298828125,
-0.89794921875,
0.423828125,
-1.1201171875,
-0.328369140625,
-0.446533203125,
-0.3330078125,
0.9384765625,
1.048828125,
0.486328125,
-0.223876953125,
-0.6337890625,
-0.1866455078125,
0.63134765625,
0.703125,
-0.275146484375,
-0.032623291015625,
0.9365234375,
0.1011962890625,
0.467041015625,
0.327392578125,
-0.314453125,
0.0008478164672851562,
-0.1431884765625,
0.0224456787109375,
0.56640625,
0.290283203125,
0.01129150390625,
0.375732421875,
0.6708984375,
-0.94189453125,
-0.432373046875,
-0.48388671875,
0.6025390625,
-0.1663818359375,
0.37158203125,
0.454833984375,
-0.062042236328125,
-0.6982421875,
-0.97509765625,
0.42724609375,
0.2388916015625,
0.56005859375,
-1.0625,
0.9228515625,
0.29150390625,
-0.48583984375,
0.139404296875,
-0.471435546875,
0.06695556640625,
1.1103515625,
0.023223876953125,
0.6025390625,
-0.8779296875,
0.5498046875,
0.1151123046875,
0.06060791015625,
0.93359375,
0.325927734375,
0.320068359375,
-0.190185546875,
-0.51806640625,
-0.2435302734375,
0.235595703125,
-0.2198486328125,
-0.386474609375,
0.40283203125,
-0.06842041015625,
-0.365234375,
-0.7431640625,
0.476806640625,
0.68310546875,
0.41552734375,
-0.215087890625,
0.4423828125,
0.09027099609375,
0.316162109375,
0.52783203125,
0.0364990234375,
0.266845703125,
-0.76025390625,
0.7841796875,
0.0645751953125,
-0.435546875,
-0.3125,
-0.183837890625,
0.0300140380859375,
0.1292724609375,
0.33056640625,
0.10906982421875,
-0.85791015625,
0.139892578125,
0.259765625,
0.5947265625,
-0.5830078125,
-0.350341796875,
-0.402099609375,
0.3583984375,
0.208984375,
-0.77734375,
0.3134765625,
-0.9677734375,
0.5205078125,
0.2548828125,
-0.0926513671875,
-0.275390625,
-0.5595703125,
-0.96875,
-0.77294921875,
-0.1141357421875,
1.2431640625,
0.0355224609375,
-0.159423828125,
-1.26953125,
0.251220703125,
0.349365234375,
-0.376220703125,
-0.1632080078125,
-0.44677734375,
0.1358642578125,
-0.251708984375,
0.3486328125,
-0.837890625,
-0.9111328125,
0.050262451171875,
-1.212890625,
0.650390625,
-0.54248046875,
0.72705078125,
-0.271728515625,
-0.30029296875,
0.1875,
-0.12164306640625,
-0.3623046875,
-0.037017822265625,
-0.263671875,
0.5234375,
-0.84765625,
-0.65869140625,
0.388427734375,
-0.318603515625,
-0.392333984375,
1.080078125,
0.0667724609375,
-0.398193359375,
-0.0362548828125,
0.30126953125,
-0.578125,
0.49609375,
-0.47119140625,
0.5673828125,
-0.281982421875,
-0.7373046875,
-0.300048828125,
-0.8232421875,
0.736328125,
-0.1861572265625,
-0.79248046875,
-0.240966796875,
-1.1376953125,
-0.238525390625,
-0.04681396484375,
-0.471923828125,
0.2066650390625,
0.271728515625,
-0.28759765625,
0.2113037109375,
-0.473388671875,
-0.396728515625,
-0.37841796875,
-0.5537109375,
-0.53955078125,
0.2008056640625,
0.1441650390625,
0.80029296875,
-0.0703125,
-0.10858154296875,
0.0457763671875,
-0.26611328125,
-0.0222930908203125,
-0.45263671875,
-0.417724609375,
0.051422119140625,
-0.497802734375,
-0.347900390625,
0.445068359375,
-0.058349609375,
0.5517578125,
0.89501953125,
-0.035675048828125,
0.401611328125,
0.44287109375,
-0.6259765625,
0.90185546875,
-0.3076171875,
-0.73681640625,
-0.1568603515625,
0.865234375,
0.158935546875,
0.83203125,
0.07916259765625,
-0.947265625,
-0.83544921875,
-0.68798828125,
-0.0560302734375,
-0.73974609375,
-0.043975830078125,
-1.12890625,
-0.1708984375,
-0.58203125,
0.396484375,
-0.085693359375,
-0.50244140625,
0.1431884765625,
-0.81689453125,
0.32861328125,
-0.94287109375,
-0.2371826171875,
-0.70263671875,
-0.250244140625,
0.15625,
0.8076171875,
0.148681640625,
0.6484375,
0.27587890625,
0.087890625,
0.197998046875,
-0.0560302734375,
-0.431884765625,
-0.509765625,
-0.403076171875,
0.2861328125,
-0.208251953125,
-0.06060791015625,
-0.5224609375,
0.646484375,
-0.8173828125,
0.09088134765625,
-0.348388671875,
-0.1900634765625,
0.2685546875,
-0.064453125,
1.2724609375,
0.016845703125,
0.139404296875,
-0.031768798828125,
0.362548828125,
0.6015625,
-0.269287109375,
-0.476806640625,
-0.27294921875,
-0.63525390625,
-0.8818359375,
0.8095703125,
-0.3837890625,
0.1300048828125,
-0.50732421875,
-0.46875,
1.05859375,
-0.50732421875,
0.481689453125,
1.115234375,
-0.024749755859375,
0.5927734375,
-0.35107421875,
0.66015625,
0.54638671875,
-0.2423095703125,
-0.17431640625,
0.044525146484375,
-0.7216796875,
0.01611328125,
-0.6748046875,
-1.04296875,
-0.90673828125,
0.3291015625,
1.140625,
-0.05914306640625,
0.810546875,
0.17333984375,
-1.115234375,
-0.6259765625,
1.1376953125,
0.47607421875,
-0.003520965576171875,
1.087890625,
-0.201171875,
-0.125732421875,
-0.0889892578125,
-0.2139892578125,
-0.447509765625,
-0.405029296875,
1.18359375,
-1.0625,
-0.61376953125,
0.78271484375,
0.82470703125,
-1.2880859375,
-1.07421875,
-0.75927734375,
-0.219970703125,
0.306396484375,
-0.6875,
0.10211181640625,
0.2401123046875,
-0.34228515625,
0.044708251953125,
0.1778564453125,
0.019073486328125,
0.475830078125,
0.270751953125,
0.0665283203125,
-0.5146484375,
0.30029296875,
0.52392578125,
-0.779296875,
-0.150390625,
-0.90185546875,
0.2484130859375,
-0.0631103515625,
0.0335693359375,
0.90234375,
-0.271240234375,
0.452880859375,
0.2529296875,
-0.41796875,
0.328369140625,
-0.7294921875,
-0.2421875,
0.7041015625,
-0.39453125,
-0.30908203125,
-0.238525390625,
0.6826171875,
-0.10693359375,
0.180419921875,
-0.5087890625,
-0.119384765625,
0.2237548828125,
0.491943359375,
-0.43603515625,
-0.759765625,
-0.2110595703125,
-1.3349609375,
-0.6552734375,
-0.50634765625,
-0.3291015625,
0.347412109375,
0.46826171875,
-0.11041259765625,
-0.57568359375,
0.2447509765625,
0.52490234375,
-0.3232421875,
0.82861328125,
-0.8486328125,
0.3818359375,
-0.427490234375,
-0.0160369873046875,
-0.76416015625,
-0.08502197265625,
-0.55712890625,
-0.2459716796875,
-0.49267578125,
0.26318359375,
-0.193359375,
0.4287109375,
-0.2021484375,
0.250244140625,
-0.282958984375,
-0.359619140625,
-0.070068359375,
0.2149658203125,
-0.32373046875,
0.87548828125,
0.65185546875,
-0.390625,
0.2166748046875,
-0.068359375,
-0.259521484375,
-0.427734375,
0.59814453125,
0.5849609375,
-0.344970703125,
-0.376708984375,
0.23828125,
0.354248046875,
-0.974609375,
0.30224609375,
-0.51123046875,
0.408935546875,
0.07122802734375,
-0.2061767578125,
0.75390625,
1.171875,
-0.407958984375,
0.239990234375,
-0.0419921875,
-0.0166778564453125,
0.91650390625,
0.031890869140625,
0.09149169921875,
0.461669921875,
0.0261077880859375,
-0.71240234375,
0.0261993408203125,
0.32275390625,
-0.07012939453125,
-0.01537322998046875,
-0.07818603515625,
-0.45556640625,
-0.9482421875,
-0.059600830078125,
-0.295654296875,
0.51123046875,
0.662109375,
-0.309814453125,
0.352294921875,
-0.300537109375,
-0.4794921875,
0.537109375,
-1.427734375,
-1.0478515625,
0.16796875,
0.164306640625,
-0.485107421875,
-0.057769775390625,
-0.427978515625,
0.0182647705078125,
-0.2447509765625,
0.180419921875,
-0.262451171875,
0.312255859375,
-0.368408203125,
0.56884765625,
-0.04888916015625,
-0.33251953125,
-0.1710205078125,
0.6953125,
-0.366455078125,
-0.8486328125,
-0.1534423828125,
1.0078125,
0.1767578125,
-0.17431640625,
0.0145111083984375,
0.163330078125,
-0.1429443359375,
0.214599609375,
-0.54931640625,
0.202880859375,
-0.138671875,
0.53173828125,
-1.0830078125,
-0.2919921875,
0.00844573974609375,
0.4130859375,
0.0859375,
-0.59716796875,
-0.33349609375,
0.78466796875,
0.75732421875,
0.1968994140625,
0.320556640625,
0.0516357421875,
0.4970703125,
-0.2144775390625,
0.16845703125,
-0.330810546875,
0.69189453125,
0.91650390625,
0.640625,
0.01079559326171875,
0.34912109375,
0.6982421875,
-0.410400390625,
-0.357666015625,
0.477294921875,
0.13134765625,
-0.1484375,
0.5771484375,
-0.1915283203125,
0.01067352294921875,
-0.2457275390625,
-0.430419921875,
0.260986328125,
-0.293701171875,
0.056060791015625,
-0.13427734375,
-0.55419921875,
1.275390625,
-0.428466796875,
-0.040069580078125,
0.0280609130859375,
-0.55322265625,
0.54150390625,
0.744140625,
-0.1162109375,
-0.2958984375,
0.80859375,
0.84033203125,
0.5263671875,
0.6826171875,
0.54052734375,
-0.060699462890625,
-0.9970703125,
0.2119140625,
0.08154296875,
0.1630859375,
-0.53271484375,
-0.321044921875,
-1.46875,
0.54443359375,
0.13134765625,
-0.20654296875,
0.59814453125,
-0.91162109375,
-0.1090087890625,
-0.04925537109375,
0.5224609375,
-0.89453125,
0.340576171875,
0.4853515625,
-0.22607421875,
-0.5224609375,
0.98095703125,
-0.0284271240234375,
0.22412109375,
0.1195068359375,
1.31640625,
0.0234832763671875,
1.4248046875,
0.56689453125,
0.2430419921875,
0.297119140625,
0.59130859375,
-0.72021484375,
-0.81689453125,
-0.31396484375,
-0.50927734375,
-0.1318359375,
-0.47021484375,
-0.31689453125,
-0.252685546875,
0.83056640625,
0.019805908203125,
-0.92333984375,
-0.4921875,
0.005279541015625,
-1.078125,
0.67041015625,
0.264404296875,
0.465087890625,
0.26220703125,
-0.09722900390625,
-0.1221923828125,
-0.5146484375,
0.0306396484375,
-0.3779296875,
0.505859375,
-0.92578125,
-0.437255859375,
-0.264892578125,
-0.55419921875,
-0.625,
0.296875,
-0.73046875,
-0.7861328125,
0.497314453125,
0.475830078125,
0.1837158203125,
0.27783203125,
-0.353271484375,
-0.2144775390625,
0.85888671875,
0.8271484375,
0.052703857421875,
0.75439453125,
0.30419921875,
-0.320556640625,
-0.1734619140625,
-0.89501953125,
0.4951171875,
-0.173828125,
-0.03118896484375,
-0.62646484375,
0.3271484375,
-0.6171875,
-1.2802734375,
-0.10528564453125,
0.349853515625,
0.07305908203125,
-0.86474609375,
-1.2138671875,
-0.3876953125,
-1.173828125,
-0.310791015625,
-0.64501953125,
0.95458984375,
0.0404052734375,
-0.0386962890625,
-0.057159423828125,
-1.2138671875,
4.390625,
0.810546875,
0.55517578125,
0.1328125,
0.42236328125,
1.2578125,
0.619140625,
-0.471435546875,
-0.60791015625,
-0.300048828125,
0.3798828125,
-0.11273193359375,
0.0986328125,
0.78955078125,
0.77392578125,
0.42919921875,
-0.57373046875,
-0.453125,
0.03460693359375,
-0.99169921875,
-0.56640625,
-0.1324462890625,
0.274169921875,
0.4248046875,
0.42529296875,
0.57080078125,
0.7421875,
-0.93505859375,
0.023773193359375,
-0.7177734375,
0.50927734375,
-0.833984375,
0.81884765625,
0.410888671875,
-0.490966796875,
0.662109375,
0.09332275390625,
-0.290771484375,
-0.24072265625,
0.44775390625,
-0.306884765625,
-0.042266845703125,
0.29296875,
-0.293701171875,
0.049652099609375,
0.06353759765625,
-0.45849609375,
0.454345703125,
0.337646484375,
-0.97802734375,
0.72314453125,
-0.06597900390625,
0.2181396484375,
-0.364990234375,
-0.81396484375,
0.446044921875,
-0.0474853515625,
0.12139892578125,
-0.1719970703125,
0.9609375,
0.306884765625,
0.0171966552734375,
-0.260986328125,
0.609375,
-1.0419921875,
0.9775390625,
-0.02166748046875,
0.369873046875,
-0.451904296875,
0.055328369140625,
-0.28857421875,
-0.6669921875,
-0.52587890625,
-0.72216796875,
0.541015625,
0.51904296875,
0.229248046875,
0.58203125,
0.57666015625,
-0.8505859375,
0.09051513671875,
0.162109375,
-0.03582763671875,
-0.1025390625,
0.61865234375,
1.3154296875,
-0.7666015625,
-0.434326171875,
-0.26220703125,
0.65576171875,
0.76513671875,
0.69775390625,
0.1474609375,
-0.85986328125,
-0.404052734375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Submitted Solution:
```
x = list(str(input()))
y = []
z = 0
if (x[0] == "A" or x[0] == "E" or x[0] == "I" or x[0] == "O" or x[0] =="U" or x[0]=="Y") and len(x) == 1:
print("1")
elif len(x) == 1:
print("2")
else:
for i in range(0,len(x)):
if x[i] == "A" or x[i] == "E" or x[i] == "I" or x[i] == "O" or x[i] =="U" or x[i]=="Y":
y.append(i)
for i in range(0, len(y)-2):
q = y[i+1] - y[i]
r = y[i+2] - y[i+1]
if r>z:
z = r
if len(y) == 0:
print(len(x)+1)
elif len(y) == 1:
if len(x) - y[0] > y[0]:
print(len(x)-y[0])
else:
print(y[0]+1)
else:
a = y[0]+1
b = len(x) - max(y)
print(max(a,b,z))
```
No
| 35,642
|
[
0.2471923828125,
-0.15185546875,
-0.407470703125,
0.58203125,
-0.51318359375,
-0.1796875,
0.49169921875,
0.0880126953125,
0.1693115234375,
0.69384765625,
0.55078125,
-0.032928466796875,
0.1077880859375,
-0.75244140625,
-0.6376953125,
0.146484375,
-0.9150390625,
-0.375732421875,
-0.55615234375,
-0.233642578125,
0.1292724609375,
-0.37646484375,
-1.02734375,
0.06866455078125,
-0.0638427734375,
0.54736328125,
0.448974609375,
-0.0087738037109375,
1.064453125,
0.9765625,
0.342529296875,
-0.1845703125,
0.108642578125,
-1.0078125,
-0.380615234375,
-0.375,
0.302734375,
-0.66650390625,
-0.5166015625,
-0.375732421875,
0.1968994140625,
-0.072998046875,
0.67919921875,
-0.578125,
-1.1240234375,
-0.2342529296875,
-0.2149658203125,
-0.389404296875,
-0.253173828125,
-0.56005859375,
0.4912109375,
-0.26904296875,
0.52734375,
-0.2071533203125,
-0.1973876953125,
-0.26416015625,
0.36669921875,
-0.06072998046875,
-1.021484375,
0.055419921875,
-0.05059814453125,
0.5751953125,
0.1661376953125,
-0.5947265625,
-0.281982421875,
0.47021484375,
-0.034210205078125,
-0.1480712890625,
-0.12939453125,
-0.4619140625,
-0.372802734375,
0.35302734375,
-0.46875,
-0.357421875,
-0.4111328125,
0.09130859375,
-0.00516510009765625,
0.0560302734375,
-0.7490234375,
0.8232421875,
0.2303466796875,
1.0849609375,
-0.115966796875,
0.16845703125,
-0.403076171875,
-0.294921875,
0.0628662109375,
0.2098388671875,
0.2135009765625,
-0.12646484375,
-0.273193359375,
0.38916015625,
-0.48046875,
-0.01629638671875,
0.6396484375,
0.450439453125,
-0.31689453125,
0.51220703125,
0.56201171875,
0.048828125,
0.6875,
0.92333984375,
-0.50927734375,
0.91552734375,
-0.440185546875,
0.31201171875,
0.2357177734375,
-0.2174072265625,
-0.03778076171875,
-0.62646484375,
-0.1884765625,
-0.06658935546875,
0.2381591796875,
0.28564453125,
-0.6064453125,
0.69970703125,
-0.049041748046875,
0.487060546875,
-0.7431640625,
0.677734375,
0.226806640625,
0.1387939453125,
0.6767578125,
0.0227203369140625,
0.364013671875,
-0.413330078125,
-0.6826171875,
0.98486328125,
-0.475341796875,
0.2666015625,
0.09478759765625,
-0.1737060546875,
-0.479248046875,
0.42333984375,
-0.50146484375,
0.521484375,
-0.33984375,
0.73876953125,
0.485595703125,
-0.92236328125,
0.603515625,
-0.15869140625,
0.09722900390625,
1.45703125,
0.54345703125,
-0.2471923828125,
0.285400390625,
0.416259765625,
-0.658203125,
0.46484375,
-1.001953125,
0.76171875,
-0.0033283233642578125,
0.08612060546875,
-0.3271484375,
0.24365234375,
-0.26953125,
0.262939453125,
0.351318359375,
0.00839996337890625,
-0.394775390625,
-0.01953125,
-0.63427734375,
0.7509765625,
-0.3642578125,
0.484375,
-0.40478515625,
-0.032623291015625,
-0.221435546875,
-0.1370849609375,
-0.003688812255859375,
0.2120361328125,
0.2998046875,
0.9375,
0.199462890625,
1.3056640625,
0.97314453125,
0.1600341796875,
0.29052734375,
0.5322265625,
-0.3388671875,
0.1220703125,
0.058135986328125,
0.89892578125,
-0.040740966796875,
0.2459716796875,
0.07525634765625,
0.0254974365234375,
-0.380126953125,
-0.1536865234375,
-0.1483154296875,
0.4931640625,
-0.5693359375,
-0.0374755859375,
-0.0904541015625,
0.08135986328125,
-0.7548828125,
-0.0265350341796875,
-0.28515625,
-1.05859375,
-0.335205078125,
0.66455078125,
0.38720703125,
0.432373046875,
-0.2210693359375,
-0.82763671875,
0.414306640625,
1.3720703125,
-0.336181640625,
0.356201171875,
0.2021484375,
-0.1689453125,
-0.06591796875,
-0.0007724761962890625,
0.38720703125,
-0.2066650390625,
-0.51123046875,
0.6884765625,
-0.256103515625,
0.345947265625,
0.1761474609375,
0.68310546875,
0.16455078125,
0.7216796875,
-0.47265625,
-0.5673828125,
0.346435546875,
1.1865234375,
-0.1590576171875,
0.65625,
0.180419921875,
0.78369140625,
0.39013671875,
0.865234375,
0.5185546875,
-0.15087890625,
0.448974609375,
0.908203125,
0.1583251953125,
0.18798828125,
0.1431884765625,
0.46923828125,
0.6875,
0.354248046875,
0.0170135498046875,
0.436767578125,
0.06097412109375,
-0.0721435546875,
-0.59619140625,
0.302978515625,
-0.58837890625,
1.0751953125,
0.062286376953125,
0.33349609375,
-0.460205078125,
-0.2042236328125,
0.116455078125,
0.4697265625,
-0.685546875,
-1.0556640625,
0.044769287109375,
-0.05926513671875,
0.287109375,
0.2498779296875,
0.4873046875,
0.6787109375,
0.037994384765625,
0.62060546875,
-0.27490234375,
-0.263671875,
-0.71533203125,
-0.75244140625,
-1.021484375,
-0.460205078125,
-0.77392578125,
-0.250244140625,
0.379638671875,
-0.87744140625,
0.65673828125,
-0.491455078125,
0.0919189453125,
-0.479736328125,
-0.402587890625,
0.7236328125,
-0.168212890625,
0.6298828125,
-0.45458984375,
0.181640625,
0.040557861328125,
0.90283203125,
-0.3642578125,
-0.19921875,
-0.400634765625,
-0.495361328125,
0.31787109375,
-0.06640625,
0.55224609375,
0.427734375,
-0.50927734375,
-0.72216796875,
-0.54638671875,
-0.32763671875,
-0.5107421875,
0.25341796875,
-0.372802734375,
0.892578125,
0.611328125,
-0.814453125,
0.4638671875,
0.94287109375,
-1.0654296875,
0.73193359375,
0.55419921875,
-0.087158203125,
-0.407958984375,
1.021484375,
0.232421875,
0.5166015625,
-0.465576171875,
-0.7060546875,
-0.357177734375,
0.1839599609375,
-0.131591796875,
-0.56689453125,
-0.475830078125,
0.7197265625,
-0.31201171875,
-0.91943359375,
0.440673828125,
-1.103515625,
-0.30029296875,
-0.460205078125,
-0.27294921875,
0.8857421875,
1.017578125,
0.50146484375,
-0.1861572265625,
-0.56298828125,
-0.113525390625,
0.66845703125,
0.61083984375,
-0.310302734375,
-0.038055419921875,
0.90380859375,
0.190673828125,
0.51025390625,
0.282470703125,
-0.3515625,
-0.01224517822265625,
-0.1376953125,
0.056365966796875,
0.4951171875,
0.28369140625,
0.0009741783142089844,
0.411376953125,
0.60009765625,
-0.8876953125,
-0.392822265625,
-0.5107421875,
0.7333984375,
-0.1048583984375,
0.422119140625,
0.439453125,
-0.006603240966796875,
-0.6533203125,
-0.98291015625,
0.412841796875,
0.292724609375,
0.4677734375,
-1.0849609375,
0.90625,
0.294921875,
-0.403076171875,
0.07623291015625,
-0.48583984375,
0.03631591796875,
1.1142578125,
0.0997314453125,
0.6279296875,
-0.8232421875,
0.4912109375,
0.150634765625,
0.10516357421875,
0.8291015625,
0.283447265625,
0.359375,
-0.2039794921875,
-0.478759765625,
-0.25390625,
0.22412109375,
-0.2275390625,
-0.337890625,
0.4228515625,
0.0030727386474609375,
-0.380859375,
-0.65869140625,
0.474609375,
0.61572265625,
0.533203125,
-0.207275390625,
0.5478515625,
0.093994140625,
0.28271484375,
0.5576171875,
0.0478515625,
0.252685546875,
-0.64453125,
0.76953125,
0.0177764892578125,
-0.32958984375,
-0.286865234375,
-0.1685791015625,
0.08160400390625,
0.11627197265625,
0.395263671875,
0.0872802734375,
-0.8134765625,
0.0780029296875,
0.21923828125,
0.55078125,
-0.55322265625,
-0.3193359375,
-0.39599609375,
0.387939453125,
0.2105712890625,
-0.763671875,
0.309814453125,
-0.9208984375,
0.52587890625,
0.1845703125,
-0.1365966796875,
-0.33349609375,
-0.63427734375,
-0.97705078125,
-0.7841796875,
-0.046142578125,
1.1337890625,
0.060760498046875,
-0.2177734375,
-1.2333984375,
0.22802734375,
0.364990234375,
-0.32421875,
-0.169921875,
-0.452880859375,
0.17822265625,
-0.15869140625,
0.32470703125,
-0.91650390625,
-0.833984375,
0.023834228515625,
-1.2802734375,
0.705078125,
-0.48974609375,
0.80322265625,
-0.261474609375,
-0.305908203125,
0.1353759765625,
-0.133544921875,
-0.350341796875,
-0.07769775390625,
-0.304931640625,
0.485595703125,
-0.8876953125,
-0.62451171875,
0.3818359375,
-0.339599609375,
-0.29248046875,
1.03515625,
-0.00713348388671875,
-0.429931640625,
-0.045135498046875,
0.393310546875,
-0.54345703125,
0.4365234375,
-0.461669921875,
0.59423828125,
-0.34130859375,
-0.7314453125,
-0.239990234375,
-0.8330078125,
0.76220703125,
-0.1929931640625,
-0.875,
-0.156005859375,
-1.15234375,
-0.2142333984375,
-0.01554107666015625,
-0.497802734375,
0.21923828125,
0.306396484375,
-0.369384765625,
0.1591796875,
-0.455322265625,
-0.30078125,
-0.3603515625,
-0.548828125,
-0.55126953125,
0.057830810546875,
0.164794921875,
0.8017578125,
-0.08758544921875,
-0.11053466796875,
0.10784912109375,
-0.265380859375,
0.01023101806640625,
-0.3828125,
-0.494384765625,
0.1036376953125,
-0.4638671875,
-0.338623046875,
0.41796875,
-0.0947265625,
0.59521484375,
0.8193359375,
-0.0215301513671875,
0.355224609375,
0.50048828125,
-0.57373046875,
0.8681640625,
-0.30908203125,
-0.68798828125,
-0.1925048828125,
0.84521484375,
0.189697265625,
0.78515625,
0.07293701171875,
-0.927734375,
-0.80859375,
-0.69482421875,
-0.053955078125,
-0.74267578125,
-0.05511474609375,
-1.142578125,
-0.15283203125,
-0.62890625,
0.405517578125,
-0.09375,
-0.57373046875,
0.1273193359375,
-0.833984375,
0.355712890625,
-0.8583984375,
-0.213134765625,
-0.6767578125,
-0.268798828125,
0.267333984375,
0.78466796875,
0.1363525390625,
0.66943359375,
0.26171875,
0.07623291015625,
0.204833984375,
-0.12451171875,
-0.44189453125,
-0.463623046875,
-0.470947265625,
0.304443359375,
-0.1988525390625,
-0.035400390625,
-0.495849609375,
0.6875,
-0.7646484375,
0.170166015625,
-0.3759765625,
-0.151123046875,
0.31396484375,
-0.00598907470703125,
1.25,
0.055816650390625,
0.1009521484375,
-0.03436279296875,
0.439697265625,
0.5400390625,
-0.299560546875,
-0.4775390625,
-0.18994140625,
-0.6201171875,
-0.9404296875,
0.80078125,
-0.44287109375,
0.1258544921875,
-0.53125,
-0.5,
1.1396484375,
-0.52880859375,
0.4072265625,
1.1318359375,
0.042510986328125,
0.64599609375,
-0.353515625,
0.60791015625,
0.54443359375,
-0.30419921875,
-0.139892578125,
0.039459228515625,
-0.7021484375,
0.11370849609375,
-0.66845703125,
-0.9912109375,
-0.8134765625,
0.258544921875,
1.0537109375,
-0.040985107421875,
0.88330078125,
0.1541748046875,
-1.0546875,
-0.61572265625,
1.078125,
0.4775390625,
0.02642822265625,
1.0966796875,
-0.17041015625,
-0.005695343017578125,
-0.149658203125,
-0.2255859375,
-0.3828125,
-0.400634765625,
1.0927734375,
-1.0849609375,
-0.60791015625,
0.82275390625,
0.83203125,
-1.2861328125,
-1.0732421875,
-0.71484375,
-0.2110595703125,
0.3759765625,
-0.6767578125,
0.1094970703125,
0.26318359375,
-0.379150390625,
0.0802001953125,
0.1800537109375,
-0.015716552734375,
0.49169921875,
0.1671142578125,
0.06646728515625,
-0.576171875,
0.28759765625,
0.454345703125,
-0.78515625,
-0.12115478515625,
-0.95703125,
0.195068359375,
-0.06610107421875,
-0.0159149169921875,
0.90087890625,
-0.1962890625,
0.440673828125,
0.2607421875,
-0.387939453125,
0.29052734375,
-0.6591796875,
-0.287841796875,
0.60009765625,
-0.3916015625,
-0.33251953125,
-0.22265625,
0.70947265625,
-0.08221435546875,
0.1143798828125,
-0.466064453125,
-0.08740234375,
0.1982421875,
0.529296875,
-0.4521484375,
-0.86474609375,
-0.20556640625,
-1.3037109375,
-0.6875,
-0.481689453125,
-0.34423828125,
0.3232421875,
0.4453125,
-0.23291015625,
-0.56884765625,
0.24462890625,
0.54052734375,
-0.39013671875,
0.80615234375,
-0.91064453125,
0.338134765625,
-0.39599609375,
-0.006160736083984375,
-0.80224609375,
-0.09521484375,
-0.474853515625,
-0.2724609375,
-0.509765625,
0.1644287109375,
-0.2271728515625,
0.44970703125,
-0.2047119140625,
0.261962890625,
-0.26025390625,
-0.505859375,
-0.1429443359375,
0.1961669921875,
-0.300048828125,
0.89404296875,
0.66650390625,
-0.3818359375,
0.14404296875,
-0.1444091796875,
-0.21435546875,
-0.466552734375,
0.57763671875,
0.60205078125,
-0.418701171875,
-0.351318359375,
0.2376708984375,
0.306640625,
-0.9716796875,
0.21728515625,
-0.5390625,
0.407958984375,
0.032257080078125,
-0.1756591796875,
0.7744140625,
1.0791015625,
-0.423828125,
0.2049560546875,
0.0031795501708984375,
-0.04046630859375,
0.84716796875,
0.05035400390625,
0.03741455078125,
0.41943359375,
0.045166015625,
-0.6455078125,
0.0255889892578125,
0.260498046875,
-0.054595947265625,
0.0010480880737304688,
-0.11944580078125,
-0.49365234375,
-0.9619140625,
-0.10931396484375,
-0.286865234375,
0.5185546875,
0.60546875,
-0.33447265625,
0.364013671875,
-0.25341796875,
-0.4716796875,
0.54736328125,
-1.33984375,
-0.978515625,
0.1656494140625,
0.07122802734375,
-0.398193359375,
0.0140838623046875,
-0.432373046875,
0.00788116455078125,
-0.187255859375,
0.244140625,
-0.25439453125,
0.30615234375,
-0.309326171875,
0.51416015625,
-0.0178070068359375,
-0.3525390625,
-0.1466064453125,
0.72900390625,
-0.353271484375,
-0.85498046875,
-0.1759033203125,
0.9541015625,
0.2447509765625,
-0.176513671875,
0.0469970703125,
0.1221923828125,
-0.09393310546875,
0.1561279296875,
-0.498291015625,
0.270751953125,
-0.169189453125,
0.52783203125,
-1.146484375,
-0.3447265625,
0.10882568359375,
0.404052734375,
0.1187744140625,
-0.55517578125,
-0.330322265625,
0.82275390625,
0.7353515625,
0.0958251953125,
0.281982421875,
0.0604248046875,
0.53271484375,
-0.1839599609375,
0.072265625,
-0.36572265625,
0.65185546875,
0.8837890625,
0.55615234375,
-0.04266357421875,
0.322998046875,
0.73779296875,
-0.28369140625,
-0.456787109375,
0.492431640625,
0.0701904296875,
-0.09234619140625,
0.61376953125,
-0.183349609375,
-0.0224609375,
-0.1890869140625,
-0.411376953125,
0.32958984375,
-0.28564453125,
0.0357666015625,
-0.10040283203125,
-0.51953125,
1.255859375,
-0.486328125,
-0.0297088623046875,
0.0186614990234375,
-0.64208984375,
0.5224609375,
0.66748046875,
-0.13330078125,
-0.277099609375,
0.81298828125,
0.7880859375,
0.5595703125,
0.75390625,
0.51416015625,
-0.01424407958984375,
-1.0224609375,
0.2147216796875,
-0.01540374755859375,
0.257080078125,
-0.42431640625,
-0.388916015625,
-1.443359375,
0.441162109375,
0.07952880859375,
-0.207763671875,
0.62255859375,
-0.88037109375,
-0.09442138671875,
0.0197906494140625,
0.49560546875,
-0.8681640625,
0.375732421875,
0.4619140625,
-0.2071533203125,
-0.51318359375,
0.9794921875,
0.00860595703125,
0.2415771484375,
0.1351318359375,
1.349609375,
-0.0229339599609375,
1.3974609375,
0.486328125,
0.125,
0.3046875,
0.515625,
-0.65234375,
-0.79345703125,
-0.361328125,
-0.497802734375,
-0.1357421875,
-0.4814453125,
-0.23779296875,
-0.33349609375,
0.7587890625,
-0.0287933349609375,
-0.953125,
-0.46044921875,
-0.057708740234375,
-1.076171875,
0.62646484375,
0.312744140625,
0.474365234375,
0.2381591796875,
-0.15625,
-0.0654296875,
-0.460693359375,
0.052734375,
-0.43896484375,
0.445068359375,
-0.92822265625,
-0.37939453125,
-0.208740234375,
-0.52880859375,
-0.61474609375,
0.3330078125,
-0.71240234375,
-0.72900390625,
0.50244140625,
0.473876953125,
0.22216796875,
0.35546875,
-0.41357421875,
-0.18408203125,
0.87841796875,
0.890625,
0.033050537109375,
0.74755859375,
0.367919921875,
-0.318359375,
-0.209228515625,
-0.90087890625,
0.445556640625,
-0.15673828125,
-0.0198211669921875,
-0.62841796875,
0.299072265625,
-0.60107421875,
-1.2880859375,
-0.2296142578125,
0.4375,
-0.006366729736328125,
-0.763671875,
-1.185546875,
-0.32177734375,
-1.2060546875,
-0.292236328125,
-0.6826171875,
0.95068359375,
0.017547607421875,
-0.00919342041015625,
-0.067626953125,
-1.16796875,
4.4296875,
0.80517578125,
0.5263671875,
0.08282470703125,
0.3642578125,
1.2763671875,
0.484375,
-0.54541015625,
-0.59033203125,
-0.318115234375,
0.3828125,
-0.13720703125,
0.0931396484375,
0.77734375,
0.71337890625,
0.378173828125,
-0.65185546875,
-0.417236328125,
0.007720947265625,
-0.94384765625,
-0.642578125,
-0.06988525390625,
0.3193359375,
0.40673828125,
0.371826171875,
0.56005859375,
0.74755859375,
-0.869140625,
-0.0261993408203125,
-0.73388671875,
0.438232421875,
-0.90234375,
0.79443359375,
0.501953125,
-0.450439453125,
0.74267578125,
0.202392578125,
-0.298095703125,
-0.242919921875,
0.351806640625,
-0.1961669921875,
-0.0780029296875,
0.2210693359375,
-0.3623046875,
0.027435302734375,
0.06158447265625,
-0.58642578125,
0.5068359375,
0.4052734375,
-0.9921875,
0.6181640625,
-0.06488037109375,
0.197265625,
-0.406982421875,
-0.85498046875,
0.472900390625,
0.0020160675048828125,
0.162109375,
-0.185302734375,
0.94189453125,
0.306396484375,
0.031951904296875,
-0.269775390625,
0.5830078125,
-1.07421875,
0.9541015625,
-0.058746337890625,
0.411376953125,
-0.4853515625,
0.038421630859375,
-0.323486328125,
-0.6650390625,
-0.4794921875,
-0.66357421875,
0.55078125,
0.56201171875,
0.202392578125,
0.58154296875,
0.55029296875,
-0.83837890625,
0.2166748046875,
0.1568603515625,
-0.0694580078125,
0.01611328125,
0.60205078125,
1.33984375,
-0.72509765625,
-0.361083984375,
-0.2783203125,
0.65087890625,
0.8203125,
0.70751953125,
0.197021484375,
-0.8642578125,
-0.349853515625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became interested what is the minimum jump ability he should have in order to be able to reach the far end of the string, jumping only on vowels of the English alphabet. Jump ability is the maximum possible length of his jump.
Formally, consider that at the begginning the Grasshopper is located directly in front of the leftmost character of the string. His goal is to reach the position right after the rightmost character of the string. In one jump the Grasshopper could jump to the right any distance from 1 to the value of his jump ability.
<image> The picture corresponds to the first example.
The following letters are vowels: 'A', 'E', 'I', 'O', 'U' and 'Y'.
Input
The first line contains non-empty string consisting of capital English letters. It is guaranteed that the length of the string does not exceed 100.
Output
Print single integer a β the minimum jump ability of the Grasshopper (in the number of symbols) that is needed to overcome the given string, jumping only on vowels.
Examples
Input
ABABBBACFEYUKOTT
Output
4
Input
AAA
Output
1
Submitted Solution:
```
s=input()
l="AEIOUY"
q=[]
x=0
if len(s)==1:
if s[0] in l:
print("1")
else:
print("2")
elif s=="NVTQVNLGWFDBCBKSDLTBGWBMNQZWZQJWNGVCTCQBGWNTYJRDBPZJHXCXFMIXNRGSTXHQPCHNFQPCMDZWJGLJZWMRRFCVLBKDTDSC":
print("45")
elif s=="PXVKJHXVDPWGLHWFWMJPMCCNHCKSHCPZXGIHHNMYNFQBUCKJJTXXJGKRNVRTQFDFMLLGPQKFOVNNLTNDIEXSARRJKGSCZKGGJCBW":
print("35")
elif s=="ABBABBB":
print("4")
elif s=="XXYC":
print("3")
elif s=="ABABBBBBBB":
print("8")
else:
for i in range(len(s)):
if s[i] in l:
q.append(i-x)
x=i
q.append(len(s)-x)
if len(q)!=0 and len(q)!=1:
print(max(q))
elif len(q)==1:
print(len(s)-x)
else:
print(len(s)+1)
```
No
| 35,643
|
[
0.2275390625,
-0.1387939453125,
-0.429443359375,
0.689453125,
-0.513671875,
-0.1922607421875,
0.53076171875,
0.1253662109375,
0.205078125,
0.66455078125,
0.5625,
-0.05322265625,
0.09320068359375,
-0.7255859375,
-0.6611328125,
0.1939697265625,
-0.9033203125,
-0.417724609375,
-0.5244140625,
-0.274169921875,
0.0186920166015625,
-0.317626953125,
-1.080078125,
0.03662109375,
-0.07159423828125,
0.66259765625,
0.45361328125,
-0.018402099609375,
1.01171875,
0.98974609375,
0.250244140625,
-0.2303466796875,
0.0909423828125,
-1.0361328125,
-0.41162109375,
-0.28564453125,
0.3486328125,
-0.638671875,
-0.451904296875,
-0.394287109375,
0.212646484375,
-0.039703369140625,
0.734375,
-0.6318359375,
-1.0576171875,
-0.2763671875,
-0.2342529296875,
-0.433349609375,
-0.3056640625,
-0.521484375,
0.517578125,
-0.31396484375,
0.55712890625,
-0.1881103515625,
-0.1541748046875,
-0.31494140625,
0.36279296875,
-0.0247802734375,
-1.0068359375,
0.07330322265625,
-0.060302734375,
0.6123046875,
0.17041015625,
-0.62060546875,
-0.287841796875,
0.56494140625,
-0.0435791015625,
-0.1478271484375,
-0.12322998046875,
-0.462890625,
-0.352783203125,
0.42724609375,
-0.4755859375,
-0.38623046875,
-0.379638671875,
0.0276641845703125,
-0.04248046875,
0.060638427734375,
-0.81640625,
0.7080078125,
0.1771240234375,
1.0791015625,
-0.1318359375,
0.122802734375,
-0.41943359375,
-0.32177734375,
0.01898193359375,
0.2392578125,
0.30517578125,
-0.09130859375,
-0.3212890625,
0.420654296875,
-0.432861328125,
-0.0767822265625,
0.63525390625,
0.515625,
-0.34716796875,
0.50732421875,
0.481689453125,
0.08746337890625,
0.73388671875,
0.890625,
-0.56884765625,
0.953125,
-0.444091796875,
0.257080078125,
0.264404296875,
-0.2344970703125,
-0.08734130859375,
-0.61279296875,
-0.2484130859375,
-0.08660888671875,
0.2568359375,
0.27490234375,
-0.515625,
0.75634765625,
-0.0799560546875,
0.48291015625,
-0.74609375,
0.64404296875,
0.1483154296875,
0.07171630859375,
0.69287109375,
0.0056915283203125,
0.357666015625,
-0.467041015625,
-0.6240234375,
0.99951171875,
-0.477783203125,
0.277587890625,
0.135498046875,
-0.214111328125,
-0.420166015625,
0.4072265625,
-0.485595703125,
0.5546875,
-0.338134765625,
0.70849609375,
0.482177734375,
-0.90087890625,
0.56787109375,
-0.196533203125,
0.1302490234375,
1.482421875,
0.54736328125,
-0.1512451171875,
0.321044921875,
0.380126953125,
-0.69580078125,
0.441162109375,
-0.98486328125,
0.7607421875,
-0.015594482421875,
0.1546630859375,
-0.390869140625,
0.211669921875,
-0.28271484375,
0.330078125,
0.329345703125,
0.03509521484375,
-0.38134765625,
-0.0304107666015625,
-0.59716796875,
0.736328125,
-0.3994140625,
0.5234375,
-0.438720703125,
-0.037994384765625,
-0.27099609375,
-0.25537109375,
0.00946807861328125,
0.185302734375,
0.258544921875,
0.873046875,
0.1824951171875,
1.259765625,
0.94482421875,
0.217529296875,
0.34130859375,
0.5263671875,
-0.309814453125,
0.09954833984375,
0.07843017578125,
0.888671875,
-0.03155517578125,
0.27880859375,
0.030670166015625,
0.011962890625,
-0.39013671875,
-0.15283203125,
-0.1556396484375,
0.57763671875,
-0.58349609375,
-0.01422119140625,
-0.07513427734375,
0.07177734375,
-0.78125,
-0.062744140625,
-0.150634765625,
-1.044921875,
-0.38623046875,
0.70458984375,
0.39599609375,
0.463623046875,
-0.22802734375,
-0.86474609375,
0.368896484375,
1.404296875,
-0.311767578125,
0.317626953125,
0.237060546875,
-0.1527099609375,
-0.0095062255859375,
0.00824737548828125,
0.4052734375,
-0.26708984375,
-0.53857421875,
0.76513671875,
-0.300537109375,
0.373779296875,
0.20166015625,
0.716796875,
0.2286376953125,
0.70361328125,
-0.449951171875,
-0.6142578125,
0.37890625,
1.1474609375,
-0.047637939453125,
0.58544921875,
0.1763916015625,
0.8232421875,
0.399169921875,
0.8134765625,
0.5654296875,
-0.0904541015625,
0.458251953125,
0.9560546875,
0.1927490234375,
0.146484375,
0.1513671875,
0.483154296875,
0.67822265625,
0.3349609375,
0.061676025390625,
0.449951171875,
0.00341033935546875,
-0.078857421875,
-0.56689453125,
0.266357421875,
-0.6015625,
1.013671875,
0.1253662109375,
0.3681640625,
-0.46630859375,
-0.146484375,
0.1710205078125,
0.43212890625,
-0.5693359375,
-1.0185546875,
0.0267486572265625,
-0.0021762847900390625,
0.322509765625,
0.282470703125,
0.45166015625,
0.66552734375,
0.07568359375,
0.595703125,
-0.282470703125,
-0.31640625,
-0.767578125,
-0.81787109375,
-1.052734375,
-0.488037109375,
-0.7626953125,
-0.28173828125,
0.426025390625,
-0.91015625,
0.69921875,
-0.452392578125,
0.075927734375,
-0.46435546875,
-0.351806640625,
0.67529296875,
-0.1923828125,
0.65283203125,
-0.459716796875,
0.255126953125,
0.08148193359375,
0.845703125,
-0.3896484375,
-0.29638671875,
-0.34765625,
-0.5390625,
0.30712890625,
-0.10601806640625,
0.5419921875,
0.411376953125,
-0.5283203125,
-0.77197265625,
-0.544921875,
-0.34716796875,
-0.53564453125,
0.301025390625,
-0.45751953125,
0.92578125,
0.56298828125,
-0.78955078125,
0.484375,
0.97900390625,
-1.05078125,
0.80517578125,
0.58935546875,
-0.07830810546875,
-0.40380859375,
1.1259765625,
0.244140625,
0.46630859375,
-0.52734375,
-0.666015625,
-0.3369140625,
0.238525390625,
-0.1090087890625,
-0.5869140625,
-0.49560546875,
0.7197265625,
-0.31005859375,
-0.88525390625,
0.44873046875,
-1.099609375,
-0.338134765625,
-0.41796875,
-0.31103515625,
0.939453125,
1.0185546875,
0.4990234375,
-0.2147216796875,
-0.63623046875,
-0.1640625,
0.662109375,
0.6279296875,
-0.2362060546875,
-0.0171966552734375,
0.923828125,
0.11444091796875,
0.51611328125,
0.3134765625,
-0.28564453125,
-0.006397247314453125,
-0.1575927734375,
0.058135986328125,
0.5078125,
0.29638671875,
-0.0596923828125,
0.374267578125,
0.673828125,
-0.90673828125,
-0.452392578125,
-0.49365234375,
0.7216796875,
-0.09515380859375,
0.41259765625,
0.497314453125,
-0.062744140625,
-0.64501953125,
-1.044921875,
0.42724609375,
0.2454833984375,
0.50439453125,
-1.0576171875,
0.8935546875,
0.30859375,
-0.463623046875,
0.120361328125,
-0.50341796875,
0.0445556640625,
1.134765625,
-0.015960693359375,
0.5654296875,
-0.87890625,
0.5673828125,
0.1419677734375,
0.067138671875,
0.8251953125,
0.301513671875,
0.3857421875,
-0.196533203125,
-0.48974609375,
-0.2423095703125,
0.146728515625,
-0.15869140625,
-0.393310546875,
0.343505859375,
-0.10894775390625,
-0.353759765625,
-0.67724609375,
0.459716796875,
0.6083984375,
0.50732421875,
-0.224853515625,
0.5673828125,
0.10296630859375,
0.318115234375,
0.54248046875,
-0.01338958740234375,
0.218505859375,
-0.68310546875,
0.75927734375,
0.06365966796875,
-0.30859375,
-0.274658203125,
-0.148681640625,
-0.005016326904296875,
0.1280517578125,
0.3974609375,
0.0296173095703125,
-0.8466796875,
0.0667724609375,
0.27978515625,
0.55126953125,
-0.529296875,
-0.289306640625,
-0.41357421875,
0.370849609375,
0.2098388671875,
-0.787109375,
0.322021484375,
-0.93359375,
0.51513671875,
0.2437744140625,
-0.0704345703125,
-0.2685546875,
-0.63134765625,
-0.982421875,
-0.8134765625,
-0.07843017578125,
1.1416015625,
0.078125,
-0.1949462890625,
-1.2451171875,
0.2578125,
0.34326171875,
-0.304443359375,
-0.1875,
-0.4150390625,
0.1416015625,
-0.1732177734375,
0.286865234375,
-0.85693359375,
-0.85986328125,
0.06597900390625,
-1.2587890625,
0.6748046875,
-0.53173828125,
0.7197265625,
-0.241943359375,
-0.319091796875,
0.12066650390625,
-0.123779296875,
-0.410888671875,
-0.07354736328125,
-0.288330078125,
0.50927734375,
-0.87841796875,
-0.59814453125,
0.42626953125,
-0.375,
-0.375732421875,
1.072265625,
0.070068359375,
-0.417724609375,
-0.071044921875,
0.345703125,
-0.6083984375,
0.47119140625,
-0.49658203125,
0.61572265625,
-0.321044921875,
-0.72119140625,
-0.26953125,
-0.79052734375,
0.77001953125,
-0.197265625,
-0.8486328125,
-0.1937255859375,
-1.1513671875,
-0.21875,
-0.041534423828125,
-0.484619140625,
0.2467041015625,
0.2247314453125,
-0.307861328125,
0.1990966796875,
-0.43408203125,
-0.358154296875,
-0.30029296875,
-0.525390625,
-0.521484375,
0.1336669921875,
0.1512451171875,
0.83154296875,
-0.1597900390625,
-0.077880859375,
0.13037109375,
-0.26904296875,
-0.033660888671875,
-0.433837890625,
-0.36474609375,
0.05560302734375,
-0.4921875,
-0.34130859375,
0.43212890625,
-0.05255126953125,
0.52294921875,
0.84765625,
0.0021915435791015625,
0.338623046875,
0.43505859375,
-0.58984375,
0.908203125,
-0.2900390625,
-0.69970703125,
-0.21484375,
0.8984375,
0.17333984375,
0.8203125,
0.080810546875,
-0.982421875,
-0.8359375,
-0.61572265625,
-0.08734130859375,
-0.779296875,
0.00893402099609375,
-1.142578125,
-0.1290283203125,
-0.59912109375,
0.444091796875,
-0.09759521484375,
-0.55615234375,
0.143310546875,
-0.77783203125,
0.24951171875,
-0.88427734375,
-0.1983642578125,
-0.72314453125,
-0.231689453125,
0.1461181640625,
0.8193359375,
0.172119140625,
0.669921875,
0.2548828125,
0.07073974609375,
0.239013671875,
-0.11248779296875,
-0.44482421875,
-0.46533203125,
-0.421142578125,
0.309326171875,
-0.1734619140625,
-0.05999755859375,
-0.53857421875,
0.66357421875,
-0.84716796875,
0.1295166015625,
-0.450927734375,
-0.1395263671875,
0.277587890625,
-0.01715087890625,
1.203125,
0.036651611328125,
0.119384765625,
0.007503509521484375,
0.406494140625,
0.59521484375,
-0.2281494140625,
-0.5322265625,
-0.2783203125,
-0.6259765625,
-0.94189453125,
0.828125,
-0.359619140625,
0.132568359375,
-0.54296875,
-0.475830078125,
1.0986328125,
-0.470458984375,
0.45703125,
1.1552734375,
-0.013946533203125,
0.62060546875,
-0.3662109375,
0.630859375,
0.58251953125,
-0.33203125,
-0.1546630859375,
0.08001708984375,
-0.70361328125,
0.0082855224609375,
-0.7392578125,
-1.0185546875,
-0.8681640625,
0.2335205078125,
1.068359375,
-0.0386962890625,
0.8095703125,
0.1378173828125,
-1.1171875,
-0.56103515625,
1.0966796875,
0.432861328125,
-0.025177001953125,
1.142578125,
-0.183837890625,
-0.04827880859375,
-0.07550048828125,
-0.2274169921875,
-0.41845703125,
-0.437255859375,
1.1552734375,
-1.037109375,
-0.62939453125,
0.763671875,
0.83642578125,
-1.27734375,
-1.0859375,
-0.74072265625,
-0.19580078125,
0.296142578125,
-0.71142578125,
0.10498046875,
0.2230224609375,
-0.430908203125,
0.033935546875,
0.170166015625,
0.04376220703125,
0.4306640625,
0.267333984375,
0.1361083984375,
-0.55224609375,
0.26220703125,
0.5126953125,
-0.77490234375,
-0.10888671875,
-0.93603515625,
0.1729736328125,
-0.050018310546875,
-0.0113067626953125,
0.87158203125,
-0.22119140625,
0.468017578125,
0.265869140625,
-0.3818359375,
0.2998046875,
-0.64208984375,
-0.264404296875,
0.6875,
-0.31982421875,
-0.33349609375,
-0.2388916015625,
0.7099609375,
-0.0943603515625,
0.171875,
-0.5029296875,
-0.10675048828125,
0.21240234375,
0.477783203125,
-0.484375,
-0.8330078125,
-0.2479248046875,
-1.314453125,
-0.642578125,
-0.52685546875,
-0.38525390625,
0.3046875,
0.49267578125,
-0.224609375,
-0.57958984375,
0.203369140625,
0.58935546875,
-0.366943359375,
0.8408203125,
-0.84765625,
0.37744140625,
-0.4404296875,
0.018157958984375,
-0.7890625,
-0.05096435546875,
-0.5087890625,
-0.287841796875,
-0.485595703125,
0.1976318359375,
-0.1920166015625,
0.461181640625,
-0.1844482421875,
0.26220703125,
-0.26318359375,
-0.427978515625,
-0.156005859375,
0.233642578125,
-0.2802734375,
0.84912109375,
0.7412109375,
-0.3720703125,
0.1937255859375,
-0.0933837890625,
-0.298828125,
-0.4931640625,
0.61083984375,
0.54150390625,
-0.34814453125,
-0.397705078125,
0.1551513671875,
0.4130859375,
-0.98681640625,
0.192138671875,
-0.58056640625,
0.449951171875,
0.07562255859375,
-0.1578369140625,
0.7158203125,
1.130859375,
-0.420654296875,
0.2044677734375,
-0.0229339599609375,
0.0328369140625,
0.9052734375,
-0.023712158203125,
0.08294677734375,
0.44140625,
0.039886474609375,
-0.689453125,
0.043670654296875,
0.267578125,
-0.1094970703125,
0.0024261474609375,
-0.09417724609375,
-0.49462890625,
-0.9287109375,
-0.12890625,
-0.30810546875,
0.5712890625,
0.6416015625,
-0.343017578125,
0.37060546875,
-0.276123046875,
-0.472412109375,
0.56201171875,
-1.341796875,
-0.97900390625,
0.20361328125,
0.1536865234375,
-0.479248046875,
-0.0853271484375,
-0.42431640625,
0.035675048828125,
-0.238037109375,
0.21484375,
-0.269287109375,
0.283447265625,
-0.34375,
0.52734375,
-0.047332763671875,
-0.28662109375,
-0.127197265625,
0.75146484375,
-0.4267578125,
-0.859375,
-0.1732177734375,
1.01171875,
0.2139892578125,
-0.16357421875,
0.045501708984375,
0.1927490234375,
-0.10369873046875,
0.218994140625,
-0.51904296875,
0.21142578125,
-0.1192626953125,
0.52001953125,
-1.0830078125,
-0.308349609375,
0.0540771484375,
0.442138671875,
0.105712890625,
-0.5908203125,
-0.349609375,
0.8134765625,
0.810546875,
0.10052490234375,
0.302978515625,
0.08197021484375,
0.467041015625,
-0.1668701171875,
0.09539794921875,
-0.39208984375,
0.6376953125,
0.90869140625,
0.60107421875,
-0.061676025390625,
0.299072265625,
0.73583984375,
-0.334716796875,
-0.394775390625,
0.489013671875,
0.07733154296875,
-0.142333984375,
0.5576171875,
-0.177001953125,
-0.0208282470703125,
-0.193359375,
-0.401611328125,
0.2454833984375,
-0.304931640625,
-0.0084381103515625,
-0.083984375,
-0.482666015625,
1.263671875,
-0.42919921875,
-0.06353759765625,
-0.0023822784423828125,
-0.595703125,
0.480712890625,
0.69189453125,
-0.11480712890625,
-0.33349609375,
0.77001953125,
0.775390625,
0.61328125,
0.7255859375,
0.53955078125,
-0.0404052734375,
-0.94384765625,
0.2420654296875,
0.038177490234375,
0.1605224609375,
-0.546875,
-0.306640625,
-1.4287109375,
0.515625,
0.096923828125,
-0.2401123046875,
0.61083984375,
-0.919921875,
-0.07073974609375,
0.0189056396484375,
0.54052734375,
-0.8408203125,
0.301025390625,
0.4765625,
-0.1961669921875,
-0.546875,
0.98095703125,
-0.060394287109375,
0.28173828125,
0.07208251953125,
1.3330078125,
-0.0007009506225585938,
1.3544921875,
0.5263671875,
0.1619873046875,
0.262451171875,
0.5595703125,
-0.70703125,
-0.8359375,
-0.2666015625,
-0.467529296875,
-0.125732421875,
-0.53759765625,
-0.23779296875,
-0.295654296875,
0.8125,
-0.00970458984375,
-0.97607421875,
-0.419677734375,
0.00580596923828125,
-1.009765625,
0.6767578125,
0.327880859375,
0.483642578125,
0.25,
-0.1412353515625,
-0.168701171875,
-0.43017578125,
0.053863525390625,
-0.384521484375,
0.472900390625,
-0.94091796875,
-0.34130859375,
-0.26513671875,
-0.58447265625,
-0.6875,
0.3515625,
-0.671875,
-0.74267578125,
0.5068359375,
0.43212890625,
0.1959228515625,
0.358642578125,
-0.33203125,
-0.1982421875,
0.88134765625,
0.8740234375,
0.056060791015625,
0.734375,
0.34912109375,
-0.293701171875,
-0.154296875,
-0.89892578125,
0.432373046875,
-0.137939453125,
-0.035919189453125,
-0.65185546875,
0.292724609375,
-0.62451171875,
-1.33203125,
-0.12286376953125,
0.423095703125,
0.0836181640625,
-0.81005859375,
-1.197265625,
-0.386962890625,
-1.181640625,
-0.25244140625,
-0.6826171875,
0.96728515625,
0.03936767578125,
-0.0477294921875,
0.0021381378173828125,
-1.1845703125,
4.3984375,
0.84228515625,
0.57568359375,
0.1180419921875,
0.3857421875,
1.2978515625,
0.56689453125,
-0.51416015625,
-0.57861328125,
-0.23681640625,
0.359375,
-0.0848388671875,
0.139404296875,
0.7529296875,
0.78857421875,
0.442138671875,
-0.646484375,
-0.36083984375,
-0.0189056396484375,
-1.01171875,
-0.58056640625,
-0.1522216796875,
0.295166015625,
0.44873046875,
0.419677734375,
0.55322265625,
0.73974609375,
-0.85205078125,
0.015472412109375,
-0.70703125,
0.40966796875,
-0.865234375,
0.7666015625,
0.421630859375,
-0.48779296875,
0.71728515625,
0.1573486328125,
-0.339111328125,
-0.233642578125,
0.407958984375,
-0.238037109375,
-0.06915283203125,
0.254638671875,
-0.35986328125,
0.03265380859375,
0.062042236328125,
-0.53076171875,
0.44189453125,
0.40966796875,
-1.001953125,
0.67724609375,
-0.055023193359375,
0.2890625,
-0.42138671875,
-0.89697265625,
0.44091796875,
-0.042877197265625,
0.186279296875,
-0.11297607421875,
0.970703125,
0.318603515625,
0.07568359375,
-0.294189453125,
0.53125,
-1.0390625,
0.98681640625,
-0.106201171875,
0.372314453125,
-0.436767578125,
0.023712158203125,
-0.330810546875,
-0.70556640625,
-0.53662109375,
-0.72509765625,
0.5869140625,
0.544921875,
0.17236328125,
0.55078125,
0.525390625,
-0.83984375,
0.1500244140625,
0.1322021484375,
-0.09869384765625,
-0.02215576171875,
0.5927734375,
1.35546875,
-0.80078125,
-0.452880859375,
-0.173095703125,
0.64306640625,
0.7822265625,
0.69287109375,
0.201171875,
-0.91845703125,
-0.453369140625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
As it's the first of April, Heidi is suspecting that the news she reads today are fake, and she does not want to look silly in front of all the contestants. She knows that a newspiece is fake if it contains heidi as a subsequence. Help Heidi assess whether the given piece is true, but please be discreet about it...
Input
The first and only line of input contains a single nonempty string s of length at most 1000 composed of lowercase letters (a-z).
Output
Output YES if the string s contains heidi as a subsequence and NO otherwise.
Examples
Input
abcheaibcdi
Output
YES
Input
hiedi
Output
NO
Note
A string s contains another string p as a subsequence if it is possible to delete some characters from s and obtain p.
Tags: implementation, strings
Correct Solution:
```
# -*- coding: utf-8 -*-
# @Date : 2019-01-24 12:04:10
# @Author : raj lath (oorja.halt@gmail.com)
# @Link : link
# @Version : 1.0.0
from sys import stdin
max_val=int(10e12)
min_val=int(-10e12)
def read_int() : return int(stdin.readline())
def read_ints() : return [int(x) for x in stdin.readline().split()]
def read_str() : return input()
def read_strs() : return [x for x in stdin.readline().split()]
ins = input()
pos = 0
need = "heidi"
for i in ins:
if i == need[pos]:
pos += 1
if pos == 5:break
print(["NO", "YES"][pos == 5])
```
| 35,663
|
[
0.29931640625,
0.0595703125,
0.214599609375,
0.55712890625,
-0.30078125,
-0.56787109375,
0.048065185546875,
0.07110595703125,
0.33056640625,
0.9248046875,
0.417236328125,
-0.2467041015625,
0.193359375,
-0.66162109375,
-0.75537109375,
-0.12408447265625,
-0.56689453125,
-0.71142578125,
-0.312744140625,
-0.43212890625,
0.059906005859375,
0.10821533203125,
-1.37109375,
-0.20458984375,
-0.859375,
1.08203125,
0.2181396484375,
0.062744140625,
1.21875,
1.1044921875,
-0.0029296875,
-0.34716796875,
0.52587890625,
-1.3203125,
-0.1907958984375,
-0.90673828125,
0.8408203125,
-0.6669921875,
-0.451904296875,
-0.483642578125,
0.0601806640625,
-0.0271453857421875,
0.3837890625,
-0.693359375,
-1.1142578125,
-0.2471923828125,
-0.40771484375,
-0.27001953125,
-0.033477783203125,
-0.03240966796875,
0.486328125,
-0.11798095703125,
0.336669921875,
0.0151519775390625,
0.026580810546875,
-0.0970458984375,
0.016937255859375,
-0.1964111328125,
-0.69482421875,
-0.001865386962890625,
0.20556640625,
0.0215301513671875,
0.01290130615234375,
-0.8662109375,
-0.281982421875,
0.19677734375,
-0.027435302734375,
0.050506591796875,
-0.311279296875,
-0.78466796875,
0.129638671875,
0.1640625,
-0.54052734375,
-0.46875,
-0.66064453125,
-0.027099609375,
0.1278076171875,
0.0709228515625,
-0.46728515625,
0.951171875,
-0.12103271484375,
0.8232421875,
0.2078857421875,
0.30322265625,
-0.34033203125,
-0.497314453125,
0.11474609375,
0.1715087890625,
0.0205841064453125,
-0.177734375,
-0.2239990234375,
0.61328125,
-0.767578125,
-0.231689453125,
0.1378173828125,
0.48193359375,
-0.10693359375,
0.169677734375,
0.217041015625,
0.380615234375,
0.5625,
0.75048828125,
-0.34228515625,
1.072265625,
-0.43310546875,
0.00890350341796875,
0.5673828125,
-0.034149169921875,
-0.46630859375,
-0.34814453125,
-0.4150390625,
-0.67529296875,
0.437744140625,
0.1043701171875,
-0.01214599609375,
0.8095703125,
0.262451171875,
0.316162109375,
-0.859375,
0.1705322265625,
0.43896484375,
0.041290283203125,
0.447021484375,
-0.2025146484375,
0.1483154296875,
-0.485595703125,
-0.334228515625,
1.15234375,
-0.441650390625,
-0.0958251953125,
0.4736328125,
0.047119140625,
0.27197265625,
0.30908203125,
-0.166259765625,
0.701171875,
-0.345458984375,
0.62646484375,
0.93603515625,
-0.4912109375,
0.6533203125,
-0.262451171875,
0.04290771484375,
1.458984375,
0.31005859375,
0.6044921875,
0.63037109375,
0.382080078125,
-0.623046875,
0.279541015625,
-1.0556640625,
0.46337890625,
0.25341796875,
0.358642578125,
-0.333984375,
0.08123779296875,
-0.164794921875,
0.51416015625,
-0.057525634765625,
0.311767578125,
-0.50390625,
0.68603515625,
-0.2315673828125,
0.79931640625,
-0.490966796875,
0.94970703125,
-0.0943603515625,
-0.457763671875,
-0.273193359375,
-0.8125,
0.406005859375,
-0.06866455078125,
-0.2685546875,
0.71630859375,
0.423095703125,
0.74072265625,
1.001953125,
-0.2900390625,
0.360107421875,
0.166259765625,
-0.34228515625,
0.4677734375,
0.61572265625,
0.86669921875,
0.421875,
0.273681640625,
0.247802734375,
0.01898193359375,
-0.63916015625,
-0.486083984375,
0.254150390625,
0.84375,
-0.63134765625,
0.488525390625,
0.41796875,
0.09942626953125,
-0.9794921875,
-0.453369140625,
0.2261962890625,
-1.2314453125,
-0.378173828125,
0.6357421875,
-0.0767822265625,
0.1624755859375,
-0.225830078125,
-0.7080078125,
0.603515625,
1.25390625,
-0.677734375,
-0.0633544921875,
0.31396484375,
0.2384033203125,
-0.22900390625,
0.1395263671875,
-0.040130615234375,
-0.40625,
-0.68505859375,
0.90576171875,
-0.34326171875,
-0.1260986328125,
0.399658203125,
0.91650390625,
0.78076171875,
0.5966796875,
-0.374755859375,
-0.27197265625,
0.3115234375,
1.115234375,
-0.09417724609375,
0.2919921875,
0.4580078125,
0.487060546875,
0.3193359375,
0.68408203125,
0.263427734375,
0.11773681640625,
0.59814453125,
0.802734375,
0.0966796875,
0.22314453125,
0.06298828125,
0.2080078125,
0.333251953125,
0.498046875,
0.30517578125,
0.173583984375,
-0.157470703125,
0.135498046875,
-0.227783203125,
-0.038238525390625,
-0.335205078125,
0.74462890625,
0.3095703125,
0.7255859375,
-0.269287109375,
-0.37890625,
0.1837158203125,
1.0517578125,
-0.93798828125,
-0.391357421875,
-0.0703125,
0.343017578125,
0.043060302734375,
0.1763916015625,
0.2666015625,
0.30517578125,
0.42041015625,
0.69921875,
-0.6923828125,
-0.58740234375,
-0.497802734375,
-0.81396484375,
-0.794921875,
-0.28125,
-0.4052734375,
-0.31591796875,
0.307861328125,
-0.91943359375,
0.1795654296875,
-0.1474609375,
-0.10369873046875,
0.33447265625,
-0.7548828125,
0.435302734375,
-0.0958251953125,
0.463134765625,
-1.0478515625,
0.56591796875,
0.791015625,
0.8876953125,
-0.60009765625,
-0.126708984375,
-0.18896484375,
-0.57958984375,
0.0445556640625,
0.0100555419921875,
0.032318115234375,
-0.08428955078125,
-0.16943359375,
-0.47314453125,
-0.09423828125,
-0.1907958984375,
-0.080322265625,
0.441162109375,
-0.64990234375,
0.71142578125,
0.368408203125,
-0.61865234375,
0.6591796875,
0.88232421875,
-0.67626953125,
0.316650390625,
0.1883544921875,
0.01422882080078125,
-0.76513671875,
1.525390625,
0.5380859375,
0.301025390625,
-0.63671875,
0.00861358642578125,
-0.748046875,
-0.153076171875,
-0.03155517578125,
-0.87548828125,
-0.5419921875,
0.428466796875,
-0.2393798828125,
-1.060546875,
0.5693359375,
-1.4375,
-0.56298828125,
0.013916015625,
-0.252685546875,
1.0126953125,
1.1630859375,
0.305419921875,
-0.57275390625,
0.037750244140625,
-0.0230865478515625,
0.7626953125,
0.1619873046875,
-0.58251953125,
0.170654296875,
0.7626953125,
-0.09844970703125,
0.29345703125,
0.329345703125,
-0.1165771484375,
0.09539794921875,
-0.330322265625,
0.2091064453125,
0.6240234375,
0.3232421875,
0.396240234375,
0.287109375,
0.86376953125,
-0.66650390625,
-0.2022705078125,
0.1929931640625,
0.50830078125,
0.50390625,
0.66796875,
0.306884765625,
-0.1839599609375,
-0.62890625,
-1.1240234375,
0.1888427734375,
0.29150390625,
0.60888671875,
-0.52001953125,
0.759765625,
0.05279541015625,
-0.329345703125,
0.7197265625,
-0.89599609375,
-0.57470703125,
0.88671875,
-0.10552978515625,
0.65576171875,
-0.7197265625,
0.352783203125,
-0.431640625,
0.17529296875,
0.67041015625,
-0.027191162109375,
0.414306640625,
-0.314453125,
-0.74853515625,
-0.469970703125,
0.10845947265625,
-0.03387451171875,
-0.88134765625,
0.065673828125,
-0.36279296875,
-0.41064453125,
-1.048828125,
0.211669921875,
0.8310546875,
0.72900390625,
0.281494140625,
0.65478515625,
0.0712890625,
1.0146484375,
0.4072265625,
-0.623046875,
0.0736083984375,
-0.7216796875,
0.54296875,
0.2191162109375,
0.21875,
-0.320556640625,
-0.11529541015625,
-0.1083984375,
0.061767578125,
-0.1871337890625,
-0.61962890625,
-0.91943359375,
-0.1405029296875,
-0.085205078125,
0.359375,
-0.6806640625,
-0.468505859375,
-0.272705078125,
0.58251953125,
0.2685546875,
-1.001953125,
0.0233612060546875,
-0.74951171875,
0.7568359375,
0.38818359375,
-0.09344482421875,
-0.39892578125,
-0.411376953125,
-1.099609375,
-0.70947265625,
-0.07073974609375,
1.00390625,
-0.205322265625,
0.344482421875,
-1.5107421875,
0.421630859375,
0.1588134765625,
0.12347412109375,
0.2308349609375,
0.0950927734375,
0.5908203125,
0.3154296875,
0.60546875,
-0.73388671875,
-0.75341796875,
0.0251922607421875,
-1.173828125,
0.34326171875,
-0.67333984375,
0.092529296875,
-0.07269287109375,
-0.0158843994140625,
-0.2279052734375,
0.68994140625,
-0.09222412109375,
0.256103515625,
0.04150390625,
0.3173828125,
-0.59130859375,
-0.59912109375,
0.94482421875,
-0.06085205078125,
-0.63525390625,
0.732421875,
-0.077392578125,
0.1986083984375,
0.450927734375,
0.8369140625,
-0.367919921875,
0.39501953125,
-0.349609375,
0.484375,
-0.0200347900390625,
-0.35107421875,
-0.1826171875,
-0.41796875,
0.60302734375,
-0.158203125,
-1.3115234375,
-0.34375,
-1.2900390625,
-0.127685546875,
-0.09185791015625,
-0.2154541015625,
0.421142578125,
0.286865234375,
0.161865234375,
0.01430511474609375,
-0.2763671875,
-0.77001953125,
-0.498291015625,
-0.39208984375,
-0.29150390625,
0.57421875,
0.8232421875,
0.802734375,
-0.1588134765625,
-0.488037109375,
-0.1260986328125,
0.2177734375,
-0.0931396484375,
-0.4072265625,
-0.01110076904296875,
-0.215576171875,
-0.31298828125,
-0.017578125,
0.185302734375,
0.1986083984375,
0.5458984375,
0.96337890625,
-0.056793212890625,
0.382568359375,
0.1768798828125,
-0.70703125,
0.93017578125,
0.232666015625,
-1.0732421875,
-0.63623046875,
0.1658935546875,
-0.29736328125,
0.572265625,
0.51708984375,
-1.080078125,
-0.369140625,
-0.9462890625,
0.1817626953125,
-0.5634765625,
-0.2384033203125,
-0.8857421875,
-0.2152099609375,
-0.658203125,
0.8681640625,
-0.429443359375,
-0.94140625,
-0.018157958984375,
-1.001953125,
0.363037109375,
-0.76123046875,
-0.394287109375,
-0.80078125,
-0.52197265625,
-0.37158203125,
0.463623046875,
0.08709716796875,
0.367919921875,
-0.293212890625,
-0.310302734375,
0.255615234375,
-0.07611083984375,
-0.58740234375,
-0.4052734375,
0.28564453125,
0.0089111328125,
-0.260498046875,
-0.02117919921875,
-0.646484375,
1.048828125,
-0.759765625,
0.129150390625,
-0.1767578125,
-0.327880859375,
-0.22705078125,
0.0242156982421875,
0.61865234375,
-0.368408203125,
-0.14990234375,
-0.5869140625,
0.54345703125,
0.424072265625,
0.11810302734375,
-0.5166015625,
-0.74755859375,
-0.381591796875,
-0.64794921875,
0.75146484375,
-0.77978515625,
0.07672119140625,
-0.7099609375,
-0.09393310546875,
0.9169921875,
-0.402099609375,
0.414794921875,
1.49609375,
0.1026611328125,
0.1895751953125,
-0.74755859375,
0.2381591796875,
0.331298828125,
-0.41845703125,
0.1572265625,
0.43115234375,
-0.654296875,
0.2186279296875,
-0.089599609375,
-1.080078125,
-0.69921875,
0.292724609375,
1.30078125,
-0.08209228515625,
0.76171875,
0.13232421875,
-1.0126953125,
-0.625,
0.9111328125,
0.1307373046875,
0.42138671875,
0.98486328125,
-0.029052734375,
0.0157318115234375,
-0.011474609375,
0.0080413818359375,
-0.424560546875,
-0.7275390625,
1.12890625,
-0.16796875,
-0.55126953125,
0.76806640625,
1.5263671875,
-1.2197265625,
-0.701171875,
0.172119140625,
-0.281494140625,
-0.0252227783203125,
-0.8125,
-0.327392578125,
0.44873046875,
-1.01953125,
0.2490234375,
0.458740234375,
-0.126220703125,
0.26953125,
0.1165771484375,
0.1583251953125,
-0.51220703125,
0.7900390625,
0.74560546875,
-0.57958984375,
-0.418701171875,
-0.9638671875,
-0.253662109375,
-0.2235107421875,
-0.02850341796875,
0.97998046875,
-0.48291015625,
0.096923828125,
0.6513671875,
-0.341552734375,
0.556640625,
-0.464111328125,
-0.40966796875,
0.3330078125,
-0.6259765625,
-0.53125,
-0.274658203125,
0.279052734375,
-0.06121826171875,
0.453125,
-0.552734375,
0.1728515625,
0.248046875,
0.4716796875,
0.087646484375,
-0.83251953125,
-0.35498046875,
-0.880859375,
-0.2332763671875,
-0.5224609375,
-0.4638671875,
-0.31591796875,
0.126708984375,
-0.01415252685546875,
-0.6630859375,
-0.371337890625,
0.33837890625,
-0.69775390625,
1.01953125,
-0.72021484375,
0.2401123046875,
-0.40234375,
-0.52294921875,
-0.7431640625,
-0.243896484375,
-0.39111328125,
-0.08538818359375,
-0.5419921875,
0.0020313262939453125,
-0.2978515625,
0.67578125,
0.2939453125,
0.459228515625,
-0.3076171875,
-0.96240234375,
-0.139404296875,
0.10552978515625,
-0.3916015625,
0.85400390625,
0.53173828125,
-0.479736328125,
-0.069580078125,
-0.4169921875,
-0.1363525390625,
-0.302490234375,
0.35302734375,
0.2880859375,
0.2083740234375,
-0.50634765625,
-0.265380859375,
0.0146942138671875,
-0.9072265625,
0.1939697265625,
-0.293701171875,
0.188720703125,
0.60302734375,
-0.35205078125,
0.35546875,
0.94482421875,
-0.335693359375,
0.450927734375,
0.15576171875,
0.44677734375,
0.3828125,
0.387939453125,
0.2548828125,
0.51611328125,
0.24755859375,
-0.175048828125,
0.1888427734375,
0.387939453125,
0.050384521484375,
0.3056640625,
-0.0211029052734375,
-0.60009765625,
-0.82275390625,
-0.3017578125,
-0.2218017578125,
0.146240234375,
0.463623046875,
-0.54248046875,
-0.26708984375,
0.07415771484375,
-0.338623046875,
0.363037109375,
-1.10546875,
-0.75,
0.406494140625,
-0.22216796875,
-0.474609375,
-0.4658203125,
-0.2281494140625,
0.06134033203125,
0.09698486328125,
0.499267578125,
-0.5673828125,
0.62451171875,
-0.302490234375,
0.40673828125,
-0.04541015625,
-0.364501953125,
-0.0908203125,
0.484375,
-0.59033203125,
-0.81201171875,
0.58740234375,
1.18359375,
0.197998046875,
-0.15966796875,
-0.496337890625,
0.156494140625,
-0.1578369140625,
-0.1807861328125,
-0.56884765625,
0.62744140625,
-0.30419921875,
0.227294921875,
-0.9052734375,
0.2083740234375,
-0.356201171875,
0.55517578125,
0.1600341796875,
-0.6767578125,
-0.289306640625,
0.53857421875,
0.62646484375,
-0.0849609375,
0.1717529296875,
-0.1302490234375,
0.8056640625,
-0.0980224609375,
-0.193603515625,
-0.0718994140625,
0.8271484375,
0.3955078125,
0.7958984375,
-0.387451171875,
0.50341796875,
0.86279296875,
-0.051116943359375,
-0.0105133056640625,
0.426513671875,
-0.019439697265625,
-0.1014404296875,
-0.29150390625,
-0.329345703125,
-0.15771484375,
0.021728515625,
-0.30810546875,
0.6875,
-0.366943359375,
-0.1800537109375,
-0.254150390625,
-0.92333984375,
0.779296875,
-0.1912841796875,
-0.1490478515625,
-0.049713134765625,
-0.25634765625,
0.212646484375,
1.078125,
-0.046600341796875,
-0.198974609375,
0.59423828125,
0.798828125,
0.1131591796875,
0.498779296875,
0.268798828125,
0.5751953125,
-0.460693359375,
0.253662109375,
0.211669921875,
0.1307373046875,
-0.447998046875,
-0.39697265625,
-0.75048828125,
0.361083984375,
-0.38330078125,
-0.07916259765625,
0.89599609375,
-0.63427734375,
0.1488037109375,
-0.306396484375,
0.75537109375,
-0.4267578125,
0.058258056640625,
0.08544921875,
-0.196044921875,
-1.0048828125,
0.94189453125,
-0.0282745361328125,
0.424072265625,
0.06549072265625,
1.08984375,
-0.2418212890625,
1.5439453125,
0.609375,
-0.051055908203125,
0.04022216796875,
0.1910400390625,
-0.271240234375,
-0.80224609375,
-0.7265625,
-0.351806640625,
0.25146484375,
-0.8662109375,
-0.4150390625,
0.1258544921875,
0.908203125,
0.08685302734375,
-1.115234375,
-0.1917724609375,
0.334716796875,
-0.7998046875,
0.208984375,
0.497802734375,
-0.0130157470703125,
-0.6005859375,
-0.105712890625,
0.290771484375,
-0.383544921875,
0.320068359375,
-0.59619140625,
0.50146484375,
-0.64404296875,
-0.6416015625,
-0.73779296875,
-0.82666015625,
-0.216552734375,
-0.1334228515625,
-0.2413330078125,
-0.7783203125,
0.2744140625,
0.65087890625,
0.658203125,
0.219970703125,
-0.685546875,
0.69677734375,
0.95458984375,
1.177734375,
0.2421875,
0.90380859375,
0.2568359375,
-0.340576171875,
0.2081298828125,
-0.260498046875,
0.248046875,
-0.064208984375,
-0.34912109375,
-0.174072265625,
0.208251953125,
-0.75634765625,
-1.3935546875,
0.5078125,
0.78125,
0.314208984375,
-0.6162109375,
-0.99755859375,
-0.1893310546875,
-1.1708984375,
-0.018096923828125,
-0.52880859375,
0.580078125,
-0.2122802734375,
0.0169219970703125,
-0.38232421875,
-1.33203125,
4.36328125,
0.697265625,
0.951171875,
0.2015380859375,
0.459716796875,
0.6455078125,
0.4990234375,
-0.67041015625,
-0.275146484375,
-0.255126953125,
0.6953125,
-0.56396484375,
0.0958251953125,
0.51025390625,
0.4140625,
0.34814453125,
-0.63037109375,
0.314208984375,
-0.1351318359375,
-0.900390625,
-1.109375,
0.316162109375,
0.007801055908203125,
0.498779296875,
0.02197265625,
-0.11077880859375,
0.25927734375,
-0.497802734375,
-0.1568603515625,
-0.77099609375,
0.23779296875,
-0.410400390625,
1.2080078125,
0.042694091796875,
-0.143310546875,
0.1910400390625,
0.057769775390625,
-0.55029296875,
-0.061614990234375,
0.37451171875,
-0.318603515625,
-0.164306640625,
0.451904296875,
-0.88427734375,
-0.1923828125,
0.287353515625,
-0.78271484375,
0.457275390625,
0.479248046875,
-1.0556640625,
0.89453125,
-0.04461669921875,
0.60498046875,
-0.93115234375,
-0.77490234375,
-0.22998046875,
-0.056884765625,
0.25634765625,
-0.2003173828125,
0.4052734375,
0.06475830078125,
0.61767578125,
-0.2169189453125,
0.59765625,
-0.83154296875,
0.6025390625,
-0.16455078125,
0.6015625,
-0.51171875,
0.056610107421875,
-0.2037353515625,
-0.0166778564453125,
0.1962890625,
0.10211181640625,
0.18115234375,
0.459716796875,
-0.31982421875,
0.7451171875,
0.430908203125,
-0.5595703125,
0.2626953125,
-0.1871337890625,
-0.5283203125,
-0.178955078125,
0.7021484375,
1.2275390625,
-0.78662109375,
-0.403564453125,
-0.471923828125,
0.8779296875,
0.438232421875,
0.55859375,
0.20166015625,
-0.268310546875,
-0.293212890625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
As it's the first of April, Heidi is suspecting that the news she reads today are fake, and she does not want to look silly in front of all the contestants. She knows that a newspiece is fake if it contains heidi as a subsequence. Help Heidi assess whether the given piece is true, but please be discreet about it...
Input
The first and only line of input contains a single nonempty string s of length at most 1000 composed of lowercase letters (a-z).
Output
Output YES if the string s contains heidi as a subsequence and NO otherwise.
Examples
Input
abcheaibcdi
Output
YES
Input
hiedi
Output
NO
Note
A string s contains another string p as a subsequence if it is possible to delete some characters from s and obtain p.
Tags: implementation, strings
Correct Solution:
```
import sys
Input = sys.stdin.readline
s = Input()
a = 'heidi'
q = 0
for i in s:
if i == a[q]:
q += 1
if q == 5:
break
print('YES' if q == 5 else 'NO')
# FMZJMSOMPMSL
```
| 35,668
|
[
0.296142578125,
0.10968017578125,
0.349609375,
0.6484375,
-0.365234375,
-0.509765625,
-0.057952880859375,
0.0208282470703125,
0.35107421875,
0.95068359375,
0.463134765625,
-0.186767578125,
0.2276611328125,
-0.6884765625,
-0.8369140625,
-0.09234619140625,
-0.55029296875,
-0.5947265625,
-0.335693359375,
-0.4267578125,
0.104736328125,
0.04296875,
-1.41015625,
-0.23974609375,
-0.74609375,
1.052734375,
0.1419677734375,
0.10296630859375,
1.1240234375,
1.1025390625,
0.0335693359375,
-0.463134765625,
0.62255859375,
-1.38671875,
-0.251953125,
-0.93212890625,
0.80859375,
-0.7470703125,
-0.49169921875,
-0.5576171875,
0.07757568359375,
-0.11956787109375,
0.39111328125,
-0.701171875,
-1.0400390625,
-0.297119140625,
-0.426513671875,
-0.271484375,
-0.0924072265625,
0.0238494873046875,
0.57421875,
-0.0784912109375,
0.40771484375,
-0.0760498046875,
-0.0282440185546875,
-0.1400146484375,
-0.01287841796875,
-0.264892578125,
-0.66796875,
0.0272216796875,
0.2274169921875,
-0.0005526542663574219,
0.055633544921875,
-0.85205078125,
-0.280029296875,
0.13232421875,
-0.025238037109375,
-0.0177459716796875,
-0.2437744140625,
-0.7568359375,
0.1328125,
0.17333984375,
-0.5,
-0.43896484375,
-0.6748046875,
-0.046539306640625,
0.073486328125,
0.057708740234375,
-0.5107421875,
0.904296875,
-0.0882568359375,
0.736328125,
0.311279296875,
0.333984375,
-0.357177734375,
-0.406005859375,
0.147216796875,
0.209716796875,
0.043853759765625,
-0.10491943359375,
-0.142822265625,
0.64599609375,
-0.74560546875,
-0.2841796875,
0.1903076171875,
0.5322265625,
-0.11700439453125,
0.09423828125,
0.17041015625,
0.32080078125,
0.5078125,
0.787109375,
-0.31494140625,
1.1337890625,
-0.453125,
-0.047515869140625,
0.603515625,
0.00295257568359375,
-0.51171875,
-0.316650390625,
-0.3994140625,
-0.65087890625,
0.50634765625,
0.1107177734375,
-0.0171966552734375,
0.78125,
0.334228515625,
0.330078125,
-0.87841796875,
0.08319091796875,
0.310791015625,
0.1357421875,
0.53369140625,
-0.1737060546875,
0.0322265625,
-0.41357421875,
-0.47607421875,
1.1767578125,
-0.493896484375,
-0.14208984375,
0.42822265625,
0.06463623046875,
0.258056640625,
0.330810546875,
-0.2364501953125,
0.69580078125,
-0.3388671875,
0.66455078125,
0.849609375,
-0.43603515625,
0.6484375,
-0.271484375,
0.0036602020263671875,
1.50390625,
0.266845703125,
0.59130859375,
0.67236328125,
0.55908203125,
-0.72265625,
0.25244140625,
-1.0966796875,
0.474609375,
0.34521484375,
0.31494140625,
-0.33203125,
0.0875244140625,
-0.098876953125,
0.4697265625,
-0.150146484375,
0.340087890625,
-0.64453125,
0.654296875,
-0.158935546875,
0.70947265625,
-0.55322265625,
0.986328125,
-0.125244140625,
-0.350341796875,
-0.26318359375,
-0.89892578125,
0.4765625,
-0.044677734375,
-0.276611328125,
0.720703125,
0.467041015625,
0.70068359375,
0.9013671875,
-0.2320556640625,
0.365478515625,
0.1920166015625,
-0.420166015625,
0.418701171875,
0.6708984375,
0.75732421875,
0.48876953125,
0.1907958984375,
0.21240234375,
0.021392822265625,
-0.67724609375,
-0.50146484375,
0.26318359375,
0.77783203125,
-0.49755859375,
0.46337890625,
0.458984375,
0.1917724609375,
-1.0595703125,
-0.4052734375,
0.3232421875,
-1.2314453125,
-0.330322265625,
0.57470703125,
-0.166748046875,
0.11431884765625,
-0.251708984375,
-0.66162109375,
0.56005859375,
1.232421875,
-0.59521484375,
-0.057464599609375,
0.2861328125,
0.1925048828125,
-0.2379150390625,
0.2083740234375,
-0.0087432861328125,
-0.53173828125,
-0.6962890625,
0.830078125,
-0.35400390625,
-0.167236328125,
0.339599609375,
0.8388671875,
0.71044921875,
0.6845703125,
-0.30810546875,
-0.223388671875,
0.3388671875,
1.0810546875,
-0.1514892578125,
0.30810546875,
0.379638671875,
0.57275390625,
0.2412109375,
0.71142578125,
0.1474609375,
0.0745849609375,
0.5986328125,
0.7978515625,
0.140380859375,
0.2301025390625,
-0.0019989013671875,
0.18017578125,
0.3837890625,
0.56005859375,
0.2464599609375,
0.1993408203125,
-0.1917724609375,
0.08660888671875,
-0.262451171875,
-0.1593017578125,
-0.322998046875,
0.75048828125,
0.26171875,
0.744140625,
-0.266357421875,
-0.416015625,
0.11737060546875,
1.083984375,
-0.9765625,
-0.36669921875,
-0.1300048828125,
0.345703125,
0.09320068359375,
0.1981201171875,
0.24560546875,
0.20751953125,
0.447021484375,
0.642578125,
-0.6650390625,
-0.60205078125,
-0.437255859375,
-0.787109375,
-0.86474609375,
-0.29833984375,
-0.3349609375,
-0.251220703125,
0.405029296875,
-0.92236328125,
0.25439453125,
-0.1632080078125,
-0.0987548828125,
0.464111328125,
-0.828125,
0.408203125,
-0.10601806640625,
0.4140625,
-1.1044921875,
0.6455078125,
0.77783203125,
0.8154296875,
-0.568359375,
-0.08831787109375,
-0.159912109375,
-0.59912109375,
0.1224365234375,
-0.0732421875,
-0.0086212158203125,
-0.1236572265625,
-0.19384765625,
-0.50390625,
-0.16650390625,
-0.1868896484375,
-0.1494140625,
0.43408203125,
-0.71337890625,
0.7060546875,
0.4248046875,
-0.65234375,
0.6494140625,
0.84228515625,
-0.6533203125,
0.39208984375,
0.154296875,
0.0033130645751953125,
-0.8056640625,
1.5068359375,
0.6064453125,
0.335693359375,
-0.5458984375,
0.0221099853515625,
-0.83251953125,
-0.1588134765625,
-0.054443359375,
-0.7548828125,
-0.54150390625,
0.437744140625,
-0.294921875,
-1.03125,
0.6015625,
-1.431640625,
-0.544921875,
-0.037353515625,
-0.1668701171875,
0.90966796875,
1.1708984375,
0.23193359375,
-0.55810546875,
0.0394287109375,
-0.05828857421875,
0.87646484375,
0.16552734375,
-0.57080078125,
0.1220703125,
0.6572265625,
-0.1251220703125,
0.310302734375,
0.347900390625,
-0.17041015625,
0.07537841796875,
-0.259521484375,
0.26953125,
0.61083984375,
0.3701171875,
0.358642578125,
0.32373046875,
0.79248046875,
-0.63037109375,
-0.1290283203125,
0.1224365234375,
0.54833984375,
0.315185546875,
0.83056640625,
0.298583984375,
-0.1552734375,
-0.60986328125,
-1.16015625,
0.0894775390625,
0.278076171875,
0.611328125,
-0.51953125,
0.77734375,
0.043975830078125,
-0.294921875,
0.69140625,
-0.89599609375,
-0.5751953125,
0.86181640625,
-0.1854248046875,
0.62548828125,
-0.69873046875,
0.260009765625,
-0.395263671875,
0.12841796875,
0.59423828125,
-0.043609619140625,
0.479736328125,
-0.212158203125,
-0.62109375,
-0.363037109375,
0.0987548828125,
0.0170440673828125,
-0.9111328125,
0.0146026611328125,
-0.383544921875,
-0.48681640625,
-1.00390625,
0.162353515625,
0.875,
0.73193359375,
0.362060546875,
0.5400390625,
0.0158843994140625,
1.0771484375,
0.371826171875,
-0.65380859375,
0.07330322265625,
-0.76953125,
0.5830078125,
0.166748046875,
0.26416015625,
-0.3232421875,
-0.02923583984375,
-0.007251739501953125,
0.12347412109375,
-0.06939697265625,
-0.6728515625,
-0.916015625,
-0.1563720703125,
-0.12005615234375,
0.275146484375,
-0.7060546875,
-0.53662109375,
-0.243896484375,
0.6083984375,
0.2568359375,
-1.013671875,
0.016510009765625,
-0.70361328125,
0.8388671875,
0.38037109375,
-0.00743865966796875,
-0.353515625,
-0.439453125,
-0.97021484375,
-0.75390625,
-0.00431060791015625,
0.96826171875,
-0.208251953125,
0.32275390625,
-1.494140625,
0.42578125,
0.151123046875,
0.1292724609375,
0.1790771484375,
0.1676025390625,
0.62646484375,
0.3427734375,
0.61279296875,
-0.80712890625,
-0.783203125,
0.00785064697265625,
-1.2548828125,
0.293701171875,
-0.74267578125,
0.0889892578125,
-0.1295166015625,
0.0501708984375,
-0.2734375,
0.72119140625,
-0.172607421875,
0.27587890625,
0.08477783203125,
0.3056640625,
-0.6826171875,
-0.496826171875,
0.9609375,
-0.13818359375,
-0.7265625,
0.71875,
-0.15966796875,
0.2498779296875,
0.448974609375,
0.88818359375,
-0.380126953125,
0.404052734375,
-0.372314453125,
0.45947265625,
-0.09661865234375,
-0.4423828125,
-0.1865234375,
-0.474853515625,
0.5048828125,
-0.175537109375,
-1.3095703125,
-0.357177734375,
-1.1728515625,
-0.10107421875,
-0.074462890625,
-0.1959228515625,
0.427001953125,
0.30078125,
0.2159423828125,
0.0213775634765625,
-0.329833984375,
-0.7822265625,
-0.478271484375,
-0.47509765625,
-0.349365234375,
0.476806640625,
0.88330078125,
0.76513671875,
-0.0928955078125,
-0.476318359375,
-0.11309814453125,
0.197998046875,
-0.050872802734375,
-0.4111328125,
-0.0562744140625,
-0.17919921875,
-0.183837890625,
0.0284576416015625,
0.28369140625,
0.25,
0.6025390625,
0.9716796875,
-0.0672607421875,
0.36767578125,
0.189453125,
-0.65185546875,
0.9580078125,
0.3359375,
-1,
-0.560546875,
0.206787109375,
-0.356201171875,
0.498046875,
0.544921875,
-1.140625,
-0.359375,
-0.9482421875,
0.17333984375,
-0.623046875,
-0.129638671875,
-0.89990234375,
-0.08697509765625,
-0.6923828125,
0.74169921875,
-0.370361328125,
-0.81298828125,
-0.0240325927734375,
-1.0361328125,
0.403076171875,
-0.7978515625,
-0.4033203125,
-0.7783203125,
-0.65625,
-0.38671875,
0.43212890625,
0.09576416015625,
0.3681640625,
-0.24365234375,
-0.336669921875,
0.27001953125,
-0.0604248046875,
-0.5361328125,
-0.46240234375,
0.20849609375,
0.048858642578125,
-0.28125,
0.068603515625,
-0.619140625,
0.9169921875,
-0.74169921875,
0.051177978515625,
-0.16162109375,
-0.323486328125,
-0.250732421875,
0.06683349609375,
0.681640625,
-0.4091796875,
-0.22900390625,
-0.58544921875,
0.6181640625,
0.40283203125,
0.178466796875,
-0.55615234375,
-0.7783203125,
-0.45654296875,
-0.619140625,
0.6806640625,
-0.72607421875,
0.1053466796875,
-0.71435546875,
-0.03424072265625,
0.962890625,
-0.40234375,
0.460205078125,
1.3583984375,
0.11810302734375,
0.082763671875,
-0.77099609375,
0.236083984375,
0.281005859375,
-0.5048828125,
0.062469482421875,
0.52978515625,
-0.7958984375,
0.260009765625,
-0.005596160888671875,
-1.0595703125,
-0.71044921875,
0.260009765625,
1.3564453125,
-0.0638427734375,
0.7353515625,
0.09942626953125,
-1.00390625,
-0.6787109375,
0.943359375,
0.08990478515625,
0.52197265625,
0.9013671875,
-0.10693359375,
-0.06842041015625,
-0.1209716796875,
0.0478515625,
-0.55078125,
-0.7548828125,
1.0244140625,
-0.1710205078125,
-0.48388671875,
0.7880859375,
1.5107421875,
-1.166015625,
-0.67236328125,
0.245849609375,
-0.33251953125,
-0.0007653236389160156,
-0.83740234375,
-0.3564453125,
0.445068359375,
-1.0234375,
0.17578125,
0.48291015625,
-0.143310546875,
0.314208984375,
0.08880615234375,
0.10711669921875,
-0.58251953125,
0.91943359375,
0.73046875,
-0.486572265625,
-0.423095703125,
-0.96337890625,
-0.32373046875,
-0.2388916015625,
-0.01438140869140625,
0.93701171875,
-0.419189453125,
0.09716796875,
0.6875,
-0.28076171875,
0.5478515625,
-0.476806640625,
-0.438720703125,
0.387451171875,
-0.62744140625,
-0.533203125,
-0.2313232421875,
0.1793212890625,
-0.0100250244140625,
0.447509765625,
-0.6083984375,
0.0706787109375,
0.316162109375,
0.45361328125,
0.10931396484375,
-0.90625,
-0.41552734375,
-0.9189453125,
-0.204345703125,
-0.499755859375,
-0.56298828125,
-0.30615234375,
0.2113037109375,
0.024200439453125,
-0.466552734375,
-0.51611328125,
0.421142578125,
-0.6865234375,
1.0849609375,
-0.7421875,
0.222412109375,
-0.412353515625,
-0.34716796875,
-0.673828125,
-0.163330078125,
-0.4033203125,
-0.1446533203125,
-0.64306640625,
-0.00568389892578125,
-0.359619140625,
0.673828125,
0.3466796875,
0.5556640625,
-0.33203125,
-0.9560546875,
-0.13232421875,
0.112060546875,
-0.468505859375,
0.8603515625,
0.546875,
-0.462158203125,
-0.011749267578125,
-0.389892578125,
-0.139404296875,
-0.16552734375,
0.368896484375,
0.39892578125,
0.1292724609375,
-0.55419921875,
-0.3154296875,
0.007129669189453125,
-0.80810546875,
0.0625,
-0.24365234375,
0.252197265625,
0.6171875,
-0.388671875,
0.2376708984375,
1.08984375,
-0.1717529296875,
0.498046875,
0.107177734375,
0.376220703125,
0.34130859375,
0.3681640625,
0.22119140625,
0.60888671875,
0.24658203125,
-0.1619873046875,
0.08941650390625,
0.342529296875,
0.06951904296875,
0.2275390625,
-0.005435943603515625,
-0.626953125,
-0.84033203125,
-0.1990966796875,
-0.1722412109375,
0.2352294921875,
0.42578125,
-0.607421875,
-0.1995849609375,
-0.0184326171875,
-0.358154296875,
0.442138671875,
-1.0537109375,
-0.64404296875,
0.33837890625,
-0.123779296875,
-0.58740234375,
-0.505859375,
-0.1983642578125,
0.0963134765625,
0.10772705078125,
0.465576171875,
-0.68115234375,
0.654296875,
-0.34521484375,
0.408203125,
0.005168914794921875,
-0.376220703125,
0.001056671142578125,
0.413818359375,
-0.52685546875,
-0.796875,
0.587890625,
1.12109375,
0.22119140625,
-0.1898193359375,
-0.489501953125,
0.1300048828125,
-0.2249755859375,
-0.2244873046875,
-0.4228515625,
0.689453125,
-0.338134765625,
0.22314453125,
-0.8798828125,
0.257568359375,
-0.298828125,
0.56201171875,
0.212158203125,
-0.8046875,
-0.251708984375,
0.498779296875,
0.70947265625,
-0.1368408203125,
0.08758544921875,
-0.10870361328125,
0.83837890625,
-0.0172119140625,
-0.1632080078125,
-0.0654296875,
0.841796875,
0.435546875,
0.779296875,
-0.35498046875,
0.591796875,
0.876953125,
-0.0163421630859375,
0.0167236328125,
0.427978515625,
0.10308837890625,
-0.12396240234375,
-0.408203125,
-0.305419921875,
-0.1517333984375,
0.02392578125,
-0.358642578125,
0.7861328125,
-0.4052734375,
-0.10394287109375,
-0.27294921875,
-0.92041015625,
0.80224609375,
-0.1607666015625,
-0.1826171875,
-0.060089111328125,
-0.1087646484375,
0.1802978515625,
1.0771484375,
-0.05804443359375,
-0.1455078125,
0.64111328125,
0.794921875,
0.08416748046875,
0.486083984375,
0.276611328125,
0.56884765625,
-0.469482421875,
0.2724609375,
0.1624755859375,
0.181396484375,
-0.415771484375,
-0.350341796875,
-0.68212890625,
0.3857421875,
-0.44775390625,
0.038482666015625,
0.89599609375,
-0.64404296875,
0.1558837890625,
-0.30859375,
0.78515625,
-0.347412109375,
0.07666015625,
0.1357421875,
-0.10186767578125,
-1.0615234375,
0.9892578125,
0.0771484375,
0.348388671875,
0.0723876953125,
1.064453125,
-0.2181396484375,
1.6103515625,
0.66064453125,
-0.040802001953125,
0.06011962890625,
0.22119140625,
-0.331298828125,
-0.78466796875,
-0.79052734375,
-0.447509765625,
0.2232666015625,
-0.8896484375,
-0.2359619140625,
0.159423828125,
0.9306640625,
0.07635498046875,
-1.0791015625,
-0.274169921875,
0.290283203125,
-0.84326171875,
0.18359375,
0.45654296875,
-0.006877899169921875,
-0.63671875,
-0.092529296875,
0.28564453125,
-0.320556640625,
0.441162109375,
-0.59814453125,
0.406494140625,
-0.5830078125,
-0.66064453125,
-0.80810546875,
-0.90771484375,
-0.2578125,
-0.141845703125,
-0.224853515625,
-0.83837890625,
0.276123046875,
0.69873046875,
0.640625,
0.32958984375,
-0.70947265625,
0.7314453125,
1.0087890625,
1.21484375,
0.1519775390625,
0.8544921875,
0.1824951171875,
-0.39892578125,
0.27734375,
-0.318603515625,
0.2489013671875,
-0.12646484375,
-0.3115234375,
-0.1837158203125,
0.2431640625,
-0.5849609375,
-1.3525390625,
0.55859375,
0.81396484375,
0.350341796875,
-0.5556640625,
-1.009765625,
-0.1815185546875,
-1.1689453125,
0.0794677734375,
-0.59423828125,
0.7490234375,
-0.248291015625,
0.01291656494140625,
-0.4072265625,
-1.3837890625,
4.3359375,
0.72265625,
0.99755859375,
0.1478271484375,
0.4091796875,
0.689453125,
0.421142578125,
-0.71142578125,
-0.182373046875,
-0.1427001953125,
0.640625,
-0.55029296875,
-0.0216217041015625,
0.484619140625,
0.434326171875,
0.36376953125,
-0.6259765625,
0.364013671875,
-0.10394287109375,
-0.89404296875,
-1.078125,
0.337890625,
0.03179931640625,
0.5107421875,
-0.032196044921875,
-0.187255859375,
0.326904296875,
-0.474609375,
-0.11553955078125,
-0.7197265625,
0.2291259765625,
-0.36767578125,
1.2353515625,
-0.054290771484375,
-0.161865234375,
0.1375732421875,
0.12115478515625,
-0.56396484375,
-0.0288543701171875,
0.291748046875,
-0.305419921875,
-0.2445068359375,
0.4716796875,
-0.94677734375,
-0.16162109375,
0.158935546875,
-0.78369140625,
0.52978515625,
0.50537109375,
-1.1240234375,
0.98388671875,
0.0011987686157226562,
0.5478515625,
-1.00390625,
-0.703125,
-0.219482421875,
0.07568359375,
0.2216796875,
-0.313720703125,
0.426513671875,
0.10443115234375,
0.58740234375,
-0.193115234375,
0.634765625,
-0.81494140625,
0.57666015625,
-0.09173583984375,
0.58837890625,
-0.6005859375,
0.038970947265625,
-0.1561279296875,
0.002483367919921875,
0.1226806640625,
0.1348876953125,
0.28466796875,
0.39697265625,
-0.357421875,
0.74755859375,
0.5087890625,
-0.54345703125,
0.27978515625,
-0.195556640625,
-0.53564453125,
-0.152099609375,
0.65283203125,
1.2890625,
-0.78271484375,
-0.50927734375,
-0.4921875,
0.84716796875,
0.36181640625,
0.46142578125,
0.2021484375,
-0.232421875,
-0.2489013671875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
VK just opened its second HQ in St. Petersburg! Side of its office building has a huge string s written on its side. This part of the office is supposed to be split into m meeting rooms in such way that meeting room walls are strictly between letters on the building. Obviously, meeting rooms should not be of size 0, but can be as small as one letter wide. Each meeting room will be named after the substring of s written on its side.
<image>
For each possible arrangement of m meeting rooms we ordered a test meeting room label for the meeting room with lexicographically minimal name. When delivered, those labels got sorted backward lexicographically.
What is printed on kth label of the delivery?
Input
In the first line, you are given three integer numbers n, m, k β length of string s, number of planned meeting rooms to split s into and number of the interesting label (2 β€ n β€ 1 000; 1 β€ m β€ 1 000; 1 β€ k β€ 10^{18}).
Second input line has string s, consisting of n lowercase english letters.
For given n, m, k there are at least k ways to split s into m substrings.
Output
Output single string β name of meeting room printed on k-th label of the delivery.
Examples
Input
4 2 1
abac
Output
aba
Input
19 5 1821
aupontrougevkoffice
Output
au
Note
In the first example, delivery consists of the labels "aba", "ab", "a".
In the second example, delivery consists of 3060 labels. The first label is "aupontrougevkof" and the last one is "a".
Submitted Solution:
```
import math
def nCr(n,r):
f = math.factorial
return f(n) // f(r) // f(n-r)
n,m,k=map(int,input().split())
count=0
word=input()
length=len(word)
if(m==1):
print(word)
elif(m==2):
print(word[0:n-k])
else:
x=m-2
while(count<k):
count+=nCr(x,x-m+2)
x=x+1
print(word[0:n-x])
```
No
| 36,207
|
[
0.279541015625,
-0.1187744140625,
-0.042388916015625,
0.2261962890625,
-0.55322265625,
-0.6591796875,
0.01251220703125,
0.212158203125,
-0.07183837890625,
0.489501953125,
0.6650390625,
-0.0182342529296875,
-0.0186767578125,
-0.6943359375,
-0.166748046875,
0.264404296875,
-0.61181640625,
-0.473876953125,
-0.451904296875,
-0.0062713623046875,
0.11553955078125,
0.253173828125,
-1.3828125,
-0.0517578125,
-0.346435546875,
0.93701171875,
0.50439453125,
-0.1383056640625,
0.98193359375,
0.931640625,
-0.2095947265625,
-0.75634765625,
0.55908203125,
-1.1806640625,
-0.214599609375,
-0.2484130859375,
0.859375,
-0.5283203125,
-0.311767578125,
-0.6806640625,
0.24072265625,
-0.268310546875,
0.2276611328125,
-0.97314453125,
-0.88720703125,
0.21533203125,
-0.06378173828125,
-0.2149658203125,
0.035919189453125,
-0.359375,
0.2130126953125,
-0.0599365234375,
0.44873046875,
-0.2232666015625,
0.1295166015625,
-0.355712890625,
-0.248779296875,
-0.06890869140625,
-0.701171875,
0.44677734375,
0.0439453125,
0.269287109375,
0.167724609375,
-0.67236328125,
0.272216796875,
0.378662109375,
-0.1827392578125,
-0.62548828125,
-0.142578125,
-0.9912109375,
-0.348388671875,
0.063720703125,
-0.767578125,
-0.42431640625,
-0.2376708984375,
-0.107666015625,
0.31201171875,
0.12548828125,
-0.80810546875,
0.67919921875,
0.2041015625,
0.80029296875,
0.33154296875,
0.309814453125,
-0.60302734375,
-0.75341796875,
0.0670166015625,
0.293701171875,
0.3896484375,
0.1397705078125,
0.03955078125,
0.35400390625,
-0.603515625,
-0.0139923095703125,
0.77685546875,
0.43701171875,
-0.257080078125,
0.68603515625,
0.2666015625,
0.384765625,
0.66259765625,
0.84765625,
-0.267578125,
0.89013671875,
-0.9150390625,
0.34912109375,
0.56640625,
-0.259033203125,
-0.09417724609375,
-0.33740234375,
-0.15087890625,
-0.55615234375,
0.32958984375,
0.38330078125,
0.21728515625,
0.94970703125,
0.377685546875,
0.33203125,
-0.90185546875,
0.439208984375,
0.71728515625,
-0.128662109375,
0.450439453125,
-0.44873046875,
0.0179290771484375,
-0.225341796875,
-0.0177764892578125,
1.22265625,
-0.55615234375,
-0.153076171875,
0.57666015625,
-0.010009765625,
-0.51806640625,
0.2568359375,
0.171142578125,
0.273193359375,
-0.0943603515625,
0.52099609375,
0.65283203125,
-0.55712890625,
0.8212890625,
-0.319091796875,
-0.032257080078125,
1.5869140625,
-0.10211181640625,
0.09271240234375,
0.6083984375,
0.43701171875,
-0.9482421875,
0.06756591796875,
-0.82666015625,
0.6865234375,
-0.1923828125,
0.096923828125,
-0.281494140625,
0.336669921875,
-0.13525390625,
0.587890625,
-0.191650390625,
0.16015625,
-0.163330078125,
0.1453857421875,
-0.467529296875,
0.6796875,
-0.6455078125,
0.73046875,
-0.94384765625,
-0.15185546875,
-0.322021484375,
-0.57763671875,
-0.09075927734375,
-0.16357421875,
0.0137939453125,
0.90283203125,
0.5791015625,
1.1123046875,
0.96533203125,
0.0043487548828125,
0.481689453125,
0.342529296875,
-0.332275390625,
0.037506103515625,
0.58740234375,
0.63525390625,
0.295166015625,
0.422607421875,
0.21875,
-0.054290771484375,
-0.892578125,
-0.74169921875,
0.2076416015625,
1.060546875,
-0.6962890625,
0.61474609375,
-0.1224365234375,
0.072021484375,
-0.95556640625,
0.207275390625,
0.06732177734375,
-0.7822265625,
-0.6591796875,
0.6962890625,
0.00412750244140625,
0.418701171875,
-0.2462158203125,
-0.484619140625,
0.490478515625,
1.1962890625,
-0.26953125,
0.35546875,
0.3740234375,
0.1395263671875,
-0.583984375,
0.146484375,
0.50048828125,
-0.172607421875,
-0.80908203125,
0.78271484375,
-0.203857421875,
-0.3740234375,
-0.329833984375,
0.63330078125,
0.09423828125,
0.59033203125,
-0.53564453125,
-0.261962890625,
0.4892578125,
1.2412109375,
0.09637451171875,
0.354736328125,
0.14794921875,
0.88525390625,
0.66162109375,
0.841796875,
0.86279296875,
0.333251953125,
0.6455078125,
0.66455078125,
-0.007602691650390625,
0.327392578125,
0.2203369140625,
0.6962890625,
0.151123046875,
0.58984375,
0.0853271484375,
0.58740234375,
-0.2496337890625,
0.10931396484375,
-0.483154296875,
0.09637451171875,
-0.1981201171875,
0.78662109375,
0.025787353515625,
0.7158203125,
-0.521484375,
-0.2254638671875,
0.275390625,
0.66552734375,
-1.025390625,
-0.63671875,
-0.0163116455078125,
-0.377197265625,
-0.023284912109375,
0.0430908203125,
0.51904296875,
0.51416015625,
0.4599609375,
0.248779296875,
-0.517578125,
-0.34423828125,
-0.9013671875,
-0.59228515625,
-0.96142578125,
-0.4580078125,
-0.78759765625,
-0.2548828125,
0.485595703125,
-0.96142578125,
0.344482421875,
-0.276611328125,
-0.027862548828125,
0.05499267578125,
-0.2421875,
0.399169921875,
-0.1640625,
0.477294921875,
-0.353271484375,
0.450927734375,
0.0760498046875,
1.0732421875,
-0.826171875,
-0.0038166046142578125,
-0.284912109375,
-0.2127685546875,
0.513671875,
-0.08740234375,
0.132568359375,
0.145263671875,
-0.72607421875,
-1.1220703125,
-0.736328125,
0.1549072265625,
-0.5234375,
0.257568359375,
-0.6943359375,
1.0458984375,
0.323974609375,
-0.4248046875,
0.461181640625,
0.88818359375,
-0.5751953125,
0.430419921875,
0.403564453125,
-0.405029296875,
-0.947265625,
1.0380859375,
0.466064453125,
0.479736328125,
-0.5966796875,
-0.63916015625,
-0.62255859375,
0.1695556640625,
0.274169921875,
-0.7314453125,
-0.326416015625,
0.57421875,
0.16845703125,
-0.89404296875,
0.4453125,
-1.2509765625,
-0.8115234375,
-0.494384765625,
-0.54638671875,
0.88232421875,
0.681640625,
-0.0806884765625,
-0.50244140625,
-0.480712890625,
0.0965576171875,
0.45947265625,
0.477783203125,
-0.60302734375,
-0.01422882080078125,
0.583984375,
-0.1968994140625,
0.2000732421875,
0.1688232421875,
-0.314453125,
-0.10614013671875,
-0.137939453125,
0.38427734375,
0.48193359375,
0.027679443359375,
0.2607421875,
0.072998046875,
0.65869140625,
-1.1376953125,
-0.405029296875,
-0.1282958984375,
0.6435546875,
0.2037353515625,
-0.2049560546875,
0.248779296875,
-0.101806640625,
-0.736328125,
-1.060546875,
0.0943603515625,
0.06072998046875,
0.806640625,
-0.7275390625,
0.76171875,
0.054779052734375,
-0.7431640625,
0.61279296875,
-0.62841796875,
-0.525390625,
0.77587890625,
0.0179901123046875,
0.88330078125,
-0.4716796875,
0.3232421875,
-0.1402587890625,
-0.240234375,
0.447021484375,
0.2210693359375,
0.69775390625,
-0.61572265625,
-0.59423828125,
-0.216796875,
0.0504150390625,
0.1429443359375,
-0.331787109375,
0.040771484375,
-0.455810546875,
-0.406494140625,
-0.91748046875,
0.43798828125,
0.83251953125,
0.5224609375,
0.3076171875,
0.476806640625,
0.1240234375,
0.2626953125,
0.46630859375,
-0.2369384765625,
0.30615234375,
-0.607421875,
1.005859375,
0.2822265625,
-0.08428955078125,
-0.484619140625,
-0.671875,
-0.1634521484375,
-0.033416748046875,
-0.5185546875,
0.019683837890625,
-1.2001953125,
0.0941162109375,
0.058746337890625,
0.66748046875,
-0.417724609375,
-0.50732421875,
-0.1409912109375,
0.387451171875,
0.2047119140625,
-0.6494140625,
0.240234375,
-0.578125,
0.46533203125,
0.59423828125,
-0.748046875,
-0.477783203125,
-0.451171875,
-0.70654296875,
-0.76025390625,
0.004123687744140625,
0.56884765625,
-0.385009765625,
0.33203125,
-1.275390625,
0.640625,
0.5732421875,
-0.69580078125,
-0.18701171875,
-0.058074951171875,
0.40771484375,
0.06427001953125,
0.57373046875,
-0.845703125,
-0.71875,
0.0504150390625,
-0.96630859375,
0.37060546875,
-0.64111328125,
0.58642578125,
0.144287109375,
0.1627197265625,
0.06280517578125,
0.6728515625,
-0.2401123046875,
0.465576171875,
-0.365478515625,
0.2017822265625,
-0.79638671875,
-0.806640625,
0.77001953125,
-0.2322998046875,
-0.712890625,
0.767578125,
-0.04510498046875,
-0.77490234375,
-0.10430908203125,
0.462890625,
-0.265625,
0.40625,
-0.71826171875,
0.379638671875,
-0.408935546875,
-0.27392578125,
0.01580810546875,
-0.58642578125,
0.9599609375,
0.161376953125,
-0.5869140625,
-0.36669921875,
-1.044921875,
-0.17333984375,
0.1339111328125,
-0.734375,
0.419921875,
0.107177734375,
0.0650634765625,
-0.057281494140625,
-0.56787109375,
-0.408935546875,
-0.1976318359375,
-0.425537109375,
0.1280517578125,
0.144775390625,
0.160400390625,
0.8388671875,
0.01593017578125,
-0.294921875,
-0.053314208984375,
0.01305389404296875,
-0.2081298828125,
-0.50146484375,
0.1304931640625,
-0.337158203125,
-0.129150390625,
-0.336669921875,
0.1710205078125,
0.033416748046875,
0.63232421875,
0.82958984375,
0.284423828125,
0.400390625,
0.1978759765625,
-0.40771484375,
1.2841796875,
0.11370849609375,
-0.81103515625,
-0.31787109375,
0.265380859375,
-0.17578125,
0.349609375,
0.4931640625,
-0.62255859375,
-0.84912109375,
-0.90576171875,
0.05535888671875,
-0.6494140625,
-0.405517578125,
-0.89794921875,
-0.71728515625,
-0.4482421875,
0.61865234375,
-0.1595458984375,
-0.39306640625,
0.472412109375,
-0.8994140625,
-0.218505859375,
-1.025390625,
-0.21875,
-0.5380859375,
-0.039947509765625,
-0.357421875,
0.79736328125,
-0.070556640625,
0.08392333984375,
-0.0026683807373046875,
0.0723876953125,
0.09503173828125,
-0.296142578125,
-0.591796875,
-0.5556640625,
-0.2000732421875,
0.271484375,
0.0653076171875,
0.3017578125,
-0.53759765625,
0.52587890625,
-0.8251953125,
-0.07574462890625,
-0.181640625,
-0.425537109375,
-0.258544921875,
-0.5634765625,
1.1435546875,
-0.396728515625,
-0.13720703125,
-0.288330078125,
0.27197265625,
0.89990234375,
-0.3837890625,
-0.40087890625,
-0.84765625,
-0.58447265625,
-1.017578125,
0.53857421875,
-0.239990234375,
0.059326171875,
-0.533203125,
-0.2666015625,
1.087890625,
-0.482421875,
0.59033203125,
1.23046875,
0.0501708984375,
0.54443359375,
-0.87548828125,
0.55029296875,
0.457763671875,
-0.60791015625,
0.2001953125,
-0.04241943359375,
-0.587890625,
0.3125,
-0.3447265625,
-1.0732421875,
-0.78515625,
-0.0252685546875,
1.1484375,
-0.28466796875,
0.61767578125,
0.1397705078125,
-1.234375,
-0.55419921875,
0.9658203125,
0.3046875,
0.0180511474609375,
0.426513671875,
-0.3515625,
-0.1309814453125,
0.00342559814453125,
0.11712646484375,
-0.384521484375,
-0.2442626953125,
1.2099609375,
-0.3876953125,
-0.427734375,
0.83251953125,
0.98779296875,
-0.86083984375,
-0.52001953125,
-0.0025234222412109375,
0.1522216796875,
-0.388427734375,
-0.65625,
0.43798828125,
0.349365234375,
-0.70166015625,
0.27783203125,
0.41650390625,
0.14111328125,
0.267578125,
0.365234375,
0.229248046875,
-0.183349609375,
0.264404296875,
0.4951171875,
-0.73095703125,
-0.371337890625,
-0.83642578125,
-0.115234375,
-0.281005859375,
0.1259765625,
0.5771484375,
-0.35546875,
0.5771484375,
0.451904296875,
0.1163330078125,
0.8681640625,
-0.2001953125,
-0.034088134765625,
0.222900390625,
-0.54931640625,
-0.73828125,
0.08282470703125,
0.486328125,
-0.20361328125,
0.701171875,
-0.396728515625,
0.0161895751953125,
0.3515625,
-0.1942138671875,
-0.2025146484375,
-0.90771484375,
-0.218994140625,
-0.8193359375,
-0.43310546875,
-0.4638671875,
-0.671875,
0.2171630859375,
0.12890625,
0.1884765625,
-0.434814453125,
-0.04010009765625,
0.5107421875,
-0.6728515625,
1.103515625,
-0.381591796875,
0.1534423828125,
-0.423583984375,
-0.420654296875,
-0.59521484375,
0.314208984375,
-0.6396484375,
-0.1541748046875,
-0.6298828125,
0.29638671875,
-0.12445068359375,
0.32763671875,
-0.276123046875,
0.320068359375,
-0.360595703125,
-0.486328125,
-0.35107421875,
0.26416015625,
-0.270751953125,
0.51171875,
0.2442626953125,
-0.255859375,
0.52294921875,
-0.1290283203125,
-0.1512451171875,
-0.10577392578125,
0.498291015625,
0.334716796875,
-0.34765625,
-0.05731201171875,
-0.1917724609375,
0.2025146484375,
-0.87109375,
0.4765625,
-0.23046875,
0.33837890625,
0.26318359375,
-0.24755859375,
0.6484375,
1.236328125,
-0.09869384765625,
0.07623291015625,
0.22998046875,
0.2998046875,
0.43359375,
0.14306640625,
0.041839599609375,
0.490234375,
-0.0736083984375,
-0.515625,
-0.01898193359375,
0.2568359375,
0.1407470703125,
-0.048431396484375,
0.10333251953125,
-1.0595703125,
-0.98193359375,
0.10028076171875,
-0.2235107421875,
0.662109375,
0.681640625,
-0.74658203125,
-0.328369140625,
-0.01158905029296875,
-0.303955078125,
0.1759033203125,
-1.09375,
-0.9931640625,
0.341552734375,
-0.0023670196533203125,
-0.4111328125,
-0.006252288818359375,
-0.417724609375,
-0.1680908203125,
0.01342010498046875,
0.257568359375,
-0.406005859375,
0.5947265625,
0.160400390625,
0.67236328125,
-0.2431640625,
-0.236083984375,
0.257568359375,
0.60595703125,
-0.5966796875,
-0.63427734375,
-0.069580078125,
1.23828125,
-0.1483154296875,
-0.292236328125,
-0.59619140625,
0.058563232421875,
0.129638671875,
-0.15673828125,
-0.2177734375,
0.251220703125,
-0.114990234375,
0.3828125,
-0.76513671875,
-0.132568359375,
-0.348388671875,
0.21044921875,
0.1236572265625,
-0.29248046875,
-0.69970703125,
0.87060546875,
0.7802734375,
-0.089599609375,
0.490234375,
-0.008392333984375,
0.458740234375,
0.025146484375,
-0.117431640625,
-0.9384765625,
0.421875,
0.79248046875,
0.488525390625,
0.1304931640625,
0.54296875,
0.7490234375,
-0.045318603515625,
-0.254150390625,
0.626953125,
0.1904296875,
0.00846099853515625,
0.0855712890625,
-0.12274169921875,
0.033233642578125,
0.07403564453125,
-0.64697265625,
0.173583984375,
-0.448974609375,
-0.1807861328125,
-0.2476806640625,
-0.609375,
0.673828125,
-0.2059326171875,
-0.327392578125,
0.029693603515625,
-0.501953125,
0.375244140625,
0.703125,
0.31591796875,
-0.1234130859375,
0.5341796875,
0.66748046875,
0.80078125,
0.64501953125,
0.44677734375,
0.3154296875,
-0.55419921875,
0.25830078125,
-0.10302734375,
-0.036346435546875,
-0.56689453125,
-0.253173828125,
-0.8193359375,
0.6953125,
-0.12115478515625,
-0.316162109375,
0.662109375,
-0.95654296875,
0.298828125,
-0.5302734375,
0.55615234375,
-0.55517578125,
0.428955078125,
0.2235107421875,
-0.36767578125,
-0.5693359375,
0.802734375,
-0.231689453125,
0.06256103515625,
0.38720703125,
1.0927734375,
0.33544921875,
1.583984375,
0.99609375,
-0.20068359375,
-0.0731201171875,
0.443359375,
-0.26318359375,
-0.274169921875,
-0.387451171875,
-0.3017578125,
-0.06732177734375,
-0.80859375,
-0.371826171875,
-0.226318359375,
1.0048828125,
0.342041015625,
-0.92822265625,
-0.367431640625,
0.3994140625,
-0.9287109375,
0.35302734375,
0.446533203125,
0.40185546875,
0.2110595703125,
-0.2237548828125,
-0.311279296875,
-0.64013671875,
0.1619873046875,
-0.436767578125,
0.336669921875,
-0.447265625,
-0.321044921875,
-0.453369140625,
-0.64111328125,
-0.28173828125,
0.212890625,
-0.38818359375,
-0.8828125,
0.406005859375,
0.509765625,
0.451416015625,
0.491943359375,
-0.09442138671875,
-0.275390625,
1.134765625,
1.056640625,
0.12005615234375,
0.90869140625,
0.497314453125,
-0.320068359375,
-0.08294677734375,
-0.1231689453125,
0.541015625,
-0.0203857421875,
0.1761474609375,
-0.06390380859375,
0.36083984375,
-0.73779296875,
-1.3505859375,
-0.10223388671875,
0.13525390625,
0.339599609375,
-0.57373046875,
-1.1015625,
-0.492431640625,
-1.140625,
-0.20361328125,
-0.5849609375,
0.78076171875,
0.165283203125,
0.1199951171875,
-0.0008220672607421875,
-1.02734375,
4.45703125,
0.9169921875,
0.87109375,
0.6328125,
0.470458984375,
1.294921875,
0.3486328125,
-0.755859375,
-0.11273193359375,
-0.60546875,
0.10845947265625,
-0.56005859375,
-0.1239013671875,
0.9130859375,
0.315185546875,
0.50830078125,
-0.81689453125,
0.1396484375,
-0.027984619140625,
-0.96923828125,
-1.1611328125,
0.347412109375,
0.50732421875,
0.4580078125,
-0.0063323974609375,
0.282958984375,
0.8701171875,
-0.7880859375,
-0.296142578125,
-0.69140625,
0.419921875,
-0.498046875,
0.9619140625,
0.08892822265625,
-0.275390625,
0.8037109375,
-0.2237548828125,
-0.5283203125,
-0.191650390625,
0.130126953125,
-0.235107421875,
0.047882080078125,
0.66259765625,
-0.7333984375,
0.029998779296875,
0.634765625,
-0.450927734375,
0.364990234375,
0.39208984375,
-0.9296875,
0.95751953125,
-0.331298828125,
0.556640625,
-0.30078125,
-0.62939453125,
-0.046142578125,
0.251708984375,
0.1512451171875,
-0.2344970703125,
0.255859375,
0.436279296875,
0.556640625,
-0.052276611328125,
0.52685546875,
-0.6298828125,
0.50537109375,
-0.040924072265625,
0.27392578125,
-0.55078125,
0.0106201171875,
-0.297607421875,
-0.0858154296875,
-0.392333984375,
-0.431884765625,
0.5244140625,
0.31640625,
-0.291748046875,
0.61376953125,
0.84619140625,
-0.55810546875,
0.29736328125,
-0.080810546875,
-0.259521484375,
-0.272216796875,
0.465087890625,
1.1484375,
-0.6669921875,
-0.62109375,
-0.486328125,
0.47216796875,
0.392578125,
0.54345703125,
-0.09027099609375,
-0.73193359375,
-0.377197265625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
VK just opened its second HQ in St. Petersburg! Side of its office building has a huge string s written on its side. This part of the office is supposed to be split into m meeting rooms in such way that meeting room walls are strictly between letters on the building. Obviously, meeting rooms should not be of size 0, but can be as small as one letter wide. Each meeting room will be named after the substring of s written on its side.
<image>
For each possible arrangement of m meeting rooms we ordered a test meeting room label for the meeting room with lexicographically minimal name. When delivered, those labels got sorted backward lexicographically.
What is printed on kth label of the delivery?
Input
In the first line, you are given three integer numbers n, m, k β length of string s, number of planned meeting rooms to split s into and number of the interesting label (2 β€ n β€ 1 000; 1 β€ m β€ 1 000; 1 β€ k β€ 10^{18}).
Second input line has string s, consisting of n lowercase english letters.
For given n, m, k there are at least k ways to split s into m substrings.
Output
Output single string β name of meeting room printed on k-th label of the delivery.
Examples
Input
4 2 1
abac
Output
aba
Input
19 5 1821
aupontrougevkoffice
Output
au
Note
In the first example, delivery consists of the labels "aba", "ab", "a".
In the second example, delivery consists of 3060 labels. The first label is "aupontrougevkof" and the last one is "a".
Submitted Solution:
```
def comb(a, b):
ret = 1
while b > 0:
ret *= a // b
a -= 1
b -= 1
return ret
n, m, k = map(int, input().strip().split())
s = input().strip()
plen = n - (m - 1)
total = 0
while total + comb(n - plen, m - 1) < k:
plen -= 1
print(s[:plen])
```
No
| 36,208
|
[
0.342041015625,
-0.1492919921875,
-0.038238525390625,
0.1497802734375,
-0.6337890625,
-0.61474609375,
0.0119476318359375,
0.151611328125,
0.0113067626953125,
0.44970703125,
0.69287109375,
0.0220794677734375,
-0.00414276123046875,
-0.61181640625,
-0.1907958984375,
0.28759765625,
-0.60205078125,
-0.45947265625,
-0.493408203125,
-0.053314208984375,
0.058135986328125,
0.255126953125,
-1.3427734375,
-0.1058349609375,
-0.38720703125,
0.875,
0.494873046875,
-0.115966796875,
0.99365234375,
0.89501953125,
-0.21533203125,
-0.65283203125,
0.54248046875,
-1.189453125,
-0.191650390625,
-0.306396484375,
0.82177734375,
-0.5556640625,
-0.33251953125,
-0.7294921875,
0.197509765625,
-0.25634765625,
0.2432861328125,
-0.94873046875,
-0.8583984375,
0.24560546875,
-0.0487060546875,
-0.214111328125,
-0.06121826171875,
-0.39794921875,
0.20751953125,
-0.08184814453125,
0.4130859375,
-0.2027587890625,
0.164794921875,
-0.29052734375,
-0.257568359375,
-0.0245208740234375,
-0.671875,
0.3828125,
0.025299072265625,
0.281982421875,
0.12322998046875,
-0.6904296875,
0.213623046875,
0.40625,
-0.1065673828125,
-0.65576171875,
-0.1500244140625,
-0.95751953125,
-0.317626953125,
0.01702880859375,
-0.78466796875,
-0.4365234375,
-0.25634765625,
-0.1644287109375,
0.3076171875,
0.14453125,
-0.83935546875,
0.619140625,
0.1781005859375,
0.7900390625,
0.27734375,
0.3173828125,
-0.6064453125,
-0.78271484375,
0.07196044921875,
0.267333984375,
0.39453125,
0.24853515625,
0.0058135986328125,
0.328125,
-0.60302734375,
-0.0082244873046875,
0.728515625,
0.4677734375,
-0.244384765625,
0.65869140625,
0.21533203125,
0.32958984375,
0.64111328125,
0.90185546875,
-0.287841796875,
0.94140625,
-0.8759765625,
0.3564453125,
0.53759765625,
-0.2135009765625,
-0.0653076171875,
-0.348876953125,
-0.1700439453125,
-0.5087890625,
0.343994140625,
0.43359375,
0.2171630859375,
0.943359375,
0.368896484375,
0.314208984375,
-0.89453125,
0.374267578125,
0.63427734375,
-0.1475830078125,
0.461669921875,
-0.397705078125,
0.02105712890625,
-0.23046875,
-0.0261077880859375,
1.130859375,
-0.56494140625,
-0.14794921875,
0.6044921875,
-0.074462890625,
-0.46484375,
0.2340087890625,
0.22119140625,
0.312255859375,
-0.13623046875,
0.53466796875,
0.583984375,
-0.5791015625,
0.751953125,
-0.310791015625,
-0.041656494140625,
1.609375,
-0.1103515625,
0.09271240234375,
0.6279296875,
0.3759765625,
-0.91796875,
0.039886474609375,
-0.689453125,
0.6376953125,
-0.213134765625,
0.04681396484375,
-0.2113037109375,
0.2174072265625,
-0.1424560546875,
0.60107421875,
-0.1552734375,
0.1995849609375,
-0.1971435546875,
0.14013671875,
-0.5166015625,
0.69580078125,
-0.58056640625,
0.77197265625,
-0.82470703125,
-0.11907958984375,
-0.282958984375,
-0.56298828125,
-0.0960693359375,
-0.1351318359375,
0.012237548828125,
0.8818359375,
0.5556640625,
1.0771484375,
0.96044921875,
-0.006671905517578125,
0.423095703125,
0.35986328125,
-0.28515625,
0.07830810546875,
0.57861328125,
0.7265625,
0.2427978515625,
0.3994140625,
0.21728515625,
0.0267486572265625,
-0.88818359375,
-0.73291015625,
0.2064208984375,
1.0244140625,
-0.74609375,
0.6826171875,
-0.08837890625,
0.09466552734375,
-0.9189453125,
0.1751708984375,
0.068359375,
-0.80078125,
-0.66064453125,
0.7177734375,
-0.011962890625,
0.462158203125,
-0.25439453125,
-0.4765625,
0.493896484375,
1.173828125,
-0.25732421875,
0.364013671875,
0.407470703125,
0.173095703125,
-0.57861328125,
0.1505126953125,
0.50244140625,
-0.192626953125,
-0.73974609375,
0.765625,
-0.169921875,
-0.3408203125,
-0.294189453125,
0.6396484375,
0.077392578125,
0.474853515625,
-0.59521484375,
-0.252197265625,
0.446044921875,
1.22265625,
0.143798828125,
0.42138671875,
0.075927734375,
0.91064453125,
0.68359375,
0.84228515625,
0.83203125,
0.244140625,
0.65625,
0.6669921875,
-0.04071044921875,
0.35546875,
0.2056884765625,
0.6611328125,
0.1170654296875,
0.583984375,
0.1541748046875,
0.57373046875,
-0.27197265625,
0.1546630859375,
-0.50830078125,
0.1212158203125,
-0.261474609375,
0.8994140625,
0.039093017578125,
0.70068359375,
-0.461181640625,
-0.274658203125,
0.305908203125,
0.6611328125,
-0.9189453125,
-0.62939453125,
0.004978179931640625,
-0.450439453125,
-0.049957275390625,
-0.013885498046875,
0.5,
0.46923828125,
0.4541015625,
0.223876953125,
-0.437744140625,
-0.366455078125,
-0.9423828125,
-0.53466796875,
-0.99072265625,
-0.4912109375,
-0.8076171875,
-0.319091796875,
0.44921875,
-0.94287109375,
0.3837890625,
-0.315185546875,
0.0199737548828125,
0.048492431640625,
-0.297607421875,
0.4111328125,
-0.133056640625,
0.480224609375,
-0.292236328125,
0.40576171875,
0.1669921875,
1.0458984375,
-0.8408203125,
-0.0270538330078125,
-0.307861328125,
-0.2281494140625,
0.42041015625,
-0.07684326171875,
0.09405517578125,
0.166015625,
-0.66748046875,
-1.080078125,
-0.77587890625,
0.173095703125,
-0.52294921875,
0.2340087890625,
-0.689453125,
1.1025390625,
0.31884765625,
-0.447021484375,
0.411376953125,
0.91552734375,
-0.51611328125,
0.40771484375,
0.3837890625,
-0.314453125,
-0.92236328125,
1.0849609375,
0.4765625,
0.493896484375,
-0.63134765625,
-0.6826171875,
-0.619140625,
0.19482421875,
0.285400390625,
-0.7939453125,
-0.36376953125,
0.55712890625,
0.1351318359375,
-0.88818359375,
0.47607421875,
-1.26953125,
-0.8173828125,
-0.494384765625,
-0.52099609375,
0.86865234375,
0.72705078125,
-0.073486328125,
-0.453857421875,
-0.435546875,
0.15283203125,
0.4345703125,
0.430419921875,
-0.6015625,
-0.06134033203125,
0.65234375,
-0.165283203125,
0.2239990234375,
0.2291259765625,
-0.36572265625,
-0.0662841796875,
-0.16162109375,
0.349853515625,
0.48388671875,
0.10321044921875,
0.27197265625,
0.052093505859375,
0.60888671875,
-1.1328125,
-0.416015625,
-0.10455322265625,
0.63818359375,
0.234375,
-0.148681640625,
0.241943359375,
-0.045074462890625,
-0.7734375,
-1.0068359375,
0.1253662109375,
0.11102294921875,
0.78759765625,
-0.7353515625,
0.7529296875,
0.0411376953125,
-0.77294921875,
0.60546875,
-0.63720703125,
-0.51171875,
0.80908203125,
0.017974853515625,
0.86865234375,
-0.483154296875,
0.346923828125,
-0.1436767578125,
-0.209716796875,
0.403564453125,
0.1488037109375,
0.7119140625,
-0.60107421875,
-0.5966796875,
-0.26025390625,
0.050262451171875,
0.162841796875,
-0.291015625,
0.0276947021484375,
-0.468505859375,
-0.367919921875,
-0.94873046875,
0.367431640625,
0.74072265625,
0.463623046875,
0.283447265625,
0.54248046875,
0.191162109375,
0.3193359375,
0.44482421875,
-0.246337890625,
0.338623046875,
-0.6044921875,
0.94775390625,
0.33642578125,
-0.0628662109375,
-0.4775390625,
-0.62939453125,
-0.131591796875,
-0.038482666015625,
-0.4462890625,
0.0360107421875,
-1.1220703125,
0.04095458984375,
0.131103515625,
0.69921875,
-0.367919921875,
-0.54833984375,
-0.1810302734375,
0.4033203125,
0.1868896484375,
-0.5986328125,
0.1722412109375,
-0.51513671875,
0.433837890625,
0.55078125,
-0.7177734375,
-0.487548828125,
-0.42626953125,
-0.69189453125,
-0.8017578125,
0.0119476318359375,
0.60400390625,
-0.37939453125,
0.2626953125,
-1.21875,
0.63525390625,
0.5849609375,
-0.703125,
-0.1470947265625,
-0.1383056640625,
0.369140625,
0.10296630859375,
0.54931640625,
-0.7802734375,
-0.7001953125,
0.004169464111328125,
-1.046875,
0.3935546875,
-0.56396484375,
0.491943359375,
0.1572265625,
0.129150390625,
0.046844482421875,
0.65087890625,
-0.26611328125,
0.4189453125,
-0.318115234375,
0.2425537109375,
-0.857421875,
-0.7978515625,
0.77880859375,
-0.13818359375,
-0.6787109375,
0.72314453125,
-0.033599853515625,
-0.77294921875,
-0.065673828125,
0.486328125,
-0.26904296875,
0.416259765625,
-0.6884765625,
0.38671875,
-0.3271484375,
-0.3232421875,
-0.0400390625,
-0.6162109375,
0.98193359375,
0.142333984375,
-0.62890625,
-0.41357421875,
-1.0419921875,
-0.181884765625,
0.1260986328125,
-0.76220703125,
0.439453125,
0.1375732421875,
0.06280517578125,
0.0214385986328125,
-0.56884765625,
-0.466796875,
-0.269287109375,
-0.394287109375,
0.08685302734375,
0.2015380859375,
0.1610107421875,
0.81640625,
0.0022735595703125,
-0.306640625,
-0.052093505859375,
0.0777587890625,
-0.230224609375,
-0.446044921875,
0.1533203125,
-0.3447265625,
-0.11590576171875,
-0.3173828125,
0.1295166015625,
0.06158447265625,
0.63525390625,
0.79345703125,
0.2509765625,
0.448974609375,
0.193115234375,
-0.43505859375,
1.25,
0.1068115234375,
-0.84228515625,
-0.307373046875,
0.26123046875,
-0.1734619140625,
0.406982421875,
0.49951171875,
-0.5986328125,
-0.86669921875,
-0.92041015625,
-0.006221771240234375,
-0.67529296875,
-0.412841796875,
-0.916015625,
-0.69140625,
-0.477783203125,
0.62353515625,
-0.1917724609375,
-0.427001953125,
0.48681640625,
-0.90478515625,
-0.09503173828125,
-1.0146484375,
-0.2132568359375,
-0.623046875,
-0.0193634033203125,
-0.31494140625,
0.73486328125,
-0.0182342529296875,
0.07196044921875,
-0.10205078125,
0.038299560546875,
0.045440673828125,
-0.2763671875,
-0.64501953125,
-0.55712890625,
-0.1380615234375,
0.2139892578125,
0.07666015625,
0.2919921875,
-0.51806640625,
0.52587890625,
-0.84326171875,
-0.03717041015625,
-0.2371826171875,
-0.375732421875,
-0.2032470703125,
-0.59814453125,
1.083984375,
-0.27294921875,
-0.1119384765625,
-0.347900390625,
0.234130859375,
0.94580078125,
-0.383544921875,
-0.370361328125,
-0.912109375,
-0.6279296875,
-1.0244140625,
0.57373046875,
-0.23583984375,
0.0145721435546875,
-0.5146484375,
-0.2471923828125,
1.10546875,
-0.448974609375,
0.6025390625,
1.27734375,
0.058135986328125,
0.476318359375,
-0.89697265625,
0.54736328125,
0.43505859375,
-0.59228515625,
0.2073974609375,
0.09228515625,
-0.60302734375,
0.228271484375,
-0.333251953125,
-1.044921875,
-0.76513671875,
-0.038482666015625,
1.173828125,
-0.252197265625,
0.681640625,
0.0765380859375,
-1.2001953125,
-0.4814453125,
0.91162109375,
0.31689453125,
-0.01488494873046875,
0.479248046875,
-0.30126953125,
-0.10833740234375,
0.01702880859375,
0.1273193359375,
-0.35888671875,
-0.265869140625,
1.228515625,
-0.427490234375,
-0.421875,
0.86376953125,
0.984375,
-0.8740234375,
-0.568359375,
0.007228851318359375,
0.1258544921875,
-0.365478515625,
-0.68359375,
0.38916015625,
0.36083984375,
-0.6787109375,
0.35302734375,
0.5029296875,
0.1707763671875,
0.25830078125,
0.385498046875,
0.2099609375,
-0.1671142578125,
0.1820068359375,
0.55712890625,
-0.72900390625,
-0.408447265625,
-0.900390625,
-0.150146484375,
-0.3037109375,
0.0997314453125,
0.57763671875,
-0.386474609375,
0.58935546875,
0.4638671875,
0.11798095703125,
0.90625,
-0.2005615234375,
-0.036407470703125,
0.2308349609375,
-0.5302734375,
-0.73095703125,
0.03814697265625,
0.5390625,
-0.18310546875,
0.708984375,
-0.37646484375,
0.0281219482421875,
0.31494140625,
-0.199951171875,
-0.2200927734375,
-0.94189453125,
-0.301513671875,
-0.84228515625,
-0.3544921875,
-0.438232421875,
-0.61279296875,
0.255126953125,
0.11151123046875,
0.1522216796875,
-0.4541015625,
-0.051300048828125,
0.47314453125,
-0.68798828125,
1.10546875,
-0.3857421875,
0.19873046875,
-0.487548828125,
-0.4169921875,
-0.56591796875,
0.2445068359375,
-0.6455078125,
-0.2012939453125,
-0.6162109375,
0.213134765625,
-0.1517333984375,
0.279541015625,
-0.309326171875,
0.34375,
-0.34912109375,
-0.53076171875,
-0.413818359375,
0.2398681640625,
-0.26708984375,
0.47509765625,
0.303955078125,
-0.267822265625,
0.455322265625,
-0.121337890625,
-0.1385498046875,
-0.12335205078125,
0.47607421875,
0.259521484375,
-0.353759765625,
-0.018463134765625,
-0.206298828125,
0.204345703125,
-0.86767578125,
0.432373046875,
-0.2783203125,
0.3466796875,
0.377685546875,
-0.207275390625,
0.64013671875,
1.2392578125,
-0.1259765625,
0.126708984375,
0.222900390625,
0.262451171875,
0.47412109375,
0.14599609375,
0.06903076171875,
0.39306640625,
-0.105224609375,
-0.5166015625,
0.002536773681640625,
0.305908203125,
0.185791015625,
-0.021728515625,
0.0997314453125,
-1.033203125,
-1.005859375,
0.038116455078125,
-0.2003173828125,
0.5986328125,
0.748046875,
-0.64306640625,
-0.297119140625,
-0.0228729248046875,
-0.333740234375,
0.1302490234375,
-1.138671875,
-1.0419921875,
0.352294921875,
-0.0196990966796875,
-0.343505859375,
-0.06036376953125,
-0.4306640625,
-0.1748046875,
0.08782958984375,
0.302001953125,
-0.41162109375,
0.60546875,
0.154052734375,
0.673828125,
-0.1907958984375,
-0.197509765625,
0.219970703125,
0.5078125,
-0.63525390625,
-0.611328125,
-0.079833984375,
1.1962890625,
-0.1783447265625,
-0.3212890625,
-0.5791015625,
0.09600830078125,
0.1578369140625,
-0.176513671875,
-0.26318359375,
0.28759765625,
-0.09613037109375,
0.410888671875,
-0.701171875,
-0.11639404296875,
-0.31689453125,
0.28857421875,
0.13916015625,
-0.299072265625,
-0.63427734375,
0.8740234375,
0.7177734375,
-0.039337158203125,
0.533203125,
0.002902984619140625,
0.395751953125,
0.00156402587890625,
-0.1033935546875,
-0.94140625,
0.390625,
0.830078125,
0.50390625,
0.1046142578125,
0.475341796875,
0.767578125,
-0.03656005859375,
-0.18798828125,
0.67041015625,
0.1640625,
-0.007720947265625,
0.08135986328125,
-0.13525390625,
0.0269012451171875,
0.12249755859375,
-0.64208984375,
0.177734375,
-0.453857421875,
-0.1661376953125,
-0.21630859375,
-0.63916015625,
0.6875,
-0.241943359375,
-0.273681640625,
0.0292816162109375,
-0.474853515625,
0.366943359375,
0.7001953125,
0.313720703125,
-0.08428955078125,
0.52197265625,
0.6416015625,
0.77294921875,
0.6376953125,
0.44775390625,
0.318603515625,
-0.5498046875,
0.237548828125,
-0.043853759765625,
-0.0341796875,
-0.55859375,
-0.2386474609375,
-0.85986328125,
0.748046875,
-0.145263671875,
-0.318115234375,
0.5703125,
-0.986328125,
0.2939453125,
-0.51318359375,
0.59033203125,
-0.541015625,
0.43896484375,
0.2298583984375,
-0.368408203125,
-0.59765625,
0.85986328125,
-0.2493896484375,
0.106201171875,
0.4228515625,
1.1572265625,
0.27978515625,
1.46875,
0.9912109375,
-0.15625,
0.01479339599609375,
0.45556640625,
-0.303955078125,
-0.2335205078125,
-0.435546875,
-0.283203125,
-0.03765869140625,
-0.82275390625,
-0.373046875,
-0.27685546875,
1.0458984375,
0.32177734375,
-0.91064453125,
-0.3515625,
0.4306640625,
-0.9150390625,
0.35302734375,
0.45556640625,
0.422607421875,
0.22119140625,
-0.171630859375,
-0.3056640625,
-0.6298828125,
0.11297607421875,
-0.428466796875,
0.34912109375,
-0.392333984375,
-0.35693359375,
-0.4365234375,
-0.66162109375,
-0.29150390625,
0.1890869140625,
-0.338134765625,
-0.84326171875,
0.474853515625,
0.53369140625,
0.476318359375,
0.43994140625,
-0.1610107421875,
-0.269287109375,
1.0869140625,
1.0625,
0.1937255859375,
0.92724609375,
0.437255859375,
-0.373779296875,
-0.1312255859375,
-0.17333984375,
0.5126953125,
-0.0131378173828125,
0.1795654296875,
-0.068603515625,
0.310302734375,
-0.7587890625,
-1.361328125,
-0.057159423828125,
0.09759521484375,
0.380126953125,
-0.6533203125,
-1.1259765625,
-0.393798828125,
-1.078125,
-0.1788330078125,
-0.56640625,
0.8095703125,
0.1573486328125,
0.0740966796875,
-0.02032470703125,
-1.0478515625,
4.4921875,
0.9248046875,
0.83984375,
0.61572265625,
0.466552734375,
1.216796875,
0.3349609375,
-0.7587890625,
-0.1546630859375,
-0.60498046875,
0.1466064453125,
-0.47900390625,
-0.0841064453125,
0.9111328125,
0.305419921875,
0.5224609375,
-0.8271484375,
0.1400146484375,
-0.0204925537109375,
-0.95263671875,
-1.0986328125,
0.3173828125,
0.4775390625,
0.43310546875,
-0.01342010498046875,
0.251220703125,
0.814453125,
-0.85546875,
-0.294189453125,
-0.64453125,
0.423583984375,
-0.53125,
0.99267578125,
0.097900390625,
-0.2861328125,
0.7333984375,
-0.250732421875,
-0.54638671875,
-0.183837890625,
0.2109375,
-0.267333984375,
0.073486328125,
0.64306640625,
-0.7333984375,
0.006412506103515625,
0.6279296875,
-0.449951171875,
0.349365234375,
0.4501953125,
-0.9775390625,
0.93994140625,
-0.312255859375,
0.55859375,
-0.258056640625,
-0.626953125,
-0.0819091796875,
0.24755859375,
0.1463623046875,
-0.188232421875,
0.344482421875,
0.39794921875,
0.5791015625,
-0.06280517578125,
0.48193359375,
-0.65234375,
0.57958984375,
-0.0972900390625,
0.259521484375,
-0.52490234375,
0.01085662841796875,
-0.3544921875,
-0.134033203125,
-0.3310546875,
-0.45751953125,
0.544921875,
0.326416015625,
-0.2459716796875,
0.64794921875,
0.728515625,
-0.5673828125,
0.293212890625,
-0.158203125,
-0.26953125,
-0.287841796875,
0.51123046875,
1.1240234375,
-0.6591796875,
-0.63671875,
-0.471435546875,
0.5595703125,
0.36962890625,
0.55517578125,
-0.01148223876953125,
-0.76806640625,
-0.358154296875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
VK just opened its second HQ in St. Petersburg! Side of its office building has a huge string s written on its side. This part of the office is supposed to be split into m meeting rooms in such way that meeting room walls are strictly between letters on the building. Obviously, meeting rooms should not be of size 0, but can be as small as one letter wide. Each meeting room will be named after the substring of s written on its side.
<image>
For each possible arrangement of m meeting rooms we ordered a test meeting room label for the meeting room with lexicographically minimal name. When delivered, those labels got sorted backward lexicographically.
What is printed on kth label of the delivery?
Input
In the first line, you are given three integer numbers n, m, k β length of string s, number of planned meeting rooms to split s into and number of the interesting label (2 β€ n β€ 1 000; 1 β€ m β€ 1 000; 1 β€ k β€ 10^{18}).
Second input line has string s, consisting of n lowercase english letters.
For given n, m, k there are at least k ways to split s into m substrings.
Output
Output single string β name of meeting room printed on k-th label of the delivery.
Examples
Input
4 2 1
abac
Output
aba
Input
19 5 1821
aupontrougevkoffice
Output
au
Note
In the first example, delivery consists of the labels "aba", "ab", "a".
In the second example, delivery consists of 3060 labels. The first label is "aupontrougevkof" and the last one is "a".
Submitted Solution:
```
fact = [ 1 ] * 1001
for i in range( 1, 1000 + 1, 1 ):
fact[ i ] = fact[ i - 1 ] * i
def choose( n, k ):
return fact[ n ] // ( fact[ k ] * fact[ n - k ] )
n, m, k = map(int,input().split())
s = input()
k = choose( n - 1, m - 1 ) - k + 1
if m == 1:
print( s );exit(0)
#print( k )
l = []
for i in range( n ):
l.append( [ s[ i ], i ] )
br = 0
l1 = []
while True:
s1 = 'z' * 1001
for i in range( len( l ) ):
if ( l[ i ][ 0 ] not in l1 ):
s1 = min( s1, l[ i ][ 0 ] )
pl = -1
for i in range( len( l ) ):
if s1 == l[ i ][ 0 ]:
if l[ i ][ 1 ] < n - 1:
l[ i ][ 1 ] += 1
l[ i ][ 0 ] += s[ l[ i ][ 1 ] ]
pl = i
break
l1.append( s1 )
d = pl - len( s1 ) + 1
a = choose( n - d - 1, m - 2 )
#print( s1, a )
br += a
if br >= k:
print( s1 )
break
```
No
| 36,209
|
[
0.33837890625,
-0.11517333984375,
-0.0264892578125,
0.1744384765625,
-0.6318359375,
-0.5849609375,
-0.07025146484375,
0.1593017578125,
0.0204925537109375,
0.51611328125,
0.69873046875,
-0.0673828125,
0.057586669921875,
-0.66650390625,
-0.212646484375,
0.1875,
-0.59375,
-0.396484375,
-0.372314453125,
-0.102294921875,
0.1102294921875,
0.2176513671875,
-1.3779296875,
-0.079833984375,
-0.39697265625,
0.970703125,
0.50537109375,
-0.12457275390625,
1.041015625,
0.87158203125,
-0.2117919921875,
-0.7236328125,
0.6337890625,
-1.1923828125,
-0.217529296875,
-0.29052734375,
0.8876953125,
-0.54296875,
-0.331787109375,
-0.69677734375,
0.22998046875,
-0.29931640625,
0.254638671875,
-0.90771484375,
-0.9609375,
0.203857421875,
-0.0908203125,
-0.27880859375,
0.0120086669921875,
-0.406982421875,
0.1678466796875,
-0.0037899017333984375,
0.454345703125,
-0.17431640625,
0.0657958984375,
-0.35595703125,
-0.260986328125,
-0.0097198486328125,
-0.638671875,
0.471923828125,
0.07000732421875,
0.25439453125,
0.191162109375,
-0.73046875,
0.201416015625,
0.387939453125,
-0.073486328125,
-0.59521484375,
-0.16552734375,
-0.91796875,
-0.364990234375,
0.082763671875,
-0.734375,
-0.49072265625,
-0.345703125,
-0.061248779296875,
0.28271484375,
0.144775390625,
-0.83642578125,
0.67041015625,
0.1932373046875,
0.8505859375,
0.35546875,
0.27734375,
-0.64013671875,
-0.72705078125,
0.10546875,
0.299560546875,
0.400146484375,
0.1990966796875,
0.03485107421875,
0.3173828125,
-0.5498046875,
-0.0292205810546875,
0.74658203125,
0.40087890625,
-0.27001953125,
0.6533203125,
0.255126953125,
0.3779296875,
0.63232421875,
0.88134765625,
-0.28125,
0.91796875,
-0.86572265625,
0.389892578125,
0.495849609375,
-0.2626953125,
-0.08721923828125,
-0.364501953125,
-0.1444091796875,
-0.52392578125,
0.385986328125,
0.424072265625,
0.2039794921875,
0.95458984375,
0.462158203125,
0.35546875,
-0.9140625,
0.369384765625,
0.6748046875,
-0.1744384765625,
0.52099609375,
-0.41357421875,
0.01263427734375,
-0.193115234375,
0.04864501953125,
1.123046875,
-0.578125,
-0.231201171875,
0.611328125,
-0.0170440673828125,
-0.4677734375,
0.264892578125,
0.2152099609375,
0.30908203125,
-0.083740234375,
0.50927734375,
0.64306640625,
-0.55615234375,
0.787109375,
-0.340087890625,
-0.0115203857421875,
1.6259765625,
-0.10723876953125,
0.105224609375,
0.5224609375,
0.4169921875,
-0.9462890625,
0.0692138671875,
-0.83740234375,
0.650390625,
-0.18359375,
0.04705810546875,
-0.27099609375,
0.2471923828125,
-0.21142578125,
0.64013671875,
-0.1361083984375,
0.1397705078125,
-0.1905517578125,
0.140380859375,
-0.50634765625,
0.6923828125,
-0.61962890625,
0.7158203125,
-0.91015625,
-0.1746826171875,
-0.3115234375,
-0.59326171875,
-0.08856201171875,
-0.1739501953125,
0.0677490234375,
0.87109375,
0.55859375,
1.115234375,
1.0205078125,
-0.032073974609375,
0.415771484375,
0.34814453125,
-0.346923828125,
0.0767822265625,
0.60693359375,
0.66748046875,
0.34326171875,
0.43212890625,
0.1717529296875,
-0.07708740234375,
-0.876953125,
-0.67431640625,
0.19140625,
1.046875,
-0.68896484375,
0.68701171875,
-0.0270538330078125,
0.07177734375,
-0.96337890625,
0.1956787109375,
0.060211181640625,
-0.80029296875,
-0.599609375,
0.6865234375,
0.0946044921875,
0.391357421875,
-0.2255859375,
-0.484375,
0.418701171875,
1.205078125,
-0.265380859375,
0.35107421875,
0.432373046875,
0.18408203125,
-0.5,
0.0582275390625,
0.513671875,
-0.1798095703125,
-0.80810546875,
0.78515625,
-0.1387939453125,
-0.38623046875,
-0.33544921875,
0.6025390625,
0.13037109375,
0.5771484375,
-0.56982421875,
-0.235595703125,
0.5029296875,
1.2529296875,
0.0931396484375,
0.35107421875,
0.2183837890625,
0.85693359375,
0.70751953125,
0.853515625,
0.87060546875,
0.310302734375,
0.60302734375,
0.68359375,
-0.06182861328125,
0.3369140625,
0.2318115234375,
0.70068359375,
0.147705078125,
0.59814453125,
0.1162109375,
0.56494140625,
-0.273193359375,
0.11688232421875,
-0.52490234375,
0.03173828125,
-0.2432861328125,
0.83203125,
-0.0086517333984375,
0.73046875,
-0.48486328125,
-0.300048828125,
0.27392578125,
0.60888671875,
-1.01953125,
-0.63232421875,
-0.0384521484375,
-0.353271484375,
-0.05731201171875,
0.11993408203125,
0.488525390625,
0.533203125,
0.44189453125,
0.2449951171875,
-0.416748046875,
-0.42041015625,
-0.8701171875,
-0.5576171875,
-1.005859375,
-0.47314453125,
-0.77685546875,
-0.1829833984375,
0.42822265625,
-1.0263671875,
0.362060546875,
-0.38720703125,
0.00702667236328125,
0.06939697265625,
-0.2415771484375,
0.413818359375,
-0.1922607421875,
0.45263671875,
-0.28076171875,
0.44140625,
0.0999755859375,
1.052734375,
-0.76513671875,
-0.040435791015625,
-0.370849609375,
-0.1986083984375,
0.469482421875,
-0.11334228515625,
0.14990234375,
0.2265625,
-0.7216796875,
-1.1162109375,
-0.72998046875,
0.177001953125,
-0.505859375,
0.275146484375,
-0.7890625,
1.12890625,
0.338623046875,
-0.475830078125,
0.411865234375,
0.9755859375,
-0.54150390625,
0.4619140625,
0.41064453125,
-0.386962890625,
-0.9052734375,
1.125,
0.474853515625,
0.482421875,
-0.6142578125,
-0.736328125,
-0.66162109375,
0.1641845703125,
0.32568359375,
-0.7626953125,
-0.397705078125,
0.61962890625,
0.143798828125,
-0.98046875,
0.446044921875,
-1.279296875,
-0.79296875,
-0.489990234375,
-0.59521484375,
0.904296875,
0.7666015625,
-0.06121826171875,
-0.51416015625,
-0.52099609375,
0.2066650390625,
0.496826171875,
0.47607421875,
-0.6591796875,
-0.01163482666015625,
0.5927734375,
-0.208740234375,
0.255615234375,
0.21826171875,
-0.2900390625,
-0.116943359375,
-0.1822509765625,
0.341552734375,
0.498779296875,
-0.0151214599609375,
0.27734375,
0.08026123046875,
0.63330078125,
-1.1298828125,
-0.382568359375,
-0.1318359375,
0.625,
0.239501953125,
-0.1556396484375,
0.206298828125,
0.04913330078125,
-0.81640625,
-1.0322265625,
0.04876708984375,
0.058380126953125,
0.74365234375,
-0.7314453125,
0.8310546875,
0.037109375,
-0.7607421875,
0.5830078125,
-0.59716796875,
-0.50732421875,
0.78564453125,
0.047332763671875,
0.90087890625,
-0.49462890625,
0.33251953125,
-0.1385498046875,
-0.210693359375,
0.456787109375,
0.2178955078125,
0.720703125,
-0.5546875,
-0.54296875,
-0.216796875,
0.0039825439453125,
0.1424560546875,
-0.35546875,
-0.0262908935546875,
-0.47705078125,
-0.377685546875,
-0.947265625,
0.40576171875,
0.8115234375,
0.5849609375,
0.28271484375,
0.50634765625,
0.1258544921875,
0.28662109375,
0.49169921875,
-0.21240234375,
0.29736328125,
-0.60302734375,
0.94091796875,
0.348388671875,
-0.052093505859375,
-0.41259765625,
-0.63232421875,
-0.2054443359375,
-0.06427001953125,
-0.50634765625,
0.0208282470703125,
-1.251953125,
0.044769287109375,
0.133544921875,
0.70068359375,
-0.392822265625,
-0.57080078125,
-0.1492919921875,
0.39013671875,
0.12042236328125,
-0.6240234375,
0.2158203125,
-0.63720703125,
0.435302734375,
0.55322265625,
-0.70361328125,
-0.5400390625,
-0.54296875,
-0.7314453125,
-0.84619140625,
-0.018829345703125,
0.55517578125,
-0.364501953125,
0.2646484375,
-1.2685546875,
0.6875,
0.6259765625,
-0.63037109375,
-0.140625,
-0.10369873046875,
0.3935546875,
0.019927978515625,
0.5546875,
-0.9345703125,
-0.67529296875,
0.01090240478515625,
-1.0087890625,
0.41015625,
-0.6474609375,
0.5224609375,
0.1676025390625,
0.08380126953125,
0.027923583984375,
0.7265625,
-0.2171630859375,
0.4833984375,
-0.303955078125,
0.259033203125,
-0.82763671875,
-0.76416015625,
0.76513671875,
-0.2017822265625,
-0.671875,
0.70458984375,
-0.047393798828125,
-0.732421875,
-0.066650390625,
0.400146484375,
-0.340087890625,
0.41064453125,
-0.71044921875,
0.3544921875,
-0.33056640625,
-0.274658203125,
-0.0229339599609375,
-0.57080078125,
0.98486328125,
0.142822265625,
-0.60498046875,
-0.44482421875,
-0.99267578125,
-0.1121826171875,
0.16455078125,
-0.74267578125,
0.391357421875,
0.1070556640625,
0.01282501220703125,
-0.085205078125,
-0.5244140625,
-0.5205078125,
-0.2459716796875,
-0.36279296875,
0.09051513671875,
0.11376953125,
0.1414794921875,
0.7724609375,
0.068603515625,
-0.342529296875,
-0.08221435546875,
0.06561279296875,
-0.263427734375,
-0.50830078125,
0.11138916015625,
-0.304443359375,
-0.09930419921875,
-0.30615234375,
0.16845703125,
-0.016357421875,
0.6923828125,
0.7998046875,
0.2403564453125,
0.480712890625,
0.1661376953125,
-0.5029296875,
1.271484375,
0.116943359375,
-0.78076171875,
-0.345703125,
0.28076171875,
-0.197265625,
0.385498046875,
0.498291015625,
-0.615234375,
-0.85693359375,
-0.994140625,
0.07354736328125,
-0.6572265625,
-0.36865234375,
-0.8974609375,
-0.6748046875,
-0.477294921875,
0.62939453125,
-0.14599609375,
-0.3349609375,
0.43798828125,
-0.8515625,
-0.10333251953125,
-1.021484375,
-0.171142578125,
-0.60595703125,
-0.06439208984375,
-0.3251953125,
0.6796875,
-0.0164947509765625,
0.1177978515625,
-0.0531005859375,
0.047149658203125,
0.07257080078125,
-0.357421875,
-0.61865234375,
-0.54248046875,
-0.1446533203125,
0.25439453125,
0.0107269287109375,
0.29150390625,
-0.5751953125,
0.53369140625,
-0.8544921875,
-0.060699462890625,
-0.137939453125,
-0.393798828125,
-0.17919921875,
-0.58154296875,
1.205078125,
-0.295654296875,
-0.068115234375,
-0.33544921875,
0.270751953125,
0.87646484375,
-0.455078125,
-0.447998046875,
-0.78857421875,
-0.53466796875,
-1.0712890625,
0.60546875,
-0.25634765625,
0.03643798828125,
-0.57958984375,
-0.257568359375,
1.0634765625,
-0.42333984375,
0.65625,
1.283203125,
0.044586181640625,
0.50439453125,
-0.82958984375,
0.462646484375,
0.43115234375,
-0.6005859375,
0.1854248046875,
0.0024852752685546875,
-0.5576171875,
0.2457275390625,
-0.35546875,
-1.013671875,
-0.7041015625,
-0.0821533203125,
1.16015625,
-0.189697265625,
0.673828125,
0.045318603515625,
-1.1884765625,
-0.44091796875,
0.9267578125,
0.26953125,
-0.0013685226440429688,
0.435791015625,
-0.30126953125,
-0.1522216796875,
-0.00469207763671875,
0.17041015625,
-0.421630859375,
-0.268798828125,
1.240234375,
-0.320556640625,
-0.440673828125,
0.9365234375,
1.0302734375,
-0.94580078125,
-0.5400390625,
-0.018310546875,
0.08380126953125,
-0.326416015625,
-0.67578125,
0.412353515625,
0.36181640625,
-0.7197265625,
0.299560546875,
0.406005859375,
0.142822265625,
0.29541015625,
0.357666015625,
0.1927490234375,
-0.16748046875,
0.214111328125,
0.5400390625,
-0.7294921875,
-0.36181640625,
-0.8466796875,
-0.1549072265625,
-0.29052734375,
0.0787353515625,
0.61865234375,
-0.416015625,
0.517578125,
0.47998046875,
0.1163330078125,
0.82666015625,
-0.164794921875,
-0.0216522216796875,
0.2220458984375,
-0.55224609375,
-0.716796875,
0.0171356201171875,
0.48486328125,
-0.2320556640625,
0.689453125,
-0.407470703125,
0.005786895751953125,
0.317138671875,
-0.2401123046875,
-0.169189453125,
-0.94921875,
-0.2890625,
-0.837890625,
-0.3701171875,
-0.440673828125,
-0.62841796875,
0.23486328125,
0.1788330078125,
0.2000732421875,
-0.470703125,
-0.01058197021484375,
0.578125,
-0.67724609375,
1.0927734375,
-0.3759765625,
0.1290283203125,
-0.449951171875,
-0.441162109375,
-0.61181640625,
0.3046875,
-0.69482421875,
-0.16845703125,
-0.6005859375,
0.323486328125,
-0.156982421875,
0.382568359375,
-0.2744140625,
0.4033203125,
-0.33642578125,
-0.51953125,
-0.396240234375,
0.212646484375,
-0.32080078125,
0.5048828125,
0.212646484375,
-0.274658203125,
0.435791015625,
-0.169921875,
-0.1279296875,
-0.0163421630859375,
0.548828125,
0.272705078125,
-0.279296875,
-0.032989501953125,
-0.15771484375,
0.156005859375,
-0.85205078125,
0.407470703125,
-0.233642578125,
0.33984375,
0.309814453125,
-0.246337890625,
0.6142578125,
1.1875,
-0.0838623046875,
0.1378173828125,
0.218017578125,
0.269287109375,
0.487060546875,
0.199951171875,
0.041900634765625,
0.431396484375,
-0.10455322265625,
-0.54638671875,
-0.0361328125,
0.306396484375,
0.2022705078125,
-0.01424407958984375,
0.1417236328125,
-1.0419921875,
-0.97314453125,
0.058013916015625,
-0.18798828125,
0.69140625,
0.71337890625,
-0.55615234375,
-0.325439453125,
0.01503753662109375,
-0.334228515625,
0.143310546875,
-1.150390625,
-1.017578125,
0.335205078125,
-0.0750732421875,
-0.42578125,
-0.0303802490234375,
-0.4345703125,
-0.181396484375,
0.1243896484375,
0.29248046875,
-0.408447265625,
0.5947265625,
0.165771484375,
0.65478515625,
-0.2301025390625,
-0.3125,
0.2003173828125,
0.50048828125,
-0.64111328125,
-0.61669921875,
-0.042449951171875,
1.2470703125,
-0.133544921875,
-0.351318359375,
-0.62353515625,
0.114990234375,
0.149169921875,
-0.2032470703125,
-0.2333984375,
0.228271484375,
-0.1268310546875,
0.32861328125,
-0.75048828125,
-0.10296630859375,
-0.2666015625,
0.179931640625,
0.11590576171875,
-0.31005859375,
-0.7294921875,
0.82861328125,
0.71533203125,
-0.07159423828125,
0.49755859375,
-0.034271240234375,
0.453369140625,
-0.0170745849609375,
-0.115478515625,
-0.9052734375,
0.4755859375,
0.7890625,
0.51171875,
0.093017578125,
0.5009765625,
0.73388671875,
-0.045074462890625,
-0.198486328125,
0.65771484375,
0.177734375,
-0.019439697265625,
0.05902099609375,
-0.1571044921875,
-0.0015306472778320312,
0.06488037109375,
-0.6884765625,
0.2413330078125,
-0.447998046875,
-0.233154296875,
-0.25341796875,
-0.6376953125,
0.703125,
-0.28125,
-0.25,
0.042205810546875,
-0.5322265625,
0.3681640625,
0.71435546875,
0.299560546875,
-0.061004638671875,
0.53857421875,
0.6484375,
0.759765625,
0.62841796875,
0.44482421875,
0.3330078125,
-0.5712890625,
0.2666015625,
-0.052947998046875,
-0.0256195068359375,
-0.50634765625,
-0.3095703125,
-0.75732421875,
0.6923828125,
-0.1708984375,
-0.25537109375,
0.62158203125,
-1.021484375,
0.2578125,
-0.5458984375,
0.625,
-0.5625,
0.41259765625,
0.1888427734375,
-0.38525390625,
-0.583984375,
0.78125,
-0.18603515625,
0.185302734375,
0.387451171875,
1.0869140625,
0.286865234375,
1.47265625,
1.0146484375,
-0.1646728515625,
-0.0045928955078125,
0.41015625,
-0.2176513671875,
-0.2236328125,
-0.43212890625,
-0.392822265625,
-0.02728271484375,
-0.78173828125,
-0.352294921875,
-0.2509765625,
1.017578125,
0.346923828125,
-0.93212890625,
-0.37744140625,
0.369140625,
-0.9150390625,
0.386474609375,
0.398193359375,
0.41650390625,
0.18115234375,
-0.218994140625,
-0.279296875,
-0.6083984375,
0.234375,
-0.356689453125,
0.340576171875,
-0.380126953125,
-0.317138671875,
-0.48193359375,
-0.59130859375,
-0.2269287109375,
0.2083740234375,
-0.4013671875,
-0.86083984375,
0.407958984375,
0.5615234375,
0.5517578125,
0.453369140625,
-0.141845703125,
-0.2310791015625,
1.0908203125,
1.04296875,
0.1954345703125,
0.88818359375,
0.45361328125,
-0.365966796875,
-0.0927734375,
-0.1158447265625,
0.484130859375,
-0.0308685302734375,
0.1368408203125,
-0.09234619140625,
0.31103515625,
-0.7470703125,
-1.3876953125,
-0.080078125,
0.08856201171875,
0.30615234375,
-0.59423828125,
-1.0341796875,
-0.5068359375,
-1.0439453125,
-0.14013671875,
-0.59912109375,
0.7529296875,
0.11370849609375,
0.0997314453125,
0.08099365234375,
-1.0849609375,
4.4609375,
0.8466796875,
0.79296875,
0.64990234375,
0.41943359375,
1.3251953125,
0.417236328125,
-0.740234375,
-0.082763671875,
-0.63330078125,
0.11419677734375,
-0.4833984375,
-0.1083984375,
0.93505859375,
0.3271484375,
0.451904296875,
-0.8837890625,
0.08721923828125,
-0.03314208984375,
-0.94384765625,
-1.15234375,
0.3876953125,
0.440185546875,
0.453369140625,
-0.00550079345703125,
0.28515625,
0.82861328125,
-0.76416015625,
-0.25634765625,
-0.69384765625,
0.417724609375,
-0.493408203125,
0.986328125,
0.05145263671875,
-0.21484375,
0.814453125,
-0.1259765625,
-0.52685546875,
-0.12445068359375,
0.2059326171875,
-0.2498779296875,
0.05169677734375,
0.6416015625,
-0.74462890625,
-0.0267181396484375,
0.61279296875,
-0.53515625,
0.36865234375,
0.40478515625,
-0.95166015625,
1.015625,
-0.278076171875,
0.59375,
-0.33447265625,
-0.61279296875,
-0.080810546875,
0.2457275390625,
0.103759765625,
-0.203369140625,
0.279541015625,
0.43212890625,
0.5146484375,
-0.07281494140625,
0.52734375,
-0.64013671875,
0.51025390625,
-0.05181884765625,
0.265869140625,
-0.51123046875,
-0.0117950439453125,
-0.357666015625,
-0.062042236328125,
-0.392822265625,
-0.427734375,
0.5068359375,
0.232421875,
-0.3046875,
0.67578125,
0.83251953125,
-0.5185546875,
0.282470703125,
-0.1099853515625,
-0.2044677734375,
-0.268310546875,
0.55224609375,
1.103515625,
-0.65869140625,
-0.626953125,
-0.420654296875,
0.4755859375,
0.3955078125,
0.5791015625,
-0.061981201171875,
-0.759765625,
-0.310546875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
VK just opened its second HQ in St. Petersburg! Side of its office building has a huge string s written on its side. This part of the office is supposed to be split into m meeting rooms in such way that meeting room walls are strictly between letters on the building. Obviously, meeting rooms should not be of size 0, but can be as small as one letter wide. Each meeting room will be named after the substring of s written on its side.
<image>
For each possible arrangement of m meeting rooms we ordered a test meeting room label for the meeting room with lexicographically minimal name. When delivered, those labels got sorted backward lexicographically.
What is printed on kth label of the delivery?
Input
In the first line, you are given three integer numbers n, m, k β length of string s, number of planned meeting rooms to split s into and number of the interesting label (2 β€ n β€ 1 000; 1 β€ m β€ 1 000; 1 β€ k β€ 10^{18}).
Second input line has string s, consisting of n lowercase english letters.
For given n, m, k there are at least k ways to split s into m substrings.
Output
Output single string β name of meeting room printed on k-th label of the delivery.
Examples
Input
4 2 1
abac
Output
aba
Input
19 5 1821
aupontrougevkoffice
Output
au
Note
In the first example, delivery consists of the labels "aba", "ab", "a".
In the second example, delivery consists of 3060 labels. The first label is "aupontrougevkof" and the last one is "a".
Submitted Solution:
```
n, m, k = map(int, input().strip().split())
s = input()
t = n-1
tS = p = s[-1]
for i in range(n-2, -1, -1):
p = s[i]+p
if min(p[:len(tS)], tS) == p[:len(tS)]:
tS = p
t = i
fact = [0] * 1005
fact[0] = fact[1] = 1
for i in range(2, 1005):
fact[i] = i * fact[i-1]
while tS:
N = n - len(tS) - 1
R = m-2
if N >= R:
k -= fact[N] // (fact[R] * fact[N-R])
if k <= 0:
print(tS)
break
tS = tS[:-1]
```
No
| 36,210
|
[
0.32373046875,
-0.14453125,
-0.036285400390625,
0.2015380859375,
-0.626953125,
-0.62939453125,
-0.04876708984375,
0.1820068359375,
-0.0054168701171875,
0.49755859375,
0.64892578125,
-0.030181884765625,
0.01378631591796875,
-0.67236328125,
-0.218994140625,
0.22509765625,
-0.58642578125,
-0.408935546875,
-0.3662109375,
-0.069580078125,
0.1094970703125,
0.222900390625,
-1.359375,
-0.050262451171875,
-0.366943359375,
0.94091796875,
0.47802734375,
-0.084228515625,
1.0205078125,
0.90576171875,
-0.2666015625,
-0.69775390625,
0.60302734375,
-1.1845703125,
-0.1995849609375,
-0.296630859375,
0.83251953125,
-0.5078125,
-0.333251953125,
-0.70068359375,
0.23095703125,
-0.27001953125,
0.2454833984375,
-0.89404296875,
-0.91845703125,
0.202392578125,
-0.05865478515625,
-0.2568359375,
-0.0112762451171875,
-0.416015625,
0.1790771484375,
-0.04241943359375,
0.44384765625,
-0.1815185546875,
0.11602783203125,
-0.3056640625,
-0.311767578125,
-0.055511474609375,
-0.646484375,
0.440185546875,
0.031982421875,
0.241943359375,
0.1495361328125,
-0.7314453125,
0.1873779296875,
0.370361328125,
-0.0899658203125,
-0.6123046875,
-0.1552734375,
-0.95263671875,
-0.368896484375,
0.06927490234375,
-0.78173828125,
-0.450927734375,
-0.314453125,
-0.084716796875,
0.2724609375,
0.1688232421875,
-0.83740234375,
0.65283203125,
0.215087890625,
0.81298828125,
0.29833984375,
0.279541015625,
-0.6455078125,
-0.75830078125,
0.07769775390625,
0.290771484375,
0.407958984375,
0.170654296875,
0.04144287109375,
0.33203125,
-0.5625,
-0.055572509765625,
0.7734375,
0.420166015625,
-0.2237548828125,
0.6689453125,
0.21630859375,
0.3779296875,
0.6240234375,
0.8720703125,
-0.26318359375,
0.947265625,
-0.88330078125,
0.38671875,
0.52587890625,
-0.2464599609375,
-0.118408203125,
-0.3505859375,
-0.1812744140625,
-0.5498046875,
0.37744140625,
0.38623046875,
0.1978759765625,
0.93994140625,
0.433837890625,
0.330078125,
-0.9267578125,
0.385498046875,
0.6875,
-0.1943359375,
0.481689453125,
-0.434326171875,
0.0372314453125,
-0.229248046875,
0.006866455078125,
1.1396484375,
-0.58203125,
-0.1572265625,
0.6025390625,
-0.0262603759765625,
-0.470947265625,
0.2275390625,
0.189208984375,
0.293701171875,
-0.09283447265625,
0.48388671875,
0.6435546875,
-0.5654296875,
0.76953125,
-0.331787109375,
-0.0296173095703125,
1.6005859375,
-0.133544921875,
0.078369140625,
0.55517578125,
0.372314453125,
-0.99560546875,
0.052093505859375,
-0.75927734375,
0.6708984375,
-0.176513671875,
0.06829833984375,
-0.25732421875,
0.2685546875,
-0.1976318359375,
0.60400390625,
-0.133544921875,
0.1392822265625,
-0.1973876953125,
0.1490478515625,
-0.480712890625,
0.69091796875,
-0.5966796875,
0.7685546875,
-0.86279296875,
-0.182373046875,
-0.29345703125,
-0.60986328125,
-0.1185302734375,
-0.1849365234375,
0.0193939208984375,
0.9345703125,
0.57275390625,
1.103515625,
1.001953125,
-0.0259552001953125,
0.43701171875,
0.310791015625,
-0.2841796875,
0.09869384765625,
0.6103515625,
0.68408203125,
0.3046875,
0.45166015625,
0.180908203125,
-0.06341552734375,
-0.85546875,
-0.720703125,
0.158935546875,
1.0400390625,
-0.6962890625,
0.681640625,
-0.047149658203125,
0.041015625,
-0.92919921875,
0.2115478515625,
0.06683349609375,
-0.79931640625,
-0.6181640625,
0.71044921875,
0.0272064208984375,
0.428466796875,
-0.248046875,
-0.49609375,
0.424560546875,
1.228515625,
-0.247314453125,
0.349853515625,
0.398681640625,
0.1492919921875,
-0.5126953125,
0.09991455078125,
0.515625,
-0.1885986328125,
-0.771484375,
0.77587890625,
-0.202392578125,
-0.372314453125,
-0.339111328125,
0.640625,
0.132568359375,
0.5302734375,
-0.57421875,
-0.201904296875,
0.471435546875,
1.2783203125,
0.11309814453125,
0.346435546875,
0.155029296875,
0.87939453125,
0.73095703125,
0.84423828125,
0.85546875,
0.33984375,
0.61767578125,
0.65966796875,
-0.058685302734375,
0.333251953125,
0.24853515625,
0.67236328125,
0.1102294921875,
0.57861328125,
0.09552001953125,
0.59814453125,
-0.273681640625,
0.127197265625,
-0.51611328125,
0.11212158203125,
-0.250244140625,
0.84130859375,
0.0380859375,
0.71875,
-0.448486328125,
-0.287109375,
0.297119140625,
0.59814453125,
-0.97607421875,
-0.62646484375,
0.006481170654296875,
-0.360595703125,
-0.025726318359375,
0.0628662109375,
0.51904296875,
0.54638671875,
0.456787109375,
0.233154296875,
-0.452392578125,
-0.39111328125,
-0.90185546875,
-0.56884765625,
-0.96728515625,
-0.441162109375,
-0.76708984375,
-0.220458984375,
0.44482421875,
-0.99560546875,
0.35107421875,
-0.3583984375,
0.04827880859375,
0.0806884765625,
-0.220458984375,
0.42529296875,
-0.1815185546875,
0.495849609375,
-0.310791015625,
0.4677734375,
0.08917236328125,
1.0390625,
-0.798828125,
-0.0157470703125,
-0.322509765625,
-0.1597900390625,
0.4716796875,
-0.09405517578125,
0.115966796875,
0.19189453125,
-0.744140625,
-1.09765625,
-0.72998046875,
0.13525390625,
-0.468505859375,
0.257080078125,
-0.75390625,
1.103515625,
0.3134765625,
-0.4462890625,
0.424560546875,
0.927734375,
-0.541015625,
0.465087890625,
0.42724609375,
-0.376953125,
-0.9189453125,
1.14453125,
0.48046875,
0.4384765625,
-0.59033203125,
-0.65673828125,
-0.6318359375,
0.1962890625,
0.329345703125,
-0.78857421875,
-0.37353515625,
0.59375,
0.1378173828125,
-0.93115234375,
0.44580078125,
-1.287109375,
-0.783203125,
-0.447998046875,
-0.54443359375,
0.89990234375,
0.759765625,
-0.039215087890625,
-0.485595703125,
-0.498046875,
0.181884765625,
0.472900390625,
0.440673828125,
-0.62646484375,
-0.04840087890625,
0.62158203125,
-0.2288818359375,
0.267822265625,
0.228515625,
-0.30908203125,
-0.1080322265625,
-0.20068359375,
0.36181640625,
0.4794921875,
0.006389617919921875,
0.29150390625,
0.07916259765625,
0.67138671875,
-1.0869140625,
-0.41943359375,
-0.1324462890625,
0.66064453125,
0.231689453125,
-0.148193359375,
0.206787109375,
-0.02392578125,
-0.78125,
-1.029296875,
0.07672119140625,
0.06719970703125,
0.765625,
-0.7099609375,
0.77880859375,
0.044525146484375,
-0.744140625,
0.60595703125,
-0.6123046875,
-0.5419921875,
0.7861328125,
0.042083740234375,
0.8564453125,
-0.472900390625,
0.32958984375,
-0.1676025390625,
-0.2408447265625,
0.436279296875,
0.227294921875,
0.69921875,
-0.5810546875,
-0.57373046875,
-0.171630859375,
0.0400390625,
0.1494140625,
-0.28369140625,
0.024688720703125,
-0.46044921875,
-0.41748046875,
-0.93603515625,
0.376708984375,
0.81298828125,
0.5322265625,
0.2412109375,
0.50048828125,
0.1517333984375,
0.325439453125,
0.46435546875,
-0.2183837890625,
0.283203125,
-0.59716796875,
0.9541015625,
0.32763671875,
-0.058502197265625,
-0.406005859375,
-0.63818359375,
-0.1771240234375,
-0.068115234375,
-0.459716796875,
-0.0090179443359375,
-1.1884765625,
0.056060791015625,
0.1387939453125,
0.7255859375,
-0.358642578125,
-0.568359375,
-0.170654296875,
0.349365234375,
0.1888427734375,
-0.61865234375,
0.2130126953125,
-0.55029296875,
0.412353515625,
0.525390625,
-0.7197265625,
-0.49951171875,
-0.479736328125,
-0.69482421875,
-0.841796875,
0.030242919921875,
0.57421875,
-0.356201171875,
0.25439453125,
-1.2841796875,
0.689453125,
0.57421875,
-0.662109375,
-0.11602783203125,
-0.1064453125,
0.364013671875,
0.04888916015625,
0.5595703125,
-0.85986328125,
-0.6904296875,
0.039337158203125,
-1.009765625,
0.411865234375,
-0.62744140625,
0.52880859375,
0.161376953125,
0.10858154296875,
0.051177978515625,
0.68896484375,
-0.1937255859375,
0.4619140625,
-0.326416015625,
0.2386474609375,
-0.81591796875,
-0.75732421875,
0.74462890625,
-0.196044921875,
-0.703125,
0.677734375,
-0.043701171875,
-0.73486328125,
-0.06268310546875,
0.4228515625,
-0.30224609375,
0.393798828125,
-0.70751953125,
0.381103515625,
-0.345458984375,
-0.2293701171875,
-0.032867431640625,
-0.5703125,
0.9775390625,
0.09088134765625,
-0.6044921875,
-0.4326171875,
-1.01171875,
-0.1485595703125,
0.16748046875,
-0.72119140625,
0.400634765625,
0.128173828125,
0.036407470703125,
-0.06719970703125,
-0.5322265625,
-0.499267578125,
-0.267578125,
-0.44775390625,
0.08343505859375,
0.159423828125,
0.155517578125,
0.818359375,
0.0267486572265625,
-0.30810546875,
-0.071044921875,
0.065185546875,
-0.2315673828125,
-0.50634765625,
0.1455078125,
-0.32861328125,
-0.09326171875,
-0.29296875,
0.138916015625,
0.0229644775390625,
0.64697265625,
0.8408203125,
0.28955078125,
0.495361328125,
0.1949462890625,
-0.481201171875,
1.234375,
0.1292724609375,
-0.8056640625,
-0.334716796875,
0.2529296875,
-0.142578125,
0.4169921875,
0.54443359375,
-0.6533203125,
-0.822265625,
-0.978515625,
0.03997802734375,
-0.63037109375,
-0.3701171875,
-0.88330078125,
-0.68798828125,
-0.465087890625,
0.63232421875,
-0.130859375,
-0.345458984375,
0.394287109375,
-0.85498046875,
-0.1209716796875,
-1.033203125,
-0.20166015625,
-0.55078125,
-0.031524658203125,
-0.376220703125,
0.71240234375,
-0.043487548828125,
0.11334228515625,
-0.058502197265625,
0.057861328125,
0.043701171875,
-0.31689453125,
-0.63720703125,
-0.58056640625,
-0.135009765625,
0.265869140625,
0.058868408203125,
0.2578125,
-0.5673828125,
0.54638671875,
-0.833984375,
-0.06402587890625,
-0.193115234375,
-0.36865234375,
-0.200439453125,
-0.60595703125,
1.1474609375,
-0.31689453125,
-0.11431884765625,
-0.33251953125,
0.2073974609375,
0.8798828125,
-0.482421875,
-0.439208984375,
-0.8271484375,
-0.5498046875,
-1.0419921875,
0.58251953125,
-0.277099609375,
0.01006317138671875,
-0.5224609375,
-0.2489013671875,
1.0654296875,
-0.46044921875,
0.6376953125,
1.2939453125,
0.0203399658203125,
0.4970703125,
-0.83740234375,
0.488525390625,
0.434814453125,
-0.5869140625,
0.189208984375,
0.0116119384765625,
-0.587890625,
0.26416015625,
-0.324951171875,
-1.0361328125,
-0.71533203125,
-0.081298828125,
1.1240234375,
-0.2398681640625,
0.67138671875,
0.07891845703125,
-1.166015625,
-0.4736328125,
0.9228515625,
0.305419921875,
-0.00788116455078125,
0.412353515625,
-0.318603515625,
-0.14794921875,
-0.07232666015625,
0.1231689453125,
-0.413330078125,
-0.28662109375,
1.21875,
-0.37060546875,
-0.4453125,
0.90234375,
1.029296875,
-0.88037109375,
-0.56494140625,
-0.04022216796875,
0.10076904296875,
-0.32958984375,
-0.67333984375,
0.3828125,
0.366943359375,
-0.70361328125,
0.314697265625,
0.468017578125,
0.2047119140625,
0.29052734375,
0.380859375,
0.237548828125,
-0.147216796875,
0.2464599609375,
0.548828125,
-0.72314453125,
-0.37841796875,
-0.88037109375,
-0.1248779296875,
-0.29296875,
0.0667724609375,
0.67236328125,
-0.41748046875,
0.56103515625,
0.462646484375,
0.1146240234375,
0.86865234375,
-0.208984375,
-0.023162841796875,
0.223876953125,
-0.5537109375,
-0.7275390625,
0.025146484375,
0.4833984375,
-0.241455078125,
0.6943359375,
-0.40625,
0.07025146484375,
0.34765625,
-0.2191162109375,
-0.1856689453125,
-0.9208984375,
-0.2646484375,
-0.8681640625,
-0.354736328125,
-0.46484375,
-0.59912109375,
0.22705078125,
0.1551513671875,
0.17041015625,
-0.5,
-0.0064849853515625,
0.54736328125,
-0.6826171875,
1.11328125,
-0.3779296875,
0.1756591796875,
-0.431640625,
-0.447998046875,
-0.58203125,
0.275634765625,
-0.6708984375,
-0.181640625,
-0.595703125,
0.29052734375,
-0.1287841796875,
0.366455078125,
-0.263916015625,
0.362548828125,
-0.330078125,
-0.51953125,
-0.39794921875,
0.232177734375,
-0.334716796875,
0.4990234375,
0.253662109375,
-0.268310546875,
0.470703125,
-0.1436767578125,
-0.163330078125,
-0.062744140625,
0.5185546875,
0.284423828125,
-0.278564453125,
-0.0577392578125,
-0.1622314453125,
0.17529296875,
-0.859375,
0.44140625,
-0.247314453125,
0.3291015625,
0.370361328125,
-0.256103515625,
0.62353515625,
1.2021484375,
-0.078125,
0.155517578125,
0.21630859375,
0.297607421875,
0.479248046875,
0.20263671875,
0.0207977294921875,
0.421630859375,
-0.08184814453125,
-0.5205078125,
0.0032825469970703125,
0.291259765625,
0.18798828125,
-0.01849365234375,
0.12005615234375,
-1.0849609375,
-0.9951171875,
0.07049560546875,
-0.1668701171875,
0.62841796875,
0.6806640625,
-0.60595703125,
-0.3369140625,
-0.0239715576171875,
-0.295654296875,
0.1484375,
-1.1142578125,
-0.98828125,
0.347900390625,
-0.0061492919921875,
-0.394287109375,
-0.004352569580078125,
-0.43505859375,
-0.173095703125,
0.05889892578125,
0.306396484375,
-0.44287109375,
0.59521484375,
0.1512451171875,
0.64111328125,
-0.2449951171875,
-0.250244140625,
0.1622314453125,
0.515625,
-0.65380859375,
-0.62060546875,
-0.0304412841796875,
1.279296875,
-0.1917724609375,
-0.314697265625,
-0.6376953125,
0.06842041015625,
0.181396484375,
-0.21435546875,
-0.22509765625,
0.2467041015625,
-0.126953125,
0.34423828125,
-0.78125,
-0.10009765625,
-0.30322265625,
0.1820068359375,
0.1480712890625,
-0.302001953125,
-0.703125,
0.85693359375,
0.72021484375,
-0.052825927734375,
0.51123046875,
-0.0295562744140625,
0.4296875,
0.023834228515625,
-0.1080322265625,
-0.92724609375,
0.439208984375,
0.78076171875,
0.4931640625,
0.08074951171875,
0.51904296875,
0.732421875,
-0.05889892578125,
-0.213623046875,
0.67822265625,
0.1751708984375,
0.0123138427734375,
0.06365966796875,
-0.16552734375,
0.050262451171875,
0.07110595703125,
-0.63232421875,
0.24267578125,
-0.479248046875,
-0.2293701171875,
-0.2418212890625,
-0.650390625,
0.6875,
-0.238037109375,
-0.291015625,
0.067626953125,
-0.52978515625,
0.388916015625,
0.69921875,
0.260986328125,
-0.059967041015625,
0.53271484375,
0.63525390625,
0.7841796875,
0.587890625,
0.430419921875,
0.320068359375,
-0.60498046875,
0.259765625,
-0.044830322265625,
-0.0305023193359375,
-0.50537109375,
-0.27294921875,
-0.7900390625,
0.7158203125,
-0.1495361328125,
-0.26171875,
0.6435546875,
-1.0068359375,
0.283203125,
-0.5576171875,
0.57763671875,
-0.5146484375,
0.435791015625,
0.18896484375,
-0.40087890625,
-0.576171875,
0.7900390625,
-0.2139892578125,
0.12158203125,
0.401123046875,
1.0888671875,
0.288818359375,
1.4853515625,
0.98876953125,
-0.180908203125,
0.0022563934326171875,
0.408447265625,
-0.23681640625,
-0.243408203125,
-0.39794921875,
-0.34619140625,
-0.03375244140625,
-0.80224609375,
-0.34814453125,
-0.255859375,
1.033203125,
0.38232421875,
-0.92724609375,
-0.333251953125,
0.3720703125,
-0.92333984375,
0.337646484375,
0.436767578125,
0.398193359375,
0.2003173828125,
-0.203369140625,
-0.299560546875,
-0.64111328125,
0.1744384765625,
-0.42236328125,
0.3330078125,
-0.3662109375,
-0.357177734375,
-0.46533203125,
-0.625,
-0.274169921875,
0.1719970703125,
-0.3896484375,
-0.85498046875,
0.3955078125,
0.52734375,
0.5322265625,
0.423583984375,
-0.12158203125,
-0.2342529296875,
1.099609375,
1.0517578125,
0.1949462890625,
0.939453125,
0.447265625,
-0.3203125,
-0.102783203125,
-0.1744384765625,
0.4462890625,
-0.007106781005859375,
0.178466796875,
-0.09564208984375,
0.317626953125,
-0.759765625,
-1.375,
-0.07781982421875,
0.10430908203125,
0.323974609375,
-0.63671875,
-1.0693359375,
-0.47216796875,
-1.0537109375,
-0.1776123046875,
-0.5751953125,
0.78662109375,
0.1170654296875,
0.125244140625,
-0.00402069091796875,
-1.0576171875,
4.48046875,
0.85791015625,
0.8388671875,
0.6337890625,
0.423095703125,
1.2646484375,
0.4150390625,
-0.763671875,
-0.1268310546875,
-0.62890625,
0.1448974609375,
-0.482177734375,
-0.1016845703125,
0.921875,
0.33935546875,
0.47900390625,
-0.8583984375,
0.08837890625,
-0.045135498046875,
-0.92529296875,
-1.1298828125,
0.348388671875,
0.483154296875,
0.46875,
0.0086822509765625,
0.268310546875,
0.86181640625,
-0.81494140625,
-0.26513671875,
-0.6728515625,
0.417724609375,
-0.477294921875,
0.95263671875,
0.07110595703125,
-0.257080078125,
0.78564453125,
-0.1884765625,
-0.57568359375,
-0.1810302734375,
0.197265625,
-0.239990234375,
0.0535888671875,
0.701171875,
-0.75146484375,
-0.0061187744140625,
0.63134765625,
-0.493408203125,
0.365478515625,
0.416748046875,
-0.94775390625,
0.99951171875,
-0.275146484375,
0.591796875,
-0.3203125,
-0.6337890625,
-0.09234619140625,
0.26806640625,
0.111328125,
-0.183837890625,
0.257080078125,
0.39794921875,
0.5224609375,
-0.0736083984375,
0.53125,
-0.646484375,
0.52490234375,
-0.08349609375,
0.258056640625,
-0.52587890625,
-0.0178375244140625,
-0.356201171875,
-0.07611083984375,
-0.364990234375,
-0.477294921875,
0.468994140625,
0.262451171875,
-0.281494140625,
0.6923828125,
0.8271484375,
-0.5390625,
0.2486572265625,
-0.0941162109375,
-0.272216796875,
-0.2412109375,
0.54443359375,
1.125,
-0.64892578125,
-0.65576171875,
-0.46630859375,
0.477783203125,
0.39990234375,
0.544921875,
-0.08203125,
-0.7470703125,
-0.3583984375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.
Let's assume that a song consists of some number of words. To make the dubstep remix of this song, Vasya inserts a certain number of words "WUB" before the first word of the song (the number may be zero), after the last word (the number may be zero), and between words (at least one between any pair of neighbouring words), and then the boy glues together all the words, including "WUB", in one string and plays the song at the club.
For example, a song with words "I AM X" can transform into a dubstep remix as "WUBWUBIWUBAMWUBWUBX" and cannot transform into "WUBWUBIAMWUBX".
Recently, Petya has heard Vasya's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Vasya remixed. Help Petya restore the original song.
Input
The input consists of a single non-empty string, consisting only of uppercase English letters, the string's length doesn't exceed 200 characters. It is guaranteed that before Vasya remixed the song, no word contained substring "WUB" in it; Vasya didn't change the word order. It is also guaranteed that initially the song had at least one word.
Output
Print the words of the initial song that Vasya used to make a dubsteb remix. Separate the words with a space.
Examples
Input
WUBWUBABCWUB
Output
ABC
Input
WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB
Output
WE ARE THE CHAMPIONS MY FRIEND
Note
In the first sample: "WUBWUBABCWUB" = "WUB" + "WUB" + "ABC" + "WUB". That means that the song originally consisted of a single word "ABC", and all words "WUB" were added by Vasya.
In the second sample Vasya added a single word "WUB" between all neighbouring words, in the beginning and in the end, except for words "ARE" and "THE" β between them Vasya added two "WUB".
Tags: strings
Correct Solution:
```
a = input().split('WUB')
s = ''
for i in a:
if i != '':
s = s + i + ' '
print(s[:-1])
```
| 36,362
|
[
-0.05328369140625,
0.392333984375,
0.1739501953125,
0.1668701171875,
-0.399658203125,
-0.57080078125,
-0.55419921875,
0.0170440673828125,
-0.16796875,
0.7421875,
0.7333984375,
-0.12030029296875,
0.31396484375,
-1.0087890625,
-0.41162109375,
0.3095703125,
-0.68701171875,
-0.6337890625,
-0.88623046875,
-0.257568359375,
0.1256103515625,
-0.32568359375,
-1.3173828125,
-0.256103515625,
-0.5751953125,
0.892578125,
0.1962890625,
-0.0211639404296875,
0.75146484375,
0.96435546875,
0.25634765625,
-0.2188720703125,
0.373779296875,
-0.76708984375,
-0.1641845703125,
-0.318359375,
0.59716796875,
-0.7236328125,
-0.1507568359375,
-0.7001953125,
0.08184814453125,
-0.3388671875,
0.481201171875,
-0.70947265625,
-1.02734375,
0.09613037109375,
0.034942626953125,
-0.357666015625,
0.0264129638671875,
-0.50634765625,
0.06671142578125,
-0.220947265625,
0.63134765625,
0.14306640625,
0.3515625,
-0.316650390625,
-0.19287109375,
-0.1005859375,
-0.74658203125,
-0.09710693359375,
0.31298828125,
0.30126953125,
0.0233306884765625,
-0.71826171875,
-0.33251953125,
0.339599609375,
-0.12493896484375,
-0.5615234375,
0.1690673828125,
-0.6572265625,
-0.505859375,
0.061431884765625,
-0.56201171875,
-0.408203125,
-0.223876953125,
0.1866455078125,
0.017822265625,
-0.0279541015625,
-0.06689453125,
0.81591796875,
0.12249755859375,
1.068359375,
0.380615234375,
0.339111328125,
-0.63037109375,
-0.80810546875,
-0.10107421875,
0.19189453125,
0.400634765625,
0.10894775390625,
-0.26416015625,
0.5380859375,
-0.42724609375,
-0.05712890625,
0.5283203125,
0.73779296875,
-0.2222900390625,
0.208251953125,
-0.024017333984375,
0.145263671875,
0.60888671875,
0.98876953125,
-0.07147216796875,
0.6494140625,
-0.39404296875,
0.309326171875,
0.1478271484375,
0.404541015625,
-0.279052734375,
-0.468505859375,
-0.2349853515625,
-0.19970703125,
0.341796875,
0.292236328125,
-0.33935546875,
0.83984375,
-0.174560546875,
0.29345703125,
-1.14453125,
-0.09136962890625,
0.391845703125,
0.26708984375,
0.52978515625,
-0.047149658203125,
0.10302734375,
-0.71484375,
-0.7939453125,
1.08203125,
-0.6875,
-0.2147216796875,
0.57763671875,
0.0031528472900390625,
-0.260986328125,
0.3984375,
0.09527587890625,
0.48046875,
-0.135986328125,
0.67041015625,
0.794921875,
-0.481689453125,
0.77392578125,
-0.06036376953125,
-0.084228515625,
1.2978515625,
-0.0869140625,
-0.0325927734375,
0.8330078125,
0.497314453125,
-0.759765625,
0.1636962890625,
-0.66552734375,
0.57275390625,
0.46435546875,
-0.064453125,
-0.138427734375,
0.2183837890625,
-0.302978515625,
0.58642578125,
0.12335205078125,
0.11376953125,
-0.489013671875,
0.144775390625,
-0.415771484375,
0.5986328125,
-0.5380859375,
0.650390625,
-0.315185546875,
-0.19873046875,
-0.31640625,
-0.33935546875,
-0.0814208984375,
-0.197265625,
-0.07000732421875,
0.406005859375,
0.469970703125,
1.10546875,
0.97900390625,
-0.2322998046875,
0.341796875,
-0.058837890625,
-0.279541015625,
0.059722900390625,
0.67333984375,
0.69482421875,
0.291015625,
-0.02880859375,
-0.30419921875,
-0.697265625,
-0.41259765625,
-0.54248046875,
0.1375732421875,
0.7998046875,
-0.712890625,
-0.2095947265625,
0.400634765625,
0.040802001953125,
-0.445068359375,
0.12261962890625,
-0.07720947265625,
-0.88916015625,
-0.457275390625,
0.61962890625,
-0.307373046875,
0.673828125,
-0.2130126953125,
-0.405029296875,
0.125244140625,
1.162109375,
-0.07989501953125,
0.07049560546875,
0.9560546875,
-0.11956787109375,
-0.32373046875,
0.1142578125,
0.238037109375,
-0.366943359375,
-0.689453125,
0.359130859375,
-0.391845703125,
-0.0064544677734375,
-0.0159454345703125,
0.71484375,
0.5517578125,
0.047637939453125,
-0.059326171875,
-0.320556640625,
0.546875,
1.03515625,
-0.073974609375,
0.45556640625,
0.046478271484375,
1.0712890625,
0.236083984375,
0.841796875,
0.64208984375,
0.37060546875,
0.462158203125,
0.82763671875,
0.11669921875,
-0.0261993408203125,
-0.1514892578125,
0.7421875,
0.41552734375,
0.9482421875,
-0.159912109375,
0.440673828125,
0.1961669921875,
0.053619384765625,
-0.37451171875,
0.2164306640625,
-0.64208984375,
0.73095703125,
0.703125,
0.939453125,
-0.43505859375,
-0.52197265625,
0.237548828125,
0.54248046875,
-1.0537109375,
-0.837890625,
0.037384033203125,
-0.01019287109375,
0.222412109375,
0.2427978515625,
0.285888671875,
0.14306640625,
0.373046875,
0.450927734375,
-0.64208984375,
-0.5556640625,
-0.59375,
-0.98291015625,
-1.015625,
-0.615234375,
-0.25341796875,
-0.067626953125,
0.01305389404296875,
-0.814453125,
0.345703125,
0.4228515625,
-0.0268402099609375,
-0.392333984375,
-0.100341796875,
0.70703125,
-0.0177764892578125,
0.6845703125,
-0.79443359375,
0.84716796875,
-0.0771484375,
1.6767578125,
-0.65576171875,
-0.2298583984375,
-0.40185546875,
-0.73779296875,
0.451171875,
0.145751953125,
0.13330078125,
0.51708984375,
-0.476318359375,
-0.193115234375,
-0.4951171875,
-0.20751953125,
-0.46044921875,
0.6357421875,
-0.5107421875,
0.8857421875,
0.57177734375,
-0.5166015625,
0.447265625,
1.0771484375,
-0.93017578125,
0.671875,
0.234130859375,
0.369384765625,
-0.81201171875,
1.1669921875,
0.79638671875,
0.4375,
-0.5244140625,
-0.26953125,
-0.61669921875,
-0.06890869140625,
-0.02215576171875,
-0.40869140625,
-0.421630859375,
0.31884765625,
0.27685546875,
-1.185546875,
0.7353515625,
-1.3154296875,
-0.92236328125,
-0.347900390625,
-0.433349609375,
0.63671875,
0.82177734375,
0.053131103515625,
-0.35302734375,
0.154296875,
-0.34521484375,
0.630859375,
0.41748046875,
-0.8310546875,
0.418212890625,
0.71630859375,
-0.02886962890625,
0.478515625,
0.0869140625,
-0.6669921875,
-0.229736328125,
-0.11016845703125,
-0.00734710693359375,
0.556640625,
0.5244140625,
-0.28369140625,
0.145263671875,
0.411376953125,
-0.8388671875,
-0.18994140625,
0.0299835205078125,
0.80908203125,
0.3212890625,
0.587890625,
0.2529296875,
-0.66162109375,
-0.449462890625,
-0.84912109375,
0.482421875,
0.67919921875,
0.716796875,
-0.7822265625,
0.2021484375,
0.1700439453125,
-0.7666015625,
0.640625,
-0.779296875,
-0.1864013671875,
1.30078125,
-0.1898193359375,
0.50390625,
-0.923828125,
0.2010498046875,
-0.5390625,
0.406494140625,
0.210205078125,
0.309814453125,
0.60400390625,
-0.5478515625,
-0.49658203125,
0.1131591796875,
-0.06646728515625,
-0.158935546875,
-0.457275390625,
0.53369140625,
-0.8876953125,
-0.24072265625,
-0.873046875,
0.56103515625,
0.7080078125,
0.50927734375,
0.353271484375,
0.8662109375,
0.46142578125,
0.413818359375,
0.5205078125,
0.08587646484375,
0.014984130859375,
-0.669921875,
0.36962890625,
0.1761474609375,
-0.01389312744140625,
-0.42529296875,
-0.44873046875,
-0.572265625,
0.32568359375,
0.23291015625,
0.275634765625,
-0.78564453125,
0.0299072265625,
-0.1953125,
0.4677734375,
-0.6806640625,
-0.334228515625,
-0.63623046875,
0.369140625,
0.278564453125,
-0.81640625,
0.324951171875,
-0.884765625,
0.66552734375,
0.59521484375,
-0.3828125,
-0.67626953125,
-0.25390625,
-0.450439453125,
-0.379638671875,
0.10833740234375,
0.77783203125,
0.07489013671875,
0.404052734375,
-1.0185546875,
0.6533203125,
0.138671875,
-0.1829833984375,
-0.0836181640625,
0.2064208984375,
0.3408203125,
0.014068603515625,
0.489501953125,
-0.5517578125,
-0.5419921875,
0.21240234375,
-1.3984375,
0.75390625,
-0.55078125,
0.6845703125,
-0.02703857421875,
-0.05926513671875,
0.0214691162109375,
0.120849609375,
-0.052947998046875,
0.07861328125,
-0.258544921875,
0.358154296875,
-1.1083984375,
-0.432373046875,
0.68408203125,
-0.25927734375,
-0.2406005859375,
0.86376953125,
0.220458984375,
-0.65966796875,
-0.047027587890625,
0.53662109375,
-0.34326171875,
0.2166748046875,
-0.77490234375,
0.5185546875,
-0.58056640625,
-0.351318359375,
-0.324462890625,
-0.391357421875,
0.8583984375,
0.1927490234375,
-0.73583984375,
-0.1898193359375,
-1.3740234375,
-0.1651611328125,
-0.01192474365234375,
-0.70361328125,
0.327880859375,
0.115966796875,
0.1319580078125,
0.29150390625,
-0.24658203125,
-0.33203125,
-0.466796875,
-0.9736328125,
-0.246337890625,
0.08612060546875,
0.370849609375,
0.822265625,
-0.286376953125,
-0.424560546875,
0.1636962890625,
0.375,
0.0440673828125,
-0.380859375,
-0.448974609375,
-0.1387939453125,
-0.60205078125,
0.0948486328125,
0.8681640625,
-0.07647705078125,
0.448974609375,
1.158203125,
0.27001953125,
0.286865234375,
0.11785888671875,
-0.578125,
0.912109375,
0.41357421875,
-0.99560546875,
-0.368896484375,
0.5625,
-0.03924560546875,
0.5693359375,
0.395263671875,
-0.4912109375,
-0.97607421875,
-1.15625,
-0.0279083251953125,
-0.95751953125,
-0.140625,
-1.037109375,
-0.46337890625,
-0.7412109375,
0.84619140625,
-0.371337890625,
-0.595703125,
0.244384765625,
-1.03125,
-0.034576416015625,
-0.62353515625,
-0.308349609375,
-0.260009765625,
-0.5078125,
-0.073974609375,
0.77294921875,
-0.355224609375,
0.826171875,
0.206298828125,
-0.1597900390625,
0.1529541015625,
-0.430419921875,
-0.59375,
-0.41943359375,
-0.2281494140625,
-0.4013671875,
0.141357421875,
-0.0193634033203125,
-0.357421875,
1.2490234375,
-1.1513671875,
0.10662841796875,
-0.346923828125,
-0.430908203125,
0.1461181640625,
0.1287841796875,
1.2236328125,
-0.126220703125,
0.0538330078125,
-0.12939453125,
0.72998046875,
0.45361328125,
-0.06182861328125,
-0.270751953125,
-0.9189453125,
-0.830078125,
-0.9873046875,
0.484619140625,
-0.250732421875,
0.33349609375,
-0.17041015625,
0.1025390625,
0.84326171875,
-0.20751953125,
0.376953125,
0.6982421875,
0.4521484375,
0.447265625,
-0.52197265625,
0.5556640625,
0.35205078125,
-0.69921875,
-0.37646484375,
0.1668701171875,
-0.71875,
0.045135498046875,
-0.3466796875,
-0.74658203125,
-0.25537109375,
-0.2369384765625,
1.421875,
-0.37060546875,
0.93359375,
-0.177490234375,
-0.890625,
-0.443603515625,
0.546875,
0.1685791015625,
-0.02386474609375,
0.8994140625,
-0.2264404296875,
0.27880859375,
-0.29736328125,
-0.26708984375,
-0.61865234375,
-0.051971435546875,
0.90234375,
-0.336181640625,
-0.52197265625,
1.07421875,
0.748046875,
-0.62255859375,
-0.83203125,
-0.50048828125,
-0.42919921875,
0.041900634765625,
-1.0126953125,
0.58984375,
0.19970703125,
-0.57421875,
0.145751953125,
0.69384765625,
0.00933837890625,
0.404541015625,
0.08343505859375,
0.131591796875,
-0.3603515625,
0.320556640625,
0.4755859375,
-0.483642578125,
-0.6396484375,
-0.7275390625,
-0.07733154296875,
-0.3173828125,
0.311767578125,
0.84130859375,
-0.261962890625,
0.53564453125,
0.59521484375,
-0.1949462890625,
0.65869140625,
-0.440185546875,
0.202392578125,
-0.020233154296875,
-0.81201171875,
-0.88818359375,
0.31103515625,
0.347900390625,
-0.5595703125,
0.26416015625,
-1.00390625,
0.33642578125,
0.229248046875,
0.39453125,
-0.1260986328125,
-1.091796875,
-0.54638671875,
-1.2607421875,
-0.429931640625,
-0.18701171875,
-0.055267333984375,
0.1136474609375,
0.55517578125,
0.0246124267578125,
-0.5458984375,
0.0009927749633789062,
0.44287109375,
-0.358154296875,
0.9873046875,
-0.626953125,
0.78857421875,
-0.78466796875,
-0.318359375,
-0.5625,
0.126708984375,
-0.496337890625,
-0.611328125,
-0.6591796875,
0.287841796875,
-0.1556396484375,
0.20751953125,
-0.45703125,
0.52392578125,
-0.138671875,
-0.2216796875,
0.1207275390625,
-0.0143280029296875,
-0.448486328125,
0.86669921875,
0.74072265625,
-0.041412353515625,
0.2822265625,
0.07464599609375,
-0.52587890625,
-0.2139892578125,
0.2425537109375,
0.72900390625,
-0.276123046875,
0.07147216796875,
-0.304931640625,
-0.09320068359375,
-0.982421875,
0.27294921875,
-0.06402587890625,
0.1165771484375,
0.5927734375,
-0.428955078125,
0.302490234375,
1.0634765625,
-0.356201171875,
0.42626953125,
0.436279296875,
0.262939453125,
0.365966796875,
0.28759765625,
-0.1815185546875,
0.380126953125,
0.2017822265625,
-0.35107421875,
-0.25439453125,
0.71484375,
-0.2000732421875,
0.232421875,
-0.5107421875,
-1.009765625,
-0.91796875,
-0.3603515625,
0.2432861328125,
0.5966796875,
0.0194549560546875,
-0.32373046875,
0.266357421875,
-0.1312255859375,
-0.69677734375,
0.22705078125,
-1.0234375,
-0.7978515625,
0.348388671875,
-0.08154296875,
-0.7880859375,
-0.33056640625,
-0.317138671875,
-0.154541015625,
0.27587890625,
0.25244140625,
-0.343017578125,
0.387451171875,
-0.1683349609375,
0.06378173828125,
-0.240234375,
0.0625,
0.1361083984375,
0.397216796875,
-0.34423828125,
-0.28955078125,
0.53662109375,
1.20703125,
0.131591796875,
-0.451416015625,
-0.591796875,
0.289306640625,
-0.38427734375,
-0.053985595703125,
-0.638671875,
0.244384765625,
0.04461669921875,
0.65478515625,
-0.77490234375,
-0.1104736328125,
-0.09515380859375,
0.431640625,
0.2447509765625,
-0.3984375,
-0.449462890625,
0.98095703125,
0.54833984375,
-0.1181640625,
0.299560546875,
-0.0299072265625,
0.493896484375,
-0.1578369140625,
-0.395263671875,
-0.283935546875,
0.8017578125,
0.74072265625,
0.6298828125,
-0.2646484375,
0.257080078125,
0.62548828125,
0.17578125,
0.35693359375,
0.68115234375,
0.55615234375,
-0.365234375,
0.1148681640625,
-0.30859375,
-0.256591796875,
-0.034912109375,
-0.453369140625,
0.6123046875,
0.16796875,
0.01535797119140625,
-0.201904296875,
-0.68115234375,
0.64892578125,
-0.151611328125,
-0.344482421875,
-0.11151123046875,
-0.0953369140625,
0.28662109375,
0.810546875,
0.24267578125,
0.060760498046875,
0.9794921875,
0.59375,
0.60107421875,
0.318115234375,
0.205810546875,
0.483642578125,
-0.53662109375,
0.236328125,
0.1646728515625,
-0.09515380859375,
-0.66259765625,
-0.0810546875,
-1.0595703125,
0.65380859375,
-0.58740234375,
-0.3427734375,
0.609375,
-0.505859375,
0.625,
-0.1572265625,
0.8017578125,
-0.50244140625,
0.292236328125,
0.358642578125,
-0.144775390625,
-0.63232421875,
1.10546875,
0.11834716796875,
0.278564453125,
0.24658203125,
0.92529296875,
-0.413330078125,
1.46484375,
-0.0625,
-0.56103515625,
0.0865478515625,
0.51123046875,
-0.5830078125,
-0.4482421875,
-0.65625,
-0.53466796875,
-0.1031494140625,
-0.7529296875,
-0.58056640625,
-0.1474609375,
0.12457275390625,
0.2158203125,
-1.1337890625,
-0.056243896484375,
0.12139892578125,
-0.806640625,
0.6123046875,
0.382568359375,
-0.0662841796875,
-0.165283203125,
0.1461181640625,
-0.29833984375,
-0.1446533203125,
-0.01068878173828125,
-0.351318359375,
0.58642578125,
-0.61279296875,
-0.417236328125,
-0.5419921875,
-0.5537109375,
-0.6064453125,
0.1649169921875,
-0.1375732421875,
-1.087890625,
0.509765625,
0.5185546875,
0.755859375,
0.478759765625,
-0.64404296875,
0.473876953125,
1.0087890625,
1.005859375,
-0.2242431640625,
0.8740234375,
-0.19873046875,
-0.966796875,
0.299072265625,
-0.251220703125,
0.5205078125,
-0.05767822265625,
0.1419677734375,
-0.1759033203125,
0.4111328125,
-0.37060546875,
-1.26171875,
-0.0438232421875,
0.68310546875,
0.266845703125,
-0.541015625,
-1.3134765625,
-0.399169921875,
-0.98876953125,
-0.1951904296875,
-0.4140625,
0.7109375,
-0.1229248046875,
0.049560546875,
-0.0550537109375,
-1.2763671875,
4.421875,
0.73681640625,
0.62939453125,
0.089599609375,
0.230712890625,
0.92333984375,
0.322021484375,
-0.384521484375,
-0.2213134765625,
-0.2861328125,
0.39306640625,
-0.60107421875,
-0.007373809814453125,
0.6484375,
0.377685546875,
0.65576171875,
-0.5556640625,
0.193359375,
-0.1761474609375,
-1.0625,
-0.88525390625,
0.403076171875,
-0.388427734375,
0.258056640625,
0.02716064453125,
0.515625,
0.599609375,
-0.55224609375,
0.09637451171875,
-0.82421875,
0.29443359375,
-0.30419921875,
0.58935546875,
-0.042449951171875,
-0.248779296875,
0.5537109375,
-0.14599609375,
-0.367431640625,
-0.282470703125,
-0.2236328125,
0.289794921875,
-0.107177734375,
0.82958984375,
-0.233642578125,
-0.333251953125,
0.509765625,
-0.6552734375,
0.57080078125,
0.12164306640625,
-0.91357421875,
0.90283203125,
-0.255615234375,
0.72021484375,
-0.66943359375,
-0.57080078125,
-0.26123046875,
0.2332763671875,
-0.04290771484375,
-0.2464599609375,
0.263427734375,
-0.1488037109375,
0.2890625,
-0.0491943359375,
0.46240234375,
-0.8916015625,
0.414306640625,
-0.329345703125,
0.26318359375,
-0.40234375,
-0.11102294921875,
-0.416259765625,
-0.1512451171875,
0.2161865234375,
-0.89990234375,
0.80029296875,
0.2459716796875,
-0.73681640625,
0.5751953125,
0.44775390625,
-0.8525390625,
0.2149658203125,
-0.40234375,
0.00710296630859375,
-0.1669921875,
0.45361328125,
0.7109375,
-0.48193359375,
-0.432373046875,
-0.08221435546875,
0.5810546875,
0.56591796875,
0.50146484375,
-0.034515380859375,
-0.1536865234375,
-0.1915283203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.
Let's assume that a song consists of some number of words. To make the dubstep remix of this song, Vasya inserts a certain number of words "WUB" before the first word of the song (the number may be zero), after the last word (the number may be zero), and between words (at least one between any pair of neighbouring words), and then the boy glues together all the words, including "WUB", in one string and plays the song at the club.
For example, a song with words "I AM X" can transform into a dubstep remix as "WUBWUBIWUBAMWUBWUBX" and cannot transform into "WUBWUBIAMWUBX".
Recently, Petya has heard Vasya's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Vasya remixed. Help Petya restore the original song.
Input
The input consists of a single non-empty string, consisting only of uppercase English letters, the string's length doesn't exceed 200 characters. It is guaranteed that before Vasya remixed the song, no word contained substring "WUB" in it; Vasya didn't change the word order. It is also guaranteed that initially the song had at least one word.
Output
Print the words of the initial song that Vasya used to make a dubsteb remix. Separate the words with a space.
Examples
Input
WUBWUBABCWUB
Output
ABC
Input
WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB
Output
WE ARE THE CHAMPIONS MY FRIEND
Note
In the first sample: "WUBWUBABCWUB" = "WUB" + "WUB" + "ABC" + "WUB". That means that the song originally consisted of a single word "ABC", and all words "WUB" were added by Vasya.
In the second sample Vasya added a single word "WUB" between all neighbouring words, in the beginning and in the end, except for words "ARE" and "THE" β between them Vasya added two "WUB".
Tags: strings
Correct Solution:
```
s = input()
S = s.split("WUB")
Ns = []
for i in S:
if i:
Ns.append(i)
print((' '.join(Ns)).strip())
```
| 36,363
|
[
-0.05328369140625,
0.392333984375,
0.1739501953125,
0.1668701171875,
-0.399658203125,
-0.57080078125,
-0.55419921875,
0.0170440673828125,
-0.16796875,
0.7421875,
0.7333984375,
-0.12030029296875,
0.31396484375,
-1.0087890625,
-0.41162109375,
0.3095703125,
-0.68701171875,
-0.6337890625,
-0.88623046875,
-0.257568359375,
0.1256103515625,
-0.32568359375,
-1.3173828125,
-0.256103515625,
-0.5751953125,
0.892578125,
0.1962890625,
-0.0211639404296875,
0.75146484375,
0.96435546875,
0.25634765625,
-0.2188720703125,
0.373779296875,
-0.76708984375,
-0.1641845703125,
-0.318359375,
0.59716796875,
-0.7236328125,
-0.1507568359375,
-0.7001953125,
0.08184814453125,
-0.3388671875,
0.481201171875,
-0.70947265625,
-1.02734375,
0.09613037109375,
0.034942626953125,
-0.357666015625,
0.0264129638671875,
-0.50634765625,
0.06671142578125,
-0.220947265625,
0.63134765625,
0.14306640625,
0.3515625,
-0.316650390625,
-0.19287109375,
-0.1005859375,
-0.74658203125,
-0.09710693359375,
0.31298828125,
0.30126953125,
0.0233306884765625,
-0.71826171875,
-0.33251953125,
0.339599609375,
-0.12493896484375,
-0.5615234375,
0.1690673828125,
-0.6572265625,
-0.505859375,
0.061431884765625,
-0.56201171875,
-0.408203125,
-0.223876953125,
0.1866455078125,
0.017822265625,
-0.0279541015625,
-0.06689453125,
0.81591796875,
0.12249755859375,
1.068359375,
0.380615234375,
0.339111328125,
-0.63037109375,
-0.80810546875,
-0.10107421875,
0.19189453125,
0.400634765625,
0.10894775390625,
-0.26416015625,
0.5380859375,
-0.42724609375,
-0.05712890625,
0.5283203125,
0.73779296875,
-0.2222900390625,
0.208251953125,
-0.024017333984375,
0.145263671875,
0.60888671875,
0.98876953125,
-0.07147216796875,
0.6494140625,
-0.39404296875,
0.309326171875,
0.1478271484375,
0.404541015625,
-0.279052734375,
-0.468505859375,
-0.2349853515625,
-0.19970703125,
0.341796875,
0.292236328125,
-0.33935546875,
0.83984375,
-0.174560546875,
0.29345703125,
-1.14453125,
-0.09136962890625,
0.391845703125,
0.26708984375,
0.52978515625,
-0.047149658203125,
0.10302734375,
-0.71484375,
-0.7939453125,
1.08203125,
-0.6875,
-0.2147216796875,
0.57763671875,
0.0031528472900390625,
-0.260986328125,
0.3984375,
0.09527587890625,
0.48046875,
-0.135986328125,
0.67041015625,
0.794921875,
-0.481689453125,
0.77392578125,
-0.06036376953125,
-0.084228515625,
1.2978515625,
-0.0869140625,
-0.0325927734375,
0.8330078125,
0.497314453125,
-0.759765625,
0.1636962890625,
-0.66552734375,
0.57275390625,
0.46435546875,
-0.064453125,
-0.138427734375,
0.2183837890625,
-0.302978515625,
0.58642578125,
0.12335205078125,
0.11376953125,
-0.489013671875,
0.144775390625,
-0.415771484375,
0.5986328125,
-0.5380859375,
0.650390625,
-0.315185546875,
-0.19873046875,
-0.31640625,
-0.33935546875,
-0.0814208984375,
-0.197265625,
-0.07000732421875,
0.406005859375,
0.469970703125,
1.10546875,
0.97900390625,
-0.2322998046875,
0.341796875,
-0.058837890625,
-0.279541015625,
0.059722900390625,
0.67333984375,
0.69482421875,
0.291015625,
-0.02880859375,
-0.30419921875,
-0.697265625,
-0.41259765625,
-0.54248046875,
0.1375732421875,
0.7998046875,
-0.712890625,
-0.2095947265625,
0.400634765625,
0.040802001953125,
-0.445068359375,
0.12261962890625,
-0.07720947265625,
-0.88916015625,
-0.457275390625,
0.61962890625,
-0.307373046875,
0.673828125,
-0.2130126953125,
-0.405029296875,
0.125244140625,
1.162109375,
-0.07989501953125,
0.07049560546875,
0.9560546875,
-0.11956787109375,
-0.32373046875,
0.1142578125,
0.238037109375,
-0.366943359375,
-0.689453125,
0.359130859375,
-0.391845703125,
-0.0064544677734375,
-0.0159454345703125,
0.71484375,
0.5517578125,
0.047637939453125,
-0.059326171875,
-0.320556640625,
0.546875,
1.03515625,
-0.073974609375,
0.45556640625,
0.046478271484375,
1.0712890625,
0.236083984375,
0.841796875,
0.64208984375,
0.37060546875,
0.462158203125,
0.82763671875,
0.11669921875,
-0.0261993408203125,
-0.1514892578125,
0.7421875,
0.41552734375,
0.9482421875,
-0.159912109375,
0.440673828125,
0.1961669921875,
0.053619384765625,
-0.37451171875,
0.2164306640625,
-0.64208984375,
0.73095703125,
0.703125,
0.939453125,
-0.43505859375,
-0.52197265625,
0.237548828125,
0.54248046875,
-1.0537109375,
-0.837890625,
0.037384033203125,
-0.01019287109375,
0.222412109375,
0.2427978515625,
0.285888671875,
0.14306640625,
0.373046875,
0.450927734375,
-0.64208984375,
-0.5556640625,
-0.59375,
-0.98291015625,
-1.015625,
-0.615234375,
-0.25341796875,
-0.067626953125,
0.01305389404296875,
-0.814453125,
0.345703125,
0.4228515625,
-0.0268402099609375,
-0.392333984375,
-0.100341796875,
0.70703125,
-0.0177764892578125,
0.6845703125,
-0.79443359375,
0.84716796875,
-0.0771484375,
1.6767578125,
-0.65576171875,
-0.2298583984375,
-0.40185546875,
-0.73779296875,
0.451171875,
0.145751953125,
0.13330078125,
0.51708984375,
-0.476318359375,
-0.193115234375,
-0.4951171875,
-0.20751953125,
-0.46044921875,
0.6357421875,
-0.5107421875,
0.8857421875,
0.57177734375,
-0.5166015625,
0.447265625,
1.0771484375,
-0.93017578125,
0.671875,
0.234130859375,
0.369384765625,
-0.81201171875,
1.1669921875,
0.79638671875,
0.4375,
-0.5244140625,
-0.26953125,
-0.61669921875,
-0.06890869140625,
-0.02215576171875,
-0.40869140625,
-0.421630859375,
0.31884765625,
0.27685546875,
-1.185546875,
0.7353515625,
-1.3154296875,
-0.92236328125,
-0.347900390625,
-0.433349609375,
0.63671875,
0.82177734375,
0.053131103515625,
-0.35302734375,
0.154296875,
-0.34521484375,
0.630859375,
0.41748046875,
-0.8310546875,
0.418212890625,
0.71630859375,
-0.02886962890625,
0.478515625,
0.0869140625,
-0.6669921875,
-0.229736328125,
-0.11016845703125,
-0.00734710693359375,
0.556640625,
0.5244140625,
-0.28369140625,
0.145263671875,
0.411376953125,
-0.8388671875,
-0.18994140625,
0.0299835205078125,
0.80908203125,
0.3212890625,
0.587890625,
0.2529296875,
-0.66162109375,
-0.449462890625,
-0.84912109375,
0.482421875,
0.67919921875,
0.716796875,
-0.7822265625,
0.2021484375,
0.1700439453125,
-0.7666015625,
0.640625,
-0.779296875,
-0.1864013671875,
1.30078125,
-0.1898193359375,
0.50390625,
-0.923828125,
0.2010498046875,
-0.5390625,
0.406494140625,
0.210205078125,
0.309814453125,
0.60400390625,
-0.5478515625,
-0.49658203125,
0.1131591796875,
-0.06646728515625,
-0.158935546875,
-0.457275390625,
0.53369140625,
-0.8876953125,
-0.24072265625,
-0.873046875,
0.56103515625,
0.7080078125,
0.50927734375,
0.353271484375,
0.8662109375,
0.46142578125,
0.413818359375,
0.5205078125,
0.08587646484375,
0.014984130859375,
-0.669921875,
0.36962890625,
0.1761474609375,
-0.01389312744140625,
-0.42529296875,
-0.44873046875,
-0.572265625,
0.32568359375,
0.23291015625,
0.275634765625,
-0.78564453125,
0.0299072265625,
-0.1953125,
0.4677734375,
-0.6806640625,
-0.334228515625,
-0.63623046875,
0.369140625,
0.278564453125,
-0.81640625,
0.324951171875,
-0.884765625,
0.66552734375,
0.59521484375,
-0.3828125,
-0.67626953125,
-0.25390625,
-0.450439453125,
-0.379638671875,
0.10833740234375,
0.77783203125,
0.07489013671875,
0.404052734375,
-1.0185546875,
0.6533203125,
0.138671875,
-0.1829833984375,
-0.0836181640625,
0.2064208984375,
0.3408203125,
0.014068603515625,
0.489501953125,
-0.5517578125,
-0.5419921875,
0.21240234375,
-1.3984375,
0.75390625,
-0.55078125,
0.6845703125,
-0.02703857421875,
-0.05926513671875,
0.0214691162109375,
0.120849609375,
-0.052947998046875,
0.07861328125,
-0.258544921875,
0.358154296875,
-1.1083984375,
-0.432373046875,
0.68408203125,
-0.25927734375,
-0.2406005859375,
0.86376953125,
0.220458984375,
-0.65966796875,
-0.047027587890625,
0.53662109375,
-0.34326171875,
0.2166748046875,
-0.77490234375,
0.5185546875,
-0.58056640625,
-0.351318359375,
-0.324462890625,
-0.391357421875,
0.8583984375,
0.1927490234375,
-0.73583984375,
-0.1898193359375,
-1.3740234375,
-0.1651611328125,
-0.01192474365234375,
-0.70361328125,
0.327880859375,
0.115966796875,
0.1319580078125,
0.29150390625,
-0.24658203125,
-0.33203125,
-0.466796875,
-0.9736328125,
-0.246337890625,
0.08612060546875,
0.370849609375,
0.822265625,
-0.286376953125,
-0.424560546875,
0.1636962890625,
0.375,
0.0440673828125,
-0.380859375,
-0.448974609375,
-0.1387939453125,
-0.60205078125,
0.0948486328125,
0.8681640625,
-0.07647705078125,
0.448974609375,
1.158203125,
0.27001953125,
0.286865234375,
0.11785888671875,
-0.578125,
0.912109375,
0.41357421875,
-0.99560546875,
-0.368896484375,
0.5625,
-0.03924560546875,
0.5693359375,
0.395263671875,
-0.4912109375,
-0.97607421875,
-1.15625,
-0.0279083251953125,
-0.95751953125,
-0.140625,
-1.037109375,
-0.46337890625,
-0.7412109375,
0.84619140625,
-0.371337890625,
-0.595703125,
0.244384765625,
-1.03125,
-0.034576416015625,
-0.62353515625,
-0.308349609375,
-0.260009765625,
-0.5078125,
-0.073974609375,
0.77294921875,
-0.355224609375,
0.826171875,
0.206298828125,
-0.1597900390625,
0.1529541015625,
-0.430419921875,
-0.59375,
-0.41943359375,
-0.2281494140625,
-0.4013671875,
0.141357421875,
-0.0193634033203125,
-0.357421875,
1.2490234375,
-1.1513671875,
0.10662841796875,
-0.346923828125,
-0.430908203125,
0.1461181640625,
0.1287841796875,
1.2236328125,
-0.126220703125,
0.0538330078125,
-0.12939453125,
0.72998046875,
0.45361328125,
-0.06182861328125,
-0.270751953125,
-0.9189453125,
-0.830078125,
-0.9873046875,
0.484619140625,
-0.250732421875,
0.33349609375,
-0.17041015625,
0.1025390625,
0.84326171875,
-0.20751953125,
0.376953125,
0.6982421875,
0.4521484375,
0.447265625,
-0.52197265625,
0.5556640625,
0.35205078125,
-0.69921875,
-0.37646484375,
0.1668701171875,
-0.71875,
0.045135498046875,
-0.3466796875,
-0.74658203125,
-0.25537109375,
-0.2369384765625,
1.421875,
-0.37060546875,
0.93359375,
-0.177490234375,
-0.890625,
-0.443603515625,
0.546875,
0.1685791015625,
-0.02386474609375,
0.8994140625,
-0.2264404296875,
0.27880859375,
-0.29736328125,
-0.26708984375,
-0.61865234375,
-0.051971435546875,
0.90234375,
-0.336181640625,
-0.52197265625,
1.07421875,
0.748046875,
-0.62255859375,
-0.83203125,
-0.50048828125,
-0.42919921875,
0.041900634765625,
-1.0126953125,
0.58984375,
0.19970703125,
-0.57421875,
0.145751953125,
0.69384765625,
0.00933837890625,
0.404541015625,
0.08343505859375,
0.131591796875,
-0.3603515625,
0.320556640625,
0.4755859375,
-0.483642578125,
-0.6396484375,
-0.7275390625,
-0.07733154296875,
-0.3173828125,
0.311767578125,
0.84130859375,
-0.261962890625,
0.53564453125,
0.59521484375,
-0.1949462890625,
0.65869140625,
-0.440185546875,
0.202392578125,
-0.020233154296875,
-0.81201171875,
-0.88818359375,
0.31103515625,
0.347900390625,
-0.5595703125,
0.26416015625,
-1.00390625,
0.33642578125,
0.229248046875,
0.39453125,
-0.1260986328125,
-1.091796875,
-0.54638671875,
-1.2607421875,
-0.429931640625,
-0.18701171875,
-0.055267333984375,
0.1136474609375,
0.55517578125,
0.0246124267578125,
-0.5458984375,
0.0009927749633789062,
0.44287109375,
-0.358154296875,
0.9873046875,
-0.626953125,
0.78857421875,
-0.78466796875,
-0.318359375,
-0.5625,
0.126708984375,
-0.496337890625,
-0.611328125,
-0.6591796875,
0.287841796875,
-0.1556396484375,
0.20751953125,
-0.45703125,
0.52392578125,
-0.138671875,
-0.2216796875,
0.1207275390625,
-0.0143280029296875,
-0.448486328125,
0.86669921875,
0.74072265625,
-0.041412353515625,
0.2822265625,
0.07464599609375,
-0.52587890625,
-0.2139892578125,
0.2425537109375,
0.72900390625,
-0.276123046875,
0.07147216796875,
-0.304931640625,
-0.09320068359375,
-0.982421875,
0.27294921875,
-0.06402587890625,
0.1165771484375,
0.5927734375,
-0.428955078125,
0.302490234375,
1.0634765625,
-0.356201171875,
0.42626953125,
0.436279296875,
0.262939453125,
0.365966796875,
0.28759765625,
-0.1815185546875,
0.380126953125,
0.2017822265625,
-0.35107421875,
-0.25439453125,
0.71484375,
-0.2000732421875,
0.232421875,
-0.5107421875,
-1.009765625,
-0.91796875,
-0.3603515625,
0.2432861328125,
0.5966796875,
0.0194549560546875,
-0.32373046875,
0.266357421875,
-0.1312255859375,
-0.69677734375,
0.22705078125,
-1.0234375,
-0.7978515625,
0.348388671875,
-0.08154296875,
-0.7880859375,
-0.33056640625,
-0.317138671875,
-0.154541015625,
0.27587890625,
0.25244140625,
-0.343017578125,
0.387451171875,
-0.1683349609375,
0.06378173828125,
-0.240234375,
0.0625,
0.1361083984375,
0.397216796875,
-0.34423828125,
-0.28955078125,
0.53662109375,
1.20703125,
0.131591796875,
-0.451416015625,
-0.591796875,
0.289306640625,
-0.38427734375,
-0.053985595703125,
-0.638671875,
0.244384765625,
0.04461669921875,
0.65478515625,
-0.77490234375,
-0.1104736328125,
-0.09515380859375,
0.431640625,
0.2447509765625,
-0.3984375,
-0.449462890625,
0.98095703125,
0.54833984375,
-0.1181640625,
0.299560546875,
-0.0299072265625,
0.493896484375,
-0.1578369140625,
-0.395263671875,
-0.283935546875,
0.8017578125,
0.74072265625,
0.6298828125,
-0.2646484375,
0.257080078125,
0.62548828125,
0.17578125,
0.35693359375,
0.68115234375,
0.55615234375,
-0.365234375,
0.1148681640625,
-0.30859375,
-0.256591796875,
-0.034912109375,
-0.453369140625,
0.6123046875,
0.16796875,
0.01535797119140625,
-0.201904296875,
-0.68115234375,
0.64892578125,
-0.151611328125,
-0.344482421875,
-0.11151123046875,
-0.0953369140625,
0.28662109375,
0.810546875,
0.24267578125,
0.060760498046875,
0.9794921875,
0.59375,
0.60107421875,
0.318115234375,
0.205810546875,
0.483642578125,
-0.53662109375,
0.236328125,
0.1646728515625,
-0.09515380859375,
-0.66259765625,
-0.0810546875,
-1.0595703125,
0.65380859375,
-0.58740234375,
-0.3427734375,
0.609375,
-0.505859375,
0.625,
-0.1572265625,
0.8017578125,
-0.50244140625,
0.292236328125,
0.358642578125,
-0.144775390625,
-0.63232421875,
1.10546875,
0.11834716796875,
0.278564453125,
0.24658203125,
0.92529296875,
-0.413330078125,
1.46484375,
-0.0625,
-0.56103515625,
0.0865478515625,
0.51123046875,
-0.5830078125,
-0.4482421875,
-0.65625,
-0.53466796875,
-0.1031494140625,
-0.7529296875,
-0.58056640625,
-0.1474609375,
0.12457275390625,
0.2158203125,
-1.1337890625,
-0.056243896484375,
0.12139892578125,
-0.806640625,
0.6123046875,
0.382568359375,
-0.0662841796875,
-0.165283203125,
0.1461181640625,
-0.29833984375,
-0.1446533203125,
-0.01068878173828125,
-0.351318359375,
0.58642578125,
-0.61279296875,
-0.417236328125,
-0.5419921875,
-0.5537109375,
-0.6064453125,
0.1649169921875,
-0.1375732421875,
-1.087890625,
0.509765625,
0.5185546875,
0.755859375,
0.478759765625,
-0.64404296875,
0.473876953125,
1.0087890625,
1.005859375,
-0.2242431640625,
0.8740234375,
-0.19873046875,
-0.966796875,
0.299072265625,
-0.251220703125,
0.5205078125,
-0.05767822265625,
0.1419677734375,
-0.1759033203125,
0.4111328125,
-0.37060546875,
-1.26171875,
-0.0438232421875,
0.68310546875,
0.266845703125,
-0.541015625,
-1.3134765625,
-0.399169921875,
-0.98876953125,
-0.1951904296875,
-0.4140625,
0.7109375,
-0.1229248046875,
0.049560546875,
-0.0550537109375,
-1.2763671875,
4.421875,
0.73681640625,
0.62939453125,
0.089599609375,
0.230712890625,
0.92333984375,
0.322021484375,
-0.384521484375,
-0.2213134765625,
-0.2861328125,
0.39306640625,
-0.60107421875,
-0.007373809814453125,
0.6484375,
0.377685546875,
0.65576171875,
-0.5556640625,
0.193359375,
-0.1761474609375,
-1.0625,
-0.88525390625,
0.403076171875,
-0.388427734375,
0.258056640625,
0.02716064453125,
0.515625,
0.599609375,
-0.55224609375,
0.09637451171875,
-0.82421875,
0.29443359375,
-0.30419921875,
0.58935546875,
-0.042449951171875,
-0.248779296875,
0.5537109375,
-0.14599609375,
-0.367431640625,
-0.282470703125,
-0.2236328125,
0.289794921875,
-0.107177734375,
0.82958984375,
-0.233642578125,
-0.333251953125,
0.509765625,
-0.6552734375,
0.57080078125,
0.12164306640625,
-0.91357421875,
0.90283203125,
-0.255615234375,
0.72021484375,
-0.66943359375,
-0.57080078125,
-0.26123046875,
0.2332763671875,
-0.04290771484375,
-0.2464599609375,
0.263427734375,
-0.1488037109375,
0.2890625,
-0.0491943359375,
0.46240234375,
-0.8916015625,
0.414306640625,
-0.329345703125,
0.26318359375,
-0.40234375,
-0.11102294921875,
-0.416259765625,
-0.1512451171875,
0.2161865234375,
-0.89990234375,
0.80029296875,
0.2459716796875,
-0.73681640625,
0.5751953125,
0.44775390625,
-0.8525390625,
0.2149658203125,
-0.40234375,
0.00710296630859375,
-0.1669921875,
0.45361328125,
0.7109375,
-0.48193359375,
-0.432373046875,
-0.08221435546875,
0.5810546875,
0.56591796875,
0.50146484375,
-0.034515380859375,
-0.1536865234375,
-0.1915283203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.
Let's assume that a song consists of some number of words. To make the dubstep remix of this song, Vasya inserts a certain number of words "WUB" before the first word of the song (the number may be zero), after the last word (the number may be zero), and between words (at least one between any pair of neighbouring words), and then the boy glues together all the words, including "WUB", in one string and plays the song at the club.
For example, a song with words "I AM X" can transform into a dubstep remix as "WUBWUBIWUBAMWUBWUBX" and cannot transform into "WUBWUBIAMWUBX".
Recently, Petya has heard Vasya's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Vasya remixed. Help Petya restore the original song.
Input
The input consists of a single non-empty string, consisting only of uppercase English letters, the string's length doesn't exceed 200 characters. It is guaranteed that before Vasya remixed the song, no word contained substring "WUB" in it; Vasya didn't change the word order. It is also guaranteed that initially the song had at least one word.
Output
Print the words of the initial song that Vasya used to make a dubsteb remix. Separate the words with a space.
Examples
Input
WUBWUBABCWUB
Output
ABC
Input
WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB
Output
WE ARE THE CHAMPIONS MY FRIEND
Note
In the first sample: "WUBWUBABCWUB" = "WUB" + "WUB" + "ABC" + "WUB". That means that the song originally consisted of a single word "ABC", and all words "WUB" were added by Vasya.
In the second sample Vasya added a single word "WUB" between all neighbouring words, in the beginning and in the end, except for words "ARE" and "THE" β between them Vasya added two "WUB".
Tags: strings
Correct Solution:
```
s = input().split("WUB")
for i in s:
if len(i)!=0:
print(i, end =" ")
print()
```
| 36,364
|
[
-0.05328369140625,
0.392333984375,
0.1739501953125,
0.1668701171875,
-0.399658203125,
-0.57080078125,
-0.55419921875,
0.0170440673828125,
-0.16796875,
0.7421875,
0.7333984375,
-0.12030029296875,
0.31396484375,
-1.0087890625,
-0.41162109375,
0.3095703125,
-0.68701171875,
-0.6337890625,
-0.88623046875,
-0.257568359375,
0.1256103515625,
-0.32568359375,
-1.3173828125,
-0.256103515625,
-0.5751953125,
0.892578125,
0.1962890625,
-0.0211639404296875,
0.75146484375,
0.96435546875,
0.25634765625,
-0.2188720703125,
0.373779296875,
-0.76708984375,
-0.1641845703125,
-0.318359375,
0.59716796875,
-0.7236328125,
-0.1507568359375,
-0.7001953125,
0.08184814453125,
-0.3388671875,
0.481201171875,
-0.70947265625,
-1.02734375,
0.09613037109375,
0.034942626953125,
-0.357666015625,
0.0264129638671875,
-0.50634765625,
0.06671142578125,
-0.220947265625,
0.63134765625,
0.14306640625,
0.3515625,
-0.316650390625,
-0.19287109375,
-0.1005859375,
-0.74658203125,
-0.09710693359375,
0.31298828125,
0.30126953125,
0.0233306884765625,
-0.71826171875,
-0.33251953125,
0.339599609375,
-0.12493896484375,
-0.5615234375,
0.1690673828125,
-0.6572265625,
-0.505859375,
0.061431884765625,
-0.56201171875,
-0.408203125,
-0.223876953125,
0.1866455078125,
0.017822265625,
-0.0279541015625,
-0.06689453125,
0.81591796875,
0.12249755859375,
1.068359375,
0.380615234375,
0.339111328125,
-0.63037109375,
-0.80810546875,
-0.10107421875,
0.19189453125,
0.400634765625,
0.10894775390625,
-0.26416015625,
0.5380859375,
-0.42724609375,
-0.05712890625,
0.5283203125,
0.73779296875,
-0.2222900390625,
0.208251953125,
-0.024017333984375,
0.145263671875,
0.60888671875,
0.98876953125,
-0.07147216796875,
0.6494140625,
-0.39404296875,
0.309326171875,
0.1478271484375,
0.404541015625,
-0.279052734375,
-0.468505859375,
-0.2349853515625,
-0.19970703125,
0.341796875,
0.292236328125,
-0.33935546875,
0.83984375,
-0.174560546875,
0.29345703125,
-1.14453125,
-0.09136962890625,
0.391845703125,
0.26708984375,
0.52978515625,
-0.047149658203125,
0.10302734375,
-0.71484375,
-0.7939453125,
1.08203125,
-0.6875,
-0.2147216796875,
0.57763671875,
0.0031528472900390625,
-0.260986328125,
0.3984375,
0.09527587890625,
0.48046875,
-0.135986328125,
0.67041015625,
0.794921875,
-0.481689453125,
0.77392578125,
-0.06036376953125,
-0.084228515625,
1.2978515625,
-0.0869140625,
-0.0325927734375,
0.8330078125,
0.497314453125,
-0.759765625,
0.1636962890625,
-0.66552734375,
0.57275390625,
0.46435546875,
-0.064453125,
-0.138427734375,
0.2183837890625,
-0.302978515625,
0.58642578125,
0.12335205078125,
0.11376953125,
-0.489013671875,
0.144775390625,
-0.415771484375,
0.5986328125,
-0.5380859375,
0.650390625,
-0.315185546875,
-0.19873046875,
-0.31640625,
-0.33935546875,
-0.0814208984375,
-0.197265625,
-0.07000732421875,
0.406005859375,
0.469970703125,
1.10546875,
0.97900390625,
-0.2322998046875,
0.341796875,
-0.058837890625,
-0.279541015625,
0.059722900390625,
0.67333984375,
0.69482421875,
0.291015625,
-0.02880859375,
-0.30419921875,
-0.697265625,
-0.41259765625,
-0.54248046875,
0.1375732421875,
0.7998046875,
-0.712890625,
-0.2095947265625,
0.400634765625,
0.040802001953125,
-0.445068359375,
0.12261962890625,
-0.07720947265625,
-0.88916015625,
-0.457275390625,
0.61962890625,
-0.307373046875,
0.673828125,
-0.2130126953125,
-0.405029296875,
0.125244140625,
1.162109375,
-0.07989501953125,
0.07049560546875,
0.9560546875,
-0.11956787109375,
-0.32373046875,
0.1142578125,
0.238037109375,
-0.366943359375,
-0.689453125,
0.359130859375,
-0.391845703125,
-0.0064544677734375,
-0.0159454345703125,
0.71484375,
0.5517578125,
0.047637939453125,
-0.059326171875,
-0.320556640625,
0.546875,
1.03515625,
-0.073974609375,
0.45556640625,
0.046478271484375,
1.0712890625,
0.236083984375,
0.841796875,
0.64208984375,
0.37060546875,
0.462158203125,
0.82763671875,
0.11669921875,
-0.0261993408203125,
-0.1514892578125,
0.7421875,
0.41552734375,
0.9482421875,
-0.159912109375,
0.440673828125,
0.1961669921875,
0.053619384765625,
-0.37451171875,
0.2164306640625,
-0.64208984375,
0.73095703125,
0.703125,
0.939453125,
-0.43505859375,
-0.52197265625,
0.237548828125,
0.54248046875,
-1.0537109375,
-0.837890625,
0.037384033203125,
-0.01019287109375,
0.222412109375,
0.2427978515625,
0.285888671875,
0.14306640625,
0.373046875,
0.450927734375,
-0.64208984375,
-0.5556640625,
-0.59375,
-0.98291015625,
-1.015625,
-0.615234375,
-0.25341796875,
-0.067626953125,
0.01305389404296875,
-0.814453125,
0.345703125,
0.4228515625,
-0.0268402099609375,
-0.392333984375,
-0.100341796875,
0.70703125,
-0.0177764892578125,
0.6845703125,
-0.79443359375,
0.84716796875,
-0.0771484375,
1.6767578125,
-0.65576171875,
-0.2298583984375,
-0.40185546875,
-0.73779296875,
0.451171875,
0.145751953125,
0.13330078125,
0.51708984375,
-0.476318359375,
-0.193115234375,
-0.4951171875,
-0.20751953125,
-0.46044921875,
0.6357421875,
-0.5107421875,
0.8857421875,
0.57177734375,
-0.5166015625,
0.447265625,
1.0771484375,
-0.93017578125,
0.671875,
0.234130859375,
0.369384765625,
-0.81201171875,
1.1669921875,
0.79638671875,
0.4375,
-0.5244140625,
-0.26953125,
-0.61669921875,
-0.06890869140625,
-0.02215576171875,
-0.40869140625,
-0.421630859375,
0.31884765625,
0.27685546875,
-1.185546875,
0.7353515625,
-1.3154296875,
-0.92236328125,
-0.347900390625,
-0.433349609375,
0.63671875,
0.82177734375,
0.053131103515625,
-0.35302734375,
0.154296875,
-0.34521484375,
0.630859375,
0.41748046875,
-0.8310546875,
0.418212890625,
0.71630859375,
-0.02886962890625,
0.478515625,
0.0869140625,
-0.6669921875,
-0.229736328125,
-0.11016845703125,
-0.00734710693359375,
0.556640625,
0.5244140625,
-0.28369140625,
0.145263671875,
0.411376953125,
-0.8388671875,
-0.18994140625,
0.0299835205078125,
0.80908203125,
0.3212890625,
0.587890625,
0.2529296875,
-0.66162109375,
-0.449462890625,
-0.84912109375,
0.482421875,
0.67919921875,
0.716796875,
-0.7822265625,
0.2021484375,
0.1700439453125,
-0.7666015625,
0.640625,
-0.779296875,
-0.1864013671875,
1.30078125,
-0.1898193359375,
0.50390625,
-0.923828125,
0.2010498046875,
-0.5390625,
0.406494140625,
0.210205078125,
0.309814453125,
0.60400390625,
-0.5478515625,
-0.49658203125,
0.1131591796875,
-0.06646728515625,
-0.158935546875,
-0.457275390625,
0.53369140625,
-0.8876953125,
-0.24072265625,
-0.873046875,
0.56103515625,
0.7080078125,
0.50927734375,
0.353271484375,
0.8662109375,
0.46142578125,
0.413818359375,
0.5205078125,
0.08587646484375,
0.014984130859375,
-0.669921875,
0.36962890625,
0.1761474609375,
-0.01389312744140625,
-0.42529296875,
-0.44873046875,
-0.572265625,
0.32568359375,
0.23291015625,
0.275634765625,
-0.78564453125,
0.0299072265625,
-0.1953125,
0.4677734375,
-0.6806640625,
-0.334228515625,
-0.63623046875,
0.369140625,
0.278564453125,
-0.81640625,
0.324951171875,
-0.884765625,
0.66552734375,
0.59521484375,
-0.3828125,
-0.67626953125,
-0.25390625,
-0.450439453125,
-0.379638671875,
0.10833740234375,
0.77783203125,
0.07489013671875,
0.404052734375,
-1.0185546875,
0.6533203125,
0.138671875,
-0.1829833984375,
-0.0836181640625,
0.2064208984375,
0.3408203125,
0.014068603515625,
0.489501953125,
-0.5517578125,
-0.5419921875,
0.21240234375,
-1.3984375,
0.75390625,
-0.55078125,
0.6845703125,
-0.02703857421875,
-0.05926513671875,
0.0214691162109375,
0.120849609375,
-0.052947998046875,
0.07861328125,
-0.258544921875,
0.358154296875,
-1.1083984375,
-0.432373046875,
0.68408203125,
-0.25927734375,
-0.2406005859375,
0.86376953125,
0.220458984375,
-0.65966796875,
-0.047027587890625,
0.53662109375,
-0.34326171875,
0.2166748046875,
-0.77490234375,
0.5185546875,
-0.58056640625,
-0.351318359375,
-0.324462890625,
-0.391357421875,
0.8583984375,
0.1927490234375,
-0.73583984375,
-0.1898193359375,
-1.3740234375,
-0.1651611328125,
-0.01192474365234375,
-0.70361328125,
0.327880859375,
0.115966796875,
0.1319580078125,
0.29150390625,
-0.24658203125,
-0.33203125,
-0.466796875,
-0.9736328125,
-0.246337890625,
0.08612060546875,
0.370849609375,
0.822265625,
-0.286376953125,
-0.424560546875,
0.1636962890625,
0.375,
0.0440673828125,
-0.380859375,
-0.448974609375,
-0.1387939453125,
-0.60205078125,
0.0948486328125,
0.8681640625,
-0.07647705078125,
0.448974609375,
1.158203125,
0.27001953125,
0.286865234375,
0.11785888671875,
-0.578125,
0.912109375,
0.41357421875,
-0.99560546875,
-0.368896484375,
0.5625,
-0.03924560546875,
0.5693359375,
0.395263671875,
-0.4912109375,
-0.97607421875,
-1.15625,
-0.0279083251953125,
-0.95751953125,
-0.140625,
-1.037109375,
-0.46337890625,
-0.7412109375,
0.84619140625,
-0.371337890625,
-0.595703125,
0.244384765625,
-1.03125,
-0.034576416015625,
-0.62353515625,
-0.308349609375,
-0.260009765625,
-0.5078125,
-0.073974609375,
0.77294921875,
-0.355224609375,
0.826171875,
0.206298828125,
-0.1597900390625,
0.1529541015625,
-0.430419921875,
-0.59375,
-0.41943359375,
-0.2281494140625,
-0.4013671875,
0.141357421875,
-0.0193634033203125,
-0.357421875,
1.2490234375,
-1.1513671875,
0.10662841796875,
-0.346923828125,
-0.430908203125,
0.1461181640625,
0.1287841796875,
1.2236328125,
-0.126220703125,
0.0538330078125,
-0.12939453125,
0.72998046875,
0.45361328125,
-0.06182861328125,
-0.270751953125,
-0.9189453125,
-0.830078125,
-0.9873046875,
0.484619140625,
-0.250732421875,
0.33349609375,
-0.17041015625,
0.1025390625,
0.84326171875,
-0.20751953125,
0.376953125,
0.6982421875,
0.4521484375,
0.447265625,
-0.52197265625,
0.5556640625,
0.35205078125,
-0.69921875,
-0.37646484375,
0.1668701171875,
-0.71875,
0.045135498046875,
-0.3466796875,
-0.74658203125,
-0.25537109375,
-0.2369384765625,
1.421875,
-0.37060546875,
0.93359375,
-0.177490234375,
-0.890625,
-0.443603515625,
0.546875,
0.1685791015625,
-0.02386474609375,
0.8994140625,
-0.2264404296875,
0.27880859375,
-0.29736328125,
-0.26708984375,
-0.61865234375,
-0.051971435546875,
0.90234375,
-0.336181640625,
-0.52197265625,
1.07421875,
0.748046875,
-0.62255859375,
-0.83203125,
-0.50048828125,
-0.42919921875,
0.041900634765625,
-1.0126953125,
0.58984375,
0.19970703125,
-0.57421875,
0.145751953125,
0.69384765625,
0.00933837890625,
0.404541015625,
0.08343505859375,
0.131591796875,
-0.3603515625,
0.320556640625,
0.4755859375,
-0.483642578125,
-0.6396484375,
-0.7275390625,
-0.07733154296875,
-0.3173828125,
0.311767578125,
0.84130859375,
-0.261962890625,
0.53564453125,
0.59521484375,
-0.1949462890625,
0.65869140625,
-0.440185546875,
0.202392578125,
-0.020233154296875,
-0.81201171875,
-0.88818359375,
0.31103515625,
0.347900390625,
-0.5595703125,
0.26416015625,
-1.00390625,
0.33642578125,
0.229248046875,
0.39453125,
-0.1260986328125,
-1.091796875,
-0.54638671875,
-1.2607421875,
-0.429931640625,
-0.18701171875,
-0.055267333984375,
0.1136474609375,
0.55517578125,
0.0246124267578125,
-0.5458984375,
0.0009927749633789062,
0.44287109375,
-0.358154296875,
0.9873046875,
-0.626953125,
0.78857421875,
-0.78466796875,
-0.318359375,
-0.5625,
0.126708984375,
-0.496337890625,
-0.611328125,
-0.6591796875,
0.287841796875,
-0.1556396484375,
0.20751953125,
-0.45703125,
0.52392578125,
-0.138671875,
-0.2216796875,
0.1207275390625,
-0.0143280029296875,
-0.448486328125,
0.86669921875,
0.74072265625,
-0.041412353515625,
0.2822265625,
0.07464599609375,
-0.52587890625,
-0.2139892578125,
0.2425537109375,
0.72900390625,
-0.276123046875,
0.07147216796875,
-0.304931640625,
-0.09320068359375,
-0.982421875,
0.27294921875,
-0.06402587890625,
0.1165771484375,
0.5927734375,
-0.428955078125,
0.302490234375,
1.0634765625,
-0.356201171875,
0.42626953125,
0.436279296875,
0.262939453125,
0.365966796875,
0.28759765625,
-0.1815185546875,
0.380126953125,
0.2017822265625,
-0.35107421875,
-0.25439453125,
0.71484375,
-0.2000732421875,
0.232421875,
-0.5107421875,
-1.009765625,
-0.91796875,
-0.3603515625,
0.2432861328125,
0.5966796875,
0.0194549560546875,
-0.32373046875,
0.266357421875,
-0.1312255859375,
-0.69677734375,
0.22705078125,
-1.0234375,
-0.7978515625,
0.348388671875,
-0.08154296875,
-0.7880859375,
-0.33056640625,
-0.317138671875,
-0.154541015625,
0.27587890625,
0.25244140625,
-0.343017578125,
0.387451171875,
-0.1683349609375,
0.06378173828125,
-0.240234375,
0.0625,
0.1361083984375,
0.397216796875,
-0.34423828125,
-0.28955078125,
0.53662109375,
1.20703125,
0.131591796875,
-0.451416015625,
-0.591796875,
0.289306640625,
-0.38427734375,
-0.053985595703125,
-0.638671875,
0.244384765625,
0.04461669921875,
0.65478515625,
-0.77490234375,
-0.1104736328125,
-0.09515380859375,
0.431640625,
0.2447509765625,
-0.3984375,
-0.449462890625,
0.98095703125,
0.54833984375,
-0.1181640625,
0.299560546875,
-0.0299072265625,
0.493896484375,
-0.1578369140625,
-0.395263671875,
-0.283935546875,
0.8017578125,
0.74072265625,
0.6298828125,
-0.2646484375,
0.257080078125,
0.62548828125,
0.17578125,
0.35693359375,
0.68115234375,
0.55615234375,
-0.365234375,
0.1148681640625,
-0.30859375,
-0.256591796875,
-0.034912109375,
-0.453369140625,
0.6123046875,
0.16796875,
0.01535797119140625,
-0.201904296875,
-0.68115234375,
0.64892578125,
-0.151611328125,
-0.344482421875,
-0.11151123046875,
-0.0953369140625,
0.28662109375,
0.810546875,
0.24267578125,
0.060760498046875,
0.9794921875,
0.59375,
0.60107421875,
0.318115234375,
0.205810546875,
0.483642578125,
-0.53662109375,
0.236328125,
0.1646728515625,
-0.09515380859375,
-0.66259765625,
-0.0810546875,
-1.0595703125,
0.65380859375,
-0.58740234375,
-0.3427734375,
0.609375,
-0.505859375,
0.625,
-0.1572265625,
0.8017578125,
-0.50244140625,
0.292236328125,
0.358642578125,
-0.144775390625,
-0.63232421875,
1.10546875,
0.11834716796875,
0.278564453125,
0.24658203125,
0.92529296875,
-0.413330078125,
1.46484375,
-0.0625,
-0.56103515625,
0.0865478515625,
0.51123046875,
-0.5830078125,
-0.4482421875,
-0.65625,
-0.53466796875,
-0.1031494140625,
-0.7529296875,
-0.58056640625,
-0.1474609375,
0.12457275390625,
0.2158203125,
-1.1337890625,
-0.056243896484375,
0.12139892578125,
-0.806640625,
0.6123046875,
0.382568359375,
-0.0662841796875,
-0.165283203125,
0.1461181640625,
-0.29833984375,
-0.1446533203125,
-0.01068878173828125,
-0.351318359375,
0.58642578125,
-0.61279296875,
-0.417236328125,
-0.5419921875,
-0.5537109375,
-0.6064453125,
0.1649169921875,
-0.1375732421875,
-1.087890625,
0.509765625,
0.5185546875,
0.755859375,
0.478759765625,
-0.64404296875,
0.473876953125,
1.0087890625,
1.005859375,
-0.2242431640625,
0.8740234375,
-0.19873046875,
-0.966796875,
0.299072265625,
-0.251220703125,
0.5205078125,
-0.05767822265625,
0.1419677734375,
-0.1759033203125,
0.4111328125,
-0.37060546875,
-1.26171875,
-0.0438232421875,
0.68310546875,
0.266845703125,
-0.541015625,
-1.3134765625,
-0.399169921875,
-0.98876953125,
-0.1951904296875,
-0.4140625,
0.7109375,
-0.1229248046875,
0.049560546875,
-0.0550537109375,
-1.2763671875,
4.421875,
0.73681640625,
0.62939453125,
0.089599609375,
0.230712890625,
0.92333984375,
0.322021484375,
-0.384521484375,
-0.2213134765625,
-0.2861328125,
0.39306640625,
-0.60107421875,
-0.007373809814453125,
0.6484375,
0.377685546875,
0.65576171875,
-0.5556640625,
0.193359375,
-0.1761474609375,
-1.0625,
-0.88525390625,
0.403076171875,
-0.388427734375,
0.258056640625,
0.02716064453125,
0.515625,
0.599609375,
-0.55224609375,
0.09637451171875,
-0.82421875,
0.29443359375,
-0.30419921875,
0.58935546875,
-0.042449951171875,
-0.248779296875,
0.5537109375,
-0.14599609375,
-0.367431640625,
-0.282470703125,
-0.2236328125,
0.289794921875,
-0.107177734375,
0.82958984375,
-0.233642578125,
-0.333251953125,
0.509765625,
-0.6552734375,
0.57080078125,
0.12164306640625,
-0.91357421875,
0.90283203125,
-0.255615234375,
0.72021484375,
-0.66943359375,
-0.57080078125,
-0.26123046875,
0.2332763671875,
-0.04290771484375,
-0.2464599609375,
0.263427734375,
-0.1488037109375,
0.2890625,
-0.0491943359375,
0.46240234375,
-0.8916015625,
0.414306640625,
-0.329345703125,
0.26318359375,
-0.40234375,
-0.11102294921875,
-0.416259765625,
-0.1512451171875,
0.2161865234375,
-0.89990234375,
0.80029296875,
0.2459716796875,
-0.73681640625,
0.5751953125,
0.44775390625,
-0.8525390625,
0.2149658203125,
-0.40234375,
0.00710296630859375,
-0.1669921875,
0.45361328125,
0.7109375,
-0.48193359375,
-0.432373046875,
-0.08221435546875,
0.5810546875,
0.56591796875,
0.50146484375,
-0.034515380859375,
-0.1536865234375,
-0.1915283203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.
Let's assume that a song consists of some number of words. To make the dubstep remix of this song, Vasya inserts a certain number of words "WUB" before the first word of the song (the number may be zero), after the last word (the number may be zero), and between words (at least one between any pair of neighbouring words), and then the boy glues together all the words, including "WUB", in one string and plays the song at the club.
For example, a song with words "I AM X" can transform into a dubstep remix as "WUBWUBIWUBAMWUBWUBX" and cannot transform into "WUBWUBIAMWUBX".
Recently, Petya has heard Vasya's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Vasya remixed. Help Petya restore the original song.
Input
The input consists of a single non-empty string, consisting only of uppercase English letters, the string's length doesn't exceed 200 characters. It is guaranteed that before Vasya remixed the song, no word contained substring "WUB" in it; Vasya didn't change the word order. It is also guaranteed that initially the song had at least one word.
Output
Print the words of the initial song that Vasya used to make a dubsteb remix. Separate the words with a space.
Examples
Input
WUBWUBABCWUB
Output
ABC
Input
WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB
Output
WE ARE THE CHAMPIONS MY FRIEND
Note
In the first sample: "WUBWUBABCWUB" = "WUB" + "WUB" + "ABC" + "WUB". That means that the song originally consisted of a single word "ABC", and all words "WUB" were added by Vasya.
In the second sample Vasya added a single word "WUB" between all neighbouring words, in the beginning and in the end, except for words "ARE" and "THE" β between them Vasya added two "WUB".
Tags: strings
Correct Solution:
```
print(*list(input().split("WUB")))
```
| 36,365
|
[
-0.05328369140625,
0.392333984375,
0.1739501953125,
0.1668701171875,
-0.399658203125,
-0.57080078125,
-0.55419921875,
0.0170440673828125,
-0.16796875,
0.7421875,
0.7333984375,
-0.12030029296875,
0.31396484375,
-1.0087890625,
-0.41162109375,
0.3095703125,
-0.68701171875,
-0.6337890625,
-0.88623046875,
-0.257568359375,
0.1256103515625,
-0.32568359375,
-1.3173828125,
-0.256103515625,
-0.5751953125,
0.892578125,
0.1962890625,
-0.0211639404296875,
0.75146484375,
0.96435546875,
0.25634765625,
-0.2188720703125,
0.373779296875,
-0.76708984375,
-0.1641845703125,
-0.318359375,
0.59716796875,
-0.7236328125,
-0.1507568359375,
-0.7001953125,
0.08184814453125,
-0.3388671875,
0.481201171875,
-0.70947265625,
-1.02734375,
0.09613037109375,
0.034942626953125,
-0.357666015625,
0.0264129638671875,
-0.50634765625,
0.06671142578125,
-0.220947265625,
0.63134765625,
0.14306640625,
0.3515625,
-0.316650390625,
-0.19287109375,
-0.1005859375,
-0.74658203125,
-0.09710693359375,
0.31298828125,
0.30126953125,
0.0233306884765625,
-0.71826171875,
-0.33251953125,
0.339599609375,
-0.12493896484375,
-0.5615234375,
0.1690673828125,
-0.6572265625,
-0.505859375,
0.061431884765625,
-0.56201171875,
-0.408203125,
-0.223876953125,
0.1866455078125,
0.017822265625,
-0.0279541015625,
-0.06689453125,
0.81591796875,
0.12249755859375,
1.068359375,
0.380615234375,
0.339111328125,
-0.63037109375,
-0.80810546875,
-0.10107421875,
0.19189453125,
0.400634765625,
0.10894775390625,
-0.26416015625,
0.5380859375,
-0.42724609375,
-0.05712890625,
0.5283203125,
0.73779296875,
-0.2222900390625,
0.208251953125,
-0.024017333984375,
0.145263671875,
0.60888671875,
0.98876953125,
-0.07147216796875,
0.6494140625,
-0.39404296875,
0.309326171875,
0.1478271484375,
0.404541015625,
-0.279052734375,
-0.468505859375,
-0.2349853515625,
-0.19970703125,
0.341796875,
0.292236328125,
-0.33935546875,
0.83984375,
-0.174560546875,
0.29345703125,
-1.14453125,
-0.09136962890625,
0.391845703125,
0.26708984375,
0.52978515625,
-0.047149658203125,
0.10302734375,
-0.71484375,
-0.7939453125,
1.08203125,
-0.6875,
-0.2147216796875,
0.57763671875,
0.0031528472900390625,
-0.260986328125,
0.3984375,
0.09527587890625,
0.48046875,
-0.135986328125,
0.67041015625,
0.794921875,
-0.481689453125,
0.77392578125,
-0.06036376953125,
-0.084228515625,
1.2978515625,
-0.0869140625,
-0.0325927734375,
0.8330078125,
0.497314453125,
-0.759765625,
0.1636962890625,
-0.66552734375,
0.57275390625,
0.46435546875,
-0.064453125,
-0.138427734375,
0.2183837890625,
-0.302978515625,
0.58642578125,
0.12335205078125,
0.11376953125,
-0.489013671875,
0.144775390625,
-0.415771484375,
0.5986328125,
-0.5380859375,
0.650390625,
-0.315185546875,
-0.19873046875,
-0.31640625,
-0.33935546875,
-0.0814208984375,
-0.197265625,
-0.07000732421875,
0.406005859375,
0.469970703125,
1.10546875,
0.97900390625,
-0.2322998046875,
0.341796875,
-0.058837890625,
-0.279541015625,
0.059722900390625,
0.67333984375,
0.69482421875,
0.291015625,
-0.02880859375,
-0.30419921875,
-0.697265625,
-0.41259765625,
-0.54248046875,
0.1375732421875,
0.7998046875,
-0.712890625,
-0.2095947265625,
0.400634765625,
0.040802001953125,
-0.445068359375,
0.12261962890625,
-0.07720947265625,
-0.88916015625,
-0.457275390625,
0.61962890625,
-0.307373046875,
0.673828125,
-0.2130126953125,
-0.405029296875,
0.125244140625,
1.162109375,
-0.07989501953125,
0.07049560546875,
0.9560546875,
-0.11956787109375,
-0.32373046875,
0.1142578125,
0.238037109375,
-0.366943359375,
-0.689453125,
0.359130859375,
-0.391845703125,
-0.0064544677734375,
-0.0159454345703125,
0.71484375,
0.5517578125,
0.047637939453125,
-0.059326171875,
-0.320556640625,
0.546875,
1.03515625,
-0.073974609375,
0.45556640625,
0.046478271484375,
1.0712890625,
0.236083984375,
0.841796875,
0.64208984375,
0.37060546875,
0.462158203125,
0.82763671875,
0.11669921875,
-0.0261993408203125,
-0.1514892578125,
0.7421875,
0.41552734375,
0.9482421875,
-0.159912109375,
0.440673828125,
0.1961669921875,
0.053619384765625,
-0.37451171875,
0.2164306640625,
-0.64208984375,
0.73095703125,
0.703125,
0.939453125,
-0.43505859375,
-0.52197265625,
0.237548828125,
0.54248046875,
-1.0537109375,
-0.837890625,
0.037384033203125,
-0.01019287109375,
0.222412109375,
0.2427978515625,
0.285888671875,
0.14306640625,
0.373046875,
0.450927734375,
-0.64208984375,
-0.5556640625,
-0.59375,
-0.98291015625,
-1.015625,
-0.615234375,
-0.25341796875,
-0.067626953125,
0.01305389404296875,
-0.814453125,
0.345703125,
0.4228515625,
-0.0268402099609375,
-0.392333984375,
-0.100341796875,
0.70703125,
-0.0177764892578125,
0.6845703125,
-0.79443359375,
0.84716796875,
-0.0771484375,
1.6767578125,
-0.65576171875,
-0.2298583984375,
-0.40185546875,
-0.73779296875,
0.451171875,
0.145751953125,
0.13330078125,
0.51708984375,
-0.476318359375,
-0.193115234375,
-0.4951171875,
-0.20751953125,
-0.46044921875,
0.6357421875,
-0.5107421875,
0.8857421875,
0.57177734375,
-0.5166015625,
0.447265625,
1.0771484375,
-0.93017578125,
0.671875,
0.234130859375,
0.369384765625,
-0.81201171875,
1.1669921875,
0.79638671875,
0.4375,
-0.5244140625,
-0.26953125,
-0.61669921875,
-0.06890869140625,
-0.02215576171875,
-0.40869140625,
-0.421630859375,
0.31884765625,
0.27685546875,
-1.185546875,
0.7353515625,
-1.3154296875,
-0.92236328125,
-0.347900390625,
-0.433349609375,
0.63671875,
0.82177734375,
0.053131103515625,
-0.35302734375,
0.154296875,
-0.34521484375,
0.630859375,
0.41748046875,
-0.8310546875,
0.418212890625,
0.71630859375,
-0.02886962890625,
0.478515625,
0.0869140625,
-0.6669921875,
-0.229736328125,
-0.11016845703125,
-0.00734710693359375,
0.556640625,
0.5244140625,
-0.28369140625,
0.145263671875,
0.411376953125,
-0.8388671875,
-0.18994140625,
0.0299835205078125,
0.80908203125,
0.3212890625,
0.587890625,
0.2529296875,
-0.66162109375,
-0.449462890625,
-0.84912109375,
0.482421875,
0.67919921875,
0.716796875,
-0.7822265625,
0.2021484375,
0.1700439453125,
-0.7666015625,
0.640625,
-0.779296875,
-0.1864013671875,
1.30078125,
-0.1898193359375,
0.50390625,
-0.923828125,
0.2010498046875,
-0.5390625,
0.406494140625,
0.210205078125,
0.309814453125,
0.60400390625,
-0.5478515625,
-0.49658203125,
0.1131591796875,
-0.06646728515625,
-0.158935546875,
-0.457275390625,
0.53369140625,
-0.8876953125,
-0.24072265625,
-0.873046875,
0.56103515625,
0.7080078125,
0.50927734375,
0.353271484375,
0.8662109375,
0.46142578125,
0.413818359375,
0.5205078125,
0.08587646484375,
0.014984130859375,
-0.669921875,
0.36962890625,
0.1761474609375,
-0.01389312744140625,
-0.42529296875,
-0.44873046875,
-0.572265625,
0.32568359375,
0.23291015625,
0.275634765625,
-0.78564453125,
0.0299072265625,
-0.1953125,
0.4677734375,
-0.6806640625,
-0.334228515625,
-0.63623046875,
0.369140625,
0.278564453125,
-0.81640625,
0.324951171875,
-0.884765625,
0.66552734375,
0.59521484375,
-0.3828125,
-0.67626953125,
-0.25390625,
-0.450439453125,
-0.379638671875,
0.10833740234375,
0.77783203125,
0.07489013671875,
0.404052734375,
-1.0185546875,
0.6533203125,
0.138671875,
-0.1829833984375,
-0.0836181640625,
0.2064208984375,
0.3408203125,
0.014068603515625,
0.489501953125,
-0.5517578125,
-0.5419921875,
0.21240234375,
-1.3984375,
0.75390625,
-0.55078125,
0.6845703125,
-0.02703857421875,
-0.05926513671875,
0.0214691162109375,
0.120849609375,
-0.052947998046875,
0.07861328125,
-0.258544921875,
0.358154296875,
-1.1083984375,
-0.432373046875,
0.68408203125,
-0.25927734375,
-0.2406005859375,
0.86376953125,
0.220458984375,
-0.65966796875,
-0.047027587890625,
0.53662109375,
-0.34326171875,
0.2166748046875,
-0.77490234375,
0.5185546875,
-0.58056640625,
-0.351318359375,
-0.324462890625,
-0.391357421875,
0.8583984375,
0.1927490234375,
-0.73583984375,
-0.1898193359375,
-1.3740234375,
-0.1651611328125,
-0.01192474365234375,
-0.70361328125,
0.327880859375,
0.115966796875,
0.1319580078125,
0.29150390625,
-0.24658203125,
-0.33203125,
-0.466796875,
-0.9736328125,
-0.246337890625,
0.08612060546875,
0.370849609375,
0.822265625,
-0.286376953125,
-0.424560546875,
0.1636962890625,
0.375,
0.0440673828125,
-0.380859375,
-0.448974609375,
-0.1387939453125,
-0.60205078125,
0.0948486328125,
0.8681640625,
-0.07647705078125,
0.448974609375,
1.158203125,
0.27001953125,
0.286865234375,
0.11785888671875,
-0.578125,
0.912109375,
0.41357421875,
-0.99560546875,
-0.368896484375,
0.5625,
-0.03924560546875,
0.5693359375,
0.395263671875,
-0.4912109375,
-0.97607421875,
-1.15625,
-0.0279083251953125,
-0.95751953125,
-0.140625,
-1.037109375,
-0.46337890625,
-0.7412109375,
0.84619140625,
-0.371337890625,
-0.595703125,
0.244384765625,
-1.03125,
-0.034576416015625,
-0.62353515625,
-0.308349609375,
-0.260009765625,
-0.5078125,
-0.073974609375,
0.77294921875,
-0.355224609375,
0.826171875,
0.206298828125,
-0.1597900390625,
0.1529541015625,
-0.430419921875,
-0.59375,
-0.41943359375,
-0.2281494140625,
-0.4013671875,
0.141357421875,
-0.0193634033203125,
-0.357421875,
1.2490234375,
-1.1513671875,
0.10662841796875,
-0.346923828125,
-0.430908203125,
0.1461181640625,
0.1287841796875,
1.2236328125,
-0.126220703125,
0.0538330078125,
-0.12939453125,
0.72998046875,
0.45361328125,
-0.06182861328125,
-0.270751953125,
-0.9189453125,
-0.830078125,
-0.9873046875,
0.484619140625,
-0.250732421875,
0.33349609375,
-0.17041015625,
0.1025390625,
0.84326171875,
-0.20751953125,
0.376953125,
0.6982421875,
0.4521484375,
0.447265625,
-0.52197265625,
0.5556640625,
0.35205078125,
-0.69921875,
-0.37646484375,
0.1668701171875,
-0.71875,
0.045135498046875,
-0.3466796875,
-0.74658203125,
-0.25537109375,
-0.2369384765625,
1.421875,
-0.37060546875,
0.93359375,
-0.177490234375,
-0.890625,
-0.443603515625,
0.546875,
0.1685791015625,
-0.02386474609375,
0.8994140625,
-0.2264404296875,
0.27880859375,
-0.29736328125,
-0.26708984375,
-0.61865234375,
-0.051971435546875,
0.90234375,
-0.336181640625,
-0.52197265625,
1.07421875,
0.748046875,
-0.62255859375,
-0.83203125,
-0.50048828125,
-0.42919921875,
0.041900634765625,
-1.0126953125,
0.58984375,
0.19970703125,
-0.57421875,
0.145751953125,
0.69384765625,
0.00933837890625,
0.404541015625,
0.08343505859375,
0.131591796875,
-0.3603515625,
0.320556640625,
0.4755859375,
-0.483642578125,
-0.6396484375,
-0.7275390625,
-0.07733154296875,
-0.3173828125,
0.311767578125,
0.84130859375,
-0.261962890625,
0.53564453125,
0.59521484375,
-0.1949462890625,
0.65869140625,
-0.440185546875,
0.202392578125,
-0.020233154296875,
-0.81201171875,
-0.88818359375,
0.31103515625,
0.347900390625,
-0.5595703125,
0.26416015625,
-1.00390625,
0.33642578125,
0.229248046875,
0.39453125,
-0.1260986328125,
-1.091796875,
-0.54638671875,
-1.2607421875,
-0.429931640625,
-0.18701171875,
-0.055267333984375,
0.1136474609375,
0.55517578125,
0.0246124267578125,
-0.5458984375,
0.0009927749633789062,
0.44287109375,
-0.358154296875,
0.9873046875,
-0.626953125,
0.78857421875,
-0.78466796875,
-0.318359375,
-0.5625,
0.126708984375,
-0.496337890625,
-0.611328125,
-0.6591796875,
0.287841796875,
-0.1556396484375,
0.20751953125,
-0.45703125,
0.52392578125,
-0.138671875,
-0.2216796875,
0.1207275390625,
-0.0143280029296875,
-0.448486328125,
0.86669921875,
0.74072265625,
-0.041412353515625,
0.2822265625,
0.07464599609375,
-0.52587890625,
-0.2139892578125,
0.2425537109375,
0.72900390625,
-0.276123046875,
0.07147216796875,
-0.304931640625,
-0.09320068359375,
-0.982421875,
0.27294921875,
-0.06402587890625,
0.1165771484375,
0.5927734375,
-0.428955078125,
0.302490234375,
1.0634765625,
-0.356201171875,
0.42626953125,
0.436279296875,
0.262939453125,
0.365966796875,
0.28759765625,
-0.1815185546875,
0.380126953125,
0.2017822265625,
-0.35107421875,
-0.25439453125,
0.71484375,
-0.2000732421875,
0.232421875,
-0.5107421875,
-1.009765625,
-0.91796875,
-0.3603515625,
0.2432861328125,
0.5966796875,
0.0194549560546875,
-0.32373046875,
0.266357421875,
-0.1312255859375,
-0.69677734375,
0.22705078125,
-1.0234375,
-0.7978515625,
0.348388671875,
-0.08154296875,
-0.7880859375,
-0.33056640625,
-0.317138671875,
-0.154541015625,
0.27587890625,
0.25244140625,
-0.343017578125,
0.387451171875,
-0.1683349609375,
0.06378173828125,
-0.240234375,
0.0625,
0.1361083984375,
0.397216796875,
-0.34423828125,
-0.28955078125,
0.53662109375,
1.20703125,
0.131591796875,
-0.451416015625,
-0.591796875,
0.289306640625,
-0.38427734375,
-0.053985595703125,
-0.638671875,
0.244384765625,
0.04461669921875,
0.65478515625,
-0.77490234375,
-0.1104736328125,
-0.09515380859375,
0.431640625,
0.2447509765625,
-0.3984375,
-0.449462890625,
0.98095703125,
0.54833984375,
-0.1181640625,
0.299560546875,
-0.0299072265625,
0.493896484375,
-0.1578369140625,
-0.395263671875,
-0.283935546875,
0.8017578125,
0.74072265625,
0.6298828125,
-0.2646484375,
0.257080078125,
0.62548828125,
0.17578125,
0.35693359375,
0.68115234375,
0.55615234375,
-0.365234375,
0.1148681640625,
-0.30859375,
-0.256591796875,
-0.034912109375,
-0.453369140625,
0.6123046875,
0.16796875,
0.01535797119140625,
-0.201904296875,
-0.68115234375,
0.64892578125,
-0.151611328125,
-0.344482421875,
-0.11151123046875,
-0.0953369140625,
0.28662109375,
0.810546875,
0.24267578125,
0.060760498046875,
0.9794921875,
0.59375,
0.60107421875,
0.318115234375,
0.205810546875,
0.483642578125,
-0.53662109375,
0.236328125,
0.1646728515625,
-0.09515380859375,
-0.66259765625,
-0.0810546875,
-1.0595703125,
0.65380859375,
-0.58740234375,
-0.3427734375,
0.609375,
-0.505859375,
0.625,
-0.1572265625,
0.8017578125,
-0.50244140625,
0.292236328125,
0.358642578125,
-0.144775390625,
-0.63232421875,
1.10546875,
0.11834716796875,
0.278564453125,
0.24658203125,
0.92529296875,
-0.413330078125,
1.46484375,
-0.0625,
-0.56103515625,
0.0865478515625,
0.51123046875,
-0.5830078125,
-0.4482421875,
-0.65625,
-0.53466796875,
-0.1031494140625,
-0.7529296875,
-0.58056640625,
-0.1474609375,
0.12457275390625,
0.2158203125,
-1.1337890625,
-0.056243896484375,
0.12139892578125,
-0.806640625,
0.6123046875,
0.382568359375,
-0.0662841796875,
-0.165283203125,
0.1461181640625,
-0.29833984375,
-0.1446533203125,
-0.01068878173828125,
-0.351318359375,
0.58642578125,
-0.61279296875,
-0.417236328125,
-0.5419921875,
-0.5537109375,
-0.6064453125,
0.1649169921875,
-0.1375732421875,
-1.087890625,
0.509765625,
0.5185546875,
0.755859375,
0.478759765625,
-0.64404296875,
0.473876953125,
1.0087890625,
1.005859375,
-0.2242431640625,
0.8740234375,
-0.19873046875,
-0.966796875,
0.299072265625,
-0.251220703125,
0.5205078125,
-0.05767822265625,
0.1419677734375,
-0.1759033203125,
0.4111328125,
-0.37060546875,
-1.26171875,
-0.0438232421875,
0.68310546875,
0.266845703125,
-0.541015625,
-1.3134765625,
-0.399169921875,
-0.98876953125,
-0.1951904296875,
-0.4140625,
0.7109375,
-0.1229248046875,
0.049560546875,
-0.0550537109375,
-1.2763671875,
4.421875,
0.73681640625,
0.62939453125,
0.089599609375,
0.230712890625,
0.92333984375,
0.322021484375,
-0.384521484375,
-0.2213134765625,
-0.2861328125,
0.39306640625,
-0.60107421875,
-0.007373809814453125,
0.6484375,
0.377685546875,
0.65576171875,
-0.5556640625,
0.193359375,
-0.1761474609375,
-1.0625,
-0.88525390625,
0.403076171875,
-0.388427734375,
0.258056640625,
0.02716064453125,
0.515625,
0.599609375,
-0.55224609375,
0.09637451171875,
-0.82421875,
0.29443359375,
-0.30419921875,
0.58935546875,
-0.042449951171875,
-0.248779296875,
0.5537109375,
-0.14599609375,
-0.367431640625,
-0.282470703125,
-0.2236328125,
0.289794921875,
-0.107177734375,
0.82958984375,
-0.233642578125,
-0.333251953125,
0.509765625,
-0.6552734375,
0.57080078125,
0.12164306640625,
-0.91357421875,
0.90283203125,
-0.255615234375,
0.72021484375,
-0.66943359375,
-0.57080078125,
-0.26123046875,
0.2332763671875,
-0.04290771484375,
-0.2464599609375,
0.263427734375,
-0.1488037109375,
0.2890625,
-0.0491943359375,
0.46240234375,
-0.8916015625,
0.414306640625,
-0.329345703125,
0.26318359375,
-0.40234375,
-0.11102294921875,
-0.416259765625,
-0.1512451171875,
0.2161865234375,
-0.89990234375,
0.80029296875,
0.2459716796875,
-0.73681640625,
0.5751953125,
0.44775390625,
-0.8525390625,
0.2149658203125,
-0.40234375,
0.00710296630859375,
-0.1669921875,
0.45361328125,
0.7109375,
-0.48193359375,
-0.432373046875,
-0.08221435546875,
0.5810546875,
0.56591796875,
0.50146484375,
-0.034515380859375,
-0.1536865234375,
-0.1915283203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.
Let's assume that a song consists of some number of words. To make the dubstep remix of this song, Vasya inserts a certain number of words "WUB" before the first word of the song (the number may be zero), after the last word (the number may be zero), and between words (at least one between any pair of neighbouring words), and then the boy glues together all the words, including "WUB", in one string and plays the song at the club.
For example, a song with words "I AM X" can transform into a dubstep remix as "WUBWUBIWUBAMWUBWUBX" and cannot transform into "WUBWUBIAMWUBX".
Recently, Petya has heard Vasya's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Vasya remixed. Help Petya restore the original song.
Input
The input consists of a single non-empty string, consisting only of uppercase English letters, the string's length doesn't exceed 200 characters. It is guaranteed that before Vasya remixed the song, no word contained substring "WUB" in it; Vasya didn't change the word order. It is also guaranteed that initially the song had at least one word.
Output
Print the words of the initial song that Vasya used to make a dubsteb remix. Separate the words with a space.
Examples
Input
WUBWUBABCWUB
Output
ABC
Input
WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB
Output
WE ARE THE CHAMPIONS MY FRIEND
Note
In the first sample: "WUBWUBABCWUB" = "WUB" + "WUB" + "ABC" + "WUB". That means that the song originally consisted of a single word "ABC", and all words "WUB" were added by Vasya.
In the second sample Vasya added a single word "WUB" between all neighbouring words, in the beginning and in the end, except for words "ARE" and "THE" β between them Vasya added two "WUB".
Tags: strings
Correct Solution:
```
s = input()
storage = []
afterwub = False
started = False
i = 0
while i < len(s):
if s[i] == 'W' and len(storage) == 0:
storage.append(s[i])
elif s[i] == 'U' and len(storage) == 1:
storage.append(s[i])
elif s[i] == 'B' and len(storage) == 2:
#print('emptied')
storage = []
afterwub = True
else:
if afterwub and started:
afterwub = False
print(' ', end='')
if len(storage) > 0:
for j in storage:
print(j, end='')
storage = []
i -= 1
started = True
afterwub = False
else:
print(s[i], end='')
started = True
afterwub = False
i += 1
if storage:
if afterwub:
print(' ', end='')
for i in storage:
print(i, end='')
```
| 36,366
|
[
-0.05328369140625,
0.392333984375,
0.1739501953125,
0.1668701171875,
-0.399658203125,
-0.57080078125,
-0.55419921875,
0.0170440673828125,
-0.16796875,
0.7421875,
0.7333984375,
-0.12030029296875,
0.31396484375,
-1.0087890625,
-0.41162109375,
0.3095703125,
-0.68701171875,
-0.6337890625,
-0.88623046875,
-0.257568359375,
0.1256103515625,
-0.32568359375,
-1.3173828125,
-0.256103515625,
-0.5751953125,
0.892578125,
0.1962890625,
-0.0211639404296875,
0.75146484375,
0.96435546875,
0.25634765625,
-0.2188720703125,
0.373779296875,
-0.76708984375,
-0.1641845703125,
-0.318359375,
0.59716796875,
-0.7236328125,
-0.1507568359375,
-0.7001953125,
0.08184814453125,
-0.3388671875,
0.481201171875,
-0.70947265625,
-1.02734375,
0.09613037109375,
0.034942626953125,
-0.357666015625,
0.0264129638671875,
-0.50634765625,
0.06671142578125,
-0.220947265625,
0.63134765625,
0.14306640625,
0.3515625,
-0.316650390625,
-0.19287109375,
-0.1005859375,
-0.74658203125,
-0.09710693359375,
0.31298828125,
0.30126953125,
0.0233306884765625,
-0.71826171875,
-0.33251953125,
0.339599609375,
-0.12493896484375,
-0.5615234375,
0.1690673828125,
-0.6572265625,
-0.505859375,
0.061431884765625,
-0.56201171875,
-0.408203125,
-0.223876953125,
0.1866455078125,
0.017822265625,
-0.0279541015625,
-0.06689453125,
0.81591796875,
0.12249755859375,
1.068359375,
0.380615234375,
0.339111328125,
-0.63037109375,
-0.80810546875,
-0.10107421875,
0.19189453125,
0.400634765625,
0.10894775390625,
-0.26416015625,
0.5380859375,
-0.42724609375,
-0.05712890625,
0.5283203125,
0.73779296875,
-0.2222900390625,
0.208251953125,
-0.024017333984375,
0.145263671875,
0.60888671875,
0.98876953125,
-0.07147216796875,
0.6494140625,
-0.39404296875,
0.309326171875,
0.1478271484375,
0.404541015625,
-0.279052734375,
-0.468505859375,
-0.2349853515625,
-0.19970703125,
0.341796875,
0.292236328125,
-0.33935546875,
0.83984375,
-0.174560546875,
0.29345703125,
-1.14453125,
-0.09136962890625,
0.391845703125,
0.26708984375,
0.52978515625,
-0.047149658203125,
0.10302734375,
-0.71484375,
-0.7939453125,
1.08203125,
-0.6875,
-0.2147216796875,
0.57763671875,
0.0031528472900390625,
-0.260986328125,
0.3984375,
0.09527587890625,
0.48046875,
-0.135986328125,
0.67041015625,
0.794921875,
-0.481689453125,
0.77392578125,
-0.06036376953125,
-0.084228515625,
1.2978515625,
-0.0869140625,
-0.0325927734375,
0.8330078125,
0.497314453125,
-0.759765625,
0.1636962890625,
-0.66552734375,
0.57275390625,
0.46435546875,
-0.064453125,
-0.138427734375,
0.2183837890625,
-0.302978515625,
0.58642578125,
0.12335205078125,
0.11376953125,
-0.489013671875,
0.144775390625,
-0.415771484375,
0.5986328125,
-0.5380859375,
0.650390625,
-0.315185546875,
-0.19873046875,
-0.31640625,
-0.33935546875,
-0.0814208984375,
-0.197265625,
-0.07000732421875,
0.406005859375,
0.469970703125,
1.10546875,
0.97900390625,
-0.2322998046875,
0.341796875,
-0.058837890625,
-0.279541015625,
0.059722900390625,
0.67333984375,
0.69482421875,
0.291015625,
-0.02880859375,
-0.30419921875,
-0.697265625,
-0.41259765625,
-0.54248046875,
0.1375732421875,
0.7998046875,
-0.712890625,
-0.2095947265625,
0.400634765625,
0.040802001953125,
-0.445068359375,
0.12261962890625,
-0.07720947265625,
-0.88916015625,
-0.457275390625,
0.61962890625,
-0.307373046875,
0.673828125,
-0.2130126953125,
-0.405029296875,
0.125244140625,
1.162109375,
-0.07989501953125,
0.07049560546875,
0.9560546875,
-0.11956787109375,
-0.32373046875,
0.1142578125,
0.238037109375,
-0.366943359375,
-0.689453125,
0.359130859375,
-0.391845703125,
-0.0064544677734375,
-0.0159454345703125,
0.71484375,
0.5517578125,
0.047637939453125,
-0.059326171875,
-0.320556640625,
0.546875,
1.03515625,
-0.073974609375,
0.45556640625,
0.046478271484375,
1.0712890625,
0.236083984375,
0.841796875,
0.64208984375,
0.37060546875,
0.462158203125,
0.82763671875,
0.11669921875,
-0.0261993408203125,
-0.1514892578125,
0.7421875,
0.41552734375,
0.9482421875,
-0.159912109375,
0.440673828125,
0.1961669921875,
0.053619384765625,
-0.37451171875,
0.2164306640625,
-0.64208984375,
0.73095703125,
0.703125,
0.939453125,
-0.43505859375,
-0.52197265625,
0.237548828125,
0.54248046875,
-1.0537109375,
-0.837890625,
0.037384033203125,
-0.01019287109375,
0.222412109375,
0.2427978515625,
0.285888671875,
0.14306640625,
0.373046875,
0.450927734375,
-0.64208984375,
-0.5556640625,
-0.59375,
-0.98291015625,
-1.015625,
-0.615234375,
-0.25341796875,
-0.067626953125,
0.01305389404296875,
-0.814453125,
0.345703125,
0.4228515625,
-0.0268402099609375,
-0.392333984375,
-0.100341796875,
0.70703125,
-0.0177764892578125,
0.6845703125,
-0.79443359375,
0.84716796875,
-0.0771484375,
1.6767578125,
-0.65576171875,
-0.2298583984375,
-0.40185546875,
-0.73779296875,
0.451171875,
0.145751953125,
0.13330078125,
0.51708984375,
-0.476318359375,
-0.193115234375,
-0.4951171875,
-0.20751953125,
-0.46044921875,
0.6357421875,
-0.5107421875,
0.8857421875,
0.57177734375,
-0.5166015625,
0.447265625,
1.0771484375,
-0.93017578125,
0.671875,
0.234130859375,
0.369384765625,
-0.81201171875,
1.1669921875,
0.79638671875,
0.4375,
-0.5244140625,
-0.26953125,
-0.61669921875,
-0.06890869140625,
-0.02215576171875,
-0.40869140625,
-0.421630859375,
0.31884765625,
0.27685546875,
-1.185546875,
0.7353515625,
-1.3154296875,
-0.92236328125,
-0.347900390625,
-0.433349609375,
0.63671875,
0.82177734375,
0.053131103515625,
-0.35302734375,
0.154296875,
-0.34521484375,
0.630859375,
0.41748046875,
-0.8310546875,
0.418212890625,
0.71630859375,
-0.02886962890625,
0.478515625,
0.0869140625,
-0.6669921875,
-0.229736328125,
-0.11016845703125,
-0.00734710693359375,
0.556640625,
0.5244140625,
-0.28369140625,
0.145263671875,
0.411376953125,
-0.8388671875,
-0.18994140625,
0.0299835205078125,
0.80908203125,
0.3212890625,
0.587890625,
0.2529296875,
-0.66162109375,
-0.449462890625,
-0.84912109375,
0.482421875,
0.67919921875,
0.716796875,
-0.7822265625,
0.2021484375,
0.1700439453125,
-0.7666015625,
0.640625,
-0.779296875,
-0.1864013671875,
1.30078125,
-0.1898193359375,
0.50390625,
-0.923828125,
0.2010498046875,
-0.5390625,
0.406494140625,
0.210205078125,
0.309814453125,
0.60400390625,
-0.5478515625,
-0.49658203125,
0.1131591796875,
-0.06646728515625,
-0.158935546875,
-0.457275390625,
0.53369140625,
-0.8876953125,
-0.24072265625,
-0.873046875,
0.56103515625,
0.7080078125,
0.50927734375,
0.353271484375,
0.8662109375,
0.46142578125,
0.413818359375,
0.5205078125,
0.08587646484375,
0.014984130859375,
-0.669921875,
0.36962890625,
0.1761474609375,
-0.01389312744140625,
-0.42529296875,
-0.44873046875,
-0.572265625,
0.32568359375,
0.23291015625,
0.275634765625,
-0.78564453125,
0.0299072265625,
-0.1953125,
0.4677734375,
-0.6806640625,
-0.334228515625,
-0.63623046875,
0.369140625,
0.278564453125,
-0.81640625,
0.324951171875,
-0.884765625,
0.66552734375,
0.59521484375,
-0.3828125,
-0.67626953125,
-0.25390625,
-0.450439453125,
-0.379638671875,
0.10833740234375,
0.77783203125,
0.07489013671875,
0.404052734375,
-1.0185546875,
0.6533203125,
0.138671875,
-0.1829833984375,
-0.0836181640625,
0.2064208984375,
0.3408203125,
0.014068603515625,
0.489501953125,
-0.5517578125,
-0.5419921875,
0.21240234375,
-1.3984375,
0.75390625,
-0.55078125,
0.6845703125,
-0.02703857421875,
-0.05926513671875,
0.0214691162109375,
0.120849609375,
-0.052947998046875,
0.07861328125,
-0.258544921875,
0.358154296875,
-1.1083984375,
-0.432373046875,
0.68408203125,
-0.25927734375,
-0.2406005859375,
0.86376953125,
0.220458984375,
-0.65966796875,
-0.047027587890625,
0.53662109375,
-0.34326171875,
0.2166748046875,
-0.77490234375,
0.5185546875,
-0.58056640625,
-0.351318359375,
-0.324462890625,
-0.391357421875,
0.8583984375,
0.1927490234375,
-0.73583984375,
-0.1898193359375,
-1.3740234375,
-0.1651611328125,
-0.01192474365234375,
-0.70361328125,
0.327880859375,
0.115966796875,
0.1319580078125,
0.29150390625,
-0.24658203125,
-0.33203125,
-0.466796875,
-0.9736328125,
-0.246337890625,
0.08612060546875,
0.370849609375,
0.822265625,
-0.286376953125,
-0.424560546875,
0.1636962890625,
0.375,
0.0440673828125,
-0.380859375,
-0.448974609375,
-0.1387939453125,
-0.60205078125,
0.0948486328125,
0.8681640625,
-0.07647705078125,
0.448974609375,
1.158203125,
0.27001953125,
0.286865234375,
0.11785888671875,
-0.578125,
0.912109375,
0.41357421875,
-0.99560546875,
-0.368896484375,
0.5625,
-0.03924560546875,
0.5693359375,
0.395263671875,
-0.4912109375,
-0.97607421875,
-1.15625,
-0.0279083251953125,
-0.95751953125,
-0.140625,
-1.037109375,
-0.46337890625,
-0.7412109375,
0.84619140625,
-0.371337890625,
-0.595703125,
0.244384765625,
-1.03125,
-0.034576416015625,
-0.62353515625,
-0.308349609375,
-0.260009765625,
-0.5078125,
-0.073974609375,
0.77294921875,
-0.355224609375,
0.826171875,
0.206298828125,
-0.1597900390625,
0.1529541015625,
-0.430419921875,
-0.59375,
-0.41943359375,
-0.2281494140625,
-0.4013671875,
0.141357421875,
-0.0193634033203125,
-0.357421875,
1.2490234375,
-1.1513671875,
0.10662841796875,
-0.346923828125,
-0.430908203125,
0.1461181640625,
0.1287841796875,
1.2236328125,
-0.126220703125,
0.0538330078125,
-0.12939453125,
0.72998046875,
0.45361328125,
-0.06182861328125,
-0.270751953125,
-0.9189453125,
-0.830078125,
-0.9873046875,
0.484619140625,
-0.250732421875,
0.33349609375,
-0.17041015625,
0.1025390625,
0.84326171875,
-0.20751953125,
0.376953125,
0.6982421875,
0.4521484375,
0.447265625,
-0.52197265625,
0.5556640625,
0.35205078125,
-0.69921875,
-0.37646484375,
0.1668701171875,
-0.71875,
0.045135498046875,
-0.3466796875,
-0.74658203125,
-0.25537109375,
-0.2369384765625,
1.421875,
-0.37060546875,
0.93359375,
-0.177490234375,
-0.890625,
-0.443603515625,
0.546875,
0.1685791015625,
-0.02386474609375,
0.8994140625,
-0.2264404296875,
0.27880859375,
-0.29736328125,
-0.26708984375,
-0.61865234375,
-0.051971435546875,
0.90234375,
-0.336181640625,
-0.52197265625,
1.07421875,
0.748046875,
-0.62255859375,
-0.83203125,
-0.50048828125,
-0.42919921875,
0.041900634765625,
-1.0126953125,
0.58984375,
0.19970703125,
-0.57421875,
0.145751953125,
0.69384765625,
0.00933837890625,
0.404541015625,
0.08343505859375,
0.131591796875,
-0.3603515625,
0.320556640625,
0.4755859375,
-0.483642578125,
-0.6396484375,
-0.7275390625,
-0.07733154296875,
-0.3173828125,
0.311767578125,
0.84130859375,
-0.261962890625,
0.53564453125,
0.59521484375,
-0.1949462890625,
0.65869140625,
-0.440185546875,
0.202392578125,
-0.020233154296875,
-0.81201171875,
-0.88818359375,
0.31103515625,
0.347900390625,
-0.5595703125,
0.26416015625,
-1.00390625,
0.33642578125,
0.229248046875,
0.39453125,
-0.1260986328125,
-1.091796875,
-0.54638671875,
-1.2607421875,
-0.429931640625,
-0.18701171875,
-0.055267333984375,
0.1136474609375,
0.55517578125,
0.0246124267578125,
-0.5458984375,
0.0009927749633789062,
0.44287109375,
-0.358154296875,
0.9873046875,
-0.626953125,
0.78857421875,
-0.78466796875,
-0.318359375,
-0.5625,
0.126708984375,
-0.496337890625,
-0.611328125,
-0.6591796875,
0.287841796875,
-0.1556396484375,
0.20751953125,
-0.45703125,
0.52392578125,
-0.138671875,
-0.2216796875,
0.1207275390625,
-0.0143280029296875,
-0.448486328125,
0.86669921875,
0.74072265625,
-0.041412353515625,
0.2822265625,
0.07464599609375,
-0.52587890625,
-0.2139892578125,
0.2425537109375,
0.72900390625,
-0.276123046875,
0.07147216796875,
-0.304931640625,
-0.09320068359375,
-0.982421875,
0.27294921875,
-0.06402587890625,
0.1165771484375,
0.5927734375,
-0.428955078125,
0.302490234375,
1.0634765625,
-0.356201171875,
0.42626953125,
0.436279296875,
0.262939453125,
0.365966796875,
0.28759765625,
-0.1815185546875,
0.380126953125,
0.2017822265625,
-0.35107421875,
-0.25439453125,
0.71484375,
-0.2000732421875,
0.232421875,
-0.5107421875,
-1.009765625,
-0.91796875,
-0.3603515625,
0.2432861328125,
0.5966796875,
0.0194549560546875,
-0.32373046875,
0.266357421875,
-0.1312255859375,
-0.69677734375,
0.22705078125,
-1.0234375,
-0.7978515625,
0.348388671875,
-0.08154296875,
-0.7880859375,
-0.33056640625,
-0.317138671875,
-0.154541015625,
0.27587890625,
0.25244140625,
-0.343017578125,
0.387451171875,
-0.1683349609375,
0.06378173828125,
-0.240234375,
0.0625,
0.1361083984375,
0.397216796875,
-0.34423828125,
-0.28955078125,
0.53662109375,
1.20703125,
0.131591796875,
-0.451416015625,
-0.591796875,
0.289306640625,
-0.38427734375,
-0.053985595703125,
-0.638671875,
0.244384765625,
0.04461669921875,
0.65478515625,
-0.77490234375,
-0.1104736328125,
-0.09515380859375,
0.431640625,
0.2447509765625,
-0.3984375,
-0.449462890625,
0.98095703125,
0.54833984375,
-0.1181640625,
0.299560546875,
-0.0299072265625,
0.493896484375,
-0.1578369140625,
-0.395263671875,
-0.283935546875,
0.8017578125,
0.74072265625,
0.6298828125,
-0.2646484375,
0.257080078125,
0.62548828125,
0.17578125,
0.35693359375,
0.68115234375,
0.55615234375,
-0.365234375,
0.1148681640625,
-0.30859375,
-0.256591796875,
-0.034912109375,
-0.453369140625,
0.6123046875,
0.16796875,
0.01535797119140625,
-0.201904296875,
-0.68115234375,
0.64892578125,
-0.151611328125,
-0.344482421875,
-0.11151123046875,
-0.0953369140625,
0.28662109375,
0.810546875,
0.24267578125,
0.060760498046875,
0.9794921875,
0.59375,
0.60107421875,
0.318115234375,
0.205810546875,
0.483642578125,
-0.53662109375,
0.236328125,
0.1646728515625,
-0.09515380859375,
-0.66259765625,
-0.0810546875,
-1.0595703125,
0.65380859375,
-0.58740234375,
-0.3427734375,
0.609375,
-0.505859375,
0.625,
-0.1572265625,
0.8017578125,
-0.50244140625,
0.292236328125,
0.358642578125,
-0.144775390625,
-0.63232421875,
1.10546875,
0.11834716796875,
0.278564453125,
0.24658203125,
0.92529296875,
-0.413330078125,
1.46484375,
-0.0625,
-0.56103515625,
0.0865478515625,
0.51123046875,
-0.5830078125,
-0.4482421875,
-0.65625,
-0.53466796875,
-0.1031494140625,
-0.7529296875,
-0.58056640625,
-0.1474609375,
0.12457275390625,
0.2158203125,
-1.1337890625,
-0.056243896484375,
0.12139892578125,
-0.806640625,
0.6123046875,
0.382568359375,
-0.0662841796875,
-0.165283203125,
0.1461181640625,
-0.29833984375,
-0.1446533203125,
-0.01068878173828125,
-0.351318359375,
0.58642578125,
-0.61279296875,
-0.417236328125,
-0.5419921875,
-0.5537109375,
-0.6064453125,
0.1649169921875,
-0.1375732421875,
-1.087890625,
0.509765625,
0.5185546875,
0.755859375,
0.478759765625,
-0.64404296875,
0.473876953125,
1.0087890625,
1.005859375,
-0.2242431640625,
0.8740234375,
-0.19873046875,
-0.966796875,
0.299072265625,
-0.251220703125,
0.5205078125,
-0.05767822265625,
0.1419677734375,
-0.1759033203125,
0.4111328125,
-0.37060546875,
-1.26171875,
-0.0438232421875,
0.68310546875,
0.266845703125,
-0.541015625,
-1.3134765625,
-0.399169921875,
-0.98876953125,
-0.1951904296875,
-0.4140625,
0.7109375,
-0.1229248046875,
0.049560546875,
-0.0550537109375,
-1.2763671875,
4.421875,
0.73681640625,
0.62939453125,
0.089599609375,
0.230712890625,
0.92333984375,
0.322021484375,
-0.384521484375,
-0.2213134765625,
-0.2861328125,
0.39306640625,
-0.60107421875,
-0.007373809814453125,
0.6484375,
0.377685546875,
0.65576171875,
-0.5556640625,
0.193359375,
-0.1761474609375,
-1.0625,
-0.88525390625,
0.403076171875,
-0.388427734375,
0.258056640625,
0.02716064453125,
0.515625,
0.599609375,
-0.55224609375,
0.09637451171875,
-0.82421875,
0.29443359375,
-0.30419921875,
0.58935546875,
-0.042449951171875,
-0.248779296875,
0.5537109375,
-0.14599609375,
-0.367431640625,
-0.282470703125,
-0.2236328125,
0.289794921875,
-0.107177734375,
0.82958984375,
-0.233642578125,
-0.333251953125,
0.509765625,
-0.6552734375,
0.57080078125,
0.12164306640625,
-0.91357421875,
0.90283203125,
-0.255615234375,
0.72021484375,
-0.66943359375,
-0.57080078125,
-0.26123046875,
0.2332763671875,
-0.04290771484375,
-0.2464599609375,
0.263427734375,
-0.1488037109375,
0.2890625,
-0.0491943359375,
0.46240234375,
-0.8916015625,
0.414306640625,
-0.329345703125,
0.26318359375,
-0.40234375,
-0.11102294921875,
-0.416259765625,
-0.1512451171875,
0.2161865234375,
-0.89990234375,
0.80029296875,
0.2459716796875,
-0.73681640625,
0.5751953125,
0.44775390625,
-0.8525390625,
0.2149658203125,
-0.40234375,
0.00710296630859375,
-0.1669921875,
0.45361328125,
0.7109375,
-0.48193359375,
-0.432373046875,
-0.08221435546875,
0.5810546875,
0.56591796875,
0.50146484375,
-0.034515380859375,
-0.1536865234375,
-0.1915283203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.
Let's assume that a song consists of some number of words. To make the dubstep remix of this song, Vasya inserts a certain number of words "WUB" before the first word of the song (the number may be zero), after the last word (the number may be zero), and between words (at least one between any pair of neighbouring words), and then the boy glues together all the words, including "WUB", in one string and plays the song at the club.
For example, a song with words "I AM X" can transform into a dubstep remix as "WUBWUBIWUBAMWUBWUBX" and cannot transform into "WUBWUBIAMWUBX".
Recently, Petya has heard Vasya's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Vasya remixed. Help Petya restore the original song.
Input
The input consists of a single non-empty string, consisting only of uppercase English letters, the string's length doesn't exceed 200 characters. It is guaranteed that before Vasya remixed the song, no word contained substring "WUB" in it; Vasya didn't change the word order. It is also guaranteed that initially the song had at least one word.
Output
Print the words of the initial song that Vasya used to make a dubsteb remix. Separate the words with a space.
Examples
Input
WUBWUBABCWUB
Output
ABC
Input
WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB
Output
WE ARE THE CHAMPIONS MY FRIEND
Note
In the first sample: "WUBWUBABCWUB" = "WUB" + "WUB" + "ABC" + "WUB". That means that the song originally consisted of a single word "ABC", and all words "WUB" were added by Vasya.
In the second sample Vasya added a single word "WUB" between all neighbouring words, in the beginning and in the end, except for words "ARE" and "THE" β between them Vasya added two "WUB".
Tags: strings
Correct Solution:
```
s = input()
if "WUB" in s:
x = s.replace("WUB"," ").strip()
print(x)
else:
print(s)
```
| 36,367
|
[
-0.05328369140625,
0.392333984375,
0.1739501953125,
0.1668701171875,
-0.399658203125,
-0.57080078125,
-0.55419921875,
0.0170440673828125,
-0.16796875,
0.7421875,
0.7333984375,
-0.12030029296875,
0.31396484375,
-1.0087890625,
-0.41162109375,
0.3095703125,
-0.68701171875,
-0.6337890625,
-0.88623046875,
-0.257568359375,
0.1256103515625,
-0.32568359375,
-1.3173828125,
-0.256103515625,
-0.5751953125,
0.892578125,
0.1962890625,
-0.0211639404296875,
0.75146484375,
0.96435546875,
0.25634765625,
-0.2188720703125,
0.373779296875,
-0.76708984375,
-0.1641845703125,
-0.318359375,
0.59716796875,
-0.7236328125,
-0.1507568359375,
-0.7001953125,
0.08184814453125,
-0.3388671875,
0.481201171875,
-0.70947265625,
-1.02734375,
0.09613037109375,
0.034942626953125,
-0.357666015625,
0.0264129638671875,
-0.50634765625,
0.06671142578125,
-0.220947265625,
0.63134765625,
0.14306640625,
0.3515625,
-0.316650390625,
-0.19287109375,
-0.1005859375,
-0.74658203125,
-0.09710693359375,
0.31298828125,
0.30126953125,
0.0233306884765625,
-0.71826171875,
-0.33251953125,
0.339599609375,
-0.12493896484375,
-0.5615234375,
0.1690673828125,
-0.6572265625,
-0.505859375,
0.061431884765625,
-0.56201171875,
-0.408203125,
-0.223876953125,
0.1866455078125,
0.017822265625,
-0.0279541015625,
-0.06689453125,
0.81591796875,
0.12249755859375,
1.068359375,
0.380615234375,
0.339111328125,
-0.63037109375,
-0.80810546875,
-0.10107421875,
0.19189453125,
0.400634765625,
0.10894775390625,
-0.26416015625,
0.5380859375,
-0.42724609375,
-0.05712890625,
0.5283203125,
0.73779296875,
-0.2222900390625,
0.208251953125,
-0.024017333984375,
0.145263671875,
0.60888671875,
0.98876953125,
-0.07147216796875,
0.6494140625,
-0.39404296875,
0.309326171875,
0.1478271484375,
0.404541015625,
-0.279052734375,
-0.468505859375,
-0.2349853515625,
-0.19970703125,
0.341796875,
0.292236328125,
-0.33935546875,
0.83984375,
-0.174560546875,
0.29345703125,
-1.14453125,
-0.09136962890625,
0.391845703125,
0.26708984375,
0.52978515625,
-0.047149658203125,
0.10302734375,
-0.71484375,
-0.7939453125,
1.08203125,
-0.6875,
-0.2147216796875,
0.57763671875,
0.0031528472900390625,
-0.260986328125,
0.3984375,
0.09527587890625,
0.48046875,
-0.135986328125,
0.67041015625,
0.794921875,
-0.481689453125,
0.77392578125,
-0.06036376953125,
-0.084228515625,
1.2978515625,
-0.0869140625,
-0.0325927734375,
0.8330078125,
0.497314453125,
-0.759765625,
0.1636962890625,
-0.66552734375,
0.57275390625,
0.46435546875,
-0.064453125,
-0.138427734375,
0.2183837890625,
-0.302978515625,
0.58642578125,
0.12335205078125,
0.11376953125,
-0.489013671875,
0.144775390625,
-0.415771484375,
0.5986328125,
-0.5380859375,
0.650390625,
-0.315185546875,
-0.19873046875,
-0.31640625,
-0.33935546875,
-0.0814208984375,
-0.197265625,
-0.07000732421875,
0.406005859375,
0.469970703125,
1.10546875,
0.97900390625,
-0.2322998046875,
0.341796875,
-0.058837890625,
-0.279541015625,
0.059722900390625,
0.67333984375,
0.69482421875,
0.291015625,
-0.02880859375,
-0.30419921875,
-0.697265625,
-0.41259765625,
-0.54248046875,
0.1375732421875,
0.7998046875,
-0.712890625,
-0.2095947265625,
0.400634765625,
0.040802001953125,
-0.445068359375,
0.12261962890625,
-0.07720947265625,
-0.88916015625,
-0.457275390625,
0.61962890625,
-0.307373046875,
0.673828125,
-0.2130126953125,
-0.405029296875,
0.125244140625,
1.162109375,
-0.07989501953125,
0.07049560546875,
0.9560546875,
-0.11956787109375,
-0.32373046875,
0.1142578125,
0.238037109375,
-0.366943359375,
-0.689453125,
0.359130859375,
-0.391845703125,
-0.0064544677734375,
-0.0159454345703125,
0.71484375,
0.5517578125,
0.047637939453125,
-0.059326171875,
-0.320556640625,
0.546875,
1.03515625,
-0.073974609375,
0.45556640625,
0.046478271484375,
1.0712890625,
0.236083984375,
0.841796875,
0.64208984375,
0.37060546875,
0.462158203125,
0.82763671875,
0.11669921875,
-0.0261993408203125,
-0.1514892578125,
0.7421875,
0.41552734375,
0.9482421875,
-0.159912109375,
0.440673828125,
0.1961669921875,
0.053619384765625,
-0.37451171875,
0.2164306640625,
-0.64208984375,
0.73095703125,
0.703125,
0.939453125,
-0.43505859375,
-0.52197265625,
0.237548828125,
0.54248046875,
-1.0537109375,
-0.837890625,
0.037384033203125,
-0.01019287109375,
0.222412109375,
0.2427978515625,
0.285888671875,
0.14306640625,
0.373046875,
0.450927734375,
-0.64208984375,
-0.5556640625,
-0.59375,
-0.98291015625,
-1.015625,
-0.615234375,
-0.25341796875,
-0.067626953125,
0.01305389404296875,
-0.814453125,
0.345703125,
0.4228515625,
-0.0268402099609375,
-0.392333984375,
-0.100341796875,
0.70703125,
-0.0177764892578125,
0.6845703125,
-0.79443359375,
0.84716796875,
-0.0771484375,
1.6767578125,
-0.65576171875,
-0.2298583984375,
-0.40185546875,
-0.73779296875,
0.451171875,
0.145751953125,
0.13330078125,
0.51708984375,
-0.476318359375,
-0.193115234375,
-0.4951171875,
-0.20751953125,
-0.46044921875,
0.6357421875,
-0.5107421875,
0.8857421875,
0.57177734375,
-0.5166015625,
0.447265625,
1.0771484375,
-0.93017578125,
0.671875,
0.234130859375,
0.369384765625,
-0.81201171875,
1.1669921875,
0.79638671875,
0.4375,
-0.5244140625,
-0.26953125,
-0.61669921875,
-0.06890869140625,
-0.02215576171875,
-0.40869140625,
-0.421630859375,
0.31884765625,
0.27685546875,
-1.185546875,
0.7353515625,
-1.3154296875,
-0.92236328125,
-0.347900390625,
-0.433349609375,
0.63671875,
0.82177734375,
0.053131103515625,
-0.35302734375,
0.154296875,
-0.34521484375,
0.630859375,
0.41748046875,
-0.8310546875,
0.418212890625,
0.71630859375,
-0.02886962890625,
0.478515625,
0.0869140625,
-0.6669921875,
-0.229736328125,
-0.11016845703125,
-0.00734710693359375,
0.556640625,
0.5244140625,
-0.28369140625,
0.145263671875,
0.411376953125,
-0.8388671875,
-0.18994140625,
0.0299835205078125,
0.80908203125,
0.3212890625,
0.587890625,
0.2529296875,
-0.66162109375,
-0.449462890625,
-0.84912109375,
0.482421875,
0.67919921875,
0.716796875,
-0.7822265625,
0.2021484375,
0.1700439453125,
-0.7666015625,
0.640625,
-0.779296875,
-0.1864013671875,
1.30078125,
-0.1898193359375,
0.50390625,
-0.923828125,
0.2010498046875,
-0.5390625,
0.406494140625,
0.210205078125,
0.309814453125,
0.60400390625,
-0.5478515625,
-0.49658203125,
0.1131591796875,
-0.06646728515625,
-0.158935546875,
-0.457275390625,
0.53369140625,
-0.8876953125,
-0.24072265625,
-0.873046875,
0.56103515625,
0.7080078125,
0.50927734375,
0.353271484375,
0.8662109375,
0.46142578125,
0.413818359375,
0.5205078125,
0.08587646484375,
0.014984130859375,
-0.669921875,
0.36962890625,
0.1761474609375,
-0.01389312744140625,
-0.42529296875,
-0.44873046875,
-0.572265625,
0.32568359375,
0.23291015625,
0.275634765625,
-0.78564453125,
0.0299072265625,
-0.1953125,
0.4677734375,
-0.6806640625,
-0.334228515625,
-0.63623046875,
0.369140625,
0.278564453125,
-0.81640625,
0.324951171875,
-0.884765625,
0.66552734375,
0.59521484375,
-0.3828125,
-0.67626953125,
-0.25390625,
-0.450439453125,
-0.379638671875,
0.10833740234375,
0.77783203125,
0.07489013671875,
0.404052734375,
-1.0185546875,
0.6533203125,
0.138671875,
-0.1829833984375,
-0.0836181640625,
0.2064208984375,
0.3408203125,
0.014068603515625,
0.489501953125,
-0.5517578125,
-0.5419921875,
0.21240234375,
-1.3984375,
0.75390625,
-0.55078125,
0.6845703125,
-0.02703857421875,
-0.05926513671875,
0.0214691162109375,
0.120849609375,
-0.052947998046875,
0.07861328125,
-0.258544921875,
0.358154296875,
-1.1083984375,
-0.432373046875,
0.68408203125,
-0.25927734375,
-0.2406005859375,
0.86376953125,
0.220458984375,
-0.65966796875,
-0.047027587890625,
0.53662109375,
-0.34326171875,
0.2166748046875,
-0.77490234375,
0.5185546875,
-0.58056640625,
-0.351318359375,
-0.324462890625,
-0.391357421875,
0.8583984375,
0.1927490234375,
-0.73583984375,
-0.1898193359375,
-1.3740234375,
-0.1651611328125,
-0.01192474365234375,
-0.70361328125,
0.327880859375,
0.115966796875,
0.1319580078125,
0.29150390625,
-0.24658203125,
-0.33203125,
-0.466796875,
-0.9736328125,
-0.246337890625,
0.08612060546875,
0.370849609375,
0.822265625,
-0.286376953125,
-0.424560546875,
0.1636962890625,
0.375,
0.0440673828125,
-0.380859375,
-0.448974609375,
-0.1387939453125,
-0.60205078125,
0.0948486328125,
0.8681640625,
-0.07647705078125,
0.448974609375,
1.158203125,
0.27001953125,
0.286865234375,
0.11785888671875,
-0.578125,
0.912109375,
0.41357421875,
-0.99560546875,
-0.368896484375,
0.5625,
-0.03924560546875,
0.5693359375,
0.395263671875,
-0.4912109375,
-0.97607421875,
-1.15625,
-0.0279083251953125,
-0.95751953125,
-0.140625,
-1.037109375,
-0.46337890625,
-0.7412109375,
0.84619140625,
-0.371337890625,
-0.595703125,
0.244384765625,
-1.03125,
-0.034576416015625,
-0.62353515625,
-0.308349609375,
-0.260009765625,
-0.5078125,
-0.073974609375,
0.77294921875,
-0.355224609375,
0.826171875,
0.206298828125,
-0.1597900390625,
0.1529541015625,
-0.430419921875,
-0.59375,
-0.41943359375,
-0.2281494140625,
-0.4013671875,
0.141357421875,
-0.0193634033203125,
-0.357421875,
1.2490234375,
-1.1513671875,
0.10662841796875,
-0.346923828125,
-0.430908203125,
0.1461181640625,
0.1287841796875,
1.2236328125,
-0.126220703125,
0.0538330078125,
-0.12939453125,
0.72998046875,
0.45361328125,
-0.06182861328125,
-0.270751953125,
-0.9189453125,
-0.830078125,
-0.9873046875,
0.484619140625,
-0.250732421875,
0.33349609375,
-0.17041015625,
0.1025390625,
0.84326171875,
-0.20751953125,
0.376953125,
0.6982421875,
0.4521484375,
0.447265625,
-0.52197265625,
0.5556640625,
0.35205078125,
-0.69921875,
-0.37646484375,
0.1668701171875,
-0.71875,
0.045135498046875,
-0.3466796875,
-0.74658203125,
-0.25537109375,
-0.2369384765625,
1.421875,
-0.37060546875,
0.93359375,
-0.177490234375,
-0.890625,
-0.443603515625,
0.546875,
0.1685791015625,
-0.02386474609375,
0.8994140625,
-0.2264404296875,
0.27880859375,
-0.29736328125,
-0.26708984375,
-0.61865234375,
-0.051971435546875,
0.90234375,
-0.336181640625,
-0.52197265625,
1.07421875,
0.748046875,
-0.62255859375,
-0.83203125,
-0.50048828125,
-0.42919921875,
0.041900634765625,
-1.0126953125,
0.58984375,
0.19970703125,
-0.57421875,
0.145751953125,
0.69384765625,
0.00933837890625,
0.404541015625,
0.08343505859375,
0.131591796875,
-0.3603515625,
0.320556640625,
0.4755859375,
-0.483642578125,
-0.6396484375,
-0.7275390625,
-0.07733154296875,
-0.3173828125,
0.311767578125,
0.84130859375,
-0.261962890625,
0.53564453125,
0.59521484375,
-0.1949462890625,
0.65869140625,
-0.440185546875,
0.202392578125,
-0.020233154296875,
-0.81201171875,
-0.88818359375,
0.31103515625,
0.347900390625,
-0.5595703125,
0.26416015625,
-1.00390625,
0.33642578125,
0.229248046875,
0.39453125,
-0.1260986328125,
-1.091796875,
-0.54638671875,
-1.2607421875,
-0.429931640625,
-0.18701171875,
-0.055267333984375,
0.1136474609375,
0.55517578125,
0.0246124267578125,
-0.5458984375,
0.0009927749633789062,
0.44287109375,
-0.358154296875,
0.9873046875,
-0.626953125,
0.78857421875,
-0.78466796875,
-0.318359375,
-0.5625,
0.126708984375,
-0.496337890625,
-0.611328125,
-0.6591796875,
0.287841796875,
-0.1556396484375,
0.20751953125,
-0.45703125,
0.52392578125,
-0.138671875,
-0.2216796875,
0.1207275390625,
-0.0143280029296875,
-0.448486328125,
0.86669921875,
0.74072265625,
-0.041412353515625,
0.2822265625,
0.07464599609375,
-0.52587890625,
-0.2139892578125,
0.2425537109375,
0.72900390625,
-0.276123046875,
0.07147216796875,
-0.304931640625,
-0.09320068359375,
-0.982421875,
0.27294921875,
-0.06402587890625,
0.1165771484375,
0.5927734375,
-0.428955078125,
0.302490234375,
1.0634765625,
-0.356201171875,
0.42626953125,
0.436279296875,
0.262939453125,
0.365966796875,
0.28759765625,
-0.1815185546875,
0.380126953125,
0.2017822265625,
-0.35107421875,
-0.25439453125,
0.71484375,
-0.2000732421875,
0.232421875,
-0.5107421875,
-1.009765625,
-0.91796875,
-0.3603515625,
0.2432861328125,
0.5966796875,
0.0194549560546875,
-0.32373046875,
0.266357421875,
-0.1312255859375,
-0.69677734375,
0.22705078125,
-1.0234375,
-0.7978515625,
0.348388671875,
-0.08154296875,
-0.7880859375,
-0.33056640625,
-0.317138671875,
-0.154541015625,
0.27587890625,
0.25244140625,
-0.343017578125,
0.387451171875,
-0.1683349609375,
0.06378173828125,
-0.240234375,
0.0625,
0.1361083984375,
0.397216796875,
-0.34423828125,
-0.28955078125,
0.53662109375,
1.20703125,
0.131591796875,
-0.451416015625,
-0.591796875,
0.289306640625,
-0.38427734375,
-0.053985595703125,
-0.638671875,
0.244384765625,
0.04461669921875,
0.65478515625,
-0.77490234375,
-0.1104736328125,
-0.09515380859375,
0.431640625,
0.2447509765625,
-0.3984375,
-0.449462890625,
0.98095703125,
0.54833984375,
-0.1181640625,
0.299560546875,
-0.0299072265625,
0.493896484375,
-0.1578369140625,
-0.395263671875,
-0.283935546875,
0.8017578125,
0.74072265625,
0.6298828125,
-0.2646484375,
0.257080078125,
0.62548828125,
0.17578125,
0.35693359375,
0.68115234375,
0.55615234375,
-0.365234375,
0.1148681640625,
-0.30859375,
-0.256591796875,
-0.034912109375,
-0.453369140625,
0.6123046875,
0.16796875,
0.01535797119140625,
-0.201904296875,
-0.68115234375,
0.64892578125,
-0.151611328125,
-0.344482421875,
-0.11151123046875,
-0.0953369140625,
0.28662109375,
0.810546875,
0.24267578125,
0.060760498046875,
0.9794921875,
0.59375,
0.60107421875,
0.318115234375,
0.205810546875,
0.483642578125,
-0.53662109375,
0.236328125,
0.1646728515625,
-0.09515380859375,
-0.66259765625,
-0.0810546875,
-1.0595703125,
0.65380859375,
-0.58740234375,
-0.3427734375,
0.609375,
-0.505859375,
0.625,
-0.1572265625,
0.8017578125,
-0.50244140625,
0.292236328125,
0.358642578125,
-0.144775390625,
-0.63232421875,
1.10546875,
0.11834716796875,
0.278564453125,
0.24658203125,
0.92529296875,
-0.413330078125,
1.46484375,
-0.0625,
-0.56103515625,
0.0865478515625,
0.51123046875,
-0.5830078125,
-0.4482421875,
-0.65625,
-0.53466796875,
-0.1031494140625,
-0.7529296875,
-0.58056640625,
-0.1474609375,
0.12457275390625,
0.2158203125,
-1.1337890625,
-0.056243896484375,
0.12139892578125,
-0.806640625,
0.6123046875,
0.382568359375,
-0.0662841796875,
-0.165283203125,
0.1461181640625,
-0.29833984375,
-0.1446533203125,
-0.01068878173828125,
-0.351318359375,
0.58642578125,
-0.61279296875,
-0.417236328125,
-0.5419921875,
-0.5537109375,
-0.6064453125,
0.1649169921875,
-0.1375732421875,
-1.087890625,
0.509765625,
0.5185546875,
0.755859375,
0.478759765625,
-0.64404296875,
0.473876953125,
1.0087890625,
1.005859375,
-0.2242431640625,
0.8740234375,
-0.19873046875,
-0.966796875,
0.299072265625,
-0.251220703125,
0.5205078125,
-0.05767822265625,
0.1419677734375,
-0.1759033203125,
0.4111328125,
-0.37060546875,
-1.26171875,
-0.0438232421875,
0.68310546875,
0.266845703125,
-0.541015625,
-1.3134765625,
-0.399169921875,
-0.98876953125,
-0.1951904296875,
-0.4140625,
0.7109375,
-0.1229248046875,
0.049560546875,
-0.0550537109375,
-1.2763671875,
4.421875,
0.73681640625,
0.62939453125,
0.089599609375,
0.230712890625,
0.92333984375,
0.322021484375,
-0.384521484375,
-0.2213134765625,
-0.2861328125,
0.39306640625,
-0.60107421875,
-0.007373809814453125,
0.6484375,
0.377685546875,
0.65576171875,
-0.5556640625,
0.193359375,
-0.1761474609375,
-1.0625,
-0.88525390625,
0.403076171875,
-0.388427734375,
0.258056640625,
0.02716064453125,
0.515625,
0.599609375,
-0.55224609375,
0.09637451171875,
-0.82421875,
0.29443359375,
-0.30419921875,
0.58935546875,
-0.042449951171875,
-0.248779296875,
0.5537109375,
-0.14599609375,
-0.367431640625,
-0.282470703125,
-0.2236328125,
0.289794921875,
-0.107177734375,
0.82958984375,
-0.233642578125,
-0.333251953125,
0.509765625,
-0.6552734375,
0.57080078125,
0.12164306640625,
-0.91357421875,
0.90283203125,
-0.255615234375,
0.72021484375,
-0.66943359375,
-0.57080078125,
-0.26123046875,
0.2332763671875,
-0.04290771484375,
-0.2464599609375,
0.263427734375,
-0.1488037109375,
0.2890625,
-0.0491943359375,
0.46240234375,
-0.8916015625,
0.414306640625,
-0.329345703125,
0.26318359375,
-0.40234375,
-0.11102294921875,
-0.416259765625,
-0.1512451171875,
0.2161865234375,
-0.89990234375,
0.80029296875,
0.2459716796875,
-0.73681640625,
0.5751953125,
0.44775390625,
-0.8525390625,
0.2149658203125,
-0.40234375,
0.00710296630859375,
-0.1669921875,
0.45361328125,
0.7109375,
-0.48193359375,
-0.432373046875,
-0.08221435546875,
0.5810546875,
0.56591796875,
0.50146484375,
-0.034515380859375,
-0.1536865234375,
-0.1915283203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.
Let's assume that a song consists of some number of words. To make the dubstep remix of this song, Vasya inserts a certain number of words "WUB" before the first word of the song (the number may be zero), after the last word (the number may be zero), and between words (at least one between any pair of neighbouring words), and then the boy glues together all the words, including "WUB", in one string and plays the song at the club.
For example, a song with words "I AM X" can transform into a dubstep remix as "WUBWUBIWUBAMWUBWUBX" and cannot transform into "WUBWUBIAMWUBX".
Recently, Petya has heard Vasya's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Vasya remixed. Help Petya restore the original song.
Input
The input consists of a single non-empty string, consisting only of uppercase English letters, the string's length doesn't exceed 200 characters. It is guaranteed that before Vasya remixed the song, no word contained substring "WUB" in it; Vasya didn't change the word order. It is also guaranteed that initially the song had at least one word.
Output
Print the words of the initial song that Vasya used to make a dubsteb remix. Separate the words with a space.
Examples
Input
WUBWUBABCWUB
Output
ABC
Input
WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB
Output
WE ARE THE CHAMPIONS MY FRIEND
Note
In the first sample: "WUBWUBABCWUB" = "WUB" + "WUB" + "ABC" + "WUB". That means that the song originally consisted of a single word "ABC", and all words "WUB" were added by Vasya.
In the second sample Vasya added a single word "WUB" between all neighbouring words, in the beginning and in the end, except for words "ARE" and "THE" β between them Vasya added two "WUB".
Tags: strings
Correct Solution:
```
s = input().strip()
tokens = list(filter(None,s.split("WUB")))
res = ''
for token in tokens:
res += token+' '
print(res.strip())
```
| 36,368
|
[
-0.05328369140625,
0.392333984375,
0.1739501953125,
0.1668701171875,
-0.399658203125,
-0.57080078125,
-0.55419921875,
0.0170440673828125,
-0.16796875,
0.7421875,
0.7333984375,
-0.12030029296875,
0.31396484375,
-1.0087890625,
-0.41162109375,
0.3095703125,
-0.68701171875,
-0.6337890625,
-0.88623046875,
-0.257568359375,
0.1256103515625,
-0.32568359375,
-1.3173828125,
-0.256103515625,
-0.5751953125,
0.892578125,
0.1962890625,
-0.0211639404296875,
0.75146484375,
0.96435546875,
0.25634765625,
-0.2188720703125,
0.373779296875,
-0.76708984375,
-0.1641845703125,
-0.318359375,
0.59716796875,
-0.7236328125,
-0.1507568359375,
-0.7001953125,
0.08184814453125,
-0.3388671875,
0.481201171875,
-0.70947265625,
-1.02734375,
0.09613037109375,
0.034942626953125,
-0.357666015625,
0.0264129638671875,
-0.50634765625,
0.06671142578125,
-0.220947265625,
0.63134765625,
0.14306640625,
0.3515625,
-0.316650390625,
-0.19287109375,
-0.1005859375,
-0.74658203125,
-0.09710693359375,
0.31298828125,
0.30126953125,
0.0233306884765625,
-0.71826171875,
-0.33251953125,
0.339599609375,
-0.12493896484375,
-0.5615234375,
0.1690673828125,
-0.6572265625,
-0.505859375,
0.061431884765625,
-0.56201171875,
-0.408203125,
-0.223876953125,
0.1866455078125,
0.017822265625,
-0.0279541015625,
-0.06689453125,
0.81591796875,
0.12249755859375,
1.068359375,
0.380615234375,
0.339111328125,
-0.63037109375,
-0.80810546875,
-0.10107421875,
0.19189453125,
0.400634765625,
0.10894775390625,
-0.26416015625,
0.5380859375,
-0.42724609375,
-0.05712890625,
0.5283203125,
0.73779296875,
-0.2222900390625,
0.208251953125,
-0.024017333984375,
0.145263671875,
0.60888671875,
0.98876953125,
-0.07147216796875,
0.6494140625,
-0.39404296875,
0.309326171875,
0.1478271484375,
0.404541015625,
-0.279052734375,
-0.468505859375,
-0.2349853515625,
-0.19970703125,
0.341796875,
0.292236328125,
-0.33935546875,
0.83984375,
-0.174560546875,
0.29345703125,
-1.14453125,
-0.09136962890625,
0.391845703125,
0.26708984375,
0.52978515625,
-0.047149658203125,
0.10302734375,
-0.71484375,
-0.7939453125,
1.08203125,
-0.6875,
-0.2147216796875,
0.57763671875,
0.0031528472900390625,
-0.260986328125,
0.3984375,
0.09527587890625,
0.48046875,
-0.135986328125,
0.67041015625,
0.794921875,
-0.481689453125,
0.77392578125,
-0.06036376953125,
-0.084228515625,
1.2978515625,
-0.0869140625,
-0.0325927734375,
0.8330078125,
0.497314453125,
-0.759765625,
0.1636962890625,
-0.66552734375,
0.57275390625,
0.46435546875,
-0.064453125,
-0.138427734375,
0.2183837890625,
-0.302978515625,
0.58642578125,
0.12335205078125,
0.11376953125,
-0.489013671875,
0.144775390625,
-0.415771484375,
0.5986328125,
-0.5380859375,
0.650390625,
-0.315185546875,
-0.19873046875,
-0.31640625,
-0.33935546875,
-0.0814208984375,
-0.197265625,
-0.07000732421875,
0.406005859375,
0.469970703125,
1.10546875,
0.97900390625,
-0.2322998046875,
0.341796875,
-0.058837890625,
-0.279541015625,
0.059722900390625,
0.67333984375,
0.69482421875,
0.291015625,
-0.02880859375,
-0.30419921875,
-0.697265625,
-0.41259765625,
-0.54248046875,
0.1375732421875,
0.7998046875,
-0.712890625,
-0.2095947265625,
0.400634765625,
0.040802001953125,
-0.445068359375,
0.12261962890625,
-0.07720947265625,
-0.88916015625,
-0.457275390625,
0.61962890625,
-0.307373046875,
0.673828125,
-0.2130126953125,
-0.405029296875,
0.125244140625,
1.162109375,
-0.07989501953125,
0.07049560546875,
0.9560546875,
-0.11956787109375,
-0.32373046875,
0.1142578125,
0.238037109375,
-0.366943359375,
-0.689453125,
0.359130859375,
-0.391845703125,
-0.0064544677734375,
-0.0159454345703125,
0.71484375,
0.5517578125,
0.047637939453125,
-0.059326171875,
-0.320556640625,
0.546875,
1.03515625,
-0.073974609375,
0.45556640625,
0.046478271484375,
1.0712890625,
0.236083984375,
0.841796875,
0.64208984375,
0.37060546875,
0.462158203125,
0.82763671875,
0.11669921875,
-0.0261993408203125,
-0.1514892578125,
0.7421875,
0.41552734375,
0.9482421875,
-0.159912109375,
0.440673828125,
0.1961669921875,
0.053619384765625,
-0.37451171875,
0.2164306640625,
-0.64208984375,
0.73095703125,
0.703125,
0.939453125,
-0.43505859375,
-0.52197265625,
0.237548828125,
0.54248046875,
-1.0537109375,
-0.837890625,
0.037384033203125,
-0.01019287109375,
0.222412109375,
0.2427978515625,
0.285888671875,
0.14306640625,
0.373046875,
0.450927734375,
-0.64208984375,
-0.5556640625,
-0.59375,
-0.98291015625,
-1.015625,
-0.615234375,
-0.25341796875,
-0.067626953125,
0.01305389404296875,
-0.814453125,
0.345703125,
0.4228515625,
-0.0268402099609375,
-0.392333984375,
-0.100341796875,
0.70703125,
-0.0177764892578125,
0.6845703125,
-0.79443359375,
0.84716796875,
-0.0771484375,
1.6767578125,
-0.65576171875,
-0.2298583984375,
-0.40185546875,
-0.73779296875,
0.451171875,
0.145751953125,
0.13330078125,
0.51708984375,
-0.476318359375,
-0.193115234375,
-0.4951171875,
-0.20751953125,
-0.46044921875,
0.6357421875,
-0.5107421875,
0.8857421875,
0.57177734375,
-0.5166015625,
0.447265625,
1.0771484375,
-0.93017578125,
0.671875,
0.234130859375,
0.369384765625,
-0.81201171875,
1.1669921875,
0.79638671875,
0.4375,
-0.5244140625,
-0.26953125,
-0.61669921875,
-0.06890869140625,
-0.02215576171875,
-0.40869140625,
-0.421630859375,
0.31884765625,
0.27685546875,
-1.185546875,
0.7353515625,
-1.3154296875,
-0.92236328125,
-0.347900390625,
-0.433349609375,
0.63671875,
0.82177734375,
0.053131103515625,
-0.35302734375,
0.154296875,
-0.34521484375,
0.630859375,
0.41748046875,
-0.8310546875,
0.418212890625,
0.71630859375,
-0.02886962890625,
0.478515625,
0.0869140625,
-0.6669921875,
-0.229736328125,
-0.11016845703125,
-0.00734710693359375,
0.556640625,
0.5244140625,
-0.28369140625,
0.145263671875,
0.411376953125,
-0.8388671875,
-0.18994140625,
0.0299835205078125,
0.80908203125,
0.3212890625,
0.587890625,
0.2529296875,
-0.66162109375,
-0.449462890625,
-0.84912109375,
0.482421875,
0.67919921875,
0.716796875,
-0.7822265625,
0.2021484375,
0.1700439453125,
-0.7666015625,
0.640625,
-0.779296875,
-0.1864013671875,
1.30078125,
-0.1898193359375,
0.50390625,
-0.923828125,
0.2010498046875,
-0.5390625,
0.406494140625,
0.210205078125,
0.309814453125,
0.60400390625,
-0.5478515625,
-0.49658203125,
0.1131591796875,
-0.06646728515625,
-0.158935546875,
-0.457275390625,
0.53369140625,
-0.8876953125,
-0.24072265625,
-0.873046875,
0.56103515625,
0.7080078125,
0.50927734375,
0.353271484375,
0.8662109375,
0.46142578125,
0.413818359375,
0.5205078125,
0.08587646484375,
0.014984130859375,
-0.669921875,
0.36962890625,
0.1761474609375,
-0.01389312744140625,
-0.42529296875,
-0.44873046875,
-0.572265625,
0.32568359375,
0.23291015625,
0.275634765625,
-0.78564453125,
0.0299072265625,
-0.1953125,
0.4677734375,
-0.6806640625,
-0.334228515625,
-0.63623046875,
0.369140625,
0.278564453125,
-0.81640625,
0.324951171875,
-0.884765625,
0.66552734375,
0.59521484375,
-0.3828125,
-0.67626953125,
-0.25390625,
-0.450439453125,
-0.379638671875,
0.10833740234375,
0.77783203125,
0.07489013671875,
0.404052734375,
-1.0185546875,
0.6533203125,
0.138671875,
-0.1829833984375,
-0.0836181640625,
0.2064208984375,
0.3408203125,
0.014068603515625,
0.489501953125,
-0.5517578125,
-0.5419921875,
0.21240234375,
-1.3984375,
0.75390625,
-0.55078125,
0.6845703125,
-0.02703857421875,
-0.05926513671875,
0.0214691162109375,
0.120849609375,
-0.052947998046875,
0.07861328125,
-0.258544921875,
0.358154296875,
-1.1083984375,
-0.432373046875,
0.68408203125,
-0.25927734375,
-0.2406005859375,
0.86376953125,
0.220458984375,
-0.65966796875,
-0.047027587890625,
0.53662109375,
-0.34326171875,
0.2166748046875,
-0.77490234375,
0.5185546875,
-0.58056640625,
-0.351318359375,
-0.324462890625,
-0.391357421875,
0.8583984375,
0.1927490234375,
-0.73583984375,
-0.1898193359375,
-1.3740234375,
-0.1651611328125,
-0.01192474365234375,
-0.70361328125,
0.327880859375,
0.115966796875,
0.1319580078125,
0.29150390625,
-0.24658203125,
-0.33203125,
-0.466796875,
-0.9736328125,
-0.246337890625,
0.08612060546875,
0.370849609375,
0.822265625,
-0.286376953125,
-0.424560546875,
0.1636962890625,
0.375,
0.0440673828125,
-0.380859375,
-0.448974609375,
-0.1387939453125,
-0.60205078125,
0.0948486328125,
0.8681640625,
-0.07647705078125,
0.448974609375,
1.158203125,
0.27001953125,
0.286865234375,
0.11785888671875,
-0.578125,
0.912109375,
0.41357421875,
-0.99560546875,
-0.368896484375,
0.5625,
-0.03924560546875,
0.5693359375,
0.395263671875,
-0.4912109375,
-0.97607421875,
-1.15625,
-0.0279083251953125,
-0.95751953125,
-0.140625,
-1.037109375,
-0.46337890625,
-0.7412109375,
0.84619140625,
-0.371337890625,
-0.595703125,
0.244384765625,
-1.03125,
-0.034576416015625,
-0.62353515625,
-0.308349609375,
-0.260009765625,
-0.5078125,
-0.073974609375,
0.77294921875,
-0.355224609375,
0.826171875,
0.206298828125,
-0.1597900390625,
0.1529541015625,
-0.430419921875,
-0.59375,
-0.41943359375,
-0.2281494140625,
-0.4013671875,
0.141357421875,
-0.0193634033203125,
-0.357421875,
1.2490234375,
-1.1513671875,
0.10662841796875,
-0.346923828125,
-0.430908203125,
0.1461181640625,
0.1287841796875,
1.2236328125,
-0.126220703125,
0.0538330078125,
-0.12939453125,
0.72998046875,
0.45361328125,
-0.06182861328125,
-0.270751953125,
-0.9189453125,
-0.830078125,
-0.9873046875,
0.484619140625,
-0.250732421875,
0.33349609375,
-0.17041015625,
0.1025390625,
0.84326171875,
-0.20751953125,
0.376953125,
0.6982421875,
0.4521484375,
0.447265625,
-0.52197265625,
0.5556640625,
0.35205078125,
-0.69921875,
-0.37646484375,
0.1668701171875,
-0.71875,
0.045135498046875,
-0.3466796875,
-0.74658203125,
-0.25537109375,
-0.2369384765625,
1.421875,
-0.37060546875,
0.93359375,
-0.177490234375,
-0.890625,
-0.443603515625,
0.546875,
0.1685791015625,
-0.02386474609375,
0.8994140625,
-0.2264404296875,
0.27880859375,
-0.29736328125,
-0.26708984375,
-0.61865234375,
-0.051971435546875,
0.90234375,
-0.336181640625,
-0.52197265625,
1.07421875,
0.748046875,
-0.62255859375,
-0.83203125,
-0.50048828125,
-0.42919921875,
0.041900634765625,
-1.0126953125,
0.58984375,
0.19970703125,
-0.57421875,
0.145751953125,
0.69384765625,
0.00933837890625,
0.404541015625,
0.08343505859375,
0.131591796875,
-0.3603515625,
0.320556640625,
0.4755859375,
-0.483642578125,
-0.6396484375,
-0.7275390625,
-0.07733154296875,
-0.3173828125,
0.311767578125,
0.84130859375,
-0.261962890625,
0.53564453125,
0.59521484375,
-0.1949462890625,
0.65869140625,
-0.440185546875,
0.202392578125,
-0.020233154296875,
-0.81201171875,
-0.88818359375,
0.31103515625,
0.347900390625,
-0.5595703125,
0.26416015625,
-1.00390625,
0.33642578125,
0.229248046875,
0.39453125,
-0.1260986328125,
-1.091796875,
-0.54638671875,
-1.2607421875,
-0.429931640625,
-0.18701171875,
-0.055267333984375,
0.1136474609375,
0.55517578125,
0.0246124267578125,
-0.5458984375,
0.0009927749633789062,
0.44287109375,
-0.358154296875,
0.9873046875,
-0.626953125,
0.78857421875,
-0.78466796875,
-0.318359375,
-0.5625,
0.126708984375,
-0.496337890625,
-0.611328125,
-0.6591796875,
0.287841796875,
-0.1556396484375,
0.20751953125,
-0.45703125,
0.52392578125,
-0.138671875,
-0.2216796875,
0.1207275390625,
-0.0143280029296875,
-0.448486328125,
0.86669921875,
0.74072265625,
-0.041412353515625,
0.2822265625,
0.07464599609375,
-0.52587890625,
-0.2139892578125,
0.2425537109375,
0.72900390625,
-0.276123046875,
0.07147216796875,
-0.304931640625,
-0.09320068359375,
-0.982421875,
0.27294921875,
-0.06402587890625,
0.1165771484375,
0.5927734375,
-0.428955078125,
0.302490234375,
1.0634765625,
-0.356201171875,
0.42626953125,
0.436279296875,
0.262939453125,
0.365966796875,
0.28759765625,
-0.1815185546875,
0.380126953125,
0.2017822265625,
-0.35107421875,
-0.25439453125,
0.71484375,
-0.2000732421875,
0.232421875,
-0.5107421875,
-1.009765625,
-0.91796875,
-0.3603515625,
0.2432861328125,
0.5966796875,
0.0194549560546875,
-0.32373046875,
0.266357421875,
-0.1312255859375,
-0.69677734375,
0.22705078125,
-1.0234375,
-0.7978515625,
0.348388671875,
-0.08154296875,
-0.7880859375,
-0.33056640625,
-0.317138671875,
-0.154541015625,
0.27587890625,
0.25244140625,
-0.343017578125,
0.387451171875,
-0.1683349609375,
0.06378173828125,
-0.240234375,
0.0625,
0.1361083984375,
0.397216796875,
-0.34423828125,
-0.28955078125,
0.53662109375,
1.20703125,
0.131591796875,
-0.451416015625,
-0.591796875,
0.289306640625,
-0.38427734375,
-0.053985595703125,
-0.638671875,
0.244384765625,
0.04461669921875,
0.65478515625,
-0.77490234375,
-0.1104736328125,
-0.09515380859375,
0.431640625,
0.2447509765625,
-0.3984375,
-0.449462890625,
0.98095703125,
0.54833984375,
-0.1181640625,
0.299560546875,
-0.0299072265625,
0.493896484375,
-0.1578369140625,
-0.395263671875,
-0.283935546875,
0.8017578125,
0.74072265625,
0.6298828125,
-0.2646484375,
0.257080078125,
0.62548828125,
0.17578125,
0.35693359375,
0.68115234375,
0.55615234375,
-0.365234375,
0.1148681640625,
-0.30859375,
-0.256591796875,
-0.034912109375,
-0.453369140625,
0.6123046875,
0.16796875,
0.01535797119140625,
-0.201904296875,
-0.68115234375,
0.64892578125,
-0.151611328125,
-0.344482421875,
-0.11151123046875,
-0.0953369140625,
0.28662109375,
0.810546875,
0.24267578125,
0.060760498046875,
0.9794921875,
0.59375,
0.60107421875,
0.318115234375,
0.205810546875,
0.483642578125,
-0.53662109375,
0.236328125,
0.1646728515625,
-0.09515380859375,
-0.66259765625,
-0.0810546875,
-1.0595703125,
0.65380859375,
-0.58740234375,
-0.3427734375,
0.609375,
-0.505859375,
0.625,
-0.1572265625,
0.8017578125,
-0.50244140625,
0.292236328125,
0.358642578125,
-0.144775390625,
-0.63232421875,
1.10546875,
0.11834716796875,
0.278564453125,
0.24658203125,
0.92529296875,
-0.413330078125,
1.46484375,
-0.0625,
-0.56103515625,
0.0865478515625,
0.51123046875,
-0.5830078125,
-0.4482421875,
-0.65625,
-0.53466796875,
-0.1031494140625,
-0.7529296875,
-0.58056640625,
-0.1474609375,
0.12457275390625,
0.2158203125,
-1.1337890625,
-0.056243896484375,
0.12139892578125,
-0.806640625,
0.6123046875,
0.382568359375,
-0.0662841796875,
-0.165283203125,
0.1461181640625,
-0.29833984375,
-0.1446533203125,
-0.01068878173828125,
-0.351318359375,
0.58642578125,
-0.61279296875,
-0.417236328125,
-0.5419921875,
-0.5537109375,
-0.6064453125,
0.1649169921875,
-0.1375732421875,
-1.087890625,
0.509765625,
0.5185546875,
0.755859375,
0.478759765625,
-0.64404296875,
0.473876953125,
1.0087890625,
1.005859375,
-0.2242431640625,
0.8740234375,
-0.19873046875,
-0.966796875,
0.299072265625,
-0.251220703125,
0.5205078125,
-0.05767822265625,
0.1419677734375,
-0.1759033203125,
0.4111328125,
-0.37060546875,
-1.26171875,
-0.0438232421875,
0.68310546875,
0.266845703125,
-0.541015625,
-1.3134765625,
-0.399169921875,
-0.98876953125,
-0.1951904296875,
-0.4140625,
0.7109375,
-0.1229248046875,
0.049560546875,
-0.0550537109375,
-1.2763671875,
4.421875,
0.73681640625,
0.62939453125,
0.089599609375,
0.230712890625,
0.92333984375,
0.322021484375,
-0.384521484375,
-0.2213134765625,
-0.2861328125,
0.39306640625,
-0.60107421875,
-0.007373809814453125,
0.6484375,
0.377685546875,
0.65576171875,
-0.5556640625,
0.193359375,
-0.1761474609375,
-1.0625,
-0.88525390625,
0.403076171875,
-0.388427734375,
0.258056640625,
0.02716064453125,
0.515625,
0.599609375,
-0.55224609375,
0.09637451171875,
-0.82421875,
0.29443359375,
-0.30419921875,
0.58935546875,
-0.042449951171875,
-0.248779296875,
0.5537109375,
-0.14599609375,
-0.367431640625,
-0.282470703125,
-0.2236328125,
0.289794921875,
-0.107177734375,
0.82958984375,
-0.233642578125,
-0.333251953125,
0.509765625,
-0.6552734375,
0.57080078125,
0.12164306640625,
-0.91357421875,
0.90283203125,
-0.255615234375,
0.72021484375,
-0.66943359375,
-0.57080078125,
-0.26123046875,
0.2332763671875,
-0.04290771484375,
-0.2464599609375,
0.263427734375,
-0.1488037109375,
0.2890625,
-0.0491943359375,
0.46240234375,
-0.8916015625,
0.414306640625,
-0.329345703125,
0.26318359375,
-0.40234375,
-0.11102294921875,
-0.416259765625,
-0.1512451171875,
0.2161865234375,
-0.89990234375,
0.80029296875,
0.2459716796875,
-0.73681640625,
0.5751953125,
0.44775390625,
-0.8525390625,
0.2149658203125,
-0.40234375,
0.00710296630859375,
-0.1669921875,
0.45361328125,
0.7109375,
-0.48193359375,
-0.432373046875,
-0.08221435546875,
0.5810546875,
0.56591796875,
0.50146484375,
-0.034515380859375,
-0.1536865234375,
-0.1915283203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Vasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them.
Let's assume that a song consists of some number of words. To make the dubstep remix of this song, Vasya inserts a certain number of words "WUB" before the first word of the song (the number may be zero), after the last word (the number may be zero), and between words (at least one between any pair of neighbouring words), and then the boy glues together all the words, including "WUB", in one string and plays the song at the club.
For example, a song with words "I AM X" can transform into a dubstep remix as "WUBWUBIWUBAMWUBWUBX" and cannot transform into "WUBWUBIAMWUBX".
Recently, Petya has heard Vasya's new dubstep track, but since he isn't into modern music, he decided to find out what was the initial song that Vasya remixed. Help Petya restore the original song.
Input
The input consists of a single non-empty string, consisting only of uppercase English letters, the string's length doesn't exceed 200 characters. It is guaranteed that before Vasya remixed the song, no word contained substring "WUB" in it; Vasya didn't change the word order. It is also guaranteed that initially the song had at least one word.
Output
Print the words of the initial song that Vasya used to make a dubsteb remix. Separate the words with a space.
Examples
Input
WUBWUBABCWUB
Output
ABC
Input
WUBWEWUBAREWUBWUBTHEWUBCHAMPIONSWUBMYWUBFRIENDWUB
Output
WE ARE THE CHAMPIONS MY FRIEND
Note
In the first sample: "WUBWUBABCWUB" = "WUB" + "WUB" + "ABC" + "WUB". That means that the song originally consisted of a single word "ABC", and all words "WUB" were added by Vasya.
In the second sample Vasya added a single word "WUB" between all neighbouring words, in the beginning and in the end, except for words "ARE" and "THE" β between them Vasya added two "WUB".
Tags: strings
Correct Solution:
```
x=input()
x=x.split("WUB")
for i in x:
print(i,end=" ")
```
| 36,369
|
[
-0.05328369140625,
0.392333984375,
0.1739501953125,
0.1668701171875,
-0.399658203125,
-0.57080078125,
-0.55419921875,
0.0170440673828125,
-0.16796875,
0.7421875,
0.7333984375,
-0.12030029296875,
0.31396484375,
-1.0087890625,
-0.41162109375,
0.3095703125,
-0.68701171875,
-0.6337890625,
-0.88623046875,
-0.257568359375,
0.1256103515625,
-0.32568359375,
-1.3173828125,
-0.256103515625,
-0.5751953125,
0.892578125,
0.1962890625,
-0.0211639404296875,
0.75146484375,
0.96435546875,
0.25634765625,
-0.2188720703125,
0.373779296875,
-0.76708984375,
-0.1641845703125,
-0.318359375,
0.59716796875,
-0.7236328125,
-0.1507568359375,
-0.7001953125,
0.08184814453125,
-0.3388671875,
0.481201171875,
-0.70947265625,
-1.02734375,
0.09613037109375,
0.034942626953125,
-0.357666015625,
0.0264129638671875,
-0.50634765625,
0.06671142578125,
-0.220947265625,
0.63134765625,
0.14306640625,
0.3515625,
-0.316650390625,
-0.19287109375,
-0.1005859375,
-0.74658203125,
-0.09710693359375,
0.31298828125,
0.30126953125,
0.0233306884765625,
-0.71826171875,
-0.33251953125,
0.339599609375,
-0.12493896484375,
-0.5615234375,
0.1690673828125,
-0.6572265625,
-0.505859375,
0.061431884765625,
-0.56201171875,
-0.408203125,
-0.223876953125,
0.1866455078125,
0.017822265625,
-0.0279541015625,
-0.06689453125,
0.81591796875,
0.12249755859375,
1.068359375,
0.380615234375,
0.339111328125,
-0.63037109375,
-0.80810546875,
-0.10107421875,
0.19189453125,
0.400634765625,
0.10894775390625,
-0.26416015625,
0.5380859375,
-0.42724609375,
-0.05712890625,
0.5283203125,
0.73779296875,
-0.2222900390625,
0.208251953125,
-0.024017333984375,
0.145263671875,
0.60888671875,
0.98876953125,
-0.07147216796875,
0.6494140625,
-0.39404296875,
0.309326171875,
0.1478271484375,
0.404541015625,
-0.279052734375,
-0.468505859375,
-0.2349853515625,
-0.19970703125,
0.341796875,
0.292236328125,
-0.33935546875,
0.83984375,
-0.174560546875,
0.29345703125,
-1.14453125,
-0.09136962890625,
0.391845703125,
0.26708984375,
0.52978515625,
-0.047149658203125,
0.10302734375,
-0.71484375,
-0.7939453125,
1.08203125,
-0.6875,
-0.2147216796875,
0.57763671875,
0.0031528472900390625,
-0.260986328125,
0.3984375,
0.09527587890625,
0.48046875,
-0.135986328125,
0.67041015625,
0.794921875,
-0.481689453125,
0.77392578125,
-0.06036376953125,
-0.084228515625,
1.2978515625,
-0.0869140625,
-0.0325927734375,
0.8330078125,
0.497314453125,
-0.759765625,
0.1636962890625,
-0.66552734375,
0.57275390625,
0.46435546875,
-0.064453125,
-0.138427734375,
0.2183837890625,
-0.302978515625,
0.58642578125,
0.12335205078125,
0.11376953125,
-0.489013671875,
0.144775390625,
-0.415771484375,
0.5986328125,
-0.5380859375,
0.650390625,
-0.315185546875,
-0.19873046875,
-0.31640625,
-0.33935546875,
-0.0814208984375,
-0.197265625,
-0.07000732421875,
0.406005859375,
0.469970703125,
1.10546875,
0.97900390625,
-0.2322998046875,
0.341796875,
-0.058837890625,
-0.279541015625,
0.059722900390625,
0.67333984375,
0.69482421875,
0.291015625,
-0.02880859375,
-0.30419921875,
-0.697265625,
-0.41259765625,
-0.54248046875,
0.1375732421875,
0.7998046875,
-0.712890625,
-0.2095947265625,
0.400634765625,
0.040802001953125,
-0.445068359375,
0.12261962890625,
-0.07720947265625,
-0.88916015625,
-0.457275390625,
0.61962890625,
-0.307373046875,
0.673828125,
-0.2130126953125,
-0.405029296875,
0.125244140625,
1.162109375,
-0.07989501953125,
0.07049560546875,
0.9560546875,
-0.11956787109375,
-0.32373046875,
0.1142578125,
0.238037109375,
-0.366943359375,
-0.689453125,
0.359130859375,
-0.391845703125,
-0.0064544677734375,
-0.0159454345703125,
0.71484375,
0.5517578125,
0.047637939453125,
-0.059326171875,
-0.320556640625,
0.546875,
1.03515625,
-0.073974609375,
0.45556640625,
0.046478271484375,
1.0712890625,
0.236083984375,
0.841796875,
0.64208984375,
0.37060546875,
0.462158203125,
0.82763671875,
0.11669921875,
-0.0261993408203125,
-0.1514892578125,
0.7421875,
0.41552734375,
0.9482421875,
-0.159912109375,
0.440673828125,
0.1961669921875,
0.053619384765625,
-0.37451171875,
0.2164306640625,
-0.64208984375,
0.73095703125,
0.703125,
0.939453125,
-0.43505859375,
-0.52197265625,
0.237548828125,
0.54248046875,
-1.0537109375,
-0.837890625,
0.037384033203125,
-0.01019287109375,
0.222412109375,
0.2427978515625,
0.285888671875,
0.14306640625,
0.373046875,
0.450927734375,
-0.64208984375,
-0.5556640625,
-0.59375,
-0.98291015625,
-1.015625,
-0.615234375,
-0.25341796875,
-0.067626953125,
0.01305389404296875,
-0.814453125,
0.345703125,
0.4228515625,
-0.0268402099609375,
-0.392333984375,
-0.100341796875,
0.70703125,
-0.0177764892578125,
0.6845703125,
-0.79443359375,
0.84716796875,
-0.0771484375,
1.6767578125,
-0.65576171875,
-0.2298583984375,
-0.40185546875,
-0.73779296875,
0.451171875,
0.145751953125,
0.13330078125,
0.51708984375,
-0.476318359375,
-0.193115234375,
-0.4951171875,
-0.20751953125,
-0.46044921875,
0.6357421875,
-0.5107421875,
0.8857421875,
0.57177734375,
-0.5166015625,
0.447265625,
1.0771484375,
-0.93017578125,
0.671875,
0.234130859375,
0.369384765625,
-0.81201171875,
1.1669921875,
0.79638671875,
0.4375,
-0.5244140625,
-0.26953125,
-0.61669921875,
-0.06890869140625,
-0.02215576171875,
-0.40869140625,
-0.421630859375,
0.31884765625,
0.27685546875,
-1.185546875,
0.7353515625,
-1.3154296875,
-0.92236328125,
-0.347900390625,
-0.433349609375,
0.63671875,
0.82177734375,
0.053131103515625,
-0.35302734375,
0.154296875,
-0.34521484375,
0.630859375,
0.41748046875,
-0.8310546875,
0.418212890625,
0.71630859375,
-0.02886962890625,
0.478515625,
0.0869140625,
-0.6669921875,
-0.229736328125,
-0.11016845703125,
-0.00734710693359375,
0.556640625,
0.5244140625,
-0.28369140625,
0.145263671875,
0.411376953125,
-0.8388671875,
-0.18994140625,
0.0299835205078125,
0.80908203125,
0.3212890625,
0.587890625,
0.2529296875,
-0.66162109375,
-0.449462890625,
-0.84912109375,
0.482421875,
0.67919921875,
0.716796875,
-0.7822265625,
0.2021484375,
0.1700439453125,
-0.7666015625,
0.640625,
-0.779296875,
-0.1864013671875,
1.30078125,
-0.1898193359375,
0.50390625,
-0.923828125,
0.2010498046875,
-0.5390625,
0.406494140625,
0.210205078125,
0.309814453125,
0.60400390625,
-0.5478515625,
-0.49658203125,
0.1131591796875,
-0.06646728515625,
-0.158935546875,
-0.457275390625,
0.53369140625,
-0.8876953125,
-0.24072265625,
-0.873046875,
0.56103515625,
0.7080078125,
0.50927734375,
0.353271484375,
0.8662109375,
0.46142578125,
0.413818359375,
0.5205078125,
0.08587646484375,
0.014984130859375,
-0.669921875,
0.36962890625,
0.1761474609375,
-0.01389312744140625,
-0.42529296875,
-0.44873046875,
-0.572265625,
0.32568359375,
0.23291015625,
0.275634765625,
-0.78564453125,
0.0299072265625,
-0.1953125,
0.4677734375,
-0.6806640625,
-0.334228515625,
-0.63623046875,
0.369140625,
0.278564453125,
-0.81640625,
0.324951171875,
-0.884765625,
0.66552734375,
0.59521484375,
-0.3828125,
-0.67626953125,
-0.25390625,
-0.450439453125,
-0.379638671875,
0.10833740234375,
0.77783203125,
0.07489013671875,
0.404052734375,
-1.0185546875,
0.6533203125,
0.138671875,
-0.1829833984375,
-0.0836181640625,
0.2064208984375,
0.3408203125,
0.014068603515625,
0.489501953125,
-0.5517578125,
-0.5419921875,
0.21240234375,
-1.3984375,
0.75390625,
-0.55078125,
0.6845703125,
-0.02703857421875,
-0.05926513671875,
0.0214691162109375,
0.120849609375,
-0.052947998046875,
0.07861328125,
-0.258544921875,
0.358154296875,
-1.1083984375,
-0.432373046875,
0.68408203125,
-0.25927734375,
-0.2406005859375,
0.86376953125,
0.220458984375,
-0.65966796875,
-0.047027587890625,
0.53662109375,
-0.34326171875,
0.2166748046875,
-0.77490234375,
0.5185546875,
-0.58056640625,
-0.351318359375,
-0.324462890625,
-0.391357421875,
0.8583984375,
0.1927490234375,
-0.73583984375,
-0.1898193359375,
-1.3740234375,
-0.1651611328125,
-0.01192474365234375,
-0.70361328125,
0.327880859375,
0.115966796875,
0.1319580078125,
0.29150390625,
-0.24658203125,
-0.33203125,
-0.466796875,
-0.9736328125,
-0.246337890625,
0.08612060546875,
0.370849609375,
0.822265625,
-0.286376953125,
-0.424560546875,
0.1636962890625,
0.375,
0.0440673828125,
-0.380859375,
-0.448974609375,
-0.1387939453125,
-0.60205078125,
0.0948486328125,
0.8681640625,
-0.07647705078125,
0.448974609375,
1.158203125,
0.27001953125,
0.286865234375,
0.11785888671875,
-0.578125,
0.912109375,
0.41357421875,
-0.99560546875,
-0.368896484375,
0.5625,
-0.03924560546875,
0.5693359375,
0.395263671875,
-0.4912109375,
-0.97607421875,
-1.15625,
-0.0279083251953125,
-0.95751953125,
-0.140625,
-1.037109375,
-0.46337890625,
-0.7412109375,
0.84619140625,
-0.371337890625,
-0.595703125,
0.244384765625,
-1.03125,
-0.034576416015625,
-0.62353515625,
-0.308349609375,
-0.260009765625,
-0.5078125,
-0.073974609375,
0.77294921875,
-0.355224609375,
0.826171875,
0.206298828125,
-0.1597900390625,
0.1529541015625,
-0.430419921875,
-0.59375,
-0.41943359375,
-0.2281494140625,
-0.4013671875,
0.141357421875,
-0.0193634033203125,
-0.357421875,
1.2490234375,
-1.1513671875,
0.10662841796875,
-0.346923828125,
-0.430908203125,
0.1461181640625,
0.1287841796875,
1.2236328125,
-0.126220703125,
0.0538330078125,
-0.12939453125,
0.72998046875,
0.45361328125,
-0.06182861328125,
-0.270751953125,
-0.9189453125,
-0.830078125,
-0.9873046875,
0.484619140625,
-0.250732421875,
0.33349609375,
-0.17041015625,
0.1025390625,
0.84326171875,
-0.20751953125,
0.376953125,
0.6982421875,
0.4521484375,
0.447265625,
-0.52197265625,
0.5556640625,
0.35205078125,
-0.69921875,
-0.37646484375,
0.1668701171875,
-0.71875,
0.045135498046875,
-0.3466796875,
-0.74658203125,
-0.25537109375,
-0.2369384765625,
1.421875,
-0.37060546875,
0.93359375,
-0.177490234375,
-0.890625,
-0.443603515625,
0.546875,
0.1685791015625,
-0.02386474609375,
0.8994140625,
-0.2264404296875,
0.27880859375,
-0.29736328125,
-0.26708984375,
-0.61865234375,
-0.051971435546875,
0.90234375,
-0.336181640625,
-0.52197265625,
1.07421875,
0.748046875,
-0.62255859375,
-0.83203125,
-0.50048828125,
-0.42919921875,
0.041900634765625,
-1.0126953125,
0.58984375,
0.19970703125,
-0.57421875,
0.145751953125,
0.69384765625,
0.00933837890625,
0.404541015625,
0.08343505859375,
0.131591796875,
-0.3603515625,
0.320556640625,
0.4755859375,
-0.483642578125,
-0.6396484375,
-0.7275390625,
-0.07733154296875,
-0.3173828125,
0.311767578125,
0.84130859375,
-0.261962890625,
0.53564453125,
0.59521484375,
-0.1949462890625,
0.65869140625,
-0.440185546875,
0.202392578125,
-0.020233154296875,
-0.81201171875,
-0.88818359375,
0.31103515625,
0.347900390625,
-0.5595703125,
0.26416015625,
-1.00390625,
0.33642578125,
0.229248046875,
0.39453125,
-0.1260986328125,
-1.091796875,
-0.54638671875,
-1.2607421875,
-0.429931640625,
-0.18701171875,
-0.055267333984375,
0.1136474609375,
0.55517578125,
0.0246124267578125,
-0.5458984375,
0.0009927749633789062,
0.44287109375,
-0.358154296875,
0.9873046875,
-0.626953125,
0.78857421875,
-0.78466796875,
-0.318359375,
-0.5625,
0.126708984375,
-0.496337890625,
-0.611328125,
-0.6591796875,
0.287841796875,
-0.1556396484375,
0.20751953125,
-0.45703125,
0.52392578125,
-0.138671875,
-0.2216796875,
0.1207275390625,
-0.0143280029296875,
-0.448486328125,
0.86669921875,
0.74072265625,
-0.041412353515625,
0.2822265625,
0.07464599609375,
-0.52587890625,
-0.2139892578125,
0.2425537109375,
0.72900390625,
-0.276123046875,
0.07147216796875,
-0.304931640625,
-0.09320068359375,
-0.982421875,
0.27294921875,
-0.06402587890625,
0.1165771484375,
0.5927734375,
-0.428955078125,
0.302490234375,
1.0634765625,
-0.356201171875,
0.42626953125,
0.436279296875,
0.262939453125,
0.365966796875,
0.28759765625,
-0.1815185546875,
0.380126953125,
0.2017822265625,
-0.35107421875,
-0.25439453125,
0.71484375,
-0.2000732421875,
0.232421875,
-0.5107421875,
-1.009765625,
-0.91796875,
-0.3603515625,
0.2432861328125,
0.5966796875,
0.0194549560546875,
-0.32373046875,
0.266357421875,
-0.1312255859375,
-0.69677734375,
0.22705078125,
-1.0234375,
-0.7978515625,
0.348388671875,
-0.08154296875,
-0.7880859375,
-0.33056640625,
-0.317138671875,
-0.154541015625,
0.27587890625,
0.25244140625,
-0.343017578125,
0.387451171875,
-0.1683349609375,
0.06378173828125,
-0.240234375,
0.0625,
0.1361083984375,
0.397216796875,
-0.34423828125,
-0.28955078125,
0.53662109375,
1.20703125,
0.131591796875,
-0.451416015625,
-0.591796875,
0.289306640625,
-0.38427734375,
-0.053985595703125,
-0.638671875,
0.244384765625,
0.04461669921875,
0.65478515625,
-0.77490234375,
-0.1104736328125,
-0.09515380859375,
0.431640625,
0.2447509765625,
-0.3984375,
-0.449462890625,
0.98095703125,
0.54833984375,
-0.1181640625,
0.299560546875,
-0.0299072265625,
0.493896484375,
-0.1578369140625,
-0.395263671875,
-0.283935546875,
0.8017578125,
0.74072265625,
0.6298828125,
-0.2646484375,
0.257080078125,
0.62548828125,
0.17578125,
0.35693359375,
0.68115234375,
0.55615234375,
-0.365234375,
0.1148681640625,
-0.30859375,
-0.256591796875,
-0.034912109375,
-0.453369140625,
0.6123046875,
0.16796875,
0.01535797119140625,
-0.201904296875,
-0.68115234375,
0.64892578125,
-0.151611328125,
-0.344482421875,
-0.11151123046875,
-0.0953369140625,
0.28662109375,
0.810546875,
0.24267578125,
0.060760498046875,
0.9794921875,
0.59375,
0.60107421875,
0.318115234375,
0.205810546875,
0.483642578125,
-0.53662109375,
0.236328125,
0.1646728515625,
-0.09515380859375,
-0.66259765625,
-0.0810546875,
-1.0595703125,
0.65380859375,
-0.58740234375,
-0.3427734375,
0.609375,
-0.505859375,
0.625,
-0.1572265625,
0.8017578125,
-0.50244140625,
0.292236328125,
0.358642578125,
-0.144775390625,
-0.63232421875,
1.10546875,
0.11834716796875,
0.278564453125,
0.24658203125,
0.92529296875,
-0.413330078125,
1.46484375,
-0.0625,
-0.56103515625,
0.0865478515625,
0.51123046875,
-0.5830078125,
-0.4482421875,
-0.65625,
-0.53466796875,
-0.1031494140625,
-0.7529296875,
-0.58056640625,
-0.1474609375,
0.12457275390625,
0.2158203125,
-1.1337890625,
-0.056243896484375,
0.12139892578125,
-0.806640625,
0.6123046875,
0.382568359375,
-0.0662841796875,
-0.165283203125,
0.1461181640625,
-0.29833984375,
-0.1446533203125,
-0.01068878173828125,
-0.351318359375,
0.58642578125,
-0.61279296875,
-0.417236328125,
-0.5419921875,
-0.5537109375,
-0.6064453125,
0.1649169921875,
-0.1375732421875,
-1.087890625,
0.509765625,
0.5185546875,
0.755859375,
0.478759765625,
-0.64404296875,
0.473876953125,
1.0087890625,
1.005859375,
-0.2242431640625,
0.8740234375,
-0.19873046875,
-0.966796875,
0.299072265625,
-0.251220703125,
0.5205078125,
-0.05767822265625,
0.1419677734375,
-0.1759033203125,
0.4111328125,
-0.37060546875,
-1.26171875,
-0.0438232421875,
0.68310546875,
0.266845703125,
-0.541015625,
-1.3134765625,
-0.399169921875,
-0.98876953125,
-0.1951904296875,
-0.4140625,
0.7109375,
-0.1229248046875,
0.049560546875,
-0.0550537109375,
-1.2763671875,
4.421875,
0.73681640625,
0.62939453125,
0.089599609375,
0.230712890625,
0.92333984375,
0.322021484375,
-0.384521484375,
-0.2213134765625,
-0.2861328125,
0.39306640625,
-0.60107421875,
-0.007373809814453125,
0.6484375,
0.377685546875,
0.65576171875,
-0.5556640625,
0.193359375,
-0.1761474609375,
-1.0625,
-0.88525390625,
0.403076171875,
-0.388427734375,
0.258056640625,
0.02716064453125,
0.515625,
0.599609375,
-0.55224609375,
0.09637451171875,
-0.82421875,
0.29443359375,
-0.30419921875,
0.58935546875,
-0.042449951171875,
-0.248779296875,
0.5537109375,
-0.14599609375,
-0.367431640625,
-0.282470703125,
-0.2236328125,
0.289794921875,
-0.107177734375,
0.82958984375,
-0.233642578125,
-0.333251953125,
0.509765625,
-0.6552734375,
0.57080078125,
0.12164306640625,
-0.91357421875,
0.90283203125,
-0.255615234375,
0.72021484375,
-0.66943359375,
-0.57080078125,
-0.26123046875,
0.2332763671875,
-0.04290771484375,
-0.2464599609375,
0.263427734375,
-0.1488037109375,
0.2890625,
-0.0491943359375,
0.46240234375,
-0.8916015625,
0.414306640625,
-0.329345703125,
0.26318359375,
-0.40234375,
-0.11102294921875,
-0.416259765625,
-0.1512451171875,
0.2161865234375,
-0.89990234375,
0.80029296875,
0.2459716796875,
-0.73681640625,
0.5751953125,
0.44775390625,
-0.8525390625,
0.2149658203125,
-0.40234375,
0.00710296630859375,
-0.1669921875,
0.45361328125,
0.7109375,
-0.48193359375,
-0.432373046875,
-0.08221435546875,
0.5810546875,
0.56591796875,
0.50146484375,
-0.034515380859375,
-0.1536865234375,
-0.1915283203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Valery have come across an entirely new programming language. Most of all the language attracted him with template functions and procedures. Let us remind you that templates are tools of a language, designed to encode generic algorithms, without reference to some parameters (e.g., data types, buffer sizes, default values).
Valery decided to examine template procedures in this language in more detail. The description of a template procedure consists of the procedure name and the list of its parameter types. The generic type T parameters can be used as parameters of template procedures.
A procedure call consists of a procedure name and a list of variable parameters. Let's call a procedure suitable for this call if the following conditions are fulfilled:
* its name equals to the name of the called procedure;
* the number of its parameters equals to the number of parameters of the procedure call;
* the types of variables in the procedure call match the corresponding types of its parameters. The variable type matches the type of a parameter if the parameter has a generic type T or the type of the variable and the parameter are the same.
You are given a description of some set of template procedures. You are also given a list of variables used in the program, as well as direct procedure calls that use the described variables. For each call you need to count the number of procedures that are suitable for this call.
Input
The first line contains a single integer n (1 β€ n β€ 1000) β the number of template procedures. The next n lines contain the description of the procedures specified in the following format:
"void procedureName (type_1, type_2, ..., type_t)" (1 β€ t β€ 5), where void is the keyword, procedureName is the procedure name, type_i is the type of the next parameter. Types of language parameters can be "int", "string", "double", and the keyword "T", which denotes the generic type.
The next line contains a single integer m (1 β€ m β€ 1000) β the number of used variables. Next m lines specify the description of the variables in the following format:
"type variableName", where type is the type of variable that can take values "int", "string", "double", variableName β the name of the variable.
The next line contains a single integer k (1 β€ k β€ 1000) β the number of procedure calls. Next k lines specify the procedure calls in the following format:
"procedureName (var_1, var_2, ..., var_t)" (1 β€ t β€ 5), where procedureName is the name of the procedure, var_i is the name of a variable.
The lines describing the variables, template procedures and their calls may contain spaces at the beginning of the line and at the end of the line, before and after the brackets and commas. Spaces may be before and after keyword void. The length of each input line does not exceed 100 characters. The names of variables and procedures are non-empty strings of lowercase English letters and numbers with lengths of not more than 10 characters. Note that this is the only condition at the names. Only the specified variables are used in procedure calls. The names of the variables are distinct. No two procedures are the same. Two procedures are the same, if they have identical names and identical ordered sets of types of their parameters.
Output
On each of k lines print a single number, where the i-th number stands for the number of suitable template procedures for the i-th call.
Examples
Input
4
void f(int,T)
void f(T, T)
void foo123 ( int, double, string,string )
void p(T,double)
3
int a
string s
double x123
5
f(a, a)
f(s,a )
foo (a,s,s)
f ( s ,x123)
proc(a)
Output
2
1
0
1
0
Input
6
void f(string,double,int)
void f(int)
void f ( T )
void procedure(int,double)
void f (T, double,int)
void f(string, T,T)
4
int a
int x
string t
double val
5
f(t, a, a)
f(t,val,a)
f(val,a, val)
solve300(val, val)
f (x)
Output
1
3
0
0
2
Tags: binary search, brute force, expression parsing, implementation
Correct Solution:
```
n = int(input())
v = dict()
f, f1 = [], []
for i in range(n):
t = input()
t1 = ''
k = t.find("d") + 1
while t[k] == " ":
k += 1
t = t[k:]
for i in t:
if i != " ":
t1 += i
t = t1
t = t.split(',')
t[-1] = t[-1][:str(t[-1]).find(")")]
r1, r2 = t[0].split("(")
t = [r1] + [r2] + t[1::]
f.append(t)
n = int(input())
for i in range(n):
t = input()
k = 0
while t[k] == " ":
k += 1
t = t[k:]
k = len(t) - 1
while t[k] == " ":
k -= 1
t = t[:k + 1]
v[t[t.rfind(" ") + 1:]] = t[:t.find(" ")]
n = int(input())
for i in range(n):
t = input()
t1 = ''
for i in t:
if i != " ":
t1 += i
t = t1
t = t.split(',')
t[-1] = t[-1][:str(t[-1]).find(")")]
r1, r2 = t[0].split("(")
t = [r1] + [r2] + t[1::]
ans = 0
for i in range(len(f)):
if len(f[i]) == len(t):
if f[i][0] == t[0]:
kek = 0
for j in range(1, len(f[i])):
if f[i][j] != "T":
if f[i][j] != v[t[j]]:
break
else:
kek += 1
else:
kek += 1
if kek == len(f[i]) - 1:
ans += 1
print(ans)
```
| 37,096
|
[
0.2352294921875,
-0.259521484375,
0.2236328125,
0.1781005859375,
-0.4794921875,
-0.363525390625,
-0.10736083984375,
0.05438232421875,
0.0230560302734375,
0.6220703125,
0.72119140625,
-0.173828125,
0.237060546875,
-0.454833984375,
-0.48681640625,
0.269287109375,
-0.439453125,
-0.89404296875,
-0.890625,
0.324462890625,
-0.1915283203125,
-0.003078460693359375,
-1.80859375,
-0.31103515625,
-0.57861328125,
0.72119140625,
0.56005859375,
-0.05224609375,
1.2177734375,
1.189453125,
-0.3623046875,
-0.4697265625,
0.28125,
-0.85986328125,
-0.232177734375,
-0.250244140625,
0.367919921875,
-0.78369140625,
-0.453857421875,
-0.2359619140625,
0.394775390625,
-0.1865234375,
0.306396484375,
-1.15234375,
-1.1689453125,
0.01103973388671875,
-0.0263671875,
-0.25634765625,
-0.0086822509765625,
-0.36962890625,
0.31884765625,
0.156005859375,
0.32861328125,
-0.46826171875,
-0.382568359375,
0.037689208984375,
0.0285797119140625,
0.10980224609375,
-0.4560546875,
-0.0657958984375,
-0.525390625,
0.30712890625,
0.005992889404296875,
-0.72119140625,
0.13720703125,
0.0921630859375,
0.06744384765625,
-0.236328125,
0.345703125,
-1.056640625,
-0.56884765625,
0.0810546875,
-0.71435546875,
-0.4697265625,
-0.042083740234375,
0.1771240234375,
0.59423828125,
0.09783935546875,
-0.57080078125,
0.30810546875,
0.64599609375,
0.994140625,
0.1416015625,
0.415771484375,
-0.5947265625,
-0.53076171875,
0.057464599609375,
0.1375732421875,
0.1651611328125,
-0.2198486328125,
-0.31396484375,
0.70947265625,
-0.1982421875,
-0.287353515625,
0.58544921875,
0.401123046875,
-0.28173828125,
0.7333984375,
0.111328125,
0.0036163330078125,
1.15625,
1.271484375,
-0.0751953125,
0.71337890625,
-0.44580078125,
0.74951171875,
0.56396484375,
0.337158203125,
-0.76904296875,
-0.440185546875,
-0.5107421875,
-0.5068359375,
0.2476806640625,
-0.254150390625,
-0.43896484375,
1.052734375,
0.01067352294921875,
-0.0211029052734375,
-0.53271484375,
0.14404296875,
0.3525390625,
0.272216796875,
0.067626953125,
-0.1912841796875,
0.09014892578125,
-0.432861328125,
-0.28076171875,
1.05078125,
-0.5888671875,
0.1448974609375,
-0.064697265625,
-0.348876953125,
-0.52734375,
0.50830078125,
-0.313720703125,
0.90625,
-0.320556640625,
0.51025390625,
0.3076171875,
-0.469482421875,
0.75732421875,
-0.1968994140625,
0.251708984375,
1.296875,
0.2200927734375,
0.339599609375,
1.0068359375,
-0.005123138427734375,
-0.83251953125,
0.53369140625,
-0.368408203125,
0.164306640625,
-0.228759765625,
0.039154052734375,
-0.03692626953125,
0.1248779296875,
-0.1607666015625,
-0.2054443359375,
0.084716796875,
0.138916015625,
-0.358642578125,
0.10882568359375,
0.06341552734375,
0.88232421875,
-0.32080078125,
0.8798828125,
-0.66259765625,
-0.2437744140625,
-0.32421875,
-0.677734375,
0.75390625,
-0.32763671875,
-0.47900390625,
0.53466796875,
1.103515625,
0.6533203125,
1.248046875,
-0.007503509521484375,
0.29150390625,
0.46435546875,
-0.2418212890625,
0.0533447265625,
0.302978515625,
0.779296875,
0.7197265625,
0.48828125,
0.283935546875,
-0.1124267578125,
-0.51953125,
-0.65478515625,
0.170166015625,
0.72119140625,
-0.6572265625,
0.27587890625,
0.2685546875,
-0.0037364959716796875,
-0.30908203125,
-0.10382080078125,
-0.145263671875,
-0.9521484375,
-0.828125,
0.55419921875,
-0.26904296875,
0.0186309814453125,
-0.533203125,
-0.185791015625,
-0.05609130859375,
1.3505859375,
-0.0943603515625,
0.1365966796875,
0.475341796875,
-0.0214385986328125,
-0.2264404296875,
-0.0019969940185546875,
0.06671142578125,
-0.3544921875,
-0.61181640625,
0.49609375,
-0.2646484375,
-0.08502197265625,
0.05450439453125,
0.74365234375,
0.7197265625,
0.042755126953125,
-0.488037109375,
-0.35107421875,
0.16162109375,
1.44140625,
0.00421142578125,
0.89111328125,
0.6533203125,
1.19921875,
0.52880859375,
1.0126953125,
0.61474609375,
0.28564453125,
0.96630859375,
1.0498046875,
0.284912109375,
0.33935546875,
-0.1378173828125,
0.422607421875,
0.45166015625,
0.13916015625,
0.00835418701171875,
0.494384765625,
-0.096923828125,
-0.260009765625,
-0.27099609375,
0.673828125,
-0.11676025390625,
1.033203125,
-0.0726318359375,
0.2822265625,
-0.1240234375,
-0.365966796875,
-0.30859375,
0.693359375,
-0.986328125,
-0.1876220703125,
0.3818359375,
0.141845703125,
0.406494140625,
0.1395263671875,
0.254150390625,
0.246337890625,
0.48046875,
0.225830078125,
-0.232666015625,
-0.99072265625,
-0.334228515625,
-0.96826171875,
-0.9921875,
-0.2109375,
-0.38720703125,
-0.09161376953125,
0.60693359375,
-0.73876953125,
0.2060546875,
-0.31982421875,
0.0819091796875,
0.3779296875,
-0.5947265625,
0.75927734375,
-0.0112457275390625,
0.21240234375,
-0.76708984375,
0.9140625,
-0.1876220703125,
0.87548828125,
-0.564453125,
-0.387451171875,
-0.0933837890625,
-0.70751953125,
0.3232421875,
0.1134033203125,
0.449951171875,
-0.299560546875,
-0.89453125,
-0.806640625,
-0.351318359375,
-0.2274169921875,
-0.71630859375,
0.38330078125,
-0.76318359375,
0.87060546875,
0.355224609375,
-0.845703125,
0.7314453125,
1.009765625,
-1.0810546875,
0.3662109375,
0.014923095703125,
0.0753173828125,
-0.77001953125,
1.3388671875,
0.4130859375,
0.36181640625,
-0.640625,
0.03887939453125,
-0.2401123046875,
-0.3330078125,
0.182861328125,
-0.4345703125,
-0.5361328125,
0.5966796875,
0.453369140625,
-0.93896484375,
0.480224609375,
-1.140625,
-0.126708984375,
-0.31640625,
-0.139404296875,
0.71435546875,
0.7470703125,
-0.1796875,
-0.03021240234375,
0.1324462890625,
-0.0121612548828125,
0.5185546875,
0.251953125,
-0.497802734375,
0.1953125,
0.5576171875,
0.079833984375,
0.57861328125,
0.425537109375,
-0.54833984375,
-0.062408447265625,
-0.5625,
0.138427734375,
0.62353515625,
0.337890625,
0.00640869140625,
-0.20849609375,
0.74658203125,
-0.52685546875,
-0.79443359375,
-0.37890625,
0.6181640625,
0.61328125,
0.65869140625,
0.192626953125,
-0.310546875,
-0.923828125,
-0.41162109375,
-0.25,
0.287353515625,
0.89990234375,
-1.0380859375,
0.7861328125,
-0.381103515625,
-0.58935546875,
-0.03759765625,
-0.61865234375,
0.10833740234375,
0.7783203125,
0.22412109375,
0.8623046875,
-0.89892578125,
-0.5986328125,
0.1456298828125,
0.06463623046875,
0.90673828125,
0.359619140625,
0.8369140625,
-0.12042236328125,
-0.379150390625,
-0.483154296875,
0.1741943359375,
0.2431640625,
-0.4873046875,
0.279052734375,
-0.358154296875,
-0.104248046875,
-1.1005859375,
0.38720703125,
0.74560546875,
0.415771484375,
0.11181640625,
0.384033203125,
0.1253662109375,
0.51708984375,
0.9091796875,
0.0955810546875,
0.1951904296875,
-0.38525390625,
0.43994140625,
0.1524658203125,
-0.2308349609375,
-0.76025390625,
-0.66015625,
0.053375244140625,
0.15380859375,
0.12335205078125,
0.0295562744140625,
-0.654296875,
0.156494140625,
0.0217132568359375,
0.60693359375,
-0.39794921875,
-0.49951171875,
-0.366455078125,
0.83544921875,
0.147705078125,
-0.457763671875,
0.36865234375,
-0.482177734375,
0.71923828125,
0.66796875,
-0.5595703125,
-0.83447265625,
-0.318603515625,
-0.71337890625,
-0.412841796875,
0.7529296875,
0.83154296875,
-0.27294921875,
0.63427734375,
-1.224609375,
0.11614990234375,
-0.1385498046875,
-0.085693359375,
0.058746337890625,
0.07049560546875,
0.51513671875,
0.50537109375,
0.34228515625,
-0.31201171875,
-0.56689453125,
0.166748046875,
-1.0478515625,
0.51611328125,
-0.759765625,
0.083251953125,
-0.0882568359375,
-0.1884765625,
-0.308349609375,
-0.028411865234375,
-0.51416015625,
0.1448974609375,
0.03851318359375,
0.353271484375,
-1.310546875,
-0.343505859375,
0.75732421875,
-0.163818359375,
0.00920867919921875,
0.97802734375,
0.2919921875,
-0.4677734375,
0.671875,
0.392822265625,
-0.5615234375,
0.264404296875,
-0.833984375,
0.37890625,
-0.242919921875,
-0.318359375,
-0.3935546875,
-0.73974609375,
0.338623046875,
0.209228515625,
-0.62890625,
-0.2471923828125,
-1.3974609375,
-0.306396484375,
-0.089111328125,
-0.376953125,
-0.047088623046875,
-0.331298828125,
-0.0188140869140625,
0.341796875,
-0.08056640625,
-0.712890625,
-0.60888671875,
-0.6337890625,
-0.306640625,
0.59228515625,
-0.041595458984375,
0.63232421875,
-0.218505859375,
-0.219482421875,
0.0379638671875,
-0.587890625,
-0.147705078125,
-0.281005859375,
0.05731201171875,
-0.09320068359375,
-0.377685546875,
-0.64306640625,
0.505859375,
-0.1573486328125,
-0.1490478515625,
0.6865234375,
0.2086181640625,
0.419677734375,
0.0231475830078125,
-0.456787109375,
0.9482421875,
0.3701171875,
-1.322265625,
-0.6337890625,
0.5458984375,
-0.13671875,
0.49365234375,
0.420166015625,
-0.267333984375,
-0.467041015625,
-1.203125,
0.07757568359375,
-0.4423828125,
-0.12939453125,
-0.420654296875,
-0.3505859375,
-0.2261962890625,
0.36767578125,
0.385498046875,
-1.0654296875,
-0.673828125,
-1.16015625,
0.490478515625,
-0.74609375,
-0.1649169921875,
-0.4951171875,
-0.56640625,
-0.45751953125,
0.98876953125,
-0.0926513671875,
-0.0445556640625,
-0.142822265625,
-0.03173828125,
0.61572265625,
0.55908203125,
-0.462646484375,
-0.63330078125,
-0.1759033203125,
0.21044921875,
-0.1475830078125,
0.1822509765625,
-0.410888671875,
0.62548828125,
-0.64501953125,
0.666015625,
0.027252197265625,
-0.53125,
-0.3544921875,
-0.2359619140625,
1.09375,
-0.64697265625,
-0.1507568359375,
-0.38330078125,
0.62451171875,
0.5869140625,
-0.67578125,
-0.837890625,
-0.44580078125,
-0.58935546875,
-0.978515625,
0.61669921875,
-0.51513671875,
0.171875,
-0.296630859375,
0.0204010009765625,
1.3115234375,
-0.5400390625,
0.671875,
1.419921875,
0.31494140625,
0.10272216796875,
-0.83740234375,
0.460693359375,
0.791015625,
-0.422607421875,
-0.16259765625,
0.19140625,
-0.6494140625,
0.01513671875,
-0.2115478515625,
-1.2373046875,
-0.5439453125,
0.1700439453125,
0.81640625,
-0.2242431640625,
0.42138671875,
-0.07415771484375,
-1.02734375,
-0.70703125,
0.9931640625,
0.0916748046875,
0.251220703125,
0.896484375,
0.01141357421875,
-0.046600341796875,
-0.19677734375,
-0.4482421875,
0.1375732421875,
-0.67138671875,
1.125,
-0.1646728515625,
-0.74755859375,
0.5205078125,
0.91650390625,
-1.08203125,
-0.677734375,
0.0098876953125,
-0.0418701171875,
-0.2216796875,
-0.430419921875,
-0.2349853515625,
0.7861328125,
-0.51171875,
0.3623046875,
0.71533203125,
0.2049560546875,
0.1226806640625,
0.30126953125,
0.21826171875,
-0.435302734375,
0.96484375,
0.79052734375,
-0.40771484375,
-0.67919921875,
-1.083984375,
-0.1876220703125,
-0.0958251953125,
-0.01422882080078125,
1.0595703125,
-0.346435546875,
0.156982421875,
0.476318359375,
-0.35302734375,
1.04296875,
-0.6630859375,
-0.183837890625,
0.033172607421875,
-0.47900390625,
-0.87744140625,
-0.251220703125,
0.21923828125,
0.0750732421875,
0.1478271484375,
-0.37109375,
0.26513671875,
0.8310546875,
0.461181640625,
-0.469970703125,
-1.533203125,
-0.342041015625,
-1.439453125,
-0.529296875,
-0.3701171875,
-0.175537109375,
-0.035125732421875,
-0.335205078125,
-0.33740234375,
-0.77685546875,
-0.41796875,
0.356201171875,
-0.1895751953125,
0.6220703125,
-1.15625,
0.37548828125,
-0.69580078125,
-0.66552734375,
-0.958984375,
0.178955078125,
-0.2060546875,
-0.0213775634765625,
-0.5888671875,
-0.13037109375,
-0.041534423828125,
0.3740234375,
-0.4384765625,
0.53125,
-0.344482421875,
-0.1424560546875,
0.00499725341796875,
0.2034912109375,
-0.3154296875,
1.09765625,
0.414306640625,
-0.08209228515625,
0.1551513671875,
-0.07000732421875,
-0.587890625,
-0.324951171875,
0.75927734375,
0.4462890625,
0.040435791015625,
-0.48095703125,
-0.7265625,
0.1822509765625,
-0.94287109375,
0.4990234375,
0.306396484375,
0.316650390625,
0.388671875,
-0.125244140625,
0.35595703125,
1.0615234375,
0.234375,
0.61962890625,
0.32373046875,
0.08929443359375,
0.7138671875,
0.457763671875,
-0.08929443359375,
-0.1807861328125,
-0.036590576171875,
0.034393310546875,
0.38134765625,
0.12103271484375,
-0.203857421875,
0.34326171875,
0.14404296875,
-0.56494140625,
-0.9189453125,
-0.41845703125,
0.07916259765625,
0.7412109375,
0.47216796875,
-0.362548828125,
0.11224365234375,
-0.34326171875,
-0.493408203125,
0.170654296875,
-1.2197265625,
-1.1005859375,
0.85009765625,
-0.3154296875,
-0.58740234375,
-0.174072265625,
-0.5732421875,
-0.4970703125,
0.35205078125,
0.54443359375,
-0.5419921875,
0.342041015625,
-0.225830078125,
0.164306640625,
-0.69091796875,
-0.136474609375,
-0.0003247261047363281,
0.11566162109375,
-0.849609375,
-0.273193359375,
0.2462158203125,
1.0078125,
0.263671875,
-0.12548828125,
-0.6171875,
-0.2169189453125,
-0.0635986328125,
0.276123046875,
-0.4658203125,
0.302734375,
-0.26123046875,
0.50830078125,
-1.1044921875,
0.09906005859375,
-0.38037109375,
0.697265625,
0.732421875,
-0.198974609375,
-0.415771484375,
0.7001953125,
0.5517578125,
-0.2744140625,
0.875,
0.681640625,
1.12890625,
0.01654052734375,
-0.03546142578125,
-0.01031494140625,
0.5302734375,
0.75537109375,
0.79248046875,
0.1414794921875,
0.4052734375,
0.640625,
0.3447265625,
-0.31494140625,
0.53564453125,
0.135498046875,
-0.362548828125,
0.1187744140625,
-0.270751953125,
-0.2423095703125,
-0.10528564453125,
-0.0927734375,
0.4462890625,
-0.466796875,
0.15576171875,
-0.71875,
-0.7099609375,
0.806640625,
-0.1300048828125,
-0.396484375,
0.294677734375,
-0.441162109375,
0.236328125,
0.6591796875,
0.03863525390625,
-0.55126953125,
0.95751953125,
0.494140625,
0.60107421875,
0.72802734375,
0.287353515625,
0.51611328125,
-0.08489990234375,
0.38916015625,
0.05828857421875,
0.60888671875,
-0.302490234375,
-0.317626953125,
-0.70556640625,
0.35107421875,
-0.383544921875,
-0.63037109375,
0.818359375,
-0.6630859375,
-0.00702667236328125,
-0.580078125,
0.9853515625,
-0.849609375,
0.111328125,
0.65185546875,
-0.269775390625,
-0.88916015625,
0.97216796875,
0.06890869140625,
0.446044921875,
0.68017578125,
0.9921875,
-0.145263671875,
1.5537109375,
0.5361328125,
0.1253662109375,
-0.16162109375,
0.4697265625,
-0.2008056640625,
-0.7099609375,
-0.53857421875,
-0.3349609375,
0.2313232421875,
-0.35595703125,
-0.6640625,
-0.462646484375,
0.5556640625,
0.0246429443359375,
-1.15625,
-0.279541015625,
0.19091796875,
-0.55322265625,
0.45751953125,
-0.0831298828125,
0.119140625,
-0.046722412109375,
0.249267578125,
-0.461669921875,
-0.92333984375,
-0.1041259765625,
-0.63330078125,
0.275390625,
-0.01001739501953125,
-0.65234375,
-0.62255859375,
-0.6708984375,
-0.13720703125,
0.08978271484375,
-0.56884765625,
-0.53466796875,
0.982421875,
0.80908203125,
0.274169921875,
0.071044921875,
-0.286865234375,
-0.291015625,
0.96484375,
0.896484375,
0.1612548828125,
0.98193359375,
0.1934814453125,
0.06341552734375,
0.25927734375,
-0.94677734375,
0.328125,
-0.05340576171875,
0.054534912109375,
-0.28857421875,
0.06201171875,
-0.560546875,
-1.0380859375,
-0.00577545166015625,
1.029296875,
0.1302490234375,
-0.78857421875,
-1.041015625,
-0.438232421875,
-1.2353515625,
-0.10003662109375,
-0.66455078125,
0.72265625,
-0.409912109375,
-0.34033203125,
-0.60791015625,
-0.9365234375,
4.22265625,
1.21484375,
1.02734375,
0.82763671875,
0.53564453125,
0.98291015625,
0.293701171875,
-0.57861328125,
-0.371337890625,
-0.90380859375,
0.66748046875,
-0.350830078125,
-0.135498046875,
0.58984375,
0.5400390625,
0.52001953125,
-0.908203125,
-0.2103271484375,
0.233642578125,
-0.650390625,
-0.73095703125,
0.525390625,
-0.1826171875,
0.71630859375,
-0.027801513671875,
0.68701171875,
0.8154296875,
-0.72265625,
-0.213623046875,
-0.68017578125,
-0.5126953125,
-0.5029296875,
0.68505859375,
0.3203125,
-0.70556640625,
0.279296875,
-0.1312255859375,
-0.47802734375,
-0.51416015625,
-0.048828125,
-0.029754638671875,
0.261474609375,
0.767578125,
-0.306640625,
-0.2044677734375,
0.46142578125,
-0.6015625,
0.5908203125,
0.57373046875,
-1.1865234375,
0.99267578125,
-0.62548828125,
0.6875,
-0.79296875,
-0.44091796875,
-0.336181640625,
0.392822265625,
-0.38671875,
-0.343505859375,
0.5380859375,
0.36376953125,
0.1561279296875,
-0.007537841796875,
0.82275390625,
-0.67041015625,
0.74462890625,
-0.377685546875,
0.186279296875,
-0.53564453125,
-0.3798828125,
-0.00548553466796875,
-0.00417327880859375,
0.259521484375,
-0.47021484375,
0.8271484375,
0.625,
-0.3232421875,
0.432861328125,
0.53076171875,
-0.97705078125,
0.250732421875,
0.0016450881958007812,
-0.29736328125,
-0.63232421875,
0.564453125,
0.57080078125,
-1.1220703125,
-0.1053466796875,
-0.10028076171875,
0.60400390625,
0.1661376953125,
0.49169921875,
-0.2489013671875,
-0.05377197265625,
-0.33642578125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Valery have come across an entirely new programming language. Most of all the language attracted him with template functions and procedures. Let us remind you that templates are tools of a language, designed to encode generic algorithms, without reference to some parameters (e.g., data types, buffer sizes, default values).
Valery decided to examine template procedures in this language in more detail. The description of a template procedure consists of the procedure name and the list of its parameter types. The generic type T parameters can be used as parameters of template procedures.
A procedure call consists of a procedure name and a list of variable parameters. Let's call a procedure suitable for this call if the following conditions are fulfilled:
* its name equals to the name of the called procedure;
* the number of its parameters equals to the number of parameters of the procedure call;
* the types of variables in the procedure call match the corresponding types of its parameters. The variable type matches the type of a parameter if the parameter has a generic type T or the type of the variable and the parameter are the same.
You are given a description of some set of template procedures. You are also given a list of variables used in the program, as well as direct procedure calls that use the described variables. For each call you need to count the number of procedures that are suitable for this call.
Input
The first line contains a single integer n (1 β€ n β€ 1000) β the number of template procedures. The next n lines contain the description of the procedures specified in the following format:
"void procedureName (type_1, type_2, ..., type_t)" (1 β€ t β€ 5), where void is the keyword, procedureName is the procedure name, type_i is the type of the next parameter. Types of language parameters can be "int", "string", "double", and the keyword "T", which denotes the generic type.
The next line contains a single integer m (1 β€ m β€ 1000) β the number of used variables. Next m lines specify the description of the variables in the following format:
"type variableName", where type is the type of variable that can take values "int", "string", "double", variableName β the name of the variable.
The next line contains a single integer k (1 β€ k β€ 1000) β the number of procedure calls. Next k lines specify the procedure calls in the following format:
"procedureName (var_1, var_2, ..., var_t)" (1 β€ t β€ 5), where procedureName is the name of the procedure, var_i is the name of a variable.
The lines describing the variables, template procedures and their calls may contain spaces at the beginning of the line and at the end of the line, before and after the brackets and commas. Spaces may be before and after keyword void. The length of each input line does not exceed 100 characters. The names of variables and procedures are non-empty strings of lowercase English letters and numbers with lengths of not more than 10 characters. Note that this is the only condition at the names. Only the specified variables are used in procedure calls. The names of the variables are distinct. No two procedures are the same. Two procedures are the same, if they have identical names and identical ordered sets of types of their parameters.
Output
On each of k lines print a single number, where the i-th number stands for the number of suitable template procedures for the i-th call.
Examples
Input
4
void f(int,T)
void f(T, T)
void foo123 ( int, double, string,string )
void p(T,double)
3
int a
string s
double x123
5
f(a, a)
f(s,a )
foo (a,s,s)
f ( s ,x123)
proc(a)
Output
2
1
0
1
0
Input
6
void f(string,double,int)
void f(int)
void f ( T )
void procedure(int,double)
void f (T, double,int)
void f(string, T,T)
4
int a
int x
string t
double val
5
f(t, a, a)
f(t,val,a)
f(val,a, val)
solve300(val, val)
f (x)
Output
1
3
0
0
2
Tags: binary search, brute force, expression parsing, implementation
Correct Solution:
```
func=int(input())
fnames=[]
fargs=[]
for i in range(func):
s=input().strip()[:-1].split('(')
fnames.append(s[0].split()[1])
arr=[j.strip() for j in s[1].split(',')]
fargs.append(arr)
#print(fnames)
#print(fargs)
something=[]
types=[]
t=int(input())
for i in range(t):
s=input().split()
types.append(s[0])
something.append(s[1])
togive=int(input())
#print(something)
#print(types)
for i in range(togive):
ss=input().strip()[:-1].split('(')
fun=ss[0].strip()
arr=[j.strip() for j in ss[1].split(',')]
#typess=[]
res=0
for j in range(len(arr)):
#re=''
#for s in range(t):
# print(something[s],arr[j])
# if something[s]==arr[j]:
# if len(re)==0:
# re=types[s]
# else:
# if types[s]=='T':
# re=types[s]
#arr[j]=re
arr[j]=types[something.index(arr[j])]
#print(fun,arr)
for f in range(func):
if fnames[f]==fun and len(arr)==len(fargs[f]):
#print(fnames[f],fun)
#arr_d=arr.count('double')
#arr_s=arr.count('string')
#arr_i=arr.count('int')
#f_d=fargs[f].count('double')
#f_i=fargs[f].count('int')
#f_s=fargs[f].count('string')
#if (arr_d==f_d and arr_i==f_i and arr_s==f_s) or (arr_d>=f_d and arr_s>=f_s and arr_i>=f_i and arr_d+arr_s+arr_i==f_d+f_i+f_s+fargs[f].count('T')):
# res+=1
sign=0
for aaa in range(len(arr)):
if arr[aaa]!=fargs[f][aaa] and fargs[f][aaa]!='T':
sign=1
if sign==0:
res+=1
print(res)
```
| 37,097
|
[
0.2352294921875,
-0.259521484375,
0.2236328125,
0.1781005859375,
-0.4794921875,
-0.363525390625,
-0.10736083984375,
0.05438232421875,
0.0230560302734375,
0.6220703125,
0.72119140625,
-0.173828125,
0.237060546875,
-0.454833984375,
-0.48681640625,
0.269287109375,
-0.439453125,
-0.89404296875,
-0.890625,
0.324462890625,
-0.1915283203125,
-0.003078460693359375,
-1.80859375,
-0.31103515625,
-0.57861328125,
0.72119140625,
0.56005859375,
-0.05224609375,
1.2177734375,
1.189453125,
-0.3623046875,
-0.4697265625,
0.28125,
-0.85986328125,
-0.232177734375,
-0.250244140625,
0.367919921875,
-0.78369140625,
-0.453857421875,
-0.2359619140625,
0.394775390625,
-0.1865234375,
0.306396484375,
-1.15234375,
-1.1689453125,
0.01103973388671875,
-0.0263671875,
-0.25634765625,
-0.0086822509765625,
-0.36962890625,
0.31884765625,
0.156005859375,
0.32861328125,
-0.46826171875,
-0.382568359375,
0.037689208984375,
0.0285797119140625,
0.10980224609375,
-0.4560546875,
-0.0657958984375,
-0.525390625,
0.30712890625,
0.005992889404296875,
-0.72119140625,
0.13720703125,
0.0921630859375,
0.06744384765625,
-0.236328125,
0.345703125,
-1.056640625,
-0.56884765625,
0.0810546875,
-0.71435546875,
-0.4697265625,
-0.042083740234375,
0.1771240234375,
0.59423828125,
0.09783935546875,
-0.57080078125,
0.30810546875,
0.64599609375,
0.994140625,
0.1416015625,
0.415771484375,
-0.5947265625,
-0.53076171875,
0.057464599609375,
0.1375732421875,
0.1651611328125,
-0.2198486328125,
-0.31396484375,
0.70947265625,
-0.1982421875,
-0.287353515625,
0.58544921875,
0.401123046875,
-0.28173828125,
0.7333984375,
0.111328125,
0.0036163330078125,
1.15625,
1.271484375,
-0.0751953125,
0.71337890625,
-0.44580078125,
0.74951171875,
0.56396484375,
0.337158203125,
-0.76904296875,
-0.440185546875,
-0.5107421875,
-0.5068359375,
0.2476806640625,
-0.254150390625,
-0.43896484375,
1.052734375,
0.01067352294921875,
-0.0211029052734375,
-0.53271484375,
0.14404296875,
0.3525390625,
0.272216796875,
0.067626953125,
-0.1912841796875,
0.09014892578125,
-0.432861328125,
-0.28076171875,
1.05078125,
-0.5888671875,
0.1448974609375,
-0.064697265625,
-0.348876953125,
-0.52734375,
0.50830078125,
-0.313720703125,
0.90625,
-0.320556640625,
0.51025390625,
0.3076171875,
-0.469482421875,
0.75732421875,
-0.1968994140625,
0.251708984375,
1.296875,
0.2200927734375,
0.339599609375,
1.0068359375,
-0.005123138427734375,
-0.83251953125,
0.53369140625,
-0.368408203125,
0.164306640625,
-0.228759765625,
0.039154052734375,
-0.03692626953125,
0.1248779296875,
-0.1607666015625,
-0.2054443359375,
0.084716796875,
0.138916015625,
-0.358642578125,
0.10882568359375,
0.06341552734375,
0.88232421875,
-0.32080078125,
0.8798828125,
-0.66259765625,
-0.2437744140625,
-0.32421875,
-0.677734375,
0.75390625,
-0.32763671875,
-0.47900390625,
0.53466796875,
1.103515625,
0.6533203125,
1.248046875,
-0.007503509521484375,
0.29150390625,
0.46435546875,
-0.2418212890625,
0.0533447265625,
0.302978515625,
0.779296875,
0.7197265625,
0.48828125,
0.283935546875,
-0.1124267578125,
-0.51953125,
-0.65478515625,
0.170166015625,
0.72119140625,
-0.6572265625,
0.27587890625,
0.2685546875,
-0.0037364959716796875,
-0.30908203125,
-0.10382080078125,
-0.145263671875,
-0.9521484375,
-0.828125,
0.55419921875,
-0.26904296875,
0.0186309814453125,
-0.533203125,
-0.185791015625,
-0.05609130859375,
1.3505859375,
-0.0943603515625,
0.1365966796875,
0.475341796875,
-0.0214385986328125,
-0.2264404296875,
-0.0019969940185546875,
0.06671142578125,
-0.3544921875,
-0.61181640625,
0.49609375,
-0.2646484375,
-0.08502197265625,
0.05450439453125,
0.74365234375,
0.7197265625,
0.042755126953125,
-0.488037109375,
-0.35107421875,
0.16162109375,
1.44140625,
0.00421142578125,
0.89111328125,
0.6533203125,
1.19921875,
0.52880859375,
1.0126953125,
0.61474609375,
0.28564453125,
0.96630859375,
1.0498046875,
0.284912109375,
0.33935546875,
-0.1378173828125,
0.422607421875,
0.45166015625,
0.13916015625,
0.00835418701171875,
0.494384765625,
-0.096923828125,
-0.260009765625,
-0.27099609375,
0.673828125,
-0.11676025390625,
1.033203125,
-0.0726318359375,
0.2822265625,
-0.1240234375,
-0.365966796875,
-0.30859375,
0.693359375,
-0.986328125,
-0.1876220703125,
0.3818359375,
0.141845703125,
0.406494140625,
0.1395263671875,
0.254150390625,
0.246337890625,
0.48046875,
0.225830078125,
-0.232666015625,
-0.99072265625,
-0.334228515625,
-0.96826171875,
-0.9921875,
-0.2109375,
-0.38720703125,
-0.09161376953125,
0.60693359375,
-0.73876953125,
0.2060546875,
-0.31982421875,
0.0819091796875,
0.3779296875,
-0.5947265625,
0.75927734375,
-0.0112457275390625,
0.21240234375,
-0.76708984375,
0.9140625,
-0.1876220703125,
0.87548828125,
-0.564453125,
-0.387451171875,
-0.0933837890625,
-0.70751953125,
0.3232421875,
0.1134033203125,
0.449951171875,
-0.299560546875,
-0.89453125,
-0.806640625,
-0.351318359375,
-0.2274169921875,
-0.71630859375,
0.38330078125,
-0.76318359375,
0.87060546875,
0.355224609375,
-0.845703125,
0.7314453125,
1.009765625,
-1.0810546875,
0.3662109375,
0.014923095703125,
0.0753173828125,
-0.77001953125,
1.3388671875,
0.4130859375,
0.36181640625,
-0.640625,
0.03887939453125,
-0.2401123046875,
-0.3330078125,
0.182861328125,
-0.4345703125,
-0.5361328125,
0.5966796875,
0.453369140625,
-0.93896484375,
0.480224609375,
-1.140625,
-0.126708984375,
-0.31640625,
-0.139404296875,
0.71435546875,
0.7470703125,
-0.1796875,
-0.03021240234375,
0.1324462890625,
-0.0121612548828125,
0.5185546875,
0.251953125,
-0.497802734375,
0.1953125,
0.5576171875,
0.079833984375,
0.57861328125,
0.425537109375,
-0.54833984375,
-0.062408447265625,
-0.5625,
0.138427734375,
0.62353515625,
0.337890625,
0.00640869140625,
-0.20849609375,
0.74658203125,
-0.52685546875,
-0.79443359375,
-0.37890625,
0.6181640625,
0.61328125,
0.65869140625,
0.192626953125,
-0.310546875,
-0.923828125,
-0.41162109375,
-0.25,
0.287353515625,
0.89990234375,
-1.0380859375,
0.7861328125,
-0.381103515625,
-0.58935546875,
-0.03759765625,
-0.61865234375,
0.10833740234375,
0.7783203125,
0.22412109375,
0.8623046875,
-0.89892578125,
-0.5986328125,
0.1456298828125,
0.06463623046875,
0.90673828125,
0.359619140625,
0.8369140625,
-0.12042236328125,
-0.379150390625,
-0.483154296875,
0.1741943359375,
0.2431640625,
-0.4873046875,
0.279052734375,
-0.358154296875,
-0.104248046875,
-1.1005859375,
0.38720703125,
0.74560546875,
0.415771484375,
0.11181640625,
0.384033203125,
0.1253662109375,
0.51708984375,
0.9091796875,
0.0955810546875,
0.1951904296875,
-0.38525390625,
0.43994140625,
0.1524658203125,
-0.2308349609375,
-0.76025390625,
-0.66015625,
0.053375244140625,
0.15380859375,
0.12335205078125,
0.0295562744140625,
-0.654296875,
0.156494140625,
0.0217132568359375,
0.60693359375,
-0.39794921875,
-0.49951171875,
-0.366455078125,
0.83544921875,
0.147705078125,
-0.457763671875,
0.36865234375,
-0.482177734375,
0.71923828125,
0.66796875,
-0.5595703125,
-0.83447265625,
-0.318603515625,
-0.71337890625,
-0.412841796875,
0.7529296875,
0.83154296875,
-0.27294921875,
0.63427734375,
-1.224609375,
0.11614990234375,
-0.1385498046875,
-0.085693359375,
0.058746337890625,
0.07049560546875,
0.51513671875,
0.50537109375,
0.34228515625,
-0.31201171875,
-0.56689453125,
0.166748046875,
-1.0478515625,
0.51611328125,
-0.759765625,
0.083251953125,
-0.0882568359375,
-0.1884765625,
-0.308349609375,
-0.028411865234375,
-0.51416015625,
0.1448974609375,
0.03851318359375,
0.353271484375,
-1.310546875,
-0.343505859375,
0.75732421875,
-0.163818359375,
0.00920867919921875,
0.97802734375,
0.2919921875,
-0.4677734375,
0.671875,
0.392822265625,
-0.5615234375,
0.264404296875,
-0.833984375,
0.37890625,
-0.242919921875,
-0.318359375,
-0.3935546875,
-0.73974609375,
0.338623046875,
0.209228515625,
-0.62890625,
-0.2471923828125,
-1.3974609375,
-0.306396484375,
-0.089111328125,
-0.376953125,
-0.047088623046875,
-0.331298828125,
-0.0188140869140625,
0.341796875,
-0.08056640625,
-0.712890625,
-0.60888671875,
-0.6337890625,
-0.306640625,
0.59228515625,
-0.041595458984375,
0.63232421875,
-0.218505859375,
-0.219482421875,
0.0379638671875,
-0.587890625,
-0.147705078125,
-0.281005859375,
0.05731201171875,
-0.09320068359375,
-0.377685546875,
-0.64306640625,
0.505859375,
-0.1573486328125,
-0.1490478515625,
0.6865234375,
0.2086181640625,
0.419677734375,
0.0231475830078125,
-0.456787109375,
0.9482421875,
0.3701171875,
-1.322265625,
-0.6337890625,
0.5458984375,
-0.13671875,
0.49365234375,
0.420166015625,
-0.267333984375,
-0.467041015625,
-1.203125,
0.07757568359375,
-0.4423828125,
-0.12939453125,
-0.420654296875,
-0.3505859375,
-0.2261962890625,
0.36767578125,
0.385498046875,
-1.0654296875,
-0.673828125,
-1.16015625,
0.490478515625,
-0.74609375,
-0.1649169921875,
-0.4951171875,
-0.56640625,
-0.45751953125,
0.98876953125,
-0.0926513671875,
-0.0445556640625,
-0.142822265625,
-0.03173828125,
0.61572265625,
0.55908203125,
-0.462646484375,
-0.63330078125,
-0.1759033203125,
0.21044921875,
-0.1475830078125,
0.1822509765625,
-0.410888671875,
0.62548828125,
-0.64501953125,
0.666015625,
0.027252197265625,
-0.53125,
-0.3544921875,
-0.2359619140625,
1.09375,
-0.64697265625,
-0.1507568359375,
-0.38330078125,
0.62451171875,
0.5869140625,
-0.67578125,
-0.837890625,
-0.44580078125,
-0.58935546875,
-0.978515625,
0.61669921875,
-0.51513671875,
0.171875,
-0.296630859375,
0.0204010009765625,
1.3115234375,
-0.5400390625,
0.671875,
1.419921875,
0.31494140625,
0.10272216796875,
-0.83740234375,
0.460693359375,
0.791015625,
-0.422607421875,
-0.16259765625,
0.19140625,
-0.6494140625,
0.01513671875,
-0.2115478515625,
-1.2373046875,
-0.5439453125,
0.1700439453125,
0.81640625,
-0.2242431640625,
0.42138671875,
-0.07415771484375,
-1.02734375,
-0.70703125,
0.9931640625,
0.0916748046875,
0.251220703125,
0.896484375,
0.01141357421875,
-0.046600341796875,
-0.19677734375,
-0.4482421875,
0.1375732421875,
-0.67138671875,
1.125,
-0.1646728515625,
-0.74755859375,
0.5205078125,
0.91650390625,
-1.08203125,
-0.677734375,
0.0098876953125,
-0.0418701171875,
-0.2216796875,
-0.430419921875,
-0.2349853515625,
0.7861328125,
-0.51171875,
0.3623046875,
0.71533203125,
0.2049560546875,
0.1226806640625,
0.30126953125,
0.21826171875,
-0.435302734375,
0.96484375,
0.79052734375,
-0.40771484375,
-0.67919921875,
-1.083984375,
-0.1876220703125,
-0.0958251953125,
-0.01422882080078125,
1.0595703125,
-0.346435546875,
0.156982421875,
0.476318359375,
-0.35302734375,
1.04296875,
-0.6630859375,
-0.183837890625,
0.033172607421875,
-0.47900390625,
-0.87744140625,
-0.251220703125,
0.21923828125,
0.0750732421875,
0.1478271484375,
-0.37109375,
0.26513671875,
0.8310546875,
0.461181640625,
-0.469970703125,
-1.533203125,
-0.342041015625,
-1.439453125,
-0.529296875,
-0.3701171875,
-0.175537109375,
-0.035125732421875,
-0.335205078125,
-0.33740234375,
-0.77685546875,
-0.41796875,
0.356201171875,
-0.1895751953125,
0.6220703125,
-1.15625,
0.37548828125,
-0.69580078125,
-0.66552734375,
-0.958984375,
0.178955078125,
-0.2060546875,
-0.0213775634765625,
-0.5888671875,
-0.13037109375,
-0.041534423828125,
0.3740234375,
-0.4384765625,
0.53125,
-0.344482421875,
-0.1424560546875,
0.00499725341796875,
0.2034912109375,
-0.3154296875,
1.09765625,
0.414306640625,
-0.08209228515625,
0.1551513671875,
-0.07000732421875,
-0.587890625,
-0.324951171875,
0.75927734375,
0.4462890625,
0.040435791015625,
-0.48095703125,
-0.7265625,
0.1822509765625,
-0.94287109375,
0.4990234375,
0.306396484375,
0.316650390625,
0.388671875,
-0.125244140625,
0.35595703125,
1.0615234375,
0.234375,
0.61962890625,
0.32373046875,
0.08929443359375,
0.7138671875,
0.457763671875,
-0.08929443359375,
-0.1807861328125,
-0.036590576171875,
0.034393310546875,
0.38134765625,
0.12103271484375,
-0.203857421875,
0.34326171875,
0.14404296875,
-0.56494140625,
-0.9189453125,
-0.41845703125,
0.07916259765625,
0.7412109375,
0.47216796875,
-0.362548828125,
0.11224365234375,
-0.34326171875,
-0.493408203125,
0.170654296875,
-1.2197265625,
-1.1005859375,
0.85009765625,
-0.3154296875,
-0.58740234375,
-0.174072265625,
-0.5732421875,
-0.4970703125,
0.35205078125,
0.54443359375,
-0.5419921875,
0.342041015625,
-0.225830078125,
0.164306640625,
-0.69091796875,
-0.136474609375,
-0.0003247261047363281,
0.11566162109375,
-0.849609375,
-0.273193359375,
0.2462158203125,
1.0078125,
0.263671875,
-0.12548828125,
-0.6171875,
-0.2169189453125,
-0.0635986328125,
0.276123046875,
-0.4658203125,
0.302734375,
-0.26123046875,
0.50830078125,
-1.1044921875,
0.09906005859375,
-0.38037109375,
0.697265625,
0.732421875,
-0.198974609375,
-0.415771484375,
0.7001953125,
0.5517578125,
-0.2744140625,
0.875,
0.681640625,
1.12890625,
0.01654052734375,
-0.03546142578125,
-0.01031494140625,
0.5302734375,
0.75537109375,
0.79248046875,
0.1414794921875,
0.4052734375,
0.640625,
0.3447265625,
-0.31494140625,
0.53564453125,
0.135498046875,
-0.362548828125,
0.1187744140625,
-0.270751953125,
-0.2423095703125,
-0.10528564453125,
-0.0927734375,
0.4462890625,
-0.466796875,
0.15576171875,
-0.71875,
-0.7099609375,
0.806640625,
-0.1300048828125,
-0.396484375,
0.294677734375,
-0.441162109375,
0.236328125,
0.6591796875,
0.03863525390625,
-0.55126953125,
0.95751953125,
0.494140625,
0.60107421875,
0.72802734375,
0.287353515625,
0.51611328125,
-0.08489990234375,
0.38916015625,
0.05828857421875,
0.60888671875,
-0.302490234375,
-0.317626953125,
-0.70556640625,
0.35107421875,
-0.383544921875,
-0.63037109375,
0.818359375,
-0.6630859375,
-0.00702667236328125,
-0.580078125,
0.9853515625,
-0.849609375,
0.111328125,
0.65185546875,
-0.269775390625,
-0.88916015625,
0.97216796875,
0.06890869140625,
0.446044921875,
0.68017578125,
0.9921875,
-0.145263671875,
1.5537109375,
0.5361328125,
0.1253662109375,
-0.16162109375,
0.4697265625,
-0.2008056640625,
-0.7099609375,
-0.53857421875,
-0.3349609375,
0.2313232421875,
-0.35595703125,
-0.6640625,
-0.462646484375,
0.5556640625,
0.0246429443359375,
-1.15625,
-0.279541015625,
0.19091796875,
-0.55322265625,
0.45751953125,
-0.0831298828125,
0.119140625,
-0.046722412109375,
0.249267578125,
-0.461669921875,
-0.92333984375,
-0.1041259765625,
-0.63330078125,
0.275390625,
-0.01001739501953125,
-0.65234375,
-0.62255859375,
-0.6708984375,
-0.13720703125,
0.08978271484375,
-0.56884765625,
-0.53466796875,
0.982421875,
0.80908203125,
0.274169921875,
0.071044921875,
-0.286865234375,
-0.291015625,
0.96484375,
0.896484375,
0.1612548828125,
0.98193359375,
0.1934814453125,
0.06341552734375,
0.25927734375,
-0.94677734375,
0.328125,
-0.05340576171875,
0.054534912109375,
-0.28857421875,
0.06201171875,
-0.560546875,
-1.0380859375,
-0.00577545166015625,
1.029296875,
0.1302490234375,
-0.78857421875,
-1.041015625,
-0.438232421875,
-1.2353515625,
-0.10003662109375,
-0.66455078125,
0.72265625,
-0.409912109375,
-0.34033203125,
-0.60791015625,
-0.9365234375,
4.22265625,
1.21484375,
1.02734375,
0.82763671875,
0.53564453125,
0.98291015625,
0.293701171875,
-0.57861328125,
-0.371337890625,
-0.90380859375,
0.66748046875,
-0.350830078125,
-0.135498046875,
0.58984375,
0.5400390625,
0.52001953125,
-0.908203125,
-0.2103271484375,
0.233642578125,
-0.650390625,
-0.73095703125,
0.525390625,
-0.1826171875,
0.71630859375,
-0.027801513671875,
0.68701171875,
0.8154296875,
-0.72265625,
-0.213623046875,
-0.68017578125,
-0.5126953125,
-0.5029296875,
0.68505859375,
0.3203125,
-0.70556640625,
0.279296875,
-0.1312255859375,
-0.47802734375,
-0.51416015625,
-0.048828125,
-0.029754638671875,
0.261474609375,
0.767578125,
-0.306640625,
-0.2044677734375,
0.46142578125,
-0.6015625,
0.5908203125,
0.57373046875,
-1.1865234375,
0.99267578125,
-0.62548828125,
0.6875,
-0.79296875,
-0.44091796875,
-0.336181640625,
0.392822265625,
-0.38671875,
-0.343505859375,
0.5380859375,
0.36376953125,
0.1561279296875,
-0.007537841796875,
0.82275390625,
-0.67041015625,
0.74462890625,
-0.377685546875,
0.186279296875,
-0.53564453125,
-0.3798828125,
-0.00548553466796875,
-0.00417327880859375,
0.259521484375,
-0.47021484375,
0.8271484375,
0.625,
-0.3232421875,
0.432861328125,
0.53076171875,
-0.97705078125,
0.250732421875,
0.0016450881958007812,
-0.29736328125,
-0.63232421875,
0.564453125,
0.57080078125,
-1.1220703125,
-0.1053466796875,
-0.10028076171875,
0.60400390625,
0.1661376953125,
0.49169921875,
-0.2489013671875,
-0.05377197265625,
-0.33642578125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Valery have come across an entirely new programming language. Most of all the language attracted him with template functions and procedures. Let us remind you that templates are tools of a language, designed to encode generic algorithms, without reference to some parameters (e.g., data types, buffer sizes, default values).
Valery decided to examine template procedures in this language in more detail. The description of a template procedure consists of the procedure name and the list of its parameter types. The generic type T parameters can be used as parameters of template procedures.
A procedure call consists of a procedure name and a list of variable parameters. Let's call a procedure suitable for this call if the following conditions are fulfilled:
* its name equals to the name of the called procedure;
* the number of its parameters equals to the number of parameters of the procedure call;
* the types of variables in the procedure call match the corresponding types of its parameters. The variable type matches the type of a parameter if the parameter has a generic type T or the type of the variable and the parameter are the same.
You are given a description of some set of template procedures. You are also given a list of variables used in the program, as well as direct procedure calls that use the described variables. For each call you need to count the number of procedures that are suitable for this call.
Input
The first line contains a single integer n (1 β€ n β€ 1000) β the number of template procedures. The next n lines contain the description of the procedures specified in the following format:
"void procedureName (type_1, type_2, ..., type_t)" (1 β€ t β€ 5), where void is the keyword, procedureName is the procedure name, type_i is the type of the next parameter. Types of language parameters can be "int", "string", "double", and the keyword "T", which denotes the generic type.
The next line contains a single integer m (1 β€ m β€ 1000) β the number of used variables. Next m lines specify the description of the variables in the following format:
"type variableName", where type is the type of variable that can take values "int", "string", "double", variableName β the name of the variable.
The next line contains a single integer k (1 β€ k β€ 1000) β the number of procedure calls. Next k lines specify the procedure calls in the following format:
"procedureName (var_1, var_2, ..., var_t)" (1 β€ t β€ 5), where procedureName is the name of the procedure, var_i is the name of a variable.
The lines describing the variables, template procedures and their calls may contain spaces at the beginning of the line and at the end of the line, before and after the brackets and commas. Spaces may be before and after keyword void. The length of each input line does not exceed 100 characters. The names of variables and procedures are non-empty strings of lowercase English letters and numbers with lengths of not more than 10 characters. Note that this is the only condition at the names. Only the specified variables are used in procedure calls. The names of the variables are distinct. No two procedures are the same. Two procedures are the same, if they have identical names and identical ordered sets of types of their parameters.
Output
On each of k lines print a single number, where the i-th number stands for the number of suitable template procedures for the i-th call.
Examples
Input
4
void f(int,T)
void f(T, T)
void foo123 ( int, double, string,string )
void p(T,double)
3
int a
string s
double x123
5
f(a, a)
f(s,a )
foo (a,s,s)
f ( s ,x123)
proc(a)
Output
2
1
0
1
0
Input
6
void f(string,double,int)
void f(int)
void f ( T )
void procedure(int,double)
void f (T, double,int)
void f(string, T,T)
4
int a
int x
string t
double val
5
f(t, a, a)
f(t,val,a)
f(val,a, val)
solve300(val, val)
f (x)
Output
1
3
0
0
2
Tags: binary search, brute force, expression parsing, implementation
Correct Solution:
```
def main():
from collections import defaultdict
import sys
strings = sys.stdin.read().split('\n')
strings.reverse()
f = defaultdict(lambda: defaultdict(int))
n = int(strings.pop())
for i in range(n):
s = strings.pop().replace('(', ' ').replace(')', ' ').replace(',', ' ')
_, name, *args = s.split()
f[name][tuple(args)] += 1
m = int(strings.pop())
variables = dict(reversed(strings.pop().split()) for j in range(m))
result = []
k = int(strings.pop())
for i in range(k):
s = strings.pop().replace('(', ' ').replace(')', ' ').replace(',', ' ')
name, *args = s.split()
count = 0
args = [variables[i] for i in args]
N = len(args)
for mask in range(1 << N):
tmp = tuple('T' if mask & (1 << i) else args[i] for i in range(N))
count += f[name][tmp]
result.append(str(count))
print('\n'.join(result))
main()
```
| 37,098
|
[
0.2352294921875,
-0.259521484375,
0.2236328125,
0.1781005859375,
-0.4794921875,
-0.363525390625,
-0.10736083984375,
0.05438232421875,
0.0230560302734375,
0.6220703125,
0.72119140625,
-0.173828125,
0.237060546875,
-0.454833984375,
-0.48681640625,
0.269287109375,
-0.439453125,
-0.89404296875,
-0.890625,
0.324462890625,
-0.1915283203125,
-0.003078460693359375,
-1.80859375,
-0.31103515625,
-0.57861328125,
0.72119140625,
0.56005859375,
-0.05224609375,
1.2177734375,
1.189453125,
-0.3623046875,
-0.4697265625,
0.28125,
-0.85986328125,
-0.232177734375,
-0.250244140625,
0.367919921875,
-0.78369140625,
-0.453857421875,
-0.2359619140625,
0.394775390625,
-0.1865234375,
0.306396484375,
-1.15234375,
-1.1689453125,
0.01103973388671875,
-0.0263671875,
-0.25634765625,
-0.0086822509765625,
-0.36962890625,
0.31884765625,
0.156005859375,
0.32861328125,
-0.46826171875,
-0.382568359375,
0.037689208984375,
0.0285797119140625,
0.10980224609375,
-0.4560546875,
-0.0657958984375,
-0.525390625,
0.30712890625,
0.005992889404296875,
-0.72119140625,
0.13720703125,
0.0921630859375,
0.06744384765625,
-0.236328125,
0.345703125,
-1.056640625,
-0.56884765625,
0.0810546875,
-0.71435546875,
-0.4697265625,
-0.042083740234375,
0.1771240234375,
0.59423828125,
0.09783935546875,
-0.57080078125,
0.30810546875,
0.64599609375,
0.994140625,
0.1416015625,
0.415771484375,
-0.5947265625,
-0.53076171875,
0.057464599609375,
0.1375732421875,
0.1651611328125,
-0.2198486328125,
-0.31396484375,
0.70947265625,
-0.1982421875,
-0.287353515625,
0.58544921875,
0.401123046875,
-0.28173828125,
0.7333984375,
0.111328125,
0.0036163330078125,
1.15625,
1.271484375,
-0.0751953125,
0.71337890625,
-0.44580078125,
0.74951171875,
0.56396484375,
0.337158203125,
-0.76904296875,
-0.440185546875,
-0.5107421875,
-0.5068359375,
0.2476806640625,
-0.254150390625,
-0.43896484375,
1.052734375,
0.01067352294921875,
-0.0211029052734375,
-0.53271484375,
0.14404296875,
0.3525390625,
0.272216796875,
0.067626953125,
-0.1912841796875,
0.09014892578125,
-0.432861328125,
-0.28076171875,
1.05078125,
-0.5888671875,
0.1448974609375,
-0.064697265625,
-0.348876953125,
-0.52734375,
0.50830078125,
-0.313720703125,
0.90625,
-0.320556640625,
0.51025390625,
0.3076171875,
-0.469482421875,
0.75732421875,
-0.1968994140625,
0.251708984375,
1.296875,
0.2200927734375,
0.339599609375,
1.0068359375,
-0.005123138427734375,
-0.83251953125,
0.53369140625,
-0.368408203125,
0.164306640625,
-0.228759765625,
0.039154052734375,
-0.03692626953125,
0.1248779296875,
-0.1607666015625,
-0.2054443359375,
0.084716796875,
0.138916015625,
-0.358642578125,
0.10882568359375,
0.06341552734375,
0.88232421875,
-0.32080078125,
0.8798828125,
-0.66259765625,
-0.2437744140625,
-0.32421875,
-0.677734375,
0.75390625,
-0.32763671875,
-0.47900390625,
0.53466796875,
1.103515625,
0.6533203125,
1.248046875,
-0.007503509521484375,
0.29150390625,
0.46435546875,
-0.2418212890625,
0.0533447265625,
0.302978515625,
0.779296875,
0.7197265625,
0.48828125,
0.283935546875,
-0.1124267578125,
-0.51953125,
-0.65478515625,
0.170166015625,
0.72119140625,
-0.6572265625,
0.27587890625,
0.2685546875,
-0.0037364959716796875,
-0.30908203125,
-0.10382080078125,
-0.145263671875,
-0.9521484375,
-0.828125,
0.55419921875,
-0.26904296875,
0.0186309814453125,
-0.533203125,
-0.185791015625,
-0.05609130859375,
1.3505859375,
-0.0943603515625,
0.1365966796875,
0.475341796875,
-0.0214385986328125,
-0.2264404296875,
-0.0019969940185546875,
0.06671142578125,
-0.3544921875,
-0.61181640625,
0.49609375,
-0.2646484375,
-0.08502197265625,
0.05450439453125,
0.74365234375,
0.7197265625,
0.042755126953125,
-0.488037109375,
-0.35107421875,
0.16162109375,
1.44140625,
0.00421142578125,
0.89111328125,
0.6533203125,
1.19921875,
0.52880859375,
1.0126953125,
0.61474609375,
0.28564453125,
0.96630859375,
1.0498046875,
0.284912109375,
0.33935546875,
-0.1378173828125,
0.422607421875,
0.45166015625,
0.13916015625,
0.00835418701171875,
0.494384765625,
-0.096923828125,
-0.260009765625,
-0.27099609375,
0.673828125,
-0.11676025390625,
1.033203125,
-0.0726318359375,
0.2822265625,
-0.1240234375,
-0.365966796875,
-0.30859375,
0.693359375,
-0.986328125,
-0.1876220703125,
0.3818359375,
0.141845703125,
0.406494140625,
0.1395263671875,
0.254150390625,
0.246337890625,
0.48046875,
0.225830078125,
-0.232666015625,
-0.99072265625,
-0.334228515625,
-0.96826171875,
-0.9921875,
-0.2109375,
-0.38720703125,
-0.09161376953125,
0.60693359375,
-0.73876953125,
0.2060546875,
-0.31982421875,
0.0819091796875,
0.3779296875,
-0.5947265625,
0.75927734375,
-0.0112457275390625,
0.21240234375,
-0.76708984375,
0.9140625,
-0.1876220703125,
0.87548828125,
-0.564453125,
-0.387451171875,
-0.0933837890625,
-0.70751953125,
0.3232421875,
0.1134033203125,
0.449951171875,
-0.299560546875,
-0.89453125,
-0.806640625,
-0.351318359375,
-0.2274169921875,
-0.71630859375,
0.38330078125,
-0.76318359375,
0.87060546875,
0.355224609375,
-0.845703125,
0.7314453125,
1.009765625,
-1.0810546875,
0.3662109375,
0.014923095703125,
0.0753173828125,
-0.77001953125,
1.3388671875,
0.4130859375,
0.36181640625,
-0.640625,
0.03887939453125,
-0.2401123046875,
-0.3330078125,
0.182861328125,
-0.4345703125,
-0.5361328125,
0.5966796875,
0.453369140625,
-0.93896484375,
0.480224609375,
-1.140625,
-0.126708984375,
-0.31640625,
-0.139404296875,
0.71435546875,
0.7470703125,
-0.1796875,
-0.03021240234375,
0.1324462890625,
-0.0121612548828125,
0.5185546875,
0.251953125,
-0.497802734375,
0.1953125,
0.5576171875,
0.079833984375,
0.57861328125,
0.425537109375,
-0.54833984375,
-0.062408447265625,
-0.5625,
0.138427734375,
0.62353515625,
0.337890625,
0.00640869140625,
-0.20849609375,
0.74658203125,
-0.52685546875,
-0.79443359375,
-0.37890625,
0.6181640625,
0.61328125,
0.65869140625,
0.192626953125,
-0.310546875,
-0.923828125,
-0.41162109375,
-0.25,
0.287353515625,
0.89990234375,
-1.0380859375,
0.7861328125,
-0.381103515625,
-0.58935546875,
-0.03759765625,
-0.61865234375,
0.10833740234375,
0.7783203125,
0.22412109375,
0.8623046875,
-0.89892578125,
-0.5986328125,
0.1456298828125,
0.06463623046875,
0.90673828125,
0.359619140625,
0.8369140625,
-0.12042236328125,
-0.379150390625,
-0.483154296875,
0.1741943359375,
0.2431640625,
-0.4873046875,
0.279052734375,
-0.358154296875,
-0.104248046875,
-1.1005859375,
0.38720703125,
0.74560546875,
0.415771484375,
0.11181640625,
0.384033203125,
0.1253662109375,
0.51708984375,
0.9091796875,
0.0955810546875,
0.1951904296875,
-0.38525390625,
0.43994140625,
0.1524658203125,
-0.2308349609375,
-0.76025390625,
-0.66015625,
0.053375244140625,
0.15380859375,
0.12335205078125,
0.0295562744140625,
-0.654296875,
0.156494140625,
0.0217132568359375,
0.60693359375,
-0.39794921875,
-0.49951171875,
-0.366455078125,
0.83544921875,
0.147705078125,
-0.457763671875,
0.36865234375,
-0.482177734375,
0.71923828125,
0.66796875,
-0.5595703125,
-0.83447265625,
-0.318603515625,
-0.71337890625,
-0.412841796875,
0.7529296875,
0.83154296875,
-0.27294921875,
0.63427734375,
-1.224609375,
0.11614990234375,
-0.1385498046875,
-0.085693359375,
0.058746337890625,
0.07049560546875,
0.51513671875,
0.50537109375,
0.34228515625,
-0.31201171875,
-0.56689453125,
0.166748046875,
-1.0478515625,
0.51611328125,
-0.759765625,
0.083251953125,
-0.0882568359375,
-0.1884765625,
-0.308349609375,
-0.028411865234375,
-0.51416015625,
0.1448974609375,
0.03851318359375,
0.353271484375,
-1.310546875,
-0.343505859375,
0.75732421875,
-0.163818359375,
0.00920867919921875,
0.97802734375,
0.2919921875,
-0.4677734375,
0.671875,
0.392822265625,
-0.5615234375,
0.264404296875,
-0.833984375,
0.37890625,
-0.242919921875,
-0.318359375,
-0.3935546875,
-0.73974609375,
0.338623046875,
0.209228515625,
-0.62890625,
-0.2471923828125,
-1.3974609375,
-0.306396484375,
-0.089111328125,
-0.376953125,
-0.047088623046875,
-0.331298828125,
-0.0188140869140625,
0.341796875,
-0.08056640625,
-0.712890625,
-0.60888671875,
-0.6337890625,
-0.306640625,
0.59228515625,
-0.041595458984375,
0.63232421875,
-0.218505859375,
-0.219482421875,
0.0379638671875,
-0.587890625,
-0.147705078125,
-0.281005859375,
0.05731201171875,
-0.09320068359375,
-0.377685546875,
-0.64306640625,
0.505859375,
-0.1573486328125,
-0.1490478515625,
0.6865234375,
0.2086181640625,
0.419677734375,
0.0231475830078125,
-0.456787109375,
0.9482421875,
0.3701171875,
-1.322265625,
-0.6337890625,
0.5458984375,
-0.13671875,
0.49365234375,
0.420166015625,
-0.267333984375,
-0.467041015625,
-1.203125,
0.07757568359375,
-0.4423828125,
-0.12939453125,
-0.420654296875,
-0.3505859375,
-0.2261962890625,
0.36767578125,
0.385498046875,
-1.0654296875,
-0.673828125,
-1.16015625,
0.490478515625,
-0.74609375,
-0.1649169921875,
-0.4951171875,
-0.56640625,
-0.45751953125,
0.98876953125,
-0.0926513671875,
-0.0445556640625,
-0.142822265625,
-0.03173828125,
0.61572265625,
0.55908203125,
-0.462646484375,
-0.63330078125,
-0.1759033203125,
0.21044921875,
-0.1475830078125,
0.1822509765625,
-0.410888671875,
0.62548828125,
-0.64501953125,
0.666015625,
0.027252197265625,
-0.53125,
-0.3544921875,
-0.2359619140625,
1.09375,
-0.64697265625,
-0.1507568359375,
-0.38330078125,
0.62451171875,
0.5869140625,
-0.67578125,
-0.837890625,
-0.44580078125,
-0.58935546875,
-0.978515625,
0.61669921875,
-0.51513671875,
0.171875,
-0.296630859375,
0.0204010009765625,
1.3115234375,
-0.5400390625,
0.671875,
1.419921875,
0.31494140625,
0.10272216796875,
-0.83740234375,
0.460693359375,
0.791015625,
-0.422607421875,
-0.16259765625,
0.19140625,
-0.6494140625,
0.01513671875,
-0.2115478515625,
-1.2373046875,
-0.5439453125,
0.1700439453125,
0.81640625,
-0.2242431640625,
0.42138671875,
-0.07415771484375,
-1.02734375,
-0.70703125,
0.9931640625,
0.0916748046875,
0.251220703125,
0.896484375,
0.01141357421875,
-0.046600341796875,
-0.19677734375,
-0.4482421875,
0.1375732421875,
-0.67138671875,
1.125,
-0.1646728515625,
-0.74755859375,
0.5205078125,
0.91650390625,
-1.08203125,
-0.677734375,
0.0098876953125,
-0.0418701171875,
-0.2216796875,
-0.430419921875,
-0.2349853515625,
0.7861328125,
-0.51171875,
0.3623046875,
0.71533203125,
0.2049560546875,
0.1226806640625,
0.30126953125,
0.21826171875,
-0.435302734375,
0.96484375,
0.79052734375,
-0.40771484375,
-0.67919921875,
-1.083984375,
-0.1876220703125,
-0.0958251953125,
-0.01422882080078125,
1.0595703125,
-0.346435546875,
0.156982421875,
0.476318359375,
-0.35302734375,
1.04296875,
-0.6630859375,
-0.183837890625,
0.033172607421875,
-0.47900390625,
-0.87744140625,
-0.251220703125,
0.21923828125,
0.0750732421875,
0.1478271484375,
-0.37109375,
0.26513671875,
0.8310546875,
0.461181640625,
-0.469970703125,
-1.533203125,
-0.342041015625,
-1.439453125,
-0.529296875,
-0.3701171875,
-0.175537109375,
-0.035125732421875,
-0.335205078125,
-0.33740234375,
-0.77685546875,
-0.41796875,
0.356201171875,
-0.1895751953125,
0.6220703125,
-1.15625,
0.37548828125,
-0.69580078125,
-0.66552734375,
-0.958984375,
0.178955078125,
-0.2060546875,
-0.0213775634765625,
-0.5888671875,
-0.13037109375,
-0.041534423828125,
0.3740234375,
-0.4384765625,
0.53125,
-0.344482421875,
-0.1424560546875,
0.00499725341796875,
0.2034912109375,
-0.3154296875,
1.09765625,
0.414306640625,
-0.08209228515625,
0.1551513671875,
-0.07000732421875,
-0.587890625,
-0.324951171875,
0.75927734375,
0.4462890625,
0.040435791015625,
-0.48095703125,
-0.7265625,
0.1822509765625,
-0.94287109375,
0.4990234375,
0.306396484375,
0.316650390625,
0.388671875,
-0.125244140625,
0.35595703125,
1.0615234375,
0.234375,
0.61962890625,
0.32373046875,
0.08929443359375,
0.7138671875,
0.457763671875,
-0.08929443359375,
-0.1807861328125,
-0.036590576171875,
0.034393310546875,
0.38134765625,
0.12103271484375,
-0.203857421875,
0.34326171875,
0.14404296875,
-0.56494140625,
-0.9189453125,
-0.41845703125,
0.07916259765625,
0.7412109375,
0.47216796875,
-0.362548828125,
0.11224365234375,
-0.34326171875,
-0.493408203125,
0.170654296875,
-1.2197265625,
-1.1005859375,
0.85009765625,
-0.3154296875,
-0.58740234375,
-0.174072265625,
-0.5732421875,
-0.4970703125,
0.35205078125,
0.54443359375,
-0.5419921875,
0.342041015625,
-0.225830078125,
0.164306640625,
-0.69091796875,
-0.136474609375,
-0.0003247261047363281,
0.11566162109375,
-0.849609375,
-0.273193359375,
0.2462158203125,
1.0078125,
0.263671875,
-0.12548828125,
-0.6171875,
-0.2169189453125,
-0.0635986328125,
0.276123046875,
-0.4658203125,
0.302734375,
-0.26123046875,
0.50830078125,
-1.1044921875,
0.09906005859375,
-0.38037109375,
0.697265625,
0.732421875,
-0.198974609375,
-0.415771484375,
0.7001953125,
0.5517578125,
-0.2744140625,
0.875,
0.681640625,
1.12890625,
0.01654052734375,
-0.03546142578125,
-0.01031494140625,
0.5302734375,
0.75537109375,
0.79248046875,
0.1414794921875,
0.4052734375,
0.640625,
0.3447265625,
-0.31494140625,
0.53564453125,
0.135498046875,
-0.362548828125,
0.1187744140625,
-0.270751953125,
-0.2423095703125,
-0.10528564453125,
-0.0927734375,
0.4462890625,
-0.466796875,
0.15576171875,
-0.71875,
-0.7099609375,
0.806640625,
-0.1300048828125,
-0.396484375,
0.294677734375,
-0.441162109375,
0.236328125,
0.6591796875,
0.03863525390625,
-0.55126953125,
0.95751953125,
0.494140625,
0.60107421875,
0.72802734375,
0.287353515625,
0.51611328125,
-0.08489990234375,
0.38916015625,
0.05828857421875,
0.60888671875,
-0.302490234375,
-0.317626953125,
-0.70556640625,
0.35107421875,
-0.383544921875,
-0.63037109375,
0.818359375,
-0.6630859375,
-0.00702667236328125,
-0.580078125,
0.9853515625,
-0.849609375,
0.111328125,
0.65185546875,
-0.269775390625,
-0.88916015625,
0.97216796875,
0.06890869140625,
0.446044921875,
0.68017578125,
0.9921875,
-0.145263671875,
1.5537109375,
0.5361328125,
0.1253662109375,
-0.16162109375,
0.4697265625,
-0.2008056640625,
-0.7099609375,
-0.53857421875,
-0.3349609375,
0.2313232421875,
-0.35595703125,
-0.6640625,
-0.462646484375,
0.5556640625,
0.0246429443359375,
-1.15625,
-0.279541015625,
0.19091796875,
-0.55322265625,
0.45751953125,
-0.0831298828125,
0.119140625,
-0.046722412109375,
0.249267578125,
-0.461669921875,
-0.92333984375,
-0.1041259765625,
-0.63330078125,
0.275390625,
-0.01001739501953125,
-0.65234375,
-0.62255859375,
-0.6708984375,
-0.13720703125,
0.08978271484375,
-0.56884765625,
-0.53466796875,
0.982421875,
0.80908203125,
0.274169921875,
0.071044921875,
-0.286865234375,
-0.291015625,
0.96484375,
0.896484375,
0.1612548828125,
0.98193359375,
0.1934814453125,
0.06341552734375,
0.25927734375,
-0.94677734375,
0.328125,
-0.05340576171875,
0.054534912109375,
-0.28857421875,
0.06201171875,
-0.560546875,
-1.0380859375,
-0.00577545166015625,
1.029296875,
0.1302490234375,
-0.78857421875,
-1.041015625,
-0.438232421875,
-1.2353515625,
-0.10003662109375,
-0.66455078125,
0.72265625,
-0.409912109375,
-0.34033203125,
-0.60791015625,
-0.9365234375,
4.22265625,
1.21484375,
1.02734375,
0.82763671875,
0.53564453125,
0.98291015625,
0.293701171875,
-0.57861328125,
-0.371337890625,
-0.90380859375,
0.66748046875,
-0.350830078125,
-0.135498046875,
0.58984375,
0.5400390625,
0.52001953125,
-0.908203125,
-0.2103271484375,
0.233642578125,
-0.650390625,
-0.73095703125,
0.525390625,
-0.1826171875,
0.71630859375,
-0.027801513671875,
0.68701171875,
0.8154296875,
-0.72265625,
-0.213623046875,
-0.68017578125,
-0.5126953125,
-0.5029296875,
0.68505859375,
0.3203125,
-0.70556640625,
0.279296875,
-0.1312255859375,
-0.47802734375,
-0.51416015625,
-0.048828125,
-0.029754638671875,
0.261474609375,
0.767578125,
-0.306640625,
-0.2044677734375,
0.46142578125,
-0.6015625,
0.5908203125,
0.57373046875,
-1.1865234375,
0.99267578125,
-0.62548828125,
0.6875,
-0.79296875,
-0.44091796875,
-0.336181640625,
0.392822265625,
-0.38671875,
-0.343505859375,
0.5380859375,
0.36376953125,
0.1561279296875,
-0.007537841796875,
0.82275390625,
-0.67041015625,
0.74462890625,
-0.377685546875,
0.186279296875,
-0.53564453125,
-0.3798828125,
-0.00548553466796875,
-0.00417327880859375,
0.259521484375,
-0.47021484375,
0.8271484375,
0.625,
-0.3232421875,
0.432861328125,
0.53076171875,
-0.97705078125,
0.250732421875,
0.0016450881958007812,
-0.29736328125,
-0.63232421875,
0.564453125,
0.57080078125,
-1.1220703125,
-0.1053466796875,
-0.10028076171875,
0.60400390625,
0.1661376953125,
0.49169921875,
-0.2489013671875,
-0.05377197265625,
-0.33642578125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Valery have come across an entirely new programming language. Most of all the language attracted him with template functions and procedures. Let us remind you that templates are tools of a language, designed to encode generic algorithms, without reference to some parameters (e.g., data types, buffer sizes, default values).
Valery decided to examine template procedures in this language in more detail. The description of a template procedure consists of the procedure name and the list of its parameter types. The generic type T parameters can be used as parameters of template procedures.
A procedure call consists of a procedure name and a list of variable parameters. Let's call a procedure suitable for this call if the following conditions are fulfilled:
* its name equals to the name of the called procedure;
* the number of its parameters equals to the number of parameters of the procedure call;
* the types of variables in the procedure call match the corresponding types of its parameters. The variable type matches the type of a parameter if the parameter has a generic type T or the type of the variable and the parameter are the same.
You are given a description of some set of template procedures. You are also given a list of variables used in the program, as well as direct procedure calls that use the described variables. For each call you need to count the number of procedures that are suitable for this call.
Input
The first line contains a single integer n (1 β€ n β€ 1000) β the number of template procedures. The next n lines contain the description of the procedures specified in the following format:
"void procedureName (type_1, type_2, ..., type_t)" (1 β€ t β€ 5), where void is the keyword, procedureName is the procedure name, type_i is the type of the next parameter. Types of language parameters can be "int", "string", "double", and the keyword "T", which denotes the generic type.
The next line contains a single integer m (1 β€ m β€ 1000) β the number of used variables. Next m lines specify the description of the variables in the following format:
"type variableName", where type is the type of variable that can take values "int", "string", "double", variableName β the name of the variable.
The next line contains a single integer k (1 β€ k β€ 1000) β the number of procedure calls. Next k lines specify the procedure calls in the following format:
"procedureName (var_1, var_2, ..., var_t)" (1 β€ t β€ 5), where procedureName is the name of the procedure, var_i is the name of a variable.
The lines describing the variables, template procedures and their calls may contain spaces at the beginning of the line and at the end of the line, before and after the brackets and commas. Spaces may be before and after keyword void. The length of each input line does not exceed 100 characters. The names of variables and procedures are non-empty strings of lowercase English letters and numbers with lengths of not more than 10 characters. Note that this is the only condition at the names. Only the specified variables are used in procedure calls. The names of the variables are distinct. No two procedures are the same. Two procedures are the same, if they have identical names and identical ordered sets of types of their parameters.
Output
On each of k lines print a single number, where the i-th number stands for the number of suitable template procedures for the i-th call.
Examples
Input
4
void f(int,T)
void f(T, T)
void foo123 ( int, double, string,string )
void p(T,double)
3
int a
string s
double x123
5
f(a, a)
f(s,a )
foo (a,s,s)
f ( s ,x123)
proc(a)
Output
2
1
0
1
0
Input
6
void f(string,double,int)
void f(int)
void f ( T )
void procedure(int,double)
void f (T, double,int)
void f(string, T,T)
4
int a
int x
string t
double val
5
f(t, a, a)
f(t,val,a)
f(val,a, val)
solve300(val, val)
f (x)
Output
1
3
0
0
2
Tags: binary search, brute force, expression parsing, implementation
Correct Solution:
```
n=int(input())
funcs=[input().replace(' ','')[4:] for i in range(n) ]
funcs2=[f.replace('(',',').replace(')','').split(',') for f in funcs]
m=int(input())
vars=[input().strip().split() for i in range(m) ]
vard={l[1]:l[0] for l in vars}
k=int(input())
calls=[input().strip().replace(' ','') for i in range(k)]
calls2=[f.replace('(',',').replace(')','').split(',') for f in calls]
for f in calls2:
ans=0
for f2 in funcs2:
if f2[0] != f[0] or len(f) != len(f2):
continue
w=1
for x,y in zip(f[1:],f2[1:]):
if y!='T' and vard[x] !=y:
w=0
break
ans+=w
print(ans)
```
| 37,099
|
[
0.2352294921875,
-0.259521484375,
0.2236328125,
0.1781005859375,
-0.4794921875,
-0.363525390625,
-0.10736083984375,
0.05438232421875,
0.0230560302734375,
0.6220703125,
0.72119140625,
-0.173828125,
0.237060546875,
-0.454833984375,
-0.48681640625,
0.269287109375,
-0.439453125,
-0.89404296875,
-0.890625,
0.324462890625,
-0.1915283203125,
-0.003078460693359375,
-1.80859375,
-0.31103515625,
-0.57861328125,
0.72119140625,
0.56005859375,
-0.05224609375,
1.2177734375,
1.189453125,
-0.3623046875,
-0.4697265625,
0.28125,
-0.85986328125,
-0.232177734375,
-0.250244140625,
0.367919921875,
-0.78369140625,
-0.453857421875,
-0.2359619140625,
0.394775390625,
-0.1865234375,
0.306396484375,
-1.15234375,
-1.1689453125,
0.01103973388671875,
-0.0263671875,
-0.25634765625,
-0.0086822509765625,
-0.36962890625,
0.31884765625,
0.156005859375,
0.32861328125,
-0.46826171875,
-0.382568359375,
0.037689208984375,
0.0285797119140625,
0.10980224609375,
-0.4560546875,
-0.0657958984375,
-0.525390625,
0.30712890625,
0.005992889404296875,
-0.72119140625,
0.13720703125,
0.0921630859375,
0.06744384765625,
-0.236328125,
0.345703125,
-1.056640625,
-0.56884765625,
0.0810546875,
-0.71435546875,
-0.4697265625,
-0.042083740234375,
0.1771240234375,
0.59423828125,
0.09783935546875,
-0.57080078125,
0.30810546875,
0.64599609375,
0.994140625,
0.1416015625,
0.415771484375,
-0.5947265625,
-0.53076171875,
0.057464599609375,
0.1375732421875,
0.1651611328125,
-0.2198486328125,
-0.31396484375,
0.70947265625,
-0.1982421875,
-0.287353515625,
0.58544921875,
0.401123046875,
-0.28173828125,
0.7333984375,
0.111328125,
0.0036163330078125,
1.15625,
1.271484375,
-0.0751953125,
0.71337890625,
-0.44580078125,
0.74951171875,
0.56396484375,
0.337158203125,
-0.76904296875,
-0.440185546875,
-0.5107421875,
-0.5068359375,
0.2476806640625,
-0.254150390625,
-0.43896484375,
1.052734375,
0.01067352294921875,
-0.0211029052734375,
-0.53271484375,
0.14404296875,
0.3525390625,
0.272216796875,
0.067626953125,
-0.1912841796875,
0.09014892578125,
-0.432861328125,
-0.28076171875,
1.05078125,
-0.5888671875,
0.1448974609375,
-0.064697265625,
-0.348876953125,
-0.52734375,
0.50830078125,
-0.313720703125,
0.90625,
-0.320556640625,
0.51025390625,
0.3076171875,
-0.469482421875,
0.75732421875,
-0.1968994140625,
0.251708984375,
1.296875,
0.2200927734375,
0.339599609375,
1.0068359375,
-0.005123138427734375,
-0.83251953125,
0.53369140625,
-0.368408203125,
0.164306640625,
-0.228759765625,
0.039154052734375,
-0.03692626953125,
0.1248779296875,
-0.1607666015625,
-0.2054443359375,
0.084716796875,
0.138916015625,
-0.358642578125,
0.10882568359375,
0.06341552734375,
0.88232421875,
-0.32080078125,
0.8798828125,
-0.66259765625,
-0.2437744140625,
-0.32421875,
-0.677734375,
0.75390625,
-0.32763671875,
-0.47900390625,
0.53466796875,
1.103515625,
0.6533203125,
1.248046875,
-0.007503509521484375,
0.29150390625,
0.46435546875,
-0.2418212890625,
0.0533447265625,
0.302978515625,
0.779296875,
0.7197265625,
0.48828125,
0.283935546875,
-0.1124267578125,
-0.51953125,
-0.65478515625,
0.170166015625,
0.72119140625,
-0.6572265625,
0.27587890625,
0.2685546875,
-0.0037364959716796875,
-0.30908203125,
-0.10382080078125,
-0.145263671875,
-0.9521484375,
-0.828125,
0.55419921875,
-0.26904296875,
0.0186309814453125,
-0.533203125,
-0.185791015625,
-0.05609130859375,
1.3505859375,
-0.0943603515625,
0.1365966796875,
0.475341796875,
-0.0214385986328125,
-0.2264404296875,
-0.0019969940185546875,
0.06671142578125,
-0.3544921875,
-0.61181640625,
0.49609375,
-0.2646484375,
-0.08502197265625,
0.05450439453125,
0.74365234375,
0.7197265625,
0.042755126953125,
-0.488037109375,
-0.35107421875,
0.16162109375,
1.44140625,
0.00421142578125,
0.89111328125,
0.6533203125,
1.19921875,
0.52880859375,
1.0126953125,
0.61474609375,
0.28564453125,
0.96630859375,
1.0498046875,
0.284912109375,
0.33935546875,
-0.1378173828125,
0.422607421875,
0.45166015625,
0.13916015625,
0.00835418701171875,
0.494384765625,
-0.096923828125,
-0.260009765625,
-0.27099609375,
0.673828125,
-0.11676025390625,
1.033203125,
-0.0726318359375,
0.2822265625,
-0.1240234375,
-0.365966796875,
-0.30859375,
0.693359375,
-0.986328125,
-0.1876220703125,
0.3818359375,
0.141845703125,
0.406494140625,
0.1395263671875,
0.254150390625,
0.246337890625,
0.48046875,
0.225830078125,
-0.232666015625,
-0.99072265625,
-0.334228515625,
-0.96826171875,
-0.9921875,
-0.2109375,
-0.38720703125,
-0.09161376953125,
0.60693359375,
-0.73876953125,
0.2060546875,
-0.31982421875,
0.0819091796875,
0.3779296875,
-0.5947265625,
0.75927734375,
-0.0112457275390625,
0.21240234375,
-0.76708984375,
0.9140625,
-0.1876220703125,
0.87548828125,
-0.564453125,
-0.387451171875,
-0.0933837890625,
-0.70751953125,
0.3232421875,
0.1134033203125,
0.449951171875,
-0.299560546875,
-0.89453125,
-0.806640625,
-0.351318359375,
-0.2274169921875,
-0.71630859375,
0.38330078125,
-0.76318359375,
0.87060546875,
0.355224609375,
-0.845703125,
0.7314453125,
1.009765625,
-1.0810546875,
0.3662109375,
0.014923095703125,
0.0753173828125,
-0.77001953125,
1.3388671875,
0.4130859375,
0.36181640625,
-0.640625,
0.03887939453125,
-0.2401123046875,
-0.3330078125,
0.182861328125,
-0.4345703125,
-0.5361328125,
0.5966796875,
0.453369140625,
-0.93896484375,
0.480224609375,
-1.140625,
-0.126708984375,
-0.31640625,
-0.139404296875,
0.71435546875,
0.7470703125,
-0.1796875,
-0.03021240234375,
0.1324462890625,
-0.0121612548828125,
0.5185546875,
0.251953125,
-0.497802734375,
0.1953125,
0.5576171875,
0.079833984375,
0.57861328125,
0.425537109375,
-0.54833984375,
-0.062408447265625,
-0.5625,
0.138427734375,
0.62353515625,
0.337890625,
0.00640869140625,
-0.20849609375,
0.74658203125,
-0.52685546875,
-0.79443359375,
-0.37890625,
0.6181640625,
0.61328125,
0.65869140625,
0.192626953125,
-0.310546875,
-0.923828125,
-0.41162109375,
-0.25,
0.287353515625,
0.89990234375,
-1.0380859375,
0.7861328125,
-0.381103515625,
-0.58935546875,
-0.03759765625,
-0.61865234375,
0.10833740234375,
0.7783203125,
0.22412109375,
0.8623046875,
-0.89892578125,
-0.5986328125,
0.1456298828125,
0.06463623046875,
0.90673828125,
0.359619140625,
0.8369140625,
-0.12042236328125,
-0.379150390625,
-0.483154296875,
0.1741943359375,
0.2431640625,
-0.4873046875,
0.279052734375,
-0.358154296875,
-0.104248046875,
-1.1005859375,
0.38720703125,
0.74560546875,
0.415771484375,
0.11181640625,
0.384033203125,
0.1253662109375,
0.51708984375,
0.9091796875,
0.0955810546875,
0.1951904296875,
-0.38525390625,
0.43994140625,
0.1524658203125,
-0.2308349609375,
-0.76025390625,
-0.66015625,
0.053375244140625,
0.15380859375,
0.12335205078125,
0.0295562744140625,
-0.654296875,
0.156494140625,
0.0217132568359375,
0.60693359375,
-0.39794921875,
-0.49951171875,
-0.366455078125,
0.83544921875,
0.147705078125,
-0.457763671875,
0.36865234375,
-0.482177734375,
0.71923828125,
0.66796875,
-0.5595703125,
-0.83447265625,
-0.318603515625,
-0.71337890625,
-0.412841796875,
0.7529296875,
0.83154296875,
-0.27294921875,
0.63427734375,
-1.224609375,
0.11614990234375,
-0.1385498046875,
-0.085693359375,
0.058746337890625,
0.07049560546875,
0.51513671875,
0.50537109375,
0.34228515625,
-0.31201171875,
-0.56689453125,
0.166748046875,
-1.0478515625,
0.51611328125,
-0.759765625,
0.083251953125,
-0.0882568359375,
-0.1884765625,
-0.308349609375,
-0.028411865234375,
-0.51416015625,
0.1448974609375,
0.03851318359375,
0.353271484375,
-1.310546875,
-0.343505859375,
0.75732421875,
-0.163818359375,
0.00920867919921875,
0.97802734375,
0.2919921875,
-0.4677734375,
0.671875,
0.392822265625,
-0.5615234375,
0.264404296875,
-0.833984375,
0.37890625,
-0.242919921875,
-0.318359375,
-0.3935546875,
-0.73974609375,
0.338623046875,
0.209228515625,
-0.62890625,
-0.2471923828125,
-1.3974609375,
-0.306396484375,
-0.089111328125,
-0.376953125,
-0.047088623046875,
-0.331298828125,
-0.0188140869140625,
0.341796875,
-0.08056640625,
-0.712890625,
-0.60888671875,
-0.6337890625,
-0.306640625,
0.59228515625,
-0.041595458984375,
0.63232421875,
-0.218505859375,
-0.219482421875,
0.0379638671875,
-0.587890625,
-0.147705078125,
-0.281005859375,
0.05731201171875,
-0.09320068359375,
-0.377685546875,
-0.64306640625,
0.505859375,
-0.1573486328125,
-0.1490478515625,
0.6865234375,
0.2086181640625,
0.419677734375,
0.0231475830078125,
-0.456787109375,
0.9482421875,
0.3701171875,
-1.322265625,
-0.6337890625,
0.5458984375,
-0.13671875,
0.49365234375,
0.420166015625,
-0.267333984375,
-0.467041015625,
-1.203125,
0.07757568359375,
-0.4423828125,
-0.12939453125,
-0.420654296875,
-0.3505859375,
-0.2261962890625,
0.36767578125,
0.385498046875,
-1.0654296875,
-0.673828125,
-1.16015625,
0.490478515625,
-0.74609375,
-0.1649169921875,
-0.4951171875,
-0.56640625,
-0.45751953125,
0.98876953125,
-0.0926513671875,
-0.0445556640625,
-0.142822265625,
-0.03173828125,
0.61572265625,
0.55908203125,
-0.462646484375,
-0.63330078125,
-0.1759033203125,
0.21044921875,
-0.1475830078125,
0.1822509765625,
-0.410888671875,
0.62548828125,
-0.64501953125,
0.666015625,
0.027252197265625,
-0.53125,
-0.3544921875,
-0.2359619140625,
1.09375,
-0.64697265625,
-0.1507568359375,
-0.38330078125,
0.62451171875,
0.5869140625,
-0.67578125,
-0.837890625,
-0.44580078125,
-0.58935546875,
-0.978515625,
0.61669921875,
-0.51513671875,
0.171875,
-0.296630859375,
0.0204010009765625,
1.3115234375,
-0.5400390625,
0.671875,
1.419921875,
0.31494140625,
0.10272216796875,
-0.83740234375,
0.460693359375,
0.791015625,
-0.422607421875,
-0.16259765625,
0.19140625,
-0.6494140625,
0.01513671875,
-0.2115478515625,
-1.2373046875,
-0.5439453125,
0.1700439453125,
0.81640625,
-0.2242431640625,
0.42138671875,
-0.07415771484375,
-1.02734375,
-0.70703125,
0.9931640625,
0.0916748046875,
0.251220703125,
0.896484375,
0.01141357421875,
-0.046600341796875,
-0.19677734375,
-0.4482421875,
0.1375732421875,
-0.67138671875,
1.125,
-0.1646728515625,
-0.74755859375,
0.5205078125,
0.91650390625,
-1.08203125,
-0.677734375,
0.0098876953125,
-0.0418701171875,
-0.2216796875,
-0.430419921875,
-0.2349853515625,
0.7861328125,
-0.51171875,
0.3623046875,
0.71533203125,
0.2049560546875,
0.1226806640625,
0.30126953125,
0.21826171875,
-0.435302734375,
0.96484375,
0.79052734375,
-0.40771484375,
-0.67919921875,
-1.083984375,
-0.1876220703125,
-0.0958251953125,
-0.01422882080078125,
1.0595703125,
-0.346435546875,
0.156982421875,
0.476318359375,
-0.35302734375,
1.04296875,
-0.6630859375,
-0.183837890625,
0.033172607421875,
-0.47900390625,
-0.87744140625,
-0.251220703125,
0.21923828125,
0.0750732421875,
0.1478271484375,
-0.37109375,
0.26513671875,
0.8310546875,
0.461181640625,
-0.469970703125,
-1.533203125,
-0.342041015625,
-1.439453125,
-0.529296875,
-0.3701171875,
-0.175537109375,
-0.035125732421875,
-0.335205078125,
-0.33740234375,
-0.77685546875,
-0.41796875,
0.356201171875,
-0.1895751953125,
0.6220703125,
-1.15625,
0.37548828125,
-0.69580078125,
-0.66552734375,
-0.958984375,
0.178955078125,
-0.2060546875,
-0.0213775634765625,
-0.5888671875,
-0.13037109375,
-0.041534423828125,
0.3740234375,
-0.4384765625,
0.53125,
-0.344482421875,
-0.1424560546875,
0.00499725341796875,
0.2034912109375,
-0.3154296875,
1.09765625,
0.414306640625,
-0.08209228515625,
0.1551513671875,
-0.07000732421875,
-0.587890625,
-0.324951171875,
0.75927734375,
0.4462890625,
0.040435791015625,
-0.48095703125,
-0.7265625,
0.1822509765625,
-0.94287109375,
0.4990234375,
0.306396484375,
0.316650390625,
0.388671875,
-0.125244140625,
0.35595703125,
1.0615234375,
0.234375,
0.61962890625,
0.32373046875,
0.08929443359375,
0.7138671875,
0.457763671875,
-0.08929443359375,
-0.1807861328125,
-0.036590576171875,
0.034393310546875,
0.38134765625,
0.12103271484375,
-0.203857421875,
0.34326171875,
0.14404296875,
-0.56494140625,
-0.9189453125,
-0.41845703125,
0.07916259765625,
0.7412109375,
0.47216796875,
-0.362548828125,
0.11224365234375,
-0.34326171875,
-0.493408203125,
0.170654296875,
-1.2197265625,
-1.1005859375,
0.85009765625,
-0.3154296875,
-0.58740234375,
-0.174072265625,
-0.5732421875,
-0.4970703125,
0.35205078125,
0.54443359375,
-0.5419921875,
0.342041015625,
-0.225830078125,
0.164306640625,
-0.69091796875,
-0.136474609375,
-0.0003247261047363281,
0.11566162109375,
-0.849609375,
-0.273193359375,
0.2462158203125,
1.0078125,
0.263671875,
-0.12548828125,
-0.6171875,
-0.2169189453125,
-0.0635986328125,
0.276123046875,
-0.4658203125,
0.302734375,
-0.26123046875,
0.50830078125,
-1.1044921875,
0.09906005859375,
-0.38037109375,
0.697265625,
0.732421875,
-0.198974609375,
-0.415771484375,
0.7001953125,
0.5517578125,
-0.2744140625,
0.875,
0.681640625,
1.12890625,
0.01654052734375,
-0.03546142578125,
-0.01031494140625,
0.5302734375,
0.75537109375,
0.79248046875,
0.1414794921875,
0.4052734375,
0.640625,
0.3447265625,
-0.31494140625,
0.53564453125,
0.135498046875,
-0.362548828125,
0.1187744140625,
-0.270751953125,
-0.2423095703125,
-0.10528564453125,
-0.0927734375,
0.4462890625,
-0.466796875,
0.15576171875,
-0.71875,
-0.7099609375,
0.806640625,
-0.1300048828125,
-0.396484375,
0.294677734375,
-0.441162109375,
0.236328125,
0.6591796875,
0.03863525390625,
-0.55126953125,
0.95751953125,
0.494140625,
0.60107421875,
0.72802734375,
0.287353515625,
0.51611328125,
-0.08489990234375,
0.38916015625,
0.05828857421875,
0.60888671875,
-0.302490234375,
-0.317626953125,
-0.70556640625,
0.35107421875,
-0.383544921875,
-0.63037109375,
0.818359375,
-0.6630859375,
-0.00702667236328125,
-0.580078125,
0.9853515625,
-0.849609375,
0.111328125,
0.65185546875,
-0.269775390625,
-0.88916015625,
0.97216796875,
0.06890869140625,
0.446044921875,
0.68017578125,
0.9921875,
-0.145263671875,
1.5537109375,
0.5361328125,
0.1253662109375,
-0.16162109375,
0.4697265625,
-0.2008056640625,
-0.7099609375,
-0.53857421875,
-0.3349609375,
0.2313232421875,
-0.35595703125,
-0.6640625,
-0.462646484375,
0.5556640625,
0.0246429443359375,
-1.15625,
-0.279541015625,
0.19091796875,
-0.55322265625,
0.45751953125,
-0.0831298828125,
0.119140625,
-0.046722412109375,
0.249267578125,
-0.461669921875,
-0.92333984375,
-0.1041259765625,
-0.63330078125,
0.275390625,
-0.01001739501953125,
-0.65234375,
-0.62255859375,
-0.6708984375,
-0.13720703125,
0.08978271484375,
-0.56884765625,
-0.53466796875,
0.982421875,
0.80908203125,
0.274169921875,
0.071044921875,
-0.286865234375,
-0.291015625,
0.96484375,
0.896484375,
0.1612548828125,
0.98193359375,
0.1934814453125,
0.06341552734375,
0.25927734375,
-0.94677734375,
0.328125,
-0.05340576171875,
0.054534912109375,
-0.28857421875,
0.06201171875,
-0.560546875,
-1.0380859375,
-0.00577545166015625,
1.029296875,
0.1302490234375,
-0.78857421875,
-1.041015625,
-0.438232421875,
-1.2353515625,
-0.10003662109375,
-0.66455078125,
0.72265625,
-0.409912109375,
-0.34033203125,
-0.60791015625,
-0.9365234375,
4.22265625,
1.21484375,
1.02734375,
0.82763671875,
0.53564453125,
0.98291015625,
0.293701171875,
-0.57861328125,
-0.371337890625,
-0.90380859375,
0.66748046875,
-0.350830078125,
-0.135498046875,
0.58984375,
0.5400390625,
0.52001953125,
-0.908203125,
-0.2103271484375,
0.233642578125,
-0.650390625,
-0.73095703125,
0.525390625,
-0.1826171875,
0.71630859375,
-0.027801513671875,
0.68701171875,
0.8154296875,
-0.72265625,
-0.213623046875,
-0.68017578125,
-0.5126953125,
-0.5029296875,
0.68505859375,
0.3203125,
-0.70556640625,
0.279296875,
-0.1312255859375,
-0.47802734375,
-0.51416015625,
-0.048828125,
-0.029754638671875,
0.261474609375,
0.767578125,
-0.306640625,
-0.2044677734375,
0.46142578125,
-0.6015625,
0.5908203125,
0.57373046875,
-1.1865234375,
0.99267578125,
-0.62548828125,
0.6875,
-0.79296875,
-0.44091796875,
-0.336181640625,
0.392822265625,
-0.38671875,
-0.343505859375,
0.5380859375,
0.36376953125,
0.1561279296875,
-0.007537841796875,
0.82275390625,
-0.67041015625,
0.74462890625,
-0.377685546875,
0.186279296875,
-0.53564453125,
-0.3798828125,
-0.00548553466796875,
-0.00417327880859375,
0.259521484375,
-0.47021484375,
0.8271484375,
0.625,
-0.3232421875,
0.432861328125,
0.53076171875,
-0.97705078125,
0.250732421875,
0.0016450881958007812,
-0.29736328125,
-0.63232421875,
0.564453125,
0.57080078125,
-1.1220703125,
-0.1053466796875,
-0.10028076171875,
0.60400390625,
0.1661376953125,
0.49169921875,
-0.2489013671875,
-0.05377197265625,
-0.33642578125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Valery have come across an entirely new programming language. Most of all the language attracted him with template functions and procedures. Let us remind you that templates are tools of a language, designed to encode generic algorithms, without reference to some parameters (e.g., data types, buffer sizes, default values).
Valery decided to examine template procedures in this language in more detail. The description of a template procedure consists of the procedure name and the list of its parameter types. The generic type T parameters can be used as parameters of template procedures.
A procedure call consists of a procedure name and a list of variable parameters. Let's call a procedure suitable for this call if the following conditions are fulfilled:
* its name equals to the name of the called procedure;
* the number of its parameters equals to the number of parameters of the procedure call;
* the types of variables in the procedure call match the corresponding types of its parameters. The variable type matches the type of a parameter if the parameter has a generic type T or the type of the variable and the parameter are the same.
You are given a description of some set of template procedures. You are also given a list of variables used in the program, as well as direct procedure calls that use the described variables. For each call you need to count the number of procedures that are suitable for this call.
Input
The first line contains a single integer n (1 β€ n β€ 1000) β the number of template procedures. The next n lines contain the description of the procedures specified in the following format:
"void procedureName (type_1, type_2, ..., type_t)" (1 β€ t β€ 5), where void is the keyword, procedureName is the procedure name, type_i is the type of the next parameter. Types of language parameters can be "int", "string", "double", and the keyword "T", which denotes the generic type.
The next line contains a single integer m (1 β€ m β€ 1000) β the number of used variables. Next m lines specify the description of the variables in the following format:
"type variableName", where type is the type of variable that can take values "int", "string", "double", variableName β the name of the variable.
The next line contains a single integer k (1 β€ k β€ 1000) β the number of procedure calls. Next k lines specify the procedure calls in the following format:
"procedureName (var_1, var_2, ..., var_t)" (1 β€ t β€ 5), where procedureName is the name of the procedure, var_i is the name of a variable.
The lines describing the variables, template procedures and their calls may contain spaces at the beginning of the line and at the end of the line, before and after the brackets and commas. Spaces may be before and after keyword void. The length of each input line does not exceed 100 characters. The names of variables and procedures are non-empty strings of lowercase English letters and numbers with lengths of not more than 10 characters. Note that this is the only condition at the names. Only the specified variables are used in procedure calls. The names of the variables are distinct. No two procedures are the same. Two procedures are the same, if they have identical names and identical ordered sets of types of their parameters.
Output
On each of k lines print a single number, where the i-th number stands for the number of suitable template procedures for the i-th call.
Examples
Input
4
void f(int,T)
void f(T, T)
void foo123 ( int, double, string,string )
void p(T,double)
3
int a
string s
double x123
5
f(a, a)
f(s,a )
foo (a,s,s)
f ( s ,x123)
proc(a)
Output
2
1
0
1
0
Input
6
void f(string,double,int)
void f(int)
void f ( T )
void procedure(int,double)
void f (T, double,int)
void f(string, T,T)
4
int a
int x
string t
double val
5
f(t, a, a)
f(t,val,a)
f(val,a, val)
solve300(val, val)
f (x)
Output
1
3
0
0
2
Tags: binary search, brute force, expression parsing, implementation
Correct Solution:
```
n=int(input())
funcnames=[]
funcs=[]
for i in range(n):
x=input()
funcnames.append(list(list(x.split('('))[0].split())[1].strip())
x=list(x.split('('))[1].strip()[:-1]
x=list(map(str.strip,list(x.split(','))))
funcs.append(x)
# print(funcnames)
k=int(input())
types={}
for i in range(k):
x=list(input().split())
x=list(map(str.strip,x))
types[x[1]]=x[0]
m=int(input())
ans=[]
for i in range(m):
x=input()
fname=list(x.split('('))[0].strip()
fargs=list(map(str.strip,list(x.split('('))[1].strip()[:-1].split(',')))
count=0
for j in range(n):
if(fname==funcnames[j]):
con=True
for t in range(len(fargs)):
if(len(fargs)==len(funcs[j]) and t<len(funcs[j]) and (funcs[j][t]=='T' or funcs[j][t]==types[fargs[t]])):
# print(fname,fargs[t],funcs[j][t])
pass
else:
con=False
break
if(con):
count+=1
print(count)
```
| 37,100
|
[
0.2352294921875,
-0.259521484375,
0.2236328125,
0.1781005859375,
-0.4794921875,
-0.363525390625,
-0.10736083984375,
0.05438232421875,
0.0230560302734375,
0.6220703125,
0.72119140625,
-0.173828125,
0.237060546875,
-0.454833984375,
-0.48681640625,
0.269287109375,
-0.439453125,
-0.89404296875,
-0.890625,
0.324462890625,
-0.1915283203125,
-0.003078460693359375,
-1.80859375,
-0.31103515625,
-0.57861328125,
0.72119140625,
0.56005859375,
-0.05224609375,
1.2177734375,
1.189453125,
-0.3623046875,
-0.4697265625,
0.28125,
-0.85986328125,
-0.232177734375,
-0.250244140625,
0.367919921875,
-0.78369140625,
-0.453857421875,
-0.2359619140625,
0.394775390625,
-0.1865234375,
0.306396484375,
-1.15234375,
-1.1689453125,
0.01103973388671875,
-0.0263671875,
-0.25634765625,
-0.0086822509765625,
-0.36962890625,
0.31884765625,
0.156005859375,
0.32861328125,
-0.46826171875,
-0.382568359375,
0.037689208984375,
0.0285797119140625,
0.10980224609375,
-0.4560546875,
-0.0657958984375,
-0.525390625,
0.30712890625,
0.005992889404296875,
-0.72119140625,
0.13720703125,
0.0921630859375,
0.06744384765625,
-0.236328125,
0.345703125,
-1.056640625,
-0.56884765625,
0.0810546875,
-0.71435546875,
-0.4697265625,
-0.042083740234375,
0.1771240234375,
0.59423828125,
0.09783935546875,
-0.57080078125,
0.30810546875,
0.64599609375,
0.994140625,
0.1416015625,
0.415771484375,
-0.5947265625,
-0.53076171875,
0.057464599609375,
0.1375732421875,
0.1651611328125,
-0.2198486328125,
-0.31396484375,
0.70947265625,
-0.1982421875,
-0.287353515625,
0.58544921875,
0.401123046875,
-0.28173828125,
0.7333984375,
0.111328125,
0.0036163330078125,
1.15625,
1.271484375,
-0.0751953125,
0.71337890625,
-0.44580078125,
0.74951171875,
0.56396484375,
0.337158203125,
-0.76904296875,
-0.440185546875,
-0.5107421875,
-0.5068359375,
0.2476806640625,
-0.254150390625,
-0.43896484375,
1.052734375,
0.01067352294921875,
-0.0211029052734375,
-0.53271484375,
0.14404296875,
0.3525390625,
0.272216796875,
0.067626953125,
-0.1912841796875,
0.09014892578125,
-0.432861328125,
-0.28076171875,
1.05078125,
-0.5888671875,
0.1448974609375,
-0.064697265625,
-0.348876953125,
-0.52734375,
0.50830078125,
-0.313720703125,
0.90625,
-0.320556640625,
0.51025390625,
0.3076171875,
-0.469482421875,
0.75732421875,
-0.1968994140625,
0.251708984375,
1.296875,
0.2200927734375,
0.339599609375,
1.0068359375,
-0.005123138427734375,
-0.83251953125,
0.53369140625,
-0.368408203125,
0.164306640625,
-0.228759765625,
0.039154052734375,
-0.03692626953125,
0.1248779296875,
-0.1607666015625,
-0.2054443359375,
0.084716796875,
0.138916015625,
-0.358642578125,
0.10882568359375,
0.06341552734375,
0.88232421875,
-0.32080078125,
0.8798828125,
-0.66259765625,
-0.2437744140625,
-0.32421875,
-0.677734375,
0.75390625,
-0.32763671875,
-0.47900390625,
0.53466796875,
1.103515625,
0.6533203125,
1.248046875,
-0.007503509521484375,
0.29150390625,
0.46435546875,
-0.2418212890625,
0.0533447265625,
0.302978515625,
0.779296875,
0.7197265625,
0.48828125,
0.283935546875,
-0.1124267578125,
-0.51953125,
-0.65478515625,
0.170166015625,
0.72119140625,
-0.6572265625,
0.27587890625,
0.2685546875,
-0.0037364959716796875,
-0.30908203125,
-0.10382080078125,
-0.145263671875,
-0.9521484375,
-0.828125,
0.55419921875,
-0.26904296875,
0.0186309814453125,
-0.533203125,
-0.185791015625,
-0.05609130859375,
1.3505859375,
-0.0943603515625,
0.1365966796875,
0.475341796875,
-0.0214385986328125,
-0.2264404296875,
-0.0019969940185546875,
0.06671142578125,
-0.3544921875,
-0.61181640625,
0.49609375,
-0.2646484375,
-0.08502197265625,
0.05450439453125,
0.74365234375,
0.7197265625,
0.042755126953125,
-0.488037109375,
-0.35107421875,
0.16162109375,
1.44140625,
0.00421142578125,
0.89111328125,
0.6533203125,
1.19921875,
0.52880859375,
1.0126953125,
0.61474609375,
0.28564453125,
0.96630859375,
1.0498046875,
0.284912109375,
0.33935546875,
-0.1378173828125,
0.422607421875,
0.45166015625,
0.13916015625,
0.00835418701171875,
0.494384765625,
-0.096923828125,
-0.260009765625,
-0.27099609375,
0.673828125,
-0.11676025390625,
1.033203125,
-0.0726318359375,
0.2822265625,
-0.1240234375,
-0.365966796875,
-0.30859375,
0.693359375,
-0.986328125,
-0.1876220703125,
0.3818359375,
0.141845703125,
0.406494140625,
0.1395263671875,
0.254150390625,
0.246337890625,
0.48046875,
0.225830078125,
-0.232666015625,
-0.99072265625,
-0.334228515625,
-0.96826171875,
-0.9921875,
-0.2109375,
-0.38720703125,
-0.09161376953125,
0.60693359375,
-0.73876953125,
0.2060546875,
-0.31982421875,
0.0819091796875,
0.3779296875,
-0.5947265625,
0.75927734375,
-0.0112457275390625,
0.21240234375,
-0.76708984375,
0.9140625,
-0.1876220703125,
0.87548828125,
-0.564453125,
-0.387451171875,
-0.0933837890625,
-0.70751953125,
0.3232421875,
0.1134033203125,
0.449951171875,
-0.299560546875,
-0.89453125,
-0.806640625,
-0.351318359375,
-0.2274169921875,
-0.71630859375,
0.38330078125,
-0.76318359375,
0.87060546875,
0.355224609375,
-0.845703125,
0.7314453125,
1.009765625,
-1.0810546875,
0.3662109375,
0.014923095703125,
0.0753173828125,
-0.77001953125,
1.3388671875,
0.4130859375,
0.36181640625,
-0.640625,
0.03887939453125,
-0.2401123046875,
-0.3330078125,
0.182861328125,
-0.4345703125,
-0.5361328125,
0.5966796875,
0.453369140625,
-0.93896484375,
0.480224609375,
-1.140625,
-0.126708984375,
-0.31640625,
-0.139404296875,
0.71435546875,
0.7470703125,
-0.1796875,
-0.03021240234375,
0.1324462890625,
-0.0121612548828125,
0.5185546875,
0.251953125,
-0.497802734375,
0.1953125,
0.5576171875,
0.079833984375,
0.57861328125,
0.425537109375,
-0.54833984375,
-0.062408447265625,
-0.5625,
0.138427734375,
0.62353515625,
0.337890625,
0.00640869140625,
-0.20849609375,
0.74658203125,
-0.52685546875,
-0.79443359375,
-0.37890625,
0.6181640625,
0.61328125,
0.65869140625,
0.192626953125,
-0.310546875,
-0.923828125,
-0.41162109375,
-0.25,
0.287353515625,
0.89990234375,
-1.0380859375,
0.7861328125,
-0.381103515625,
-0.58935546875,
-0.03759765625,
-0.61865234375,
0.10833740234375,
0.7783203125,
0.22412109375,
0.8623046875,
-0.89892578125,
-0.5986328125,
0.1456298828125,
0.06463623046875,
0.90673828125,
0.359619140625,
0.8369140625,
-0.12042236328125,
-0.379150390625,
-0.483154296875,
0.1741943359375,
0.2431640625,
-0.4873046875,
0.279052734375,
-0.358154296875,
-0.104248046875,
-1.1005859375,
0.38720703125,
0.74560546875,
0.415771484375,
0.11181640625,
0.384033203125,
0.1253662109375,
0.51708984375,
0.9091796875,
0.0955810546875,
0.1951904296875,
-0.38525390625,
0.43994140625,
0.1524658203125,
-0.2308349609375,
-0.76025390625,
-0.66015625,
0.053375244140625,
0.15380859375,
0.12335205078125,
0.0295562744140625,
-0.654296875,
0.156494140625,
0.0217132568359375,
0.60693359375,
-0.39794921875,
-0.49951171875,
-0.366455078125,
0.83544921875,
0.147705078125,
-0.457763671875,
0.36865234375,
-0.482177734375,
0.71923828125,
0.66796875,
-0.5595703125,
-0.83447265625,
-0.318603515625,
-0.71337890625,
-0.412841796875,
0.7529296875,
0.83154296875,
-0.27294921875,
0.63427734375,
-1.224609375,
0.11614990234375,
-0.1385498046875,
-0.085693359375,
0.058746337890625,
0.07049560546875,
0.51513671875,
0.50537109375,
0.34228515625,
-0.31201171875,
-0.56689453125,
0.166748046875,
-1.0478515625,
0.51611328125,
-0.759765625,
0.083251953125,
-0.0882568359375,
-0.1884765625,
-0.308349609375,
-0.028411865234375,
-0.51416015625,
0.1448974609375,
0.03851318359375,
0.353271484375,
-1.310546875,
-0.343505859375,
0.75732421875,
-0.163818359375,
0.00920867919921875,
0.97802734375,
0.2919921875,
-0.4677734375,
0.671875,
0.392822265625,
-0.5615234375,
0.264404296875,
-0.833984375,
0.37890625,
-0.242919921875,
-0.318359375,
-0.3935546875,
-0.73974609375,
0.338623046875,
0.209228515625,
-0.62890625,
-0.2471923828125,
-1.3974609375,
-0.306396484375,
-0.089111328125,
-0.376953125,
-0.047088623046875,
-0.331298828125,
-0.0188140869140625,
0.341796875,
-0.08056640625,
-0.712890625,
-0.60888671875,
-0.6337890625,
-0.306640625,
0.59228515625,
-0.041595458984375,
0.63232421875,
-0.218505859375,
-0.219482421875,
0.0379638671875,
-0.587890625,
-0.147705078125,
-0.281005859375,
0.05731201171875,
-0.09320068359375,
-0.377685546875,
-0.64306640625,
0.505859375,
-0.1573486328125,
-0.1490478515625,
0.6865234375,
0.2086181640625,
0.419677734375,
0.0231475830078125,
-0.456787109375,
0.9482421875,
0.3701171875,
-1.322265625,
-0.6337890625,
0.5458984375,
-0.13671875,
0.49365234375,
0.420166015625,
-0.267333984375,
-0.467041015625,
-1.203125,
0.07757568359375,
-0.4423828125,
-0.12939453125,
-0.420654296875,
-0.3505859375,
-0.2261962890625,
0.36767578125,
0.385498046875,
-1.0654296875,
-0.673828125,
-1.16015625,
0.490478515625,
-0.74609375,
-0.1649169921875,
-0.4951171875,
-0.56640625,
-0.45751953125,
0.98876953125,
-0.0926513671875,
-0.0445556640625,
-0.142822265625,
-0.03173828125,
0.61572265625,
0.55908203125,
-0.462646484375,
-0.63330078125,
-0.1759033203125,
0.21044921875,
-0.1475830078125,
0.1822509765625,
-0.410888671875,
0.62548828125,
-0.64501953125,
0.666015625,
0.027252197265625,
-0.53125,
-0.3544921875,
-0.2359619140625,
1.09375,
-0.64697265625,
-0.1507568359375,
-0.38330078125,
0.62451171875,
0.5869140625,
-0.67578125,
-0.837890625,
-0.44580078125,
-0.58935546875,
-0.978515625,
0.61669921875,
-0.51513671875,
0.171875,
-0.296630859375,
0.0204010009765625,
1.3115234375,
-0.5400390625,
0.671875,
1.419921875,
0.31494140625,
0.10272216796875,
-0.83740234375,
0.460693359375,
0.791015625,
-0.422607421875,
-0.16259765625,
0.19140625,
-0.6494140625,
0.01513671875,
-0.2115478515625,
-1.2373046875,
-0.5439453125,
0.1700439453125,
0.81640625,
-0.2242431640625,
0.42138671875,
-0.07415771484375,
-1.02734375,
-0.70703125,
0.9931640625,
0.0916748046875,
0.251220703125,
0.896484375,
0.01141357421875,
-0.046600341796875,
-0.19677734375,
-0.4482421875,
0.1375732421875,
-0.67138671875,
1.125,
-0.1646728515625,
-0.74755859375,
0.5205078125,
0.91650390625,
-1.08203125,
-0.677734375,
0.0098876953125,
-0.0418701171875,
-0.2216796875,
-0.430419921875,
-0.2349853515625,
0.7861328125,
-0.51171875,
0.3623046875,
0.71533203125,
0.2049560546875,
0.1226806640625,
0.30126953125,
0.21826171875,
-0.435302734375,
0.96484375,
0.79052734375,
-0.40771484375,
-0.67919921875,
-1.083984375,
-0.1876220703125,
-0.0958251953125,
-0.01422882080078125,
1.0595703125,
-0.346435546875,
0.156982421875,
0.476318359375,
-0.35302734375,
1.04296875,
-0.6630859375,
-0.183837890625,
0.033172607421875,
-0.47900390625,
-0.87744140625,
-0.251220703125,
0.21923828125,
0.0750732421875,
0.1478271484375,
-0.37109375,
0.26513671875,
0.8310546875,
0.461181640625,
-0.469970703125,
-1.533203125,
-0.342041015625,
-1.439453125,
-0.529296875,
-0.3701171875,
-0.175537109375,
-0.035125732421875,
-0.335205078125,
-0.33740234375,
-0.77685546875,
-0.41796875,
0.356201171875,
-0.1895751953125,
0.6220703125,
-1.15625,
0.37548828125,
-0.69580078125,
-0.66552734375,
-0.958984375,
0.178955078125,
-0.2060546875,
-0.0213775634765625,
-0.5888671875,
-0.13037109375,
-0.041534423828125,
0.3740234375,
-0.4384765625,
0.53125,
-0.344482421875,
-0.1424560546875,
0.00499725341796875,
0.2034912109375,
-0.3154296875,
1.09765625,
0.414306640625,
-0.08209228515625,
0.1551513671875,
-0.07000732421875,
-0.587890625,
-0.324951171875,
0.75927734375,
0.4462890625,
0.040435791015625,
-0.48095703125,
-0.7265625,
0.1822509765625,
-0.94287109375,
0.4990234375,
0.306396484375,
0.316650390625,
0.388671875,
-0.125244140625,
0.35595703125,
1.0615234375,
0.234375,
0.61962890625,
0.32373046875,
0.08929443359375,
0.7138671875,
0.457763671875,
-0.08929443359375,
-0.1807861328125,
-0.036590576171875,
0.034393310546875,
0.38134765625,
0.12103271484375,
-0.203857421875,
0.34326171875,
0.14404296875,
-0.56494140625,
-0.9189453125,
-0.41845703125,
0.07916259765625,
0.7412109375,
0.47216796875,
-0.362548828125,
0.11224365234375,
-0.34326171875,
-0.493408203125,
0.170654296875,
-1.2197265625,
-1.1005859375,
0.85009765625,
-0.3154296875,
-0.58740234375,
-0.174072265625,
-0.5732421875,
-0.4970703125,
0.35205078125,
0.54443359375,
-0.5419921875,
0.342041015625,
-0.225830078125,
0.164306640625,
-0.69091796875,
-0.136474609375,
-0.0003247261047363281,
0.11566162109375,
-0.849609375,
-0.273193359375,
0.2462158203125,
1.0078125,
0.263671875,
-0.12548828125,
-0.6171875,
-0.2169189453125,
-0.0635986328125,
0.276123046875,
-0.4658203125,
0.302734375,
-0.26123046875,
0.50830078125,
-1.1044921875,
0.09906005859375,
-0.38037109375,
0.697265625,
0.732421875,
-0.198974609375,
-0.415771484375,
0.7001953125,
0.5517578125,
-0.2744140625,
0.875,
0.681640625,
1.12890625,
0.01654052734375,
-0.03546142578125,
-0.01031494140625,
0.5302734375,
0.75537109375,
0.79248046875,
0.1414794921875,
0.4052734375,
0.640625,
0.3447265625,
-0.31494140625,
0.53564453125,
0.135498046875,
-0.362548828125,
0.1187744140625,
-0.270751953125,
-0.2423095703125,
-0.10528564453125,
-0.0927734375,
0.4462890625,
-0.466796875,
0.15576171875,
-0.71875,
-0.7099609375,
0.806640625,
-0.1300048828125,
-0.396484375,
0.294677734375,
-0.441162109375,
0.236328125,
0.6591796875,
0.03863525390625,
-0.55126953125,
0.95751953125,
0.494140625,
0.60107421875,
0.72802734375,
0.287353515625,
0.51611328125,
-0.08489990234375,
0.38916015625,
0.05828857421875,
0.60888671875,
-0.302490234375,
-0.317626953125,
-0.70556640625,
0.35107421875,
-0.383544921875,
-0.63037109375,
0.818359375,
-0.6630859375,
-0.00702667236328125,
-0.580078125,
0.9853515625,
-0.849609375,
0.111328125,
0.65185546875,
-0.269775390625,
-0.88916015625,
0.97216796875,
0.06890869140625,
0.446044921875,
0.68017578125,
0.9921875,
-0.145263671875,
1.5537109375,
0.5361328125,
0.1253662109375,
-0.16162109375,
0.4697265625,
-0.2008056640625,
-0.7099609375,
-0.53857421875,
-0.3349609375,
0.2313232421875,
-0.35595703125,
-0.6640625,
-0.462646484375,
0.5556640625,
0.0246429443359375,
-1.15625,
-0.279541015625,
0.19091796875,
-0.55322265625,
0.45751953125,
-0.0831298828125,
0.119140625,
-0.046722412109375,
0.249267578125,
-0.461669921875,
-0.92333984375,
-0.1041259765625,
-0.63330078125,
0.275390625,
-0.01001739501953125,
-0.65234375,
-0.62255859375,
-0.6708984375,
-0.13720703125,
0.08978271484375,
-0.56884765625,
-0.53466796875,
0.982421875,
0.80908203125,
0.274169921875,
0.071044921875,
-0.286865234375,
-0.291015625,
0.96484375,
0.896484375,
0.1612548828125,
0.98193359375,
0.1934814453125,
0.06341552734375,
0.25927734375,
-0.94677734375,
0.328125,
-0.05340576171875,
0.054534912109375,
-0.28857421875,
0.06201171875,
-0.560546875,
-1.0380859375,
-0.00577545166015625,
1.029296875,
0.1302490234375,
-0.78857421875,
-1.041015625,
-0.438232421875,
-1.2353515625,
-0.10003662109375,
-0.66455078125,
0.72265625,
-0.409912109375,
-0.34033203125,
-0.60791015625,
-0.9365234375,
4.22265625,
1.21484375,
1.02734375,
0.82763671875,
0.53564453125,
0.98291015625,
0.293701171875,
-0.57861328125,
-0.371337890625,
-0.90380859375,
0.66748046875,
-0.350830078125,
-0.135498046875,
0.58984375,
0.5400390625,
0.52001953125,
-0.908203125,
-0.2103271484375,
0.233642578125,
-0.650390625,
-0.73095703125,
0.525390625,
-0.1826171875,
0.71630859375,
-0.027801513671875,
0.68701171875,
0.8154296875,
-0.72265625,
-0.213623046875,
-0.68017578125,
-0.5126953125,
-0.5029296875,
0.68505859375,
0.3203125,
-0.70556640625,
0.279296875,
-0.1312255859375,
-0.47802734375,
-0.51416015625,
-0.048828125,
-0.029754638671875,
0.261474609375,
0.767578125,
-0.306640625,
-0.2044677734375,
0.46142578125,
-0.6015625,
0.5908203125,
0.57373046875,
-1.1865234375,
0.99267578125,
-0.62548828125,
0.6875,
-0.79296875,
-0.44091796875,
-0.336181640625,
0.392822265625,
-0.38671875,
-0.343505859375,
0.5380859375,
0.36376953125,
0.1561279296875,
-0.007537841796875,
0.82275390625,
-0.67041015625,
0.74462890625,
-0.377685546875,
0.186279296875,
-0.53564453125,
-0.3798828125,
-0.00548553466796875,
-0.00417327880859375,
0.259521484375,
-0.47021484375,
0.8271484375,
0.625,
-0.3232421875,
0.432861328125,
0.53076171875,
-0.97705078125,
0.250732421875,
0.0016450881958007812,
-0.29736328125,
-0.63232421875,
0.564453125,
0.57080078125,
-1.1220703125,
-0.1053466796875,
-0.10028076171875,
0.60400390625,
0.1661376953125,
0.49169921875,
-0.2489013671875,
-0.05377197265625,
-0.33642578125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Valery have come across an entirely new programming language. Most of all the language attracted him with template functions and procedures. Let us remind you that templates are tools of a language, designed to encode generic algorithms, without reference to some parameters (e.g., data types, buffer sizes, default values).
Valery decided to examine template procedures in this language in more detail. The description of a template procedure consists of the procedure name and the list of its parameter types. The generic type T parameters can be used as parameters of template procedures.
A procedure call consists of a procedure name and a list of variable parameters. Let's call a procedure suitable for this call if the following conditions are fulfilled:
* its name equals to the name of the called procedure;
* the number of its parameters equals to the number of parameters of the procedure call;
* the types of variables in the procedure call match the corresponding types of its parameters. The variable type matches the type of a parameter if the parameter has a generic type T or the type of the variable and the parameter are the same.
You are given a description of some set of template procedures. You are also given a list of variables used in the program, as well as direct procedure calls that use the described variables. For each call you need to count the number of procedures that are suitable for this call.
Input
The first line contains a single integer n (1 β€ n β€ 1000) β the number of template procedures. The next n lines contain the description of the procedures specified in the following format:
"void procedureName (type_1, type_2, ..., type_t)" (1 β€ t β€ 5), where void is the keyword, procedureName is the procedure name, type_i is the type of the next parameter. Types of language parameters can be "int", "string", "double", and the keyword "T", which denotes the generic type.
The next line contains a single integer m (1 β€ m β€ 1000) β the number of used variables. Next m lines specify the description of the variables in the following format:
"type variableName", where type is the type of variable that can take values "int", "string", "double", variableName β the name of the variable.
The next line contains a single integer k (1 β€ k β€ 1000) β the number of procedure calls. Next k lines specify the procedure calls in the following format:
"procedureName (var_1, var_2, ..., var_t)" (1 β€ t β€ 5), where procedureName is the name of the procedure, var_i is the name of a variable.
The lines describing the variables, template procedures and their calls may contain spaces at the beginning of the line and at the end of the line, before and after the brackets and commas. Spaces may be before and after keyword void. The length of each input line does not exceed 100 characters. The names of variables and procedures are non-empty strings of lowercase English letters and numbers with lengths of not more than 10 characters. Note that this is the only condition at the names. Only the specified variables are used in procedure calls. The names of the variables are distinct. No two procedures are the same. Two procedures are the same, if they have identical names and identical ordered sets of types of their parameters.
Output
On each of k lines print a single number, where the i-th number stands for the number of suitable template procedures for the i-th call.
Examples
Input
4
void f(int,T)
void f(T, T)
void foo123 ( int, double, string,string )
void p(T,double)
3
int a
string s
double x123
5
f(a, a)
f(s,a )
foo (a,s,s)
f ( s ,x123)
proc(a)
Output
2
1
0
1
0
Input
6
void f(string,double,int)
void f(int)
void f ( T )
void procedure(int,double)
void f (T, double,int)
void f(string, T,T)
4
int a
int x
string t
double val
5
f(t, a, a)
f(t,val,a)
f(val,a, val)
solve300(val, val)
f (x)
Output
1
3
0
0
2
Tags: binary search, brute force, expression parsing, implementation
Correct Solution:
```
n=int(input())
fu=[input().replace(' ','')[4:].replace('(',',').replace(')','').split(',') for i in range(n)]
m=int(input())
v=[input().strip().split() for i in range(m)]
vd={l[1]:l[0] for l in v}
k=int(input())
c=[input().strip().replace(' ','').replace('(',',').replace(')','').split(',') for i in range(k)]
for f in c:
a=0
for f2 in fu:
if f2[0] != f[0] or len(f) != len(f2):
continue
w=1
for x,y in zip(f[1:],f2[1:]):
if y!='T' and vd[x] !=y:
w=0
break
a+=w
print(a)
```
| 37,101
|
[
0.2352294921875,
-0.259521484375,
0.2236328125,
0.1781005859375,
-0.4794921875,
-0.363525390625,
-0.10736083984375,
0.05438232421875,
0.0230560302734375,
0.6220703125,
0.72119140625,
-0.173828125,
0.237060546875,
-0.454833984375,
-0.48681640625,
0.269287109375,
-0.439453125,
-0.89404296875,
-0.890625,
0.324462890625,
-0.1915283203125,
-0.003078460693359375,
-1.80859375,
-0.31103515625,
-0.57861328125,
0.72119140625,
0.56005859375,
-0.05224609375,
1.2177734375,
1.189453125,
-0.3623046875,
-0.4697265625,
0.28125,
-0.85986328125,
-0.232177734375,
-0.250244140625,
0.367919921875,
-0.78369140625,
-0.453857421875,
-0.2359619140625,
0.394775390625,
-0.1865234375,
0.306396484375,
-1.15234375,
-1.1689453125,
0.01103973388671875,
-0.0263671875,
-0.25634765625,
-0.0086822509765625,
-0.36962890625,
0.31884765625,
0.156005859375,
0.32861328125,
-0.46826171875,
-0.382568359375,
0.037689208984375,
0.0285797119140625,
0.10980224609375,
-0.4560546875,
-0.0657958984375,
-0.525390625,
0.30712890625,
0.005992889404296875,
-0.72119140625,
0.13720703125,
0.0921630859375,
0.06744384765625,
-0.236328125,
0.345703125,
-1.056640625,
-0.56884765625,
0.0810546875,
-0.71435546875,
-0.4697265625,
-0.042083740234375,
0.1771240234375,
0.59423828125,
0.09783935546875,
-0.57080078125,
0.30810546875,
0.64599609375,
0.994140625,
0.1416015625,
0.415771484375,
-0.5947265625,
-0.53076171875,
0.057464599609375,
0.1375732421875,
0.1651611328125,
-0.2198486328125,
-0.31396484375,
0.70947265625,
-0.1982421875,
-0.287353515625,
0.58544921875,
0.401123046875,
-0.28173828125,
0.7333984375,
0.111328125,
0.0036163330078125,
1.15625,
1.271484375,
-0.0751953125,
0.71337890625,
-0.44580078125,
0.74951171875,
0.56396484375,
0.337158203125,
-0.76904296875,
-0.440185546875,
-0.5107421875,
-0.5068359375,
0.2476806640625,
-0.254150390625,
-0.43896484375,
1.052734375,
0.01067352294921875,
-0.0211029052734375,
-0.53271484375,
0.14404296875,
0.3525390625,
0.272216796875,
0.067626953125,
-0.1912841796875,
0.09014892578125,
-0.432861328125,
-0.28076171875,
1.05078125,
-0.5888671875,
0.1448974609375,
-0.064697265625,
-0.348876953125,
-0.52734375,
0.50830078125,
-0.313720703125,
0.90625,
-0.320556640625,
0.51025390625,
0.3076171875,
-0.469482421875,
0.75732421875,
-0.1968994140625,
0.251708984375,
1.296875,
0.2200927734375,
0.339599609375,
1.0068359375,
-0.005123138427734375,
-0.83251953125,
0.53369140625,
-0.368408203125,
0.164306640625,
-0.228759765625,
0.039154052734375,
-0.03692626953125,
0.1248779296875,
-0.1607666015625,
-0.2054443359375,
0.084716796875,
0.138916015625,
-0.358642578125,
0.10882568359375,
0.06341552734375,
0.88232421875,
-0.32080078125,
0.8798828125,
-0.66259765625,
-0.2437744140625,
-0.32421875,
-0.677734375,
0.75390625,
-0.32763671875,
-0.47900390625,
0.53466796875,
1.103515625,
0.6533203125,
1.248046875,
-0.007503509521484375,
0.29150390625,
0.46435546875,
-0.2418212890625,
0.0533447265625,
0.302978515625,
0.779296875,
0.7197265625,
0.48828125,
0.283935546875,
-0.1124267578125,
-0.51953125,
-0.65478515625,
0.170166015625,
0.72119140625,
-0.6572265625,
0.27587890625,
0.2685546875,
-0.0037364959716796875,
-0.30908203125,
-0.10382080078125,
-0.145263671875,
-0.9521484375,
-0.828125,
0.55419921875,
-0.26904296875,
0.0186309814453125,
-0.533203125,
-0.185791015625,
-0.05609130859375,
1.3505859375,
-0.0943603515625,
0.1365966796875,
0.475341796875,
-0.0214385986328125,
-0.2264404296875,
-0.0019969940185546875,
0.06671142578125,
-0.3544921875,
-0.61181640625,
0.49609375,
-0.2646484375,
-0.08502197265625,
0.05450439453125,
0.74365234375,
0.7197265625,
0.042755126953125,
-0.488037109375,
-0.35107421875,
0.16162109375,
1.44140625,
0.00421142578125,
0.89111328125,
0.6533203125,
1.19921875,
0.52880859375,
1.0126953125,
0.61474609375,
0.28564453125,
0.96630859375,
1.0498046875,
0.284912109375,
0.33935546875,
-0.1378173828125,
0.422607421875,
0.45166015625,
0.13916015625,
0.00835418701171875,
0.494384765625,
-0.096923828125,
-0.260009765625,
-0.27099609375,
0.673828125,
-0.11676025390625,
1.033203125,
-0.0726318359375,
0.2822265625,
-0.1240234375,
-0.365966796875,
-0.30859375,
0.693359375,
-0.986328125,
-0.1876220703125,
0.3818359375,
0.141845703125,
0.406494140625,
0.1395263671875,
0.254150390625,
0.246337890625,
0.48046875,
0.225830078125,
-0.232666015625,
-0.99072265625,
-0.334228515625,
-0.96826171875,
-0.9921875,
-0.2109375,
-0.38720703125,
-0.09161376953125,
0.60693359375,
-0.73876953125,
0.2060546875,
-0.31982421875,
0.0819091796875,
0.3779296875,
-0.5947265625,
0.75927734375,
-0.0112457275390625,
0.21240234375,
-0.76708984375,
0.9140625,
-0.1876220703125,
0.87548828125,
-0.564453125,
-0.387451171875,
-0.0933837890625,
-0.70751953125,
0.3232421875,
0.1134033203125,
0.449951171875,
-0.299560546875,
-0.89453125,
-0.806640625,
-0.351318359375,
-0.2274169921875,
-0.71630859375,
0.38330078125,
-0.76318359375,
0.87060546875,
0.355224609375,
-0.845703125,
0.7314453125,
1.009765625,
-1.0810546875,
0.3662109375,
0.014923095703125,
0.0753173828125,
-0.77001953125,
1.3388671875,
0.4130859375,
0.36181640625,
-0.640625,
0.03887939453125,
-0.2401123046875,
-0.3330078125,
0.182861328125,
-0.4345703125,
-0.5361328125,
0.5966796875,
0.453369140625,
-0.93896484375,
0.480224609375,
-1.140625,
-0.126708984375,
-0.31640625,
-0.139404296875,
0.71435546875,
0.7470703125,
-0.1796875,
-0.03021240234375,
0.1324462890625,
-0.0121612548828125,
0.5185546875,
0.251953125,
-0.497802734375,
0.1953125,
0.5576171875,
0.079833984375,
0.57861328125,
0.425537109375,
-0.54833984375,
-0.062408447265625,
-0.5625,
0.138427734375,
0.62353515625,
0.337890625,
0.00640869140625,
-0.20849609375,
0.74658203125,
-0.52685546875,
-0.79443359375,
-0.37890625,
0.6181640625,
0.61328125,
0.65869140625,
0.192626953125,
-0.310546875,
-0.923828125,
-0.41162109375,
-0.25,
0.287353515625,
0.89990234375,
-1.0380859375,
0.7861328125,
-0.381103515625,
-0.58935546875,
-0.03759765625,
-0.61865234375,
0.10833740234375,
0.7783203125,
0.22412109375,
0.8623046875,
-0.89892578125,
-0.5986328125,
0.1456298828125,
0.06463623046875,
0.90673828125,
0.359619140625,
0.8369140625,
-0.12042236328125,
-0.379150390625,
-0.483154296875,
0.1741943359375,
0.2431640625,
-0.4873046875,
0.279052734375,
-0.358154296875,
-0.104248046875,
-1.1005859375,
0.38720703125,
0.74560546875,
0.415771484375,
0.11181640625,
0.384033203125,
0.1253662109375,
0.51708984375,
0.9091796875,
0.0955810546875,
0.1951904296875,
-0.38525390625,
0.43994140625,
0.1524658203125,
-0.2308349609375,
-0.76025390625,
-0.66015625,
0.053375244140625,
0.15380859375,
0.12335205078125,
0.0295562744140625,
-0.654296875,
0.156494140625,
0.0217132568359375,
0.60693359375,
-0.39794921875,
-0.49951171875,
-0.366455078125,
0.83544921875,
0.147705078125,
-0.457763671875,
0.36865234375,
-0.482177734375,
0.71923828125,
0.66796875,
-0.5595703125,
-0.83447265625,
-0.318603515625,
-0.71337890625,
-0.412841796875,
0.7529296875,
0.83154296875,
-0.27294921875,
0.63427734375,
-1.224609375,
0.11614990234375,
-0.1385498046875,
-0.085693359375,
0.058746337890625,
0.07049560546875,
0.51513671875,
0.50537109375,
0.34228515625,
-0.31201171875,
-0.56689453125,
0.166748046875,
-1.0478515625,
0.51611328125,
-0.759765625,
0.083251953125,
-0.0882568359375,
-0.1884765625,
-0.308349609375,
-0.028411865234375,
-0.51416015625,
0.1448974609375,
0.03851318359375,
0.353271484375,
-1.310546875,
-0.343505859375,
0.75732421875,
-0.163818359375,
0.00920867919921875,
0.97802734375,
0.2919921875,
-0.4677734375,
0.671875,
0.392822265625,
-0.5615234375,
0.264404296875,
-0.833984375,
0.37890625,
-0.242919921875,
-0.318359375,
-0.3935546875,
-0.73974609375,
0.338623046875,
0.209228515625,
-0.62890625,
-0.2471923828125,
-1.3974609375,
-0.306396484375,
-0.089111328125,
-0.376953125,
-0.047088623046875,
-0.331298828125,
-0.0188140869140625,
0.341796875,
-0.08056640625,
-0.712890625,
-0.60888671875,
-0.6337890625,
-0.306640625,
0.59228515625,
-0.041595458984375,
0.63232421875,
-0.218505859375,
-0.219482421875,
0.0379638671875,
-0.587890625,
-0.147705078125,
-0.281005859375,
0.05731201171875,
-0.09320068359375,
-0.377685546875,
-0.64306640625,
0.505859375,
-0.1573486328125,
-0.1490478515625,
0.6865234375,
0.2086181640625,
0.419677734375,
0.0231475830078125,
-0.456787109375,
0.9482421875,
0.3701171875,
-1.322265625,
-0.6337890625,
0.5458984375,
-0.13671875,
0.49365234375,
0.420166015625,
-0.267333984375,
-0.467041015625,
-1.203125,
0.07757568359375,
-0.4423828125,
-0.12939453125,
-0.420654296875,
-0.3505859375,
-0.2261962890625,
0.36767578125,
0.385498046875,
-1.0654296875,
-0.673828125,
-1.16015625,
0.490478515625,
-0.74609375,
-0.1649169921875,
-0.4951171875,
-0.56640625,
-0.45751953125,
0.98876953125,
-0.0926513671875,
-0.0445556640625,
-0.142822265625,
-0.03173828125,
0.61572265625,
0.55908203125,
-0.462646484375,
-0.63330078125,
-0.1759033203125,
0.21044921875,
-0.1475830078125,
0.1822509765625,
-0.410888671875,
0.62548828125,
-0.64501953125,
0.666015625,
0.027252197265625,
-0.53125,
-0.3544921875,
-0.2359619140625,
1.09375,
-0.64697265625,
-0.1507568359375,
-0.38330078125,
0.62451171875,
0.5869140625,
-0.67578125,
-0.837890625,
-0.44580078125,
-0.58935546875,
-0.978515625,
0.61669921875,
-0.51513671875,
0.171875,
-0.296630859375,
0.0204010009765625,
1.3115234375,
-0.5400390625,
0.671875,
1.419921875,
0.31494140625,
0.10272216796875,
-0.83740234375,
0.460693359375,
0.791015625,
-0.422607421875,
-0.16259765625,
0.19140625,
-0.6494140625,
0.01513671875,
-0.2115478515625,
-1.2373046875,
-0.5439453125,
0.1700439453125,
0.81640625,
-0.2242431640625,
0.42138671875,
-0.07415771484375,
-1.02734375,
-0.70703125,
0.9931640625,
0.0916748046875,
0.251220703125,
0.896484375,
0.01141357421875,
-0.046600341796875,
-0.19677734375,
-0.4482421875,
0.1375732421875,
-0.67138671875,
1.125,
-0.1646728515625,
-0.74755859375,
0.5205078125,
0.91650390625,
-1.08203125,
-0.677734375,
0.0098876953125,
-0.0418701171875,
-0.2216796875,
-0.430419921875,
-0.2349853515625,
0.7861328125,
-0.51171875,
0.3623046875,
0.71533203125,
0.2049560546875,
0.1226806640625,
0.30126953125,
0.21826171875,
-0.435302734375,
0.96484375,
0.79052734375,
-0.40771484375,
-0.67919921875,
-1.083984375,
-0.1876220703125,
-0.0958251953125,
-0.01422882080078125,
1.0595703125,
-0.346435546875,
0.156982421875,
0.476318359375,
-0.35302734375,
1.04296875,
-0.6630859375,
-0.183837890625,
0.033172607421875,
-0.47900390625,
-0.87744140625,
-0.251220703125,
0.21923828125,
0.0750732421875,
0.1478271484375,
-0.37109375,
0.26513671875,
0.8310546875,
0.461181640625,
-0.469970703125,
-1.533203125,
-0.342041015625,
-1.439453125,
-0.529296875,
-0.3701171875,
-0.175537109375,
-0.035125732421875,
-0.335205078125,
-0.33740234375,
-0.77685546875,
-0.41796875,
0.356201171875,
-0.1895751953125,
0.6220703125,
-1.15625,
0.37548828125,
-0.69580078125,
-0.66552734375,
-0.958984375,
0.178955078125,
-0.2060546875,
-0.0213775634765625,
-0.5888671875,
-0.13037109375,
-0.041534423828125,
0.3740234375,
-0.4384765625,
0.53125,
-0.344482421875,
-0.1424560546875,
0.00499725341796875,
0.2034912109375,
-0.3154296875,
1.09765625,
0.414306640625,
-0.08209228515625,
0.1551513671875,
-0.07000732421875,
-0.587890625,
-0.324951171875,
0.75927734375,
0.4462890625,
0.040435791015625,
-0.48095703125,
-0.7265625,
0.1822509765625,
-0.94287109375,
0.4990234375,
0.306396484375,
0.316650390625,
0.388671875,
-0.125244140625,
0.35595703125,
1.0615234375,
0.234375,
0.61962890625,
0.32373046875,
0.08929443359375,
0.7138671875,
0.457763671875,
-0.08929443359375,
-0.1807861328125,
-0.036590576171875,
0.034393310546875,
0.38134765625,
0.12103271484375,
-0.203857421875,
0.34326171875,
0.14404296875,
-0.56494140625,
-0.9189453125,
-0.41845703125,
0.07916259765625,
0.7412109375,
0.47216796875,
-0.362548828125,
0.11224365234375,
-0.34326171875,
-0.493408203125,
0.170654296875,
-1.2197265625,
-1.1005859375,
0.85009765625,
-0.3154296875,
-0.58740234375,
-0.174072265625,
-0.5732421875,
-0.4970703125,
0.35205078125,
0.54443359375,
-0.5419921875,
0.342041015625,
-0.225830078125,
0.164306640625,
-0.69091796875,
-0.136474609375,
-0.0003247261047363281,
0.11566162109375,
-0.849609375,
-0.273193359375,
0.2462158203125,
1.0078125,
0.263671875,
-0.12548828125,
-0.6171875,
-0.2169189453125,
-0.0635986328125,
0.276123046875,
-0.4658203125,
0.302734375,
-0.26123046875,
0.50830078125,
-1.1044921875,
0.09906005859375,
-0.38037109375,
0.697265625,
0.732421875,
-0.198974609375,
-0.415771484375,
0.7001953125,
0.5517578125,
-0.2744140625,
0.875,
0.681640625,
1.12890625,
0.01654052734375,
-0.03546142578125,
-0.01031494140625,
0.5302734375,
0.75537109375,
0.79248046875,
0.1414794921875,
0.4052734375,
0.640625,
0.3447265625,
-0.31494140625,
0.53564453125,
0.135498046875,
-0.362548828125,
0.1187744140625,
-0.270751953125,
-0.2423095703125,
-0.10528564453125,
-0.0927734375,
0.4462890625,
-0.466796875,
0.15576171875,
-0.71875,
-0.7099609375,
0.806640625,
-0.1300048828125,
-0.396484375,
0.294677734375,
-0.441162109375,
0.236328125,
0.6591796875,
0.03863525390625,
-0.55126953125,
0.95751953125,
0.494140625,
0.60107421875,
0.72802734375,
0.287353515625,
0.51611328125,
-0.08489990234375,
0.38916015625,
0.05828857421875,
0.60888671875,
-0.302490234375,
-0.317626953125,
-0.70556640625,
0.35107421875,
-0.383544921875,
-0.63037109375,
0.818359375,
-0.6630859375,
-0.00702667236328125,
-0.580078125,
0.9853515625,
-0.849609375,
0.111328125,
0.65185546875,
-0.269775390625,
-0.88916015625,
0.97216796875,
0.06890869140625,
0.446044921875,
0.68017578125,
0.9921875,
-0.145263671875,
1.5537109375,
0.5361328125,
0.1253662109375,
-0.16162109375,
0.4697265625,
-0.2008056640625,
-0.7099609375,
-0.53857421875,
-0.3349609375,
0.2313232421875,
-0.35595703125,
-0.6640625,
-0.462646484375,
0.5556640625,
0.0246429443359375,
-1.15625,
-0.279541015625,
0.19091796875,
-0.55322265625,
0.45751953125,
-0.0831298828125,
0.119140625,
-0.046722412109375,
0.249267578125,
-0.461669921875,
-0.92333984375,
-0.1041259765625,
-0.63330078125,
0.275390625,
-0.01001739501953125,
-0.65234375,
-0.62255859375,
-0.6708984375,
-0.13720703125,
0.08978271484375,
-0.56884765625,
-0.53466796875,
0.982421875,
0.80908203125,
0.274169921875,
0.071044921875,
-0.286865234375,
-0.291015625,
0.96484375,
0.896484375,
0.1612548828125,
0.98193359375,
0.1934814453125,
0.06341552734375,
0.25927734375,
-0.94677734375,
0.328125,
-0.05340576171875,
0.054534912109375,
-0.28857421875,
0.06201171875,
-0.560546875,
-1.0380859375,
-0.00577545166015625,
1.029296875,
0.1302490234375,
-0.78857421875,
-1.041015625,
-0.438232421875,
-1.2353515625,
-0.10003662109375,
-0.66455078125,
0.72265625,
-0.409912109375,
-0.34033203125,
-0.60791015625,
-0.9365234375,
4.22265625,
1.21484375,
1.02734375,
0.82763671875,
0.53564453125,
0.98291015625,
0.293701171875,
-0.57861328125,
-0.371337890625,
-0.90380859375,
0.66748046875,
-0.350830078125,
-0.135498046875,
0.58984375,
0.5400390625,
0.52001953125,
-0.908203125,
-0.2103271484375,
0.233642578125,
-0.650390625,
-0.73095703125,
0.525390625,
-0.1826171875,
0.71630859375,
-0.027801513671875,
0.68701171875,
0.8154296875,
-0.72265625,
-0.213623046875,
-0.68017578125,
-0.5126953125,
-0.5029296875,
0.68505859375,
0.3203125,
-0.70556640625,
0.279296875,
-0.1312255859375,
-0.47802734375,
-0.51416015625,
-0.048828125,
-0.029754638671875,
0.261474609375,
0.767578125,
-0.306640625,
-0.2044677734375,
0.46142578125,
-0.6015625,
0.5908203125,
0.57373046875,
-1.1865234375,
0.99267578125,
-0.62548828125,
0.6875,
-0.79296875,
-0.44091796875,
-0.336181640625,
0.392822265625,
-0.38671875,
-0.343505859375,
0.5380859375,
0.36376953125,
0.1561279296875,
-0.007537841796875,
0.82275390625,
-0.67041015625,
0.74462890625,
-0.377685546875,
0.186279296875,
-0.53564453125,
-0.3798828125,
-0.00548553466796875,
-0.00417327880859375,
0.259521484375,
-0.47021484375,
0.8271484375,
0.625,
-0.3232421875,
0.432861328125,
0.53076171875,
-0.97705078125,
0.250732421875,
0.0016450881958007812,
-0.29736328125,
-0.63232421875,
0.564453125,
0.57080078125,
-1.1220703125,
-0.1053466796875,
-0.10028076171875,
0.60400390625,
0.1661376953125,
0.49169921875,
-0.2489013671875,
-0.05377197265625,
-0.33642578125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently, Valery have come across an entirely new programming language. Most of all the language attracted him with template functions and procedures. Let us remind you that templates are tools of a language, designed to encode generic algorithms, without reference to some parameters (e.g., data types, buffer sizes, default values).
Valery decided to examine template procedures in this language in more detail. The description of a template procedure consists of the procedure name and the list of its parameter types. The generic type T parameters can be used as parameters of template procedures.
A procedure call consists of a procedure name and a list of variable parameters. Let's call a procedure suitable for this call if the following conditions are fulfilled:
* its name equals to the name of the called procedure;
* the number of its parameters equals to the number of parameters of the procedure call;
* the types of variables in the procedure call match the corresponding types of its parameters. The variable type matches the type of a parameter if the parameter has a generic type T or the type of the variable and the parameter are the same.
You are given a description of some set of template procedures. You are also given a list of variables used in the program, as well as direct procedure calls that use the described variables. For each call you need to count the number of procedures that are suitable for this call.
Input
The first line contains a single integer n (1 β€ n β€ 1000) β the number of template procedures. The next n lines contain the description of the procedures specified in the following format:
"void procedureName (type_1, type_2, ..., type_t)" (1 β€ t β€ 5), where void is the keyword, procedureName is the procedure name, type_i is the type of the next parameter. Types of language parameters can be "int", "string", "double", and the keyword "T", which denotes the generic type.
The next line contains a single integer m (1 β€ m β€ 1000) β the number of used variables. Next m lines specify the description of the variables in the following format:
"type variableName", where type is the type of variable that can take values "int", "string", "double", variableName β the name of the variable.
The next line contains a single integer k (1 β€ k β€ 1000) β the number of procedure calls. Next k lines specify the procedure calls in the following format:
"procedureName (var_1, var_2, ..., var_t)" (1 β€ t β€ 5), where procedureName is the name of the procedure, var_i is the name of a variable.
The lines describing the variables, template procedures and their calls may contain spaces at the beginning of the line and at the end of the line, before and after the brackets and commas. Spaces may be before and after keyword void. The length of each input line does not exceed 100 characters. The names of variables and procedures are non-empty strings of lowercase English letters and numbers with lengths of not more than 10 characters. Note that this is the only condition at the names. Only the specified variables are used in procedure calls. The names of the variables are distinct. No two procedures are the same. Two procedures are the same, if they have identical names and identical ordered sets of types of their parameters.
Output
On each of k lines print a single number, where the i-th number stands for the number of suitable template procedures for the i-th call.
Examples
Input
4
void f(int,T)
void f(T, T)
void foo123 ( int, double, string,string )
void p(T,double)
3
int a
string s
double x123
5
f(a, a)
f(s,a )
foo (a,s,s)
f ( s ,x123)
proc(a)
Output
2
1
0
1
0
Input
6
void f(string,double,int)
void f(int)
void f ( T )
void procedure(int,double)
void f (T, double,int)
void f(string, T,T)
4
int a
int x
string t
double val
5
f(t, a, a)
f(t,val,a)
f(val,a, val)
solve300(val, val)
f (x)
Output
1
3
0
0
2
Tags: binary search, brute force, expression parsing, implementation
Correct Solution:
```
I=input
R=str.replace
P=range
D=lambda:P(int(I()))
T={}
d={}
def rf(s):
print(s.split())
for _ in D():s=R(R(I(),'void',''),' ','');t=s.find('(');k=s[:t];d[k]=d.get(k,[])+[s[t+1:-1].split(',')]
for _ in D():a,b=I().split();T[b]=a
for _ in D():
s=R(I(),' ','');t=s.find('(');s,v=s[:t],s[t+1:-1].split(',');r=0
for p in d.get(s,[]):
if len(v)==len(p):
for i in P(len(v)):
if p[i]!='T'and p[i]!=T[v[i]]:break
else:r+=1
print(r)
```
| 37,102
|
[
0.2352294921875,
-0.259521484375,
0.2236328125,
0.1781005859375,
-0.4794921875,
-0.363525390625,
-0.10736083984375,
0.05438232421875,
0.0230560302734375,
0.6220703125,
0.72119140625,
-0.173828125,
0.237060546875,
-0.454833984375,
-0.48681640625,
0.269287109375,
-0.439453125,
-0.89404296875,
-0.890625,
0.324462890625,
-0.1915283203125,
-0.003078460693359375,
-1.80859375,
-0.31103515625,
-0.57861328125,
0.72119140625,
0.56005859375,
-0.05224609375,
1.2177734375,
1.189453125,
-0.3623046875,
-0.4697265625,
0.28125,
-0.85986328125,
-0.232177734375,
-0.250244140625,
0.367919921875,
-0.78369140625,
-0.453857421875,
-0.2359619140625,
0.394775390625,
-0.1865234375,
0.306396484375,
-1.15234375,
-1.1689453125,
0.01103973388671875,
-0.0263671875,
-0.25634765625,
-0.0086822509765625,
-0.36962890625,
0.31884765625,
0.156005859375,
0.32861328125,
-0.46826171875,
-0.382568359375,
0.037689208984375,
0.0285797119140625,
0.10980224609375,
-0.4560546875,
-0.0657958984375,
-0.525390625,
0.30712890625,
0.005992889404296875,
-0.72119140625,
0.13720703125,
0.0921630859375,
0.06744384765625,
-0.236328125,
0.345703125,
-1.056640625,
-0.56884765625,
0.0810546875,
-0.71435546875,
-0.4697265625,
-0.042083740234375,
0.1771240234375,
0.59423828125,
0.09783935546875,
-0.57080078125,
0.30810546875,
0.64599609375,
0.994140625,
0.1416015625,
0.415771484375,
-0.5947265625,
-0.53076171875,
0.057464599609375,
0.1375732421875,
0.1651611328125,
-0.2198486328125,
-0.31396484375,
0.70947265625,
-0.1982421875,
-0.287353515625,
0.58544921875,
0.401123046875,
-0.28173828125,
0.7333984375,
0.111328125,
0.0036163330078125,
1.15625,
1.271484375,
-0.0751953125,
0.71337890625,
-0.44580078125,
0.74951171875,
0.56396484375,
0.337158203125,
-0.76904296875,
-0.440185546875,
-0.5107421875,
-0.5068359375,
0.2476806640625,
-0.254150390625,
-0.43896484375,
1.052734375,
0.01067352294921875,
-0.0211029052734375,
-0.53271484375,
0.14404296875,
0.3525390625,
0.272216796875,
0.067626953125,
-0.1912841796875,
0.09014892578125,
-0.432861328125,
-0.28076171875,
1.05078125,
-0.5888671875,
0.1448974609375,
-0.064697265625,
-0.348876953125,
-0.52734375,
0.50830078125,
-0.313720703125,
0.90625,
-0.320556640625,
0.51025390625,
0.3076171875,
-0.469482421875,
0.75732421875,
-0.1968994140625,
0.251708984375,
1.296875,
0.2200927734375,
0.339599609375,
1.0068359375,
-0.005123138427734375,
-0.83251953125,
0.53369140625,
-0.368408203125,
0.164306640625,
-0.228759765625,
0.039154052734375,
-0.03692626953125,
0.1248779296875,
-0.1607666015625,
-0.2054443359375,
0.084716796875,
0.138916015625,
-0.358642578125,
0.10882568359375,
0.06341552734375,
0.88232421875,
-0.32080078125,
0.8798828125,
-0.66259765625,
-0.2437744140625,
-0.32421875,
-0.677734375,
0.75390625,
-0.32763671875,
-0.47900390625,
0.53466796875,
1.103515625,
0.6533203125,
1.248046875,
-0.007503509521484375,
0.29150390625,
0.46435546875,
-0.2418212890625,
0.0533447265625,
0.302978515625,
0.779296875,
0.7197265625,
0.48828125,
0.283935546875,
-0.1124267578125,
-0.51953125,
-0.65478515625,
0.170166015625,
0.72119140625,
-0.6572265625,
0.27587890625,
0.2685546875,
-0.0037364959716796875,
-0.30908203125,
-0.10382080078125,
-0.145263671875,
-0.9521484375,
-0.828125,
0.55419921875,
-0.26904296875,
0.0186309814453125,
-0.533203125,
-0.185791015625,
-0.05609130859375,
1.3505859375,
-0.0943603515625,
0.1365966796875,
0.475341796875,
-0.0214385986328125,
-0.2264404296875,
-0.0019969940185546875,
0.06671142578125,
-0.3544921875,
-0.61181640625,
0.49609375,
-0.2646484375,
-0.08502197265625,
0.05450439453125,
0.74365234375,
0.7197265625,
0.042755126953125,
-0.488037109375,
-0.35107421875,
0.16162109375,
1.44140625,
0.00421142578125,
0.89111328125,
0.6533203125,
1.19921875,
0.52880859375,
1.0126953125,
0.61474609375,
0.28564453125,
0.96630859375,
1.0498046875,
0.284912109375,
0.33935546875,
-0.1378173828125,
0.422607421875,
0.45166015625,
0.13916015625,
0.00835418701171875,
0.494384765625,
-0.096923828125,
-0.260009765625,
-0.27099609375,
0.673828125,
-0.11676025390625,
1.033203125,
-0.0726318359375,
0.2822265625,
-0.1240234375,
-0.365966796875,
-0.30859375,
0.693359375,
-0.986328125,
-0.1876220703125,
0.3818359375,
0.141845703125,
0.406494140625,
0.1395263671875,
0.254150390625,
0.246337890625,
0.48046875,
0.225830078125,
-0.232666015625,
-0.99072265625,
-0.334228515625,
-0.96826171875,
-0.9921875,
-0.2109375,
-0.38720703125,
-0.09161376953125,
0.60693359375,
-0.73876953125,
0.2060546875,
-0.31982421875,
0.0819091796875,
0.3779296875,
-0.5947265625,
0.75927734375,
-0.0112457275390625,
0.21240234375,
-0.76708984375,
0.9140625,
-0.1876220703125,
0.87548828125,
-0.564453125,
-0.387451171875,
-0.0933837890625,
-0.70751953125,
0.3232421875,
0.1134033203125,
0.449951171875,
-0.299560546875,
-0.89453125,
-0.806640625,
-0.351318359375,
-0.2274169921875,
-0.71630859375,
0.38330078125,
-0.76318359375,
0.87060546875,
0.355224609375,
-0.845703125,
0.7314453125,
1.009765625,
-1.0810546875,
0.3662109375,
0.014923095703125,
0.0753173828125,
-0.77001953125,
1.3388671875,
0.4130859375,
0.36181640625,
-0.640625,
0.03887939453125,
-0.2401123046875,
-0.3330078125,
0.182861328125,
-0.4345703125,
-0.5361328125,
0.5966796875,
0.453369140625,
-0.93896484375,
0.480224609375,
-1.140625,
-0.126708984375,
-0.31640625,
-0.139404296875,
0.71435546875,
0.7470703125,
-0.1796875,
-0.03021240234375,
0.1324462890625,
-0.0121612548828125,
0.5185546875,
0.251953125,
-0.497802734375,
0.1953125,
0.5576171875,
0.079833984375,
0.57861328125,
0.425537109375,
-0.54833984375,
-0.062408447265625,
-0.5625,
0.138427734375,
0.62353515625,
0.337890625,
0.00640869140625,
-0.20849609375,
0.74658203125,
-0.52685546875,
-0.79443359375,
-0.37890625,
0.6181640625,
0.61328125,
0.65869140625,
0.192626953125,
-0.310546875,
-0.923828125,
-0.41162109375,
-0.25,
0.287353515625,
0.89990234375,
-1.0380859375,
0.7861328125,
-0.381103515625,
-0.58935546875,
-0.03759765625,
-0.61865234375,
0.10833740234375,
0.7783203125,
0.22412109375,
0.8623046875,
-0.89892578125,
-0.5986328125,
0.1456298828125,
0.06463623046875,
0.90673828125,
0.359619140625,
0.8369140625,
-0.12042236328125,
-0.379150390625,
-0.483154296875,
0.1741943359375,
0.2431640625,
-0.4873046875,
0.279052734375,
-0.358154296875,
-0.104248046875,
-1.1005859375,
0.38720703125,
0.74560546875,
0.415771484375,
0.11181640625,
0.384033203125,
0.1253662109375,
0.51708984375,
0.9091796875,
0.0955810546875,
0.1951904296875,
-0.38525390625,
0.43994140625,
0.1524658203125,
-0.2308349609375,
-0.76025390625,
-0.66015625,
0.053375244140625,
0.15380859375,
0.12335205078125,
0.0295562744140625,
-0.654296875,
0.156494140625,
0.0217132568359375,
0.60693359375,
-0.39794921875,
-0.49951171875,
-0.366455078125,
0.83544921875,
0.147705078125,
-0.457763671875,
0.36865234375,
-0.482177734375,
0.71923828125,
0.66796875,
-0.5595703125,
-0.83447265625,
-0.318603515625,
-0.71337890625,
-0.412841796875,
0.7529296875,
0.83154296875,
-0.27294921875,
0.63427734375,
-1.224609375,
0.11614990234375,
-0.1385498046875,
-0.085693359375,
0.058746337890625,
0.07049560546875,
0.51513671875,
0.50537109375,
0.34228515625,
-0.31201171875,
-0.56689453125,
0.166748046875,
-1.0478515625,
0.51611328125,
-0.759765625,
0.083251953125,
-0.0882568359375,
-0.1884765625,
-0.308349609375,
-0.028411865234375,
-0.51416015625,
0.1448974609375,
0.03851318359375,
0.353271484375,
-1.310546875,
-0.343505859375,
0.75732421875,
-0.163818359375,
0.00920867919921875,
0.97802734375,
0.2919921875,
-0.4677734375,
0.671875,
0.392822265625,
-0.5615234375,
0.264404296875,
-0.833984375,
0.37890625,
-0.242919921875,
-0.318359375,
-0.3935546875,
-0.73974609375,
0.338623046875,
0.209228515625,
-0.62890625,
-0.2471923828125,
-1.3974609375,
-0.306396484375,
-0.089111328125,
-0.376953125,
-0.047088623046875,
-0.331298828125,
-0.0188140869140625,
0.341796875,
-0.08056640625,
-0.712890625,
-0.60888671875,
-0.6337890625,
-0.306640625,
0.59228515625,
-0.041595458984375,
0.63232421875,
-0.218505859375,
-0.219482421875,
0.0379638671875,
-0.587890625,
-0.147705078125,
-0.281005859375,
0.05731201171875,
-0.09320068359375,
-0.377685546875,
-0.64306640625,
0.505859375,
-0.1573486328125,
-0.1490478515625,
0.6865234375,
0.2086181640625,
0.419677734375,
0.0231475830078125,
-0.456787109375,
0.9482421875,
0.3701171875,
-1.322265625,
-0.6337890625,
0.5458984375,
-0.13671875,
0.49365234375,
0.420166015625,
-0.267333984375,
-0.467041015625,
-1.203125,
0.07757568359375,
-0.4423828125,
-0.12939453125,
-0.420654296875,
-0.3505859375,
-0.2261962890625,
0.36767578125,
0.385498046875,
-1.0654296875,
-0.673828125,
-1.16015625,
0.490478515625,
-0.74609375,
-0.1649169921875,
-0.4951171875,
-0.56640625,
-0.45751953125,
0.98876953125,
-0.0926513671875,
-0.0445556640625,
-0.142822265625,
-0.03173828125,
0.61572265625,
0.55908203125,
-0.462646484375,
-0.63330078125,
-0.1759033203125,
0.21044921875,
-0.1475830078125,
0.1822509765625,
-0.410888671875,
0.62548828125,
-0.64501953125,
0.666015625,
0.027252197265625,
-0.53125,
-0.3544921875,
-0.2359619140625,
1.09375,
-0.64697265625,
-0.1507568359375,
-0.38330078125,
0.62451171875,
0.5869140625,
-0.67578125,
-0.837890625,
-0.44580078125,
-0.58935546875,
-0.978515625,
0.61669921875,
-0.51513671875,
0.171875,
-0.296630859375,
0.0204010009765625,
1.3115234375,
-0.5400390625,
0.671875,
1.419921875,
0.31494140625,
0.10272216796875,
-0.83740234375,
0.460693359375,
0.791015625,
-0.422607421875,
-0.16259765625,
0.19140625,
-0.6494140625,
0.01513671875,
-0.2115478515625,
-1.2373046875,
-0.5439453125,
0.1700439453125,
0.81640625,
-0.2242431640625,
0.42138671875,
-0.07415771484375,
-1.02734375,
-0.70703125,
0.9931640625,
0.0916748046875,
0.251220703125,
0.896484375,
0.01141357421875,
-0.046600341796875,
-0.19677734375,
-0.4482421875,
0.1375732421875,
-0.67138671875,
1.125,
-0.1646728515625,
-0.74755859375,
0.5205078125,
0.91650390625,
-1.08203125,
-0.677734375,
0.0098876953125,
-0.0418701171875,
-0.2216796875,
-0.430419921875,
-0.2349853515625,
0.7861328125,
-0.51171875,
0.3623046875,
0.71533203125,
0.2049560546875,
0.1226806640625,
0.30126953125,
0.21826171875,
-0.435302734375,
0.96484375,
0.79052734375,
-0.40771484375,
-0.67919921875,
-1.083984375,
-0.1876220703125,
-0.0958251953125,
-0.01422882080078125,
1.0595703125,
-0.346435546875,
0.156982421875,
0.476318359375,
-0.35302734375,
1.04296875,
-0.6630859375,
-0.183837890625,
0.033172607421875,
-0.47900390625,
-0.87744140625,
-0.251220703125,
0.21923828125,
0.0750732421875,
0.1478271484375,
-0.37109375,
0.26513671875,
0.8310546875,
0.461181640625,
-0.469970703125,
-1.533203125,
-0.342041015625,
-1.439453125,
-0.529296875,
-0.3701171875,
-0.175537109375,
-0.035125732421875,
-0.335205078125,
-0.33740234375,
-0.77685546875,
-0.41796875,
0.356201171875,
-0.1895751953125,
0.6220703125,
-1.15625,
0.37548828125,
-0.69580078125,
-0.66552734375,
-0.958984375,
0.178955078125,
-0.2060546875,
-0.0213775634765625,
-0.5888671875,
-0.13037109375,
-0.041534423828125,
0.3740234375,
-0.4384765625,
0.53125,
-0.344482421875,
-0.1424560546875,
0.00499725341796875,
0.2034912109375,
-0.3154296875,
1.09765625,
0.414306640625,
-0.08209228515625,
0.1551513671875,
-0.07000732421875,
-0.587890625,
-0.324951171875,
0.75927734375,
0.4462890625,
0.040435791015625,
-0.48095703125,
-0.7265625,
0.1822509765625,
-0.94287109375,
0.4990234375,
0.306396484375,
0.316650390625,
0.388671875,
-0.125244140625,
0.35595703125,
1.0615234375,
0.234375,
0.61962890625,
0.32373046875,
0.08929443359375,
0.7138671875,
0.457763671875,
-0.08929443359375,
-0.1807861328125,
-0.036590576171875,
0.034393310546875,
0.38134765625,
0.12103271484375,
-0.203857421875,
0.34326171875,
0.14404296875,
-0.56494140625,
-0.9189453125,
-0.41845703125,
0.07916259765625,
0.7412109375,
0.47216796875,
-0.362548828125,
0.11224365234375,
-0.34326171875,
-0.493408203125,
0.170654296875,
-1.2197265625,
-1.1005859375,
0.85009765625,
-0.3154296875,
-0.58740234375,
-0.174072265625,
-0.5732421875,
-0.4970703125,
0.35205078125,
0.54443359375,
-0.5419921875,
0.342041015625,
-0.225830078125,
0.164306640625,
-0.69091796875,
-0.136474609375,
-0.0003247261047363281,
0.11566162109375,
-0.849609375,
-0.273193359375,
0.2462158203125,
1.0078125,
0.263671875,
-0.12548828125,
-0.6171875,
-0.2169189453125,
-0.0635986328125,
0.276123046875,
-0.4658203125,
0.302734375,
-0.26123046875,
0.50830078125,
-1.1044921875,
0.09906005859375,
-0.38037109375,
0.697265625,
0.732421875,
-0.198974609375,
-0.415771484375,
0.7001953125,
0.5517578125,
-0.2744140625,
0.875,
0.681640625,
1.12890625,
0.01654052734375,
-0.03546142578125,
-0.01031494140625,
0.5302734375,
0.75537109375,
0.79248046875,
0.1414794921875,
0.4052734375,
0.640625,
0.3447265625,
-0.31494140625,
0.53564453125,
0.135498046875,
-0.362548828125,
0.1187744140625,
-0.270751953125,
-0.2423095703125,
-0.10528564453125,
-0.0927734375,
0.4462890625,
-0.466796875,
0.15576171875,
-0.71875,
-0.7099609375,
0.806640625,
-0.1300048828125,
-0.396484375,
0.294677734375,
-0.441162109375,
0.236328125,
0.6591796875,
0.03863525390625,
-0.55126953125,
0.95751953125,
0.494140625,
0.60107421875,
0.72802734375,
0.287353515625,
0.51611328125,
-0.08489990234375,
0.38916015625,
0.05828857421875,
0.60888671875,
-0.302490234375,
-0.317626953125,
-0.70556640625,
0.35107421875,
-0.383544921875,
-0.63037109375,
0.818359375,
-0.6630859375,
-0.00702667236328125,
-0.580078125,
0.9853515625,
-0.849609375,
0.111328125,
0.65185546875,
-0.269775390625,
-0.88916015625,
0.97216796875,
0.06890869140625,
0.446044921875,
0.68017578125,
0.9921875,
-0.145263671875,
1.5537109375,
0.5361328125,
0.1253662109375,
-0.16162109375,
0.4697265625,
-0.2008056640625,
-0.7099609375,
-0.53857421875,
-0.3349609375,
0.2313232421875,
-0.35595703125,
-0.6640625,
-0.462646484375,
0.5556640625,
0.0246429443359375,
-1.15625,
-0.279541015625,
0.19091796875,
-0.55322265625,
0.45751953125,
-0.0831298828125,
0.119140625,
-0.046722412109375,
0.249267578125,
-0.461669921875,
-0.92333984375,
-0.1041259765625,
-0.63330078125,
0.275390625,
-0.01001739501953125,
-0.65234375,
-0.62255859375,
-0.6708984375,
-0.13720703125,
0.08978271484375,
-0.56884765625,
-0.53466796875,
0.982421875,
0.80908203125,
0.274169921875,
0.071044921875,
-0.286865234375,
-0.291015625,
0.96484375,
0.896484375,
0.1612548828125,
0.98193359375,
0.1934814453125,
0.06341552734375,
0.25927734375,
-0.94677734375,
0.328125,
-0.05340576171875,
0.054534912109375,
-0.28857421875,
0.06201171875,
-0.560546875,
-1.0380859375,
-0.00577545166015625,
1.029296875,
0.1302490234375,
-0.78857421875,
-1.041015625,
-0.438232421875,
-1.2353515625,
-0.10003662109375,
-0.66455078125,
0.72265625,
-0.409912109375,
-0.34033203125,
-0.60791015625,
-0.9365234375,
4.22265625,
1.21484375,
1.02734375,
0.82763671875,
0.53564453125,
0.98291015625,
0.293701171875,
-0.57861328125,
-0.371337890625,
-0.90380859375,
0.66748046875,
-0.350830078125,
-0.135498046875,
0.58984375,
0.5400390625,
0.52001953125,
-0.908203125,
-0.2103271484375,
0.233642578125,
-0.650390625,
-0.73095703125,
0.525390625,
-0.1826171875,
0.71630859375,
-0.027801513671875,
0.68701171875,
0.8154296875,
-0.72265625,
-0.213623046875,
-0.68017578125,
-0.5126953125,
-0.5029296875,
0.68505859375,
0.3203125,
-0.70556640625,
0.279296875,
-0.1312255859375,
-0.47802734375,
-0.51416015625,
-0.048828125,
-0.029754638671875,
0.261474609375,
0.767578125,
-0.306640625,
-0.2044677734375,
0.46142578125,
-0.6015625,
0.5908203125,
0.57373046875,
-1.1865234375,
0.99267578125,
-0.62548828125,
0.6875,
-0.79296875,
-0.44091796875,
-0.336181640625,
0.392822265625,
-0.38671875,
-0.343505859375,
0.5380859375,
0.36376953125,
0.1561279296875,
-0.007537841796875,
0.82275390625,
-0.67041015625,
0.74462890625,
-0.377685546875,
0.186279296875,
-0.53564453125,
-0.3798828125,
-0.00548553466796875,
-0.00417327880859375,
0.259521484375,
-0.47021484375,
0.8271484375,
0.625,
-0.3232421875,
0.432861328125,
0.53076171875,
-0.97705078125,
0.250732421875,
0.0016450881958007812,
-0.29736328125,
-0.63232421875,
0.564453125,
0.57080078125,
-1.1220703125,
-0.1053466796875,
-0.10028076171875,
0.60400390625,
0.1661376953125,
0.49169921875,
-0.2489013671875,
-0.05377197265625,
-0.33642578125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a text consisting of n lines. Each line contains some space-separated words, consisting of lowercase English letters.
We define a syllable as a string that contains exactly one vowel and any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowels: 'a', 'e', 'i', 'o', 'u' and 'y'.
Each word of the text that contains at least one vowel can be divided into syllables. Each character should be a part of exactly one syllable. For example, the word "mamma" can be divided into syllables as "ma" and "mma", "mam" and "ma", and "mamm" and "a". Words that consist of only consonants should be ignored.
The verse patterns for the given text is a sequence of n integers p1, p2, ..., pn. Text matches the given verse pattern if for each i from 1 to n one can divide words of the i-th line in syllables in such a way that the total number of syllables is equal to pi.
You are given the text and the verse pattern. Check, if the given text matches the given verse pattern.
Input
The first line of the input contains a single integer n (1 β€ n β€ 100) β the number of lines in the text.
The second line contains integers p1, ..., pn (0 β€ pi β€ 100) β the verse pattern.
Next n lines contain the text itself. Text consists of lowercase English letters and spaces. It's guaranteed that all lines are non-empty, each line starts and ends with a letter and words are separated by exactly one space. The length of each line doesn't exceed 100 characters.
Output
If the given text matches the given verse pattern, then print "YES" (without quotes) in the only line of the output. Otherwise, print "NO" (without quotes).
Examples
Input
3
2 2 3
intel
code
ch allenge
Output
YES
Input
4
1 2 3 1
a
bcdefghi
jklmnopqrstu
vwxyz
Output
NO
Input
4
13 11 15 15
to be or not to be that is the question
whether tis nobler in the mind to suffer
the slings and arrows of outrageous fortune
or to take arms against a sea of troubles
Output
YES
Note
In the first sample, one can split words into syllables in the following way:
in-tel
co-de
ch al-len-ge
Since the word "ch" in the third line doesn't contain vowels, we can ignore it. As the result we get 2 syllabels in first two lines and 3 syllables in the third one.
Tags: implementation, strings
Correct Solution:
```
n = int(input())
V = {'a','e','i','o','u','y'}
p = input().split()
p = [int(i) for i in p]
c = [0 for i in range(n)]
for i in range(n):
A = list(input())
for v in V:
c[i] += A.count(v)
assert(len(c) == n)
flag = 1
for i in range(n):
if(c[i] != p[i]):
flag = 0;
break
if(flag):
print("YES")
else:
print("NO")
```
| 37,323
|
[
0.256103515625,
0.1124267578125,
0.173828125,
0.061370849609375,
-0.36572265625,
-0.447509765625,
0.44775390625,
-0.389892578125,
0.371337890625,
0.8623046875,
0.353759765625,
0.1375732421875,
0.07672119140625,
-0.75390625,
-0.348388671875,
0.035186767578125,
-0.69140625,
-0.90478515625,
-0.475341796875,
-0.1226806640625,
-0.329345703125,
0.1776123046875,
-1.6689453125,
-0.29296875,
0.0311737060546875,
0.85205078125,
0.51025390625,
0.437255859375,
0.82080078125,
0.98046875,
-0.1705322265625,
-0.2039794921875,
0.474853515625,
-0.978515625,
-0.213623046875,
-0.65185546875,
0.7001953125,
-0.63232421875,
-0.38232421875,
-0.796875,
0.294189453125,
-0.4814453125,
0.432373046875,
-0.40380859375,
-1.1943359375,
-0.61865234375,
-0.315673828125,
-0.4208984375,
-0.10809326171875,
-0.082763671875,
0.58544921875,
-0.441650390625,
0.415283203125,
-0.2203369140625,
-0.390869140625,
-0.24853515625,
-0.1375732421875,
0.0341796875,
-0.82470703125,
0.2509765625,
0.2144775390625,
0.3896484375,
-0.2724609375,
-0.291748046875,
-0.806640625,
0.081298828125,
-0.264404296875,
0.0355224609375,
-0.12164306640625,
-0.74462890625,
-0.32666015625,
0.232421875,
-0.10516357421875,
-0.7138671875,
-0.75146484375,
-0.25537109375,
-0.11077880859375,
-0.29052734375,
-0.55517578125,
0.7158203125,
0.1390380859375,
1.1572265625,
0.281005859375,
0.38330078125,
-0.615234375,
-0.892578125,
-0.342529296875,
0.1700439453125,
0.307373046875,
-0.2493896484375,
-0.25732421875,
0.4921875,
-0.572265625,
0.29931640625,
0.58447265625,
0.68310546875,
-0.25439453125,
0.2379150390625,
0.59130859375,
0.60400390625,
0.6103515625,
0.806640625,
-0.439697265625,
1.0634765625,
-0.51904296875,
0.28955078125,
0.38427734375,
-0.0198974609375,
-0.1387939453125,
-0.1932373046875,
-0.0889892578125,
-0.382568359375,
0.447998046875,
0.51171875,
-0.14794921875,
0.94775390625,
-0.164306640625,
0.2484130859375,
-0.8408203125,
0.1932373046875,
0.30126953125,
0.1533203125,
0.1629638671875,
-0.386962890625,
0.4130859375,
-0.62109375,
-0.374755859375,
0.97509765625,
-0.330322265625,
0.0611572265625,
0.57470703125,
-0.180908203125,
-0.040374755859375,
0.21435546875,
-0.1435546875,
0.2880859375,
-0.061126708984375,
0.6162109375,
0.76123046875,
-0.4375,
0.7880859375,
-0.5771484375,
-0.045623779296875,
1.5048828125,
0.7001953125,
0.31005859375,
0.53125,
0.348388671875,
-0.931640625,
0.332275390625,
-0.95849609375,
0.82177734375,
0.0231475830078125,
0.264892578125,
-0.21630859375,
0.291259765625,
-0.2242431640625,
0.1552734375,
-0.045562744140625,
0.2265625,
-0.15380859375,
0.144287109375,
-0.2705078125,
0.79833984375,
-0.455078125,
0.79248046875,
-0.44091796875,
-0.11651611328125,
0.01568603515625,
-0.931640625,
0.4091796875,
0.10186767578125,
-0.279296875,
0.64453125,
0.34326171875,
0.9658203125,
0.82861328125,
-0.5400390625,
0.5771484375,
0.1370849609375,
-0.11083984375,
0.296875,
-0.1348876953125,
0.401123046875,
0.2447509765625,
0.477294921875,
0.03173828125,
-0.1805419921875,
-1.2548828125,
-0.55322265625,
0.18408203125,
0.931640625,
-0.76708984375,
0.322021484375,
0.61962890625,
-0.11181640625,
-0.654296875,
-0.418212890625,
-0.40966796875,
-0.89111328125,
-0.2047119140625,
0.6083984375,
-0.12353515625,
0.448486328125,
-0.5224609375,
-0.70556640625,
0.69140625,
1.3916015625,
-0.2254638671875,
0.385498046875,
0.16357421875,
0.011749267578125,
-0.07000732421875,
0.35009765625,
0.2366943359375,
-0.296875,
-0.5908203125,
0.896484375,
-0.50439453125,
-0.186279296875,
-0.1949462890625,
0.70263671875,
0.329833984375,
0.46533203125,
-0.29931640625,
-0.68505859375,
0.61865234375,
0.89208984375,
0.10687255859375,
0.376220703125,
0.0589599609375,
0.6826171875,
0.332275390625,
0.72998046875,
0.2457275390625,
0.286865234375,
0.283935546875,
0.9921875,
-0.109130859375,
0.497802734375,
-0.20361328125,
0.53564453125,
0.312255859375,
0.6728515625,
0.314208984375,
0.388427734375,
-0.273681640625,
0.2275390625,
-0.6044921875,
0.484619140625,
-0.0758056640625,
1.119140625,
0.6826171875,
0.62744140625,
-0.650390625,
-0.837890625,
-0.1422119140625,
0.8076171875,
-0.9501953125,
-0.7138671875,
0.07928466796875,
0.184326171875,
0.37060546875,
0.1636962890625,
0.222900390625,
0.37255859375,
0.5693359375,
0.458740234375,
-0.283203125,
-0.129150390625,
-0.7197265625,
-0.59375,
-0.92138671875,
-0.10028076171875,
-0.59033203125,
-0.12408447265625,
0.1685791015625,
-1.017578125,
0.2030029296875,
-0.28662109375,
-0.08282470703125,
0.2607421875,
-0.8798828125,
0.463134765625,
-0.62744140625,
0.5859375,
-0.51123046875,
0.74609375,
0.03875732421875,
0.958984375,
-0.7412109375,
-0.5546875,
-0.19921875,
-0.6806640625,
0.5322265625,
0.0965576171875,
0.38623046875,
0.470703125,
-0.68017578125,
-0.623046875,
-0.05926513671875,
-0.5419921875,
-0.418701171875,
0.47998046875,
-0.75439453125,
0.9267578125,
0.379150390625,
-0.9033203125,
0.1903076171875,
0.923828125,
-0.8115234375,
0.4169921875,
0.396728515625,
0.056640625,
-0.6630859375,
1.328125,
0.5927734375,
0.497314453125,
-0.78125,
-0.32763671875,
-0.498779296875,
0.171875,
0.09002685546875,
-0.48974609375,
-0.384521484375,
0.3291015625,
0.65283203125,
-1.1875,
0.55859375,
-1.169921875,
-0.37890625,
-0.12347412109375,
-0.45947265625,
1.1611328125,
0.97314453125,
-0.054595947265625,
-0.281494140625,
-0.3046875,
0.13525390625,
0.865234375,
0.49365234375,
-0.5791015625,
0.20751953125,
0.84423828125,
-0.1865234375,
-0.0838623046875,
0.325439453125,
-0.3857421875,
0.14013671875,
-0.040252685546875,
0.05859375,
0.9091796875,
0.58203125,
0.60888671875,
0.345703125,
0.3623046875,
-0.89208984375,
-0.3984375,
-0.2685546875,
0.97900390625,
0.2474365234375,
0.66455078125,
0.36572265625,
-0.004497528076171875,
-0.187744140625,
-0.80419921875,
0.54443359375,
-0.03802490234375,
0.70263671875,
-1.013671875,
0.85205078125,
0.1463623046875,
-0.2479248046875,
0.6787109375,
-0.8173828125,
-0.382568359375,
1.5302734375,
-0.07000732421875,
0.796875,
-0.47998046875,
0.410888671875,
-0.281982421875,
0.00467681884765625,
0.7080078125,
0.499755859375,
0.42431640625,
-0.250732421875,
-0.385009765625,
-0.1939697265625,
-0.195556640625,
-0.323974609375,
-0.57958984375,
0.3173828125,
-0.60009765625,
-0.33837890625,
-0.78076171875,
0.288330078125,
0.62353515625,
0.1651611328125,
-0.03253173828125,
0.41357421875,
0.1815185546875,
0.8076171875,
0.47265625,
-0.2198486328125,
0.496337890625,
-0.6474609375,
0.46533203125,
-0.087158203125,
-0.232666015625,
-0.7822265625,
-0.4912109375,
-0.57373046875,
-0.483154296875,
0.1351318359375,
-0.224853515625,
-0.82763671875,
0.11737060546875,
0.10711669921875,
0.5810546875,
-1.1767578125,
-0.2347412109375,
-0.290771484375,
0.69091796875,
0.404541015625,
-0.8740234375,
0.13134765625,
-0.87353515625,
0.6025390625,
0.332763671875,
-0.27392578125,
-0.273681640625,
-0.38330078125,
-0.85107421875,
-0.59033203125,
0.068603515625,
0.45361328125,
-0.129638671875,
0.328369140625,
-0.91796875,
0.5576171875,
0.47314453125,
-0.28369140625,
0.1307373046875,
0.2413330078125,
-0.0611572265625,
0.421875,
0.65478515625,
-0.77587890625,
-0.65869140625,
0.259521484375,
-1.263671875,
0.305908203125,
-0.7099609375,
0.2200927734375,
-0.237548828125,
-0.2269287109375,
-0.02813720703125,
0.29345703125,
-0.223876953125,
0.10821533203125,
-0.18994140625,
0.11474609375,
-1.0009765625,
-1.044921875,
0.5986328125,
0.1275634765625,
-0.5849609375,
0.9755859375,
-0.1824951171875,
-0.28955078125,
0.2408447265625,
0.37109375,
-0.415771484375,
0.47021484375,
-0.4541015625,
0.308837890625,
-0.1873779296875,
-0.5478515625,
-0.529296875,
-0.187744140625,
0.328857421875,
-0.1319580078125,
-0.67529296875,
-0.31494140625,
-1.060546875,
-0.1888427734375,
-0.333251953125,
-0.310546875,
0.150390625,
0.3369140625,
0.0246734619140625,
0.05169677734375,
-0.357421875,
-0.347900390625,
-0.397705078125,
-0.42431640625,
-0.65283203125,
0.41162109375,
0.50048828125,
0.99658203125,
0.336181640625,
-0.39306640625,
-0.097900390625,
0.20947265625,
0.020660400390625,
-0.322021484375,
-0.20263671875,
-0.043304443359375,
-0.55126953125,
-0.05682373046875,
0.60791015625,
0.07562255859375,
0.4404296875,
0.8134765625,
-0.0732421875,
0.58349609375,
0.546875,
-0.4130859375,
1.1513671875,
0.38720703125,
-1.056640625,
-0.407470703125,
0.34033203125,
-0.08270263671875,
1.08203125,
0.1995849609375,
-0.83544921875,
-0.66748046875,
-1,
-0.1126708984375,
-0.246826171875,
-0.2197265625,
-0.482177734375,
-0.322509765625,
0.00872802734375,
0.814453125,
-0.227294921875,
-0.35302734375,
-0.056396484375,
-1.119140625,
-0.1292724609375,
-0.59521484375,
-0.1553955078125,
-0.5498046875,
-0.09552001953125,
-0.57421875,
0.955078125,
-0.1365966796875,
0.1962890625,
0.11749267578125,
-0.09112548828125,
0.336181640625,
-0.1246337890625,
-0.7998046875,
-0.499267578125,
0.369873046875,
0.2408447265625,
0.16845703125,
0.283203125,
-0.35009765625,
1.0263671875,
-0.8876953125,
-0.0021648406982421875,
-0.51708984375,
-0.3828125,
0.18310546875,
-0.42626953125,
0.9755859375,
-0.1630859375,
-0.5068359375,
-0.2230224609375,
0.39013671875,
0.425537109375,
-0.27294921875,
-0.2283935546875,
-0.50439453125,
-0.12103271484375,
-1.1005859375,
0.148681640625,
-0.57568359375,
0.0277862548828125,
-0.81884765625,
-0.107421875,
1.11328125,
-0.689453125,
0.56201171875,
1.0400390625,
0.1058349609375,
0.00693511962890625,
-0.5537109375,
0.56591796875,
0.287353515625,
-0.44921875,
-0.154052734375,
-0.1358642578125,
-0.83544921875,
0.4130859375,
-0.39892578125,
-0.97119140625,
-0.6337890625,
0.397705078125,
1.2470703125,
-0.45263671875,
0.7216796875,
-0.1436767578125,
-0.80078125,
-0.5693359375,
0.9619140625,
0.085205078125,
0.468505859375,
0.91015625,
-0.265380859375,
-0.0195159912109375,
0.0190277099609375,
-0.52978515625,
-0.55908203125,
-0.41650390625,
1.015625,
-0.197509765625,
-0.578125,
0.155517578125,
0.6884765625,
-1.3828125,
-0.68212890625,
-0.236572265625,
0.26416015625,
-0.376220703125,
-0.58349609375,
0.322021484375,
0.63916015625,
-0.52392578125,
0.380615234375,
0.59521484375,
-0.0220947265625,
0.375,
-0.26123046875,
0.36474609375,
-0.50927734375,
0.61279296875,
0.81005859375,
-0.450439453125,
-0.0955810546875,
-0.476806640625,
-0.07623291015625,
-0.1434326171875,
0.16259765625,
0.609375,
-0.272216796875,
0.19873046875,
0.7509765625,
-0.25146484375,
0.89013671875,
-0.5322265625,
-0.345947265625,
0.1788330078125,
-0.382568359375,
-0.64306640625,
0.040435791015625,
0.78564453125,
-0.04095458984375,
0.427001953125,
-0.416259765625,
0.1680908203125,
0.045318603515625,
0.255615234375,
-0.375,
-0.642578125,
-0.498046875,
-0.85302734375,
-0.1029052734375,
-0.38916015625,
-0.4658203125,
0.249267578125,
-0.058197021484375,
-0.09716796875,
-0.34814453125,
0.1292724609375,
0.335693359375,
-0.705078125,
0.78857421875,
-0.66552734375,
0.275634765625,
-0.449951171875,
-0.2373046875,
-0.59765625,
-0.1954345703125,
-0.1595458984375,
-0.1458740234375,
-0.669921875,
0.341552734375,
-0.287353515625,
0.34814453125,
-0.2080078125,
0.58935546875,
0.00720977783203125,
-0.47265625,
0.1656494140625,
0.1593017578125,
-0.25439453125,
1.15625,
0.583984375,
-0.031494140625,
0.1171875,
0.08416748046875,
-0.45361328125,
-0.6728515625,
0.705078125,
0.91455078125,
-0.08673095703125,
-0.49658203125,
-0.486328125,
0.330810546875,
-1.0400390625,
0.11083984375,
-0.2216796875,
0.08074951171875,
0.32568359375,
-0.276123046875,
0.30078125,
1.3525390625,
-0.7548828125,
0.5302734375,
0.343017578125,
0.1785888671875,
0.25927734375,
0.6552734375,
-0.0240631103515625,
0.4384765625,
0.474853515625,
-0.09332275390625,
0.14697265625,
0.48486328125,
-0.0067138671875,
0.305908203125,
-0.312255859375,
-0.52490234375,
-0.73681640625,
-0.185302734375,
-0.1756591796875,
0.62060546875,
0.2607421875,
-0.9228515625,
-0.0423583984375,
-0.1446533203125,
-0.53125,
-0.040130615234375,
-1.18359375,
-0.83447265625,
0.75927734375,
-0.0894775390625,
-0.47265625,
-0.147705078125,
-0.389892578125,
-0.52197265625,
-0.049285888671875,
0.42529296875,
-0.53857421875,
0.4599609375,
-0.252685546875,
0.457275390625,
-0.1197509765625,
0.37890625,
0.35498046875,
0.26611328125,
-1.0380859375,
-0.6552734375,
0.3115234375,
1.14453125,
0.0281829833984375,
0.1514892578125,
-0.64013671875,
-0.0406494140625,
-0.27783203125,
-0.167236328125,
-0.2548828125,
0.44873046875,
0.11346435546875,
0.333251953125,
-1.185546875,
0.11907958984375,
-0.275634765625,
0.282958984375,
0.13427734375,
-0.2364501953125,
-0.46337890625,
0.71630859375,
0.845703125,
0.188720703125,
0.69873046875,
0.1282958984375,
1.015625,
-0.1123046875,
-0.14892578125,
-0.44189453125,
0.6767578125,
0.7021484375,
0.312255859375,
-0.441162109375,
0.57080078125,
0.69677734375,
0.1253662109375,
0.1405029296875,
0.390380859375,
0.52099609375,
-0.152587890625,
0.033721923828125,
-0.52783203125,
-0.09637451171875,
0.485107421875,
-0.58984375,
0.2386474609375,
-0.313232421875,
-0.188232421875,
-0.31494140625,
-0.5361328125,
0.59765625,
-0.256103515625,
-0.361572265625,
-0.09796142578125,
-0.337890625,
0.548828125,
0.9697265625,
0.330322265625,
0.188720703125,
1.123046875,
0.5537109375,
0.26708984375,
0.341796875,
0.299072265625,
0.123779296875,
-0.62353515625,
0.344970703125,
0.360595703125,
-0.10784912109375,
-0.47314453125,
-0.224609375,
-1.2177734375,
0.85400390625,
-0.5205078125,
-0.1253662109375,
0.82373046875,
-0.94921875,
-0.2705078125,
-0.64013671875,
0.98486328125,
-0.55224609375,
0.34716796875,
0.2205810546875,
-0.18701171875,
-0.7666015625,
0.71923828125,
-0.155517578125,
0.46044921875,
0.318603515625,
1.0869140625,
-0.0897216796875,
1.25390625,
0.338134765625,
-0.297119140625,
-0.1983642578125,
0.0491943359375,
-0.459716796875,
-0.642578125,
-0.14453125,
-0.362060546875,
0.03192138671875,
-0.822265625,
-0.144287109375,
-0.2257080078125,
0.73388671875,
-0.12396240234375,
-1.05859375,
-0.447509765625,
0.253173828125,
-0.94189453125,
0.51806640625,
-0.060791015625,
0.15625,
0.1925048828125,
-0.2235107421875,
-0.37255859375,
-0.445556640625,
-0.127685546875,
-0.5341796875,
0.87939453125,
-0.399169921875,
-1.033203125,
-0.42578125,
-0.41552734375,
-0.402587890625,
-0.1932373046875,
-0.452880859375,
-0.74755859375,
0.2666015625,
0.68408203125,
0.2449951171875,
0.2392578125,
-0.42236328125,
0.1785888671875,
1.0390625,
0.69873046875,
0.07635498046875,
1.1220703125,
0.006549835205078125,
-0.33056640625,
0.54638671875,
-0.7822265625,
0.54443359375,
-0.1475830078125,
-0.3662109375,
-0.459228515625,
0.319580078125,
-0.9609375,
-1.099609375,
0.37255859375,
0.46923828125,
0.27880859375,
-0.9169921875,
-1.49609375,
-0.206298828125,
-0.9375,
-0.10455322265625,
-0.78271484375,
0.67919921875,
0.445068359375,
-0.2327880859375,
-0.255615234375,
-1.103515625,
4.33984375,
1.12109375,
0.5478515625,
0.367431640625,
0.2073974609375,
0.80224609375,
0.431640625,
-0.62060546875,
-0.472900390625,
-0.57958984375,
0.701171875,
-0.58056640625,
-0.0709228515625,
1.0986328125,
0.478271484375,
0.6484375,
-0.32470703125,
-0.1513671875,
-0.141845703125,
-0.763671875,
-0.94677734375,
0.207275390625,
0.0738525390625,
0.712890625,
0.0638427734375,
0.1370849609375,
0.54931640625,
-0.2398681640625,
-0.5439453125,
-0.88623046875,
-0.046905517578125,
-0.63427734375,
0.82470703125,
0.25390625,
-0.431396484375,
0.5107421875,
-0.2115478515625,
-0.6162109375,
-0.6240234375,
0.1253662109375,
-0.73095703125,
0.1651611328125,
0.49365234375,
-0.70556640625,
-0.301025390625,
0.75341796875,
-0.3076171875,
0.5244140625,
0.297607421875,
-1.013671875,
1.001953125,
-0.078369140625,
0.481201171875,
-0.81298828125,
-0.8916015625,
-0.116943359375,
0.239990234375,
0.061676025390625,
-0.1983642578125,
0.1885986328125,
0.20751953125,
0.301025390625,
-0.08135986328125,
0.68896484375,
-0.98193359375,
0.96728515625,
-0.08367919921875,
0.36083984375,
-0.27734375,
-0.010498046875,
-0.1370849609375,
-0.239013671875,
-0.387451171875,
-0.237548828125,
0.6005859375,
0.5126953125,
-0.260498046875,
0.56982421875,
0.923828125,
-0.66748046875,
0.11053466796875,
-0.271484375,
-0.2147216796875,
0.10955810546875,
0.64599609375,
1.076171875,
-0.572265625,
-0.394287109375,
-0.556640625,
0.70849609375,
0.69384765625,
0.478515625,
-0.037139892578125,
-0.3212890625,
-0.49658203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a text consisting of n lines. Each line contains some space-separated words, consisting of lowercase English letters.
We define a syllable as a string that contains exactly one vowel and any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowels: 'a', 'e', 'i', 'o', 'u' and 'y'.
Each word of the text that contains at least one vowel can be divided into syllables. Each character should be a part of exactly one syllable. For example, the word "mamma" can be divided into syllables as "ma" and "mma", "mam" and "ma", and "mamm" and "a". Words that consist of only consonants should be ignored.
The verse patterns for the given text is a sequence of n integers p1, p2, ..., pn. Text matches the given verse pattern if for each i from 1 to n one can divide words of the i-th line in syllables in such a way that the total number of syllables is equal to pi.
You are given the text and the verse pattern. Check, if the given text matches the given verse pattern.
Input
The first line of the input contains a single integer n (1 β€ n β€ 100) β the number of lines in the text.
The second line contains integers p1, ..., pn (0 β€ pi β€ 100) β the verse pattern.
Next n lines contain the text itself. Text consists of lowercase English letters and spaces. It's guaranteed that all lines are non-empty, each line starts and ends with a letter and words are separated by exactly one space. The length of each line doesn't exceed 100 characters.
Output
If the given text matches the given verse pattern, then print "YES" (without quotes) in the only line of the output. Otherwise, print "NO" (without quotes).
Examples
Input
3
2 2 3
intel
code
ch allenge
Output
YES
Input
4
1 2 3 1
a
bcdefghi
jklmnopqrstu
vwxyz
Output
NO
Input
4
13 11 15 15
to be or not to be that is the question
whether tis nobler in the mind to suffer
the slings and arrows of outrageous fortune
or to take arms against a sea of troubles
Output
YES
Note
In the first sample, one can split words into syllables in the following way:
in-tel
co-de
ch al-len-ge
Since the word "ch" in the third line doesn't contain vowels, we can ignore it. As the result we get 2 syllabels in first two lines and 3 syllables in the third one.
Tags: implementation, strings
Correct Solution:
```
n = int(input())
p=list(map(int,input().split()))
f=0
for i in range(n):
s=input()
if s.count('a')+s.count('e')+s.count('i')+s.count('o')+s.count('u')+s.count('y')==p[i]:
f+=1
if f==n:
print('YES')
else:
print('NO')
```
| 37,324
|
[
0.256103515625,
0.1124267578125,
0.173828125,
0.061370849609375,
-0.36572265625,
-0.447509765625,
0.44775390625,
-0.389892578125,
0.371337890625,
0.8623046875,
0.353759765625,
0.1375732421875,
0.07672119140625,
-0.75390625,
-0.348388671875,
0.035186767578125,
-0.69140625,
-0.90478515625,
-0.475341796875,
-0.1226806640625,
-0.329345703125,
0.1776123046875,
-1.6689453125,
-0.29296875,
0.0311737060546875,
0.85205078125,
0.51025390625,
0.437255859375,
0.82080078125,
0.98046875,
-0.1705322265625,
-0.2039794921875,
0.474853515625,
-0.978515625,
-0.213623046875,
-0.65185546875,
0.7001953125,
-0.63232421875,
-0.38232421875,
-0.796875,
0.294189453125,
-0.4814453125,
0.432373046875,
-0.40380859375,
-1.1943359375,
-0.61865234375,
-0.315673828125,
-0.4208984375,
-0.10809326171875,
-0.082763671875,
0.58544921875,
-0.441650390625,
0.415283203125,
-0.2203369140625,
-0.390869140625,
-0.24853515625,
-0.1375732421875,
0.0341796875,
-0.82470703125,
0.2509765625,
0.2144775390625,
0.3896484375,
-0.2724609375,
-0.291748046875,
-0.806640625,
0.081298828125,
-0.264404296875,
0.0355224609375,
-0.12164306640625,
-0.74462890625,
-0.32666015625,
0.232421875,
-0.10516357421875,
-0.7138671875,
-0.75146484375,
-0.25537109375,
-0.11077880859375,
-0.29052734375,
-0.55517578125,
0.7158203125,
0.1390380859375,
1.1572265625,
0.281005859375,
0.38330078125,
-0.615234375,
-0.892578125,
-0.342529296875,
0.1700439453125,
0.307373046875,
-0.2493896484375,
-0.25732421875,
0.4921875,
-0.572265625,
0.29931640625,
0.58447265625,
0.68310546875,
-0.25439453125,
0.2379150390625,
0.59130859375,
0.60400390625,
0.6103515625,
0.806640625,
-0.439697265625,
1.0634765625,
-0.51904296875,
0.28955078125,
0.38427734375,
-0.0198974609375,
-0.1387939453125,
-0.1932373046875,
-0.0889892578125,
-0.382568359375,
0.447998046875,
0.51171875,
-0.14794921875,
0.94775390625,
-0.164306640625,
0.2484130859375,
-0.8408203125,
0.1932373046875,
0.30126953125,
0.1533203125,
0.1629638671875,
-0.386962890625,
0.4130859375,
-0.62109375,
-0.374755859375,
0.97509765625,
-0.330322265625,
0.0611572265625,
0.57470703125,
-0.180908203125,
-0.040374755859375,
0.21435546875,
-0.1435546875,
0.2880859375,
-0.061126708984375,
0.6162109375,
0.76123046875,
-0.4375,
0.7880859375,
-0.5771484375,
-0.045623779296875,
1.5048828125,
0.7001953125,
0.31005859375,
0.53125,
0.348388671875,
-0.931640625,
0.332275390625,
-0.95849609375,
0.82177734375,
0.0231475830078125,
0.264892578125,
-0.21630859375,
0.291259765625,
-0.2242431640625,
0.1552734375,
-0.045562744140625,
0.2265625,
-0.15380859375,
0.144287109375,
-0.2705078125,
0.79833984375,
-0.455078125,
0.79248046875,
-0.44091796875,
-0.11651611328125,
0.01568603515625,
-0.931640625,
0.4091796875,
0.10186767578125,
-0.279296875,
0.64453125,
0.34326171875,
0.9658203125,
0.82861328125,
-0.5400390625,
0.5771484375,
0.1370849609375,
-0.11083984375,
0.296875,
-0.1348876953125,
0.401123046875,
0.2447509765625,
0.477294921875,
0.03173828125,
-0.1805419921875,
-1.2548828125,
-0.55322265625,
0.18408203125,
0.931640625,
-0.76708984375,
0.322021484375,
0.61962890625,
-0.11181640625,
-0.654296875,
-0.418212890625,
-0.40966796875,
-0.89111328125,
-0.2047119140625,
0.6083984375,
-0.12353515625,
0.448486328125,
-0.5224609375,
-0.70556640625,
0.69140625,
1.3916015625,
-0.2254638671875,
0.385498046875,
0.16357421875,
0.011749267578125,
-0.07000732421875,
0.35009765625,
0.2366943359375,
-0.296875,
-0.5908203125,
0.896484375,
-0.50439453125,
-0.186279296875,
-0.1949462890625,
0.70263671875,
0.329833984375,
0.46533203125,
-0.29931640625,
-0.68505859375,
0.61865234375,
0.89208984375,
0.10687255859375,
0.376220703125,
0.0589599609375,
0.6826171875,
0.332275390625,
0.72998046875,
0.2457275390625,
0.286865234375,
0.283935546875,
0.9921875,
-0.109130859375,
0.497802734375,
-0.20361328125,
0.53564453125,
0.312255859375,
0.6728515625,
0.314208984375,
0.388427734375,
-0.273681640625,
0.2275390625,
-0.6044921875,
0.484619140625,
-0.0758056640625,
1.119140625,
0.6826171875,
0.62744140625,
-0.650390625,
-0.837890625,
-0.1422119140625,
0.8076171875,
-0.9501953125,
-0.7138671875,
0.07928466796875,
0.184326171875,
0.37060546875,
0.1636962890625,
0.222900390625,
0.37255859375,
0.5693359375,
0.458740234375,
-0.283203125,
-0.129150390625,
-0.7197265625,
-0.59375,
-0.92138671875,
-0.10028076171875,
-0.59033203125,
-0.12408447265625,
0.1685791015625,
-1.017578125,
0.2030029296875,
-0.28662109375,
-0.08282470703125,
0.2607421875,
-0.8798828125,
0.463134765625,
-0.62744140625,
0.5859375,
-0.51123046875,
0.74609375,
0.03875732421875,
0.958984375,
-0.7412109375,
-0.5546875,
-0.19921875,
-0.6806640625,
0.5322265625,
0.0965576171875,
0.38623046875,
0.470703125,
-0.68017578125,
-0.623046875,
-0.05926513671875,
-0.5419921875,
-0.418701171875,
0.47998046875,
-0.75439453125,
0.9267578125,
0.379150390625,
-0.9033203125,
0.1903076171875,
0.923828125,
-0.8115234375,
0.4169921875,
0.396728515625,
0.056640625,
-0.6630859375,
1.328125,
0.5927734375,
0.497314453125,
-0.78125,
-0.32763671875,
-0.498779296875,
0.171875,
0.09002685546875,
-0.48974609375,
-0.384521484375,
0.3291015625,
0.65283203125,
-1.1875,
0.55859375,
-1.169921875,
-0.37890625,
-0.12347412109375,
-0.45947265625,
1.1611328125,
0.97314453125,
-0.054595947265625,
-0.281494140625,
-0.3046875,
0.13525390625,
0.865234375,
0.49365234375,
-0.5791015625,
0.20751953125,
0.84423828125,
-0.1865234375,
-0.0838623046875,
0.325439453125,
-0.3857421875,
0.14013671875,
-0.040252685546875,
0.05859375,
0.9091796875,
0.58203125,
0.60888671875,
0.345703125,
0.3623046875,
-0.89208984375,
-0.3984375,
-0.2685546875,
0.97900390625,
0.2474365234375,
0.66455078125,
0.36572265625,
-0.004497528076171875,
-0.187744140625,
-0.80419921875,
0.54443359375,
-0.03802490234375,
0.70263671875,
-1.013671875,
0.85205078125,
0.1463623046875,
-0.2479248046875,
0.6787109375,
-0.8173828125,
-0.382568359375,
1.5302734375,
-0.07000732421875,
0.796875,
-0.47998046875,
0.410888671875,
-0.281982421875,
0.00467681884765625,
0.7080078125,
0.499755859375,
0.42431640625,
-0.250732421875,
-0.385009765625,
-0.1939697265625,
-0.195556640625,
-0.323974609375,
-0.57958984375,
0.3173828125,
-0.60009765625,
-0.33837890625,
-0.78076171875,
0.288330078125,
0.62353515625,
0.1651611328125,
-0.03253173828125,
0.41357421875,
0.1815185546875,
0.8076171875,
0.47265625,
-0.2198486328125,
0.496337890625,
-0.6474609375,
0.46533203125,
-0.087158203125,
-0.232666015625,
-0.7822265625,
-0.4912109375,
-0.57373046875,
-0.483154296875,
0.1351318359375,
-0.224853515625,
-0.82763671875,
0.11737060546875,
0.10711669921875,
0.5810546875,
-1.1767578125,
-0.2347412109375,
-0.290771484375,
0.69091796875,
0.404541015625,
-0.8740234375,
0.13134765625,
-0.87353515625,
0.6025390625,
0.332763671875,
-0.27392578125,
-0.273681640625,
-0.38330078125,
-0.85107421875,
-0.59033203125,
0.068603515625,
0.45361328125,
-0.129638671875,
0.328369140625,
-0.91796875,
0.5576171875,
0.47314453125,
-0.28369140625,
0.1307373046875,
0.2413330078125,
-0.0611572265625,
0.421875,
0.65478515625,
-0.77587890625,
-0.65869140625,
0.259521484375,
-1.263671875,
0.305908203125,
-0.7099609375,
0.2200927734375,
-0.237548828125,
-0.2269287109375,
-0.02813720703125,
0.29345703125,
-0.223876953125,
0.10821533203125,
-0.18994140625,
0.11474609375,
-1.0009765625,
-1.044921875,
0.5986328125,
0.1275634765625,
-0.5849609375,
0.9755859375,
-0.1824951171875,
-0.28955078125,
0.2408447265625,
0.37109375,
-0.415771484375,
0.47021484375,
-0.4541015625,
0.308837890625,
-0.1873779296875,
-0.5478515625,
-0.529296875,
-0.187744140625,
0.328857421875,
-0.1319580078125,
-0.67529296875,
-0.31494140625,
-1.060546875,
-0.1888427734375,
-0.333251953125,
-0.310546875,
0.150390625,
0.3369140625,
0.0246734619140625,
0.05169677734375,
-0.357421875,
-0.347900390625,
-0.397705078125,
-0.42431640625,
-0.65283203125,
0.41162109375,
0.50048828125,
0.99658203125,
0.336181640625,
-0.39306640625,
-0.097900390625,
0.20947265625,
0.020660400390625,
-0.322021484375,
-0.20263671875,
-0.043304443359375,
-0.55126953125,
-0.05682373046875,
0.60791015625,
0.07562255859375,
0.4404296875,
0.8134765625,
-0.0732421875,
0.58349609375,
0.546875,
-0.4130859375,
1.1513671875,
0.38720703125,
-1.056640625,
-0.407470703125,
0.34033203125,
-0.08270263671875,
1.08203125,
0.1995849609375,
-0.83544921875,
-0.66748046875,
-1,
-0.1126708984375,
-0.246826171875,
-0.2197265625,
-0.482177734375,
-0.322509765625,
0.00872802734375,
0.814453125,
-0.227294921875,
-0.35302734375,
-0.056396484375,
-1.119140625,
-0.1292724609375,
-0.59521484375,
-0.1553955078125,
-0.5498046875,
-0.09552001953125,
-0.57421875,
0.955078125,
-0.1365966796875,
0.1962890625,
0.11749267578125,
-0.09112548828125,
0.336181640625,
-0.1246337890625,
-0.7998046875,
-0.499267578125,
0.369873046875,
0.2408447265625,
0.16845703125,
0.283203125,
-0.35009765625,
1.0263671875,
-0.8876953125,
-0.0021648406982421875,
-0.51708984375,
-0.3828125,
0.18310546875,
-0.42626953125,
0.9755859375,
-0.1630859375,
-0.5068359375,
-0.2230224609375,
0.39013671875,
0.425537109375,
-0.27294921875,
-0.2283935546875,
-0.50439453125,
-0.12103271484375,
-1.1005859375,
0.148681640625,
-0.57568359375,
0.0277862548828125,
-0.81884765625,
-0.107421875,
1.11328125,
-0.689453125,
0.56201171875,
1.0400390625,
0.1058349609375,
0.00693511962890625,
-0.5537109375,
0.56591796875,
0.287353515625,
-0.44921875,
-0.154052734375,
-0.1358642578125,
-0.83544921875,
0.4130859375,
-0.39892578125,
-0.97119140625,
-0.6337890625,
0.397705078125,
1.2470703125,
-0.45263671875,
0.7216796875,
-0.1436767578125,
-0.80078125,
-0.5693359375,
0.9619140625,
0.085205078125,
0.468505859375,
0.91015625,
-0.265380859375,
-0.0195159912109375,
0.0190277099609375,
-0.52978515625,
-0.55908203125,
-0.41650390625,
1.015625,
-0.197509765625,
-0.578125,
0.155517578125,
0.6884765625,
-1.3828125,
-0.68212890625,
-0.236572265625,
0.26416015625,
-0.376220703125,
-0.58349609375,
0.322021484375,
0.63916015625,
-0.52392578125,
0.380615234375,
0.59521484375,
-0.0220947265625,
0.375,
-0.26123046875,
0.36474609375,
-0.50927734375,
0.61279296875,
0.81005859375,
-0.450439453125,
-0.0955810546875,
-0.476806640625,
-0.07623291015625,
-0.1434326171875,
0.16259765625,
0.609375,
-0.272216796875,
0.19873046875,
0.7509765625,
-0.25146484375,
0.89013671875,
-0.5322265625,
-0.345947265625,
0.1788330078125,
-0.382568359375,
-0.64306640625,
0.040435791015625,
0.78564453125,
-0.04095458984375,
0.427001953125,
-0.416259765625,
0.1680908203125,
0.045318603515625,
0.255615234375,
-0.375,
-0.642578125,
-0.498046875,
-0.85302734375,
-0.1029052734375,
-0.38916015625,
-0.4658203125,
0.249267578125,
-0.058197021484375,
-0.09716796875,
-0.34814453125,
0.1292724609375,
0.335693359375,
-0.705078125,
0.78857421875,
-0.66552734375,
0.275634765625,
-0.449951171875,
-0.2373046875,
-0.59765625,
-0.1954345703125,
-0.1595458984375,
-0.1458740234375,
-0.669921875,
0.341552734375,
-0.287353515625,
0.34814453125,
-0.2080078125,
0.58935546875,
0.00720977783203125,
-0.47265625,
0.1656494140625,
0.1593017578125,
-0.25439453125,
1.15625,
0.583984375,
-0.031494140625,
0.1171875,
0.08416748046875,
-0.45361328125,
-0.6728515625,
0.705078125,
0.91455078125,
-0.08673095703125,
-0.49658203125,
-0.486328125,
0.330810546875,
-1.0400390625,
0.11083984375,
-0.2216796875,
0.08074951171875,
0.32568359375,
-0.276123046875,
0.30078125,
1.3525390625,
-0.7548828125,
0.5302734375,
0.343017578125,
0.1785888671875,
0.25927734375,
0.6552734375,
-0.0240631103515625,
0.4384765625,
0.474853515625,
-0.09332275390625,
0.14697265625,
0.48486328125,
-0.0067138671875,
0.305908203125,
-0.312255859375,
-0.52490234375,
-0.73681640625,
-0.185302734375,
-0.1756591796875,
0.62060546875,
0.2607421875,
-0.9228515625,
-0.0423583984375,
-0.1446533203125,
-0.53125,
-0.040130615234375,
-1.18359375,
-0.83447265625,
0.75927734375,
-0.0894775390625,
-0.47265625,
-0.147705078125,
-0.389892578125,
-0.52197265625,
-0.049285888671875,
0.42529296875,
-0.53857421875,
0.4599609375,
-0.252685546875,
0.457275390625,
-0.1197509765625,
0.37890625,
0.35498046875,
0.26611328125,
-1.0380859375,
-0.6552734375,
0.3115234375,
1.14453125,
0.0281829833984375,
0.1514892578125,
-0.64013671875,
-0.0406494140625,
-0.27783203125,
-0.167236328125,
-0.2548828125,
0.44873046875,
0.11346435546875,
0.333251953125,
-1.185546875,
0.11907958984375,
-0.275634765625,
0.282958984375,
0.13427734375,
-0.2364501953125,
-0.46337890625,
0.71630859375,
0.845703125,
0.188720703125,
0.69873046875,
0.1282958984375,
1.015625,
-0.1123046875,
-0.14892578125,
-0.44189453125,
0.6767578125,
0.7021484375,
0.312255859375,
-0.441162109375,
0.57080078125,
0.69677734375,
0.1253662109375,
0.1405029296875,
0.390380859375,
0.52099609375,
-0.152587890625,
0.033721923828125,
-0.52783203125,
-0.09637451171875,
0.485107421875,
-0.58984375,
0.2386474609375,
-0.313232421875,
-0.188232421875,
-0.31494140625,
-0.5361328125,
0.59765625,
-0.256103515625,
-0.361572265625,
-0.09796142578125,
-0.337890625,
0.548828125,
0.9697265625,
0.330322265625,
0.188720703125,
1.123046875,
0.5537109375,
0.26708984375,
0.341796875,
0.299072265625,
0.123779296875,
-0.62353515625,
0.344970703125,
0.360595703125,
-0.10784912109375,
-0.47314453125,
-0.224609375,
-1.2177734375,
0.85400390625,
-0.5205078125,
-0.1253662109375,
0.82373046875,
-0.94921875,
-0.2705078125,
-0.64013671875,
0.98486328125,
-0.55224609375,
0.34716796875,
0.2205810546875,
-0.18701171875,
-0.7666015625,
0.71923828125,
-0.155517578125,
0.46044921875,
0.318603515625,
1.0869140625,
-0.0897216796875,
1.25390625,
0.338134765625,
-0.297119140625,
-0.1983642578125,
0.0491943359375,
-0.459716796875,
-0.642578125,
-0.14453125,
-0.362060546875,
0.03192138671875,
-0.822265625,
-0.144287109375,
-0.2257080078125,
0.73388671875,
-0.12396240234375,
-1.05859375,
-0.447509765625,
0.253173828125,
-0.94189453125,
0.51806640625,
-0.060791015625,
0.15625,
0.1925048828125,
-0.2235107421875,
-0.37255859375,
-0.445556640625,
-0.127685546875,
-0.5341796875,
0.87939453125,
-0.399169921875,
-1.033203125,
-0.42578125,
-0.41552734375,
-0.402587890625,
-0.1932373046875,
-0.452880859375,
-0.74755859375,
0.2666015625,
0.68408203125,
0.2449951171875,
0.2392578125,
-0.42236328125,
0.1785888671875,
1.0390625,
0.69873046875,
0.07635498046875,
1.1220703125,
0.006549835205078125,
-0.33056640625,
0.54638671875,
-0.7822265625,
0.54443359375,
-0.1475830078125,
-0.3662109375,
-0.459228515625,
0.319580078125,
-0.9609375,
-1.099609375,
0.37255859375,
0.46923828125,
0.27880859375,
-0.9169921875,
-1.49609375,
-0.206298828125,
-0.9375,
-0.10455322265625,
-0.78271484375,
0.67919921875,
0.445068359375,
-0.2327880859375,
-0.255615234375,
-1.103515625,
4.33984375,
1.12109375,
0.5478515625,
0.367431640625,
0.2073974609375,
0.80224609375,
0.431640625,
-0.62060546875,
-0.472900390625,
-0.57958984375,
0.701171875,
-0.58056640625,
-0.0709228515625,
1.0986328125,
0.478271484375,
0.6484375,
-0.32470703125,
-0.1513671875,
-0.141845703125,
-0.763671875,
-0.94677734375,
0.207275390625,
0.0738525390625,
0.712890625,
0.0638427734375,
0.1370849609375,
0.54931640625,
-0.2398681640625,
-0.5439453125,
-0.88623046875,
-0.046905517578125,
-0.63427734375,
0.82470703125,
0.25390625,
-0.431396484375,
0.5107421875,
-0.2115478515625,
-0.6162109375,
-0.6240234375,
0.1253662109375,
-0.73095703125,
0.1651611328125,
0.49365234375,
-0.70556640625,
-0.301025390625,
0.75341796875,
-0.3076171875,
0.5244140625,
0.297607421875,
-1.013671875,
1.001953125,
-0.078369140625,
0.481201171875,
-0.81298828125,
-0.8916015625,
-0.116943359375,
0.239990234375,
0.061676025390625,
-0.1983642578125,
0.1885986328125,
0.20751953125,
0.301025390625,
-0.08135986328125,
0.68896484375,
-0.98193359375,
0.96728515625,
-0.08367919921875,
0.36083984375,
-0.27734375,
-0.010498046875,
-0.1370849609375,
-0.239013671875,
-0.387451171875,
-0.237548828125,
0.6005859375,
0.5126953125,
-0.260498046875,
0.56982421875,
0.923828125,
-0.66748046875,
0.11053466796875,
-0.271484375,
-0.2147216796875,
0.10955810546875,
0.64599609375,
1.076171875,
-0.572265625,
-0.394287109375,
-0.556640625,
0.70849609375,
0.69384765625,
0.478515625,
-0.037139892578125,
-0.3212890625,
-0.49658203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a text consisting of n lines. Each line contains some space-separated words, consisting of lowercase English letters.
We define a syllable as a string that contains exactly one vowel and any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowels: 'a', 'e', 'i', 'o', 'u' and 'y'.
Each word of the text that contains at least one vowel can be divided into syllables. Each character should be a part of exactly one syllable. For example, the word "mamma" can be divided into syllables as "ma" and "mma", "mam" and "ma", and "mamm" and "a". Words that consist of only consonants should be ignored.
The verse patterns for the given text is a sequence of n integers p1, p2, ..., pn. Text matches the given verse pattern if for each i from 1 to n one can divide words of the i-th line in syllables in such a way that the total number of syllables is equal to pi.
You are given the text and the verse pattern. Check, if the given text matches the given verse pattern.
Input
The first line of the input contains a single integer n (1 β€ n β€ 100) β the number of lines in the text.
The second line contains integers p1, ..., pn (0 β€ pi β€ 100) β the verse pattern.
Next n lines contain the text itself. Text consists of lowercase English letters and spaces. It's guaranteed that all lines are non-empty, each line starts and ends with a letter and words are separated by exactly one space. The length of each line doesn't exceed 100 characters.
Output
If the given text matches the given verse pattern, then print "YES" (without quotes) in the only line of the output. Otherwise, print "NO" (without quotes).
Examples
Input
3
2 2 3
intel
code
ch allenge
Output
YES
Input
4
1 2 3 1
a
bcdefghi
jklmnopqrstu
vwxyz
Output
NO
Input
4
13 11 15 15
to be or not to be that is the question
whether tis nobler in the mind to suffer
the slings and arrows of outrageous fortune
or to take arms against a sea of troubles
Output
YES
Note
In the first sample, one can split words into syllables in the following way:
in-tel
co-de
ch al-len-ge
Since the word "ch" in the third line doesn't contain vowels, we can ignore it. As the result we get 2 syllabels in first two lines and 3 syllables in the third one.
Tags: implementation, strings
Correct Solution:
```
from sys import exit
def num_vow(s):
vow = ['a', 'e', 'o', 'i', 'u', 'y']
r = 0
for i in vow:
r += s.count(i)
return r
n = int(input())
p = list(map(int, input().split()))
f = True
for i in range(n):
s = input()
if num_vow(s) != p[i] and f:
print("NO")
f = False
if f:
print("YES")
```
| 37,325
|
[
0.256103515625,
0.1124267578125,
0.173828125,
0.061370849609375,
-0.36572265625,
-0.447509765625,
0.44775390625,
-0.389892578125,
0.371337890625,
0.8623046875,
0.353759765625,
0.1375732421875,
0.07672119140625,
-0.75390625,
-0.348388671875,
0.035186767578125,
-0.69140625,
-0.90478515625,
-0.475341796875,
-0.1226806640625,
-0.329345703125,
0.1776123046875,
-1.6689453125,
-0.29296875,
0.0311737060546875,
0.85205078125,
0.51025390625,
0.437255859375,
0.82080078125,
0.98046875,
-0.1705322265625,
-0.2039794921875,
0.474853515625,
-0.978515625,
-0.213623046875,
-0.65185546875,
0.7001953125,
-0.63232421875,
-0.38232421875,
-0.796875,
0.294189453125,
-0.4814453125,
0.432373046875,
-0.40380859375,
-1.1943359375,
-0.61865234375,
-0.315673828125,
-0.4208984375,
-0.10809326171875,
-0.082763671875,
0.58544921875,
-0.441650390625,
0.415283203125,
-0.2203369140625,
-0.390869140625,
-0.24853515625,
-0.1375732421875,
0.0341796875,
-0.82470703125,
0.2509765625,
0.2144775390625,
0.3896484375,
-0.2724609375,
-0.291748046875,
-0.806640625,
0.081298828125,
-0.264404296875,
0.0355224609375,
-0.12164306640625,
-0.74462890625,
-0.32666015625,
0.232421875,
-0.10516357421875,
-0.7138671875,
-0.75146484375,
-0.25537109375,
-0.11077880859375,
-0.29052734375,
-0.55517578125,
0.7158203125,
0.1390380859375,
1.1572265625,
0.281005859375,
0.38330078125,
-0.615234375,
-0.892578125,
-0.342529296875,
0.1700439453125,
0.307373046875,
-0.2493896484375,
-0.25732421875,
0.4921875,
-0.572265625,
0.29931640625,
0.58447265625,
0.68310546875,
-0.25439453125,
0.2379150390625,
0.59130859375,
0.60400390625,
0.6103515625,
0.806640625,
-0.439697265625,
1.0634765625,
-0.51904296875,
0.28955078125,
0.38427734375,
-0.0198974609375,
-0.1387939453125,
-0.1932373046875,
-0.0889892578125,
-0.382568359375,
0.447998046875,
0.51171875,
-0.14794921875,
0.94775390625,
-0.164306640625,
0.2484130859375,
-0.8408203125,
0.1932373046875,
0.30126953125,
0.1533203125,
0.1629638671875,
-0.386962890625,
0.4130859375,
-0.62109375,
-0.374755859375,
0.97509765625,
-0.330322265625,
0.0611572265625,
0.57470703125,
-0.180908203125,
-0.040374755859375,
0.21435546875,
-0.1435546875,
0.2880859375,
-0.061126708984375,
0.6162109375,
0.76123046875,
-0.4375,
0.7880859375,
-0.5771484375,
-0.045623779296875,
1.5048828125,
0.7001953125,
0.31005859375,
0.53125,
0.348388671875,
-0.931640625,
0.332275390625,
-0.95849609375,
0.82177734375,
0.0231475830078125,
0.264892578125,
-0.21630859375,
0.291259765625,
-0.2242431640625,
0.1552734375,
-0.045562744140625,
0.2265625,
-0.15380859375,
0.144287109375,
-0.2705078125,
0.79833984375,
-0.455078125,
0.79248046875,
-0.44091796875,
-0.11651611328125,
0.01568603515625,
-0.931640625,
0.4091796875,
0.10186767578125,
-0.279296875,
0.64453125,
0.34326171875,
0.9658203125,
0.82861328125,
-0.5400390625,
0.5771484375,
0.1370849609375,
-0.11083984375,
0.296875,
-0.1348876953125,
0.401123046875,
0.2447509765625,
0.477294921875,
0.03173828125,
-0.1805419921875,
-1.2548828125,
-0.55322265625,
0.18408203125,
0.931640625,
-0.76708984375,
0.322021484375,
0.61962890625,
-0.11181640625,
-0.654296875,
-0.418212890625,
-0.40966796875,
-0.89111328125,
-0.2047119140625,
0.6083984375,
-0.12353515625,
0.448486328125,
-0.5224609375,
-0.70556640625,
0.69140625,
1.3916015625,
-0.2254638671875,
0.385498046875,
0.16357421875,
0.011749267578125,
-0.07000732421875,
0.35009765625,
0.2366943359375,
-0.296875,
-0.5908203125,
0.896484375,
-0.50439453125,
-0.186279296875,
-0.1949462890625,
0.70263671875,
0.329833984375,
0.46533203125,
-0.29931640625,
-0.68505859375,
0.61865234375,
0.89208984375,
0.10687255859375,
0.376220703125,
0.0589599609375,
0.6826171875,
0.332275390625,
0.72998046875,
0.2457275390625,
0.286865234375,
0.283935546875,
0.9921875,
-0.109130859375,
0.497802734375,
-0.20361328125,
0.53564453125,
0.312255859375,
0.6728515625,
0.314208984375,
0.388427734375,
-0.273681640625,
0.2275390625,
-0.6044921875,
0.484619140625,
-0.0758056640625,
1.119140625,
0.6826171875,
0.62744140625,
-0.650390625,
-0.837890625,
-0.1422119140625,
0.8076171875,
-0.9501953125,
-0.7138671875,
0.07928466796875,
0.184326171875,
0.37060546875,
0.1636962890625,
0.222900390625,
0.37255859375,
0.5693359375,
0.458740234375,
-0.283203125,
-0.129150390625,
-0.7197265625,
-0.59375,
-0.92138671875,
-0.10028076171875,
-0.59033203125,
-0.12408447265625,
0.1685791015625,
-1.017578125,
0.2030029296875,
-0.28662109375,
-0.08282470703125,
0.2607421875,
-0.8798828125,
0.463134765625,
-0.62744140625,
0.5859375,
-0.51123046875,
0.74609375,
0.03875732421875,
0.958984375,
-0.7412109375,
-0.5546875,
-0.19921875,
-0.6806640625,
0.5322265625,
0.0965576171875,
0.38623046875,
0.470703125,
-0.68017578125,
-0.623046875,
-0.05926513671875,
-0.5419921875,
-0.418701171875,
0.47998046875,
-0.75439453125,
0.9267578125,
0.379150390625,
-0.9033203125,
0.1903076171875,
0.923828125,
-0.8115234375,
0.4169921875,
0.396728515625,
0.056640625,
-0.6630859375,
1.328125,
0.5927734375,
0.497314453125,
-0.78125,
-0.32763671875,
-0.498779296875,
0.171875,
0.09002685546875,
-0.48974609375,
-0.384521484375,
0.3291015625,
0.65283203125,
-1.1875,
0.55859375,
-1.169921875,
-0.37890625,
-0.12347412109375,
-0.45947265625,
1.1611328125,
0.97314453125,
-0.054595947265625,
-0.281494140625,
-0.3046875,
0.13525390625,
0.865234375,
0.49365234375,
-0.5791015625,
0.20751953125,
0.84423828125,
-0.1865234375,
-0.0838623046875,
0.325439453125,
-0.3857421875,
0.14013671875,
-0.040252685546875,
0.05859375,
0.9091796875,
0.58203125,
0.60888671875,
0.345703125,
0.3623046875,
-0.89208984375,
-0.3984375,
-0.2685546875,
0.97900390625,
0.2474365234375,
0.66455078125,
0.36572265625,
-0.004497528076171875,
-0.187744140625,
-0.80419921875,
0.54443359375,
-0.03802490234375,
0.70263671875,
-1.013671875,
0.85205078125,
0.1463623046875,
-0.2479248046875,
0.6787109375,
-0.8173828125,
-0.382568359375,
1.5302734375,
-0.07000732421875,
0.796875,
-0.47998046875,
0.410888671875,
-0.281982421875,
0.00467681884765625,
0.7080078125,
0.499755859375,
0.42431640625,
-0.250732421875,
-0.385009765625,
-0.1939697265625,
-0.195556640625,
-0.323974609375,
-0.57958984375,
0.3173828125,
-0.60009765625,
-0.33837890625,
-0.78076171875,
0.288330078125,
0.62353515625,
0.1651611328125,
-0.03253173828125,
0.41357421875,
0.1815185546875,
0.8076171875,
0.47265625,
-0.2198486328125,
0.496337890625,
-0.6474609375,
0.46533203125,
-0.087158203125,
-0.232666015625,
-0.7822265625,
-0.4912109375,
-0.57373046875,
-0.483154296875,
0.1351318359375,
-0.224853515625,
-0.82763671875,
0.11737060546875,
0.10711669921875,
0.5810546875,
-1.1767578125,
-0.2347412109375,
-0.290771484375,
0.69091796875,
0.404541015625,
-0.8740234375,
0.13134765625,
-0.87353515625,
0.6025390625,
0.332763671875,
-0.27392578125,
-0.273681640625,
-0.38330078125,
-0.85107421875,
-0.59033203125,
0.068603515625,
0.45361328125,
-0.129638671875,
0.328369140625,
-0.91796875,
0.5576171875,
0.47314453125,
-0.28369140625,
0.1307373046875,
0.2413330078125,
-0.0611572265625,
0.421875,
0.65478515625,
-0.77587890625,
-0.65869140625,
0.259521484375,
-1.263671875,
0.305908203125,
-0.7099609375,
0.2200927734375,
-0.237548828125,
-0.2269287109375,
-0.02813720703125,
0.29345703125,
-0.223876953125,
0.10821533203125,
-0.18994140625,
0.11474609375,
-1.0009765625,
-1.044921875,
0.5986328125,
0.1275634765625,
-0.5849609375,
0.9755859375,
-0.1824951171875,
-0.28955078125,
0.2408447265625,
0.37109375,
-0.415771484375,
0.47021484375,
-0.4541015625,
0.308837890625,
-0.1873779296875,
-0.5478515625,
-0.529296875,
-0.187744140625,
0.328857421875,
-0.1319580078125,
-0.67529296875,
-0.31494140625,
-1.060546875,
-0.1888427734375,
-0.333251953125,
-0.310546875,
0.150390625,
0.3369140625,
0.0246734619140625,
0.05169677734375,
-0.357421875,
-0.347900390625,
-0.397705078125,
-0.42431640625,
-0.65283203125,
0.41162109375,
0.50048828125,
0.99658203125,
0.336181640625,
-0.39306640625,
-0.097900390625,
0.20947265625,
0.020660400390625,
-0.322021484375,
-0.20263671875,
-0.043304443359375,
-0.55126953125,
-0.05682373046875,
0.60791015625,
0.07562255859375,
0.4404296875,
0.8134765625,
-0.0732421875,
0.58349609375,
0.546875,
-0.4130859375,
1.1513671875,
0.38720703125,
-1.056640625,
-0.407470703125,
0.34033203125,
-0.08270263671875,
1.08203125,
0.1995849609375,
-0.83544921875,
-0.66748046875,
-1,
-0.1126708984375,
-0.246826171875,
-0.2197265625,
-0.482177734375,
-0.322509765625,
0.00872802734375,
0.814453125,
-0.227294921875,
-0.35302734375,
-0.056396484375,
-1.119140625,
-0.1292724609375,
-0.59521484375,
-0.1553955078125,
-0.5498046875,
-0.09552001953125,
-0.57421875,
0.955078125,
-0.1365966796875,
0.1962890625,
0.11749267578125,
-0.09112548828125,
0.336181640625,
-0.1246337890625,
-0.7998046875,
-0.499267578125,
0.369873046875,
0.2408447265625,
0.16845703125,
0.283203125,
-0.35009765625,
1.0263671875,
-0.8876953125,
-0.0021648406982421875,
-0.51708984375,
-0.3828125,
0.18310546875,
-0.42626953125,
0.9755859375,
-0.1630859375,
-0.5068359375,
-0.2230224609375,
0.39013671875,
0.425537109375,
-0.27294921875,
-0.2283935546875,
-0.50439453125,
-0.12103271484375,
-1.1005859375,
0.148681640625,
-0.57568359375,
0.0277862548828125,
-0.81884765625,
-0.107421875,
1.11328125,
-0.689453125,
0.56201171875,
1.0400390625,
0.1058349609375,
0.00693511962890625,
-0.5537109375,
0.56591796875,
0.287353515625,
-0.44921875,
-0.154052734375,
-0.1358642578125,
-0.83544921875,
0.4130859375,
-0.39892578125,
-0.97119140625,
-0.6337890625,
0.397705078125,
1.2470703125,
-0.45263671875,
0.7216796875,
-0.1436767578125,
-0.80078125,
-0.5693359375,
0.9619140625,
0.085205078125,
0.468505859375,
0.91015625,
-0.265380859375,
-0.0195159912109375,
0.0190277099609375,
-0.52978515625,
-0.55908203125,
-0.41650390625,
1.015625,
-0.197509765625,
-0.578125,
0.155517578125,
0.6884765625,
-1.3828125,
-0.68212890625,
-0.236572265625,
0.26416015625,
-0.376220703125,
-0.58349609375,
0.322021484375,
0.63916015625,
-0.52392578125,
0.380615234375,
0.59521484375,
-0.0220947265625,
0.375,
-0.26123046875,
0.36474609375,
-0.50927734375,
0.61279296875,
0.81005859375,
-0.450439453125,
-0.0955810546875,
-0.476806640625,
-0.07623291015625,
-0.1434326171875,
0.16259765625,
0.609375,
-0.272216796875,
0.19873046875,
0.7509765625,
-0.25146484375,
0.89013671875,
-0.5322265625,
-0.345947265625,
0.1788330078125,
-0.382568359375,
-0.64306640625,
0.040435791015625,
0.78564453125,
-0.04095458984375,
0.427001953125,
-0.416259765625,
0.1680908203125,
0.045318603515625,
0.255615234375,
-0.375,
-0.642578125,
-0.498046875,
-0.85302734375,
-0.1029052734375,
-0.38916015625,
-0.4658203125,
0.249267578125,
-0.058197021484375,
-0.09716796875,
-0.34814453125,
0.1292724609375,
0.335693359375,
-0.705078125,
0.78857421875,
-0.66552734375,
0.275634765625,
-0.449951171875,
-0.2373046875,
-0.59765625,
-0.1954345703125,
-0.1595458984375,
-0.1458740234375,
-0.669921875,
0.341552734375,
-0.287353515625,
0.34814453125,
-0.2080078125,
0.58935546875,
0.00720977783203125,
-0.47265625,
0.1656494140625,
0.1593017578125,
-0.25439453125,
1.15625,
0.583984375,
-0.031494140625,
0.1171875,
0.08416748046875,
-0.45361328125,
-0.6728515625,
0.705078125,
0.91455078125,
-0.08673095703125,
-0.49658203125,
-0.486328125,
0.330810546875,
-1.0400390625,
0.11083984375,
-0.2216796875,
0.08074951171875,
0.32568359375,
-0.276123046875,
0.30078125,
1.3525390625,
-0.7548828125,
0.5302734375,
0.343017578125,
0.1785888671875,
0.25927734375,
0.6552734375,
-0.0240631103515625,
0.4384765625,
0.474853515625,
-0.09332275390625,
0.14697265625,
0.48486328125,
-0.0067138671875,
0.305908203125,
-0.312255859375,
-0.52490234375,
-0.73681640625,
-0.185302734375,
-0.1756591796875,
0.62060546875,
0.2607421875,
-0.9228515625,
-0.0423583984375,
-0.1446533203125,
-0.53125,
-0.040130615234375,
-1.18359375,
-0.83447265625,
0.75927734375,
-0.0894775390625,
-0.47265625,
-0.147705078125,
-0.389892578125,
-0.52197265625,
-0.049285888671875,
0.42529296875,
-0.53857421875,
0.4599609375,
-0.252685546875,
0.457275390625,
-0.1197509765625,
0.37890625,
0.35498046875,
0.26611328125,
-1.0380859375,
-0.6552734375,
0.3115234375,
1.14453125,
0.0281829833984375,
0.1514892578125,
-0.64013671875,
-0.0406494140625,
-0.27783203125,
-0.167236328125,
-0.2548828125,
0.44873046875,
0.11346435546875,
0.333251953125,
-1.185546875,
0.11907958984375,
-0.275634765625,
0.282958984375,
0.13427734375,
-0.2364501953125,
-0.46337890625,
0.71630859375,
0.845703125,
0.188720703125,
0.69873046875,
0.1282958984375,
1.015625,
-0.1123046875,
-0.14892578125,
-0.44189453125,
0.6767578125,
0.7021484375,
0.312255859375,
-0.441162109375,
0.57080078125,
0.69677734375,
0.1253662109375,
0.1405029296875,
0.390380859375,
0.52099609375,
-0.152587890625,
0.033721923828125,
-0.52783203125,
-0.09637451171875,
0.485107421875,
-0.58984375,
0.2386474609375,
-0.313232421875,
-0.188232421875,
-0.31494140625,
-0.5361328125,
0.59765625,
-0.256103515625,
-0.361572265625,
-0.09796142578125,
-0.337890625,
0.548828125,
0.9697265625,
0.330322265625,
0.188720703125,
1.123046875,
0.5537109375,
0.26708984375,
0.341796875,
0.299072265625,
0.123779296875,
-0.62353515625,
0.344970703125,
0.360595703125,
-0.10784912109375,
-0.47314453125,
-0.224609375,
-1.2177734375,
0.85400390625,
-0.5205078125,
-0.1253662109375,
0.82373046875,
-0.94921875,
-0.2705078125,
-0.64013671875,
0.98486328125,
-0.55224609375,
0.34716796875,
0.2205810546875,
-0.18701171875,
-0.7666015625,
0.71923828125,
-0.155517578125,
0.46044921875,
0.318603515625,
1.0869140625,
-0.0897216796875,
1.25390625,
0.338134765625,
-0.297119140625,
-0.1983642578125,
0.0491943359375,
-0.459716796875,
-0.642578125,
-0.14453125,
-0.362060546875,
0.03192138671875,
-0.822265625,
-0.144287109375,
-0.2257080078125,
0.73388671875,
-0.12396240234375,
-1.05859375,
-0.447509765625,
0.253173828125,
-0.94189453125,
0.51806640625,
-0.060791015625,
0.15625,
0.1925048828125,
-0.2235107421875,
-0.37255859375,
-0.445556640625,
-0.127685546875,
-0.5341796875,
0.87939453125,
-0.399169921875,
-1.033203125,
-0.42578125,
-0.41552734375,
-0.402587890625,
-0.1932373046875,
-0.452880859375,
-0.74755859375,
0.2666015625,
0.68408203125,
0.2449951171875,
0.2392578125,
-0.42236328125,
0.1785888671875,
1.0390625,
0.69873046875,
0.07635498046875,
1.1220703125,
0.006549835205078125,
-0.33056640625,
0.54638671875,
-0.7822265625,
0.54443359375,
-0.1475830078125,
-0.3662109375,
-0.459228515625,
0.319580078125,
-0.9609375,
-1.099609375,
0.37255859375,
0.46923828125,
0.27880859375,
-0.9169921875,
-1.49609375,
-0.206298828125,
-0.9375,
-0.10455322265625,
-0.78271484375,
0.67919921875,
0.445068359375,
-0.2327880859375,
-0.255615234375,
-1.103515625,
4.33984375,
1.12109375,
0.5478515625,
0.367431640625,
0.2073974609375,
0.80224609375,
0.431640625,
-0.62060546875,
-0.472900390625,
-0.57958984375,
0.701171875,
-0.58056640625,
-0.0709228515625,
1.0986328125,
0.478271484375,
0.6484375,
-0.32470703125,
-0.1513671875,
-0.141845703125,
-0.763671875,
-0.94677734375,
0.207275390625,
0.0738525390625,
0.712890625,
0.0638427734375,
0.1370849609375,
0.54931640625,
-0.2398681640625,
-0.5439453125,
-0.88623046875,
-0.046905517578125,
-0.63427734375,
0.82470703125,
0.25390625,
-0.431396484375,
0.5107421875,
-0.2115478515625,
-0.6162109375,
-0.6240234375,
0.1253662109375,
-0.73095703125,
0.1651611328125,
0.49365234375,
-0.70556640625,
-0.301025390625,
0.75341796875,
-0.3076171875,
0.5244140625,
0.297607421875,
-1.013671875,
1.001953125,
-0.078369140625,
0.481201171875,
-0.81298828125,
-0.8916015625,
-0.116943359375,
0.239990234375,
0.061676025390625,
-0.1983642578125,
0.1885986328125,
0.20751953125,
0.301025390625,
-0.08135986328125,
0.68896484375,
-0.98193359375,
0.96728515625,
-0.08367919921875,
0.36083984375,
-0.27734375,
-0.010498046875,
-0.1370849609375,
-0.239013671875,
-0.387451171875,
-0.237548828125,
0.6005859375,
0.5126953125,
-0.260498046875,
0.56982421875,
0.923828125,
-0.66748046875,
0.11053466796875,
-0.271484375,
-0.2147216796875,
0.10955810546875,
0.64599609375,
1.076171875,
-0.572265625,
-0.394287109375,
-0.556640625,
0.70849609375,
0.69384765625,
0.478515625,
-0.037139892578125,
-0.3212890625,
-0.49658203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a text consisting of n lines. Each line contains some space-separated words, consisting of lowercase English letters.
We define a syllable as a string that contains exactly one vowel and any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowels: 'a', 'e', 'i', 'o', 'u' and 'y'.
Each word of the text that contains at least one vowel can be divided into syllables. Each character should be a part of exactly one syllable. For example, the word "mamma" can be divided into syllables as "ma" and "mma", "mam" and "ma", and "mamm" and "a". Words that consist of only consonants should be ignored.
The verse patterns for the given text is a sequence of n integers p1, p2, ..., pn. Text matches the given verse pattern if for each i from 1 to n one can divide words of the i-th line in syllables in such a way that the total number of syllables is equal to pi.
You are given the text and the verse pattern. Check, if the given text matches the given verse pattern.
Input
The first line of the input contains a single integer n (1 β€ n β€ 100) β the number of lines in the text.
The second line contains integers p1, ..., pn (0 β€ pi β€ 100) β the verse pattern.
Next n lines contain the text itself. Text consists of lowercase English letters and spaces. It's guaranteed that all lines are non-empty, each line starts and ends with a letter and words are separated by exactly one space. The length of each line doesn't exceed 100 characters.
Output
If the given text matches the given verse pattern, then print "YES" (without quotes) in the only line of the output. Otherwise, print "NO" (without quotes).
Examples
Input
3
2 2 3
intel
code
ch allenge
Output
YES
Input
4
1 2 3 1
a
bcdefghi
jklmnopqrstu
vwxyz
Output
NO
Input
4
13 11 15 15
to be or not to be that is the question
whether tis nobler in the mind to suffer
the slings and arrows of outrageous fortune
or to take arms against a sea of troubles
Output
YES
Note
In the first sample, one can split words into syllables in the following way:
in-tel
co-de
ch al-len-ge
Since the word "ch" in the third line doesn't contain vowels, we can ignore it. As the result we get 2 syllabels in first two lines and 3 syllables in the third one.
Tags: implementation, strings
Correct Solution:
```
__author__ = 'Think'
n=int(input())
p=[int(i) for i in input().split()]
broken=False
for i in range(n):
line=input()
total=0
for s in line:
if s in ["a", "e", "i", "u", "o", "y"]:
total+=1
if total!=p[i]:
print("NO")
broken=True
break
if not broken:
print("YES")
```
| 37,326
|
[
0.256103515625,
0.1124267578125,
0.173828125,
0.061370849609375,
-0.36572265625,
-0.447509765625,
0.44775390625,
-0.389892578125,
0.371337890625,
0.8623046875,
0.353759765625,
0.1375732421875,
0.07672119140625,
-0.75390625,
-0.348388671875,
0.035186767578125,
-0.69140625,
-0.90478515625,
-0.475341796875,
-0.1226806640625,
-0.329345703125,
0.1776123046875,
-1.6689453125,
-0.29296875,
0.0311737060546875,
0.85205078125,
0.51025390625,
0.437255859375,
0.82080078125,
0.98046875,
-0.1705322265625,
-0.2039794921875,
0.474853515625,
-0.978515625,
-0.213623046875,
-0.65185546875,
0.7001953125,
-0.63232421875,
-0.38232421875,
-0.796875,
0.294189453125,
-0.4814453125,
0.432373046875,
-0.40380859375,
-1.1943359375,
-0.61865234375,
-0.315673828125,
-0.4208984375,
-0.10809326171875,
-0.082763671875,
0.58544921875,
-0.441650390625,
0.415283203125,
-0.2203369140625,
-0.390869140625,
-0.24853515625,
-0.1375732421875,
0.0341796875,
-0.82470703125,
0.2509765625,
0.2144775390625,
0.3896484375,
-0.2724609375,
-0.291748046875,
-0.806640625,
0.081298828125,
-0.264404296875,
0.0355224609375,
-0.12164306640625,
-0.74462890625,
-0.32666015625,
0.232421875,
-0.10516357421875,
-0.7138671875,
-0.75146484375,
-0.25537109375,
-0.11077880859375,
-0.29052734375,
-0.55517578125,
0.7158203125,
0.1390380859375,
1.1572265625,
0.281005859375,
0.38330078125,
-0.615234375,
-0.892578125,
-0.342529296875,
0.1700439453125,
0.307373046875,
-0.2493896484375,
-0.25732421875,
0.4921875,
-0.572265625,
0.29931640625,
0.58447265625,
0.68310546875,
-0.25439453125,
0.2379150390625,
0.59130859375,
0.60400390625,
0.6103515625,
0.806640625,
-0.439697265625,
1.0634765625,
-0.51904296875,
0.28955078125,
0.38427734375,
-0.0198974609375,
-0.1387939453125,
-0.1932373046875,
-0.0889892578125,
-0.382568359375,
0.447998046875,
0.51171875,
-0.14794921875,
0.94775390625,
-0.164306640625,
0.2484130859375,
-0.8408203125,
0.1932373046875,
0.30126953125,
0.1533203125,
0.1629638671875,
-0.386962890625,
0.4130859375,
-0.62109375,
-0.374755859375,
0.97509765625,
-0.330322265625,
0.0611572265625,
0.57470703125,
-0.180908203125,
-0.040374755859375,
0.21435546875,
-0.1435546875,
0.2880859375,
-0.061126708984375,
0.6162109375,
0.76123046875,
-0.4375,
0.7880859375,
-0.5771484375,
-0.045623779296875,
1.5048828125,
0.7001953125,
0.31005859375,
0.53125,
0.348388671875,
-0.931640625,
0.332275390625,
-0.95849609375,
0.82177734375,
0.0231475830078125,
0.264892578125,
-0.21630859375,
0.291259765625,
-0.2242431640625,
0.1552734375,
-0.045562744140625,
0.2265625,
-0.15380859375,
0.144287109375,
-0.2705078125,
0.79833984375,
-0.455078125,
0.79248046875,
-0.44091796875,
-0.11651611328125,
0.01568603515625,
-0.931640625,
0.4091796875,
0.10186767578125,
-0.279296875,
0.64453125,
0.34326171875,
0.9658203125,
0.82861328125,
-0.5400390625,
0.5771484375,
0.1370849609375,
-0.11083984375,
0.296875,
-0.1348876953125,
0.401123046875,
0.2447509765625,
0.477294921875,
0.03173828125,
-0.1805419921875,
-1.2548828125,
-0.55322265625,
0.18408203125,
0.931640625,
-0.76708984375,
0.322021484375,
0.61962890625,
-0.11181640625,
-0.654296875,
-0.418212890625,
-0.40966796875,
-0.89111328125,
-0.2047119140625,
0.6083984375,
-0.12353515625,
0.448486328125,
-0.5224609375,
-0.70556640625,
0.69140625,
1.3916015625,
-0.2254638671875,
0.385498046875,
0.16357421875,
0.011749267578125,
-0.07000732421875,
0.35009765625,
0.2366943359375,
-0.296875,
-0.5908203125,
0.896484375,
-0.50439453125,
-0.186279296875,
-0.1949462890625,
0.70263671875,
0.329833984375,
0.46533203125,
-0.29931640625,
-0.68505859375,
0.61865234375,
0.89208984375,
0.10687255859375,
0.376220703125,
0.0589599609375,
0.6826171875,
0.332275390625,
0.72998046875,
0.2457275390625,
0.286865234375,
0.283935546875,
0.9921875,
-0.109130859375,
0.497802734375,
-0.20361328125,
0.53564453125,
0.312255859375,
0.6728515625,
0.314208984375,
0.388427734375,
-0.273681640625,
0.2275390625,
-0.6044921875,
0.484619140625,
-0.0758056640625,
1.119140625,
0.6826171875,
0.62744140625,
-0.650390625,
-0.837890625,
-0.1422119140625,
0.8076171875,
-0.9501953125,
-0.7138671875,
0.07928466796875,
0.184326171875,
0.37060546875,
0.1636962890625,
0.222900390625,
0.37255859375,
0.5693359375,
0.458740234375,
-0.283203125,
-0.129150390625,
-0.7197265625,
-0.59375,
-0.92138671875,
-0.10028076171875,
-0.59033203125,
-0.12408447265625,
0.1685791015625,
-1.017578125,
0.2030029296875,
-0.28662109375,
-0.08282470703125,
0.2607421875,
-0.8798828125,
0.463134765625,
-0.62744140625,
0.5859375,
-0.51123046875,
0.74609375,
0.03875732421875,
0.958984375,
-0.7412109375,
-0.5546875,
-0.19921875,
-0.6806640625,
0.5322265625,
0.0965576171875,
0.38623046875,
0.470703125,
-0.68017578125,
-0.623046875,
-0.05926513671875,
-0.5419921875,
-0.418701171875,
0.47998046875,
-0.75439453125,
0.9267578125,
0.379150390625,
-0.9033203125,
0.1903076171875,
0.923828125,
-0.8115234375,
0.4169921875,
0.396728515625,
0.056640625,
-0.6630859375,
1.328125,
0.5927734375,
0.497314453125,
-0.78125,
-0.32763671875,
-0.498779296875,
0.171875,
0.09002685546875,
-0.48974609375,
-0.384521484375,
0.3291015625,
0.65283203125,
-1.1875,
0.55859375,
-1.169921875,
-0.37890625,
-0.12347412109375,
-0.45947265625,
1.1611328125,
0.97314453125,
-0.054595947265625,
-0.281494140625,
-0.3046875,
0.13525390625,
0.865234375,
0.49365234375,
-0.5791015625,
0.20751953125,
0.84423828125,
-0.1865234375,
-0.0838623046875,
0.325439453125,
-0.3857421875,
0.14013671875,
-0.040252685546875,
0.05859375,
0.9091796875,
0.58203125,
0.60888671875,
0.345703125,
0.3623046875,
-0.89208984375,
-0.3984375,
-0.2685546875,
0.97900390625,
0.2474365234375,
0.66455078125,
0.36572265625,
-0.004497528076171875,
-0.187744140625,
-0.80419921875,
0.54443359375,
-0.03802490234375,
0.70263671875,
-1.013671875,
0.85205078125,
0.1463623046875,
-0.2479248046875,
0.6787109375,
-0.8173828125,
-0.382568359375,
1.5302734375,
-0.07000732421875,
0.796875,
-0.47998046875,
0.410888671875,
-0.281982421875,
0.00467681884765625,
0.7080078125,
0.499755859375,
0.42431640625,
-0.250732421875,
-0.385009765625,
-0.1939697265625,
-0.195556640625,
-0.323974609375,
-0.57958984375,
0.3173828125,
-0.60009765625,
-0.33837890625,
-0.78076171875,
0.288330078125,
0.62353515625,
0.1651611328125,
-0.03253173828125,
0.41357421875,
0.1815185546875,
0.8076171875,
0.47265625,
-0.2198486328125,
0.496337890625,
-0.6474609375,
0.46533203125,
-0.087158203125,
-0.232666015625,
-0.7822265625,
-0.4912109375,
-0.57373046875,
-0.483154296875,
0.1351318359375,
-0.224853515625,
-0.82763671875,
0.11737060546875,
0.10711669921875,
0.5810546875,
-1.1767578125,
-0.2347412109375,
-0.290771484375,
0.69091796875,
0.404541015625,
-0.8740234375,
0.13134765625,
-0.87353515625,
0.6025390625,
0.332763671875,
-0.27392578125,
-0.273681640625,
-0.38330078125,
-0.85107421875,
-0.59033203125,
0.068603515625,
0.45361328125,
-0.129638671875,
0.328369140625,
-0.91796875,
0.5576171875,
0.47314453125,
-0.28369140625,
0.1307373046875,
0.2413330078125,
-0.0611572265625,
0.421875,
0.65478515625,
-0.77587890625,
-0.65869140625,
0.259521484375,
-1.263671875,
0.305908203125,
-0.7099609375,
0.2200927734375,
-0.237548828125,
-0.2269287109375,
-0.02813720703125,
0.29345703125,
-0.223876953125,
0.10821533203125,
-0.18994140625,
0.11474609375,
-1.0009765625,
-1.044921875,
0.5986328125,
0.1275634765625,
-0.5849609375,
0.9755859375,
-0.1824951171875,
-0.28955078125,
0.2408447265625,
0.37109375,
-0.415771484375,
0.47021484375,
-0.4541015625,
0.308837890625,
-0.1873779296875,
-0.5478515625,
-0.529296875,
-0.187744140625,
0.328857421875,
-0.1319580078125,
-0.67529296875,
-0.31494140625,
-1.060546875,
-0.1888427734375,
-0.333251953125,
-0.310546875,
0.150390625,
0.3369140625,
0.0246734619140625,
0.05169677734375,
-0.357421875,
-0.347900390625,
-0.397705078125,
-0.42431640625,
-0.65283203125,
0.41162109375,
0.50048828125,
0.99658203125,
0.336181640625,
-0.39306640625,
-0.097900390625,
0.20947265625,
0.020660400390625,
-0.322021484375,
-0.20263671875,
-0.043304443359375,
-0.55126953125,
-0.05682373046875,
0.60791015625,
0.07562255859375,
0.4404296875,
0.8134765625,
-0.0732421875,
0.58349609375,
0.546875,
-0.4130859375,
1.1513671875,
0.38720703125,
-1.056640625,
-0.407470703125,
0.34033203125,
-0.08270263671875,
1.08203125,
0.1995849609375,
-0.83544921875,
-0.66748046875,
-1,
-0.1126708984375,
-0.246826171875,
-0.2197265625,
-0.482177734375,
-0.322509765625,
0.00872802734375,
0.814453125,
-0.227294921875,
-0.35302734375,
-0.056396484375,
-1.119140625,
-0.1292724609375,
-0.59521484375,
-0.1553955078125,
-0.5498046875,
-0.09552001953125,
-0.57421875,
0.955078125,
-0.1365966796875,
0.1962890625,
0.11749267578125,
-0.09112548828125,
0.336181640625,
-0.1246337890625,
-0.7998046875,
-0.499267578125,
0.369873046875,
0.2408447265625,
0.16845703125,
0.283203125,
-0.35009765625,
1.0263671875,
-0.8876953125,
-0.0021648406982421875,
-0.51708984375,
-0.3828125,
0.18310546875,
-0.42626953125,
0.9755859375,
-0.1630859375,
-0.5068359375,
-0.2230224609375,
0.39013671875,
0.425537109375,
-0.27294921875,
-0.2283935546875,
-0.50439453125,
-0.12103271484375,
-1.1005859375,
0.148681640625,
-0.57568359375,
0.0277862548828125,
-0.81884765625,
-0.107421875,
1.11328125,
-0.689453125,
0.56201171875,
1.0400390625,
0.1058349609375,
0.00693511962890625,
-0.5537109375,
0.56591796875,
0.287353515625,
-0.44921875,
-0.154052734375,
-0.1358642578125,
-0.83544921875,
0.4130859375,
-0.39892578125,
-0.97119140625,
-0.6337890625,
0.397705078125,
1.2470703125,
-0.45263671875,
0.7216796875,
-0.1436767578125,
-0.80078125,
-0.5693359375,
0.9619140625,
0.085205078125,
0.468505859375,
0.91015625,
-0.265380859375,
-0.0195159912109375,
0.0190277099609375,
-0.52978515625,
-0.55908203125,
-0.41650390625,
1.015625,
-0.197509765625,
-0.578125,
0.155517578125,
0.6884765625,
-1.3828125,
-0.68212890625,
-0.236572265625,
0.26416015625,
-0.376220703125,
-0.58349609375,
0.322021484375,
0.63916015625,
-0.52392578125,
0.380615234375,
0.59521484375,
-0.0220947265625,
0.375,
-0.26123046875,
0.36474609375,
-0.50927734375,
0.61279296875,
0.81005859375,
-0.450439453125,
-0.0955810546875,
-0.476806640625,
-0.07623291015625,
-0.1434326171875,
0.16259765625,
0.609375,
-0.272216796875,
0.19873046875,
0.7509765625,
-0.25146484375,
0.89013671875,
-0.5322265625,
-0.345947265625,
0.1788330078125,
-0.382568359375,
-0.64306640625,
0.040435791015625,
0.78564453125,
-0.04095458984375,
0.427001953125,
-0.416259765625,
0.1680908203125,
0.045318603515625,
0.255615234375,
-0.375,
-0.642578125,
-0.498046875,
-0.85302734375,
-0.1029052734375,
-0.38916015625,
-0.4658203125,
0.249267578125,
-0.058197021484375,
-0.09716796875,
-0.34814453125,
0.1292724609375,
0.335693359375,
-0.705078125,
0.78857421875,
-0.66552734375,
0.275634765625,
-0.449951171875,
-0.2373046875,
-0.59765625,
-0.1954345703125,
-0.1595458984375,
-0.1458740234375,
-0.669921875,
0.341552734375,
-0.287353515625,
0.34814453125,
-0.2080078125,
0.58935546875,
0.00720977783203125,
-0.47265625,
0.1656494140625,
0.1593017578125,
-0.25439453125,
1.15625,
0.583984375,
-0.031494140625,
0.1171875,
0.08416748046875,
-0.45361328125,
-0.6728515625,
0.705078125,
0.91455078125,
-0.08673095703125,
-0.49658203125,
-0.486328125,
0.330810546875,
-1.0400390625,
0.11083984375,
-0.2216796875,
0.08074951171875,
0.32568359375,
-0.276123046875,
0.30078125,
1.3525390625,
-0.7548828125,
0.5302734375,
0.343017578125,
0.1785888671875,
0.25927734375,
0.6552734375,
-0.0240631103515625,
0.4384765625,
0.474853515625,
-0.09332275390625,
0.14697265625,
0.48486328125,
-0.0067138671875,
0.305908203125,
-0.312255859375,
-0.52490234375,
-0.73681640625,
-0.185302734375,
-0.1756591796875,
0.62060546875,
0.2607421875,
-0.9228515625,
-0.0423583984375,
-0.1446533203125,
-0.53125,
-0.040130615234375,
-1.18359375,
-0.83447265625,
0.75927734375,
-0.0894775390625,
-0.47265625,
-0.147705078125,
-0.389892578125,
-0.52197265625,
-0.049285888671875,
0.42529296875,
-0.53857421875,
0.4599609375,
-0.252685546875,
0.457275390625,
-0.1197509765625,
0.37890625,
0.35498046875,
0.26611328125,
-1.0380859375,
-0.6552734375,
0.3115234375,
1.14453125,
0.0281829833984375,
0.1514892578125,
-0.64013671875,
-0.0406494140625,
-0.27783203125,
-0.167236328125,
-0.2548828125,
0.44873046875,
0.11346435546875,
0.333251953125,
-1.185546875,
0.11907958984375,
-0.275634765625,
0.282958984375,
0.13427734375,
-0.2364501953125,
-0.46337890625,
0.71630859375,
0.845703125,
0.188720703125,
0.69873046875,
0.1282958984375,
1.015625,
-0.1123046875,
-0.14892578125,
-0.44189453125,
0.6767578125,
0.7021484375,
0.312255859375,
-0.441162109375,
0.57080078125,
0.69677734375,
0.1253662109375,
0.1405029296875,
0.390380859375,
0.52099609375,
-0.152587890625,
0.033721923828125,
-0.52783203125,
-0.09637451171875,
0.485107421875,
-0.58984375,
0.2386474609375,
-0.313232421875,
-0.188232421875,
-0.31494140625,
-0.5361328125,
0.59765625,
-0.256103515625,
-0.361572265625,
-0.09796142578125,
-0.337890625,
0.548828125,
0.9697265625,
0.330322265625,
0.188720703125,
1.123046875,
0.5537109375,
0.26708984375,
0.341796875,
0.299072265625,
0.123779296875,
-0.62353515625,
0.344970703125,
0.360595703125,
-0.10784912109375,
-0.47314453125,
-0.224609375,
-1.2177734375,
0.85400390625,
-0.5205078125,
-0.1253662109375,
0.82373046875,
-0.94921875,
-0.2705078125,
-0.64013671875,
0.98486328125,
-0.55224609375,
0.34716796875,
0.2205810546875,
-0.18701171875,
-0.7666015625,
0.71923828125,
-0.155517578125,
0.46044921875,
0.318603515625,
1.0869140625,
-0.0897216796875,
1.25390625,
0.338134765625,
-0.297119140625,
-0.1983642578125,
0.0491943359375,
-0.459716796875,
-0.642578125,
-0.14453125,
-0.362060546875,
0.03192138671875,
-0.822265625,
-0.144287109375,
-0.2257080078125,
0.73388671875,
-0.12396240234375,
-1.05859375,
-0.447509765625,
0.253173828125,
-0.94189453125,
0.51806640625,
-0.060791015625,
0.15625,
0.1925048828125,
-0.2235107421875,
-0.37255859375,
-0.445556640625,
-0.127685546875,
-0.5341796875,
0.87939453125,
-0.399169921875,
-1.033203125,
-0.42578125,
-0.41552734375,
-0.402587890625,
-0.1932373046875,
-0.452880859375,
-0.74755859375,
0.2666015625,
0.68408203125,
0.2449951171875,
0.2392578125,
-0.42236328125,
0.1785888671875,
1.0390625,
0.69873046875,
0.07635498046875,
1.1220703125,
0.006549835205078125,
-0.33056640625,
0.54638671875,
-0.7822265625,
0.54443359375,
-0.1475830078125,
-0.3662109375,
-0.459228515625,
0.319580078125,
-0.9609375,
-1.099609375,
0.37255859375,
0.46923828125,
0.27880859375,
-0.9169921875,
-1.49609375,
-0.206298828125,
-0.9375,
-0.10455322265625,
-0.78271484375,
0.67919921875,
0.445068359375,
-0.2327880859375,
-0.255615234375,
-1.103515625,
4.33984375,
1.12109375,
0.5478515625,
0.367431640625,
0.2073974609375,
0.80224609375,
0.431640625,
-0.62060546875,
-0.472900390625,
-0.57958984375,
0.701171875,
-0.58056640625,
-0.0709228515625,
1.0986328125,
0.478271484375,
0.6484375,
-0.32470703125,
-0.1513671875,
-0.141845703125,
-0.763671875,
-0.94677734375,
0.207275390625,
0.0738525390625,
0.712890625,
0.0638427734375,
0.1370849609375,
0.54931640625,
-0.2398681640625,
-0.5439453125,
-0.88623046875,
-0.046905517578125,
-0.63427734375,
0.82470703125,
0.25390625,
-0.431396484375,
0.5107421875,
-0.2115478515625,
-0.6162109375,
-0.6240234375,
0.1253662109375,
-0.73095703125,
0.1651611328125,
0.49365234375,
-0.70556640625,
-0.301025390625,
0.75341796875,
-0.3076171875,
0.5244140625,
0.297607421875,
-1.013671875,
1.001953125,
-0.078369140625,
0.481201171875,
-0.81298828125,
-0.8916015625,
-0.116943359375,
0.239990234375,
0.061676025390625,
-0.1983642578125,
0.1885986328125,
0.20751953125,
0.301025390625,
-0.08135986328125,
0.68896484375,
-0.98193359375,
0.96728515625,
-0.08367919921875,
0.36083984375,
-0.27734375,
-0.010498046875,
-0.1370849609375,
-0.239013671875,
-0.387451171875,
-0.237548828125,
0.6005859375,
0.5126953125,
-0.260498046875,
0.56982421875,
0.923828125,
-0.66748046875,
0.11053466796875,
-0.271484375,
-0.2147216796875,
0.10955810546875,
0.64599609375,
1.076171875,
-0.572265625,
-0.394287109375,
-0.556640625,
0.70849609375,
0.69384765625,
0.478515625,
-0.037139892578125,
-0.3212890625,
-0.49658203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a text consisting of n lines. Each line contains some space-separated words, consisting of lowercase English letters.
We define a syllable as a string that contains exactly one vowel and any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowels: 'a', 'e', 'i', 'o', 'u' and 'y'.
Each word of the text that contains at least one vowel can be divided into syllables. Each character should be a part of exactly one syllable. For example, the word "mamma" can be divided into syllables as "ma" and "mma", "mam" and "ma", and "mamm" and "a". Words that consist of only consonants should be ignored.
The verse patterns for the given text is a sequence of n integers p1, p2, ..., pn. Text matches the given verse pattern if for each i from 1 to n one can divide words of the i-th line in syllables in such a way that the total number of syllables is equal to pi.
You are given the text and the verse pattern. Check, if the given text matches the given verse pattern.
Input
The first line of the input contains a single integer n (1 β€ n β€ 100) β the number of lines in the text.
The second line contains integers p1, ..., pn (0 β€ pi β€ 100) β the verse pattern.
Next n lines contain the text itself. Text consists of lowercase English letters and spaces. It's guaranteed that all lines are non-empty, each line starts and ends with a letter and words are separated by exactly one space. The length of each line doesn't exceed 100 characters.
Output
If the given text matches the given verse pattern, then print "YES" (without quotes) in the only line of the output. Otherwise, print "NO" (without quotes).
Examples
Input
3
2 2 3
intel
code
ch allenge
Output
YES
Input
4
1 2 3 1
a
bcdefghi
jklmnopqrstu
vwxyz
Output
NO
Input
4
13 11 15 15
to be or not to be that is the question
whether tis nobler in the mind to suffer
the slings and arrows of outrageous fortune
or to take arms against a sea of troubles
Output
YES
Note
In the first sample, one can split words into syllables in the following way:
in-tel
co-de
ch al-len-ge
Since the word "ch" in the third line doesn't contain vowels, we can ignore it. As the result we get 2 syllabels in first two lines and 3 syllables in the third one.
Tags: implementation, strings
Correct Solution:
```
from sys import *
n=int(input())
p=[int(z) for z in input().split()]
glas=set([ "a", "e", "i", "o", "u", "y"])
for i in range(n):
s=input()
nogl=0
for j in s:
if j in glas:
nogl+=1
if nogl!=p[i]:
print("NO")
exit(0)
print("YES")
```
| 37,327
|
[
0.256103515625,
0.1124267578125,
0.173828125,
0.061370849609375,
-0.36572265625,
-0.447509765625,
0.44775390625,
-0.389892578125,
0.371337890625,
0.8623046875,
0.353759765625,
0.1375732421875,
0.07672119140625,
-0.75390625,
-0.348388671875,
0.035186767578125,
-0.69140625,
-0.90478515625,
-0.475341796875,
-0.1226806640625,
-0.329345703125,
0.1776123046875,
-1.6689453125,
-0.29296875,
0.0311737060546875,
0.85205078125,
0.51025390625,
0.437255859375,
0.82080078125,
0.98046875,
-0.1705322265625,
-0.2039794921875,
0.474853515625,
-0.978515625,
-0.213623046875,
-0.65185546875,
0.7001953125,
-0.63232421875,
-0.38232421875,
-0.796875,
0.294189453125,
-0.4814453125,
0.432373046875,
-0.40380859375,
-1.1943359375,
-0.61865234375,
-0.315673828125,
-0.4208984375,
-0.10809326171875,
-0.082763671875,
0.58544921875,
-0.441650390625,
0.415283203125,
-0.2203369140625,
-0.390869140625,
-0.24853515625,
-0.1375732421875,
0.0341796875,
-0.82470703125,
0.2509765625,
0.2144775390625,
0.3896484375,
-0.2724609375,
-0.291748046875,
-0.806640625,
0.081298828125,
-0.264404296875,
0.0355224609375,
-0.12164306640625,
-0.74462890625,
-0.32666015625,
0.232421875,
-0.10516357421875,
-0.7138671875,
-0.75146484375,
-0.25537109375,
-0.11077880859375,
-0.29052734375,
-0.55517578125,
0.7158203125,
0.1390380859375,
1.1572265625,
0.281005859375,
0.38330078125,
-0.615234375,
-0.892578125,
-0.342529296875,
0.1700439453125,
0.307373046875,
-0.2493896484375,
-0.25732421875,
0.4921875,
-0.572265625,
0.29931640625,
0.58447265625,
0.68310546875,
-0.25439453125,
0.2379150390625,
0.59130859375,
0.60400390625,
0.6103515625,
0.806640625,
-0.439697265625,
1.0634765625,
-0.51904296875,
0.28955078125,
0.38427734375,
-0.0198974609375,
-0.1387939453125,
-0.1932373046875,
-0.0889892578125,
-0.382568359375,
0.447998046875,
0.51171875,
-0.14794921875,
0.94775390625,
-0.164306640625,
0.2484130859375,
-0.8408203125,
0.1932373046875,
0.30126953125,
0.1533203125,
0.1629638671875,
-0.386962890625,
0.4130859375,
-0.62109375,
-0.374755859375,
0.97509765625,
-0.330322265625,
0.0611572265625,
0.57470703125,
-0.180908203125,
-0.040374755859375,
0.21435546875,
-0.1435546875,
0.2880859375,
-0.061126708984375,
0.6162109375,
0.76123046875,
-0.4375,
0.7880859375,
-0.5771484375,
-0.045623779296875,
1.5048828125,
0.7001953125,
0.31005859375,
0.53125,
0.348388671875,
-0.931640625,
0.332275390625,
-0.95849609375,
0.82177734375,
0.0231475830078125,
0.264892578125,
-0.21630859375,
0.291259765625,
-0.2242431640625,
0.1552734375,
-0.045562744140625,
0.2265625,
-0.15380859375,
0.144287109375,
-0.2705078125,
0.79833984375,
-0.455078125,
0.79248046875,
-0.44091796875,
-0.11651611328125,
0.01568603515625,
-0.931640625,
0.4091796875,
0.10186767578125,
-0.279296875,
0.64453125,
0.34326171875,
0.9658203125,
0.82861328125,
-0.5400390625,
0.5771484375,
0.1370849609375,
-0.11083984375,
0.296875,
-0.1348876953125,
0.401123046875,
0.2447509765625,
0.477294921875,
0.03173828125,
-0.1805419921875,
-1.2548828125,
-0.55322265625,
0.18408203125,
0.931640625,
-0.76708984375,
0.322021484375,
0.61962890625,
-0.11181640625,
-0.654296875,
-0.418212890625,
-0.40966796875,
-0.89111328125,
-0.2047119140625,
0.6083984375,
-0.12353515625,
0.448486328125,
-0.5224609375,
-0.70556640625,
0.69140625,
1.3916015625,
-0.2254638671875,
0.385498046875,
0.16357421875,
0.011749267578125,
-0.07000732421875,
0.35009765625,
0.2366943359375,
-0.296875,
-0.5908203125,
0.896484375,
-0.50439453125,
-0.186279296875,
-0.1949462890625,
0.70263671875,
0.329833984375,
0.46533203125,
-0.29931640625,
-0.68505859375,
0.61865234375,
0.89208984375,
0.10687255859375,
0.376220703125,
0.0589599609375,
0.6826171875,
0.332275390625,
0.72998046875,
0.2457275390625,
0.286865234375,
0.283935546875,
0.9921875,
-0.109130859375,
0.497802734375,
-0.20361328125,
0.53564453125,
0.312255859375,
0.6728515625,
0.314208984375,
0.388427734375,
-0.273681640625,
0.2275390625,
-0.6044921875,
0.484619140625,
-0.0758056640625,
1.119140625,
0.6826171875,
0.62744140625,
-0.650390625,
-0.837890625,
-0.1422119140625,
0.8076171875,
-0.9501953125,
-0.7138671875,
0.07928466796875,
0.184326171875,
0.37060546875,
0.1636962890625,
0.222900390625,
0.37255859375,
0.5693359375,
0.458740234375,
-0.283203125,
-0.129150390625,
-0.7197265625,
-0.59375,
-0.92138671875,
-0.10028076171875,
-0.59033203125,
-0.12408447265625,
0.1685791015625,
-1.017578125,
0.2030029296875,
-0.28662109375,
-0.08282470703125,
0.2607421875,
-0.8798828125,
0.463134765625,
-0.62744140625,
0.5859375,
-0.51123046875,
0.74609375,
0.03875732421875,
0.958984375,
-0.7412109375,
-0.5546875,
-0.19921875,
-0.6806640625,
0.5322265625,
0.0965576171875,
0.38623046875,
0.470703125,
-0.68017578125,
-0.623046875,
-0.05926513671875,
-0.5419921875,
-0.418701171875,
0.47998046875,
-0.75439453125,
0.9267578125,
0.379150390625,
-0.9033203125,
0.1903076171875,
0.923828125,
-0.8115234375,
0.4169921875,
0.396728515625,
0.056640625,
-0.6630859375,
1.328125,
0.5927734375,
0.497314453125,
-0.78125,
-0.32763671875,
-0.498779296875,
0.171875,
0.09002685546875,
-0.48974609375,
-0.384521484375,
0.3291015625,
0.65283203125,
-1.1875,
0.55859375,
-1.169921875,
-0.37890625,
-0.12347412109375,
-0.45947265625,
1.1611328125,
0.97314453125,
-0.054595947265625,
-0.281494140625,
-0.3046875,
0.13525390625,
0.865234375,
0.49365234375,
-0.5791015625,
0.20751953125,
0.84423828125,
-0.1865234375,
-0.0838623046875,
0.325439453125,
-0.3857421875,
0.14013671875,
-0.040252685546875,
0.05859375,
0.9091796875,
0.58203125,
0.60888671875,
0.345703125,
0.3623046875,
-0.89208984375,
-0.3984375,
-0.2685546875,
0.97900390625,
0.2474365234375,
0.66455078125,
0.36572265625,
-0.004497528076171875,
-0.187744140625,
-0.80419921875,
0.54443359375,
-0.03802490234375,
0.70263671875,
-1.013671875,
0.85205078125,
0.1463623046875,
-0.2479248046875,
0.6787109375,
-0.8173828125,
-0.382568359375,
1.5302734375,
-0.07000732421875,
0.796875,
-0.47998046875,
0.410888671875,
-0.281982421875,
0.00467681884765625,
0.7080078125,
0.499755859375,
0.42431640625,
-0.250732421875,
-0.385009765625,
-0.1939697265625,
-0.195556640625,
-0.323974609375,
-0.57958984375,
0.3173828125,
-0.60009765625,
-0.33837890625,
-0.78076171875,
0.288330078125,
0.62353515625,
0.1651611328125,
-0.03253173828125,
0.41357421875,
0.1815185546875,
0.8076171875,
0.47265625,
-0.2198486328125,
0.496337890625,
-0.6474609375,
0.46533203125,
-0.087158203125,
-0.232666015625,
-0.7822265625,
-0.4912109375,
-0.57373046875,
-0.483154296875,
0.1351318359375,
-0.224853515625,
-0.82763671875,
0.11737060546875,
0.10711669921875,
0.5810546875,
-1.1767578125,
-0.2347412109375,
-0.290771484375,
0.69091796875,
0.404541015625,
-0.8740234375,
0.13134765625,
-0.87353515625,
0.6025390625,
0.332763671875,
-0.27392578125,
-0.273681640625,
-0.38330078125,
-0.85107421875,
-0.59033203125,
0.068603515625,
0.45361328125,
-0.129638671875,
0.328369140625,
-0.91796875,
0.5576171875,
0.47314453125,
-0.28369140625,
0.1307373046875,
0.2413330078125,
-0.0611572265625,
0.421875,
0.65478515625,
-0.77587890625,
-0.65869140625,
0.259521484375,
-1.263671875,
0.305908203125,
-0.7099609375,
0.2200927734375,
-0.237548828125,
-0.2269287109375,
-0.02813720703125,
0.29345703125,
-0.223876953125,
0.10821533203125,
-0.18994140625,
0.11474609375,
-1.0009765625,
-1.044921875,
0.5986328125,
0.1275634765625,
-0.5849609375,
0.9755859375,
-0.1824951171875,
-0.28955078125,
0.2408447265625,
0.37109375,
-0.415771484375,
0.47021484375,
-0.4541015625,
0.308837890625,
-0.1873779296875,
-0.5478515625,
-0.529296875,
-0.187744140625,
0.328857421875,
-0.1319580078125,
-0.67529296875,
-0.31494140625,
-1.060546875,
-0.1888427734375,
-0.333251953125,
-0.310546875,
0.150390625,
0.3369140625,
0.0246734619140625,
0.05169677734375,
-0.357421875,
-0.347900390625,
-0.397705078125,
-0.42431640625,
-0.65283203125,
0.41162109375,
0.50048828125,
0.99658203125,
0.336181640625,
-0.39306640625,
-0.097900390625,
0.20947265625,
0.020660400390625,
-0.322021484375,
-0.20263671875,
-0.043304443359375,
-0.55126953125,
-0.05682373046875,
0.60791015625,
0.07562255859375,
0.4404296875,
0.8134765625,
-0.0732421875,
0.58349609375,
0.546875,
-0.4130859375,
1.1513671875,
0.38720703125,
-1.056640625,
-0.407470703125,
0.34033203125,
-0.08270263671875,
1.08203125,
0.1995849609375,
-0.83544921875,
-0.66748046875,
-1,
-0.1126708984375,
-0.246826171875,
-0.2197265625,
-0.482177734375,
-0.322509765625,
0.00872802734375,
0.814453125,
-0.227294921875,
-0.35302734375,
-0.056396484375,
-1.119140625,
-0.1292724609375,
-0.59521484375,
-0.1553955078125,
-0.5498046875,
-0.09552001953125,
-0.57421875,
0.955078125,
-0.1365966796875,
0.1962890625,
0.11749267578125,
-0.09112548828125,
0.336181640625,
-0.1246337890625,
-0.7998046875,
-0.499267578125,
0.369873046875,
0.2408447265625,
0.16845703125,
0.283203125,
-0.35009765625,
1.0263671875,
-0.8876953125,
-0.0021648406982421875,
-0.51708984375,
-0.3828125,
0.18310546875,
-0.42626953125,
0.9755859375,
-0.1630859375,
-0.5068359375,
-0.2230224609375,
0.39013671875,
0.425537109375,
-0.27294921875,
-0.2283935546875,
-0.50439453125,
-0.12103271484375,
-1.1005859375,
0.148681640625,
-0.57568359375,
0.0277862548828125,
-0.81884765625,
-0.107421875,
1.11328125,
-0.689453125,
0.56201171875,
1.0400390625,
0.1058349609375,
0.00693511962890625,
-0.5537109375,
0.56591796875,
0.287353515625,
-0.44921875,
-0.154052734375,
-0.1358642578125,
-0.83544921875,
0.4130859375,
-0.39892578125,
-0.97119140625,
-0.6337890625,
0.397705078125,
1.2470703125,
-0.45263671875,
0.7216796875,
-0.1436767578125,
-0.80078125,
-0.5693359375,
0.9619140625,
0.085205078125,
0.468505859375,
0.91015625,
-0.265380859375,
-0.0195159912109375,
0.0190277099609375,
-0.52978515625,
-0.55908203125,
-0.41650390625,
1.015625,
-0.197509765625,
-0.578125,
0.155517578125,
0.6884765625,
-1.3828125,
-0.68212890625,
-0.236572265625,
0.26416015625,
-0.376220703125,
-0.58349609375,
0.322021484375,
0.63916015625,
-0.52392578125,
0.380615234375,
0.59521484375,
-0.0220947265625,
0.375,
-0.26123046875,
0.36474609375,
-0.50927734375,
0.61279296875,
0.81005859375,
-0.450439453125,
-0.0955810546875,
-0.476806640625,
-0.07623291015625,
-0.1434326171875,
0.16259765625,
0.609375,
-0.272216796875,
0.19873046875,
0.7509765625,
-0.25146484375,
0.89013671875,
-0.5322265625,
-0.345947265625,
0.1788330078125,
-0.382568359375,
-0.64306640625,
0.040435791015625,
0.78564453125,
-0.04095458984375,
0.427001953125,
-0.416259765625,
0.1680908203125,
0.045318603515625,
0.255615234375,
-0.375,
-0.642578125,
-0.498046875,
-0.85302734375,
-0.1029052734375,
-0.38916015625,
-0.4658203125,
0.249267578125,
-0.058197021484375,
-0.09716796875,
-0.34814453125,
0.1292724609375,
0.335693359375,
-0.705078125,
0.78857421875,
-0.66552734375,
0.275634765625,
-0.449951171875,
-0.2373046875,
-0.59765625,
-0.1954345703125,
-0.1595458984375,
-0.1458740234375,
-0.669921875,
0.341552734375,
-0.287353515625,
0.34814453125,
-0.2080078125,
0.58935546875,
0.00720977783203125,
-0.47265625,
0.1656494140625,
0.1593017578125,
-0.25439453125,
1.15625,
0.583984375,
-0.031494140625,
0.1171875,
0.08416748046875,
-0.45361328125,
-0.6728515625,
0.705078125,
0.91455078125,
-0.08673095703125,
-0.49658203125,
-0.486328125,
0.330810546875,
-1.0400390625,
0.11083984375,
-0.2216796875,
0.08074951171875,
0.32568359375,
-0.276123046875,
0.30078125,
1.3525390625,
-0.7548828125,
0.5302734375,
0.343017578125,
0.1785888671875,
0.25927734375,
0.6552734375,
-0.0240631103515625,
0.4384765625,
0.474853515625,
-0.09332275390625,
0.14697265625,
0.48486328125,
-0.0067138671875,
0.305908203125,
-0.312255859375,
-0.52490234375,
-0.73681640625,
-0.185302734375,
-0.1756591796875,
0.62060546875,
0.2607421875,
-0.9228515625,
-0.0423583984375,
-0.1446533203125,
-0.53125,
-0.040130615234375,
-1.18359375,
-0.83447265625,
0.75927734375,
-0.0894775390625,
-0.47265625,
-0.147705078125,
-0.389892578125,
-0.52197265625,
-0.049285888671875,
0.42529296875,
-0.53857421875,
0.4599609375,
-0.252685546875,
0.457275390625,
-0.1197509765625,
0.37890625,
0.35498046875,
0.26611328125,
-1.0380859375,
-0.6552734375,
0.3115234375,
1.14453125,
0.0281829833984375,
0.1514892578125,
-0.64013671875,
-0.0406494140625,
-0.27783203125,
-0.167236328125,
-0.2548828125,
0.44873046875,
0.11346435546875,
0.333251953125,
-1.185546875,
0.11907958984375,
-0.275634765625,
0.282958984375,
0.13427734375,
-0.2364501953125,
-0.46337890625,
0.71630859375,
0.845703125,
0.188720703125,
0.69873046875,
0.1282958984375,
1.015625,
-0.1123046875,
-0.14892578125,
-0.44189453125,
0.6767578125,
0.7021484375,
0.312255859375,
-0.441162109375,
0.57080078125,
0.69677734375,
0.1253662109375,
0.1405029296875,
0.390380859375,
0.52099609375,
-0.152587890625,
0.033721923828125,
-0.52783203125,
-0.09637451171875,
0.485107421875,
-0.58984375,
0.2386474609375,
-0.313232421875,
-0.188232421875,
-0.31494140625,
-0.5361328125,
0.59765625,
-0.256103515625,
-0.361572265625,
-0.09796142578125,
-0.337890625,
0.548828125,
0.9697265625,
0.330322265625,
0.188720703125,
1.123046875,
0.5537109375,
0.26708984375,
0.341796875,
0.299072265625,
0.123779296875,
-0.62353515625,
0.344970703125,
0.360595703125,
-0.10784912109375,
-0.47314453125,
-0.224609375,
-1.2177734375,
0.85400390625,
-0.5205078125,
-0.1253662109375,
0.82373046875,
-0.94921875,
-0.2705078125,
-0.64013671875,
0.98486328125,
-0.55224609375,
0.34716796875,
0.2205810546875,
-0.18701171875,
-0.7666015625,
0.71923828125,
-0.155517578125,
0.46044921875,
0.318603515625,
1.0869140625,
-0.0897216796875,
1.25390625,
0.338134765625,
-0.297119140625,
-0.1983642578125,
0.0491943359375,
-0.459716796875,
-0.642578125,
-0.14453125,
-0.362060546875,
0.03192138671875,
-0.822265625,
-0.144287109375,
-0.2257080078125,
0.73388671875,
-0.12396240234375,
-1.05859375,
-0.447509765625,
0.253173828125,
-0.94189453125,
0.51806640625,
-0.060791015625,
0.15625,
0.1925048828125,
-0.2235107421875,
-0.37255859375,
-0.445556640625,
-0.127685546875,
-0.5341796875,
0.87939453125,
-0.399169921875,
-1.033203125,
-0.42578125,
-0.41552734375,
-0.402587890625,
-0.1932373046875,
-0.452880859375,
-0.74755859375,
0.2666015625,
0.68408203125,
0.2449951171875,
0.2392578125,
-0.42236328125,
0.1785888671875,
1.0390625,
0.69873046875,
0.07635498046875,
1.1220703125,
0.006549835205078125,
-0.33056640625,
0.54638671875,
-0.7822265625,
0.54443359375,
-0.1475830078125,
-0.3662109375,
-0.459228515625,
0.319580078125,
-0.9609375,
-1.099609375,
0.37255859375,
0.46923828125,
0.27880859375,
-0.9169921875,
-1.49609375,
-0.206298828125,
-0.9375,
-0.10455322265625,
-0.78271484375,
0.67919921875,
0.445068359375,
-0.2327880859375,
-0.255615234375,
-1.103515625,
4.33984375,
1.12109375,
0.5478515625,
0.367431640625,
0.2073974609375,
0.80224609375,
0.431640625,
-0.62060546875,
-0.472900390625,
-0.57958984375,
0.701171875,
-0.58056640625,
-0.0709228515625,
1.0986328125,
0.478271484375,
0.6484375,
-0.32470703125,
-0.1513671875,
-0.141845703125,
-0.763671875,
-0.94677734375,
0.207275390625,
0.0738525390625,
0.712890625,
0.0638427734375,
0.1370849609375,
0.54931640625,
-0.2398681640625,
-0.5439453125,
-0.88623046875,
-0.046905517578125,
-0.63427734375,
0.82470703125,
0.25390625,
-0.431396484375,
0.5107421875,
-0.2115478515625,
-0.6162109375,
-0.6240234375,
0.1253662109375,
-0.73095703125,
0.1651611328125,
0.49365234375,
-0.70556640625,
-0.301025390625,
0.75341796875,
-0.3076171875,
0.5244140625,
0.297607421875,
-1.013671875,
1.001953125,
-0.078369140625,
0.481201171875,
-0.81298828125,
-0.8916015625,
-0.116943359375,
0.239990234375,
0.061676025390625,
-0.1983642578125,
0.1885986328125,
0.20751953125,
0.301025390625,
-0.08135986328125,
0.68896484375,
-0.98193359375,
0.96728515625,
-0.08367919921875,
0.36083984375,
-0.27734375,
-0.010498046875,
-0.1370849609375,
-0.239013671875,
-0.387451171875,
-0.237548828125,
0.6005859375,
0.5126953125,
-0.260498046875,
0.56982421875,
0.923828125,
-0.66748046875,
0.11053466796875,
-0.271484375,
-0.2147216796875,
0.10955810546875,
0.64599609375,
1.076171875,
-0.572265625,
-0.394287109375,
-0.556640625,
0.70849609375,
0.69384765625,
0.478515625,
-0.037139892578125,
-0.3212890625,
-0.49658203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a text consisting of n lines. Each line contains some space-separated words, consisting of lowercase English letters.
We define a syllable as a string that contains exactly one vowel and any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowels: 'a', 'e', 'i', 'o', 'u' and 'y'.
Each word of the text that contains at least one vowel can be divided into syllables. Each character should be a part of exactly one syllable. For example, the word "mamma" can be divided into syllables as "ma" and "mma", "mam" and "ma", and "mamm" and "a". Words that consist of only consonants should be ignored.
The verse patterns for the given text is a sequence of n integers p1, p2, ..., pn. Text matches the given verse pattern if for each i from 1 to n one can divide words of the i-th line in syllables in such a way that the total number of syllables is equal to pi.
You are given the text and the verse pattern. Check, if the given text matches the given verse pattern.
Input
The first line of the input contains a single integer n (1 β€ n β€ 100) β the number of lines in the text.
The second line contains integers p1, ..., pn (0 β€ pi β€ 100) β the verse pattern.
Next n lines contain the text itself. Text consists of lowercase English letters and spaces. It's guaranteed that all lines are non-empty, each line starts and ends with a letter and words are separated by exactly one space. The length of each line doesn't exceed 100 characters.
Output
If the given text matches the given verse pattern, then print "YES" (without quotes) in the only line of the output. Otherwise, print "NO" (without quotes).
Examples
Input
3
2 2 3
intel
code
ch allenge
Output
YES
Input
4
1 2 3 1
a
bcdefghi
jklmnopqrstu
vwxyz
Output
NO
Input
4
13 11 15 15
to be or not to be that is the question
whether tis nobler in the mind to suffer
the slings and arrows of outrageous fortune
or to take arms against a sea of troubles
Output
YES
Note
In the first sample, one can split words into syllables in the following way:
in-tel
co-de
ch al-len-ge
Since the word "ch" in the third line doesn't contain vowels, we can ignore it. As the result we get 2 syllabels in first two lines and 3 syllables in the third one.
Tags: implementation, strings
Correct Solution:
```
input()
answer = "YES"
vowels = set("aeiouy")
for p in map(int, input().split()):
if p != sum(l in vowels for l in input()):
answer = "NO"
break
print(answer)
```
| 37,328
|
[
0.256103515625,
0.1124267578125,
0.173828125,
0.061370849609375,
-0.36572265625,
-0.447509765625,
0.44775390625,
-0.389892578125,
0.371337890625,
0.8623046875,
0.353759765625,
0.1375732421875,
0.07672119140625,
-0.75390625,
-0.348388671875,
0.035186767578125,
-0.69140625,
-0.90478515625,
-0.475341796875,
-0.1226806640625,
-0.329345703125,
0.1776123046875,
-1.6689453125,
-0.29296875,
0.0311737060546875,
0.85205078125,
0.51025390625,
0.437255859375,
0.82080078125,
0.98046875,
-0.1705322265625,
-0.2039794921875,
0.474853515625,
-0.978515625,
-0.213623046875,
-0.65185546875,
0.7001953125,
-0.63232421875,
-0.38232421875,
-0.796875,
0.294189453125,
-0.4814453125,
0.432373046875,
-0.40380859375,
-1.1943359375,
-0.61865234375,
-0.315673828125,
-0.4208984375,
-0.10809326171875,
-0.082763671875,
0.58544921875,
-0.441650390625,
0.415283203125,
-0.2203369140625,
-0.390869140625,
-0.24853515625,
-0.1375732421875,
0.0341796875,
-0.82470703125,
0.2509765625,
0.2144775390625,
0.3896484375,
-0.2724609375,
-0.291748046875,
-0.806640625,
0.081298828125,
-0.264404296875,
0.0355224609375,
-0.12164306640625,
-0.74462890625,
-0.32666015625,
0.232421875,
-0.10516357421875,
-0.7138671875,
-0.75146484375,
-0.25537109375,
-0.11077880859375,
-0.29052734375,
-0.55517578125,
0.7158203125,
0.1390380859375,
1.1572265625,
0.281005859375,
0.38330078125,
-0.615234375,
-0.892578125,
-0.342529296875,
0.1700439453125,
0.307373046875,
-0.2493896484375,
-0.25732421875,
0.4921875,
-0.572265625,
0.29931640625,
0.58447265625,
0.68310546875,
-0.25439453125,
0.2379150390625,
0.59130859375,
0.60400390625,
0.6103515625,
0.806640625,
-0.439697265625,
1.0634765625,
-0.51904296875,
0.28955078125,
0.38427734375,
-0.0198974609375,
-0.1387939453125,
-0.1932373046875,
-0.0889892578125,
-0.382568359375,
0.447998046875,
0.51171875,
-0.14794921875,
0.94775390625,
-0.164306640625,
0.2484130859375,
-0.8408203125,
0.1932373046875,
0.30126953125,
0.1533203125,
0.1629638671875,
-0.386962890625,
0.4130859375,
-0.62109375,
-0.374755859375,
0.97509765625,
-0.330322265625,
0.0611572265625,
0.57470703125,
-0.180908203125,
-0.040374755859375,
0.21435546875,
-0.1435546875,
0.2880859375,
-0.061126708984375,
0.6162109375,
0.76123046875,
-0.4375,
0.7880859375,
-0.5771484375,
-0.045623779296875,
1.5048828125,
0.7001953125,
0.31005859375,
0.53125,
0.348388671875,
-0.931640625,
0.332275390625,
-0.95849609375,
0.82177734375,
0.0231475830078125,
0.264892578125,
-0.21630859375,
0.291259765625,
-0.2242431640625,
0.1552734375,
-0.045562744140625,
0.2265625,
-0.15380859375,
0.144287109375,
-0.2705078125,
0.79833984375,
-0.455078125,
0.79248046875,
-0.44091796875,
-0.11651611328125,
0.01568603515625,
-0.931640625,
0.4091796875,
0.10186767578125,
-0.279296875,
0.64453125,
0.34326171875,
0.9658203125,
0.82861328125,
-0.5400390625,
0.5771484375,
0.1370849609375,
-0.11083984375,
0.296875,
-0.1348876953125,
0.401123046875,
0.2447509765625,
0.477294921875,
0.03173828125,
-0.1805419921875,
-1.2548828125,
-0.55322265625,
0.18408203125,
0.931640625,
-0.76708984375,
0.322021484375,
0.61962890625,
-0.11181640625,
-0.654296875,
-0.418212890625,
-0.40966796875,
-0.89111328125,
-0.2047119140625,
0.6083984375,
-0.12353515625,
0.448486328125,
-0.5224609375,
-0.70556640625,
0.69140625,
1.3916015625,
-0.2254638671875,
0.385498046875,
0.16357421875,
0.011749267578125,
-0.07000732421875,
0.35009765625,
0.2366943359375,
-0.296875,
-0.5908203125,
0.896484375,
-0.50439453125,
-0.186279296875,
-0.1949462890625,
0.70263671875,
0.329833984375,
0.46533203125,
-0.29931640625,
-0.68505859375,
0.61865234375,
0.89208984375,
0.10687255859375,
0.376220703125,
0.0589599609375,
0.6826171875,
0.332275390625,
0.72998046875,
0.2457275390625,
0.286865234375,
0.283935546875,
0.9921875,
-0.109130859375,
0.497802734375,
-0.20361328125,
0.53564453125,
0.312255859375,
0.6728515625,
0.314208984375,
0.388427734375,
-0.273681640625,
0.2275390625,
-0.6044921875,
0.484619140625,
-0.0758056640625,
1.119140625,
0.6826171875,
0.62744140625,
-0.650390625,
-0.837890625,
-0.1422119140625,
0.8076171875,
-0.9501953125,
-0.7138671875,
0.07928466796875,
0.184326171875,
0.37060546875,
0.1636962890625,
0.222900390625,
0.37255859375,
0.5693359375,
0.458740234375,
-0.283203125,
-0.129150390625,
-0.7197265625,
-0.59375,
-0.92138671875,
-0.10028076171875,
-0.59033203125,
-0.12408447265625,
0.1685791015625,
-1.017578125,
0.2030029296875,
-0.28662109375,
-0.08282470703125,
0.2607421875,
-0.8798828125,
0.463134765625,
-0.62744140625,
0.5859375,
-0.51123046875,
0.74609375,
0.03875732421875,
0.958984375,
-0.7412109375,
-0.5546875,
-0.19921875,
-0.6806640625,
0.5322265625,
0.0965576171875,
0.38623046875,
0.470703125,
-0.68017578125,
-0.623046875,
-0.05926513671875,
-0.5419921875,
-0.418701171875,
0.47998046875,
-0.75439453125,
0.9267578125,
0.379150390625,
-0.9033203125,
0.1903076171875,
0.923828125,
-0.8115234375,
0.4169921875,
0.396728515625,
0.056640625,
-0.6630859375,
1.328125,
0.5927734375,
0.497314453125,
-0.78125,
-0.32763671875,
-0.498779296875,
0.171875,
0.09002685546875,
-0.48974609375,
-0.384521484375,
0.3291015625,
0.65283203125,
-1.1875,
0.55859375,
-1.169921875,
-0.37890625,
-0.12347412109375,
-0.45947265625,
1.1611328125,
0.97314453125,
-0.054595947265625,
-0.281494140625,
-0.3046875,
0.13525390625,
0.865234375,
0.49365234375,
-0.5791015625,
0.20751953125,
0.84423828125,
-0.1865234375,
-0.0838623046875,
0.325439453125,
-0.3857421875,
0.14013671875,
-0.040252685546875,
0.05859375,
0.9091796875,
0.58203125,
0.60888671875,
0.345703125,
0.3623046875,
-0.89208984375,
-0.3984375,
-0.2685546875,
0.97900390625,
0.2474365234375,
0.66455078125,
0.36572265625,
-0.004497528076171875,
-0.187744140625,
-0.80419921875,
0.54443359375,
-0.03802490234375,
0.70263671875,
-1.013671875,
0.85205078125,
0.1463623046875,
-0.2479248046875,
0.6787109375,
-0.8173828125,
-0.382568359375,
1.5302734375,
-0.07000732421875,
0.796875,
-0.47998046875,
0.410888671875,
-0.281982421875,
0.00467681884765625,
0.7080078125,
0.499755859375,
0.42431640625,
-0.250732421875,
-0.385009765625,
-0.1939697265625,
-0.195556640625,
-0.323974609375,
-0.57958984375,
0.3173828125,
-0.60009765625,
-0.33837890625,
-0.78076171875,
0.288330078125,
0.62353515625,
0.1651611328125,
-0.03253173828125,
0.41357421875,
0.1815185546875,
0.8076171875,
0.47265625,
-0.2198486328125,
0.496337890625,
-0.6474609375,
0.46533203125,
-0.087158203125,
-0.232666015625,
-0.7822265625,
-0.4912109375,
-0.57373046875,
-0.483154296875,
0.1351318359375,
-0.224853515625,
-0.82763671875,
0.11737060546875,
0.10711669921875,
0.5810546875,
-1.1767578125,
-0.2347412109375,
-0.290771484375,
0.69091796875,
0.404541015625,
-0.8740234375,
0.13134765625,
-0.87353515625,
0.6025390625,
0.332763671875,
-0.27392578125,
-0.273681640625,
-0.38330078125,
-0.85107421875,
-0.59033203125,
0.068603515625,
0.45361328125,
-0.129638671875,
0.328369140625,
-0.91796875,
0.5576171875,
0.47314453125,
-0.28369140625,
0.1307373046875,
0.2413330078125,
-0.0611572265625,
0.421875,
0.65478515625,
-0.77587890625,
-0.65869140625,
0.259521484375,
-1.263671875,
0.305908203125,
-0.7099609375,
0.2200927734375,
-0.237548828125,
-0.2269287109375,
-0.02813720703125,
0.29345703125,
-0.223876953125,
0.10821533203125,
-0.18994140625,
0.11474609375,
-1.0009765625,
-1.044921875,
0.5986328125,
0.1275634765625,
-0.5849609375,
0.9755859375,
-0.1824951171875,
-0.28955078125,
0.2408447265625,
0.37109375,
-0.415771484375,
0.47021484375,
-0.4541015625,
0.308837890625,
-0.1873779296875,
-0.5478515625,
-0.529296875,
-0.187744140625,
0.328857421875,
-0.1319580078125,
-0.67529296875,
-0.31494140625,
-1.060546875,
-0.1888427734375,
-0.333251953125,
-0.310546875,
0.150390625,
0.3369140625,
0.0246734619140625,
0.05169677734375,
-0.357421875,
-0.347900390625,
-0.397705078125,
-0.42431640625,
-0.65283203125,
0.41162109375,
0.50048828125,
0.99658203125,
0.336181640625,
-0.39306640625,
-0.097900390625,
0.20947265625,
0.020660400390625,
-0.322021484375,
-0.20263671875,
-0.043304443359375,
-0.55126953125,
-0.05682373046875,
0.60791015625,
0.07562255859375,
0.4404296875,
0.8134765625,
-0.0732421875,
0.58349609375,
0.546875,
-0.4130859375,
1.1513671875,
0.38720703125,
-1.056640625,
-0.407470703125,
0.34033203125,
-0.08270263671875,
1.08203125,
0.1995849609375,
-0.83544921875,
-0.66748046875,
-1,
-0.1126708984375,
-0.246826171875,
-0.2197265625,
-0.482177734375,
-0.322509765625,
0.00872802734375,
0.814453125,
-0.227294921875,
-0.35302734375,
-0.056396484375,
-1.119140625,
-0.1292724609375,
-0.59521484375,
-0.1553955078125,
-0.5498046875,
-0.09552001953125,
-0.57421875,
0.955078125,
-0.1365966796875,
0.1962890625,
0.11749267578125,
-0.09112548828125,
0.336181640625,
-0.1246337890625,
-0.7998046875,
-0.499267578125,
0.369873046875,
0.2408447265625,
0.16845703125,
0.283203125,
-0.35009765625,
1.0263671875,
-0.8876953125,
-0.0021648406982421875,
-0.51708984375,
-0.3828125,
0.18310546875,
-0.42626953125,
0.9755859375,
-0.1630859375,
-0.5068359375,
-0.2230224609375,
0.39013671875,
0.425537109375,
-0.27294921875,
-0.2283935546875,
-0.50439453125,
-0.12103271484375,
-1.1005859375,
0.148681640625,
-0.57568359375,
0.0277862548828125,
-0.81884765625,
-0.107421875,
1.11328125,
-0.689453125,
0.56201171875,
1.0400390625,
0.1058349609375,
0.00693511962890625,
-0.5537109375,
0.56591796875,
0.287353515625,
-0.44921875,
-0.154052734375,
-0.1358642578125,
-0.83544921875,
0.4130859375,
-0.39892578125,
-0.97119140625,
-0.6337890625,
0.397705078125,
1.2470703125,
-0.45263671875,
0.7216796875,
-0.1436767578125,
-0.80078125,
-0.5693359375,
0.9619140625,
0.085205078125,
0.468505859375,
0.91015625,
-0.265380859375,
-0.0195159912109375,
0.0190277099609375,
-0.52978515625,
-0.55908203125,
-0.41650390625,
1.015625,
-0.197509765625,
-0.578125,
0.155517578125,
0.6884765625,
-1.3828125,
-0.68212890625,
-0.236572265625,
0.26416015625,
-0.376220703125,
-0.58349609375,
0.322021484375,
0.63916015625,
-0.52392578125,
0.380615234375,
0.59521484375,
-0.0220947265625,
0.375,
-0.26123046875,
0.36474609375,
-0.50927734375,
0.61279296875,
0.81005859375,
-0.450439453125,
-0.0955810546875,
-0.476806640625,
-0.07623291015625,
-0.1434326171875,
0.16259765625,
0.609375,
-0.272216796875,
0.19873046875,
0.7509765625,
-0.25146484375,
0.89013671875,
-0.5322265625,
-0.345947265625,
0.1788330078125,
-0.382568359375,
-0.64306640625,
0.040435791015625,
0.78564453125,
-0.04095458984375,
0.427001953125,
-0.416259765625,
0.1680908203125,
0.045318603515625,
0.255615234375,
-0.375,
-0.642578125,
-0.498046875,
-0.85302734375,
-0.1029052734375,
-0.38916015625,
-0.4658203125,
0.249267578125,
-0.058197021484375,
-0.09716796875,
-0.34814453125,
0.1292724609375,
0.335693359375,
-0.705078125,
0.78857421875,
-0.66552734375,
0.275634765625,
-0.449951171875,
-0.2373046875,
-0.59765625,
-0.1954345703125,
-0.1595458984375,
-0.1458740234375,
-0.669921875,
0.341552734375,
-0.287353515625,
0.34814453125,
-0.2080078125,
0.58935546875,
0.00720977783203125,
-0.47265625,
0.1656494140625,
0.1593017578125,
-0.25439453125,
1.15625,
0.583984375,
-0.031494140625,
0.1171875,
0.08416748046875,
-0.45361328125,
-0.6728515625,
0.705078125,
0.91455078125,
-0.08673095703125,
-0.49658203125,
-0.486328125,
0.330810546875,
-1.0400390625,
0.11083984375,
-0.2216796875,
0.08074951171875,
0.32568359375,
-0.276123046875,
0.30078125,
1.3525390625,
-0.7548828125,
0.5302734375,
0.343017578125,
0.1785888671875,
0.25927734375,
0.6552734375,
-0.0240631103515625,
0.4384765625,
0.474853515625,
-0.09332275390625,
0.14697265625,
0.48486328125,
-0.0067138671875,
0.305908203125,
-0.312255859375,
-0.52490234375,
-0.73681640625,
-0.185302734375,
-0.1756591796875,
0.62060546875,
0.2607421875,
-0.9228515625,
-0.0423583984375,
-0.1446533203125,
-0.53125,
-0.040130615234375,
-1.18359375,
-0.83447265625,
0.75927734375,
-0.0894775390625,
-0.47265625,
-0.147705078125,
-0.389892578125,
-0.52197265625,
-0.049285888671875,
0.42529296875,
-0.53857421875,
0.4599609375,
-0.252685546875,
0.457275390625,
-0.1197509765625,
0.37890625,
0.35498046875,
0.26611328125,
-1.0380859375,
-0.6552734375,
0.3115234375,
1.14453125,
0.0281829833984375,
0.1514892578125,
-0.64013671875,
-0.0406494140625,
-0.27783203125,
-0.167236328125,
-0.2548828125,
0.44873046875,
0.11346435546875,
0.333251953125,
-1.185546875,
0.11907958984375,
-0.275634765625,
0.282958984375,
0.13427734375,
-0.2364501953125,
-0.46337890625,
0.71630859375,
0.845703125,
0.188720703125,
0.69873046875,
0.1282958984375,
1.015625,
-0.1123046875,
-0.14892578125,
-0.44189453125,
0.6767578125,
0.7021484375,
0.312255859375,
-0.441162109375,
0.57080078125,
0.69677734375,
0.1253662109375,
0.1405029296875,
0.390380859375,
0.52099609375,
-0.152587890625,
0.033721923828125,
-0.52783203125,
-0.09637451171875,
0.485107421875,
-0.58984375,
0.2386474609375,
-0.313232421875,
-0.188232421875,
-0.31494140625,
-0.5361328125,
0.59765625,
-0.256103515625,
-0.361572265625,
-0.09796142578125,
-0.337890625,
0.548828125,
0.9697265625,
0.330322265625,
0.188720703125,
1.123046875,
0.5537109375,
0.26708984375,
0.341796875,
0.299072265625,
0.123779296875,
-0.62353515625,
0.344970703125,
0.360595703125,
-0.10784912109375,
-0.47314453125,
-0.224609375,
-1.2177734375,
0.85400390625,
-0.5205078125,
-0.1253662109375,
0.82373046875,
-0.94921875,
-0.2705078125,
-0.64013671875,
0.98486328125,
-0.55224609375,
0.34716796875,
0.2205810546875,
-0.18701171875,
-0.7666015625,
0.71923828125,
-0.155517578125,
0.46044921875,
0.318603515625,
1.0869140625,
-0.0897216796875,
1.25390625,
0.338134765625,
-0.297119140625,
-0.1983642578125,
0.0491943359375,
-0.459716796875,
-0.642578125,
-0.14453125,
-0.362060546875,
0.03192138671875,
-0.822265625,
-0.144287109375,
-0.2257080078125,
0.73388671875,
-0.12396240234375,
-1.05859375,
-0.447509765625,
0.253173828125,
-0.94189453125,
0.51806640625,
-0.060791015625,
0.15625,
0.1925048828125,
-0.2235107421875,
-0.37255859375,
-0.445556640625,
-0.127685546875,
-0.5341796875,
0.87939453125,
-0.399169921875,
-1.033203125,
-0.42578125,
-0.41552734375,
-0.402587890625,
-0.1932373046875,
-0.452880859375,
-0.74755859375,
0.2666015625,
0.68408203125,
0.2449951171875,
0.2392578125,
-0.42236328125,
0.1785888671875,
1.0390625,
0.69873046875,
0.07635498046875,
1.1220703125,
0.006549835205078125,
-0.33056640625,
0.54638671875,
-0.7822265625,
0.54443359375,
-0.1475830078125,
-0.3662109375,
-0.459228515625,
0.319580078125,
-0.9609375,
-1.099609375,
0.37255859375,
0.46923828125,
0.27880859375,
-0.9169921875,
-1.49609375,
-0.206298828125,
-0.9375,
-0.10455322265625,
-0.78271484375,
0.67919921875,
0.445068359375,
-0.2327880859375,
-0.255615234375,
-1.103515625,
4.33984375,
1.12109375,
0.5478515625,
0.367431640625,
0.2073974609375,
0.80224609375,
0.431640625,
-0.62060546875,
-0.472900390625,
-0.57958984375,
0.701171875,
-0.58056640625,
-0.0709228515625,
1.0986328125,
0.478271484375,
0.6484375,
-0.32470703125,
-0.1513671875,
-0.141845703125,
-0.763671875,
-0.94677734375,
0.207275390625,
0.0738525390625,
0.712890625,
0.0638427734375,
0.1370849609375,
0.54931640625,
-0.2398681640625,
-0.5439453125,
-0.88623046875,
-0.046905517578125,
-0.63427734375,
0.82470703125,
0.25390625,
-0.431396484375,
0.5107421875,
-0.2115478515625,
-0.6162109375,
-0.6240234375,
0.1253662109375,
-0.73095703125,
0.1651611328125,
0.49365234375,
-0.70556640625,
-0.301025390625,
0.75341796875,
-0.3076171875,
0.5244140625,
0.297607421875,
-1.013671875,
1.001953125,
-0.078369140625,
0.481201171875,
-0.81298828125,
-0.8916015625,
-0.116943359375,
0.239990234375,
0.061676025390625,
-0.1983642578125,
0.1885986328125,
0.20751953125,
0.301025390625,
-0.08135986328125,
0.68896484375,
-0.98193359375,
0.96728515625,
-0.08367919921875,
0.36083984375,
-0.27734375,
-0.010498046875,
-0.1370849609375,
-0.239013671875,
-0.387451171875,
-0.237548828125,
0.6005859375,
0.5126953125,
-0.260498046875,
0.56982421875,
0.923828125,
-0.66748046875,
0.11053466796875,
-0.271484375,
-0.2147216796875,
0.10955810546875,
0.64599609375,
1.076171875,
-0.572265625,
-0.394287109375,
-0.556640625,
0.70849609375,
0.69384765625,
0.478515625,
-0.037139892578125,
-0.3212890625,
-0.49658203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a text consisting of n lines. Each line contains some space-separated words, consisting of lowercase English letters.
We define a syllable as a string that contains exactly one vowel and any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowels: 'a', 'e', 'i', 'o', 'u' and 'y'.
Each word of the text that contains at least one vowel can be divided into syllables. Each character should be a part of exactly one syllable. For example, the word "mamma" can be divided into syllables as "ma" and "mma", "mam" and "ma", and "mamm" and "a". Words that consist of only consonants should be ignored.
The verse patterns for the given text is a sequence of n integers p1, p2, ..., pn. Text matches the given verse pattern if for each i from 1 to n one can divide words of the i-th line in syllables in such a way that the total number of syllables is equal to pi.
You are given the text and the verse pattern. Check, if the given text matches the given verse pattern.
Input
The first line of the input contains a single integer n (1 β€ n β€ 100) β the number of lines in the text.
The second line contains integers p1, ..., pn (0 β€ pi β€ 100) β the verse pattern.
Next n lines contain the text itself. Text consists of lowercase English letters and spaces. It's guaranteed that all lines are non-empty, each line starts and ends with a letter and words are separated by exactly one space. The length of each line doesn't exceed 100 characters.
Output
If the given text matches the given verse pattern, then print "YES" (without quotes) in the only line of the output. Otherwise, print "NO" (without quotes).
Examples
Input
3
2 2 3
intel
code
ch allenge
Output
YES
Input
4
1 2 3 1
a
bcdefghi
jklmnopqrstu
vwxyz
Output
NO
Input
4
13 11 15 15
to be or not to be that is the question
whether tis nobler in the mind to suffer
the slings and arrows of outrageous fortune
or to take arms against a sea of troubles
Output
YES
Note
In the first sample, one can split words into syllables in the following way:
in-tel
co-de
ch al-len-ge
Since the word "ch" in the third line doesn't contain vowels, we can ignore it. As the result we get 2 syllabels in first two lines and 3 syllables in the third one.
Tags: implementation, strings
Correct Solution:
```
num = int(input())
li = [int(x) for x in input().split()]
s = set(list("aeiouy"))
lis = [ len("".join(filter(lambda x: x in s,input()))) for x in range(num)]
print("YES" if lis == li else "NO")
```
| 37,329
|
[
0.256103515625,
0.1124267578125,
0.173828125,
0.061370849609375,
-0.36572265625,
-0.447509765625,
0.44775390625,
-0.389892578125,
0.371337890625,
0.8623046875,
0.353759765625,
0.1375732421875,
0.07672119140625,
-0.75390625,
-0.348388671875,
0.035186767578125,
-0.69140625,
-0.90478515625,
-0.475341796875,
-0.1226806640625,
-0.329345703125,
0.1776123046875,
-1.6689453125,
-0.29296875,
0.0311737060546875,
0.85205078125,
0.51025390625,
0.437255859375,
0.82080078125,
0.98046875,
-0.1705322265625,
-0.2039794921875,
0.474853515625,
-0.978515625,
-0.213623046875,
-0.65185546875,
0.7001953125,
-0.63232421875,
-0.38232421875,
-0.796875,
0.294189453125,
-0.4814453125,
0.432373046875,
-0.40380859375,
-1.1943359375,
-0.61865234375,
-0.315673828125,
-0.4208984375,
-0.10809326171875,
-0.082763671875,
0.58544921875,
-0.441650390625,
0.415283203125,
-0.2203369140625,
-0.390869140625,
-0.24853515625,
-0.1375732421875,
0.0341796875,
-0.82470703125,
0.2509765625,
0.2144775390625,
0.3896484375,
-0.2724609375,
-0.291748046875,
-0.806640625,
0.081298828125,
-0.264404296875,
0.0355224609375,
-0.12164306640625,
-0.74462890625,
-0.32666015625,
0.232421875,
-0.10516357421875,
-0.7138671875,
-0.75146484375,
-0.25537109375,
-0.11077880859375,
-0.29052734375,
-0.55517578125,
0.7158203125,
0.1390380859375,
1.1572265625,
0.281005859375,
0.38330078125,
-0.615234375,
-0.892578125,
-0.342529296875,
0.1700439453125,
0.307373046875,
-0.2493896484375,
-0.25732421875,
0.4921875,
-0.572265625,
0.29931640625,
0.58447265625,
0.68310546875,
-0.25439453125,
0.2379150390625,
0.59130859375,
0.60400390625,
0.6103515625,
0.806640625,
-0.439697265625,
1.0634765625,
-0.51904296875,
0.28955078125,
0.38427734375,
-0.0198974609375,
-0.1387939453125,
-0.1932373046875,
-0.0889892578125,
-0.382568359375,
0.447998046875,
0.51171875,
-0.14794921875,
0.94775390625,
-0.164306640625,
0.2484130859375,
-0.8408203125,
0.1932373046875,
0.30126953125,
0.1533203125,
0.1629638671875,
-0.386962890625,
0.4130859375,
-0.62109375,
-0.374755859375,
0.97509765625,
-0.330322265625,
0.0611572265625,
0.57470703125,
-0.180908203125,
-0.040374755859375,
0.21435546875,
-0.1435546875,
0.2880859375,
-0.061126708984375,
0.6162109375,
0.76123046875,
-0.4375,
0.7880859375,
-0.5771484375,
-0.045623779296875,
1.5048828125,
0.7001953125,
0.31005859375,
0.53125,
0.348388671875,
-0.931640625,
0.332275390625,
-0.95849609375,
0.82177734375,
0.0231475830078125,
0.264892578125,
-0.21630859375,
0.291259765625,
-0.2242431640625,
0.1552734375,
-0.045562744140625,
0.2265625,
-0.15380859375,
0.144287109375,
-0.2705078125,
0.79833984375,
-0.455078125,
0.79248046875,
-0.44091796875,
-0.11651611328125,
0.01568603515625,
-0.931640625,
0.4091796875,
0.10186767578125,
-0.279296875,
0.64453125,
0.34326171875,
0.9658203125,
0.82861328125,
-0.5400390625,
0.5771484375,
0.1370849609375,
-0.11083984375,
0.296875,
-0.1348876953125,
0.401123046875,
0.2447509765625,
0.477294921875,
0.03173828125,
-0.1805419921875,
-1.2548828125,
-0.55322265625,
0.18408203125,
0.931640625,
-0.76708984375,
0.322021484375,
0.61962890625,
-0.11181640625,
-0.654296875,
-0.418212890625,
-0.40966796875,
-0.89111328125,
-0.2047119140625,
0.6083984375,
-0.12353515625,
0.448486328125,
-0.5224609375,
-0.70556640625,
0.69140625,
1.3916015625,
-0.2254638671875,
0.385498046875,
0.16357421875,
0.011749267578125,
-0.07000732421875,
0.35009765625,
0.2366943359375,
-0.296875,
-0.5908203125,
0.896484375,
-0.50439453125,
-0.186279296875,
-0.1949462890625,
0.70263671875,
0.329833984375,
0.46533203125,
-0.29931640625,
-0.68505859375,
0.61865234375,
0.89208984375,
0.10687255859375,
0.376220703125,
0.0589599609375,
0.6826171875,
0.332275390625,
0.72998046875,
0.2457275390625,
0.286865234375,
0.283935546875,
0.9921875,
-0.109130859375,
0.497802734375,
-0.20361328125,
0.53564453125,
0.312255859375,
0.6728515625,
0.314208984375,
0.388427734375,
-0.273681640625,
0.2275390625,
-0.6044921875,
0.484619140625,
-0.0758056640625,
1.119140625,
0.6826171875,
0.62744140625,
-0.650390625,
-0.837890625,
-0.1422119140625,
0.8076171875,
-0.9501953125,
-0.7138671875,
0.07928466796875,
0.184326171875,
0.37060546875,
0.1636962890625,
0.222900390625,
0.37255859375,
0.5693359375,
0.458740234375,
-0.283203125,
-0.129150390625,
-0.7197265625,
-0.59375,
-0.92138671875,
-0.10028076171875,
-0.59033203125,
-0.12408447265625,
0.1685791015625,
-1.017578125,
0.2030029296875,
-0.28662109375,
-0.08282470703125,
0.2607421875,
-0.8798828125,
0.463134765625,
-0.62744140625,
0.5859375,
-0.51123046875,
0.74609375,
0.03875732421875,
0.958984375,
-0.7412109375,
-0.5546875,
-0.19921875,
-0.6806640625,
0.5322265625,
0.0965576171875,
0.38623046875,
0.470703125,
-0.68017578125,
-0.623046875,
-0.05926513671875,
-0.5419921875,
-0.418701171875,
0.47998046875,
-0.75439453125,
0.9267578125,
0.379150390625,
-0.9033203125,
0.1903076171875,
0.923828125,
-0.8115234375,
0.4169921875,
0.396728515625,
0.056640625,
-0.6630859375,
1.328125,
0.5927734375,
0.497314453125,
-0.78125,
-0.32763671875,
-0.498779296875,
0.171875,
0.09002685546875,
-0.48974609375,
-0.384521484375,
0.3291015625,
0.65283203125,
-1.1875,
0.55859375,
-1.169921875,
-0.37890625,
-0.12347412109375,
-0.45947265625,
1.1611328125,
0.97314453125,
-0.054595947265625,
-0.281494140625,
-0.3046875,
0.13525390625,
0.865234375,
0.49365234375,
-0.5791015625,
0.20751953125,
0.84423828125,
-0.1865234375,
-0.0838623046875,
0.325439453125,
-0.3857421875,
0.14013671875,
-0.040252685546875,
0.05859375,
0.9091796875,
0.58203125,
0.60888671875,
0.345703125,
0.3623046875,
-0.89208984375,
-0.3984375,
-0.2685546875,
0.97900390625,
0.2474365234375,
0.66455078125,
0.36572265625,
-0.004497528076171875,
-0.187744140625,
-0.80419921875,
0.54443359375,
-0.03802490234375,
0.70263671875,
-1.013671875,
0.85205078125,
0.1463623046875,
-0.2479248046875,
0.6787109375,
-0.8173828125,
-0.382568359375,
1.5302734375,
-0.07000732421875,
0.796875,
-0.47998046875,
0.410888671875,
-0.281982421875,
0.00467681884765625,
0.7080078125,
0.499755859375,
0.42431640625,
-0.250732421875,
-0.385009765625,
-0.1939697265625,
-0.195556640625,
-0.323974609375,
-0.57958984375,
0.3173828125,
-0.60009765625,
-0.33837890625,
-0.78076171875,
0.288330078125,
0.62353515625,
0.1651611328125,
-0.03253173828125,
0.41357421875,
0.1815185546875,
0.8076171875,
0.47265625,
-0.2198486328125,
0.496337890625,
-0.6474609375,
0.46533203125,
-0.087158203125,
-0.232666015625,
-0.7822265625,
-0.4912109375,
-0.57373046875,
-0.483154296875,
0.1351318359375,
-0.224853515625,
-0.82763671875,
0.11737060546875,
0.10711669921875,
0.5810546875,
-1.1767578125,
-0.2347412109375,
-0.290771484375,
0.69091796875,
0.404541015625,
-0.8740234375,
0.13134765625,
-0.87353515625,
0.6025390625,
0.332763671875,
-0.27392578125,
-0.273681640625,
-0.38330078125,
-0.85107421875,
-0.59033203125,
0.068603515625,
0.45361328125,
-0.129638671875,
0.328369140625,
-0.91796875,
0.5576171875,
0.47314453125,
-0.28369140625,
0.1307373046875,
0.2413330078125,
-0.0611572265625,
0.421875,
0.65478515625,
-0.77587890625,
-0.65869140625,
0.259521484375,
-1.263671875,
0.305908203125,
-0.7099609375,
0.2200927734375,
-0.237548828125,
-0.2269287109375,
-0.02813720703125,
0.29345703125,
-0.223876953125,
0.10821533203125,
-0.18994140625,
0.11474609375,
-1.0009765625,
-1.044921875,
0.5986328125,
0.1275634765625,
-0.5849609375,
0.9755859375,
-0.1824951171875,
-0.28955078125,
0.2408447265625,
0.37109375,
-0.415771484375,
0.47021484375,
-0.4541015625,
0.308837890625,
-0.1873779296875,
-0.5478515625,
-0.529296875,
-0.187744140625,
0.328857421875,
-0.1319580078125,
-0.67529296875,
-0.31494140625,
-1.060546875,
-0.1888427734375,
-0.333251953125,
-0.310546875,
0.150390625,
0.3369140625,
0.0246734619140625,
0.05169677734375,
-0.357421875,
-0.347900390625,
-0.397705078125,
-0.42431640625,
-0.65283203125,
0.41162109375,
0.50048828125,
0.99658203125,
0.336181640625,
-0.39306640625,
-0.097900390625,
0.20947265625,
0.020660400390625,
-0.322021484375,
-0.20263671875,
-0.043304443359375,
-0.55126953125,
-0.05682373046875,
0.60791015625,
0.07562255859375,
0.4404296875,
0.8134765625,
-0.0732421875,
0.58349609375,
0.546875,
-0.4130859375,
1.1513671875,
0.38720703125,
-1.056640625,
-0.407470703125,
0.34033203125,
-0.08270263671875,
1.08203125,
0.1995849609375,
-0.83544921875,
-0.66748046875,
-1,
-0.1126708984375,
-0.246826171875,
-0.2197265625,
-0.482177734375,
-0.322509765625,
0.00872802734375,
0.814453125,
-0.227294921875,
-0.35302734375,
-0.056396484375,
-1.119140625,
-0.1292724609375,
-0.59521484375,
-0.1553955078125,
-0.5498046875,
-0.09552001953125,
-0.57421875,
0.955078125,
-0.1365966796875,
0.1962890625,
0.11749267578125,
-0.09112548828125,
0.336181640625,
-0.1246337890625,
-0.7998046875,
-0.499267578125,
0.369873046875,
0.2408447265625,
0.16845703125,
0.283203125,
-0.35009765625,
1.0263671875,
-0.8876953125,
-0.0021648406982421875,
-0.51708984375,
-0.3828125,
0.18310546875,
-0.42626953125,
0.9755859375,
-0.1630859375,
-0.5068359375,
-0.2230224609375,
0.39013671875,
0.425537109375,
-0.27294921875,
-0.2283935546875,
-0.50439453125,
-0.12103271484375,
-1.1005859375,
0.148681640625,
-0.57568359375,
0.0277862548828125,
-0.81884765625,
-0.107421875,
1.11328125,
-0.689453125,
0.56201171875,
1.0400390625,
0.1058349609375,
0.00693511962890625,
-0.5537109375,
0.56591796875,
0.287353515625,
-0.44921875,
-0.154052734375,
-0.1358642578125,
-0.83544921875,
0.4130859375,
-0.39892578125,
-0.97119140625,
-0.6337890625,
0.397705078125,
1.2470703125,
-0.45263671875,
0.7216796875,
-0.1436767578125,
-0.80078125,
-0.5693359375,
0.9619140625,
0.085205078125,
0.468505859375,
0.91015625,
-0.265380859375,
-0.0195159912109375,
0.0190277099609375,
-0.52978515625,
-0.55908203125,
-0.41650390625,
1.015625,
-0.197509765625,
-0.578125,
0.155517578125,
0.6884765625,
-1.3828125,
-0.68212890625,
-0.236572265625,
0.26416015625,
-0.376220703125,
-0.58349609375,
0.322021484375,
0.63916015625,
-0.52392578125,
0.380615234375,
0.59521484375,
-0.0220947265625,
0.375,
-0.26123046875,
0.36474609375,
-0.50927734375,
0.61279296875,
0.81005859375,
-0.450439453125,
-0.0955810546875,
-0.476806640625,
-0.07623291015625,
-0.1434326171875,
0.16259765625,
0.609375,
-0.272216796875,
0.19873046875,
0.7509765625,
-0.25146484375,
0.89013671875,
-0.5322265625,
-0.345947265625,
0.1788330078125,
-0.382568359375,
-0.64306640625,
0.040435791015625,
0.78564453125,
-0.04095458984375,
0.427001953125,
-0.416259765625,
0.1680908203125,
0.045318603515625,
0.255615234375,
-0.375,
-0.642578125,
-0.498046875,
-0.85302734375,
-0.1029052734375,
-0.38916015625,
-0.4658203125,
0.249267578125,
-0.058197021484375,
-0.09716796875,
-0.34814453125,
0.1292724609375,
0.335693359375,
-0.705078125,
0.78857421875,
-0.66552734375,
0.275634765625,
-0.449951171875,
-0.2373046875,
-0.59765625,
-0.1954345703125,
-0.1595458984375,
-0.1458740234375,
-0.669921875,
0.341552734375,
-0.287353515625,
0.34814453125,
-0.2080078125,
0.58935546875,
0.00720977783203125,
-0.47265625,
0.1656494140625,
0.1593017578125,
-0.25439453125,
1.15625,
0.583984375,
-0.031494140625,
0.1171875,
0.08416748046875,
-0.45361328125,
-0.6728515625,
0.705078125,
0.91455078125,
-0.08673095703125,
-0.49658203125,
-0.486328125,
0.330810546875,
-1.0400390625,
0.11083984375,
-0.2216796875,
0.08074951171875,
0.32568359375,
-0.276123046875,
0.30078125,
1.3525390625,
-0.7548828125,
0.5302734375,
0.343017578125,
0.1785888671875,
0.25927734375,
0.6552734375,
-0.0240631103515625,
0.4384765625,
0.474853515625,
-0.09332275390625,
0.14697265625,
0.48486328125,
-0.0067138671875,
0.305908203125,
-0.312255859375,
-0.52490234375,
-0.73681640625,
-0.185302734375,
-0.1756591796875,
0.62060546875,
0.2607421875,
-0.9228515625,
-0.0423583984375,
-0.1446533203125,
-0.53125,
-0.040130615234375,
-1.18359375,
-0.83447265625,
0.75927734375,
-0.0894775390625,
-0.47265625,
-0.147705078125,
-0.389892578125,
-0.52197265625,
-0.049285888671875,
0.42529296875,
-0.53857421875,
0.4599609375,
-0.252685546875,
0.457275390625,
-0.1197509765625,
0.37890625,
0.35498046875,
0.26611328125,
-1.0380859375,
-0.6552734375,
0.3115234375,
1.14453125,
0.0281829833984375,
0.1514892578125,
-0.64013671875,
-0.0406494140625,
-0.27783203125,
-0.167236328125,
-0.2548828125,
0.44873046875,
0.11346435546875,
0.333251953125,
-1.185546875,
0.11907958984375,
-0.275634765625,
0.282958984375,
0.13427734375,
-0.2364501953125,
-0.46337890625,
0.71630859375,
0.845703125,
0.188720703125,
0.69873046875,
0.1282958984375,
1.015625,
-0.1123046875,
-0.14892578125,
-0.44189453125,
0.6767578125,
0.7021484375,
0.312255859375,
-0.441162109375,
0.57080078125,
0.69677734375,
0.1253662109375,
0.1405029296875,
0.390380859375,
0.52099609375,
-0.152587890625,
0.033721923828125,
-0.52783203125,
-0.09637451171875,
0.485107421875,
-0.58984375,
0.2386474609375,
-0.313232421875,
-0.188232421875,
-0.31494140625,
-0.5361328125,
0.59765625,
-0.256103515625,
-0.361572265625,
-0.09796142578125,
-0.337890625,
0.548828125,
0.9697265625,
0.330322265625,
0.188720703125,
1.123046875,
0.5537109375,
0.26708984375,
0.341796875,
0.299072265625,
0.123779296875,
-0.62353515625,
0.344970703125,
0.360595703125,
-0.10784912109375,
-0.47314453125,
-0.224609375,
-1.2177734375,
0.85400390625,
-0.5205078125,
-0.1253662109375,
0.82373046875,
-0.94921875,
-0.2705078125,
-0.64013671875,
0.98486328125,
-0.55224609375,
0.34716796875,
0.2205810546875,
-0.18701171875,
-0.7666015625,
0.71923828125,
-0.155517578125,
0.46044921875,
0.318603515625,
1.0869140625,
-0.0897216796875,
1.25390625,
0.338134765625,
-0.297119140625,
-0.1983642578125,
0.0491943359375,
-0.459716796875,
-0.642578125,
-0.14453125,
-0.362060546875,
0.03192138671875,
-0.822265625,
-0.144287109375,
-0.2257080078125,
0.73388671875,
-0.12396240234375,
-1.05859375,
-0.447509765625,
0.253173828125,
-0.94189453125,
0.51806640625,
-0.060791015625,
0.15625,
0.1925048828125,
-0.2235107421875,
-0.37255859375,
-0.445556640625,
-0.127685546875,
-0.5341796875,
0.87939453125,
-0.399169921875,
-1.033203125,
-0.42578125,
-0.41552734375,
-0.402587890625,
-0.1932373046875,
-0.452880859375,
-0.74755859375,
0.2666015625,
0.68408203125,
0.2449951171875,
0.2392578125,
-0.42236328125,
0.1785888671875,
1.0390625,
0.69873046875,
0.07635498046875,
1.1220703125,
0.006549835205078125,
-0.33056640625,
0.54638671875,
-0.7822265625,
0.54443359375,
-0.1475830078125,
-0.3662109375,
-0.459228515625,
0.319580078125,
-0.9609375,
-1.099609375,
0.37255859375,
0.46923828125,
0.27880859375,
-0.9169921875,
-1.49609375,
-0.206298828125,
-0.9375,
-0.10455322265625,
-0.78271484375,
0.67919921875,
0.445068359375,
-0.2327880859375,
-0.255615234375,
-1.103515625,
4.33984375,
1.12109375,
0.5478515625,
0.367431640625,
0.2073974609375,
0.80224609375,
0.431640625,
-0.62060546875,
-0.472900390625,
-0.57958984375,
0.701171875,
-0.58056640625,
-0.0709228515625,
1.0986328125,
0.478271484375,
0.6484375,
-0.32470703125,
-0.1513671875,
-0.141845703125,
-0.763671875,
-0.94677734375,
0.207275390625,
0.0738525390625,
0.712890625,
0.0638427734375,
0.1370849609375,
0.54931640625,
-0.2398681640625,
-0.5439453125,
-0.88623046875,
-0.046905517578125,
-0.63427734375,
0.82470703125,
0.25390625,
-0.431396484375,
0.5107421875,
-0.2115478515625,
-0.6162109375,
-0.6240234375,
0.1253662109375,
-0.73095703125,
0.1651611328125,
0.49365234375,
-0.70556640625,
-0.301025390625,
0.75341796875,
-0.3076171875,
0.5244140625,
0.297607421875,
-1.013671875,
1.001953125,
-0.078369140625,
0.481201171875,
-0.81298828125,
-0.8916015625,
-0.116943359375,
0.239990234375,
0.061676025390625,
-0.1983642578125,
0.1885986328125,
0.20751953125,
0.301025390625,
-0.08135986328125,
0.68896484375,
-0.98193359375,
0.96728515625,
-0.08367919921875,
0.36083984375,
-0.27734375,
-0.010498046875,
-0.1370849609375,
-0.239013671875,
-0.387451171875,
-0.237548828125,
0.6005859375,
0.5126953125,
-0.260498046875,
0.56982421875,
0.923828125,
-0.66748046875,
0.11053466796875,
-0.271484375,
-0.2147216796875,
0.10955810546875,
0.64599609375,
1.076171875,
-0.572265625,
-0.394287109375,
-0.556640625,
0.70849609375,
0.69384765625,
0.478515625,
-0.037139892578125,
-0.3212890625,
-0.49658203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a text consisting of n lines. Each line contains some space-separated words, consisting of lowercase English letters.
We define a syllable as a string that contains exactly one vowel and any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowels: 'a', 'e', 'i', 'o', 'u' and 'y'.
Each word of the text that contains at least one vowel can be divided into syllables. Each character should be a part of exactly one syllable. For example, the word "mamma" can be divided into syllables as "ma" and "mma", "mam" and "ma", and "mamm" and "a". Words that consist of only consonants should be ignored.
The verse patterns for the given text is a sequence of n integers p1, p2, ..., pn. Text matches the given verse pattern if for each i from 1 to n one can divide words of the i-th line in syllables in such a way that the total number of syllables is equal to pi.
You are given the text and the verse pattern. Check, if the given text matches the given verse pattern.
Input
The first line of the input contains a single integer n (1 β€ n β€ 100) β the number of lines in the text.
The second line contains integers p1, ..., pn (0 β€ pi β€ 100) β the verse pattern.
Next n lines contain the text itself. Text consists of lowercase English letters and spaces. It's guaranteed that all lines are non-empty, each line starts and ends with a letter and words are separated by exactly one space. The length of each line doesn't exceed 100 characters.
Output
If the given text matches the given verse pattern, then print "YES" (without quotes) in the only line of the output. Otherwise, print "NO" (without quotes).
Examples
Input
3
2 2 3
intel
code
ch allenge
Output
YES
Input
4
1 2 3 1
a
bcdefghi
jklmnopqrstu
vwxyz
Output
NO
Input
4
13 11 15 15
to be or not to be that is the question
whether tis nobler in the mind to suffer
the slings and arrows of outrageous fortune
or to take arms against a sea of troubles
Output
YES
Note
In the first sample, one can split words into syllables in the following way:
in-tel
co-de
ch al-len-ge
Since the word "ch" in the third line doesn't contain vowels, we can ignore it. As the result we get 2 syllabels in first two lines and 3 syllables in the third one.
Tags: implementation, strings
Correct Solution:
```
n = int(input())
a = map(int, input().split())
for w in a:
s = input()
if w != sum(s.count(c) for c in "aeiouy"):
print("NO")
exit(0)
print("YES")
```
| 37,330
|
[
0.256103515625,
0.1124267578125,
0.173828125,
0.061370849609375,
-0.36572265625,
-0.447509765625,
0.44775390625,
-0.389892578125,
0.371337890625,
0.8623046875,
0.353759765625,
0.1375732421875,
0.07672119140625,
-0.75390625,
-0.348388671875,
0.035186767578125,
-0.69140625,
-0.90478515625,
-0.475341796875,
-0.1226806640625,
-0.329345703125,
0.1776123046875,
-1.6689453125,
-0.29296875,
0.0311737060546875,
0.85205078125,
0.51025390625,
0.437255859375,
0.82080078125,
0.98046875,
-0.1705322265625,
-0.2039794921875,
0.474853515625,
-0.978515625,
-0.213623046875,
-0.65185546875,
0.7001953125,
-0.63232421875,
-0.38232421875,
-0.796875,
0.294189453125,
-0.4814453125,
0.432373046875,
-0.40380859375,
-1.1943359375,
-0.61865234375,
-0.315673828125,
-0.4208984375,
-0.10809326171875,
-0.082763671875,
0.58544921875,
-0.441650390625,
0.415283203125,
-0.2203369140625,
-0.390869140625,
-0.24853515625,
-0.1375732421875,
0.0341796875,
-0.82470703125,
0.2509765625,
0.2144775390625,
0.3896484375,
-0.2724609375,
-0.291748046875,
-0.806640625,
0.081298828125,
-0.264404296875,
0.0355224609375,
-0.12164306640625,
-0.74462890625,
-0.32666015625,
0.232421875,
-0.10516357421875,
-0.7138671875,
-0.75146484375,
-0.25537109375,
-0.11077880859375,
-0.29052734375,
-0.55517578125,
0.7158203125,
0.1390380859375,
1.1572265625,
0.281005859375,
0.38330078125,
-0.615234375,
-0.892578125,
-0.342529296875,
0.1700439453125,
0.307373046875,
-0.2493896484375,
-0.25732421875,
0.4921875,
-0.572265625,
0.29931640625,
0.58447265625,
0.68310546875,
-0.25439453125,
0.2379150390625,
0.59130859375,
0.60400390625,
0.6103515625,
0.806640625,
-0.439697265625,
1.0634765625,
-0.51904296875,
0.28955078125,
0.38427734375,
-0.0198974609375,
-0.1387939453125,
-0.1932373046875,
-0.0889892578125,
-0.382568359375,
0.447998046875,
0.51171875,
-0.14794921875,
0.94775390625,
-0.164306640625,
0.2484130859375,
-0.8408203125,
0.1932373046875,
0.30126953125,
0.1533203125,
0.1629638671875,
-0.386962890625,
0.4130859375,
-0.62109375,
-0.374755859375,
0.97509765625,
-0.330322265625,
0.0611572265625,
0.57470703125,
-0.180908203125,
-0.040374755859375,
0.21435546875,
-0.1435546875,
0.2880859375,
-0.061126708984375,
0.6162109375,
0.76123046875,
-0.4375,
0.7880859375,
-0.5771484375,
-0.045623779296875,
1.5048828125,
0.7001953125,
0.31005859375,
0.53125,
0.348388671875,
-0.931640625,
0.332275390625,
-0.95849609375,
0.82177734375,
0.0231475830078125,
0.264892578125,
-0.21630859375,
0.291259765625,
-0.2242431640625,
0.1552734375,
-0.045562744140625,
0.2265625,
-0.15380859375,
0.144287109375,
-0.2705078125,
0.79833984375,
-0.455078125,
0.79248046875,
-0.44091796875,
-0.11651611328125,
0.01568603515625,
-0.931640625,
0.4091796875,
0.10186767578125,
-0.279296875,
0.64453125,
0.34326171875,
0.9658203125,
0.82861328125,
-0.5400390625,
0.5771484375,
0.1370849609375,
-0.11083984375,
0.296875,
-0.1348876953125,
0.401123046875,
0.2447509765625,
0.477294921875,
0.03173828125,
-0.1805419921875,
-1.2548828125,
-0.55322265625,
0.18408203125,
0.931640625,
-0.76708984375,
0.322021484375,
0.61962890625,
-0.11181640625,
-0.654296875,
-0.418212890625,
-0.40966796875,
-0.89111328125,
-0.2047119140625,
0.6083984375,
-0.12353515625,
0.448486328125,
-0.5224609375,
-0.70556640625,
0.69140625,
1.3916015625,
-0.2254638671875,
0.385498046875,
0.16357421875,
0.011749267578125,
-0.07000732421875,
0.35009765625,
0.2366943359375,
-0.296875,
-0.5908203125,
0.896484375,
-0.50439453125,
-0.186279296875,
-0.1949462890625,
0.70263671875,
0.329833984375,
0.46533203125,
-0.29931640625,
-0.68505859375,
0.61865234375,
0.89208984375,
0.10687255859375,
0.376220703125,
0.0589599609375,
0.6826171875,
0.332275390625,
0.72998046875,
0.2457275390625,
0.286865234375,
0.283935546875,
0.9921875,
-0.109130859375,
0.497802734375,
-0.20361328125,
0.53564453125,
0.312255859375,
0.6728515625,
0.314208984375,
0.388427734375,
-0.273681640625,
0.2275390625,
-0.6044921875,
0.484619140625,
-0.0758056640625,
1.119140625,
0.6826171875,
0.62744140625,
-0.650390625,
-0.837890625,
-0.1422119140625,
0.8076171875,
-0.9501953125,
-0.7138671875,
0.07928466796875,
0.184326171875,
0.37060546875,
0.1636962890625,
0.222900390625,
0.37255859375,
0.5693359375,
0.458740234375,
-0.283203125,
-0.129150390625,
-0.7197265625,
-0.59375,
-0.92138671875,
-0.10028076171875,
-0.59033203125,
-0.12408447265625,
0.1685791015625,
-1.017578125,
0.2030029296875,
-0.28662109375,
-0.08282470703125,
0.2607421875,
-0.8798828125,
0.463134765625,
-0.62744140625,
0.5859375,
-0.51123046875,
0.74609375,
0.03875732421875,
0.958984375,
-0.7412109375,
-0.5546875,
-0.19921875,
-0.6806640625,
0.5322265625,
0.0965576171875,
0.38623046875,
0.470703125,
-0.68017578125,
-0.623046875,
-0.05926513671875,
-0.5419921875,
-0.418701171875,
0.47998046875,
-0.75439453125,
0.9267578125,
0.379150390625,
-0.9033203125,
0.1903076171875,
0.923828125,
-0.8115234375,
0.4169921875,
0.396728515625,
0.056640625,
-0.6630859375,
1.328125,
0.5927734375,
0.497314453125,
-0.78125,
-0.32763671875,
-0.498779296875,
0.171875,
0.09002685546875,
-0.48974609375,
-0.384521484375,
0.3291015625,
0.65283203125,
-1.1875,
0.55859375,
-1.169921875,
-0.37890625,
-0.12347412109375,
-0.45947265625,
1.1611328125,
0.97314453125,
-0.054595947265625,
-0.281494140625,
-0.3046875,
0.13525390625,
0.865234375,
0.49365234375,
-0.5791015625,
0.20751953125,
0.84423828125,
-0.1865234375,
-0.0838623046875,
0.325439453125,
-0.3857421875,
0.14013671875,
-0.040252685546875,
0.05859375,
0.9091796875,
0.58203125,
0.60888671875,
0.345703125,
0.3623046875,
-0.89208984375,
-0.3984375,
-0.2685546875,
0.97900390625,
0.2474365234375,
0.66455078125,
0.36572265625,
-0.004497528076171875,
-0.187744140625,
-0.80419921875,
0.54443359375,
-0.03802490234375,
0.70263671875,
-1.013671875,
0.85205078125,
0.1463623046875,
-0.2479248046875,
0.6787109375,
-0.8173828125,
-0.382568359375,
1.5302734375,
-0.07000732421875,
0.796875,
-0.47998046875,
0.410888671875,
-0.281982421875,
0.00467681884765625,
0.7080078125,
0.499755859375,
0.42431640625,
-0.250732421875,
-0.385009765625,
-0.1939697265625,
-0.195556640625,
-0.323974609375,
-0.57958984375,
0.3173828125,
-0.60009765625,
-0.33837890625,
-0.78076171875,
0.288330078125,
0.62353515625,
0.1651611328125,
-0.03253173828125,
0.41357421875,
0.1815185546875,
0.8076171875,
0.47265625,
-0.2198486328125,
0.496337890625,
-0.6474609375,
0.46533203125,
-0.087158203125,
-0.232666015625,
-0.7822265625,
-0.4912109375,
-0.57373046875,
-0.483154296875,
0.1351318359375,
-0.224853515625,
-0.82763671875,
0.11737060546875,
0.10711669921875,
0.5810546875,
-1.1767578125,
-0.2347412109375,
-0.290771484375,
0.69091796875,
0.404541015625,
-0.8740234375,
0.13134765625,
-0.87353515625,
0.6025390625,
0.332763671875,
-0.27392578125,
-0.273681640625,
-0.38330078125,
-0.85107421875,
-0.59033203125,
0.068603515625,
0.45361328125,
-0.129638671875,
0.328369140625,
-0.91796875,
0.5576171875,
0.47314453125,
-0.28369140625,
0.1307373046875,
0.2413330078125,
-0.0611572265625,
0.421875,
0.65478515625,
-0.77587890625,
-0.65869140625,
0.259521484375,
-1.263671875,
0.305908203125,
-0.7099609375,
0.2200927734375,
-0.237548828125,
-0.2269287109375,
-0.02813720703125,
0.29345703125,
-0.223876953125,
0.10821533203125,
-0.18994140625,
0.11474609375,
-1.0009765625,
-1.044921875,
0.5986328125,
0.1275634765625,
-0.5849609375,
0.9755859375,
-0.1824951171875,
-0.28955078125,
0.2408447265625,
0.37109375,
-0.415771484375,
0.47021484375,
-0.4541015625,
0.308837890625,
-0.1873779296875,
-0.5478515625,
-0.529296875,
-0.187744140625,
0.328857421875,
-0.1319580078125,
-0.67529296875,
-0.31494140625,
-1.060546875,
-0.1888427734375,
-0.333251953125,
-0.310546875,
0.150390625,
0.3369140625,
0.0246734619140625,
0.05169677734375,
-0.357421875,
-0.347900390625,
-0.397705078125,
-0.42431640625,
-0.65283203125,
0.41162109375,
0.50048828125,
0.99658203125,
0.336181640625,
-0.39306640625,
-0.097900390625,
0.20947265625,
0.020660400390625,
-0.322021484375,
-0.20263671875,
-0.043304443359375,
-0.55126953125,
-0.05682373046875,
0.60791015625,
0.07562255859375,
0.4404296875,
0.8134765625,
-0.0732421875,
0.58349609375,
0.546875,
-0.4130859375,
1.1513671875,
0.38720703125,
-1.056640625,
-0.407470703125,
0.34033203125,
-0.08270263671875,
1.08203125,
0.1995849609375,
-0.83544921875,
-0.66748046875,
-1,
-0.1126708984375,
-0.246826171875,
-0.2197265625,
-0.482177734375,
-0.322509765625,
0.00872802734375,
0.814453125,
-0.227294921875,
-0.35302734375,
-0.056396484375,
-1.119140625,
-0.1292724609375,
-0.59521484375,
-0.1553955078125,
-0.5498046875,
-0.09552001953125,
-0.57421875,
0.955078125,
-0.1365966796875,
0.1962890625,
0.11749267578125,
-0.09112548828125,
0.336181640625,
-0.1246337890625,
-0.7998046875,
-0.499267578125,
0.369873046875,
0.2408447265625,
0.16845703125,
0.283203125,
-0.35009765625,
1.0263671875,
-0.8876953125,
-0.0021648406982421875,
-0.51708984375,
-0.3828125,
0.18310546875,
-0.42626953125,
0.9755859375,
-0.1630859375,
-0.5068359375,
-0.2230224609375,
0.39013671875,
0.425537109375,
-0.27294921875,
-0.2283935546875,
-0.50439453125,
-0.12103271484375,
-1.1005859375,
0.148681640625,
-0.57568359375,
0.0277862548828125,
-0.81884765625,
-0.107421875,
1.11328125,
-0.689453125,
0.56201171875,
1.0400390625,
0.1058349609375,
0.00693511962890625,
-0.5537109375,
0.56591796875,
0.287353515625,
-0.44921875,
-0.154052734375,
-0.1358642578125,
-0.83544921875,
0.4130859375,
-0.39892578125,
-0.97119140625,
-0.6337890625,
0.397705078125,
1.2470703125,
-0.45263671875,
0.7216796875,
-0.1436767578125,
-0.80078125,
-0.5693359375,
0.9619140625,
0.085205078125,
0.468505859375,
0.91015625,
-0.265380859375,
-0.0195159912109375,
0.0190277099609375,
-0.52978515625,
-0.55908203125,
-0.41650390625,
1.015625,
-0.197509765625,
-0.578125,
0.155517578125,
0.6884765625,
-1.3828125,
-0.68212890625,
-0.236572265625,
0.26416015625,
-0.376220703125,
-0.58349609375,
0.322021484375,
0.63916015625,
-0.52392578125,
0.380615234375,
0.59521484375,
-0.0220947265625,
0.375,
-0.26123046875,
0.36474609375,
-0.50927734375,
0.61279296875,
0.81005859375,
-0.450439453125,
-0.0955810546875,
-0.476806640625,
-0.07623291015625,
-0.1434326171875,
0.16259765625,
0.609375,
-0.272216796875,
0.19873046875,
0.7509765625,
-0.25146484375,
0.89013671875,
-0.5322265625,
-0.345947265625,
0.1788330078125,
-0.382568359375,
-0.64306640625,
0.040435791015625,
0.78564453125,
-0.04095458984375,
0.427001953125,
-0.416259765625,
0.1680908203125,
0.045318603515625,
0.255615234375,
-0.375,
-0.642578125,
-0.498046875,
-0.85302734375,
-0.1029052734375,
-0.38916015625,
-0.4658203125,
0.249267578125,
-0.058197021484375,
-0.09716796875,
-0.34814453125,
0.1292724609375,
0.335693359375,
-0.705078125,
0.78857421875,
-0.66552734375,
0.275634765625,
-0.449951171875,
-0.2373046875,
-0.59765625,
-0.1954345703125,
-0.1595458984375,
-0.1458740234375,
-0.669921875,
0.341552734375,
-0.287353515625,
0.34814453125,
-0.2080078125,
0.58935546875,
0.00720977783203125,
-0.47265625,
0.1656494140625,
0.1593017578125,
-0.25439453125,
1.15625,
0.583984375,
-0.031494140625,
0.1171875,
0.08416748046875,
-0.45361328125,
-0.6728515625,
0.705078125,
0.91455078125,
-0.08673095703125,
-0.49658203125,
-0.486328125,
0.330810546875,
-1.0400390625,
0.11083984375,
-0.2216796875,
0.08074951171875,
0.32568359375,
-0.276123046875,
0.30078125,
1.3525390625,
-0.7548828125,
0.5302734375,
0.343017578125,
0.1785888671875,
0.25927734375,
0.6552734375,
-0.0240631103515625,
0.4384765625,
0.474853515625,
-0.09332275390625,
0.14697265625,
0.48486328125,
-0.0067138671875,
0.305908203125,
-0.312255859375,
-0.52490234375,
-0.73681640625,
-0.185302734375,
-0.1756591796875,
0.62060546875,
0.2607421875,
-0.9228515625,
-0.0423583984375,
-0.1446533203125,
-0.53125,
-0.040130615234375,
-1.18359375,
-0.83447265625,
0.75927734375,
-0.0894775390625,
-0.47265625,
-0.147705078125,
-0.389892578125,
-0.52197265625,
-0.049285888671875,
0.42529296875,
-0.53857421875,
0.4599609375,
-0.252685546875,
0.457275390625,
-0.1197509765625,
0.37890625,
0.35498046875,
0.26611328125,
-1.0380859375,
-0.6552734375,
0.3115234375,
1.14453125,
0.0281829833984375,
0.1514892578125,
-0.64013671875,
-0.0406494140625,
-0.27783203125,
-0.167236328125,
-0.2548828125,
0.44873046875,
0.11346435546875,
0.333251953125,
-1.185546875,
0.11907958984375,
-0.275634765625,
0.282958984375,
0.13427734375,
-0.2364501953125,
-0.46337890625,
0.71630859375,
0.845703125,
0.188720703125,
0.69873046875,
0.1282958984375,
1.015625,
-0.1123046875,
-0.14892578125,
-0.44189453125,
0.6767578125,
0.7021484375,
0.312255859375,
-0.441162109375,
0.57080078125,
0.69677734375,
0.1253662109375,
0.1405029296875,
0.390380859375,
0.52099609375,
-0.152587890625,
0.033721923828125,
-0.52783203125,
-0.09637451171875,
0.485107421875,
-0.58984375,
0.2386474609375,
-0.313232421875,
-0.188232421875,
-0.31494140625,
-0.5361328125,
0.59765625,
-0.256103515625,
-0.361572265625,
-0.09796142578125,
-0.337890625,
0.548828125,
0.9697265625,
0.330322265625,
0.188720703125,
1.123046875,
0.5537109375,
0.26708984375,
0.341796875,
0.299072265625,
0.123779296875,
-0.62353515625,
0.344970703125,
0.360595703125,
-0.10784912109375,
-0.47314453125,
-0.224609375,
-1.2177734375,
0.85400390625,
-0.5205078125,
-0.1253662109375,
0.82373046875,
-0.94921875,
-0.2705078125,
-0.64013671875,
0.98486328125,
-0.55224609375,
0.34716796875,
0.2205810546875,
-0.18701171875,
-0.7666015625,
0.71923828125,
-0.155517578125,
0.46044921875,
0.318603515625,
1.0869140625,
-0.0897216796875,
1.25390625,
0.338134765625,
-0.297119140625,
-0.1983642578125,
0.0491943359375,
-0.459716796875,
-0.642578125,
-0.14453125,
-0.362060546875,
0.03192138671875,
-0.822265625,
-0.144287109375,
-0.2257080078125,
0.73388671875,
-0.12396240234375,
-1.05859375,
-0.447509765625,
0.253173828125,
-0.94189453125,
0.51806640625,
-0.060791015625,
0.15625,
0.1925048828125,
-0.2235107421875,
-0.37255859375,
-0.445556640625,
-0.127685546875,
-0.5341796875,
0.87939453125,
-0.399169921875,
-1.033203125,
-0.42578125,
-0.41552734375,
-0.402587890625,
-0.1932373046875,
-0.452880859375,
-0.74755859375,
0.2666015625,
0.68408203125,
0.2449951171875,
0.2392578125,
-0.42236328125,
0.1785888671875,
1.0390625,
0.69873046875,
0.07635498046875,
1.1220703125,
0.006549835205078125,
-0.33056640625,
0.54638671875,
-0.7822265625,
0.54443359375,
-0.1475830078125,
-0.3662109375,
-0.459228515625,
0.319580078125,
-0.9609375,
-1.099609375,
0.37255859375,
0.46923828125,
0.27880859375,
-0.9169921875,
-1.49609375,
-0.206298828125,
-0.9375,
-0.10455322265625,
-0.78271484375,
0.67919921875,
0.445068359375,
-0.2327880859375,
-0.255615234375,
-1.103515625,
4.33984375,
1.12109375,
0.5478515625,
0.367431640625,
0.2073974609375,
0.80224609375,
0.431640625,
-0.62060546875,
-0.472900390625,
-0.57958984375,
0.701171875,
-0.58056640625,
-0.0709228515625,
1.0986328125,
0.478271484375,
0.6484375,
-0.32470703125,
-0.1513671875,
-0.141845703125,
-0.763671875,
-0.94677734375,
0.207275390625,
0.0738525390625,
0.712890625,
0.0638427734375,
0.1370849609375,
0.54931640625,
-0.2398681640625,
-0.5439453125,
-0.88623046875,
-0.046905517578125,
-0.63427734375,
0.82470703125,
0.25390625,
-0.431396484375,
0.5107421875,
-0.2115478515625,
-0.6162109375,
-0.6240234375,
0.1253662109375,
-0.73095703125,
0.1651611328125,
0.49365234375,
-0.70556640625,
-0.301025390625,
0.75341796875,
-0.3076171875,
0.5244140625,
0.297607421875,
-1.013671875,
1.001953125,
-0.078369140625,
0.481201171875,
-0.81298828125,
-0.8916015625,
-0.116943359375,
0.239990234375,
0.061676025390625,
-0.1983642578125,
0.1885986328125,
0.20751953125,
0.301025390625,
-0.08135986328125,
0.68896484375,
-0.98193359375,
0.96728515625,
-0.08367919921875,
0.36083984375,
-0.27734375,
-0.010498046875,
-0.1370849609375,
-0.239013671875,
-0.387451171875,
-0.237548828125,
0.6005859375,
0.5126953125,
-0.260498046875,
0.56982421875,
0.923828125,
-0.66748046875,
0.11053466796875,
-0.271484375,
-0.2147216796875,
0.10955810546875,
0.64599609375,
1.076171875,
-0.572265625,
-0.394287109375,
-0.556640625,
0.70849609375,
0.69384765625,
0.478515625,
-0.037139892578125,
-0.3212890625,
-0.49658203125
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Background
The kindergarten attached to the University of Aizu is a kindergarten where children who love programming gather. Yu, one of the kindergarten children, loves lowercase letters as much as programming. Yu-kun decided to write a scoring program for a new play that uses paper, circles, lines, and lowercase letters.
Problem
Initially, V circles and E lines are drawn on the paper. The circles are numbered from 0 in ascending order, with one lowercase letter or nothing in each circle. Each line connects two different circles. A circle cannot be connected by more than 26 lines.
The play procedure is as follows.
1. Select one circle with nothing written on it. If such a circle does not exist, this process ends.
2. Write one lowercase letter in the circle. However, if the circle is already connected to a circle with lowercase letters by a line, the same lowercase letters as the lowercase letters cannot be written.
3. Return to 1.
After writing lowercase letters in all the circles according to the above procedure, arrange the lowercase letters in the circles in ascending order of the circle numbers to make a character string. I want to minimize the character strings that can be created in this way in lexicographical order. There are two strings s and t of the same length, and s is smaller than t in lexicographical order in the following cases. si represents the i-th lowercase letter of the string s and ti represents the i-th lowercase letter of the string t. For the smallest i where si differs from ti, si is less than ti.
Since the initial state of the paper is given, output the smallest character string that can be created according to the above procedure in lexicographical order.
Constraints
The input satisfies the following conditions.
* 1 β€ V β€ 100,000
* 0 β€ E β€ 200,000
* ai is either lowercase or'?' (0 β€ i β€ V-1)
* 0 β€ si, ti β€ V-1 (si <ti, 0 β€ i β€ E-1)
* One circle cannot be connected by more than 26 lines
Input
V E
a0 a1 ... a (V-1)
s0 t0
s1 t1
...
s (E-1) t (E-1)
The number of circles V and the number of lines E are given on the first line, separated by blanks.
The initial state of the circle is given on the second line, separated by blanks.
If ai is a lowercase letter, the lowercase letter is written in the i-th circle, and if it is'?', It means that nothing is written in the i-th circle.
The line information is given as si ti on the following E line, which means that the si and ti circles are connected by a line.
Output
Output the smallest character string in the dictionary order on one line among the character strings that can be created according to the procedure in the question sentence.
Examples
Input
3 3
c ? ?
0 1
0 2
1 2
Output
cab
Input
3 2
c ? ?
0 1
0 2
Output
caa
Input
7 6
? a ? ? z a ?
0 1
0 2
3 4
4 5
4 6
5 6
Output
baaazab
Input
5 0
? ? ? ? ?
Output
aaaaa
"Correct Solution:
```
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
v, e = map(int, input().split())
a = list(input().split())
g = [[] for _ in range(v)]
for _ in range(e):
s, t = map(int, input().split())
g[s].append(t)
g[t].append(s)
for i in range(v):
if a[i] != '?':
continue
for c in alphabet:
flag = True
for to in g[i]:
if a[to] == c:
flag = False
break
if flag:
a[i] = c
break
print(''.join(a))
```
| 37,704
|
[
0.06219482421875,
0.099853515625,
0.5458984375,
-0.06732177734375,
-0.48486328125,
-0.5625,
0.06536865234375,
0.0662841796875,
-0.37060546875,
0.8330078125,
0.736328125,
-0.03607177734375,
0.1214599609375,
-0.8447265625,
-0.9814453125,
0.286376953125,
-0.783203125,
-0.5322265625,
-0.26611328125,
0.08642578125,
0.13427734375,
0.1732177734375,
-1.4677734375,
-0.18359375,
-0.330322265625,
1.4326171875,
0.43017578125,
0.2337646484375,
1.1318359375,
0.6708984375,
-0.1689453125,
-0.5947265625,
0.447509765625,
-0.81591796875,
-0.4375,
-0.448486328125,
0.51953125,
-0.65087890625,
0.058563232421875,
-0.6591796875,
0.405517578125,
-0.55517578125,
0.62109375,
-0.68408203125,
-1.1826171875,
-0.1234130859375,
-0.2568359375,
-0.280029296875,
0.031494140625,
-0.48193359375,
0.04974365234375,
0.0330810546875,
0.38330078125,
-0.2445068359375,
-0.086181640625,
0.045135498046875,
0.2890625,
-0.328125,
-0.6328125,
0.308837890625,
-0.2208251953125,
0.059173583984375,
0.09405517578125,
-0.1258544921875,
0.055633544921875,
-0.031524658203125,
-0.461669921875,
-0.1796875,
-0.0066986083984375,
-0.221923828125,
-0.306884765625,
0.14453125,
-0.383544921875,
-0.54833984375,
-0.262451171875,
0.0184173583984375,
-0.135498046875,
-0.406494140625,
-0.343994140625,
0.72802734375,
0.128662109375,
1.2255859375,
0.4462890625,
0.34619140625,
-0.2376708984375,
-0.6796875,
0.09283447265625,
0.09149169921875,
0.490478515625,
-0.1512451171875,
0.0950927734375,
0.18798828125,
-0.96728515625,
0.35546875,
0.75732421875,
0.359130859375,
-0.2066650390625,
0.1265869140625,
0.297119140625,
0.316162109375,
0.80859375,
1.091796875,
0.0296783447265625,
1.107421875,
-0.87060546875,
0.2210693359375,
-0.17041015625,
0.03289794921875,
-0.057159423828125,
0.12646484375,
-0.33056640625,
-0.42919921875,
0.304443359375,
0.08966064453125,
-0.344482421875,
0.81005859375,
0.00522613525390625,
0.4501953125,
-0.74609375,
0.3076171875,
0.47119140625,
0.37451171875,
0.31689453125,
-0.260986328125,
0.1434326171875,
-0.03497314453125,
-0.456298828125,
0.720703125,
-0.4765625,
0.0097198486328125,
0.5146484375,
0.036041259765625,
-0.08441162109375,
0.2371826171875,
-0.049530029296875,
0.837890625,
-0.10711669921875,
0.396240234375,
0.9501953125,
-0.471923828125,
0.572265625,
-0.13720703125,
-0.0814208984375,
1.4814453125,
0.56201171875,
-0.0865478515625,
0.0721435546875,
0.497802734375,
-0.9814453125,
0.386474609375,
-0.86767578125,
0.59521484375,
0.58349609375,
0.1436767578125,
-0.161376953125,
0.251708984375,
-0.456787109375,
0.38623046875,
0.3154296875,
0.01593017578125,
-0.52587890625,
0.0650634765625,
-0.17578125,
0.483642578125,
-0.154052734375,
0.79248046875,
-0.262939453125,
-0.425048828125,
-0.1541748046875,
-0.382080078125,
-0.00940704345703125,
-0.0278778076171875,
-0.0810546875,
0.7255859375,
0.5107421875,
0.7099609375,
0.88525390625,
-0.25927734375,
0.2030029296875,
0.241455078125,
-0.36474609375,
0.40380859375,
0.2587890625,
0.7490234375,
0.308837890625,
0.5146484375,
-0.04400634765625,
-0.60888671875,
-0.92822265625,
-0.412841796875,
0.1204833984375,
0.51513671875,
-0.402587890625,
0.5087890625,
0.12030029296875,
0.061859130859375,
-0.71435546875,
0.04693603515625,
0.2318115234375,
-0.76708984375,
-0.48291015625,
0.65185546875,
-0.482177734375,
0.15234375,
-0.31982421875,
-0.365478515625,
0.1473388671875,
1.1025390625,
-0.4130859375,
-0.25439453125,
0.04779052734375,
0.030609130859375,
-0.185302734375,
0.2393798828125,
-0.02423095703125,
-0.0213165283203125,
-0.340087890625,
0.435302734375,
-0.216552734375,
-0.152099609375,
0.328369140625,
0.7470703125,
0.264404296875,
0.52392578125,
-0.94677734375,
-0.1795654296875,
0.431396484375,
0.779296875,
0.08380126953125,
0.279052734375,
0.2099609375,
0.9296875,
0.6259765625,
0.6162109375,
0.488037109375,
-0.05316162109375,
0.56298828125,
0.7294921875,
-0.259521484375,
0.210205078125,
-0.0124969482421875,
0.429931640625,
0.325927734375,
0.7802734375,
-0.026092529296875,
0.460693359375,
-0.404052734375,
0.21923828125,
-0.62353515625,
0.160400390625,
-0.623046875,
0.8115234375,
0.08026123046875,
0.30322265625,
-0.5673828125,
-0.2408447265625,
-0.140869140625,
0.462890625,
-0.8037109375,
-0.70361328125,
0.050079345703125,
0.154052734375,
0.37255859375,
-0.08551025390625,
0.1956787109375,
0.359130859375,
0.77587890625,
0.2188720703125,
0.0693359375,
-0.35546875,
-1.013671875,
-0.53759765625,
-0.9755859375,
-0.060211181640625,
-0.51025390625,
-0.0245208740234375,
0.56982421875,
-0.92529296875,
0.76416015625,
-0.303955078125,
-0.1956787109375,
-0.27734375,
-0.6572265625,
0.64306640625,
-0.031982421875,
0.626953125,
-0.701171875,
0.3203125,
-0.213623046875,
0.83349609375,
-0.63330078125,
-0.084228515625,
-0.390380859375,
-0.385986328125,
0.775390625,
0.10589599609375,
0.6572265625,
-0.0802001953125,
-0.434326171875,
-1.2197265625,
-0.33642578125,
-0.2734375,
-0.366455078125,
0.476806640625,
-0.68017578125,
0.7158203125,
0.17529296875,
-0.91748046875,
0.3427734375,
0.43310546875,
-0.9130859375,
0.5986328125,
0.186279296875,
0.07135009765625,
-0.79736328125,
1.3544921875,
0.34814453125,
-0.08953857421875,
-0.31640625,
-0.650390625,
-0.200439453125,
0.2296142578125,
0.12115478515625,
-0.408447265625,
-0.06756591796875,
0.61669921875,
0.29638671875,
-1.017578125,
0.7109375,
-0.9130859375,
-0.62353515625,
-0.316162109375,
-0.55712890625,
0.61865234375,
0.346923828125,
0.09698486328125,
-0.31298828125,
-0.46875,
-0.21923828125,
0.6826171875,
0.62451171875,
-0.77783203125,
-0.0009074211120605469,
0.4384765625,
-0.08258056640625,
0.33349609375,
0.488525390625,
-0.360107421875,
-0.058197021484375,
-0.218017578125,
0.118896484375,
0.255859375,
0.280029296875,
0.08135986328125,
0.07464599609375,
0.49853515625,
-0.77099609375,
-0.51220703125,
-0.411865234375,
0.79443359375,
0.257568359375,
0.53857421875,
0.61474609375,
-0.0257720947265625,
-0.428466796875,
-1.5029296875,
0.85009765625,
0.007328033447265625,
0.85595703125,
-0.56103515625,
0.7890625,
0.31494140625,
-0.7861328125,
0.5,
-0.58056640625,
0.0362548828125,
1.0185546875,
0.160400390625,
0.82666015625,
-0.5703125,
-0.09100341796875,
-0.24951171875,
-0.30712890625,
0.59521484375,
0.397705078125,
0.537109375,
-0.10308837890625,
-0.03656005859375,
-0.2099609375,
-0.3359375,
-0.01461029052734375,
-0.48095703125,
0.317138671875,
-0.50146484375,
-0.266357421875,
-0.65771484375,
0.25732421875,
1.0361328125,
0.6416015625,
0.316162109375,
0.7841796875,
-0.1668701171875,
0.330810546875,
0.78173828125,
-0.418212890625,
-0.0811767578125,
-0.60107421875,
0.74658203125,
0.36865234375,
-0.456298828125,
-0.28759765625,
-0.451171875,
-0.17724609375,
-0.1966552734375,
0.1268310546875,
-0.025360107421875,
-0.96142578125,
0.052642822265625,
-0.1292724609375,
0.6484375,
-0.8447265625,
-0.411865234375,
-0.5263671875,
0.65966796875,
0.368896484375,
-0.8193359375,
0.1885986328125,
-0.69677734375,
0.485595703125,
0.174072265625,
-0.156005859375,
-0.533203125,
-0.5947265625,
-0.931640625,
-0.53125,
0.290283203125,
0.97314453125,
0.029388427734375,
0.378662109375,
-0.87646484375,
0.5400390625,
0.53173828125,
-0.09149169921875,
0.200439453125,
0.28662109375,
0.44677734375,
0.10601806640625,
0.55908203125,
-0.615234375,
-0.6259765625,
0.098876953125,
-1.08203125,
0.34130859375,
-0.305419921875,
0.56689453125,
-0.1322021484375,
-0.36279296875,
-0.11151123046875,
0.44482421875,
-0.42138671875,
0.01435089111328125,
-0.051422119140625,
0.537109375,
-0.93798828125,
-0.74462890625,
0.4072265625,
-0.22265625,
0.1533203125,
0.8544921875,
-0.120849609375,
-0.46337890625,
0.243408203125,
0.219482421875,
-0.348876953125,
0.456787109375,
-0.18408203125,
0.2200927734375,
-0.310546875,
-0.197509765625,
0.31201171875,
-0.06842041015625,
0.82275390625,
-0.491943359375,
-0.70703125,
-0.2403564453125,
-0.91357421875,
-0.03094482421875,
-0.10113525390625,
-0.8056640625,
0.33837890625,
-0.05645751953125,
-0.281494140625,
-0.2088623046875,
-0.2432861328125,
-0.4931640625,
-0.185791015625,
-0.521484375,
-0.4345703125,
0.1397705078125,
0.4794921875,
0.31103515625,
0.390625,
-0.8017578125,
-0.1141357421875,
-0.146484375,
0.0638427734375,
-0.1114501953125,
-0.01364898681640625,
-0.343994140625,
-0.490966796875,
-0.1002197265625,
0.6708984375,
0.3486328125,
0.4296875,
0.3173828125,
0.45361328125,
0.322998046875,
0.1531982421875,
-0.70556640625,
0.80224609375,
0.018951416015625,
-0.65234375,
-0.58935546875,
0.69873046875,
-0.1531982421875,
0.5205078125,
-0.049346923828125,
-0.482177734375,
-0.6162109375,
-1.0986328125,
0.413818359375,
-0.373046875,
-0.3740234375,
-0.69775390625,
-0.2103271484375,
-0.2529296875,
0.478515625,
-0.34521484375,
-0.55908203125,
0.0716552734375,
-1.2763671875,
-0.0242767333984375,
-0.419677734375,
-0.198486328125,
-0.564453125,
-0.360595703125,
-0.36962890625,
0.9140625,
0.150146484375,
0.1949462890625,
0.083251953125,
-0.12451171875,
0.51220703125,
-0.1517333984375,
-0.837890625,
-0.501953125,
-0.1849365234375,
0.1358642578125,
0.02288818359375,
0.162353515625,
-0.157470703125,
0.96240234375,
-0.69091796875,
0.0281982421875,
-0.333984375,
-0.31982421875,
-0.039581298828125,
-0.376220703125,
1.3466796875,
-0.40478515625,
0.1937255859375,
-0.37353515625,
0.541015625,
0.491943359375,
-0.1534423828125,
-0.1497802734375,
-0.8076171875,
-0.39697265625,
-0.72265625,
0.5546875,
-0.348388671875,
0.0221099853515625,
-0.61328125,
-0.2176513671875,
1.0859375,
-0.486083984375,
0.3935546875,
0.89111328125,
0.163330078125,
0.46923828125,
-0.8564453125,
0.41650390625,
0.248291015625,
-0.486083984375,
-0.358154296875,
0.10382080078125,
-0.7724609375,
0.27197265625,
-0.1982421875,
-0.97900390625,
-0.93017578125,
0.9599609375,
1.1552734375,
-0.38671875,
0.97509765625,
-0.294677734375,
-1.1669921875,
-0.18212890625,
0.783203125,
-0.357421875,
0.267822265625,
0.60302734375,
-0.484375,
-0.214111328125,
0.413818359375,
0.06512451171875,
-0.47119140625,
-0.319091796875,
1.2509765625,
-0.5185546875,
-0.77685546875,
0.73681640625,
0.86083984375,
-0.85595703125,
-0.58837890625,
-0.372802734375,
-0.1512451171875,
-0.037322998046875,
-0.79052734375,
0.1568603515625,
0.53515625,
-0.475830078125,
0.1510009765625,
0.53466796875,
-0.36767578125,
0.814453125,
0.16162109375,
0.061492919921875,
-0.67138671875,
0.439697265625,
0.498779296875,
-0.3291015625,
-0.1424560546875,
-0.65380859375,
-0.275634765625,
-0.2266845703125,
0.009857177734375,
0.716796875,
-0.01178741455078125,
-0.4130859375,
0.91650390625,
-0.289306640625,
0.736328125,
-0.55126953125,
-0.041259765625,
-0.225830078125,
-0.58740234375,
-0.74072265625,
-0.33056640625,
0.08563232421875,
-0.2408447265625,
0.27001953125,
-0.962890625,
-0.14892578125,
-0.032501220703125,
0.48779296875,
-0.327880859375,
-0.6865234375,
-0.23291015625,
-0.70849609375,
-0.316650390625,
-0.4951171875,
-0.599609375,
-0.276611328125,
0.1668701171875,
0.3349609375,
-0.52783203125,
0.56884765625,
0.477294921875,
-0.4306640625,
0.9013671875,
-0.8212890625,
0.01483154296875,
-0.2802734375,
-0.1220703125,
-0.615234375,
0.037689208984375,
-0.458740234375,
0.09832763671875,
-0.73583984375,
0.41015625,
-0.1319580078125,
0.305908203125,
-0.157958984375,
0.1304931640625,
-0.037261962890625,
-0.47802734375,
0.205322265625,
0.1187744140625,
-0.50146484375,
0.7783203125,
0.331787109375,
0.05950927734375,
-0.00464630126953125,
-0.30322265625,
-0.41845703125,
-0.181396484375,
0.7587890625,
0.66259765625,
-0.247314453125,
-0.1407470703125,
0.13232421875,
0.1485595703125,
-0.98974609375,
0.2470703125,
-0.226318359375,
-0.141845703125,
0.147705078125,
-0.262939453125,
0.51171875,
1.2421875,
-0.2646484375,
0.320556640625,
0.0044708251953125,
-0.2294921875,
0.416015625,
0.0966796875,
-0.32763671875,
0.75634765625,
0.2235107421875,
-0.431640625,
-0.203369140625,
0.25830078125,
0.0643310546875,
0.6591796875,
-0.1160888671875,
-0.5537109375,
-1.119140625,
-0.226806640625,
-0.09649658203125,
0.66748046875,
0.352783203125,
-0.97412109375,
-0.0124664306640625,
-0.478515625,
-0.50244140625,
0.32861328125,
-1.197265625,
-1.2666015625,
0.1595458984375,
0.132568359375,
-0.083251953125,
0.1346435546875,
-0.284912109375,
-0.1746826171875,
0.2135009765625,
0.359130859375,
-0.57666015625,
0.3662109375,
0.08001708984375,
0.380615234375,
-0.365234375,
-0.33837890625,
0.416748046875,
0.82275390625,
-0.2327880859375,
-0.348388671875,
0.347900390625,
0.8349609375,
0.241455078125,
0.0908203125,
-0.2249755859375,
0.2264404296875,
0.0408935546875,
0.27734375,
-0.09490966796875,
0.1092529296875,
-0.51416015625,
0.73876953125,
-0.9228515625,
0.038055419921875,
-0.040496826171875,
0.697265625,
-0.0804443359375,
-0.2486572265625,
-0.4931640625,
0.68603515625,
0.73486328125,
0.37841796875,
0.5537109375,
-0.053131103515625,
0.6689453125,
-0.141357421875,
-0.01995849609375,
-0.35693359375,
0.338623046875,
0.1304931640625,
0.5849609375,
0.1324462890625,
0.7509765625,
0.7890625,
-0.0972900390625,
-0.2724609375,
0.6376953125,
0.00647735595703125,
-0.07000732421875,
-0.073486328125,
-0.2337646484375,
-0.14599609375,
0.3056640625,
-0.5224609375,
0.509765625,
-0.470458984375,
-0.09521484375,
0.054473876953125,
-0.28369140625,
0.85986328125,
-0.39111328125,
-0.1468505859375,
0.0273895263671875,
-0.5966796875,
0.328369140625,
0.308349609375,
0.426025390625,
0.343017578125,
0.8408203125,
0.4443359375,
0.19677734375,
0.65625,
0.6611328125,
0.47607421875,
-0.705078125,
0.2003173828125,
0.0258636474609375,
-0.434326171875,
-0.173828125,
-0.19970703125,
-0.47119140625,
0.517578125,
-0.0207977294921875,
-0.443115234375,
0.3330078125,
-0.7939453125,
-0.366943359375,
-0.38720703125,
0.62939453125,
-0.55859375,
0.51708984375,
0.473388671875,
-0.3642578125,
-0.55859375,
1.09765625,
0.11370849609375,
0.2464599609375,
0.67919921875,
0.46630859375,
0.322021484375,
1.484375,
0.51806640625,
-0.049285888671875,
0.1424560546875,
0.234130859375,
-0.417724609375,
-0.65966796875,
-0.11663818359375,
-0.474365234375,
-0.0838623046875,
-0.81640625,
-0.2161865234375,
-0.286865234375,
0.482421875,
0.048004150390625,
-0.77001953125,
-0.06866455078125,
0.305419921875,
-0.72705078125,
0.309814453125,
0.1080322265625,
0.0288543701171875,
0.1298828125,
0.285888671875,
-0.053497314453125,
-0.428466796875,
-0.08233642578125,
-0.473876953125,
0.21435546875,
-0.79638671875,
-0.35009765625,
-0.76171875,
-0.59912109375,
-0.303955078125,
-0.0625,
-0.4111328125,
-1.0107421875,
0.46142578125,
0.44580078125,
0.56787109375,
0.300048828125,
-0.25146484375,
0.169189453125,
0.8251953125,
0.90625,
0.11236572265625,
0.4482421875,
0.203125,
-0.033416748046875,
0.24267578125,
-0.2587890625,
0.303955078125,
-0.478271484375,
0.491943359375,
-0.366943359375,
0.2296142578125,
-0.293212890625,
-1.3271484375,
-0.396484375,
-0.1475830078125,
0.461669921875,
-0.370361328125,
-0.95263671875,
-0.356689453125,
-0.91748046875,
-0.04632568359375,
-0.79443359375,
0.65478515625,
-0.040740966796875,
0.11029052734375,
-0.18359375,
-1.068359375,
4.6015625,
0.73583984375,
0.8828125,
0.1822509765625,
0.282958984375,
1.0693359375,
0.2452392578125,
-0.79248046875,
-0.1334228515625,
-0.32568359375,
0.481201171875,
-0.08929443359375,
0.3349609375,
0.99267578125,
0.447021484375,
0.71484375,
-0.771484375,
-0.127197265625,
0.144287109375,
-1.0634765625,
-0.88525390625,
0.2059326171875,
-0.225341796875,
0.0994873046875,
-0.20068359375,
0.2288818359375,
0.60595703125,
-1.0390625,
-0.390380859375,
-0.452392578125,
-0.11480712890625,
-0.89501953125,
0.63671875,
-0.3740234375,
-0.09149169921875,
0.416748046875,
-0.1693115234375,
-0.609375,
-0.1875,
0.491455078125,
-0.08270263671875,
0.210693359375,
0.5615234375,
-0.6923828125,
-0.0000699162483215332,
0.1624755859375,
-0.48095703125,
0.2017822265625,
-0.08465576171875,
-0.958984375,
0.90283203125,
-0.483642578125,
0.317626953125,
0.08984375,
-1.0654296875,
0.276611328125,
0.0699462890625,
-0.248046875,
-0.047119140625,
0.78466796875,
0.321533203125,
0.1434326171875,
-0.12176513671875,
0.5185546875,
-1.326171875,
0.541015625,
-0.239013671875,
0.294677734375,
-0.473876953125,
0.296630859375,
-0.06805419921875,
-0.0831298828125,
-0.424072265625,
-0.0439453125,
0.75341796875,
0.058135986328125,
-0.45263671875,
0.3193359375,
0.469482421875,
-0.58154296875,
0.406982421875,
-0.01438140869140625,
-0.355712890625,
-0.265380859375,
0.5390625,
1.0888671875,
-0.66455078125,
-0.74267578125,
-0.2724609375,
0.497314453125,
0.580078125,
0.53662109375,
0.401123046875,
-0.4345703125,
-0.233154296875
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Background
The kindergarten attached to the University of Aizu is a kindergarten where children who love programming gather. Yu, one of the kindergarten children, loves lowercase letters as much as programming. Yu-kun decided to write a scoring program for a new play that uses paper, circles, lines, and lowercase letters.
Problem
Initially, V circles and E lines are drawn on the paper. The circles are numbered from 0 in ascending order, with one lowercase letter or nothing in each circle. Each line connects two different circles. A circle cannot be connected by more than 26 lines.
The play procedure is as follows.
1. Select one circle with nothing written on it. If such a circle does not exist, this process ends.
2. Write one lowercase letter in the circle. However, if the circle is already connected to a circle with lowercase letters by a line, the same lowercase letters as the lowercase letters cannot be written.
3. Return to 1.
After writing lowercase letters in all the circles according to the above procedure, arrange the lowercase letters in the circles in ascending order of the circle numbers to make a character string. I want to minimize the character strings that can be created in this way in lexicographical order. There are two strings s and t of the same length, and s is smaller than t in lexicographical order in the following cases. si represents the i-th lowercase letter of the string s and ti represents the i-th lowercase letter of the string t. For the smallest i where si differs from ti, si is less than ti.
Since the initial state of the paper is given, output the smallest character string that can be created according to the above procedure in lexicographical order.
Constraints
The input satisfies the following conditions.
* 1 β€ V β€ 100,000
* 0 β€ E β€ 200,000
* ai is either lowercase or'?' (0 β€ i β€ V-1)
* 0 β€ si, ti β€ V-1 (si <ti, 0 β€ i β€ E-1)
* One circle cannot be connected by more than 26 lines
Input
V E
a0 a1 ... a (V-1)
s0 t0
s1 t1
...
s (E-1) t (E-1)
The number of circles V and the number of lines E are given on the first line, separated by blanks.
The initial state of the circle is given on the second line, separated by blanks.
If ai is a lowercase letter, the lowercase letter is written in the i-th circle, and if it is'?', It means that nothing is written in the i-th circle.
The line information is given as si ti on the following E line, which means that the si and ti circles are connected by a line.
Output
Output the smallest character string in the dictionary order on one line among the character strings that can be created according to the procedure in the question sentence.
Examples
Input
3 3
c ? ?
0 1
0 2
1 2
Output
cab
Input
3 2
c ? ?
0 1
0 2
Output
caa
Input
7 6
? a ? ? z a ?
0 1
0 2
3 4
4 5
4 6
5 6
Output
baaazab
Input
5 0
? ? ? ? ?
Output
aaaaa
"Correct Solution:
```
v, e = map(int, input().split())
a_lst = input().split()
edges = [[] for _ in range(v)]
for _ in range(e):
s, t = map(int, input().split())
edges[s].append(t)
edges[t].append(s)
for i in range(v):
if "a" <= a_lst[i] <= "z": continue
lst = {i for i in range(26)}
for fr in edges[i]:
lst.discard(ord(a_lst[fr]) - ord("a"))
a_lst[i] = chr(min(lst) + ord("a"))
print("".join(a_lst))
```
| 37,705
|
[
0.06219482421875,
0.099853515625,
0.5458984375,
-0.06732177734375,
-0.48486328125,
-0.5625,
0.06536865234375,
0.0662841796875,
-0.37060546875,
0.8330078125,
0.736328125,
-0.03607177734375,
0.1214599609375,
-0.8447265625,
-0.9814453125,
0.286376953125,
-0.783203125,
-0.5322265625,
-0.26611328125,
0.08642578125,
0.13427734375,
0.1732177734375,
-1.4677734375,
-0.18359375,
-0.330322265625,
1.4326171875,
0.43017578125,
0.2337646484375,
1.1318359375,
0.6708984375,
-0.1689453125,
-0.5947265625,
0.447509765625,
-0.81591796875,
-0.4375,
-0.448486328125,
0.51953125,
-0.65087890625,
0.058563232421875,
-0.6591796875,
0.405517578125,
-0.55517578125,
0.62109375,
-0.68408203125,
-1.1826171875,
-0.1234130859375,
-0.2568359375,
-0.280029296875,
0.031494140625,
-0.48193359375,
0.04974365234375,
0.0330810546875,
0.38330078125,
-0.2445068359375,
-0.086181640625,
0.045135498046875,
0.2890625,
-0.328125,
-0.6328125,
0.308837890625,
-0.2208251953125,
0.059173583984375,
0.09405517578125,
-0.1258544921875,
0.055633544921875,
-0.031524658203125,
-0.461669921875,
-0.1796875,
-0.0066986083984375,
-0.221923828125,
-0.306884765625,
0.14453125,
-0.383544921875,
-0.54833984375,
-0.262451171875,
0.0184173583984375,
-0.135498046875,
-0.406494140625,
-0.343994140625,
0.72802734375,
0.128662109375,
1.2255859375,
0.4462890625,
0.34619140625,
-0.2376708984375,
-0.6796875,
0.09283447265625,
0.09149169921875,
0.490478515625,
-0.1512451171875,
0.0950927734375,
0.18798828125,
-0.96728515625,
0.35546875,
0.75732421875,
0.359130859375,
-0.2066650390625,
0.1265869140625,
0.297119140625,
0.316162109375,
0.80859375,
1.091796875,
0.0296783447265625,
1.107421875,
-0.87060546875,
0.2210693359375,
-0.17041015625,
0.03289794921875,
-0.057159423828125,
0.12646484375,
-0.33056640625,
-0.42919921875,
0.304443359375,
0.08966064453125,
-0.344482421875,
0.81005859375,
0.00522613525390625,
0.4501953125,
-0.74609375,
0.3076171875,
0.47119140625,
0.37451171875,
0.31689453125,
-0.260986328125,
0.1434326171875,
-0.03497314453125,
-0.456298828125,
0.720703125,
-0.4765625,
0.0097198486328125,
0.5146484375,
0.036041259765625,
-0.08441162109375,
0.2371826171875,
-0.049530029296875,
0.837890625,
-0.10711669921875,
0.396240234375,
0.9501953125,
-0.471923828125,
0.572265625,
-0.13720703125,
-0.0814208984375,
1.4814453125,
0.56201171875,
-0.0865478515625,
0.0721435546875,
0.497802734375,
-0.9814453125,
0.386474609375,
-0.86767578125,
0.59521484375,
0.58349609375,
0.1436767578125,
-0.161376953125,
0.251708984375,
-0.456787109375,
0.38623046875,
0.3154296875,
0.01593017578125,
-0.52587890625,
0.0650634765625,
-0.17578125,
0.483642578125,
-0.154052734375,
0.79248046875,
-0.262939453125,
-0.425048828125,
-0.1541748046875,
-0.382080078125,
-0.00940704345703125,
-0.0278778076171875,
-0.0810546875,
0.7255859375,
0.5107421875,
0.7099609375,
0.88525390625,
-0.25927734375,
0.2030029296875,
0.241455078125,
-0.36474609375,
0.40380859375,
0.2587890625,
0.7490234375,
0.308837890625,
0.5146484375,
-0.04400634765625,
-0.60888671875,
-0.92822265625,
-0.412841796875,
0.1204833984375,
0.51513671875,
-0.402587890625,
0.5087890625,
0.12030029296875,
0.061859130859375,
-0.71435546875,
0.04693603515625,
0.2318115234375,
-0.76708984375,
-0.48291015625,
0.65185546875,
-0.482177734375,
0.15234375,
-0.31982421875,
-0.365478515625,
0.1473388671875,
1.1025390625,
-0.4130859375,
-0.25439453125,
0.04779052734375,
0.030609130859375,
-0.185302734375,
0.2393798828125,
-0.02423095703125,
-0.0213165283203125,
-0.340087890625,
0.435302734375,
-0.216552734375,
-0.152099609375,
0.328369140625,
0.7470703125,
0.264404296875,
0.52392578125,
-0.94677734375,
-0.1795654296875,
0.431396484375,
0.779296875,
0.08380126953125,
0.279052734375,
0.2099609375,
0.9296875,
0.6259765625,
0.6162109375,
0.488037109375,
-0.05316162109375,
0.56298828125,
0.7294921875,
-0.259521484375,
0.210205078125,
-0.0124969482421875,
0.429931640625,
0.325927734375,
0.7802734375,
-0.026092529296875,
0.460693359375,
-0.404052734375,
0.21923828125,
-0.62353515625,
0.160400390625,
-0.623046875,
0.8115234375,
0.08026123046875,
0.30322265625,
-0.5673828125,
-0.2408447265625,
-0.140869140625,
0.462890625,
-0.8037109375,
-0.70361328125,
0.050079345703125,
0.154052734375,
0.37255859375,
-0.08551025390625,
0.1956787109375,
0.359130859375,
0.77587890625,
0.2188720703125,
0.0693359375,
-0.35546875,
-1.013671875,
-0.53759765625,
-0.9755859375,
-0.060211181640625,
-0.51025390625,
-0.0245208740234375,
0.56982421875,
-0.92529296875,
0.76416015625,
-0.303955078125,
-0.1956787109375,
-0.27734375,
-0.6572265625,
0.64306640625,
-0.031982421875,
0.626953125,
-0.701171875,
0.3203125,
-0.213623046875,
0.83349609375,
-0.63330078125,
-0.084228515625,
-0.390380859375,
-0.385986328125,
0.775390625,
0.10589599609375,
0.6572265625,
-0.0802001953125,
-0.434326171875,
-1.2197265625,
-0.33642578125,
-0.2734375,
-0.366455078125,
0.476806640625,
-0.68017578125,
0.7158203125,
0.17529296875,
-0.91748046875,
0.3427734375,
0.43310546875,
-0.9130859375,
0.5986328125,
0.186279296875,
0.07135009765625,
-0.79736328125,
1.3544921875,
0.34814453125,
-0.08953857421875,
-0.31640625,
-0.650390625,
-0.200439453125,
0.2296142578125,
0.12115478515625,
-0.408447265625,
-0.06756591796875,
0.61669921875,
0.29638671875,
-1.017578125,
0.7109375,
-0.9130859375,
-0.62353515625,
-0.316162109375,
-0.55712890625,
0.61865234375,
0.346923828125,
0.09698486328125,
-0.31298828125,
-0.46875,
-0.21923828125,
0.6826171875,
0.62451171875,
-0.77783203125,
-0.0009074211120605469,
0.4384765625,
-0.08258056640625,
0.33349609375,
0.488525390625,
-0.360107421875,
-0.058197021484375,
-0.218017578125,
0.118896484375,
0.255859375,
0.280029296875,
0.08135986328125,
0.07464599609375,
0.49853515625,
-0.77099609375,
-0.51220703125,
-0.411865234375,
0.79443359375,
0.257568359375,
0.53857421875,
0.61474609375,
-0.0257720947265625,
-0.428466796875,
-1.5029296875,
0.85009765625,
0.007328033447265625,
0.85595703125,
-0.56103515625,
0.7890625,
0.31494140625,
-0.7861328125,
0.5,
-0.58056640625,
0.0362548828125,
1.0185546875,
0.160400390625,
0.82666015625,
-0.5703125,
-0.09100341796875,
-0.24951171875,
-0.30712890625,
0.59521484375,
0.397705078125,
0.537109375,
-0.10308837890625,
-0.03656005859375,
-0.2099609375,
-0.3359375,
-0.01461029052734375,
-0.48095703125,
0.317138671875,
-0.50146484375,
-0.266357421875,
-0.65771484375,
0.25732421875,
1.0361328125,
0.6416015625,
0.316162109375,
0.7841796875,
-0.1668701171875,
0.330810546875,
0.78173828125,
-0.418212890625,
-0.0811767578125,
-0.60107421875,
0.74658203125,
0.36865234375,
-0.456298828125,
-0.28759765625,
-0.451171875,
-0.17724609375,
-0.1966552734375,
0.1268310546875,
-0.025360107421875,
-0.96142578125,
0.052642822265625,
-0.1292724609375,
0.6484375,
-0.8447265625,
-0.411865234375,
-0.5263671875,
0.65966796875,
0.368896484375,
-0.8193359375,
0.1885986328125,
-0.69677734375,
0.485595703125,
0.174072265625,
-0.156005859375,
-0.533203125,
-0.5947265625,
-0.931640625,
-0.53125,
0.290283203125,
0.97314453125,
0.029388427734375,
0.378662109375,
-0.87646484375,
0.5400390625,
0.53173828125,
-0.09149169921875,
0.200439453125,
0.28662109375,
0.44677734375,
0.10601806640625,
0.55908203125,
-0.615234375,
-0.6259765625,
0.098876953125,
-1.08203125,
0.34130859375,
-0.305419921875,
0.56689453125,
-0.1322021484375,
-0.36279296875,
-0.11151123046875,
0.44482421875,
-0.42138671875,
0.01435089111328125,
-0.051422119140625,
0.537109375,
-0.93798828125,
-0.74462890625,
0.4072265625,
-0.22265625,
0.1533203125,
0.8544921875,
-0.120849609375,
-0.46337890625,
0.243408203125,
0.219482421875,
-0.348876953125,
0.456787109375,
-0.18408203125,
0.2200927734375,
-0.310546875,
-0.197509765625,
0.31201171875,
-0.06842041015625,
0.82275390625,
-0.491943359375,
-0.70703125,
-0.2403564453125,
-0.91357421875,
-0.03094482421875,
-0.10113525390625,
-0.8056640625,
0.33837890625,
-0.05645751953125,
-0.281494140625,
-0.2088623046875,
-0.2432861328125,
-0.4931640625,
-0.185791015625,
-0.521484375,
-0.4345703125,
0.1397705078125,
0.4794921875,
0.31103515625,
0.390625,
-0.8017578125,
-0.1141357421875,
-0.146484375,
0.0638427734375,
-0.1114501953125,
-0.01364898681640625,
-0.343994140625,
-0.490966796875,
-0.1002197265625,
0.6708984375,
0.3486328125,
0.4296875,
0.3173828125,
0.45361328125,
0.322998046875,
0.1531982421875,
-0.70556640625,
0.80224609375,
0.018951416015625,
-0.65234375,
-0.58935546875,
0.69873046875,
-0.1531982421875,
0.5205078125,
-0.049346923828125,
-0.482177734375,
-0.6162109375,
-1.0986328125,
0.413818359375,
-0.373046875,
-0.3740234375,
-0.69775390625,
-0.2103271484375,
-0.2529296875,
0.478515625,
-0.34521484375,
-0.55908203125,
0.0716552734375,
-1.2763671875,
-0.0242767333984375,
-0.419677734375,
-0.198486328125,
-0.564453125,
-0.360595703125,
-0.36962890625,
0.9140625,
0.150146484375,
0.1949462890625,
0.083251953125,
-0.12451171875,
0.51220703125,
-0.1517333984375,
-0.837890625,
-0.501953125,
-0.1849365234375,
0.1358642578125,
0.02288818359375,
0.162353515625,
-0.157470703125,
0.96240234375,
-0.69091796875,
0.0281982421875,
-0.333984375,
-0.31982421875,
-0.039581298828125,
-0.376220703125,
1.3466796875,
-0.40478515625,
0.1937255859375,
-0.37353515625,
0.541015625,
0.491943359375,
-0.1534423828125,
-0.1497802734375,
-0.8076171875,
-0.39697265625,
-0.72265625,
0.5546875,
-0.348388671875,
0.0221099853515625,
-0.61328125,
-0.2176513671875,
1.0859375,
-0.486083984375,
0.3935546875,
0.89111328125,
0.163330078125,
0.46923828125,
-0.8564453125,
0.41650390625,
0.248291015625,
-0.486083984375,
-0.358154296875,
0.10382080078125,
-0.7724609375,
0.27197265625,
-0.1982421875,
-0.97900390625,
-0.93017578125,
0.9599609375,
1.1552734375,
-0.38671875,
0.97509765625,
-0.294677734375,
-1.1669921875,
-0.18212890625,
0.783203125,
-0.357421875,
0.267822265625,
0.60302734375,
-0.484375,
-0.214111328125,
0.413818359375,
0.06512451171875,
-0.47119140625,
-0.319091796875,
1.2509765625,
-0.5185546875,
-0.77685546875,
0.73681640625,
0.86083984375,
-0.85595703125,
-0.58837890625,
-0.372802734375,
-0.1512451171875,
-0.037322998046875,
-0.79052734375,
0.1568603515625,
0.53515625,
-0.475830078125,
0.1510009765625,
0.53466796875,
-0.36767578125,
0.814453125,
0.16162109375,
0.061492919921875,
-0.67138671875,
0.439697265625,
0.498779296875,
-0.3291015625,
-0.1424560546875,
-0.65380859375,
-0.275634765625,
-0.2266845703125,
0.009857177734375,
0.716796875,
-0.01178741455078125,
-0.4130859375,
0.91650390625,
-0.289306640625,
0.736328125,
-0.55126953125,
-0.041259765625,
-0.225830078125,
-0.58740234375,
-0.74072265625,
-0.33056640625,
0.08563232421875,
-0.2408447265625,
0.27001953125,
-0.962890625,
-0.14892578125,
-0.032501220703125,
0.48779296875,
-0.327880859375,
-0.6865234375,
-0.23291015625,
-0.70849609375,
-0.316650390625,
-0.4951171875,
-0.599609375,
-0.276611328125,
0.1668701171875,
0.3349609375,
-0.52783203125,
0.56884765625,
0.477294921875,
-0.4306640625,
0.9013671875,
-0.8212890625,
0.01483154296875,
-0.2802734375,
-0.1220703125,
-0.615234375,
0.037689208984375,
-0.458740234375,
0.09832763671875,
-0.73583984375,
0.41015625,
-0.1319580078125,
0.305908203125,
-0.157958984375,
0.1304931640625,
-0.037261962890625,
-0.47802734375,
0.205322265625,
0.1187744140625,
-0.50146484375,
0.7783203125,
0.331787109375,
0.05950927734375,
-0.00464630126953125,
-0.30322265625,
-0.41845703125,
-0.181396484375,
0.7587890625,
0.66259765625,
-0.247314453125,
-0.1407470703125,
0.13232421875,
0.1485595703125,
-0.98974609375,
0.2470703125,
-0.226318359375,
-0.141845703125,
0.147705078125,
-0.262939453125,
0.51171875,
1.2421875,
-0.2646484375,
0.320556640625,
0.0044708251953125,
-0.2294921875,
0.416015625,
0.0966796875,
-0.32763671875,
0.75634765625,
0.2235107421875,
-0.431640625,
-0.203369140625,
0.25830078125,
0.0643310546875,
0.6591796875,
-0.1160888671875,
-0.5537109375,
-1.119140625,
-0.226806640625,
-0.09649658203125,
0.66748046875,
0.352783203125,
-0.97412109375,
-0.0124664306640625,
-0.478515625,
-0.50244140625,
0.32861328125,
-1.197265625,
-1.2666015625,
0.1595458984375,
0.132568359375,
-0.083251953125,
0.1346435546875,
-0.284912109375,
-0.1746826171875,
0.2135009765625,
0.359130859375,
-0.57666015625,
0.3662109375,
0.08001708984375,
0.380615234375,
-0.365234375,
-0.33837890625,
0.416748046875,
0.82275390625,
-0.2327880859375,
-0.348388671875,
0.347900390625,
0.8349609375,
0.241455078125,
0.0908203125,
-0.2249755859375,
0.2264404296875,
0.0408935546875,
0.27734375,
-0.09490966796875,
0.1092529296875,
-0.51416015625,
0.73876953125,
-0.9228515625,
0.038055419921875,
-0.040496826171875,
0.697265625,
-0.0804443359375,
-0.2486572265625,
-0.4931640625,
0.68603515625,
0.73486328125,
0.37841796875,
0.5537109375,
-0.053131103515625,
0.6689453125,
-0.141357421875,
-0.01995849609375,
-0.35693359375,
0.338623046875,
0.1304931640625,
0.5849609375,
0.1324462890625,
0.7509765625,
0.7890625,
-0.0972900390625,
-0.2724609375,
0.6376953125,
0.00647735595703125,
-0.07000732421875,
-0.073486328125,
-0.2337646484375,
-0.14599609375,
0.3056640625,
-0.5224609375,
0.509765625,
-0.470458984375,
-0.09521484375,
0.054473876953125,
-0.28369140625,
0.85986328125,
-0.39111328125,
-0.1468505859375,
0.0273895263671875,
-0.5966796875,
0.328369140625,
0.308349609375,
0.426025390625,
0.343017578125,
0.8408203125,
0.4443359375,
0.19677734375,
0.65625,
0.6611328125,
0.47607421875,
-0.705078125,
0.2003173828125,
0.0258636474609375,
-0.434326171875,
-0.173828125,
-0.19970703125,
-0.47119140625,
0.517578125,
-0.0207977294921875,
-0.443115234375,
0.3330078125,
-0.7939453125,
-0.366943359375,
-0.38720703125,
0.62939453125,
-0.55859375,
0.51708984375,
0.473388671875,
-0.3642578125,
-0.55859375,
1.09765625,
0.11370849609375,
0.2464599609375,
0.67919921875,
0.46630859375,
0.322021484375,
1.484375,
0.51806640625,
-0.049285888671875,
0.1424560546875,
0.234130859375,
-0.417724609375,
-0.65966796875,
-0.11663818359375,
-0.474365234375,
-0.0838623046875,
-0.81640625,
-0.2161865234375,
-0.286865234375,
0.482421875,
0.048004150390625,
-0.77001953125,
-0.06866455078125,
0.305419921875,
-0.72705078125,
0.309814453125,
0.1080322265625,
0.0288543701171875,
0.1298828125,
0.285888671875,
-0.053497314453125,
-0.428466796875,
-0.08233642578125,
-0.473876953125,
0.21435546875,
-0.79638671875,
-0.35009765625,
-0.76171875,
-0.59912109375,
-0.303955078125,
-0.0625,
-0.4111328125,
-1.0107421875,
0.46142578125,
0.44580078125,
0.56787109375,
0.300048828125,
-0.25146484375,
0.169189453125,
0.8251953125,
0.90625,
0.11236572265625,
0.4482421875,
0.203125,
-0.033416748046875,
0.24267578125,
-0.2587890625,
0.303955078125,
-0.478271484375,
0.491943359375,
-0.366943359375,
0.2296142578125,
-0.293212890625,
-1.3271484375,
-0.396484375,
-0.1475830078125,
0.461669921875,
-0.370361328125,
-0.95263671875,
-0.356689453125,
-0.91748046875,
-0.04632568359375,
-0.79443359375,
0.65478515625,
-0.040740966796875,
0.11029052734375,
-0.18359375,
-1.068359375,
4.6015625,
0.73583984375,
0.8828125,
0.1822509765625,
0.282958984375,
1.0693359375,
0.2452392578125,
-0.79248046875,
-0.1334228515625,
-0.32568359375,
0.481201171875,
-0.08929443359375,
0.3349609375,
0.99267578125,
0.447021484375,
0.71484375,
-0.771484375,
-0.127197265625,
0.144287109375,
-1.0634765625,
-0.88525390625,
0.2059326171875,
-0.225341796875,
0.0994873046875,
-0.20068359375,
0.2288818359375,
0.60595703125,
-1.0390625,
-0.390380859375,
-0.452392578125,
-0.11480712890625,
-0.89501953125,
0.63671875,
-0.3740234375,
-0.09149169921875,
0.416748046875,
-0.1693115234375,
-0.609375,
-0.1875,
0.491455078125,
-0.08270263671875,
0.210693359375,
0.5615234375,
-0.6923828125,
-0.0000699162483215332,
0.1624755859375,
-0.48095703125,
0.2017822265625,
-0.08465576171875,
-0.958984375,
0.90283203125,
-0.483642578125,
0.317626953125,
0.08984375,
-1.0654296875,
0.276611328125,
0.0699462890625,
-0.248046875,
-0.047119140625,
0.78466796875,
0.321533203125,
0.1434326171875,
-0.12176513671875,
0.5185546875,
-1.326171875,
0.541015625,
-0.239013671875,
0.294677734375,
-0.473876953125,
0.296630859375,
-0.06805419921875,
-0.0831298828125,
-0.424072265625,
-0.0439453125,
0.75341796875,
0.058135986328125,
-0.45263671875,
0.3193359375,
0.469482421875,
-0.58154296875,
0.406982421875,
-0.01438140869140625,
-0.355712890625,
-0.265380859375,
0.5390625,
1.0888671875,
-0.66455078125,
-0.74267578125,
-0.2724609375,
0.497314453125,
0.580078125,
0.53662109375,
0.401123046875,
-0.4345703125,
-0.233154296875
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Background
The kindergarten attached to the University of Aizu is a kindergarten where children who love programming gather. Yu, one of the kindergarten children, loves lowercase letters as much as programming. Yu-kun decided to write a scoring program for a new play that uses paper, circles, lines, and lowercase letters.
Problem
Initially, V circles and E lines are drawn on the paper. The circles are numbered from 0 in ascending order, with one lowercase letter or nothing in each circle. Each line connects two different circles. A circle cannot be connected by more than 26 lines.
The play procedure is as follows.
1. Select one circle with nothing written on it. If such a circle does not exist, this process ends.
2. Write one lowercase letter in the circle. However, if the circle is already connected to a circle with lowercase letters by a line, the same lowercase letters as the lowercase letters cannot be written.
3. Return to 1.
After writing lowercase letters in all the circles according to the above procedure, arrange the lowercase letters in the circles in ascending order of the circle numbers to make a character string. I want to minimize the character strings that can be created in this way in lexicographical order. There are two strings s and t of the same length, and s is smaller than t in lexicographical order in the following cases. si represents the i-th lowercase letter of the string s and ti represents the i-th lowercase letter of the string t. For the smallest i where si differs from ti, si is less than ti.
Since the initial state of the paper is given, output the smallest character string that can be created according to the above procedure in lexicographical order.
Constraints
The input satisfies the following conditions.
* 1 β€ V β€ 100,000
* 0 β€ E β€ 200,000
* ai is either lowercase or'?' (0 β€ i β€ V-1)
* 0 β€ si, ti β€ V-1 (si <ti, 0 β€ i β€ E-1)
* One circle cannot be connected by more than 26 lines
Input
V E
a0 a1 ... a (V-1)
s0 t0
s1 t1
...
s (E-1) t (E-1)
The number of circles V and the number of lines E are given on the first line, separated by blanks.
The initial state of the circle is given on the second line, separated by blanks.
If ai is a lowercase letter, the lowercase letter is written in the i-th circle, and if it is'?', It means that nothing is written in the i-th circle.
The line information is given as si ti on the following E line, which means that the si and ti circles are connected by a line.
Output
Output the smallest character string in the dictionary order on one line among the character strings that can be created according to the procedure in the question sentence.
Examples
Input
3 3
c ? ?
0 1
0 2
1 2
Output
cab
Input
3 2
c ? ?
0 1
0 2
Output
caa
Input
7 6
? a ? ? z a ?
0 1
0 2
3 4
4 5
4 6
5 6
Output
baaazab
Input
5 0
? ? ? ? ?
Output
aaaaa
"Correct Solution:
```
V_, E_ = map(int, input().split())
A = input().split()
E = [[] for _ in range(V_)]
Used = [[False]*26 for _ in range(V_)]
for _ in range(E_):
s, t = map(int, input().split())
As, At = A[s], A[t]
if As != "?":
Used[t][ord(As)-97] = True
if At != "?":
Used[s][ord(At)-97] = True
E[s].append(t)
E[t].append(s)
for i, a in enumerate(A):
if a == "?":
for j in range(26):
if not Used[i][j]:
A[i] = chr(j + 97)
for u in E[i]:
Used[u][j] = True
break
print("".join(A))
```
| 37,706
|
[
0.06219482421875,
0.099853515625,
0.5458984375,
-0.06732177734375,
-0.48486328125,
-0.5625,
0.06536865234375,
0.0662841796875,
-0.37060546875,
0.8330078125,
0.736328125,
-0.03607177734375,
0.1214599609375,
-0.8447265625,
-0.9814453125,
0.286376953125,
-0.783203125,
-0.5322265625,
-0.26611328125,
0.08642578125,
0.13427734375,
0.1732177734375,
-1.4677734375,
-0.18359375,
-0.330322265625,
1.4326171875,
0.43017578125,
0.2337646484375,
1.1318359375,
0.6708984375,
-0.1689453125,
-0.5947265625,
0.447509765625,
-0.81591796875,
-0.4375,
-0.448486328125,
0.51953125,
-0.65087890625,
0.058563232421875,
-0.6591796875,
0.405517578125,
-0.55517578125,
0.62109375,
-0.68408203125,
-1.1826171875,
-0.1234130859375,
-0.2568359375,
-0.280029296875,
0.031494140625,
-0.48193359375,
0.04974365234375,
0.0330810546875,
0.38330078125,
-0.2445068359375,
-0.086181640625,
0.045135498046875,
0.2890625,
-0.328125,
-0.6328125,
0.308837890625,
-0.2208251953125,
0.059173583984375,
0.09405517578125,
-0.1258544921875,
0.055633544921875,
-0.031524658203125,
-0.461669921875,
-0.1796875,
-0.0066986083984375,
-0.221923828125,
-0.306884765625,
0.14453125,
-0.383544921875,
-0.54833984375,
-0.262451171875,
0.0184173583984375,
-0.135498046875,
-0.406494140625,
-0.343994140625,
0.72802734375,
0.128662109375,
1.2255859375,
0.4462890625,
0.34619140625,
-0.2376708984375,
-0.6796875,
0.09283447265625,
0.09149169921875,
0.490478515625,
-0.1512451171875,
0.0950927734375,
0.18798828125,
-0.96728515625,
0.35546875,
0.75732421875,
0.359130859375,
-0.2066650390625,
0.1265869140625,
0.297119140625,
0.316162109375,
0.80859375,
1.091796875,
0.0296783447265625,
1.107421875,
-0.87060546875,
0.2210693359375,
-0.17041015625,
0.03289794921875,
-0.057159423828125,
0.12646484375,
-0.33056640625,
-0.42919921875,
0.304443359375,
0.08966064453125,
-0.344482421875,
0.81005859375,
0.00522613525390625,
0.4501953125,
-0.74609375,
0.3076171875,
0.47119140625,
0.37451171875,
0.31689453125,
-0.260986328125,
0.1434326171875,
-0.03497314453125,
-0.456298828125,
0.720703125,
-0.4765625,
0.0097198486328125,
0.5146484375,
0.036041259765625,
-0.08441162109375,
0.2371826171875,
-0.049530029296875,
0.837890625,
-0.10711669921875,
0.396240234375,
0.9501953125,
-0.471923828125,
0.572265625,
-0.13720703125,
-0.0814208984375,
1.4814453125,
0.56201171875,
-0.0865478515625,
0.0721435546875,
0.497802734375,
-0.9814453125,
0.386474609375,
-0.86767578125,
0.59521484375,
0.58349609375,
0.1436767578125,
-0.161376953125,
0.251708984375,
-0.456787109375,
0.38623046875,
0.3154296875,
0.01593017578125,
-0.52587890625,
0.0650634765625,
-0.17578125,
0.483642578125,
-0.154052734375,
0.79248046875,
-0.262939453125,
-0.425048828125,
-0.1541748046875,
-0.382080078125,
-0.00940704345703125,
-0.0278778076171875,
-0.0810546875,
0.7255859375,
0.5107421875,
0.7099609375,
0.88525390625,
-0.25927734375,
0.2030029296875,
0.241455078125,
-0.36474609375,
0.40380859375,
0.2587890625,
0.7490234375,
0.308837890625,
0.5146484375,
-0.04400634765625,
-0.60888671875,
-0.92822265625,
-0.412841796875,
0.1204833984375,
0.51513671875,
-0.402587890625,
0.5087890625,
0.12030029296875,
0.061859130859375,
-0.71435546875,
0.04693603515625,
0.2318115234375,
-0.76708984375,
-0.48291015625,
0.65185546875,
-0.482177734375,
0.15234375,
-0.31982421875,
-0.365478515625,
0.1473388671875,
1.1025390625,
-0.4130859375,
-0.25439453125,
0.04779052734375,
0.030609130859375,
-0.185302734375,
0.2393798828125,
-0.02423095703125,
-0.0213165283203125,
-0.340087890625,
0.435302734375,
-0.216552734375,
-0.152099609375,
0.328369140625,
0.7470703125,
0.264404296875,
0.52392578125,
-0.94677734375,
-0.1795654296875,
0.431396484375,
0.779296875,
0.08380126953125,
0.279052734375,
0.2099609375,
0.9296875,
0.6259765625,
0.6162109375,
0.488037109375,
-0.05316162109375,
0.56298828125,
0.7294921875,
-0.259521484375,
0.210205078125,
-0.0124969482421875,
0.429931640625,
0.325927734375,
0.7802734375,
-0.026092529296875,
0.460693359375,
-0.404052734375,
0.21923828125,
-0.62353515625,
0.160400390625,
-0.623046875,
0.8115234375,
0.08026123046875,
0.30322265625,
-0.5673828125,
-0.2408447265625,
-0.140869140625,
0.462890625,
-0.8037109375,
-0.70361328125,
0.050079345703125,
0.154052734375,
0.37255859375,
-0.08551025390625,
0.1956787109375,
0.359130859375,
0.77587890625,
0.2188720703125,
0.0693359375,
-0.35546875,
-1.013671875,
-0.53759765625,
-0.9755859375,
-0.060211181640625,
-0.51025390625,
-0.0245208740234375,
0.56982421875,
-0.92529296875,
0.76416015625,
-0.303955078125,
-0.1956787109375,
-0.27734375,
-0.6572265625,
0.64306640625,
-0.031982421875,
0.626953125,
-0.701171875,
0.3203125,
-0.213623046875,
0.83349609375,
-0.63330078125,
-0.084228515625,
-0.390380859375,
-0.385986328125,
0.775390625,
0.10589599609375,
0.6572265625,
-0.0802001953125,
-0.434326171875,
-1.2197265625,
-0.33642578125,
-0.2734375,
-0.366455078125,
0.476806640625,
-0.68017578125,
0.7158203125,
0.17529296875,
-0.91748046875,
0.3427734375,
0.43310546875,
-0.9130859375,
0.5986328125,
0.186279296875,
0.07135009765625,
-0.79736328125,
1.3544921875,
0.34814453125,
-0.08953857421875,
-0.31640625,
-0.650390625,
-0.200439453125,
0.2296142578125,
0.12115478515625,
-0.408447265625,
-0.06756591796875,
0.61669921875,
0.29638671875,
-1.017578125,
0.7109375,
-0.9130859375,
-0.62353515625,
-0.316162109375,
-0.55712890625,
0.61865234375,
0.346923828125,
0.09698486328125,
-0.31298828125,
-0.46875,
-0.21923828125,
0.6826171875,
0.62451171875,
-0.77783203125,
-0.0009074211120605469,
0.4384765625,
-0.08258056640625,
0.33349609375,
0.488525390625,
-0.360107421875,
-0.058197021484375,
-0.218017578125,
0.118896484375,
0.255859375,
0.280029296875,
0.08135986328125,
0.07464599609375,
0.49853515625,
-0.77099609375,
-0.51220703125,
-0.411865234375,
0.79443359375,
0.257568359375,
0.53857421875,
0.61474609375,
-0.0257720947265625,
-0.428466796875,
-1.5029296875,
0.85009765625,
0.007328033447265625,
0.85595703125,
-0.56103515625,
0.7890625,
0.31494140625,
-0.7861328125,
0.5,
-0.58056640625,
0.0362548828125,
1.0185546875,
0.160400390625,
0.82666015625,
-0.5703125,
-0.09100341796875,
-0.24951171875,
-0.30712890625,
0.59521484375,
0.397705078125,
0.537109375,
-0.10308837890625,
-0.03656005859375,
-0.2099609375,
-0.3359375,
-0.01461029052734375,
-0.48095703125,
0.317138671875,
-0.50146484375,
-0.266357421875,
-0.65771484375,
0.25732421875,
1.0361328125,
0.6416015625,
0.316162109375,
0.7841796875,
-0.1668701171875,
0.330810546875,
0.78173828125,
-0.418212890625,
-0.0811767578125,
-0.60107421875,
0.74658203125,
0.36865234375,
-0.456298828125,
-0.28759765625,
-0.451171875,
-0.17724609375,
-0.1966552734375,
0.1268310546875,
-0.025360107421875,
-0.96142578125,
0.052642822265625,
-0.1292724609375,
0.6484375,
-0.8447265625,
-0.411865234375,
-0.5263671875,
0.65966796875,
0.368896484375,
-0.8193359375,
0.1885986328125,
-0.69677734375,
0.485595703125,
0.174072265625,
-0.156005859375,
-0.533203125,
-0.5947265625,
-0.931640625,
-0.53125,
0.290283203125,
0.97314453125,
0.029388427734375,
0.378662109375,
-0.87646484375,
0.5400390625,
0.53173828125,
-0.09149169921875,
0.200439453125,
0.28662109375,
0.44677734375,
0.10601806640625,
0.55908203125,
-0.615234375,
-0.6259765625,
0.098876953125,
-1.08203125,
0.34130859375,
-0.305419921875,
0.56689453125,
-0.1322021484375,
-0.36279296875,
-0.11151123046875,
0.44482421875,
-0.42138671875,
0.01435089111328125,
-0.051422119140625,
0.537109375,
-0.93798828125,
-0.74462890625,
0.4072265625,
-0.22265625,
0.1533203125,
0.8544921875,
-0.120849609375,
-0.46337890625,
0.243408203125,
0.219482421875,
-0.348876953125,
0.456787109375,
-0.18408203125,
0.2200927734375,
-0.310546875,
-0.197509765625,
0.31201171875,
-0.06842041015625,
0.82275390625,
-0.491943359375,
-0.70703125,
-0.2403564453125,
-0.91357421875,
-0.03094482421875,
-0.10113525390625,
-0.8056640625,
0.33837890625,
-0.05645751953125,
-0.281494140625,
-0.2088623046875,
-0.2432861328125,
-0.4931640625,
-0.185791015625,
-0.521484375,
-0.4345703125,
0.1397705078125,
0.4794921875,
0.31103515625,
0.390625,
-0.8017578125,
-0.1141357421875,
-0.146484375,
0.0638427734375,
-0.1114501953125,
-0.01364898681640625,
-0.343994140625,
-0.490966796875,
-0.1002197265625,
0.6708984375,
0.3486328125,
0.4296875,
0.3173828125,
0.45361328125,
0.322998046875,
0.1531982421875,
-0.70556640625,
0.80224609375,
0.018951416015625,
-0.65234375,
-0.58935546875,
0.69873046875,
-0.1531982421875,
0.5205078125,
-0.049346923828125,
-0.482177734375,
-0.6162109375,
-1.0986328125,
0.413818359375,
-0.373046875,
-0.3740234375,
-0.69775390625,
-0.2103271484375,
-0.2529296875,
0.478515625,
-0.34521484375,
-0.55908203125,
0.0716552734375,
-1.2763671875,
-0.0242767333984375,
-0.419677734375,
-0.198486328125,
-0.564453125,
-0.360595703125,
-0.36962890625,
0.9140625,
0.150146484375,
0.1949462890625,
0.083251953125,
-0.12451171875,
0.51220703125,
-0.1517333984375,
-0.837890625,
-0.501953125,
-0.1849365234375,
0.1358642578125,
0.02288818359375,
0.162353515625,
-0.157470703125,
0.96240234375,
-0.69091796875,
0.0281982421875,
-0.333984375,
-0.31982421875,
-0.039581298828125,
-0.376220703125,
1.3466796875,
-0.40478515625,
0.1937255859375,
-0.37353515625,
0.541015625,
0.491943359375,
-0.1534423828125,
-0.1497802734375,
-0.8076171875,
-0.39697265625,
-0.72265625,
0.5546875,
-0.348388671875,
0.0221099853515625,
-0.61328125,
-0.2176513671875,
1.0859375,
-0.486083984375,
0.3935546875,
0.89111328125,
0.163330078125,
0.46923828125,
-0.8564453125,
0.41650390625,
0.248291015625,
-0.486083984375,
-0.358154296875,
0.10382080078125,
-0.7724609375,
0.27197265625,
-0.1982421875,
-0.97900390625,
-0.93017578125,
0.9599609375,
1.1552734375,
-0.38671875,
0.97509765625,
-0.294677734375,
-1.1669921875,
-0.18212890625,
0.783203125,
-0.357421875,
0.267822265625,
0.60302734375,
-0.484375,
-0.214111328125,
0.413818359375,
0.06512451171875,
-0.47119140625,
-0.319091796875,
1.2509765625,
-0.5185546875,
-0.77685546875,
0.73681640625,
0.86083984375,
-0.85595703125,
-0.58837890625,
-0.372802734375,
-0.1512451171875,
-0.037322998046875,
-0.79052734375,
0.1568603515625,
0.53515625,
-0.475830078125,
0.1510009765625,
0.53466796875,
-0.36767578125,
0.814453125,
0.16162109375,
0.061492919921875,
-0.67138671875,
0.439697265625,
0.498779296875,
-0.3291015625,
-0.1424560546875,
-0.65380859375,
-0.275634765625,
-0.2266845703125,
0.009857177734375,
0.716796875,
-0.01178741455078125,
-0.4130859375,
0.91650390625,
-0.289306640625,
0.736328125,
-0.55126953125,
-0.041259765625,
-0.225830078125,
-0.58740234375,
-0.74072265625,
-0.33056640625,
0.08563232421875,
-0.2408447265625,
0.27001953125,
-0.962890625,
-0.14892578125,
-0.032501220703125,
0.48779296875,
-0.327880859375,
-0.6865234375,
-0.23291015625,
-0.70849609375,
-0.316650390625,
-0.4951171875,
-0.599609375,
-0.276611328125,
0.1668701171875,
0.3349609375,
-0.52783203125,
0.56884765625,
0.477294921875,
-0.4306640625,
0.9013671875,
-0.8212890625,
0.01483154296875,
-0.2802734375,
-0.1220703125,
-0.615234375,
0.037689208984375,
-0.458740234375,
0.09832763671875,
-0.73583984375,
0.41015625,
-0.1319580078125,
0.305908203125,
-0.157958984375,
0.1304931640625,
-0.037261962890625,
-0.47802734375,
0.205322265625,
0.1187744140625,
-0.50146484375,
0.7783203125,
0.331787109375,
0.05950927734375,
-0.00464630126953125,
-0.30322265625,
-0.41845703125,
-0.181396484375,
0.7587890625,
0.66259765625,
-0.247314453125,
-0.1407470703125,
0.13232421875,
0.1485595703125,
-0.98974609375,
0.2470703125,
-0.226318359375,
-0.141845703125,
0.147705078125,
-0.262939453125,
0.51171875,
1.2421875,
-0.2646484375,
0.320556640625,
0.0044708251953125,
-0.2294921875,
0.416015625,
0.0966796875,
-0.32763671875,
0.75634765625,
0.2235107421875,
-0.431640625,
-0.203369140625,
0.25830078125,
0.0643310546875,
0.6591796875,
-0.1160888671875,
-0.5537109375,
-1.119140625,
-0.226806640625,
-0.09649658203125,
0.66748046875,
0.352783203125,
-0.97412109375,
-0.0124664306640625,
-0.478515625,
-0.50244140625,
0.32861328125,
-1.197265625,
-1.2666015625,
0.1595458984375,
0.132568359375,
-0.083251953125,
0.1346435546875,
-0.284912109375,
-0.1746826171875,
0.2135009765625,
0.359130859375,
-0.57666015625,
0.3662109375,
0.08001708984375,
0.380615234375,
-0.365234375,
-0.33837890625,
0.416748046875,
0.82275390625,
-0.2327880859375,
-0.348388671875,
0.347900390625,
0.8349609375,
0.241455078125,
0.0908203125,
-0.2249755859375,
0.2264404296875,
0.0408935546875,
0.27734375,
-0.09490966796875,
0.1092529296875,
-0.51416015625,
0.73876953125,
-0.9228515625,
0.038055419921875,
-0.040496826171875,
0.697265625,
-0.0804443359375,
-0.2486572265625,
-0.4931640625,
0.68603515625,
0.73486328125,
0.37841796875,
0.5537109375,
-0.053131103515625,
0.6689453125,
-0.141357421875,
-0.01995849609375,
-0.35693359375,
0.338623046875,
0.1304931640625,
0.5849609375,
0.1324462890625,
0.7509765625,
0.7890625,
-0.0972900390625,
-0.2724609375,
0.6376953125,
0.00647735595703125,
-0.07000732421875,
-0.073486328125,
-0.2337646484375,
-0.14599609375,
0.3056640625,
-0.5224609375,
0.509765625,
-0.470458984375,
-0.09521484375,
0.054473876953125,
-0.28369140625,
0.85986328125,
-0.39111328125,
-0.1468505859375,
0.0273895263671875,
-0.5966796875,
0.328369140625,
0.308349609375,
0.426025390625,
0.343017578125,
0.8408203125,
0.4443359375,
0.19677734375,
0.65625,
0.6611328125,
0.47607421875,
-0.705078125,
0.2003173828125,
0.0258636474609375,
-0.434326171875,
-0.173828125,
-0.19970703125,
-0.47119140625,
0.517578125,
-0.0207977294921875,
-0.443115234375,
0.3330078125,
-0.7939453125,
-0.366943359375,
-0.38720703125,
0.62939453125,
-0.55859375,
0.51708984375,
0.473388671875,
-0.3642578125,
-0.55859375,
1.09765625,
0.11370849609375,
0.2464599609375,
0.67919921875,
0.46630859375,
0.322021484375,
1.484375,
0.51806640625,
-0.049285888671875,
0.1424560546875,
0.234130859375,
-0.417724609375,
-0.65966796875,
-0.11663818359375,
-0.474365234375,
-0.0838623046875,
-0.81640625,
-0.2161865234375,
-0.286865234375,
0.482421875,
0.048004150390625,
-0.77001953125,
-0.06866455078125,
0.305419921875,
-0.72705078125,
0.309814453125,
0.1080322265625,
0.0288543701171875,
0.1298828125,
0.285888671875,
-0.053497314453125,
-0.428466796875,
-0.08233642578125,
-0.473876953125,
0.21435546875,
-0.79638671875,
-0.35009765625,
-0.76171875,
-0.59912109375,
-0.303955078125,
-0.0625,
-0.4111328125,
-1.0107421875,
0.46142578125,
0.44580078125,
0.56787109375,
0.300048828125,
-0.25146484375,
0.169189453125,
0.8251953125,
0.90625,
0.11236572265625,
0.4482421875,
0.203125,
-0.033416748046875,
0.24267578125,
-0.2587890625,
0.303955078125,
-0.478271484375,
0.491943359375,
-0.366943359375,
0.2296142578125,
-0.293212890625,
-1.3271484375,
-0.396484375,
-0.1475830078125,
0.461669921875,
-0.370361328125,
-0.95263671875,
-0.356689453125,
-0.91748046875,
-0.04632568359375,
-0.79443359375,
0.65478515625,
-0.040740966796875,
0.11029052734375,
-0.18359375,
-1.068359375,
4.6015625,
0.73583984375,
0.8828125,
0.1822509765625,
0.282958984375,
1.0693359375,
0.2452392578125,
-0.79248046875,
-0.1334228515625,
-0.32568359375,
0.481201171875,
-0.08929443359375,
0.3349609375,
0.99267578125,
0.447021484375,
0.71484375,
-0.771484375,
-0.127197265625,
0.144287109375,
-1.0634765625,
-0.88525390625,
0.2059326171875,
-0.225341796875,
0.0994873046875,
-0.20068359375,
0.2288818359375,
0.60595703125,
-1.0390625,
-0.390380859375,
-0.452392578125,
-0.11480712890625,
-0.89501953125,
0.63671875,
-0.3740234375,
-0.09149169921875,
0.416748046875,
-0.1693115234375,
-0.609375,
-0.1875,
0.491455078125,
-0.08270263671875,
0.210693359375,
0.5615234375,
-0.6923828125,
-0.0000699162483215332,
0.1624755859375,
-0.48095703125,
0.2017822265625,
-0.08465576171875,
-0.958984375,
0.90283203125,
-0.483642578125,
0.317626953125,
0.08984375,
-1.0654296875,
0.276611328125,
0.0699462890625,
-0.248046875,
-0.047119140625,
0.78466796875,
0.321533203125,
0.1434326171875,
-0.12176513671875,
0.5185546875,
-1.326171875,
0.541015625,
-0.239013671875,
0.294677734375,
-0.473876953125,
0.296630859375,
-0.06805419921875,
-0.0831298828125,
-0.424072265625,
-0.0439453125,
0.75341796875,
0.058135986328125,
-0.45263671875,
0.3193359375,
0.469482421875,
-0.58154296875,
0.406982421875,
-0.01438140869140625,
-0.355712890625,
-0.265380859375,
0.5390625,
1.0888671875,
-0.66455078125,
-0.74267578125,
-0.2724609375,
0.497314453125,
0.580078125,
0.53662109375,
0.401123046875,
-0.4345703125,
-0.233154296875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules:
* There are three parts of speech: the adjective, the noun, the verb. Each word in his language is an adjective, noun or verb.
* There are two genders: masculine and feminine. Each word in his language has gender either masculine or feminine.
* Masculine adjectives end with -lios, and feminine adjectives end with -liala.
* Masculine nouns end with -etr, and feminime nouns end with -etra.
* Masculine verbs end with -initis, and feminime verbs end with -inites.
* Thus, each word in the Petya's language has one of the six endings, given above. There are no other endings in Petya's language.
* It is accepted that the whole word consists of an ending. That is, words "lios", "liala", "etr" and so on belong to the Petya's language.
* There aren't any punctuation marks, grammatical tenses, singular/plural forms or other language complications.
* A sentence is either exactly one valid language word or exactly one statement.
Statement is any sequence of the Petya's language, that satisfy both conditions:
* Words in statement follow in the following order (from the left to the right): zero or more adjectives followed by exactly one noun followed by zero or more verbs.
* All words in the statement should have the same gender.
After Petya's friend Vasya wrote instant messenger (an instant messaging program) that supported the Petya's language, Petya wanted to add spelling and grammar checking to the program. As Vasya was in the country and Petya didn't feel like waiting, he asked you to help him with this problem. Your task is to define by a given sequence of words, whether it is true that the given text represents exactly one sentence in Petya's language.
Input
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105.
It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that given words do not belong to the Petya's language.
Output
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
Examples
Input
petr
Output
YES
Input
etis atis animatis etis atis amatis
Output
NO
Input
nataliala kataliala vetra feinites
Output
YES
Tags: implementation, strings
Correct Solution:
```
words = [c for c in input().split()]
verdict = True
category = ["" for i in range(len(words))]
gender = ["" for i in range(len(words))]
for i in range(len(words)):
if (not verdict): break
if (len(words[i]) < 3): verdict = False
elif (words[i][-3:] == "etr"):
category[i] = "noun"
gender[i] = "male"
elif (len(words[i]) >= 4 and words[i][-4:] == "etra"):
category[i] = "noun"
gender[i] = "female"
elif ((len(words[i]) >= 4 and words[i][-4:] == "lios")):
category[i] = "adjective"
gender[i] = "male"
elif (len(words[i]) >= 5 and words[i][-5:] == "liala"):
category[i] = "adjective"
gender[i] = "female"
elif (len(words[i]) >= 6):
category[i] = "verb"
if (words[i][-6:] == "initis"): gender[i] = "male"
elif (words[i][-6:] == "inites"): gender[i] = "female"
else: verdict = False
else: verdict = False
first_noun = -1
for i in range(len(category)):
if (not verdict): break
if (category[i] == "noun"):
first_noun = i
break
if (first_noun == -1 and len(words) > 1): verdict = False
elif (first_noun != -1 and verdict):
left, right = first_noun - 1, first_noun + 1
while (left >= 0 and category[left] == "adjective" and gender[left] == gender[first_noun]): left -= 1
while (right < len(category) and category[right] == "verb" and gender[right] == gender[first_noun]): right += 1
if (left >= 0 or right < len(category)): verdict = False
print(("NO" if (not verdict) else "YES"))
```
| 37,810
|
[
0.1558837890625,
-0.245361328125,
-0.1279296875,
0.40234375,
-0.451171875,
-0.431884765625,
0.00937652587890625,
0.347412109375,
-0.0406494140625,
0.2293701171875,
0.552734375,
0.050140380859375,
0.34423828125,
-0.7294921875,
-0.599609375,
0.0022335052490234375,
-0.45556640625,
-0.96337890625,
-0.75390625,
0.357177734375,
0.2152099609375,
-0.1925048828125,
-1.8642578125,
-0.024169921875,
-0.83349609375,
0.92578125,
0.3037109375,
0.452880859375,
1.2314453125,
0.90185546875,
-0.08343505859375,
0.10675048828125,
0.34814453125,
-0.8017578125,
-0.101806640625,
-0.1014404296875,
0.52587890625,
-0.61328125,
-0.448974609375,
-0.73291015625,
0.6865234375,
-0.408447265625,
0.63916015625,
-0.62060546875,
-0.9765625,
0.043731689453125,
-0.11480712890625,
-0.59912109375,
-0.0966796875,
-0.1199951171875,
0.44189453125,
-0.283447265625,
0.494140625,
-0.006664276123046875,
0.036468505859375,
-0.4130859375,
-0.07489013671875,
0.367919921875,
-0.8662109375,
0.017578125,
0.07562255859375,
0.5517578125,
-0.16943359375,
-0.70751953125,
-0.055084228515625,
0.312255859375,
0.301513671875,
0.0322265625,
-0.033935546875,
-0.71484375,
-0.268310546875,
0.2147216796875,
-0.4365234375,
-0.6630859375,
-0.720703125,
0.103759765625,
0.39697265625,
-0.139404296875,
-0.4921875,
0.363037109375,
0.356201171875,
1.2451171875,
0.4140625,
0.1302490234375,
-0.71337890625,
-0.85107421875,
0.04351806640625,
0.685546875,
-0.0295257568359375,
-0.1343994140625,
-0.11444091796875,
0.1513671875,
-0.48876953125,
-0.01142120361328125,
0.828125,
0.57177734375,
-0.1781005859375,
0.3095703125,
0.10687255859375,
0.1456298828125,
0.62939453125,
0.91455078125,
-0.2109375,
1.056640625,
-0.759765625,
-0.07684326171875,
0.4384765625,
0.1461181640625,
-0.0298309326171875,
-0.267822265625,
-0.247802734375,
0.0219268798828125,
0.52587890625,
0.324951171875,
-0.35595703125,
0.91162109375,
-0.418212890625,
-0.046295166015625,
-1.185546875,
-0.038543701171875,
0.51953125,
-0.11981201171875,
0.47216796875,
-0.54541015625,
0.27783203125,
-0.619140625,
-0.285400390625,
0.998046875,
-0.8427734375,
-0.67333984375,
0.183349609375,
-0.054656982421875,
0.0938720703125,
0.308349609375,
-0.033233642578125,
0.47705078125,
-0.34033203125,
0.798828125,
1.0498046875,
-1.029296875,
0.62158203125,
0.07025146484375,
-0.14111328125,
1.404296875,
0.4150390625,
0.1348876953125,
0.6572265625,
0.1959228515625,
-0.87158203125,
0.341552734375,
-0.90673828125,
0.59423828125,
0.2000732421875,
0.283203125,
-0.4697265625,
-0.0141448974609375,
0.23486328125,
0.2427978515625,
0.2998046875,
-0.08953857421875,
-0.55517578125,
0.03289794921875,
-0.482666015625,
0.92333984375,
-0.338623046875,
0.45849609375,
-0.229736328125,
-0.482421875,
-0.07025146484375,
-0.5947265625,
0.1763916015625,
-0.334716796875,
-0.2017822265625,
0.7607421875,
0.66064453125,
1.30078125,
0.74853515625,
-0.2340087890625,
-0.00614166259765625,
-0.2457275390625,
-0.2861328125,
-0.036773681640625,
0.1883544921875,
0.78857421875,
0.59716796875,
-0.1661376953125,
0.17041015625,
-0.2900390625,
-0.515625,
-0.7021484375,
-0.080078125,
0.6103515625,
-0.5576171875,
0.2900390625,
0.24951171875,
0.59521484375,
-0.83740234375,
0.283935546875,
-0.09722900390625,
-0.8125,
-0.455810546875,
1.01171875,
-0.32373046875,
0.5390625,
-0.12255859375,
-0.65771484375,
-0.055419921875,
1.25390625,
-0.412841796875,
0.0280914306640625,
0.830078125,
0.245361328125,
-0.50439453125,
-0.431396484375,
0.037384033203125,
-0.583984375,
-0.8330078125,
0.85791015625,
-0.5888671875,
0.060302734375,
0.279052734375,
0.583984375,
0.1282958984375,
0.222412109375,
-0.043731689453125,
-0.46044921875,
0.3603515625,
1.099609375,
0.02581787109375,
0.8232421875,
0.53271484375,
1.021484375,
0.505859375,
1.05859375,
0.55810546875,
0.156982421875,
0.87744140625,
1.0576171875,
-0.00986480712890625,
0.0858154296875,
-0.07183837890625,
0.40576171875,
0.5927734375,
0.438720703125,
-0.1729736328125,
0.564453125,
-0.207275390625,
-0.05615234375,
-0.66943359375,
0.324462890625,
-0.353271484375,
0.62890625,
0.332275390625,
0.8193359375,
-0.8076171875,
-0.67822265625,
0.422607421875,
0.388427734375,
-0.6552734375,
-0.50439453125,
0.03912353515625,
0.005794525146484375,
0.33251953125,
0.07110595703125,
0.457275390625,
0.79052734375,
0.318115234375,
0.53466796875,
-0.36474609375,
-0.9033203125,
-0.462890625,
-0.73095703125,
-1.23828125,
-0.381103515625,
-0.39794921875,
-0.14208984375,
0.55419921875,
-1.0595703125,
0.21435546875,
-0.1455078125,
-0.0943603515625,
-0.10479736328125,
-0.75341796875,
0.76416015625,
-0.64990234375,
0.595703125,
-0.6435546875,
0.452880859375,
0.1458740234375,
1.1376953125,
-0.6240234375,
-0.2188720703125,
-0.386962890625,
-0.30126953125,
0.58203125,
0.0190582275390625,
0.62451171875,
0.004016876220703125,
-1.0673828125,
-0.70361328125,
-0.26123046875,
0.017974853515625,
-0.189697265625,
0.521484375,
-0.97900390625,
1.009765625,
0.41552734375,
-0.7275390625,
0.6279296875,
0.96630859375,
-1.2724609375,
0.6884765625,
0.1942138671875,
0.52490234375,
-0.958984375,
0.66845703125,
0.341064453125,
0.297119140625,
-0.6748046875,
-0.348876953125,
-0.630859375,
-0.09588623046875,
0.26904296875,
-0.59228515625,
-0.046600341796875,
0.0975341796875,
0.040374755859375,
-1.2646484375,
0.66455078125,
-1.330078125,
-1.0869140625,
-0.24853515625,
-0.5732421875,
0.82763671875,
0.994140625,
0.224609375,
-0.58642578125,
0.08221435546875,
-0.280517578125,
0.6396484375,
0.7626953125,
-0.6181640625,
-0.03387451171875,
0.712890625,
-0.1025390625,
0.55078125,
0.51904296875,
-0.59912109375,
-0.297119140625,
-0.05889892578125,
0.1416015625,
0.81591796875,
0.34765625,
0.261474609375,
-0.333251953125,
0.9873046875,
-0.59228515625,
-0.59521484375,
0.325439453125,
0.39013671875,
-0.260009765625,
0.298095703125,
0.296142578125,
-0.432861328125,
-0.3525390625,
-0.52197265625,
0.4306640625,
0.153076171875,
0.64990234375,
-0.826171875,
0.796875,
0.07781982421875,
-0.71826171875,
0.337890625,
-0.73828125,
-0.375244140625,
1.365234375,
-0.1282958984375,
0.8583984375,
-0.468017578125,
0.51611328125,
-0.34716796875,
0.01248931884765625,
0.61181640625,
0.056976318359375,
0.7978515625,
-0.330322265625,
-0.46484375,
-0.55224609375,
0.042999267578125,
-0.10791015625,
-0.58056640625,
0.28173828125,
-0.291015625,
-0.072509765625,
-1.1376953125,
0.8876953125,
0.5751953125,
0.3232421875,
0.0189361572265625,
0.8125,
-0.03765869140625,
0.70166015625,
0.79541015625,
-0.275390625,
0.2568359375,
-0.8984375,
0.8984375,
0.0023860931396484375,
-0.08905029296875,
-0.2401123046875,
-0.421875,
-0.5654296875,
0.03167724609375,
-0.1483154296875,
-0.11065673828125,
-0.9140625,
0.3876953125,
0.0987548828125,
0.625,
-0.81640625,
-0.30517578125,
0.2017822265625,
0.6240234375,
0.1749267578125,
-0.61962890625,
-0.0262298583984375,
-0.73583984375,
0.72314453125,
0.5107421875,
-0.1336669921875,
-0.48681640625,
0.07177734375,
-0.44287109375,
-0.65625,
-0.026153564453125,
0.98095703125,
0.459228515625,
0.2413330078125,
-0.841796875,
0.57177734375,
0.55517578125,
-0.12158203125,
-0.12939453125,
0.030059814453125,
0.5302734375,
0.256591796875,
0.5068359375,
-0.45263671875,
-0.84228515625,
0.343505859375,
-1.04296875,
0.424560546875,
-0.68896484375,
0.2225341796875,
-0.0535888671875,
-0.2958984375,
-0.07537841796875,
0.465576171875,
-0.33154296875,
0.24755859375,
-0.016387939453125,
0.60107421875,
-1.06640625,
-0.470703125,
0.072265625,
-0.1043701171875,
-0.73828125,
0.505859375,
0.2127685546875,
-0.56298828125,
0.3095703125,
0.455078125,
-0.2332763671875,
0.42236328125,
-0.99951171875,
0.353271484375,
-0.275146484375,
-0.3291015625,
-0.159423828125,
-0.460693359375,
0.13037109375,
0.2890625,
-1.1064453125,
-0.233154296875,
-1.25390625,
-0.364501953125,
0.0445556640625,
-0.28369140625,
0.38916015625,
0.249267578125,
-0.217041015625,
0.1212158203125,
-0.63623046875,
-0.83935546875,
-0.428955078125,
-0.2489013671875,
-0.34521484375,
0.22265625,
0.324462890625,
0.8603515625,
0.07916259765625,
-0.39990234375,
0.2318115234375,
0.1925048828125,
-0.327880859375,
-0.8515625,
-0.061492919921875,
-0.0645751953125,
-0.37744140625,
-0.11566162109375,
0.5283203125,
-0.1572265625,
0.21240234375,
1.0224609375,
0.00989532470703125,
0.404052734375,
0.248046875,
-0.7509765625,
1.048828125,
0.0537109375,
-1.02734375,
-0.56689453125,
0.66259765625,
0.2103271484375,
0.2861328125,
0.15869140625,
-0.5859375,
-1.005859375,
-1.1796875,
0.005619049072265625,
-0.6455078125,
-0.20703125,
-0.54638671875,
-0.353759765625,
0.0836181640625,
0.8798828125,
0.04876708984375,
-0.426513671875,
-0.112060546875,
-1.4365234375,
0.3232421875,
-0.8681640625,
-0.266845703125,
-0.65478515625,
-0.314208984375,
-0.395751953125,
1.162109375,
0.3369140625,
0.64794921875,
-0.2186279296875,
-0.2119140625,
-0.0242767333984375,
0.0188140869140625,
-0.60888671875,
-0.44091796875,
-0.03521728515625,
-0.266845703125,
-0.2783203125,
0.04852294921875,
-0.6279296875,
0.64599609375,
-1.0732421875,
0.007720947265625,
-0.49072265625,
-0.4326171875,
-0.46435546875,
-0.39306640625,
1.453125,
-0.233154296875,
-0.315673828125,
-0.2093505859375,
0.79345703125,
0.4375,
-0.313232421875,
-0.78857421875,
-0.53955078125,
-0.759765625,
-0.91357421875,
0.9833984375,
-0.4638671875,
-0.129150390625,
-0.399658203125,
0.11968994140625,
0.86083984375,
0.0023326873779296875,
0.36376953125,
1.302734375,
0.424072265625,
0.072509765625,
-1.318359375,
0.916015625,
0.58251953125,
-0.54638671875,
-0.0428466796875,
0.20361328125,
-0.5234375,
0.29248046875,
-0.73779296875,
-1.15625,
-0.55712890625,
-0.234619140625,
1.23828125,
-0.04913330078125,
1.14453125,
-0.30078125,
-0.80615234375,
-0.5810546875,
0.88818359375,
0.36328125,
-0.0139923095703125,
0.78369140625,
0.0904541015625,
-0.06292724609375,
0.277099609375,
0.050689697265625,
-0.328369140625,
-0.61767578125,
0.98486328125,
-0.01502227783203125,
-0.615234375,
1.0078125,
0.91650390625,
-0.8486328125,
-0.76806640625,
-0.0972900390625,
-0.05633544921875,
-0.33544921875,
-0.93994140625,
0.1549072265625,
0.54248046875,
-0.46142578125,
0.0070953369140625,
0.484130859375,
-0.481201171875,
0.037841796875,
0.1588134765625,
0.018951416015625,
-0.264404296875,
0.1416015625,
0.57861328125,
-1.2373046875,
-0.23193359375,
-0.86279296875,
-0.0615234375,
-0.0201873779296875,
0.015380859375,
0.96240234375,
-0.377685546875,
0.68408203125,
0.46044921875,
-0.0098114013671875,
0.9599609375,
-0.720703125,
-0.52734375,
0.56494140625,
-1.1328125,
-0.33203125,
-0.140625,
0.427001953125,
-0.25732421875,
0.407470703125,
-0.75146484375,
0.07757568359375,
0.45849609375,
0.5107421875,
0.1834716796875,
-0.818359375,
-0.7041015625,
-1.21484375,
-0.362060546875,
-0.328369140625,
-0.3955078125,
-0.71923828125,
0.294189453125,
0.3623046875,
-0.5205078125,
-0.0311431884765625,
0.50927734375,
-0.56640625,
0.662109375,
-0.91162109375,
0.54150390625,
-0.72119140625,
-0.3935546875,
-0.4150390625,
0.289794921875,
-0.2919921875,
0.0355224609375,
-0.2132568359375,
0.1368408203125,
0.1063232421875,
0.6328125,
-0.42333984375,
0.3056640625,
-0.2117919921875,
-0.2396240234375,
0.33544921875,
0.02862548828125,
-0.17138671875,
0.6474609375,
0.8173828125,
-0.19775390625,
0.19140625,
-0.6591796875,
-0.333740234375,
-0.1983642578125,
0.06536865234375,
0.576171875,
-0.2646484375,
-0.018524169921875,
-0.41943359375,
0.038421630859375,
-0.80517578125,
-0.1378173828125,
-0.346923828125,
0.24853515625,
0.03955078125,
-0.311279296875,
0.271728515625,
0.978515625,
0.2169189453125,
0.451416015625,
-0.419189453125,
0.61376953125,
0.5166015625,
0.043212890625,
-0.07110595703125,
0.69189453125,
0.3525390625,
-0.22509765625,
0.6806640625,
0.403076171875,
-0.203857421875,
0.52001953125,
-0.2076416015625,
-1.1962890625,
-1.044921875,
0.0655517578125,
0.2359619140625,
0.1812744140625,
0.5546875,
-0.318359375,
-0.08843994140625,
-0.409423828125,
-0.802734375,
-0.1461181640625,
-0.888671875,
-0.8330078125,
0.406494140625,
-0.0021953582763671875,
-0.24560546875,
0.013519287109375,
-0.4541015625,
-0.1195068359375,
0.2333984375,
0.32568359375,
-0.47021484375,
0.389404296875,
0.10919189453125,
0.48779296875,
-0.375244140625,
0.0187225341796875,
-0.0299835205078125,
0.4287109375,
-0.2484130859375,
-0.681640625,
0.367431640625,
0.8291015625,
0.267578125,
-0.093994140625,
-0.68603515625,
0.2376708984375,
0.00463104248046875,
-0.021392822265625,
-0.5791015625,
0.4140625,
0.219970703125,
0.50927734375,
-0.77685546875,
0.27001953125,
-0.034698486328125,
0.421630859375,
0.60693359375,
-0.11773681640625,
-0.669921875,
0.77099609375,
0.529296875,
-0.18115234375,
0.417236328125,
0.3173828125,
0.5615234375,
0.1077880859375,
-0.2191162109375,
-0.461669921875,
0.978515625,
0.6044921875,
0.37646484375,
-0.28369140625,
0.219970703125,
0.791015625,
-0.0308074951171875,
-0.298095703125,
0.4951171875,
0.50439453125,
-0.162841796875,
-0.005367279052734375,
-0.472900390625,
-0.402587890625,
-0.01226806640625,
-0.370849609375,
0.1317138671875,
-0.58154296875,
-0.059356689453125,
-0.51416015625,
-0.625,
0.8359375,
0.05126953125,
0.010406494140625,
-0.1494140625,
-0.54052734375,
0.476318359375,
0.76123046875,
0.1815185546875,
0.1700439453125,
0.79638671875,
1.015625,
0.43798828125,
0.70068359375,
0.358642578125,
0.52099609375,
-0.93115234375,
-0.2103271484375,
-0.0172576904296875,
-0.06488037109375,
-0.51416015625,
-0.7431640625,
-0.966796875,
0.72900390625,
-0.62158203125,
-0.70166015625,
0.529296875,
-1.0068359375,
0.148681640625,
-0.175048828125,
0.59521484375,
-0.51416015625,
0.08538818359375,
0.285888671875,
-0.372802734375,
-0.53955078125,
1.013671875,
0.044921875,
0.85986328125,
0.51708984375,
1.203125,
-0.0982666015625,
1.505859375,
0.64599609375,
-0.45458984375,
0.1839599609375,
0.44921875,
-0.455810546875,
-0.6455078125,
0.07659912109375,
-0.5048828125,
-0.053497314453125,
-0.3134765625,
-0.56787109375,
0.08209228515625,
0.845703125,
0.01849365234375,
-0.763671875,
-0.357421875,
0.36474609375,
-0.51513671875,
0.51416015625,
-0.0347900390625,
0.289794921875,
0.164306640625,
0.17919921875,
-0.373291015625,
-0.6953125,
0.3623046875,
-0.49853515625,
0.59765625,
-0.485595703125,
-0.9970703125,
-0.51611328125,
-0.6669921875,
-0.486083984375,
-0.0008263587951660156,
-0.381103515625,
-0.79833984375,
0.29248046875,
0.6845703125,
0.46435546875,
-0.08526611328125,
-0.5986328125,
-0.209716796875,
0.6533203125,
1.0654296875,
0.151123046875,
0.9619140625,
0.58447265625,
-0.2724609375,
0.481689453125,
-0.5322265625,
0.89990234375,
0.21240234375,
0.0869140625,
-0.666015625,
0.1719970703125,
-0.296630859375,
-1.3037109375,
0.2391357421875,
0.53662109375,
0.454833984375,
-0.411865234375,
-1.3134765625,
-0.76416015625,
-0.58984375,
-0.39208984375,
-0.71240234375,
0.8603515625,
0.16748046875,
-0.182861328125,
0.036407470703125,
-1.1572265625,
4.171875,
1.1875,
1.076171875,
0.5791015625,
0.642578125,
1.005859375,
0.6416015625,
-0.71630859375,
-0.09234619140625,
-0.7548828125,
0.373291015625,
-0.677734375,
-0.36474609375,
0.75439453125,
0.1583251953125,
0.5595703125,
-0.1943359375,
0.45654296875,
-0.2286376953125,
-0.87841796875,
-0.6669921875,
0.006282806396484375,
0.209228515625,
0.53564453125,
0.3388671875,
0.07318115234375,
0.5888671875,
-0.86279296875,
-0.11187744140625,
-0.62353515625,
0.19482421875,
-0.8076171875,
0.85302734375,
0.3779296875,
-0.47314453125,
0.55615234375,
0.0306549072265625,
-0.61572265625,
-0.471923828125,
0.04296875,
-0.5234375,
-0.051666259765625,
0.88134765625,
-0.5771484375,
0.11065673828125,
0.456298828125,
-0.59716796875,
0.88427734375,
0.412841796875,
-0.931640625,
1.21484375,
-0.46484375,
0.340576171875,
-0.49853515625,
-0.82373046875,
0.02001953125,
0.33251953125,
-0.3525390625,
-0.47705078125,
0.61572265625,
-0.1473388671875,
0.07891845703125,
0.0838623046875,
1.021484375,
-1.056640625,
1.048828125,
0.12152099609375,
0.389892578125,
-0.71435546875,
-0.124755859375,
-0.224365234375,
0.061553955078125,
-0.342529296875,
-0.454345703125,
0.368408203125,
0.06201171875,
-0.61083984375,
1.0048828125,
0.2418212890625,
-0.422607421875,
0.027740478515625,
-0.244140625,
-0.658203125,
-0.0916748046875,
0.47509765625,
1.2109375,
-0.487548828125,
-0.1087646484375,
-0.32275390625,
1.02734375,
0.7783203125,
0.329833984375,
-0.039031982421875,
-0.533203125,
-0.188720703125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules:
* There are three parts of speech: the adjective, the noun, the verb. Each word in his language is an adjective, noun or verb.
* There are two genders: masculine and feminine. Each word in his language has gender either masculine or feminine.
* Masculine adjectives end with -lios, and feminine adjectives end with -liala.
* Masculine nouns end with -etr, and feminime nouns end with -etra.
* Masculine verbs end with -initis, and feminime verbs end with -inites.
* Thus, each word in the Petya's language has one of the six endings, given above. There are no other endings in Petya's language.
* It is accepted that the whole word consists of an ending. That is, words "lios", "liala", "etr" and so on belong to the Petya's language.
* There aren't any punctuation marks, grammatical tenses, singular/plural forms or other language complications.
* A sentence is either exactly one valid language word or exactly one statement.
Statement is any sequence of the Petya's language, that satisfy both conditions:
* Words in statement follow in the following order (from the left to the right): zero or more adjectives followed by exactly one noun followed by zero or more verbs.
* All words in the statement should have the same gender.
After Petya's friend Vasya wrote instant messenger (an instant messaging program) that supported the Petya's language, Petya wanted to add spelling and grammar checking to the program. As Vasya was in the country and Petya didn't feel like waiting, he asked you to help him with this problem. Your task is to define by a given sequence of words, whether it is true that the given text represents exactly one sentence in Petya's language.
Input
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105.
It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that given words do not belong to the Petya's language.
Output
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
Examples
Input
petr
Output
YES
Input
etis atis animatis etis atis amatis
Output
NO
Input
nataliala kataliala vetra feinites
Output
YES
Tags: implementation, strings
Correct Solution:
```
import re
def f(x):
if x.endswith("lios"): return 1
elif x.endswith("liala"): return -1
elif x.endswith("etr"): return 2
elif x.endswith("etra"): return -2
elif x.endswith("initis"):return 3
elif x.endswith("inites"): return -3
else: return 0
a,b=input().strip().split(),[]
for s in a:b.append(f(s))
if len(b)==1:
if b[0]!=0:print("YES")
else:print("NO")
else:
for x in b:
if b[0]*x <= 0:
print("NO")
exit()
c=""
for x in b:c+=str(abs(x))
sbl=re.compile(r'^1*23*$')
if sbl.match(c):
print("YES")
else:
print("NO")
```
| 37,811
|
[
0.1558837890625,
-0.245361328125,
-0.1279296875,
0.40234375,
-0.451171875,
-0.431884765625,
0.00937652587890625,
0.347412109375,
-0.0406494140625,
0.2293701171875,
0.552734375,
0.050140380859375,
0.34423828125,
-0.7294921875,
-0.599609375,
0.0022335052490234375,
-0.45556640625,
-0.96337890625,
-0.75390625,
0.357177734375,
0.2152099609375,
-0.1925048828125,
-1.8642578125,
-0.024169921875,
-0.83349609375,
0.92578125,
0.3037109375,
0.452880859375,
1.2314453125,
0.90185546875,
-0.08343505859375,
0.10675048828125,
0.34814453125,
-0.8017578125,
-0.101806640625,
-0.1014404296875,
0.52587890625,
-0.61328125,
-0.448974609375,
-0.73291015625,
0.6865234375,
-0.408447265625,
0.63916015625,
-0.62060546875,
-0.9765625,
0.043731689453125,
-0.11480712890625,
-0.59912109375,
-0.0966796875,
-0.1199951171875,
0.44189453125,
-0.283447265625,
0.494140625,
-0.006664276123046875,
0.036468505859375,
-0.4130859375,
-0.07489013671875,
0.367919921875,
-0.8662109375,
0.017578125,
0.07562255859375,
0.5517578125,
-0.16943359375,
-0.70751953125,
-0.055084228515625,
0.312255859375,
0.301513671875,
0.0322265625,
-0.033935546875,
-0.71484375,
-0.268310546875,
0.2147216796875,
-0.4365234375,
-0.6630859375,
-0.720703125,
0.103759765625,
0.39697265625,
-0.139404296875,
-0.4921875,
0.363037109375,
0.356201171875,
1.2451171875,
0.4140625,
0.1302490234375,
-0.71337890625,
-0.85107421875,
0.04351806640625,
0.685546875,
-0.0295257568359375,
-0.1343994140625,
-0.11444091796875,
0.1513671875,
-0.48876953125,
-0.01142120361328125,
0.828125,
0.57177734375,
-0.1781005859375,
0.3095703125,
0.10687255859375,
0.1456298828125,
0.62939453125,
0.91455078125,
-0.2109375,
1.056640625,
-0.759765625,
-0.07684326171875,
0.4384765625,
0.1461181640625,
-0.0298309326171875,
-0.267822265625,
-0.247802734375,
0.0219268798828125,
0.52587890625,
0.324951171875,
-0.35595703125,
0.91162109375,
-0.418212890625,
-0.046295166015625,
-1.185546875,
-0.038543701171875,
0.51953125,
-0.11981201171875,
0.47216796875,
-0.54541015625,
0.27783203125,
-0.619140625,
-0.285400390625,
0.998046875,
-0.8427734375,
-0.67333984375,
0.183349609375,
-0.054656982421875,
0.0938720703125,
0.308349609375,
-0.033233642578125,
0.47705078125,
-0.34033203125,
0.798828125,
1.0498046875,
-1.029296875,
0.62158203125,
0.07025146484375,
-0.14111328125,
1.404296875,
0.4150390625,
0.1348876953125,
0.6572265625,
0.1959228515625,
-0.87158203125,
0.341552734375,
-0.90673828125,
0.59423828125,
0.2000732421875,
0.283203125,
-0.4697265625,
-0.0141448974609375,
0.23486328125,
0.2427978515625,
0.2998046875,
-0.08953857421875,
-0.55517578125,
0.03289794921875,
-0.482666015625,
0.92333984375,
-0.338623046875,
0.45849609375,
-0.229736328125,
-0.482421875,
-0.07025146484375,
-0.5947265625,
0.1763916015625,
-0.334716796875,
-0.2017822265625,
0.7607421875,
0.66064453125,
1.30078125,
0.74853515625,
-0.2340087890625,
-0.00614166259765625,
-0.2457275390625,
-0.2861328125,
-0.036773681640625,
0.1883544921875,
0.78857421875,
0.59716796875,
-0.1661376953125,
0.17041015625,
-0.2900390625,
-0.515625,
-0.7021484375,
-0.080078125,
0.6103515625,
-0.5576171875,
0.2900390625,
0.24951171875,
0.59521484375,
-0.83740234375,
0.283935546875,
-0.09722900390625,
-0.8125,
-0.455810546875,
1.01171875,
-0.32373046875,
0.5390625,
-0.12255859375,
-0.65771484375,
-0.055419921875,
1.25390625,
-0.412841796875,
0.0280914306640625,
0.830078125,
0.245361328125,
-0.50439453125,
-0.431396484375,
0.037384033203125,
-0.583984375,
-0.8330078125,
0.85791015625,
-0.5888671875,
0.060302734375,
0.279052734375,
0.583984375,
0.1282958984375,
0.222412109375,
-0.043731689453125,
-0.46044921875,
0.3603515625,
1.099609375,
0.02581787109375,
0.8232421875,
0.53271484375,
1.021484375,
0.505859375,
1.05859375,
0.55810546875,
0.156982421875,
0.87744140625,
1.0576171875,
-0.00986480712890625,
0.0858154296875,
-0.07183837890625,
0.40576171875,
0.5927734375,
0.438720703125,
-0.1729736328125,
0.564453125,
-0.207275390625,
-0.05615234375,
-0.66943359375,
0.324462890625,
-0.353271484375,
0.62890625,
0.332275390625,
0.8193359375,
-0.8076171875,
-0.67822265625,
0.422607421875,
0.388427734375,
-0.6552734375,
-0.50439453125,
0.03912353515625,
0.005794525146484375,
0.33251953125,
0.07110595703125,
0.457275390625,
0.79052734375,
0.318115234375,
0.53466796875,
-0.36474609375,
-0.9033203125,
-0.462890625,
-0.73095703125,
-1.23828125,
-0.381103515625,
-0.39794921875,
-0.14208984375,
0.55419921875,
-1.0595703125,
0.21435546875,
-0.1455078125,
-0.0943603515625,
-0.10479736328125,
-0.75341796875,
0.76416015625,
-0.64990234375,
0.595703125,
-0.6435546875,
0.452880859375,
0.1458740234375,
1.1376953125,
-0.6240234375,
-0.2188720703125,
-0.386962890625,
-0.30126953125,
0.58203125,
0.0190582275390625,
0.62451171875,
0.004016876220703125,
-1.0673828125,
-0.70361328125,
-0.26123046875,
0.017974853515625,
-0.189697265625,
0.521484375,
-0.97900390625,
1.009765625,
0.41552734375,
-0.7275390625,
0.6279296875,
0.96630859375,
-1.2724609375,
0.6884765625,
0.1942138671875,
0.52490234375,
-0.958984375,
0.66845703125,
0.341064453125,
0.297119140625,
-0.6748046875,
-0.348876953125,
-0.630859375,
-0.09588623046875,
0.26904296875,
-0.59228515625,
-0.046600341796875,
0.0975341796875,
0.040374755859375,
-1.2646484375,
0.66455078125,
-1.330078125,
-1.0869140625,
-0.24853515625,
-0.5732421875,
0.82763671875,
0.994140625,
0.224609375,
-0.58642578125,
0.08221435546875,
-0.280517578125,
0.6396484375,
0.7626953125,
-0.6181640625,
-0.03387451171875,
0.712890625,
-0.1025390625,
0.55078125,
0.51904296875,
-0.59912109375,
-0.297119140625,
-0.05889892578125,
0.1416015625,
0.81591796875,
0.34765625,
0.261474609375,
-0.333251953125,
0.9873046875,
-0.59228515625,
-0.59521484375,
0.325439453125,
0.39013671875,
-0.260009765625,
0.298095703125,
0.296142578125,
-0.432861328125,
-0.3525390625,
-0.52197265625,
0.4306640625,
0.153076171875,
0.64990234375,
-0.826171875,
0.796875,
0.07781982421875,
-0.71826171875,
0.337890625,
-0.73828125,
-0.375244140625,
1.365234375,
-0.1282958984375,
0.8583984375,
-0.468017578125,
0.51611328125,
-0.34716796875,
0.01248931884765625,
0.61181640625,
0.056976318359375,
0.7978515625,
-0.330322265625,
-0.46484375,
-0.55224609375,
0.042999267578125,
-0.10791015625,
-0.58056640625,
0.28173828125,
-0.291015625,
-0.072509765625,
-1.1376953125,
0.8876953125,
0.5751953125,
0.3232421875,
0.0189361572265625,
0.8125,
-0.03765869140625,
0.70166015625,
0.79541015625,
-0.275390625,
0.2568359375,
-0.8984375,
0.8984375,
0.0023860931396484375,
-0.08905029296875,
-0.2401123046875,
-0.421875,
-0.5654296875,
0.03167724609375,
-0.1483154296875,
-0.11065673828125,
-0.9140625,
0.3876953125,
0.0987548828125,
0.625,
-0.81640625,
-0.30517578125,
0.2017822265625,
0.6240234375,
0.1749267578125,
-0.61962890625,
-0.0262298583984375,
-0.73583984375,
0.72314453125,
0.5107421875,
-0.1336669921875,
-0.48681640625,
0.07177734375,
-0.44287109375,
-0.65625,
-0.026153564453125,
0.98095703125,
0.459228515625,
0.2413330078125,
-0.841796875,
0.57177734375,
0.55517578125,
-0.12158203125,
-0.12939453125,
0.030059814453125,
0.5302734375,
0.256591796875,
0.5068359375,
-0.45263671875,
-0.84228515625,
0.343505859375,
-1.04296875,
0.424560546875,
-0.68896484375,
0.2225341796875,
-0.0535888671875,
-0.2958984375,
-0.07537841796875,
0.465576171875,
-0.33154296875,
0.24755859375,
-0.016387939453125,
0.60107421875,
-1.06640625,
-0.470703125,
0.072265625,
-0.1043701171875,
-0.73828125,
0.505859375,
0.2127685546875,
-0.56298828125,
0.3095703125,
0.455078125,
-0.2332763671875,
0.42236328125,
-0.99951171875,
0.353271484375,
-0.275146484375,
-0.3291015625,
-0.159423828125,
-0.460693359375,
0.13037109375,
0.2890625,
-1.1064453125,
-0.233154296875,
-1.25390625,
-0.364501953125,
0.0445556640625,
-0.28369140625,
0.38916015625,
0.249267578125,
-0.217041015625,
0.1212158203125,
-0.63623046875,
-0.83935546875,
-0.428955078125,
-0.2489013671875,
-0.34521484375,
0.22265625,
0.324462890625,
0.8603515625,
0.07916259765625,
-0.39990234375,
0.2318115234375,
0.1925048828125,
-0.327880859375,
-0.8515625,
-0.061492919921875,
-0.0645751953125,
-0.37744140625,
-0.11566162109375,
0.5283203125,
-0.1572265625,
0.21240234375,
1.0224609375,
0.00989532470703125,
0.404052734375,
0.248046875,
-0.7509765625,
1.048828125,
0.0537109375,
-1.02734375,
-0.56689453125,
0.66259765625,
0.2103271484375,
0.2861328125,
0.15869140625,
-0.5859375,
-1.005859375,
-1.1796875,
0.005619049072265625,
-0.6455078125,
-0.20703125,
-0.54638671875,
-0.353759765625,
0.0836181640625,
0.8798828125,
0.04876708984375,
-0.426513671875,
-0.112060546875,
-1.4365234375,
0.3232421875,
-0.8681640625,
-0.266845703125,
-0.65478515625,
-0.314208984375,
-0.395751953125,
1.162109375,
0.3369140625,
0.64794921875,
-0.2186279296875,
-0.2119140625,
-0.0242767333984375,
0.0188140869140625,
-0.60888671875,
-0.44091796875,
-0.03521728515625,
-0.266845703125,
-0.2783203125,
0.04852294921875,
-0.6279296875,
0.64599609375,
-1.0732421875,
0.007720947265625,
-0.49072265625,
-0.4326171875,
-0.46435546875,
-0.39306640625,
1.453125,
-0.233154296875,
-0.315673828125,
-0.2093505859375,
0.79345703125,
0.4375,
-0.313232421875,
-0.78857421875,
-0.53955078125,
-0.759765625,
-0.91357421875,
0.9833984375,
-0.4638671875,
-0.129150390625,
-0.399658203125,
0.11968994140625,
0.86083984375,
0.0023326873779296875,
0.36376953125,
1.302734375,
0.424072265625,
0.072509765625,
-1.318359375,
0.916015625,
0.58251953125,
-0.54638671875,
-0.0428466796875,
0.20361328125,
-0.5234375,
0.29248046875,
-0.73779296875,
-1.15625,
-0.55712890625,
-0.234619140625,
1.23828125,
-0.04913330078125,
1.14453125,
-0.30078125,
-0.80615234375,
-0.5810546875,
0.88818359375,
0.36328125,
-0.0139923095703125,
0.78369140625,
0.0904541015625,
-0.06292724609375,
0.277099609375,
0.050689697265625,
-0.328369140625,
-0.61767578125,
0.98486328125,
-0.01502227783203125,
-0.615234375,
1.0078125,
0.91650390625,
-0.8486328125,
-0.76806640625,
-0.0972900390625,
-0.05633544921875,
-0.33544921875,
-0.93994140625,
0.1549072265625,
0.54248046875,
-0.46142578125,
0.0070953369140625,
0.484130859375,
-0.481201171875,
0.037841796875,
0.1588134765625,
0.018951416015625,
-0.264404296875,
0.1416015625,
0.57861328125,
-1.2373046875,
-0.23193359375,
-0.86279296875,
-0.0615234375,
-0.0201873779296875,
0.015380859375,
0.96240234375,
-0.377685546875,
0.68408203125,
0.46044921875,
-0.0098114013671875,
0.9599609375,
-0.720703125,
-0.52734375,
0.56494140625,
-1.1328125,
-0.33203125,
-0.140625,
0.427001953125,
-0.25732421875,
0.407470703125,
-0.75146484375,
0.07757568359375,
0.45849609375,
0.5107421875,
0.1834716796875,
-0.818359375,
-0.7041015625,
-1.21484375,
-0.362060546875,
-0.328369140625,
-0.3955078125,
-0.71923828125,
0.294189453125,
0.3623046875,
-0.5205078125,
-0.0311431884765625,
0.50927734375,
-0.56640625,
0.662109375,
-0.91162109375,
0.54150390625,
-0.72119140625,
-0.3935546875,
-0.4150390625,
0.289794921875,
-0.2919921875,
0.0355224609375,
-0.2132568359375,
0.1368408203125,
0.1063232421875,
0.6328125,
-0.42333984375,
0.3056640625,
-0.2117919921875,
-0.2396240234375,
0.33544921875,
0.02862548828125,
-0.17138671875,
0.6474609375,
0.8173828125,
-0.19775390625,
0.19140625,
-0.6591796875,
-0.333740234375,
-0.1983642578125,
0.06536865234375,
0.576171875,
-0.2646484375,
-0.018524169921875,
-0.41943359375,
0.038421630859375,
-0.80517578125,
-0.1378173828125,
-0.346923828125,
0.24853515625,
0.03955078125,
-0.311279296875,
0.271728515625,
0.978515625,
0.2169189453125,
0.451416015625,
-0.419189453125,
0.61376953125,
0.5166015625,
0.043212890625,
-0.07110595703125,
0.69189453125,
0.3525390625,
-0.22509765625,
0.6806640625,
0.403076171875,
-0.203857421875,
0.52001953125,
-0.2076416015625,
-1.1962890625,
-1.044921875,
0.0655517578125,
0.2359619140625,
0.1812744140625,
0.5546875,
-0.318359375,
-0.08843994140625,
-0.409423828125,
-0.802734375,
-0.1461181640625,
-0.888671875,
-0.8330078125,
0.406494140625,
-0.0021953582763671875,
-0.24560546875,
0.013519287109375,
-0.4541015625,
-0.1195068359375,
0.2333984375,
0.32568359375,
-0.47021484375,
0.389404296875,
0.10919189453125,
0.48779296875,
-0.375244140625,
0.0187225341796875,
-0.0299835205078125,
0.4287109375,
-0.2484130859375,
-0.681640625,
0.367431640625,
0.8291015625,
0.267578125,
-0.093994140625,
-0.68603515625,
0.2376708984375,
0.00463104248046875,
-0.021392822265625,
-0.5791015625,
0.4140625,
0.219970703125,
0.50927734375,
-0.77685546875,
0.27001953125,
-0.034698486328125,
0.421630859375,
0.60693359375,
-0.11773681640625,
-0.669921875,
0.77099609375,
0.529296875,
-0.18115234375,
0.417236328125,
0.3173828125,
0.5615234375,
0.1077880859375,
-0.2191162109375,
-0.461669921875,
0.978515625,
0.6044921875,
0.37646484375,
-0.28369140625,
0.219970703125,
0.791015625,
-0.0308074951171875,
-0.298095703125,
0.4951171875,
0.50439453125,
-0.162841796875,
-0.005367279052734375,
-0.472900390625,
-0.402587890625,
-0.01226806640625,
-0.370849609375,
0.1317138671875,
-0.58154296875,
-0.059356689453125,
-0.51416015625,
-0.625,
0.8359375,
0.05126953125,
0.010406494140625,
-0.1494140625,
-0.54052734375,
0.476318359375,
0.76123046875,
0.1815185546875,
0.1700439453125,
0.79638671875,
1.015625,
0.43798828125,
0.70068359375,
0.358642578125,
0.52099609375,
-0.93115234375,
-0.2103271484375,
-0.0172576904296875,
-0.06488037109375,
-0.51416015625,
-0.7431640625,
-0.966796875,
0.72900390625,
-0.62158203125,
-0.70166015625,
0.529296875,
-1.0068359375,
0.148681640625,
-0.175048828125,
0.59521484375,
-0.51416015625,
0.08538818359375,
0.285888671875,
-0.372802734375,
-0.53955078125,
1.013671875,
0.044921875,
0.85986328125,
0.51708984375,
1.203125,
-0.0982666015625,
1.505859375,
0.64599609375,
-0.45458984375,
0.1839599609375,
0.44921875,
-0.455810546875,
-0.6455078125,
0.07659912109375,
-0.5048828125,
-0.053497314453125,
-0.3134765625,
-0.56787109375,
0.08209228515625,
0.845703125,
0.01849365234375,
-0.763671875,
-0.357421875,
0.36474609375,
-0.51513671875,
0.51416015625,
-0.0347900390625,
0.289794921875,
0.164306640625,
0.17919921875,
-0.373291015625,
-0.6953125,
0.3623046875,
-0.49853515625,
0.59765625,
-0.485595703125,
-0.9970703125,
-0.51611328125,
-0.6669921875,
-0.486083984375,
-0.0008263587951660156,
-0.381103515625,
-0.79833984375,
0.29248046875,
0.6845703125,
0.46435546875,
-0.08526611328125,
-0.5986328125,
-0.209716796875,
0.6533203125,
1.0654296875,
0.151123046875,
0.9619140625,
0.58447265625,
-0.2724609375,
0.481689453125,
-0.5322265625,
0.89990234375,
0.21240234375,
0.0869140625,
-0.666015625,
0.1719970703125,
-0.296630859375,
-1.3037109375,
0.2391357421875,
0.53662109375,
0.454833984375,
-0.411865234375,
-1.3134765625,
-0.76416015625,
-0.58984375,
-0.39208984375,
-0.71240234375,
0.8603515625,
0.16748046875,
-0.182861328125,
0.036407470703125,
-1.1572265625,
4.171875,
1.1875,
1.076171875,
0.5791015625,
0.642578125,
1.005859375,
0.6416015625,
-0.71630859375,
-0.09234619140625,
-0.7548828125,
0.373291015625,
-0.677734375,
-0.36474609375,
0.75439453125,
0.1583251953125,
0.5595703125,
-0.1943359375,
0.45654296875,
-0.2286376953125,
-0.87841796875,
-0.6669921875,
0.006282806396484375,
0.209228515625,
0.53564453125,
0.3388671875,
0.07318115234375,
0.5888671875,
-0.86279296875,
-0.11187744140625,
-0.62353515625,
0.19482421875,
-0.8076171875,
0.85302734375,
0.3779296875,
-0.47314453125,
0.55615234375,
0.0306549072265625,
-0.61572265625,
-0.471923828125,
0.04296875,
-0.5234375,
-0.051666259765625,
0.88134765625,
-0.5771484375,
0.11065673828125,
0.456298828125,
-0.59716796875,
0.88427734375,
0.412841796875,
-0.931640625,
1.21484375,
-0.46484375,
0.340576171875,
-0.49853515625,
-0.82373046875,
0.02001953125,
0.33251953125,
-0.3525390625,
-0.47705078125,
0.61572265625,
-0.1473388671875,
0.07891845703125,
0.0838623046875,
1.021484375,
-1.056640625,
1.048828125,
0.12152099609375,
0.389892578125,
-0.71435546875,
-0.124755859375,
-0.224365234375,
0.061553955078125,
-0.342529296875,
-0.454345703125,
0.368408203125,
0.06201171875,
-0.61083984375,
1.0048828125,
0.2418212890625,
-0.422607421875,
0.027740478515625,
-0.244140625,
-0.658203125,
-0.0916748046875,
0.47509765625,
1.2109375,
-0.487548828125,
-0.1087646484375,
-0.32275390625,
1.02734375,
0.7783203125,
0.329833984375,
-0.039031982421875,
-0.533203125,
-0.188720703125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules:
* There are three parts of speech: the adjective, the noun, the verb. Each word in his language is an adjective, noun or verb.
* There are two genders: masculine and feminine. Each word in his language has gender either masculine or feminine.
* Masculine adjectives end with -lios, and feminine adjectives end with -liala.
* Masculine nouns end with -etr, and feminime nouns end with -etra.
* Masculine verbs end with -initis, and feminime verbs end with -inites.
* Thus, each word in the Petya's language has one of the six endings, given above. There are no other endings in Petya's language.
* It is accepted that the whole word consists of an ending. That is, words "lios", "liala", "etr" and so on belong to the Petya's language.
* There aren't any punctuation marks, grammatical tenses, singular/plural forms or other language complications.
* A sentence is either exactly one valid language word or exactly one statement.
Statement is any sequence of the Petya's language, that satisfy both conditions:
* Words in statement follow in the following order (from the left to the right): zero or more adjectives followed by exactly one noun followed by zero or more verbs.
* All words in the statement should have the same gender.
After Petya's friend Vasya wrote instant messenger (an instant messaging program) that supported the Petya's language, Petya wanted to add spelling and grammar checking to the program. As Vasya was in the country and Petya didn't feel like waiting, he asked you to help him with this problem. Your task is to define by a given sequence of words, whether it is true that the given text represents exactly one sentence in Petya's language.
Input
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105.
It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that given words do not belong to the Petya's language.
Output
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
Examples
Input
petr
Output
YES
Input
etis atis animatis etis atis amatis
Output
NO
Input
nataliala kataliala vetra feinites
Output
YES
Tags: implementation, strings
Correct Solution:
```
lista = input().split()
passadj = False
passsub = False
gender = -1
can = True
canF = True
# verificando os generos das palavras
for i in range(0,len(lista)):
if (len(lista[i]) >= 3 and lista[i][len(lista[i])-3::] == "etr") or (len(lista[i]) >= 4 and lista[i][len(lista[i])-4::] == "lios") or (len(lista[i]) >= 6 and lista[i][len(lista[i])-6::] == "initis"):
if gender == -1:
gender = 1
elif gender == 2:
can = False
else:
if gender == -1:
gender = 2
elif gender == 1:
can = False
# print(can)
# verificando os blocos
for i in range(0, len(lista)):
if (len(lista[i]) >= 4 and lista[i][len(lista[i])-4::] == "lios") or (len(lista[i]) >= 5 and lista[i][len(lista[i])-5::] == "liala"):
if(passadj == True):
can = False
elif (len(lista[i]) >= 3 and lista[i][len(lista[i])-3::] == "etr") or (len(lista[i]) >= 4 and lista[i][len(lista[i])-4::] == "etra"):
passadj = True
if passsub == True:
can = False
else:
passsub = True
elif (len(lista[i]) >= 6 and lista[i][len(lista[i])-6::] == "initis") or (len(lista[i]) >= 6 and lista[i][len(lista[i])-6::] == "inites"):
if passadj == False or passsub == False:
can = False
else:
canF = False
# print(can)
if (len(lista)==1 and canF) or (passsub and canF and can):
print("YES\n")
else:
print("NO\n")
```
| 37,812
|
[
0.1558837890625,
-0.245361328125,
-0.1279296875,
0.40234375,
-0.451171875,
-0.431884765625,
0.00937652587890625,
0.347412109375,
-0.0406494140625,
0.2293701171875,
0.552734375,
0.050140380859375,
0.34423828125,
-0.7294921875,
-0.599609375,
0.0022335052490234375,
-0.45556640625,
-0.96337890625,
-0.75390625,
0.357177734375,
0.2152099609375,
-0.1925048828125,
-1.8642578125,
-0.024169921875,
-0.83349609375,
0.92578125,
0.3037109375,
0.452880859375,
1.2314453125,
0.90185546875,
-0.08343505859375,
0.10675048828125,
0.34814453125,
-0.8017578125,
-0.101806640625,
-0.1014404296875,
0.52587890625,
-0.61328125,
-0.448974609375,
-0.73291015625,
0.6865234375,
-0.408447265625,
0.63916015625,
-0.62060546875,
-0.9765625,
0.043731689453125,
-0.11480712890625,
-0.59912109375,
-0.0966796875,
-0.1199951171875,
0.44189453125,
-0.283447265625,
0.494140625,
-0.006664276123046875,
0.036468505859375,
-0.4130859375,
-0.07489013671875,
0.367919921875,
-0.8662109375,
0.017578125,
0.07562255859375,
0.5517578125,
-0.16943359375,
-0.70751953125,
-0.055084228515625,
0.312255859375,
0.301513671875,
0.0322265625,
-0.033935546875,
-0.71484375,
-0.268310546875,
0.2147216796875,
-0.4365234375,
-0.6630859375,
-0.720703125,
0.103759765625,
0.39697265625,
-0.139404296875,
-0.4921875,
0.363037109375,
0.356201171875,
1.2451171875,
0.4140625,
0.1302490234375,
-0.71337890625,
-0.85107421875,
0.04351806640625,
0.685546875,
-0.0295257568359375,
-0.1343994140625,
-0.11444091796875,
0.1513671875,
-0.48876953125,
-0.01142120361328125,
0.828125,
0.57177734375,
-0.1781005859375,
0.3095703125,
0.10687255859375,
0.1456298828125,
0.62939453125,
0.91455078125,
-0.2109375,
1.056640625,
-0.759765625,
-0.07684326171875,
0.4384765625,
0.1461181640625,
-0.0298309326171875,
-0.267822265625,
-0.247802734375,
0.0219268798828125,
0.52587890625,
0.324951171875,
-0.35595703125,
0.91162109375,
-0.418212890625,
-0.046295166015625,
-1.185546875,
-0.038543701171875,
0.51953125,
-0.11981201171875,
0.47216796875,
-0.54541015625,
0.27783203125,
-0.619140625,
-0.285400390625,
0.998046875,
-0.8427734375,
-0.67333984375,
0.183349609375,
-0.054656982421875,
0.0938720703125,
0.308349609375,
-0.033233642578125,
0.47705078125,
-0.34033203125,
0.798828125,
1.0498046875,
-1.029296875,
0.62158203125,
0.07025146484375,
-0.14111328125,
1.404296875,
0.4150390625,
0.1348876953125,
0.6572265625,
0.1959228515625,
-0.87158203125,
0.341552734375,
-0.90673828125,
0.59423828125,
0.2000732421875,
0.283203125,
-0.4697265625,
-0.0141448974609375,
0.23486328125,
0.2427978515625,
0.2998046875,
-0.08953857421875,
-0.55517578125,
0.03289794921875,
-0.482666015625,
0.92333984375,
-0.338623046875,
0.45849609375,
-0.229736328125,
-0.482421875,
-0.07025146484375,
-0.5947265625,
0.1763916015625,
-0.334716796875,
-0.2017822265625,
0.7607421875,
0.66064453125,
1.30078125,
0.74853515625,
-0.2340087890625,
-0.00614166259765625,
-0.2457275390625,
-0.2861328125,
-0.036773681640625,
0.1883544921875,
0.78857421875,
0.59716796875,
-0.1661376953125,
0.17041015625,
-0.2900390625,
-0.515625,
-0.7021484375,
-0.080078125,
0.6103515625,
-0.5576171875,
0.2900390625,
0.24951171875,
0.59521484375,
-0.83740234375,
0.283935546875,
-0.09722900390625,
-0.8125,
-0.455810546875,
1.01171875,
-0.32373046875,
0.5390625,
-0.12255859375,
-0.65771484375,
-0.055419921875,
1.25390625,
-0.412841796875,
0.0280914306640625,
0.830078125,
0.245361328125,
-0.50439453125,
-0.431396484375,
0.037384033203125,
-0.583984375,
-0.8330078125,
0.85791015625,
-0.5888671875,
0.060302734375,
0.279052734375,
0.583984375,
0.1282958984375,
0.222412109375,
-0.043731689453125,
-0.46044921875,
0.3603515625,
1.099609375,
0.02581787109375,
0.8232421875,
0.53271484375,
1.021484375,
0.505859375,
1.05859375,
0.55810546875,
0.156982421875,
0.87744140625,
1.0576171875,
-0.00986480712890625,
0.0858154296875,
-0.07183837890625,
0.40576171875,
0.5927734375,
0.438720703125,
-0.1729736328125,
0.564453125,
-0.207275390625,
-0.05615234375,
-0.66943359375,
0.324462890625,
-0.353271484375,
0.62890625,
0.332275390625,
0.8193359375,
-0.8076171875,
-0.67822265625,
0.422607421875,
0.388427734375,
-0.6552734375,
-0.50439453125,
0.03912353515625,
0.005794525146484375,
0.33251953125,
0.07110595703125,
0.457275390625,
0.79052734375,
0.318115234375,
0.53466796875,
-0.36474609375,
-0.9033203125,
-0.462890625,
-0.73095703125,
-1.23828125,
-0.381103515625,
-0.39794921875,
-0.14208984375,
0.55419921875,
-1.0595703125,
0.21435546875,
-0.1455078125,
-0.0943603515625,
-0.10479736328125,
-0.75341796875,
0.76416015625,
-0.64990234375,
0.595703125,
-0.6435546875,
0.452880859375,
0.1458740234375,
1.1376953125,
-0.6240234375,
-0.2188720703125,
-0.386962890625,
-0.30126953125,
0.58203125,
0.0190582275390625,
0.62451171875,
0.004016876220703125,
-1.0673828125,
-0.70361328125,
-0.26123046875,
0.017974853515625,
-0.189697265625,
0.521484375,
-0.97900390625,
1.009765625,
0.41552734375,
-0.7275390625,
0.6279296875,
0.96630859375,
-1.2724609375,
0.6884765625,
0.1942138671875,
0.52490234375,
-0.958984375,
0.66845703125,
0.341064453125,
0.297119140625,
-0.6748046875,
-0.348876953125,
-0.630859375,
-0.09588623046875,
0.26904296875,
-0.59228515625,
-0.046600341796875,
0.0975341796875,
0.040374755859375,
-1.2646484375,
0.66455078125,
-1.330078125,
-1.0869140625,
-0.24853515625,
-0.5732421875,
0.82763671875,
0.994140625,
0.224609375,
-0.58642578125,
0.08221435546875,
-0.280517578125,
0.6396484375,
0.7626953125,
-0.6181640625,
-0.03387451171875,
0.712890625,
-0.1025390625,
0.55078125,
0.51904296875,
-0.59912109375,
-0.297119140625,
-0.05889892578125,
0.1416015625,
0.81591796875,
0.34765625,
0.261474609375,
-0.333251953125,
0.9873046875,
-0.59228515625,
-0.59521484375,
0.325439453125,
0.39013671875,
-0.260009765625,
0.298095703125,
0.296142578125,
-0.432861328125,
-0.3525390625,
-0.52197265625,
0.4306640625,
0.153076171875,
0.64990234375,
-0.826171875,
0.796875,
0.07781982421875,
-0.71826171875,
0.337890625,
-0.73828125,
-0.375244140625,
1.365234375,
-0.1282958984375,
0.8583984375,
-0.468017578125,
0.51611328125,
-0.34716796875,
0.01248931884765625,
0.61181640625,
0.056976318359375,
0.7978515625,
-0.330322265625,
-0.46484375,
-0.55224609375,
0.042999267578125,
-0.10791015625,
-0.58056640625,
0.28173828125,
-0.291015625,
-0.072509765625,
-1.1376953125,
0.8876953125,
0.5751953125,
0.3232421875,
0.0189361572265625,
0.8125,
-0.03765869140625,
0.70166015625,
0.79541015625,
-0.275390625,
0.2568359375,
-0.8984375,
0.8984375,
0.0023860931396484375,
-0.08905029296875,
-0.2401123046875,
-0.421875,
-0.5654296875,
0.03167724609375,
-0.1483154296875,
-0.11065673828125,
-0.9140625,
0.3876953125,
0.0987548828125,
0.625,
-0.81640625,
-0.30517578125,
0.2017822265625,
0.6240234375,
0.1749267578125,
-0.61962890625,
-0.0262298583984375,
-0.73583984375,
0.72314453125,
0.5107421875,
-0.1336669921875,
-0.48681640625,
0.07177734375,
-0.44287109375,
-0.65625,
-0.026153564453125,
0.98095703125,
0.459228515625,
0.2413330078125,
-0.841796875,
0.57177734375,
0.55517578125,
-0.12158203125,
-0.12939453125,
0.030059814453125,
0.5302734375,
0.256591796875,
0.5068359375,
-0.45263671875,
-0.84228515625,
0.343505859375,
-1.04296875,
0.424560546875,
-0.68896484375,
0.2225341796875,
-0.0535888671875,
-0.2958984375,
-0.07537841796875,
0.465576171875,
-0.33154296875,
0.24755859375,
-0.016387939453125,
0.60107421875,
-1.06640625,
-0.470703125,
0.072265625,
-0.1043701171875,
-0.73828125,
0.505859375,
0.2127685546875,
-0.56298828125,
0.3095703125,
0.455078125,
-0.2332763671875,
0.42236328125,
-0.99951171875,
0.353271484375,
-0.275146484375,
-0.3291015625,
-0.159423828125,
-0.460693359375,
0.13037109375,
0.2890625,
-1.1064453125,
-0.233154296875,
-1.25390625,
-0.364501953125,
0.0445556640625,
-0.28369140625,
0.38916015625,
0.249267578125,
-0.217041015625,
0.1212158203125,
-0.63623046875,
-0.83935546875,
-0.428955078125,
-0.2489013671875,
-0.34521484375,
0.22265625,
0.324462890625,
0.8603515625,
0.07916259765625,
-0.39990234375,
0.2318115234375,
0.1925048828125,
-0.327880859375,
-0.8515625,
-0.061492919921875,
-0.0645751953125,
-0.37744140625,
-0.11566162109375,
0.5283203125,
-0.1572265625,
0.21240234375,
1.0224609375,
0.00989532470703125,
0.404052734375,
0.248046875,
-0.7509765625,
1.048828125,
0.0537109375,
-1.02734375,
-0.56689453125,
0.66259765625,
0.2103271484375,
0.2861328125,
0.15869140625,
-0.5859375,
-1.005859375,
-1.1796875,
0.005619049072265625,
-0.6455078125,
-0.20703125,
-0.54638671875,
-0.353759765625,
0.0836181640625,
0.8798828125,
0.04876708984375,
-0.426513671875,
-0.112060546875,
-1.4365234375,
0.3232421875,
-0.8681640625,
-0.266845703125,
-0.65478515625,
-0.314208984375,
-0.395751953125,
1.162109375,
0.3369140625,
0.64794921875,
-0.2186279296875,
-0.2119140625,
-0.0242767333984375,
0.0188140869140625,
-0.60888671875,
-0.44091796875,
-0.03521728515625,
-0.266845703125,
-0.2783203125,
0.04852294921875,
-0.6279296875,
0.64599609375,
-1.0732421875,
0.007720947265625,
-0.49072265625,
-0.4326171875,
-0.46435546875,
-0.39306640625,
1.453125,
-0.233154296875,
-0.315673828125,
-0.2093505859375,
0.79345703125,
0.4375,
-0.313232421875,
-0.78857421875,
-0.53955078125,
-0.759765625,
-0.91357421875,
0.9833984375,
-0.4638671875,
-0.129150390625,
-0.399658203125,
0.11968994140625,
0.86083984375,
0.0023326873779296875,
0.36376953125,
1.302734375,
0.424072265625,
0.072509765625,
-1.318359375,
0.916015625,
0.58251953125,
-0.54638671875,
-0.0428466796875,
0.20361328125,
-0.5234375,
0.29248046875,
-0.73779296875,
-1.15625,
-0.55712890625,
-0.234619140625,
1.23828125,
-0.04913330078125,
1.14453125,
-0.30078125,
-0.80615234375,
-0.5810546875,
0.88818359375,
0.36328125,
-0.0139923095703125,
0.78369140625,
0.0904541015625,
-0.06292724609375,
0.277099609375,
0.050689697265625,
-0.328369140625,
-0.61767578125,
0.98486328125,
-0.01502227783203125,
-0.615234375,
1.0078125,
0.91650390625,
-0.8486328125,
-0.76806640625,
-0.0972900390625,
-0.05633544921875,
-0.33544921875,
-0.93994140625,
0.1549072265625,
0.54248046875,
-0.46142578125,
0.0070953369140625,
0.484130859375,
-0.481201171875,
0.037841796875,
0.1588134765625,
0.018951416015625,
-0.264404296875,
0.1416015625,
0.57861328125,
-1.2373046875,
-0.23193359375,
-0.86279296875,
-0.0615234375,
-0.0201873779296875,
0.015380859375,
0.96240234375,
-0.377685546875,
0.68408203125,
0.46044921875,
-0.0098114013671875,
0.9599609375,
-0.720703125,
-0.52734375,
0.56494140625,
-1.1328125,
-0.33203125,
-0.140625,
0.427001953125,
-0.25732421875,
0.407470703125,
-0.75146484375,
0.07757568359375,
0.45849609375,
0.5107421875,
0.1834716796875,
-0.818359375,
-0.7041015625,
-1.21484375,
-0.362060546875,
-0.328369140625,
-0.3955078125,
-0.71923828125,
0.294189453125,
0.3623046875,
-0.5205078125,
-0.0311431884765625,
0.50927734375,
-0.56640625,
0.662109375,
-0.91162109375,
0.54150390625,
-0.72119140625,
-0.3935546875,
-0.4150390625,
0.289794921875,
-0.2919921875,
0.0355224609375,
-0.2132568359375,
0.1368408203125,
0.1063232421875,
0.6328125,
-0.42333984375,
0.3056640625,
-0.2117919921875,
-0.2396240234375,
0.33544921875,
0.02862548828125,
-0.17138671875,
0.6474609375,
0.8173828125,
-0.19775390625,
0.19140625,
-0.6591796875,
-0.333740234375,
-0.1983642578125,
0.06536865234375,
0.576171875,
-0.2646484375,
-0.018524169921875,
-0.41943359375,
0.038421630859375,
-0.80517578125,
-0.1378173828125,
-0.346923828125,
0.24853515625,
0.03955078125,
-0.311279296875,
0.271728515625,
0.978515625,
0.2169189453125,
0.451416015625,
-0.419189453125,
0.61376953125,
0.5166015625,
0.043212890625,
-0.07110595703125,
0.69189453125,
0.3525390625,
-0.22509765625,
0.6806640625,
0.403076171875,
-0.203857421875,
0.52001953125,
-0.2076416015625,
-1.1962890625,
-1.044921875,
0.0655517578125,
0.2359619140625,
0.1812744140625,
0.5546875,
-0.318359375,
-0.08843994140625,
-0.409423828125,
-0.802734375,
-0.1461181640625,
-0.888671875,
-0.8330078125,
0.406494140625,
-0.0021953582763671875,
-0.24560546875,
0.013519287109375,
-0.4541015625,
-0.1195068359375,
0.2333984375,
0.32568359375,
-0.47021484375,
0.389404296875,
0.10919189453125,
0.48779296875,
-0.375244140625,
0.0187225341796875,
-0.0299835205078125,
0.4287109375,
-0.2484130859375,
-0.681640625,
0.367431640625,
0.8291015625,
0.267578125,
-0.093994140625,
-0.68603515625,
0.2376708984375,
0.00463104248046875,
-0.021392822265625,
-0.5791015625,
0.4140625,
0.219970703125,
0.50927734375,
-0.77685546875,
0.27001953125,
-0.034698486328125,
0.421630859375,
0.60693359375,
-0.11773681640625,
-0.669921875,
0.77099609375,
0.529296875,
-0.18115234375,
0.417236328125,
0.3173828125,
0.5615234375,
0.1077880859375,
-0.2191162109375,
-0.461669921875,
0.978515625,
0.6044921875,
0.37646484375,
-0.28369140625,
0.219970703125,
0.791015625,
-0.0308074951171875,
-0.298095703125,
0.4951171875,
0.50439453125,
-0.162841796875,
-0.005367279052734375,
-0.472900390625,
-0.402587890625,
-0.01226806640625,
-0.370849609375,
0.1317138671875,
-0.58154296875,
-0.059356689453125,
-0.51416015625,
-0.625,
0.8359375,
0.05126953125,
0.010406494140625,
-0.1494140625,
-0.54052734375,
0.476318359375,
0.76123046875,
0.1815185546875,
0.1700439453125,
0.79638671875,
1.015625,
0.43798828125,
0.70068359375,
0.358642578125,
0.52099609375,
-0.93115234375,
-0.2103271484375,
-0.0172576904296875,
-0.06488037109375,
-0.51416015625,
-0.7431640625,
-0.966796875,
0.72900390625,
-0.62158203125,
-0.70166015625,
0.529296875,
-1.0068359375,
0.148681640625,
-0.175048828125,
0.59521484375,
-0.51416015625,
0.08538818359375,
0.285888671875,
-0.372802734375,
-0.53955078125,
1.013671875,
0.044921875,
0.85986328125,
0.51708984375,
1.203125,
-0.0982666015625,
1.505859375,
0.64599609375,
-0.45458984375,
0.1839599609375,
0.44921875,
-0.455810546875,
-0.6455078125,
0.07659912109375,
-0.5048828125,
-0.053497314453125,
-0.3134765625,
-0.56787109375,
0.08209228515625,
0.845703125,
0.01849365234375,
-0.763671875,
-0.357421875,
0.36474609375,
-0.51513671875,
0.51416015625,
-0.0347900390625,
0.289794921875,
0.164306640625,
0.17919921875,
-0.373291015625,
-0.6953125,
0.3623046875,
-0.49853515625,
0.59765625,
-0.485595703125,
-0.9970703125,
-0.51611328125,
-0.6669921875,
-0.486083984375,
-0.0008263587951660156,
-0.381103515625,
-0.79833984375,
0.29248046875,
0.6845703125,
0.46435546875,
-0.08526611328125,
-0.5986328125,
-0.209716796875,
0.6533203125,
1.0654296875,
0.151123046875,
0.9619140625,
0.58447265625,
-0.2724609375,
0.481689453125,
-0.5322265625,
0.89990234375,
0.21240234375,
0.0869140625,
-0.666015625,
0.1719970703125,
-0.296630859375,
-1.3037109375,
0.2391357421875,
0.53662109375,
0.454833984375,
-0.411865234375,
-1.3134765625,
-0.76416015625,
-0.58984375,
-0.39208984375,
-0.71240234375,
0.8603515625,
0.16748046875,
-0.182861328125,
0.036407470703125,
-1.1572265625,
4.171875,
1.1875,
1.076171875,
0.5791015625,
0.642578125,
1.005859375,
0.6416015625,
-0.71630859375,
-0.09234619140625,
-0.7548828125,
0.373291015625,
-0.677734375,
-0.36474609375,
0.75439453125,
0.1583251953125,
0.5595703125,
-0.1943359375,
0.45654296875,
-0.2286376953125,
-0.87841796875,
-0.6669921875,
0.006282806396484375,
0.209228515625,
0.53564453125,
0.3388671875,
0.07318115234375,
0.5888671875,
-0.86279296875,
-0.11187744140625,
-0.62353515625,
0.19482421875,
-0.8076171875,
0.85302734375,
0.3779296875,
-0.47314453125,
0.55615234375,
0.0306549072265625,
-0.61572265625,
-0.471923828125,
0.04296875,
-0.5234375,
-0.051666259765625,
0.88134765625,
-0.5771484375,
0.11065673828125,
0.456298828125,
-0.59716796875,
0.88427734375,
0.412841796875,
-0.931640625,
1.21484375,
-0.46484375,
0.340576171875,
-0.49853515625,
-0.82373046875,
0.02001953125,
0.33251953125,
-0.3525390625,
-0.47705078125,
0.61572265625,
-0.1473388671875,
0.07891845703125,
0.0838623046875,
1.021484375,
-1.056640625,
1.048828125,
0.12152099609375,
0.389892578125,
-0.71435546875,
-0.124755859375,
-0.224365234375,
0.061553955078125,
-0.342529296875,
-0.454345703125,
0.368408203125,
0.06201171875,
-0.61083984375,
1.0048828125,
0.2418212890625,
-0.422607421875,
0.027740478515625,
-0.244140625,
-0.658203125,
-0.0916748046875,
0.47509765625,
1.2109375,
-0.487548828125,
-0.1087646484375,
-0.32275390625,
1.02734375,
0.7783203125,
0.329833984375,
-0.039031982421875,
-0.533203125,
-0.188720703125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules:
* There are three parts of speech: the adjective, the noun, the verb. Each word in his language is an adjective, noun or verb.
* There are two genders: masculine and feminine. Each word in his language has gender either masculine or feminine.
* Masculine adjectives end with -lios, and feminine adjectives end with -liala.
* Masculine nouns end with -etr, and feminime nouns end with -etra.
* Masculine verbs end with -initis, and feminime verbs end with -inites.
* Thus, each word in the Petya's language has one of the six endings, given above. There are no other endings in Petya's language.
* It is accepted that the whole word consists of an ending. That is, words "lios", "liala", "etr" and so on belong to the Petya's language.
* There aren't any punctuation marks, grammatical tenses, singular/plural forms or other language complications.
* A sentence is either exactly one valid language word or exactly one statement.
Statement is any sequence of the Petya's language, that satisfy both conditions:
* Words in statement follow in the following order (from the left to the right): zero or more adjectives followed by exactly one noun followed by zero or more verbs.
* All words in the statement should have the same gender.
After Petya's friend Vasya wrote instant messenger (an instant messaging program) that supported the Petya's language, Petya wanted to add spelling and grammar checking to the program. As Vasya was in the country and Petya didn't feel like waiting, he asked you to help him with this problem. Your task is to define by a given sequence of words, whether it is true that the given text represents exactly one sentence in Petya's language.
Input
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105.
It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that given words do not belong to the Petya's language.
Output
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
Examples
Input
petr
Output
YES
Input
etis atis animatis etis atis amatis
Output
NO
Input
nataliala kataliala vetra feinites
Output
YES
Tags: implementation, strings
Correct Solution:
```
words = input().split()
adj = ['lios', 'liala']
nouns = ['etr', 'etra']
verbs = ['initis', 'inites']
mascul = [adj[0], nouns[0], verbs[0]]
femine = [adj[1], nouns[1], verbs[1]]
good = True
if len(words) > 1:
masc = False
femi = False
if any([x == words[0][-len(x):] for x in mascul]):
masc = True
elif any([x == words[0][-len(x):] for x in femine]):
femi = True
else:
good = False
if masc:
for i in range(len(words)):
if not any([x == words[i][-len(x):] for x in mascul]):
good = False
if femi:
for i in range(len(words)):
if not any([x == words[i][-len(x):] for x in femine]):
good = False
if good and masc:
i = 0
while i < len(words) and words[i][-len(mascul[0]):] == mascul[0]: i += 1
if i == len(words) or words[i][-len(nouns[0]):] != nouns[0]:
good = False
i += 1
while i < len(words):
if words[i][-len(verbs[0]):] != verbs[0]:
good = False
break
i += 1
if good and femi:
i = 0
while i < len(words) and words[i][-len(femine[0]):] == femine[0]: i += 1
if i == len(words) or words[i][-len(nouns[1]):] != nouns[1]:
good = False
i += 1
while i < len(words):
if words[i][-len(verbs[1]):] != verbs[1]:
good = False
break
i += 1
else:
if not any([x == words[0][-len(x):] for x in (mascul + femine)]):
good = False
if good:
print("YES")
else:
print("NO")
```
| 37,813
|
[
0.1558837890625,
-0.245361328125,
-0.1279296875,
0.40234375,
-0.451171875,
-0.431884765625,
0.00937652587890625,
0.347412109375,
-0.0406494140625,
0.2293701171875,
0.552734375,
0.050140380859375,
0.34423828125,
-0.7294921875,
-0.599609375,
0.0022335052490234375,
-0.45556640625,
-0.96337890625,
-0.75390625,
0.357177734375,
0.2152099609375,
-0.1925048828125,
-1.8642578125,
-0.024169921875,
-0.83349609375,
0.92578125,
0.3037109375,
0.452880859375,
1.2314453125,
0.90185546875,
-0.08343505859375,
0.10675048828125,
0.34814453125,
-0.8017578125,
-0.101806640625,
-0.1014404296875,
0.52587890625,
-0.61328125,
-0.448974609375,
-0.73291015625,
0.6865234375,
-0.408447265625,
0.63916015625,
-0.62060546875,
-0.9765625,
0.043731689453125,
-0.11480712890625,
-0.59912109375,
-0.0966796875,
-0.1199951171875,
0.44189453125,
-0.283447265625,
0.494140625,
-0.006664276123046875,
0.036468505859375,
-0.4130859375,
-0.07489013671875,
0.367919921875,
-0.8662109375,
0.017578125,
0.07562255859375,
0.5517578125,
-0.16943359375,
-0.70751953125,
-0.055084228515625,
0.312255859375,
0.301513671875,
0.0322265625,
-0.033935546875,
-0.71484375,
-0.268310546875,
0.2147216796875,
-0.4365234375,
-0.6630859375,
-0.720703125,
0.103759765625,
0.39697265625,
-0.139404296875,
-0.4921875,
0.363037109375,
0.356201171875,
1.2451171875,
0.4140625,
0.1302490234375,
-0.71337890625,
-0.85107421875,
0.04351806640625,
0.685546875,
-0.0295257568359375,
-0.1343994140625,
-0.11444091796875,
0.1513671875,
-0.48876953125,
-0.01142120361328125,
0.828125,
0.57177734375,
-0.1781005859375,
0.3095703125,
0.10687255859375,
0.1456298828125,
0.62939453125,
0.91455078125,
-0.2109375,
1.056640625,
-0.759765625,
-0.07684326171875,
0.4384765625,
0.1461181640625,
-0.0298309326171875,
-0.267822265625,
-0.247802734375,
0.0219268798828125,
0.52587890625,
0.324951171875,
-0.35595703125,
0.91162109375,
-0.418212890625,
-0.046295166015625,
-1.185546875,
-0.038543701171875,
0.51953125,
-0.11981201171875,
0.47216796875,
-0.54541015625,
0.27783203125,
-0.619140625,
-0.285400390625,
0.998046875,
-0.8427734375,
-0.67333984375,
0.183349609375,
-0.054656982421875,
0.0938720703125,
0.308349609375,
-0.033233642578125,
0.47705078125,
-0.34033203125,
0.798828125,
1.0498046875,
-1.029296875,
0.62158203125,
0.07025146484375,
-0.14111328125,
1.404296875,
0.4150390625,
0.1348876953125,
0.6572265625,
0.1959228515625,
-0.87158203125,
0.341552734375,
-0.90673828125,
0.59423828125,
0.2000732421875,
0.283203125,
-0.4697265625,
-0.0141448974609375,
0.23486328125,
0.2427978515625,
0.2998046875,
-0.08953857421875,
-0.55517578125,
0.03289794921875,
-0.482666015625,
0.92333984375,
-0.338623046875,
0.45849609375,
-0.229736328125,
-0.482421875,
-0.07025146484375,
-0.5947265625,
0.1763916015625,
-0.334716796875,
-0.2017822265625,
0.7607421875,
0.66064453125,
1.30078125,
0.74853515625,
-0.2340087890625,
-0.00614166259765625,
-0.2457275390625,
-0.2861328125,
-0.036773681640625,
0.1883544921875,
0.78857421875,
0.59716796875,
-0.1661376953125,
0.17041015625,
-0.2900390625,
-0.515625,
-0.7021484375,
-0.080078125,
0.6103515625,
-0.5576171875,
0.2900390625,
0.24951171875,
0.59521484375,
-0.83740234375,
0.283935546875,
-0.09722900390625,
-0.8125,
-0.455810546875,
1.01171875,
-0.32373046875,
0.5390625,
-0.12255859375,
-0.65771484375,
-0.055419921875,
1.25390625,
-0.412841796875,
0.0280914306640625,
0.830078125,
0.245361328125,
-0.50439453125,
-0.431396484375,
0.037384033203125,
-0.583984375,
-0.8330078125,
0.85791015625,
-0.5888671875,
0.060302734375,
0.279052734375,
0.583984375,
0.1282958984375,
0.222412109375,
-0.043731689453125,
-0.46044921875,
0.3603515625,
1.099609375,
0.02581787109375,
0.8232421875,
0.53271484375,
1.021484375,
0.505859375,
1.05859375,
0.55810546875,
0.156982421875,
0.87744140625,
1.0576171875,
-0.00986480712890625,
0.0858154296875,
-0.07183837890625,
0.40576171875,
0.5927734375,
0.438720703125,
-0.1729736328125,
0.564453125,
-0.207275390625,
-0.05615234375,
-0.66943359375,
0.324462890625,
-0.353271484375,
0.62890625,
0.332275390625,
0.8193359375,
-0.8076171875,
-0.67822265625,
0.422607421875,
0.388427734375,
-0.6552734375,
-0.50439453125,
0.03912353515625,
0.005794525146484375,
0.33251953125,
0.07110595703125,
0.457275390625,
0.79052734375,
0.318115234375,
0.53466796875,
-0.36474609375,
-0.9033203125,
-0.462890625,
-0.73095703125,
-1.23828125,
-0.381103515625,
-0.39794921875,
-0.14208984375,
0.55419921875,
-1.0595703125,
0.21435546875,
-0.1455078125,
-0.0943603515625,
-0.10479736328125,
-0.75341796875,
0.76416015625,
-0.64990234375,
0.595703125,
-0.6435546875,
0.452880859375,
0.1458740234375,
1.1376953125,
-0.6240234375,
-0.2188720703125,
-0.386962890625,
-0.30126953125,
0.58203125,
0.0190582275390625,
0.62451171875,
0.004016876220703125,
-1.0673828125,
-0.70361328125,
-0.26123046875,
0.017974853515625,
-0.189697265625,
0.521484375,
-0.97900390625,
1.009765625,
0.41552734375,
-0.7275390625,
0.6279296875,
0.96630859375,
-1.2724609375,
0.6884765625,
0.1942138671875,
0.52490234375,
-0.958984375,
0.66845703125,
0.341064453125,
0.297119140625,
-0.6748046875,
-0.348876953125,
-0.630859375,
-0.09588623046875,
0.26904296875,
-0.59228515625,
-0.046600341796875,
0.0975341796875,
0.040374755859375,
-1.2646484375,
0.66455078125,
-1.330078125,
-1.0869140625,
-0.24853515625,
-0.5732421875,
0.82763671875,
0.994140625,
0.224609375,
-0.58642578125,
0.08221435546875,
-0.280517578125,
0.6396484375,
0.7626953125,
-0.6181640625,
-0.03387451171875,
0.712890625,
-0.1025390625,
0.55078125,
0.51904296875,
-0.59912109375,
-0.297119140625,
-0.05889892578125,
0.1416015625,
0.81591796875,
0.34765625,
0.261474609375,
-0.333251953125,
0.9873046875,
-0.59228515625,
-0.59521484375,
0.325439453125,
0.39013671875,
-0.260009765625,
0.298095703125,
0.296142578125,
-0.432861328125,
-0.3525390625,
-0.52197265625,
0.4306640625,
0.153076171875,
0.64990234375,
-0.826171875,
0.796875,
0.07781982421875,
-0.71826171875,
0.337890625,
-0.73828125,
-0.375244140625,
1.365234375,
-0.1282958984375,
0.8583984375,
-0.468017578125,
0.51611328125,
-0.34716796875,
0.01248931884765625,
0.61181640625,
0.056976318359375,
0.7978515625,
-0.330322265625,
-0.46484375,
-0.55224609375,
0.042999267578125,
-0.10791015625,
-0.58056640625,
0.28173828125,
-0.291015625,
-0.072509765625,
-1.1376953125,
0.8876953125,
0.5751953125,
0.3232421875,
0.0189361572265625,
0.8125,
-0.03765869140625,
0.70166015625,
0.79541015625,
-0.275390625,
0.2568359375,
-0.8984375,
0.8984375,
0.0023860931396484375,
-0.08905029296875,
-0.2401123046875,
-0.421875,
-0.5654296875,
0.03167724609375,
-0.1483154296875,
-0.11065673828125,
-0.9140625,
0.3876953125,
0.0987548828125,
0.625,
-0.81640625,
-0.30517578125,
0.2017822265625,
0.6240234375,
0.1749267578125,
-0.61962890625,
-0.0262298583984375,
-0.73583984375,
0.72314453125,
0.5107421875,
-0.1336669921875,
-0.48681640625,
0.07177734375,
-0.44287109375,
-0.65625,
-0.026153564453125,
0.98095703125,
0.459228515625,
0.2413330078125,
-0.841796875,
0.57177734375,
0.55517578125,
-0.12158203125,
-0.12939453125,
0.030059814453125,
0.5302734375,
0.256591796875,
0.5068359375,
-0.45263671875,
-0.84228515625,
0.343505859375,
-1.04296875,
0.424560546875,
-0.68896484375,
0.2225341796875,
-0.0535888671875,
-0.2958984375,
-0.07537841796875,
0.465576171875,
-0.33154296875,
0.24755859375,
-0.016387939453125,
0.60107421875,
-1.06640625,
-0.470703125,
0.072265625,
-0.1043701171875,
-0.73828125,
0.505859375,
0.2127685546875,
-0.56298828125,
0.3095703125,
0.455078125,
-0.2332763671875,
0.42236328125,
-0.99951171875,
0.353271484375,
-0.275146484375,
-0.3291015625,
-0.159423828125,
-0.460693359375,
0.13037109375,
0.2890625,
-1.1064453125,
-0.233154296875,
-1.25390625,
-0.364501953125,
0.0445556640625,
-0.28369140625,
0.38916015625,
0.249267578125,
-0.217041015625,
0.1212158203125,
-0.63623046875,
-0.83935546875,
-0.428955078125,
-0.2489013671875,
-0.34521484375,
0.22265625,
0.324462890625,
0.8603515625,
0.07916259765625,
-0.39990234375,
0.2318115234375,
0.1925048828125,
-0.327880859375,
-0.8515625,
-0.061492919921875,
-0.0645751953125,
-0.37744140625,
-0.11566162109375,
0.5283203125,
-0.1572265625,
0.21240234375,
1.0224609375,
0.00989532470703125,
0.404052734375,
0.248046875,
-0.7509765625,
1.048828125,
0.0537109375,
-1.02734375,
-0.56689453125,
0.66259765625,
0.2103271484375,
0.2861328125,
0.15869140625,
-0.5859375,
-1.005859375,
-1.1796875,
0.005619049072265625,
-0.6455078125,
-0.20703125,
-0.54638671875,
-0.353759765625,
0.0836181640625,
0.8798828125,
0.04876708984375,
-0.426513671875,
-0.112060546875,
-1.4365234375,
0.3232421875,
-0.8681640625,
-0.266845703125,
-0.65478515625,
-0.314208984375,
-0.395751953125,
1.162109375,
0.3369140625,
0.64794921875,
-0.2186279296875,
-0.2119140625,
-0.0242767333984375,
0.0188140869140625,
-0.60888671875,
-0.44091796875,
-0.03521728515625,
-0.266845703125,
-0.2783203125,
0.04852294921875,
-0.6279296875,
0.64599609375,
-1.0732421875,
0.007720947265625,
-0.49072265625,
-0.4326171875,
-0.46435546875,
-0.39306640625,
1.453125,
-0.233154296875,
-0.315673828125,
-0.2093505859375,
0.79345703125,
0.4375,
-0.313232421875,
-0.78857421875,
-0.53955078125,
-0.759765625,
-0.91357421875,
0.9833984375,
-0.4638671875,
-0.129150390625,
-0.399658203125,
0.11968994140625,
0.86083984375,
0.0023326873779296875,
0.36376953125,
1.302734375,
0.424072265625,
0.072509765625,
-1.318359375,
0.916015625,
0.58251953125,
-0.54638671875,
-0.0428466796875,
0.20361328125,
-0.5234375,
0.29248046875,
-0.73779296875,
-1.15625,
-0.55712890625,
-0.234619140625,
1.23828125,
-0.04913330078125,
1.14453125,
-0.30078125,
-0.80615234375,
-0.5810546875,
0.88818359375,
0.36328125,
-0.0139923095703125,
0.78369140625,
0.0904541015625,
-0.06292724609375,
0.277099609375,
0.050689697265625,
-0.328369140625,
-0.61767578125,
0.98486328125,
-0.01502227783203125,
-0.615234375,
1.0078125,
0.91650390625,
-0.8486328125,
-0.76806640625,
-0.0972900390625,
-0.05633544921875,
-0.33544921875,
-0.93994140625,
0.1549072265625,
0.54248046875,
-0.46142578125,
0.0070953369140625,
0.484130859375,
-0.481201171875,
0.037841796875,
0.1588134765625,
0.018951416015625,
-0.264404296875,
0.1416015625,
0.57861328125,
-1.2373046875,
-0.23193359375,
-0.86279296875,
-0.0615234375,
-0.0201873779296875,
0.015380859375,
0.96240234375,
-0.377685546875,
0.68408203125,
0.46044921875,
-0.0098114013671875,
0.9599609375,
-0.720703125,
-0.52734375,
0.56494140625,
-1.1328125,
-0.33203125,
-0.140625,
0.427001953125,
-0.25732421875,
0.407470703125,
-0.75146484375,
0.07757568359375,
0.45849609375,
0.5107421875,
0.1834716796875,
-0.818359375,
-0.7041015625,
-1.21484375,
-0.362060546875,
-0.328369140625,
-0.3955078125,
-0.71923828125,
0.294189453125,
0.3623046875,
-0.5205078125,
-0.0311431884765625,
0.50927734375,
-0.56640625,
0.662109375,
-0.91162109375,
0.54150390625,
-0.72119140625,
-0.3935546875,
-0.4150390625,
0.289794921875,
-0.2919921875,
0.0355224609375,
-0.2132568359375,
0.1368408203125,
0.1063232421875,
0.6328125,
-0.42333984375,
0.3056640625,
-0.2117919921875,
-0.2396240234375,
0.33544921875,
0.02862548828125,
-0.17138671875,
0.6474609375,
0.8173828125,
-0.19775390625,
0.19140625,
-0.6591796875,
-0.333740234375,
-0.1983642578125,
0.06536865234375,
0.576171875,
-0.2646484375,
-0.018524169921875,
-0.41943359375,
0.038421630859375,
-0.80517578125,
-0.1378173828125,
-0.346923828125,
0.24853515625,
0.03955078125,
-0.311279296875,
0.271728515625,
0.978515625,
0.2169189453125,
0.451416015625,
-0.419189453125,
0.61376953125,
0.5166015625,
0.043212890625,
-0.07110595703125,
0.69189453125,
0.3525390625,
-0.22509765625,
0.6806640625,
0.403076171875,
-0.203857421875,
0.52001953125,
-0.2076416015625,
-1.1962890625,
-1.044921875,
0.0655517578125,
0.2359619140625,
0.1812744140625,
0.5546875,
-0.318359375,
-0.08843994140625,
-0.409423828125,
-0.802734375,
-0.1461181640625,
-0.888671875,
-0.8330078125,
0.406494140625,
-0.0021953582763671875,
-0.24560546875,
0.013519287109375,
-0.4541015625,
-0.1195068359375,
0.2333984375,
0.32568359375,
-0.47021484375,
0.389404296875,
0.10919189453125,
0.48779296875,
-0.375244140625,
0.0187225341796875,
-0.0299835205078125,
0.4287109375,
-0.2484130859375,
-0.681640625,
0.367431640625,
0.8291015625,
0.267578125,
-0.093994140625,
-0.68603515625,
0.2376708984375,
0.00463104248046875,
-0.021392822265625,
-0.5791015625,
0.4140625,
0.219970703125,
0.50927734375,
-0.77685546875,
0.27001953125,
-0.034698486328125,
0.421630859375,
0.60693359375,
-0.11773681640625,
-0.669921875,
0.77099609375,
0.529296875,
-0.18115234375,
0.417236328125,
0.3173828125,
0.5615234375,
0.1077880859375,
-0.2191162109375,
-0.461669921875,
0.978515625,
0.6044921875,
0.37646484375,
-0.28369140625,
0.219970703125,
0.791015625,
-0.0308074951171875,
-0.298095703125,
0.4951171875,
0.50439453125,
-0.162841796875,
-0.005367279052734375,
-0.472900390625,
-0.402587890625,
-0.01226806640625,
-0.370849609375,
0.1317138671875,
-0.58154296875,
-0.059356689453125,
-0.51416015625,
-0.625,
0.8359375,
0.05126953125,
0.010406494140625,
-0.1494140625,
-0.54052734375,
0.476318359375,
0.76123046875,
0.1815185546875,
0.1700439453125,
0.79638671875,
1.015625,
0.43798828125,
0.70068359375,
0.358642578125,
0.52099609375,
-0.93115234375,
-0.2103271484375,
-0.0172576904296875,
-0.06488037109375,
-0.51416015625,
-0.7431640625,
-0.966796875,
0.72900390625,
-0.62158203125,
-0.70166015625,
0.529296875,
-1.0068359375,
0.148681640625,
-0.175048828125,
0.59521484375,
-0.51416015625,
0.08538818359375,
0.285888671875,
-0.372802734375,
-0.53955078125,
1.013671875,
0.044921875,
0.85986328125,
0.51708984375,
1.203125,
-0.0982666015625,
1.505859375,
0.64599609375,
-0.45458984375,
0.1839599609375,
0.44921875,
-0.455810546875,
-0.6455078125,
0.07659912109375,
-0.5048828125,
-0.053497314453125,
-0.3134765625,
-0.56787109375,
0.08209228515625,
0.845703125,
0.01849365234375,
-0.763671875,
-0.357421875,
0.36474609375,
-0.51513671875,
0.51416015625,
-0.0347900390625,
0.289794921875,
0.164306640625,
0.17919921875,
-0.373291015625,
-0.6953125,
0.3623046875,
-0.49853515625,
0.59765625,
-0.485595703125,
-0.9970703125,
-0.51611328125,
-0.6669921875,
-0.486083984375,
-0.0008263587951660156,
-0.381103515625,
-0.79833984375,
0.29248046875,
0.6845703125,
0.46435546875,
-0.08526611328125,
-0.5986328125,
-0.209716796875,
0.6533203125,
1.0654296875,
0.151123046875,
0.9619140625,
0.58447265625,
-0.2724609375,
0.481689453125,
-0.5322265625,
0.89990234375,
0.21240234375,
0.0869140625,
-0.666015625,
0.1719970703125,
-0.296630859375,
-1.3037109375,
0.2391357421875,
0.53662109375,
0.454833984375,
-0.411865234375,
-1.3134765625,
-0.76416015625,
-0.58984375,
-0.39208984375,
-0.71240234375,
0.8603515625,
0.16748046875,
-0.182861328125,
0.036407470703125,
-1.1572265625,
4.171875,
1.1875,
1.076171875,
0.5791015625,
0.642578125,
1.005859375,
0.6416015625,
-0.71630859375,
-0.09234619140625,
-0.7548828125,
0.373291015625,
-0.677734375,
-0.36474609375,
0.75439453125,
0.1583251953125,
0.5595703125,
-0.1943359375,
0.45654296875,
-0.2286376953125,
-0.87841796875,
-0.6669921875,
0.006282806396484375,
0.209228515625,
0.53564453125,
0.3388671875,
0.07318115234375,
0.5888671875,
-0.86279296875,
-0.11187744140625,
-0.62353515625,
0.19482421875,
-0.8076171875,
0.85302734375,
0.3779296875,
-0.47314453125,
0.55615234375,
0.0306549072265625,
-0.61572265625,
-0.471923828125,
0.04296875,
-0.5234375,
-0.051666259765625,
0.88134765625,
-0.5771484375,
0.11065673828125,
0.456298828125,
-0.59716796875,
0.88427734375,
0.412841796875,
-0.931640625,
1.21484375,
-0.46484375,
0.340576171875,
-0.49853515625,
-0.82373046875,
0.02001953125,
0.33251953125,
-0.3525390625,
-0.47705078125,
0.61572265625,
-0.1473388671875,
0.07891845703125,
0.0838623046875,
1.021484375,
-1.056640625,
1.048828125,
0.12152099609375,
0.389892578125,
-0.71435546875,
-0.124755859375,
-0.224365234375,
0.061553955078125,
-0.342529296875,
-0.454345703125,
0.368408203125,
0.06201171875,
-0.61083984375,
1.0048828125,
0.2418212890625,
-0.422607421875,
0.027740478515625,
-0.244140625,
-0.658203125,
-0.0916748046875,
0.47509765625,
1.2109375,
-0.487548828125,
-0.1087646484375,
-0.32275390625,
1.02734375,
0.7783203125,
0.329833984375,
-0.039031982421875,
-0.533203125,
-0.188720703125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules:
* There are three parts of speech: the adjective, the noun, the verb. Each word in his language is an adjective, noun or verb.
* There are two genders: masculine and feminine. Each word in his language has gender either masculine or feminine.
* Masculine adjectives end with -lios, and feminine adjectives end with -liala.
* Masculine nouns end with -etr, and feminime nouns end with -etra.
* Masculine verbs end with -initis, and feminime verbs end with -inites.
* Thus, each word in the Petya's language has one of the six endings, given above. There are no other endings in Petya's language.
* It is accepted that the whole word consists of an ending. That is, words "lios", "liala", "etr" and so on belong to the Petya's language.
* There aren't any punctuation marks, grammatical tenses, singular/plural forms or other language complications.
* A sentence is either exactly one valid language word or exactly one statement.
Statement is any sequence of the Petya's language, that satisfy both conditions:
* Words in statement follow in the following order (from the left to the right): zero or more adjectives followed by exactly one noun followed by zero or more verbs.
* All words in the statement should have the same gender.
After Petya's friend Vasya wrote instant messenger (an instant messaging program) that supported the Petya's language, Petya wanted to add spelling and grammar checking to the program. As Vasya was in the country and Petya didn't feel like waiting, he asked you to help him with this problem. Your task is to define by a given sequence of words, whether it is true that the given text represents exactly one sentence in Petya's language.
Input
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105.
It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that given words do not belong to the Petya's language.
Output
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
Examples
Input
petr
Output
YES
Input
etis atis animatis etis atis amatis
Output
NO
Input
nataliala kataliala vetra feinites
Output
YES
Tags: implementation, strings
Correct Solution:
```
s = input().split(' ');
a = []
b = [0] * 6
for x in s:
if x[-4:] == "lios":
a.append(0)
b[0] += 1
elif x[-5:] == "liala":
a.append(3)
b[3] += 1
elif x[-3:] == "etr":
a.append(1)
b[1] += 1
elif x[-4:] == "etra":
a.append(4)
b[4] += 1
elif x[-6:] == "initis":
a.append(2)
b[2] += 1
elif x[-6:] == "inites":
a.append(5)
b[5] += 1
else :
print("NO")
# print(b,a)
exit(0)
# print(b,a)
if len(s) == 1 and (b[0] > 0 or b[1] > 0 or b[2] > 0 or b[3] > 0 or b[4] > 0 or b[5] > 0):
print("YES")
exit(0)
if (b[0] > 0 or b[1] > 0 or b[2] > 0) and (b[3] > 0 or b[4] > 0 or b[5] > 0) :
print("NO")
exit(0)
if not (b[1] == 1 or b[4] == 1):
print("NO")
exit(0)
n = len(s)
for i in range(1, n):
if(a[i] < a[i - 1]) :
print("NO")
exit(0)
print("YES")
```
| 37,814
|
[
0.1558837890625,
-0.245361328125,
-0.1279296875,
0.40234375,
-0.451171875,
-0.431884765625,
0.00937652587890625,
0.347412109375,
-0.0406494140625,
0.2293701171875,
0.552734375,
0.050140380859375,
0.34423828125,
-0.7294921875,
-0.599609375,
0.0022335052490234375,
-0.45556640625,
-0.96337890625,
-0.75390625,
0.357177734375,
0.2152099609375,
-0.1925048828125,
-1.8642578125,
-0.024169921875,
-0.83349609375,
0.92578125,
0.3037109375,
0.452880859375,
1.2314453125,
0.90185546875,
-0.08343505859375,
0.10675048828125,
0.34814453125,
-0.8017578125,
-0.101806640625,
-0.1014404296875,
0.52587890625,
-0.61328125,
-0.448974609375,
-0.73291015625,
0.6865234375,
-0.408447265625,
0.63916015625,
-0.62060546875,
-0.9765625,
0.043731689453125,
-0.11480712890625,
-0.59912109375,
-0.0966796875,
-0.1199951171875,
0.44189453125,
-0.283447265625,
0.494140625,
-0.006664276123046875,
0.036468505859375,
-0.4130859375,
-0.07489013671875,
0.367919921875,
-0.8662109375,
0.017578125,
0.07562255859375,
0.5517578125,
-0.16943359375,
-0.70751953125,
-0.055084228515625,
0.312255859375,
0.301513671875,
0.0322265625,
-0.033935546875,
-0.71484375,
-0.268310546875,
0.2147216796875,
-0.4365234375,
-0.6630859375,
-0.720703125,
0.103759765625,
0.39697265625,
-0.139404296875,
-0.4921875,
0.363037109375,
0.356201171875,
1.2451171875,
0.4140625,
0.1302490234375,
-0.71337890625,
-0.85107421875,
0.04351806640625,
0.685546875,
-0.0295257568359375,
-0.1343994140625,
-0.11444091796875,
0.1513671875,
-0.48876953125,
-0.01142120361328125,
0.828125,
0.57177734375,
-0.1781005859375,
0.3095703125,
0.10687255859375,
0.1456298828125,
0.62939453125,
0.91455078125,
-0.2109375,
1.056640625,
-0.759765625,
-0.07684326171875,
0.4384765625,
0.1461181640625,
-0.0298309326171875,
-0.267822265625,
-0.247802734375,
0.0219268798828125,
0.52587890625,
0.324951171875,
-0.35595703125,
0.91162109375,
-0.418212890625,
-0.046295166015625,
-1.185546875,
-0.038543701171875,
0.51953125,
-0.11981201171875,
0.47216796875,
-0.54541015625,
0.27783203125,
-0.619140625,
-0.285400390625,
0.998046875,
-0.8427734375,
-0.67333984375,
0.183349609375,
-0.054656982421875,
0.0938720703125,
0.308349609375,
-0.033233642578125,
0.47705078125,
-0.34033203125,
0.798828125,
1.0498046875,
-1.029296875,
0.62158203125,
0.07025146484375,
-0.14111328125,
1.404296875,
0.4150390625,
0.1348876953125,
0.6572265625,
0.1959228515625,
-0.87158203125,
0.341552734375,
-0.90673828125,
0.59423828125,
0.2000732421875,
0.283203125,
-0.4697265625,
-0.0141448974609375,
0.23486328125,
0.2427978515625,
0.2998046875,
-0.08953857421875,
-0.55517578125,
0.03289794921875,
-0.482666015625,
0.92333984375,
-0.338623046875,
0.45849609375,
-0.229736328125,
-0.482421875,
-0.07025146484375,
-0.5947265625,
0.1763916015625,
-0.334716796875,
-0.2017822265625,
0.7607421875,
0.66064453125,
1.30078125,
0.74853515625,
-0.2340087890625,
-0.00614166259765625,
-0.2457275390625,
-0.2861328125,
-0.036773681640625,
0.1883544921875,
0.78857421875,
0.59716796875,
-0.1661376953125,
0.17041015625,
-0.2900390625,
-0.515625,
-0.7021484375,
-0.080078125,
0.6103515625,
-0.5576171875,
0.2900390625,
0.24951171875,
0.59521484375,
-0.83740234375,
0.283935546875,
-0.09722900390625,
-0.8125,
-0.455810546875,
1.01171875,
-0.32373046875,
0.5390625,
-0.12255859375,
-0.65771484375,
-0.055419921875,
1.25390625,
-0.412841796875,
0.0280914306640625,
0.830078125,
0.245361328125,
-0.50439453125,
-0.431396484375,
0.037384033203125,
-0.583984375,
-0.8330078125,
0.85791015625,
-0.5888671875,
0.060302734375,
0.279052734375,
0.583984375,
0.1282958984375,
0.222412109375,
-0.043731689453125,
-0.46044921875,
0.3603515625,
1.099609375,
0.02581787109375,
0.8232421875,
0.53271484375,
1.021484375,
0.505859375,
1.05859375,
0.55810546875,
0.156982421875,
0.87744140625,
1.0576171875,
-0.00986480712890625,
0.0858154296875,
-0.07183837890625,
0.40576171875,
0.5927734375,
0.438720703125,
-0.1729736328125,
0.564453125,
-0.207275390625,
-0.05615234375,
-0.66943359375,
0.324462890625,
-0.353271484375,
0.62890625,
0.332275390625,
0.8193359375,
-0.8076171875,
-0.67822265625,
0.422607421875,
0.388427734375,
-0.6552734375,
-0.50439453125,
0.03912353515625,
0.005794525146484375,
0.33251953125,
0.07110595703125,
0.457275390625,
0.79052734375,
0.318115234375,
0.53466796875,
-0.36474609375,
-0.9033203125,
-0.462890625,
-0.73095703125,
-1.23828125,
-0.381103515625,
-0.39794921875,
-0.14208984375,
0.55419921875,
-1.0595703125,
0.21435546875,
-0.1455078125,
-0.0943603515625,
-0.10479736328125,
-0.75341796875,
0.76416015625,
-0.64990234375,
0.595703125,
-0.6435546875,
0.452880859375,
0.1458740234375,
1.1376953125,
-0.6240234375,
-0.2188720703125,
-0.386962890625,
-0.30126953125,
0.58203125,
0.0190582275390625,
0.62451171875,
0.004016876220703125,
-1.0673828125,
-0.70361328125,
-0.26123046875,
0.017974853515625,
-0.189697265625,
0.521484375,
-0.97900390625,
1.009765625,
0.41552734375,
-0.7275390625,
0.6279296875,
0.96630859375,
-1.2724609375,
0.6884765625,
0.1942138671875,
0.52490234375,
-0.958984375,
0.66845703125,
0.341064453125,
0.297119140625,
-0.6748046875,
-0.348876953125,
-0.630859375,
-0.09588623046875,
0.26904296875,
-0.59228515625,
-0.046600341796875,
0.0975341796875,
0.040374755859375,
-1.2646484375,
0.66455078125,
-1.330078125,
-1.0869140625,
-0.24853515625,
-0.5732421875,
0.82763671875,
0.994140625,
0.224609375,
-0.58642578125,
0.08221435546875,
-0.280517578125,
0.6396484375,
0.7626953125,
-0.6181640625,
-0.03387451171875,
0.712890625,
-0.1025390625,
0.55078125,
0.51904296875,
-0.59912109375,
-0.297119140625,
-0.05889892578125,
0.1416015625,
0.81591796875,
0.34765625,
0.261474609375,
-0.333251953125,
0.9873046875,
-0.59228515625,
-0.59521484375,
0.325439453125,
0.39013671875,
-0.260009765625,
0.298095703125,
0.296142578125,
-0.432861328125,
-0.3525390625,
-0.52197265625,
0.4306640625,
0.153076171875,
0.64990234375,
-0.826171875,
0.796875,
0.07781982421875,
-0.71826171875,
0.337890625,
-0.73828125,
-0.375244140625,
1.365234375,
-0.1282958984375,
0.8583984375,
-0.468017578125,
0.51611328125,
-0.34716796875,
0.01248931884765625,
0.61181640625,
0.056976318359375,
0.7978515625,
-0.330322265625,
-0.46484375,
-0.55224609375,
0.042999267578125,
-0.10791015625,
-0.58056640625,
0.28173828125,
-0.291015625,
-0.072509765625,
-1.1376953125,
0.8876953125,
0.5751953125,
0.3232421875,
0.0189361572265625,
0.8125,
-0.03765869140625,
0.70166015625,
0.79541015625,
-0.275390625,
0.2568359375,
-0.8984375,
0.8984375,
0.0023860931396484375,
-0.08905029296875,
-0.2401123046875,
-0.421875,
-0.5654296875,
0.03167724609375,
-0.1483154296875,
-0.11065673828125,
-0.9140625,
0.3876953125,
0.0987548828125,
0.625,
-0.81640625,
-0.30517578125,
0.2017822265625,
0.6240234375,
0.1749267578125,
-0.61962890625,
-0.0262298583984375,
-0.73583984375,
0.72314453125,
0.5107421875,
-0.1336669921875,
-0.48681640625,
0.07177734375,
-0.44287109375,
-0.65625,
-0.026153564453125,
0.98095703125,
0.459228515625,
0.2413330078125,
-0.841796875,
0.57177734375,
0.55517578125,
-0.12158203125,
-0.12939453125,
0.030059814453125,
0.5302734375,
0.256591796875,
0.5068359375,
-0.45263671875,
-0.84228515625,
0.343505859375,
-1.04296875,
0.424560546875,
-0.68896484375,
0.2225341796875,
-0.0535888671875,
-0.2958984375,
-0.07537841796875,
0.465576171875,
-0.33154296875,
0.24755859375,
-0.016387939453125,
0.60107421875,
-1.06640625,
-0.470703125,
0.072265625,
-0.1043701171875,
-0.73828125,
0.505859375,
0.2127685546875,
-0.56298828125,
0.3095703125,
0.455078125,
-0.2332763671875,
0.42236328125,
-0.99951171875,
0.353271484375,
-0.275146484375,
-0.3291015625,
-0.159423828125,
-0.460693359375,
0.13037109375,
0.2890625,
-1.1064453125,
-0.233154296875,
-1.25390625,
-0.364501953125,
0.0445556640625,
-0.28369140625,
0.38916015625,
0.249267578125,
-0.217041015625,
0.1212158203125,
-0.63623046875,
-0.83935546875,
-0.428955078125,
-0.2489013671875,
-0.34521484375,
0.22265625,
0.324462890625,
0.8603515625,
0.07916259765625,
-0.39990234375,
0.2318115234375,
0.1925048828125,
-0.327880859375,
-0.8515625,
-0.061492919921875,
-0.0645751953125,
-0.37744140625,
-0.11566162109375,
0.5283203125,
-0.1572265625,
0.21240234375,
1.0224609375,
0.00989532470703125,
0.404052734375,
0.248046875,
-0.7509765625,
1.048828125,
0.0537109375,
-1.02734375,
-0.56689453125,
0.66259765625,
0.2103271484375,
0.2861328125,
0.15869140625,
-0.5859375,
-1.005859375,
-1.1796875,
0.005619049072265625,
-0.6455078125,
-0.20703125,
-0.54638671875,
-0.353759765625,
0.0836181640625,
0.8798828125,
0.04876708984375,
-0.426513671875,
-0.112060546875,
-1.4365234375,
0.3232421875,
-0.8681640625,
-0.266845703125,
-0.65478515625,
-0.314208984375,
-0.395751953125,
1.162109375,
0.3369140625,
0.64794921875,
-0.2186279296875,
-0.2119140625,
-0.0242767333984375,
0.0188140869140625,
-0.60888671875,
-0.44091796875,
-0.03521728515625,
-0.266845703125,
-0.2783203125,
0.04852294921875,
-0.6279296875,
0.64599609375,
-1.0732421875,
0.007720947265625,
-0.49072265625,
-0.4326171875,
-0.46435546875,
-0.39306640625,
1.453125,
-0.233154296875,
-0.315673828125,
-0.2093505859375,
0.79345703125,
0.4375,
-0.313232421875,
-0.78857421875,
-0.53955078125,
-0.759765625,
-0.91357421875,
0.9833984375,
-0.4638671875,
-0.129150390625,
-0.399658203125,
0.11968994140625,
0.86083984375,
0.0023326873779296875,
0.36376953125,
1.302734375,
0.424072265625,
0.072509765625,
-1.318359375,
0.916015625,
0.58251953125,
-0.54638671875,
-0.0428466796875,
0.20361328125,
-0.5234375,
0.29248046875,
-0.73779296875,
-1.15625,
-0.55712890625,
-0.234619140625,
1.23828125,
-0.04913330078125,
1.14453125,
-0.30078125,
-0.80615234375,
-0.5810546875,
0.88818359375,
0.36328125,
-0.0139923095703125,
0.78369140625,
0.0904541015625,
-0.06292724609375,
0.277099609375,
0.050689697265625,
-0.328369140625,
-0.61767578125,
0.98486328125,
-0.01502227783203125,
-0.615234375,
1.0078125,
0.91650390625,
-0.8486328125,
-0.76806640625,
-0.0972900390625,
-0.05633544921875,
-0.33544921875,
-0.93994140625,
0.1549072265625,
0.54248046875,
-0.46142578125,
0.0070953369140625,
0.484130859375,
-0.481201171875,
0.037841796875,
0.1588134765625,
0.018951416015625,
-0.264404296875,
0.1416015625,
0.57861328125,
-1.2373046875,
-0.23193359375,
-0.86279296875,
-0.0615234375,
-0.0201873779296875,
0.015380859375,
0.96240234375,
-0.377685546875,
0.68408203125,
0.46044921875,
-0.0098114013671875,
0.9599609375,
-0.720703125,
-0.52734375,
0.56494140625,
-1.1328125,
-0.33203125,
-0.140625,
0.427001953125,
-0.25732421875,
0.407470703125,
-0.75146484375,
0.07757568359375,
0.45849609375,
0.5107421875,
0.1834716796875,
-0.818359375,
-0.7041015625,
-1.21484375,
-0.362060546875,
-0.328369140625,
-0.3955078125,
-0.71923828125,
0.294189453125,
0.3623046875,
-0.5205078125,
-0.0311431884765625,
0.50927734375,
-0.56640625,
0.662109375,
-0.91162109375,
0.54150390625,
-0.72119140625,
-0.3935546875,
-0.4150390625,
0.289794921875,
-0.2919921875,
0.0355224609375,
-0.2132568359375,
0.1368408203125,
0.1063232421875,
0.6328125,
-0.42333984375,
0.3056640625,
-0.2117919921875,
-0.2396240234375,
0.33544921875,
0.02862548828125,
-0.17138671875,
0.6474609375,
0.8173828125,
-0.19775390625,
0.19140625,
-0.6591796875,
-0.333740234375,
-0.1983642578125,
0.06536865234375,
0.576171875,
-0.2646484375,
-0.018524169921875,
-0.41943359375,
0.038421630859375,
-0.80517578125,
-0.1378173828125,
-0.346923828125,
0.24853515625,
0.03955078125,
-0.311279296875,
0.271728515625,
0.978515625,
0.2169189453125,
0.451416015625,
-0.419189453125,
0.61376953125,
0.5166015625,
0.043212890625,
-0.07110595703125,
0.69189453125,
0.3525390625,
-0.22509765625,
0.6806640625,
0.403076171875,
-0.203857421875,
0.52001953125,
-0.2076416015625,
-1.1962890625,
-1.044921875,
0.0655517578125,
0.2359619140625,
0.1812744140625,
0.5546875,
-0.318359375,
-0.08843994140625,
-0.409423828125,
-0.802734375,
-0.1461181640625,
-0.888671875,
-0.8330078125,
0.406494140625,
-0.0021953582763671875,
-0.24560546875,
0.013519287109375,
-0.4541015625,
-0.1195068359375,
0.2333984375,
0.32568359375,
-0.47021484375,
0.389404296875,
0.10919189453125,
0.48779296875,
-0.375244140625,
0.0187225341796875,
-0.0299835205078125,
0.4287109375,
-0.2484130859375,
-0.681640625,
0.367431640625,
0.8291015625,
0.267578125,
-0.093994140625,
-0.68603515625,
0.2376708984375,
0.00463104248046875,
-0.021392822265625,
-0.5791015625,
0.4140625,
0.219970703125,
0.50927734375,
-0.77685546875,
0.27001953125,
-0.034698486328125,
0.421630859375,
0.60693359375,
-0.11773681640625,
-0.669921875,
0.77099609375,
0.529296875,
-0.18115234375,
0.417236328125,
0.3173828125,
0.5615234375,
0.1077880859375,
-0.2191162109375,
-0.461669921875,
0.978515625,
0.6044921875,
0.37646484375,
-0.28369140625,
0.219970703125,
0.791015625,
-0.0308074951171875,
-0.298095703125,
0.4951171875,
0.50439453125,
-0.162841796875,
-0.005367279052734375,
-0.472900390625,
-0.402587890625,
-0.01226806640625,
-0.370849609375,
0.1317138671875,
-0.58154296875,
-0.059356689453125,
-0.51416015625,
-0.625,
0.8359375,
0.05126953125,
0.010406494140625,
-0.1494140625,
-0.54052734375,
0.476318359375,
0.76123046875,
0.1815185546875,
0.1700439453125,
0.79638671875,
1.015625,
0.43798828125,
0.70068359375,
0.358642578125,
0.52099609375,
-0.93115234375,
-0.2103271484375,
-0.0172576904296875,
-0.06488037109375,
-0.51416015625,
-0.7431640625,
-0.966796875,
0.72900390625,
-0.62158203125,
-0.70166015625,
0.529296875,
-1.0068359375,
0.148681640625,
-0.175048828125,
0.59521484375,
-0.51416015625,
0.08538818359375,
0.285888671875,
-0.372802734375,
-0.53955078125,
1.013671875,
0.044921875,
0.85986328125,
0.51708984375,
1.203125,
-0.0982666015625,
1.505859375,
0.64599609375,
-0.45458984375,
0.1839599609375,
0.44921875,
-0.455810546875,
-0.6455078125,
0.07659912109375,
-0.5048828125,
-0.053497314453125,
-0.3134765625,
-0.56787109375,
0.08209228515625,
0.845703125,
0.01849365234375,
-0.763671875,
-0.357421875,
0.36474609375,
-0.51513671875,
0.51416015625,
-0.0347900390625,
0.289794921875,
0.164306640625,
0.17919921875,
-0.373291015625,
-0.6953125,
0.3623046875,
-0.49853515625,
0.59765625,
-0.485595703125,
-0.9970703125,
-0.51611328125,
-0.6669921875,
-0.486083984375,
-0.0008263587951660156,
-0.381103515625,
-0.79833984375,
0.29248046875,
0.6845703125,
0.46435546875,
-0.08526611328125,
-0.5986328125,
-0.209716796875,
0.6533203125,
1.0654296875,
0.151123046875,
0.9619140625,
0.58447265625,
-0.2724609375,
0.481689453125,
-0.5322265625,
0.89990234375,
0.21240234375,
0.0869140625,
-0.666015625,
0.1719970703125,
-0.296630859375,
-1.3037109375,
0.2391357421875,
0.53662109375,
0.454833984375,
-0.411865234375,
-1.3134765625,
-0.76416015625,
-0.58984375,
-0.39208984375,
-0.71240234375,
0.8603515625,
0.16748046875,
-0.182861328125,
0.036407470703125,
-1.1572265625,
4.171875,
1.1875,
1.076171875,
0.5791015625,
0.642578125,
1.005859375,
0.6416015625,
-0.71630859375,
-0.09234619140625,
-0.7548828125,
0.373291015625,
-0.677734375,
-0.36474609375,
0.75439453125,
0.1583251953125,
0.5595703125,
-0.1943359375,
0.45654296875,
-0.2286376953125,
-0.87841796875,
-0.6669921875,
0.006282806396484375,
0.209228515625,
0.53564453125,
0.3388671875,
0.07318115234375,
0.5888671875,
-0.86279296875,
-0.11187744140625,
-0.62353515625,
0.19482421875,
-0.8076171875,
0.85302734375,
0.3779296875,
-0.47314453125,
0.55615234375,
0.0306549072265625,
-0.61572265625,
-0.471923828125,
0.04296875,
-0.5234375,
-0.051666259765625,
0.88134765625,
-0.5771484375,
0.11065673828125,
0.456298828125,
-0.59716796875,
0.88427734375,
0.412841796875,
-0.931640625,
1.21484375,
-0.46484375,
0.340576171875,
-0.49853515625,
-0.82373046875,
0.02001953125,
0.33251953125,
-0.3525390625,
-0.47705078125,
0.61572265625,
-0.1473388671875,
0.07891845703125,
0.0838623046875,
1.021484375,
-1.056640625,
1.048828125,
0.12152099609375,
0.389892578125,
-0.71435546875,
-0.124755859375,
-0.224365234375,
0.061553955078125,
-0.342529296875,
-0.454345703125,
0.368408203125,
0.06201171875,
-0.61083984375,
1.0048828125,
0.2418212890625,
-0.422607421875,
0.027740478515625,
-0.244140625,
-0.658203125,
-0.0916748046875,
0.47509765625,
1.2109375,
-0.487548828125,
-0.1087646484375,
-0.32275390625,
1.02734375,
0.7783203125,
0.329833984375,
-0.039031982421875,
-0.533203125,
-0.188720703125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules:
* There are three parts of speech: the adjective, the noun, the verb. Each word in his language is an adjective, noun or verb.
* There are two genders: masculine and feminine. Each word in his language has gender either masculine or feminine.
* Masculine adjectives end with -lios, and feminine adjectives end with -liala.
* Masculine nouns end with -etr, and feminime nouns end with -etra.
* Masculine verbs end with -initis, and feminime verbs end with -inites.
* Thus, each word in the Petya's language has one of the six endings, given above. There are no other endings in Petya's language.
* It is accepted that the whole word consists of an ending. That is, words "lios", "liala", "etr" and so on belong to the Petya's language.
* There aren't any punctuation marks, grammatical tenses, singular/plural forms or other language complications.
* A sentence is either exactly one valid language word or exactly one statement.
Statement is any sequence of the Petya's language, that satisfy both conditions:
* Words in statement follow in the following order (from the left to the right): zero or more adjectives followed by exactly one noun followed by zero or more verbs.
* All words in the statement should have the same gender.
After Petya's friend Vasya wrote instant messenger (an instant messaging program) that supported the Petya's language, Petya wanted to add spelling and grammar checking to the program. As Vasya was in the country and Petya didn't feel like waiting, he asked you to help him with this problem. Your task is to define by a given sequence of words, whether it is true that the given text represents exactly one sentence in Petya's language.
Input
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105.
It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that given words do not belong to the Petya's language.
Output
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
Examples
Input
petr
Output
YES
Input
etis atis animatis etis atis amatis
Output
NO
Input
nataliala kataliala vetra feinites
Output
YES
Tags: implementation, strings
Correct Solution:
```
# from dust i have come dust i will be
#each should be of same gender
#adjective*-noun*1-verb*
a=list(map(str,input().split()))
t=[0]*len(a)
str=["lios","liala","etr","etra","initis","inites"]
if len(a)==1:
for i in range(6):
if a[0].endswith(str[i]):
print("YES")
exit(0)
print("NO")
exit(0)
for i in range(len(a)):
for j in range(6):
if a[i].endswith(str[j]):
t[i]=j+1
break
#not belonging in any language
if t[i]==0:
print("NO")
exit(0)
#all the t[]'s should be either or odd
rem=t[0]%2
for i in range(len(t)):
if t[i]%2!=rem:
print("NO")
exit(0)
x=sorted(t)
cnt=0
for i in range(len(t)):
if t[i]==3 or t[i]==4:
cnt+=1
if t[i]!=x[i]:
print("NO")
exit(0)
if cnt==1:
print("YES")
else:
print("NO")
```
| 37,815
|
[
0.1558837890625,
-0.245361328125,
-0.1279296875,
0.40234375,
-0.451171875,
-0.431884765625,
0.00937652587890625,
0.347412109375,
-0.0406494140625,
0.2293701171875,
0.552734375,
0.050140380859375,
0.34423828125,
-0.7294921875,
-0.599609375,
0.0022335052490234375,
-0.45556640625,
-0.96337890625,
-0.75390625,
0.357177734375,
0.2152099609375,
-0.1925048828125,
-1.8642578125,
-0.024169921875,
-0.83349609375,
0.92578125,
0.3037109375,
0.452880859375,
1.2314453125,
0.90185546875,
-0.08343505859375,
0.10675048828125,
0.34814453125,
-0.8017578125,
-0.101806640625,
-0.1014404296875,
0.52587890625,
-0.61328125,
-0.448974609375,
-0.73291015625,
0.6865234375,
-0.408447265625,
0.63916015625,
-0.62060546875,
-0.9765625,
0.043731689453125,
-0.11480712890625,
-0.59912109375,
-0.0966796875,
-0.1199951171875,
0.44189453125,
-0.283447265625,
0.494140625,
-0.006664276123046875,
0.036468505859375,
-0.4130859375,
-0.07489013671875,
0.367919921875,
-0.8662109375,
0.017578125,
0.07562255859375,
0.5517578125,
-0.16943359375,
-0.70751953125,
-0.055084228515625,
0.312255859375,
0.301513671875,
0.0322265625,
-0.033935546875,
-0.71484375,
-0.268310546875,
0.2147216796875,
-0.4365234375,
-0.6630859375,
-0.720703125,
0.103759765625,
0.39697265625,
-0.139404296875,
-0.4921875,
0.363037109375,
0.356201171875,
1.2451171875,
0.4140625,
0.1302490234375,
-0.71337890625,
-0.85107421875,
0.04351806640625,
0.685546875,
-0.0295257568359375,
-0.1343994140625,
-0.11444091796875,
0.1513671875,
-0.48876953125,
-0.01142120361328125,
0.828125,
0.57177734375,
-0.1781005859375,
0.3095703125,
0.10687255859375,
0.1456298828125,
0.62939453125,
0.91455078125,
-0.2109375,
1.056640625,
-0.759765625,
-0.07684326171875,
0.4384765625,
0.1461181640625,
-0.0298309326171875,
-0.267822265625,
-0.247802734375,
0.0219268798828125,
0.52587890625,
0.324951171875,
-0.35595703125,
0.91162109375,
-0.418212890625,
-0.046295166015625,
-1.185546875,
-0.038543701171875,
0.51953125,
-0.11981201171875,
0.47216796875,
-0.54541015625,
0.27783203125,
-0.619140625,
-0.285400390625,
0.998046875,
-0.8427734375,
-0.67333984375,
0.183349609375,
-0.054656982421875,
0.0938720703125,
0.308349609375,
-0.033233642578125,
0.47705078125,
-0.34033203125,
0.798828125,
1.0498046875,
-1.029296875,
0.62158203125,
0.07025146484375,
-0.14111328125,
1.404296875,
0.4150390625,
0.1348876953125,
0.6572265625,
0.1959228515625,
-0.87158203125,
0.341552734375,
-0.90673828125,
0.59423828125,
0.2000732421875,
0.283203125,
-0.4697265625,
-0.0141448974609375,
0.23486328125,
0.2427978515625,
0.2998046875,
-0.08953857421875,
-0.55517578125,
0.03289794921875,
-0.482666015625,
0.92333984375,
-0.338623046875,
0.45849609375,
-0.229736328125,
-0.482421875,
-0.07025146484375,
-0.5947265625,
0.1763916015625,
-0.334716796875,
-0.2017822265625,
0.7607421875,
0.66064453125,
1.30078125,
0.74853515625,
-0.2340087890625,
-0.00614166259765625,
-0.2457275390625,
-0.2861328125,
-0.036773681640625,
0.1883544921875,
0.78857421875,
0.59716796875,
-0.1661376953125,
0.17041015625,
-0.2900390625,
-0.515625,
-0.7021484375,
-0.080078125,
0.6103515625,
-0.5576171875,
0.2900390625,
0.24951171875,
0.59521484375,
-0.83740234375,
0.283935546875,
-0.09722900390625,
-0.8125,
-0.455810546875,
1.01171875,
-0.32373046875,
0.5390625,
-0.12255859375,
-0.65771484375,
-0.055419921875,
1.25390625,
-0.412841796875,
0.0280914306640625,
0.830078125,
0.245361328125,
-0.50439453125,
-0.431396484375,
0.037384033203125,
-0.583984375,
-0.8330078125,
0.85791015625,
-0.5888671875,
0.060302734375,
0.279052734375,
0.583984375,
0.1282958984375,
0.222412109375,
-0.043731689453125,
-0.46044921875,
0.3603515625,
1.099609375,
0.02581787109375,
0.8232421875,
0.53271484375,
1.021484375,
0.505859375,
1.05859375,
0.55810546875,
0.156982421875,
0.87744140625,
1.0576171875,
-0.00986480712890625,
0.0858154296875,
-0.07183837890625,
0.40576171875,
0.5927734375,
0.438720703125,
-0.1729736328125,
0.564453125,
-0.207275390625,
-0.05615234375,
-0.66943359375,
0.324462890625,
-0.353271484375,
0.62890625,
0.332275390625,
0.8193359375,
-0.8076171875,
-0.67822265625,
0.422607421875,
0.388427734375,
-0.6552734375,
-0.50439453125,
0.03912353515625,
0.005794525146484375,
0.33251953125,
0.07110595703125,
0.457275390625,
0.79052734375,
0.318115234375,
0.53466796875,
-0.36474609375,
-0.9033203125,
-0.462890625,
-0.73095703125,
-1.23828125,
-0.381103515625,
-0.39794921875,
-0.14208984375,
0.55419921875,
-1.0595703125,
0.21435546875,
-0.1455078125,
-0.0943603515625,
-0.10479736328125,
-0.75341796875,
0.76416015625,
-0.64990234375,
0.595703125,
-0.6435546875,
0.452880859375,
0.1458740234375,
1.1376953125,
-0.6240234375,
-0.2188720703125,
-0.386962890625,
-0.30126953125,
0.58203125,
0.0190582275390625,
0.62451171875,
0.004016876220703125,
-1.0673828125,
-0.70361328125,
-0.26123046875,
0.017974853515625,
-0.189697265625,
0.521484375,
-0.97900390625,
1.009765625,
0.41552734375,
-0.7275390625,
0.6279296875,
0.96630859375,
-1.2724609375,
0.6884765625,
0.1942138671875,
0.52490234375,
-0.958984375,
0.66845703125,
0.341064453125,
0.297119140625,
-0.6748046875,
-0.348876953125,
-0.630859375,
-0.09588623046875,
0.26904296875,
-0.59228515625,
-0.046600341796875,
0.0975341796875,
0.040374755859375,
-1.2646484375,
0.66455078125,
-1.330078125,
-1.0869140625,
-0.24853515625,
-0.5732421875,
0.82763671875,
0.994140625,
0.224609375,
-0.58642578125,
0.08221435546875,
-0.280517578125,
0.6396484375,
0.7626953125,
-0.6181640625,
-0.03387451171875,
0.712890625,
-0.1025390625,
0.55078125,
0.51904296875,
-0.59912109375,
-0.297119140625,
-0.05889892578125,
0.1416015625,
0.81591796875,
0.34765625,
0.261474609375,
-0.333251953125,
0.9873046875,
-0.59228515625,
-0.59521484375,
0.325439453125,
0.39013671875,
-0.260009765625,
0.298095703125,
0.296142578125,
-0.432861328125,
-0.3525390625,
-0.52197265625,
0.4306640625,
0.153076171875,
0.64990234375,
-0.826171875,
0.796875,
0.07781982421875,
-0.71826171875,
0.337890625,
-0.73828125,
-0.375244140625,
1.365234375,
-0.1282958984375,
0.8583984375,
-0.468017578125,
0.51611328125,
-0.34716796875,
0.01248931884765625,
0.61181640625,
0.056976318359375,
0.7978515625,
-0.330322265625,
-0.46484375,
-0.55224609375,
0.042999267578125,
-0.10791015625,
-0.58056640625,
0.28173828125,
-0.291015625,
-0.072509765625,
-1.1376953125,
0.8876953125,
0.5751953125,
0.3232421875,
0.0189361572265625,
0.8125,
-0.03765869140625,
0.70166015625,
0.79541015625,
-0.275390625,
0.2568359375,
-0.8984375,
0.8984375,
0.0023860931396484375,
-0.08905029296875,
-0.2401123046875,
-0.421875,
-0.5654296875,
0.03167724609375,
-0.1483154296875,
-0.11065673828125,
-0.9140625,
0.3876953125,
0.0987548828125,
0.625,
-0.81640625,
-0.30517578125,
0.2017822265625,
0.6240234375,
0.1749267578125,
-0.61962890625,
-0.0262298583984375,
-0.73583984375,
0.72314453125,
0.5107421875,
-0.1336669921875,
-0.48681640625,
0.07177734375,
-0.44287109375,
-0.65625,
-0.026153564453125,
0.98095703125,
0.459228515625,
0.2413330078125,
-0.841796875,
0.57177734375,
0.55517578125,
-0.12158203125,
-0.12939453125,
0.030059814453125,
0.5302734375,
0.256591796875,
0.5068359375,
-0.45263671875,
-0.84228515625,
0.343505859375,
-1.04296875,
0.424560546875,
-0.68896484375,
0.2225341796875,
-0.0535888671875,
-0.2958984375,
-0.07537841796875,
0.465576171875,
-0.33154296875,
0.24755859375,
-0.016387939453125,
0.60107421875,
-1.06640625,
-0.470703125,
0.072265625,
-0.1043701171875,
-0.73828125,
0.505859375,
0.2127685546875,
-0.56298828125,
0.3095703125,
0.455078125,
-0.2332763671875,
0.42236328125,
-0.99951171875,
0.353271484375,
-0.275146484375,
-0.3291015625,
-0.159423828125,
-0.460693359375,
0.13037109375,
0.2890625,
-1.1064453125,
-0.233154296875,
-1.25390625,
-0.364501953125,
0.0445556640625,
-0.28369140625,
0.38916015625,
0.249267578125,
-0.217041015625,
0.1212158203125,
-0.63623046875,
-0.83935546875,
-0.428955078125,
-0.2489013671875,
-0.34521484375,
0.22265625,
0.324462890625,
0.8603515625,
0.07916259765625,
-0.39990234375,
0.2318115234375,
0.1925048828125,
-0.327880859375,
-0.8515625,
-0.061492919921875,
-0.0645751953125,
-0.37744140625,
-0.11566162109375,
0.5283203125,
-0.1572265625,
0.21240234375,
1.0224609375,
0.00989532470703125,
0.404052734375,
0.248046875,
-0.7509765625,
1.048828125,
0.0537109375,
-1.02734375,
-0.56689453125,
0.66259765625,
0.2103271484375,
0.2861328125,
0.15869140625,
-0.5859375,
-1.005859375,
-1.1796875,
0.005619049072265625,
-0.6455078125,
-0.20703125,
-0.54638671875,
-0.353759765625,
0.0836181640625,
0.8798828125,
0.04876708984375,
-0.426513671875,
-0.112060546875,
-1.4365234375,
0.3232421875,
-0.8681640625,
-0.266845703125,
-0.65478515625,
-0.314208984375,
-0.395751953125,
1.162109375,
0.3369140625,
0.64794921875,
-0.2186279296875,
-0.2119140625,
-0.0242767333984375,
0.0188140869140625,
-0.60888671875,
-0.44091796875,
-0.03521728515625,
-0.266845703125,
-0.2783203125,
0.04852294921875,
-0.6279296875,
0.64599609375,
-1.0732421875,
0.007720947265625,
-0.49072265625,
-0.4326171875,
-0.46435546875,
-0.39306640625,
1.453125,
-0.233154296875,
-0.315673828125,
-0.2093505859375,
0.79345703125,
0.4375,
-0.313232421875,
-0.78857421875,
-0.53955078125,
-0.759765625,
-0.91357421875,
0.9833984375,
-0.4638671875,
-0.129150390625,
-0.399658203125,
0.11968994140625,
0.86083984375,
0.0023326873779296875,
0.36376953125,
1.302734375,
0.424072265625,
0.072509765625,
-1.318359375,
0.916015625,
0.58251953125,
-0.54638671875,
-0.0428466796875,
0.20361328125,
-0.5234375,
0.29248046875,
-0.73779296875,
-1.15625,
-0.55712890625,
-0.234619140625,
1.23828125,
-0.04913330078125,
1.14453125,
-0.30078125,
-0.80615234375,
-0.5810546875,
0.88818359375,
0.36328125,
-0.0139923095703125,
0.78369140625,
0.0904541015625,
-0.06292724609375,
0.277099609375,
0.050689697265625,
-0.328369140625,
-0.61767578125,
0.98486328125,
-0.01502227783203125,
-0.615234375,
1.0078125,
0.91650390625,
-0.8486328125,
-0.76806640625,
-0.0972900390625,
-0.05633544921875,
-0.33544921875,
-0.93994140625,
0.1549072265625,
0.54248046875,
-0.46142578125,
0.0070953369140625,
0.484130859375,
-0.481201171875,
0.037841796875,
0.1588134765625,
0.018951416015625,
-0.264404296875,
0.1416015625,
0.57861328125,
-1.2373046875,
-0.23193359375,
-0.86279296875,
-0.0615234375,
-0.0201873779296875,
0.015380859375,
0.96240234375,
-0.377685546875,
0.68408203125,
0.46044921875,
-0.0098114013671875,
0.9599609375,
-0.720703125,
-0.52734375,
0.56494140625,
-1.1328125,
-0.33203125,
-0.140625,
0.427001953125,
-0.25732421875,
0.407470703125,
-0.75146484375,
0.07757568359375,
0.45849609375,
0.5107421875,
0.1834716796875,
-0.818359375,
-0.7041015625,
-1.21484375,
-0.362060546875,
-0.328369140625,
-0.3955078125,
-0.71923828125,
0.294189453125,
0.3623046875,
-0.5205078125,
-0.0311431884765625,
0.50927734375,
-0.56640625,
0.662109375,
-0.91162109375,
0.54150390625,
-0.72119140625,
-0.3935546875,
-0.4150390625,
0.289794921875,
-0.2919921875,
0.0355224609375,
-0.2132568359375,
0.1368408203125,
0.1063232421875,
0.6328125,
-0.42333984375,
0.3056640625,
-0.2117919921875,
-0.2396240234375,
0.33544921875,
0.02862548828125,
-0.17138671875,
0.6474609375,
0.8173828125,
-0.19775390625,
0.19140625,
-0.6591796875,
-0.333740234375,
-0.1983642578125,
0.06536865234375,
0.576171875,
-0.2646484375,
-0.018524169921875,
-0.41943359375,
0.038421630859375,
-0.80517578125,
-0.1378173828125,
-0.346923828125,
0.24853515625,
0.03955078125,
-0.311279296875,
0.271728515625,
0.978515625,
0.2169189453125,
0.451416015625,
-0.419189453125,
0.61376953125,
0.5166015625,
0.043212890625,
-0.07110595703125,
0.69189453125,
0.3525390625,
-0.22509765625,
0.6806640625,
0.403076171875,
-0.203857421875,
0.52001953125,
-0.2076416015625,
-1.1962890625,
-1.044921875,
0.0655517578125,
0.2359619140625,
0.1812744140625,
0.5546875,
-0.318359375,
-0.08843994140625,
-0.409423828125,
-0.802734375,
-0.1461181640625,
-0.888671875,
-0.8330078125,
0.406494140625,
-0.0021953582763671875,
-0.24560546875,
0.013519287109375,
-0.4541015625,
-0.1195068359375,
0.2333984375,
0.32568359375,
-0.47021484375,
0.389404296875,
0.10919189453125,
0.48779296875,
-0.375244140625,
0.0187225341796875,
-0.0299835205078125,
0.4287109375,
-0.2484130859375,
-0.681640625,
0.367431640625,
0.8291015625,
0.267578125,
-0.093994140625,
-0.68603515625,
0.2376708984375,
0.00463104248046875,
-0.021392822265625,
-0.5791015625,
0.4140625,
0.219970703125,
0.50927734375,
-0.77685546875,
0.27001953125,
-0.034698486328125,
0.421630859375,
0.60693359375,
-0.11773681640625,
-0.669921875,
0.77099609375,
0.529296875,
-0.18115234375,
0.417236328125,
0.3173828125,
0.5615234375,
0.1077880859375,
-0.2191162109375,
-0.461669921875,
0.978515625,
0.6044921875,
0.37646484375,
-0.28369140625,
0.219970703125,
0.791015625,
-0.0308074951171875,
-0.298095703125,
0.4951171875,
0.50439453125,
-0.162841796875,
-0.005367279052734375,
-0.472900390625,
-0.402587890625,
-0.01226806640625,
-0.370849609375,
0.1317138671875,
-0.58154296875,
-0.059356689453125,
-0.51416015625,
-0.625,
0.8359375,
0.05126953125,
0.010406494140625,
-0.1494140625,
-0.54052734375,
0.476318359375,
0.76123046875,
0.1815185546875,
0.1700439453125,
0.79638671875,
1.015625,
0.43798828125,
0.70068359375,
0.358642578125,
0.52099609375,
-0.93115234375,
-0.2103271484375,
-0.0172576904296875,
-0.06488037109375,
-0.51416015625,
-0.7431640625,
-0.966796875,
0.72900390625,
-0.62158203125,
-0.70166015625,
0.529296875,
-1.0068359375,
0.148681640625,
-0.175048828125,
0.59521484375,
-0.51416015625,
0.08538818359375,
0.285888671875,
-0.372802734375,
-0.53955078125,
1.013671875,
0.044921875,
0.85986328125,
0.51708984375,
1.203125,
-0.0982666015625,
1.505859375,
0.64599609375,
-0.45458984375,
0.1839599609375,
0.44921875,
-0.455810546875,
-0.6455078125,
0.07659912109375,
-0.5048828125,
-0.053497314453125,
-0.3134765625,
-0.56787109375,
0.08209228515625,
0.845703125,
0.01849365234375,
-0.763671875,
-0.357421875,
0.36474609375,
-0.51513671875,
0.51416015625,
-0.0347900390625,
0.289794921875,
0.164306640625,
0.17919921875,
-0.373291015625,
-0.6953125,
0.3623046875,
-0.49853515625,
0.59765625,
-0.485595703125,
-0.9970703125,
-0.51611328125,
-0.6669921875,
-0.486083984375,
-0.0008263587951660156,
-0.381103515625,
-0.79833984375,
0.29248046875,
0.6845703125,
0.46435546875,
-0.08526611328125,
-0.5986328125,
-0.209716796875,
0.6533203125,
1.0654296875,
0.151123046875,
0.9619140625,
0.58447265625,
-0.2724609375,
0.481689453125,
-0.5322265625,
0.89990234375,
0.21240234375,
0.0869140625,
-0.666015625,
0.1719970703125,
-0.296630859375,
-1.3037109375,
0.2391357421875,
0.53662109375,
0.454833984375,
-0.411865234375,
-1.3134765625,
-0.76416015625,
-0.58984375,
-0.39208984375,
-0.71240234375,
0.8603515625,
0.16748046875,
-0.182861328125,
0.036407470703125,
-1.1572265625,
4.171875,
1.1875,
1.076171875,
0.5791015625,
0.642578125,
1.005859375,
0.6416015625,
-0.71630859375,
-0.09234619140625,
-0.7548828125,
0.373291015625,
-0.677734375,
-0.36474609375,
0.75439453125,
0.1583251953125,
0.5595703125,
-0.1943359375,
0.45654296875,
-0.2286376953125,
-0.87841796875,
-0.6669921875,
0.006282806396484375,
0.209228515625,
0.53564453125,
0.3388671875,
0.07318115234375,
0.5888671875,
-0.86279296875,
-0.11187744140625,
-0.62353515625,
0.19482421875,
-0.8076171875,
0.85302734375,
0.3779296875,
-0.47314453125,
0.55615234375,
0.0306549072265625,
-0.61572265625,
-0.471923828125,
0.04296875,
-0.5234375,
-0.051666259765625,
0.88134765625,
-0.5771484375,
0.11065673828125,
0.456298828125,
-0.59716796875,
0.88427734375,
0.412841796875,
-0.931640625,
1.21484375,
-0.46484375,
0.340576171875,
-0.49853515625,
-0.82373046875,
0.02001953125,
0.33251953125,
-0.3525390625,
-0.47705078125,
0.61572265625,
-0.1473388671875,
0.07891845703125,
0.0838623046875,
1.021484375,
-1.056640625,
1.048828125,
0.12152099609375,
0.389892578125,
-0.71435546875,
-0.124755859375,
-0.224365234375,
0.061553955078125,
-0.342529296875,
-0.454345703125,
0.368408203125,
0.06201171875,
-0.61083984375,
1.0048828125,
0.2418212890625,
-0.422607421875,
0.027740478515625,
-0.244140625,
-0.658203125,
-0.0916748046875,
0.47509765625,
1.2109375,
-0.487548828125,
-0.1087646484375,
-0.32275390625,
1.02734375,
0.7783203125,
0.329833984375,
-0.039031982421875,
-0.533203125,
-0.188720703125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules:
* There are three parts of speech: the adjective, the noun, the verb. Each word in his language is an adjective, noun or verb.
* There are two genders: masculine and feminine. Each word in his language has gender either masculine or feminine.
* Masculine adjectives end with -lios, and feminine adjectives end with -liala.
* Masculine nouns end with -etr, and feminime nouns end with -etra.
* Masculine verbs end with -initis, and feminime verbs end with -inites.
* Thus, each word in the Petya's language has one of the six endings, given above. There are no other endings in Petya's language.
* It is accepted that the whole word consists of an ending. That is, words "lios", "liala", "etr" and so on belong to the Petya's language.
* There aren't any punctuation marks, grammatical tenses, singular/plural forms or other language complications.
* A sentence is either exactly one valid language word or exactly one statement.
Statement is any sequence of the Petya's language, that satisfy both conditions:
* Words in statement follow in the following order (from the left to the right): zero or more adjectives followed by exactly one noun followed by zero or more verbs.
* All words in the statement should have the same gender.
After Petya's friend Vasya wrote instant messenger (an instant messaging program) that supported the Petya's language, Petya wanted to add spelling and grammar checking to the program. As Vasya was in the country and Petya didn't feel like waiting, he asked you to help him with this problem. Your task is to define by a given sequence of words, whether it is true that the given text represents exactly one sentence in Petya's language.
Input
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105.
It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that given words do not belong to the Petya's language.
Output
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
Examples
Input
petr
Output
YES
Input
etis atis animatis etis atis amatis
Output
NO
Input
nataliala kataliala vetra feinites
Output
YES
Submitted Solution:
```
words = [c for c in input().split()]
verdict = True
category = ["" for i in range(len(words))]
for i in range(len(words)):
if (not verdict): break
if (len(words[i]) < 3): verdict = False
elif (words[i][-3:] == "etr" or (len(words[i]) >= 4 and words[i][-4:] == "etra")): category[i] = "noun"
elif ((len(words[i]) >= 4 and words[i][-4:] == "lios") or (len(words[i]) >= 5 and words[i][-5:] == "liala")): category[i] = "adjective"
elif (len(words[i]) >= 6 and (words[i][-6:] == "initis" or words[i][-6:] == "inites")): category[i] = "verb"
else: verdict = False
first_noun = -1
for i in range(len(category)):
if (category[i] == "noun"):
first_noun = i
break
if (first_noun == -1): verdict = False
else:
left, right = first_noun - 1, first_noun + 1
while (left >= 0 and category[left] != "noun"): left -= 1
while (right < len(category) and category[right] != "noun"): right += 1
if (left >= 0 or right < len(category)): verdict = False
print(("NO" if (not verdict) else "YES"))
```
No
| 37,816
|
[
0.1998291015625,
-0.2152099609375,
-0.13330078125,
0.298828125,
-0.60205078125,
-0.340576171875,
-0.07452392578125,
0.45263671875,
-0.048187255859375,
0.22705078125,
0.496337890625,
0.0882568359375,
0.293701171875,
-0.67626953125,
-0.603515625,
0.018310546875,
-0.439208984375,
-0.9609375,
-0.79150390625,
0.2147216796875,
0.1339111328125,
-0.1953125,
-1.79296875,
0.0897216796875,
-0.82568359375,
0.8515625,
0.1939697265625,
0.395751953125,
1.185546875,
0.80712890625,
-0.08502197265625,
0.1046142578125,
0.30859375,
-0.7138671875,
-0.031707763671875,
-0.198486328125,
0.60791015625,
-0.63427734375,
-0.5712890625,
-0.8095703125,
0.5869140625,
-0.2734375,
0.69140625,
-0.70703125,
-1.052734375,
0.1357421875,
-0.10589599609375,
-0.59521484375,
-0.1365966796875,
-0.150634765625,
0.5419921875,
-0.27880859375,
0.46435546875,
-0.021148681640625,
0.09564208984375,
-0.2386474609375,
-0.04345703125,
0.296142578125,
-0.90771484375,
-0.01020050048828125,
0.0262451171875,
0.51123046875,
-0.2061767578125,
-0.798828125,
-0.050140380859375,
0.397216796875,
0.29541015625,
0.027618408203125,
0.039459228515625,
-0.454345703125,
-0.2342529296875,
0.22998046875,
-0.439697265625,
-0.47998046875,
-0.77783203125,
0.1763916015625,
0.31396484375,
-0.1591796875,
-0.60986328125,
0.38623046875,
0.315673828125,
1.3193359375,
0.467529296875,
0.22265625,
-0.68994140625,
-0.7587890625,
0.104248046875,
0.662109375,
-0.036163330078125,
-0.148193359375,
0.1083984375,
0.1824951171875,
-0.5107421875,
-0.027313232421875,
0.84521484375,
0.54248046875,
-0.197021484375,
0.270263671875,
0.10833740234375,
0.12420654296875,
0.640625,
0.8037109375,
-0.2213134765625,
1.09375,
-0.75390625,
-0.10638427734375,
0.409912109375,
0.0266876220703125,
0.033111572265625,
-0.227294921875,
-0.14697265625,
0.010009765625,
0.48193359375,
0.281494140625,
-0.5048828125,
0.88134765625,
-0.2734375,
-0.06512451171875,
-1.091796875,
-0.09521484375,
0.56689453125,
-0.08612060546875,
0.56005859375,
-0.43896484375,
0.302001953125,
-0.59765625,
-0.3544921875,
0.9541015625,
-0.787109375,
-0.65576171875,
0.2264404296875,
-0.1021728515625,
-0.0004963874816894531,
0.25634765625,
0.0179901123046875,
0.47021484375,
-0.352783203125,
0.7568359375,
1.02734375,
-0.97998046875,
0.66064453125,
-0.00852203369140625,
-0.048126220703125,
1.419921875,
0.3251953125,
0.120361328125,
0.54296875,
0.207275390625,
-0.8212890625,
0.380859375,
-0.8271484375,
0.53076171875,
0.11871337890625,
0.2318115234375,
-0.480224609375,
-0.01282501220703125,
0.2420654296875,
0.177490234375,
0.283935546875,
-0.099853515625,
-0.51171875,
0.0404052734375,
-0.548828125,
0.8623046875,
-0.36572265625,
0.49609375,
-0.2041015625,
-0.39599609375,
-0.12646484375,
-0.52978515625,
0.231201171875,
-0.3701171875,
-0.07586669921875,
0.865234375,
0.65185546875,
1.3134765625,
0.78271484375,
-0.2109375,
-0.079345703125,
-0.21533203125,
-0.3056640625,
-0.09429931640625,
0.25048828125,
0.76416015625,
0.626953125,
-0.05609130859375,
0.185791015625,
-0.1373291015625,
-0.484130859375,
-0.697265625,
-0.10040283203125,
0.7607421875,
-0.55810546875,
0.35986328125,
0.146728515625,
0.642578125,
-0.8232421875,
0.232666015625,
-0.093017578125,
-0.9501953125,
-0.5634765625,
1.017578125,
-0.26904296875,
0.544921875,
-0.1219482421875,
-0.6982421875,
-0.103759765625,
1.173828125,
-0.45068359375,
0.09893798828125,
0.80029296875,
0.32666015625,
-0.5244140625,
-0.4453125,
0.0233306884765625,
-0.52978515625,
-0.8037109375,
0.7783203125,
-0.58544921875,
0.0116424560546875,
0.3251953125,
0.611328125,
0.0823974609375,
0.343017578125,
-0.1727294921875,
-0.447998046875,
0.25048828125,
1.1552734375,
0.016845703125,
0.78466796875,
0.5751953125,
1.021484375,
0.60888671875,
1.140625,
0.6083984375,
0.21875,
1.03515625,
1.009765625,
-0.0953369140625,
0.1607666015625,
-0.07354736328125,
0.486572265625,
0.54345703125,
0.4111328125,
-0.054840087890625,
0.5419921875,
-0.1846923828125,
-0.040069580078125,
-0.65771484375,
0.30908203125,
-0.315673828125,
0.634765625,
0.2435302734375,
0.9072265625,
-0.70361328125,
-0.67138671875,
0.50732421875,
0.40869140625,
-0.70654296875,
-0.6484375,
0.00433349609375,
-0.05126953125,
0.328125,
0.2244873046875,
0.411865234375,
0.62158203125,
0.322265625,
0.64208984375,
-0.339599609375,
-0.9091796875,
-0.451171875,
-0.7978515625,
-1.2744140625,
-0.3388671875,
-0.484130859375,
-0.2423095703125,
0.52880859375,
-1.1435546875,
0.1798095703125,
-0.173095703125,
-0.191650390625,
-0.07781982421875,
-0.64501953125,
0.79833984375,
-0.5869140625,
0.619140625,
-0.595703125,
0.370849609375,
0.2734375,
1.1123046875,
-0.669921875,
-0.1849365234375,
-0.357177734375,
-0.292236328125,
0.60693359375,
0.048309326171875,
0.5810546875,
0.01020050048828125,
-1.06640625,
-0.89013671875,
-0.27978515625,
0.1553955078125,
-0.178466796875,
0.469970703125,
-0.9833984375,
1.044921875,
0.2396240234375,
-0.70751953125,
0.53857421875,
0.9287109375,
-1.2021484375,
0.791015625,
0.30126953125,
0.51025390625,
-0.8974609375,
0.73291015625,
0.339599609375,
0.364013671875,
-0.70751953125,
-0.435302734375,
-0.61767578125,
-0.165771484375,
0.397216796875,
-0.6279296875,
-0.0987548828125,
0.1845703125,
0.0214691162109375,
-1.2451171875,
0.7412109375,
-1.3671875,
-1.068359375,
-0.325439453125,
-0.66259765625,
0.80322265625,
1.0478515625,
0.2822265625,
-0.5068359375,
-0.04278564453125,
-0.298095703125,
0.63818359375,
0.84326171875,
-0.7197265625,
0.0511474609375,
0.7880859375,
-0.143310546875,
0.55419921875,
0.515625,
-0.6533203125,
-0.329833984375,
-0.0306854248046875,
0.0811767578125,
0.92431640625,
0.403564453125,
0.2646484375,
-0.31787109375,
1.0751953125,
-0.65087890625,
-0.58203125,
0.240234375,
0.35009765625,
-0.2034912109375,
0.426513671875,
0.338134765625,
-0.318115234375,
-0.5107421875,
-0.478271484375,
0.378662109375,
0.039154052734375,
0.6923828125,
-0.7626953125,
0.85693359375,
-0.0323486328125,
-0.85546875,
0.323486328125,
-0.74853515625,
-0.36328125,
1.287109375,
-0.10699462890625,
0.90478515625,
-0.5625,
0.4873046875,
-0.408935546875,
-0.041656494140625,
0.58251953125,
0.037353515625,
0.916015625,
-0.357421875,
-0.39404296875,
-0.544921875,
0.050811767578125,
-0.06475830078125,
-0.5234375,
0.255615234375,
-0.30322265625,
-0.194580078125,
-1.2158203125,
0.9228515625,
0.59375,
0.38330078125,
0.0180206298828125,
0.7275390625,
-0.0509033203125,
0.64404296875,
0.8515625,
-0.348388671875,
0.298095703125,
-0.91259765625,
0.8447265625,
0.0662841796875,
-0.061614990234375,
-0.30126953125,
-0.452392578125,
-0.5283203125,
0.04241943359375,
-0.1771240234375,
-0.1556396484375,
-0.92431640625,
0.54150390625,
0.119384765625,
0.60302734375,
-0.8759765625,
-0.337890625,
0.22998046875,
0.642578125,
0.264892578125,
-0.64208984375,
0.042816162109375,
-0.7431640625,
0.60107421875,
0.5654296875,
-0.1627197265625,
-0.6240234375,
0.11224365234375,
-0.58203125,
-0.7314453125,
-0.037078857421875,
1.0615234375,
0.4228515625,
0.24951171875,
-1.048828125,
0.57470703125,
0.662109375,
-0.258056640625,
-0.017242431640625,
-0.10369873046875,
0.5205078125,
0.2064208984375,
0.509765625,
-0.4716796875,
-0.8671875,
0.343505859375,
-1.0712890625,
0.392822265625,
-0.7060546875,
0.2357177734375,
-0.0263671875,
-0.26025390625,
-0.07647705078125,
0.59228515625,
-0.285888671875,
0.197509765625,
0.033233642578125,
0.6904296875,
-1.11328125,
-0.40185546875,
0.11627197265625,
-0.0489501953125,
-0.8173828125,
0.473876953125,
0.12890625,
-0.6533203125,
0.421630859375,
0.404052734375,
-0.28564453125,
0.51220703125,
-0.91162109375,
0.307373046875,
-0.21728515625,
-0.200439453125,
-0.1578369140625,
-0.52099609375,
0.21826171875,
0.1893310546875,
-1.0205078125,
-0.28076171875,
-1.271484375,
-0.29443359375,
0.0029392242431640625,
-0.287353515625,
0.45947265625,
0.340087890625,
-0.166259765625,
0.0914306640625,
-0.6474609375,
-0.89306640625,
-0.44384765625,
-0.28125,
-0.39501953125,
0.25830078125,
0.39208984375,
0.8134765625,
0.10821533203125,
-0.48486328125,
0.09661865234375,
0.081298828125,
-0.2470703125,
-0.81396484375,
0.004405975341796875,
0.0389404296875,
-0.30322265625,
-0.1572265625,
0.537109375,
-0.2230224609375,
0.245361328125,
0.95751953125,
0.04644775390625,
0.5263671875,
0.20654296875,
-0.896484375,
1.1259765625,
0.03826904296875,
-1.169921875,
-0.5185546875,
0.50341796875,
0.245849609375,
0.426025390625,
0.08648681640625,
-0.55224609375,
-1.0908203125,
-1.2919921875,
0.0985107421875,
-0.65771484375,
-0.3095703125,
-0.611328125,
-0.423583984375,
0.072265625,
0.853515625,
0.1270751953125,
-0.4052734375,
-0.09466552734375,
-1.5380859375,
0.370361328125,
-0.97412109375,
-0.157958984375,
-0.72021484375,
-0.311767578125,
-0.426025390625,
1.205078125,
0.333984375,
0.6279296875,
-0.314453125,
-0.169921875,
-0.06719970703125,
0.0312347412109375,
-0.51513671875,
-0.54443359375,
-0.018951416015625,
-0.29052734375,
-0.38623046875,
0.11669921875,
-0.56396484375,
0.69775390625,
-1.029296875,
0.07806396484375,
-0.461669921875,
-0.37646484375,
-0.462158203125,
-0.4072265625,
1.4912109375,
-0.27392578125,
-0.272705078125,
-0.427734375,
0.7578125,
0.57373046875,
-0.321044921875,
-0.79443359375,
-0.56689453125,
-0.7333984375,
-0.9755859375,
0.94140625,
-0.435302734375,
-0.09588623046875,
-0.45263671875,
0.197265625,
0.9443359375,
-0.07989501953125,
0.36181640625,
1.31640625,
0.445556640625,
0.038238525390625,
-1.3076171875,
0.8984375,
0.65185546875,
-0.54296875,
-0.04925537109375,
0.1585693359375,
-0.603515625,
0.150390625,
-0.7890625,
-1.103515625,
-0.5791015625,
-0.1553955078125,
1.1396484375,
-0.125,
1.1689453125,
-0.2418212890625,
-0.82421875,
-0.58154296875,
0.8671875,
0.30908203125,
0.14208984375,
0.79345703125,
0.1724853515625,
-0.14404296875,
0.31005859375,
0.053924560546875,
-0.366943359375,
-0.52783203125,
1.09765625,
-0.1317138671875,
-0.6328125,
1.0244140625,
0.91357421875,
-0.916015625,
-0.7841796875,
-0.00847625732421875,
-0.0906982421875,
-0.173583984375,
-0.85595703125,
0.261474609375,
0.480224609375,
-0.44384765625,
0.16015625,
0.56396484375,
-0.483642578125,
0.09686279296875,
0.1168212890625,
0.0672607421875,
-0.31787109375,
0.1651611328125,
0.71875,
-1.1962890625,
-0.2095947265625,
-0.8544921875,
0.07269287109375,
-0.0018148422241210938,
-0.07830810546875,
0.89990234375,
-0.361083984375,
0.59033203125,
0.56298828125,
0.04888916015625,
0.9619140625,
-0.7978515625,
-0.37255859375,
0.479248046875,
-1.09765625,
-0.41552734375,
-0.264892578125,
0.457763671875,
-0.1910400390625,
0.446533203125,
-0.7119140625,
0.0272064208984375,
0.56884765625,
0.49365234375,
0.2071533203125,
-0.802734375,
-0.810546875,
-1.1337890625,
-0.4912109375,
-0.300537109375,
-0.32275390625,
-0.64599609375,
0.35400390625,
0.45263671875,
-0.487060546875,
-0.0226287841796875,
0.5283203125,
-0.5595703125,
0.67822265625,
-0.93212890625,
0.51953125,
-0.83056640625,
-0.53125,
-0.407470703125,
0.3271484375,
-0.377197265625,
0.041229248046875,
-0.17919921875,
0.210693359375,
0.0689697265625,
0.6435546875,
-0.475830078125,
0.336181640625,
-0.150390625,
-0.190673828125,
0.343017578125,
0.10858154296875,
-0.25048828125,
0.744140625,
0.65478515625,
-0.10406494140625,
0.152587890625,
-0.60595703125,
-0.259033203125,
-0.10369873046875,
0.157470703125,
0.44775390625,
-0.1947021484375,
-0.0175323486328125,
-0.29052734375,
-0.07171630859375,
-0.7958984375,
-0.11285400390625,
-0.279296875,
0.1982421875,
0.06494140625,
-0.296630859375,
0.2484130859375,
0.9638671875,
0.17529296875,
0.485595703125,
-0.39990234375,
0.6103515625,
0.5341796875,
0.055755615234375,
0.015289306640625,
0.73583984375,
0.384033203125,
-0.1973876953125,
0.62744140625,
0.54736328125,
-0.147216796875,
0.50537109375,
-0.29345703125,
-1.2333984375,
-1.107421875,
0.117431640625,
0.1593017578125,
0.1676025390625,
0.59130859375,
-0.4208984375,
-0.12091064453125,
-0.412353515625,
-0.7705078125,
-0.09735107421875,
-1.0810546875,
-0.8134765625,
0.52734375,
-0.009185791015625,
-0.270751953125,
0.0823974609375,
-0.50146484375,
-0.1280517578125,
0.253173828125,
0.1900634765625,
-0.472900390625,
0.2061767578125,
0.060882568359375,
0.473876953125,
-0.51123046875,
-0.090576171875,
-0.04705810546875,
0.31103515625,
-0.374267578125,
-0.70556640625,
0.304443359375,
0.83740234375,
0.1824951171875,
-0.1939697265625,
-0.74365234375,
0.28564453125,
-0.0616455078125,
-0.12310791015625,
-0.476318359375,
0.435546875,
0.267578125,
0.46923828125,
-0.64453125,
0.19677734375,
-0.11700439453125,
0.390625,
0.48876953125,
-0.2412109375,
-0.5986328125,
0.68701171875,
0.494384765625,
-0.2025146484375,
0.4677734375,
0.2186279296875,
0.66552734375,
0.06744384765625,
-0.259765625,
-0.350341796875,
0.97314453125,
0.65283203125,
0.51025390625,
-0.1982421875,
0.31201171875,
0.787109375,
0.0616455078125,
-0.2232666015625,
0.46435546875,
0.5078125,
-0.01287841796875,
-0.000545501708984375,
-0.501953125,
-0.3154296875,
0.0266571044921875,
-0.431884765625,
0.1571044921875,
-0.5908203125,
-0.1455078125,
-0.59765625,
-0.6875,
0.92822265625,
0.0124053955078125,
0.11871337890625,
-0.1641845703125,
-0.6103515625,
0.60791015625,
0.84130859375,
0.136962890625,
0.184814453125,
0.830078125,
1.119140625,
0.53759765625,
0.76025390625,
0.366943359375,
0.49658203125,
-0.9892578125,
-0.24951171875,
0.1595458984375,
-0.160888671875,
-0.410400390625,
-0.66552734375,
-0.9404296875,
0.80419921875,
-0.4892578125,
-0.58154296875,
0.426513671875,
-1.072265625,
0.17138671875,
-0.185791015625,
0.62841796875,
-0.5146484375,
0.001617431640625,
0.216796875,
-0.291748046875,
-0.580078125,
0.98876953125,
0.0643310546875,
0.89306640625,
0.5263671875,
1.189453125,
-0.0943603515625,
1.423828125,
0.763671875,
-0.45166015625,
0.1795654296875,
0.572265625,
-0.38525390625,
-0.60888671875,
0.09747314453125,
-0.49072265625,
-0.12481689453125,
-0.341552734375,
-0.64306640625,
0.01070404052734375,
0.88134765625,
0.05242919921875,
-0.8408203125,
-0.352294921875,
0.384765625,
-0.55322265625,
0.54736328125,
-0.04168701171875,
0.38818359375,
0.1256103515625,
0.30224609375,
-0.402587890625,
-0.7705078125,
0.33642578125,
-0.412353515625,
0.5947265625,
-0.47802734375,
-0.96142578125,
-0.5693359375,
-0.70654296875,
-0.276611328125,
0.01175689697265625,
-0.47216796875,
-0.67919921875,
0.30517578125,
0.6669921875,
0.43505859375,
-0.09552001953125,
-0.58544921875,
-0.177734375,
0.6962890625,
1.0830078125,
0.07598876953125,
0.998046875,
0.626953125,
-0.2322998046875,
0.397216796875,
-0.5751953125,
0.8642578125,
0.1575927734375,
0.0867919921875,
-0.64892578125,
0.21337890625,
-0.386962890625,
-1.1474609375,
0.1995849609375,
0.59423828125,
0.339111328125,
-0.310546875,
-1.32421875,
-0.76123046875,
-0.62353515625,
-0.365966796875,
-0.859375,
0.8525390625,
0.13427734375,
-0.290771484375,
0.02557373046875,
-1.0986328125,
4.109375,
1.1259765625,
0.97705078125,
0.5048828125,
0.61083984375,
0.92578125,
0.591796875,
-0.68359375,
-0.0173492431640625,
-0.8779296875,
0.38427734375,
-0.6953125,
-0.269287109375,
0.724609375,
0.11053466796875,
0.599609375,
-0.304931640625,
0.28271484375,
-0.2044677734375,
-0.9501953125,
-0.8515625,
0.0537109375,
0.2880859375,
0.47509765625,
0.330810546875,
0.1103515625,
0.7275390625,
-0.9921875,
-0.18505859375,
-0.62939453125,
0.239990234375,
-0.765625,
0.93701171875,
0.3203125,
-0.428955078125,
0.50830078125,
0.07977294921875,
-0.6533203125,
-0.544921875,
0.2220458984375,
-0.6474609375,
-0.05426025390625,
0.8779296875,
-0.55029296875,
0.06500244140625,
0.6376953125,
-0.66015625,
0.9697265625,
0.427978515625,
-0.96337890625,
1.20703125,
-0.453857421875,
0.37744140625,
-0.50439453125,
-0.74462890625,
0.06085205078125,
0.28857421875,
-0.308349609375,
-0.51904296875,
0.55419921875,
-0.176025390625,
0.197998046875,
0.03277587890625,
1.0498046875,
-1.0986328125,
0.95947265625,
0.1689453125,
0.328857421875,
-0.72265625,
-0.08428955078125,
-0.384521484375,
-0.0279693603515625,
-0.235595703125,
-0.52587890625,
0.340087890625,
0.1644287109375,
-0.69482421875,
0.97509765625,
0.298828125,
-0.384521484375,
0.0367431640625,
-0.31298828125,
-0.64892578125,
-0.1964111328125,
0.5654296875,
1.20703125,
-0.6181640625,
-0.2041015625,
-0.363037109375,
1.0615234375,
0.81396484375,
0.376220703125,
-0.0258026123046875,
-0.52197265625,
-0.29833984375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules:
* There are three parts of speech: the adjective, the noun, the verb. Each word in his language is an adjective, noun or verb.
* There are two genders: masculine and feminine. Each word in his language has gender either masculine or feminine.
* Masculine adjectives end with -lios, and feminine adjectives end with -liala.
* Masculine nouns end with -etr, and feminime nouns end with -etra.
* Masculine verbs end with -initis, and feminime verbs end with -inites.
* Thus, each word in the Petya's language has one of the six endings, given above. There are no other endings in Petya's language.
* It is accepted that the whole word consists of an ending. That is, words "lios", "liala", "etr" and so on belong to the Petya's language.
* There aren't any punctuation marks, grammatical tenses, singular/plural forms or other language complications.
* A sentence is either exactly one valid language word or exactly one statement.
Statement is any sequence of the Petya's language, that satisfy both conditions:
* Words in statement follow in the following order (from the left to the right): zero or more adjectives followed by exactly one noun followed by zero or more verbs.
* All words in the statement should have the same gender.
After Petya's friend Vasya wrote instant messenger (an instant messaging program) that supported the Petya's language, Petya wanted to add spelling and grammar checking to the program. As Vasya was in the country and Petya didn't feel like waiting, he asked you to help him with this problem. Your task is to define by a given sequence of words, whether it is true that the given text represents exactly one sentence in Petya's language.
Input
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105.
It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that given words do not belong to the Petya's language.
Output
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
Examples
Input
petr
Output
YES
Input
etis atis animatis etis atis amatis
Output
NO
Input
nataliala kataliala vetra feinites
Output
YES
Submitted Solution:
```
s = input().split(' ');
a = []
b = [0] * 6
for x in s:
if x[-4:] == "lios":
a.append(0)
b[0] += 1
elif x[-5:] == "liala":
a.append(3)
b[3] += 1
elif x[-3:] == "etr":
a.append(1)
b[1] += 1
elif x[-4:] == "etra":
a.append(4)
b[4] += 1
elif x[-6:] == "initis":
a.append(2)
b[2] += 1
elif x[-6:] == "inites":
a.append(5)
b[5] += 1
else :
print("NO")
# print(b,a)
exit(0)
# print(b,a)
if (b[0] > 0 or b[1] > 0 or b[2] > 0) and (b[3] > 0 or b[4] > 0 or b[5] > 0) :
print("NO")
exit(0)
if not (b[1] == 1 or b[4] == 1):
print("NO")
exit(0)
n = len(s)
for i in range(1, n):
if(a[i] < a[i - 1]) :
print("NO")
exit(0)
print("YES")
```
No
| 37,817
|
[
0.1998291015625,
-0.2152099609375,
-0.13330078125,
0.298828125,
-0.60205078125,
-0.340576171875,
-0.07452392578125,
0.45263671875,
-0.048187255859375,
0.22705078125,
0.496337890625,
0.0882568359375,
0.293701171875,
-0.67626953125,
-0.603515625,
0.018310546875,
-0.439208984375,
-0.9609375,
-0.79150390625,
0.2147216796875,
0.1339111328125,
-0.1953125,
-1.79296875,
0.0897216796875,
-0.82568359375,
0.8515625,
0.1939697265625,
0.395751953125,
1.185546875,
0.80712890625,
-0.08502197265625,
0.1046142578125,
0.30859375,
-0.7138671875,
-0.031707763671875,
-0.198486328125,
0.60791015625,
-0.63427734375,
-0.5712890625,
-0.8095703125,
0.5869140625,
-0.2734375,
0.69140625,
-0.70703125,
-1.052734375,
0.1357421875,
-0.10589599609375,
-0.59521484375,
-0.1365966796875,
-0.150634765625,
0.5419921875,
-0.27880859375,
0.46435546875,
-0.021148681640625,
0.09564208984375,
-0.2386474609375,
-0.04345703125,
0.296142578125,
-0.90771484375,
-0.01020050048828125,
0.0262451171875,
0.51123046875,
-0.2061767578125,
-0.798828125,
-0.050140380859375,
0.397216796875,
0.29541015625,
0.027618408203125,
0.039459228515625,
-0.454345703125,
-0.2342529296875,
0.22998046875,
-0.439697265625,
-0.47998046875,
-0.77783203125,
0.1763916015625,
0.31396484375,
-0.1591796875,
-0.60986328125,
0.38623046875,
0.315673828125,
1.3193359375,
0.467529296875,
0.22265625,
-0.68994140625,
-0.7587890625,
0.104248046875,
0.662109375,
-0.036163330078125,
-0.148193359375,
0.1083984375,
0.1824951171875,
-0.5107421875,
-0.027313232421875,
0.84521484375,
0.54248046875,
-0.197021484375,
0.270263671875,
0.10833740234375,
0.12420654296875,
0.640625,
0.8037109375,
-0.2213134765625,
1.09375,
-0.75390625,
-0.10638427734375,
0.409912109375,
0.0266876220703125,
0.033111572265625,
-0.227294921875,
-0.14697265625,
0.010009765625,
0.48193359375,
0.281494140625,
-0.5048828125,
0.88134765625,
-0.2734375,
-0.06512451171875,
-1.091796875,
-0.09521484375,
0.56689453125,
-0.08612060546875,
0.56005859375,
-0.43896484375,
0.302001953125,
-0.59765625,
-0.3544921875,
0.9541015625,
-0.787109375,
-0.65576171875,
0.2264404296875,
-0.1021728515625,
-0.0004963874816894531,
0.25634765625,
0.0179901123046875,
0.47021484375,
-0.352783203125,
0.7568359375,
1.02734375,
-0.97998046875,
0.66064453125,
-0.00852203369140625,
-0.048126220703125,
1.419921875,
0.3251953125,
0.120361328125,
0.54296875,
0.207275390625,
-0.8212890625,
0.380859375,
-0.8271484375,
0.53076171875,
0.11871337890625,
0.2318115234375,
-0.480224609375,
-0.01282501220703125,
0.2420654296875,
0.177490234375,
0.283935546875,
-0.099853515625,
-0.51171875,
0.0404052734375,
-0.548828125,
0.8623046875,
-0.36572265625,
0.49609375,
-0.2041015625,
-0.39599609375,
-0.12646484375,
-0.52978515625,
0.231201171875,
-0.3701171875,
-0.07586669921875,
0.865234375,
0.65185546875,
1.3134765625,
0.78271484375,
-0.2109375,
-0.079345703125,
-0.21533203125,
-0.3056640625,
-0.09429931640625,
0.25048828125,
0.76416015625,
0.626953125,
-0.05609130859375,
0.185791015625,
-0.1373291015625,
-0.484130859375,
-0.697265625,
-0.10040283203125,
0.7607421875,
-0.55810546875,
0.35986328125,
0.146728515625,
0.642578125,
-0.8232421875,
0.232666015625,
-0.093017578125,
-0.9501953125,
-0.5634765625,
1.017578125,
-0.26904296875,
0.544921875,
-0.1219482421875,
-0.6982421875,
-0.103759765625,
1.173828125,
-0.45068359375,
0.09893798828125,
0.80029296875,
0.32666015625,
-0.5244140625,
-0.4453125,
0.0233306884765625,
-0.52978515625,
-0.8037109375,
0.7783203125,
-0.58544921875,
0.0116424560546875,
0.3251953125,
0.611328125,
0.0823974609375,
0.343017578125,
-0.1727294921875,
-0.447998046875,
0.25048828125,
1.1552734375,
0.016845703125,
0.78466796875,
0.5751953125,
1.021484375,
0.60888671875,
1.140625,
0.6083984375,
0.21875,
1.03515625,
1.009765625,
-0.0953369140625,
0.1607666015625,
-0.07354736328125,
0.486572265625,
0.54345703125,
0.4111328125,
-0.054840087890625,
0.5419921875,
-0.1846923828125,
-0.040069580078125,
-0.65771484375,
0.30908203125,
-0.315673828125,
0.634765625,
0.2435302734375,
0.9072265625,
-0.70361328125,
-0.67138671875,
0.50732421875,
0.40869140625,
-0.70654296875,
-0.6484375,
0.00433349609375,
-0.05126953125,
0.328125,
0.2244873046875,
0.411865234375,
0.62158203125,
0.322265625,
0.64208984375,
-0.339599609375,
-0.9091796875,
-0.451171875,
-0.7978515625,
-1.2744140625,
-0.3388671875,
-0.484130859375,
-0.2423095703125,
0.52880859375,
-1.1435546875,
0.1798095703125,
-0.173095703125,
-0.191650390625,
-0.07781982421875,
-0.64501953125,
0.79833984375,
-0.5869140625,
0.619140625,
-0.595703125,
0.370849609375,
0.2734375,
1.1123046875,
-0.669921875,
-0.1849365234375,
-0.357177734375,
-0.292236328125,
0.60693359375,
0.048309326171875,
0.5810546875,
0.01020050048828125,
-1.06640625,
-0.89013671875,
-0.27978515625,
0.1553955078125,
-0.178466796875,
0.469970703125,
-0.9833984375,
1.044921875,
0.2396240234375,
-0.70751953125,
0.53857421875,
0.9287109375,
-1.2021484375,
0.791015625,
0.30126953125,
0.51025390625,
-0.8974609375,
0.73291015625,
0.339599609375,
0.364013671875,
-0.70751953125,
-0.435302734375,
-0.61767578125,
-0.165771484375,
0.397216796875,
-0.6279296875,
-0.0987548828125,
0.1845703125,
0.0214691162109375,
-1.2451171875,
0.7412109375,
-1.3671875,
-1.068359375,
-0.325439453125,
-0.66259765625,
0.80322265625,
1.0478515625,
0.2822265625,
-0.5068359375,
-0.04278564453125,
-0.298095703125,
0.63818359375,
0.84326171875,
-0.7197265625,
0.0511474609375,
0.7880859375,
-0.143310546875,
0.55419921875,
0.515625,
-0.6533203125,
-0.329833984375,
-0.0306854248046875,
0.0811767578125,
0.92431640625,
0.403564453125,
0.2646484375,
-0.31787109375,
1.0751953125,
-0.65087890625,
-0.58203125,
0.240234375,
0.35009765625,
-0.2034912109375,
0.426513671875,
0.338134765625,
-0.318115234375,
-0.5107421875,
-0.478271484375,
0.378662109375,
0.039154052734375,
0.6923828125,
-0.7626953125,
0.85693359375,
-0.0323486328125,
-0.85546875,
0.323486328125,
-0.74853515625,
-0.36328125,
1.287109375,
-0.10699462890625,
0.90478515625,
-0.5625,
0.4873046875,
-0.408935546875,
-0.041656494140625,
0.58251953125,
0.037353515625,
0.916015625,
-0.357421875,
-0.39404296875,
-0.544921875,
0.050811767578125,
-0.06475830078125,
-0.5234375,
0.255615234375,
-0.30322265625,
-0.194580078125,
-1.2158203125,
0.9228515625,
0.59375,
0.38330078125,
0.0180206298828125,
0.7275390625,
-0.0509033203125,
0.64404296875,
0.8515625,
-0.348388671875,
0.298095703125,
-0.91259765625,
0.8447265625,
0.0662841796875,
-0.061614990234375,
-0.30126953125,
-0.452392578125,
-0.5283203125,
0.04241943359375,
-0.1771240234375,
-0.1556396484375,
-0.92431640625,
0.54150390625,
0.119384765625,
0.60302734375,
-0.8759765625,
-0.337890625,
0.22998046875,
0.642578125,
0.264892578125,
-0.64208984375,
0.042816162109375,
-0.7431640625,
0.60107421875,
0.5654296875,
-0.1627197265625,
-0.6240234375,
0.11224365234375,
-0.58203125,
-0.7314453125,
-0.037078857421875,
1.0615234375,
0.4228515625,
0.24951171875,
-1.048828125,
0.57470703125,
0.662109375,
-0.258056640625,
-0.017242431640625,
-0.10369873046875,
0.5205078125,
0.2064208984375,
0.509765625,
-0.4716796875,
-0.8671875,
0.343505859375,
-1.0712890625,
0.392822265625,
-0.7060546875,
0.2357177734375,
-0.0263671875,
-0.26025390625,
-0.07647705078125,
0.59228515625,
-0.285888671875,
0.197509765625,
0.033233642578125,
0.6904296875,
-1.11328125,
-0.40185546875,
0.11627197265625,
-0.0489501953125,
-0.8173828125,
0.473876953125,
0.12890625,
-0.6533203125,
0.421630859375,
0.404052734375,
-0.28564453125,
0.51220703125,
-0.91162109375,
0.307373046875,
-0.21728515625,
-0.200439453125,
-0.1578369140625,
-0.52099609375,
0.21826171875,
0.1893310546875,
-1.0205078125,
-0.28076171875,
-1.271484375,
-0.29443359375,
0.0029392242431640625,
-0.287353515625,
0.45947265625,
0.340087890625,
-0.166259765625,
0.0914306640625,
-0.6474609375,
-0.89306640625,
-0.44384765625,
-0.28125,
-0.39501953125,
0.25830078125,
0.39208984375,
0.8134765625,
0.10821533203125,
-0.48486328125,
0.09661865234375,
0.081298828125,
-0.2470703125,
-0.81396484375,
0.004405975341796875,
0.0389404296875,
-0.30322265625,
-0.1572265625,
0.537109375,
-0.2230224609375,
0.245361328125,
0.95751953125,
0.04644775390625,
0.5263671875,
0.20654296875,
-0.896484375,
1.1259765625,
0.03826904296875,
-1.169921875,
-0.5185546875,
0.50341796875,
0.245849609375,
0.426025390625,
0.08648681640625,
-0.55224609375,
-1.0908203125,
-1.2919921875,
0.0985107421875,
-0.65771484375,
-0.3095703125,
-0.611328125,
-0.423583984375,
0.072265625,
0.853515625,
0.1270751953125,
-0.4052734375,
-0.09466552734375,
-1.5380859375,
0.370361328125,
-0.97412109375,
-0.157958984375,
-0.72021484375,
-0.311767578125,
-0.426025390625,
1.205078125,
0.333984375,
0.6279296875,
-0.314453125,
-0.169921875,
-0.06719970703125,
0.0312347412109375,
-0.51513671875,
-0.54443359375,
-0.018951416015625,
-0.29052734375,
-0.38623046875,
0.11669921875,
-0.56396484375,
0.69775390625,
-1.029296875,
0.07806396484375,
-0.461669921875,
-0.37646484375,
-0.462158203125,
-0.4072265625,
1.4912109375,
-0.27392578125,
-0.272705078125,
-0.427734375,
0.7578125,
0.57373046875,
-0.321044921875,
-0.79443359375,
-0.56689453125,
-0.7333984375,
-0.9755859375,
0.94140625,
-0.435302734375,
-0.09588623046875,
-0.45263671875,
0.197265625,
0.9443359375,
-0.07989501953125,
0.36181640625,
1.31640625,
0.445556640625,
0.038238525390625,
-1.3076171875,
0.8984375,
0.65185546875,
-0.54296875,
-0.04925537109375,
0.1585693359375,
-0.603515625,
0.150390625,
-0.7890625,
-1.103515625,
-0.5791015625,
-0.1553955078125,
1.1396484375,
-0.125,
1.1689453125,
-0.2418212890625,
-0.82421875,
-0.58154296875,
0.8671875,
0.30908203125,
0.14208984375,
0.79345703125,
0.1724853515625,
-0.14404296875,
0.31005859375,
0.053924560546875,
-0.366943359375,
-0.52783203125,
1.09765625,
-0.1317138671875,
-0.6328125,
1.0244140625,
0.91357421875,
-0.916015625,
-0.7841796875,
-0.00847625732421875,
-0.0906982421875,
-0.173583984375,
-0.85595703125,
0.261474609375,
0.480224609375,
-0.44384765625,
0.16015625,
0.56396484375,
-0.483642578125,
0.09686279296875,
0.1168212890625,
0.0672607421875,
-0.31787109375,
0.1651611328125,
0.71875,
-1.1962890625,
-0.2095947265625,
-0.8544921875,
0.07269287109375,
-0.0018148422241210938,
-0.07830810546875,
0.89990234375,
-0.361083984375,
0.59033203125,
0.56298828125,
0.04888916015625,
0.9619140625,
-0.7978515625,
-0.37255859375,
0.479248046875,
-1.09765625,
-0.41552734375,
-0.264892578125,
0.457763671875,
-0.1910400390625,
0.446533203125,
-0.7119140625,
0.0272064208984375,
0.56884765625,
0.49365234375,
0.2071533203125,
-0.802734375,
-0.810546875,
-1.1337890625,
-0.4912109375,
-0.300537109375,
-0.32275390625,
-0.64599609375,
0.35400390625,
0.45263671875,
-0.487060546875,
-0.0226287841796875,
0.5283203125,
-0.5595703125,
0.67822265625,
-0.93212890625,
0.51953125,
-0.83056640625,
-0.53125,
-0.407470703125,
0.3271484375,
-0.377197265625,
0.041229248046875,
-0.17919921875,
0.210693359375,
0.0689697265625,
0.6435546875,
-0.475830078125,
0.336181640625,
-0.150390625,
-0.190673828125,
0.343017578125,
0.10858154296875,
-0.25048828125,
0.744140625,
0.65478515625,
-0.10406494140625,
0.152587890625,
-0.60595703125,
-0.259033203125,
-0.10369873046875,
0.157470703125,
0.44775390625,
-0.1947021484375,
-0.0175323486328125,
-0.29052734375,
-0.07171630859375,
-0.7958984375,
-0.11285400390625,
-0.279296875,
0.1982421875,
0.06494140625,
-0.296630859375,
0.2484130859375,
0.9638671875,
0.17529296875,
0.485595703125,
-0.39990234375,
0.6103515625,
0.5341796875,
0.055755615234375,
0.015289306640625,
0.73583984375,
0.384033203125,
-0.1973876953125,
0.62744140625,
0.54736328125,
-0.147216796875,
0.50537109375,
-0.29345703125,
-1.2333984375,
-1.107421875,
0.117431640625,
0.1593017578125,
0.1676025390625,
0.59130859375,
-0.4208984375,
-0.12091064453125,
-0.412353515625,
-0.7705078125,
-0.09735107421875,
-1.0810546875,
-0.8134765625,
0.52734375,
-0.009185791015625,
-0.270751953125,
0.0823974609375,
-0.50146484375,
-0.1280517578125,
0.253173828125,
0.1900634765625,
-0.472900390625,
0.2061767578125,
0.060882568359375,
0.473876953125,
-0.51123046875,
-0.090576171875,
-0.04705810546875,
0.31103515625,
-0.374267578125,
-0.70556640625,
0.304443359375,
0.83740234375,
0.1824951171875,
-0.1939697265625,
-0.74365234375,
0.28564453125,
-0.0616455078125,
-0.12310791015625,
-0.476318359375,
0.435546875,
0.267578125,
0.46923828125,
-0.64453125,
0.19677734375,
-0.11700439453125,
0.390625,
0.48876953125,
-0.2412109375,
-0.5986328125,
0.68701171875,
0.494384765625,
-0.2025146484375,
0.4677734375,
0.2186279296875,
0.66552734375,
0.06744384765625,
-0.259765625,
-0.350341796875,
0.97314453125,
0.65283203125,
0.51025390625,
-0.1982421875,
0.31201171875,
0.787109375,
0.0616455078125,
-0.2232666015625,
0.46435546875,
0.5078125,
-0.01287841796875,
-0.000545501708984375,
-0.501953125,
-0.3154296875,
0.0266571044921875,
-0.431884765625,
0.1571044921875,
-0.5908203125,
-0.1455078125,
-0.59765625,
-0.6875,
0.92822265625,
0.0124053955078125,
0.11871337890625,
-0.1641845703125,
-0.6103515625,
0.60791015625,
0.84130859375,
0.136962890625,
0.184814453125,
0.830078125,
1.119140625,
0.53759765625,
0.76025390625,
0.366943359375,
0.49658203125,
-0.9892578125,
-0.24951171875,
0.1595458984375,
-0.160888671875,
-0.410400390625,
-0.66552734375,
-0.9404296875,
0.80419921875,
-0.4892578125,
-0.58154296875,
0.426513671875,
-1.072265625,
0.17138671875,
-0.185791015625,
0.62841796875,
-0.5146484375,
0.001617431640625,
0.216796875,
-0.291748046875,
-0.580078125,
0.98876953125,
0.0643310546875,
0.89306640625,
0.5263671875,
1.189453125,
-0.0943603515625,
1.423828125,
0.763671875,
-0.45166015625,
0.1795654296875,
0.572265625,
-0.38525390625,
-0.60888671875,
0.09747314453125,
-0.49072265625,
-0.12481689453125,
-0.341552734375,
-0.64306640625,
0.01070404052734375,
0.88134765625,
0.05242919921875,
-0.8408203125,
-0.352294921875,
0.384765625,
-0.55322265625,
0.54736328125,
-0.04168701171875,
0.38818359375,
0.1256103515625,
0.30224609375,
-0.402587890625,
-0.7705078125,
0.33642578125,
-0.412353515625,
0.5947265625,
-0.47802734375,
-0.96142578125,
-0.5693359375,
-0.70654296875,
-0.276611328125,
0.01175689697265625,
-0.47216796875,
-0.67919921875,
0.30517578125,
0.6669921875,
0.43505859375,
-0.09552001953125,
-0.58544921875,
-0.177734375,
0.6962890625,
1.0830078125,
0.07598876953125,
0.998046875,
0.626953125,
-0.2322998046875,
0.397216796875,
-0.5751953125,
0.8642578125,
0.1575927734375,
0.0867919921875,
-0.64892578125,
0.21337890625,
-0.386962890625,
-1.1474609375,
0.1995849609375,
0.59423828125,
0.339111328125,
-0.310546875,
-1.32421875,
-0.76123046875,
-0.62353515625,
-0.365966796875,
-0.859375,
0.8525390625,
0.13427734375,
-0.290771484375,
0.02557373046875,
-1.0986328125,
4.109375,
1.1259765625,
0.97705078125,
0.5048828125,
0.61083984375,
0.92578125,
0.591796875,
-0.68359375,
-0.0173492431640625,
-0.8779296875,
0.38427734375,
-0.6953125,
-0.269287109375,
0.724609375,
0.11053466796875,
0.599609375,
-0.304931640625,
0.28271484375,
-0.2044677734375,
-0.9501953125,
-0.8515625,
0.0537109375,
0.2880859375,
0.47509765625,
0.330810546875,
0.1103515625,
0.7275390625,
-0.9921875,
-0.18505859375,
-0.62939453125,
0.239990234375,
-0.765625,
0.93701171875,
0.3203125,
-0.428955078125,
0.50830078125,
0.07977294921875,
-0.6533203125,
-0.544921875,
0.2220458984375,
-0.6474609375,
-0.05426025390625,
0.8779296875,
-0.55029296875,
0.06500244140625,
0.6376953125,
-0.66015625,
0.9697265625,
0.427978515625,
-0.96337890625,
1.20703125,
-0.453857421875,
0.37744140625,
-0.50439453125,
-0.74462890625,
0.06085205078125,
0.28857421875,
-0.308349609375,
-0.51904296875,
0.55419921875,
-0.176025390625,
0.197998046875,
0.03277587890625,
1.0498046875,
-1.0986328125,
0.95947265625,
0.1689453125,
0.328857421875,
-0.72265625,
-0.08428955078125,
-0.384521484375,
-0.0279693603515625,
-0.235595703125,
-0.52587890625,
0.340087890625,
0.1644287109375,
-0.69482421875,
0.97509765625,
0.298828125,
-0.384521484375,
0.0367431640625,
-0.31298828125,
-0.64892578125,
-0.1964111328125,
0.5654296875,
1.20703125,
-0.6181640625,
-0.2041015625,
-0.363037109375,
1.0615234375,
0.81396484375,
0.376220703125,
-0.0258026123046875,
-0.52197265625,
-0.29833984375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules:
* There are three parts of speech: the adjective, the noun, the verb. Each word in his language is an adjective, noun or verb.
* There are two genders: masculine and feminine. Each word in his language has gender either masculine or feminine.
* Masculine adjectives end with -lios, and feminine adjectives end with -liala.
* Masculine nouns end with -etr, and feminime nouns end with -etra.
* Masculine verbs end with -initis, and feminime verbs end with -inites.
* Thus, each word in the Petya's language has one of the six endings, given above. There are no other endings in Petya's language.
* It is accepted that the whole word consists of an ending. That is, words "lios", "liala", "etr" and so on belong to the Petya's language.
* There aren't any punctuation marks, grammatical tenses, singular/plural forms or other language complications.
* A sentence is either exactly one valid language word or exactly one statement.
Statement is any sequence of the Petya's language, that satisfy both conditions:
* Words in statement follow in the following order (from the left to the right): zero or more adjectives followed by exactly one noun followed by zero or more verbs.
* All words in the statement should have the same gender.
After Petya's friend Vasya wrote instant messenger (an instant messaging program) that supported the Petya's language, Petya wanted to add spelling and grammar checking to the program. As Vasya was in the country and Petya didn't feel like waiting, he asked you to help him with this problem. Your task is to define by a given sequence of words, whether it is true that the given text represents exactly one sentence in Petya's language.
Input
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105.
It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that given words do not belong to the Petya's language.
Output
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
Examples
Input
petr
Output
YES
Input
etis atis animatis etis atis amatis
Output
NO
Input
nataliala kataliala vetra feinites
Output
YES
Submitted Solution:
```
words = [c for c in input().split()]
verdict = True
category = ["" for i in range(len(words))]
for i in range(len(words)):
if (not verdict): break
if (len(words[i]) < 3): verdict = False
elif (words[i][-3:] == "etr" or (len(words[i]) >= 4 and words[i][-4:] == "etra")): category[i] = "noun"
elif ((len(words[i]) >= 4 and words[i][-4:] == "lios") or (len(words[i]) >= 5 and words[i][-5:] == "liala")): category[i] = "adjective"
elif (len(words[i]) >= 6 and (words[i][-6:] == "initis" or words[i][-6:] == "inites")): category[i] = "verb"
else: verdict = False
first_noun = -1
for i in range(len(category)):
if (not verdict): break
if (category[i] == "noun"):
first_noun = i
break
if (first_noun == -1 and len(words) > 1): verdict = False
elif (first_noun != -1 and verdict):
left, right = first_noun - 1, first_noun + 1
while (left >= 0 and category[left] == "adjective"): left -= 1
while (right < len(category) and category[right] == "verb"): right += 1
if (left >= 0 or right < len(category)): verdict = False
print(("NO" if (not verdict) else "YES"))
```
No
| 37,818
|
[
0.1998291015625,
-0.2152099609375,
-0.13330078125,
0.298828125,
-0.60205078125,
-0.340576171875,
-0.07452392578125,
0.45263671875,
-0.048187255859375,
0.22705078125,
0.496337890625,
0.0882568359375,
0.293701171875,
-0.67626953125,
-0.603515625,
0.018310546875,
-0.439208984375,
-0.9609375,
-0.79150390625,
0.2147216796875,
0.1339111328125,
-0.1953125,
-1.79296875,
0.0897216796875,
-0.82568359375,
0.8515625,
0.1939697265625,
0.395751953125,
1.185546875,
0.80712890625,
-0.08502197265625,
0.1046142578125,
0.30859375,
-0.7138671875,
-0.031707763671875,
-0.198486328125,
0.60791015625,
-0.63427734375,
-0.5712890625,
-0.8095703125,
0.5869140625,
-0.2734375,
0.69140625,
-0.70703125,
-1.052734375,
0.1357421875,
-0.10589599609375,
-0.59521484375,
-0.1365966796875,
-0.150634765625,
0.5419921875,
-0.27880859375,
0.46435546875,
-0.021148681640625,
0.09564208984375,
-0.2386474609375,
-0.04345703125,
0.296142578125,
-0.90771484375,
-0.01020050048828125,
0.0262451171875,
0.51123046875,
-0.2061767578125,
-0.798828125,
-0.050140380859375,
0.397216796875,
0.29541015625,
0.027618408203125,
0.039459228515625,
-0.454345703125,
-0.2342529296875,
0.22998046875,
-0.439697265625,
-0.47998046875,
-0.77783203125,
0.1763916015625,
0.31396484375,
-0.1591796875,
-0.60986328125,
0.38623046875,
0.315673828125,
1.3193359375,
0.467529296875,
0.22265625,
-0.68994140625,
-0.7587890625,
0.104248046875,
0.662109375,
-0.036163330078125,
-0.148193359375,
0.1083984375,
0.1824951171875,
-0.5107421875,
-0.027313232421875,
0.84521484375,
0.54248046875,
-0.197021484375,
0.270263671875,
0.10833740234375,
0.12420654296875,
0.640625,
0.8037109375,
-0.2213134765625,
1.09375,
-0.75390625,
-0.10638427734375,
0.409912109375,
0.0266876220703125,
0.033111572265625,
-0.227294921875,
-0.14697265625,
0.010009765625,
0.48193359375,
0.281494140625,
-0.5048828125,
0.88134765625,
-0.2734375,
-0.06512451171875,
-1.091796875,
-0.09521484375,
0.56689453125,
-0.08612060546875,
0.56005859375,
-0.43896484375,
0.302001953125,
-0.59765625,
-0.3544921875,
0.9541015625,
-0.787109375,
-0.65576171875,
0.2264404296875,
-0.1021728515625,
-0.0004963874816894531,
0.25634765625,
0.0179901123046875,
0.47021484375,
-0.352783203125,
0.7568359375,
1.02734375,
-0.97998046875,
0.66064453125,
-0.00852203369140625,
-0.048126220703125,
1.419921875,
0.3251953125,
0.120361328125,
0.54296875,
0.207275390625,
-0.8212890625,
0.380859375,
-0.8271484375,
0.53076171875,
0.11871337890625,
0.2318115234375,
-0.480224609375,
-0.01282501220703125,
0.2420654296875,
0.177490234375,
0.283935546875,
-0.099853515625,
-0.51171875,
0.0404052734375,
-0.548828125,
0.8623046875,
-0.36572265625,
0.49609375,
-0.2041015625,
-0.39599609375,
-0.12646484375,
-0.52978515625,
0.231201171875,
-0.3701171875,
-0.07586669921875,
0.865234375,
0.65185546875,
1.3134765625,
0.78271484375,
-0.2109375,
-0.079345703125,
-0.21533203125,
-0.3056640625,
-0.09429931640625,
0.25048828125,
0.76416015625,
0.626953125,
-0.05609130859375,
0.185791015625,
-0.1373291015625,
-0.484130859375,
-0.697265625,
-0.10040283203125,
0.7607421875,
-0.55810546875,
0.35986328125,
0.146728515625,
0.642578125,
-0.8232421875,
0.232666015625,
-0.093017578125,
-0.9501953125,
-0.5634765625,
1.017578125,
-0.26904296875,
0.544921875,
-0.1219482421875,
-0.6982421875,
-0.103759765625,
1.173828125,
-0.45068359375,
0.09893798828125,
0.80029296875,
0.32666015625,
-0.5244140625,
-0.4453125,
0.0233306884765625,
-0.52978515625,
-0.8037109375,
0.7783203125,
-0.58544921875,
0.0116424560546875,
0.3251953125,
0.611328125,
0.0823974609375,
0.343017578125,
-0.1727294921875,
-0.447998046875,
0.25048828125,
1.1552734375,
0.016845703125,
0.78466796875,
0.5751953125,
1.021484375,
0.60888671875,
1.140625,
0.6083984375,
0.21875,
1.03515625,
1.009765625,
-0.0953369140625,
0.1607666015625,
-0.07354736328125,
0.486572265625,
0.54345703125,
0.4111328125,
-0.054840087890625,
0.5419921875,
-0.1846923828125,
-0.040069580078125,
-0.65771484375,
0.30908203125,
-0.315673828125,
0.634765625,
0.2435302734375,
0.9072265625,
-0.70361328125,
-0.67138671875,
0.50732421875,
0.40869140625,
-0.70654296875,
-0.6484375,
0.00433349609375,
-0.05126953125,
0.328125,
0.2244873046875,
0.411865234375,
0.62158203125,
0.322265625,
0.64208984375,
-0.339599609375,
-0.9091796875,
-0.451171875,
-0.7978515625,
-1.2744140625,
-0.3388671875,
-0.484130859375,
-0.2423095703125,
0.52880859375,
-1.1435546875,
0.1798095703125,
-0.173095703125,
-0.191650390625,
-0.07781982421875,
-0.64501953125,
0.79833984375,
-0.5869140625,
0.619140625,
-0.595703125,
0.370849609375,
0.2734375,
1.1123046875,
-0.669921875,
-0.1849365234375,
-0.357177734375,
-0.292236328125,
0.60693359375,
0.048309326171875,
0.5810546875,
0.01020050048828125,
-1.06640625,
-0.89013671875,
-0.27978515625,
0.1553955078125,
-0.178466796875,
0.469970703125,
-0.9833984375,
1.044921875,
0.2396240234375,
-0.70751953125,
0.53857421875,
0.9287109375,
-1.2021484375,
0.791015625,
0.30126953125,
0.51025390625,
-0.8974609375,
0.73291015625,
0.339599609375,
0.364013671875,
-0.70751953125,
-0.435302734375,
-0.61767578125,
-0.165771484375,
0.397216796875,
-0.6279296875,
-0.0987548828125,
0.1845703125,
0.0214691162109375,
-1.2451171875,
0.7412109375,
-1.3671875,
-1.068359375,
-0.325439453125,
-0.66259765625,
0.80322265625,
1.0478515625,
0.2822265625,
-0.5068359375,
-0.04278564453125,
-0.298095703125,
0.63818359375,
0.84326171875,
-0.7197265625,
0.0511474609375,
0.7880859375,
-0.143310546875,
0.55419921875,
0.515625,
-0.6533203125,
-0.329833984375,
-0.0306854248046875,
0.0811767578125,
0.92431640625,
0.403564453125,
0.2646484375,
-0.31787109375,
1.0751953125,
-0.65087890625,
-0.58203125,
0.240234375,
0.35009765625,
-0.2034912109375,
0.426513671875,
0.338134765625,
-0.318115234375,
-0.5107421875,
-0.478271484375,
0.378662109375,
0.039154052734375,
0.6923828125,
-0.7626953125,
0.85693359375,
-0.0323486328125,
-0.85546875,
0.323486328125,
-0.74853515625,
-0.36328125,
1.287109375,
-0.10699462890625,
0.90478515625,
-0.5625,
0.4873046875,
-0.408935546875,
-0.041656494140625,
0.58251953125,
0.037353515625,
0.916015625,
-0.357421875,
-0.39404296875,
-0.544921875,
0.050811767578125,
-0.06475830078125,
-0.5234375,
0.255615234375,
-0.30322265625,
-0.194580078125,
-1.2158203125,
0.9228515625,
0.59375,
0.38330078125,
0.0180206298828125,
0.7275390625,
-0.0509033203125,
0.64404296875,
0.8515625,
-0.348388671875,
0.298095703125,
-0.91259765625,
0.8447265625,
0.0662841796875,
-0.061614990234375,
-0.30126953125,
-0.452392578125,
-0.5283203125,
0.04241943359375,
-0.1771240234375,
-0.1556396484375,
-0.92431640625,
0.54150390625,
0.119384765625,
0.60302734375,
-0.8759765625,
-0.337890625,
0.22998046875,
0.642578125,
0.264892578125,
-0.64208984375,
0.042816162109375,
-0.7431640625,
0.60107421875,
0.5654296875,
-0.1627197265625,
-0.6240234375,
0.11224365234375,
-0.58203125,
-0.7314453125,
-0.037078857421875,
1.0615234375,
0.4228515625,
0.24951171875,
-1.048828125,
0.57470703125,
0.662109375,
-0.258056640625,
-0.017242431640625,
-0.10369873046875,
0.5205078125,
0.2064208984375,
0.509765625,
-0.4716796875,
-0.8671875,
0.343505859375,
-1.0712890625,
0.392822265625,
-0.7060546875,
0.2357177734375,
-0.0263671875,
-0.26025390625,
-0.07647705078125,
0.59228515625,
-0.285888671875,
0.197509765625,
0.033233642578125,
0.6904296875,
-1.11328125,
-0.40185546875,
0.11627197265625,
-0.0489501953125,
-0.8173828125,
0.473876953125,
0.12890625,
-0.6533203125,
0.421630859375,
0.404052734375,
-0.28564453125,
0.51220703125,
-0.91162109375,
0.307373046875,
-0.21728515625,
-0.200439453125,
-0.1578369140625,
-0.52099609375,
0.21826171875,
0.1893310546875,
-1.0205078125,
-0.28076171875,
-1.271484375,
-0.29443359375,
0.0029392242431640625,
-0.287353515625,
0.45947265625,
0.340087890625,
-0.166259765625,
0.0914306640625,
-0.6474609375,
-0.89306640625,
-0.44384765625,
-0.28125,
-0.39501953125,
0.25830078125,
0.39208984375,
0.8134765625,
0.10821533203125,
-0.48486328125,
0.09661865234375,
0.081298828125,
-0.2470703125,
-0.81396484375,
0.004405975341796875,
0.0389404296875,
-0.30322265625,
-0.1572265625,
0.537109375,
-0.2230224609375,
0.245361328125,
0.95751953125,
0.04644775390625,
0.5263671875,
0.20654296875,
-0.896484375,
1.1259765625,
0.03826904296875,
-1.169921875,
-0.5185546875,
0.50341796875,
0.245849609375,
0.426025390625,
0.08648681640625,
-0.55224609375,
-1.0908203125,
-1.2919921875,
0.0985107421875,
-0.65771484375,
-0.3095703125,
-0.611328125,
-0.423583984375,
0.072265625,
0.853515625,
0.1270751953125,
-0.4052734375,
-0.09466552734375,
-1.5380859375,
0.370361328125,
-0.97412109375,
-0.157958984375,
-0.72021484375,
-0.311767578125,
-0.426025390625,
1.205078125,
0.333984375,
0.6279296875,
-0.314453125,
-0.169921875,
-0.06719970703125,
0.0312347412109375,
-0.51513671875,
-0.54443359375,
-0.018951416015625,
-0.29052734375,
-0.38623046875,
0.11669921875,
-0.56396484375,
0.69775390625,
-1.029296875,
0.07806396484375,
-0.461669921875,
-0.37646484375,
-0.462158203125,
-0.4072265625,
1.4912109375,
-0.27392578125,
-0.272705078125,
-0.427734375,
0.7578125,
0.57373046875,
-0.321044921875,
-0.79443359375,
-0.56689453125,
-0.7333984375,
-0.9755859375,
0.94140625,
-0.435302734375,
-0.09588623046875,
-0.45263671875,
0.197265625,
0.9443359375,
-0.07989501953125,
0.36181640625,
1.31640625,
0.445556640625,
0.038238525390625,
-1.3076171875,
0.8984375,
0.65185546875,
-0.54296875,
-0.04925537109375,
0.1585693359375,
-0.603515625,
0.150390625,
-0.7890625,
-1.103515625,
-0.5791015625,
-0.1553955078125,
1.1396484375,
-0.125,
1.1689453125,
-0.2418212890625,
-0.82421875,
-0.58154296875,
0.8671875,
0.30908203125,
0.14208984375,
0.79345703125,
0.1724853515625,
-0.14404296875,
0.31005859375,
0.053924560546875,
-0.366943359375,
-0.52783203125,
1.09765625,
-0.1317138671875,
-0.6328125,
1.0244140625,
0.91357421875,
-0.916015625,
-0.7841796875,
-0.00847625732421875,
-0.0906982421875,
-0.173583984375,
-0.85595703125,
0.261474609375,
0.480224609375,
-0.44384765625,
0.16015625,
0.56396484375,
-0.483642578125,
0.09686279296875,
0.1168212890625,
0.0672607421875,
-0.31787109375,
0.1651611328125,
0.71875,
-1.1962890625,
-0.2095947265625,
-0.8544921875,
0.07269287109375,
-0.0018148422241210938,
-0.07830810546875,
0.89990234375,
-0.361083984375,
0.59033203125,
0.56298828125,
0.04888916015625,
0.9619140625,
-0.7978515625,
-0.37255859375,
0.479248046875,
-1.09765625,
-0.41552734375,
-0.264892578125,
0.457763671875,
-0.1910400390625,
0.446533203125,
-0.7119140625,
0.0272064208984375,
0.56884765625,
0.49365234375,
0.2071533203125,
-0.802734375,
-0.810546875,
-1.1337890625,
-0.4912109375,
-0.300537109375,
-0.32275390625,
-0.64599609375,
0.35400390625,
0.45263671875,
-0.487060546875,
-0.0226287841796875,
0.5283203125,
-0.5595703125,
0.67822265625,
-0.93212890625,
0.51953125,
-0.83056640625,
-0.53125,
-0.407470703125,
0.3271484375,
-0.377197265625,
0.041229248046875,
-0.17919921875,
0.210693359375,
0.0689697265625,
0.6435546875,
-0.475830078125,
0.336181640625,
-0.150390625,
-0.190673828125,
0.343017578125,
0.10858154296875,
-0.25048828125,
0.744140625,
0.65478515625,
-0.10406494140625,
0.152587890625,
-0.60595703125,
-0.259033203125,
-0.10369873046875,
0.157470703125,
0.44775390625,
-0.1947021484375,
-0.0175323486328125,
-0.29052734375,
-0.07171630859375,
-0.7958984375,
-0.11285400390625,
-0.279296875,
0.1982421875,
0.06494140625,
-0.296630859375,
0.2484130859375,
0.9638671875,
0.17529296875,
0.485595703125,
-0.39990234375,
0.6103515625,
0.5341796875,
0.055755615234375,
0.015289306640625,
0.73583984375,
0.384033203125,
-0.1973876953125,
0.62744140625,
0.54736328125,
-0.147216796875,
0.50537109375,
-0.29345703125,
-1.2333984375,
-1.107421875,
0.117431640625,
0.1593017578125,
0.1676025390625,
0.59130859375,
-0.4208984375,
-0.12091064453125,
-0.412353515625,
-0.7705078125,
-0.09735107421875,
-1.0810546875,
-0.8134765625,
0.52734375,
-0.009185791015625,
-0.270751953125,
0.0823974609375,
-0.50146484375,
-0.1280517578125,
0.253173828125,
0.1900634765625,
-0.472900390625,
0.2061767578125,
0.060882568359375,
0.473876953125,
-0.51123046875,
-0.090576171875,
-0.04705810546875,
0.31103515625,
-0.374267578125,
-0.70556640625,
0.304443359375,
0.83740234375,
0.1824951171875,
-0.1939697265625,
-0.74365234375,
0.28564453125,
-0.0616455078125,
-0.12310791015625,
-0.476318359375,
0.435546875,
0.267578125,
0.46923828125,
-0.64453125,
0.19677734375,
-0.11700439453125,
0.390625,
0.48876953125,
-0.2412109375,
-0.5986328125,
0.68701171875,
0.494384765625,
-0.2025146484375,
0.4677734375,
0.2186279296875,
0.66552734375,
0.06744384765625,
-0.259765625,
-0.350341796875,
0.97314453125,
0.65283203125,
0.51025390625,
-0.1982421875,
0.31201171875,
0.787109375,
0.0616455078125,
-0.2232666015625,
0.46435546875,
0.5078125,
-0.01287841796875,
-0.000545501708984375,
-0.501953125,
-0.3154296875,
0.0266571044921875,
-0.431884765625,
0.1571044921875,
-0.5908203125,
-0.1455078125,
-0.59765625,
-0.6875,
0.92822265625,
0.0124053955078125,
0.11871337890625,
-0.1641845703125,
-0.6103515625,
0.60791015625,
0.84130859375,
0.136962890625,
0.184814453125,
0.830078125,
1.119140625,
0.53759765625,
0.76025390625,
0.366943359375,
0.49658203125,
-0.9892578125,
-0.24951171875,
0.1595458984375,
-0.160888671875,
-0.410400390625,
-0.66552734375,
-0.9404296875,
0.80419921875,
-0.4892578125,
-0.58154296875,
0.426513671875,
-1.072265625,
0.17138671875,
-0.185791015625,
0.62841796875,
-0.5146484375,
0.001617431640625,
0.216796875,
-0.291748046875,
-0.580078125,
0.98876953125,
0.0643310546875,
0.89306640625,
0.5263671875,
1.189453125,
-0.0943603515625,
1.423828125,
0.763671875,
-0.45166015625,
0.1795654296875,
0.572265625,
-0.38525390625,
-0.60888671875,
0.09747314453125,
-0.49072265625,
-0.12481689453125,
-0.341552734375,
-0.64306640625,
0.01070404052734375,
0.88134765625,
0.05242919921875,
-0.8408203125,
-0.352294921875,
0.384765625,
-0.55322265625,
0.54736328125,
-0.04168701171875,
0.38818359375,
0.1256103515625,
0.30224609375,
-0.402587890625,
-0.7705078125,
0.33642578125,
-0.412353515625,
0.5947265625,
-0.47802734375,
-0.96142578125,
-0.5693359375,
-0.70654296875,
-0.276611328125,
0.01175689697265625,
-0.47216796875,
-0.67919921875,
0.30517578125,
0.6669921875,
0.43505859375,
-0.09552001953125,
-0.58544921875,
-0.177734375,
0.6962890625,
1.0830078125,
0.07598876953125,
0.998046875,
0.626953125,
-0.2322998046875,
0.397216796875,
-0.5751953125,
0.8642578125,
0.1575927734375,
0.0867919921875,
-0.64892578125,
0.21337890625,
-0.386962890625,
-1.1474609375,
0.1995849609375,
0.59423828125,
0.339111328125,
-0.310546875,
-1.32421875,
-0.76123046875,
-0.62353515625,
-0.365966796875,
-0.859375,
0.8525390625,
0.13427734375,
-0.290771484375,
0.02557373046875,
-1.0986328125,
4.109375,
1.1259765625,
0.97705078125,
0.5048828125,
0.61083984375,
0.92578125,
0.591796875,
-0.68359375,
-0.0173492431640625,
-0.8779296875,
0.38427734375,
-0.6953125,
-0.269287109375,
0.724609375,
0.11053466796875,
0.599609375,
-0.304931640625,
0.28271484375,
-0.2044677734375,
-0.9501953125,
-0.8515625,
0.0537109375,
0.2880859375,
0.47509765625,
0.330810546875,
0.1103515625,
0.7275390625,
-0.9921875,
-0.18505859375,
-0.62939453125,
0.239990234375,
-0.765625,
0.93701171875,
0.3203125,
-0.428955078125,
0.50830078125,
0.07977294921875,
-0.6533203125,
-0.544921875,
0.2220458984375,
-0.6474609375,
-0.05426025390625,
0.8779296875,
-0.55029296875,
0.06500244140625,
0.6376953125,
-0.66015625,
0.9697265625,
0.427978515625,
-0.96337890625,
1.20703125,
-0.453857421875,
0.37744140625,
-0.50439453125,
-0.74462890625,
0.06085205078125,
0.28857421875,
-0.308349609375,
-0.51904296875,
0.55419921875,
-0.176025390625,
0.197998046875,
0.03277587890625,
1.0498046875,
-1.0986328125,
0.95947265625,
0.1689453125,
0.328857421875,
-0.72265625,
-0.08428955078125,
-0.384521484375,
-0.0279693603515625,
-0.235595703125,
-0.52587890625,
0.340087890625,
0.1644287109375,
-0.69482421875,
0.97509765625,
0.298828125,
-0.384521484375,
0.0367431640625,
-0.31298828125,
-0.64892578125,
-0.1964111328125,
0.5654296875,
1.20703125,
-0.6181640625,
-0.2041015625,
-0.363037109375,
1.0615234375,
0.81396484375,
0.376220703125,
-0.0258026123046875,
-0.52197265625,
-0.29833984375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the language's grammar can be described with the following set of rules:
* There are three parts of speech: the adjective, the noun, the verb. Each word in his language is an adjective, noun or verb.
* There are two genders: masculine and feminine. Each word in his language has gender either masculine or feminine.
* Masculine adjectives end with -lios, and feminine adjectives end with -liala.
* Masculine nouns end with -etr, and feminime nouns end with -etra.
* Masculine verbs end with -initis, and feminime verbs end with -inites.
* Thus, each word in the Petya's language has one of the six endings, given above. There are no other endings in Petya's language.
* It is accepted that the whole word consists of an ending. That is, words "lios", "liala", "etr" and so on belong to the Petya's language.
* There aren't any punctuation marks, grammatical tenses, singular/plural forms or other language complications.
* A sentence is either exactly one valid language word or exactly one statement.
Statement is any sequence of the Petya's language, that satisfy both conditions:
* Words in statement follow in the following order (from the left to the right): zero or more adjectives followed by exactly one noun followed by zero or more verbs.
* All words in the statement should have the same gender.
After Petya's friend Vasya wrote instant messenger (an instant messaging program) that supported the Petya's language, Petya wanted to add spelling and grammar checking to the program. As Vasya was in the country and Petya didn't feel like waiting, he asked you to help him with this problem. Your task is to define by a given sequence of words, whether it is true that the given text represents exactly one sentence in Petya's language.
Input
The first line contains one or more words consisting of lowercase Latin letters. The overall number of characters (including letters and spaces) does not exceed 105.
It is guaranteed that any two consecutive words are separated by exactly one space and the input data do not contain any other spaces. It is possible that given words do not belong to the Petya's language.
Output
If some word of the given text does not belong to the Petya's language or if the text contains more that one sentence, print "NO" (without the quotes). Otherwise, print "YES" (without the quotes).
Examples
Input
petr
Output
YES
Input
etis atis animatis etis atis amatis
Output
NO
Input
nataliala kataliala vetra feinites
Output
YES
Submitted Solution:
```
words = [c for c in input().split()]
verdict = True
category = ["" for i in range(len(words))]
for i in range(len(words)):
if (not verdict): break
if (len(words[i]) < 3): verdict = False
elif (words[i][-3:] == "etr" or (len(words[i]) >= 4 and words[i][-4:] == "etra")): category[i] = "noun"
elif ((len(words[i]) >= 4 and words[i][-4:] == "lios") or (len(words[i]) >= 5 and words[i][-5:] == "liala")): category[i] = "adjective"
elif (len(words[i]) >= 6 and (words[i][-6:] == "initis" or words[i][-6:] == "inites")): category[i] = "verb"
else: verdict = False
first_noun = -1
for i in range(len(category)):
if (category[i] == "noun"):
first_noun = i
break
if (first_noun == -1 and len(words) > 1): verdict = False
elif (first_noun != -1):
left, right = first_noun - 1, first_noun + 1
while (left >= 0 and category[left] != "noun"): left -= 1
while (right < len(category) and category[right] != "noun"): right += 1
if (left >= 0 or right < len(category)): verdict = False
print(("NO" if (not verdict) else "YES"))
```
No
| 37,819
|
[
0.1998291015625,
-0.2152099609375,
-0.13330078125,
0.298828125,
-0.60205078125,
-0.340576171875,
-0.07452392578125,
0.45263671875,
-0.048187255859375,
0.22705078125,
0.496337890625,
0.0882568359375,
0.293701171875,
-0.67626953125,
-0.603515625,
0.018310546875,
-0.439208984375,
-0.9609375,
-0.79150390625,
0.2147216796875,
0.1339111328125,
-0.1953125,
-1.79296875,
0.0897216796875,
-0.82568359375,
0.8515625,
0.1939697265625,
0.395751953125,
1.185546875,
0.80712890625,
-0.08502197265625,
0.1046142578125,
0.30859375,
-0.7138671875,
-0.031707763671875,
-0.198486328125,
0.60791015625,
-0.63427734375,
-0.5712890625,
-0.8095703125,
0.5869140625,
-0.2734375,
0.69140625,
-0.70703125,
-1.052734375,
0.1357421875,
-0.10589599609375,
-0.59521484375,
-0.1365966796875,
-0.150634765625,
0.5419921875,
-0.27880859375,
0.46435546875,
-0.021148681640625,
0.09564208984375,
-0.2386474609375,
-0.04345703125,
0.296142578125,
-0.90771484375,
-0.01020050048828125,
0.0262451171875,
0.51123046875,
-0.2061767578125,
-0.798828125,
-0.050140380859375,
0.397216796875,
0.29541015625,
0.027618408203125,
0.039459228515625,
-0.454345703125,
-0.2342529296875,
0.22998046875,
-0.439697265625,
-0.47998046875,
-0.77783203125,
0.1763916015625,
0.31396484375,
-0.1591796875,
-0.60986328125,
0.38623046875,
0.315673828125,
1.3193359375,
0.467529296875,
0.22265625,
-0.68994140625,
-0.7587890625,
0.104248046875,
0.662109375,
-0.036163330078125,
-0.148193359375,
0.1083984375,
0.1824951171875,
-0.5107421875,
-0.027313232421875,
0.84521484375,
0.54248046875,
-0.197021484375,
0.270263671875,
0.10833740234375,
0.12420654296875,
0.640625,
0.8037109375,
-0.2213134765625,
1.09375,
-0.75390625,
-0.10638427734375,
0.409912109375,
0.0266876220703125,
0.033111572265625,
-0.227294921875,
-0.14697265625,
0.010009765625,
0.48193359375,
0.281494140625,
-0.5048828125,
0.88134765625,
-0.2734375,
-0.06512451171875,
-1.091796875,
-0.09521484375,
0.56689453125,
-0.08612060546875,
0.56005859375,
-0.43896484375,
0.302001953125,
-0.59765625,
-0.3544921875,
0.9541015625,
-0.787109375,
-0.65576171875,
0.2264404296875,
-0.1021728515625,
-0.0004963874816894531,
0.25634765625,
0.0179901123046875,
0.47021484375,
-0.352783203125,
0.7568359375,
1.02734375,
-0.97998046875,
0.66064453125,
-0.00852203369140625,
-0.048126220703125,
1.419921875,
0.3251953125,
0.120361328125,
0.54296875,
0.207275390625,
-0.8212890625,
0.380859375,
-0.8271484375,
0.53076171875,
0.11871337890625,
0.2318115234375,
-0.480224609375,
-0.01282501220703125,
0.2420654296875,
0.177490234375,
0.283935546875,
-0.099853515625,
-0.51171875,
0.0404052734375,
-0.548828125,
0.8623046875,
-0.36572265625,
0.49609375,
-0.2041015625,
-0.39599609375,
-0.12646484375,
-0.52978515625,
0.231201171875,
-0.3701171875,
-0.07586669921875,
0.865234375,
0.65185546875,
1.3134765625,
0.78271484375,
-0.2109375,
-0.079345703125,
-0.21533203125,
-0.3056640625,
-0.09429931640625,
0.25048828125,
0.76416015625,
0.626953125,
-0.05609130859375,
0.185791015625,
-0.1373291015625,
-0.484130859375,
-0.697265625,
-0.10040283203125,
0.7607421875,
-0.55810546875,
0.35986328125,
0.146728515625,
0.642578125,
-0.8232421875,
0.232666015625,
-0.093017578125,
-0.9501953125,
-0.5634765625,
1.017578125,
-0.26904296875,
0.544921875,
-0.1219482421875,
-0.6982421875,
-0.103759765625,
1.173828125,
-0.45068359375,
0.09893798828125,
0.80029296875,
0.32666015625,
-0.5244140625,
-0.4453125,
0.0233306884765625,
-0.52978515625,
-0.8037109375,
0.7783203125,
-0.58544921875,
0.0116424560546875,
0.3251953125,
0.611328125,
0.0823974609375,
0.343017578125,
-0.1727294921875,
-0.447998046875,
0.25048828125,
1.1552734375,
0.016845703125,
0.78466796875,
0.5751953125,
1.021484375,
0.60888671875,
1.140625,
0.6083984375,
0.21875,
1.03515625,
1.009765625,
-0.0953369140625,
0.1607666015625,
-0.07354736328125,
0.486572265625,
0.54345703125,
0.4111328125,
-0.054840087890625,
0.5419921875,
-0.1846923828125,
-0.040069580078125,
-0.65771484375,
0.30908203125,
-0.315673828125,
0.634765625,
0.2435302734375,
0.9072265625,
-0.70361328125,
-0.67138671875,
0.50732421875,
0.40869140625,
-0.70654296875,
-0.6484375,
0.00433349609375,
-0.05126953125,
0.328125,
0.2244873046875,
0.411865234375,
0.62158203125,
0.322265625,
0.64208984375,
-0.339599609375,
-0.9091796875,
-0.451171875,
-0.7978515625,
-1.2744140625,
-0.3388671875,
-0.484130859375,
-0.2423095703125,
0.52880859375,
-1.1435546875,
0.1798095703125,
-0.173095703125,
-0.191650390625,
-0.07781982421875,
-0.64501953125,
0.79833984375,
-0.5869140625,
0.619140625,
-0.595703125,
0.370849609375,
0.2734375,
1.1123046875,
-0.669921875,
-0.1849365234375,
-0.357177734375,
-0.292236328125,
0.60693359375,
0.048309326171875,
0.5810546875,
0.01020050048828125,
-1.06640625,
-0.89013671875,
-0.27978515625,
0.1553955078125,
-0.178466796875,
0.469970703125,
-0.9833984375,
1.044921875,
0.2396240234375,
-0.70751953125,
0.53857421875,
0.9287109375,
-1.2021484375,
0.791015625,
0.30126953125,
0.51025390625,
-0.8974609375,
0.73291015625,
0.339599609375,
0.364013671875,
-0.70751953125,
-0.435302734375,
-0.61767578125,
-0.165771484375,
0.397216796875,
-0.6279296875,
-0.0987548828125,
0.1845703125,
0.0214691162109375,
-1.2451171875,
0.7412109375,
-1.3671875,
-1.068359375,
-0.325439453125,
-0.66259765625,
0.80322265625,
1.0478515625,
0.2822265625,
-0.5068359375,
-0.04278564453125,
-0.298095703125,
0.63818359375,
0.84326171875,
-0.7197265625,
0.0511474609375,
0.7880859375,
-0.143310546875,
0.55419921875,
0.515625,
-0.6533203125,
-0.329833984375,
-0.0306854248046875,
0.0811767578125,
0.92431640625,
0.403564453125,
0.2646484375,
-0.31787109375,
1.0751953125,
-0.65087890625,
-0.58203125,
0.240234375,
0.35009765625,
-0.2034912109375,
0.426513671875,
0.338134765625,
-0.318115234375,
-0.5107421875,
-0.478271484375,
0.378662109375,
0.039154052734375,
0.6923828125,
-0.7626953125,
0.85693359375,
-0.0323486328125,
-0.85546875,
0.323486328125,
-0.74853515625,
-0.36328125,
1.287109375,
-0.10699462890625,
0.90478515625,
-0.5625,
0.4873046875,
-0.408935546875,
-0.041656494140625,
0.58251953125,
0.037353515625,
0.916015625,
-0.357421875,
-0.39404296875,
-0.544921875,
0.050811767578125,
-0.06475830078125,
-0.5234375,
0.255615234375,
-0.30322265625,
-0.194580078125,
-1.2158203125,
0.9228515625,
0.59375,
0.38330078125,
0.0180206298828125,
0.7275390625,
-0.0509033203125,
0.64404296875,
0.8515625,
-0.348388671875,
0.298095703125,
-0.91259765625,
0.8447265625,
0.0662841796875,
-0.061614990234375,
-0.30126953125,
-0.452392578125,
-0.5283203125,
0.04241943359375,
-0.1771240234375,
-0.1556396484375,
-0.92431640625,
0.54150390625,
0.119384765625,
0.60302734375,
-0.8759765625,
-0.337890625,
0.22998046875,
0.642578125,
0.264892578125,
-0.64208984375,
0.042816162109375,
-0.7431640625,
0.60107421875,
0.5654296875,
-0.1627197265625,
-0.6240234375,
0.11224365234375,
-0.58203125,
-0.7314453125,
-0.037078857421875,
1.0615234375,
0.4228515625,
0.24951171875,
-1.048828125,
0.57470703125,
0.662109375,
-0.258056640625,
-0.017242431640625,
-0.10369873046875,
0.5205078125,
0.2064208984375,
0.509765625,
-0.4716796875,
-0.8671875,
0.343505859375,
-1.0712890625,
0.392822265625,
-0.7060546875,
0.2357177734375,
-0.0263671875,
-0.26025390625,
-0.07647705078125,
0.59228515625,
-0.285888671875,
0.197509765625,
0.033233642578125,
0.6904296875,
-1.11328125,
-0.40185546875,
0.11627197265625,
-0.0489501953125,
-0.8173828125,
0.473876953125,
0.12890625,
-0.6533203125,
0.421630859375,
0.404052734375,
-0.28564453125,
0.51220703125,
-0.91162109375,
0.307373046875,
-0.21728515625,
-0.200439453125,
-0.1578369140625,
-0.52099609375,
0.21826171875,
0.1893310546875,
-1.0205078125,
-0.28076171875,
-1.271484375,
-0.29443359375,
0.0029392242431640625,
-0.287353515625,
0.45947265625,
0.340087890625,
-0.166259765625,
0.0914306640625,
-0.6474609375,
-0.89306640625,
-0.44384765625,
-0.28125,
-0.39501953125,
0.25830078125,
0.39208984375,
0.8134765625,
0.10821533203125,
-0.48486328125,
0.09661865234375,
0.081298828125,
-0.2470703125,
-0.81396484375,
0.004405975341796875,
0.0389404296875,
-0.30322265625,
-0.1572265625,
0.537109375,
-0.2230224609375,
0.245361328125,
0.95751953125,
0.04644775390625,
0.5263671875,
0.20654296875,
-0.896484375,
1.1259765625,
0.03826904296875,
-1.169921875,
-0.5185546875,
0.50341796875,
0.245849609375,
0.426025390625,
0.08648681640625,
-0.55224609375,
-1.0908203125,
-1.2919921875,
0.0985107421875,
-0.65771484375,
-0.3095703125,
-0.611328125,
-0.423583984375,
0.072265625,
0.853515625,
0.1270751953125,
-0.4052734375,
-0.09466552734375,
-1.5380859375,
0.370361328125,
-0.97412109375,
-0.157958984375,
-0.72021484375,
-0.311767578125,
-0.426025390625,
1.205078125,
0.333984375,
0.6279296875,
-0.314453125,
-0.169921875,
-0.06719970703125,
0.0312347412109375,
-0.51513671875,
-0.54443359375,
-0.018951416015625,
-0.29052734375,
-0.38623046875,
0.11669921875,
-0.56396484375,
0.69775390625,
-1.029296875,
0.07806396484375,
-0.461669921875,
-0.37646484375,
-0.462158203125,
-0.4072265625,
1.4912109375,
-0.27392578125,
-0.272705078125,
-0.427734375,
0.7578125,
0.57373046875,
-0.321044921875,
-0.79443359375,
-0.56689453125,
-0.7333984375,
-0.9755859375,
0.94140625,
-0.435302734375,
-0.09588623046875,
-0.45263671875,
0.197265625,
0.9443359375,
-0.07989501953125,
0.36181640625,
1.31640625,
0.445556640625,
0.038238525390625,
-1.3076171875,
0.8984375,
0.65185546875,
-0.54296875,
-0.04925537109375,
0.1585693359375,
-0.603515625,
0.150390625,
-0.7890625,
-1.103515625,
-0.5791015625,
-0.1553955078125,
1.1396484375,
-0.125,
1.1689453125,
-0.2418212890625,
-0.82421875,
-0.58154296875,
0.8671875,
0.30908203125,
0.14208984375,
0.79345703125,
0.1724853515625,
-0.14404296875,
0.31005859375,
0.053924560546875,
-0.366943359375,
-0.52783203125,
1.09765625,
-0.1317138671875,
-0.6328125,
1.0244140625,
0.91357421875,
-0.916015625,
-0.7841796875,
-0.00847625732421875,
-0.0906982421875,
-0.173583984375,
-0.85595703125,
0.261474609375,
0.480224609375,
-0.44384765625,
0.16015625,
0.56396484375,
-0.483642578125,
0.09686279296875,
0.1168212890625,
0.0672607421875,
-0.31787109375,
0.1651611328125,
0.71875,
-1.1962890625,
-0.2095947265625,
-0.8544921875,
0.07269287109375,
-0.0018148422241210938,
-0.07830810546875,
0.89990234375,
-0.361083984375,
0.59033203125,
0.56298828125,
0.04888916015625,
0.9619140625,
-0.7978515625,
-0.37255859375,
0.479248046875,
-1.09765625,
-0.41552734375,
-0.264892578125,
0.457763671875,
-0.1910400390625,
0.446533203125,
-0.7119140625,
0.0272064208984375,
0.56884765625,
0.49365234375,
0.2071533203125,
-0.802734375,
-0.810546875,
-1.1337890625,
-0.4912109375,
-0.300537109375,
-0.32275390625,
-0.64599609375,
0.35400390625,
0.45263671875,
-0.487060546875,
-0.0226287841796875,
0.5283203125,
-0.5595703125,
0.67822265625,
-0.93212890625,
0.51953125,
-0.83056640625,
-0.53125,
-0.407470703125,
0.3271484375,
-0.377197265625,
0.041229248046875,
-0.17919921875,
0.210693359375,
0.0689697265625,
0.6435546875,
-0.475830078125,
0.336181640625,
-0.150390625,
-0.190673828125,
0.343017578125,
0.10858154296875,
-0.25048828125,
0.744140625,
0.65478515625,
-0.10406494140625,
0.152587890625,
-0.60595703125,
-0.259033203125,
-0.10369873046875,
0.157470703125,
0.44775390625,
-0.1947021484375,
-0.0175323486328125,
-0.29052734375,
-0.07171630859375,
-0.7958984375,
-0.11285400390625,
-0.279296875,
0.1982421875,
0.06494140625,
-0.296630859375,
0.2484130859375,
0.9638671875,
0.17529296875,
0.485595703125,
-0.39990234375,
0.6103515625,
0.5341796875,
0.055755615234375,
0.015289306640625,
0.73583984375,
0.384033203125,
-0.1973876953125,
0.62744140625,
0.54736328125,
-0.147216796875,
0.50537109375,
-0.29345703125,
-1.2333984375,
-1.107421875,
0.117431640625,
0.1593017578125,
0.1676025390625,
0.59130859375,
-0.4208984375,
-0.12091064453125,
-0.412353515625,
-0.7705078125,
-0.09735107421875,
-1.0810546875,
-0.8134765625,
0.52734375,
-0.009185791015625,
-0.270751953125,
0.0823974609375,
-0.50146484375,
-0.1280517578125,
0.253173828125,
0.1900634765625,
-0.472900390625,
0.2061767578125,
0.060882568359375,
0.473876953125,
-0.51123046875,
-0.090576171875,
-0.04705810546875,
0.31103515625,
-0.374267578125,
-0.70556640625,
0.304443359375,
0.83740234375,
0.1824951171875,
-0.1939697265625,
-0.74365234375,
0.28564453125,
-0.0616455078125,
-0.12310791015625,
-0.476318359375,
0.435546875,
0.267578125,
0.46923828125,
-0.64453125,
0.19677734375,
-0.11700439453125,
0.390625,
0.48876953125,
-0.2412109375,
-0.5986328125,
0.68701171875,
0.494384765625,
-0.2025146484375,
0.4677734375,
0.2186279296875,
0.66552734375,
0.06744384765625,
-0.259765625,
-0.350341796875,
0.97314453125,
0.65283203125,
0.51025390625,
-0.1982421875,
0.31201171875,
0.787109375,
0.0616455078125,
-0.2232666015625,
0.46435546875,
0.5078125,
-0.01287841796875,
-0.000545501708984375,
-0.501953125,
-0.3154296875,
0.0266571044921875,
-0.431884765625,
0.1571044921875,
-0.5908203125,
-0.1455078125,
-0.59765625,
-0.6875,
0.92822265625,
0.0124053955078125,
0.11871337890625,
-0.1641845703125,
-0.6103515625,
0.60791015625,
0.84130859375,
0.136962890625,
0.184814453125,
0.830078125,
1.119140625,
0.53759765625,
0.76025390625,
0.366943359375,
0.49658203125,
-0.9892578125,
-0.24951171875,
0.1595458984375,
-0.160888671875,
-0.410400390625,
-0.66552734375,
-0.9404296875,
0.80419921875,
-0.4892578125,
-0.58154296875,
0.426513671875,
-1.072265625,
0.17138671875,
-0.185791015625,
0.62841796875,
-0.5146484375,
0.001617431640625,
0.216796875,
-0.291748046875,
-0.580078125,
0.98876953125,
0.0643310546875,
0.89306640625,
0.5263671875,
1.189453125,
-0.0943603515625,
1.423828125,
0.763671875,
-0.45166015625,
0.1795654296875,
0.572265625,
-0.38525390625,
-0.60888671875,
0.09747314453125,
-0.49072265625,
-0.12481689453125,
-0.341552734375,
-0.64306640625,
0.01070404052734375,
0.88134765625,
0.05242919921875,
-0.8408203125,
-0.352294921875,
0.384765625,
-0.55322265625,
0.54736328125,
-0.04168701171875,
0.38818359375,
0.1256103515625,
0.30224609375,
-0.402587890625,
-0.7705078125,
0.33642578125,
-0.412353515625,
0.5947265625,
-0.47802734375,
-0.96142578125,
-0.5693359375,
-0.70654296875,
-0.276611328125,
0.01175689697265625,
-0.47216796875,
-0.67919921875,
0.30517578125,
0.6669921875,
0.43505859375,
-0.09552001953125,
-0.58544921875,
-0.177734375,
0.6962890625,
1.0830078125,
0.07598876953125,
0.998046875,
0.626953125,
-0.2322998046875,
0.397216796875,
-0.5751953125,
0.8642578125,
0.1575927734375,
0.0867919921875,
-0.64892578125,
0.21337890625,
-0.386962890625,
-1.1474609375,
0.1995849609375,
0.59423828125,
0.339111328125,
-0.310546875,
-1.32421875,
-0.76123046875,
-0.62353515625,
-0.365966796875,
-0.859375,
0.8525390625,
0.13427734375,
-0.290771484375,
0.02557373046875,
-1.0986328125,
4.109375,
1.1259765625,
0.97705078125,
0.5048828125,
0.61083984375,
0.92578125,
0.591796875,
-0.68359375,
-0.0173492431640625,
-0.8779296875,
0.38427734375,
-0.6953125,
-0.269287109375,
0.724609375,
0.11053466796875,
0.599609375,
-0.304931640625,
0.28271484375,
-0.2044677734375,
-0.9501953125,
-0.8515625,
0.0537109375,
0.2880859375,
0.47509765625,
0.330810546875,
0.1103515625,
0.7275390625,
-0.9921875,
-0.18505859375,
-0.62939453125,
0.239990234375,
-0.765625,
0.93701171875,
0.3203125,
-0.428955078125,
0.50830078125,
0.07977294921875,
-0.6533203125,
-0.544921875,
0.2220458984375,
-0.6474609375,
-0.05426025390625,
0.8779296875,
-0.55029296875,
0.06500244140625,
0.6376953125,
-0.66015625,
0.9697265625,
0.427978515625,
-0.96337890625,
1.20703125,
-0.453857421875,
0.37744140625,
-0.50439453125,
-0.74462890625,
0.06085205078125,
0.28857421875,
-0.308349609375,
-0.51904296875,
0.55419921875,
-0.176025390625,
0.197998046875,
0.03277587890625,
1.0498046875,
-1.0986328125,
0.95947265625,
0.1689453125,
0.328857421875,
-0.72265625,
-0.08428955078125,
-0.384521484375,
-0.0279693603515625,
-0.235595703125,
-0.52587890625,
0.340087890625,
0.1644287109375,
-0.69482421875,
0.97509765625,
0.298828125,
-0.384521484375,
0.0367431640625,
-0.31298828125,
-0.64892578125,
-0.1964111328125,
0.5654296875,
1.20703125,
-0.6181640625,
-0.2041015625,
-0.363037109375,
1.0615234375,
0.81396484375,
0.376220703125,
-0.0258026123046875,
-0.52197265625,
-0.29833984375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
Vasya has come up with an algorithm he will follow while writing a letter. First he chooses two strings, s1 anf s2, consisting of uppercase English letters. Then the boy makes string sk, using a recurrent equation sn = sn - 2 + sn - 1, operation '+' means a concatenation (that is, the sequential record) of strings in the given order. Then Vasya writes down string sk on a piece of paper, puts it in the envelope and sends in to Santa.
Vasya is absolutely sure that Santa will bring him the best present if the resulting string sk has exactly x occurrences of substring AC (the short-cut reminds him ΠΎf accepted problems). Besides, Vasya decided that string s1 should have length n, and string s2 should have length m. Vasya hasn't decided anything else.
At the moment Vasya's got urgent New Year business, so he asks you to choose two strings for him, s1 and s2 in the required manner. Help Vasya.
Input
The first line contains four integers k, x, n, m (3 β€ k β€ 50; 0 β€ x β€ 109; 1 β€ n, m β€ 100).
Output
In the first line print string s1, consisting of n uppercase English letters. In the second line print string s2, consisting of m uppercase English letters. If there are multiple valid strings, print any of them.
If the required pair of strings doesn't exist, print "Happy new year!" without the quotes.
Examples
Input
3 2 2 2
Output
AC
AC
Input
3 3 2 2
Output
Happy new year!
Input
3 0 2 2
Output
AA
AA
Input
4 3 2 1
Output
Happy new year!
Input
4 2 2 1
Output
Happy new year!
Tags: bitmasks, brute force, dp
Correct Solution:
```
import sys
import itertools
k, x, n, m = map(int, input().split())
def valid(inicio, fim, tamanho, num_ac):
if num_ac == 0:
if tamanho == 1:
return ("" if inicio != fim else inicio)
elif tamanho == 2:
return (inicio + fim if inicio + fim != "AC" else "")
else:
return inicio + "B" * (tamanho - 2) + fim
s = "AC" * num_ac
if (not s) or s[0] != inicio:
s = inicio + s
if len(s) > tamanho or len(s) == tamanho and s[-1] != fim:
return ""
s += fim * (tamanho - len(s))
return s
a = [0] * 51
a[1] = 1
b = [0] * 51
b[2] = 1
for i in range(3, 51):
a[i] = a[i-2] + a[i-1]
b[i] = b[i-2] + b[i-1]
for letters in itertools.product(['A', 'B', 'C'], repeat=4):
first_s1 = letters[0]
last_s1 = letters[1]
first_s2 = letters[2]
last_s2 = letters[3]
c = [0] * 51
meio = last_s1 + first_s2
c[3] = (1 if meio == "AC" else 0)
for i in range(4, 51):
meio = last_s2 + (first_s1 if i % 2 == 0 else first_s2)
c[i] = c[i-2] + c[i-1] + (1 if meio == "AC" else 0)
for occ1 in range(0, 51):
tmp = x - a[k] * occ1 - c[k]
if tmp % b[k] != 0:
continue
tmp = tmp//b[k]
if tmp < 0 or tmp > 50:
continue
s1 = valid(first_s1, last_s1, n, occ1)
s2 = valid(first_s2, last_s2, m, tmp)
if s1 and s2:
print(s1)
print(s2)
sys.exit(0)
print("Happy new year!")
```
| 38,006
|
[
0.295166015625,
-0.04412841796875,
0.287353515625,
0.1890869140625,
-0.54296875,
-0.744140625,
0.136474609375,
0.11395263671875,
-0.09130859375,
0.8515625,
0.67431640625,
-0.10675048828125,
0.07281494140625,
-0.57958984375,
-0.53369140625,
0.1474609375,
-0.521484375,
-0.71240234375,
-0.27197265625,
0.123291015625,
0.07861328125,
-0.048797607421875,
-1.576171875,
-0.3974609375,
-0.505859375,
0.814453125,
0.159912109375,
0.0823974609375,
1.0703125,
1.0654296875,
0.0963134765625,
-0.580078125,
0.326171875,
-1.3583984375,
-0.173828125,
-0.50439453125,
0.80859375,
-0.72607421875,
-0.0389404296875,
-0.146484375,
0.2176513671875,
-0.3037109375,
0.8525390625,
-0.658203125,
-1.1689453125,
-0.250244140625,
-0.169921875,
-0.0855712890625,
-0.218017578125,
-0.5205078125,
0.376708984375,
-0.461669921875,
0.52294921875,
-0.456298828125,
0.314697265625,
0.2115478515625,
-0.0149993896484375,
-0.05560302734375,
-0.73974609375,
0.07330322265625,
0.2039794921875,
0.1661376953125,
0.280029296875,
-0.525390625,
-0.002651214599609375,
0.1317138671875,
0.0770263671875,
-0.2200927734375,
-0.138916015625,
-0.498046875,
-0.35595703125,
0.2607421875,
-0.86328125,
-0.239013671875,
-0.33447265625,
0.028411865234375,
0.1458740234375,
-0.042938232421875,
-0.564453125,
0.78271484375,
0.051605224609375,
0.81640625,
0.213623046875,
0.3466796875,
-0.40478515625,
-0.74755859375,
0.373046875,
0.1966552734375,
0.352783203125,
0.0975341796875,
-0.1881103515625,
0.321533203125,
-0.7138671875,
0.269287109375,
0.61279296875,
0.72998046875,
-0.1539306640625,
0.319091796875,
0.1304931640625,
0.374267578125,
0.74267578125,
0.84814453125,
-0.296142578125,
0.94189453125,
-0.68017578125,
0.212158203125,
0.43505859375,
-0.11639404296875,
-0.1544189453125,
-0.10076904296875,
-0.394287109375,
-0.265869140625,
0.64306640625,
0.1900634765625,
-0.41748046875,
0.96923828125,
0.232421875,
0.6904296875,
-0.69384765625,
0.1927490234375,
0.7294921875,
0.251220703125,
0.71044921875,
-0.3173828125,
-0.34228515625,
-0.276123046875,
-0.28662109375,
1.064453125,
-0.53759765625,
0.037689208984375,
0.546875,
0.051300048828125,
-0.196533203125,
0.29248046875,
-0.2200927734375,
0.4384765625,
-0.1591796875,
0.53564453125,
0.802734375,
-0.65869140625,
0.244384765625,
-0.2149658203125,
0.0718994140625,
1.3447265625,
0.07611083984375,
-0.06341552734375,
0.67919921875,
0.48095703125,
-1.09765625,
0.197021484375,
-0.50634765625,
0.51416015625,
0.1878662109375,
0.31591796875,
-0.165771484375,
0.222900390625,
-0.144775390625,
0.014892578125,
0.2181396484375,
-0.1365966796875,
-0.214111328125,
0.367919921875,
-0.366455078125,
0.95458984375,
-0.202880859375,
0.56884765625,
-0.412353515625,
-0.179931640625,
-0.51318359375,
-0.58740234375,
0.0819091796875,
-0.327392578125,
-0.430908203125,
0.5966796875,
0.497802734375,
0.77294921875,
1.16015625,
-0.281494140625,
0.332275390625,
-0.05322265625,
-0.353759765625,
0.362548828125,
0.7021484375,
0.7578125,
0.319580078125,
0.336181640625,
-0.0869140625,
-0.35009765625,
-0.60107421875,
-0.77294921875,
0.0220489501953125,
0.473876953125,
-0.46142578125,
0.48486328125,
0.10345458984375,
0.224365234375,
-0.8447265625,
-0.31494140625,
-0.28125,
-0.875,
-0.4931640625,
0.396728515625,
-0.326171875,
0.5224609375,
-0.71826171875,
-0.65283203125,
0.420166015625,
1.134765625,
-0.2109375,
0.07305908203125,
0.465087890625,
0.1131591796875,
-0.275634765625,
0.3525390625,
0.28466796875,
-0.054473876953125,
-0.7216796875,
0.59375,
-0.067626953125,
-0.025909423828125,
-0.0029697418212890625,
0.580078125,
0.43408203125,
0.353759765625,
-0.349853515625,
-0.2222900390625,
0.650390625,
0.77099609375,
-0.07415771484375,
0.623046875,
0.06451416015625,
0.81201171875,
0.478271484375,
0.81689453125,
0.814453125,
0.1300048828125,
0.58056640625,
0.487548828125,
0.0882568359375,
0.280517578125,
0.143310546875,
0.1146240234375,
0.0943603515625,
0.3466796875,
0.12432861328125,
0.55810546875,
-0.22021484375,
0.127685546875,
-0.1514892578125,
0.178466796875,
-0.360107421875,
0.5302734375,
0.35107421875,
0.53466796875,
-0.4189453125,
-0.2099609375,
0.277099609375,
0.94482421875,
-0.53076171875,
-0.430908203125,
-0.489990234375,
0.12286376953125,
0.045013427734375,
0.07867431640625,
0.08978271484375,
0.168701171875,
0.548828125,
0.57470703125,
-0.439453125,
-0.5615234375,
-0.91357421875,
-0.935546875,
-0.80078125,
-0.5078125,
-0.5048828125,
-0.03369140625,
0.7451171875,
-0.97509765625,
0.1556396484375,
-0.1964111328125,
-0.09259033203125,
0.22119140625,
-0.461181640625,
0.298828125,
-0.2218017578125,
0.398193359375,
-0.64697265625,
0.47119140625,
0.11163330078125,
1.037109375,
-0.689453125,
0.070556640625,
0.000263214111328125,
-0.1876220703125,
0.28125,
-0.158447265625,
0.2261962890625,
-0.29443359375,
-0.475341796875,
-0.7763671875,
-0.6044921875,
-0.1507568359375,
0.0195770263671875,
0.1676025390625,
-0.440185546875,
0.414306640625,
0.52783203125,
-0.98388671875,
0.4951171875,
0.72265625,
-0.791015625,
0.1541748046875,
0.433837890625,
-0.18310546875,
-0.802734375,
1.1875,
0.38232421875,
0.55810546875,
-0.5693359375,
-0.383544921875,
-0.1614990234375,
0.179443359375,
-0.004329681396484375,
-0.252197265625,
-0.51708984375,
0.57666015625,
-0.155029296875,
-0.93994140625,
0.398681640625,
-0.9521484375,
-0.681640625,
-0.42236328125,
-0.453857421875,
0.78515625,
0.814453125,
0.27294921875,
-0.2060546875,
0.031158447265625,
-0.1109619140625,
0.58447265625,
0.36865234375,
-0.6220703125,
0.06463623046875,
0.65234375,
-0.2486572265625,
-0.0289306640625,
0.4345703125,
-0.318359375,
-0.370849609375,
0.11163330078125,
0.281982421875,
0.265625,
0.342041015625,
-0.10107421875,
0.572265625,
0.73779296875,
-0.720703125,
-0.25537109375,
0.0018758773803710938,
0.64208984375,
0.287109375,
0.6435546875,
0.322509765625,
-0.485595703125,
-0.54931640625,
-1.2744140625,
0.51904296875,
0.09844970703125,
0.60400390625,
-0.98876953125,
0.677734375,
0.12091064453125,
-0.8515625,
0.371337890625,
-0.646484375,
-0.2430419921875,
0.783203125,
-0.351318359375,
0.51220703125,
-0.65576171875,
0.16796875,
-0.48828125,
-0.0653076171875,
0.53955078125,
0.287109375,
0.56884765625,
-0.31884765625,
-0.30859375,
-0.384765625,
-0.1439208984375,
-0.061859130859375,
-0.448974609375,
0.277099609375,
-0.28955078125,
-0.22216796875,
-0.9443359375,
0.59765625,
0.4619140625,
0.5693359375,
0.10150146484375,
0.481689453125,
0.08251953125,
0.72509765625,
0.394775390625,
-0.1585693359375,
0.1480712890625,
-0.7587890625,
0.95361328125,
0.266845703125,
-0.34130859375,
-0.55322265625,
-0.29931640625,
-0.132568359375,
0.187255859375,
-0.01010894775390625,
-0.276611328125,
-0.97119140625,
-0.015777587890625,
-0.053375244140625,
0.59375,
-0.3896484375,
-0.2066650390625,
-0.421630859375,
0.275146484375,
0.11444091796875,
-1.1787109375,
0.287353515625,
-0.76904296875,
0.73828125,
0.1468505859375,
0.07806396484375,
-0.58251953125,
-0.2117919921875,
-0.7626953125,
-0.59814453125,
-0.32275390625,
0.9853515625,
-0.007061004638671875,
0.33740234375,
-1.3818359375,
0.2373046875,
0.43359375,
-0.006755828857421875,
0.2705078125,
0.376708984375,
0.457275390625,
0.1954345703125,
0.595703125,
-0.1878662109375,
-0.63037109375,
0.33837890625,
-1.37109375,
0.3701171875,
-0.509765625,
0.42138671875,
-0.08441162109375,
-0.0307769775390625,
-0.170166015625,
0.4931640625,
-0.3017578125,
0.41455078125,
-0.1881103515625,
0.34814453125,
-0.9892578125,
-0.79736328125,
0.4990234375,
-0.1575927734375,
-0.5224609375,
0.80517578125,
-0.0806884765625,
-0.43505859375,
-0.11199951171875,
0.630859375,
-0.30029296875,
0.07342529296875,
-0.412109375,
0.50390625,
-0.2264404296875,
-0.66015625,
-0.3486328125,
-0.994140625,
0.78369140625,
-0.09918212890625,
-0.78564453125,
-0.155029296875,
-1.16796875,
-0.05029296875,
0.27734375,
-0.58056640625,
0.54736328125,
0.106689453125,
0.0748291015625,
-0.32470703125,
-0.168701171875,
-0.580078125,
0.0535888671875,
-0.9423828125,
-0.40576171875,
0.337890625,
0.57373046875,
0.85400390625,
-0.12420654296875,
-0.69677734375,
0.258056640625,
0.40185546875,
-0.196533203125,
-0.52587890625,
0.0082550048828125,
-0.267822265625,
-0.447265625,
-0.20166015625,
0.1953125,
0.06890869140625,
0.2744140625,
0.66064453125,
0.155517578125,
0.390625,
0.67626953125,
-0.66357421875,
0.9658203125,
0.56201171875,
-1.22265625,
-0.368896484375,
0.3388671875,
-0.54052734375,
0.494140625,
0.301513671875,
-0.68994140625,
-1.0966796875,
-0.939453125,
-0.1524658203125,
-0.477783203125,
0.10491943359375,
-0.91455078125,
-0.060455322265625,
-0.45947265625,
0.8037109375,
-0.2138671875,
-0.46435546875,
0.1905517578125,
-1.05078125,
-0.06048583984375,
-0.8447265625,
-0.339599609375,
-0.5390625,
-0.290771484375,
-0.127197265625,
1.0419921875,
-0.1553955078125,
0.313720703125,
-0.220703125,
-0.479736328125,
0.1558837890625,
0.1336669921875,
-0.58203125,
-0.366943359375,
0.289306640625,
0.110595703125,
-0.148681640625,
-0.1422119140625,
-0.37841796875,
0.8671875,
-0.705078125,
0.047515869140625,
-0.294677734375,
-0.53955078125,
-0.1754150390625,
-0.022735595703125,
1.1162109375,
-0.69287109375,
0.1258544921875,
-0.4912109375,
0.59765625,
0.9501953125,
-0.339111328125,
-0.297119140625,
-0.7080078125,
-0.6806640625,
-1.01953125,
0.42041015625,
-0.187744140625,
0.250732421875,
-0.6259765625,
-0.1617431640625,
1.12109375,
-0.37255859375,
0.2469482421875,
1.0869140625,
0.430908203125,
0.392822265625,
-0.69189453125,
0.5791015625,
0.400146484375,
-0.365478515625,
0.197021484375,
0.346435546875,
-0.806640625,
0.260498046875,
-0.3388671875,
-1.0341796875,
-0.77880859375,
0.5029296875,
1.3681640625,
-0.5302734375,
0.8486328125,
-0.01355743408203125,
-1.1689453125,
-0.237548828125,
0.7080078125,
0.02783203125,
-0.00823974609375,
1.119140625,
0.2392578125,
0.015838623046875,
-0.271240234375,
-0.175048828125,
-0.265869140625,
-0.284423828125,
0.7783203125,
-0.49853515625,
-0.58154296875,
0.6015625,
1.1767578125,
-0.658203125,
-0.77880859375,
0.0704345703125,
0.103271484375,
0.1719970703125,
-0.73193359375,
0.051849365234375,
0.462158203125,
-0.409912109375,
0.2183837890625,
0.5625,
0.26123046875,
0.41015625,
-0.00614166259765625,
0.498291015625,
-0.213134765625,
0.47705078125,
0.45166015625,
-0.60302734375,
-0.339111328125,
-0.720703125,
-0.176025390625,
-0.2169189453125,
0.1251220703125,
1.048828125,
-0.11865234375,
0.306396484375,
0.5869140625,
-0.2000732421875,
0.93505859375,
-0.45166015625,
-0.469482421875,
0.5029296875,
-0.6259765625,
-0.444091796875,
0.045867919921875,
0.353759765625,
-0.1993408203125,
0.2025146484375,
-0.467529296875,
-0.2017822265625,
0.10125732421875,
0.290771484375,
-0.175537109375,
-0.66357421875,
-0.286376953125,
-0.68798828125,
-0.44189453125,
-0.6220703125,
-0.560546875,
-0.30615234375,
0.1563720703125,
0.1744384765625,
-0.55810546875,
-0.23486328125,
0.77783203125,
-1.14453125,
0.8603515625,
-0.64404296875,
0.32763671875,
-0.57861328125,
-0.1871337890625,
-0.54150390625,
-0.055572509765625,
-0.62841796875,
-0.04400634765625,
-0.4521484375,
0.180419921875,
-0.322265625,
0.3955078125,
0.0180206298828125,
0.142333984375,
-0.083984375,
-0.65380859375,
-0.076904296875,
0.222412109375,
-0.053009033203125,
0.45556640625,
0.6806640625,
-0.342041015625,
0.2298583984375,
-0.311767578125,
-0.2685546875,
-0.56689453125,
0.51904296875,
0.58935546875,
-0.10528564453125,
-0.1807861328125,
-0.0770263671875,
0.064208984375,
-1.0400390625,
0.26953125,
-0.087646484375,
0.5009765625,
0.6171875,
-0.57666015625,
0.5205078125,
0.87646484375,
-0.325439453125,
0.407958984375,
0.3369140625,
0.449462890625,
0.10064697265625,
0.268798828125,
-0.18994140625,
0.8759765625,
0.36865234375,
-0.370849609375,
-0.050750732421875,
0.272705078125,
-0.09820556640625,
0.5400390625,
-0.269775390625,
-0.6201171875,
-0.96923828125,
-0.259765625,
0.0281982421875,
0.496337890625,
0.63671875,
-0.59326171875,
-0.07916259765625,
0.0631103515625,
-0.36474609375,
0.1778564453125,
-1.056640625,
-1.109375,
0.35302734375,
-0.11614990234375,
-0.560546875,
-0.197509765625,
-0.212890625,
-0.120361328125,
0.390380859375,
0.2415771484375,
-0.66357421875,
0.53515625,
-0.120849609375,
0.7001953125,
-0.44482421875,
0.0113525390625,
0.181640625,
0.374755859375,
-0.3095703125,
-0.490966796875,
0.206787109375,
1.23828125,
0.154296875,
-0.08038330078125,
-0.55224609375,
0.467041015625,
0.1724853515625,
0.280517578125,
-0.6005859375,
0.58154296875,
-0.2335205078125,
0.4794921875,
-0.8232421875,
-0.18994140625,
-0.1690673828125,
0.42822265625,
0.151611328125,
-0.337646484375,
-0.84326171875,
0.92529296875,
0.460693359375,
0.06622314453125,
0.671875,
0.307861328125,
0.505859375,
0.0361328125,
-0.11785888671875,
-0.277587890625,
0.59814453125,
0.58349609375,
0.556640625,
0.0142364501953125,
0.1463623046875,
0.89404296875,
-0.102783203125,
-0.1644287109375,
0.40966796875,
0.4462890625,
-0.1951904296875,
0.336181640625,
0.0989990234375,
-0.061004638671875,
-0.07806396484375,
-0.59033203125,
0.740234375,
-0.355712890625,
0.22314453125,
-0.439453125,
-0.8984375,
0.6328125,
-0.273193359375,
0.038238525390625,
0.276611328125,
-0.135009765625,
0.3056640625,
0.61962890625,
0.10260009765625,
-0.050537109375,
0.97216796875,
0.64306640625,
0.787109375,
0.5302734375,
0.5068359375,
0.4521484375,
-0.448486328125,
-0.0343017578125,
-0.2032470703125,
0.038970947265625,
-0.1563720703125,
-0.4453125,
-0.943359375,
0.5966796875,
-0.3662109375,
-0.1484375,
0.642578125,
-0.5732421875,
0.25146484375,
-0.4423828125,
0.75537109375,
-0.51318359375,
0.2120361328125,
0.474609375,
-0.62451171875,
-0.50634765625,
0.6923828125,
-0.2349853515625,
0.26220703125,
0.340576171875,
0.66650390625,
0.033935546875,
1.283203125,
0.521484375,
-0.3349609375,
-0.1812744140625,
-0.096435546875,
-0.219970703125,
-0.467529296875,
-0.166015625,
-0.5048828125,
0.1258544921875,
-0.71630859375,
-0.482666015625,
-0.0235748291015625,
0.84228515625,
-0.12225341796875,
-1.0537109375,
-0.420166015625,
0.01474761962890625,
-0.81005859375,
0.25927734375,
0.27197265625,
0.13623046875,
-0.307861328125,
0.2347412109375,
-0.10247802734375,
-0.70703125,
0.375244140625,
-0.6396484375,
0.51025390625,
-0.64111328125,
-0.373291015625,
-0.62158203125,
-0.94384765625,
-0.45361328125,
-0.26025390625,
-0.427001953125,
-0.81494140625,
0.4326171875,
0.46728515625,
0.422607421875,
0.529296875,
-0.42041015625,
0.17529296875,
0.826171875,
1.20703125,
0.13427734375,
0.70751953125,
0.00035452842712402344,
-0.26611328125,
0.0777587890625,
-0.56689453125,
0.5224609375,
-0.11981201171875,
0.439697265625,
-0.54638671875,
0.249755859375,
-0.482421875,
-1.30078125,
-0.1409912109375,
0.2044677734375,
0.48828125,
-0.78271484375,
-1.1484375,
-0.272216796875,
-1.1259765625,
-0.1343994140625,
-0.81787109375,
0.923828125,
-0.255615234375,
0.1612548828125,
-0.34033203125,
-1.064453125,
4.53125,
1.0498046875,
0.8935546875,
0.34521484375,
0.78125,
1.1689453125,
0.3779296875,
-0.390625,
-0.399169921875,
-0.1484375,
0.2457275390625,
-0.62744140625,
0.12237548828125,
0.84375,
0.1495361328125,
0.466796875,
-0.537109375,
0.15869140625,
-0.296630859375,
-0.92333984375,
-1.14453125,
0.390869140625,
0.096435546875,
0.29052734375,
0.0684814453125,
0.03289794921875,
0.252685546875,
-0.448974609375,
-0.184326171875,
-0.85546875,
0.1864013671875,
-0.380126953125,
0.86572265625,
-0.0006661415100097656,
0.2415771484375,
0.6357421875,
-0.03643798828125,
-0.61669921875,
-0.3427734375,
0.149169921875,
-0.29541015625,
-0.07110595703125,
0.67578125,
-0.46044921875,
0.1292724609375,
0.359375,
-0.66650390625,
0.54248046875,
-0.28466796875,
-1.205078125,
0.9384765625,
-0.2291259765625,
0.2152099609375,
-0.5791015625,
-0.74658203125,
0.382568359375,
0.302978515625,
-0.2191162109375,
-0.408203125,
0.49267578125,
0.31640625,
0.256591796875,
0.1116943359375,
0.748046875,
-1.2880859375,
0.68359375,
-0.509765625,
0.5078125,
-0.78515625,
-0.041168212890625,
-0.294189453125,
0.1007080078125,
-0.476318359375,
-0.5107421875,
0.1646728515625,
0.0394287109375,
-0.311767578125,
0.67724609375,
0.6416015625,
-0.64697265625,
0.296630859375,
-0.1011962890625,
-0.396484375,
-0.404296875,
0.51318359375,
1.3251953125,
-0.52392578125,
-0.1937255859375,
-0.298828125,
0.701171875,
0.441162109375,
0.42236328125,
-0.211181640625,
-0.47119140625,
-0.2244873046875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
Vasya has come up with an algorithm he will follow while writing a letter. First he chooses two strings, s1 anf s2, consisting of uppercase English letters. Then the boy makes string sk, using a recurrent equation sn = sn - 2 + sn - 1, operation '+' means a concatenation (that is, the sequential record) of strings in the given order. Then Vasya writes down string sk on a piece of paper, puts it in the envelope and sends in to Santa.
Vasya is absolutely sure that Santa will bring him the best present if the resulting string sk has exactly x occurrences of substring AC (the short-cut reminds him ΠΎf accepted problems). Besides, Vasya decided that string s1 should have length n, and string s2 should have length m. Vasya hasn't decided anything else.
At the moment Vasya's got urgent New Year business, so he asks you to choose two strings for him, s1 and s2 in the required manner. Help Vasya.
Input
The first line contains four integers k, x, n, m (3 β€ k β€ 50; 0 β€ x β€ 109; 1 β€ n, m β€ 100).
Output
In the first line print string s1, consisting of n uppercase English letters. In the second line print string s2, consisting of m uppercase English letters. If there are multiple valid strings, print any of them.
If the required pair of strings doesn't exist, print "Happy new year!" without the quotes.
Examples
Input
3 2 2 2
Output
AC
AC
Input
3 3 2 2
Output
Happy new year!
Input
3 0 2 2
Output
AA
AA
Input
4 3 2 1
Output
Happy new year!
Input
4 2 2 1
Output
Happy new year!
Tags: bitmasks, brute force, dp
Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
def make_string(k, k2string, s1, s2):
if k in k2string:
return k2string[k]
if k == 1:
k2string[k] = s1
elif k == 2:
k2string[k] = s2
else:
k2string[k] = make_string(k-2, k2string, s1, s2) + make_string(k-1, k2string, s1, s2)
return k2string[k]
def count_comb(k, k2comb):
if k in k2comb:
return k2comb[k]
if k == 1:
k2comb[k] = ([0, 0, 0, 0, 1, 0], ('1', '1'))
elif k == 2:
k2comb[k] = ([0, 0, 0, 0, 0, 1], ('2', '2'))
else:
r_2 = count_comb(k-2, k2comb)
r_1 = count_comb(k-1, k2comb)
r = ([x+y for (x,y) in zip(r_2[0],r_1[0])], (r_2[1][0], r_1[1][1]))
ss = r_2[1][1] + r_1[1][0]
if ss == '11':
r[0][0] += 1
elif ss == '12':
r[0][1] += 1
elif ss == '21':
r[0][2] += 1
elif ss == '22':
r[0][3] += 1
k2comb[k] = r
return k2comb[k]
def max_independent_ac(l, cStart, aEnd):
if l <= 1:
return 0
elif (cStart and not aEnd) or (not cStart and aEnd):
return (l-1) // 2
elif cStart and aEnd:
return (l-2) // 2
else:
return l // 2
def print_sequence(l, ac, cStart, aEnd):
cStart = 1 if cStart else 0
aEnd = 1 if aEnd else 0
if cStart:
print('C', end='')
for i in range(ac):
print('AC', end='')
for i in range(l - 2*ac - cStart - aEnd):
print('B', end='')
if aEnd:
print('A', end='')
print()
def run_test(k, x, n, m):
comb = count_comb(k, {})[0]
for mask in range(16):
v = [0, 0, 0, 0, 0, 0]
if (mask & 1) and (mask & 2):
v[0] = 1
if (mask & 2) and (mask & 4):
v[1] = 1
if (mask & 1) and (mask & 8):
v[2] = 1
if (mask & 4) and (mask & 8):
v[3] = 1
if (n == 1 and v[0]) or (m == 1 and v[3]):
continue
max1 = max_independent_ac(n, mask & 1, mask & 2)
max2 = max_independent_ac(m, mask & 4, mask & 8)
for p in range(max1+1):
for q in range(max2+1):
v[4] = p
v[5] = q
if sum([x*y for (x,y) in zip(v,comb)]) == x:
print_sequence(n, p, mask&1, mask&2)
print_sequence(m, q, mask&4, mask&8)
return
print('Happy new year!')
k, x, n, m = (int(x) for x in sys.stdin.readline().split(' '))
run_test(k, x, n, m)
```
| 38,007
|
[
0.27197265625,
-0.039093017578125,
0.2491455078125,
0.213623046875,
-0.556640625,
-0.80517578125,
0.15087890625,
0.1712646484375,
-0.1239013671875,
0.810546875,
0.67626953125,
-0.11029052734375,
0.1142578125,
-0.63720703125,
-0.57373046875,
0.1697998046875,
-0.479736328125,
-0.76123046875,
-0.231689453125,
0.1876220703125,
0.09088134765625,
-0.043487548828125,
-1.5830078125,
-0.404296875,
-0.4736328125,
0.77294921875,
0.2408447265625,
0.12646484375,
1.0361328125,
1.10546875,
0.072509765625,
-0.5546875,
0.3486328125,
-1.4208984375,
-0.2044677734375,
-0.52392578125,
0.833984375,
-0.765625,
-0.0202789306640625,
-0.158935546875,
0.27587890625,
-0.31982421875,
0.86865234375,
-0.6748046875,
-1.1630859375,
-0.265869140625,
-0.1885986328125,
-0.0667724609375,
-0.2403564453125,
-0.51806640625,
0.398193359375,
-0.460205078125,
0.55224609375,
-0.447265625,
0.370361328125,
0.248779296875,
-0.0141143798828125,
-0.042694091796875,
-0.7548828125,
0.06585693359375,
0.1463623046875,
0.0989990234375,
0.2139892578125,
-0.59716796875,
0.018646240234375,
0.17041015625,
-0.0126953125,
-0.184326171875,
-0.1865234375,
-0.488037109375,
-0.287841796875,
0.2281494140625,
-0.84228515625,
-0.266845703125,
-0.272216796875,
-0.031280517578125,
0.1031494140625,
-0.0034160614013671875,
-0.54541015625,
0.7822265625,
0.0513916015625,
0.83251953125,
0.2325439453125,
0.34765625,
-0.37939453125,
-0.8037109375,
0.34716796875,
0.2327880859375,
0.325439453125,
0.13037109375,
-0.177978515625,
0.324462890625,
-0.68603515625,
0.2498779296875,
0.62548828125,
0.7685546875,
-0.08135986328125,
0.389404296875,
0.1112060546875,
0.351318359375,
0.740234375,
0.87939453125,
-0.321044921875,
0.93115234375,
-0.61328125,
0.269287109375,
0.417724609375,
-0.08917236328125,
-0.1983642578125,
-0.088623046875,
-0.3828125,
-0.3232421875,
0.64453125,
0.1768798828125,
-0.415283203125,
0.96875,
0.143310546875,
0.69287109375,
-0.7138671875,
0.2169189453125,
0.68896484375,
0.2381591796875,
0.70703125,
-0.322998046875,
-0.32861328125,
-0.25927734375,
-0.236083984375,
1.07421875,
-0.51806640625,
0.0034313201904296875,
0.5166015625,
-0.0095977783203125,
-0.1756591796875,
0.272216796875,
-0.219970703125,
0.51953125,
-0.1331787109375,
0.52490234375,
0.8203125,
-0.68212890625,
0.30126953125,
-0.2071533203125,
0.09326171875,
1.3837890625,
0.060546875,
-0.040374755859375,
0.6845703125,
0.480224609375,
-1.103515625,
0.2318115234375,
-0.421875,
0.422119140625,
0.1890869140625,
0.3310546875,
-0.1480712890625,
0.26123046875,
-0.1593017578125,
0.0623779296875,
0.1619873046875,
-0.11578369140625,
-0.19677734375,
0.37158203125,
-0.37646484375,
0.9755859375,
-0.228271484375,
0.55810546875,
-0.447021484375,
-0.2166748046875,
-0.55224609375,
-0.58984375,
0.055572509765625,
-0.33642578125,
-0.427001953125,
0.6298828125,
0.50146484375,
0.73974609375,
1.107421875,
-0.251708984375,
0.310546875,
-0.0157470703125,
-0.26416015625,
0.375244140625,
0.6533203125,
0.8095703125,
0.2861328125,
0.279052734375,
-0.1416015625,
-0.322998046875,
-0.61181640625,
-0.76123046875,
0.034515380859375,
0.49462890625,
-0.46533203125,
0.447998046875,
0.1591796875,
0.201171875,
-0.84130859375,
-0.330322265625,
-0.238037109375,
-0.841796875,
-0.443359375,
0.417236328125,
-0.305419921875,
0.5048828125,
-0.69482421875,
-0.6748046875,
0.402099609375,
1.140625,
-0.1748046875,
0.029052734375,
0.45166015625,
0.10400390625,
-0.27490234375,
0.34228515625,
0.301513671875,
-0.09710693359375,
-0.794921875,
0.67333984375,
-0.05181884765625,
0.015960693359375,
-0.00658416748046875,
0.59130859375,
0.477294921875,
0.437255859375,
-0.380615234375,
-0.22802734375,
0.64111328125,
0.83154296875,
-0.0018758773803710938,
0.55322265625,
0.03375244140625,
0.81103515625,
0.48876953125,
0.84130859375,
0.87353515625,
0.188720703125,
0.5947265625,
0.50146484375,
0.1229248046875,
0.337158203125,
0.06243896484375,
0.0811767578125,
0.046478271484375,
0.354248046875,
0.1414794921875,
0.57861328125,
-0.2401123046875,
0.08404541015625,
-0.2181396484375,
0.08917236328125,
-0.35888671875,
0.56787109375,
0.377685546875,
0.5595703125,
-0.48583984375,
-0.24853515625,
0.31298828125,
0.943359375,
-0.55078125,
-0.454833984375,
-0.434326171875,
0.16162109375,
0.01120758056640625,
0.11883544921875,
0.128173828125,
0.1942138671875,
0.5048828125,
0.6064453125,
-0.4091796875,
-0.58740234375,
-0.96630859375,
-0.97802734375,
-0.82666015625,
-0.50830078125,
-0.50146484375,
-0.024627685546875,
0.69091796875,
-1.037109375,
0.1280517578125,
-0.1717529296875,
-0.05889892578125,
0.252197265625,
-0.52490234375,
0.31201171875,
-0.2095947265625,
0.35986328125,
-0.65576171875,
0.53662109375,
0.0948486328125,
1.0712890625,
-0.73828125,
0.06781005859375,
-0.05535888671875,
-0.2166748046875,
0.3037109375,
-0.1600341796875,
0.2261962890625,
-0.327880859375,
-0.46923828125,
-0.78125,
-0.7001953125,
-0.1146240234375,
0.0012111663818359375,
0.10894775390625,
-0.444580078125,
0.434326171875,
0.51416015625,
-0.9521484375,
0.5625,
0.78857421875,
-0.77294921875,
0.193115234375,
0.50732421875,
-0.1522216796875,
-0.8583984375,
1.2255859375,
0.422119140625,
0.52685546875,
-0.5732421875,
-0.428955078125,
-0.184814453125,
0.171142578125,
-0.0029735565185546875,
-0.251708984375,
-0.47705078125,
0.609375,
-0.1298828125,
-0.93408203125,
0.3935546875,
-0.9326171875,
-0.73974609375,
-0.4443359375,
-0.43994140625,
0.79052734375,
0.818359375,
0.27734375,
-0.2301025390625,
0.08160400390625,
-0.1041259765625,
0.580078125,
0.387939453125,
-0.587890625,
0.0611572265625,
0.67431640625,
-0.26220703125,
0.0120391845703125,
0.400146484375,
-0.3984375,
-0.385009765625,
0.0762939453125,
0.3359375,
0.3154296875,
0.39013671875,
-0.1297607421875,
0.5224609375,
0.84521484375,
-0.7705078125,
-0.26025390625,
0.007244110107421875,
0.60009765625,
0.327392578125,
0.6435546875,
0.32666015625,
-0.5107421875,
-0.55029296875,
-1.2744140625,
0.56591796875,
0.056121826171875,
0.634765625,
-1.0224609375,
0.67724609375,
0.1297607421875,
-0.8623046875,
0.3720703125,
-0.66259765625,
-0.1868896484375,
0.8046875,
-0.35986328125,
0.50634765625,
-0.67431640625,
0.2039794921875,
-0.400390625,
-0.1060791015625,
0.57568359375,
0.313232421875,
0.55712890625,
-0.3671875,
-0.266845703125,
-0.43017578125,
-0.1474609375,
-0.0211029052734375,
-0.499755859375,
0.256591796875,
-0.35693359375,
-0.2451171875,
-0.96826171875,
0.59375,
0.43505859375,
0.57373046875,
0.10186767578125,
0.463134765625,
0.03997802734375,
0.751953125,
0.407470703125,
-0.1627197265625,
0.145751953125,
-0.85009765625,
0.943359375,
0.26220703125,
-0.33154296875,
-0.53369140625,
-0.25048828125,
-0.224609375,
0.19091796875,
0.01369476318359375,
-0.2244873046875,
-0.998046875,
0.07965087890625,
-0.07049560546875,
0.62353515625,
-0.389892578125,
-0.239013671875,
-0.40087890625,
0.316162109375,
0.1427001953125,
-1.203125,
0.2459716796875,
-0.7421875,
0.72705078125,
0.19189453125,
0.1185302734375,
-0.54248046875,
-0.2305908203125,
-0.79150390625,
-0.59375,
-0.2919921875,
0.98779296875,
-0.0015106201171875,
0.34765625,
-1.419921875,
0.252685546875,
0.414306640625,
-0.0404052734375,
0.2354736328125,
0.371337890625,
0.4609375,
0.17529296875,
0.68017578125,
-0.1512451171875,
-0.65478515625,
0.342041015625,
-1.3720703125,
0.356689453125,
-0.467529296875,
0.35986328125,
-0.1011962890625,
0.0115814208984375,
-0.1903076171875,
0.49951171875,
-0.31787109375,
0.35546875,
-0.1849365234375,
0.334716796875,
-1.0087890625,
-0.80419921875,
0.50390625,
-0.1923828125,
-0.5615234375,
0.79833984375,
-0.04656982421875,
-0.41357421875,
-0.1566162109375,
0.62255859375,
-0.336669921875,
0.084228515625,
-0.445068359375,
0.496826171875,
-0.30078125,
-0.63427734375,
-0.385986328125,
-0.94140625,
0.79833984375,
-0.0692138671875,
-0.8125,
-0.18359375,
-1.1318359375,
-0.0751953125,
0.28173828125,
-0.56005859375,
0.6201171875,
0.043182373046875,
0.03582763671875,
-0.255126953125,
-0.1544189453125,
-0.62939453125,
0.05279541015625,
-0.96728515625,
-0.444580078125,
0.37744140625,
0.60595703125,
0.8671875,
-0.136474609375,
-0.64453125,
0.263427734375,
0.411376953125,
-0.1873779296875,
-0.54833984375,
-0.0033740997314453125,
-0.2418212890625,
-0.5234375,
-0.222412109375,
0.187255859375,
-0.0184326171875,
0.25439453125,
0.6845703125,
0.1390380859375,
0.45556640625,
0.58935546875,
-0.6689453125,
0.9833984375,
0.56982421875,
-1.1962890625,
-0.3662109375,
0.309814453125,
-0.5,
0.576171875,
0.28564453125,
-0.71484375,
-1.0830078125,
-0.908203125,
-0.1683349609375,
-0.51611328125,
0.11688232421875,
-0.8916015625,
-0.099609375,
-0.50244140625,
0.83984375,
-0.1846923828125,
-0.44091796875,
0.18359375,
-1.0205078125,
-0.1480712890625,
-0.91357421875,
-0.297607421875,
-0.583984375,
-0.352294921875,
-0.2061767578125,
1.052734375,
-0.178466796875,
0.29638671875,
-0.1904296875,
-0.46533203125,
0.133544921875,
0.1326904296875,
-0.56201171875,
-0.33349609375,
0.26611328125,
0.18408203125,
-0.2083740234375,
-0.16259765625,
-0.44189453125,
0.88330078125,
-0.7177734375,
0.0726318359375,
-0.34912109375,
-0.4990234375,
-0.1776123046875,
-0.0413818359375,
1.1669921875,
-0.73681640625,
0.2022705078125,
-0.491943359375,
0.55322265625,
0.919921875,
-0.318115234375,
-0.31689453125,
-0.73095703125,
-0.72021484375,
-1.0400390625,
0.465576171875,
-0.1708984375,
0.283203125,
-0.65576171875,
-0.1710205078125,
1.080078125,
-0.43115234375,
0.2496337890625,
1.0732421875,
0.359375,
0.334228515625,
-0.697265625,
0.6064453125,
0.423828125,
-0.334228515625,
0.2412109375,
0.414306640625,
-0.80859375,
0.18896484375,
-0.37109375,
-1.052734375,
-0.7998046875,
0.5048828125,
1.3427734375,
-0.56201171875,
0.8876953125,
-0.050750732421875,
-1.1669921875,
-0.2171630859375,
0.7783203125,
0.047698974609375,
0.032867431640625,
1.087890625,
0.2427978515625,
0.0014591217041015625,
-0.1898193359375,
-0.158447265625,
-0.289794921875,
-0.30126953125,
0.84765625,
-0.5400390625,
-0.56298828125,
0.57568359375,
1.1875,
-0.6953125,
-0.7705078125,
0.007770538330078125,
0.096923828125,
0.186767578125,
-0.74609375,
0.046173095703125,
0.41748046875,
-0.4052734375,
0.20068359375,
0.580078125,
0.3466796875,
0.378662109375,
-0.0014390945434570312,
0.494873046875,
-0.264892578125,
0.477294921875,
0.485107421875,
-0.55517578125,
-0.36572265625,
-0.6728515625,
-0.1478271484375,
-0.2308349609375,
0.17041015625,
1.0556640625,
-0.11529541015625,
0.343017578125,
0.60693359375,
-0.206298828125,
0.8818359375,
-0.41845703125,
-0.458984375,
0.54345703125,
-0.6787109375,
-0.48291015625,
0.062744140625,
0.35546875,
-0.24072265625,
0.2027587890625,
-0.53466796875,
-0.1614990234375,
0.09625244140625,
0.3056640625,
-0.2158203125,
-0.64404296875,
-0.268798828125,
-0.75390625,
-0.456298828125,
-0.7060546875,
-0.58642578125,
-0.343505859375,
0.189453125,
0.1751708984375,
-0.6064453125,
-0.2156982421875,
0.794921875,
-1.1083984375,
0.91650390625,
-0.65283203125,
0.27783203125,
-0.5595703125,
-0.23388671875,
-0.505859375,
-0.049468994140625,
-0.634765625,
-0.0938720703125,
-0.426513671875,
0.2255859375,
-0.31591796875,
0.4150390625,
0.06201171875,
0.129150390625,
-0.1114501953125,
-0.62548828125,
-0.13916015625,
0.2059326171875,
-0.06964111328125,
0.455810546875,
0.68896484375,
-0.339599609375,
0.299072265625,
-0.313232421875,
-0.265380859375,
-0.591796875,
0.449462890625,
0.5595703125,
-0.1292724609375,
-0.25390625,
-0.08502197265625,
0.055450439453125,
-1.087890625,
0.338623046875,
-0.1187744140625,
0.468994140625,
0.61767578125,
-0.62890625,
0.533203125,
0.92041015625,
-0.263427734375,
0.360107421875,
0.386474609375,
0.487060546875,
0.1373291015625,
0.28515625,
-0.18310546875,
0.888671875,
0.396728515625,
-0.386962890625,
-0.06988525390625,
0.2303466796875,
-0.1502685546875,
0.54248046875,
-0.28271484375,
-0.65869140625,
-0.9697265625,
-0.272705078125,
0.043487548828125,
0.4931640625,
0.62939453125,
-0.61669921875,
-0.1407470703125,
0.09259033203125,
-0.328125,
0.1517333984375,
-1.083984375,
-1.115234375,
0.416748046875,
-0.1160888671875,
-0.5673828125,
-0.1942138671875,
-0.154296875,
-0.1441650390625,
0.340087890625,
0.2052001953125,
-0.6904296875,
0.53076171875,
-0.09967041015625,
0.744140625,
-0.408935546875,
0.0518798828125,
0.1806640625,
0.422607421875,
-0.318603515625,
-0.52099609375,
0.1800537109375,
1.2412109375,
0.115234375,
-0.11328125,
-0.5771484375,
0.492919921875,
0.2174072265625,
0.304931640625,
-0.611328125,
0.556640625,
-0.2115478515625,
0.56689453125,
-0.80859375,
-0.164306640625,
-0.175537109375,
0.4306640625,
0.1256103515625,
-0.353271484375,
-0.81689453125,
0.95458984375,
0.490234375,
0.00371551513671875,
0.71875,
0.27197265625,
0.452392578125,
0.08074951171875,
-0.061126708984375,
-0.28271484375,
0.6083984375,
0.58349609375,
0.57666015625,
0.0184173583984375,
0.1549072265625,
0.896484375,
-0.06842041015625,
-0.10968017578125,
0.427978515625,
0.45703125,
-0.2293701171875,
0.332275390625,
0.08673095703125,
-0.01425933837890625,
-0.0782470703125,
-0.52978515625,
0.72900390625,
-0.361328125,
0.2408447265625,
-0.50390625,
-0.94921875,
0.63037109375,
-0.250244140625,
-0.01018524169921875,
0.3017578125,
-0.1041259765625,
0.329833984375,
0.6162109375,
0.058837890625,
-0.032501220703125,
0.986328125,
0.64208984375,
0.7431640625,
0.496826171875,
0.51220703125,
0.449951171875,
-0.4619140625,
-0.05950927734375,
-0.11944580078125,
-0.0039520263671875,
-0.1529541015625,
-0.4482421875,
-0.9345703125,
0.5830078125,
-0.34912109375,
-0.1741943359375,
0.67822265625,
-0.58154296875,
0.27587890625,
-0.449462890625,
0.76220703125,
-0.521484375,
0.2308349609375,
0.470703125,
-0.578125,
-0.471435546875,
0.740234375,
-0.277099609375,
0.3115234375,
0.309814453125,
0.638671875,
0.06085205078125,
1.31640625,
0.548828125,
-0.295166015625,
-0.1497802734375,
-0.059326171875,
-0.23681640625,
-0.51025390625,
-0.2144775390625,
-0.50927734375,
0.0986328125,
-0.7685546875,
-0.497802734375,
0.0601806640625,
0.87353515625,
-0.08648681640625,
-1.025390625,
-0.380859375,
0.040618896484375,
-0.8251953125,
0.27001953125,
0.234130859375,
0.115478515625,
-0.28271484375,
0.236328125,
-0.083251953125,
-0.701171875,
0.36328125,
-0.58251953125,
0.564453125,
-0.66845703125,
-0.386962890625,
-0.6259765625,
-0.9560546875,
-0.471923828125,
-0.290771484375,
-0.424072265625,
-0.8408203125,
0.478759765625,
0.468994140625,
0.3837890625,
0.5185546875,
-0.41259765625,
0.2255859375,
0.81103515625,
1.2177734375,
0.1497802734375,
0.71875,
0.003612518310546875,
-0.209716796875,
0.07373046875,
-0.548828125,
0.474853515625,
-0.161376953125,
0.46337890625,
-0.564453125,
0.262451171875,
-0.45166015625,
-1.3037109375,
-0.09930419921875,
0.2469482421875,
0.54248046875,
-0.76953125,
-1.205078125,
-0.2822265625,
-1.1669921875,
-0.12335205078125,
-0.79833984375,
0.97607421875,
-0.23046875,
0.1898193359375,
-0.32421875,
-1.0595703125,
4.48046875,
1.0791015625,
0.90380859375,
0.35498046875,
0.7861328125,
1.1767578125,
0.411376953125,
-0.374755859375,
-0.398193359375,
-0.1475830078125,
0.2247314453125,
-0.65087890625,
0.11505126953125,
0.82177734375,
0.1298828125,
0.493408203125,
-0.51318359375,
0.12408447265625,
-0.342041015625,
-0.96630859375,
-1.1220703125,
0.32958984375,
0.08349609375,
0.27490234375,
0.06585693359375,
0.00873565673828125,
0.26318359375,
-0.51611328125,
-0.152587890625,
-0.7978515625,
0.2012939453125,
-0.379638671875,
0.900390625,
0.042724609375,
0.1561279296875,
0.65380859375,
-0.040924072265625,
-0.6171875,
-0.31787109375,
0.1109619140625,
-0.33837890625,
-0.0192413330078125,
0.66162109375,
-0.47412109375,
0.074951171875,
0.43017578125,
-0.68212890625,
0.5068359375,
-0.294921875,
-1.248046875,
0.94970703125,
-0.25146484375,
0.2445068359375,
-0.496337890625,
-0.7529296875,
0.3916015625,
0.336669921875,
-0.1837158203125,
-0.38671875,
0.5185546875,
0.296630859375,
0.266845703125,
0.09869384765625,
0.72216796875,
-1.2666015625,
0.6728515625,
-0.5419921875,
0.5126953125,
-0.78271484375,
-0.025604248046875,
-0.3291015625,
0.042633056640625,
-0.47900390625,
-0.50732421875,
0.2294921875,
0.0709228515625,
-0.30859375,
0.68408203125,
0.61474609375,
-0.65087890625,
0.2919921875,
-0.1484375,
-0.38525390625,
-0.458251953125,
0.56787109375,
1.3154296875,
-0.54833984375,
-0.150146484375,
-0.211181640625,
0.74072265625,
0.421630859375,
0.46435546875,
-0.289306640625,
-0.484375,
-0.2393798828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
Vasya has come up with an algorithm he will follow while writing a letter. First he chooses two strings, s1 anf s2, consisting of uppercase English letters. Then the boy makes string sk, using a recurrent equation sn = sn - 2 + sn - 1, operation '+' means a concatenation (that is, the sequential record) of strings in the given order. Then Vasya writes down string sk on a piece of paper, puts it in the envelope and sends in to Santa.
Vasya is absolutely sure that Santa will bring him the best present if the resulting string sk has exactly x occurrences of substring AC (the short-cut reminds him ΠΎf accepted problems). Besides, Vasya decided that string s1 should have length n, and string s2 should have length m. Vasya hasn't decided anything else.
At the moment Vasya's got urgent New Year business, so he asks you to choose two strings for him, s1 and s2 in the required manner. Help Vasya.
Input
The first line contains four integers k, x, n, m (3 β€ k β€ 50; 0 β€ x β€ 109; 1 β€ n, m β€ 100).
Output
In the first line print string s1, consisting of n uppercase English letters. In the second line print string s2, consisting of m uppercase English letters. If there are multiple valid strings, print any of them.
If the required pair of strings doesn't exist, print "Happy new year!" without the quotes.
Examples
Input
3 2 2 2
Output
AC
AC
Input
3 3 2 2
Output
Happy new year!
Input
3 0 2 2
Output
AA
AA
Input
4 3 2 1
Output
Happy new year!
Input
4 2 2 1
Output
Happy new year!
Tags: bitmasks, brute force, dp
Correct Solution:
```
k,x,n,m=map(int,input().split())
def calc(k,a,b,op1,ed1,op2,ed2):
if k==2:
return b
return calc(k-1,b,a+b+(ed1&op2),op2,ed2,op1,ed2)
def make(len,a,op,ed):
res,i="",0
if op:
res+="C"
i+=1
if ed:
len-=1
while a:
res+="AC"
a-=1
i+=2
while i<len:
res+="P"
i+=1
if ed:
res+="A"
return res
def check(a,b,op1,ed1,op2,ed2):
if (2*a+op1+ed1>n) or (2*b+op2+ed2>m):
return 0
if calc(k,a,b,op1,ed1,op2,ed2) == x:
print(make(n,a,op1,ed1))
print(make(m,b,op2,ed2))
return 1
flag=0
for i in range(0,(n>>1)+1):
for j in range(0,(m>>1)+1):
for l in range(0,16):
if check(i,j,l&1,(l>>1)&1,(l>>2)&1,(l>>3)&1):
flag=1
break
if flag:
break
if flag:
break
if not flag:
print("Happy new year!")
```
| 38,008
|
[
0.2939453125,
-0.039642333984375,
0.282958984375,
0.1822509765625,
-0.54248046875,
-0.75439453125,
0.14599609375,
0.1453857421875,
-0.086669921875,
0.84033203125,
0.69873046875,
-0.09136962890625,
0.044708251953125,
-0.59326171875,
-0.55029296875,
0.1434326171875,
-0.51171875,
-0.72265625,
-0.2449951171875,
0.1529541015625,
0.07733154296875,
-0.049468994140625,
-1.5546875,
-0.385986328125,
-0.474853515625,
0.779296875,
0.1634521484375,
0.071533203125,
1.0791015625,
1.0751953125,
0.089111328125,
-0.57080078125,
0.3251953125,
-1.3779296875,
-0.1734619140625,
-0.501953125,
0.77685546875,
-0.73583984375,
-0.050689697265625,
-0.1488037109375,
0.2308349609375,
-0.300048828125,
0.88134765625,
-0.64794921875,
-1.1494140625,
-0.2442626953125,
-0.1881103515625,
-0.06561279296875,
-0.2462158203125,
-0.5361328125,
0.364013671875,
-0.470947265625,
0.52783203125,
-0.4482421875,
0.354248046875,
0.2257080078125,
0.0111083984375,
-0.04425048828125,
-0.72265625,
0.08697509765625,
0.2408447265625,
0.150146484375,
0.2264404296875,
-0.529296875,
-0.0259857177734375,
0.11517333984375,
0.06414794921875,
-0.1959228515625,
-0.1451416015625,
-0.51025390625,
-0.313232421875,
0.269287109375,
-0.86083984375,
-0.2314453125,
-0.323486328125,
0.006641387939453125,
0.10699462890625,
-0.041778564453125,
-0.5615234375,
0.78759765625,
0.076904296875,
0.80322265625,
0.1756591796875,
0.358642578125,
-0.404296875,
-0.7822265625,
0.35302734375,
0.1767578125,
0.384521484375,
0.1158447265625,
-0.1861572265625,
0.3251953125,
-0.6962890625,
0.275390625,
0.61181640625,
0.732421875,
-0.1160888671875,
0.32373046875,
0.136474609375,
0.35400390625,
0.7607421875,
0.81884765625,
-0.282470703125,
0.93017578125,
-0.66650390625,
0.2078857421875,
0.408203125,
-0.11968994140625,
-0.1484375,
-0.09881591796875,
-0.4091796875,
-0.2900390625,
0.64404296875,
0.1947021484375,
-0.427978515625,
0.9482421875,
0.2269287109375,
0.6943359375,
-0.6875,
0.1822509765625,
0.75244140625,
0.26416015625,
0.703125,
-0.303955078125,
-0.316162109375,
-0.244873046875,
-0.26025390625,
1.0537109375,
-0.53369140625,
0.035980224609375,
0.5439453125,
0.0162200927734375,
-0.184326171875,
0.283447265625,
-0.208251953125,
0.447509765625,
-0.147216796875,
0.53466796875,
0.80078125,
-0.6953125,
0.2421875,
-0.20751953125,
0.061065673828125,
1.3232421875,
0.0709228515625,
-0.04217529296875,
0.67578125,
0.47265625,
-1.1015625,
0.199951171875,
-0.484375,
0.501953125,
0.1900634765625,
0.32861328125,
-0.16162109375,
0.2099609375,
-0.1365966796875,
-0.0018157958984375,
0.1971435546875,
-0.0992431640625,
-0.18896484375,
0.355224609375,
-0.37646484375,
0.97998046875,
-0.2252197265625,
0.56103515625,
-0.4375,
-0.18701171875,
-0.52392578125,
-0.59033203125,
0.1064453125,
-0.33203125,
-0.441162109375,
0.61669921875,
0.485107421875,
0.75341796875,
1.1484375,
-0.260009765625,
0.32177734375,
-0.0306243896484375,
-0.3017578125,
0.37158203125,
0.68994140625,
0.78662109375,
0.317138671875,
0.324462890625,
-0.111083984375,
-0.33056640625,
-0.5986328125,
-0.78125,
0.001483917236328125,
0.456298828125,
-0.458740234375,
0.46337890625,
0.07928466796875,
0.1988525390625,
-0.8125,
-0.34716796875,
-0.26416015625,
-0.8662109375,
-0.46142578125,
0.414306640625,
-0.345458984375,
0.54150390625,
-0.7314453125,
-0.67138671875,
0.425048828125,
1.1142578125,
-0.2020263671875,
0.051025390625,
0.474365234375,
0.1256103515625,
-0.288818359375,
0.32958984375,
0.310791015625,
-0.048248291015625,
-0.7138671875,
0.6162109375,
-0.0850830078125,
-0.0303955078125,
0.01398468017578125,
0.587890625,
0.486572265625,
0.3779296875,
-0.326416015625,
-0.2197265625,
0.63671875,
0.77978515625,
-0.08648681640625,
0.59814453125,
0.048095703125,
0.82177734375,
0.4658203125,
0.81884765625,
0.828125,
0.15087890625,
0.56884765625,
0.48193359375,
0.10174560546875,
0.3076171875,
0.1519775390625,
0.07537841796875,
0.08349609375,
0.32958984375,
0.1226806640625,
0.587890625,
-0.2218017578125,
0.1256103515625,
-0.1573486328125,
0.1383056640625,
-0.327392578125,
0.51123046875,
0.359130859375,
0.54248046875,
-0.4521484375,
-0.1966552734375,
0.26904296875,
0.93798828125,
-0.50341796875,
-0.4287109375,
-0.5146484375,
0.12646484375,
0.0282745361328125,
0.07769775390625,
0.08416748046875,
0.166015625,
0.5322265625,
0.57275390625,
-0.4423828125,
-0.57470703125,
-0.94970703125,
-0.95703125,
-0.79248046875,
-0.52880859375,
-0.52197265625,
-0.05767822265625,
0.7421875,
-0.9853515625,
0.1346435546875,
-0.194580078125,
-0.07342529296875,
0.2257080078125,
-0.484130859375,
0.314697265625,
-0.20751953125,
0.407470703125,
-0.63916015625,
0.486328125,
0.12890625,
1.056640625,
-0.69140625,
0.07391357421875,
-0.0061798095703125,
-0.194091796875,
0.27294921875,
-0.1689453125,
0.21630859375,
-0.29833984375,
-0.4794921875,
-0.79296875,
-0.62060546875,
-0.12066650390625,
0.03192138671875,
0.165283203125,
-0.421142578125,
0.4169921875,
0.491455078125,
-0.97216796875,
0.5068359375,
0.74609375,
-0.7890625,
0.186767578125,
0.44970703125,
-0.198486328125,
-0.82177734375,
1.1669921875,
0.407470703125,
0.548828125,
-0.56494140625,
-0.4169921875,
-0.1676025390625,
0.15966796875,
0.012420654296875,
-0.26708984375,
-0.513671875,
0.57861328125,
-0.1624755859375,
-0.9208984375,
0.378662109375,
-0.92431640625,
-0.72021484375,
-0.433349609375,
-0.48828125,
0.76220703125,
0.8095703125,
0.28076171875,
-0.2052001953125,
0.038330078125,
-0.09771728515625,
0.59521484375,
0.38818359375,
-0.6220703125,
0.0609130859375,
0.62255859375,
-0.25341796875,
-0.0445556640625,
0.429443359375,
-0.32568359375,
-0.41845703125,
0.10198974609375,
0.2783203125,
0.279541015625,
0.349853515625,
-0.10711669921875,
0.55517578125,
0.7421875,
-0.7314453125,
-0.2344970703125,
-0.0001971721649169922,
0.6123046875,
0.320556640625,
0.64208984375,
0.326904296875,
-0.488037109375,
-0.541015625,
-1.2373046875,
0.56201171875,
0.09100341796875,
0.58544921875,
-0.98291015625,
0.66748046875,
0.1265869140625,
-0.857421875,
0.33935546875,
-0.66650390625,
-0.238525390625,
0.7685546875,
-0.342529296875,
0.50830078125,
-0.67236328125,
0.1741943359375,
-0.472900390625,
-0.053375244140625,
0.5419921875,
0.273681640625,
0.5556640625,
-0.329833984375,
-0.305419921875,
-0.373046875,
-0.17724609375,
-0.0516357421875,
-0.4716796875,
0.262451171875,
-0.29296875,
-0.221435546875,
-0.9287109375,
0.61572265625,
0.423583984375,
0.5556640625,
0.09698486328125,
0.47900390625,
0.07769775390625,
0.76025390625,
0.404052734375,
-0.16796875,
0.1607666015625,
-0.78857421875,
0.935546875,
0.249267578125,
-0.342041015625,
-0.53076171875,
-0.261474609375,
-0.15625,
0.176025390625,
0.0099029541015625,
-0.27978515625,
-0.9736328125,
0.002246856689453125,
-0.0625,
0.59716796875,
-0.3642578125,
-0.219970703125,
-0.41162109375,
0.268310546875,
0.119873046875,
-1.1826171875,
0.293701171875,
-0.77685546875,
0.7373046875,
0.154296875,
0.0660400390625,
-0.544921875,
-0.2144775390625,
-0.76806640625,
-0.5654296875,
-0.292236328125,
0.962890625,
0.0102081298828125,
0.31201171875,
-1.37890625,
0.22607421875,
0.4140625,
0.01126861572265625,
0.285888671875,
0.3994140625,
0.456298828125,
0.172607421875,
0.62548828125,
-0.1571044921875,
-0.61962890625,
0.337158203125,
-1.3564453125,
0.3740234375,
-0.4619140625,
0.39501953125,
-0.09320068359375,
-0.0202178955078125,
-0.18408203125,
0.484130859375,
-0.2900390625,
0.398193359375,
-0.2020263671875,
0.317626953125,
-0.9794921875,
-0.798828125,
0.5,
-0.149658203125,
-0.5029296875,
0.81103515625,
-0.0777587890625,
-0.416259765625,
-0.1185302734375,
0.662109375,
-0.301513671875,
0.06097412109375,
-0.412109375,
0.49609375,
-0.233642578125,
-0.65673828125,
-0.346435546875,
-0.96923828125,
0.77294921875,
-0.1051025390625,
-0.791015625,
-0.1539306640625,
-1.150390625,
-0.028900146484375,
0.281982421875,
-0.5693359375,
0.55078125,
0.116943359375,
0.057220458984375,
-0.3212890625,
-0.16552734375,
-0.57666015625,
0.04168701171875,
-1.0078125,
-0.4072265625,
0.3515625,
0.595703125,
0.845703125,
-0.13427734375,
-0.69482421875,
0.28125,
0.427490234375,
-0.1763916015625,
-0.52978515625,
0.01433563232421875,
-0.248291015625,
-0.455810546875,
-0.1895751953125,
0.2099609375,
0.030303955078125,
0.267578125,
0.65478515625,
0.1485595703125,
0.42431640625,
0.6220703125,
-0.66064453125,
0.9384765625,
0.57763671875,
-1.2177734375,
-0.383056640625,
0.31689453125,
-0.53369140625,
0.5029296875,
0.2919921875,
-0.720703125,
-1.072265625,
-0.93701171875,
-0.1824951171875,
-0.46337890625,
0.12017822265625,
-0.90673828125,
-0.06988525390625,
-0.46875,
0.79931640625,
-0.2310791015625,
-0.46630859375,
0.17919921875,
-1.0498046875,
-0.08306884765625,
-0.86328125,
-0.329345703125,
-0.56591796875,
-0.32080078125,
-0.1177978515625,
1.01171875,
-0.15625,
0.30029296875,
-0.229736328125,
-0.515625,
0.154296875,
0.1090087890625,
-0.58740234375,
-0.377685546875,
0.288330078125,
0.10968017578125,
-0.16845703125,
-0.1466064453125,
-0.37353515625,
0.896484375,
-0.7138671875,
0.057037353515625,
-0.30322265625,
-0.5361328125,
-0.1807861328125,
-0.037109375,
1.1337890625,
-0.703125,
0.1400146484375,
-0.490234375,
0.58056640625,
0.9453125,
-0.341064453125,
-0.31494140625,
-0.72216796875,
-0.69189453125,
-1.0263671875,
0.42236328125,
-0.1929931640625,
0.243896484375,
-0.63525390625,
-0.15673828125,
1.099609375,
-0.370849609375,
0.2440185546875,
1.0634765625,
0.406494140625,
0.38720703125,
-0.7080078125,
0.576171875,
0.385498046875,
-0.344970703125,
0.1986083984375,
0.35009765625,
-0.8037109375,
0.2449951171875,
-0.33251953125,
-1.0048828125,
-0.76806640625,
0.53125,
1.3544921875,
-0.5478515625,
0.859375,
-0.027679443359375,
-1.16015625,
-0.243896484375,
0.70166015625,
0.04901123046875,
0.0215301513671875,
1.099609375,
0.250244140625,
0.0250701904296875,
-0.271728515625,
-0.1375732421875,
-0.27001953125,
-0.29345703125,
0.7705078125,
-0.489013671875,
-0.59326171875,
0.587890625,
1.1865234375,
-0.6337890625,
-0.76904296875,
0.061737060546875,
0.08148193359375,
0.1610107421875,
-0.70947265625,
0.07147216796875,
0.466796875,
-0.403076171875,
0.2366943359375,
0.5546875,
0.2705078125,
0.406005859375,
-0.00713348388671875,
0.50634765625,
-0.2186279296875,
0.485107421875,
0.46875,
-0.5859375,
-0.334716796875,
-0.69677734375,
-0.18359375,
-0.2135009765625,
0.1270751953125,
1.03125,
-0.1143798828125,
0.299072265625,
0.60791015625,
-0.204345703125,
0.9228515625,
-0.43896484375,
-0.46484375,
0.5068359375,
-0.63916015625,
-0.443603515625,
0.063720703125,
0.33642578125,
-0.2137451171875,
0.173095703125,
-0.482421875,
-0.1962890625,
0.08251953125,
0.294189453125,
-0.19677734375,
-0.65087890625,
-0.302734375,
-0.671875,
-0.432373046875,
-0.6240234375,
-0.56640625,
-0.29296875,
0.1669921875,
0.1590576171875,
-0.568359375,
-0.2119140625,
0.77978515625,
-1.12890625,
0.8671875,
-0.6357421875,
0.348388671875,
-0.583984375,
-0.2193603515625,
-0.5185546875,
-0.0953369140625,
-0.625,
-0.07208251953125,
-0.4306640625,
0.191650390625,
-0.2861328125,
0.377197265625,
0.042205810546875,
0.129638671875,
-0.095458984375,
-0.66748046875,
-0.10565185546875,
0.2364501953125,
-0.061614990234375,
0.456298828125,
0.669921875,
-0.332763671875,
0.2327880859375,
-0.330322265625,
-0.28173828125,
-0.55712890625,
0.51513671875,
0.58203125,
-0.07330322265625,
-0.1907958984375,
-0.07342529296875,
0.05450439453125,
-1.0390625,
0.28271484375,
-0.1083984375,
0.487060546875,
0.61083984375,
-0.59326171875,
0.51708984375,
0.86083984375,
-0.30908203125,
0.397705078125,
0.34326171875,
0.46240234375,
0.10595703125,
0.294677734375,
-0.1763916015625,
0.87744140625,
0.38232421875,
-0.3916015625,
-0.058074951171875,
0.2442626953125,
-0.11163330078125,
0.5439453125,
-0.241943359375,
-0.63427734375,
-0.9677734375,
-0.269287109375,
0.036376953125,
0.4892578125,
0.61083984375,
-0.5849609375,
-0.08514404296875,
0.11651611328125,
-0.339599609375,
0.167236328125,
-1.0283203125,
-1.1064453125,
0.38427734375,
-0.10723876953125,
-0.55517578125,
-0.1856689453125,
-0.232421875,
-0.150634765625,
0.36962890625,
0.234375,
-0.69482421875,
0.53564453125,
-0.12060546875,
0.70947265625,
-0.46337890625,
-0.00554656982421875,
0.16748046875,
0.390869140625,
-0.334716796875,
-0.5029296875,
0.2191162109375,
1.2197265625,
0.1641845703125,
-0.07037353515625,
-0.56396484375,
0.483154296875,
0.2078857421875,
0.2939453125,
-0.59033203125,
0.5849609375,
-0.259033203125,
0.5244140625,
-0.79638671875,
-0.1961669921875,
-0.1793212890625,
0.4150390625,
0.141845703125,
-0.318115234375,
-0.82373046875,
0.9248046875,
0.450927734375,
0.011932373046875,
0.67041015625,
0.308837890625,
0.4814453125,
0.033782958984375,
-0.1365966796875,
-0.284423828125,
0.6103515625,
0.56982421875,
0.55224609375,
0.0013751983642578125,
0.1356201171875,
0.8798828125,
-0.06903076171875,
-0.1265869140625,
0.40966796875,
0.455810546875,
-0.2025146484375,
0.346923828125,
0.150634765625,
-0.031890869140625,
-0.0693359375,
-0.58935546875,
0.73046875,
-0.353759765625,
0.2196044921875,
-0.457763671875,
-0.89404296875,
0.63916015625,
-0.271240234375,
0.031463623046875,
0.28515625,
-0.12042236328125,
0.3115234375,
0.60791015625,
0.12188720703125,
-0.03607177734375,
0.994140625,
0.64013671875,
0.77685546875,
0.54638671875,
0.51171875,
0.455322265625,
-0.43310546875,
-0.032684326171875,
-0.17431640625,
0.02685546875,
-0.15283203125,
-0.4580078125,
-0.9248046875,
0.5771484375,
-0.364501953125,
-0.1693115234375,
0.6630859375,
-0.56298828125,
0.253662109375,
-0.41845703125,
0.74365234375,
-0.5107421875,
0.2110595703125,
0.472412109375,
-0.64306640625,
-0.492919921875,
0.68798828125,
-0.233154296875,
0.287109375,
0.340576171875,
0.6337890625,
0.0105133056640625,
1.28125,
0.5087890625,
-0.30615234375,
-0.1849365234375,
-0.08526611328125,
-0.207763671875,
-0.475341796875,
-0.189697265625,
-0.515625,
0.112060546875,
-0.73046875,
-0.464111328125,
-0.01409912109375,
0.83203125,
-0.10760498046875,
-1.0615234375,
-0.417236328125,
0.034027099609375,
-0.78857421875,
0.24609375,
0.277587890625,
0.14990234375,
-0.28173828125,
0.233154296875,
-0.09814453125,
-0.7099609375,
0.346923828125,
-0.63330078125,
0.52587890625,
-0.61767578125,
-0.355712890625,
-0.595703125,
-0.94140625,
-0.413330078125,
-0.26220703125,
-0.422607421875,
-0.7978515625,
0.434814453125,
0.47265625,
0.4248046875,
0.55322265625,
-0.400634765625,
0.192138671875,
0.814453125,
1.1767578125,
0.1402587890625,
0.69873046875,
0.00901031494140625,
-0.252685546875,
0.0740966796875,
-0.56103515625,
0.5283203125,
-0.12286376953125,
0.450927734375,
-0.572265625,
0.26611328125,
-0.471435546875,
-1.2822265625,
-0.11004638671875,
0.232421875,
0.5244140625,
-0.7783203125,
-1.140625,
-0.257568359375,
-1.1337890625,
-0.1456298828125,
-0.81494140625,
0.9365234375,
-0.2227783203125,
0.1689453125,
-0.346435546875,
-1.05859375,
4.54296875,
1.0458984375,
0.89599609375,
0.380859375,
0.78857421875,
1.1650390625,
0.38818359375,
-0.390869140625,
-0.41796875,
-0.149169921875,
0.240966796875,
-0.62060546875,
0.1341552734375,
0.81298828125,
0.1397705078125,
0.464111328125,
-0.5185546875,
0.1544189453125,
-0.321044921875,
-0.89404296875,
-1.1416015625,
0.38623046875,
0.07330322265625,
0.294921875,
0.05194091796875,
0.047637939453125,
0.234130859375,
-0.4521484375,
-0.1944580078125,
-0.8388671875,
0.2164306640625,
-0.380859375,
0.87890625,
0.02655029296875,
0.2049560546875,
0.61962890625,
-0.03179931640625,
-0.61669921875,
-0.353271484375,
0.1209716796875,
-0.2880859375,
-0.0611572265625,
0.67236328125,
-0.471435546875,
0.111572265625,
0.378173828125,
-0.68603515625,
0.55029296875,
-0.346435546875,
-1.2060546875,
0.9228515625,
-0.2330322265625,
0.22119140625,
-0.58056640625,
-0.744140625,
0.366943359375,
0.29931640625,
-0.20263671875,
-0.370361328125,
0.48779296875,
0.335693359375,
0.242431640625,
0.093017578125,
0.70556640625,
-1.294921875,
0.66796875,
-0.50634765625,
0.5009765625,
-0.79296875,
-0.036468505859375,
-0.299072265625,
0.10626220703125,
-0.482421875,
-0.50732421875,
0.189208984375,
0.03369140625,
-0.33935546875,
0.658203125,
0.6123046875,
-0.66455078125,
0.289794921875,
-0.11065673828125,
-0.410400390625,
-0.42529296875,
0.533203125,
1.3037109375,
-0.5126953125,
-0.1671142578125,
-0.25390625,
0.69873046875,
0.4580078125,
0.42578125,
-0.2357177734375,
-0.48193359375,
-0.22021484375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
Vasya has come up with an algorithm he will follow while writing a letter. First he chooses two strings, s1 anf s2, consisting of uppercase English letters. Then the boy makes string sk, using a recurrent equation sn = sn - 2 + sn - 1, operation '+' means a concatenation (that is, the sequential record) of strings in the given order. Then Vasya writes down string sk on a piece of paper, puts it in the envelope and sends in to Santa.
Vasya is absolutely sure that Santa will bring him the best present if the resulting string sk has exactly x occurrences of substring AC (the short-cut reminds him ΠΎf accepted problems). Besides, Vasya decided that string s1 should have length n, and string s2 should have length m. Vasya hasn't decided anything else.
At the moment Vasya's got urgent New Year business, so he asks you to choose two strings for him, s1 and s2 in the required manner. Help Vasya.
Input
The first line contains four integers k, x, n, m (3 β€ k β€ 50; 0 β€ x β€ 109; 1 β€ n, m β€ 100).
Output
In the first line print string s1, consisting of n uppercase English letters. In the second line print string s2, consisting of m uppercase English letters. If there are multiple valid strings, print any of them.
If the required pair of strings doesn't exist, print "Happy new year!" without the quotes.
Examples
Input
3 2 2 2
Output
AC
AC
Input
3 3 2 2
Output
Happy new year!
Input
3 0 2 2
Output
AA
AA
Input
4 3 2 1
Output
Happy new year!
Input
4 2 2 1
Output
Happy new year!
Tags: bitmasks, brute force, dp
Correct Solution:
```
def F(a, b, c, d, e, f, k):
for _ in range(k - 2):
a, b, c, d, e, f = d, e, f, a, b + e + (c and d), f
return e
k, x, n, m = map(int, input().split())
for a in [True, False]:
for c in [True, False]:
for b in range((n - a - c) // 2 + 1):
for d in [True, False]:
for f in [True, False]:
for e in range((m - d - f) // 2 + 1):
if F(a, b, c, d, e, f, k) == x:
print(['', 'C'][a] + 'AC' * b + 'Z' * (n - a - b - b - c) + ['', 'A'][c])
print(['', 'C'][d] + 'AC' * e + 'Z' * (m - d - e - e - f) + ['', 'A'][f])
exit()
print('Happy new year!')
```
| 38,009
|
[
0.303466796875,
-0.0521240234375,
0.2841796875,
0.210693359375,
-0.54736328125,
-0.76171875,
0.1473388671875,
0.1378173828125,
-0.11151123046875,
0.82958984375,
0.68896484375,
-0.1080322265625,
0.043304443359375,
-0.61279296875,
-0.56396484375,
0.1292724609375,
-0.5126953125,
-0.72509765625,
-0.241455078125,
0.1453857421875,
0.0799560546875,
-0.0386962890625,
-1.5576171875,
-0.3896484375,
-0.46533203125,
0.77490234375,
0.185791015625,
0.07672119140625,
1.064453125,
1.0927734375,
0.109375,
-0.56005859375,
0.335693359375,
-1.375,
-0.179931640625,
-0.51513671875,
0.78271484375,
-0.74072265625,
-0.031524658203125,
-0.1676025390625,
0.2548828125,
-0.322021484375,
0.86962890625,
-0.63916015625,
-1.1630859375,
-0.263671875,
-0.1761474609375,
-0.05853271484375,
-0.2352294921875,
-0.52978515625,
0.36669921875,
-0.47216796875,
0.52197265625,
-0.4482421875,
0.34326171875,
0.2261962890625,
0.0201416015625,
-0.04168701171875,
-0.72265625,
0.0859375,
0.221435546875,
0.152099609375,
0.2296142578125,
-0.53515625,
-0.0121612548828125,
0.1385498046875,
0.0648193359375,
-0.1888427734375,
-0.156494140625,
-0.494384765625,
-0.3310546875,
0.254150390625,
-0.85009765625,
-0.2381591796875,
-0.32666015625,
0.00047516822814941406,
0.11328125,
-0.0233154296875,
-0.5703125,
0.8046875,
0.0755615234375,
0.8095703125,
0.1900634765625,
0.36474609375,
-0.3837890625,
-0.77685546875,
0.383544921875,
0.183349609375,
0.373779296875,
0.10565185546875,
-0.180419921875,
0.29541015625,
-0.70751953125,
0.2607421875,
0.61376953125,
0.7578125,
-0.10552978515625,
0.334228515625,
0.140869140625,
0.341064453125,
0.7490234375,
0.83349609375,
-0.316650390625,
0.93017578125,
-0.642578125,
0.230224609375,
0.41162109375,
-0.120849609375,
-0.1846923828125,
-0.07720947265625,
-0.4248046875,
-0.2822265625,
0.64208984375,
0.1939697265625,
-0.429443359375,
0.93505859375,
0.2103271484375,
0.69970703125,
-0.6865234375,
0.177490234375,
0.71875,
0.25732421875,
0.72021484375,
-0.297607421875,
-0.308837890625,
-0.248779296875,
-0.2705078125,
1.048828125,
-0.525390625,
0.0095977783203125,
0.54150390625,
0.0311279296875,
-0.1805419921875,
0.2666015625,
-0.2318115234375,
0.450927734375,
-0.132568359375,
0.5341796875,
0.810546875,
-0.69140625,
0.259033203125,
-0.2305908203125,
0.0753173828125,
1.3310546875,
0.06024169921875,
-0.03839111328125,
0.6630859375,
0.5,
-1.1171875,
0.210693359375,
-0.470458984375,
0.46533203125,
0.18017578125,
0.33447265625,
-0.1605224609375,
0.237548828125,
-0.1295166015625,
0.0005459785461425781,
0.2030029296875,
-0.09210205078125,
-0.193359375,
0.3466796875,
-0.392578125,
0.9599609375,
-0.2164306640625,
0.54931640625,
-0.416259765625,
-0.209716796875,
-0.54638671875,
-0.5771484375,
0.06744384765625,
-0.322998046875,
-0.439453125,
0.61083984375,
0.493896484375,
0.7294921875,
1.1259765625,
-0.2529296875,
0.31640625,
-0.024688720703125,
-0.287353515625,
0.371337890625,
0.67138671875,
0.7900390625,
0.29345703125,
0.315185546875,
-0.1275634765625,
-0.34033203125,
-0.591796875,
-0.7724609375,
-0.0008587837219238281,
0.468017578125,
-0.4560546875,
0.474853515625,
0.082763671875,
0.2144775390625,
-0.8369140625,
-0.3486328125,
-0.24853515625,
-0.8515625,
-0.478271484375,
0.41796875,
-0.31982421875,
0.515625,
-0.7119140625,
-0.68115234375,
0.41943359375,
1.1103515625,
-0.183837890625,
0.0699462890625,
0.46435546875,
0.09735107421875,
-0.273193359375,
0.337890625,
0.315185546875,
-0.0518798828125,
-0.7333984375,
0.62060546875,
-0.07122802734375,
-0.0059051513671875,
0.016876220703125,
0.58349609375,
0.47607421875,
0.40087890625,
-0.322021484375,
-0.226806640625,
0.654296875,
0.7587890625,
-0.0654296875,
0.591796875,
0.06182861328125,
0.826171875,
0.460693359375,
0.82763671875,
0.84521484375,
0.1351318359375,
0.58984375,
0.48046875,
0.11065673828125,
0.3203125,
0.1268310546875,
0.0684814453125,
0.093017578125,
0.35107421875,
0.1256103515625,
0.59765625,
-0.227783203125,
0.11358642578125,
-0.1826171875,
0.130615234375,
-0.3427734375,
0.50634765625,
0.355224609375,
0.54296875,
-0.453369140625,
-0.19873046875,
0.296875,
0.92138671875,
-0.50439453125,
-0.44677734375,
-0.5048828125,
0.11627197265625,
0.0185394287109375,
0.0950927734375,
0.0828857421875,
0.1785888671875,
0.5048828125,
0.59375,
-0.416748046875,
-0.57861328125,
-0.94189453125,
-0.95947265625,
-0.82177734375,
-0.51904296875,
-0.5166015625,
-0.05859375,
0.7041015625,
-0.98388671875,
0.16943359375,
-0.1641845703125,
-0.069580078125,
0.2445068359375,
-0.51220703125,
0.306640625,
-0.2149658203125,
0.380859375,
-0.64892578125,
0.50341796875,
0.11309814453125,
1.0458984375,
-0.69482421875,
0.08148193359375,
-0.0229644775390625,
-0.2232666015625,
0.267333984375,
-0.180419921875,
0.217041015625,
-0.297607421875,
-0.464111328125,
-0.7958984375,
-0.63623046875,
-0.11822509765625,
0.0217437744140625,
0.15185546875,
-0.435791015625,
0.433837890625,
0.487060546875,
-0.984375,
0.51220703125,
0.75341796875,
-0.78564453125,
0.204833984375,
0.472412109375,
-0.1575927734375,
-0.8076171875,
1.1904296875,
0.41748046875,
0.53857421875,
-0.5556640625,
-0.41455078125,
-0.1595458984375,
0.1724853515625,
-0.006557464599609375,
-0.264404296875,
-0.51708984375,
0.57177734375,
-0.164794921875,
-0.916015625,
0.385009765625,
-0.921875,
-0.74658203125,
-0.429443359375,
-0.4892578125,
0.775390625,
0.8115234375,
0.2861328125,
-0.207275390625,
0.0355224609375,
-0.0924072265625,
0.61181640625,
0.384521484375,
-0.62109375,
0.0721435546875,
0.6259765625,
-0.240478515625,
-0.021148681640625,
0.43310546875,
-0.334716796875,
-0.429443359375,
0.07843017578125,
0.298583984375,
0.30419921875,
0.35546875,
-0.1177978515625,
0.521484375,
0.76171875,
-0.73681640625,
-0.2337646484375,
-0.01224517822265625,
0.6357421875,
0.283447265625,
0.65771484375,
0.327880859375,
-0.496337890625,
-0.5361328125,
-1.25,
0.55859375,
0.057281494140625,
0.58984375,
-0.9794921875,
0.6845703125,
0.10906982421875,
-0.85546875,
0.330322265625,
-0.66162109375,
-0.1954345703125,
0.7705078125,
-0.35107421875,
0.52001953125,
-0.68212890625,
0.17919921875,
-0.458251953125,
-0.0927734375,
0.54931640625,
0.2783203125,
0.55224609375,
-0.3076171875,
-0.280029296875,
-0.3916015625,
-0.1754150390625,
-0.0501708984375,
-0.46435546875,
0.243408203125,
-0.3115234375,
-0.2314453125,
-0.93408203125,
0.62158203125,
0.439697265625,
0.55029296875,
0.092529296875,
0.48974609375,
0.04913330078125,
0.759765625,
0.408203125,
-0.146484375,
0.1422119140625,
-0.8046875,
0.95458984375,
0.248291015625,
-0.34228515625,
-0.50634765625,
-0.24267578125,
-0.176025390625,
0.1861572265625,
0.0009126663208007812,
-0.259033203125,
-0.970703125,
0.009002685546875,
-0.0504150390625,
0.57861328125,
-0.376220703125,
-0.207763671875,
-0.414306640625,
0.296875,
0.12091064453125,
-1.1884765625,
0.276611328125,
-0.75732421875,
0.7314453125,
0.15576171875,
0.0880126953125,
-0.5439453125,
-0.2113037109375,
-0.794921875,
-0.57470703125,
-0.2890625,
0.95556640625,
0.00897216796875,
0.328125,
-1.3818359375,
0.2247314453125,
0.414794921875,
0.007663726806640625,
0.274658203125,
0.3896484375,
0.4501953125,
0.1558837890625,
0.6357421875,
-0.138916015625,
-0.619140625,
0.31689453125,
-1.3662109375,
0.36865234375,
-0.46875,
0.3701171875,
-0.10052490234375,
-0.024871826171875,
-0.2188720703125,
0.486328125,
-0.31787109375,
0.37890625,
-0.1884765625,
0.332763671875,
-0.98388671875,
-0.7900390625,
0.490966796875,
-0.1578369140625,
-0.50048828125,
0.7861328125,
-0.06756591796875,
-0.416015625,
-0.129638671875,
0.65283203125,
-0.314453125,
0.0736083984375,
-0.419677734375,
0.493896484375,
-0.24755859375,
-0.6552734375,
-0.36767578125,
-0.9736328125,
0.763671875,
-0.1043701171875,
-0.78271484375,
-0.1572265625,
-1.1416015625,
-0.0357666015625,
0.292724609375,
-0.568359375,
0.572265625,
0.09326171875,
0.06500244140625,
-0.305419921875,
-0.1624755859375,
-0.5849609375,
0.0418701171875,
-0.9951171875,
-0.431396484375,
0.351318359375,
0.6044921875,
0.828125,
-0.13623046875,
-0.65185546875,
0.288818359375,
0.431640625,
-0.1849365234375,
-0.5361328125,
0.0277252197265625,
-0.234130859375,
-0.4794921875,
-0.205078125,
0.229248046875,
-0.0002655982971191406,
0.251953125,
0.66015625,
0.1507568359375,
0.4345703125,
0.60400390625,
-0.64306640625,
0.951171875,
0.580078125,
-1.2119140625,
-0.354736328125,
0.317626953125,
-0.5458984375,
0.51220703125,
0.283203125,
-0.71875,
-1.083984375,
-0.93994140625,
-0.181640625,
-0.48681640625,
0.110107421875,
-0.9033203125,
-0.064208984375,
-0.47265625,
0.79443359375,
-0.2159423828125,
-0.4619140625,
0.202880859375,
-1.0556640625,
-0.0914306640625,
-0.8740234375,
-0.3271484375,
-0.58251953125,
-0.330810546875,
-0.1474609375,
1.0302734375,
-0.1668701171875,
0.297119140625,
-0.190673828125,
-0.47802734375,
0.1318359375,
0.139404296875,
-0.591796875,
-0.377197265625,
0.279541015625,
0.123046875,
-0.182861328125,
-0.1348876953125,
-0.394287109375,
0.88623046875,
-0.71142578125,
0.0579833984375,
-0.30712890625,
-0.52490234375,
-0.177978515625,
-0.0286865234375,
1.1474609375,
-0.7158203125,
0.16259765625,
-0.5068359375,
0.57177734375,
0.951171875,
-0.331298828125,
-0.326904296875,
-0.71240234375,
-0.6982421875,
-1.0283203125,
0.440673828125,
-0.1788330078125,
0.269287109375,
-0.64013671875,
-0.171875,
1.103515625,
-0.39013671875,
0.2366943359375,
1.0556640625,
0.41748046875,
0.383544921875,
-0.7099609375,
0.583984375,
0.4111328125,
-0.357177734375,
0.1959228515625,
0.3955078125,
-0.80517578125,
0.242919921875,
-0.332763671875,
-1.01171875,
-0.7763671875,
0.53564453125,
1.3388671875,
-0.5400390625,
0.88232421875,
-0.0435791015625,
-1.169921875,
-0.213623046875,
0.712890625,
0.033721923828125,
0.0225830078125,
1.1220703125,
0.2376708984375,
0.037689208984375,
-0.231201171875,
-0.14013671875,
-0.281494140625,
-0.308349609375,
0.7744140625,
-0.5166015625,
-0.59765625,
0.60302734375,
1.1748046875,
-0.63916015625,
-0.7841796875,
0.028961181640625,
0.06317138671875,
0.191650390625,
-0.7236328125,
0.0625,
0.455810546875,
-0.4033203125,
0.23291015625,
0.5703125,
0.279541015625,
0.40966796875,
-0.0120086669921875,
0.4931640625,
-0.25048828125,
0.490478515625,
0.47119140625,
-0.56982421875,
-0.352294921875,
-0.701171875,
-0.1678466796875,
-0.1878662109375,
0.1492919921875,
1.025390625,
-0.111083984375,
0.3115234375,
0.63623046875,
-0.2012939453125,
0.9072265625,
-0.42724609375,
-0.4423828125,
0.5029296875,
-0.63525390625,
-0.431640625,
0.036529541015625,
0.321044921875,
-0.21923828125,
0.17626953125,
-0.488525390625,
-0.208251953125,
0.07061767578125,
0.318603515625,
-0.203125,
-0.6484375,
-0.3251953125,
-0.69482421875,
-0.443603515625,
-0.634765625,
-0.5712890625,
-0.295654296875,
0.1744384765625,
0.13671875,
-0.56103515625,
-0.234130859375,
0.78271484375,
-1.1337890625,
0.8623046875,
-0.64892578125,
0.319091796875,
-0.564453125,
-0.205078125,
-0.5263671875,
-0.08148193359375,
-0.6318359375,
-0.09173583984375,
-0.39794921875,
0.20458984375,
-0.281494140625,
0.3720703125,
0.040496826171875,
0.123046875,
-0.06549072265625,
-0.63330078125,
-0.1279296875,
0.2432861328125,
-0.07183837890625,
0.474853515625,
0.66943359375,
-0.308837890625,
0.236572265625,
-0.334716796875,
-0.285400390625,
-0.5634765625,
0.50439453125,
0.5810546875,
-0.0833740234375,
-0.2239990234375,
-0.07208251953125,
0.0753173828125,
-1.048828125,
0.295654296875,
-0.1136474609375,
0.51611328125,
0.5830078125,
-0.595703125,
0.51416015625,
0.8857421875,
-0.294677734375,
0.409423828125,
0.368896484375,
0.462646484375,
0.1055908203125,
0.297607421875,
-0.204833984375,
0.87939453125,
0.39208984375,
-0.40625,
-0.072265625,
0.2308349609375,
-0.124267578125,
0.53076171875,
-0.254638671875,
-0.6318359375,
-0.97412109375,
-0.269775390625,
0.0275115966796875,
0.485107421875,
0.62841796875,
-0.58740234375,
-0.0865478515625,
0.123779296875,
-0.369384765625,
0.1756591796875,
-1.044921875,
-1.0869140625,
0.384033203125,
-0.1068115234375,
-0.54736328125,
-0.1842041015625,
-0.2318115234375,
-0.1419677734375,
0.36767578125,
0.22705078125,
-0.7119140625,
0.51953125,
-0.1024169921875,
0.70947265625,
-0.446533203125,
-0.0019588470458984375,
0.168701171875,
0.392333984375,
-0.31787109375,
-0.5048828125,
0.2098388671875,
1.216796875,
0.1529541015625,
-0.08709716796875,
-0.56787109375,
0.48193359375,
0.208251953125,
0.29443359375,
-0.57666015625,
0.583984375,
-0.25,
0.5419921875,
-0.8173828125,
-0.1943359375,
-0.1783447265625,
0.41552734375,
0.1480712890625,
-0.316650390625,
-0.83056640625,
0.93505859375,
0.4619140625,
0.016998291015625,
0.6826171875,
0.296142578125,
0.463134765625,
0.045379638671875,
-0.0989990234375,
-0.2890625,
0.60791015625,
0.568359375,
0.54541015625,
0.0160675048828125,
0.1553955078125,
0.88134765625,
-0.088623046875,
-0.1021728515625,
0.412353515625,
0.437744140625,
-0.214111328125,
0.36083984375,
0.1248779296875,
-0.0396728515625,
-0.0782470703125,
-0.5849609375,
0.73046875,
-0.367919921875,
0.244140625,
-0.4599609375,
-0.89794921875,
0.64990234375,
-0.282470703125,
0.0300445556640625,
0.283447265625,
-0.11334228515625,
0.323974609375,
0.57861328125,
0.1248779296875,
-0.0289459228515625,
1.0029296875,
0.63134765625,
0.7607421875,
0.54052734375,
0.52294921875,
0.44677734375,
-0.434814453125,
-0.039886474609375,
-0.1737060546875,
-0.0009441375732421875,
-0.13427734375,
-0.455322265625,
-0.943359375,
0.55908203125,
-0.34765625,
-0.1663818359375,
0.6552734375,
-0.56494140625,
0.2587890625,
-0.41064453125,
0.77001953125,
-0.513671875,
0.2149658203125,
0.48876953125,
-0.6123046875,
-0.485595703125,
0.7080078125,
-0.2293701171875,
0.285400390625,
0.342529296875,
0.64111328125,
0.0241851806640625,
1.296875,
0.509765625,
-0.27978515625,
-0.15771484375,
-0.0789794921875,
-0.2109375,
-0.464111328125,
-0.195068359375,
-0.513671875,
0.1156005859375,
-0.71728515625,
-0.4892578125,
-0.0106964111328125,
0.83447265625,
-0.10150146484375,
-1.0478515625,
-0.423828125,
0.036224365234375,
-0.7939453125,
0.268798828125,
0.2548828125,
0.15625,
-0.2763671875,
0.224365234375,
-0.1014404296875,
-0.7060546875,
0.36279296875,
-0.58935546875,
0.5380859375,
-0.62109375,
-0.357177734375,
-0.623046875,
-0.94580078125,
-0.444580078125,
-0.2403564453125,
-0.41552734375,
-0.8046875,
0.4443359375,
0.4794921875,
0.410888671875,
0.56884765625,
-0.398193359375,
0.208251953125,
0.8056640625,
1.19140625,
0.13427734375,
0.68115234375,
0.0108184814453125,
-0.22998046875,
0.054840087890625,
-0.548828125,
0.52392578125,
-0.1265869140625,
0.45556640625,
-0.595703125,
0.26904296875,
-0.47216796875,
-1.27734375,
-0.10369873046875,
0.234375,
0.533203125,
-0.7900390625,
-1.1669921875,
-0.28662109375,
-1.1318359375,
-0.1292724609375,
-0.81689453125,
0.94970703125,
-0.2200927734375,
0.1715087890625,
-0.34912109375,
-1.052734375,
4.53515625,
1.0615234375,
0.876953125,
0.37548828125,
0.81103515625,
1.1748046875,
0.38671875,
-0.385986328125,
-0.404052734375,
-0.1529541015625,
0.242919921875,
-0.64013671875,
0.1451416015625,
0.81201171875,
0.1343994140625,
0.465576171875,
-0.5205078125,
0.1461181640625,
-0.3173828125,
-0.931640625,
-1.123046875,
0.337158203125,
0.08038330078125,
0.276611328125,
0.06561279296875,
0.040985107421875,
0.265869140625,
-0.459716796875,
-0.1839599609375,
-0.8359375,
0.1884765625,
-0.39599609375,
0.8583984375,
0.03448486328125,
0.16796875,
0.642578125,
-0.03265380859375,
-0.6025390625,
-0.34619140625,
0.140380859375,
-0.290771484375,
-0.04486083984375,
0.6650390625,
-0.46923828125,
0.07403564453125,
0.3916015625,
-0.6943359375,
0.54052734375,
-0.348876953125,
-1.208984375,
0.92041015625,
-0.231201171875,
0.231689453125,
-0.5498046875,
-0.759765625,
0.399169921875,
0.310546875,
-0.212158203125,
-0.37890625,
0.51220703125,
0.32763671875,
0.245361328125,
0.09478759765625,
0.685546875,
-1.2685546875,
0.68896484375,
-0.496337890625,
0.50537109375,
-0.79296875,
-0.029266357421875,
-0.29931640625,
0.07635498046875,
-0.5078125,
-0.5009765625,
0.20654296875,
0.0247344970703125,
-0.3154296875,
0.64599609375,
0.5830078125,
-0.67822265625,
0.283447265625,
-0.1395263671875,
-0.396240234375,
-0.447021484375,
0.52978515625,
1.296875,
-0.52587890625,
-0.18603515625,
-0.2166748046875,
0.70263671875,
0.459716796875,
0.447509765625,
-0.224609375,
-0.471435546875,
-0.2315673828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
Vasya has come up with an algorithm he will follow while writing a letter. First he chooses two strings, s1 anf s2, consisting of uppercase English letters. Then the boy makes string sk, using a recurrent equation sn = sn - 2 + sn - 1, operation '+' means a concatenation (that is, the sequential record) of strings in the given order. Then Vasya writes down string sk on a piece of paper, puts it in the envelope and sends in to Santa.
Vasya is absolutely sure that Santa will bring him the best present if the resulting string sk has exactly x occurrences of substring AC (the short-cut reminds him ΠΎf accepted problems). Besides, Vasya decided that string s1 should have length n, and string s2 should have length m. Vasya hasn't decided anything else.
At the moment Vasya's got urgent New Year business, so he asks you to choose two strings for him, s1 and s2 in the required manner. Help Vasya.
Input
The first line contains four integers k, x, n, m (3 β€ k β€ 50; 0 β€ x β€ 109; 1 β€ n, m β€ 100).
Output
In the first line print string s1, consisting of n uppercase English letters. In the second line print string s2, consisting of m uppercase English letters. If there are multiple valid strings, print any of them.
If the required pair of strings doesn't exist, print "Happy new year!" without the quotes.
Examples
Input
3 2 2 2
Output
AC
AC
Input
3 3 2 2
Output
Happy new year!
Input
3 0 2 2
Output
AA
AA
Input
4 3 2 1
Output
Happy new year!
Input
4 2 2 1
Output
Happy new year!
Tags: bitmasks, brute force, dp
Correct Solution:
```
def main():
k, x, n, m = map(int, input().split())
def f(s, e, n, cnt):
ret = [""] * n
ret[0] = s
ret[-1] = e
sa = 0 if s == 'A' else 1
for i in range(cnt):
ret[sa] = 'A'
ret[sa + 1] = 'C'
sa += 2
for j in range(sa, n - 1):
ret[j] = 'B'
return "".join(ret)
for sa in "ABC":
for ea in "ABC":
if n == 1:
ea = sa
for sb in "ABC":
for eb in "ABC":
if m == 1:
eb = sb
N = max(0, n - (sa != 'A') - (ea != 'C'))
M = max(0, m - (sb != 'A') - (eb != 'C'))
for i in range(1 + N // 2):
for j in range(1 + M // 2):
A = sa + ea
B = sb + eb
a, b = i, j
for c in range(k - 2):
a, b = b, a + b
if A[1] == 'A' and B[0] == 'C':
b += 1
A, B = B, A[0] + B[1]
if b == x:
print(f(sa, ea, n, i))
print(f(sb, eb, m, j))
return 0
print("Happy new year!")
return 0
main()
```
| 38,010
|
[
0.287841796875,
-0.04656982421875,
0.279052734375,
0.1900634765625,
-0.53076171875,
-0.7412109375,
0.1439208984375,
0.1434326171875,
-0.08734130859375,
0.830078125,
0.6904296875,
-0.10748291015625,
0.038604736328125,
-0.59716796875,
-0.54931640625,
0.1129150390625,
-0.53125,
-0.73828125,
-0.262939453125,
0.1436767578125,
0.07183837890625,
-0.031646728515625,
-1.56640625,
-0.39794921875,
-0.472900390625,
0.787109375,
0.1680908203125,
0.07574462890625,
1.068359375,
1.0771484375,
0.1043701171875,
-0.55859375,
0.326171875,
-1.38671875,
-0.1580810546875,
-0.50927734375,
0.78564453125,
-0.73291015625,
-0.0478515625,
-0.1519775390625,
0.2427978515625,
-0.3232421875,
0.873046875,
-0.646484375,
-1.1689453125,
-0.2451171875,
-0.16943359375,
-0.07080078125,
-0.233154296875,
-0.515625,
0.3662109375,
-0.465576171875,
0.52978515625,
-0.437744140625,
0.336181640625,
0.21337890625,
0.01369476318359375,
-0.036285400390625,
-0.73193359375,
0.096923828125,
0.23193359375,
0.1578369140625,
0.2210693359375,
-0.53076171875,
-0.0257415771484375,
0.123291015625,
0.07147216796875,
-0.1873779296875,
-0.144775390625,
-0.51171875,
-0.34375,
0.260009765625,
-0.86767578125,
-0.238525390625,
-0.336669921875,
0.00833892822265625,
0.1160888671875,
-0.048248291015625,
-0.55908203125,
0.80224609375,
0.08245849609375,
0.81103515625,
0.1822509765625,
0.364501953125,
-0.3935546875,
-0.77392578125,
0.3662109375,
0.1859130859375,
0.36328125,
0.11676025390625,
-0.1876220703125,
0.30859375,
-0.71044921875,
0.276123046875,
0.619140625,
0.732421875,
-0.11688232421875,
0.3232421875,
0.13720703125,
0.364990234375,
0.76806640625,
0.83056640625,
-0.29150390625,
0.9306640625,
-0.6669921875,
0.2205810546875,
0.41796875,
-0.1282958984375,
-0.1578369140625,
-0.09747314453125,
-0.40673828125,
-0.268798828125,
0.64453125,
0.1912841796875,
-0.435302734375,
0.9404296875,
0.226318359375,
0.70068359375,
-0.6904296875,
0.1895751953125,
0.74609375,
0.271240234375,
0.71435546875,
-0.3154296875,
-0.3037109375,
-0.247802734375,
-0.271240234375,
1.06640625,
-0.537109375,
0.02874755859375,
0.548828125,
0.032928466796875,
-0.1793212890625,
0.2841796875,
-0.218994140625,
0.44970703125,
-0.14892578125,
0.5458984375,
0.79638671875,
-0.70166015625,
0.24609375,
-0.2208251953125,
0.06591796875,
1.3232421875,
0.06524658203125,
-0.049285888671875,
0.66845703125,
0.484375,
-1.099609375,
0.2060546875,
-0.48681640625,
0.49853515625,
0.1964111328125,
0.33251953125,
-0.16162109375,
0.228515625,
-0.13671875,
0.0013980865478515625,
0.191650390625,
-0.10699462890625,
-0.2034912109375,
0.34619140625,
-0.3818359375,
0.95849609375,
-0.2291259765625,
0.56103515625,
-0.444580078125,
-0.1981201171875,
-0.541015625,
-0.57373046875,
0.0848388671875,
-0.330322265625,
-0.43359375,
0.623046875,
0.4951171875,
0.75830078125,
1.150390625,
-0.25634765625,
0.32177734375,
-0.0273284912109375,
-0.30615234375,
0.38134765625,
0.6728515625,
0.7705078125,
0.313720703125,
0.319580078125,
-0.1214599609375,
-0.34375,
-0.60595703125,
-0.76904296875,
0.00392913818359375,
0.47216796875,
-0.457275390625,
0.466796875,
0.08203125,
0.212158203125,
-0.81689453125,
-0.336181640625,
-0.271728515625,
-0.8623046875,
-0.47021484375,
0.413330078125,
-0.322265625,
0.52734375,
-0.72119140625,
-0.66455078125,
0.428466796875,
1.1201171875,
-0.2047119140625,
0.0556640625,
0.468994140625,
0.10845947265625,
-0.286376953125,
0.342529296875,
0.3076171875,
-0.048675537109375,
-0.71435546875,
0.6171875,
-0.079833984375,
-0.022216796875,
-0.003688812255859375,
0.58349609375,
0.471923828125,
0.380859375,
-0.3330078125,
-0.2098388671875,
0.65771484375,
0.7646484375,
-0.08148193359375,
0.603515625,
0.06390380859375,
0.8232421875,
0.457763671875,
0.8271484375,
0.83056640625,
0.1458740234375,
0.55419921875,
0.4853515625,
0.09857177734375,
0.30029296875,
0.1375732421875,
0.07977294921875,
0.08416748046875,
0.324462890625,
0.125244140625,
0.5888671875,
-0.207763671875,
0.125244140625,
-0.150146484375,
0.14990234375,
-0.325927734375,
0.50390625,
0.360595703125,
0.5283203125,
-0.454833984375,
-0.192138671875,
0.285400390625,
0.9306640625,
-0.50634765625,
-0.435546875,
-0.5107421875,
0.117919921875,
0.041717529296875,
0.0841064453125,
0.0819091796875,
0.16259765625,
0.5283203125,
0.5947265625,
-0.45166015625,
-0.58544921875,
-0.92431640625,
-0.95458984375,
-0.78759765625,
-0.51611328125,
-0.51708984375,
-0.053741455078125,
0.73486328125,
-0.984375,
0.1546630859375,
-0.1676025390625,
-0.0753173828125,
0.224365234375,
-0.48779296875,
0.306884765625,
-0.220458984375,
0.38818359375,
-0.63623046875,
0.491943359375,
0.1236572265625,
1.056640625,
-0.68994140625,
0.08209228515625,
-0.0009298324584960938,
-0.179443359375,
0.2666015625,
-0.16357421875,
0.2197265625,
-0.288818359375,
-0.473876953125,
-0.7998046875,
-0.61865234375,
-0.134521484375,
0.01496124267578125,
0.1759033203125,
-0.435302734375,
0.4287109375,
0.4873046875,
-0.9677734375,
0.5068359375,
0.744140625,
-0.794921875,
0.1854248046875,
0.449951171875,
-0.1761474609375,
-0.8056640625,
1.1650390625,
0.40234375,
0.5380859375,
-0.5576171875,
-0.411376953125,
-0.1605224609375,
0.1636962890625,
0.0035953521728515625,
-0.267822265625,
-0.515625,
0.57470703125,
-0.17333984375,
-0.91455078125,
0.382568359375,
-0.92578125,
-0.71728515625,
-0.428466796875,
-0.48583984375,
0.7685546875,
0.81298828125,
0.283447265625,
-0.2059326171875,
0.048797607421875,
-0.0897216796875,
0.5908203125,
0.390869140625,
-0.6123046875,
0.06280517578125,
0.6318359375,
-0.257080078125,
-0.043243408203125,
0.42529296875,
-0.316650390625,
-0.400146484375,
0.10064697265625,
0.276123046875,
0.265869140625,
0.340576171875,
-0.11041259765625,
0.53173828125,
0.7421875,
-0.72900390625,
-0.2474365234375,
0.00965118408203125,
0.615234375,
0.295654296875,
0.6513671875,
0.322509765625,
-0.48828125,
-0.52685546875,
-1.255859375,
0.55810546875,
0.09686279296875,
0.59130859375,
-0.9921875,
0.67919921875,
0.12310791015625,
-0.861328125,
0.329345703125,
-0.68017578125,
-0.2431640625,
0.77880859375,
-0.358642578125,
0.51171875,
-0.67724609375,
0.1751708984375,
-0.474609375,
-0.063720703125,
0.552734375,
0.28369140625,
0.5556640625,
-0.318115234375,
-0.295166015625,
-0.376953125,
-0.1654052734375,
-0.051300048828125,
-0.462646484375,
0.270751953125,
-0.303466796875,
-0.2220458984375,
-0.9296875,
0.6220703125,
0.43701171875,
0.55078125,
0.09515380859375,
0.48583984375,
0.070068359375,
0.755859375,
0.38671875,
-0.173583984375,
0.16064453125,
-0.78759765625,
0.953125,
0.25439453125,
-0.345703125,
-0.5185546875,
-0.259765625,
-0.1619873046875,
0.1798095703125,
0.006458282470703125,
-0.276123046875,
-0.97412109375,
-0.00412750244140625,
-0.05889892578125,
0.58740234375,
-0.369140625,
-0.195068359375,
-0.406982421875,
0.28466796875,
0.11358642578125,
-1.1806640625,
0.27783203125,
-0.7734375,
0.7431640625,
0.1451416015625,
0.07501220703125,
-0.5478515625,
-0.2181396484375,
-0.7822265625,
-0.5576171875,
-0.3046875,
0.970703125,
0.002513885498046875,
0.320068359375,
-1.3798828125,
0.2203369140625,
0.420654296875,
0.01088714599609375,
0.287109375,
0.39306640625,
0.44287109375,
0.164794921875,
0.62548828125,
-0.1583251953125,
-0.6240234375,
0.327880859375,
-1.3798828125,
0.380859375,
-0.4775390625,
0.399169921875,
-0.0943603515625,
-0.032196044921875,
-0.1875,
0.48046875,
-0.2998046875,
0.404541015625,
-0.1929931640625,
0.330322265625,
-0.98095703125,
-0.796875,
0.49658203125,
-0.15185546875,
-0.49462890625,
0.7900390625,
-0.06951904296875,
-0.424072265625,
-0.11627197265625,
0.6669921875,
-0.302734375,
0.0657958984375,
-0.42431640625,
0.491455078125,
-0.24169921875,
-0.66455078125,
-0.35009765625,
-0.97802734375,
0.7578125,
-0.09368896484375,
-0.79833984375,
-0.1507568359375,
-1.1435546875,
-0.031585693359375,
0.279296875,
-0.5693359375,
0.5546875,
0.12188720703125,
0.059814453125,
-0.302490234375,
-0.1700439453125,
-0.5693359375,
0.040313720703125,
-0.9873046875,
-0.412353515625,
0.33203125,
0.59228515625,
0.84423828125,
-0.1380615234375,
-0.68505859375,
0.27978515625,
0.420166015625,
-0.192138671875,
-0.5263671875,
0.034423828125,
-0.256103515625,
-0.465087890625,
-0.19384765625,
0.210693359375,
0.0261993408203125,
0.263671875,
0.66357421875,
0.1453857421875,
0.406005859375,
0.62841796875,
-0.65625,
0.93994140625,
0.587890625,
-1.20703125,
-0.364013671875,
0.317626953125,
-0.54931640625,
0.492919921875,
0.294189453125,
-0.70361328125,
-1.0732421875,
-0.95068359375,
-0.1732177734375,
-0.460205078125,
0.10479736328125,
-0.9150390625,
-0.0595703125,
-0.462158203125,
0.78857421875,
-0.2255859375,
-0.467529296875,
0.1864013671875,
-1.04296875,
-0.08697509765625,
-0.86279296875,
-0.330322265625,
-0.55810546875,
-0.310302734375,
-0.1273193359375,
1.03515625,
-0.164794921875,
0.300537109375,
-0.2080078125,
-0.50146484375,
0.1451416015625,
0.12115478515625,
-0.595703125,
-0.36083984375,
0.284423828125,
0.11865234375,
-0.159912109375,
-0.1407470703125,
-0.367431640625,
0.888671875,
-0.703125,
0.0467529296875,
-0.297607421875,
-0.537109375,
-0.1807861328125,
-0.0286865234375,
1.1259765625,
-0.71337890625,
0.141357421875,
-0.491455078125,
0.5927734375,
0.95361328125,
-0.345947265625,
-0.3154296875,
-0.7021484375,
-0.68798828125,
-1.017578125,
0.419677734375,
-0.193115234375,
0.2437744140625,
-0.65234375,
-0.1488037109375,
1.1083984375,
-0.392333984375,
0.24072265625,
1.0703125,
0.422607421875,
0.38525390625,
-0.71044921875,
0.57373046875,
0.3759765625,
-0.34375,
0.1905517578125,
0.365478515625,
-0.8232421875,
0.25927734375,
-0.330810546875,
-1.017578125,
-0.775390625,
0.52978515625,
1.369140625,
-0.52685546875,
0.8642578125,
-0.004638671875,
-1.1640625,
-0.238525390625,
0.70703125,
0.042022705078125,
0.01447296142578125,
1.1201171875,
0.24462890625,
0.028411865234375,
-0.267578125,
-0.1546630859375,
-0.276611328125,
-0.287109375,
0.76708984375,
-0.50048828125,
-0.5830078125,
0.59716796875,
1.1904296875,
-0.64208984375,
-0.775390625,
0.05242919921875,
0.07318115234375,
0.17822265625,
-0.71044921875,
0.04669189453125,
0.459716796875,
-0.4091796875,
0.22705078125,
0.5576171875,
0.274658203125,
0.40283203125,
-0.005100250244140625,
0.483154296875,
-0.231201171875,
0.489013671875,
0.460693359375,
-0.57666015625,
-0.344970703125,
-0.69873046875,
-0.16748046875,
-0.2012939453125,
0.1378173828125,
1.03125,
-0.10791015625,
0.29541015625,
0.60693359375,
-0.19091796875,
0.92333984375,
-0.43994140625,
-0.4775390625,
0.49560546875,
-0.623046875,
-0.433349609375,
0.055084228515625,
0.33642578125,
-0.21337890625,
0.194580078125,
-0.477783203125,
-0.2056884765625,
0.07666015625,
0.294921875,
-0.191162109375,
-0.63671875,
-0.31298828125,
-0.685546875,
-0.451416015625,
-0.61865234375,
-0.5693359375,
-0.291748046875,
0.1671142578125,
0.1495361328125,
-0.546875,
-0.2308349609375,
0.7744140625,
-1.1474609375,
0.86962890625,
-0.65185546875,
0.333251953125,
-0.5751953125,
-0.2103271484375,
-0.52001953125,
-0.09246826171875,
-0.62353515625,
-0.0745849609375,
-0.4248046875,
0.1983642578125,
-0.28515625,
0.38037109375,
0.040435791015625,
0.12359619140625,
-0.0782470703125,
-0.65087890625,
-0.10345458984375,
0.237548828125,
-0.0482177734375,
0.4580078125,
0.66943359375,
-0.3310546875,
0.2303466796875,
-0.3173828125,
-0.2841796875,
-0.5537109375,
0.51220703125,
0.59814453125,
-0.07794189453125,
-0.191162109375,
-0.076904296875,
0.06793212890625,
-1.0361328125,
0.299072265625,
-0.09490966796875,
0.50390625,
0.60400390625,
-0.5869140625,
0.52587890625,
0.888671875,
-0.30322265625,
0.395263671875,
0.34716796875,
0.44873046875,
0.09619140625,
0.290771484375,
-0.1920166015625,
0.87060546875,
0.38623046875,
-0.390380859375,
-0.058074951171875,
0.2449951171875,
-0.10760498046875,
0.5302734375,
-0.253173828125,
-0.63330078125,
-0.95556640625,
-0.264404296875,
0.03582763671875,
0.49267578125,
0.6240234375,
-0.59423828125,
-0.0860595703125,
0.1077880859375,
-0.340576171875,
0.176513671875,
-1.033203125,
-1.09765625,
0.364013671875,
-0.11102294921875,
-0.55322265625,
-0.18896484375,
-0.2288818359375,
-0.129150390625,
0.3623046875,
0.2325439453125,
-0.69482421875,
0.5205078125,
-0.114990234375,
0.701171875,
-0.449951171875,
-0.004131317138671875,
0.1754150390625,
0.3818359375,
-0.320556640625,
-0.505859375,
0.2281494140625,
1.220703125,
0.1578369140625,
-0.07623291015625,
-0.5576171875,
0.48193359375,
0.177734375,
0.285400390625,
-0.5888671875,
0.59326171875,
-0.2464599609375,
0.513671875,
-0.81494140625,
-0.2064208984375,
-0.18359375,
0.41259765625,
0.143798828125,
-0.318359375,
-0.82666015625,
0.93408203125,
0.455810546875,
0.02349853515625,
0.66015625,
0.30126953125,
0.48193359375,
0.0462646484375,
-0.126708984375,
-0.27880859375,
0.6064453125,
0.56884765625,
0.54296875,
0.01407623291015625,
0.154541015625,
0.88427734375,
-0.10113525390625,
-0.12200927734375,
0.41015625,
0.448974609375,
-0.1990966796875,
0.352294921875,
0.14453125,
-0.033599853515625,
-0.077880859375,
-0.59619140625,
0.7216796875,
-0.349365234375,
0.2274169921875,
-0.456298828125,
-0.89404296875,
0.6494140625,
-0.271240234375,
0.039154052734375,
0.2734375,
-0.11444091796875,
0.31787109375,
0.60888671875,
0.12274169921875,
-0.03851318359375,
0.9921875,
0.6337890625,
0.7763671875,
0.53564453125,
0.52734375,
0.447021484375,
-0.429443359375,
-0.029388427734375,
-0.1849365234375,
0.0303802490234375,
-0.156494140625,
-0.453125,
-0.95166015625,
0.576171875,
-0.347412109375,
-0.1617431640625,
0.6728515625,
-0.5546875,
0.260009765625,
-0.427490234375,
0.74462890625,
-0.5087890625,
0.215576171875,
0.478759765625,
-0.64013671875,
-0.484619140625,
0.68310546875,
-0.2371826171875,
0.28466796875,
0.341796875,
0.64990234375,
0.0007710456848144531,
1.2890625,
0.50146484375,
-0.30810546875,
-0.1806640625,
-0.09552001953125,
-0.2103271484375,
-0.478515625,
-0.18212890625,
-0.5146484375,
0.1380615234375,
-0.71435546875,
-0.479736328125,
-0.01383209228515625,
0.8369140625,
-0.12396240234375,
-1.0673828125,
-0.423583984375,
0.036163330078125,
-0.7919921875,
0.25048828125,
0.2587890625,
0.151123046875,
-0.28515625,
0.23486328125,
-0.09979248046875,
-0.70703125,
0.360595703125,
-0.623046875,
0.533203125,
-0.62646484375,
-0.353759765625,
-0.6083984375,
-0.94873046875,
-0.435791015625,
-0.259521484375,
-0.420166015625,
-0.8095703125,
0.428466796875,
0.468505859375,
0.436279296875,
0.56494140625,
-0.412353515625,
0.1807861328125,
0.8154296875,
1.189453125,
0.14404296875,
0.677734375,
0.0102386474609375,
-0.261474609375,
0.0682373046875,
-0.57080078125,
0.53515625,
-0.121826171875,
0.447265625,
-0.57177734375,
0.264404296875,
-0.47998046875,
-1.2958984375,
-0.105712890625,
0.2305908203125,
0.51611328125,
-0.771484375,
-1.1474609375,
-0.259033203125,
-1.138671875,
-0.1412353515625,
-0.81201171875,
0.943359375,
-0.2308349609375,
0.17431640625,
-0.352294921875,
-1.060546875,
4.5390625,
1.0537109375,
0.88916015625,
0.385498046875,
0.78662109375,
1.181640625,
0.383544921875,
-0.3837890625,
-0.413818359375,
-0.145751953125,
0.2379150390625,
-0.62939453125,
0.1331787109375,
0.8193359375,
0.1282958984375,
0.466552734375,
-0.51171875,
0.1650390625,
-0.318115234375,
-0.9140625,
-1.1328125,
0.363525390625,
0.087890625,
0.289794921875,
0.054962158203125,
0.043182373046875,
0.23681640625,
-0.444580078125,
-0.1917724609375,
-0.849609375,
0.2186279296875,
-0.3876953125,
0.873046875,
0.026092529296875,
0.2003173828125,
0.62158203125,
-0.030609130859375,
-0.61865234375,
-0.353759765625,
0.13623046875,
-0.30224609375,
-0.0673828125,
0.65869140625,
-0.47705078125,
0.1048583984375,
0.3818359375,
-0.697265625,
0.55908203125,
-0.3369140625,
-1.220703125,
0.92041015625,
-0.2413330078125,
0.2115478515625,
-0.57568359375,
-0.7568359375,
0.387939453125,
0.32177734375,
-0.2061767578125,
-0.392822265625,
0.484619140625,
0.327880859375,
0.23095703125,
0.1112060546875,
0.72607421875,
-1.2841796875,
0.69287109375,
-0.50390625,
0.50390625,
-0.7958984375,
-0.0469970703125,
-0.290283203125,
0.089111328125,
-0.4833984375,
-0.4873046875,
0.1903076171875,
0.033538818359375,
-0.32568359375,
0.65185546875,
0.61181640625,
-0.67822265625,
0.284423828125,
-0.114990234375,
-0.398681640625,
-0.433349609375,
0.5234375,
1.3037109375,
-0.5185546875,
-0.1788330078125,
-0.2705078125,
0.6923828125,
0.4541015625,
0.43359375,
-0.229248046875,
-0.47509765625,
-0.218505859375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
Vasya has come up with an algorithm he will follow while writing a letter. First he chooses two strings, s1 anf s2, consisting of uppercase English letters. Then the boy makes string sk, using a recurrent equation sn = sn - 2 + sn - 1, operation '+' means a concatenation (that is, the sequential record) of strings in the given order. Then Vasya writes down string sk on a piece of paper, puts it in the envelope and sends in to Santa.
Vasya is absolutely sure that Santa will bring him the best present if the resulting string sk has exactly x occurrences of substring AC (the short-cut reminds him ΠΎf accepted problems). Besides, Vasya decided that string s1 should have length n, and string s2 should have length m. Vasya hasn't decided anything else.
At the moment Vasya's got urgent New Year business, so he asks you to choose two strings for him, s1 and s2 in the required manner. Help Vasya.
Input
The first line contains four integers k, x, n, m (3 β€ k β€ 50; 0 β€ x β€ 109; 1 β€ n, m β€ 100).
Output
In the first line print string s1, consisting of n uppercase English letters. In the second line print string s2, consisting of m uppercase English letters. If there are multiple valid strings, print any of them.
If the required pair of strings doesn't exist, print "Happy new year!" without the quotes.
Examples
Input
3 2 2 2
Output
AC
AC
Input
3 3 2 2
Output
Happy new year!
Input
3 0 2 2
Output
AA
AA
Input
4 3 2 1
Output
Happy new year!
Input
4 2 2 1
Output
Happy new year!
Tags: bitmasks, brute force, dp
Correct Solution:
```
import sys
import itertools
k, x, n, m = map(int, input().split())
def valid(inicio, fim, tamanho, num_ac):
if num_ac == 0:
if tamanho == 1:
return ("" if inicio != fim else inicio)
if tamanho == 2:
return (inicio + fim if inicio + fim != "AC" else "")
return inicio + "B" * (tamanho - 2) + fim
s = "AC" * num_ac
if s[0] != inicio:
s = inicio + s
if len(s) > tamanho:
return ""
s += fim * (tamanho - len(s))
if s[-1] != fim:
return ""
return s
a = [0] * 51
a[1] = 1
b = [0] * 51
b[2] = 1
for i in range(3, 51):
a[i] = a[i-2] + a[i-1]
b[i] = b[i-2] + b[i-1]
for letters in itertools.product(['A', 'B', 'C'], repeat=4):
first_s1 = letters[0]
last_s1 = letters[1]
first_s2 = letters[2]
last_s2 = letters[3]
c = [0] * 51
meio = last_s1 + first_s2
c[3] = (1 if meio == "AC" else 0)
for i in range(4, 51):
meio = last_s2 + (first_s1 if i % 2 == 0 else first_s2)
c[i] = c[i-2] + c[i-1] + (1 if meio == "AC" else 0)
for occ1 in range(0, 51):
tmp = x - a[k] * occ1 - c[k]
if tmp % b[k] != 0:
continue
tmp = tmp//b[k]
if tmp < 0 or tmp > 50:
continue
s1 = valid(first_s1, last_s1, n, occ1)
s2 = valid(first_s2, last_s2, m, tmp)
if s1 and s2:
print(s1)
print(s2)
sys.exit(0)
print("Happy new year!")
```
| 38,011
|
[
0.295166015625,
-0.04412841796875,
0.287353515625,
0.1890869140625,
-0.54296875,
-0.744140625,
0.136474609375,
0.11395263671875,
-0.09130859375,
0.8515625,
0.67431640625,
-0.10675048828125,
0.07281494140625,
-0.57958984375,
-0.53369140625,
0.1474609375,
-0.521484375,
-0.71240234375,
-0.27197265625,
0.123291015625,
0.07861328125,
-0.048797607421875,
-1.576171875,
-0.3974609375,
-0.505859375,
0.814453125,
0.159912109375,
0.0823974609375,
1.0703125,
1.0654296875,
0.0963134765625,
-0.580078125,
0.326171875,
-1.3583984375,
-0.173828125,
-0.50439453125,
0.80859375,
-0.72607421875,
-0.0389404296875,
-0.146484375,
0.2176513671875,
-0.3037109375,
0.8525390625,
-0.658203125,
-1.1689453125,
-0.250244140625,
-0.169921875,
-0.0855712890625,
-0.218017578125,
-0.5205078125,
0.376708984375,
-0.461669921875,
0.52294921875,
-0.456298828125,
0.314697265625,
0.2115478515625,
-0.0149993896484375,
-0.05560302734375,
-0.73974609375,
0.07330322265625,
0.2039794921875,
0.1661376953125,
0.280029296875,
-0.525390625,
-0.002651214599609375,
0.1317138671875,
0.0770263671875,
-0.2200927734375,
-0.138916015625,
-0.498046875,
-0.35595703125,
0.2607421875,
-0.86328125,
-0.239013671875,
-0.33447265625,
0.028411865234375,
0.1458740234375,
-0.042938232421875,
-0.564453125,
0.78271484375,
0.051605224609375,
0.81640625,
0.213623046875,
0.3466796875,
-0.40478515625,
-0.74755859375,
0.373046875,
0.1966552734375,
0.352783203125,
0.0975341796875,
-0.1881103515625,
0.321533203125,
-0.7138671875,
0.269287109375,
0.61279296875,
0.72998046875,
-0.1539306640625,
0.319091796875,
0.1304931640625,
0.374267578125,
0.74267578125,
0.84814453125,
-0.296142578125,
0.94189453125,
-0.68017578125,
0.212158203125,
0.43505859375,
-0.11639404296875,
-0.1544189453125,
-0.10076904296875,
-0.394287109375,
-0.265869140625,
0.64306640625,
0.1900634765625,
-0.41748046875,
0.96923828125,
0.232421875,
0.6904296875,
-0.69384765625,
0.1927490234375,
0.7294921875,
0.251220703125,
0.71044921875,
-0.3173828125,
-0.34228515625,
-0.276123046875,
-0.28662109375,
1.064453125,
-0.53759765625,
0.037689208984375,
0.546875,
0.051300048828125,
-0.196533203125,
0.29248046875,
-0.2200927734375,
0.4384765625,
-0.1591796875,
0.53564453125,
0.802734375,
-0.65869140625,
0.244384765625,
-0.2149658203125,
0.0718994140625,
1.3447265625,
0.07611083984375,
-0.06341552734375,
0.67919921875,
0.48095703125,
-1.09765625,
0.197021484375,
-0.50634765625,
0.51416015625,
0.1878662109375,
0.31591796875,
-0.165771484375,
0.222900390625,
-0.144775390625,
0.014892578125,
0.2181396484375,
-0.1365966796875,
-0.214111328125,
0.367919921875,
-0.366455078125,
0.95458984375,
-0.202880859375,
0.56884765625,
-0.412353515625,
-0.179931640625,
-0.51318359375,
-0.58740234375,
0.0819091796875,
-0.327392578125,
-0.430908203125,
0.5966796875,
0.497802734375,
0.77294921875,
1.16015625,
-0.281494140625,
0.332275390625,
-0.05322265625,
-0.353759765625,
0.362548828125,
0.7021484375,
0.7578125,
0.319580078125,
0.336181640625,
-0.0869140625,
-0.35009765625,
-0.60107421875,
-0.77294921875,
0.0220489501953125,
0.473876953125,
-0.46142578125,
0.48486328125,
0.10345458984375,
0.224365234375,
-0.8447265625,
-0.31494140625,
-0.28125,
-0.875,
-0.4931640625,
0.396728515625,
-0.326171875,
0.5224609375,
-0.71826171875,
-0.65283203125,
0.420166015625,
1.134765625,
-0.2109375,
0.07305908203125,
0.465087890625,
0.1131591796875,
-0.275634765625,
0.3525390625,
0.28466796875,
-0.054473876953125,
-0.7216796875,
0.59375,
-0.067626953125,
-0.025909423828125,
-0.0029697418212890625,
0.580078125,
0.43408203125,
0.353759765625,
-0.349853515625,
-0.2222900390625,
0.650390625,
0.77099609375,
-0.07415771484375,
0.623046875,
0.06451416015625,
0.81201171875,
0.478271484375,
0.81689453125,
0.814453125,
0.1300048828125,
0.58056640625,
0.487548828125,
0.0882568359375,
0.280517578125,
0.143310546875,
0.1146240234375,
0.0943603515625,
0.3466796875,
0.12432861328125,
0.55810546875,
-0.22021484375,
0.127685546875,
-0.1514892578125,
0.178466796875,
-0.360107421875,
0.5302734375,
0.35107421875,
0.53466796875,
-0.4189453125,
-0.2099609375,
0.277099609375,
0.94482421875,
-0.53076171875,
-0.430908203125,
-0.489990234375,
0.12286376953125,
0.045013427734375,
0.07867431640625,
0.08978271484375,
0.168701171875,
0.548828125,
0.57470703125,
-0.439453125,
-0.5615234375,
-0.91357421875,
-0.935546875,
-0.80078125,
-0.5078125,
-0.5048828125,
-0.03369140625,
0.7451171875,
-0.97509765625,
0.1556396484375,
-0.1964111328125,
-0.09259033203125,
0.22119140625,
-0.461181640625,
0.298828125,
-0.2218017578125,
0.398193359375,
-0.64697265625,
0.47119140625,
0.11163330078125,
1.037109375,
-0.689453125,
0.070556640625,
0.000263214111328125,
-0.1876220703125,
0.28125,
-0.158447265625,
0.2261962890625,
-0.29443359375,
-0.475341796875,
-0.7763671875,
-0.6044921875,
-0.1507568359375,
0.0195770263671875,
0.1676025390625,
-0.440185546875,
0.414306640625,
0.52783203125,
-0.98388671875,
0.4951171875,
0.72265625,
-0.791015625,
0.1541748046875,
0.433837890625,
-0.18310546875,
-0.802734375,
1.1875,
0.38232421875,
0.55810546875,
-0.5693359375,
-0.383544921875,
-0.1614990234375,
0.179443359375,
-0.004329681396484375,
-0.252197265625,
-0.51708984375,
0.57666015625,
-0.155029296875,
-0.93994140625,
0.398681640625,
-0.9521484375,
-0.681640625,
-0.42236328125,
-0.453857421875,
0.78515625,
0.814453125,
0.27294921875,
-0.2060546875,
0.031158447265625,
-0.1109619140625,
0.58447265625,
0.36865234375,
-0.6220703125,
0.06463623046875,
0.65234375,
-0.2486572265625,
-0.0289306640625,
0.4345703125,
-0.318359375,
-0.370849609375,
0.11163330078125,
0.281982421875,
0.265625,
0.342041015625,
-0.10107421875,
0.572265625,
0.73779296875,
-0.720703125,
-0.25537109375,
0.0018758773803710938,
0.64208984375,
0.287109375,
0.6435546875,
0.322509765625,
-0.485595703125,
-0.54931640625,
-1.2744140625,
0.51904296875,
0.09844970703125,
0.60400390625,
-0.98876953125,
0.677734375,
0.12091064453125,
-0.8515625,
0.371337890625,
-0.646484375,
-0.2430419921875,
0.783203125,
-0.351318359375,
0.51220703125,
-0.65576171875,
0.16796875,
-0.48828125,
-0.0653076171875,
0.53955078125,
0.287109375,
0.56884765625,
-0.31884765625,
-0.30859375,
-0.384765625,
-0.1439208984375,
-0.061859130859375,
-0.448974609375,
0.277099609375,
-0.28955078125,
-0.22216796875,
-0.9443359375,
0.59765625,
0.4619140625,
0.5693359375,
0.10150146484375,
0.481689453125,
0.08251953125,
0.72509765625,
0.394775390625,
-0.1585693359375,
0.1480712890625,
-0.7587890625,
0.95361328125,
0.266845703125,
-0.34130859375,
-0.55322265625,
-0.29931640625,
-0.132568359375,
0.187255859375,
-0.01010894775390625,
-0.276611328125,
-0.97119140625,
-0.015777587890625,
-0.053375244140625,
0.59375,
-0.3896484375,
-0.2066650390625,
-0.421630859375,
0.275146484375,
0.11444091796875,
-1.1787109375,
0.287353515625,
-0.76904296875,
0.73828125,
0.1468505859375,
0.07806396484375,
-0.58251953125,
-0.2117919921875,
-0.7626953125,
-0.59814453125,
-0.32275390625,
0.9853515625,
-0.007061004638671875,
0.33740234375,
-1.3818359375,
0.2373046875,
0.43359375,
-0.006755828857421875,
0.2705078125,
0.376708984375,
0.457275390625,
0.1954345703125,
0.595703125,
-0.1878662109375,
-0.63037109375,
0.33837890625,
-1.37109375,
0.3701171875,
-0.509765625,
0.42138671875,
-0.08441162109375,
-0.0307769775390625,
-0.170166015625,
0.4931640625,
-0.3017578125,
0.41455078125,
-0.1881103515625,
0.34814453125,
-0.9892578125,
-0.79736328125,
0.4990234375,
-0.1575927734375,
-0.5224609375,
0.80517578125,
-0.0806884765625,
-0.43505859375,
-0.11199951171875,
0.630859375,
-0.30029296875,
0.07342529296875,
-0.412109375,
0.50390625,
-0.2264404296875,
-0.66015625,
-0.3486328125,
-0.994140625,
0.78369140625,
-0.09918212890625,
-0.78564453125,
-0.155029296875,
-1.16796875,
-0.05029296875,
0.27734375,
-0.58056640625,
0.54736328125,
0.106689453125,
0.0748291015625,
-0.32470703125,
-0.168701171875,
-0.580078125,
0.0535888671875,
-0.9423828125,
-0.40576171875,
0.337890625,
0.57373046875,
0.85400390625,
-0.12420654296875,
-0.69677734375,
0.258056640625,
0.40185546875,
-0.196533203125,
-0.52587890625,
0.0082550048828125,
-0.267822265625,
-0.447265625,
-0.20166015625,
0.1953125,
0.06890869140625,
0.2744140625,
0.66064453125,
0.155517578125,
0.390625,
0.67626953125,
-0.66357421875,
0.9658203125,
0.56201171875,
-1.22265625,
-0.368896484375,
0.3388671875,
-0.54052734375,
0.494140625,
0.301513671875,
-0.68994140625,
-1.0966796875,
-0.939453125,
-0.1524658203125,
-0.477783203125,
0.10491943359375,
-0.91455078125,
-0.060455322265625,
-0.45947265625,
0.8037109375,
-0.2138671875,
-0.46435546875,
0.1905517578125,
-1.05078125,
-0.06048583984375,
-0.8447265625,
-0.339599609375,
-0.5390625,
-0.290771484375,
-0.127197265625,
1.0419921875,
-0.1553955078125,
0.313720703125,
-0.220703125,
-0.479736328125,
0.1558837890625,
0.1336669921875,
-0.58203125,
-0.366943359375,
0.289306640625,
0.110595703125,
-0.148681640625,
-0.1422119140625,
-0.37841796875,
0.8671875,
-0.705078125,
0.047515869140625,
-0.294677734375,
-0.53955078125,
-0.1754150390625,
-0.022735595703125,
1.1162109375,
-0.69287109375,
0.1258544921875,
-0.4912109375,
0.59765625,
0.9501953125,
-0.339111328125,
-0.297119140625,
-0.7080078125,
-0.6806640625,
-1.01953125,
0.42041015625,
-0.187744140625,
0.250732421875,
-0.6259765625,
-0.1617431640625,
1.12109375,
-0.37255859375,
0.2469482421875,
1.0869140625,
0.430908203125,
0.392822265625,
-0.69189453125,
0.5791015625,
0.400146484375,
-0.365478515625,
0.197021484375,
0.346435546875,
-0.806640625,
0.260498046875,
-0.3388671875,
-1.0341796875,
-0.77880859375,
0.5029296875,
1.3681640625,
-0.5302734375,
0.8486328125,
-0.01355743408203125,
-1.1689453125,
-0.237548828125,
0.7080078125,
0.02783203125,
-0.00823974609375,
1.119140625,
0.2392578125,
0.015838623046875,
-0.271240234375,
-0.175048828125,
-0.265869140625,
-0.284423828125,
0.7783203125,
-0.49853515625,
-0.58154296875,
0.6015625,
1.1767578125,
-0.658203125,
-0.77880859375,
0.0704345703125,
0.103271484375,
0.1719970703125,
-0.73193359375,
0.051849365234375,
0.462158203125,
-0.409912109375,
0.2183837890625,
0.5625,
0.26123046875,
0.41015625,
-0.00614166259765625,
0.498291015625,
-0.213134765625,
0.47705078125,
0.45166015625,
-0.60302734375,
-0.339111328125,
-0.720703125,
-0.176025390625,
-0.2169189453125,
0.1251220703125,
1.048828125,
-0.11865234375,
0.306396484375,
0.5869140625,
-0.2000732421875,
0.93505859375,
-0.45166015625,
-0.469482421875,
0.5029296875,
-0.6259765625,
-0.444091796875,
0.045867919921875,
0.353759765625,
-0.1993408203125,
0.2025146484375,
-0.467529296875,
-0.2017822265625,
0.10125732421875,
0.290771484375,
-0.175537109375,
-0.66357421875,
-0.286376953125,
-0.68798828125,
-0.44189453125,
-0.6220703125,
-0.560546875,
-0.30615234375,
0.1563720703125,
0.1744384765625,
-0.55810546875,
-0.23486328125,
0.77783203125,
-1.14453125,
0.8603515625,
-0.64404296875,
0.32763671875,
-0.57861328125,
-0.1871337890625,
-0.54150390625,
-0.055572509765625,
-0.62841796875,
-0.04400634765625,
-0.4521484375,
0.180419921875,
-0.322265625,
0.3955078125,
0.0180206298828125,
0.142333984375,
-0.083984375,
-0.65380859375,
-0.076904296875,
0.222412109375,
-0.053009033203125,
0.45556640625,
0.6806640625,
-0.342041015625,
0.2298583984375,
-0.311767578125,
-0.2685546875,
-0.56689453125,
0.51904296875,
0.58935546875,
-0.10528564453125,
-0.1807861328125,
-0.0770263671875,
0.064208984375,
-1.0400390625,
0.26953125,
-0.087646484375,
0.5009765625,
0.6171875,
-0.57666015625,
0.5205078125,
0.87646484375,
-0.325439453125,
0.407958984375,
0.3369140625,
0.449462890625,
0.10064697265625,
0.268798828125,
-0.18994140625,
0.8759765625,
0.36865234375,
-0.370849609375,
-0.050750732421875,
0.272705078125,
-0.09820556640625,
0.5400390625,
-0.269775390625,
-0.6201171875,
-0.96923828125,
-0.259765625,
0.0281982421875,
0.496337890625,
0.63671875,
-0.59326171875,
-0.07916259765625,
0.0631103515625,
-0.36474609375,
0.1778564453125,
-1.056640625,
-1.109375,
0.35302734375,
-0.11614990234375,
-0.560546875,
-0.197509765625,
-0.212890625,
-0.120361328125,
0.390380859375,
0.2415771484375,
-0.66357421875,
0.53515625,
-0.120849609375,
0.7001953125,
-0.44482421875,
0.0113525390625,
0.181640625,
0.374755859375,
-0.3095703125,
-0.490966796875,
0.206787109375,
1.23828125,
0.154296875,
-0.08038330078125,
-0.55224609375,
0.467041015625,
0.1724853515625,
0.280517578125,
-0.6005859375,
0.58154296875,
-0.2335205078125,
0.4794921875,
-0.8232421875,
-0.18994140625,
-0.1690673828125,
0.42822265625,
0.151611328125,
-0.337646484375,
-0.84326171875,
0.92529296875,
0.460693359375,
0.06622314453125,
0.671875,
0.307861328125,
0.505859375,
0.0361328125,
-0.11785888671875,
-0.277587890625,
0.59814453125,
0.58349609375,
0.556640625,
0.0142364501953125,
0.1463623046875,
0.89404296875,
-0.102783203125,
-0.1644287109375,
0.40966796875,
0.4462890625,
-0.1951904296875,
0.336181640625,
0.0989990234375,
-0.061004638671875,
-0.07806396484375,
-0.59033203125,
0.740234375,
-0.355712890625,
0.22314453125,
-0.439453125,
-0.8984375,
0.6328125,
-0.273193359375,
0.038238525390625,
0.276611328125,
-0.135009765625,
0.3056640625,
0.61962890625,
0.10260009765625,
-0.050537109375,
0.97216796875,
0.64306640625,
0.787109375,
0.5302734375,
0.5068359375,
0.4521484375,
-0.448486328125,
-0.0343017578125,
-0.2032470703125,
0.038970947265625,
-0.1563720703125,
-0.4453125,
-0.943359375,
0.5966796875,
-0.3662109375,
-0.1484375,
0.642578125,
-0.5732421875,
0.25146484375,
-0.4423828125,
0.75537109375,
-0.51318359375,
0.2120361328125,
0.474609375,
-0.62451171875,
-0.50634765625,
0.6923828125,
-0.2349853515625,
0.26220703125,
0.340576171875,
0.66650390625,
0.033935546875,
1.283203125,
0.521484375,
-0.3349609375,
-0.1812744140625,
-0.096435546875,
-0.219970703125,
-0.467529296875,
-0.166015625,
-0.5048828125,
0.1258544921875,
-0.71630859375,
-0.482666015625,
-0.0235748291015625,
0.84228515625,
-0.12225341796875,
-1.0537109375,
-0.420166015625,
0.01474761962890625,
-0.81005859375,
0.25927734375,
0.27197265625,
0.13623046875,
-0.307861328125,
0.2347412109375,
-0.10247802734375,
-0.70703125,
0.375244140625,
-0.6396484375,
0.51025390625,
-0.64111328125,
-0.373291015625,
-0.62158203125,
-0.94384765625,
-0.45361328125,
-0.26025390625,
-0.427001953125,
-0.81494140625,
0.4326171875,
0.46728515625,
0.422607421875,
0.529296875,
-0.42041015625,
0.17529296875,
0.826171875,
1.20703125,
0.13427734375,
0.70751953125,
0.00035452842712402344,
-0.26611328125,
0.0777587890625,
-0.56689453125,
0.5224609375,
-0.11981201171875,
0.439697265625,
-0.54638671875,
0.249755859375,
-0.482421875,
-1.30078125,
-0.1409912109375,
0.2044677734375,
0.48828125,
-0.78271484375,
-1.1484375,
-0.272216796875,
-1.1259765625,
-0.1343994140625,
-0.81787109375,
0.923828125,
-0.255615234375,
0.1612548828125,
-0.34033203125,
-1.064453125,
4.53125,
1.0498046875,
0.8935546875,
0.34521484375,
0.78125,
1.1689453125,
0.3779296875,
-0.390625,
-0.399169921875,
-0.1484375,
0.2457275390625,
-0.62744140625,
0.12237548828125,
0.84375,
0.1495361328125,
0.466796875,
-0.537109375,
0.15869140625,
-0.296630859375,
-0.92333984375,
-1.14453125,
0.390869140625,
0.096435546875,
0.29052734375,
0.0684814453125,
0.03289794921875,
0.252685546875,
-0.448974609375,
-0.184326171875,
-0.85546875,
0.1864013671875,
-0.380126953125,
0.86572265625,
-0.0006661415100097656,
0.2415771484375,
0.6357421875,
-0.03643798828125,
-0.61669921875,
-0.3427734375,
0.149169921875,
-0.29541015625,
-0.07110595703125,
0.67578125,
-0.46044921875,
0.1292724609375,
0.359375,
-0.66650390625,
0.54248046875,
-0.28466796875,
-1.205078125,
0.9384765625,
-0.2291259765625,
0.2152099609375,
-0.5791015625,
-0.74658203125,
0.382568359375,
0.302978515625,
-0.2191162109375,
-0.408203125,
0.49267578125,
0.31640625,
0.256591796875,
0.1116943359375,
0.748046875,
-1.2880859375,
0.68359375,
-0.509765625,
0.5078125,
-0.78515625,
-0.041168212890625,
-0.294189453125,
0.1007080078125,
-0.476318359375,
-0.5107421875,
0.1646728515625,
0.0394287109375,
-0.311767578125,
0.67724609375,
0.6416015625,
-0.64697265625,
0.296630859375,
-0.1011962890625,
-0.396484375,
-0.404296875,
0.51318359375,
1.3251953125,
-0.52392578125,
-0.1937255859375,
-0.298828125,
0.701171875,
0.441162109375,
0.42236328125,
-0.211181640625,
-0.47119140625,
-0.2244873046875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to Santa on the New Year Eve (we Russians actually expect Santa for the New Year, not for Christmas).
Vasya has come up with an algorithm he will follow while writing a letter. First he chooses two strings, s1 anf s2, consisting of uppercase English letters. Then the boy makes string sk, using a recurrent equation sn = sn - 2 + sn - 1, operation '+' means a concatenation (that is, the sequential record) of strings in the given order. Then Vasya writes down string sk on a piece of paper, puts it in the envelope and sends in to Santa.
Vasya is absolutely sure that Santa will bring him the best present if the resulting string sk has exactly x occurrences of substring AC (the short-cut reminds him ΠΎf accepted problems). Besides, Vasya decided that string s1 should have length n, and string s2 should have length m. Vasya hasn't decided anything else.
At the moment Vasya's got urgent New Year business, so he asks you to choose two strings for him, s1 and s2 in the required manner. Help Vasya.
Input
The first line contains four integers k, x, n, m (3 β€ k β€ 50; 0 β€ x β€ 109; 1 β€ n, m β€ 100).
Output
In the first line print string s1, consisting of n uppercase English letters. In the second line print string s2, consisting of m uppercase English letters. If there are multiple valid strings, print any of them.
If the required pair of strings doesn't exist, print "Happy new year!" without the quotes.
Examples
Input
3 2 2 2
Output
AC
AC
Input
3 3 2 2
Output
Happy new year!
Input
3 0 2 2
Output
AA
AA
Input
4 3 2 1
Output
Happy new year!
Input
4 2 2 1
Output
Happy new year!
Tags: bitmasks, brute force, dp
Correct Solution:
```
def f(k):
if k == 1: return (1, 0, 0, 0, 0)
if k == 2: return (0, 1, 0, 0, 0)
if k == 3: return (1, 1, 1, 0, 0)
a, b = 1, 1
for i in range(k - 3): a, b = b, a + b
c = a
d = e = 0
for i in range(k - 3): d, e = e, d + e + int(i % 2 == 0)
return (a, b, c, d, e)
def r(a, i, n):
if n == 1:
if a == 'BB': return 'B'
if a == 'BA': return 'A'
if a == 'CB': return 'C'
return False
if i == 0:
if a == 'BB': return 'B' * n
if a == 'BA': return 'B' * (n - 1) + 'A'
if a == 'CB': return 'C' + 'B' * (n - 1)
x = 'AC' * i
n -= len(x)
if n < 0: return False
if a[0] == 'B':
if a[1] == 'B': return x + 'C' * n
return x + 'A' * n
else:
if a[1] == 'B': return 'C' * n + x
n -= 1
if n < 1: return False
return 'C' + x + 'A' * n
def g(a, b, i, j, n, m):
x, y = r(a, i, n), r(b, j, m)
if x and y:
print(x)
print(y)
return True
return False
def h():
k, x, n, m = map(int, input().split())
t = f(k)
for i in range(n // 2 + 1):
for j in range(m // 2 + 1):
if x == t[0] * i + t[1] * j:
print('AC' * i + 'B' * (n - 2 * i))
print('AC' * j + 'B' * (m - 2 * j))
return
for i in range((n + 1) // 2):
for j in range((m + 1) // 2):
y = x - (t[0] * i + t[1] * j)
if y == t[2] and g('BA', 'CB', i, j, n, m): return
if y == t[3] and g('BB', 'CA', i, j, n, m): return
if y == t[4] and g('CB', 'BA', i, j, n, m): return
if y == t[2] + t[3] and g('BA', 'CA', i, j, n, m): return
if y == t[3] + t[4] and g('CB', 'BA', i, j, n, m): return
if y == t[2] + t[3] + t[4] and g('CA', 'CA', i, j, n, m): return
print('Happy new year!')
h()
```
| 38,012
|
[
0.304931640625,
-0.056732177734375,
0.279052734375,
0.2137451171875,
-0.53564453125,
-0.759765625,
0.1619873046875,
0.149169921875,
-0.08294677734375,
0.83837890625,
0.6826171875,
-0.09857177734375,
0.044403076171875,
-0.59326171875,
-0.55517578125,
0.1295166015625,
-0.52294921875,
-0.73583984375,
-0.254638671875,
0.138671875,
0.0660400390625,
-0.06036376953125,
-1.56640625,
-0.381103515625,
-0.473388671875,
0.783203125,
0.16357421875,
0.084716796875,
1.060546875,
1.1064453125,
0.10791015625,
-0.55908203125,
0.334716796875,
-1.37109375,
-0.183349609375,
-0.51220703125,
0.7919921875,
-0.75830078125,
-0.031280517578125,
-0.1522216796875,
0.233154296875,
-0.29296875,
0.87158203125,
-0.65576171875,
-1.169921875,
-0.25146484375,
-0.184814453125,
-0.05377197265625,
-0.2159423828125,
-0.52685546875,
0.385009765625,
-0.47509765625,
0.52880859375,
-0.44970703125,
0.340087890625,
0.23291015625,
0.022003173828125,
-0.057464599609375,
-0.72509765625,
0.0882568359375,
0.2294921875,
0.1474609375,
0.228515625,
-0.54931640625,
-0.027618408203125,
0.1171875,
0.07965087890625,
-0.1842041015625,
-0.1689453125,
-0.495361328125,
-0.306640625,
0.27392578125,
-0.85302734375,
-0.235107421875,
-0.333251953125,
0.0157012939453125,
0.10577392578125,
-0.045501708984375,
-0.55126953125,
0.81787109375,
0.0718994140625,
0.7998046875,
0.1881103515625,
0.363037109375,
-0.385498046875,
-0.78564453125,
0.379638671875,
0.214599609375,
0.37109375,
0.10040283203125,
-0.1746826171875,
0.319580078125,
-0.7236328125,
0.26806640625,
0.6181640625,
0.734375,
-0.09576416015625,
0.316162109375,
0.1488037109375,
0.330078125,
0.74658203125,
0.8251953125,
-0.301025390625,
0.91162109375,
-0.66064453125,
0.220703125,
0.405517578125,
-0.1357421875,
-0.1962890625,
-0.081298828125,
-0.40087890625,
-0.290771484375,
0.65234375,
0.204345703125,
-0.43701171875,
0.947265625,
0.23388671875,
0.6826171875,
-0.6943359375,
0.1795654296875,
0.728515625,
0.267822265625,
0.72119140625,
-0.301513671875,
-0.302734375,
-0.2406005859375,
-0.25732421875,
1.0771484375,
-0.5302734375,
0.023162841796875,
0.5439453125,
0.026702880859375,
-0.151123046875,
0.255615234375,
-0.232421875,
0.457763671875,
-0.1358642578125,
0.54052734375,
0.8173828125,
-0.7080078125,
0.25537109375,
-0.22412109375,
0.07000732421875,
1.3134765625,
0.0650634765625,
-0.042999267578125,
0.685546875,
0.482421875,
-1.1083984375,
0.2059326171875,
-0.482177734375,
0.494384765625,
0.19287109375,
0.328857421875,
-0.153076171875,
0.2254638671875,
-0.11285400390625,
-0.014923095703125,
0.184326171875,
-0.09271240234375,
-0.1903076171875,
0.3740234375,
-0.386474609375,
0.96728515625,
-0.232421875,
0.55419921875,
-0.403076171875,
-0.1944580078125,
-0.5322265625,
-0.5947265625,
0.0771484375,
-0.31005859375,
-0.43896484375,
0.6279296875,
0.50244140625,
0.74072265625,
1.1533203125,
-0.261474609375,
0.318359375,
-0.033935546875,
-0.2998046875,
0.37548828125,
0.6689453125,
0.787109375,
0.31591796875,
0.307373046875,
-0.11102294921875,
-0.337158203125,
-0.61279296875,
-0.76904296875,
-0.00981903076171875,
0.461669921875,
-0.457275390625,
0.46875,
0.0985107421875,
0.217529296875,
-0.82080078125,
-0.34423828125,
-0.2705078125,
-0.876953125,
-0.481201171875,
0.431640625,
-0.348876953125,
0.51025390625,
-0.70703125,
-0.6875,
0.43505859375,
1.1123046875,
-0.193359375,
0.047607421875,
0.446533203125,
0.113037109375,
-0.2744140625,
0.339111328125,
0.297607421875,
-0.045013427734375,
-0.7275390625,
0.64404296875,
-0.069091796875,
-0.0013856887817382812,
0.0266265869140625,
0.568359375,
0.476806640625,
0.403076171875,
-0.322509765625,
-0.22314453125,
0.6328125,
0.78759765625,
-0.0662841796875,
0.60302734375,
0.06298828125,
0.85205078125,
0.473876953125,
0.84130859375,
0.85595703125,
0.1617431640625,
0.5947265625,
0.486328125,
0.11212158203125,
0.33154296875,
0.1326904296875,
0.05535888671875,
0.10284423828125,
0.35498046875,
0.099609375,
0.5771484375,
-0.2083740234375,
0.13232421875,
-0.1561279296875,
0.11676025390625,
-0.329345703125,
0.494384765625,
0.3486328125,
0.548828125,
-0.462158203125,
-0.18994140625,
0.286376953125,
0.9306640625,
-0.51318359375,
-0.4375,
-0.5244140625,
0.126708984375,
0.0183258056640625,
0.0833740234375,
0.0947265625,
0.1610107421875,
0.5234375,
0.60546875,
-0.453369140625,
-0.56298828125,
-0.9560546875,
-0.9638671875,
-0.8251953125,
-0.50390625,
-0.515625,
-0.052398681640625,
0.73388671875,
-0.984375,
0.1407470703125,
-0.17724609375,
-0.07257080078125,
0.25048828125,
-0.51318359375,
0.32568359375,
-0.21435546875,
0.401123046875,
-0.6435546875,
0.5068359375,
0.14453125,
1.0625,
-0.7099609375,
0.08001708984375,
-0.028533935546875,
-0.224853515625,
0.268798828125,
-0.1820068359375,
0.224609375,
-0.3056640625,
-0.486083984375,
-0.79296875,
-0.62060546875,
-0.1099853515625,
0.024322509765625,
0.1751708984375,
-0.43701171875,
0.417724609375,
0.484619140625,
-0.9697265625,
0.5068359375,
0.76416015625,
-0.80517578125,
0.2042236328125,
0.440185546875,
-0.18505859375,
-0.83154296875,
1.1689453125,
0.417236328125,
0.53564453125,
-0.54833984375,
-0.41650390625,
-0.1622314453125,
0.150634765625,
0.00830078125,
-0.267822265625,
-0.51806640625,
0.572265625,
-0.1640625,
-0.93798828125,
0.38037109375,
-0.93212890625,
-0.72802734375,
-0.4365234375,
-0.4912109375,
0.79833984375,
0.81689453125,
0.27978515625,
-0.181884765625,
0.025482177734375,
-0.0966796875,
0.62744140625,
0.385009765625,
-0.611328125,
0.08056640625,
0.61572265625,
-0.26220703125,
-0.041473388671875,
0.419677734375,
-0.34375,
-0.41796875,
0.08319091796875,
0.306396484375,
0.298828125,
0.3603515625,
-0.1265869140625,
0.55419921875,
0.751953125,
-0.736328125,
-0.2349853515625,
0.0178375244140625,
0.6201171875,
0.283935546875,
0.6630859375,
0.3359375,
-0.49755859375,
-0.52783203125,
-1.2412109375,
0.5478515625,
0.0714111328125,
0.58447265625,
-0.9775390625,
0.6767578125,
0.09552001953125,
-0.83837890625,
0.31689453125,
-0.67431640625,
-0.2236328125,
0.77734375,
-0.35009765625,
0.52685546875,
-0.6884765625,
0.1763916015625,
-0.47900390625,
-0.063232421875,
0.55517578125,
0.258544921875,
0.54736328125,
-0.307861328125,
-0.295166015625,
-0.380615234375,
-0.1741943359375,
-0.05633544921875,
-0.479736328125,
0.251953125,
-0.294189453125,
-0.239990234375,
-0.9375,
0.60888671875,
0.436279296875,
0.55615234375,
0.086181640625,
0.46826171875,
0.0673828125,
0.77001953125,
0.39306640625,
-0.1517333984375,
0.147705078125,
-0.77978515625,
0.9345703125,
0.235107421875,
-0.345458984375,
-0.5263671875,
-0.228271484375,
-0.169189453125,
0.177734375,
0.0129241943359375,
-0.284423828125,
-0.96923828125,
0.0408935546875,
-0.06787109375,
0.5703125,
-0.3828125,
-0.2237548828125,
-0.388427734375,
0.286376953125,
0.12457275390625,
-1.173828125,
0.28955078125,
-0.74365234375,
0.74169921875,
0.1627197265625,
0.075439453125,
-0.533203125,
-0.219970703125,
-0.78515625,
-0.56884765625,
-0.309814453125,
0.99072265625,
0.016326904296875,
0.330810546875,
-1.3935546875,
0.2174072265625,
0.412109375,
0.01580810546875,
0.259033203125,
0.37158203125,
0.449462890625,
0.15576171875,
0.6669921875,
-0.1767578125,
-0.63671875,
0.3203125,
-1.3828125,
0.376953125,
-0.46142578125,
0.400146484375,
-0.09527587890625,
-0.0276031494140625,
-0.2021484375,
0.50048828125,
-0.321044921875,
0.380859375,
-0.180908203125,
0.332275390625,
-0.990234375,
-0.77392578125,
0.487060546875,
-0.1534423828125,
-0.5048828125,
0.7998046875,
-0.076416015625,
-0.42724609375,
-0.1031494140625,
0.669921875,
-0.315673828125,
0.05377197265625,
-0.417236328125,
0.490234375,
-0.256591796875,
-0.6748046875,
-0.34033203125,
-0.98974609375,
0.7646484375,
-0.090087890625,
-0.798828125,
-0.1815185546875,
-1.146484375,
-0.0290069580078125,
0.287841796875,
-0.54296875,
0.5869140625,
0.1070556640625,
0.09161376953125,
-0.327880859375,
-0.1722412109375,
-0.587890625,
0.04888916015625,
-0.9931640625,
-0.407470703125,
0.343994140625,
0.623046875,
0.81787109375,
-0.1488037109375,
-0.6640625,
0.2822265625,
0.45068359375,
-0.169677734375,
-0.53515625,
0.000499725341796875,
-0.234619140625,
-0.466552734375,
-0.1844482421875,
0.212890625,
0.007411956787109375,
0.25537109375,
0.654296875,
0.138427734375,
0.422607421875,
0.62451171875,
-0.64599609375,
0.95751953125,
0.5908203125,
-1.2197265625,
-0.381103515625,
0.3095703125,
-0.52880859375,
0.5224609375,
0.295654296875,
-0.71240234375,
-1.072265625,
-0.94482421875,
-0.1962890625,
-0.462158203125,
0.09783935546875,
-0.9052734375,
-0.056549072265625,
-0.467041015625,
0.794921875,
-0.198486328125,
-0.5048828125,
0.19384765625,
-1.0615234375,
-0.08544921875,
-0.8994140625,
-0.332763671875,
-0.56982421875,
-0.338134765625,
-0.137451171875,
1.0126953125,
-0.1485595703125,
0.31396484375,
-0.22998046875,
-0.50732421875,
0.146484375,
0.126220703125,
-0.587890625,
-0.39208984375,
0.2744140625,
0.10833740234375,
-0.1915283203125,
-0.1434326171875,
-0.3916015625,
0.880859375,
-0.70263671875,
0.06396484375,
-0.317626953125,
-0.53857421875,
-0.2073974609375,
-0.028656005859375,
1.1328125,
-0.7060546875,
0.1427001953125,
-0.5068359375,
0.58740234375,
0.96240234375,
-0.344482421875,
-0.332763671875,
-0.71533203125,
-0.69873046875,
-1.0263671875,
0.431640625,
-0.1881103515625,
0.252197265625,
-0.6455078125,
-0.17919921875,
1.1025390625,
-0.380859375,
0.2332763671875,
1.064453125,
0.3994140625,
0.371337890625,
-0.724609375,
0.58203125,
0.39404296875,
-0.359619140625,
0.19677734375,
0.390380859375,
-0.81005859375,
0.256591796875,
-0.317626953125,
-1,
-0.771484375,
0.5146484375,
1.3505859375,
-0.53515625,
0.9033203125,
-0.0279998779296875,
-1.1728515625,
-0.2479248046875,
0.69677734375,
0.05694580078125,
0.025299072265625,
1.1044921875,
0.261962890625,
0.02764892578125,
-0.255615234375,
-0.150390625,
-0.265869140625,
-0.303466796875,
0.779296875,
-0.48486328125,
-0.60302734375,
0.60302734375,
1.203125,
-0.6337890625,
-0.79150390625,
0.07470703125,
0.05029296875,
0.17578125,
-0.71142578125,
0.07342529296875,
0.45703125,
-0.400634765625,
0.252685546875,
0.5693359375,
0.263671875,
0.399658203125,
-0.02117919921875,
0.5078125,
-0.251708984375,
0.48388671875,
0.480224609375,
-0.59033203125,
-0.346923828125,
-0.70361328125,
-0.1826171875,
-0.2099609375,
0.13232421875,
1.03125,
-0.09967041015625,
0.3017578125,
0.6259765625,
-0.2022705078125,
0.92724609375,
-0.4306640625,
-0.468017578125,
0.50634765625,
-0.64599609375,
-0.43505859375,
0.03167724609375,
0.31396484375,
-0.19873046875,
0.1751708984375,
-0.48095703125,
-0.2020263671875,
0.07720947265625,
0.311767578125,
-0.2012939453125,
-0.64794921875,
-0.31689453125,
-0.67431640625,
-0.45166015625,
-0.6396484375,
-0.5712890625,
-0.313232421875,
0.161865234375,
0.1473388671875,
-0.55615234375,
-0.25390625,
0.77685546875,
-1.134765625,
0.85205078125,
-0.65185546875,
0.324462890625,
-0.5830078125,
-0.2357177734375,
-0.51708984375,
-0.08624267578125,
-0.62744140625,
-0.05511474609375,
-0.442626953125,
0.196044921875,
-0.2880859375,
0.408447265625,
0.04998779296875,
0.1290283203125,
-0.08221435546875,
-0.66650390625,
-0.0902099609375,
0.228515625,
-0.07281494140625,
0.4697265625,
0.6552734375,
-0.3203125,
0.241943359375,
-0.352783203125,
-0.268798828125,
-0.5634765625,
0.50732421875,
0.587890625,
-0.1014404296875,
-0.19580078125,
-0.048919677734375,
0.057281494140625,
-1.041015625,
0.280517578125,
-0.1175537109375,
0.494873046875,
0.58984375,
-0.5966796875,
0.51025390625,
0.8623046875,
-0.289794921875,
0.41552734375,
0.33984375,
0.468017578125,
0.1175537109375,
0.291748046875,
-0.19677734375,
0.87060546875,
0.377197265625,
-0.367919921875,
-0.05169677734375,
0.2437744140625,
-0.11407470703125,
0.5185546875,
-0.2496337890625,
-0.6435546875,
-0.97265625,
-0.260498046875,
0.007602691650390625,
0.467041015625,
0.62451171875,
-0.5771484375,
-0.06939697265625,
0.125,
-0.346923828125,
0.18896484375,
-1.0263671875,
-1.087890625,
0.37060546875,
-0.1015625,
-0.56005859375,
-0.1749267578125,
-0.236083984375,
-0.16064453125,
0.36474609375,
0.243896484375,
-0.708984375,
0.52783203125,
-0.10760498046875,
0.71044921875,
-0.44921875,
-0.00904083251953125,
0.1551513671875,
0.40185546875,
-0.319091796875,
-0.51171875,
0.2203369140625,
1.1982421875,
0.1763916015625,
-0.0872802734375,
-0.57080078125,
0.486328125,
0.203125,
0.289794921875,
-0.5810546875,
0.60205078125,
-0.263671875,
0.54345703125,
-0.7919921875,
-0.18408203125,
-0.16259765625,
0.420166015625,
0.1470947265625,
-0.328857421875,
-0.8154296875,
0.92431640625,
0.446533203125,
-0.01739501953125,
0.67431640625,
0.310791015625,
0.47607421875,
0.046875,
-0.11334228515625,
-0.256591796875,
0.62744140625,
0.5576171875,
0.5625,
0.016937255859375,
0.1558837890625,
0.8740234375,
-0.09161376953125,
-0.11151123046875,
0.40576171875,
0.43017578125,
-0.2034912109375,
0.349365234375,
0.1474609375,
-0.0296173095703125,
-0.085205078125,
-0.6064453125,
0.7314453125,
-0.36767578125,
0.2281494140625,
-0.47119140625,
-0.90966796875,
0.65673828125,
-0.25390625,
0.0440673828125,
0.2724609375,
-0.1114501953125,
0.328857421875,
0.60595703125,
0.09747314453125,
-0.037078857421875,
1.0009765625,
0.64794921875,
0.76123046875,
0.56396484375,
0.515625,
0.468505859375,
-0.434814453125,
-0.035064697265625,
-0.1697998046875,
0.0196380615234375,
-0.1368408203125,
-0.4765625,
-0.9453125,
0.556640625,
-0.359619140625,
-0.1678466796875,
0.6943359375,
-0.59375,
0.282470703125,
-0.399658203125,
0.73876953125,
-0.50732421875,
0.217529296875,
0.46923828125,
-0.619140625,
-0.480224609375,
0.69189453125,
-0.21826171875,
0.291748046875,
0.3359375,
0.650390625,
0.002071380615234375,
1.29296875,
0.493408203125,
-0.297607421875,
-0.17041015625,
-0.07781982421875,
-0.1981201171875,
-0.468994140625,
-0.1983642578125,
-0.52197265625,
0.1175537109375,
-0.7236328125,
-0.496337890625,
-0.0009655952453613281,
0.8125,
-0.118408203125,
-1.05859375,
-0.42333984375,
0.048187255859375,
-0.80126953125,
0.266845703125,
0.266845703125,
0.14892578125,
-0.27587890625,
0.218017578125,
-0.09295654296875,
-0.70654296875,
0.381103515625,
-0.6171875,
0.5380859375,
-0.6318359375,
-0.373291015625,
-0.6025390625,
-0.94775390625,
-0.423095703125,
-0.25390625,
-0.41650390625,
-0.81787109375,
0.42724609375,
0.48291015625,
0.435302734375,
0.56787109375,
-0.404296875,
0.2008056640625,
0.822265625,
1.201171875,
0.1329345703125,
0.69287109375,
0.00714111328125,
-0.264892578125,
0.06982421875,
-0.5771484375,
0.521484375,
-0.14208984375,
0.4521484375,
-0.5791015625,
0.281494140625,
-0.46142578125,
-1.2841796875,
-0.10333251953125,
0.252197265625,
0.521484375,
-0.765625,
-1.1787109375,
-0.27978515625,
-1.1328125,
-0.1424560546875,
-0.81884765625,
0.955078125,
-0.2269287109375,
0.163818359375,
-0.36865234375,
-1.0673828125,
4.5234375,
1.0498046875,
0.89599609375,
0.408447265625,
0.8095703125,
1.16015625,
0.400146484375,
-0.39013671875,
-0.401611328125,
-0.146484375,
0.23779296875,
-0.64404296875,
0.1324462890625,
0.806640625,
0.12432861328125,
0.442626953125,
-0.51123046875,
0.164794921875,
-0.325439453125,
-0.912109375,
-1.1357421875,
0.360595703125,
0.09552001953125,
0.28662109375,
0.051910400390625,
0.03173828125,
0.2431640625,
-0.46240234375,
-0.1871337890625,
-0.8466796875,
0.2274169921875,
-0.37548828125,
0.88720703125,
0.02935791015625,
0.197265625,
0.62744140625,
-0.03704833984375,
-0.60595703125,
-0.348388671875,
0.137939453125,
-0.308349609375,
-0.07476806640625,
0.66943359375,
-0.4755859375,
0.09075927734375,
0.382568359375,
-0.712890625,
0.5712890625,
-0.33642578125,
-1.201171875,
0.9296875,
-0.239013671875,
0.228271484375,
-0.560546875,
-0.74072265625,
0.377197265625,
0.306884765625,
-0.197265625,
-0.37744140625,
0.50830078125,
0.31884765625,
0.2369384765625,
0.1015625,
0.69482421875,
-1.2978515625,
0.673828125,
-0.5009765625,
0.51611328125,
-0.80078125,
-0.050994873046875,
-0.302001953125,
0.086669921875,
-0.486083984375,
-0.50927734375,
0.1956787109375,
0.03387451171875,
-0.3291015625,
0.65380859375,
0.59326171875,
-0.6806640625,
0.29736328125,
-0.12158203125,
-0.40283203125,
-0.4287109375,
0.54248046875,
1.314453125,
-0.50341796875,
-0.176025390625,
-0.244384765625,
0.712890625,
0.46337890625,
0.435302734375,
-0.2276611328125,
-0.47265625,
-0.2259521484375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Anfisa the monkey learns to type. She is yet unfamiliar with the "space" key and can only type in lower-case Latin letters. Having typed for a fairly long line, Anfisa understood that it would be great to divide what she has written into k lines not shorter than a and not longer than b, for the text to resemble human speech more. Help Anfisa.
Input
The first line contains three integers k, a and b (1 β€ k β€ 200, 1 β€ a β€ b β€ 200). The second line contains a sequence of lowercase Latin letters β the text typed by Anfisa. It is guaranteed that the given line is not empty and its length does not exceed 200 symbols.
Output
Print k lines, each of which contains no less than a and no more than b symbols β Anfisa's text divided into lines. It is not allowed to perform any changes in the text, such as: deleting or adding symbols, changing their order, etc. If the solution is not unique, print any of them. If there is no solution, print "No solution" (without quotes).
Examples
Input
3 2 5
abrakadabra
Output
ab
rakad
abra
Input
4 1 2
abrakadabra
Output
No solution
Tags: dp
Correct Solution:
```
line = list(map(int, input().split()))
k = line[0]
a = line[1]
b = line[2]
text = input()
textLength = len(text)
if (textLength/k > b or textLength/k < a):
print("No solution")
else:
avg = textLength // k
splitLength = [avg for i in range(k)]
remaining = textLength % k
for i in range(remaining):
splitLength[i%k]+=1
if (splitLength[0] > b):
print("No solution")
else:
start = 0
for i in range(k):
print(text[start:start+splitLength[i]])
start+= splitLength[i]
```
| 38,033
|
[
0.318359375,
-0.05340576171875,
0.36474609375,
0.255615234375,
-0.4208984375,
-0.53564453125,
0.1026611328125,
0.1920166015625,
-0.09625244140625,
0.8671875,
0.486328125,
0.439453125,
-0.51318359375,
-0.5693359375,
-0.52978515625,
0.28173828125,
-0.55517578125,
-1.0439453125,
-0.13623046875,
-0.3740234375,
-0.01265716552734375,
0.10516357421875,
-1.5087890625,
-0.292724609375,
-0.3134765625,
1.0771484375,
0.3828125,
0.213134765625,
1.033203125,
0.78369140625,
0.336181640625,
-0.5322265625,
0.57177734375,
-1.37890625,
-0.391357421875,
-0.378173828125,
0.595703125,
-0.421142578125,
-0.7666015625,
-0.544921875,
0.2398681640625,
-0.2138671875,
0.6279296875,
-0.9814453125,
-1.3544921875,
0.0948486328125,
-0.5341796875,
-0.14697265625,
-0.2315673828125,
-0.406005859375,
-0.1038818359375,
-0.0482177734375,
0.67578125,
-0.1546630859375,
-0.4208984375,
-0.1851806640625,
0.2132568359375,
-0.174560546875,
-0.95751953125,
0.260498046875,
0.1951904296875,
0.51953125,
-0.2166748046875,
-0.2186279296875,
-0.04058837890625,
0.1820068359375,
-0.466064453125,
-0.268798828125,
-0.40234375,
-0.5146484375,
-0.09332275390625,
0.517578125,
-0.218994140625,
-0.322021484375,
-0.626953125,
-0.0914306640625,
-0.03839111328125,
-0.25439453125,
-0.6396484375,
0.74365234375,
0.0025920867919921875,
0.916015625,
0.036529541015625,
0.69775390625,
-0.69140625,
-0.9404296875,
-0.032257080078125,
0.2197265625,
0.494140625,
-0.09844970703125,
-0.343017578125,
0.466064453125,
-0.5224609375,
0.4931640625,
0.60693359375,
0.55712890625,
-0.1324462890625,
0.1986083984375,
0.32958984375,
0.287353515625,
0.8876953125,
0.927734375,
-0.4453125,
0.763671875,
-0.6015625,
0.1781005859375,
0.1939697265625,
0.1680908203125,
-0.08233642578125,
-0.38916015625,
-0.273193359375,
-0.39697265625,
0.320556640625,
0.27783203125,
-0.45654296875,
0.5966796875,
0.1756591796875,
0.2430419921875,
-0.83349609375,
0.046173095703125,
0.210205078125,
0.38671875,
0.40966796875,
-0.328369140625,
0.040618896484375,
-0.261962890625,
-0.58349609375,
0.919921875,
-0.27734375,
-0.211181640625,
0.56298828125,
0.0288848876953125,
0.1824951171875,
0.2127685546875,
-0.005924224853515625,
0.6767578125,
-0.09161376953125,
0.62841796875,
0.57080078125,
-0.59130859375,
0.349365234375,
0.01483154296875,
0.036468505859375,
1.2333984375,
0.51513671875,
0.02362060546875,
0.58740234375,
0.448486328125,
-0.476806640625,
0.2462158203125,
-0.9482421875,
0.59716796875,
0.1986083984375,
0.371337890625,
-0.355712890625,
-0.09375,
-0.147216796875,
0.307861328125,
0.007152557373046875,
0.466796875,
-0.288330078125,
0.037322998046875,
-0.322509765625,
0.91552734375,
-0.2164306640625,
0.6181640625,
-0.28955078125,
-0.353515625,
0.285888671875,
-0.384765625,
0.80908203125,
-0.372802734375,
-0.0411376953125,
0.779296875,
0.3037109375,
0.98681640625,
0.7783203125,
0.08489990234375,
0.1705322265625,
0.36669921875,
-0.11431884765625,
0.4755859375,
0.297119140625,
0.69482421875,
0.60693359375,
0.2449951171875,
0.405517578125,
-0.2481689453125,
-1.080078125,
-0.53759765625,
-0.0751953125,
0.6376953125,
-0.4951171875,
0.415283203125,
0.34814453125,
0.05499267578125,
-0.580078125,
-0.206787109375,
0.403076171875,
-0.83935546875,
-0.442626953125,
0.8779296875,
-0.5234375,
0.58935546875,
-0.54541015625,
-0.403076171875,
0.2022705078125,
1.3515625,
-0.3193359375,
-0.10443115234375,
0.21533203125,
0.019317626953125,
-0.3896484375,
-0.26025390625,
0.02655029296875,
-0.6103515625,
-0.494384765625,
0.681640625,
-0.25341796875,
0.1900634765625,
0.2127685546875,
0.61328125,
0.392333984375,
0.70556640625,
-0.58837890625,
-0.1466064453125,
0.6845703125,
1.2060546875,
-0.00234222412109375,
0.335693359375,
-0.0306243896484375,
0.81884765625,
0.6162109375,
0.65966796875,
0.226806640625,
0.58642578125,
0.40380859375,
0.787109375,
0.004436492919921875,
0.361328125,
0.01222991943359375,
0.276123046875,
0.336181640625,
0.67333984375,
0.33154296875,
0.28076171875,
-0.390869140625,
0.00896453857421875,
-0.27783203125,
0.216064453125,
-0.3544921875,
0.82373046875,
0.329833984375,
0.38134765625,
-0.406494140625,
-0.1832275390625,
0.499267578125,
0.9560546875,
-0.8369140625,
-0.76318359375,
-0.118896484375,
-0.35498046875,
0.322021484375,
-0.040740966796875,
0.359375,
0.35888671875,
0.127685546875,
0.291259765625,
-0.298095703125,
-0.5068359375,
-0.87890625,
-0.62451171875,
-0.95947265625,
-0.26171875,
-0.4443359375,
-0.1395263671875,
0.2369384765625,
-0.9814453125,
0.47802734375,
-0.66552734375,
-0.30810546875,
-0.109130859375,
-0.72314453125,
0.39990234375,
0.1861572265625,
0.79248046875,
-0.5126953125,
0.57470703125,
0.323974609375,
1.1650390625,
-0.48388671875,
-0.289794921875,
-0.1278076171875,
-0.91748046875,
0.76123046875,
-0.15380859375,
0.0958251953125,
0.2022705078125,
-1.0927734375,
-1.1572265625,
-0.55078125,
-0.404296875,
-0.421875,
0.2037353515625,
-0.3271484375,
0.79931640625,
0.185546875,
-0.62060546875,
0.30224609375,
0.640625,
-0.673828125,
0.56103515625,
0.256591796875,
0.093017578125,
-0.87451171875,
0.9169921875,
0.5146484375,
0.393798828125,
-0.5576171875,
-0.73291015625,
-0.487060546875,
0.1629638671875,
0.31396484375,
-0.11956787109375,
-0.447998046875,
0.276611328125,
0.344482421875,
-1.177734375,
0.396240234375,
-0.8046875,
-0.4716796875,
-0.4912109375,
-0.7509765625,
0.79736328125,
0.91015625,
0.226806640625,
-0.404541015625,
-0.391845703125,
-0.7412109375,
0.359619140625,
0.419677734375,
-0.80322265625,
-0.0279388427734375,
0.7470703125,
-0.07220458984375,
-0.347412109375,
-0.08062744140625,
-0.345947265625,
-0.18994140625,
0.00753021240234375,
0.0140380859375,
0.274658203125,
0.63330078125,
0.291748046875,
0.472900390625,
0.603515625,
-0.8857421875,
-0.1279296875,
-0.09588623046875,
0.66455078125,
0.1568603515625,
0.53857421875,
0.71533203125,
-0.537109375,
-0.447509765625,
-1.146484375,
0.457275390625,
0.2445068359375,
0.63818359375,
-0.9619140625,
0.394287109375,
0.1810302734375,
-0.411376953125,
0.278564453125,
-0.7744140625,
-0.22021484375,
1.2412109375,
-0.09478759765625,
0.94189453125,
-0.8349609375,
0.1766357421875,
-0.09771728515625,
0.15576171875,
0.68359375,
0.2509765625,
0.2056884765625,
-0.469482421875,
-0.1165771484375,
0.0782470703125,
-0.5947265625,
0.0977783203125,
-0.358642578125,
0.32373046875,
-0.318359375,
-0.5078125,
-0.87060546875,
0.333740234375,
0.88037109375,
0.438232421875,
0.1949462890625,
0.1885986328125,
-0.052764892578125,
1.01953125,
0.341552734375,
-0.360595703125,
0.236572265625,
-0.751953125,
0.880859375,
0.4921875,
0.06317138671875,
-0.38818359375,
-0.6728515625,
0.260986328125,
0.055694580078125,
-0.05584716796875,
-0.095458984375,
-0.460205078125,
-0.13525390625,
0.00943756103515625,
0.52001953125,
-0.7900390625,
-0.457275390625,
-0.1510009765625,
0.359375,
0.1492919921875,
-1.12109375,
0.244140625,
-0.703125,
0.95263671875,
0.387939453125,
-0.42138671875,
-0.03070068359375,
-0.421142578125,
-0.734375,
-0.296630859375,
0.350830078125,
0.830078125,
-0.2244873046875,
0.37841796875,
-0.9775390625,
0.379638671875,
0.55419921875,
-0.2259521484375,
0.055908203125,
0.2216796875,
0.205322265625,
-0.0109405517578125,
0.74072265625,
-0.289794921875,
-1.125,
0.65185546875,
-1.21484375,
0.39697265625,
-0.382568359375,
0.01183319091796875,
-0.333740234375,
-0.1746826171875,
0.1536865234375,
0.3203125,
-0.2020263671875,
-0.066162109375,
0.01219940185546875,
0.289306640625,
-0.64013671875,
-0.748046875,
0.36474609375,
-0.06475830078125,
-0.35205078125,
0.560546875,
-0.01525115966796875,
-0.51806640625,
0.273193359375,
0.5859375,
-0.55029296875,
0.401123046875,
-0.75830078125,
0.302978515625,
-0.2398681640625,
-0.69580078125,
-0.35498046875,
-0.451416015625,
0.328369140625,
0.0275421142578125,
-0.69287109375,
0.005279541015625,
-1.0478515625,
-0.1326904296875,
-0.64306640625,
-0.728515625,
0.288818359375,
0.62548828125,
-0.29248046875,
0.08575439453125,
-0.416748046875,
-0.0148162841796875,
-0.39013671875,
-0.5712890625,
-0.4013671875,
0.361328125,
0.33203125,
0.6025390625,
0.1661376953125,
-0.34521484375,
0.326416015625,
0.005481719970703125,
-0.07525634765625,
-0.417236328125,
-0.06884765625,
0.09197998046875,
-0.31298828125,
0.01898193359375,
0.453369140625,
0.25732421875,
0.517578125,
0.8505859375,
-0.157470703125,
0.50439453125,
0.4765625,
-0.6220703125,
1.23828125,
0.1591796875,
-0.9677734375,
-0.3212890625,
0.5419921875,
-0.302734375,
0.60693359375,
0.283447265625,
-0.64599609375,
-0.720703125,
-1.3251953125,
0.1162109375,
-0.422119140625,
-0.08013916015625,
-0.9453125,
-0.404296875,
-0.1898193359375,
0.209716796875,
-0.154541015625,
-0.61669921875,
-0.06756591796875,
-1.203125,
0.2015380859375,
-0.607421875,
-0.1319580078125,
-0.7587890625,
-0.253173828125,
-0.036346435546875,
1.08203125,
0.068115234375,
0.051483154296875,
0.344482421875,
-0.64013671875,
0.366455078125,
-0.1474609375,
-0.66015625,
-0.6318359375,
0.1356201171875,
0.19384765625,
-0.250732421875,
0.452880859375,
-0.189453125,
0.72998046875,
-0.8916015625,
-0.347412109375,
-0.27783203125,
-0.360107421875,
-0.08135986328125,
-0.329833984375,
0.94140625,
0.09869384765625,
-0.062347412109375,
-0.361083984375,
0.7080078125,
0.78173828125,
-0.269775390625,
-0.27099609375,
-0.67431640625,
-0.1943359375,
-1.1298828125,
0.41259765625,
-0.4365234375,
0.1634521484375,
-0.2841796875,
-0.049163818359375,
0.8271484375,
-0.396728515625,
0.471435546875,
1.22265625,
-0.01171875,
0.220947265625,
-0.6630859375,
0.74853515625,
0.234130859375,
-0.57666015625,
-0.037750244140625,
0.130859375,
-0.921875,
0.0926513671875,
-0.153564453125,
-0.8125,
-0.6669921875,
0.6083984375,
1.6064453125,
-0.50048828125,
0.67626953125,
-0.0634765625,
-1.19921875,
-0.85009765625,
0.77001953125,
0.1575927734375,
0.31201171875,
0.79296875,
-0.493896484375,
-0.411865234375,
0.12298583984375,
-0.11767578125,
-0.505859375,
-0.491455078125,
1.16796875,
0.0458984375,
-0.3310546875,
0.6748046875,
1.3349609375,
-1.1044921875,
-1.017578125,
0.10760498046875,
-0.1268310546875,
-0.338134765625,
-0.368408203125,
0.0880126953125,
0.61328125,
-0.65087890625,
0.38916015625,
0.1923828125,
0.0845947265625,
0.55859375,
0.1744384765625,
0.29150390625,
-0.28466796875,
0.327880859375,
1.0595703125,
-0.22412109375,
0.04107666015625,
-0.80419921875,
-0.427490234375,
-0.42431640625,
0.147216796875,
0.572265625,
-0.56884765625,
-0.07611083984375,
0.7978515625,
-0.0202484130859375,
0.6376953125,
-0.55322265625,
-0.37158203125,
0.5537109375,
-0.91650390625,
-0.296630859375,
0.1263427734375,
0.85498046875,
-0.1370849609375,
0.296630859375,
-0.7978515625,
-0.339599609375,
0.2578125,
0.2568359375,
-0.140625,
-0.9541015625,
-0.615234375,
-0.5625,
-0.59521484375,
-0.34228515625,
-0.99951171875,
-0.019683837890625,
0.40087890625,
0.045318603515625,
-0.296142578125,
0.12255859375,
0.415283203125,
-0.80517578125,
0.499267578125,
-0.6904296875,
0.441650390625,
-0.73828125,
-0.47021484375,
-0.5576171875,
-0.1964111328125,
-0.355224609375,
0.0767822265625,
-0.841796875,
0.47705078125,
-0.085693359375,
1.2021484375,
0.1207275390625,
0.0975341796875,
-0.17724609375,
-0.501953125,
0.21337890625,
0.3681640625,
-0.33642578125,
0.7265625,
0.482421875,
0.12091064453125,
0.12200927734375,
0.05230712890625,
-0.1751708984375,
-0.140869140625,
0.76708984375,
0.568359375,
-0.176513671875,
-0.0018978118896484375,
-0.351806640625,
0.09552001953125,
-0.9208984375,
0.201171875,
-0.320556640625,
0.10833740234375,
0.403076171875,
-0.11834716796875,
0.3671875,
1.1611328125,
-0.257568359375,
0.12335205078125,
-0.01702880859375,
-0.1331787109375,
0.55078125,
-0.1220703125,
0.51025390625,
0.319091796875,
0.226806640625,
-0.57861328125,
0.0285186767578125,
0.49755859375,
-0.2330322265625,
0.0540771484375,
0.021087646484375,
-0.58935546875,
-0.8994140625,
0.18017578125,
-0.096923828125,
0.11968994140625,
0.430419921875,
-0.767578125,
-0.30712890625,
-0.17529296875,
-0.56787109375,
0.1453857421875,
-1.0380859375,
-0.60693359375,
0.521484375,
-0.08270263671875,
-0.3935546875,
0.03436279296875,
-0.7470703125,
-0.1944580078125,
-0.0258026123046875,
0.59619140625,
-0.2261962890625,
0.2060546875,
-0.30126953125,
0.0628662109375,
-0.396484375,
-0.47119140625,
0.0004074573516845703,
0.36376953125,
-0.439697265625,
-0.464111328125,
0.0278778076171875,
1.2607421875,
0.5048828125,
-0.021026611328125,
-0.456787109375,
0.347412109375,
-0.2802734375,
-0.030303955078125,
-0.405517578125,
0.1734619140625,
0.1468505859375,
0.03472900390625,
-0.88134765625,
-0.2286376953125,
-0.43310546875,
0.5185546875,
0.1175537109375,
-0.224365234375,
-0.2333984375,
0.8056640625,
0.89208984375,
-0.493408203125,
0.6640625,
-0.1109619140625,
0.42333984375,
-0.11529541015625,
-0.0914306640625,
-0.005329132080078125,
0.7080078125,
0.62841796875,
0.59228515625,
-0.290283203125,
0.331787109375,
1.0732421875,
-0.3125,
-0.412109375,
0.10882568359375,
0.229736328125,
-0.2705078125,
-0.403564453125,
-0.04107666015625,
-0.419677734375,
-0.0657958984375,
-0.86669921875,
0.385498046875,
-0.31005859375,
-0.1954345703125,
-0.2259521484375,
-0.52001953125,
0.7958984375,
-0.49853515625,
-0.12213134765625,
-0.19970703125,
-0.3818359375,
0.390380859375,
0.5244140625,
0.357177734375,
0.03240966796875,
0.826171875,
0.279296875,
0.67822265625,
0.5849609375,
0.11956787109375,
0.409423828125,
-0.54248046875,
0.529296875,
0.27685546875,
-0.1795654296875,
-0.259765625,
-0.333740234375,
-1.103515625,
0.2431640625,
-0.7353515625,
-0.475341796875,
0.6982421875,
-0.56591796875,
0.20556640625,
-0.2174072265625,
0.341064453125,
-0.66259765625,
0.51171875,
0.364013671875,
-0.3212890625,
-0.62890625,
0.45068359375,
0.059906005859375,
0.429443359375,
-0.08837890625,
1.0947265625,
-0.053955078125,
1.68359375,
0.3466796875,
0.197265625,
-0.08221435546875,
0.040679931640625,
-0.1875,
-0.66259765625,
-0.305908203125,
-0.2900390625,
0.387939453125,
-0.5810546875,
-0.2095947265625,
0.0865478515625,
0.77099609375,
-0.468994140625,
-0.802734375,
-0.312744140625,
0.5517578125,
-0.68310546875,
0.10821533203125,
-0.048095703125,
0.1019287109375,
0.255126953125,
0.0244598388671875,
0.0171661376953125,
-0.364013671875,
-0.029144287109375,
-0.38037109375,
0.45263671875,
-0.20068359375,
-0.73974609375,
-0.357421875,
-0.79443359375,
-0.276611328125,
-0.1224365234375,
-0.603515625,
-0.97802734375,
0.2432861328125,
0.64990234375,
0.5419921875,
0.345947265625,
-0.31005859375,
-0.110107421875,
1.015625,
1.13671875,
-0.0894775390625,
0.71044921875,
0.59912109375,
-0.70068359375,
0.4462890625,
-0.4306640625,
0.6279296875,
-0.137451171875,
0.1524658203125,
-0.058258056640625,
0.370361328125,
-0.7119140625,
-1.044921875,
0.2388916015625,
0.486083984375,
0.45166015625,
-0.74267578125,
-1.2646484375,
-0.21435546875,
-1.099609375,
-0.283447265625,
-0.8603515625,
0.99658203125,
-0.0019989013671875,
-0.04608154296875,
0.056549072265625,
-1.0107421875,
4.48046875,
1.0595703125,
0.564453125,
0.4287109375,
0.0004329681396484375,
0.61474609375,
0.422607421875,
-0.49072265625,
-0.024383544921875,
-0.837890625,
0.1663818359375,
-0.411376953125,
0.044097900390625,
0.9072265625,
0.297119140625,
0.4580078125,
-0.403564453125,
0.1519775390625,
-0.035980224609375,
-0.77197265625,
-1,
0.436767578125,
0.09149169921875,
0.1824951171875,
-0.10443115234375,
0.5302734375,
0.37890625,
-0.34228515625,
-0.370849609375,
-0.62451171875,
0.346923828125,
-0.86474609375,
0.951171875,
-0.042724609375,
-0.1405029296875,
0.431640625,
-0.22314453125,
-0.67236328125,
-0.07867431640625,
0.2352294921875,
-0.054656982421875,
-0.0982666015625,
0.432861328125,
-0.56787109375,
-0.107666015625,
0.378173828125,
-0.14453125,
0.51220703125,
0.241455078125,
-0.77734375,
0.5869140625,
-0.2205810546875,
0.2734375,
-0.3994140625,
-0.75244140625,
0.29345703125,
0.197021484375,
-0.09173583984375,
-0.1705322265625,
0.4609375,
0.8076171875,
0.46630859375,
0.1475830078125,
0.609375,
-0.8974609375,
1.017578125,
0.07342529296875,
0.462158203125,
-0.58203125,
-0.294189453125,
-0.22216796875,
-0.28955078125,
-0.10076904296875,
-0.5185546875,
0.88037109375,
0.1939697265625,
-0.291259765625,
0.60400390625,
0.3515625,
-0.466064453125,
0.29931640625,
-0.288330078125,
-0.30078125,
-0.281494140625,
0.35498046875,
1.2431640625,
-0.2252197265625,
-0.1739501953125,
-0.57470703125,
0.55078125,
0.74267578125,
0.54345703125,
-0.0256500244140625,
-0.53515625,
-0.25537109375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Anfisa the monkey learns to type. She is yet unfamiliar with the "space" key and can only type in lower-case Latin letters. Having typed for a fairly long line, Anfisa understood that it would be great to divide what she has written into k lines not shorter than a and not longer than b, for the text to resemble human speech more. Help Anfisa.
Input
The first line contains three integers k, a and b (1 β€ k β€ 200, 1 β€ a β€ b β€ 200). The second line contains a sequence of lowercase Latin letters β the text typed by Anfisa. It is guaranteed that the given line is not empty and its length does not exceed 200 symbols.
Output
Print k lines, each of which contains no less than a and no more than b symbols β Anfisa's text divided into lines. It is not allowed to perform any changes in the text, such as: deleting or adding symbols, changing their order, etc. If the solution is not unique, print any of them. If there is no solution, print "No solution" (without quotes).
Examples
Input
3 2 5
abrakadabra
Output
ab
rakad
abra
Input
4 1 2
abrakadabra
Output
No solution
Tags: dp
Correct Solution:
```
#region Header
#!/usr/bin/env python3
# from typing import *
import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq
def input():
return sys.stdin.readline()[:-1]
# sys.setrecursionlimit(1000000)
#endregion
# _INPUT = """# paste here...
# """
# sys.stdin = io.StringIO(_INPUT)
def main():
k, a, b = map(int, input().split())
S = input()
N = len(S)
if N < a*k or b*k < N:
print('No solution')
else:
L = []
while N > 0:
v = math.floor(N/k)
L.append(v)
N -= v
k -= 1
a = 0
for l in L:
print(S[a:a+l])
a += l
if __name__ == '__main__':
main()
```
| 38,034
|
[
0.383544921875,
-0.0023441314697265625,
0.359375,
0.1722412109375,
-0.49072265625,
-0.50048828125,
0.1258544921875,
0.1451416015625,
-0.154052734375,
0.802734375,
0.450439453125,
0.359130859375,
-0.6025390625,
-0.58837890625,
-0.53173828125,
0.1741943359375,
-0.5751953125,
-1.021484375,
-0.1568603515625,
-0.44580078125,
0.00829315185546875,
-0.0068359375,
-1.4267578125,
-0.376708984375,
-0.342041015625,
1.08203125,
0.51953125,
0.280517578125,
1.013671875,
0.77783203125,
0.35498046875,
-0.4287109375,
0.62451171875,
-1.2978515625,
-0.470947265625,
-0.413818359375,
0.60302734375,
-0.46728515625,
-0.728515625,
-0.418212890625,
0.272216796875,
-0.2308349609375,
0.5634765625,
-0.9501953125,
-1.3271484375,
0.1614990234375,
-0.5888671875,
-0.177734375,
-0.228515625,
-0.35693359375,
-0.1146240234375,
0.010498046875,
0.615234375,
-0.144287109375,
-0.4169921875,
-0.1572265625,
0.1153564453125,
-0.261474609375,
-0.85302734375,
0.17529296875,
0.158447265625,
0.383056640625,
-0.2325439453125,
-0.2225341796875,
-0.06085205078125,
0.2159423828125,
-0.44580078125,
-0.2841796875,
-0.41650390625,
-0.50830078125,
-0.01540374755859375,
0.42724609375,
-0.281982421875,
-0.380615234375,
-0.5537109375,
-0.08087158203125,
-0.1077880859375,
-0.2109375,
-0.63623046875,
0.76953125,
0.10443115234375,
0.9296875,
0.005023956298828125,
0.75732421875,
-0.71826171875,
-0.939453125,
-0.054534912109375,
0.132568359375,
0.433349609375,
-0.117431640625,
-0.28857421875,
0.481201171875,
-0.546875,
0.525390625,
0.6904296875,
0.65478515625,
-0.220947265625,
0.28076171875,
0.29443359375,
0.1746826171875,
0.798828125,
1.021484375,
-0.50732421875,
0.7900390625,
-0.5341796875,
0.146484375,
0.2076416015625,
0.2271728515625,
-0.046661376953125,
-0.299560546875,
-0.2490234375,
-0.388916015625,
0.36328125,
0.25634765625,
-0.396728515625,
0.64404296875,
0.1805419921875,
0.2281494140625,
-0.85986328125,
0.0192108154296875,
0.07177734375,
0.373779296875,
0.396484375,
-0.311767578125,
-0.0017480850219726562,
-0.328857421875,
-0.58984375,
0.94189453125,
-0.269287109375,
-0.1732177734375,
0.513671875,
0.11138916015625,
0.1678466796875,
0.267578125,
-0.07470703125,
0.7294921875,
-0.124267578125,
0.5478515625,
0.54052734375,
-0.493896484375,
0.4423828125,
-0.0227203369140625,
0.159912109375,
1.2451171875,
0.513671875,
-0.060333251953125,
0.513671875,
0.5087890625,
-0.387451171875,
0.319091796875,
-0.87255859375,
0.43994140625,
0.279541015625,
0.372802734375,
-0.252685546875,
-0.087646484375,
-0.192138671875,
0.47509765625,
0.042938232421875,
0.51513671875,
-0.4150390625,
0.1248779296875,
-0.22021484375,
0.80078125,
-0.2042236328125,
0.62353515625,
-0.259521484375,
-0.365234375,
0.1622314453125,
-0.39599609375,
0.875,
-0.287841796875,
0.034149169921875,
0.6962890625,
0.3447265625,
0.91796875,
0.7177734375,
0.007610321044921875,
0.0428466796875,
0.44921875,
-0.1962890625,
0.33447265625,
0.3076171875,
0.63916015625,
0.57421875,
0.2127685546875,
0.416015625,
-0.29833984375,
-0.97705078125,
-0.5859375,
-0.08349609375,
0.57958984375,
-0.458740234375,
0.365478515625,
0.287841796875,
0.1541748046875,
-0.60986328125,
-0.35986328125,
0.361328125,
-0.75390625,
-0.4345703125,
0.9033203125,
-0.41455078125,
0.43798828125,
-0.478515625,
-0.482666015625,
0.210693359375,
1.2958984375,
-0.35546875,
-0.16357421875,
0.354736328125,
-0.09429931640625,
-0.392578125,
-0.259765625,
-0.064453125,
-0.6240234375,
-0.46484375,
0.72705078125,
-0.2265625,
0.2017822265625,
0.303466796875,
0.62890625,
0.45263671875,
0.69091796875,
-0.630859375,
-0.06756591796875,
0.62744140625,
1.177734375,
0.019866943359375,
0.27294921875,
0.00789642333984375,
0.74609375,
0.57861328125,
0.6904296875,
0.322021484375,
0.379150390625,
0.52685546875,
0.82861328125,
0.01079559326171875,
0.373779296875,
0.06134033203125,
0.357177734375,
0.34814453125,
0.67236328125,
0.2900390625,
0.260498046875,
-0.458740234375,
-0.0016870498657226562,
-0.284912109375,
0.12249755859375,
-0.268310546875,
0.765625,
0.189208984375,
0.263916015625,
-0.389404296875,
-0.27587890625,
0.51220703125,
0.86083984375,
-0.76416015625,
-0.7529296875,
-0.1307373046875,
-0.42529296875,
0.265625,
-0.03570556640625,
0.31591796875,
0.397705078125,
0.03009033203125,
0.357421875,
-0.263671875,
-0.51025390625,
-0.9345703125,
-0.494140625,
-0.93115234375,
-0.256591796875,
-0.446533203125,
-0.16552734375,
0.1998291015625,
-0.93212890625,
0.533203125,
-0.58935546875,
-0.275634765625,
-0.0416259765625,
-0.68017578125,
0.44384765625,
0.1788330078125,
0.8798828125,
-0.49169921875,
0.58984375,
0.291015625,
1.119140625,
-0.46142578125,
-0.284423828125,
-0.172119140625,
-0.84375,
0.87353515625,
-0.11749267578125,
0.1351318359375,
0.1597900390625,
-0.931640625,
-1.12109375,
-0.61181640625,
-0.366943359375,
-0.414794921875,
0.1761474609375,
-0.2366943359375,
0.74853515625,
0.2108154296875,
-0.587890625,
0.274169921875,
0.495361328125,
-0.58837890625,
0.436279296875,
0.1607666015625,
0.140625,
-0.8173828125,
1.001953125,
0.5029296875,
0.319580078125,
-0.54443359375,
-0.689453125,
-0.4111328125,
0.1439208984375,
0.272705078125,
-0.040557861328125,
-0.34619140625,
0.255615234375,
0.2958984375,
-1.099609375,
0.47705078125,
-0.86279296875,
-0.50732421875,
-0.456298828125,
-0.755859375,
0.87158203125,
0.94189453125,
0.2030029296875,
-0.3671875,
-0.338134765625,
-0.77001953125,
0.3642578125,
0.475341796875,
-0.8359375,
-0.041107177734375,
0.66015625,
-0.146728515625,
-0.326171875,
-0.05657958984375,
-0.28369140625,
-0.16796875,
-0.0465087890625,
0.0909423828125,
0.267333984375,
0.580078125,
0.26220703125,
0.498046875,
0.5546875,
-0.8271484375,
-0.10418701171875,
-0.0252838134765625,
0.734375,
0.2548828125,
0.57568359375,
0.66650390625,
-0.57763671875,
-0.43408203125,
-1.099609375,
0.39013671875,
0.1630859375,
0.6689453125,
-0.82373046875,
0.445068359375,
0.228515625,
-0.367919921875,
0.1956787109375,
-0.78173828125,
-0.08026123046875,
1.197265625,
-0.1341552734375,
0.9140625,
-0.7822265625,
0.263427734375,
-0.1942138671875,
-0.0032596588134765625,
0.59228515625,
0.25341796875,
0.259765625,
-0.46484375,
-0.08343505859375,
-0.025238037109375,
-0.580078125,
0.146728515625,
-0.308837890625,
0.38818359375,
-0.35693359375,
-0.443359375,
-0.888671875,
0.369140625,
0.96240234375,
0.443603515625,
0.195068359375,
0.166259765625,
-0.044891357421875,
0.99609375,
0.3564453125,
-0.4169921875,
0.252197265625,
-0.71337890625,
0.91650390625,
0.45361328125,
0.09234619140625,
-0.37939453125,
-0.69677734375,
0.34912109375,
0.12310791015625,
0.017608642578125,
-0.02215576171875,
-0.58837890625,
-0.08355712890625,
-0.062408447265625,
0.52783203125,
-0.83740234375,
-0.40673828125,
-0.1717529296875,
0.474365234375,
0.103515625,
-1.064453125,
0.2484130859375,
-0.63720703125,
0.89599609375,
0.266845703125,
-0.401611328125,
-0.0183868408203125,
-0.312255859375,
-0.6318359375,
-0.363525390625,
0.3330078125,
0.94140625,
-0.259521484375,
0.400390625,
-1.017578125,
0.366943359375,
0.5947265625,
-0.218994140625,
-0.006404876708984375,
0.290283203125,
0.2392578125,
-0.0859375,
0.794921875,
-0.317626953125,
-1.123046875,
0.66552734375,
-1.2431640625,
0.490234375,
-0.30712890625,
0.0185394287109375,
-0.3818359375,
-0.26708984375,
0.21875,
0.38427734375,
-0.316650390625,
-0.0872802734375,
0.1412353515625,
0.358642578125,
-0.64697265625,
-0.7841796875,
0.33984375,
-0.191162109375,
-0.2509765625,
0.51904296875,
0.03717041015625,
-0.488525390625,
0.382568359375,
0.630859375,
-0.460205078125,
0.36962890625,
-0.818359375,
0.34033203125,
-0.173095703125,
-0.6015625,
-0.347900390625,
-0.335693359375,
0.3427734375,
0.106689453125,
-0.62890625,
-0.0040130615234375,
-1.12109375,
-0.1070556640625,
-0.5380859375,
-0.75048828125,
0.3193359375,
0.5498046875,
-0.306640625,
0.0413818359375,
-0.381591796875,
-0.03253173828125,
-0.344482421875,
-0.5263671875,
-0.45361328125,
0.39404296875,
0.305908203125,
0.60791015625,
0.1951904296875,
-0.315673828125,
0.35546875,
-0.032379150390625,
-0.1273193359375,
-0.45556640625,
-0.1175537109375,
0.00458526611328125,
-0.330322265625,
-0.0262908935546875,
0.359375,
0.31640625,
0.397705078125,
0.82666015625,
-0.1177978515625,
0.487060546875,
0.415283203125,
-0.67529296875,
1.2158203125,
0.081298828125,
-0.98095703125,
-0.314697265625,
0.63818359375,
-0.234619140625,
0.5205078125,
0.2420654296875,
-0.57373046875,
-0.65869140625,
-1.2548828125,
0.223388671875,
-0.493408203125,
-0.059112548828125,
-0.97607421875,
-0.35302734375,
-0.182861328125,
0.2301025390625,
-0.122802734375,
-0.6064453125,
-0.062164306640625,
-1.0693359375,
0.2117919921875,
-0.60693359375,
-0.21728515625,
-0.84521484375,
-0.316162109375,
-0.10284423828125,
1.001953125,
0.1241455078125,
0.08636474609375,
0.388427734375,
-0.54345703125,
0.345703125,
-0.136474609375,
-0.67138671875,
-0.60986328125,
0.059234619140625,
0.1961669921875,
-0.404296875,
0.494140625,
-0.2379150390625,
0.6533203125,
-0.81640625,
-0.260009765625,
-0.3544921875,
-0.30029296875,
-0.1263427734375,
-0.2076416015625,
0.96533203125,
0.0263519287109375,
-0.049072265625,
-0.31982421875,
0.712890625,
0.75390625,
-0.271484375,
-0.36181640625,
-0.74951171875,
-0.2337646484375,
-1.1298828125,
0.48193359375,
-0.50146484375,
0.170654296875,
-0.369384765625,
-0.06414794921875,
0.86279296875,
-0.40234375,
0.3759765625,
1.177734375,
0.04962158203125,
0.203369140625,
-0.68603515625,
0.7587890625,
0.32177734375,
-0.6171875,
-0.0675048828125,
0.1983642578125,
-0.86767578125,
0.095458984375,
-0.123046875,
-0.8017578125,
-0.6259765625,
0.58251953125,
1.6044921875,
-0.49658203125,
0.73291015625,
-0.10174560546875,
-1.205078125,
-0.73583984375,
0.6943359375,
0.1556396484375,
0.379638671875,
0.88720703125,
-0.452880859375,
-0.366455078125,
0.1817626953125,
-0.0259857177734375,
-0.4658203125,
-0.50390625,
1.11328125,
-0.055328369140625,
-0.35302734375,
0.693359375,
1.361328125,
-1.1025390625,
-1.0625,
0.123046875,
-0.05047607421875,
-0.26806640625,
-0.315185546875,
0.085693359375,
0.61474609375,
-0.67431640625,
0.3310546875,
0.26123046875,
0.07269287109375,
0.5634765625,
0.184326171875,
0.2958984375,
-0.316162109375,
0.410888671875,
0.99951171875,
-0.190185546875,
-0.0185089111328125,
-0.7861328125,
-0.39306640625,
-0.4287109375,
0.0648193359375,
0.56005859375,
-0.71044921875,
-0.07794189453125,
0.736328125,
-0.0302276611328125,
0.61083984375,
-0.6220703125,
-0.28515625,
0.42431640625,
-0.8955078125,
-0.220458984375,
0.1502685546875,
0.7392578125,
-0.0298309326171875,
0.288330078125,
-0.7744140625,
-0.30126953125,
0.36669921875,
0.232177734375,
-0.22412109375,
-0.96728515625,
-0.578125,
-0.564453125,
-0.603515625,
-0.353271484375,
-1.0380859375,
-0.003353118896484375,
0.37255859375,
0.09429931640625,
-0.374755859375,
0.1341552734375,
0.31640625,
-0.73779296875,
0.472900390625,
-0.67236328125,
0.417236328125,
-0.67578125,
-0.343994140625,
-0.5458984375,
-0.218017578125,
-0.330078125,
0.0119781494140625,
-0.9375,
0.41455078125,
-0.01509857177734375,
1.2412109375,
0.0455322265625,
0.0703125,
-0.1605224609375,
-0.426025390625,
0.12646484375,
0.265380859375,
-0.330810546875,
0.76123046875,
0.453857421875,
0.16943359375,
0.149658203125,
0.0233154296875,
-0.2198486328125,
-0.1842041015625,
0.73193359375,
0.568359375,
-0.176025390625,
-0.0965576171875,
-0.30615234375,
0.2335205078125,
-0.8818359375,
0.303466796875,
-0.349365234375,
0.10205078125,
0.3798828125,
-0.191650390625,
0.42041015625,
1.1689453125,
-0.23046875,
0.12103271484375,
-0.0251007080078125,
-0.172607421875,
0.5546875,
-0.163330078125,
0.45947265625,
0.326904296875,
0.219482421875,
-0.5439453125,
-0.030853271484375,
0.564453125,
-0.2359619140625,
0.01165771484375,
0.0015611648559570312,
-0.57177734375,
-0.98779296875,
0.2626953125,
-0.01142120361328125,
0.129150390625,
0.484375,
-0.77490234375,
-0.279052734375,
-0.2276611328125,
-0.60888671875,
0.304931640625,
-0.88330078125,
-0.6650390625,
0.54931640625,
-0.11053466796875,
-0.5556640625,
0.03741455078125,
-0.724609375,
-0.12066650390625,
0.067626953125,
0.521484375,
-0.133544921875,
0.2281494140625,
-0.248291015625,
-0.050201416015625,
-0.4619140625,
-0.51416015625,
-0.04302978515625,
0.3681640625,
-0.443115234375,
-0.3935546875,
0.0860595703125,
1.322265625,
0.541015625,
-0.03265380859375,
-0.447998046875,
0.349365234375,
-0.236328125,
0.026611328125,
-0.515625,
0.138427734375,
0.064453125,
0.1065673828125,
-0.958984375,
-0.19287109375,
-0.38720703125,
0.50927734375,
0.10211181640625,
-0.2396240234375,
-0.2442626953125,
0.80029296875,
0.84326171875,
-0.372802734375,
0.693359375,
-0.06378173828125,
0.331787109375,
-0.129638671875,
-0.053375244140625,
-0.008056640625,
0.6943359375,
0.6123046875,
0.59130859375,
-0.247802734375,
0.362548828125,
1.0458984375,
-0.34814453125,
-0.448974609375,
-0.025726318359375,
0.1474609375,
-0.289306640625,
-0.386962890625,
-0.1258544921875,
-0.405517578125,
-0.08294677734375,
-0.888671875,
0.405517578125,
-0.27587890625,
-0.23291015625,
-0.2626953125,
-0.4658203125,
0.90771484375,
-0.513671875,
-0.194580078125,
-0.0953369140625,
-0.361572265625,
0.45458984375,
0.4521484375,
0.43701171875,
-0.0283660888671875,
0.85546875,
0.22509765625,
0.69189453125,
0.64599609375,
0.1043701171875,
0.35986328125,
-0.4951171875,
0.489013671875,
0.243896484375,
-0.160400390625,
-0.2034912109375,
-0.364013671875,
-1.1123046875,
0.1552734375,
-0.595703125,
-0.363037109375,
0.599609375,
-0.439208984375,
0.169921875,
-0.28662109375,
0.456298828125,
-0.65380859375,
0.54638671875,
0.38134765625,
-0.30908203125,
-0.6552734375,
0.46240234375,
0.1104736328125,
0.4140625,
-0.08660888671875,
1.12109375,
0.00470733642578125,
1.623046875,
0.3935546875,
0.17626953125,
-0.09674072265625,
0.06243896484375,
-0.31494140625,
-0.66064453125,
-0.3720703125,
-0.2315673828125,
0.4169921875,
-0.51953125,
-0.231689453125,
0.16455078125,
0.68408203125,
-0.421630859375,
-0.72900390625,
-0.293701171875,
0.52490234375,
-0.73828125,
0.180419921875,
-0.049591064453125,
0.08770751953125,
0.1771240234375,
0.08758544921875,
0.0723876953125,
-0.52685546875,
0.0258636474609375,
-0.368896484375,
0.4267578125,
-0.257568359375,
-0.71533203125,
-0.419189453125,
-0.8115234375,
-0.27783203125,
-0.029388427734375,
-0.58935546875,
-0.958984375,
0.290283203125,
0.603515625,
0.462158203125,
0.328857421875,
-0.372802734375,
-0.08544921875,
0.9970703125,
1.150390625,
-0.10064697265625,
0.64453125,
0.572265625,
-0.7197265625,
0.4482421875,
-0.431884765625,
0.56103515625,
-0.11859130859375,
0.21337890625,
-0.06329345703125,
0.30712890625,
-0.767578125,
-1.11328125,
0.238525390625,
0.39501953125,
0.42236328125,
-0.783203125,
-1.1728515625,
-0.267578125,
-1.0361328125,
-0.270751953125,
-0.798828125,
0.8876953125,
-0.0036029815673828125,
-0.05426025390625,
0.034027099609375,
-0.9951171875,
4.54296875,
1.091796875,
0.57861328125,
0.3505859375,
0.037445068359375,
0.5693359375,
0.422607421875,
-0.474609375,
-0.024658203125,
-0.861328125,
0.1141357421875,
-0.36865234375,
0.04937744140625,
0.85205078125,
0.30029296875,
0.411376953125,
-0.4072265625,
0.09344482421875,
-0.046173095703125,
-0.7255859375,
-0.97998046875,
0.383544921875,
0.066162109375,
0.0889892578125,
-0.0897216796875,
0.5302734375,
0.3603515625,
-0.416748046875,
-0.3876953125,
-0.63330078125,
0.3291015625,
-0.76318359375,
0.94482421875,
-0.050323486328125,
-0.1051025390625,
0.4482421875,
-0.285400390625,
-0.5390625,
-0.08062744140625,
0.29736328125,
-0.060791015625,
-0.0192718505859375,
0.34765625,
-0.59521484375,
-0.0362548828125,
0.4033203125,
-0.2440185546875,
0.466064453125,
0.288818359375,
-0.8056640625,
0.5185546875,
-0.2188720703125,
0.187255859375,
-0.343994140625,
-0.62353515625,
0.300048828125,
0.208984375,
-0.151123046875,
-0.343505859375,
0.472900390625,
0.69873046875,
0.403076171875,
0.1693115234375,
0.5947265625,
-0.9794921875,
1.080078125,
0.01467132568359375,
0.51611328125,
-0.65380859375,
-0.240478515625,
-0.314208984375,
-0.27734375,
-0.1607666015625,
-0.485595703125,
0.85986328125,
0.0740966796875,
-0.31396484375,
0.60107421875,
0.29541015625,
-0.47802734375,
0.2939453125,
-0.224853515625,
-0.28271484375,
-0.3203125,
0.341064453125,
1.1845703125,
-0.147705078125,
-0.244873046875,
-0.53955078125,
0.53125,
0.63818359375,
0.48681640625,
0.006694793701171875,
-0.607421875,
-0.29052734375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Anfisa the monkey learns to type. She is yet unfamiliar with the "space" key and can only type in lower-case Latin letters. Having typed for a fairly long line, Anfisa understood that it would be great to divide what she has written into k lines not shorter than a and not longer than b, for the text to resemble human speech more. Help Anfisa.
Input
The first line contains three integers k, a and b (1 β€ k β€ 200, 1 β€ a β€ b β€ 200). The second line contains a sequence of lowercase Latin letters β the text typed by Anfisa. It is guaranteed that the given line is not empty and its length does not exceed 200 symbols.
Output
Print k lines, each of which contains no less than a and no more than b symbols β Anfisa's text divided into lines. It is not allowed to perform any changes in the text, such as: deleting or adding symbols, changing their order, etc. If the solution is not unique, print any of them. If there is no solution, print "No solution" (without quotes).
Examples
Input
3 2 5
abrakadabra
Output
ab
rakad
abra
Input
4 1 2
abrakadabra
Output
No solution
Tags: dp
Correct Solution:
```
(k, a, b) = map(int, input().split())
min_len = k * a
max_len = k * b
line = input()
line_length = len(line)
print_index = 0
if line_length < min_len or line_length > max_len:
print("No solution")
else:
add_length = line_length - min_len
distance = b - a
print_to = 0
for item in range(0, k):
add_length -= distance
if add_length > 0:
print_to = print_index+a+distance
else:
print_to = print_index + a + distance + add_length
add_length = 0
print(line[print_index:print_to])
print_index = print_to
```
| 38,035
|
[
0.386474609375,
0.0216064453125,
0.38330078125,
0.2841796875,
-0.38232421875,
-0.54931640625,
0.1295166015625,
0.17724609375,
-0.208984375,
0.86474609375,
0.56201171875,
0.458984375,
-0.59228515625,
-0.62939453125,
-0.552734375,
0.30712890625,
-0.5947265625,
-0.98828125,
-0.07318115234375,
-0.379638671875,
-0.00783538818359375,
0.04412841796875,
-1.48046875,
-0.28857421875,
-0.342041015625,
1.09765625,
0.411865234375,
0.2078857421875,
1.0400390625,
0.74853515625,
0.385986328125,
-0.47900390625,
0.5791015625,
-1.5009765625,
-0.34619140625,
-0.3935546875,
0.57080078125,
-0.455810546875,
-0.7548828125,
-0.46435546875,
0.33056640625,
-0.2919921875,
0.59765625,
-0.92041015625,
-1.3759765625,
0.13623046875,
-0.5390625,
-0.228271484375,
-0.241455078125,
-0.4150390625,
-0.2047119140625,
-0.0024204254150390625,
0.640625,
-0.215576171875,
-0.39208984375,
-0.231201171875,
0.18408203125,
-0.17724609375,
-0.8564453125,
0.22607421875,
0.1942138671875,
0.46875,
-0.1907958984375,
-0.274169921875,
-0.0823974609375,
0.1885986328125,
-0.4560546875,
-0.357421875,
-0.37841796875,
-0.5009765625,
0.052215576171875,
0.50439453125,
-0.0653076171875,
-0.330810546875,
-0.529296875,
0.0036144256591796875,
0.003719329833984375,
-0.255126953125,
-0.638671875,
0.8232421875,
0.0772705078125,
0.888671875,
-0.042327880859375,
0.73291015625,
-0.68603515625,
-0.93359375,
-0.011566162109375,
0.1962890625,
0.4130859375,
-0.0902099609375,
-0.292724609375,
0.53466796875,
-0.447265625,
0.43212890625,
0.6826171875,
0.5458984375,
-0.1805419921875,
0.288330078125,
0.281982421875,
0.241943359375,
0.8310546875,
0.890625,
-0.408447265625,
0.7900390625,
-0.5029296875,
0.259765625,
0.08062744140625,
0.171875,
-0.08636474609375,
-0.318359375,
-0.2685546875,
-0.351318359375,
0.383544921875,
0.24951171875,
-0.454345703125,
0.623046875,
0.1353759765625,
0.297119140625,
-0.8896484375,
0.059356689453125,
0.2239990234375,
0.441650390625,
0.3828125,
-0.3427734375,
0.004638671875,
-0.369873046875,
-0.5478515625,
0.888671875,
-0.297607421875,
-0.15185546875,
0.452392578125,
0.11627197265625,
0.2347412109375,
0.28515625,
-0.01090240478515625,
0.7138671875,
-0.2073974609375,
0.556640625,
0.61328125,
-0.57080078125,
0.36376953125,
0.007511138916015625,
0.0291290283203125,
1.2275390625,
0.568359375,
-0.0110626220703125,
0.53369140625,
0.47119140625,
-0.517578125,
0.27099609375,
-0.93505859375,
0.63134765625,
0.2430419921875,
0.2939453125,
-0.28857421875,
-0.0931396484375,
-0.1766357421875,
0.35498046875,
0.1129150390625,
0.44189453125,
-0.353271484375,
0.04241943359375,
-0.330810546875,
0.82666015625,
-0.2177734375,
0.61181640625,
-0.32373046875,
-0.274658203125,
0.164794921875,
-0.398193359375,
0.79296875,
-0.352294921875,
-0.0819091796875,
0.736328125,
0.317138671875,
1.0009765625,
0.74169921875,
0.107666015625,
0.1324462890625,
0.400390625,
-0.0902099609375,
0.496826171875,
0.2015380859375,
0.685546875,
0.58154296875,
0.275146484375,
0.293212890625,
-0.266845703125,
-1.009765625,
-0.56494140625,
-0.08831787109375,
0.54931640625,
-0.434814453125,
0.46435546875,
0.32568359375,
0.0653076171875,
-0.56298828125,
-0.2158203125,
0.416015625,
-0.81396484375,
-0.4423828125,
0.92041015625,
-0.541015625,
0.58447265625,
-0.49658203125,
-0.4267578125,
0.166748046875,
1.4013671875,
-0.3779296875,
-0.1617431640625,
0.257568359375,
0.0197906494140625,
-0.3310546875,
-0.2235107421875,
-0.041717529296875,
-0.6279296875,
-0.439208984375,
0.7548828125,
-0.268310546875,
0.221435546875,
0.24658203125,
0.60498046875,
0.3447265625,
0.71630859375,
-0.5712890625,
-0.1595458984375,
0.68505859375,
1.1806640625,
-0.077880859375,
0.37060546875,
-0.05535888671875,
0.8076171875,
0.634765625,
0.61767578125,
0.12237548828125,
0.56640625,
0.46923828125,
0.78662109375,
0.00653076171875,
0.314453125,
0.1435546875,
0.286865234375,
0.351806640625,
0.6318359375,
0.38330078125,
0.2822265625,
-0.286865234375,
-0.034210205078125,
-0.26025390625,
0.139404296875,
-0.33251953125,
0.81787109375,
0.26708984375,
0.30322265625,
-0.30078125,
-0.208984375,
0.4521484375,
0.89990234375,
-0.728515625,
-0.8408203125,
-0.1134033203125,
-0.440185546875,
0.31640625,
-0.0523681640625,
0.395263671875,
0.412353515625,
0.0135040283203125,
0.330810546875,
-0.2357177734375,
-0.41748046875,
-0.896484375,
-0.53662109375,
-0.9365234375,
-0.22802734375,
-0.51513671875,
-0.1888427734375,
0.29345703125,
-0.923828125,
0.443115234375,
-0.63232421875,
-0.258544921875,
-0.1990966796875,
-0.7158203125,
0.400634765625,
0.15625,
0.83154296875,
-0.4814453125,
0.51416015625,
0.274169921875,
1.1689453125,
-0.43359375,
-0.219482421875,
-0.2088623046875,
-0.908203125,
0.806640625,
-0.1629638671875,
0.146484375,
0.1259765625,
-1.0419921875,
-1.189453125,
-0.53369140625,
-0.4716796875,
-0.4140625,
0.186279296875,
-0.296142578125,
0.7353515625,
0.2196044921875,
-0.60546875,
0.2449951171875,
0.556640625,
-0.677734375,
0.50341796875,
0.159423828125,
0.1893310546875,
-0.89990234375,
0.9794921875,
0.50146484375,
0.399169921875,
-0.51806640625,
-0.75732421875,
-0.428466796875,
0.280517578125,
0.279296875,
-0.1146240234375,
-0.28759765625,
0.288818359375,
0.32763671875,
-1.1279296875,
0.43115234375,
-0.89404296875,
-0.53564453125,
-0.53759765625,
-0.72412109375,
0.6943359375,
0.87255859375,
0.313232421875,
-0.35888671875,
-0.399169921875,
-0.75341796875,
0.38134765625,
0.425537109375,
-0.72509765625,
-0.07745361328125,
0.7724609375,
-0.1339111328125,
-0.21484375,
-0.06549072265625,
-0.2481689453125,
-0.173583984375,
0.0947265625,
0.046905517578125,
0.2222900390625,
0.6513671875,
0.2034912109375,
0.43408203125,
0.5498046875,
-0.91357421875,
-0.1329345703125,
-0.1563720703125,
0.76171875,
0.209228515625,
0.509765625,
0.73583984375,
-0.5908203125,
-0.482666015625,
-1.1240234375,
0.546875,
0.150390625,
0.68505859375,
-0.8837890625,
0.41845703125,
0.20556640625,
-0.3974609375,
0.1942138671875,
-0.76513671875,
-0.0533447265625,
1.248046875,
-0.0914306640625,
0.94189453125,
-0.828125,
0.1734619140625,
0.02166748046875,
0.10205078125,
0.6357421875,
0.36328125,
0.280029296875,
-0.465087890625,
-0.031402587890625,
0.05157470703125,
-0.544921875,
0.07373046875,
-0.356201171875,
0.330810546875,
-0.335693359375,
-0.473388671875,
-0.873046875,
0.31103515625,
0.93896484375,
0.420166015625,
0.0721435546875,
0.16650390625,
-0.11572265625,
1.03515625,
0.35791015625,
-0.3896484375,
0.1795654296875,
-0.7880859375,
0.95703125,
0.5224609375,
0.037933349609375,
-0.350341796875,
-0.6533203125,
0.317138671875,
0.06939697265625,
-0.018035888671875,
-0.09320068359375,
-0.5068359375,
-0.1456298828125,
-0.0002231597900390625,
0.47021484375,
-0.8046875,
-0.435546875,
-0.162109375,
0.37548828125,
0.2177734375,
-1.1435546875,
0.287109375,
-0.71337890625,
0.9697265625,
0.381591796875,
-0.421630859375,
-0.07000732421875,
-0.389892578125,
-0.72998046875,
-0.27001953125,
0.3642578125,
0.90234375,
-0.1480712890625,
0.43505859375,
-0.96630859375,
0.386474609375,
0.5205078125,
-0.2158203125,
0.0225982666015625,
0.2215576171875,
0.262939453125,
-0.08990478515625,
0.67236328125,
-0.31640625,
-1.1953125,
0.6318359375,
-1.21875,
0.378173828125,
-0.33837890625,
0.04693603515625,
-0.269287109375,
-0.2294921875,
0.2269287109375,
0.36962890625,
-0.1676025390625,
-0.035247802734375,
-0.044769287109375,
0.315185546875,
-0.62255859375,
-0.693359375,
0.35302734375,
-0.1131591796875,
-0.310791015625,
0.5625,
-0.014251708984375,
-0.44482421875,
0.33349609375,
0.6875,
-0.60498046875,
0.405029296875,
-0.79248046875,
0.296875,
-0.24853515625,
-0.67529296875,
-0.26806640625,
-0.41845703125,
0.33984375,
-0.016632080078125,
-0.62890625,
0.05450439453125,
-1.0439453125,
-0.1522216796875,
-0.5205078125,
-0.80224609375,
0.2646484375,
0.57275390625,
-0.38818359375,
0.0272064208984375,
-0.38720703125,
0.0110626220703125,
-0.30029296875,
-0.4990234375,
-0.44482421875,
0.395263671875,
0.256103515625,
0.52685546875,
0.14599609375,
-0.3525390625,
0.344970703125,
0.004467010498046875,
-0.061187744140625,
-0.394287109375,
-0.09088134765625,
0.09234619140625,
-0.369140625,
0.06927490234375,
0.4189453125,
0.27734375,
0.429443359375,
0.86083984375,
-0.07196044921875,
0.468017578125,
0.47216796875,
-0.671875,
1.0810546875,
0.039886474609375,
-0.96337890625,
-0.36376953125,
0.67333984375,
-0.269287109375,
0.478515625,
0.23193359375,
-0.69384765625,
-0.72412109375,
-1.240234375,
0.1865234375,
-0.39013671875,
-0.12249755859375,
-1.0478515625,
-0.4150390625,
-0.15625,
0.1988525390625,
-0.1727294921875,
-0.55419921875,
-0.0133514404296875,
-1.1572265625,
0.240966796875,
-0.63720703125,
-0.1983642578125,
-0.82763671875,
-0.288818359375,
0.06866455078125,
1.0654296875,
0.0970458984375,
0.049652099609375,
0.3623046875,
-0.54345703125,
0.3310546875,
-0.12103271484375,
-0.66064453125,
-0.630859375,
0.0975341796875,
0.261474609375,
-0.304443359375,
0.425537109375,
-0.142578125,
0.6416015625,
-0.82958984375,
-0.316650390625,
-0.37646484375,
-0.30224609375,
-0.1263427734375,
-0.30126953125,
0.984375,
0.054107666015625,
-0.0535888671875,
-0.2705078125,
0.6845703125,
0.7109375,
-0.296875,
-0.309326171875,
-0.71240234375,
-0.29296875,
-1.0400390625,
0.49072265625,
-0.490234375,
0.1407470703125,
-0.295654296875,
-0.10137939453125,
0.8857421875,
-0.334228515625,
0.428955078125,
1.2412109375,
-0.09039306640625,
0.189208984375,
-0.64453125,
0.79638671875,
0.177734375,
-0.59521484375,
-0.0279388427734375,
0.149658203125,
-0.810546875,
0.01131439208984375,
-0.2232666015625,
-0.87060546875,
-0.666015625,
0.6513671875,
1.568359375,
-0.447265625,
0.70751953125,
-0.12188720703125,
-1.232421875,
-0.84521484375,
0.7705078125,
0.1314697265625,
0.280029296875,
0.77783203125,
-0.494140625,
-0.377685546875,
0.0623779296875,
-0.12030029296875,
-0.5390625,
-0.447021484375,
1.0908203125,
0.03863525390625,
-0.365966796875,
0.7607421875,
1.455078125,
-1.1171875,
-1.0732421875,
0.0662841796875,
-0.12237548828125,
-0.269287109375,
-0.404052734375,
0.044403076171875,
0.66650390625,
-0.6298828125,
0.3720703125,
0.2054443359375,
0.0640869140625,
0.5859375,
0.2412109375,
0.322998046875,
-0.374267578125,
0.29296875,
1.0625,
-0.2459716796875,
0.0034580230712890625,
-0.73681640625,
-0.3701171875,
-0.463623046875,
0.1392822265625,
0.55615234375,
-0.6103515625,
-0.1185302734375,
0.76513671875,
0.023223876953125,
0.650390625,
-0.68798828125,
-0.2109375,
0.56884765625,
-0.95166015625,
-0.2293701171875,
0.09820556640625,
0.8662109375,
-0.06201171875,
0.260986328125,
-0.77490234375,
-0.388671875,
0.238037109375,
0.306396484375,
-0.192138671875,
-0.9443359375,
-0.54345703125,
-0.6240234375,
-0.5341796875,
-0.4013671875,
-0.98193359375,
0.01488494873046875,
0.390869140625,
0.1375732421875,
-0.388427734375,
0.168212890625,
0.450927734375,
-0.734375,
0.53369140625,
-0.7138671875,
0.413818359375,
-0.73974609375,
-0.412841796875,
-0.52294921875,
-0.222412109375,
-0.36279296875,
0.007480621337890625,
-0.87109375,
0.4267578125,
-0.03143310546875,
1.2666015625,
0.0625,
0.1492919921875,
-0.185546875,
-0.5166015625,
0.2322998046875,
0.34375,
-0.309326171875,
0.70703125,
0.44384765625,
0.1558837890625,
0.078125,
0.061492919921875,
-0.209716796875,
-0.08380126953125,
0.7607421875,
0.505859375,
-0.12042236328125,
-0.05908203125,
-0.26513671875,
0.192626953125,
-0.88623046875,
0.19189453125,
-0.383056640625,
0.061767578125,
0.344482421875,
-0.1385498046875,
0.41552734375,
1.1318359375,
-0.30908203125,
0.02166748046875,
-0.07342529296875,
-0.2125244140625,
0.572265625,
-0.12384033203125,
0.475341796875,
0.421875,
0.26806640625,
-0.673828125,
-0.0236053466796875,
0.572265625,
-0.353271484375,
0.07196044921875,
-0.0224761962890625,
-0.5986328125,
-0.92236328125,
0.192626953125,
-0.037567138671875,
0.077392578125,
0.41162109375,
-0.64599609375,
-0.381591796875,
-0.306884765625,
-0.5966796875,
0.233642578125,
-1.0673828125,
-0.64794921875,
0.56591796875,
-0.031707763671875,
-0.369873046875,
0.09130859375,
-0.716796875,
-0.02276611328125,
0.04443359375,
0.51416015625,
-0.1663818359375,
0.2188720703125,
-0.36767578125,
0.04071044921875,
-0.44921875,
-0.5654296875,
-0.0190582275390625,
0.309326171875,
-0.430419921875,
-0.45068359375,
0.06756591796875,
1.294921875,
0.5244140625,
-0.03289794921875,
-0.419921875,
0.38427734375,
-0.266845703125,
0.019500732421875,
-0.465087890625,
0.1357421875,
0.1763916015625,
0.10711669921875,
-0.97509765625,
-0.214111328125,
-0.3212890625,
0.485595703125,
0.106201171875,
-0.1783447265625,
-0.2349853515625,
0.75537109375,
0.87255859375,
-0.375732421875,
0.6044921875,
-0.1207275390625,
0.47021484375,
-0.1192626953125,
-0.021697998046875,
-0.0255584716796875,
0.72265625,
0.495849609375,
0.63720703125,
-0.2364501953125,
0.43408203125,
1.0244140625,
-0.3095703125,
-0.40966796875,
0.1571044921875,
0.20947265625,
-0.25390625,
-0.358154296875,
-0.019439697265625,
-0.41845703125,
0.022857666015625,
-0.79248046875,
0.406005859375,
-0.284423828125,
-0.259521484375,
-0.1727294921875,
-0.469970703125,
0.8623046875,
-0.432373046875,
-0.18115234375,
-0.1644287109375,
-0.377197265625,
0.340087890625,
0.4453125,
0.37939453125,
0.01540374755859375,
0.79736328125,
0.267822265625,
0.6845703125,
0.5859375,
0.0271453857421875,
0.378662109375,
-0.5322265625,
0.43994140625,
0.318603515625,
-0.1551513671875,
-0.261962890625,
-0.36865234375,
-0.97314453125,
0.2349853515625,
-0.6455078125,
-0.435546875,
0.650390625,
-0.576171875,
0.098876953125,
-0.28662109375,
0.32861328125,
-0.74951171875,
0.5625,
0.369140625,
-0.299072265625,
-0.61767578125,
0.48779296875,
0.001285552978515625,
0.383544921875,
0.0153961181640625,
1.1025390625,
0.01305389404296875,
1.677734375,
0.331787109375,
0.171630859375,
-0.1295166015625,
0.132080078125,
-0.292724609375,
-0.6728515625,
-0.404052734375,
-0.3466796875,
0.350341796875,
-0.64599609375,
-0.28662109375,
0.1048583984375,
0.751953125,
-0.5595703125,
-0.78271484375,
-0.26953125,
0.59130859375,
-0.71240234375,
0.0643310546875,
-0.07452392578125,
0.079345703125,
0.33740234375,
0.1011962890625,
0.058258056640625,
-0.391357421875,
0.014068603515625,
-0.378173828125,
0.3623046875,
-0.30615234375,
-0.7158203125,
-0.388671875,
-0.7978515625,
-0.296142578125,
-0.046722412109375,
-0.580078125,
-1.0302734375,
0.2091064453125,
0.572265625,
0.451171875,
0.348388671875,
-0.374755859375,
-0.1265869140625,
0.984375,
1.083984375,
-0.134521484375,
0.72314453125,
0.65576171875,
-0.611328125,
0.310302734375,
-0.4091796875,
0.54052734375,
-0.1070556640625,
0.314208984375,
-0.053009033203125,
0.34814453125,
-0.70166015625,
-1.1474609375,
0.2225341796875,
0.431396484375,
0.462646484375,
-0.8212890625,
-1.2841796875,
-0.320556640625,
-1.041015625,
-0.3115234375,
-0.86279296875,
0.96875,
0.00824737548828125,
-0.086669921875,
0.0615234375,
-1.0400390625,
4.5,
1.046875,
0.60546875,
0.404052734375,
0.047637939453125,
0.69091796875,
0.478759765625,
-0.50439453125,
-0.04498291015625,
-0.7392578125,
0.160400390625,
-0.36328125,
0.057952880859375,
0.8251953125,
0.345703125,
0.51318359375,
-0.399658203125,
0.0693359375,
-0.0292510986328125,
-0.74072265625,
-0.943359375,
0.3408203125,
0.12188720703125,
0.15087890625,
-0.026763916015625,
0.61181640625,
0.417724609375,
-0.437255859375,
-0.368408203125,
-0.64599609375,
0.2471923828125,
-0.88232421875,
0.9365234375,
-0.040069580078125,
-0.05682373046875,
0.422607421875,
-0.19140625,
-0.572265625,
-0.0007677078247070312,
0.258544921875,
-0.0091552734375,
-0.10858154296875,
0.37646484375,
-0.54248046875,
-0.03143310546875,
0.3671875,
-0.15869140625,
0.5009765625,
0.1854248046875,
-0.8427734375,
0.71826171875,
-0.253662109375,
0.203125,
-0.316650390625,
-0.79150390625,
0.34228515625,
0.1533203125,
-0.05194091796875,
-0.2017822265625,
0.50048828125,
0.75048828125,
0.465087890625,
0.11737060546875,
0.572265625,
-1.0087890625,
1.013671875,
0.05010986328125,
0.424560546875,
-0.583984375,
-0.2457275390625,
-0.2607421875,
-0.28369140625,
-0.1605224609375,
-0.4716796875,
0.89111328125,
0.139892578125,
-0.3154296875,
0.537109375,
0.305908203125,
-0.39453125,
0.253173828125,
-0.278564453125,
-0.27978515625,
-0.403564453125,
0.3173828125,
1.234375,
-0.261474609375,
-0.264892578125,
-0.6083984375,
0.5244140625,
0.73486328125,
0.53173828125,
-0.0784912109375,
-0.6025390625,
-0.2349853515625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Anfisa the monkey learns to type. She is yet unfamiliar with the "space" key and can only type in lower-case Latin letters. Having typed for a fairly long line, Anfisa understood that it would be great to divide what she has written into k lines not shorter than a and not longer than b, for the text to resemble human speech more. Help Anfisa.
Input
The first line contains three integers k, a and b (1 β€ k β€ 200, 1 β€ a β€ b β€ 200). The second line contains a sequence of lowercase Latin letters β the text typed by Anfisa. It is guaranteed that the given line is not empty and its length does not exceed 200 symbols.
Output
Print k lines, each of which contains no less than a and no more than b symbols β Anfisa's text divided into lines. It is not allowed to perform any changes in the text, such as: deleting or adding symbols, changing their order, etc. If the solution is not unique, print any of them. If there is no solution, print "No solution" (without quotes).
Examples
Input
3 2 5
abrakadabra
Output
ab
rakad
abra
Input
4 1 2
abrakadabra
Output
No solution
Tags: dp
Correct Solution:
```
k , n , m = map(int,input().split())
s = input()
l = len(s)
if l>k*m or l<n*k:
print("No solution")
exit()
lis=[n]*k
l-=((n)*(k))
c=0
ans=[]
while l!=0:
for j in range(k):
if l==0:
break
if lis[j]<m:
lis[j]+=1
l-=1
# print(lis,l)
if l==0:
break
c=0
#print(lis)
for j in range(k):
ss=s[c:lis[j]+c]
ans.append(ss)
c+=lis[j]
#print(ans)
for i in ans:
print(*i,sep='')
```
| 38,036
|
[
0.39208984375,
-0.0257110595703125,
0.41748046875,
0.208740234375,
-0.41357421875,
-0.58056640625,
0.0372314453125,
0.216796875,
-0.133544921875,
0.7998046875,
0.465576171875,
0.46337890625,
-0.483642578125,
-0.5966796875,
-0.58203125,
0.1754150390625,
-0.580078125,
-0.90087890625,
-0.085693359375,
-0.400146484375,
0.043060302734375,
0.059906005859375,
-1.517578125,
-0.301513671875,
-0.339111328125,
1.078125,
0.466796875,
0.2646484375,
1.0205078125,
0.85107421875,
0.363037109375,
-0.541015625,
0.63232421875,
-1.3857421875,
-0.5166015625,
-0.4287109375,
0.55712890625,
-0.466064453125,
-0.6875,
-0.53564453125,
0.31591796875,
-0.2239990234375,
0.609375,
-0.95263671875,
-1.3271484375,
0.0887451171875,
-0.5107421875,
-0.1358642578125,
-0.2039794921875,
-0.406005859375,
-0.1676025390625,
-0.0101470947265625,
0.65869140625,
-0.161376953125,
-0.37548828125,
-0.158203125,
0.21533203125,
-0.23681640625,
-0.8818359375,
0.256591796875,
0.2225341796875,
0.47314453125,
-0.282470703125,
-0.2352294921875,
-0.1068115234375,
0.170654296875,
-0.485595703125,
-0.251953125,
-0.322265625,
-0.48291015625,
-0.037567138671875,
0.495849609375,
-0.273681640625,
-0.3681640625,
-0.5732421875,
-0.0941162109375,
-0.16357421875,
-0.1678466796875,
-0.634765625,
0.69775390625,
0.044647216796875,
0.8896484375,
0.06353759765625,
0.7236328125,
-0.6083984375,
-0.943359375,
-0.005306243896484375,
0.204345703125,
0.4130859375,
-0.1375732421875,
-0.293701171875,
0.515625,
-0.52978515625,
0.448974609375,
0.6572265625,
0.611328125,
-0.1846923828125,
0.2135009765625,
0.341064453125,
0.1614990234375,
0.7509765625,
0.86328125,
-0.39697265625,
0.73974609375,
-0.5595703125,
0.1510009765625,
0.1705322265625,
0.229248046875,
-0.05224609375,
-0.3544921875,
-0.256591796875,
-0.3388671875,
0.37255859375,
0.260498046875,
-0.3935546875,
0.60205078125,
0.25048828125,
0.2626953125,
-0.8212890625,
0.04425048828125,
0.2086181640625,
0.47412109375,
0.40625,
-0.386962890625,
0.032196044921875,
-0.278564453125,
-0.5771484375,
0.96044921875,
-0.375244140625,
-0.208984375,
0.57861328125,
0.12359619140625,
0.224853515625,
0.29638671875,
-0.142333984375,
0.72314453125,
-0.11761474609375,
0.56787109375,
0.5595703125,
-0.56884765625,
0.413330078125,
-0.028594970703125,
0.11956787109375,
1.2392578125,
0.490478515625,
-0.019622802734375,
0.4931640625,
0.4736328125,
-0.4521484375,
0.2509765625,
-1.0068359375,
0.54150390625,
0.28662109375,
0.3291015625,
-0.359130859375,
-0.1572265625,
-0.154296875,
0.304931640625,
-0.016357421875,
0.517578125,
-0.284912109375,
0.036712646484375,
-0.31640625,
0.8486328125,
-0.1549072265625,
0.55810546875,
-0.33740234375,
-0.349853515625,
0.25634765625,
-0.44677734375,
0.8740234375,
-0.368408203125,
-0.0335693359375,
0.869140625,
0.322998046875,
0.9287109375,
0.7802734375,
0.08160400390625,
0.023651123046875,
0.4072265625,
-0.132568359375,
0.435791015625,
0.280029296875,
0.62841796875,
0.58544921875,
0.220703125,
0.384033203125,
-0.336181640625,
-1.0078125,
-0.5380859375,
-0.11492919921875,
0.64013671875,
-0.432861328125,
0.415771484375,
0.316162109375,
0.090087890625,
-0.65380859375,
-0.259521484375,
0.429443359375,
-0.82470703125,
-0.4169921875,
0.859375,
-0.479248046875,
0.51416015625,
-0.53125,
-0.492919921875,
0.2164306640625,
1.3681640625,
-0.352783203125,
-0.1751708984375,
0.2271728515625,
-0.054534912109375,
-0.412841796875,
-0.216796875,
0.00786590576171875,
-0.57080078125,
-0.4853515625,
0.681640625,
-0.322998046875,
0.155517578125,
0.22900390625,
0.5830078125,
0.419677734375,
0.681640625,
-0.55615234375,
-0.1632080078125,
0.6767578125,
1.15234375,
-0.0760498046875,
0.284423828125,
-0.066162109375,
0.8349609375,
0.60791015625,
0.69970703125,
0.249267578125,
0.59765625,
0.450439453125,
0.8173828125,
0.0457763671875,
0.38232421875,
0.06866455078125,
0.291015625,
0.431884765625,
0.7177734375,
0.2587890625,
0.253662109375,
-0.39990234375,
-0.00482177734375,
-0.294189453125,
0.06573486328125,
-0.185791015625,
0.79052734375,
0.328857421875,
0.346923828125,
-0.365966796875,
-0.1912841796875,
0.53271484375,
0.876953125,
-0.72265625,
-0.80419921875,
-0.1749267578125,
-0.412353515625,
0.41748046875,
-0.046295166015625,
0.24462890625,
0.38671875,
0.042816162109375,
0.346923828125,
-0.3095703125,
-0.55810546875,
-0.908203125,
-0.5498046875,
-0.9052734375,
-0.284423828125,
-0.438232421875,
-0.10845947265625,
0.2359619140625,
-0.99462890625,
0.51025390625,
-0.705078125,
-0.283203125,
-0.03271484375,
-0.71240234375,
0.456298828125,
0.23876953125,
0.80029296875,
-0.494384765625,
0.58642578125,
0.275634765625,
1.1083984375,
-0.3955078125,
-0.28759765625,
-0.1148681640625,
-0.8974609375,
0.77978515625,
-0.1883544921875,
0.06854248046875,
0.197998046875,
-1.0322265625,
-1.1337890625,
-0.53076171875,
-0.438720703125,
-0.424560546875,
0.25244140625,
-0.34033203125,
0.744140625,
0.2210693359375,
-0.646484375,
0.2476806640625,
0.57421875,
-0.58251953125,
0.51171875,
0.1533203125,
0.1395263671875,
-0.7802734375,
0.95458984375,
0.440673828125,
0.3603515625,
-0.50927734375,
-0.72412109375,
-0.43603515625,
0.06805419921875,
0.292724609375,
-0.0518798828125,
-0.337646484375,
0.265869140625,
0.292236328125,
-1.142578125,
0.4326171875,
-0.806640625,
-0.5068359375,
-0.400390625,
-0.67822265625,
0.78369140625,
0.95361328125,
0.291259765625,
-0.316650390625,
-0.390380859375,
-0.81689453125,
0.435546875,
0.36767578125,
-0.8134765625,
-0.037261962890625,
0.67919921875,
-0.08050537109375,
-0.30419921875,
-0.0312042236328125,
-0.2271728515625,
-0.1917724609375,
-0.0290069580078125,
0.0540771484375,
0.26904296875,
0.59375,
0.2109375,
0.497314453125,
0.59326171875,
-0.8515625,
-0.1612548828125,
-0.1363525390625,
0.73095703125,
0.1416015625,
0.6591796875,
0.7646484375,
-0.53955078125,
-0.415771484375,
-1.1015625,
0.45751953125,
0.22119140625,
0.64453125,
-0.9189453125,
0.390869140625,
0.211181640625,
-0.314697265625,
0.10516357421875,
-0.76708984375,
-0.1729736328125,
1.1953125,
-0.12432861328125,
1.0107421875,
-0.8330078125,
0.242919921875,
-0.1412353515625,
0.1329345703125,
0.6142578125,
0.2205810546875,
0.2666015625,
-0.408447265625,
-0.122314453125,
0.07159423828125,
-0.58935546875,
0.160400390625,
-0.45166015625,
0.35205078125,
-0.3515625,
-0.469482421875,
-0.90234375,
0.37451171875,
0.91650390625,
0.369384765625,
0.19873046875,
0.165283203125,
-0.197509765625,
1.0380859375,
0.311767578125,
-0.3828125,
0.2408447265625,
-0.7314453125,
0.89208984375,
0.47412109375,
-0.026336669921875,
-0.280517578125,
-0.5703125,
0.33837890625,
0.12353515625,
0.0015916824340820312,
-0.12890625,
-0.484130859375,
-0.09771728515625,
-0.072509765625,
0.492919921875,
-0.81201171875,
-0.52587890625,
-0.09515380859375,
0.441650390625,
0.1676025390625,
-1.07421875,
0.22607421875,
-0.677734375,
0.97802734375,
0.403076171875,
-0.367431640625,
0.0268707275390625,
-0.3779296875,
-0.75927734375,
-0.281982421875,
0.28857421875,
0.84521484375,
-0.236328125,
0.353271484375,
-0.935546875,
0.405029296875,
0.607421875,
-0.176025390625,
0.09332275390625,
0.348876953125,
0.118408203125,
-0.07733154296875,
0.6103515625,
-0.353515625,
-1.1181640625,
0.669921875,
-1.201171875,
0.41748046875,
-0.35107421875,
0.0025882720947265625,
-0.328369140625,
-0.198486328125,
0.1739501953125,
0.305419921875,
-0.314208984375,
-0.12384033203125,
0.1279296875,
0.362060546875,
-0.62255859375,
-0.6904296875,
0.341552734375,
-0.0487060546875,
-0.30029296875,
0.55712890625,
0.0015707015991210938,
-0.5185546875,
0.384521484375,
0.61669921875,
-0.54931640625,
0.47119140625,
-0.77587890625,
0.328857421875,
-0.1663818359375,
-0.6455078125,
-0.255126953125,
-0.421630859375,
0.298583984375,
-0.01029205322265625,
-0.64208984375,
0.0029621124267578125,
-1.00390625,
-0.061614990234375,
-0.56005859375,
-0.67333984375,
0.303955078125,
0.6318359375,
-0.27099609375,
-0.0009708404541015625,
-0.384765625,
0.040008544921875,
-0.429443359375,
-0.56591796875,
-0.447998046875,
0.360107421875,
0.28857421875,
0.6728515625,
0.1920166015625,
-0.302001953125,
0.344482421875,
-0.0452880859375,
0.033416748046875,
-0.37548828125,
-0.0985107421875,
0.0121307373046875,
-0.326416015625,
-0.00884246826171875,
0.384765625,
0.361328125,
0.459228515625,
0.88720703125,
-0.09161376953125,
0.48681640625,
0.379150390625,
-0.6962890625,
1.234375,
0.0928955078125,
-0.974609375,
-0.318359375,
0.55322265625,
-0.27978515625,
0.6064453125,
0.208251953125,
-0.5693359375,
-0.67236328125,
-1.298828125,
0.148681640625,
-0.39697265625,
-0.0794677734375,
-0.91162109375,
-0.318359375,
-0.2117919921875,
0.22802734375,
-0.1846923828125,
-0.5654296875,
-0.07684326171875,
-1.1376953125,
0.1444091796875,
-0.62646484375,
-0.2305908203125,
-0.83251953125,
-0.377685546875,
-0.057281494140625,
1,
0.16845703125,
0.00913238525390625,
0.35888671875,
-0.59228515625,
0.418701171875,
-0.1954345703125,
-0.61376953125,
-0.5966796875,
0.1480712890625,
0.24169921875,
-0.375,
0.54345703125,
-0.14013671875,
0.6318359375,
-0.8642578125,
-0.351318359375,
-0.296875,
-0.345703125,
-0.116943359375,
-0.306396484375,
1.001953125,
-0.00774383544921875,
-0.07855224609375,
-0.3701171875,
0.70166015625,
0.74658203125,
-0.308837890625,
-0.380859375,
-0.57470703125,
-0.137939453125,
-1.1318359375,
0.49462890625,
-0.495849609375,
0.198974609375,
-0.36376953125,
-0.07696533203125,
0.798828125,
-0.432373046875,
0.398193359375,
1.1162109375,
-0.0313720703125,
0.10296630859375,
-0.7275390625,
0.689453125,
0.326416015625,
-0.634765625,
-0.09027099609375,
0.1400146484375,
-0.8583984375,
0.10296630859375,
-0.10498046875,
-0.78076171875,
-0.65478515625,
0.6484375,
1.6416015625,
-0.450439453125,
0.67236328125,
-0.09869384765625,
-1.16015625,
-0.84033203125,
0.705078125,
0.058380126953125,
0.438232421875,
0.765625,
-0.4521484375,
-0.388671875,
0.13232421875,
-0.05218505859375,
-0.60498046875,
-0.50634765625,
1.0849609375,
-0.01068115234375,
-0.384033203125,
0.6416015625,
1.3623046875,
-1.0556640625,
-1.0361328125,
0.1259765625,
-0.09320068359375,
-0.273193359375,
-0.331298828125,
0.1009521484375,
0.60009765625,
-0.6708984375,
0.370361328125,
0.214599609375,
0.0548095703125,
0.552734375,
0.1365966796875,
0.29541015625,
-0.308837890625,
0.385986328125,
1.0517578125,
-0.2000732421875,
-0.00391387939453125,
-0.81884765625,
-0.392333984375,
-0.431884765625,
0.091552734375,
0.4775390625,
-0.59814453125,
-0.0882568359375,
0.87255859375,
0.02825927734375,
0.623046875,
-0.6748046875,
-0.29248046875,
0.464599609375,
-0.89501953125,
-0.215087890625,
0.06060791015625,
0.8427734375,
-0.06329345703125,
0.28271484375,
-0.85400390625,
-0.299560546875,
0.320556640625,
0.25146484375,
-0.14306640625,
-0.91796875,
-0.6484375,
-0.51318359375,
-0.6328125,
-0.336181640625,
-0.93115234375,
-0.01120758056640625,
0.385009765625,
0.1298828125,
-0.287109375,
0.151123046875,
0.362060546875,
-0.83935546875,
0.447021484375,
-0.67138671875,
0.5,
-0.77001953125,
-0.38427734375,
-0.48876953125,
-0.2083740234375,
-0.392333984375,
0.00366973876953125,
-0.86279296875,
0.4892578125,
0.01824951171875,
1.248046875,
0.11065673828125,
0.024749755859375,
-0.1318359375,
-0.480712890625,
0.22509765625,
0.308349609375,
-0.3251953125,
0.76123046875,
0.41455078125,
0.1507568359375,
0.136474609375,
-0.0162811279296875,
-0.2376708984375,
-0.1376953125,
0.77099609375,
0.53857421875,
-0.1129150390625,
0.0038585662841796875,
-0.259765625,
0.17431640625,
-0.9013671875,
0.2222900390625,
-0.333251953125,
0.159423828125,
0.423095703125,
-0.1290283203125,
0.385009765625,
1.166015625,
-0.16552734375,
0.09295654296875,
-0.09490966796875,
-0.12213134765625,
0.5693359375,
-0.06640625,
0.5048828125,
0.398193359375,
0.218994140625,
-0.6064453125,
0.052398681640625,
0.529296875,
-0.2509765625,
0.045562744140625,
0.041595458984375,
-0.59130859375,
-0.90869140625,
0.232421875,
-0.02984619140625,
0.1470947265625,
0.54248046875,
-0.7529296875,
-0.2783203125,
-0.185791015625,
-0.60986328125,
0.155517578125,
-1.0322265625,
-0.6337890625,
0.56298828125,
-0.0849609375,
-0.52294921875,
0.08416748046875,
-0.65771484375,
-0.1324462890625,
-0.049957275390625,
0.5791015625,
-0.271728515625,
0.16064453125,
-0.297119140625,
-0.04534912109375,
-0.451904296875,
-0.5732421875,
-0.00556182861328125,
0.32763671875,
-0.374755859375,
-0.454833984375,
0.11871337890625,
1.2919921875,
0.55712890625,
-0.01323699951171875,
-0.42333984375,
0.331787109375,
-0.251953125,
-0.0210723876953125,
-0.459228515625,
0.1744384765625,
0.1375732421875,
0.1168212890625,
-0.8984375,
-0.197265625,
-0.359619140625,
0.52392578125,
0.085693359375,
-0.22802734375,
-0.281494140625,
0.73681640625,
0.8916015625,
-0.5263671875,
0.69091796875,
-0.056060791015625,
0.45947265625,
-0.12042236328125,
0.0142974853515625,
-0.0321044921875,
0.70361328125,
0.59521484375,
0.65283203125,
-0.2274169921875,
0.336669921875,
1.0361328125,
-0.41845703125,
-0.38623046875,
0.04180908203125,
0.1966552734375,
-0.207763671875,
-0.478759765625,
-0.06842041015625,
-0.388427734375,
-0.0131988525390625,
-0.91650390625,
0.292236328125,
-0.326904296875,
-0.19189453125,
-0.24072265625,
-0.4755859375,
0.8857421875,
-0.64013671875,
-0.12939453125,
-0.1639404296875,
-0.325927734375,
0.401123046875,
0.51806640625,
0.406494140625,
-0.0117950439453125,
0.8740234375,
0.2415771484375,
0.67578125,
0.6162109375,
0.0653076171875,
0.373291015625,
-0.48046875,
0.50537109375,
0.24658203125,
-0.121337890625,
-0.21142578125,
-0.34814453125,
-1.013671875,
0.1597900390625,
-0.6669921875,
-0.41650390625,
0.701171875,
-0.4638671875,
0.122802734375,
-0.2457275390625,
0.3935546875,
-0.64453125,
0.50732421875,
0.398681640625,
-0.33544921875,
-0.63671875,
0.479248046875,
0.10614013671875,
0.43603515625,
-0.0814208984375,
1.078125,
0.048797607421875,
1.6328125,
0.38525390625,
0.1839599609375,
-0.1702880859375,
0.034210205078125,
-0.26708984375,
-0.6884765625,
-0.351318359375,
-0.31201171875,
0.38818359375,
-0.55712890625,
-0.12030029296875,
0.113525390625,
0.7060546875,
-0.489013671875,
-0.7744140625,
-0.266357421875,
0.607421875,
-0.740234375,
0.1663818359375,
-0.1341552734375,
0.07208251953125,
0.2454833984375,
0.06890869140625,
0.07843017578125,
-0.4404296875,
0.028350830078125,
-0.3486328125,
0.419921875,
-0.2462158203125,
-0.6767578125,
-0.41162109375,
-0.83154296875,
-0.351318359375,
-0.0789794921875,
-0.62646484375,
-0.97998046875,
0.249755859375,
0.59521484375,
0.486083984375,
0.380126953125,
-0.3984375,
-0.1357421875,
1.056640625,
1.0771484375,
-0.1632080078125,
0.6806640625,
0.58740234375,
-0.70556640625,
0.36328125,
-0.397705078125,
0.63720703125,
-0.1842041015625,
0.18505859375,
-0.00467681884765625,
0.361328125,
-0.7490234375,
-1.1015625,
0.28076171875,
0.43408203125,
0.45703125,
-0.763671875,
-1.1943359375,
-0.2685546875,
-1.05859375,
-0.281005859375,
-0.83837890625,
1.0087890625,
-0.022552490234375,
-0.1202392578125,
-0.023529052734375,
-0.96044921875,
4.52734375,
1.0537109375,
0.609375,
0.439697265625,
0.03460693359375,
0.51708984375,
0.478271484375,
-0.494873046875,
0.05859375,
-0.83447265625,
0.1495361328125,
-0.357177734375,
0.11224365234375,
0.86328125,
0.364501953125,
0.439697265625,
-0.392333984375,
0.1817626953125,
-0.0537109375,
-0.80419921875,
-1.0205078125,
0.39599609375,
0.0836181640625,
0.08221435546875,
-0.142333984375,
0.451416015625,
0.365478515625,
-0.411376953125,
-0.359375,
-0.6123046875,
0.30712890625,
-0.92041015625,
0.90380859375,
-0.0333251953125,
-0.1124267578125,
0.390869140625,
-0.25,
-0.54736328125,
-0.11334228515625,
0.270751953125,
-0.0982666015625,
-0.06231689453125,
0.3837890625,
-0.58056640625,
-0.1031494140625,
0.427978515625,
-0.177734375,
0.466796875,
0.1900634765625,
-0.75830078125,
0.56640625,
-0.221923828125,
0.17333984375,
-0.3779296875,
-0.72412109375,
0.25146484375,
0.2001953125,
-0.11798095703125,
-0.2008056640625,
0.454833984375,
0.72021484375,
0.416259765625,
0.07220458984375,
0.59765625,
-0.94091796875,
1.068359375,
0.056427001953125,
0.410888671875,
-0.5849609375,
-0.291259765625,
-0.232666015625,
-0.26611328125,
-0.21923828125,
-0.49267578125,
0.88623046875,
0.056060791015625,
-0.314697265625,
0.57666015625,
0.25927734375,
-0.5625,
0.257568359375,
-0.30029296875,
-0.35693359375,
-0.313720703125,
0.335693359375,
1.140625,
-0.187744140625,
-0.223876953125,
-0.505859375,
0.541015625,
0.7783203125,
0.459716796875,
-0.020233154296875,
-0.57275390625,
-0.2327880859375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Anfisa the monkey learns to type. She is yet unfamiliar with the "space" key and can only type in lower-case Latin letters. Having typed for a fairly long line, Anfisa understood that it would be great to divide what she has written into k lines not shorter than a and not longer than b, for the text to resemble human speech more. Help Anfisa.
Input
The first line contains three integers k, a and b (1 β€ k β€ 200, 1 β€ a β€ b β€ 200). The second line contains a sequence of lowercase Latin letters β the text typed by Anfisa. It is guaranteed that the given line is not empty and its length does not exceed 200 symbols.
Output
Print k lines, each of which contains no less than a and no more than b symbols β Anfisa's text divided into lines. It is not allowed to perform any changes in the text, such as: deleting or adding symbols, changing their order, etc. If the solution is not unique, print any of them. If there is no solution, print "No solution" (without quotes).
Examples
Input
3 2 5
abrakadabra
Output
ab
rakad
abra
Input
4 1 2
abrakadabra
Output
No solution
Tags: dp
Correct Solution:
```
k,a,b=map(int,input().split(' '))
s=input()
l=len(s)
if(l<k*a or l>k*b):
print("No solution")
else:
n1=l//k
n2=n1+1
n3=k-(l%k)
n4=l%k
cur=0
for i in range(n3):
print(s[cur:cur+n1])
cur+=n1
for i in range(n4):
print(s[cur:cur+n2])
cur+=n2
```
| 38,037
|
[
0.367919921875,
-0.0499267578125,
0.35791015625,
0.2081298828125,
-0.437255859375,
-0.58740234375,
0.0855712890625,
0.2059326171875,
-0.15869140625,
0.80322265625,
0.50634765625,
0.4853515625,
-0.497314453125,
-0.5693359375,
-0.485595703125,
0.18310546875,
-0.58251953125,
-0.98828125,
-0.10516357421875,
-0.42236328125,
-0.032073974609375,
0.07568359375,
-1.490234375,
-0.30615234375,
-0.3583984375,
1.1064453125,
0.420166015625,
0.1851806640625,
1.0146484375,
0.81103515625,
0.31005859375,
-0.572265625,
0.6279296875,
-1.3974609375,
-0.4189453125,
-0.4453125,
0.5634765625,
-0.405517578125,
-0.67578125,
-0.5166015625,
0.280029296875,
-0.238525390625,
0.57275390625,
-0.9619140625,
-1.369140625,
0.08935546875,
-0.59375,
-0.1336669921875,
-0.26025390625,
-0.458984375,
-0.1279296875,
0.00542449951171875,
0.6279296875,
-0.126708984375,
-0.4033203125,
-0.1099853515625,
0.169921875,
-0.26171875,
-0.9267578125,
0.18603515625,
0.21484375,
0.4697265625,
-0.1810302734375,
-0.2442626953125,
-0.09686279296875,
0.1942138671875,
-0.5283203125,
-0.310546875,
-0.37548828125,
-0.48828125,
-0.055999755859375,
0.48388671875,
-0.201416015625,
-0.326416015625,
-0.615234375,
-0.11077880859375,
-0.16259765625,
-0.1810302734375,
-0.71142578125,
0.75390625,
0.0245819091796875,
0.8740234375,
0.022308349609375,
0.72216796875,
-0.6904296875,
-0.96826171875,
0.0328369140625,
0.226806640625,
0.47607421875,
-0.1343994140625,
-0.287109375,
0.52001953125,
-0.478515625,
0.478271484375,
0.6767578125,
0.625,
-0.1876220703125,
0.2568359375,
0.344482421875,
0.27197265625,
0.82421875,
0.88525390625,
-0.385498046875,
0.79736328125,
-0.5126953125,
0.0869140625,
0.11529541015625,
0.2142333984375,
-0.07623291015625,
-0.34814453125,
-0.249267578125,
-0.374267578125,
0.386474609375,
0.2822265625,
-0.39404296875,
0.58984375,
0.1715087890625,
0.2413330078125,
-0.81884765625,
-0.00040435791015625,
0.140869140625,
0.422607421875,
0.410888671875,
-0.347412109375,
-0.033416748046875,
-0.282958984375,
-0.630859375,
0.95361328125,
-0.281005859375,
-0.1630859375,
0.517578125,
0.130859375,
0.1724853515625,
0.2476806640625,
-0.1077880859375,
0.701171875,
-0.10009765625,
0.58349609375,
0.53955078125,
-0.53076171875,
0.429931640625,
-0.0193634033203125,
0.127197265625,
1.236328125,
0.48974609375,
0.0122528076171875,
0.568359375,
0.5087890625,
-0.464111328125,
0.296142578125,
-0.939453125,
0.5537109375,
0.262939453125,
0.361328125,
-0.328125,
-0.080810546875,
-0.152099609375,
0.350341796875,
0.0181884765625,
0.47705078125,
-0.336181640625,
0.08148193359375,
-0.29443359375,
0.88818359375,
-0.16064453125,
0.64794921875,
-0.2802734375,
-0.367431640625,
0.2259521484375,
-0.450439453125,
0.85595703125,
-0.323486328125,
-0.037384033203125,
0.80908203125,
0.337890625,
0.94140625,
0.79736328125,
0.07977294921875,
0.06805419921875,
0.4228515625,
-0.1392822265625,
0.413330078125,
0.346435546875,
0.71435546875,
0.59716796875,
0.280029296875,
0.41015625,
-0.30224609375,
-0.98095703125,
-0.51123046875,
-0.1287841796875,
0.578125,
-0.45751953125,
0.46826171875,
0.360107421875,
0.09320068359375,
-0.60693359375,
-0.33349609375,
0.431640625,
-0.80859375,
-0.4580078125,
0.8935546875,
-0.53564453125,
0.5205078125,
-0.5380859375,
-0.52294921875,
0.1436767578125,
1.34765625,
-0.3349609375,
-0.1680908203125,
0.2396240234375,
-0.045074462890625,
-0.38623046875,
-0.267578125,
0.0311279296875,
-0.59521484375,
-0.4404296875,
0.7119140625,
-0.287109375,
0.184326171875,
0.2462158203125,
0.62109375,
0.42138671875,
0.71923828125,
-0.580078125,
-0.129150390625,
0.66943359375,
1.15234375,
-0.07232666015625,
0.3203125,
0.01219940185546875,
0.818359375,
0.63916015625,
0.65380859375,
0.229736328125,
0.5322265625,
0.494384765625,
0.796875,
0.0882568359375,
0.347900390625,
0.040740966796875,
0.29150390625,
0.38818359375,
0.6513671875,
0.28076171875,
0.224609375,
-0.40966796875,
0.08367919921875,
-0.290283203125,
0.154296875,
-0.26708984375,
0.71435546875,
0.2406005859375,
0.32861328125,
-0.358642578125,
-0.1778564453125,
0.499755859375,
0.90185546875,
-0.7275390625,
-0.77001953125,
-0.1514892578125,
-0.436279296875,
0.383544921875,
-0.0513916015625,
0.3349609375,
0.367919921875,
0.1129150390625,
0.318603515625,
-0.267333984375,
-0.52587890625,
-0.9248046875,
-0.56591796875,
-0.9267578125,
-0.271484375,
-0.4873046875,
-0.127197265625,
0.2022705078125,
-0.93701171875,
0.45068359375,
-0.6298828125,
-0.2705078125,
-0.032379150390625,
-0.68017578125,
0.50048828125,
0.221435546875,
0.83056640625,
-0.50048828125,
0.53271484375,
0.29443359375,
1.0908203125,
-0.44873046875,
-0.293212890625,
-0.126220703125,
-0.9072265625,
0.765625,
-0.1639404296875,
0.0721435546875,
0.15625,
-1.01953125,
-1.142578125,
-0.55908203125,
-0.356689453125,
-0.383056640625,
0.1844482421875,
-0.323974609375,
0.72119140625,
0.236572265625,
-0.6708984375,
0.2333984375,
0.57373046875,
-0.5830078125,
0.5322265625,
0.2108154296875,
0.129150390625,
-0.82421875,
1.013671875,
0.497314453125,
0.364013671875,
-0.5595703125,
-0.73095703125,
-0.43896484375,
0.1451416015625,
0.308837890625,
-0.14599609375,
-0.384521484375,
0.26904296875,
0.276123046875,
-1.1220703125,
0.427490234375,
-0.81787109375,
-0.57373046875,
-0.435791015625,
-0.7607421875,
0.78759765625,
0.9521484375,
0.260009765625,
-0.2900390625,
-0.37841796875,
-0.8017578125,
0.347412109375,
0.347412109375,
-0.80322265625,
-0.023681640625,
0.69970703125,
-0.1361083984375,
-0.2493896484375,
-0.078369140625,
-0.2418212890625,
-0.206298828125,
0.020172119140625,
0.0172119140625,
0.244384765625,
0.59521484375,
0.21484375,
0.53515625,
0.5849609375,
-0.8857421875,
-0.1234130859375,
-0.12139892578125,
0.71533203125,
0.173828125,
0.623046875,
0.7216796875,
-0.5673828125,
-0.39794921875,
-1.1025390625,
0.450439453125,
0.231689453125,
0.65234375,
-0.865234375,
0.3642578125,
0.229736328125,
-0.363525390625,
0.1956787109375,
-0.796875,
-0.1734619140625,
1.220703125,
-0.1419677734375,
0.9697265625,
-0.84375,
0.2340087890625,
-0.138427734375,
0.10174560546875,
0.60205078125,
0.250732421875,
0.2880859375,
-0.422119140625,
-0.06390380859375,
0.07196044921875,
-0.5712890625,
0.167724609375,
-0.402099609375,
0.415771484375,
-0.341552734375,
-0.498046875,
-0.8857421875,
0.400390625,
0.904296875,
0.362060546875,
0.1611328125,
0.1871337890625,
-0.111328125,
1.0771484375,
0.37109375,
-0.34619140625,
0.21533203125,
-0.7333984375,
0.85888671875,
0.4970703125,
0.0010042190551757812,
-0.35595703125,
-0.658203125,
0.333740234375,
0.09942626953125,
0.01322174072265625,
-0.10986328125,
-0.48974609375,
-0.047027587890625,
-0.05157470703125,
0.5419921875,
-0.86865234375,
-0.470947265625,
-0.1605224609375,
0.419921875,
0.1588134765625,
-1.11328125,
0.24072265625,
-0.6494140625,
0.9775390625,
0.401123046875,
-0.35498046875,
-0.0015783309936523438,
-0.36376953125,
-0.71240234375,
-0.302734375,
0.30859375,
0.8544921875,
-0.2076416015625,
0.391845703125,
-0.958984375,
0.414306640625,
0.59814453125,
-0.19775390625,
0.08123779296875,
0.261474609375,
0.154052734375,
-0.1116943359375,
0.72998046875,
-0.33740234375,
-1.142578125,
0.67431640625,
-1.267578125,
0.372314453125,
-0.294677734375,
0.0244293212890625,
-0.338623046875,
-0.2032470703125,
0.185302734375,
0.31103515625,
-0.246337890625,
-0.1085205078125,
0.08544921875,
0.3173828125,
-0.65283203125,
-0.7880859375,
0.330322265625,
-0.08526611328125,
-0.275634765625,
0.5244140625,
0.01052093505859375,
-0.52294921875,
0.3271484375,
0.595703125,
-0.56396484375,
0.399169921875,
-0.7861328125,
0.313720703125,
-0.2003173828125,
-0.67236328125,
-0.25341796875,
-0.42919921875,
0.38330078125,
0.0241546630859375,
-0.62060546875,
0.008270263671875,
-1.05078125,
-0.0692138671875,
-0.544921875,
-0.75390625,
0.25244140625,
0.6279296875,
-0.306640625,
0.0018205642700195312,
-0.401123046875,
0.035858154296875,
-0.34375,
-0.5576171875,
-0.392578125,
0.3720703125,
0.331787109375,
0.67138671875,
0.1949462890625,
-0.329833984375,
0.33837890625,
0.0175018310546875,
0.0012798309326171875,
-0.44287109375,
-0.058013916015625,
0.05645751953125,
-0.322021484375,
-0.0340576171875,
0.44580078125,
0.310546875,
0.427978515625,
0.84326171875,
-0.10186767578125,
0.53564453125,
0.372314453125,
-0.69873046875,
1.2158203125,
0.057830810546875,
-1.0576171875,
-0.374267578125,
0.546875,
-0.2119140625,
0.56982421875,
0.25439453125,
-0.54296875,
-0.67724609375,
-1.3525390625,
0.13671875,
-0.5078125,
-0.052978515625,
-0.9638671875,
-0.365234375,
-0.173583984375,
0.205322265625,
-0.1077880859375,
-0.59765625,
-0.0413818359375,
-1.208984375,
0.1871337890625,
-0.63232421875,
-0.2027587890625,
-0.82373046875,
-0.335205078125,
-0.06573486328125,
0.98974609375,
0.1446533203125,
0.020477294921875,
0.401611328125,
-0.5673828125,
0.374267578125,
-0.1329345703125,
-0.67138671875,
-0.6279296875,
0.1395263671875,
0.2196044921875,
-0.417236328125,
0.4638671875,
-0.2156982421875,
0.68701171875,
-0.84521484375,
-0.3330078125,
-0.312744140625,
-0.333251953125,
-0.0823974609375,
-0.287109375,
0.96435546875,
0.0712890625,
-0.01349639892578125,
-0.384033203125,
0.6943359375,
0.7373046875,
-0.32080078125,
-0.365966796875,
-0.6826171875,
-0.19189453125,
-1.115234375,
0.50146484375,
-0.51904296875,
0.2005615234375,
-0.31591796875,
-0.08184814453125,
0.8203125,
-0.3544921875,
0.417724609375,
1.1630859375,
-0.0194091796875,
0.169189453125,
-0.69921875,
0.775390625,
0.286865234375,
-0.5537109375,
-0.0830078125,
0.12841796875,
-0.83349609375,
0.040252685546875,
-0.1397705078125,
-0.76806640625,
-0.63916015625,
0.61474609375,
1.6123046875,
-0.48828125,
0.74365234375,
-0.139404296875,
-1.2373046875,
-0.83349609375,
0.7177734375,
0.035430908203125,
0.40283203125,
0.8203125,
-0.41943359375,
-0.43359375,
0.1324462890625,
-0.01983642578125,
-0.54541015625,
-0.496826171875,
1.087890625,
0.0089263916015625,
-0.365234375,
0.69677734375,
1.3896484375,
-1.0556640625,
-1.0966796875,
0.09942626953125,
-0.1351318359375,
-0.29150390625,
-0.309814453125,
0.1688232421875,
0.64501953125,
-0.68359375,
0.34521484375,
0.2391357421875,
0.07623291015625,
0.578125,
0.1856689453125,
0.322509765625,
-0.357421875,
0.378173828125,
0.9921875,
-0.22998046875,
-0.035736083984375,
-0.75927734375,
-0.369873046875,
-0.37841796875,
0.09423828125,
0.5263671875,
-0.59375,
-0.138427734375,
0.81787109375,
-0.0141754150390625,
0.61669921875,
-0.6748046875,
-0.289306640625,
0.388427734375,
-0.9423828125,
-0.2332763671875,
0.11016845703125,
0.77197265625,
-0.08685302734375,
0.24267578125,
-0.76513671875,
-0.325439453125,
0.341552734375,
0.3017578125,
-0.216552734375,
-0.97119140625,
-0.6279296875,
-0.572265625,
-0.6025390625,
-0.363525390625,
-0.94482421875,
-0.004364013671875,
0.38232421875,
0.09979248046875,
-0.35009765625,
0.17333984375,
0.35595703125,
-0.78955078125,
0.51416015625,
-0.67919921875,
0.428955078125,
-0.76416015625,
-0.378662109375,
-0.50732421875,
-0.238525390625,
-0.324462890625,
0.00746917724609375,
-0.90234375,
0.47900390625,
-0.0248870849609375,
1.25,
0.06634521484375,
0.06866455078125,
-0.1624755859375,
-0.505859375,
0.1715087890625,
0.3232421875,
-0.3798828125,
0.77880859375,
0.408447265625,
0.1873779296875,
0.1153564453125,
0.02679443359375,
-0.2081298828125,
-0.1439208984375,
0.7783203125,
0.54052734375,
-0.165771484375,
-0.01157379150390625,
-0.280029296875,
0.1522216796875,
-0.904296875,
0.221923828125,
-0.34912109375,
0.1195068359375,
0.335205078125,
-0.129638671875,
0.3583984375,
1.123046875,
-0.2626953125,
0.1834716796875,
-0.06494140625,
-0.2037353515625,
0.5400390625,
-0.11895751953125,
0.49462890625,
0.39697265625,
0.183349609375,
-0.5576171875,
0.0191497802734375,
0.57568359375,
-0.251953125,
0.0382080078125,
0.025543212890625,
-0.62890625,
-0.9326171875,
0.229248046875,
-0.037994384765625,
0.09100341796875,
0.46240234375,
-0.77734375,
-0.261474609375,
-0.1842041015625,
-0.62158203125,
0.2392578125,
-1.044921875,
-0.6630859375,
0.6748046875,
-0.0771484375,
-0.463623046875,
0.06939697265625,
-0.73193359375,
-0.0667724609375,
0.013702392578125,
0.6337890625,
-0.226318359375,
0.1767578125,
-0.30517578125,
0.02880859375,
-0.460205078125,
-0.533203125,
-0.05438232421875,
0.380615234375,
-0.394775390625,
-0.45751953125,
0.046722412109375,
1.2900390625,
0.54541015625,
0.00775146484375,
-0.40576171875,
0.4482421875,
-0.2462158203125,
-0.0302276611328125,
-0.470947265625,
0.2076416015625,
0.090576171875,
0.125244140625,
-0.88134765625,
-0.1624755859375,
-0.4228515625,
0.5693359375,
0.11334228515625,
-0.2269287109375,
-0.2333984375,
0.767578125,
0.82470703125,
-0.486328125,
0.64794921875,
-0.0728759765625,
0.40625,
-0.164306640625,
-0.0623779296875,
0.0158538818359375,
0.69677734375,
0.548828125,
0.66943359375,
-0.2454833984375,
0.40576171875,
1.072265625,
-0.38134765625,
-0.395263671875,
0.047698974609375,
0.1959228515625,
-0.22412109375,
-0.4052734375,
-0.0562744140625,
-0.39599609375,
-0.008392333984375,
-0.86083984375,
0.376953125,
-0.314453125,
-0.2156982421875,
-0.1728515625,
-0.489501953125,
0.8740234375,
-0.5341796875,
-0.110107421875,
-0.15185546875,
-0.334716796875,
0.431640625,
0.48095703125,
0.403564453125,
-0.031524658203125,
0.85546875,
0.291748046875,
0.70703125,
0.654296875,
0.0228424072265625,
0.3662109375,
-0.52294921875,
0.496826171875,
0.34716796875,
-0.1466064453125,
-0.21630859375,
-0.349365234375,
-1.0546875,
0.2095947265625,
-0.650390625,
-0.421142578125,
0.67626953125,
-0.48779296875,
0.11749267578125,
-0.27734375,
0.39453125,
-0.6748046875,
0.5390625,
0.354736328125,
-0.361572265625,
-0.6181640625,
0.4580078125,
0.1103515625,
0.3798828125,
-0.0440673828125,
1.14453125,
-0.024658203125,
1.6875,
0.389892578125,
0.1434326171875,
-0.1531982421875,
0.05657958984375,
-0.2218017578125,
-0.6103515625,
-0.351318359375,
-0.322998046875,
0.332763671875,
-0.5419921875,
-0.2218017578125,
0.109130859375,
0.6728515625,
-0.436279296875,
-0.8076171875,
-0.296142578125,
0.58740234375,
-0.71484375,
0.1630859375,
-0.0738525390625,
0.04351806640625,
0.23095703125,
0.12255859375,
0.07476806640625,
-0.440673828125,
-0.0158233642578125,
-0.3876953125,
0.380615234375,
-0.251953125,
-0.73046875,
-0.396728515625,
-0.84423828125,
-0.287841796875,
-0.031280517578125,
-0.59326171875,
-0.9853515625,
0.279541015625,
0.61669921875,
0.453369140625,
0.36865234375,
-0.270263671875,
-0.1309814453125,
0.9892578125,
1.126953125,
-0.1309814453125,
0.6591796875,
0.5888671875,
-0.73974609375,
0.422607421875,
-0.49609375,
0.638671875,
-0.1395263671875,
0.21728515625,
-0.0694580078125,
0.349853515625,
-0.7177734375,
-1.0771484375,
0.24560546875,
0.4365234375,
0.447265625,
-0.73291015625,
-1.255859375,
-0.2423095703125,
-1.0537109375,
-0.273193359375,
-0.84765625,
0.9599609375,
-0.04376220703125,
-0.08660888671875,
0.022247314453125,
-1.021484375,
4.50390625,
1.0908203125,
0.58935546875,
0.38037109375,
0.05780029296875,
0.490966796875,
0.46875,
-0.5078125,
0.0239105224609375,
-0.79736328125,
0.12030029296875,
-0.375244140625,
0.03253173828125,
0.8525390625,
0.329345703125,
0.436767578125,
-0.42626953125,
0.1591796875,
-0.038665771484375,
-0.6953125,
-1.0087890625,
0.409912109375,
0.055572509765625,
0.06988525390625,
-0.10272216796875,
0.515625,
0.4033203125,
-0.406982421875,
-0.384033203125,
-0.60888671875,
0.337158203125,
-0.8828125,
0.94970703125,
-0.0401611328125,
-0.10009765625,
0.39892578125,
-0.260009765625,
-0.54052734375,
-0.0848388671875,
0.254150390625,
-0.0574951171875,
-0.038482666015625,
0.430419921875,
-0.5869140625,
-0.09283447265625,
0.375,
-0.20849609375,
0.480712890625,
0.288330078125,
-0.7841796875,
0.58740234375,
-0.2203369140625,
0.2276611328125,
-0.3974609375,
-0.69873046875,
0.267578125,
0.205078125,
-0.0943603515625,
-0.2734375,
0.492431640625,
0.763671875,
0.392578125,
0.12066650390625,
0.56396484375,
-0.97265625,
1.0107421875,
0.03424072265625,
0.43798828125,
-0.59912109375,
-0.304443359375,
-0.271728515625,
-0.256103515625,
-0.1314697265625,
-0.5390625,
0.953125,
0.11700439453125,
-0.312255859375,
0.5498046875,
0.270751953125,
-0.53759765625,
0.265869140625,
-0.2366943359375,
-0.27978515625,
-0.3486328125,
0.328857421875,
1.1904296875,
-0.1884765625,
-0.182861328125,
-0.5712890625,
0.5810546875,
0.82080078125,
0.48193359375,
-0.0281524658203125,
-0.5537109375,
-0.276123046875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Anfisa the monkey learns to type. She is yet unfamiliar with the "space" key and can only type in lower-case Latin letters. Having typed for a fairly long line, Anfisa understood that it would be great to divide what she has written into k lines not shorter than a and not longer than b, for the text to resemble human speech more. Help Anfisa.
Input
The first line contains three integers k, a and b (1 β€ k β€ 200, 1 β€ a β€ b β€ 200). The second line contains a sequence of lowercase Latin letters β the text typed by Anfisa. It is guaranteed that the given line is not empty and its length does not exceed 200 symbols.
Output
Print k lines, each of which contains no less than a and no more than b symbols β Anfisa's text divided into lines. It is not allowed to perform any changes in the text, such as: deleting or adding symbols, changing their order, etc. If the solution is not unique, print any of them. If there is no solution, print "No solution" (without quotes).
Examples
Input
3 2 5
abrakadabra
Output
ab
rakad
abra
Input
4 1 2
abrakadabra
Output
No solution
Tags: dp
Correct Solution:
```
def chujnia():
k, n, m = tuple(list(map(int, input().split())))
slowo = input()
lower = k*n
higher = k*m
if len(slowo) < lower or len(slowo) > higher:
print("No solution")
exit(0)
ilosc = len(slowo)//k
reszta = len(slowo) % k
cp = reszta
i = 0
for _ in range(k):
if cp != 0:
print(slowo[i:i+ilosc+1])
i+=ilosc+1
cp -= 1
else:
print(slowo[i:i+ilosc])
i+=ilosc
chujnia()
```
| 38,038
|
[
0.31787109375,
-0.08349609375,
0.311279296875,
0.205810546875,
-0.55322265625,
-0.54150390625,
-0.0213623046875,
0.1536865234375,
-0.1103515625,
0.84619140625,
0.464111328125,
0.5166015625,
-0.517578125,
-0.58740234375,
-0.45654296875,
0.196044921875,
-0.56591796875,
-1.1044921875,
-0.1324462890625,
-0.328369140625,
-0.00814056396484375,
-0.04931640625,
-1.462890625,
-0.4140625,
-0.388916015625,
1.12890625,
0.358642578125,
0.1856689453125,
1.01171875,
0.74658203125,
0.270263671875,
-0.53662109375,
0.6220703125,
-1.4560546875,
-0.406005859375,
-0.501953125,
0.48876953125,
-0.357666015625,
-0.6396484375,
-0.5234375,
0.315673828125,
-0.282470703125,
0.580078125,
-0.90185546875,
-1.4267578125,
0.09039306640625,
-0.401123046875,
-0.1578369140625,
-0.2279052734375,
-0.5234375,
-0.056427001953125,
-0.0108642578125,
0.5712890625,
-0.1795654296875,
-0.390380859375,
-0.11895751953125,
0.253662109375,
-0.271240234375,
-0.7861328125,
0.271484375,
0.28125,
0.5361328125,
-0.154541015625,
-0.26171875,
-0.110107421875,
0.148681640625,
-0.5009765625,
-0.2685546875,
-0.40283203125,
-0.442626953125,
-0.00482177734375,
0.57763671875,
-0.154541015625,
-0.40478515625,
-0.6279296875,
0.0014123916625976562,
-0.1688232421875,
-0.1734619140625,
-0.73095703125,
0.72021484375,
0.1065673828125,
0.88916015625,
0.11907958984375,
0.8125,
-0.7568359375,
-0.953125,
0.011505126953125,
0.207763671875,
0.38232421875,
-0.056121826171875,
-0.2364501953125,
0.495849609375,
-0.51513671875,
0.47021484375,
0.6630859375,
0.5966796875,
-0.08935546875,
0.22802734375,
0.3564453125,
0.269775390625,
0.8193359375,
0.87548828125,
-0.310546875,
0.8203125,
-0.5712890625,
0.25634765625,
0.190673828125,
0.166015625,
-0.1168212890625,
-0.300048828125,
-0.264892578125,
-0.39599609375,
0.341064453125,
0.32177734375,
-0.44091796875,
0.5595703125,
0.08343505859375,
0.225830078125,
-0.7998046875,
0.0298614501953125,
0.1417236328125,
0.482177734375,
0.45947265625,
-0.361572265625,
0.0301971435546875,
-0.325927734375,
-0.58203125,
1.0078125,
-0.46142578125,
-0.1981201171875,
0.41552734375,
0.0297088623046875,
0.255859375,
0.29443359375,
-0.11993408203125,
0.79833984375,
0.02490234375,
0.5224609375,
0.5849609375,
-0.59814453125,
0.485595703125,
0.00012069940567016602,
0.101318359375,
1.1845703125,
0.487548828125,
0.026123046875,
0.609375,
0.484619140625,
-0.419189453125,
0.284912109375,
-0.94482421875,
0.489501953125,
0.267822265625,
0.395751953125,
-0.349853515625,
0.018218994140625,
-0.20556640625,
0.347900390625,
0.038055419921875,
0.466064453125,
-0.3525390625,
0.006114959716796875,
-0.25830078125,
0.87841796875,
-0.1669921875,
0.5478515625,
-0.2232666015625,
-0.235595703125,
0.1873779296875,
-0.382568359375,
0.77783203125,
-0.2978515625,
-0.1009521484375,
0.76708984375,
0.251953125,
0.8466796875,
0.80859375,
0.0469970703125,
0.0921630859375,
0.395263671875,
-0.12445068359375,
0.484619140625,
0.216796875,
0.669921875,
0.53369140625,
0.1373291015625,
0.4326171875,
-0.27734375,
-0.90234375,
-0.49755859375,
-0.122802734375,
0.55517578125,
-0.343994140625,
0.4169921875,
0.388427734375,
0.09014892578125,
-0.66650390625,
-0.2744140625,
0.471923828125,
-0.81591796875,
-0.431640625,
0.9189453125,
-0.5009765625,
0.619140625,
-0.439453125,
-0.5234375,
0.1810302734375,
1.37109375,
-0.263916015625,
-0.148681640625,
0.37890625,
-0.137451171875,
-0.39306640625,
-0.1544189453125,
0.03912353515625,
-0.59619140625,
-0.5244140625,
0.7685546875,
-0.2176513671875,
0.11932373046875,
0.33984375,
0.603515625,
0.48193359375,
0.7626953125,
-0.50634765625,
0.025970458984375,
0.6640625,
1.181640625,
-0.01702880859375,
0.315185546875,
-0.0301055908203125,
0.70703125,
0.57080078125,
0.638671875,
0.358642578125,
0.484130859375,
0.401611328125,
0.732421875,
0.08636474609375,
0.379150390625,
0.0296630859375,
0.25927734375,
0.49755859375,
0.716796875,
0.2137451171875,
0.27685546875,
-0.464111328125,
0.2042236328125,
-0.306640625,
0.01316070556640625,
-0.238525390625,
0.72119140625,
0.17333984375,
0.284912109375,
-0.36962890625,
-0.1925048828125,
0.52294921875,
0.8330078125,
-0.82177734375,
-0.79150390625,
-0.2110595703125,
-0.486328125,
0.3720703125,
-0.095458984375,
0.239501953125,
0.35302734375,
0.1568603515625,
0.35546875,
-0.1868896484375,
-0.59375,
-0.93408203125,
-0.50390625,
-0.9072265625,
-0.389892578125,
-0.476806640625,
-0.03179931640625,
0.3154296875,
-0.9775390625,
0.496337890625,
-0.59716796875,
-0.18359375,
-0.04541015625,
-0.67578125,
0.47412109375,
0.1746826171875,
0.892578125,
-0.48974609375,
0.54345703125,
0.083740234375,
1.0927734375,
-0.412841796875,
-0.1446533203125,
-0.216064453125,
-0.8701171875,
0.7802734375,
-0.134765625,
0.12548828125,
0.1431884765625,
-1.025390625,
-1.1123046875,
-0.603515625,
-0.458251953125,
-0.403564453125,
0.13720703125,
-0.323974609375,
0.64794921875,
0.11602783203125,
-0.5908203125,
0.3046875,
0.62890625,
-0.493896484375,
0.4541015625,
0.21728515625,
0.1990966796875,
-0.80615234375,
1.0830078125,
0.360107421875,
0.281005859375,
-0.59423828125,
-0.6708984375,
-0.389404296875,
0.1302490234375,
0.2398681640625,
-0.227294921875,
-0.3916015625,
0.2568359375,
0.25146484375,
-1.1484375,
0.4365234375,
-0.78076171875,
-0.70703125,
-0.424560546875,
-0.7841796875,
0.73974609375,
1.03125,
0.2486572265625,
-0.39208984375,
-0.31689453125,
-0.9453125,
0.37353515625,
0.31298828125,
-0.7578125,
-0.03948974609375,
0.595703125,
-0.10272216796875,
-0.1640625,
-0.057830810546875,
-0.33544921875,
-0.310546875,
0.074462890625,
-0.0213165283203125,
0.29541015625,
0.5947265625,
0.206787109375,
0.51904296875,
0.57177734375,
-0.88818359375,
-0.1309814453125,
-0.065673828125,
0.76953125,
0.2020263671875,
0.556640625,
0.68115234375,
-0.5927734375,
-0.417236328125,
-1.1064453125,
0.5283203125,
0.18798828125,
0.6318359375,
-0.8857421875,
0.3525390625,
0.23046875,
-0.40283203125,
0.1453857421875,
-0.87060546875,
-0.1502685546875,
1.208984375,
-0.11077880859375,
0.9375,
-0.82470703125,
0.2191162109375,
-0.18310546875,
0.094482421875,
0.53271484375,
0.256103515625,
0.2381591796875,
-0.390380859375,
-0.015411376953125,
0.036773681640625,
-0.62939453125,
0.2227783203125,
-0.3349609375,
0.401611328125,
-0.39306640625,
-0.51123046875,
-0.8955078125,
0.361328125,
0.947265625,
0.31591796875,
0.162841796875,
0.1688232421875,
-0.1881103515625,
1.01953125,
0.448974609375,
-0.2452392578125,
0.1373291015625,
-0.6669921875,
0.87158203125,
0.433837890625,
-0.0169677734375,
-0.355224609375,
-0.64892578125,
0.286376953125,
0.09783935546875,
0.05877685546875,
-0.0677490234375,
-0.494873046875,
-0.14501953125,
-0.06890869140625,
0.484619140625,
-0.8935546875,
-0.47119140625,
-0.183837890625,
0.469482421875,
0.2052001953125,
-1.0791015625,
0.2049560546875,
-0.609375,
0.90283203125,
0.47802734375,
-0.26904296875,
0.08612060546875,
-0.31201171875,
-0.685546875,
-0.331787109375,
0.3056640625,
0.7353515625,
-0.1275634765625,
0.295654296875,
-0.9638671875,
0.36279296875,
0.62939453125,
-0.244140625,
0.06787109375,
0.2607421875,
0.11505126953125,
-0.202392578125,
0.66552734375,
-0.337890625,
-1.142578125,
0.6279296875,
-1.2568359375,
0.356201171875,
-0.385009765625,
-0.0060272216796875,
-0.33837890625,
-0.2301025390625,
0.179931640625,
0.26611328125,
-0.226318359375,
-0.08721923828125,
-0.0858154296875,
0.390625,
-0.69482421875,
-0.802734375,
0.31494140625,
-0.1807861328125,
-0.253173828125,
0.5712890625,
0.027740478515625,
-0.4677734375,
0.431396484375,
0.5654296875,
-0.4658203125,
0.417236328125,
-0.83203125,
0.25732421875,
-0.2344970703125,
-0.6083984375,
-0.314697265625,
-0.42578125,
0.32568359375,
0.0312042236328125,
-0.68408203125,
-0.0107269287109375,
-1.0703125,
-0.16064453125,
-0.43505859375,
-0.7626953125,
0.333984375,
0.476806640625,
-0.34814453125,
0.1064453125,
-0.456298828125,
-0.131591796875,
-0.351318359375,
-0.6376953125,
-0.411376953125,
0.471923828125,
0.4404296875,
0.5556640625,
0.19873046875,
-0.364013671875,
0.251953125,
0.00919342041015625,
0.0034084320068359375,
-0.30908203125,
-0.1453857421875,
0.01241302490234375,
-0.34814453125,
0.033660888671875,
0.395751953125,
0.284912109375,
0.533203125,
0.82421875,
0.006923675537109375,
0.56298828125,
0.44677734375,
-0.6552734375,
1.2109375,
0.0157470703125,
-1.0791015625,
-0.345703125,
0.54443359375,
-0.1627197265625,
0.63818359375,
0.165283203125,
-0.59814453125,
-0.71435546875,
-1.3857421875,
0.060821533203125,
-0.44921875,
-0.038238525390625,
-0.92431640625,
-0.317138671875,
-0.148681640625,
0.07379150390625,
-0.135986328125,
-0.63037109375,
-0.0245361328125,
-1.259765625,
0.2181396484375,
-0.65966796875,
-0.315185546875,
-0.68359375,
-0.371337890625,
-0.07733154296875,
0.91943359375,
0.218505859375,
0.033172607421875,
0.3779296875,
-0.468994140625,
0.3076171875,
-0.27734375,
-0.701171875,
-0.6630859375,
0.07122802734375,
0.236083984375,
-0.38818359375,
0.39599609375,
-0.29345703125,
0.6923828125,
-0.80029296875,
-0.33837890625,
-0.243896484375,
-0.35498046875,
-0.1619873046875,
-0.36572265625,
1.0732421875,
0.044097900390625,
0.0046234130859375,
-0.322021484375,
0.65185546875,
0.68798828125,
-0.366943359375,
-0.405517578125,
-0.708984375,
-0.1915283203125,
-1.1640625,
0.53857421875,
-0.45263671875,
0.21923828125,
-0.307373046875,
-0.038604736328125,
0.740234375,
-0.2685546875,
0.332763671875,
1.19921875,
0.032470703125,
0.17431640625,
-0.81201171875,
0.84326171875,
0.3359375,
-0.556640625,
-0.0195770263671875,
0.1947021484375,
-0.810546875,
0.0599365234375,
-0.06976318359375,
-0.83447265625,
-0.64404296875,
0.68505859375,
1.4814453125,
-0.443115234375,
0.83154296875,
-0.149658203125,
-1.2109375,
-0.75341796875,
0.71240234375,
0.0012216567993164062,
0.41845703125,
0.751953125,
-0.56591796875,
-0.382568359375,
0.10687255859375,
0.0214691162109375,
-0.489990234375,
-0.41064453125,
1.0625,
-0.11468505859375,
-0.365478515625,
0.64208984375,
1.4013671875,
-1.0634765625,
-1.0576171875,
0.1036376953125,
-0.07904052734375,
-0.274658203125,
-0.32861328125,
0.08990478515625,
0.61181640625,
-0.609375,
0.448486328125,
0.1904296875,
0.033477783203125,
0.5439453125,
0.1513671875,
0.249755859375,
-0.51025390625,
0.322998046875,
0.9677734375,
-0.2188720703125,
-0.021942138671875,
-0.646484375,
-0.3095703125,
-0.469482421875,
0.1512451171875,
0.607421875,
-0.65576171875,
-0.1185302734375,
0.89599609375,
0.037628173828125,
0.56640625,
-0.63916015625,
-0.2303466796875,
0.480224609375,
-0.91748046875,
-0.18701171875,
0.1785888671875,
0.80322265625,
-0.0758056640625,
0.31396484375,
-0.8017578125,
-0.2464599609375,
0.3349609375,
0.208984375,
-0.1485595703125,
-0.94921875,
-0.54833984375,
-0.66552734375,
-0.62451171875,
-0.348876953125,
-0.896484375,
-0.1185302734375,
0.345458984375,
0.060760498046875,
-0.30859375,
0.1339111328125,
0.2176513671875,
-0.72314453125,
0.48046875,
-0.671875,
0.391357421875,
-0.900390625,
-0.412353515625,
-0.55322265625,
-0.1815185546875,
-0.26904296875,
0.0256805419921875,
-0.8857421875,
0.47119140625,
-0.0174102783203125,
1.1640625,
0.046600341796875,
-0.0154876708984375,
-0.16259765625,
-0.4716796875,
0.08935546875,
0.367431640625,
-0.271240234375,
0.86474609375,
0.421142578125,
0.2235107421875,
0.10870361328125,
0.0294342041015625,
-0.236572265625,
-0.206298828125,
0.7421875,
0.54248046875,
-0.11761474609375,
-0.062469482421875,
-0.2030029296875,
0.06494140625,
-0.9599609375,
0.233642578125,
-0.2958984375,
0.1871337890625,
0.332763671875,
-0.11376953125,
0.281494140625,
1.107421875,
-0.34619140625,
0.1431884765625,
0.00762939453125,
-0.2020263671875,
0.52392578125,
-0.12420654296875,
0.521484375,
0.3623046875,
0.1962890625,
-0.552734375,
-0.0621337890625,
0.62109375,
-0.267822265625,
0.042236328125,
0.043792724609375,
-0.556640625,
-0.96337890625,
0.172119140625,
-0.01203155517578125,
0.13525390625,
0.46826171875,
-0.81298828125,
-0.314208984375,
-0.08526611328125,
-0.69921875,
0.1856689453125,
-1.0048828125,
-0.625,
0.5595703125,
-0.07586669921875,
-0.4921875,
0.046112060546875,
-0.6845703125,
-0.057037353515625,
-0.0335693359375,
0.5576171875,
-0.216552734375,
0.115478515625,
-0.3134765625,
-0.040069580078125,
-0.451904296875,
-0.5732421875,
-0.00954437255859375,
0.38671875,
-0.305419921875,
-0.392333984375,
0.09423828125,
1.3046875,
0.54736328125,
-0.021728515625,
-0.499755859375,
0.37939453125,
-0.232177734375,
-0.023956298828125,
-0.389404296875,
0.2939453125,
0.257080078125,
0.258544921875,
-0.953125,
-0.302734375,
-0.329345703125,
0.51611328125,
0.185302734375,
-0.0865478515625,
-0.250732421875,
0.841796875,
0.8974609375,
-0.515625,
0.69091796875,
-0.0135955810546875,
0.328857421875,
-0.11083984375,
-0.087646484375,
-0.01751708984375,
0.7216796875,
0.52587890625,
0.6328125,
-0.16748046875,
0.3486328125,
0.98095703125,
-0.416748046875,
-0.405517578125,
0.0946044921875,
0.23583984375,
-0.206787109375,
-0.38671875,
-0.1844482421875,
-0.351318359375,
-0.007415771484375,
-0.8681640625,
0.477294921875,
-0.3125,
-0.2144775390625,
-0.174560546875,
-0.5537109375,
0.85595703125,
-0.564453125,
-0.10791015625,
-0.1038818359375,
-0.259521484375,
0.43701171875,
0.467041015625,
0.34130859375,
0.0426025390625,
0.8173828125,
0.272705078125,
0.7373046875,
0.6416015625,
0.0902099609375,
0.40087890625,
-0.482177734375,
0.458251953125,
0.4033203125,
-0.185791015625,
-0.219970703125,
-0.255126953125,
-0.97998046875,
0.207275390625,
-0.72802734375,
-0.394287109375,
0.662109375,
-0.41357421875,
0.172607421875,
-0.247314453125,
0.33056640625,
-0.6845703125,
0.564453125,
0.40673828125,
-0.261962890625,
-0.6298828125,
0.47607421875,
0.1251220703125,
0.423583984375,
-0.0021495819091796875,
1.181640625,
0.0036983489990234375,
1.662109375,
0.37158203125,
0.128662109375,
-0.170166015625,
-0.09466552734375,
-0.2109375,
-0.662109375,
-0.330078125,
-0.2822265625,
0.3583984375,
-0.5615234375,
-0.2413330078125,
0.15576171875,
0.6748046875,
-0.27294921875,
-0.87109375,
-0.2315673828125,
0.52392578125,
-0.62548828125,
0.258544921875,
0.04168701171875,
0.09814453125,
0.190185546875,
0.12225341796875,
0.158935546875,
-0.49755859375,
-0.00891876220703125,
-0.40966796875,
0.46533203125,
-0.200927734375,
-0.74951171875,
-0.45166015625,
-0.85986328125,
-0.28759765625,
0.0469970703125,
-0.62646484375,
-0.95849609375,
0.2861328125,
0.6572265625,
0.395263671875,
0.290771484375,
-0.267822265625,
0.035247802734375,
1.0458984375,
1.162109375,
-0.10858154296875,
0.67529296875,
0.61962890625,
-0.7294921875,
0.444580078125,
-0.50390625,
0.6259765625,
-0.1500244140625,
0.17822265625,
-0.0290679931640625,
0.4638671875,
-0.77392578125,
-1.048828125,
0.2529296875,
0.371826171875,
0.5615234375,
-0.73388671875,
-1.3583984375,
-0.21923828125,
-1.013671875,
-0.2296142578125,
-0.82421875,
0.93310546875,
-0.058319091796875,
-0.062469482421875,
0.10986328125,
-0.9912109375,
4.51953125,
1.0869140625,
0.66064453125,
0.40576171875,
0.0921630859375,
0.479736328125,
0.430419921875,
-0.537109375,
-0.07183837890625,
-0.8154296875,
0.141845703125,
-0.447509765625,
-0.00983428955078125,
0.78564453125,
0.3837890625,
0.411865234375,
-0.3134765625,
0.213623046875,
-0.049072265625,
-0.67041015625,
-1.0478515625,
0.42529296875,
0.054046630859375,
0.09747314453125,
-0.057403564453125,
0.4931640625,
0.34716796875,
-0.371337890625,
-0.326416015625,
-0.6171875,
0.3017578125,
-0.7900390625,
1.005859375,
-0.025726318359375,
-0.11865234375,
0.331298828125,
-0.30224609375,
-0.58203125,
-0.053558349609375,
0.2783203125,
-0.029052734375,
0.0606689453125,
0.413818359375,
-0.59423828125,
-0.115966796875,
0.3466796875,
-0.225830078125,
0.5947265625,
0.289306640625,
-0.78564453125,
0.626953125,
-0.1868896484375,
0.2333984375,
-0.34130859375,
-0.611328125,
0.2152099609375,
0.2445068359375,
-0.1488037109375,
-0.2861328125,
0.517578125,
0.724609375,
0.341796875,
0.18359375,
0.482177734375,
-0.9970703125,
0.9169921875,
0.035736083984375,
0.44287109375,
-0.72998046875,
-0.359375,
-0.28173828125,
-0.194580078125,
-0.1165771484375,
-0.5107421875,
0.9580078125,
0.1400146484375,
-0.405517578125,
0.6298828125,
0.26220703125,
-0.50390625,
0.2486572265625,
-0.301025390625,
-0.35205078125,
-0.359375,
0.413818359375,
1.234375,
-0.26318359375,
-0.15185546875,
-0.66357421875,
0.5634765625,
0.771484375,
0.393798828125,
0.039031982421875,
-0.5595703125,
-0.20703125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Anfisa the monkey learns to type. She is yet unfamiliar with the "space" key and can only type in lower-case Latin letters. Having typed for a fairly long line, Anfisa understood that it would be great to divide what she has written into k lines not shorter than a and not longer than b, for the text to resemble human speech more. Help Anfisa.
Input
The first line contains three integers k, a and b (1 β€ k β€ 200, 1 β€ a β€ b β€ 200). The second line contains a sequence of lowercase Latin letters β the text typed by Anfisa. It is guaranteed that the given line is not empty and its length does not exceed 200 symbols.
Output
Print k lines, each of which contains no less than a and no more than b symbols β Anfisa's text divided into lines. It is not allowed to perform any changes in the text, such as: deleting or adding symbols, changing their order, etc. If the solution is not unique, print any of them. If there is no solution, print "No solution" (without quotes).
Examples
Input
3 2 5
abrakadabra
Output
ab
rakad
abra
Input
4 1 2
abrakadabra
Output
No solution
Tags: dp
Correct Solution:
```
n, a, b = map(int, input().split())
s = input()
if n * a <= len(s) <= n * b:
x, y = divmod(len(s), n)
j = 0
for i in range(n):
print(s[j : j + x + (y > i)])
j = j + x + (y > i)
else:
print('No solution')
```
| 38,039
|
[
0.386474609375,
-0.0482177734375,
0.358642578125,
0.212646484375,
-0.4423828125,
-0.59765625,
0.0841064453125,
0.2286376953125,
-0.1546630859375,
0.8486328125,
0.50048828125,
0.4912109375,
-0.48291015625,
-0.537109375,
-0.49609375,
0.1768798828125,
-0.5625,
-0.96826171875,
-0.14111328125,
-0.421630859375,
-0.02728271484375,
0.0670166015625,
-1.5078125,
-0.33935546875,
-0.377197265625,
1.08203125,
0.412109375,
0.1800537109375,
1.001953125,
0.77197265625,
0.324462890625,
-0.5400390625,
0.62890625,
-1.3935546875,
-0.42822265625,
-0.434326171875,
0.55810546875,
-0.45849609375,
-0.72119140625,
-0.51806640625,
0.30419921875,
-0.2413330078125,
0.60986328125,
-0.9755859375,
-1.3466796875,
0.0946044921875,
-0.56494140625,
-0.11761474609375,
-0.289794921875,
-0.4482421875,
-0.0972900390625,
0.0291900634765625,
0.61962890625,
-0.1304931640625,
-0.4462890625,
-0.162353515625,
0.175048828125,
-0.2293701171875,
-0.9140625,
0.2149658203125,
0.234130859375,
0.471435546875,
-0.233154296875,
-0.243896484375,
-0.11444091796875,
0.191162109375,
-0.54541015625,
-0.32958984375,
-0.400390625,
-0.467041015625,
-0.0321044921875,
0.492919921875,
-0.175537109375,
-0.300048828125,
-0.6025390625,
-0.08251953125,
-0.1328125,
-0.2080078125,
-0.67724609375,
0.72705078125,
0.03753662109375,
0.87158203125,
-0.07305908203125,
0.689453125,
-0.68701171875,
-0.94873046875,
0.03515625,
0.2064208984375,
0.47607421875,
-0.1015625,
-0.33056640625,
0.53369140625,
-0.494140625,
0.52099609375,
0.67919921875,
0.62548828125,
-0.187744140625,
0.248291015625,
0.319580078125,
0.229736328125,
0.859375,
0.95654296875,
-0.421630859375,
0.775390625,
-0.53369140625,
0.05987548828125,
0.1514892578125,
0.270263671875,
-0.06866455078125,
-0.35546875,
-0.232421875,
-0.36474609375,
0.355712890625,
0.281494140625,
-0.383056640625,
0.5732421875,
0.1923828125,
0.2626953125,
-0.85595703125,
-0.029815673828125,
0.116943359375,
0.427001953125,
0.381591796875,
-0.315673828125,
-0.0028667449951171875,
-0.3115234375,
-0.6142578125,
0.984375,
-0.29296875,
-0.1812744140625,
0.53466796875,
0.12481689453125,
0.1890869140625,
0.27001953125,
-0.08648681640625,
0.73193359375,
-0.100830078125,
0.59765625,
0.56494140625,
-0.521484375,
0.4658203125,
-0.01629638671875,
0.106201171875,
1.2158203125,
0.491943359375,
-0.01511383056640625,
0.5556640625,
0.47265625,
-0.454345703125,
0.2724609375,
-0.9267578125,
0.53076171875,
0.2318115234375,
0.349365234375,
-0.343017578125,
-0.1219482421875,
-0.12353515625,
0.38134765625,
0.04901123046875,
0.4775390625,
-0.3603515625,
0.048736572265625,
-0.292236328125,
0.9013671875,
-0.20751953125,
0.6494140625,
-0.263916015625,
-0.3251953125,
0.2408447265625,
-0.449951171875,
0.86865234375,
-0.333251953125,
-0.07635498046875,
0.7529296875,
0.3173828125,
0.94873046875,
0.7744140625,
0.10504150390625,
0.09906005859375,
0.43896484375,
-0.107177734375,
0.426513671875,
0.29736328125,
0.701171875,
0.62060546875,
0.266357421875,
0.41552734375,
-0.296142578125,
-0.98388671875,
-0.54345703125,
-0.062042236328125,
0.5986328125,
-0.473876953125,
0.418212890625,
0.341064453125,
0.10791015625,
-0.60205078125,
-0.287353515625,
0.46826171875,
-0.8115234375,
-0.452880859375,
0.88232421875,
-0.53466796875,
0.556640625,
-0.5234375,
-0.4775390625,
0.124267578125,
1.3564453125,
-0.34521484375,
-0.161865234375,
0.257080078125,
-0.059356689453125,
-0.355224609375,
-0.28564453125,
0.035858154296875,
-0.63720703125,
-0.438720703125,
0.7421875,
-0.290771484375,
0.207275390625,
0.26953125,
0.6171875,
0.432861328125,
0.69384765625,
-0.56005859375,
-0.14501953125,
0.66943359375,
1.171875,
-0.054412841796875,
0.33251953125,
-0.01297760009765625,
0.7939453125,
0.59033203125,
0.67626953125,
0.242919921875,
0.50048828125,
0.4404296875,
0.7724609375,
0.0219573974609375,
0.354248046875,
0.032012939453125,
0.281982421875,
0.3671875,
0.64453125,
0.28466796875,
0.251708984375,
-0.445068359375,
0.0408935546875,
-0.277587890625,
0.140625,
-0.2445068359375,
0.76025390625,
0.265625,
0.294189453125,
-0.360107421875,
-0.1395263671875,
0.492919921875,
0.9345703125,
-0.7451171875,
-0.7421875,
-0.144287109375,
-0.426513671875,
0.343994140625,
-0.058563232421875,
0.3388671875,
0.328857421875,
0.104248046875,
0.326416015625,
-0.28271484375,
-0.52783203125,
-0.9248046875,
-0.560546875,
-0.962890625,
-0.28759765625,
-0.439697265625,
-0.1649169921875,
0.2041015625,
-0.892578125,
0.51611328125,
-0.64453125,
-0.2900390625,
-0.0286712646484375,
-0.7041015625,
0.450927734375,
0.2142333984375,
0.85791015625,
-0.498046875,
0.541015625,
0.332763671875,
1.1220703125,
-0.48681640625,
-0.300537109375,
-0.1339111328125,
-0.9306640625,
0.76904296875,
-0.1405029296875,
0.08734130859375,
0.163330078125,
-1.0400390625,
-1.14453125,
-0.54248046875,
-0.39013671875,
-0.378662109375,
0.191650390625,
-0.323974609375,
0.763671875,
0.2298583984375,
-0.65283203125,
0.25,
0.603515625,
-0.5732421875,
0.54736328125,
0.1966552734375,
0.16162109375,
-0.84619140625,
1.0205078125,
0.51220703125,
0.367919921875,
-0.5830078125,
-0.74462890625,
-0.455322265625,
0.1719970703125,
0.28955078125,
-0.155517578125,
-0.3740234375,
0.28369140625,
0.292724609375,
-1.1318359375,
0.430908203125,
-0.853515625,
-0.5556640625,
-0.44970703125,
-0.76171875,
0.7783203125,
0.94091796875,
0.2763671875,
-0.3203125,
-0.41845703125,
-0.796875,
0.354248046875,
0.39404296875,
-0.7734375,
-0.0345458984375,
0.7119140625,
-0.12030029296875,
-0.2822265625,
-0.0626220703125,
-0.300048828125,
-0.1881103515625,
0.0234527587890625,
0.011749267578125,
0.267578125,
0.6025390625,
0.1998291015625,
0.468505859375,
0.58056640625,
-0.88427734375,
-0.11383056640625,
-0.1136474609375,
0.69091796875,
0.166259765625,
0.58203125,
0.68896484375,
-0.57080078125,
-0.439208984375,
-1.1201171875,
0.4287109375,
0.234130859375,
0.662109375,
-0.892578125,
0.378173828125,
0.2474365234375,
-0.375,
0.2064208984375,
-0.80126953125,
-0.185546875,
1.2333984375,
-0.14453125,
0.94677734375,
-0.83251953125,
0.2197265625,
-0.099365234375,
0.11883544921875,
0.615234375,
0.26220703125,
0.28515625,
-0.451904296875,
-0.07611083984375,
0.07122802734375,
-0.564453125,
0.1651611328125,
-0.39453125,
0.376220703125,
-0.361328125,
-0.450439453125,
-0.88671875,
0.382080078125,
0.8994140625,
0.37939453125,
0.1820068359375,
0.203369140625,
-0.1279296875,
1.037109375,
0.376708984375,
-0.367431640625,
0.2430419921875,
-0.72998046875,
0.84521484375,
0.53759765625,
0.0198974609375,
-0.35498046875,
-0.6591796875,
0.325439453125,
0.1075439453125,
0.00616455078125,
-0.10205078125,
-0.5,
-0.08087158203125,
-0.041656494140625,
0.544921875,
-0.837890625,
-0.478271484375,
-0.1654052734375,
0.44873046875,
0.1793212890625,
-1.099609375,
0.232666015625,
-0.65234375,
0.9990234375,
0.41162109375,
-0.37646484375,
-0.012908935546875,
-0.345458984375,
-0.697265625,
-0.278564453125,
0.324951171875,
0.87939453125,
-0.25830078125,
0.3740234375,
-0.96875,
0.4306640625,
0.626953125,
-0.2071533203125,
0.0838623046875,
0.27099609375,
0.185302734375,
-0.12310791015625,
0.72216796875,
-0.3203125,
-1.1005859375,
0.66748046875,
-1.2470703125,
0.361328125,
-0.275634765625,
-0.012115478515625,
-0.364990234375,
-0.1724853515625,
0.2076416015625,
0.34326171875,
-0.21923828125,
-0.1072998046875,
0.0943603515625,
0.31201171875,
-0.63916015625,
-0.7421875,
0.34033203125,
-0.0655517578125,
-0.307373046875,
0.51220703125,
-0.0009603500366210938,
-0.525390625,
0.301513671875,
0.6259765625,
-0.5537109375,
0.41064453125,
-0.77587890625,
0.324951171875,
-0.1802978515625,
-0.68505859375,
-0.26220703125,
-0.418701171875,
0.3486328125,
0.08544921875,
-0.6357421875,
0.0067596435546875,
-1.0439453125,
-0.1036376953125,
-0.54638671875,
-0.76220703125,
0.2529296875,
0.5751953125,
-0.3251953125,
0.044036865234375,
-0.376953125,
-0.01222991943359375,
-0.337158203125,
-0.51904296875,
-0.443115234375,
0.428955078125,
0.314208984375,
0.65771484375,
0.2022705078125,
-0.36767578125,
0.329833984375,
-0.00750732421875,
-0.0303955078125,
-0.4365234375,
-0.08013916015625,
0.085693359375,
-0.31640625,
-0.036865234375,
0.444580078125,
0.286376953125,
0.446044921875,
0.86669921875,
-0.1409912109375,
0.5078125,
0.3564453125,
-0.68701171875,
1.1630859375,
0.08331298828125,
-1.083984375,
-0.34619140625,
0.5244140625,
-0.2154541015625,
0.546875,
0.2266845703125,
-0.6103515625,
-0.70703125,
-1.359375,
0.11553955078125,
-0.496337890625,
-0.04217529296875,
-0.986328125,
-0.356201171875,
-0.2109375,
0.181396484375,
-0.156005859375,
-0.56787109375,
-0.07855224609375,
-1.19140625,
0.1934814453125,
-0.63232421875,
-0.1964111328125,
-0.78125,
-0.316650390625,
-0.044677734375,
0.9775390625,
0.1414794921875,
0.004390716552734375,
0.41015625,
-0.52734375,
0.38720703125,
-0.1173095703125,
-0.6787109375,
-0.60302734375,
0.1451416015625,
0.197509765625,
-0.384765625,
0.47314453125,
-0.2249755859375,
0.63427734375,
-0.85546875,
-0.31396484375,
-0.325927734375,
-0.343505859375,
-0.09716796875,
-0.2880859375,
0.96533203125,
0.07666015625,
-0.01274871826171875,
-0.37548828125,
0.67822265625,
0.74169921875,
-0.292724609375,
-0.362548828125,
-0.69091796875,
-0.198974609375,
-1.0986328125,
0.50146484375,
-0.51513671875,
0.1827392578125,
-0.274658203125,
-0.06365966796875,
0.7900390625,
-0.35791015625,
0.43115234375,
1.23828125,
-0.031341552734375,
0.1748046875,
-0.68701171875,
0.74853515625,
0.259033203125,
-0.5498046875,
-0.08984375,
0.173828125,
-0.86474609375,
0.0447998046875,
-0.1741943359375,
-0.794921875,
-0.6708984375,
0.57080078125,
1.6357421875,
-0.5,
0.70166015625,
-0.1256103515625,
-1.2333984375,
-0.87158203125,
0.73193359375,
0.06390380859375,
0.410400390625,
0.81103515625,
-0.4677734375,
-0.42919921875,
0.08172607421875,
-0.02996826171875,
-0.56640625,
-0.50439453125,
1.111328125,
0.0034580230712890625,
-0.305908203125,
0.68212890625,
1.4384765625,
-1.087890625,
-1.0927734375,
0.1087646484375,
-0.100830078125,
-0.29248046875,
-0.33056640625,
0.1265869140625,
0.65966796875,
-0.67333984375,
0.383056640625,
0.233154296875,
0.09588623046875,
0.53564453125,
0.195556640625,
0.314453125,
-0.315185546875,
0.364501953125,
0.994140625,
-0.220458984375,
-0.03265380859375,
-0.7587890625,
-0.372802734375,
-0.37451171875,
0.07110595703125,
0.55908203125,
-0.57958984375,
-0.167236328125,
0.79345703125,
-0.03656005859375,
0.63525390625,
-0.703125,
-0.31982421875,
0.4208984375,
-0.9599609375,
-0.2249755859375,
0.11444091796875,
0.78271484375,
-0.07086181640625,
0.2392578125,
-0.7958984375,
-0.30126953125,
0.314208984375,
0.26220703125,
-0.2164306640625,
-0.98681640625,
-0.63037109375,
-0.6064453125,
-0.576171875,
-0.3486328125,
-0.94189453125,
-0.0136260986328125,
0.36865234375,
0.1064453125,
-0.3271484375,
0.1834716796875,
0.320068359375,
-0.77685546875,
0.521484375,
-0.7216796875,
0.445556640625,
-0.74853515625,
-0.372802734375,
-0.4892578125,
-0.251220703125,
-0.356201171875,
0.049041748046875,
-0.908203125,
0.484375,
0.0036373138427734375,
1.2646484375,
0.11517333984375,
0.09259033203125,
-0.1759033203125,
-0.485595703125,
0.17236328125,
0.3212890625,
-0.34033203125,
0.7939453125,
0.399658203125,
0.151123046875,
0.0906982421875,
-0.0047454833984375,
-0.239501953125,
-0.113037109375,
0.76220703125,
0.5341796875,
-0.15673828125,
-0.029815673828125,
-0.308837890625,
0.159423828125,
-0.90625,
0.2490234375,
-0.3359375,
0.129150390625,
0.32861328125,
-0.11663818359375,
0.38330078125,
1.123046875,
-0.26953125,
0.154541015625,
-0.05224609375,
-0.18359375,
0.56298828125,
-0.15234375,
0.5078125,
0.364013671875,
0.1795654296875,
-0.5849609375,
-0.0026378631591796875,
0.55859375,
-0.27392578125,
0.03045654296875,
0.04974365234375,
-0.5947265625,
-0.953125,
0.217041015625,
0.00792694091796875,
0.09991455078125,
0.408203125,
-0.7880859375,
-0.31494140625,
-0.1708984375,
-0.62060546875,
0.2039794921875,
-1.103515625,
-0.6240234375,
0.62841796875,
-0.074951171875,
-0.470458984375,
0.040771484375,
-0.7353515625,
-0.08416748046875,
0.01026153564453125,
0.6220703125,
-0.2327880859375,
0.163330078125,
-0.33447265625,
0.04864501953125,
-0.49169921875,
-0.5439453125,
-0.0182342529296875,
0.36865234375,
-0.385986328125,
-0.446533203125,
0.05474853515625,
1.2685546875,
0.5458984375,
-0.01500701904296875,
-0.41796875,
0.4755859375,
-0.256103515625,
0.0027923583984375,
-0.4638671875,
0.2110595703125,
0.12457275390625,
0.11761474609375,
-0.89892578125,
-0.1729736328125,
-0.437744140625,
0.5146484375,
0.10418701171875,
-0.224609375,
-0.2474365234375,
0.75146484375,
0.84130859375,
-0.456787109375,
0.61572265625,
-0.10833740234375,
0.384765625,
-0.20751953125,
-0.0714111328125,
0.062408447265625,
0.68798828125,
0.56201171875,
0.65087890625,
-0.264404296875,
0.390625,
1.0751953125,
-0.386474609375,
-0.382568359375,
0.042877197265625,
0.1990966796875,
-0.299560546875,
-0.40380859375,
-0.036407470703125,
-0.37548828125,
-0.0182037353515625,
-0.86962890625,
0.38671875,
-0.30859375,
-0.245849609375,
-0.2054443359375,
-0.48779296875,
0.8466796875,
-0.5185546875,
-0.0716552734375,
-0.1873779296875,
-0.343017578125,
0.398681640625,
0.53369140625,
0.407958984375,
-0.025787353515625,
0.8818359375,
0.279052734375,
0.70751953125,
0.64892578125,
0.0158843994140625,
0.38916015625,
-0.47998046875,
0.541015625,
0.328369140625,
-0.18115234375,
-0.25439453125,
-0.365966796875,
-1.0732421875,
0.22998046875,
-0.6533203125,
-0.44140625,
0.72412109375,
-0.5107421875,
0.1539306640625,
-0.25341796875,
0.3818359375,
-0.68505859375,
0.50146484375,
0.35498046875,
-0.345458984375,
-0.62255859375,
0.46142578125,
0.1090087890625,
0.378173828125,
-0.032135009765625,
1.154296875,
0.017242431640625,
1.6962890625,
0.427734375,
0.1556396484375,
-0.1492919921875,
0.08746337890625,
-0.2496337890625,
-0.60888671875,
-0.345947265625,
-0.297119140625,
0.3125,
-0.5908203125,
-0.2548828125,
0.119384765625,
0.72412109375,
-0.4375,
-0.7763671875,
-0.296142578125,
0.611328125,
-0.68603515625,
0.1651611328125,
-0.051055908203125,
0.042755126953125,
0.266357421875,
0.134033203125,
0.0921630859375,
-0.41943359375,
-0.0057373046875,
-0.426513671875,
0.401123046875,
-0.2607421875,
-0.72802734375,
-0.38037109375,
-0.83203125,
-0.27294921875,
-0.0771484375,
-0.625,
-1.0029296875,
0.2486572265625,
0.61376953125,
0.488525390625,
0.40869140625,
-0.3076171875,
-0.1260986328125,
1.0244140625,
1.0986328125,
-0.124755859375,
0.66748046875,
0.55224609375,
-0.72607421875,
0.4404296875,
-0.5,
0.64599609375,
-0.1051025390625,
0.2293701171875,
-0.0772705078125,
0.345458984375,
-0.6962890625,
-1.0810546875,
0.265380859375,
0.473388671875,
0.471923828125,
-0.78515625,
-1.2265625,
-0.232421875,
-1.06640625,
-0.30322265625,
-0.873046875,
1.0009765625,
-0.039154052734375,
-0.08258056640625,
0.0249481201171875,
-1.0146484375,
4.49609375,
1.0791015625,
0.580078125,
0.39599609375,
0.042877197265625,
0.5341796875,
0.4091796875,
-0.4453125,
-0.0199737548828125,
-0.79150390625,
0.1495361328125,
-0.345947265625,
0.028961181640625,
0.86962890625,
0.3251953125,
0.46435546875,
-0.38720703125,
0.170654296875,
-0.0120849609375,
-0.70068359375,
-0.98193359375,
0.408935546875,
0.0504150390625,
0.05926513671875,
-0.08831787109375,
0.5439453125,
0.416259765625,
-0.40185546875,
-0.362548828125,
-0.5947265625,
0.3291015625,
-0.8388671875,
0.96875,
-0.0157318115234375,
-0.07257080078125,
0.40185546875,
-0.250732421875,
-0.548828125,
-0.07916259765625,
0.2340087890625,
-0.0230255126953125,
-0.044769287109375,
0.4267578125,
-0.59326171875,
-0.08477783203125,
0.384765625,
-0.2188720703125,
0.454345703125,
0.2705078125,
-0.73876953125,
0.56982421875,
-0.2298583984375,
0.22900390625,
-0.429443359375,
-0.662109375,
0.26611328125,
0.1798095703125,
-0.094482421875,
-0.275390625,
0.457763671875,
0.7734375,
0.40576171875,
0.125,
0.56982421875,
-0.95263671875,
1.013671875,
0.065673828125,
0.43359375,
-0.55859375,
-0.283447265625,
-0.260009765625,
-0.233642578125,
-0.10565185546875,
-0.52490234375,
0.9326171875,
0.10540771484375,
-0.27197265625,
0.55029296875,
0.292236328125,
-0.521484375,
0.2724609375,
-0.2705078125,
-0.299072265625,
-0.358154296875,
0.346435546875,
1.1845703125,
-0.153076171875,
-0.18994140625,
-0.560546875,
0.59033203125,
0.7685546875,
0.501953125,
-0.00959014892578125,
-0.5517578125,
-0.26220703125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Anfisa the monkey learns to type. She is yet unfamiliar with the "space" key and can only type in lower-case Latin letters. Having typed for a fairly long line, Anfisa understood that it would be great to divide what she has written into k lines not shorter than a and not longer than b, for the text to resemble human speech more. Help Anfisa.
Input
The first line contains three integers k, a and b (1 β€ k β€ 200, 1 β€ a β€ b β€ 200). The second line contains a sequence of lowercase Latin letters β the text typed by Anfisa. It is guaranteed that the given line is not empty and its length does not exceed 200 symbols.
Output
Print k lines, each of which contains no less than a and no more than b symbols β Anfisa's text divided into lines. It is not allowed to perform any changes in the text, such as: deleting or adding symbols, changing their order, etc. If the solution is not unique, print any of them. If there is no solution, print "No solution" (without quotes).
Examples
Input
3 2 5
abrakadabra
Output
ab
rakad
abra
Input
4 1 2
abrakadabra
Output
No solution
Tags: dp
Correct Solution:
```
k,a,b=map(int,input().split())
s=input()
bal =len(s)
if bal>k*b or bal<k*a:
print("No solution")
else:
arr=[a]*k
bal-=a*k
inc=bal//k
bal-=inc*k
for i in range(k):
arr[i]+=inc
for i in range(bal):
arr[i]+=1
#print(arr)
for i in range(1,k):
arr[i]+=arr[i-1]
arr2=[s[:arr[0]]]
for i in range(1,k):
arr2.append(s[arr[i-1]:arr[i]])
#print(arr)
for i in arr2:
print(i)
```
| 38,040
|
[
0.392578125,
0.02593994140625,
0.347900390625,
0.180419921875,
-0.362060546875,
-0.55322265625,
0.0550537109375,
0.10687255859375,
-0.0909423828125,
0.87744140625,
0.67578125,
0.380615234375,
-0.56201171875,
-0.7041015625,
-0.5673828125,
0.1561279296875,
-0.5947265625,
-0.83056640625,
-0.1571044921875,
-0.3994140625,
0.11077880859375,
0.03289794921875,
-1.5107421875,
-0.400390625,
-0.456298828125,
1.1123046875,
0.356689453125,
0.12939453125,
1.0888671875,
0.97998046875,
0.36279296875,
-0.6103515625,
0.491943359375,
-1.380859375,
-0.371826171875,
-0.515625,
0.68701171875,
-0.5908203125,
-0.64892578125,
-0.416748046875,
0.278564453125,
-0.157470703125,
0.48681640625,
-0.841796875,
-1.3388671875,
0.173583984375,
-0.445068359375,
-0.2861328125,
-0.174072265625,
-0.4375,
-0.2005615234375,
-0.0294189453125,
0.6884765625,
-0.12890625,
-0.353759765625,
-0.302490234375,
0.1768798828125,
-0.26171875,
-0.923828125,
0.299072265625,
0.2105712890625,
0.349609375,
-0.201171875,
-0.25390625,
-0.184814453125,
0.05584716796875,
-0.369873046875,
-0.295166015625,
-0.327392578125,
-0.546875,
-0.17578125,
0.459716796875,
-0.167724609375,
-0.428466796875,
-0.56494140625,
-0.215576171875,
-0.1756591796875,
-0.11932373046875,
-0.68359375,
0.7646484375,
0.11346435546875,
0.74951171875,
0.003849029541015625,
0.7763671875,
-0.61767578125,
-0.7919921875,
-0.08489990234375,
0.1649169921875,
0.2998046875,
-0.2353515625,
-0.407958984375,
0.50732421875,
-0.45947265625,
0.54736328125,
0.73828125,
0.67919921875,
-0.12347412109375,
0.31298828125,
0.302490234375,
0.1915283203125,
0.841796875,
0.8173828125,
-0.457275390625,
0.70263671875,
-0.478515625,
0.151123046875,
0.049163818359375,
0.296142578125,
-0.0240936279296875,
-0.478271484375,
-0.3291015625,
-0.343505859375,
0.386474609375,
0.4208984375,
-0.37060546875,
0.488525390625,
0.1180419921875,
0.282470703125,
-0.7626953125,
0.06134033203125,
0.1529541015625,
0.4814453125,
0.433349609375,
-0.392822265625,
0.0085601806640625,
-0.3046875,
-0.5419921875,
0.98828125,
-0.392578125,
-0.15478515625,
0.638671875,
0.2257080078125,
0.0987548828125,
0.337890625,
-0.09539794921875,
0.69970703125,
-0.075927734375,
0.67236328125,
0.45458984375,
-0.54443359375,
0.43896484375,
-0.025726318359375,
-0.0830078125,
1.271484375,
0.47607421875,
0.01561737060546875,
0.5263671875,
0.426025390625,
-0.49609375,
0.27392578125,
-0.888671875,
0.414794921875,
0.264892578125,
0.343994140625,
-0.275146484375,
-0.10174560546875,
-0.1658935546875,
0.423583984375,
-0.01401519775390625,
0.5068359375,
-0.421875,
-0.08258056640625,
-0.176513671875,
0.859375,
-0.0941162109375,
0.69921875,
-0.235107421875,
-0.304443359375,
0.2445068359375,
-0.4033203125,
0.82275390625,
-0.3330078125,
-0.07708740234375,
0.83349609375,
0.32958984375,
1.0126953125,
0.83349609375,
0.049530029296875,
0.189697265625,
0.334228515625,
0.01361846923828125,
0.599609375,
0.1923828125,
0.61572265625,
0.6337890625,
0.3662109375,
0.1824951171875,
-0.247802734375,
-0.81298828125,
-0.60302734375,
-0.0538330078125,
0.6015625,
-0.41943359375,
0.461181640625,
0.296630859375,
0.051116943359375,
-0.70166015625,
-0.256103515625,
0.436767578125,
-0.873046875,
-0.451416015625,
0.84326171875,
-0.367919921875,
0.54833984375,
-0.4736328125,
-0.49755859375,
0.18115234375,
1.3232421875,
-0.362548828125,
-0.104736328125,
0.1517333984375,
-0.0927734375,
-0.3671875,
-0.2308349609375,
-0.10321044921875,
-0.50537109375,
-0.5185546875,
0.71875,
-0.2578125,
0.251708984375,
0.01528167724609375,
0.52294921875,
0.53076171875,
0.76220703125,
-0.607421875,
-0.197021484375,
0.67138671875,
1.017578125,
-0.01525115966796875,
0.1973876953125,
-0.01116180419921875,
0.7626953125,
0.403564453125,
0.67919921875,
0.38134765625,
0.480224609375,
0.387939453125,
0.8046875,
0.0870361328125,
0.34912109375,
0.1015625,
0.273193359375,
0.43359375,
0.45556640625,
0.277587890625,
0.324462890625,
-0.262451171875,
0.059356689453125,
-0.2371826171875,
0.361083984375,
-0.2249755859375,
0.8212890625,
0.2469482421875,
0.306640625,
-0.294921875,
-0.28466796875,
0.313720703125,
0.91162109375,
-0.82568359375,
-0.76123046875,
-0.169921875,
-0.453369140625,
0.423828125,
0.011383056640625,
0.34716796875,
0.484619140625,
0.18896484375,
0.27685546875,
-0.259033203125,
-0.57470703125,
-0.9873046875,
-0.6484375,
-0.83544921875,
-0.15234375,
-0.50537109375,
-0.212646484375,
0.249755859375,
-1.048828125,
0.5478515625,
-0.52490234375,
-0.2423095703125,
-0.08685302734375,
-0.66943359375,
0.56201171875,
0.19091796875,
0.69287109375,
-0.55419921875,
0.62353515625,
0.28466796875,
1.0087890625,
-0.382568359375,
-0.345458984375,
-0.0906982421875,
-0.77734375,
0.6982421875,
-0.2445068359375,
0.11444091796875,
0.2230224609375,
-1.0595703125,
-1.1875,
-0.450439453125,
-0.319091796875,
-0.5283203125,
0.2198486328125,
-0.26123046875,
0.7900390625,
0.272705078125,
-0.7861328125,
0.1552734375,
0.62255859375,
-0.57861328125,
0.5869140625,
0.2410888671875,
0.02301025390625,
-0.74169921875,
0.958984375,
0.552734375,
0.36767578125,
-0.5537109375,
-0.78369140625,
-0.479736328125,
0.172607421875,
0.242919921875,
-0.1912841796875,
-0.405517578125,
0.337646484375,
0.26513671875,
-1.2001953125,
0.30810546875,
-0.82275390625,
-0.5849609375,
-0.4189453125,
-0.64697265625,
0.703125,
0.802734375,
0.2164306640625,
-0.1806640625,
-0.359375,
-0.6865234375,
0.42138671875,
0.39453125,
-0.8564453125,
-0.1434326171875,
0.73779296875,
0.0347900390625,
-0.1336669921875,
-0.05242919921875,
-0.2249755859375,
-0.2431640625,
-0.04010009765625,
-0.11334228515625,
0.239501953125,
0.440673828125,
0.25830078125,
0.5556640625,
0.52734375,
-0.8017578125,
-0.04302978515625,
-0.17626953125,
0.85791015625,
0.11981201171875,
0.36669921875,
0.7421875,
-0.5,
-0.36669921875,
-0.90234375,
0.455810546875,
0.1907958984375,
0.666015625,
-0.9970703125,
0.34033203125,
0.28125,
-0.394287109375,
0.19775390625,
-0.85400390625,
-0.2445068359375,
1.1279296875,
-0.0906982421875,
1.076171875,
-0.93310546875,
0.352783203125,
-0.1224365234375,
0.14501953125,
0.56298828125,
0.291259765625,
0.21728515625,
-0.285888671875,
-0.07586669921875,
0.01375579833984375,
-0.53125,
0.0159149169921875,
-0.31396484375,
0.38623046875,
-0.468994140625,
-0.49755859375,
-0.90576171875,
0.410400390625,
0.9560546875,
0.460693359375,
0.0863037109375,
0.227783203125,
-0.07440185546875,
0.95947265625,
0.38720703125,
-0.37890625,
0.0911865234375,
-0.73095703125,
0.91845703125,
0.53076171875,
-0.138671875,
-0.305419921875,
-0.5263671875,
0.2056884765625,
0.2081298828125,
0.00010716915130615234,
-0.0653076171875,
-0.810546875,
-0.1697998046875,
-0.052459716796875,
0.63037109375,
-0.60888671875,
-0.51416015625,
-0.1436767578125,
0.368896484375,
0.143310546875,
-1.04296875,
0.177001953125,
-0.70751953125,
1.0244140625,
0.300537109375,
-0.478759765625,
-0.04541015625,
-0.418212890625,
-0.810546875,
-0.23388671875,
0.263916015625,
0.8916015625,
-0.31591796875,
0.443359375,
-1.03515625,
0.407470703125,
0.66943359375,
-0.230712890625,
0.197265625,
0.117919921875,
0.11224365234375,
-0.1328125,
0.6796875,
-0.308349609375,
-1.02734375,
0.70068359375,
-1.2900390625,
0.4853515625,
-0.2294921875,
0.0540771484375,
-0.474609375,
-0.2188720703125,
0.40869140625,
0.3291015625,
-0.0909423828125,
-0.130126953125,
0.038848876953125,
0.2454833984375,
-0.779296875,
-0.82666015625,
0.254638671875,
-0.1785888671875,
-0.26318359375,
0.509765625,
0.181396484375,
-0.56005859375,
0.330078125,
0.5087890625,
-0.67822265625,
0.4775390625,
-0.6611328125,
0.27783203125,
-0.09356689453125,
-0.5771484375,
-0.263916015625,
-0.404296875,
0.429931640625,
0.00023543834686279297,
-0.548828125,
-0.09173583984375,
-1.0517578125,
0.045013427734375,
-0.476806640625,
-0.705078125,
0.1505126953125,
0.685546875,
-0.25439453125,
-0.0714111328125,
-0.2369384765625,
0.1494140625,
-0.3291015625,
-0.49755859375,
-0.3271484375,
0.468505859375,
0.2451171875,
0.66455078125,
0.2115478515625,
-0.46142578125,
0.296630859375,
0.016143798828125,
0.0256500244140625,
-0.315185546875,
-0.0875244140625,
0.1016845703125,
-0.4482421875,
-0.0220947265625,
0.35693359375,
0.348388671875,
0.413818359375,
0.82421875,
-0.152587890625,
0.5791015625,
0.481689453125,
-0.61669921875,
1.279296875,
0.0570068359375,
-1.0458984375,
-0.2890625,
0.52685546875,
-0.2000732421875,
0.6318359375,
0.323974609375,
-0.58544921875,
-0.64208984375,
-1.1962890625,
0.217529296875,
-0.47607421875,
-0.2330322265625,
-1.06640625,
-0.417236328125,
-0.146484375,
0.3388671875,
-0.2274169921875,
-0.546875,
-0.01529693603515625,
-1.1884765625,
0.208251953125,
-0.51318359375,
-0.275390625,
-0.798828125,
-0.2724609375,
0.060943603515625,
1.013671875,
0.214111328125,
0.00945281982421875,
0.37255859375,
-0.53857421875,
0.447265625,
-0.1221923828125,
-0.74755859375,
-0.416748046875,
0.006992340087890625,
0.257080078125,
-0.29833984375,
0.50390625,
-0.240966796875,
0.71826171875,
-0.83154296875,
-0.2154541015625,
-0.2374267578125,
-0.447265625,
-0.08819580078125,
-0.43017578125,
1.044921875,
0.00141143798828125,
0.009490966796875,
-0.39404296875,
0.7255859375,
0.77685546875,
-0.270751953125,
-0.300048828125,
-0.65625,
-0.203369140625,
-1.0673828125,
0.54541015625,
-0.59619140625,
0.27783203125,
-0.4912109375,
0.105224609375,
0.83349609375,
-0.35400390625,
0.564453125,
1.203125,
-0.05303955078125,
0.1412353515625,
-0.798828125,
0.76513671875,
0.39404296875,
-0.669921875,
-0.0307464599609375,
0.1309814453125,
-0.78955078125,
0.15478515625,
-0.184814453125,
-0.74609375,
-0.51611328125,
0.59765625,
1.5400390625,
-0.469482421875,
0.79638671875,
0.0162506103515625,
-1.21875,
-0.92578125,
0.7119140625,
-0.0537109375,
0.332763671875,
0.8310546875,
-0.376220703125,
-0.32763671875,
0.1446533203125,
-0.05853271484375,
-0.6923828125,
-0.5537109375,
1.1201171875,
-0.09320068359375,
-0.439697265625,
0.58544921875,
1.2548828125,
-1.177734375,
-1.0244140625,
-0.001674652099609375,
-0.0345458984375,
-0.271728515625,
-0.31494140625,
0.17041015625,
0.70068359375,
-0.65380859375,
0.54052734375,
0.2213134765625,
0.007030487060546875,
0.498779296875,
0.2354736328125,
0.312255859375,
-0.447998046875,
0.301513671875,
1.048828125,
-0.1981201171875,
-0.0517578125,
-0.77001953125,
-0.35205078125,
-0.329833984375,
0.091796875,
0.630859375,
-0.59716796875,
-0.130615234375,
0.72119140625,
0.1414794921875,
0.6279296875,
-0.77392578125,
-0.34033203125,
0.34228515625,
-0.88330078125,
-0.299072265625,
0.0257415771484375,
0.89892578125,
-0.10205078125,
0.255859375,
-0.79638671875,
-0.2008056640625,
0.441162109375,
0.265380859375,
-0.048492431640625,
-0.88720703125,
-0.73388671875,
-0.64208984375,
-0.88330078125,
-0.393798828125,
-0.95849609375,
-0.001049041748046875,
0.33203125,
0.08526611328125,
-0.30078125,
0.291259765625,
0.426025390625,
-0.93212890625,
0.54931640625,
-0.57177734375,
0.333984375,
-0.7412109375,
-0.43408203125,
-0.56298828125,
-0.19873046875,
-0.394775390625,
0.06866455078125,
-0.85791015625,
0.449951171875,
0.0007405281066894531,
1.0830078125,
0.09027099609375,
-0.00016820430755615234,
-0.142578125,
-0.481201171875,
0.26123046875,
0.06890869140625,
-0.4443359375,
0.8173828125,
0.326171875,
0.1611328125,
0.1341552734375,
0.046905517578125,
-0.115966796875,
-0.1915283203125,
0.681640625,
0.71044921875,
-0.1351318359375,
-0.031646728515625,
-0.421142578125,
0.301513671875,
-0.92724609375,
0.2183837890625,
-0.30078125,
0.130615234375,
0.3984375,
-0.2213134765625,
0.47265625,
1.11328125,
-0.254150390625,
0.11541748046875,
0.07647705078125,
-0.267822265625,
0.43798828125,
-0.11822509765625,
0.4931640625,
0.443603515625,
0.348388671875,
-0.4970703125,
-0.07147216796875,
0.441650390625,
-0.223388671875,
0.041748046875,
-0.060882568359375,
-0.54248046875,
-0.869140625,
0.3671875,
0.08087158203125,
0.07366943359375,
0.55126953125,
-0.77880859375,
-0.270751953125,
-0.1419677734375,
-0.64794921875,
0.1611328125,
-1.080078125,
-0.654296875,
0.6728515625,
-0.08013916015625,
-0.53125,
0.03851318359375,
-0.8359375,
-0.140625,
0.048614501953125,
0.59228515625,
-0.337158203125,
0.26025390625,
-0.30859375,
-0.0242767333984375,
-0.369873046875,
-0.429443359375,
-0.0248870849609375,
0.396240234375,
-0.412109375,
-0.3212890625,
0.03564453125,
1.25390625,
0.5478515625,
0.0104217529296875,
-0.4111328125,
0.29345703125,
-0.10565185546875,
-0.04248046875,
-0.5927734375,
0.10333251953125,
0.05108642578125,
0.290771484375,
-0.97509765625,
-0.1865234375,
-0.5283203125,
0.52001953125,
0.1614990234375,
-0.1290283203125,
-0.193359375,
0.828125,
0.7744140625,
-0.487548828125,
0.6904296875,
0.01678466796875,
0.388671875,
-0.0653076171875,
-0.05303955078125,
-0.002246856689453125,
0.76416015625,
0.55517578125,
0.61572265625,
-0.2161865234375,
0.436279296875,
1.025390625,
-0.382568359375,
-0.385009765625,
0.10040283203125,
0.285888671875,
-0.2783203125,
-0.44921875,
-0.084228515625,
-0.267578125,
-0.10186767578125,
-0.87158203125,
0.421630859375,
-0.311767578125,
-0.25634765625,
-0.2054443359375,
-0.41015625,
0.919921875,
-0.474609375,
-0.150634765625,
-0.155517578125,
-0.5146484375,
0.445068359375,
0.51513671875,
0.414306640625,
-0.1646728515625,
0.95703125,
0.285400390625,
0.54541015625,
0.5859375,
0.09527587890625,
0.497314453125,
-0.609375,
0.50732421875,
0.310791015625,
-0.1553955078125,
-0.244140625,
-0.342041015625,
-0.97705078125,
0.1949462890625,
-0.4345703125,
-0.4658203125,
0.73876953125,
-0.5048828125,
0.1336669921875,
-0.385986328125,
0.460693359375,
-0.7138671875,
0.53369140625,
0.39306640625,
-0.395751953125,
-0.5888671875,
0.52294921875,
0.0869140625,
0.398681640625,
-0.02374267578125,
1.1171875,
-0.0234222412109375,
1.6748046875,
0.411376953125,
0.04913330078125,
-0.15380859375,
0.1104736328125,
-0.296630859375,
-0.73779296875,
-0.36474609375,
-0.443115234375,
0.335693359375,
-0.5576171875,
-0.281982421875,
0.033050537109375,
0.71875,
-0.4853515625,
-0.72412109375,
-0.261474609375,
0.5517578125,
-0.78125,
0.1171875,
-0.14990234375,
-0.00506591796875,
0.3310546875,
-0.036224365234375,
0.061798095703125,
-0.38916015625,
-0.11029052734375,
-0.34619140625,
0.427001953125,
-0.41162109375,
-0.6689453125,
-0.446044921875,
-0.87158203125,
-0.23388671875,
0.0902099609375,
-0.69775390625,
-0.90087890625,
0.2236328125,
0.64990234375,
0.4404296875,
0.329345703125,
-0.28271484375,
-0.063232421875,
0.88427734375,
1.076171875,
-0.11541748046875,
0.467529296875,
0.62255859375,
-0.59765625,
0.3251953125,
-0.513671875,
0.533203125,
-0.11798095703125,
0.1055908203125,
-0.0601806640625,
0.4951171875,
-0.76318359375,
-1.0283203125,
0.349609375,
0.246826171875,
0.382080078125,
-0.791015625,
-1.31640625,
-0.2452392578125,
-1.0361328125,
-0.181884765625,
-0.81689453125,
0.966796875,
-0.0810546875,
-0.09576416015625,
0.027923583984375,
-0.986328125,
4.49609375,
1.125,
0.65185546875,
0.478759765625,
0.058074951171875,
0.578125,
0.5068359375,
-0.45849609375,
-0.045989990234375,
-0.84619140625,
0.1258544921875,
-0.356201171875,
0.17333984375,
0.830078125,
0.412109375,
0.55078125,
-0.5029296875,
0.1561279296875,
0.01490020751953125,
-0.83984375,
-1.0322265625,
0.335205078125,
0.007228851318359375,
0.1483154296875,
-0.117431640625,
0.492431640625,
0.376953125,
-0.5625,
-0.330810546875,
-0.673828125,
0.280517578125,
-0.86865234375,
0.8994140625,
-0.029876708984375,
-0.105712890625,
0.5078125,
-0.23046875,
-0.50927734375,
-0.056488037109375,
0.309814453125,
0.01200103759765625,
-0.153076171875,
0.34521484375,
-0.68701171875,
-0.047119140625,
0.366455078125,
-0.263916015625,
0.4873046875,
0.2379150390625,
-0.7421875,
0.62451171875,
-0.2147216796875,
0.154541015625,
-0.429443359375,
-0.71435546875,
0.334716796875,
0.285400390625,
-0.1519775390625,
-0.262939453125,
0.52783203125,
0.70654296875,
0.469970703125,
0.2098388671875,
0.705078125,
-0.93115234375,
0.89453125,
0.05194091796875,
0.348876953125,
-0.5693359375,
-0.11712646484375,
-0.27880859375,
-0.119873046875,
0.01018524169921875,
-0.53515625,
0.82470703125,
-0.00315093994140625,
-0.294921875,
0.57958984375,
0.1983642578125,
-0.58251953125,
0.19287109375,
-0.1722412109375,
-0.3349609375,
-0.28515625,
0.429443359375,
1.3056640625,
-0.28857421875,
-0.161376953125,
-0.541015625,
0.51806640625,
0.798828125,
0.375,
-0.0183563232421875,
-0.63818359375,
-0.377197265625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Tags: implementation, strings
Correct Solution:
```
s = input()
ans = 0
prev = 'a'
for c in s:
v = abs(ord(c)-ord(prev))
ans += min(v, 26-v)
prev = c
print(ans)
```
| 38,175
|
[
0.41162109375,
-0.171142578125,
0.0247650146484375,
0.38427734375,
-0.461181640625,
-0.5634765625,
-0.039337158203125,
-0.127197265625,
0.01444244384765625,
0.537109375,
0.7392578125,
-0.29931640625,
0.0889892578125,
-0.72119140625,
-0.6552734375,
0.06298828125,
-0.386474609375,
-0.650390625,
-0.6533203125,
-0.13427734375,
0.1846923828125,
-0.3310546875,
-1.349609375,
-0.262939453125,
-0.73828125,
0.8935546875,
0.1851806640625,
0.232177734375,
0.98095703125,
1.1650390625,
-0.10235595703125,
-0.292236328125,
1.091796875,
-1.19921875,
-0.11322021484375,
-0.34912109375,
0.3857421875,
-0.5546875,
0.1558837890625,
-0.49560546875,
0.2266845703125,
-0.213134765625,
0.634765625,
-0.53515625,
-0.96337890625,
-0.042266845703125,
-0.045928955078125,
-0.46142578125,
-0.1619873046875,
-0.7373046875,
0.11419677734375,
-0.1739501953125,
0.4931640625,
-0.196044921875,
-0.10601806640625,
-0.259765625,
0.004543304443359375,
-0.0936279296875,
-0.462158203125,
0.1446533203125,
0.144287109375,
0.1700439453125,
0.14453125,
-0.94580078125,
-0.272216796875,
0.0499267578125,
0.037261962890625,
-0.251708984375,
-0.00930023193359375,
-0.9716796875,
-0.3271484375,
0.3408203125,
0.05517578125,
-0.76513671875,
-0.361083984375,
-0.048309326171875,
0.0775146484375,
0.17822265625,
-0.6533203125,
0.548828125,
0.050567626953125,
0.6796875,
-0.220947265625,
0.1796875,
-0.54052734375,
-0.452880859375,
0.018310546875,
-0.213134765625,
0.1534423828125,
-0.33056640625,
-0.136474609375,
0.52587890625,
-0.70703125,
0.18359375,
0.6806640625,
0.70556640625,
-0.4453125,
0.45556640625,
0.320556640625,
0.266845703125,
0.5732421875,
1.0390625,
-0.78759765625,
0.939453125,
-0.1412353515625,
-0.051727294921875,
0.1884765625,
-0.2418212890625,
-0.290771484375,
-0.5859375,
-0.393310546875,
-0.45361328125,
0.5224609375,
0.2578125,
-0.11163330078125,
0.69580078125,
0.310302734375,
0.470458984375,
-0.70166015625,
0.5,
0.135986328125,
-0.2034912109375,
0.2462158203125,
-0.3154296875,
-0.158447265625,
-0.0947265625,
-0.44921875,
0.65234375,
-0.40771484375,
0.03863525390625,
0.62744140625,
0.54833984375,
0.0243072509765625,
0.494873046875,
-0.18310546875,
0.73486328125,
-0.1873779296875,
0.66845703125,
0.79296875,
-0.646484375,
0.2548828125,
-0.480712890625,
0.4228515625,
1.7900390625,
0.53857421875,
-0.14453125,
0.67333984375,
0.58154296875,
-0.89990234375,
0.8046875,
-0.60693359375,
0.58349609375,
0.08380126953125,
0.260009765625,
-0.169921875,
-0.052825927734375,
-0.38232421875,
0.64892578125,
-0.15869140625,
0.464111328125,
-0.59423828125,
-0.09173583984375,
0.05755615234375,
0.9853515625,
-0.06988525390625,
0.9033203125,
-0.32373046875,
-0.396240234375,
-0.1634521484375,
-0.92138671875,
0.255126953125,
-0.1656494140625,
-0.10791015625,
0.5390625,
0.55078125,
0.81884765625,
0.87939453125,
-0.0660400390625,
0.56884765625,
0.18994140625,
-0.255126953125,
0.10198974609375,
0.1346435546875,
0.63720703125,
-0.07843017578125,
0.30908203125,
0.05419921875,
-0.264892578125,
-0.52197265625,
-0.5,
-0.06298828125,
0.5927734375,
-0.2939453125,
0.13671875,
-0.0484619140625,
0.1259765625,
-1.0771484375,
0.056884765625,
-0.032501220703125,
-1.052734375,
-0.244873046875,
0.62353515625,
-0.04376220703125,
0.3359375,
-0.3603515625,
-0.87451171875,
0.364501953125,
1.02734375,
-0.478759765625,
-0.046417236328125,
0.6396484375,
0.2025146484375,
-0.222412109375,
0.255859375,
0.2105712890625,
-0.25732421875,
-0.7783203125,
0.7490234375,
-0.35791015625,
0.1456298828125,
-0.07232666015625,
0.8310546875,
0.186767578125,
0.57568359375,
-0.30078125,
0.286376953125,
0.379150390625,
1.1044921875,
-0.061431884765625,
0.56591796875,
0.144775390625,
0.98291015625,
0.7900390625,
0.85107421875,
0.6689453125,
0.0811767578125,
0.317626953125,
0.54150390625,
0.027130126953125,
-0.07916259765625,
0.08941650390625,
0.282958984375,
0.55859375,
0.39404296875,
-0.2113037109375,
0.492919921875,
0.03887939453125,
-0.2078857421875,
-0.53076171875,
0.346435546875,
-0.312744140625,
0.9072265625,
-0.126953125,
0.32470703125,
-0.1693115234375,
-0.222412109375,
0.360595703125,
0.63232421875,
-0.361083984375,
-0.407958984375,
0.2841796875,
0.289794921875,
0.1287841796875,
0.002655029296875,
-0.059234619140625,
0.337890625,
0.00269317626953125,
0.8486328125,
-0.4501953125,
-0.304443359375,
-1.0595703125,
-0.95654296875,
-0.74072265625,
-0.11346435546875,
-0.57763671875,
-0.038604736328125,
0.414794921875,
-0.59228515625,
0.7607421875,
-0.62744140625,
0.08624267578125,
-0.05841064453125,
-0.75244140625,
0.681640625,
0.04541015625,
0.673828125,
-0.3349609375,
0.423095703125,
0.10400390625,
0.84423828125,
-0.611328125,
-0.29833984375,
-0.483642578125,
-0.354736328125,
0.38134765625,
-0.07568359375,
0.5244140625,
-0.47314453125,
-0.9072265625,
-0.7509765625,
-0.18212890625,
-0.04345703125,
-0.488037109375,
0.288818359375,
-0.51611328125,
0.8818359375,
0.60400390625,
-0.86572265625,
0.39697265625,
0.8046875,
-0.9453125,
0.43505859375,
0.306640625,
-0.0294342041015625,
-0.9677734375,
1.095703125,
0.390380859375,
0.55078125,
-0.256591796875,
-0.0012226104736328125,
-0.56201171875,
0.38525390625,
-0.316650390625,
-0.57373046875,
-0.2357177734375,
0.49658203125,
0.1942138671875,
-1.0166015625,
0.544921875,
-1.03515625,
-0.650390625,
-0.4677734375,
-0.48046875,
0.77783203125,
0.7333984375,
-0.0046844482421875,
0.141357421875,
0.0034732818603515625,
0.26708984375,
0.71923828125,
0.398193359375,
-0.458740234375,
0.177978515625,
0.41845703125,
-0.6171875,
0.509765625,
0.442626953125,
-0.1600341796875,
-0.196533203125,
-0.08477783203125,
0.13818359375,
0.1322021484375,
0.246337890625,
0.243896484375,
0.63427734375,
0.78759765625,
-0.493896484375,
-0.2509765625,
-0.65869140625,
1.03515625,
0.435791015625,
0.482421875,
0.2213134765625,
-0.113037109375,
-0.53564453125,
-0.787109375,
0.09576416015625,
0.61962890625,
0.68994140625,
-0.55517578125,
0.708984375,
0.061553955078125,
-0.5341796875,
-0.0102996826171875,
-0.60107421875,
-0.5,
0.8056640625,
-0.1376953125,
0.86572265625,
-0.5390625,
0.047637939453125,
-0.383544921875,
0.0175323486328125,
0.0693359375,
0.097412109375,
0.59033203125,
-0.293212890625,
-0.25439453125,
-0.60400390625,
-0.2646484375,
-0.0192413330078125,
-0.5634765625,
0.2279052734375,
-0.65576171875,
-0.490966796875,
-0.548828125,
0.324951171875,
1.017578125,
0.54345703125,
-0.1336669921875,
0.317138671875,
0.1759033203125,
0.267822265625,
0.30810546875,
-0.56591796875,
-0.054443359375,
-0.6005859375,
0.72314453125,
0.26953125,
-0.376220703125,
-0.56005859375,
-0.363037109375,
-0.71044921875,
0.146484375,
0.253173828125,
-0.13720703125,
-0.63037109375,
0.423828125,
-0.2005615234375,
0.431396484375,
-0.6279296875,
-0.29150390625,
-0.472900390625,
0.57421875,
0.69189453125,
-0.0523681640625,
0.02911376953125,
-0.5751953125,
0.6298828125,
0.59375,
-0.0367431640625,
-0.5302734375,
-0.1915283203125,
-0.6611328125,
-0.50146484375,
-0.01421356201171875,
0.64111328125,
0.398193359375,
0.06707763671875,
-1.0224609375,
0.7685546875,
0.204345703125,
-0.65234375,
-0.1263427734375,
0.411376953125,
0.10198974609375,
-0.216796875,
0.6533203125,
-0.1519775390625,
-0.6220703125,
0.23876953125,
-1.0439453125,
0.70166015625,
-0.20068359375,
0.406005859375,
-0.07763671875,
-0.1033935546875,
0.1427001953125,
0.235595703125,
-0.7099609375,
-0.0243072509765625,
-0.2471923828125,
0.6142578125,
-1.05078125,
-0.56201171875,
0.64013671875,
-0.21142578125,
-0.36572265625,
0.56103515625,
-0.351318359375,
-0.322021484375,
0.281005859375,
0.0223846435546875,
-0.5048828125,
-0.0660400390625,
-0.361328125,
0.486572265625,
0.058349609375,
-0.2607421875,
0.392333984375,
-0.580078125,
1.1728515625,
0.1654052734375,
-0.72509765625,
-0.07562255859375,
-1.06640625,
-0.266845703125,
-0.20947265625,
-0.63818359375,
-0.01258087158203125,
0.0009927749633789062,
-0.2452392578125,
-0.1478271484375,
-0.236328125,
-0.5400390625,
-0.234619140625,
-0.68115234375,
0.257080078125,
0.53173828125,
0.384765625,
0.270263671875,
-0.12103271484375,
-0.5732421875,
0.343505859375,
-0.33935546875,
-0.04241943359375,
-0.416748046875,
-0.084228515625,
-0.483642578125,
-0.287353515625,
-0.30078125,
0.343505859375,
-0.333984375,
0.081298828125,
0.87841796875,
0.4990234375,
0.346923828125,
-0.21875,
-0.40625,
0.6005859375,
0.093994140625,
-1.0810546875,
-0.68017578125,
1.109375,
0.0489501953125,
0.58642578125,
0.5146484375,
-0.57958984375,
-1.1435546875,
-0.9716796875,
0.1708984375,
-0.444091796875,
-0.23095703125,
-0.72900390625,
-0.354736328125,
-0.57568359375,
0.40478515625,
-0.11822509765625,
-0.374267578125,
0.330322265625,
-0.88525390625,
0.178466796875,
-0.482177734375,
0.224609375,
-0.48388671875,
-0.81298828125,
-0.47900390625,
0.8447265625,
0.317138671875,
0.278564453125,
-0.00469207763671875,
-0.00197601318359375,
0.468994140625,
0.297607421875,
-0.275146484375,
-0.35595703125,
-0.131591796875,
0.5927734375,
-0.284912109375,
-0.1741943359375,
-0.0882568359375,
0.63818359375,
-0.92041015625,
0.4091796875,
0.1436767578125,
-0.1876220703125,
-0.197509765625,
-0.319091796875,
1.0283203125,
-0.2349853515625,
-0.01476287841796875,
-0.38037109375,
0.5908203125,
0.53662109375,
-0.275390625,
-0.0716552734375,
-0.595703125,
-0.411376953125,
-1.03515625,
0.74853515625,
-0.0648193359375,
0.324951171875,
-0.479248046875,
-0.214111328125,
1.3173828125,
-0.42236328125,
0.401123046875,
1.1865234375,
0.1312255859375,
0.246337890625,
-0.66015625,
0.541015625,
0.339111328125,
-0.39501953125,
-0.376953125,
0.01507568359375,
-0.771484375,
0.50146484375,
-0.19482421875,
-0.9658203125,
-0.5166015625,
0.5302734375,
1.234375,
-0.2330322265625,
0.546875,
-0.2186279296875,
-1.134765625,
-0.6083984375,
0.7314453125,
-0.326904296875,
0.213623046875,
0.66796875,
-0.0248260498046875,
-0.1451416015625,
-0.07861328125,
0.00714874267578125,
-0.397216796875,
-0.4150390625,
1.0087890625,
-0.28564453125,
-0.7724609375,
1.2451171875,
0.517578125,
-0.8349609375,
-0.98095703125,
0.10150146484375,
-0.1895751953125,
-0.328369140625,
-0.89892578125,
0.277587890625,
0.251953125,
-0.374755859375,
-0.15771484375,
0.417236328125,
-0.2430419921875,
0.288818359375,
0.034515380859375,
0.3193359375,
-0.52294921875,
0.0640869140625,
0.302978515625,
-0.423583984375,
-0.2333984375,
-0.89990234375,
-0.253662109375,
-0.65087890625,
-0.06402587890625,
0.37451171875,
-0.323974609375,
0.4326171875,
0.383544921875,
0.2069091796875,
0.9208984375,
-0.2137451171875,
-0.26416015625,
0.02813720703125,
-0.407470703125,
-0.6103515625,
-0.37255859375,
0.262939453125,
-0.421142578125,
-0.1497802734375,
-0.65673828125,
-0.2822265625,
0.355712890625,
0.330322265625,
-0.464111328125,
-1.16796875,
-0.299072265625,
-1.064453125,
-0.57861328125,
-0.412353515625,
-0.5703125,
-0.350341796875,
-0.173828125,
-0.045989990234375,
-0.39794921875,
0.0504150390625,
0.476806640625,
-0.1922607421875,
0.69189453125,
-0.392822265625,
0.447265625,
-0.84228515625,
-0.043304443359375,
-0.5546875,
0.369384765625,
-0.4560546875,
-0.1397705078125,
-0.72705078125,
0.0152587890625,
0.18017578125,
0.529296875,
-0.360107421875,
0.356689453125,
0.09613037109375,
-0.455322265625,
-0.0367431640625,
0.064697265625,
-0.03338623046875,
0.55615234375,
0.93212890625,
-0.154541015625,
0.42138671875,
-0.1549072265625,
-0.5732421875,
-0.147216796875,
0.51318359375,
0.459716796875,
-0.21630859375,
-0.10882568359375,
-0.202392578125,
0.38232421875,
-0.9716796875,
0.26904296875,
-0.279541015625,
0.359619140625,
-0.041900634765625,
-0.211181640625,
0.578125,
0.65185546875,
0.11737060546875,
0.0667724609375,
-0.09930419921875,
0.09649658203125,
-0.1114501953125,
0.2259521484375,
0.1090087890625,
0.5625,
0.10986328125,
-0.388916015625,
-0.085205078125,
0.29931640625,
-0.396728515625,
0.64892578125,
-0.473388671875,
-0.39111328125,
-0.736328125,
-0.1484375,
-0.03466796875,
0.7353515625,
0.4990234375,
-0.64453125,
0.0243682861328125,
-0.2315673828125,
-0.666015625,
0.06890869140625,
-1.306640625,
-0.908203125,
0.17041015625,
-0.123779296875,
-0.08148193359375,
-0.441650390625,
-0.61181640625,
-0.1083984375,
-0.1285400390625,
0.78662109375,
-0.763671875,
0.45947265625,
-0.056365966796875,
0.69775390625,
-0.64404296875,
0.2822265625,
0.383544921875,
0.705078125,
-0.293701171875,
-0.478759765625,
-0.039276123046875,
1.271484375,
0.08929443359375,
0.287841796875,
-0.386962890625,
0.042388916015625,
0.124755859375,
0.2413330078125,
-0.343505859375,
-0.027313232421875,
-0.464599609375,
1.1103515625,
-0.87939453125,
0.1429443359375,
0.265869140625,
0.4599609375,
0.1904296875,
-0.472900390625,
-0.51708984375,
0.91845703125,
1.0244140625,
0.12213134765625,
0.462158203125,
0.5927734375,
0.53076171875,
-0.40771484375,
-0.21630859375,
-0.323974609375,
0.86767578125,
0.36474609375,
0.34765625,
-0.254638671875,
0.56494140625,
0.77685546875,
-0.05987548828125,
-0.3017578125,
0.57763671875,
0.3046875,
-0.314453125,
0.32080078125,
0.041900634765625,
-0.01177978515625,
-0.223388671875,
-0.1480712890625,
0.61181640625,
-0.320556640625,
-0.04583740234375,
-0.180908203125,
-0.6806640625,
0.74755859375,
-0.13134765625,
-0.482421875,
0.77197265625,
-0.477294921875,
0.413330078125,
0.326904296875,
0.0887451171875,
-0.0202178955078125,
0.8447265625,
0.81591796875,
0.285400390625,
0.451171875,
0.68505859375,
0.30224609375,
-0.85009765625,
0.039703369140625,
0.556640625,
0.00701141357421875,
-0.269287109375,
-0.60546875,
-0.8017578125,
0.60009765625,
-0.364013671875,
-0.35888671875,
0.36669921875,
-0.65673828125,
0.05169677734375,
-0.638671875,
0.9521484375,
-0.69140625,
0.314208984375,
0.31884765625,
0.1102294921875,
-0.5634765625,
1.126953125,
-0.351806640625,
0.31298828125,
0.316162109375,
1.3251953125,
0.150390625,
1.248046875,
0.685546875,
-0.28125,
-0.1568603515625,
0.4462890625,
-0.51123046875,
-0.52392578125,
-0.252197265625,
-0.250244140625,
-0.279541015625,
-1.0478515625,
-0.299560546875,
-0.4375,
1.1123046875,
-0.07598876953125,
-0.88623046875,
-0.15869140625,
0.2447509765625,
-1.0166015625,
0.53369140625,
0.234130859375,
0.24755859375,
0.22705078125,
0.1768798828125,
-0.234375,
-0.6689453125,
0.090576171875,
-0.6298828125,
0.317138671875,
-0.64990234375,
-0.392578125,
-0.8056640625,
-0.8486328125,
-0.5107421875,
0.1829833984375,
-0.5146484375,
-0.84326171875,
0.2225341796875,
0.439697265625,
0.496826171875,
0.360107421875,
-0.0673828125,
-0.17236328125,
0.92919921875,
0.89013671875,
0.474365234375,
0.89013671875,
0.1463623046875,
0.027557373046875,
0.118408203125,
-0.7216796875,
0.454833984375,
-0.458740234375,
0.6220703125,
0.150390625,
0.048187255859375,
-0.54052734375,
-1.40625,
-0.2216796875,
0.240966796875,
0.40673828125,
-0.5517578125,
-0.99365234375,
-0.5986328125,
-0.89404296875,
-0.3046875,
-0.434326171875,
0.63330078125,
-0.09808349609375,
0.2783203125,
-0.42236328125,
-1.3515625,
4.5390625,
1.087890625,
0.92529296875,
0.603515625,
0.1175537109375,
0.857421875,
0.68603515625,
-0.5693359375,
-0.1585693359375,
-0.241455078125,
0.3671875,
-0.006008148193359375,
-0.004241943359375,
0.84228515625,
0.483642578125,
0.58154296875,
-0.80908203125,
-0.04400634765625,
-0.051055908203125,
-1.0390625,
-0.779296875,
0.0250091552734375,
-0.300048828125,
0.304931640625,
-0.26953125,
0.1175537109375,
0.763671875,
-0.64404296875,
-0.775390625,
-0.53662109375,
0.0116424560546875,
-0.3876953125,
0.84375,
0.0318603515625,
-0.422119140625,
0.43505859375,
-0.184326171875,
-0.607421875,
-0.31396484375,
0.2039794921875,
-0.06390380859375,
-0.28564453125,
0.88623046875,
-0.3369140625,
0.04901123046875,
0.435791015625,
-0.623046875,
0.599609375,
0.4296875,
-0.74755859375,
0.79736328125,
-0.10003662109375,
0.449951171875,
-0.3798828125,
-0.744140625,
0.0065460205078125,
0.0447998046875,
-0.111572265625,
-0.420166015625,
0.60693359375,
0.3251953125,
0.2607421875,
-0.10418701171875,
0.35009765625,
-0.80029296875,
0.7841796875,
-0.54833984375,
0.477783203125,
-0.5390625,
0.16064453125,
-0.1458740234375,
-0.27783203125,
-0.322021484375,
-0.1376953125,
0.7548828125,
0.43994140625,
-0.27392578125,
0.2236328125,
0.337646484375,
-0.68115234375,
0.207763671875,
-0.01502227783203125,
-0.36181640625,
-0.2587890625,
0.383056640625,
1.033203125,
-0.783203125,
-0.58056640625,
-0.45361328125,
0.488525390625,
0.66455078125,
0.253662109375,
0.03643798828125,
-0.59375,
-0.16064453125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Tags: implementation, strings
Correct Solution:
```
grigoriye = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
l = len(grigoriye)
staticpointer = grigoriye[0]
def get_least_distance(value):
total = 0
staticpointer_index = 0
for i in value:
value_index = grigoriye.index(i)
min_distance = abs(min(value_index - staticpointer_index , l-(value_index-staticpointer_index)))
if min_distance > 13:
min_distance = 26-min_distance
staticpointer_index = value_index
total += min_distance
return total
if __name__ == "__main__":
value = str(input())
least_distance = get_least_distance(value)
print(least_distance)
```
| 38,176
|
[
0.405517578125,
-0.1361083984375,
-0.0298919677734375,
0.385498046875,
-0.473876953125,
-0.57177734375,
-0.0223541259765625,
-0.14892578125,
0.0222930908203125,
0.472412109375,
0.78564453125,
-0.3037109375,
0.1290283203125,
-0.7080078125,
-0.62744140625,
0.04339599609375,
-0.498291015625,
-0.734375,
-0.65869140625,
-0.10333251953125,
0.241943359375,
-0.302001953125,
-1.3349609375,
-0.310546875,
-0.7744140625,
0.92724609375,
0.09844970703125,
0.2144775390625,
0.99365234375,
1.16015625,
-0.10552978515625,
-0.2734375,
1.0078125,
-1.1884765625,
-0.10028076171875,
-0.369140625,
0.3525390625,
-0.5390625,
0.1693115234375,
-0.56640625,
0.239990234375,
-0.193115234375,
0.5634765625,
-0.48291015625,
-0.96875,
-0.052032470703125,
-0.03997802734375,
-0.441650390625,
-0.1632080078125,
-0.75244140625,
0.117919921875,
-0.192138671875,
0.499755859375,
-0.1453857421875,
-0.09930419921875,
-0.227294921875,
-0.016387939453125,
-0.1190185546875,
-0.4873046875,
0.07568359375,
0.10223388671875,
0.19775390625,
0.224365234375,
-1.0185546875,
-0.2332763671875,
0.07012939453125,
0.0931396484375,
-0.305908203125,
0.01251220703125,
-0.94677734375,
-0.36279296875,
0.281005859375,
0.0477294921875,
-0.7744140625,
-0.367919921875,
-0.0211029052734375,
0.0153045654296875,
0.11431884765625,
-0.572265625,
0.5380859375,
0.05841064453125,
0.7236328125,
-0.2119140625,
0.2176513671875,
-0.60302734375,
-0.486328125,
0.00507354736328125,
-0.1849365234375,
0.171630859375,
-0.322998046875,
-0.1539306640625,
0.496826171875,
-0.69970703125,
0.1851806640625,
0.69189453125,
0.74658203125,
-0.382080078125,
0.45849609375,
0.321044921875,
0.3193359375,
0.59423828125,
1.041015625,
-0.779296875,
1.0224609375,
-0.1622314453125,
-0.0211944580078125,
0.1925048828125,
-0.316650390625,
-0.279052734375,
-0.5849609375,
-0.463623046875,
-0.435302734375,
0.56396484375,
0.22216796875,
-0.11212158203125,
0.72607421875,
0.296875,
0.447509765625,
-0.74755859375,
0.465576171875,
0.1336669921875,
-0.193359375,
0.2032470703125,
-0.300048828125,
-0.151611328125,
-0.098388671875,
-0.371337890625,
0.60693359375,
-0.400634765625,
0.032440185546875,
0.65771484375,
0.517578125,
0.04522705078125,
0.445556640625,
-0.122802734375,
0.6826171875,
-0.160888671875,
0.7568359375,
0.73193359375,
-0.6298828125,
0.275146484375,
-0.4931640625,
0.41455078125,
1.7919921875,
0.5732421875,
-0.1728515625,
0.72119140625,
0.5654296875,
-0.91015625,
0.759765625,
-0.5009765625,
0.62255859375,
0.061981201171875,
0.235595703125,
-0.1610107421875,
-0.062225341796875,
-0.41162109375,
0.6494140625,
-0.173583984375,
0.44677734375,
-0.599609375,
-0.07080078125,
0.08050537109375,
1.029296875,
-0.0833740234375,
0.90380859375,
-0.39990234375,
-0.430419921875,
-0.154296875,
-0.85546875,
0.213623046875,
-0.1982421875,
-0.156494140625,
0.53564453125,
0.52001953125,
0.8115234375,
0.82373046875,
-0.09820556640625,
0.52294921875,
0.15869140625,
-0.2430419921875,
0.139404296875,
0.1380615234375,
0.607421875,
-0.0914306640625,
0.301513671875,
0.016357421875,
-0.275390625,
-0.5380859375,
-0.5087890625,
-0.04473876953125,
0.53125,
-0.27099609375,
0.13671875,
-0.06732177734375,
0.16552734375,
-1.046875,
0.059539794921875,
-0.111083984375,
-1.0185546875,
-0.2291259765625,
0.66650390625,
-0.07012939453125,
0.311279296875,
-0.22607421875,
-0.8662109375,
0.317626953125,
1.0830078125,
-0.4560546875,
-0.01456451416015625,
0.59033203125,
0.1766357421875,
-0.2451171875,
0.2181396484375,
0.2381591796875,
-0.2298583984375,
-0.81201171875,
0.72216796875,
-0.310791015625,
0.169677734375,
-0.06732177734375,
0.76220703125,
0.1846923828125,
0.59375,
-0.275634765625,
0.239013671875,
0.356689453125,
1.0908203125,
0.00518798828125,
0.5751953125,
0.13916015625,
0.97021484375,
0.7939453125,
0.8212890625,
0.64404296875,
0.069580078125,
0.29150390625,
0.5419921875,
0.030731201171875,
-0.061004638671875,
0.057586669921875,
0.251220703125,
0.59033203125,
0.40087890625,
-0.249267578125,
0.57470703125,
-0.006534576416015625,
-0.1591796875,
-0.6103515625,
0.39208984375,
-0.363525390625,
0.90087890625,
-0.126220703125,
0.361083984375,
-0.212646484375,
-0.2396240234375,
0.338134765625,
0.611328125,
-0.385498046875,
-0.38916015625,
0.27099609375,
0.287109375,
0.1451416015625,
0.023590087890625,
-0.0628662109375,
0.341064453125,
-0.0246734619140625,
0.81298828125,
-0.40478515625,
-0.341064453125,
-1.0625,
-0.94677734375,
-0.712890625,
-0.1231689453125,
-0.54638671875,
0.0132598876953125,
0.50537109375,
-0.5537109375,
0.7294921875,
-0.56982421875,
0.119384765625,
-0.020843505859375,
-0.76220703125,
0.70947265625,
0.05889892578125,
0.654296875,
-0.371826171875,
0.421875,
0.10821533203125,
0.81982421875,
-0.54931640625,
-0.29736328125,
-0.473388671875,
-0.310791015625,
0.440185546875,
-0.062347412109375,
0.52978515625,
-0.477783203125,
-0.888671875,
-0.72021484375,
-0.11859130859375,
-0.05035400390625,
-0.442138671875,
0.2724609375,
-0.481689453125,
0.85888671875,
0.61572265625,
-0.880859375,
0.38916015625,
0.794921875,
-1.0087890625,
0.433837890625,
0.283447265625,
-0.021728515625,
-0.8955078125,
1.013671875,
0.435302734375,
0.490234375,
-0.198486328125,
-0.0191650390625,
-0.5712890625,
0.345458984375,
-0.298828125,
-0.5693359375,
-0.2476806640625,
0.48193359375,
0.1766357421875,
-1.0517578125,
0.51025390625,
-1.078125,
-0.66943359375,
-0.52099609375,
-0.4912109375,
0.7763671875,
0.69775390625,
-0.0333251953125,
0.1138916015625,
0.03021240234375,
0.29345703125,
0.7294921875,
0.41259765625,
-0.415283203125,
0.2008056640625,
0.39697265625,
-0.59814453125,
0.51611328125,
0.4609375,
-0.1474609375,
-0.1754150390625,
-0.048919677734375,
0.1751708984375,
0.14111328125,
0.2626953125,
0.218994140625,
0.55712890625,
0.77392578125,
-0.446044921875,
-0.1993408203125,
-0.6064453125,
1.03125,
0.384521484375,
0.51611328125,
0.29931640625,
-0.1446533203125,
-0.53076171875,
-0.85009765625,
0.169189453125,
0.6318359375,
0.6982421875,
-0.50830078125,
0.6865234375,
0.006130218505859375,
-0.60693359375,
-0.055419921875,
-0.595703125,
-0.54833984375,
0.8095703125,
-0.16162109375,
0.88720703125,
-0.501953125,
0.050537109375,
-0.367919921875,
0.07135009765625,
0.0131683349609375,
0.09307861328125,
0.61572265625,
-0.299072265625,
-0.26123046875,
-0.60986328125,
-0.28125,
-0.044525146484375,
-0.63427734375,
0.2171630859375,
-0.64794921875,
-0.49560546875,
-0.4931640625,
0.305908203125,
1.06640625,
0.5498046875,
-0.2030029296875,
0.376953125,
0.2352294921875,
0.2225341796875,
0.310546875,
-0.58056640625,
-0.031494140625,
-0.630859375,
0.6953125,
0.33154296875,
-0.401611328125,
-0.5068359375,
-0.3876953125,
-0.7333984375,
0.152587890625,
0.3173828125,
-0.1295166015625,
-0.65966796875,
0.3916015625,
-0.2186279296875,
0.3798828125,
-0.68603515625,
-0.306884765625,
-0.39892578125,
0.56787109375,
0.6396484375,
-0.062744140625,
0.018218994140625,
-0.59521484375,
0.59375,
0.60107421875,
-0.08221435546875,
-0.50537109375,
-0.252197265625,
-0.662109375,
-0.441162109375,
-0.060150146484375,
0.63330078125,
0.358154296875,
0.06640625,
-1.0478515625,
0.7451171875,
0.192138671875,
-0.58251953125,
-0.1187744140625,
0.393798828125,
0.0576171875,
-0.1868896484375,
0.69775390625,
-0.1878662109375,
-0.62451171875,
0.175048828125,
-1.00390625,
0.69580078125,
-0.2354736328125,
0.421875,
-0.12335205078125,
-0.1881103515625,
0.11065673828125,
0.224365234375,
-0.6650390625,
0.01374053955078125,
-0.1629638671875,
0.5888671875,
-1.0185546875,
-0.53173828125,
0.59521484375,
-0.1923828125,
-0.341796875,
0.5322265625,
-0.326904296875,
-0.367919921875,
0.29833984375,
-0.013397216796875,
-0.50146484375,
-0.031707763671875,
-0.357421875,
0.435302734375,
0.055908203125,
-0.296875,
0.430908203125,
-0.607421875,
1.177734375,
0.205810546875,
-0.66943359375,
-0.0992431640625,
-1.0576171875,
-0.26513671875,
-0.16455078125,
-0.68212890625,
0.0000591278076171875,
-0.04888916015625,
-0.294677734375,
-0.0859375,
-0.29248046875,
-0.6015625,
-0.1470947265625,
-0.6865234375,
0.226806640625,
0.53076171875,
0.3203125,
0.268798828125,
-0.10760498046875,
-0.5888671875,
0.34228515625,
-0.33447265625,
-0.046539306640625,
-0.4599609375,
-0.11749267578125,
-0.466552734375,
-0.236328125,
-0.36962890625,
0.3349609375,
-0.32763671875,
0.004383087158203125,
0.85009765625,
0.495361328125,
0.3525390625,
-0.2412109375,
-0.442138671875,
0.60302734375,
0.1090087890625,
-1.0859375,
-0.65771484375,
1.0859375,
0.064208984375,
0.55712890625,
0.50439453125,
-0.54931640625,
-1.1240234375,
-0.93310546875,
0.1318359375,
-0.458251953125,
-0.2744140625,
-0.69775390625,
-0.345947265625,
-0.6064453125,
0.386962890625,
-0.1187744140625,
-0.349365234375,
0.31689453125,
-0.90087890625,
0.239501953125,
-0.468017578125,
0.16357421875,
-0.461669921875,
-0.83251953125,
-0.492919921875,
0.90478515625,
0.288818359375,
0.27978515625,
0.061187744140625,
0.01267242431640625,
0.4443359375,
0.25244140625,
-0.275634765625,
-0.408203125,
-0.159423828125,
0.56103515625,
-0.304443359375,
-0.1424560546875,
-0.0816650390625,
0.64990234375,
-0.95751953125,
0.36865234375,
0.112548828125,
-0.1455078125,
-0.142333984375,
-0.308837890625,
1.107421875,
-0.270751953125,
0.0283355712890625,
-0.41015625,
0.57763671875,
0.52783203125,
-0.24072265625,
-0.07073974609375,
-0.58154296875,
-0.400634765625,
-1.044921875,
0.77099609375,
-0.0640869140625,
0.296630859375,
-0.505859375,
-0.2164306640625,
1.3544921875,
-0.34130859375,
0.403564453125,
1.2392578125,
0.1300048828125,
0.321044921875,
-0.71142578125,
0.458251953125,
0.3232421875,
-0.423583984375,
-0.329833984375,
0.0193328857421875,
-0.72314453125,
0.50146484375,
-0.1923828125,
-0.962890625,
-0.498046875,
0.484130859375,
1.2353515625,
-0.268310546875,
0.595703125,
-0.208984375,
-1.16015625,
-0.61376953125,
0.77197265625,
-0.2822265625,
0.148681640625,
0.66064453125,
-0.00446319580078125,
-0.1429443359375,
-0.0523681640625,
-0.005344390869140625,
-0.405517578125,
-0.37451171875,
0.9189453125,
-0.2919921875,
-0.75048828125,
1.2041015625,
0.5126953125,
-0.81201171875,
-1.0576171875,
0.0548095703125,
-0.1749267578125,
-0.313720703125,
-0.90283203125,
0.2626953125,
0.25048828125,
-0.3095703125,
-0.0811767578125,
0.482421875,
-0.2337646484375,
0.240966796875,
0.036529541015625,
0.3154296875,
-0.548828125,
0.047027587890625,
0.29833984375,
-0.440185546875,
-0.253173828125,
-0.8857421875,
-0.2003173828125,
-0.61376953125,
-0.0467529296875,
0.3642578125,
-0.37646484375,
0.447021484375,
0.422119140625,
0.1844482421875,
0.92431640625,
-0.2293701171875,
-0.2236328125,
-0.029693603515625,
-0.396484375,
-0.5966796875,
-0.39599609375,
0.279052734375,
-0.412109375,
-0.139892578125,
-0.61083984375,
-0.27978515625,
0.378662109375,
0.30078125,
-0.468017578125,
-1.1640625,
-0.306640625,
-1.0146484375,
-0.53173828125,
-0.35009765625,
-0.4990234375,
-0.345703125,
-0.1839599609375,
-0.058319091796875,
-0.410888671875,
0.0078582763671875,
0.5146484375,
-0.2196044921875,
0.724609375,
-0.403564453125,
0.394287109375,
-0.81884765625,
-0.09368896484375,
-0.587890625,
0.38818359375,
-0.44287109375,
-0.185546875,
-0.67724609375,
0.062744140625,
0.1778564453125,
0.50732421875,
-0.35595703125,
0.367431640625,
0.14404296875,
-0.377197265625,
-0.07867431640625,
-0.0035228729248046875,
0.028900146484375,
0.51611328125,
0.931640625,
-0.291259765625,
0.47314453125,
-0.1558837890625,
-0.60595703125,
-0.1395263671875,
0.477294921875,
0.4755859375,
-0.2037353515625,
-0.11651611328125,
-0.19384765625,
0.424560546875,
-0.984375,
0.3193359375,
-0.2388916015625,
0.39794921875,
-0.045013427734375,
-0.20751953125,
0.57958984375,
0.6103515625,
0.0970458984375,
0.017303466796875,
-0.06231689453125,
0.04986572265625,
-0.079833984375,
0.19775390625,
0.08074951171875,
0.53564453125,
0.1683349609375,
-0.3671875,
-0.04962158203125,
0.2176513671875,
-0.367919921875,
0.68603515625,
-0.48291015625,
-0.388427734375,
-0.740234375,
-0.16845703125,
-0.040069580078125,
0.7392578125,
0.51220703125,
-0.607421875,
-0.00592803955078125,
-0.2200927734375,
-0.6689453125,
0.11688232421875,
-1.27734375,
-0.95361328125,
0.2034912109375,
-0.10601806640625,
-0.09857177734375,
-0.455322265625,
-0.59814453125,
-0.12359619140625,
-0.0848388671875,
0.79931640625,
-0.806640625,
0.4853515625,
0.0140533447265625,
0.72216796875,
-0.66748046875,
0.3173828125,
0.36767578125,
0.685546875,
-0.23876953125,
-0.4677734375,
-0.00856781005859375,
1.30078125,
0.130615234375,
0.302001953125,
-0.394287109375,
-0.0092620849609375,
0.1474609375,
0.1033935546875,
-0.27392578125,
0.01029205322265625,
-0.413818359375,
1.1142578125,
-0.93212890625,
0.1748046875,
0.246337890625,
0.50830078125,
0.158203125,
-0.454345703125,
-0.52734375,
0.88818359375,
1.0009765625,
0.1043701171875,
0.464111328125,
0.6015625,
0.537109375,
-0.338134765625,
-0.186279296875,
-0.30224609375,
0.8203125,
0.345947265625,
0.353515625,
-0.276123046875,
0.57177734375,
0.7890625,
-0.06365966796875,
-0.33056640625,
0.60302734375,
0.386474609375,
-0.2978515625,
0.370849609375,
0.033416748046875,
-0.06396484375,
-0.22021484375,
-0.1962890625,
0.55859375,
-0.28759765625,
-0.09326171875,
-0.1268310546875,
-0.67236328125,
0.76220703125,
-0.1622314453125,
-0.438232421875,
0.7607421875,
-0.482666015625,
0.441162109375,
0.307861328125,
0.188232421875,
-0.0074005126953125,
0.83154296875,
0.77197265625,
0.23095703125,
0.426513671875,
0.68310546875,
0.308349609375,
-0.83984375,
0.092041015625,
0.51806640625,
0.0090789794921875,
-0.263916015625,
-0.6494140625,
-0.83642578125,
0.60595703125,
-0.427978515625,
-0.34912109375,
0.373779296875,
-0.6748046875,
0.0416259765625,
-0.63720703125,
0.958984375,
-0.6220703125,
0.25,
0.30517578125,
0.06561279296875,
-0.492431640625,
1.08203125,
-0.319091796875,
0.370849609375,
0.2890625,
1.3486328125,
0.1358642578125,
1.267578125,
0.71337890625,
-0.255615234375,
-0.10546875,
0.3662109375,
-0.47119140625,
-0.57666015625,
-0.230224609375,
-0.269287109375,
-0.2313232421875,
-0.99951171875,
-0.29248046875,
-0.42822265625,
1.08203125,
-0.033050537109375,
-0.98046875,
-0.1668701171875,
0.261962890625,
-0.99169921875,
0.576171875,
0.289794921875,
0.2373046875,
0.1898193359375,
0.1756591796875,
-0.2164306640625,
-0.6435546875,
0.1275634765625,
-0.6796875,
0.3681640625,
-0.61279296875,
-0.3486328125,
-0.76318359375,
-0.8134765625,
-0.51025390625,
0.1697998046875,
-0.54443359375,
-0.86865234375,
0.19970703125,
0.459716796875,
0.52001953125,
0.31640625,
-0.09600830078125,
-0.225341796875,
0.9150390625,
0.91552734375,
0.435302734375,
0.84228515625,
0.105712890625,
-0.002216339111328125,
0.093994140625,
-0.72802734375,
0.4814453125,
-0.403076171875,
0.62353515625,
0.205322265625,
-0.004276275634765625,
-0.47607421875,
-1.388671875,
-0.1883544921875,
0.257080078125,
0.3544921875,
-0.490966796875,
-1.0400390625,
-0.611328125,
-0.93994140625,
-0.294189453125,
-0.371826171875,
0.6171875,
-0.0863037109375,
0.348388671875,
-0.37939453125,
-1.3818359375,
4.5546875,
1.1357421875,
0.92333984375,
0.5390625,
0.1358642578125,
0.86669921875,
0.73681640625,
-0.57421875,
-0.1495361328125,
-0.26318359375,
0.342041015625,
-0.037933349609375,
0.070556640625,
0.79833984375,
0.475341796875,
0.583984375,
-0.78466796875,
-0.048126220703125,
-0.0784912109375,
-1.0166015625,
-0.7939453125,
0.00864410400390625,
-0.3291015625,
0.277587890625,
-0.25537109375,
0.1312255859375,
0.7197265625,
-0.65771484375,
-0.77294921875,
-0.529296875,
-0.0019683837890625,
-0.372314453125,
0.85205078125,
0.05963134765625,
-0.442626953125,
0.4453125,
-0.1807861328125,
-0.630859375,
-0.324951171875,
0.2060546875,
-0.08721923828125,
-0.27490234375,
0.90478515625,
-0.31201171875,
0.06561279296875,
0.479248046875,
-0.64697265625,
0.552734375,
0.47021484375,
-0.70849609375,
0.81005859375,
-0.11126708984375,
0.44482421875,
-0.43115234375,
-0.72998046875,
0.017852783203125,
0.025848388671875,
-0.08624267578125,
-0.45458984375,
0.5771484375,
0.328125,
0.2476806640625,
-0.16064453125,
0.360595703125,
-0.76220703125,
0.83935546875,
-0.5234375,
0.52197265625,
-0.53173828125,
0.07952880859375,
-0.085205078125,
-0.231201171875,
-0.35107421875,
-0.1474609375,
0.6982421875,
0.403564453125,
-0.325927734375,
0.2232666015625,
0.357666015625,
-0.65869140625,
0.224609375,
-0.054046630859375,
-0.353271484375,
-0.2359619140625,
0.41357421875,
1.0771484375,
-0.7529296875,
-0.59765625,
-0.445068359375,
0.53955078125,
0.65234375,
0.2364501953125,
0.026580810546875,
-0.515625,
-0.20361328125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Tags: implementation, strings
Correct Solution:
```
import sys
inp = sys.stdin.readlines()
start_position = 'a'
alpha = list(map(chr, range(97, 123)))
word = inp[0].lower().strip()
rounds = 0
for letter in word:
right = 0
while True:
try:
if alpha[alpha.index(start_position)+right] == letter:
break
except IndexError:
if alpha[alpha.index(start_position)+right-len(alpha)] == letter:
break
finally:
right += 1
right -= 1
left = 0
while True:
try:
if alpha[alpha.index(start_position) - left] == letter:
break
except IndexError:
if alpha[alpha.index(start_position)-left+len(alpha)] == letter:
break
finally:
left += 1
left -= 1
rounds += min(right, left)
start_position = letter
print(rounds)
```
| 38,177
|
[
0.414794921875,
-0.17431640625,
0.0170440673828125,
0.387939453125,
-0.42578125,
-0.5517578125,
-0.076416015625,
-0.1287841796875,
0.03424072265625,
0.5361328125,
0.71484375,
-0.304443359375,
0.0948486328125,
-0.70166015625,
-0.64990234375,
0.0980224609375,
-0.407470703125,
-0.71044921875,
-0.68505859375,
-0.1387939453125,
0.2137451171875,
-0.37109375,
-1.3408203125,
-0.31396484375,
-0.7490234375,
0.92138671875,
0.1688232421875,
0.26904296875,
1.0107421875,
1.166015625,
-0.09442138671875,
-0.276123046875,
1.12109375,
-1.259765625,
-0.117431640625,
-0.35888671875,
0.3857421875,
-0.541015625,
0.128173828125,
-0.51416015625,
0.23779296875,
-0.1824951171875,
0.607421875,
-0.52294921875,
-0.94287109375,
-0.05010986328125,
-0.05462646484375,
-0.46142578125,
-0.13720703125,
-0.72265625,
0.106201171875,
-0.127197265625,
0.50634765625,
-0.1702880859375,
-0.1510009765625,
-0.2418212890625,
-0.0223236083984375,
-0.07012939453125,
-0.481201171875,
0.11639404296875,
0.1292724609375,
0.189697265625,
0.13330078125,
-0.900390625,
-0.234130859375,
0.060211181640625,
0.10198974609375,
-0.254150390625,
0.0013227462768554688,
-0.978515625,
-0.310302734375,
0.35107421875,
0.039398193359375,
-0.77099609375,
-0.39501953125,
-0.00798797607421875,
0.05731201171875,
0.186767578125,
-0.63232421875,
0.50732421875,
0.0743408203125,
0.70556640625,
-0.2174072265625,
0.1865234375,
-0.56396484375,
-0.42431640625,
-0.0019521713256835938,
-0.2164306640625,
0.135986328125,
-0.2900390625,
-0.099853515625,
0.5,
-0.71435546875,
0.20947265625,
0.65869140625,
0.728515625,
-0.405517578125,
0.453125,
0.3212890625,
0.317626953125,
0.58349609375,
1.0654296875,
-0.78173828125,
0.94287109375,
-0.16552734375,
-0.094482421875,
0.232421875,
-0.289794921875,
-0.268798828125,
-0.5517578125,
-0.41552734375,
-0.4423828125,
0.5400390625,
0.3095703125,
-0.0631103515625,
0.689453125,
0.271728515625,
0.451904296875,
-0.74072265625,
0.54296875,
0.08660888671875,
-0.1783447265625,
0.235107421875,
-0.31005859375,
-0.1502685546875,
-0.10150146484375,
-0.387939453125,
0.603515625,
-0.412841796875,
0.07427978515625,
0.60595703125,
0.57568359375,
0.0250244140625,
0.47900390625,
-0.179931640625,
0.70263671875,
-0.1739501953125,
0.66748046875,
0.80322265625,
-0.654296875,
0.24560546875,
-0.5205078125,
0.401123046875,
1.81640625,
0.5380859375,
-0.1490478515625,
0.70458984375,
0.5830078125,
-0.90478515625,
0.78369140625,
-0.59912109375,
0.53369140625,
0.0947265625,
0.28857421875,
-0.2020263671875,
-0.0970458984375,
-0.3974609375,
0.681640625,
-0.1773681640625,
0.515625,
-0.6181640625,
-0.0865478515625,
0.08660888671875,
1.02734375,
-0.060699462890625,
0.935546875,
-0.36328125,
-0.44580078125,
-0.15478515625,
-0.93603515625,
0.271240234375,
-0.2132568359375,
-0.170166015625,
0.491455078125,
0.50390625,
0.798828125,
0.86181640625,
-0.06756591796875,
0.56298828125,
0.1695556640625,
-0.29736328125,
0.11041259765625,
0.1383056640625,
0.63232421875,
-0.07659912109375,
0.331298828125,
0.11505126953125,
-0.283447265625,
-0.499755859375,
-0.521484375,
-0.046295166015625,
0.5927734375,
-0.28955078125,
0.152587890625,
-0.042877197265625,
0.154296875,
-1.1318359375,
0.06903076171875,
-0.049652099609375,
-1.0400390625,
-0.20361328125,
0.59765625,
-0.08551025390625,
0.310791015625,
-0.3564453125,
-0.828125,
0.38134765625,
1.052734375,
-0.4755859375,
-0.06549072265625,
0.64794921875,
0.1695556640625,
-0.25048828125,
0.25439453125,
0.18603515625,
-0.26220703125,
-0.79931640625,
0.7890625,
-0.338623046875,
0.1693115234375,
-0.03179931640625,
0.81640625,
0.208251953125,
0.55908203125,
-0.298828125,
0.291748046875,
0.35009765625,
1.1142578125,
-0.06378173828125,
0.53173828125,
0.1488037109375,
0.96337890625,
0.7646484375,
0.84814453125,
0.6328125,
0.0924072265625,
0.288818359375,
0.56494140625,
0.010498046875,
-0.083251953125,
0.06317138671875,
0.2276611328125,
0.56787109375,
0.3857421875,
-0.2086181640625,
0.481689453125,
0.017608642578125,
-0.2091064453125,
-0.55517578125,
0.349609375,
-0.332763671875,
0.90380859375,
-0.1585693359375,
0.310546875,
-0.1546630859375,
-0.2398681640625,
0.33935546875,
0.63427734375,
-0.418701171875,
-0.3720703125,
0.2457275390625,
0.27294921875,
0.083251953125,
0.0142974853515625,
-0.0191497802734375,
0.3935546875,
-0.0193634033203125,
0.8408203125,
-0.475830078125,
-0.30029296875,
-1.0869140625,
-0.955078125,
-0.7587890625,
-0.052093505859375,
-0.5771484375,
-0.02911376953125,
0.452392578125,
-0.58056640625,
0.78662109375,
-0.63134765625,
0.06463623046875,
-0.005023956298828125,
-0.73095703125,
0.65185546875,
0.046051025390625,
0.671875,
-0.33544921875,
0.427978515625,
0.100830078125,
0.8662109375,
-0.62060546875,
-0.28466796875,
-0.47802734375,
-0.358154296875,
0.395263671875,
-0.08001708984375,
0.5498046875,
-0.473876953125,
-0.89990234375,
-0.79248046875,
-0.1595458984375,
-0.031951904296875,
-0.509765625,
0.31982421875,
-0.525390625,
0.86083984375,
0.611328125,
-0.8583984375,
0.393798828125,
0.8076171875,
-0.99560546875,
0.437744140625,
0.2457275390625,
0.0014486312866210938,
-0.9833984375,
1.09375,
0.37109375,
0.5400390625,
-0.275634765625,
-0.0145111083984375,
-0.56494140625,
0.408203125,
-0.28662109375,
-0.58056640625,
-0.229248046875,
0.51513671875,
0.25537109375,
-1.03515625,
0.5498046875,
-1.0283203125,
-0.5830078125,
-0.478515625,
-0.501953125,
0.751953125,
0.693359375,
0.014739990234375,
0.10650634765625,
0.004535675048828125,
0.2362060546875,
0.74365234375,
0.379638671875,
-0.416015625,
0.1917724609375,
0.402587890625,
-0.6474609375,
0.4814453125,
0.48095703125,
-0.166748046875,
-0.1588134765625,
-0.08502197265625,
0.0888671875,
0.12164306640625,
0.257080078125,
0.2783203125,
0.62939453125,
0.81982421875,
-0.491943359375,
-0.217529296875,
-0.61669921875,
0.99169921875,
0.426025390625,
0.5205078125,
0.2005615234375,
-0.10400390625,
-0.53857421875,
-0.77783203125,
0.1302490234375,
0.62548828125,
0.69287109375,
-0.55126953125,
0.6826171875,
0.056304931640625,
-0.57861328125,
-0.02618408203125,
-0.623046875,
-0.513671875,
0.77294921875,
-0.17236328125,
0.86669921875,
-0.521484375,
0.0399169921875,
-0.380615234375,
0.06597900390625,
0.050445556640625,
0.0295562744140625,
0.59228515625,
-0.277587890625,
-0.2320556640625,
-0.6181640625,
-0.28515625,
-0.00389862060546875,
-0.5732421875,
0.203125,
-0.59375,
-0.51708984375,
-0.55322265625,
0.331787109375,
1.0107421875,
0.54736328125,
-0.1693115234375,
0.34033203125,
0.1392822265625,
0.27294921875,
0.33154296875,
-0.537109375,
-0.01280975341796875,
-0.59814453125,
0.712890625,
0.26416015625,
-0.34326171875,
-0.60302734375,
-0.328857421875,
-0.6865234375,
0.1761474609375,
0.2176513671875,
-0.171630859375,
-0.6630859375,
0.453369140625,
-0.1712646484375,
0.421142578125,
-0.64013671875,
-0.29345703125,
-0.446044921875,
0.57568359375,
0.6611328125,
-0.060791015625,
0.03717041015625,
-0.57958984375,
0.62939453125,
0.57666015625,
-0.049346923828125,
-0.52001953125,
-0.201904296875,
-0.6337890625,
-0.5224609375,
-0.017822265625,
0.66015625,
0.375732421875,
0.09881591796875,
-1.033203125,
0.7587890625,
0.16650390625,
-0.59130859375,
-0.187255859375,
0.39306640625,
0.090576171875,
-0.1832275390625,
0.61328125,
-0.1339111328125,
-0.6123046875,
0.22900390625,
-1.09765625,
0.6826171875,
-0.2335205078125,
0.392822265625,
-0.10662841796875,
-0.1195068359375,
0.12939453125,
0.257080078125,
-0.6728515625,
-0.05560302734375,
-0.203369140625,
0.6455078125,
-1.0654296875,
-0.51611328125,
0.62109375,
-0.232177734375,
-0.3466796875,
0.52783203125,
-0.3544921875,
-0.321533203125,
0.3486328125,
0.049896240234375,
-0.474853515625,
-0.11260986328125,
-0.36083984375,
0.485107421875,
0.0870361328125,
-0.2425537109375,
0.35693359375,
-0.55908203125,
1.1806640625,
0.193603515625,
-0.693359375,
-0.05828857421875,
-1.0458984375,
-0.2529296875,
-0.205810546875,
-0.5908203125,
0.034881591796875,
0.017333984375,
-0.2261962890625,
-0.10443115234375,
-0.289306640625,
-0.5234375,
-0.1944580078125,
-0.66650390625,
0.2276611328125,
0.556640625,
0.375244140625,
0.259521484375,
-0.1474609375,
-0.56396484375,
0.328857421875,
-0.378173828125,
-0.06463623046875,
-0.45849609375,
-0.0799560546875,
-0.521484375,
-0.271728515625,
-0.340576171875,
0.30810546875,
-0.34912109375,
0.058929443359375,
0.8720703125,
0.499755859375,
0.376220703125,
-0.174072265625,
-0.41357421875,
0.5673828125,
0.10546875,
-1.103515625,
-0.671875,
1.107421875,
-0.0039005279541015625,
0.5673828125,
0.5625,
-0.59033203125,
-1.11328125,
-1.01953125,
0.1727294921875,
-0.453369140625,
-0.22900390625,
-0.6669921875,
-0.366455078125,
-0.59765625,
0.42626953125,
-0.1221923828125,
-0.39013671875,
0.292236328125,
-0.88330078125,
0.196533203125,
-0.46044921875,
0.216064453125,
-0.46044921875,
-0.84619140625,
-0.459228515625,
0.8955078125,
0.316162109375,
0.28759765625,
-0.0218963623046875,
0.0248870849609375,
0.447509765625,
0.283203125,
-0.270263671875,
-0.385498046875,
-0.1519775390625,
0.6318359375,
-0.30517578125,
-0.11297607421875,
-0.0570068359375,
0.6328125,
-0.880859375,
0.41748046875,
0.1256103515625,
-0.12481689453125,
-0.2333984375,
-0.291259765625,
1.044921875,
-0.2274169921875,
0.006031036376953125,
-0.33837890625,
0.63427734375,
0.5615234375,
-0.287109375,
-0.027679443359375,
-0.5986328125,
-0.399169921875,
-1.0556640625,
0.7705078125,
-0.1201171875,
0.295654296875,
-0.462890625,
-0.181640625,
1.3369140625,
-0.450927734375,
0.408935546875,
1.212890625,
0.12255859375,
0.1990966796875,
-0.69580078125,
0.54296875,
0.3203125,
-0.367431640625,
-0.31884765625,
0.045440673828125,
-0.72412109375,
0.499267578125,
-0.1998291015625,
-1.015625,
-0.472900390625,
0.4775390625,
1.2626953125,
-0.262451171875,
0.57666015625,
-0.2098388671875,
-1.0595703125,
-0.59375,
0.7587890625,
-0.2734375,
0.185546875,
0.703125,
-0.0266265869140625,
-0.1458740234375,
-0.1229248046875,
0.01053619384765625,
-0.3828125,
-0.39697265625,
0.96875,
-0.26708984375,
-0.76025390625,
1.2294921875,
0.52587890625,
-0.84765625,
-0.97802734375,
0.1060791015625,
-0.1546630859375,
-0.296875,
-0.9208984375,
0.22119140625,
0.2109375,
-0.37353515625,
-0.1124267578125,
0.37890625,
-0.2841796875,
0.275390625,
0.06591796875,
0.272705078125,
-0.53076171875,
0.0419921875,
0.30517578125,
-0.421875,
-0.263427734375,
-0.94677734375,
-0.2353515625,
-0.65380859375,
-0.08355712890625,
0.406982421875,
-0.36328125,
0.43798828125,
0.334228515625,
0.225830078125,
0.91943359375,
-0.1795654296875,
-0.265625,
0.0333251953125,
-0.408935546875,
-0.5966796875,
-0.395751953125,
0.24951171875,
-0.4306640625,
-0.1346435546875,
-0.6142578125,
-0.2413330078125,
0.33740234375,
0.293212890625,
-0.468505859375,
-1.2333984375,
-0.30908203125,
-1.07421875,
-0.59130859375,
-0.36279296875,
-0.55419921875,
-0.387451171875,
-0.1871337890625,
-0.0465087890625,
-0.41015625,
0.038818359375,
0.48193359375,
-0.1383056640625,
0.63037109375,
-0.41162109375,
0.40185546875,
-0.83935546875,
-0.0076751708984375,
-0.59033203125,
0.376953125,
-0.448974609375,
-0.0919189453125,
-0.6806640625,
-0.006549835205078125,
0.2147216796875,
0.55517578125,
-0.357177734375,
0.3544921875,
0.10333251953125,
-0.462646484375,
-0.01488494873046875,
0.0721435546875,
-0.041473388671875,
0.53076171875,
0.9306640625,
-0.1939697265625,
0.42333984375,
-0.1611328125,
-0.56396484375,
-0.11065673828125,
0.48486328125,
0.4921875,
-0.206298828125,
-0.08355712890625,
-0.252685546875,
0.41015625,
-0.92626953125,
0.251708984375,
-0.2425537109375,
0.32177734375,
-0.052215576171875,
-0.190673828125,
0.56396484375,
0.64453125,
0.12646484375,
0.079833984375,
-0.1334228515625,
0.1357421875,
-0.0904541015625,
0.188232421875,
0.1358642578125,
0.53515625,
0.084228515625,
-0.354248046875,
-0.09271240234375,
0.28662109375,
-0.41162109375,
0.62255859375,
-0.48388671875,
-0.36767578125,
-0.7392578125,
-0.1719970703125,
0.0028438568115234375,
0.75,
0.482666015625,
-0.640625,
-0.034332275390625,
-0.2474365234375,
-0.6484375,
0.09307861328125,
-1.318359375,
-0.8779296875,
0.149169921875,
-0.142333984375,
-0.117431640625,
-0.44775390625,
-0.62158203125,
-0.11651611328125,
-0.12335205078125,
0.75830078125,
-0.80029296875,
0.461669921875,
-0.01763916015625,
0.716796875,
-0.63623046875,
0.29052734375,
0.35546875,
0.6669921875,
-0.293212890625,
-0.437255859375,
-0.017242431640625,
1.3076171875,
0.0755615234375,
0.272705078125,
-0.45556640625,
0.00675201416015625,
0.1573486328125,
0.220458984375,
-0.3876953125,
-0.033447265625,
-0.4921875,
1.0693359375,
-0.85205078125,
0.1326904296875,
0.25732421875,
0.42333984375,
0.2109375,
-0.455078125,
-0.51806640625,
0.89306640625,
1.0048828125,
0.11004638671875,
0.44873046875,
0.603515625,
0.54638671875,
-0.3583984375,
-0.225830078125,
-0.317626953125,
0.86767578125,
0.34912109375,
0.35107421875,
-0.2529296875,
0.533203125,
0.78564453125,
-0.0784912109375,
-0.365966796875,
0.49462890625,
0.30029296875,
-0.342529296875,
0.319580078125,
0.041168212890625,
-0.046875,
-0.2493896484375,
-0.1793212890625,
0.65576171875,
-0.3515625,
-0.04656982421875,
-0.2098388671875,
-0.69775390625,
0.7099609375,
-0.0977783203125,
-0.517578125,
0.78466796875,
-0.51025390625,
0.40380859375,
0.310302734375,
0.08795166015625,
-0.05792236328125,
0.86962890625,
0.8583984375,
0.283447265625,
0.425048828125,
0.6904296875,
0.320556640625,
-0.828125,
0.016693115234375,
0.5537109375,
0.0214385986328125,
-0.27734375,
-0.6083984375,
-0.79541015625,
0.6123046875,
-0.3798828125,
-0.32763671875,
0.3818359375,
-0.63525390625,
0.0672607421875,
-0.64013671875,
0.9501953125,
-0.666015625,
0.30322265625,
0.303466796875,
0.09716796875,
-0.55810546875,
1.107421875,
-0.318359375,
0.326904296875,
0.30712890625,
1.33203125,
0.107421875,
1.232421875,
0.69873046875,
-0.26318359375,
-0.1630859375,
0.452880859375,
-0.489501953125,
-0.6015625,
-0.212890625,
-0.2164306640625,
-0.227294921875,
-1.005859375,
-0.3076171875,
-0.395263671875,
1.1171875,
-0.0487060546875,
-0.88623046875,
-0.1201171875,
0.206298828125,
-1.03125,
0.5322265625,
0.273681640625,
0.2354736328125,
0.2132568359375,
0.1627197265625,
-0.217041015625,
-0.615234375,
0.08123779296875,
-0.6201171875,
0.31494140625,
-0.68408203125,
-0.3955078125,
-0.849609375,
-0.84619140625,
-0.5068359375,
0.16064453125,
-0.53759765625,
-0.84716796875,
0.203125,
0.489013671875,
0.56640625,
0.331787109375,
-0.07672119140625,
-0.1512451171875,
0.9267578125,
0.87109375,
0.5400390625,
0.92431640625,
0.1533203125,
-0.0173492431640625,
0.10968017578125,
-0.7568359375,
0.46923828125,
-0.461669921875,
0.5595703125,
0.1964111328125,
0.031829833984375,
-0.54248046875,
-1.4375,
-0.1744384765625,
0.2322998046875,
0.4033203125,
-0.494873046875,
-0.984375,
-0.58837890625,
-0.91259765625,
-0.29052734375,
-0.4345703125,
0.6591796875,
-0.0657958984375,
0.29296875,
-0.413330078125,
-1.3310546875,
4.54296875,
1.0947265625,
0.93994140625,
0.62255859375,
0.09765625,
0.84619140625,
0.73974609375,
-0.55517578125,
-0.1658935546875,
-0.280517578125,
0.328369140625,
-0.04742431640625,
0.006343841552734375,
0.85546875,
0.461669921875,
0.5888671875,
-0.8408203125,
-0.006931304931640625,
-0.06365966796875,
-0.98681640625,
-0.775390625,
0.027099609375,
-0.35400390625,
0.2822265625,
-0.2452392578125,
0.15185546875,
0.78466796875,
-0.6650390625,
-0.755859375,
-0.492431640625,
-0.00319671630859375,
-0.369873046875,
0.8818359375,
0.006595611572265625,
-0.385009765625,
0.439208984375,
-0.1925048828125,
-0.63330078125,
-0.33447265625,
0.1849365234375,
-0.064453125,
-0.2440185546875,
0.82763671875,
-0.332763671875,
0.08770751953125,
0.4658203125,
-0.5966796875,
0.58349609375,
0.447509765625,
-0.732421875,
0.80322265625,
-0.1041259765625,
0.410888671875,
-0.385498046875,
-0.72607421875,
0.014373779296875,
0.067138671875,
-0.08056640625,
-0.448486328125,
0.62109375,
0.31591796875,
0.26025390625,
-0.060699462890625,
0.386962890625,
-0.77734375,
0.8232421875,
-0.5556640625,
0.487060546875,
-0.52978515625,
0.1578369140625,
-0.171142578125,
-0.239990234375,
-0.343017578125,
-0.140625,
0.70166015625,
0.407958984375,
-0.270751953125,
0.225830078125,
0.355712890625,
-0.658203125,
0.1781005859375,
-0.0026702880859375,
-0.39794921875,
-0.2073974609375,
0.379150390625,
1.0302734375,
-0.7470703125,
-0.60986328125,
-0.492431640625,
0.486572265625,
0.66943359375,
0.247802734375,
0.019073486328125,
-0.56201171875,
-0.1402587890625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Tags: implementation, strings
Correct Solution:
```
import string
arr = [i for i in string.ascii_lowercase]
current = 'a'
s = str(input())
count = 0
for i in s:
if i != current:
count += min(abs(arr.index(i) - arr.index(current)), 26 - abs(arr.index(i) - arr.index(current)))
current = i
print(count)
```
| 38,178
|
[
0.401123046875,
-0.1256103515625,
0.01009368896484375,
0.3603515625,
-0.43017578125,
-0.556640625,
-0.05328369140625,
-0.151123046875,
0.05413818359375,
0.478759765625,
0.72216796875,
-0.312744140625,
0.08245849609375,
-0.75146484375,
-0.6552734375,
0.07611083984375,
-0.398681640625,
-0.70068359375,
-0.66552734375,
-0.154052734375,
0.2034912109375,
-0.367919921875,
-1.341796875,
-0.322265625,
-0.73681640625,
0.9443359375,
0.188232421875,
0.29296875,
1,
1.1435546875,
-0.102294921875,
-0.2802734375,
1.1181640625,
-1.2353515625,
-0.135009765625,
-0.361572265625,
0.37451171875,
-0.5830078125,
0.12359619140625,
-0.4814453125,
0.21142578125,
-0.17529296875,
0.6171875,
-0.5107421875,
-0.990234375,
-0.0487060546875,
-0.05743408203125,
-0.443603515625,
-0.11962890625,
-0.6953125,
0.08270263671875,
-0.146484375,
0.5068359375,
-0.1551513671875,
-0.107666015625,
-0.2841796875,
-0.00565338134765625,
-0.06390380859375,
-0.458251953125,
0.126220703125,
0.12841796875,
0.175048828125,
0.10906982421875,
-0.845703125,
-0.2626953125,
0.0462646484375,
0.11273193359375,
-0.283447265625,
0.0171356201171875,
-0.98095703125,
-0.325927734375,
0.326904296875,
0.046417236328125,
-0.76806640625,
-0.378173828125,
-0.0178680419921875,
0.060028076171875,
0.1571044921875,
-0.62255859375,
0.51220703125,
0.065673828125,
0.7099609375,
-0.18115234375,
0.17822265625,
-0.5498046875,
-0.42041015625,
-0.00390625,
-0.1978759765625,
0.1627197265625,
-0.318115234375,
-0.12115478515625,
0.52880859375,
-0.75830078125,
0.2266845703125,
0.69775390625,
0.7314453125,
-0.384765625,
0.4814453125,
0.312255859375,
0.29541015625,
0.57763671875,
1.0224609375,
-0.75439453125,
0.96923828125,
-0.1290283203125,
-0.0853271484375,
0.1961669921875,
-0.271240234375,
-0.26708984375,
-0.5390625,
-0.37548828125,
-0.463623046875,
0.57275390625,
0.28125,
-0.058197021484375,
0.71484375,
0.2486572265625,
0.439208984375,
-0.74169921875,
0.509765625,
0.06964111328125,
-0.2042236328125,
0.2474365234375,
-0.279052734375,
-0.1776123046875,
-0.09735107421875,
-0.41064453125,
0.64404296875,
-0.390380859375,
0.07012939453125,
0.60888671875,
0.5791015625,
0.042144775390625,
0.470458984375,
-0.2181396484375,
0.69140625,
-0.16259765625,
0.6826171875,
0.76025390625,
-0.65869140625,
0.269287109375,
-0.51220703125,
0.35595703125,
1.8056640625,
0.53662109375,
-0.11376953125,
0.68896484375,
0.56787109375,
-0.88818359375,
0.76171875,
-0.60400390625,
0.54736328125,
0.10333251953125,
0.2457275390625,
-0.2130126953125,
-0.06439208984375,
-0.39892578125,
0.6494140625,
-0.1690673828125,
0.50146484375,
-0.603515625,
-0.06512451171875,
0.05999755859375,
0.97998046875,
-0.05560302734375,
0.92919921875,
-0.365966796875,
-0.4521484375,
-0.12054443359375,
-0.95068359375,
0.290283203125,
-0.2191162109375,
-0.1376953125,
0.5283203125,
0.52978515625,
0.79296875,
0.8818359375,
-0.08197021484375,
0.56787109375,
0.1639404296875,
-0.259765625,
0.11279296875,
0.1497802734375,
0.6318359375,
-0.11737060546875,
0.345703125,
0.07745361328125,
-0.27685546875,
-0.51611328125,
-0.54443359375,
-0.0292205810546875,
0.58154296875,
-0.30322265625,
0.151123046875,
-0.049652099609375,
0.1839599609375,
-1.1142578125,
0.06134033203125,
-0.0640869140625,
-1.060546875,
-0.2197265625,
0.61669921875,
-0.0850830078125,
0.298828125,
-0.326904296875,
-0.83837890625,
0.401611328125,
1.041015625,
-0.43603515625,
-0.04913330078125,
0.6337890625,
0.1773681640625,
-0.2054443359375,
0.292236328125,
0.192626953125,
-0.27392578125,
-0.80810546875,
0.80712890625,
-0.352783203125,
0.2039794921875,
-0.06976318359375,
0.755859375,
0.1951904296875,
0.5869140625,
-0.263671875,
0.293701171875,
0.397216796875,
1.0673828125,
-0.0797119140625,
0.52099609375,
0.1546630859375,
0.96826171875,
0.80126953125,
0.828125,
0.64794921875,
0.11346435546875,
0.3076171875,
0.55419921875,
0.0323486328125,
-0.1033935546875,
0.033538818359375,
0.2041015625,
0.5810546875,
0.347900390625,
-0.1885986328125,
0.485107421875,
-0.0001392364501953125,
-0.1949462890625,
-0.5478515625,
0.355712890625,
-0.309814453125,
0.90625,
-0.09283447265625,
0.31982421875,
-0.1932373046875,
-0.265625,
0.356689453125,
0.63134765625,
-0.4111328125,
-0.3837890625,
0.2320556640625,
0.2890625,
0.115234375,
-0.0012178421020507812,
-0.03643798828125,
0.341064453125,
-0.0098724365234375,
0.8291015625,
-0.47509765625,
-0.2978515625,
-1.1083984375,
-0.95166015625,
-0.748046875,
-0.07305908203125,
-0.5654296875,
-0.02264404296875,
0.46533203125,
-0.57763671875,
0.81494140625,
-0.5712890625,
0.0716552734375,
-0.08245849609375,
-0.76220703125,
0.638671875,
0.03509521484375,
0.7109375,
-0.304931640625,
0.430419921875,
0.09197998046875,
0.826171875,
-0.61669921875,
-0.288818359375,
-0.467041015625,
-0.330322265625,
0.354736328125,
-0.0894775390625,
0.55419921875,
-0.5244140625,
-0.89501953125,
-0.7587890625,
-0.149169921875,
-0.06463623046875,
-0.5400390625,
0.32763671875,
-0.51611328125,
0.8173828125,
0.62353515625,
-0.84326171875,
0.4091796875,
0.80615234375,
-0.9931640625,
0.436767578125,
0.27001953125,
-0.01178741455078125,
-0.96044921875,
1.0791015625,
0.369140625,
0.5185546875,
-0.2666015625,
-0.046142578125,
-0.57958984375,
0.41943359375,
-0.298095703125,
-0.57373046875,
-0.23828125,
0.5185546875,
0.2279052734375,
-1.044921875,
0.55908203125,
-1.0263671875,
-0.6005859375,
-0.5,
-0.505859375,
0.7109375,
0.6943359375,
-0.032623291015625,
0.1390380859375,
-0.01104736328125,
0.23486328125,
0.7626953125,
0.443603515625,
-0.43359375,
0.181884765625,
0.404052734375,
-0.68505859375,
0.5078125,
0.430419921875,
-0.12744140625,
-0.2021484375,
-0.09320068359375,
0.09173583984375,
0.13623046875,
0.245849609375,
0.28271484375,
0.640625,
0.82275390625,
-0.4443359375,
-0.251708984375,
-0.61474609375,
1.009765625,
0.434814453125,
0.53662109375,
0.228271484375,
-0.11590576171875,
-0.517578125,
-0.77099609375,
0.09466552734375,
0.6435546875,
0.67822265625,
-0.55517578125,
0.650390625,
0.0758056640625,
-0.548828125,
0.005413055419921875,
-0.6162109375,
-0.5283203125,
0.78076171875,
-0.1719970703125,
0.85595703125,
-0.505859375,
0.03076171875,
-0.38525390625,
0.032989501953125,
0.045440673828125,
0.07855224609375,
0.5908203125,
-0.306640625,
-0.23388671875,
-0.59423828125,
-0.282470703125,
-0.007404327392578125,
-0.58642578125,
0.2025146484375,
-0.6435546875,
-0.5078125,
-0.4990234375,
0.322021484375,
0.98583984375,
0.54052734375,
-0.1473388671875,
0.311767578125,
0.18115234375,
0.2802734375,
0.300537109375,
-0.58349609375,
-0.04779052734375,
-0.576171875,
0.703125,
0.255126953125,
-0.37744140625,
-0.59033203125,
-0.325927734375,
-0.69873046875,
0.158447265625,
0.2548828125,
-0.1671142578125,
-0.65771484375,
0.4931640625,
-0.19287109375,
0.44775390625,
-0.6083984375,
-0.288818359375,
-0.448974609375,
0.546875,
0.64453125,
-0.03338623046875,
0.0517578125,
-0.5859375,
0.62646484375,
0.59716796875,
-0.038299560546875,
-0.53173828125,
-0.1927490234375,
-0.64306640625,
-0.478759765625,
-0.006771087646484375,
0.68115234375,
0.39306640625,
0.0787353515625,
-1.01171875,
0.78955078125,
0.1912841796875,
-0.591796875,
-0.179443359375,
0.40576171875,
0.0616455078125,
-0.1851806640625,
0.63623046875,
-0.1756591796875,
-0.623046875,
0.2275390625,
-1.1259765625,
0.69677734375,
-0.2127685546875,
0.405029296875,
-0.0849609375,
-0.1285400390625,
0.1885986328125,
0.26611328125,
-0.63623046875,
-0.0712890625,
-0.2109375,
0.63525390625,
-1.0869140625,
-0.52734375,
0.6162109375,
-0.26123046875,
-0.332275390625,
0.5615234375,
-0.35986328125,
-0.29736328125,
0.30908203125,
-0.0136566162109375,
-0.48681640625,
-0.09619140625,
-0.332275390625,
0.52197265625,
0.0775146484375,
-0.2490234375,
0.38134765625,
-0.5576171875,
1.1865234375,
0.178466796875,
-0.71875,
-0.039215087890625,
-1.0185546875,
-0.240234375,
-0.17431640625,
-0.60986328125,
0.02728271484375,
0.01393890380859375,
-0.24365234375,
-0.113525390625,
-0.26318359375,
-0.53564453125,
-0.2001953125,
-0.68408203125,
0.22216796875,
0.5400390625,
0.388671875,
0.2467041015625,
-0.1336669921875,
-0.5634765625,
0.314453125,
-0.337158203125,
-0.0234527587890625,
-0.421630859375,
-0.111083984375,
-0.53759765625,
-0.2939453125,
-0.345947265625,
0.37255859375,
-0.337158203125,
0.08642578125,
0.859375,
0.50634765625,
0.407470703125,
-0.204345703125,
-0.431396484375,
0.59130859375,
0.1282958984375,
-1.080078125,
-0.66650390625,
1.1103515625,
0.0411376953125,
0.55859375,
0.55908203125,
-0.57080078125,
-1.1171875,
-1.044921875,
0.2137451171875,
-0.408203125,
-0.252685546875,
-0.67578125,
-0.362548828125,
-0.6025390625,
0.43798828125,
-0.144775390625,
-0.36083984375,
0.326904296875,
-0.859375,
0.1978759765625,
-0.477783203125,
0.1949462890625,
-0.392578125,
-0.857421875,
-0.45263671875,
0.8525390625,
0.3388671875,
0.29296875,
0.005779266357421875,
-0.01226043701171875,
0.444091796875,
0.26318359375,
-0.25341796875,
-0.378662109375,
-0.1551513671875,
0.6015625,
-0.27294921875,
-0.140625,
-0.043792724609375,
0.6181640625,
-0.90185546875,
0.384521484375,
0.145263671875,
-0.1617431640625,
-0.2344970703125,
-0.36083984375,
1.03515625,
-0.25146484375,
-0.02197265625,
-0.312255859375,
0.63037109375,
0.5322265625,
-0.276611328125,
-0.0251922607421875,
-0.62646484375,
-0.415283203125,
-1.0458984375,
0.7353515625,
-0.1209716796875,
0.301513671875,
-0.485107421875,
-0.1676025390625,
1.34765625,
-0.462158203125,
0.405029296875,
1.1923828125,
0.16015625,
0.2100830078125,
-0.69189453125,
0.5380859375,
0.28515625,
-0.349853515625,
-0.345458984375,
0.0205078125,
-0.72998046875,
0.493896484375,
-0.1971435546875,
-1.02734375,
-0.52099609375,
0.50634765625,
1.25,
-0.28857421875,
0.5537109375,
-0.1678466796875,
-1.0869140625,
-0.60791015625,
0.75244140625,
-0.2861328125,
0.199951171875,
0.7216796875,
-0.036224365234375,
-0.1572265625,
-0.07916259765625,
-0.0180816650390625,
-0.423583984375,
-0.427978515625,
0.9951171875,
-0.265869140625,
-0.79052734375,
1.2099609375,
0.521484375,
-0.8408203125,
-0.9306640625,
0.097900390625,
-0.22607421875,
-0.300537109375,
-0.89453125,
0.2265625,
0.1849365234375,
-0.3466796875,
-0.1365966796875,
0.3115234375,
-0.2841796875,
0.283935546875,
0.035003662109375,
0.28125,
-0.5419921875,
0.07855224609375,
0.29296875,
-0.422607421875,
-0.286865234375,
-0.93896484375,
-0.2474365234375,
-0.68603515625,
-0.07568359375,
0.375,
-0.35888671875,
0.416748046875,
0.34375,
0.217529296875,
0.90234375,
-0.1824951171875,
-0.2467041015625,
0.03521728515625,
-0.401123046875,
-0.59912109375,
-0.38037109375,
0.2587890625,
-0.421875,
-0.1318359375,
-0.59375,
-0.266845703125,
0.337890625,
0.29443359375,
-0.44921875,
-1.158203125,
-0.2958984375,
-1.0390625,
-0.5869140625,
-0.4140625,
-0.52978515625,
-0.353271484375,
-0.178955078125,
-0.05474853515625,
-0.388671875,
0.081787109375,
0.49560546875,
-0.12158203125,
0.68212890625,
-0.35693359375,
0.40966796875,
-0.83056640625,
-0.01520538330078125,
-0.54638671875,
0.376220703125,
-0.439697265625,
-0.1038818359375,
-0.720703125,
0.0068817138671875,
0.20458984375,
0.5458984375,
-0.385986328125,
0.3896484375,
0.1103515625,
-0.436279296875,
-0.0079193115234375,
0.0362548828125,
-0.0347900390625,
0.51904296875,
0.8974609375,
-0.14794921875,
0.375732421875,
-0.178955078125,
-0.57275390625,
-0.09527587890625,
0.5302734375,
0.50927734375,
-0.2376708984375,
-0.09637451171875,
-0.2391357421875,
0.420166015625,
-0.89453125,
0.233642578125,
-0.243896484375,
0.31640625,
-0.039154052734375,
-0.20751953125,
0.55712890625,
0.64111328125,
0.12109375,
0.06390380859375,
-0.1326904296875,
0.10980224609375,
-0.0809326171875,
0.190185546875,
0.14892578125,
0.52294921875,
0.136474609375,
-0.371337890625,
-0.10382080078125,
0.27734375,
-0.390380859375,
0.65478515625,
-0.487548828125,
-0.37939453125,
-0.74560546875,
-0.127685546875,
-0.0075225830078125,
0.75830078125,
0.4599609375,
-0.6318359375,
0.0038909912109375,
-0.23388671875,
-0.6494140625,
0.08416748046875,
-1.3095703125,
-0.91943359375,
0.1546630859375,
-0.111083984375,
-0.1021728515625,
-0.45556640625,
-0.6181640625,
-0.077392578125,
-0.091064453125,
0.75537109375,
-0.763671875,
0.452392578125,
-0.003246307373046875,
0.736328125,
-0.60009765625,
0.28271484375,
0.37939453125,
0.75537109375,
-0.28369140625,
-0.45263671875,
-0.007579803466796875,
1.287109375,
0.1087646484375,
0.26416015625,
-0.429931640625,
0.002689361572265625,
0.1241455078125,
0.23486328125,
-0.3642578125,
-0.046142578125,
-0.51416015625,
1.091796875,
-0.89404296875,
0.146728515625,
0.255615234375,
0.40380859375,
0.2222900390625,
-0.468505859375,
-0.52099609375,
0.9287109375,
1.017578125,
0.08624267578125,
0.425537109375,
0.61181640625,
0.49853515625,
-0.322509765625,
-0.24609375,
-0.27001953125,
0.880859375,
0.36865234375,
0.37451171875,
-0.23779296875,
0.52880859375,
0.783203125,
-0.044677734375,
-0.3056640625,
0.5361328125,
0.3369140625,
-0.346435546875,
0.2890625,
0.05035400390625,
-0.019927978515625,
-0.261962890625,
-0.197021484375,
0.6103515625,
-0.3349609375,
-0.09625244140625,
-0.1787109375,
-0.6552734375,
0.71142578125,
-0.086669921875,
-0.51318359375,
0.78515625,
-0.490234375,
0.38427734375,
0.344482421875,
0.08184814453125,
-0.04736328125,
0.8671875,
0.8115234375,
0.305419921875,
0.4345703125,
0.669921875,
0.341796875,
-0.83544921875,
0.0276947021484375,
0.55712890625,
-0.01099395751953125,
-0.2744140625,
-0.57666015625,
-0.79296875,
0.60205078125,
-0.397216796875,
-0.30517578125,
0.373046875,
-0.66064453125,
0.06414794921875,
-0.658203125,
0.92041015625,
-0.65087890625,
0.280517578125,
0.29736328125,
0.10150146484375,
-0.51025390625,
1.1337890625,
-0.3125,
0.326416015625,
0.23046875,
1.337890625,
0.119140625,
1.25,
0.69384765625,
-0.271484375,
-0.16943359375,
0.414794921875,
-0.49365234375,
-0.60205078125,
-0.2322998046875,
-0.2335205078125,
-0.2371826171875,
-1.0302734375,
-0.322021484375,
-0.415771484375,
1.140625,
-0.03594970703125,
-0.93017578125,
-0.109619140625,
0.1937255859375,
-1.0732421875,
0.5478515625,
0.225341796875,
0.210205078125,
0.170654296875,
0.1600341796875,
-0.1845703125,
-0.63232421875,
0.003307342529296875,
-0.61572265625,
0.28466796875,
-0.67822265625,
-0.40283203125,
-0.8330078125,
-0.84423828125,
-0.5126953125,
0.1693115234375,
-0.5068359375,
-0.86328125,
0.21435546875,
0.45947265625,
0.54833984375,
0.330810546875,
-0.0875244140625,
-0.164794921875,
0.92626953125,
0.89501953125,
0.515625,
0.8984375,
0.1683349609375,
-0.03448486328125,
0.1112060546875,
-0.740234375,
0.46435546875,
-0.43505859375,
0.5634765625,
0.1781005859375,
0.06451416015625,
-0.52294921875,
-1.4267578125,
-0.1595458984375,
0.241455078125,
0.394775390625,
-0.473388671875,
-0.9658203125,
-0.58251953125,
-0.908203125,
-0.293701171875,
-0.41259765625,
0.64208984375,
-0.08099365234375,
0.2939453125,
-0.391845703125,
-1.3271484375,
4.55078125,
1.1064453125,
0.9716796875,
0.60009765625,
0.061859130859375,
0.8603515625,
0.744140625,
-0.60302734375,
-0.158935546875,
-0.249267578125,
0.318115234375,
-0.03533935546875,
0.04034423828125,
0.849609375,
0.43798828125,
0.58837890625,
-0.85107421875,
0.018035888671875,
-0.029754638671875,
-0.9697265625,
-0.79931640625,
0.01367950439453125,
-0.343994140625,
0.28515625,
-0.257568359375,
0.1490478515625,
0.7275390625,
-0.63232421875,
-0.75341796875,
-0.50390625,
0.0255279541015625,
-0.342529296875,
0.86572265625,
-0.00026535987854003906,
-0.437255859375,
0.463623046875,
-0.2120361328125,
-0.64013671875,
-0.315673828125,
0.235107421875,
-0.05145263671875,
-0.273681640625,
0.8154296875,
-0.343994140625,
0.095458984375,
0.4091796875,
-0.60546875,
0.57666015625,
0.427490234375,
-0.7763671875,
0.81640625,
-0.100830078125,
0.410400390625,
-0.392822265625,
-0.71875,
0.0015468597412109375,
0.060272216796875,
-0.065185546875,
-0.482177734375,
0.61474609375,
0.30908203125,
0.26025390625,
-0.0966796875,
0.326171875,
-0.80419921875,
0.8359375,
-0.56884765625,
0.50048828125,
-0.505859375,
0.133056640625,
-0.1763916015625,
-0.231689453125,
-0.310791015625,
-0.1416015625,
0.70263671875,
0.41650390625,
-0.296630859375,
0.184326171875,
0.35205078125,
-0.68017578125,
0.201904296875,
-0.0087738037109375,
-0.404541015625,
-0.2100830078125,
0.382080078125,
1.0244140625,
-0.763671875,
-0.61669921875,
-0.4892578125,
0.4775390625,
0.6630859375,
0.2379150390625,
0.03619384765625,
-0.55810546875,
-0.1348876953125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Tags: implementation, strings
Correct Solution:
```
word = input()
lc = 'a'
t = 0
for c in word:
x = max(ord(c)-ord('a')+1, ord(lc)-ord('a')+1)
y = min(ord(c)-ord('a')+1, ord(lc)-ord('a')+1)
if x - y <= 13:
t += x-y
else:
t += 26 + y-x
lc = c
print(t)
```
| 38,179
|
[
0.41796875,
-0.207763671875,
0.029449462890625,
0.408447265625,
-0.4853515625,
-0.59423828125,
0.0166168212890625,
-0.102294921875,
0.032470703125,
0.51953125,
0.7451171875,
-0.29541015625,
0.057281494140625,
-0.73828125,
-0.64892578125,
0.072509765625,
-0.41845703125,
-0.6298828125,
-0.609375,
-0.1455078125,
0.1812744140625,
-0.324462890625,
-1.3681640625,
-0.21484375,
-0.75048828125,
0.85791015625,
0.1900634765625,
0.2044677734375,
1.0048828125,
1.150390625,
-0.109130859375,
-0.2734375,
1.0947265625,
-1.1875,
-0.1285400390625,
-0.35888671875,
0.412353515625,
-0.56298828125,
0.1358642578125,
-0.484130859375,
0.2734375,
-0.262451171875,
0.64892578125,
-0.55810546875,
-0.96875,
-0.032623291015625,
-0.0267181396484375,
-0.487060546875,
-0.1905517578125,
-0.74658203125,
0.08819580078125,
-0.1629638671875,
0.4873046875,
-0.224609375,
-0.0980224609375,
-0.282958984375,
0.0154876708984375,
-0.054962158203125,
-0.413330078125,
0.1422119140625,
0.1650390625,
0.161376953125,
0.141357421875,
-0.93994140625,
-0.295166015625,
0.06512451171875,
0.00653076171875,
-0.1856689453125,
0.040283203125,
-0.98046875,
-0.311767578125,
0.332763671875,
0.03759765625,
-0.7568359375,
-0.340087890625,
-0.06817626953125,
0.062103271484375,
0.15771484375,
-0.64892578125,
0.58056640625,
0.0362548828125,
0.63134765625,
-0.2333984375,
0.1455078125,
-0.52685546875,
-0.416748046875,
0.050048828125,
-0.2142333984375,
0.146484375,
-0.33349609375,
-0.176513671875,
0.54931640625,
-0.70849609375,
0.2144775390625,
0.67431640625,
0.71533203125,
-0.427001953125,
0.455810546875,
0.346923828125,
0.26123046875,
0.57470703125,
1.056640625,
-0.71240234375,
0.89990234375,
-0.130615234375,
-0.0697021484375,
0.1727294921875,
-0.2255859375,
-0.2462158203125,
-0.56787109375,
-0.385009765625,
-0.414794921875,
0.51513671875,
0.22802734375,
-0.1109619140625,
0.67822265625,
0.255615234375,
0.48291015625,
-0.7041015625,
0.4853515625,
0.12469482421875,
-0.1737060546875,
0.2098388671875,
-0.261962890625,
-0.125,
-0.091796875,
-0.50537109375,
0.6689453125,
-0.414794921875,
0.010345458984375,
0.578125,
0.54443359375,
-0.01352691650390625,
0.5244140625,
-0.1624755859375,
0.75244140625,
-0.181640625,
0.64404296875,
0.79150390625,
-0.6962890625,
0.26171875,
-0.49267578125,
0.420166015625,
1.8076171875,
0.505859375,
-0.0963134765625,
0.68701171875,
0.6240234375,
-0.90673828125,
0.8671875,
-0.63427734375,
0.6064453125,
0.09295654296875,
0.2939453125,
-0.18701171875,
-0.00974273681640625,
-0.33740234375,
0.65673828125,
-0.17431640625,
0.47412109375,
-0.56005859375,
-0.1494140625,
0.045135498046875,
0.9287109375,
-0.11126708984375,
0.90380859375,
-0.34228515625,
-0.383544921875,
-0.1787109375,
-0.8935546875,
0.265380859375,
-0.1572265625,
-0.087158203125,
0.50341796875,
0.5283203125,
0.84423828125,
0.89990234375,
-0.0654296875,
0.56689453125,
0.18896484375,
-0.298828125,
0.10406494140625,
0.09942626953125,
0.646484375,
-0.05908203125,
0.31982421875,
0.051361083984375,
-0.2421875,
-0.48779296875,
-0.52783203125,
-0.03985595703125,
0.634765625,
-0.28271484375,
0.0997314453125,
-0.07635498046875,
0.1048583984375,
-1.0341796875,
0.056854248046875,
-0.0306549072265625,
-1.068359375,
-0.1951904296875,
0.61865234375,
-0.0238494873046875,
0.341796875,
-0.408935546875,
-0.87841796875,
0.3486328125,
0.9951171875,
-0.5517578125,
-0.037506103515625,
0.64501953125,
0.24560546875,
-0.1768798828125,
0.257568359375,
0.2347412109375,
-0.2169189453125,
-0.798828125,
0.7470703125,
-0.404541015625,
0.09051513671875,
-0.0511474609375,
0.81884765625,
0.2047119140625,
0.5869140625,
-0.300537109375,
0.267578125,
0.4248046875,
1.12109375,
-0.07470703125,
0.58154296875,
0.135986328125,
0.9814453125,
0.7255859375,
0.81201171875,
0.6513671875,
0.1285400390625,
0.313232421875,
0.52783203125,
0.041656494140625,
-0.1258544921875,
0.084716796875,
0.32421875,
0.5625,
0.39794921875,
-0.1904296875,
0.51513671875,
-0.0017499923706054688,
-0.225341796875,
-0.5234375,
0.362548828125,
-0.32373046875,
0.91162109375,
-0.1148681640625,
0.292724609375,
-0.19482421875,
-0.2264404296875,
0.40771484375,
0.6728515625,
-0.32421875,
-0.494873046875,
0.3154296875,
0.24755859375,
0.10833740234375,
0.0200653076171875,
-0.0489501953125,
0.34716796875,
0.0206298828125,
0.85546875,
-0.4404296875,
-0.285888671875,
-1.06640625,
-0.98046875,
-0.72021484375,
-0.1304931640625,
-0.58642578125,
-0.02679443359375,
0.390625,
-0.58349609375,
0.736328125,
-0.6171875,
0.058319091796875,
-0.113037109375,
-0.724609375,
0.66796875,
0.017669677734375,
0.6845703125,
-0.31689453125,
0.44677734375,
0.09661865234375,
0.8359375,
-0.63720703125,
-0.298583984375,
-0.533203125,
-0.393310546875,
0.412109375,
-0.06646728515625,
0.51953125,
-0.4384765625,
-0.87548828125,
-0.75146484375,
-0.159912109375,
-0.05853271484375,
-0.450439453125,
0.289306640625,
-0.5205078125,
0.90478515625,
0.623046875,
-0.90087890625,
0.351806640625,
0.8017578125,
-0.93505859375,
0.45556640625,
0.325439453125,
-0.01342010498046875,
-1.0048828125,
1.1123046875,
0.39013671875,
0.56298828125,
-0.259033203125,
-0.0229644775390625,
-0.5537109375,
0.405029296875,
-0.3017578125,
-0.55224609375,
-0.1942138671875,
0.5078125,
0.171875,
-1.0341796875,
0.546875,
-1.029296875,
-0.68701171875,
-0.46337890625,
-0.497802734375,
0.775390625,
0.74267578125,
0.01995849609375,
0.1298828125,
-0.00022733211517333984,
0.22802734375,
0.72509765625,
0.39111328125,
-0.463134765625,
0.1578369140625,
0.453369140625,
-0.6083984375,
0.45263671875,
0.44140625,
-0.10888671875,
-0.2271728515625,
-0.06793212890625,
0.111328125,
0.1954345703125,
0.250732421875,
0.28076171875,
0.64794921875,
0.76953125,
-0.50927734375,
-0.251220703125,
-0.68212890625,
0.9775390625,
0.46630859375,
0.455322265625,
0.1949462890625,
-0.0838623046875,
-0.5341796875,
-0.7470703125,
0.11163330078125,
0.626953125,
0.7177734375,
-0.5400390625,
0.734375,
0.08966064453125,
-0.52294921875,
0.0141754150390625,
-0.671875,
-0.525390625,
0.8271484375,
-0.17822265625,
0.89013671875,
-0.568359375,
0.04925537109375,
-0.403076171875,
-0.0062255859375,
0.11407470703125,
0.10247802734375,
0.58740234375,
-0.284912109375,
-0.2119140625,
-0.57568359375,
-0.271240234375,
-0.03314208984375,
-0.564453125,
0.282958984375,
-0.6669921875,
-0.495849609375,
-0.5634765625,
0.343017578125,
0.99072265625,
0.51318359375,
-0.1239013671875,
0.3193359375,
0.1710205078125,
0.2464599609375,
0.313232421875,
-0.56689453125,
-0.057403564453125,
-0.59130859375,
0.75390625,
0.251220703125,
-0.403564453125,
-0.55712890625,
-0.38671875,
-0.70849609375,
0.12322998046875,
0.22900390625,
-0.1580810546875,
-0.611328125,
0.427001953125,
-0.1634521484375,
0.464111328125,
-0.6259765625,
-0.27392578125,
-0.468505859375,
0.5810546875,
0.70361328125,
-0.06494140625,
0.0080108642578125,
-0.578125,
0.61279296875,
0.58349609375,
-0.038055419921875,
-0.5390625,
-0.1798095703125,
-0.69140625,
-0.51953125,
0.01055908203125,
0.63525390625,
0.398193359375,
0.033966064453125,
-0.99658203125,
0.8056640625,
0.22265625,
-0.67041015625,
-0.1082763671875,
0.413330078125,
0.0986328125,
-0.1895751953125,
0.6669921875,
-0.153076171875,
-0.62109375,
0.2666015625,
-1.044921875,
0.68798828125,
-0.209228515625,
0.450927734375,
-0.03948974609375,
-0.08563232421875,
0.14306640625,
0.220458984375,
-0.708984375,
-0.0011920928955078125,
-0.279296875,
0.62353515625,
-1.0625,
-0.57373046875,
0.70263671875,
-0.270751953125,
-0.364013671875,
0.57763671875,
-0.330810546875,
-0.325439453125,
0.29736328125,
0.018341064453125,
-0.51708984375,
-0.10986328125,
-0.36328125,
0.54931640625,
0.0306396484375,
-0.259521484375,
0.37158203125,
-0.57861328125,
1.146484375,
0.17333984375,
-0.73486328125,
-0.06390380859375,
-1.0732421875,
-0.2364501953125,
-0.1771240234375,
-0.673828125,
-0.030670166015625,
0.0016393661499023438,
-0.26953125,
-0.1658935546875,
-0.26025390625,
-0.515625,
-0.2354736328125,
-0.67822265625,
0.273193359375,
0.52685546875,
0.409912109375,
0.262939453125,
-0.10589599609375,
-0.5546875,
0.3642578125,
-0.329345703125,
-0.06427001953125,
-0.4228515625,
-0.08502197265625,
-0.482421875,
-0.280029296875,
-0.2440185546875,
0.327392578125,
-0.328369140625,
0.10113525390625,
0.865234375,
0.457275390625,
0.351806640625,
-0.176025390625,
-0.368408203125,
0.60546875,
0.0859375,
-1.0634765625,
-0.65625,
1.1103515625,
0.048736572265625,
0.55712890625,
0.4658203125,
-0.5888671875,
-1.16796875,
-0.9462890625,
0.1904296875,
-0.435546875,
-0.249267578125,
-0.759765625,
-0.351318359375,
-0.55615234375,
0.3994140625,
-0.1265869140625,
-0.38232421875,
0.324951171875,
-0.89794921875,
0.1885986328125,
-0.490966796875,
0.2088623046875,
-0.477783203125,
-0.79931640625,
-0.49853515625,
0.7919921875,
0.3359375,
0.281494140625,
-0.006748199462890625,
0.0164031982421875,
0.461181640625,
0.329833984375,
-0.27001953125,
-0.294921875,
-0.1556396484375,
0.5888671875,
-0.26123046875,
-0.203857421875,
-0.08526611328125,
0.630859375,
-0.91162109375,
0.413330078125,
0.11029052734375,
-0.2305908203125,
-0.2432861328125,
-0.3388671875,
1.0087890625,
-0.2327880859375,
-0.039337158203125,
-0.334716796875,
0.5849609375,
0.5263671875,
-0.279541015625,
-0.0791015625,
-0.62548828125,
-0.396728515625,
-1.0224609375,
0.70751953125,
-0.08154296875,
0.31689453125,
-0.48583984375,
-0.2120361328125,
1.271484375,
-0.456787109375,
0.4150390625,
1.181640625,
0.1328125,
0.2357177734375,
-0.64892578125,
0.56201171875,
0.32568359375,
-0.367919921875,
-0.403076171875,
0.031646728515625,
-0.79345703125,
0.53759765625,
-0.1885986328125,
-0.9775390625,
-0.53369140625,
0.5234375,
1.2060546875,
-0.196533203125,
0.52685546875,
-0.133544921875,
-1.11328125,
-0.63720703125,
0.728515625,
-0.3662109375,
0.2119140625,
0.666015625,
-0.045013427734375,
-0.182861328125,
-0.0687255859375,
0.00893402099609375,
-0.397216796875,
-0.41455078125,
1.0166015625,
-0.26708984375,
-0.78759765625,
1.2685546875,
0.54052734375,
-0.81396484375,
-0.95703125,
0.09124755859375,
-0.11328125,
-0.3154296875,
-0.9033203125,
0.279052734375,
0.300537109375,
-0.3837890625,
-0.2188720703125,
0.386474609375,
-0.2474365234375,
0.318359375,
0.006717681884765625,
0.29931640625,
-0.483154296875,
0.084716796875,
0.281005859375,
-0.3984375,
-0.2164306640625,
-0.91943359375,
-0.22412109375,
-0.6416015625,
-0.06439208984375,
0.3359375,
-0.331787109375,
0.439453125,
0.361328125,
0.198486328125,
0.8798828125,
-0.253173828125,
-0.2529296875,
0.03973388671875,
-0.384033203125,
-0.58984375,
-0.330078125,
0.2474365234375,
-0.3837890625,
-0.1612548828125,
-0.69580078125,
-0.2900390625,
0.33056640625,
0.3017578125,
-0.466552734375,
-1.1318359375,
-0.264892578125,
-1.0751953125,
-0.59619140625,
-0.40087890625,
-0.6220703125,
-0.35009765625,
-0.1611328125,
-0.05084228515625,
-0.394775390625,
0.06768798828125,
0.424560546875,
-0.230712890625,
0.68603515625,
-0.370849609375,
0.5048828125,
-0.8779296875,
-0.0020313262939453125,
-0.52197265625,
0.399658203125,
-0.485595703125,
-0.1514892578125,
-0.74169921875,
0.0279998779296875,
0.17041015625,
0.5283203125,
-0.357177734375,
0.364501953125,
0.07623291015625,
-0.4375,
-0.0278472900390625,
0.0787353515625,
-0.03924560546875,
0.578125,
0.962890625,
-0.1099853515625,
0.412841796875,
-0.1429443359375,
-0.5791015625,
-0.16650390625,
0.52392578125,
0.477294921875,
-0.265380859375,
-0.1187744140625,
-0.189453125,
0.38671875,
-1.0087890625,
0.259033203125,
-0.2880859375,
0.39306640625,
-0.055572509765625,
-0.22705078125,
0.56494140625,
0.7109375,
0.12109375,
0.06591796875,
-0.09796142578125,
0.11932373046875,
-0.09271240234375,
0.2103271484375,
0.1466064453125,
0.56982421875,
0.109375,
-0.404541015625,
-0.04693603515625,
0.343505859375,
-0.349365234375,
0.6123046875,
-0.48291015625,
-0.3828125,
-0.72412109375,
-0.1534423828125,
-0.057464599609375,
0.6923828125,
0.47998046875,
-0.671875,
0.01971435546875,
-0.2371826171875,
-0.68359375,
0.06640625,
-1.3134765625,
-0.87548828125,
0.16015625,
-0.1573486328125,
-0.06756591796875,
-0.41796875,
-0.615234375,
-0.12493896484375,
-0.1536865234375,
0.76318359375,
-0.79296875,
0.45703125,
-0.0933837890625,
0.75732421875,
-0.63525390625,
0.309814453125,
0.373291015625,
0.66259765625,
-0.302001953125,
-0.4716796875,
-0.030059814453125,
1.26171875,
0.10980224609375,
0.320556640625,
-0.384765625,
0.045318603515625,
0.11944580078125,
0.250244140625,
-0.412353515625,
-0.0155181884765625,
-0.455810546875,
1.0986328125,
-0.89599609375,
0.16064453125,
0.2423095703125,
0.45751953125,
0.1727294921875,
-0.4609375,
-0.51611328125,
0.939453125,
1.0712890625,
0.126953125,
0.39794921875,
0.58447265625,
0.544921875,
-0.420166015625,
-0.24169921875,
-0.360107421875,
0.90283203125,
0.353515625,
0.3583984375,
-0.280029296875,
0.59765625,
0.7724609375,
-0.03924560546875,
-0.29931640625,
0.61083984375,
0.302001953125,
-0.3076171875,
0.315673828125,
0.0192718505859375,
-0.0305633544921875,
-0.1943359375,
-0.1365966796875,
0.5888671875,
-0.306640625,
-0.0249481201171875,
-0.1795654296875,
-0.7294921875,
0.74609375,
-0.1290283203125,
-0.48828125,
0.77685546875,
-0.46337890625,
0.38916015625,
0.34423828125,
0.0986328125,
-0.03179931640625,
0.84228515625,
0.8271484375,
0.33056640625,
0.45947265625,
0.6953125,
0.266845703125,
-0.8564453125,
0.053131103515625,
0.52587890625,
0.0106201171875,
-0.26220703125,
-0.5908203125,
-0.82373046875,
0.58203125,
-0.359375,
-0.41748046875,
0.375244140625,
-0.634765625,
0.0540771484375,
-0.62109375,
0.95751953125,
-0.7109375,
0.31787109375,
0.322509765625,
0.108642578125,
-0.5498046875,
1.1005859375,
-0.33447265625,
0.248046875,
0.356689453125,
1.3388671875,
0.1983642578125,
1.21875,
0.681640625,
-0.28173828125,
-0.1363525390625,
0.486083984375,
-0.54833984375,
-0.494140625,
-0.239990234375,
-0.2113037109375,
-0.31298828125,
-1.044921875,
-0.28369140625,
-0.434814453125,
1.130859375,
-0.1051025390625,
-0.8681640625,
-0.1640625,
0.227783203125,
-1.0390625,
0.529296875,
0.1868896484375,
0.22119140625,
0.2396240234375,
0.20361328125,
-0.243896484375,
-0.6884765625,
0.08331298828125,
-0.5966796875,
0.3447265625,
-0.65966796875,
-0.4580078125,
-0.75048828125,
-0.861328125,
-0.521484375,
0.1597900390625,
-0.487060546875,
-0.85693359375,
0.223388671875,
0.45458984375,
0.50390625,
0.3310546875,
-0.0770263671875,
-0.1318359375,
0.8623046875,
0.89599609375,
0.477783203125,
0.89306640625,
0.15771484375,
0.07647705078125,
0.10565185546875,
-0.74072265625,
0.4658203125,
-0.4873046875,
0.6474609375,
0.1260986328125,
0.09375,
-0.5595703125,
-1.4384765625,
-0.2393798828125,
0.25830078125,
0.408935546875,
-0.568359375,
-0.978515625,
-0.5546875,
-0.90673828125,
-0.3544921875,
-0.4423828125,
0.650390625,
-0.0789794921875,
0.273681640625,
-0.46875,
-1.384765625,
4.53515625,
1.03515625,
0.9189453125,
0.58984375,
0.1473388671875,
0.90283203125,
0.67578125,
-0.56640625,
-0.19873046875,
-0.267822265625,
0.431396484375,
0.0016889572143554688,
-0.0233917236328125,
0.8388671875,
0.458251953125,
0.619140625,
-0.8232421875,
-0.0740966796875,
-0.07647705078125,
-1.0341796875,
-0.80517578125,
-0.0087738037109375,
-0.25830078125,
0.30419921875,
-0.31298828125,
0.10357666015625,
0.7841796875,
-0.6279296875,
-0.763671875,
-0.5205078125,
0.0268707275390625,
-0.433837890625,
0.826171875,
-0.0158843994140625,
-0.45166015625,
0.44482421875,
-0.1734619140625,
-0.6103515625,
-0.273681640625,
0.229736328125,
-0.05419921875,
-0.295166015625,
0.8583984375,
-0.3466796875,
0.08758544921875,
0.42529296875,
-0.6318359375,
0.59814453125,
0.40673828125,
-0.71044921875,
0.77490234375,
-0.11029052734375,
0.4921875,
-0.38525390625,
-0.70556640625,
0.01122283935546875,
0.0186004638671875,
-0.14306640625,
-0.448974609375,
0.64697265625,
0.33251953125,
0.2384033203125,
-0.1275634765625,
0.36181640625,
-0.7890625,
0.8017578125,
-0.50244140625,
0.42578125,
-0.54443359375,
0.1741943359375,
-0.1495361328125,
-0.283203125,
-0.35888671875,
-0.11981201171875,
0.75927734375,
0.416748046875,
-0.253662109375,
0.245361328125,
0.367919921875,
-0.65869140625,
0.2332763671875,
0.02349853515625,
-0.32373046875,
-0.251953125,
0.3427734375,
0.9931640625,
-0.77001953125,
-0.5205078125,
-0.484375,
0.490478515625,
0.66455078125,
0.264404296875,
0.0260467529296875,
-0.595703125,
-0.1527099609375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Tags: implementation, strings
Correct Solution:
```
count = 0
beg = 'a'
st = input()
c = 0
for i in range (len (st)):
c = abs (ord (beg) - ord (st[i]))
count += min (c, 26 - c)
beg = st[i]
print (count)
```
| 38,180
|
[
0.420654296875,
-0.16015625,
0.01165771484375,
0.385498046875,
-0.44775390625,
-0.5576171875,
-0.05963134765625,
-0.11083984375,
0.01366424560546875,
0.52392578125,
0.744140625,
-0.290771484375,
0.083984375,
-0.72802734375,
-0.66650390625,
0.075439453125,
-0.414306640625,
-0.67529296875,
-0.66015625,
-0.128173828125,
0.1961669921875,
-0.34326171875,
-1.3359375,
-0.27880859375,
-0.73486328125,
0.935546875,
0.19189453125,
0.25732421875,
0.9853515625,
1.1552734375,
-0.09832763671875,
-0.275146484375,
1.1103515625,
-1.2041015625,
-0.12127685546875,
-0.36328125,
0.3798828125,
-0.544921875,
0.1575927734375,
-0.50439453125,
0.221923828125,
-0.2076416015625,
0.61474609375,
-0.505859375,
-0.9560546875,
-0.0416259765625,
-0.040802001953125,
-0.462890625,
-0.154052734375,
-0.73388671875,
0.10369873046875,
-0.174072265625,
0.49755859375,
-0.1798095703125,
-0.10052490234375,
-0.2451171875,
0.004077911376953125,
-0.07989501953125,
-0.480224609375,
0.12939453125,
0.12353515625,
0.1856689453125,
0.1292724609375,
-0.9345703125,
-0.270263671875,
0.046600341796875,
0.07989501953125,
-0.27880859375,
0.017669677734375,
-0.9833984375,
-0.340576171875,
0.322265625,
0.042816162109375,
-0.75830078125,
-0.35302734375,
-0.01910400390625,
0.06658935546875,
0.18408203125,
-0.65478515625,
0.5400390625,
0.062744140625,
0.689453125,
-0.2236328125,
0.18212890625,
-0.56787109375,
-0.43408203125,
0.0099945068359375,
-0.2177734375,
0.154541015625,
-0.325927734375,
-0.1341552734375,
0.50341796875,
-0.72802734375,
0.1876220703125,
0.69140625,
0.71044921875,
-0.434326171875,
0.446533203125,
0.3173828125,
0.287841796875,
0.5947265625,
1.01953125,
-0.78369140625,
0.96923828125,
-0.16162109375,
-0.08056640625,
0.1881103515625,
-0.251708984375,
-0.2880859375,
-0.578125,
-0.421142578125,
-0.451416015625,
0.5556640625,
0.27734375,
-0.0933837890625,
0.6943359375,
0.285400390625,
0.4677734375,
-0.7255859375,
0.50341796875,
0.11029052734375,
-0.1998291015625,
0.252197265625,
-0.29248046875,
-0.153564453125,
-0.09112548828125,
-0.42529296875,
0.6328125,
-0.408935546875,
0.05279541015625,
0.61669921875,
0.5732421875,
0.0408935546875,
0.4765625,
-0.192626953125,
0.70849609375,
-0.1656494140625,
0.6826171875,
0.79345703125,
-0.6494140625,
0.269287109375,
-0.50048828125,
0.397705078125,
1.7939453125,
0.5458984375,
-0.17333984375,
0.68115234375,
0.58251953125,
-0.89794921875,
0.77978515625,
-0.6025390625,
0.57568359375,
0.086669921875,
0.264892578125,
-0.1905517578125,
-0.07208251953125,
-0.40380859375,
0.658203125,
-0.151123046875,
0.477783203125,
-0.59912109375,
-0.08203125,
0.059906005859375,
1.0068359375,
-0.067138671875,
0.9189453125,
-0.339599609375,
-0.4189453125,
-0.1600341796875,
-0.93603515625,
0.2491455078125,
-0.193115234375,
-0.1370849609375,
0.5341796875,
0.533203125,
0.818359375,
0.85595703125,
-0.0784912109375,
0.5615234375,
0.1702880859375,
-0.251953125,
0.09918212890625,
0.1566162109375,
0.64453125,
-0.109619140625,
0.31396484375,
0.059722900390625,
-0.262939453125,
-0.50537109375,
-0.50146484375,
-0.06829833984375,
0.58251953125,
-0.298828125,
0.1346435546875,
-0.05145263671875,
0.145751953125,
-1.1083984375,
0.051116943359375,
-0.047393798828125,
-1.0654296875,
-0.235107421875,
0.6201171875,
-0.052337646484375,
0.32421875,
-0.338623046875,
-0.8740234375,
0.37060546875,
1.0400390625,
-0.455810546875,
-0.03790283203125,
0.63037109375,
0.195556640625,
-0.2176513671875,
0.2705078125,
0.1895751953125,
-0.2467041015625,
-0.7822265625,
0.75732421875,
-0.33349609375,
0.1685791015625,
-0.059906005859375,
0.82080078125,
0.1761474609375,
0.5791015625,
-0.287841796875,
0.278076171875,
0.37451171875,
1.1171875,
-0.06781005859375,
0.57177734375,
0.149658203125,
0.96826171875,
0.8076171875,
0.8447265625,
0.64453125,
0.0889892578125,
0.30322265625,
0.544921875,
0.0256195068359375,
-0.093505859375,
0.0682373046875,
0.269775390625,
0.576171875,
0.376953125,
-0.20068359375,
0.5029296875,
0.0137176513671875,
-0.1875,
-0.55029296875,
0.35888671875,
-0.30224609375,
0.91259765625,
-0.11651611328125,
0.319580078125,
-0.152099609375,
-0.2181396484375,
0.3642578125,
0.6123046875,
-0.371337890625,
-0.402587890625,
0.2578125,
0.288330078125,
0.1165771484375,
0.00821685791015625,
-0.050384521484375,
0.364990234375,
0.005146026611328125,
0.85302734375,
-0.44677734375,
-0.30224609375,
-1.0771484375,
-0.95068359375,
-0.75048828125,
-0.1019287109375,
-0.56494140625,
-0.0308837890625,
0.43359375,
-0.5849609375,
0.77587890625,
-0.6103515625,
0.07025146484375,
-0.0654296875,
-0.75244140625,
0.67138671875,
0.042877197265625,
0.68408203125,
-0.331787109375,
0.408447265625,
0.11639404296875,
0.8271484375,
-0.60595703125,
-0.28955078125,
-0.45654296875,
-0.336669921875,
0.36572265625,
-0.0753173828125,
0.54150390625,
-0.48193359375,
-0.90380859375,
-0.75927734375,
-0.16357421875,
-0.043426513671875,
-0.505859375,
0.3173828125,
-0.5185546875,
0.86767578125,
0.6162109375,
-0.85595703125,
0.41015625,
0.8017578125,
-0.96142578125,
0.439453125,
0.28662109375,
-0.00882720947265625,
-0.947265625,
1.0751953125,
0.392578125,
0.5439453125,
-0.25537109375,
-0.00902557373046875,
-0.568359375,
0.394287109375,
-0.3203125,
-0.5712890625,
-0.23193359375,
0.493896484375,
0.197021484375,
-1.0283203125,
0.5478515625,
-1.046875,
-0.63671875,
-0.4765625,
-0.49462890625,
0.75,
0.72314453125,
-0.01407623291015625,
0.154541015625,
-0.01279449462890625,
0.252685546875,
0.72900390625,
0.411865234375,
-0.42578125,
0.1619873046875,
0.40869140625,
-0.638671875,
0.505859375,
0.458251953125,
-0.135986328125,
-0.195068359375,
-0.0738525390625,
0.10821533203125,
0.12078857421875,
0.2435302734375,
0.2490234375,
0.61376953125,
0.8095703125,
-0.468017578125,
-0.23193359375,
-0.64208984375,
1.0234375,
0.417724609375,
0.4921875,
0.2344970703125,
-0.1324462890625,
-0.5517578125,
-0.79638671875,
0.123291015625,
0.6171875,
0.67822265625,
-0.53662109375,
0.69970703125,
0.050445556640625,
-0.5419921875,
-0.0161590576171875,
-0.595703125,
-0.509765625,
0.791015625,
-0.1622314453125,
0.85107421875,
-0.53662109375,
0.05511474609375,
-0.38037109375,
0.037200927734375,
0.053558349609375,
0.095947265625,
0.59619140625,
-0.3076171875,
-0.260986328125,
-0.6005859375,
-0.2479248046875,
0.0009217262268066406,
-0.56884765625,
0.2093505859375,
-0.6572265625,
-0.50048828125,
-0.5361328125,
0.31982421875,
1.0126953125,
0.54638671875,
-0.1484375,
0.33251953125,
0.1728515625,
0.241943359375,
0.321044921875,
-0.57177734375,
-0.047760009765625,
-0.5927734375,
0.7119140625,
0.280517578125,
-0.38671875,
-0.5556640625,
-0.354248046875,
-0.6923828125,
0.1610107421875,
0.2587890625,
-0.14697265625,
-0.63623046875,
0.4453125,
-0.186767578125,
0.42529296875,
-0.63623046875,
-0.291015625,
-0.433349609375,
0.56494140625,
0.662109375,
-0.04296875,
0.024932861328125,
-0.58203125,
0.62255859375,
0.58837890625,
-0.0364990234375,
-0.544921875,
-0.19287109375,
-0.66650390625,
-0.493408203125,
-0.0254974365234375,
0.6630859375,
0.372802734375,
0.06793212890625,
-1.04296875,
0.7783203125,
0.212646484375,
-0.6337890625,
-0.14794921875,
0.414794921875,
0.09375,
-0.21484375,
0.642578125,
-0.162841796875,
-0.6123046875,
0.201416015625,
-1.0654296875,
0.70068359375,
-0.1986083984375,
0.393310546875,
-0.09912109375,
-0.12646484375,
0.158203125,
0.2427978515625,
-0.68408203125,
-0.050323486328125,
-0.2205810546875,
0.63623046875,
-1.0625,
-0.53271484375,
0.60546875,
-0.2081298828125,
-0.344970703125,
0.53466796875,
-0.34912109375,
-0.30712890625,
0.291015625,
0.0091705322265625,
-0.5048828125,
-0.06768798828125,
-0.337890625,
0.476806640625,
0.07330322265625,
-0.2403564453125,
0.377685546875,
-0.5751953125,
1.17578125,
0.1595458984375,
-0.71826171875,
-0.05206298828125,
-1.052734375,
-0.260498046875,
-0.1976318359375,
-0.6328125,
-0.0045318603515625,
0.0124053955078125,
-0.2496337890625,
-0.12347412109375,
-0.2493896484375,
-0.5498046875,
-0.21484375,
-0.6669921875,
0.2447509765625,
0.52294921875,
0.367431640625,
0.26025390625,
-0.1209716796875,
-0.56103515625,
0.3388671875,
-0.361328125,
-0.045867919921875,
-0.43408203125,
-0.0911865234375,
-0.51123046875,
-0.290283203125,
-0.318359375,
0.34326171875,
-0.32666015625,
0.04620361328125,
0.89697265625,
0.49169921875,
0.347412109375,
-0.218017578125,
-0.4169921875,
0.58447265625,
0.07769775390625,
-1.0751953125,
-0.67919921875,
1.109375,
0.020538330078125,
0.5791015625,
0.53271484375,
-0.5693359375,
-1.1376953125,
-1.0087890625,
0.18212890625,
-0.44775390625,
-0.255859375,
-0.67919921875,
-0.359375,
-0.60009765625,
0.4228515625,
-0.1370849609375,
-0.35791015625,
0.328857421875,
-0.8798828125,
0.186767578125,
-0.476318359375,
0.214111328125,
-0.4501953125,
-0.82177734375,
-0.466796875,
0.8623046875,
0.31298828125,
0.29736328125,
0.00882720947265625,
-0.00960540771484375,
0.447265625,
0.28076171875,
-0.267578125,
-0.39208984375,
-0.153076171875,
0.59375,
-0.28369140625,
-0.15625,
-0.075927734375,
0.6533203125,
-0.90771484375,
0.405517578125,
0.1513671875,
-0.1590576171875,
-0.1954345703125,
-0.3203125,
1.0390625,
-0.237060546875,
-0.0003693103790283203,
-0.3564453125,
0.58544921875,
0.5458984375,
-0.283203125,
-0.051025390625,
-0.60205078125,
-0.408447265625,
-1.0634765625,
0.75146484375,
-0.0733642578125,
0.330322265625,
-0.49658203125,
-0.220458984375,
1.33203125,
-0.423828125,
0.397216796875,
1.1982421875,
0.1431884765625,
0.24853515625,
-0.68212890625,
0.52978515625,
0.326171875,
-0.387939453125,
-0.353271484375,
0.01244354248046875,
-0.74951171875,
0.48974609375,
-0.205078125,
-0.98828125,
-0.51953125,
0.51708984375,
1.228515625,
-0.25439453125,
0.556640625,
-0.2198486328125,
-1.1171875,
-0.61376953125,
0.7470703125,
-0.28466796875,
0.1982421875,
0.68994140625,
-0.0179595947265625,
-0.156494140625,
-0.0849609375,
0.01357269287109375,
-0.408447265625,
-0.411376953125,
1.0068359375,
-0.286865234375,
-0.76806640625,
1.2392578125,
0.5185546875,
-0.83447265625,
-0.98095703125,
0.10357666015625,
-0.210693359375,
-0.301025390625,
-0.89794921875,
0.2349853515625,
0.220947265625,
-0.391845703125,
-0.12066650390625,
0.394775390625,
-0.27978515625,
0.2763671875,
0.04730224609375,
0.320068359375,
-0.5263671875,
0.0572509765625,
0.3095703125,
-0.438720703125,
-0.258056640625,
-0.93701171875,
-0.244140625,
-0.64404296875,
-0.08056640625,
0.380126953125,
-0.353759765625,
0.4345703125,
0.361083984375,
0.1881103515625,
0.91748046875,
-0.2135009765625,
-0.266845703125,
0.0404052734375,
-0.40625,
-0.5859375,
-0.38427734375,
0.26513671875,
-0.430908203125,
-0.1363525390625,
-0.6337890625,
-0.2587890625,
0.34716796875,
0.317138671875,
-0.449462890625,
-1.1689453125,
-0.30859375,
-1.06640625,
-0.5849609375,
-0.401611328125,
-0.5390625,
-0.3466796875,
-0.1646728515625,
-0.034210205078125,
-0.40673828125,
0.064697265625,
0.49072265625,
-0.1749267578125,
0.70751953125,
-0.392578125,
0.4296875,
-0.8369140625,
-0.0196990966796875,
-0.578125,
0.369140625,
-0.456787109375,
-0.1331787109375,
-0.7138671875,
0.02838134765625,
0.2115478515625,
0.5439453125,
-0.377685546875,
0.362060546875,
0.103759765625,
-0.435302734375,
-0.02752685546875,
0.05499267578125,
-0.041046142578125,
0.541015625,
0.91748046875,
-0.170654296875,
0.3955078125,
-0.1746826171875,
-0.57763671875,
-0.12469482421875,
0.51025390625,
0.451171875,
-0.2049560546875,
-0.098388671875,
-0.2052001953125,
0.39501953125,
-0.93994140625,
0.2705078125,
-0.260009765625,
0.34033203125,
-0.041351318359375,
-0.2000732421875,
0.60205078125,
0.6396484375,
0.1102294921875,
0.078369140625,
-0.12432861328125,
0.1124267578125,
-0.1085205078125,
0.2308349609375,
0.11102294921875,
0.53759765625,
0.11492919921875,
-0.38525390625,
-0.1024169921875,
0.273193359375,
-0.40283203125,
0.63525390625,
-0.474609375,
-0.40478515625,
-0.74072265625,
-0.1326904296875,
-0.0243072509765625,
0.7568359375,
0.50830078125,
-0.642578125,
0.0156402587890625,
-0.2347412109375,
-0.66943359375,
0.07354736328125,
-1.3134765625,
-0.90966796875,
0.1678466796875,
-0.09747314453125,
-0.10638427734375,
-0.435791015625,
-0.6162109375,
-0.1016845703125,
-0.12060546875,
0.7880859375,
-0.77490234375,
0.458251953125,
-0.03173828125,
0.708984375,
-0.6376953125,
0.287353515625,
0.37646484375,
0.7109375,
-0.29443359375,
-0.46142578125,
-0.033843994140625,
1.3017578125,
0.0950927734375,
0.285888671875,
-0.408935546875,
0.02020263671875,
0.13623046875,
0.22119140625,
-0.34375,
-0.0433349609375,
-0.47705078125,
1.09375,
-0.88330078125,
0.1341552734375,
0.271728515625,
0.435302734375,
0.200927734375,
-0.463134765625,
-0.51611328125,
0.91455078125,
1.025390625,
0.1273193359375,
0.452392578125,
0.6025390625,
0.52294921875,
-0.3798828125,
-0.2147216796875,
-0.3115234375,
0.873046875,
0.3759765625,
0.352783203125,
-0.2359619140625,
0.54345703125,
0.78173828125,
-0.04949951171875,
-0.303955078125,
0.560546875,
0.29248046875,
-0.314208984375,
0.315185546875,
0.041229248046875,
-0.0205230712890625,
-0.2266845703125,
-0.1754150390625,
0.61181640625,
-0.33056640625,
-0.055999755859375,
-0.1693115234375,
-0.6787109375,
0.74755859375,
-0.1207275390625,
-0.4990234375,
0.779296875,
-0.478759765625,
0.39990234375,
0.3212890625,
0.096435546875,
-0.030059814453125,
0.8583984375,
0.82958984375,
0.298095703125,
0.4375,
0.6826171875,
0.314208984375,
-0.84326171875,
0.030975341796875,
0.57177734375,
0.01062774658203125,
-0.261474609375,
-0.60986328125,
-0.8056640625,
0.60791015625,
-0.3798828125,
-0.33251953125,
0.362060546875,
-0.642578125,
0.042816162109375,
-0.6494140625,
0.9443359375,
-0.673828125,
0.29052734375,
0.302734375,
0.1083984375,
-0.54931640625,
1.13671875,
-0.336181640625,
0.32861328125,
0.27587890625,
1.314453125,
0.13330078125,
1.244140625,
0.71923828125,
-0.284912109375,
-0.1619873046875,
0.435302734375,
-0.50830078125,
-0.56201171875,
-0.2337646484375,
-0.2462158203125,
-0.269287109375,
-1.0322265625,
-0.31689453125,
-0.4326171875,
1.119140625,
-0.0423583984375,
-0.923828125,
-0.1328125,
0.23046875,
-1.0234375,
0.548828125,
0.260498046875,
0.2449951171875,
0.2158203125,
0.1756591796875,
-0.225341796875,
-0.64306640625,
0.0838623046875,
-0.63525390625,
0.30810546875,
-0.6640625,
-0.387939453125,
-0.8330078125,
-0.833984375,
-0.49267578125,
0.183349609375,
-0.53125,
-0.85986328125,
0.217041015625,
0.448974609375,
0.52734375,
0.343994140625,
-0.08349609375,
-0.178466796875,
0.93505859375,
0.87939453125,
0.47705078125,
0.88232421875,
0.1474609375,
-0.0007944107055664062,
0.1015625,
-0.72900390625,
0.45703125,
-0.4423828125,
0.60546875,
0.1561279296875,
0.038238525390625,
-0.546875,
-1.4140625,
-0.1947021484375,
0.232421875,
0.40673828125,
-0.5244140625,
-1.0068359375,
-0.60546875,
-0.90576171875,
-0.28759765625,
-0.421630859375,
0.6357421875,
-0.099853515625,
0.281982421875,
-0.41552734375,
-1.3359375,
4.54296875,
1.107421875,
0.9169921875,
0.5927734375,
0.109375,
0.8369140625,
0.7197265625,
-0.58447265625,
-0.15869140625,
-0.2398681640625,
0.341552734375,
0.00025343894958496094,
0.0238800048828125,
0.84716796875,
0.474365234375,
0.57568359375,
-0.806640625,
-0.03466796875,
-0.045745849609375,
-1.0146484375,
-0.7783203125,
0.04339599609375,
-0.32763671875,
0.2900390625,
-0.24609375,
0.1309814453125,
0.76904296875,
-0.6591796875,
-0.7763671875,
-0.5009765625,
0.010955810546875,
-0.373779296875,
0.8486328125,
0.044891357421875,
-0.427001953125,
0.443359375,
-0.18310546875,
-0.62060546875,
-0.322021484375,
0.1903076171875,
-0.06646728515625,
-0.264892578125,
0.87109375,
-0.318603515625,
0.048675537109375,
0.4326171875,
-0.609375,
0.60693359375,
0.43505859375,
-0.75341796875,
0.78759765625,
-0.09466552734375,
0.440673828125,
-0.3857421875,
-0.7353515625,
-0.0204925537109375,
0.048095703125,
-0.0809326171875,
-0.4404296875,
0.61767578125,
0.33984375,
0.26123046875,
-0.09539794921875,
0.374755859375,
-0.81640625,
0.80322265625,
-0.5634765625,
0.488037109375,
-0.5322265625,
0.1611328125,
-0.1544189453125,
-0.26611328125,
-0.322509765625,
-0.1431884765625,
0.72705078125,
0.42919921875,
-0.27490234375,
0.2244873046875,
0.363037109375,
-0.6630859375,
0.17529296875,
-0.01358795166015625,
-0.371337890625,
-0.2381591796875,
0.398681640625,
1.0419921875,
-0.76953125,
-0.591796875,
-0.45654296875,
0.49560546875,
0.65966796875,
0.257080078125,
0.03204345703125,
-0.59130859375,
-0.153564453125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Tags: implementation, strings
Correct Solution:
```
name = input()
ans = 0
ptr = 1
for i in name:
pos = ord(i) - 96
ans += min(abs(ptr - pos), 26 - abs(ptr - pos))
ptr = pos
print(ans)
```
| 38,181
|
[
0.42578125,
-0.1708984375,
0.009735107421875,
0.37451171875,
-0.4443359375,
-0.568359375,
-0.04718017578125,
-0.1134033203125,
0.0291748046875,
0.52685546875,
0.75537109375,
-0.301513671875,
0.07037353515625,
-0.72509765625,
-0.66552734375,
0.0810546875,
-0.394775390625,
-0.68212890625,
-0.646484375,
-0.1514892578125,
0.1912841796875,
-0.315185546875,
-1.361328125,
-0.266357421875,
-0.748046875,
0.92236328125,
0.1661376953125,
0.2420654296875,
0.9755859375,
1.1630859375,
-0.10089111328125,
-0.28759765625,
1.08984375,
-1.201171875,
-0.1175537109375,
-0.345703125,
0.381591796875,
-0.552734375,
0.1441650390625,
-0.4873046875,
0.231201171875,
-0.2135009765625,
0.61279296875,
-0.51318359375,
-0.94775390625,
-0.034759521484375,
-0.04315185546875,
-0.448486328125,
-0.160400390625,
-0.74853515625,
0.10101318359375,
-0.1748046875,
0.5107421875,
-0.1837158203125,
-0.10406494140625,
-0.2646484375,
0.0244598388671875,
-0.06707763671875,
-0.4716796875,
0.14892578125,
0.1392822265625,
0.2012939453125,
0.1473388671875,
-0.95458984375,
-0.265869140625,
0.06689453125,
0.060760498046875,
-0.27392578125,
-0.004230499267578125,
-0.96923828125,
-0.347412109375,
0.3271484375,
0.0609130859375,
-0.75830078125,
-0.349609375,
-0.0345458984375,
0.0809326171875,
0.165771484375,
-0.64013671875,
0.55224609375,
0.056243896484375,
0.67724609375,
-0.230712890625,
0.18017578125,
-0.560546875,
-0.431396484375,
0.00428009033203125,
-0.2203369140625,
0.1456298828125,
-0.309814453125,
-0.14013671875,
0.5107421875,
-0.7109375,
0.1844482421875,
0.69189453125,
0.70849609375,
-0.427978515625,
0.461669921875,
0.298583984375,
0.29296875,
0.587890625,
1.0439453125,
-0.79541015625,
0.9541015625,
-0.1536865234375,
-0.07476806640625,
0.1949462890625,
-0.256103515625,
-0.29296875,
-0.58837890625,
-0.416259765625,
-0.44140625,
0.54296875,
0.282470703125,
-0.10028076171875,
0.701171875,
0.283935546875,
0.4599609375,
-0.72021484375,
0.5087890625,
0.11572265625,
-0.212646484375,
0.250244140625,
-0.308349609375,
-0.1356201171875,
-0.115234375,
-0.42578125,
0.63623046875,
-0.396240234375,
0.04449462890625,
0.6328125,
0.5498046875,
0.0360107421875,
0.476318359375,
-0.17431640625,
0.71875,
-0.1768798828125,
0.68359375,
0.79248046875,
-0.65966796875,
0.2529296875,
-0.5,
0.418701171875,
1.8154296875,
0.53173828125,
-0.144775390625,
0.66845703125,
0.57177734375,
-0.87646484375,
0.791015625,
-0.59716796875,
0.58984375,
0.0760498046875,
0.27392578125,
-0.179443359375,
-0.0697021484375,
-0.40283203125,
0.66015625,
-0.1533203125,
0.472412109375,
-0.58251953125,
-0.0936279296875,
0.062744140625,
1.00390625,
-0.07415771484375,
0.91552734375,
-0.34521484375,
-0.4111328125,
-0.1798095703125,
-0.92431640625,
0.2371826171875,
-0.1695556640625,
-0.1290283203125,
0.525390625,
0.5205078125,
0.8251953125,
0.8505859375,
-0.0684814453125,
0.55322265625,
0.1654052734375,
-0.247802734375,
0.09539794921875,
0.142578125,
0.66455078125,
-0.10321044921875,
0.302734375,
0.05816650390625,
-0.254638671875,
-0.51708984375,
-0.51220703125,
-0.058319091796875,
0.59326171875,
-0.2802734375,
0.13623046875,
-0.05810546875,
0.11669921875,
-1.0947265625,
0.058258056640625,
-0.034393310546875,
-1.0615234375,
-0.2330322265625,
0.62060546875,
-0.05645751953125,
0.34228515625,
-0.360107421875,
-0.86474609375,
0.361083984375,
1.017578125,
-0.490966796875,
-0.06683349609375,
0.63720703125,
0.212646484375,
-0.2100830078125,
0.27001953125,
0.186767578125,
-0.2432861328125,
-0.7822265625,
0.74853515625,
-0.348876953125,
0.1461181640625,
-0.04986572265625,
0.82177734375,
0.18603515625,
0.56640625,
-0.296142578125,
0.28662109375,
0.378662109375,
1.1103515625,
-0.060791015625,
0.58251953125,
0.1566162109375,
0.96875,
0.7841796875,
0.86474609375,
0.6787109375,
0.07122802734375,
0.312255859375,
0.556640625,
0.03460693359375,
-0.08880615234375,
0.09552001953125,
0.263916015625,
0.5849609375,
0.38671875,
-0.2071533203125,
0.483154296875,
0.03973388671875,
-0.173583984375,
-0.55029296875,
0.36181640625,
-0.30859375,
0.91015625,
-0.1263427734375,
0.317138671875,
-0.158203125,
-0.214111328125,
0.35791015625,
0.63671875,
-0.360107421875,
-0.410888671875,
0.2607421875,
0.297607421875,
0.135009765625,
0.00586700439453125,
-0.03399658203125,
0.359375,
-0.002643585205078125,
0.86181640625,
-0.438232421875,
-0.30322265625,
-1.072265625,
-0.95556640625,
-0.744140625,
-0.1156005859375,
-0.5771484375,
-0.052459716796875,
0.4404296875,
-0.58837890625,
0.7734375,
-0.60498046875,
0.06658935546875,
-0.0819091796875,
-0.7392578125,
0.6904296875,
0.03521728515625,
0.67724609375,
-0.333251953125,
0.408203125,
0.0941162109375,
0.83935546875,
-0.60546875,
-0.2900390625,
-0.456787109375,
-0.36962890625,
0.35498046875,
-0.0823974609375,
0.52734375,
-0.4697265625,
-0.89599609375,
-0.7587890625,
-0.18603515625,
-0.0404052734375,
-0.484130859375,
0.306640625,
-0.525390625,
0.8818359375,
0.60888671875,
-0.86181640625,
0.3994140625,
0.7939453125,
-0.96630859375,
0.4580078125,
0.28857421875,
-0.023101806640625,
-0.96533203125,
1.0927734375,
0.387939453125,
0.56103515625,
-0.255615234375,
-0.007137298583984375,
-0.5673828125,
0.373779296875,
-0.330810546875,
-0.57861328125,
-0.2261962890625,
0.50244140625,
0.198974609375,
-1.0419921875,
0.5419921875,
-1.0390625,
-0.63671875,
-0.472412109375,
-0.480224609375,
0.77099609375,
0.7109375,
-0.00978851318359375,
0.152099609375,
-0.00897979736328125,
0.258056640625,
0.73046875,
0.41943359375,
-0.44384765625,
0.1712646484375,
0.416259765625,
-0.6103515625,
0.509765625,
0.473876953125,
-0.1588134765625,
-0.1876220703125,
-0.08428955078125,
0.1275634765625,
0.12109375,
0.2459716796875,
0.24365234375,
0.62451171875,
0.7939453125,
-0.4814453125,
-0.2471923828125,
-0.646484375,
1.0263671875,
0.422119140625,
0.49072265625,
0.239990234375,
-0.1448974609375,
-0.546875,
-0.791015625,
0.10577392578125,
0.6357421875,
0.70166015625,
-0.580078125,
0.71240234375,
0.048980712890625,
-0.5361328125,
-0.01274871826171875,
-0.59228515625,
-0.5166015625,
0.794921875,
-0.156982421875,
0.85986328125,
-0.52685546875,
0.04962158203125,
-0.359130859375,
0.0299072265625,
0.056060791015625,
0.10369873046875,
0.60546875,
-0.307861328125,
-0.248779296875,
-0.60595703125,
-0.2529296875,
-0.000091552734375,
-0.57275390625,
0.2061767578125,
-0.6533203125,
-0.5009765625,
-0.54052734375,
0.32470703125,
1.0068359375,
0.56201171875,
-0.162109375,
0.343505859375,
0.169921875,
0.26171875,
0.321533203125,
-0.5576171875,
-0.04254150390625,
-0.60107421875,
0.712890625,
0.27978515625,
-0.37060546875,
-0.55322265625,
-0.343017578125,
-0.70458984375,
0.1610107421875,
0.26611328125,
-0.15771484375,
-0.6416015625,
0.439697265625,
-0.188720703125,
0.435302734375,
-0.60498046875,
-0.29345703125,
-0.455078125,
0.57568359375,
0.6826171875,
-0.031982421875,
0.016204833984375,
-0.57421875,
0.630859375,
0.6025390625,
-0.050140380859375,
-0.5615234375,
-0.179931640625,
-0.66162109375,
-0.490234375,
-0.0171661376953125,
0.650390625,
0.375,
0.077392578125,
-1.0302734375,
0.76513671875,
0.223876953125,
-0.64208984375,
-0.1312255859375,
0.41357421875,
0.09637451171875,
-0.2252197265625,
0.6455078125,
-0.1480712890625,
-0.6044921875,
0.2078857421875,
-1.0576171875,
0.69287109375,
-0.20654296875,
0.40966796875,
-0.0977783203125,
-0.12127685546875,
0.1431884765625,
0.2568359375,
-0.685546875,
-0.034881591796875,
-0.2237548828125,
0.62548828125,
-1.0634765625,
-0.55029296875,
0.6337890625,
-0.2210693359375,
-0.349609375,
0.5556640625,
-0.347412109375,
-0.310302734375,
0.302978515625,
0.00989532470703125,
-0.51611328125,
-0.0748291015625,
-0.337890625,
0.4853515625,
0.056243896484375,
-0.2301025390625,
0.39404296875,
-0.568359375,
1.1630859375,
0.167236328125,
-0.7177734375,
-0.0728759765625,
-1.0576171875,
-0.25927734375,
-0.19921875,
-0.63623046875,
-0.02032470703125,
0.00429534912109375,
-0.263916015625,
-0.118408203125,
-0.26611328125,
-0.537109375,
-0.213134765625,
-0.68310546875,
0.26806640625,
0.5400390625,
0.3701171875,
0.258056640625,
-0.11785888671875,
-0.58251953125,
0.3486328125,
-0.35400390625,
-0.04461669921875,
-0.421142578125,
-0.0850830078125,
-0.487548828125,
-0.3046875,
-0.3076171875,
0.32861328125,
-0.3330078125,
0.048675537109375,
0.8916015625,
0.48974609375,
0.348388671875,
-0.1937255859375,
-0.39501953125,
0.58154296875,
0.076904296875,
-1.078125,
-0.6689453125,
1.1103515625,
0.044891357421875,
0.60009765625,
0.5283203125,
-0.57958984375,
-1.1455078125,
-0.9931640625,
0.185546875,
-0.444091796875,
-0.249755859375,
-0.697265625,
-0.36767578125,
-0.59423828125,
0.41748046875,
-0.135986328125,
-0.370849609375,
0.337158203125,
-0.87890625,
0.17724609375,
-0.489990234375,
0.223388671875,
-0.4697265625,
-0.80712890625,
-0.449951171875,
0.86328125,
0.29443359375,
0.28271484375,
0.003276824951171875,
-0.0017957687377929688,
0.4560546875,
0.30322265625,
-0.27392578125,
-0.367919921875,
-0.142822265625,
0.59716796875,
-0.283203125,
-0.1785888671875,
-0.0777587890625,
0.64599609375,
-0.93798828125,
0.398681640625,
0.1422119140625,
-0.1737060546875,
-0.201416015625,
-0.316162109375,
1.033203125,
-0.23876953125,
-0.00933074951171875,
-0.3662109375,
0.587890625,
0.533203125,
-0.281494140625,
-0.07073974609375,
-0.58984375,
-0.4033203125,
-1.0283203125,
0.7392578125,
-0.07647705078125,
0.33056640625,
-0.50048828125,
-0.2216796875,
1.3154296875,
-0.426025390625,
0.39501953125,
1.19140625,
0.130126953125,
0.262939453125,
-0.6845703125,
0.53173828125,
0.313232421875,
-0.37353515625,
-0.343994140625,
0.0178375244140625,
-0.76611328125,
0.48974609375,
-0.215576171875,
-0.99462890625,
-0.52197265625,
0.5205078125,
1.2236328125,
-0.2366943359375,
0.55859375,
-0.22119140625,
-1.125,
-0.62744140625,
0.75439453125,
-0.297607421875,
0.1910400390625,
0.69921875,
-0.0181427001953125,
-0.154296875,
-0.0836181640625,
0.01448822021484375,
-0.397705078125,
-0.411865234375,
1.01171875,
-0.279052734375,
-0.767578125,
1.2314453125,
0.52880859375,
-0.8583984375,
-0.98779296875,
0.09906005859375,
-0.1849365234375,
-0.31689453125,
-0.9189453125,
0.2396240234375,
0.232177734375,
-0.390625,
-0.143310546875,
0.3896484375,
-0.29150390625,
0.275634765625,
0.043121337890625,
0.31982421875,
-0.544921875,
0.054779052734375,
0.31640625,
-0.434326171875,
-0.251708984375,
-0.91796875,
-0.2471923828125,
-0.65185546875,
-0.0745849609375,
0.36669921875,
-0.357177734375,
0.438720703125,
0.379150390625,
0.2139892578125,
0.92724609375,
-0.1939697265625,
-0.2462158203125,
0.04412841796875,
-0.403564453125,
-0.6044921875,
-0.391357421875,
0.276123046875,
-0.419677734375,
-0.1348876953125,
-0.64208984375,
-0.26513671875,
0.35546875,
0.33056640625,
-0.46923828125,
-1.1796875,
-0.3037109375,
-1.087890625,
-0.6005859375,
-0.408447265625,
-0.5732421875,
-0.348388671875,
-0.1800537109375,
-0.027374267578125,
-0.39697265625,
0.0595703125,
0.4833984375,
-0.1873779296875,
0.701171875,
-0.377685546875,
0.43310546875,
-0.83740234375,
-0.0306243896484375,
-0.576171875,
0.3564453125,
-0.4423828125,
-0.12841796875,
-0.72607421875,
0.03497314453125,
0.17529296875,
0.53369140625,
-0.363525390625,
0.34814453125,
0.09991455078125,
-0.454833984375,
-0.04595947265625,
0.07452392578125,
-0.04986572265625,
0.54150390625,
0.92431640625,
-0.1661376953125,
0.4072265625,
-0.1497802734375,
-0.56298828125,
-0.13525390625,
0.50048828125,
0.43994140625,
-0.2244873046875,
-0.11639404296875,
-0.202392578125,
0.398681640625,
-0.96630859375,
0.27783203125,
-0.273193359375,
0.333251953125,
-0.050750732421875,
-0.20654296875,
0.60205078125,
0.66064453125,
0.138427734375,
0.08306884765625,
-0.11163330078125,
0.12225341796875,
-0.103271484375,
0.200439453125,
0.1236572265625,
0.55078125,
0.1077880859375,
-0.393798828125,
-0.08135986328125,
0.27685546875,
-0.400146484375,
0.63916015625,
-0.475341796875,
-0.396240234375,
-0.7265625,
-0.1534423828125,
-0.0222930908203125,
0.75048828125,
0.50634765625,
-0.6416015625,
0.017913818359375,
-0.259521484375,
-0.666015625,
0.08209228515625,
-1.3251953125,
-0.919921875,
0.188720703125,
-0.1131591796875,
-0.0821533203125,
-0.43505859375,
-0.61181640625,
-0.09747314453125,
-0.1148681640625,
0.79150390625,
-0.7724609375,
0.469970703125,
-0.037445068359375,
0.71533203125,
-0.62890625,
0.285888671875,
0.37841796875,
0.70849609375,
-0.30810546875,
-0.479736328125,
-0.04559326171875,
1.2919921875,
0.1025390625,
0.2841796875,
-0.3974609375,
0.00750732421875,
0.1461181640625,
0.23876953125,
-0.345947265625,
-0.0504150390625,
-0.448974609375,
1.1064453125,
-0.8642578125,
0.156982421875,
0.2509765625,
0.435302734375,
0.2188720703125,
-0.457275390625,
-0.52294921875,
0.923828125,
1.0263671875,
0.1329345703125,
0.457275390625,
0.58349609375,
0.515625,
-0.385498046875,
-0.22802734375,
-0.304931640625,
0.884765625,
0.36572265625,
0.369140625,
-0.234375,
0.541015625,
0.78369140625,
-0.056671142578125,
-0.297607421875,
0.5712890625,
0.3056640625,
-0.318603515625,
0.32568359375,
0.048431396484375,
-0.0277252197265625,
-0.22412109375,
-0.1439208984375,
0.61376953125,
-0.33837890625,
-0.06756591796875,
-0.183837890625,
-0.67724609375,
0.7470703125,
-0.1116943359375,
-0.490234375,
0.78466796875,
-0.47998046875,
0.39013671875,
0.32568359375,
0.1026611328125,
-0.041229248046875,
0.8466796875,
0.82421875,
0.287841796875,
0.45849609375,
0.6953125,
0.31396484375,
-0.84912109375,
0.02862548828125,
0.56005859375,
0.0021648406982421875,
-0.28759765625,
-0.6201171875,
-0.78564453125,
0.5927734375,
-0.38037109375,
-0.335205078125,
0.364990234375,
-0.6650390625,
0.03955078125,
-0.6337890625,
0.9453125,
-0.685546875,
0.298095703125,
0.30712890625,
0.10845947265625,
-0.552734375,
1.13671875,
-0.3408203125,
0.3310546875,
0.28466796875,
1.31640625,
0.164306640625,
1.232421875,
0.72021484375,
-0.29345703125,
-0.1580810546875,
0.440185546875,
-0.50048828125,
-0.54638671875,
-0.237548828125,
-0.25927734375,
-0.2626953125,
-1.04296875,
-0.31396484375,
-0.434326171875,
1.1298828125,
-0.05908203125,
-0.92822265625,
-0.15478515625,
0.2427978515625,
-1.029296875,
0.5498046875,
0.251220703125,
0.250244140625,
0.2335205078125,
0.162353515625,
-0.2161865234375,
-0.6552734375,
0.0921630859375,
-0.64306640625,
0.32421875,
-0.638671875,
-0.3857421875,
-0.8359375,
-0.8427734375,
-0.487060546875,
0.1783447265625,
-0.53125,
-0.849609375,
0.220947265625,
0.446533203125,
0.49658203125,
0.325927734375,
-0.08123779296875,
-0.1876220703125,
0.92333984375,
0.88134765625,
0.47509765625,
0.90087890625,
0.1600341796875,
0.0127716064453125,
0.0908203125,
-0.7353515625,
0.476806640625,
-0.463134765625,
0.61376953125,
0.1639404296875,
0.04486083984375,
-0.52685546875,
-1.41796875,
-0.2095947265625,
0.2335205078125,
0.405029296875,
-0.53662109375,
-1.0078125,
-0.609375,
-0.90234375,
-0.309814453125,
-0.4365234375,
0.630859375,
-0.09490966796875,
0.27734375,
-0.41650390625,
-1.34375,
4.53515625,
1.095703125,
0.92041015625,
0.5986328125,
0.09710693359375,
0.85791015625,
0.70654296875,
-0.54931640625,
-0.1566162109375,
-0.249267578125,
0.349365234375,
-0.0015869140625,
0.01146697998046875,
0.83447265625,
0.471435546875,
0.599609375,
-0.822265625,
-0.053253173828125,
-0.051025390625,
-1.029296875,
-0.76513671875,
0.024139404296875,
-0.311279296875,
0.287353515625,
-0.25634765625,
0.1204833984375,
0.74658203125,
-0.66943359375,
-0.77294921875,
-0.482666015625,
0.015350341796875,
-0.389892578125,
0.86083984375,
0.048980712890625,
-0.42724609375,
0.44384765625,
-0.1859130859375,
-0.60888671875,
-0.306884765625,
0.1861572265625,
-0.0828857421875,
-0.27685546875,
0.87646484375,
-0.3154296875,
0.0499267578125,
0.44140625,
-0.6123046875,
0.5947265625,
0.417724609375,
-0.75732421875,
0.8095703125,
-0.09124755859375,
0.441162109375,
-0.38427734375,
-0.73583984375,
0.008026123046875,
0.0301971435546875,
-0.10400390625,
-0.43310546875,
0.63427734375,
0.331787109375,
0.24560546875,
-0.11029052734375,
0.35791015625,
-0.81298828125,
0.8056640625,
-0.55322265625,
0.4697265625,
-0.52734375,
0.1485595703125,
-0.14599609375,
-0.28564453125,
-0.3154296875,
-0.15087890625,
0.72509765625,
0.429443359375,
-0.2900390625,
0.2359619140625,
0.350830078125,
-0.67822265625,
0.186279296875,
-0.01245880126953125,
-0.37158203125,
-0.239013671875,
0.39453125,
1.0400390625,
-0.77783203125,
-0.595703125,
-0.461181640625,
0.5078125,
0.66455078125,
0.26513671875,
0.0423583984375,
-0.58544921875,
-0.1639404296875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Tags: implementation, strings
Correct Solution:
```
# https://codeforces.com/contest/731/problem/A
# zeus
inp = input()
start = 'a'
my_dict = {'a':1}
for i in range(2,27):
start = chr(ord(start) + 1)
my_dict[start] = i
#print(my_dict)
rotation = 0
counter = 'a'
for i in inp:
distance1 = my_dict[counter] - my_dict[i]
distance2 = my_dict[i] - my_dict[counter]
#print('\t i:{}'.format(i))
#print(' d1:{};d2:{};min_steps:{}'
#.format(distance1,distance2,min(distance1, distance2)), end='')
if distance1 < 0:
distance1 += 26
if distance2 < 0:
distance2 += 26
rotation += min(distance1, distance2)
#print(' d1:{};d2:{};min_steps:{}'
#.format(distance1,distance2,min(distance1, distance2)))
counter = i
print(rotation)
```
| 38,182
|
[
0.4384765625,
-0.1900634765625,
-0.04119873046875,
0.390380859375,
-0.4404296875,
-0.57421875,
-0.051971435546875,
-0.10400390625,
0.01995849609375,
0.4931640625,
0.7080078125,
-0.279541015625,
0.1060791015625,
-0.74169921875,
-0.6904296875,
0.03045654296875,
-0.431396484375,
-0.64453125,
-0.654296875,
-0.161376953125,
0.197265625,
-0.316650390625,
-1.33203125,
-0.298583984375,
-0.734375,
0.9736328125,
0.1201171875,
0.2509765625,
1.0341796875,
1.12109375,
-0.1510009765625,
-0.292724609375,
1.123046875,
-1.21875,
-0.1339111328125,
-0.38037109375,
0.35107421875,
-0.490966796875,
0.122314453125,
-0.50390625,
0.224609375,
-0.214599609375,
0.60302734375,
-0.49951171875,
-1.015625,
-0.037567138671875,
-0.07904052734375,
-0.50537109375,
-0.1888427734375,
-0.73779296875,
0.071044921875,
-0.158203125,
0.5126953125,
-0.140869140625,
-0.12005615234375,
-0.26611328125,
0.007320404052734375,
-0.03948974609375,
-0.488525390625,
0.07318115234375,
0.12548828125,
0.185302734375,
0.07574462890625,
-0.91748046875,
-0.280517578125,
0.058746337890625,
0.07525634765625,
-0.2442626953125,
0.039520263671875,
-0.9423828125,
-0.312255859375,
0.3193359375,
0.01451873779296875,
-0.8095703125,
-0.353271484375,
-0.038726806640625,
0.056182861328125,
0.2061767578125,
-0.65380859375,
0.51611328125,
0.0660400390625,
0.70263671875,
-0.2587890625,
0.09710693359375,
-0.60009765625,
-0.373046875,
0.008331298828125,
-0.197998046875,
0.165771484375,
-0.29541015625,
-0.140380859375,
0.51953125,
-0.7294921875,
0.2607421875,
0.74951171875,
0.74658203125,
-0.42529296875,
0.474609375,
0.262451171875,
0.35791015625,
0.61962890625,
1.048828125,
-0.7978515625,
0.94580078125,
-0.1766357421875,
-0.13671875,
0.1802978515625,
-0.254150390625,
-0.27978515625,
-0.54345703125,
-0.412353515625,
-0.45751953125,
0.53076171875,
0.275634765625,
-0.05535888671875,
0.66015625,
0.234130859375,
0.418212890625,
-0.73681640625,
0.49462890625,
0.0865478515625,
-0.18798828125,
0.2371826171875,
-0.2890625,
-0.1131591796875,
-0.05975341796875,
-0.443359375,
0.60595703125,
-0.385009765625,
0.029296875,
0.61572265625,
0.6044921875,
0.07086181640625,
0.51513671875,
-0.207275390625,
0.69677734375,
-0.13671875,
0.66845703125,
0.76904296875,
-0.6728515625,
0.2415771484375,
-0.5537109375,
0.402099609375,
1.7958984375,
0.525390625,
-0.209228515625,
0.6640625,
0.56005859375,
-0.94189453125,
0.79931640625,
-0.54345703125,
0.5654296875,
0.09912109375,
0.2880859375,
-0.1866455078125,
-0.0704345703125,
-0.37841796875,
0.6748046875,
-0.1048583984375,
0.499267578125,
-0.6103515625,
-0.07379150390625,
0.07928466796875,
0.9931640625,
-0.0926513671875,
0.927734375,
-0.34033203125,
-0.425048828125,
-0.1661376953125,
-0.9892578125,
0.2496337890625,
-0.2022705078125,
-0.1572265625,
0.5078125,
0.5283203125,
0.7880859375,
0.82080078125,
-0.0892333984375,
0.55810546875,
0.1259765625,
-0.251708984375,
0.10626220703125,
0.1497802734375,
0.673828125,
-0.1427001953125,
0.351806640625,
0.0650634765625,
-0.259765625,
-0.50537109375,
-0.4794921875,
-0.0645751953125,
0.5400390625,
-0.278564453125,
0.1268310546875,
-0.059112548828125,
0.112060546875,
-1.1142578125,
0.055145263671875,
-0.0243682861328125,
-1.08203125,
-0.215087890625,
0.6337890625,
-0.039337158203125,
0.28271484375,
-0.339599609375,
-0.90478515625,
0.337646484375,
1.0673828125,
-0.49658203125,
-0.0689697265625,
0.625,
0.1943359375,
-0.2303466796875,
0.260498046875,
0.197265625,
-0.27978515625,
-0.765625,
0.77001953125,
-0.35888671875,
0.2161865234375,
-0.058197021484375,
0.861328125,
0.22119140625,
0.6044921875,
-0.28173828125,
0.291259765625,
0.41650390625,
1.1171875,
-0.0283050537109375,
0.541015625,
0.1341552734375,
0.923828125,
0.8251953125,
0.82421875,
0.63427734375,
0.0830078125,
0.309814453125,
0.5703125,
-0.0005278587341308594,
-0.06414794921875,
0.0673828125,
0.2724609375,
0.56640625,
0.361572265625,
-0.1839599609375,
0.486083984375,
0.022796630859375,
-0.14990234375,
-0.53369140625,
0.384033203125,
-0.3232421875,
0.92138671875,
-0.050262451171875,
0.330810546875,
-0.152587890625,
-0.231689453125,
0.3681640625,
0.58740234375,
-0.3740234375,
-0.415771484375,
0.299072265625,
0.278564453125,
0.0906982421875,
-0.0281219482421875,
-0.0095367431640625,
0.387451171875,
0.029571533203125,
0.88818359375,
-0.478515625,
-0.3115234375,
-1.044921875,
-0.95947265625,
-0.70166015625,
-0.105712890625,
-0.572265625,
-0.0169677734375,
0.410888671875,
-0.583984375,
0.8330078125,
-0.64501953125,
0.042938232421875,
-0.06671142578125,
-0.73291015625,
0.60888671875,
0.064453125,
0.7421875,
-0.32568359375,
0.4150390625,
0.135498046875,
0.83056640625,
-0.6259765625,
-0.29638671875,
-0.431640625,
-0.306884765625,
0.390380859375,
-0.09765625,
0.55712890625,
-0.439453125,
-0.94677734375,
-0.74560546875,
-0.1356201171875,
-0.0810546875,
-0.466796875,
0.3408203125,
-0.55908203125,
0.859375,
0.60546875,
-0.84228515625,
0.390625,
0.80322265625,
-1.015625,
0.431884765625,
0.279296875,
-0.0029354095458984375,
-0.95263671875,
1.099609375,
0.404296875,
0.5029296875,
-0.275390625,
0.00262451171875,
-0.55078125,
0.415771484375,
-0.318603515625,
-0.5576171875,
-0.245361328125,
0.521484375,
0.169921875,
-1.0556640625,
0.51611328125,
-1.044921875,
-0.6396484375,
-0.45751953125,
-0.50341796875,
0.74560546875,
0.7431640625,
-0.00380706787109375,
0.1796875,
-0.004680633544921875,
0.2283935546875,
0.7080078125,
0.37890625,
-0.440185546875,
0.1304931640625,
0.388427734375,
-0.66796875,
0.46728515625,
0.483642578125,
-0.1123046875,
-0.21484375,
-0.0760498046875,
0.10272216796875,
0.12548828125,
0.244140625,
0.2103271484375,
0.56689453125,
0.8486328125,
-0.47900390625,
-0.271728515625,
-0.60693359375,
0.994140625,
0.454833984375,
0.54345703125,
0.23486328125,
-0.130126953125,
-0.54541015625,
-0.798828125,
0.12420654296875,
0.65673828125,
0.65576171875,
-0.4970703125,
0.67041015625,
0.08416748046875,
-0.5966796875,
-0.00511932373046875,
-0.65185546875,
-0.52587890625,
0.76123046875,
-0.1673583984375,
0.84326171875,
-0.541015625,
0.06451416015625,
-0.362060546875,
-0.00299072265625,
0.056060791015625,
0.1357421875,
0.578125,
-0.342041015625,
-0.283935546875,
-0.6201171875,
-0.225830078125,
0.053131103515625,
-0.53369140625,
0.1875,
-0.666015625,
-0.52001953125,
-0.54052734375,
0.309326171875,
0.982421875,
0.5185546875,
-0.16259765625,
0.3515625,
0.2191162109375,
0.22900390625,
0.3486328125,
-0.53515625,
-0.05078125,
-0.62353515625,
0.73046875,
0.282958984375,
-0.421142578125,
-0.52978515625,
-0.389404296875,
-0.693359375,
0.1522216796875,
0.1871337890625,
-0.2008056640625,
-0.66748046875,
0.462646484375,
-0.1580810546875,
0.505859375,
-0.666015625,
-0.275634765625,
-0.453125,
0.53662109375,
0.65625,
-0.06536865234375,
0.0235443115234375,
-0.5693359375,
0.642578125,
0.59423828125,
-0.0316162109375,
-0.4951171875,
-0.1717529296875,
-0.69580078125,
-0.475830078125,
0.0012836456298828125,
0.7041015625,
0.352783203125,
0.063232421875,
-1.044921875,
0.81787109375,
0.2435302734375,
-0.60888671875,
-0.1412353515625,
0.377685546875,
0.113525390625,
-0.250244140625,
0.65185546875,
-0.1363525390625,
-0.611328125,
0.1915283203125,
-1.0810546875,
0.66748046875,
-0.184814453125,
0.41259765625,
-0.132568359375,
-0.1309814453125,
0.1435546875,
0.2320556640625,
-0.634765625,
-0.0218048095703125,
-0.1424560546875,
0.6201171875,
-1.025390625,
-0.53076171875,
0.591796875,
-0.2178955078125,
-0.348876953125,
0.52734375,
-0.30615234375,
-0.274658203125,
0.28662109375,
-0.007526397705078125,
-0.50537109375,
-0.0845947265625,
-0.307373046875,
0.50537109375,
0.10577392578125,
-0.25048828125,
0.312255859375,
-0.57763671875,
1.173828125,
0.1925048828125,
-0.75439453125,
-0.057281494140625,
-1.029296875,
-0.3017578125,
-0.212890625,
-0.6337890625,
-0.006748199462890625,
-0.0229949951171875,
-0.2381591796875,
-0.08197021484375,
-0.280517578125,
-0.58935546875,
-0.2332763671875,
-0.6611328125,
0.2156982421875,
0.57080078125,
0.39013671875,
0.28662109375,
-0.10711669921875,
-0.5419921875,
0.345947265625,
-0.362548828125,
-0.043975830078125,
-0.440673828125,
-0.02813720703125,
-0.52783203125,
-0.292724609375,
-0.265380859375,
0.34423828125,
-0.321533203125,
0.052276611328125,
0.87744140625,
0.498046875,
0.362060546875,
-0.2113037109375,
-0.455078125,
0.5537109375,
0.06768798828125,
-1.0986328125,
-0.68896484375,
1.1416015625,
0.036651611328125,
0.625,
0.55224609375,
-0.57568359375,
-1.12890625,
-1.02734375,
0.2274169921875,
-0.45703125,
-0.2476806640625,
-0.65576171875,
-0.341552734375,
-0.6162109375,
0.4482421875,
-0.17333984375,
-0.307861328125,
0.252197265625,
-0.81982421875,
0.2193603515625,
-0.4794921875,
0.218017578125,
-0.433837890625,
-0.859375,
-0.46435546875,
0.8603515625,
0.324462890625,
0.288818359375,
0.0259857177734375,
-0.0127105712890625,
0.4267578125,
0.2802734375,
-0.28125,
-0.39453125,
-0.2095947265625,
0.58154296875,
-0.2578125,
-0.204833984375,
-0.07196044921875,
0.67138671875,
-0.88232421875,
0.427490234375,
0.1279296875,
-0.1962890625,
-0.226806640625,
-0.29345703125,
0.97314453125,
-0.229736328125,
0.0340576171875,
-0.344970703125,
0.55322265625,
0.53857421875,
-0.25732421875,
-0.0214996337890625,
-0.62451171875,
-0.385498046875,
-1.0185546875,
0.72119140625,
-0.07769775390625,
0.35009765625,
-0.51611328125,
-0.208740234375,
1.3154296875,
-0.393310546875,
0.422119140625,
1.1865234375,
0.14990234375,
0.216552734375,
-0.65673828125,
0.51904296875,
0.326904296875,
-0.32666015625,
-0.305908203125,
0.040313720703125,
-0.70703125,
0.47900390625,
-0.2174072265625,
-0.978515625,
-0.5322265625,
0.489501953125,
1.232421875,
-0.27587890625,
0.55126953125,
-0.213134765625,
-1.095703125,
-0.58642578125,
0.76220703125,
-0.294921875,
0.182861328125,
0.69873046875,
-0.0082855224609375,
-0.17724609375,
-0.0230712890625,
-0.0032482147216796875,
-0.3984375,
-0.411376953125,
0.97021484375,
-0.275634765625,
-0.7900390625,
1.2509765625,
0.483154296875,
-0.82666015625,
-0.9619140625,
0.1390380859375,
-0.14501953125,
-0.28759765625,
-0.873046875,
0.1961669921875,
0.2215576171875,
-0.352294921875,
-0.1689453125,
0.353515625,
-0.223388671875,
0.28369140625,
0.0643310546875,
0.330810546875,
-0.5068359375,
0.019866943359375,
0.31982421875,
-0.44140625,
-0.26220703125,
-0.91259765625,
-0.226318359375,
-0.66748046875,
-0.11029052734375,
0.38232421875,
-0.362548828125,
0.46875,
0.36572265625,
0.18310546875,
0.91552734375,
-0.21044921875,
-0.26416015625,
0.11102294921875,
-0.382568359375,
-0.57568359375,
-0.398193359375,
0.2291259765625,
-0.426025390625,
-0.154541015625,
-0.6328125,
-0.27734375,
0.326416015625,
0.344482421875,
-0.45361328125,
-1.14453125,
-0.300048828125,
-1.0771484375,
-0.568359375,
-0.40283203125,
-0.51123046875,
-0.3603515625,
-0.1878662109375,
-0.041839599609375,
-0.44091796875,
0.10211181640625,
0.493896484375,
-0.1522216796875,
0.6796875,
-0.3984375,
0.429931640625,
-0.82470703125,
0.0227203369140625,
-0.56298828125,
0.345947265625,
-0.46533203125,
-0.1802978515625,
-0.74169921875,
0.0226898193359375,
0.265869140625,
0.5107421875,
-0.401123046875,
0.3857421875,
0.13916015625,
-0.394287109375,
-0.02764892578125,
0.06353759765625,
-0.055572509765625,
0.5263671875,
0.93212890625,
-0.1510009765625,
0.369140625,
-0.1781005859375,
-0.5703125,
-0.07452392578125,
0.5009765625,
0.484130859375,
-0.21630859375,
-0.09228515625,
-0.26416015625,
0.437255859375,
-0.9482421875,
0.28076171875,
-0.25634765625,
0.27783203125,
-0.04632568359375,
-0.1849365234375,
0.61767578125,
0.68212890625,
0.139892578125,
0.07171630859375,
-0.110107421875,
0.1468505859375,
-0.090576171875,
0.218017578125,
0.166748046875,
0.52880859375,
0.1082763671875,
-0.39208984375,
-0.085205078125,
0.268310546875,
-0.380126953125,
0.67626953125,
-0.451904296875,
-0.385009765625,
-0.74853515625,
-0.1419677734375,
0.0211944580078125,
0.78369140625,
0.51025390625,
-0.61474609375,
0.0161895751953125,
-0.2054443359375,
-0.66455078125,
0.08868408203125,
-1.3330078125,
-0.88720703125,
0.2003173828125,
-0.1126708984375,
-0.120361328125,
-0.47509765625,
-0.61328125,
-0.022247314453125,
-0.12457275390625,
0.802734375,
-0.779296875,
0.4345703125,
-0.0299835205078125,
0.68212890625,
-0.630859375,
0.314453125,
0.3935546875,
0.701171875,
-0.281494140625,
-0.458251953125,
-0.03759765625,
1.3447265625,
0.11566162109375,
0.2763671875,
-0.410888671875,
-0.0265960693359375,
0.205810546875,
0.25439453125,
-0.364013671875,
-0.0736083984375,
-0.5146484375,
1.064453125,
-0.86865234375,
0.138671875,
0.262451171875,
0.455810546875,
0.177490234375,
-0.472412109375,
-0.50244140625,
0.927734375,
1.052734375,
0.1829833984375,
0.4169921875,
0.60498046875,
0.51611328125,
-0.4228515625,
-0.219970703125,
-0.26806640625,
0.869140625,
0.396240234375,
0.337158203125,
-0.233154296875,
0.55224609375,
0.8251953125,
-0.0836181640625,
-0.287841796875,
0.5458984375,
0.307373046875,
-0.359130859375,
0.267578125,
0.04864501953125,
0.0107421875,
-0.2447509765625,
-0.1817626953125,
0.61767578125,
-0.316650390625,
-0.06805419921875,
-0.18408203125,
-0.69140625,
0.73046875,
-0.1680908203125,
-0.482177734375,
0.75244140625,
-0.474365234375,
0.38916015625,
0.329345703125,
0.08123779296875,
-0.04888916015625,
0.8154296875,
0.82421875,
0.287109375,
0.413818359375,
0.68994140625,
0.29296875,
-0.85302734375,
0.0165252685546875,
0.5615234375,
-0.0211029052734375,
-0.281982421875,
-0.58056640625,
-0.7744140625,
0.611328125,
-0.36767578125,
-0.32568359375,
0.326904296875,
-0.59716796875,
0.026641845703125,
-0.67041015625,
0.95068359375,
-0.70166015625,
0.2587890625,
0.28369140625,
0.08154296875,
-0.53271484375,
1.1279296875,
-0.335693359375,
0.3251953125,
0.28271484375,
1.294921875,
0.1033935546875,
1.236328125,
0.720703125,
-0.294189453125,
-0.1475830078125,
0.451171875,
-0.51953125,
-0.5888671875,
-0.1949462890625,
-0.263916015625,
-0.30078125,
-1.005859375,
-0.32568359375,
-0.408203125,
1.1357421875,
-0.04022216796875,
-0.92626953125,
-0.1572265625,
0.229736328125,
-1.0302734375,
0.52392578125,
0.226318359375,
0.2142333984375,
0.19287109375,
0.18798828125,
-0.2469482421875,
-0.6513671875,
0.0307769775390625,
-0.6298828125,
0.295654296875,
-0.71923828125,
-0.4013671875,
-0.8642578125,
-0.8544921875,
-0.47802734375,
0.1947021484375,
-0.5234375,
-0.8349609375,
0.1998291015625,
0.482421875,
0.55224609375,
0.295654296875,
-0.10137939453125,
-0.188720703125,
0.9072265625,
0.87548828125,
0.50341796875,
0.876953125,
0.17041015625,
0.0084075927734375,
0.1239013671875,
-0.7431640625,
0.4794921875,
-0.455322265625,
0.6083984375,
0.1407470703125,
0.0635986328125,
-0.5517578125,
-1.4287109375,
-0.17333984375,
0.2086181640625,
0.40771484375,
-0.51611328125,
-0.98974609375,
-0.6181640625,
-0.8779296875,
-0.3193359375,
-0.420654296875,
0.638671875,
-0.039093017578125,
0.295166015625,
-0.384521484375,
-1.3642578125,
4.54296875,
1.072265625,
0.9404296875,
0.62890625,
0.111328125,
0.8251953125,
0.7255859375,
-0.572265625,
-0.1500244140625,
-0.282958984375,
0.34521484375,
-0.035125732421875,
0.007503509521484375,
0.841796875,
0.437744140625,
0.58984375,
-0.82080078125,
-0.0236358642578125,
-0.09490966796875,
-1.0400390625,
-0.7763671875,
0.007221221923828125,
-0.34375,
0.302001953125,
-0.24658203125,
0.1536865234375,
0.71826171875,
-0.63330078125,
-0.74365234375,
-0.478271484375,
0.009033203125,
-0.348876953125,
0.876953125,
0.06475830078125,
-0.43701171875,
0.451904296875,
-0.2059326171875,
-0.619140625,
-0.32666015625,
0.1949462890625,
-0.0653076171875,
-0.2626953125,
0.904296875,
-0.3173828125,
0.1082763671875,
0.420654296875,
-0.5859375,
0.56787109375,
0.424560546875,
-0.7099609375,
0.77783203125,
-0.080810546875,
0.4560546875,
-0.36474609375,
-0.732421875,
-0.00018274784088134766,
0.021514892578125,
-0.037322998046875,
-0.43798828125,
0.6025390625,
0.335205078125,
0.2476806640625,
-0.09759521484375,
0.389892578125,
-0.79638671875,
0.8125,
-0.58056640625,
0.4990234375,
-0.5107421875,
0.140380859375,
-0.1671142578125,
-0.2476806640625,
-0.302978515625,
-0.12091064453125,
0.6826171875,
0.402099609375,
-0.215087890625,
0.1888427734375,
0.361572265625,
-0.650390625,
0.1861572265625,
0.046173095703125,
-0.3642578125,
-0.2440185546875,
0.376953125,
0.982421875,
-0.78076171875,
-0.6044921875,
-0.452880859375,
0.4970703125,
0.62890625,
0.25146484375,
0.00258636474609375,
-0.59423828125,
-0.145263671875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Submitted Solution:
```
s = input()
t = 'abcdefghijklmnopqrstuvwxyz'
currid = 0
den = 0
for i in s:
temp = abs(currid - t.index(i))
if temp > len(t) - temp :
den += len(t) - temp
else :
den += temp
currid = t.index(i)
print(den)
```
Yes
| 38,183
|
[
0.411865234375,
-0.2239990234375,
-0.07373046875,
0.3701171875,
-0.5224609375,
-0.48193359375,
-0.11004638671875,
-0.04449462890625,
0.0699462890625,
0.50732421875,
0.71533203125,
-0.30859375,
0.055419921875,
-0.7470703125,
-0.7119140625,
0.0880126953125,
-0.335693359375,
-0.7529296875,
-0.5966796875,
-0.1904296875,
0.0992431640625,
-0.2247314453125,
-1.2666015625,
-0.252685546875,
-0.69482421875,
0.9423828125,
0.2393798828125,
0.1611328125,
0.95263671875,
1.142578125,
-0.1038818359375,
-0.359130859375,
0.97509765625,
-1.146484375,
-0.09930419921875,
-0.367431640625,
0.4599609375,
-0.64111328125,
0.1593017578125,
-0.53515625,
0.1490478515625,
-0.1610107421875,
0.66162109375,
-0.5263671875,
-0.97412109375,
-0.0885009765625,
0.0020160675048828125,
-0.47216796875,
-0.13623046875,
-0.7646484375,
0.2139892578125,
-0.2139892578125,
0.4970703125,
-0.25732421875,
-0.036865234375,
-0.1971435546875,
0.0267181396484375,
-0.0301361083984375,
-0.57958984375,
0.11712646484375,
0.1561279296875,
0.255615234375,
0.1356201171875,
-1.037109375,
-0.220947265625,
0.1961669921875,
0.103515625,
-0.3515625,
-0.0762939453125,
-0.83349609375,
-0.31787109375,
0.259033203125,
0.0007786750793457031,
-0.66015625,
-0.288330078125,
-0.07037353515625,
0.01044464111328125,
0.1951904296875,
-0.77099609375,
0.5361328125,
0.025482177734375,
0.70166015625,
-0.1610107421875,
0.25732421875,
-0.53369140625,
-0.4609375,
0.0650634765625,
-0.0830078125,
0.2386474609375,
-0.31494140625,
-0.11578369140625,
0.495849609375,
-0.6259765625,
0.08563232421875,
0.70654296875,
0.6982421875,
-0.458251953125,
0.46728515625,
0.349609375,
0.279541015625,
0.60400390625,
0.93408203125,
-0.73876953125,
1.1025390625,
-0.13330078125,
-0.049041748046875,
0.2486572265625,
-0.26171875,
-0.31298828125,
-0.60595703125,
-0.429931640625,
-0.41455078125,
0.521484375,
0.276123046875,
-0.1260986328125,
0.70263671875,
0.26171875,
0.415283203125,
-0.74560546875,
0.475341796875,
0.0660400390625,
-0.307861328125,
0.287353515625,
-0.3037109375,
-0.062164306640625,
-0.2454833984375,
-0.375,
0.607421875,
-0.442138671875,
-0.004802703857421875,
0.54443359375,
0.49755859375,
0.00365447998046875,
0.43896484375,
-0.1331787109375,
0.74609375,
-0.171630859375,
0.66064453125,
0.76904296875,
-0.68701171875,
0.2607421875,
-0.435302734375,
0.43505859375,
1.849609375,
0.47314453125,
-0.170654296875,
0.6318359375,
0.56201171875,
-0.8056640625,
0.84423828125,
-0.5732421875,
0.46337890625,
-0.032257080078125,
0.177978515625,
-0.328369140625,
-0.0321044921875,
-0.429443359375,
0.689453125,
-0.037994384765625,
0.411865234375,
-0.54833984375,
0.039642333984375,
-0.0675048828125,
0.96923828125,
-0.040130615234375,
0.9267578125,
-0.39990234375,
-0.41015625,
-0.1624755859375,
-0.869140625,
0.1395263671875,
-0.14990234375,
-0.062225341796875,
0.5947265625,
0.59423828125,
0.82177734375,
0.8212890625,
-0.01336669921875,
0.6318359375,
0.16357421875,
-0.295654296875,
0.0887451171875,
0.15185546875,
0.6572265625,
-0.10455322265625,
0.319580078125,
0.00896453857421875,
-0.223388671875,
-0.377197265625,
-0.4892578125,
-0.1143798828125,
0.68310546875,
-0.400634765625,
0.2005615234375,
-0.1226806640625,
0.09814453125,
-0.9765625,
-0.03369140625,
0.10650634765625,
-1.04296875,
-0.3173828125,
0.64501953125,
-0.0623779296875,
0.461181640625,
-0.297119140625,
-0.92236328125,
0.31396484375,
1.0927734375,
-0.438720703125,
0.033538818359375,
0.6845703125,
0.356689453125,
-0.2418212890625,
0.2078857421875,
0.1905517578125,
-0.277099609375,
-0.84033203125,
0.68896484375,
-0.34716796875,
0.1575927734375,
0.06500244140625,
0.73583984375,
0.2000732421875,
0.5810546875,
-0.4111328125,
0.342529296875,
0.3076171875,
1.16796875,
-0.0129241943359375,
0.5595703125,
0.1441650390625,
1.06640625,
0.83740234375,
0.90576171875,
0.78857421875,
0.06494140625,
0.51220703125,
0.51171875,
0.0051422119140625,
-0.01959228515625,
0.07171630859375,
0.305908203125,
0.578125,
0.392822265625,
-0.1759033203125,
0.5078125,
-0.056915283203125,
-0.1396484375,
-0.6220703125,
0.32177734375,
-0.32763671875,
0.8359375,
-0.1593017578125,
0.3447265625,
-0.2373046875,
-0.26904296875,
0.395751953125,
0.57861328125,
-0.387939453125,
-0.52392578125,
0.2288818359375,
0.36767578125,
0.07354736328125,
0.060546875,
-0.039031982421875,
0.2327880859375,
-0.08221435546875,
0.8408203125,
-0.393310546875,
-0.328857421875,
-1.0751953125,
-0.96240234375,
-0.91748046875,
-0.1553955078125,
-0.619140625,
-0.067626953125,
0.3828125,
-0.5986328125,
0.66650390625,
-0.650390625,
0.0787353515625,
-0.09234619140625,
-0.70703125,
0.7275390625,
0.061492919921875,
0.70703125,
-0.382568359375,
0.451171875,
0.2008056640625,
0.8095703125,
-0.64013671875,
-0.220947265625,
-0.425048828125,
-0.353759765625,
0.41455078125,
-0.01445770263671875,
0.521484375,
-0.413818359375,
-0.9365234375,
-0.79052734375,
-0.313720703125,
-0.0142669677734375,
-0.497802734375,
0.181640625,
-0.52734375,
0.8916015625,
0.5068359375,
-0.95263671875,
0.46240234375,
0.78466796875,
-0.93212890625,
0.46240234375,
0.3154296875,
0.03729248046875,
-0.87158203125,
1.185546875,
0.373291015625,
0.56005859375,
-0.202392578125,
0.045318603515625,
-0.5693359375,
0.288330078125,
-0.345703125,
-0.591796875,
-0.298828125,
0.439697265625,
0.2376708984375,
-1.0546875,
0.61181640625,
-1.0693359375,
-0.62109375,
-0.4921875,
-0.59912109375,
0.86962890625,
0.673828125,
0.0026454925537109375,
0.1973876953125,
-0.12408447265625,
0.18359375,
0.71630859375,
0.484619140625,
-0.50732421875,
0.205322265625,
0.50341796875,
-0.61474609375,
0.55615234375,
0.46337890625,
-0.262939453125,
-0.146728515625,
-0.1494140625,
0.11065673828125,
0.1807861328125,
0.2578125,
0.168701171875,
0.603515625,
0.82373046875,
-0.578125,
-0.2529296875,
-0.67333984375,
1.033203125,
0.37451171875,
0.501953125,
0.41943359375,
-0.1046142578125,
-0.5517578125,
-0.80810546875,
0.20654296875,
0.420654296875,
0.73779296875,
-0.54052734375,
0.71044921875,
0.02764892578125,
-0.6533203125,
0.0830078125,
-0.615234375,
-0.44580078125,
0.80615234375,
-0.1707763671875,
0.83203125,
-0.64599609375,
0.07940673828125,
-0.431884765625,
-0.049285888671875,
-0.0242462158203125,
0.0611572265625,
0.63818359375,
-0.303466796875,
-0.1988525390625,
-0.5693359375,
-0.21435546875,
0.002166748046875,
-0.63818359375,
0.152587890625,
-0.70849609375,
-0.494384765625,
-0.6435546875,
0.452880859375,
0.95849609375,
0.48095703125,
-0.08514404296875,
0.353271484375,
0.1390380859375,
0.22119140625,
0.384521484375,
-0.445068359375,
-0.0229644775390625,
-0.67138671875,
0.76171875,
0.41162109375,
-0.460693359375,
-0.54833984375,
-0.2998046875,
-0.68994140625,
0.18505859375,
0.2371826171875,
-0.03692626953125,
-0.61376953125,
0.479248046875,
-0.219970703125,
0.43212890625,
-0.75830078125,
-0.325439453125,
-0.40673828125,
0.52783203125,
0.71923828125,
-0.09619140625,
0.0107269287109375,
-0.61767578125,
0.54833984375,
0.6904296875,
0.02764892578125,
-0.60546875,
-0.1361083984375,
-0.75048828125,
-0.556640625,
-0.0709228515625,
0.74365234375,
0.2978515625,
0.13330078125,
-1.125,
0.681640625,
0.289306640625,
-0.6875,
-0.06915283203125,
0.3466796875,
0.09423828125,
-0.1483154296875,
0.6650390625,
-0.1907958984375,
-0.6376953125,
0.2213134765625,
-1.017578125,
0.67333984375,
-0.304931640625,
0.4072265625,
-0.09100341796875,
-0.14013671875,
0.2039794921875,
0.287353515625,
-0.68408203125,
-0.039154052734375,
-0.0872802734375,
0.63916015625,
-1.0556640625,
-0.5908203125,
0.55859375,
-0.125,
-0.48974609375,
0.65087890625,
-0.298828125,
-0.35107421875,
0.3134765625,
-0.038787841796875,
-0.53759765625,
0.08477783203125,
-0.4638671875,
0.357421875,
0.049163818359375,
-0.280517578125,
0.32763671875,
-0.59228515625,
1.1171875,
0.1297607421875,
-0.58251953125,
-0.1407470703125,
-1.0859375,
-0.28857421875,
-0.24609375,
-0.6826171875,
0.054779052734375,
0.0252227783203125,
-0.1883544921875,
-0.18603515625,
-0.325439453125,
-0.59423828125,
-0.0780029296875,
-0.6650390625,
0.1591796875,
0.55615234375,
0.359375,
0.2325439453125,
-0.1568603515625,
-0.59375,
0.3037109375,
-0.429931640625,
-0.0455322265625,
-0.483642578125,
-0.0673828125,
-0.445556640625,
-0.36376953125,
-0.4375,
0.41455078125,
-0.375244140625,
0.062744140625,
0.9013671875,
0.4580078125,
0.429931640625,
-0.207275390625,
-0.469482421875,
0.73095703125,
0.049896240234375,
-1.2060546875,
-0.583984375,
1.0302734375,
0.0823974609375,
0.6455078125,
0.480224609375,
-0.54541015625,
-1.0517578125,
-0.99365234375,
0.1807861328125,
-0.5947265625,
-0.231201171875,
-0.7509765625,
-0.386962890625,
-0.5439453125,
0.439697265625,
-0.11358642578125,
-0.32421875,
0.355224609375,
-0.8642578125,
0.1221923828125,
-0.6025390625,
0.1646728515625,
-0.51220703125,
-0.765625,
-0.505859375,
0.91455078125,
0.251953125,
0.2705078125,
-0.03582763671875,
0.0760498046875,
0.3818359375,
0.246826171875,
-0.26904296875,
-0.470703125,
-0.159423828125,
0.5546875,
-0.31884765625,
-0.156982421875,
-0.1484375,
0.64013671875,
-0.97119140625,
0.311767578125,
0.10552978515625,
-0.0838623046875,
-0.2010498046875,
-0.312255859375,
1.0576171875,
-0.3408203125,
-0.051666259765625,
-0.423095703125,
0.55322265625,
0.65234375,
-0.2724609375,
-0.1171875,
-0.60693359375,
-0.3564453125,
-1.078125,
0.76513671875,
-0.02984619140625,
0.3291015625,
-0.50341796875,
-0.1146240234375,
1.30078125,
-0.44580078125,
0.343994140625,
1.1748046875,
0.1181640625,
0.1920166015625,
-0.7431640625,
0.60400390625,
0.4013671875,
-0.44775390625,
-0.26123046875,
-0.0283966064453125,
-0.822265625,
0.44873046875,
-0.262939453125,
-0.9501953125,
-0.5888671875,
0.50732421875,
1.1748046875,
-0.250732421875,
0.6044921875,
-0.2022705078125,
-1.22265625,
-0.56201171875,
0.7470703125,
-0.2978515625,
0.1309814453125,
0.71044921875,
0.0321044921875,
-0.25439453125,
-0.048675537109375,
-0.018890380859375,
-0.450927734375,
-0.3564453125,
1.115234375,
-0.354736328125,
-0.767578125,
1.228515625,
0.53466796875,
-0.919921875,
-0.99169921875,
0.09246826171875,
-0.149658203125,
-0.277099609375,
-0.95654296875,
0.338623046875,
0.1900634765625,
-0.34033203125,
-0.06646728515625,
0.44921875,
-0.300537109375,
0.279541015625,
0.09234619140625,
0.412109375,
-0.595703125,
-0.00739288330078125,
0.421630859375,
-0.46875,
-0.35498046875,
-0.89990234375,
-0.1937255859375,
-0.52294921875,
-0.0286712646484375,
0.3740234375,
-0.361328125,
0.4658203125,
0.509765625,
0.1322021484375,
0.9736328125,
-0.1903076171875,
-0.2008056640625,
0.05419921875,
-0.43310546875,
-0.62646484375,
-0.45458984375,
0.329345703125,
-0.38427734375,
-0.10406494140625,
-0.6962890625,
-0.343505859375,
0.440673828125,
0.38525390625,
-0.53369140625,
-1.07421875,
-0.3759765625,
-1.060546875,
-0.61962890625,
-0.371826171875,
-0.5166015625,
-0.321533203125,
-0.10595703125,
0.0594482421875,
-0.389892578125,
0.05621337890625,
0.54248046875,
-0.2481689453125,
0.72998046875,
-0.391845703125,
0.371826171875,
-0.8046875,
-0.04949951171875,
-0.5341796875,
0.385986328125,
-0.53955078125,
-0.1456298828125,
-0.6103515625,
0.1282958984375,
0.1116943359375,
0.55419921875,
-0.3076171875,
0.311279296875,
0.20556640625,
-0.362060546875,
-0.01416778564453125,
0.1627197265625,
-0.1485595703125,
0.6005859375,
0.78759765625,
-0.169921875,
0.55859375,
-0.23095703125,
-0.54443359375,
-0.149658203125,
0.59423828125,
0.4228515625,
-0.142822265625,
-0.23828125,
-0.12109375,
0.337646484375,
-0.94677734375,
0.316162109375,
-0.2802734375,
0.42578125,
-0.0257110595703125,
-0.2529296875,
0.53564453125,
0.708984375,
0.0726318359375,
0.1744384765625,
-0.0810546875,
0.150390625,
0.0082855224609375,
0.283447265625,
0.193359375,
0.5341796875,
0.099365234375,
-0.45263671875,
-0.1103515625,
0.26220703125,
-0.382080078125,
0.6064453125,
-0.431884765625,
-0.541015625,
-0.83203125,
-0.0997314453125,
-0.029083251953125,
0.75927734375,
0.6416015625,
-0.60546875,
-0.0031795501708984375,
-0.19970703125,
-0.70947265625,
0.1063232421875,
-1.296875,
-0.94873046875,
0.29296875,
-0.06744384765625,
-0.23583984375,
-0.27783203125,
-0.5712890625,
-0.0452880859375,
-0.10699462890625,
0.6787109375,
-0.748046875,
0.4130859375,
0.00884246826171875,
0.6845703125,
-0.61328125,
0.31787109375,
0.279541015625,
0.71728515625,
-0.39697265625,
-0.49755859375,
-0.06903076171875,
1.259765625,
0.1080322265625,
0.15771484375,
-0.39111328125,
0.1431884765625,
0.051361083984375,
0.1510009765625,
-0.305908203125,
-0.042205810546875,
-0.401123046875,
1.13671875,
-0.84326171875,
0.09869384765625,
0.1705322265625,
0.4638671875,
0.1280517578125,
-0.494873046875,
-0.56689453125,
0.94580078125,
1.03515625,
0.1690673828125,
0.5419921875,
0.5107421875,
0.5341796875,
-0.337646484375,
-0.0936279296875,
-0.3505859375,
0.84716796875,
0.427734375,
0.495361328125,
-0.1800537109375,
0.6005859375,
0.80224609375,
-0.0394287109375,
-0.180908203125,
0.52392578125,
0.295166015625,
-0.358154296875,
0.375732421875,
-0.014068603515625,
-0.022796630859375,
-0.19091796875,
-0.1834716796875,
0.53955078125,
-0.38232421875,
-0.034637451171875,
-0.2373046875,
-0.66943359375,
0.84130859375,
-0.1602783203125,
-0.453857421875,
0.67431640625,
-0.437744140625,
0.44970703125,
0.318603515625,
0.2039794921875,
-0.005710601806640625,
0.85009765625,
0.8740234375,
0.341796875,
0.41845703125,
0.67822265625,
0.287841796875,
-0.888671875,
0.054443359375,
0.62548828125,
0.003780364990234375,
-0.332763671875,
-0.60400390625,
-0.94189453125,
0.73583984375,
-0.291015625,
-0.296142578125,
0.34228515625,
-0.7802734375,
0.0965576171875,
-0.68115234375,
0.97900390625,
-0.71728515625,
0.358154296875,
0.286865234375,
0.06414794921875,
-0.5498046875,
1.0712890625,
-0.365478515625,
0.4013671875,
0.230712890625,
1.31640625,
0.16845703125,
1.330078125,
0.8046875,
-0.261962890625,
-0.17578125,
0.52587890625,
-0.4326171875,
-0.48046875,
-0.1484375,
-0.2802734375,
-0.231689453125,
-0.9814453125,
-0.385009765625,
-0.4541015625,
1.1220703125,
0.07073974609375,
-0.85009765625,
-0.26611328125,
0.323486328125,
-0.95166015625,
0.5654296875,
0.149169921875,
0.30859375,
0.28125,
0.183349609375,
-0.320068359375,
-0.59814453125,
0.0833740234375,
-0.515625,
0.37548828125,
-0.60693359375,
-0.385986328125,
-0.7939453125,
-0.7763671875,
-0.48095703125,
0.139892578125,
-0.58544921875,
-0.87353515625,
0.327392578125,
0.40625,
0.424072265625,
0.316650390625,
-0.08807373046875,
-0.1871337890625,
1,
0.83544921875,
0.42822265625,
0.9306640625,
0.1949462890625,
0.04107666015625,
0.038604736328125,
-0.71875,
0.483642578125,
-0.40771484375,
0.48779296875,
0.0927734375,
0.044769287109375,
-0.583984375,
-1.3203125,
-0.2130126953125,
0.25830078125,
0.389404296875,
-0.58251953125,
-1.087890625,
-0.69140625,
-0.84130859375,
-0.2578125,
-0.49365234375,
0.70361328125,
-0.0494384765625,
0.1478271484375,
-0.38671875,
-1.2666015625,
4.49609375,
1.14453125,
0.80908203125,
0.54052734375,
0.1441650390625,
0.841796875,
0.76171875,
-0.5439453125,
-0.161865234375,
-0.302978515625,
0.2939453125,
-0.0887451171875,
0.084228515625,
0.80078125,
0.50537109375,
0.5908203125,
-0.767578125,
-0.183837890625,
0.00565338134765625,
-1.0712890625,
-0.71923828125,
-0.0172119140625,
-0.26171875,
0.2371826171875,
-0.281982421875,
0.164306640625,
0.86962890625,
-0.7626953125,
-0.7216796875,
-0.529296875,
0.16162109375,
-0.401611328125,
0.90087890625,
0.15283203125,
-0.443359375,
0.448974609375,
-0.17529296875,
-0.689453125,
-0.278076171875,
0.256103515625,
-0.20849609375,
-0.11572265625,
0.8916015625,
-0.27978515625,
-0.0036144256591796875,
0.5498046875,
-0.51025390625,
0.6240234375,
0.47314453125,
-0.88232421875,
0.908203125,
-0.1156005859375,
0.379638671875,
-0.31982421875,
-0.693359375,
0.04168701171875,
0.10687255859375,
-0.09576416015625,
-0.367431640625,
0.68212890625,
0.355712890625,
0.299072265625,
-0.13671875,
0.432373046875,
-0.84765625,
0.67578125,
-0.494384765625,
0.444091796875,
-0.513671875,
0.10693359375,
-0.1578369140625,
-0.260009765625,
-0.380615234375,
-0.340576171875,
0.697265625,
0.427001953125,
-0.3701171875,
0.1739501953125,
0.302734375,
-0.6708984375,
0.15087890625,
-0.08099365234375,
-0.28125,
-0.302001953125,
0.421630859375,
1.18359375,
-0.7724609375,
-0.62060546875,
-0.489990234375,
0.5166015625,
0.6943359375,
0.295654296875,
0.02630615234375,
-0.64501953125,
-0.26123046875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Submitted Solution:
```
a=[0,*map(lambda x:ord(x)-97,input())]
print(sum(min(z,26-z) for z in [abs(y-x) for x,y in zip(a,a[1:])]))
```
Yes
| 38,184
|
[
0.4111328125,
-0.2191162109375,
-0.06549072265625,
0.366455078125,
-0.5,
-0.4814453125,
-0.12286376953125,
-0.0382080078125,
0.04107666015625,
0.493896484375,
0.72021484375,
-0.3173828125,
0.0628662109375,
-0.73486328125,
-0.69287109375,
0.11883544921875,
-0.3623046875,
-0.75,
-0.599609375,
-0.1900634765625,
0.1171875,
-0.243408203125,
-1.27734375,
-0.260986328125,
-0.68017578125,
0.93310546875,
0.22021484375,
0.1817626953125,
0.9638671875,
1.1123046875,
-0.09478759765625,
-0.34228515625,
1.0185546875,
-1.1708984375,
-0.08544921875,
-0.371337890625,
0.446044921875,
-0.6083984375,
0.1414794921875,
-0.55322265625,
0.1905517578125,
-0.169189453125,
0.66455078125,
-0.51513671875,
-0.9638671875,
-0.05560302734375,
-0.0008544921875,
-0.473388671875,
-0.1473388671875,
-0.75927734375,
0.1680908203125,
-0.1900634765625,
0.47265625,
-0.268310546875,
-0.052825927734375,
-0.197265625,
0.05157470703125,
-0.01427459716796875,
-0.5546875,
0.09857177734375,
0.1728515625,
0.25439453125,
0.12445068359375,
-0.99853515625,
-0.22265625,
0.1776123046875,
0.10809326171875,
-0.3388671875,
-0.045135498046875,
-0.8427734375,
-0.2919921875,
0.2744140625,
0.00489044189453125,
-0.67724609375,
-0.306884765625,
-0.043304443359375,
-0.008270263671875,
0.198486328125,
-0.77392578125,
0.51416015625,
0.019744873046875,
0.7158203125,
-0.165771484375,
0.2314453125,
-0.521484375,
-0.448974609375,
0.07012939453125,
-0.09136962890625,
0.2215576171875,
-0.301025390625,
-0.0987548828125,
0.49658203125,
-0.61083984375,
0.1241455078125,
0.7041015625,
0.72021484375,
-0.447021484375,
0.4775390625,
0.371826171875,
0.289794921875,
0.61962890625,
0.94482421875,
-0.72119140625,
1.0751953125,
-0.1397705078125,
-0.0787353515625,
0.2152099609375,
-0.267822265625,
-0.29248046875,
-0.60693359375,
-0.40673828125,
-0.416748046875,
0.52880859375,
0.276611328125,
-0.0836181640625,
0.65625,
0.2266845703125,
0.433349609375,
-0.7578125,
0.4677734375,
0.06805419921875,
-0.256591796875,
0.28271484375,
-0.296875,
-0.060394287109375,
-0.2135009765625,
-0.39599609375,
0.60498046875,
-0.464599609375,
0.006084442138671875,
0.52099609375,
0.50634765625,
0.0038051605224609375,
0.45849609375,
-0.1568603515625,
0.72412109375,
-0.17333984375,
0.666015625,
0.7685546875,
-0.703125,
0.256591796875,
-0.450439453125,
0.421875,
1.8544921875,
0.455322265625,
-0.177490234375,
0.6572265625,
0.56494140625,
-0.82177734375,
0.87060546875,
-0.5888671875,
0.454345703125,
-0.0165863037109375,
0.170654296875,
-0.33935546875,
-0.05010986328125,
-0.428955078125,
0.6953125,
-0.048004150390625,
0.41259765625,
-0.529296875,
-0.0096588134765625,
-0.057220458984375,
0.9521484375,
-0.04852294921875,
0.93701171875,
-0.425048828125,
-0.40576171875,
-0.1419677734375,
-0.87060546875,
0.157470703125,
-0.1688232421875,
-0.0830078125,
0.58349609375,
0.59326171875,
0.81982421875,
0.828125,
-0.037750244140625,
0.63916015625,
0.1632080078125,
-0.302001953125,
0.092529296875,
0.1475830078125,
0.671875,
-0.1005859375,
0.292236328125,
0.021697998046875,
-0.2176513671875,
-0.363037109375,
-0.486328125,
-0.1168212890625,
0.69140625,
-0.373046875,
0.1953125,
-0.1243896484375,
0.108154296875,
-1,
-0.0160980224609375,
0.07867431640625,
-1.0419921875,
-0.283203125,
0.6201171875,
-0.08599853515625,
0.44384765625,
-0.326171875,
-0.90380859375,
0.30712890625,
1.078125,
-0.484375,
0.058990478515625,
0.7001953125,
0.33203125,
-0.238525390625,
0.192626953125,
0.19140625,
-0.260498046875,
-0.837890625,
0.7216796875,
-0.371826171875,
0.11602783203125,
0.05926513671875,
0.75732421875,
0.16015625,
0.57275390625,
-0.392578125,
0.328369140625,
0.3134765625,
1.177734375,
-0.030120849609375,
0.5537109375,
0.1490478515625,
1.041015625,
0.81103515625,
0.884765625,
0.755859375,
0.083740234375,
0.49072265625,
0.517578125,
-0.024444580078125,
-0.049652099609375,
0.0753173828125,
0.331787109375,
0.57373046875,
0.3740234375,
-0.149658203125,
0.50390625,
-0.06048583984375,
-0.145751953125,
-0.63525390625,
0.343505859375,
-0.3427734375,
0.83154296875,
-0.1519775390625,
0.328125,
-0.2364501953125,
-0.2403564453125,
0.402587890625,
0.60009765625,
-0.3759765625,
-0.52880859375,
0.244140625,
0.322509765625,
0.0806884765625,
0.044952392578125,
-0.051788330078125,
0.27197265625,
-0.060760498046875,
0.84033203125,
-0.38525390625,
-0.29443359375,
-1.099609375,
-0.9599609375,
-0.875,
-0.1580810546875,
-0.625,
-0.0268096923828125,
0.425048828125,
-0.6044921875,
0.671875,
-0.65478515625,
0.0849609375,
-0.088623046875,
-0.7119140625,
0.7109375,
0.08148193359375,
0.71923828125,
-0.340576171875,
0.45166015625,
0.1712646484375,
0.8056640625,
-0.666015625,
-0.2222900390625,
-0.445556640625,
-0.341796875,
0.429443359375,
-0.0146331787109375,
0.52197265625,
-0.411865234375,
-0.93310546875,
-0.80517578125,
-0.28662109375,
-0.01558685302734375,
-0.484375,
0.2115478515625,
-0.54248046875,
0.9091796875,
0.5361328125,
-0.94873046875,
0.446044921875,
0.775390625,
-0.91748046875,
0.465576171875,
0.296875,
0.06475830078125,
-0.880859375,
1.181640625,
0.355712890625,
0.5556640625,
-0.239013671875,
0.0297088623046875,
-0.5673828125,
0.2998046875,
-0.328857421875,
-0.58642578125,
-0.279052734375,
0.44091796875,
0.2281494140625,
-1.048828125,
0.619140625,
-1.060546875,
-0.6220703125,
-0.45947265625,
-0.61572265625,
0.8173828125,
0.68115234375,
-0.005825042724609375,
0.1749267578125,
-0.0911865234375,
0.1893310546875,
0.70458984375,
0.464599609375,
-0.50634765625,
0.218505859375,
0.474609375,
-0.646484375,
0.5439453125,
0.4638671875,
-0.2078857421875,
-0.1451416015625,
-0.1263427734375,
0.06878662109375,
0.2042236328125,
0.2366943359375,
0.2095947265625,
0.59326171875,
0.837890625,
-0.59521484375,
-0.2255859375,
-0.673828125,
1.013671875,
0.382080078125,
0.482666015625,
0.383544921875,
-0.11273193359375,
-0.5625,
-0.79248046875,
0.216796875,
0.44287109375,
0.71435546875,
-0.54150390625,
0.7294921875,
0.0377197265625,
-0.6337890625,
0.08001708984375,
-0.615234375,
-0.42333984375,
0.7939453125,
-0.2027587890625,
0.833984375,
-0.63671875,
0.06329345703125,
-0.41552734375,
-0.0084381103515625,
-0.0343017578125,
0.0848388671875,
0.6533203125,
-0.296875,
-0.149658203125,
-0.59765625,
-0.243896484375,
-0.00103759765625,
-0.60791015625,
0.1717529296875,
-0.708984375,
-0.5107421875,
-0.6328125,
0.419921875,
0.96875,
0.492431640625,
-0.11065673828125,
0.3359375,
0.134521484375,
0.2020263671875,
0.404052734375,
-0.434326171875,
-0.0081329345703125,
-0.66845703125,
0.7568359375,
0.38525390625,
-0.478515625,
-0.53955078125,
-0.3232421875,
-0.68505859375,
0.1717529296875,
0.2216796875,
-0.06829833984375,
-0.63134765625,
0.5087890625,
-0.232177734375,
0.462158203125,
-0.76025390625,
-0.308837890625,
-0.380615234375,
0.50732421875,
0.70166015625,
-0.09014892578125,
-0.0131378173828125,
-0.642578125,
0.54248046875,
0.68505859375,
0.002292633056640625,
-0.6123046875,
-0.13818359375,
-0.7421875,
-0.55322265625,
-0.048583984375,
0.744140625,
0.30224609375,
0.1153564453125,
-1.119140625,
0.72216796875,
0.283935546875,
-0.70703125,
-0.10400390625,
0.335205078125,
0.091552734375,
-0.155029296875,
0.63623046875,
-0.1990966796875,
-0.63330078125,
0.237060546875,
-1.0283203125,
0.63916015625,
-0.277099609375,
0.397216796875,
-0.08892822265625,
-0.132568359375,
0.1837158203125,
0.272216796875,
-0.6640625,
-0.038177490234375,
-0.12091064453125,
0.6650390625,
-1.072265625,
-0.5732421875,
0.5595703125,
-0.134765625,
-0.431884765625,
0.64892578125,
-0.2880859375,
-0.376953125,
0.329833984375,
-0.032257080078125,
-0.53271484375,
0.059600830078125,
-0.4384765625,
0.404296875,
0.0660400390625,
-0.25537109375,
0.33349609375,
-0.5810546875,
1.1435546875,
0.1405029296875,
-0.57958984375,
-0.12030029296875,
-1.078125,
-0.271728515625,
-0.2293701171875,
-0.7041015625,
0.05804443359375,
0.017425537109375,
-0.205810546875,
-0.1689453125,
-0.3271484375,
-0.56982421875,
-0.08624267578125,
-0.63525390625,
0.177490234375,
0.5634765625,
0.38525390625,
0.220703125,
-0.1339111328125,
-0.6103515625,
0.277587890625,
-0.433349609375,
-0.037017822265625,
-0.484375,
-0.048828125,
-0.471435546875,
-0.342041015625,
-0.43017578125,
0.38818359375,
-0.359375,
0.0711669921875,
0.88232421875,
0.463134765625,
0.440673828125,
-0.189697265625,
-0.469482421875,
0.701171875,
0.0677490234375,
-1.2158203125,
-0.5859375,
1.0556640625,
0.0538330078125,
0.6357421875,
0.467529296875,
-0.541015625,
-1.1015625,
-1.0078125,
0.20068359375,
-0.615234375,
-0.2452392578125,
-0.74169921875,
-0.396728515625,
-0.5439453125,
0.438720703125,
-0.10589599609375,
-0.338623046875,
0.319091796875,
-0.875,
0.1292724609375,
-0.583984375,
0.1622314453125,
-0.50341796875,
-0.76611328125,
-0.48583984375,
0.91015625,
0.287109375,
0.284423828125,
-0.039794921875,
0.09381103515625,
0.367919921875,
0.2509765625,
-0.2442626953125,
-0.473388671875,
-0.166259765625,
0.55810546875,
-0.319580078125,
-0.163330078125,
-0.11431884765625,
0.6298828125,
-0.96337890625,
0.314453125,
0.1026611328125,
-0.07208251953125,
-0.18115234375,
-0.30810546875,
1.060546875,
-0.338134765625,
-0.0205078125,
-0.389892578125,
0.53662109375,
0.63525390625,
-0.2841796875,
-0.09417724609375,
-0.61181640625,
-0.35595703125,
-1.1015625,
0.7880859375,
-0.067138671875,
0.30322265625,
-0.53466796875,
-0.1171875,
1.3056640625,
-0.460693359375,
0.382568359375,
1.17578125,
0.1593017578125,
0.16943359375,
-0.7177734375,
0.58837890625,
0.381103515625,
-0.408935546875,
-0.2587890625,
-0.0179290771484375,
-0.7734375,
0.468017578125,
-0.26611328125,
-0.93994140625,
-0.56591796875,
0.5,
1.140625,
-0.2509765625,
0.61865234375,
-0.16552734375,
-1.1826171875,
-0.56884765625,
0.716796875,
-0.274658203125,
0.13818359375,
0.67724609375,
0.0228271484375,
-0.2666015625,
-0.0626220703125,
-0.003528594970703125,
-0.4775390625,
-0.35107421875,
1.0751953125,
-0.3681640625,
-0.78125,
1.21875,
0.529296875,
-0.9111328125,
-0.95947265625,
0.090576171875,
-0.10345458984375,
-0.290283203125,
-0.9501953125,
0.300048828125,
0.1937255859375,
-0.35107421875,
-0.07763671875,
0.42919921875,
-0.288330078125,
0.262451171875,
0.08319091796875,
0.39306640625,
-0.6015625,
-0.0160064697265625,
0.423828125,
-0.4560546875,
-0.382080078125,
-0.91015625,
-0.1744384765625,
-0.517578125,
-0.038116455078125,
0.393310546875,
-0.355712890625,
0.476806640625,
0.4814453125,
0.157470703125,
0.95849609375,
-0.2049560546875,
-0.175537109375,
0.0550537109375,
-0.442138671875,
-0.60302734375,
-0.4462890625,
0.3232421875,
-0.3720703125,
-0.1190185546875,
-0.66650390625,
-0.303466796875,
0.42333984375,
0.3681640625,
-0.5322265625,
-1.0927734375,
-0.367919921875,
-1.09765625,
-0.6455078125,
-0.373291015625,
-0.5029296875,
-0.31982421875,
-0.11383056640625,
0.040008544921875,
-0.390380859375,
0.0728759765625,
0.53076171875,
-0.2322998046875,
0.75390625,
-0.398681640625,
0.364013671875,
-0.84033203125,
-0.040924072265625,
-0.53515625,
0.38623046875,
-0.5244140625,
-0.14599609375,
-0.61279296875,
0.12646484375,
0.1766357421875,
0.57177734375,
-0.33984375,
0.310791015625,
0.2030029296875,
-0.373779296875,
-0.032867431640625,
0.166748046875,
-0.14013671875,
0.5869140625,
0.79638671875,
-0.154541015625,
0.521484375,
-0.2235107421875,
-0.556640625,
-0.1402587890625,
0.5888671875,
0.439697265625,
-0.1583251953125,
-0.1953125,
-0.146728515625,
0.33984375,
-0.93505859375,
0.317626953125,
-0.284912109375,
0.416015625,
-0.05316162109375,
-0.2457275390625,
0.54443359375,
0.728515625,
0.06939697265625,
0.1417236328125,
-0.0660400390625,
0.1300048828125,
-0.0073699951171875,
0.272705078125,
0.2196044921875,
0.53515625,
0.08087158203125,
-0.459228515625,
-0.1138916015625,
0.257080078125,
-0.361328125,
0.58447265625,
-0.46826171875,
-0.52099609375,
-0.826171875,
-0.1273193359375,
0.0073699951171875,
0.77294921875,
0.61376953125,
-0.60693359375,
-0.05145263671875,
-0.2220458984375,
-0.7216796875,
0.08984375,
-1.3193359375,
-0.93017578125,
0.283203125,
-0.07891845703125,
-0.228271484375,
-0.259033203125,
-0.55615234375,
-0.048095703125,
-0.0904541015625,
0.6982421875,
-0.74658203125,
0.396484375,
0.00791168212890625,
0.697265625,
-0.61376953125,
0.298583984375,
0.294921875,
0.72021484375,
-0.39990234375,
-0.48095703125,
-0.06884765625,
1.2890625,
0.12164306640625,
0.18896484375,
-0.419189453125,
0.11474609375,
0.05731201171875,
0.145263671875,
-0.320068359375,
-0.05511474609375,
-0.42138671875,
1.1259765625,
-0.8486328125,
0.09820556640625,
0.1998291015625,
0.44287109375,
0.13623046875,
-0.461181640625,
-0.57373046875,
0.94921875,
1.05859375,
0.1800537109375,
0.55126953125,
0.5390625,
0.55322265625,
-0.315185546875,
-0.11700439453125,
-0.353271484375,
0.865234375,
0.4072265625,
0.474365234375,
-0.1993408203125,
0.59326171875,
0.81640625,
-0.020233154296875,
-0.2056884765625,
0.49267578125,
0.29345703125,
-0.326171875,
0.3681640625,
-0.0025310516357421875,
-0.036834716796875,
-0.1851806640625,
-0.1593017578125,
0.56591796875,
-0.379150390625,
-0.02618408203125,
-0.2197265625,
-0.67529296875,
0.83203125,
-0.1827392578125,
-0.47314453125,
0.6611328125,
-0.481201171875,
0.439208984375,
0.2958984375,
0.1903076171875,
-0.0278778076171875,
0.85205078125,
0.88037109375,
0.34228515625,
0.4169921875,
0.69091796875,
0.2900390625,
-0.9169921875,
0.03753662109375,
0.6181640625,
0.019195556640625,
-0.316650390625,
-0.61962890625,
-0.91845703125,
0.7392578125,
-0.3037109375,
-0.290771484375,
0.3076171875,
-0.74755859375,
0.0728759765625,
-0.66845703125,
0.97265625,
-0.71728515625,
0.3642578125,
0.2822265625,
0.076904296875,
-0.5673828125,
1.0751953125,
-0.34912109375,
0.386474609375,
0.28173828125,
1.326171875,
0.1575927734375,
1.28125,
0.83349609375,
-0.265869140625,
-0.1728515625,
0.53515625,
-0.46044921875,
-0.472412109375,
-0.14453125,
-0.2462158203125,
-0.254150390625,
-0.9814453125,
-0.373779296875,
-0.486572265625,
1.123046875,
0.05145263671875,
-0.86279296875,
-0.2403564453125,
0.296630859375,
-0.99755859375,
0.5771484375,
0.15576171875,
0.326171875,
0.2646484375,
0.2088623046875,
-0.297607421875,
-0.591796875,
0.0648193359375,
-0.5244140625,
0.35302734375,
-0.63720703125,
-0.382568359375,
-0.79150390625,
-0.78369140625,
-0.487548828125,
0.1307373046875,
-0.56884765625,
-0.8857421875,
0.294189453125,
0.430908203125,
0.4619140625,
0.31884765625,
-0.12017822265625,
-0.15625,
0.96044921875,
0.84033203125,
0.44140625,
0.93212890625,
0.2288818359375,
0.0567626953125,
0.01499176025390625,
-0.744140625,
0.48046875,
-0.433349609375,
0.51318359375,
0.10552978515625,
0.04449462890625,
-0.60205078125,
-1.359375,
-0.1995849609375,
0.2587890625,
0.393310546875,
-0.56201171875,
-1.048828125,
-0.66943359375,
-0.8388671875,
-0.253173828125,
-0.48193359375,
0.68408203125,
-0.030914306640625,
0.1378173828125,
-0.389404296875,
-1.283203125,
4.50390625,
1.14453125,
0.83349609375,
0.57470703125,
0.1759033203125,
0.85107421875,
0.75634765625,
-0.54833984375,
-0.1636962890625,
-0.3291015625,
0.316162109375,
-0.055816650390625,
0.088134765625,
0.8076171875,
0.47900390625,
0.59814453125,
-0.78271484375,
-0.169677734375,
0.003192901611328125,
-1.064453125,
-0.73828125,
-0.035247802734375,
-0.261474609375,
0.2203369140625,
-0.294677734375,
0.144775390625,
0.892578125,
-0.75830078125,
-0.71533203125,
-0.5185546875,
0.12237548828125,
-0.412841796875,
0.90869140625,
0.1143798828125,
-0.412841796875,
0.44580078125,
-0.1861572265625,
-0.68115234375,
-0.274658203125,
0.240234375,
-0.1925048828125,
-0.10491943359375,
0.88671875,
-0.2978515625,
0.026885986328125,
0.537109375,
-0.51904296875,
0.63818359375,
0.451171875,
-0.8466796875,
0.8857421875,
-0.126953125,
0.380615234375,
-0.327880859375,
-0.67626953125,
0.0262908935546875,
0.09967041015625,
-0.09906005859375,
-0.37451171875,
0.6875,
0.3544921875,
0.281982421875,
-0.1287841796875,
0.447509765625,
-0.84375,
0.6796875,
-0.50341796875,
0.421142578125,
-0.484375,
0.1392822265625,
-0.18310546875,
-0.271240234375,
-0.37255859375,
-0.316650390625,
0.68408203125,
0.403076171875,
-0.360107421875,
0.1839599609375,
0.30615234375,
-0.63916015625,
0.166748046875,
-0.07342529296875,
-0.288330078125,
-0.29296875,
0.401611328125,
1.1337890625,
-0.78466796875,
-0.59912109375,
-0.51708984375,
0.493896484375,
0.72607421875,
0.30078125,
0.0225677490234375,
-0.6591796875,
-0.25732421875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Submitted Solution:
```
from bisect import bisect
s = input()
e = "abcdefghijklmnopqrstuvwxyz"
i = 1
ans = 0
for c in s:
t = bisect(e, c)
ans += min(((t+26)-i) % 26, ((i + 26) - t) % 26)
i = t
print(ans)
```
Yes
| 38,185
|
[
0.38037109375,
-0.211669921875,
-0.06689453125,
0.373291015625,
-0.560546875,
-0.474853515625,
-0.07843017578125,
-0.10174560546875,
0.049468994140625,
0.533203125,
0.7607421875,
-0.264404296875,
0.1063232421875,
-0.81787109375,
-0.7373046875,
0.10174560546875,
-0.349365234375,
-0.7890625,
-0.65380859375,
-0.180908203125,
0.09222412109375,
-0.293701171875,
-1.283203125,
-0.226806640625,
-0.6708984375,
0.91943359375,
0.2149658203125,
0.0804443359375,
0.88427734375,
1.0966796875,
-0.093017578125,
-0.30029296875,
1.0205078125,
-1.1376953125,
-0.136474609375,
-0.361572265625,
0.483154296875,
-0.654296875,
0.0958251953125,
-0.533203125,
0.1441650390625,
-0.2078857421875,
0.677734375,
-0.52734375,
-0.96923828125,
-0.10870361328125,
0.010650634765625,
-0.5263671875,
-0.14697265625,
-0.82421875,
0.196533203125,
-0.1927490234375,
0.429443359375,
-0.1976318359375,
-0.06207275390625,
-0.1536865234375,
0.04632568359375,
-0.03204345703125,
-0.5146484375,
0.08428955078125,
0.1427001953125,
0.239990234375,
0.09814453125,
-0.984375,
-0.26123046875,
0.1666259765625,
0.088134765625,
-0.311279296875,
-0.11724853515625,
-0.8505859375,
-0.271240234375,
0.25244140625,
0.0288238525390625,
-0.68408203125,
-0.187255859375,
-0.0380859375,
0.07470703125,
0.11236572265625,
-0.80712890625,
0.5927734375,
0.0235443115234375,
0.7353515625,
-0.1866455078125,
0.24267578125,
-0.477294921875,
-0.459228515625,
0.0082550048828125,
-0.056182861328125,
0.25927734375,
-0.294677734375,
-0.0802001953125,
0.477783203125,
-0.58544921875,
0.1534423828125,
0.7236328125,
0.71875,
-0.430908203125,
0.53369140625,
0.29833984375,
0.294677734375,
0.576171875,
1.03515625,
-0.7900390625,
1.109375,
-0.14453125,
-0.05792236328125,
0.223388671875,
-0.297119140625,
-0.2362060546875,
-0.65576171875,
-0.40966796875,
-0.42041015625,
0.39892578125,
0.26171875,
-0.1336669921875,
0.69921875,
0.256103515625,
0.38427734375,
-0.74609375,
0.493408203125,
0.01220703125,
-0.3369140625,
0.29296875,
-0.32568359375,
-0.08416748046875,
-0.27734375,
-0.377685546875,
0.5732421875,
-0.447998046875,
-0.0604248046875,
0.55908203125,
0.51953125,
-0.007720947265625,
0.42529296875,
-0.14013671875,
0.68798828125,
-0.2359619140625,
0.5654296875,
0.7685546875,
-0.65966796875,
0.228759765625,
-0.45068359375,
0.3916015625,
1.873046875,
0.491455078125,
-0.1658935546875,
0.61572265625,
0.56005859375,
-0.7294921875,
0.9033203125,
-0.623046875,
0.4833984375,
-0.02764892578125,
0.1759033203125,
-0.32568359375,
-0.022186279296875,
-0.420654296875,
0.7294921875,
-0.01525115966796875,
0.406494140625,
-0.6044921875,
0.0103607177734375,
-0.01366424560546875,
0.98876953125,
-0.1051025390625,
0.974609375,
-0.4658203125,
-0.3486328125,
-0.145263671875,
-0.82470703125,
0.13232421875,
-0.159423828125,
-0.0643310546875,
0.5556640625,
0.5654296875,
0.8037109375,
0.72705078125,
-0.060028076171875,
0.68017578125,
0.11651611328125,
-0.3076171875,
0.035125732421875,
0.1025390625,
0.6943359375,
-0.129638671875,
0.28076171875,
-0.06353759765625,
-0.2271728515625,
-0.365478515625,
-0.4892578125,
-0.1029052734375,
0.701171875,
-0.38330078125,
0.1734619140625,
-0.127685546875,
0.12335205078125,
-0.966796875,
-0.07513427734375,
0.07305908203125,
-1.0478515625,
-0.2462158203125,
0.6806640625,
0.03619384765625,
0.54345703125,
-0.2288818359375,
-0.91455078125,
0.34521484375,
1.0732421875,
-0.433349609375,
0.055267333984375,
0.68505859375,
0.329833984375,
-0.297607421875,
0.2381591796875,
0.2144775390625,
-0.309814453125,
-0.83837890625,
0.74267578125,
-0.320068359375,
0.1395263671875,
0.01000213623046875,
0.72265625,
0.231201171875,
0.59130859375,
-0.469970703125,
0.407470703125,
0.284423828125,
1.2060546875,
-0.005062103271484375,
0.53271484375,
0.1312255859375,
1.0166015625,
0.7705078125,
0.90234375,
0.7841796875,
0.1033935546875,
0.51611328125,
0.52294921875,
-0.1090087890625,
0.033111572265625,
0.0662841796875,
0.31396484375,
0.54833984375,
0.39111328125,
-0.1451416015625,
0.52490234375,
0.00711822509765625,
-0.1412353515625,
-0.63623046875,
0.29833984375,
-0.450927734375,
0.85107421875,
-0.201416015625,
0.32373046875,
-0.218994140625,
-0.369140625,
0.363525390625,
0.546875,
-0.419677734375,
-0.4794921875,
0.27197265625,
0.34765625,
0.0016841888427734375,
0.098876953125,
-0.056732177734375,
0.311767578125,
-0.07025146484375,
0.775390625,
-0.353759765625,
-0.3193359375,
-1.033203125,
-0.91455078125,
-0.912109375,
-0.1851806640625,
-0.64599609375,
-0.0992431640625,
0.35498046875,
-0.5927734375,
0.67236328125,
-0.64013671875,
0.07159423828125,
-0.089599609375,
-0.7451171875,
0.67431640625,
-0.0035610198974609375,
0.701171875,
-0.32080078125,
0.509765625,
0.18896484375,
0.828125,
-0.67041015625,
-0.1822509765625,
-0.38134765625,
-0.371826171875,
0.382568359375,
-0.00798797607421875,
0.53564453125,
-0.34375,
-0.8837890625,
-0.74462890625,
-0.410888671875,
-0.031982421875,
-0.5576171875,
0.1807861328125,
-0.494873046875,
0.89453125,
0.55322265625,
-0.83154296875,
0.43310546875,
0.78466796875,
-0.9443359375,
0.388916015625,
0.2432861328125,
-0.027435302734375,
-0.8642578125,
1.2333984375,
0.343505859375,
0.50537109375,
-0.2200927734375,
0.08880615234375,
-0.56884765625,
0.3017578125,
-0.316650390625,
-0.51513671875,
-0.322021484375,
0.4990234375,
0.27197265625,
-1.0703125,
0.60986328125,
-1.005859375,
-0.6005859375,
-0.4404296875,
-0.6376953125,
0.88330078125,
0.75146484375,
-0.038238525390625,
0.192138671875,
-0.138916015625,
0.1419677734375,
0.72509765625,
0.55029296875,
-0.50732421875,
0.1864013671875,
0.4658203125,
-0.59130859375,
0.5205078125,
0.461181640625,
-0.242431640625,
-0.14892578125,
-0.13525390625,
0.1346435546875,
0.2088623046875,
0.265869140625,
0.1689453125,
0.5625,
0.8154296875,
-0.6669921875,
-0.228515625,
-0.63134765625,
1.068359375,
0.451171875,
0.5390625,
0.40234375,
-0.07305908203125,
-0.59375,
-0.8330078125,
0.1483154296875,
0.44873046875,
0.6787109375,
-0.5,
0.81689453125,
0.0631103515625,
-0.55322265625,
0.040863037109375,
-0.595703125,
-0.3857421875,
0.75732421875,
-0.1920166015625,
0.9130859375,
-0.5966796875,
0.107177734375,
-0.482666015625,
-0.01024627685546875,
-0.04425048828125,
0.01486968994140625,
0.626953125,
-0.39013671875,
-0.2491455078125,
-0.55322265625,
-0.25146484375,
-0.038177490234375,
-0.59326171875,
0.10760498046875,
-0.70263671875,
-0.55224609375,
-0.65625,
0.43212890625,
0.9169921875,
0.54443359375,
-0.035430908203125,
0.3642578125,
0.2364501953125,
0.1961669921875,
0.332763671875,
-0.44091796875,
-0.006549835205078125,
-0.68505859375,
0.73046875,
0.38427734375,
-0.46337890625,
-0.54345703125,
-0.36962890625,
-0.62744140625,
0.227783203125,
0.202880859375,
0.0008082389831542969,
-0.658203125,
0.429931640625,
-0.2734375,
0.435791015625,
-0.7392578125,
-0.434326171875,
-0.4091796875,
0.45458984375,
0.697265625,
-0.10235595703125,
0.034881591796875,
-0.640625,
0.5419921875,
0.693359375,
0.0248565673828125,
-0.533203125,
-0.1142578125,
-0.7802734375,
-0.5390625,
0.004291534423828125,
0.79833984375,
0.267333984375,
0.11407470703125,
-1.09375,
0.693359375,
0.319091796875,
-0.6904296875,
-0.1097412109375,
0.328125,
0.11883544921875,
-0.13330078125,
0.68310546875,
-0.25927734375,
-0.5849609375,
0.259765625,
-1,
0.73046875,
-0.281005859375,
0.3896484375,
-0.11614990234375,
-0.1954345703125,
0.27294921875,
0.2890625,
-0.66064453125,
-0.0103759765625,
-0.07476806640625,
0.6474609375,
-1.1005859375,
-0.61376953125,
0.546875,
-0.170654296875,
-0.462890625,
0.59619140625,
-0.240478515625,
-0.3212890625,
0.30322265625,
-0.048736572265625,
-0.5302734375,
0.1407470703125,
-0.4794921875,
0.340087890625,
0.0941162109375,
-0.3076171875,
0.3310546875,
-0.54443359375,
1.1103515625,
0.1431884765625,
-0.55810546875,
-0.23681640625,
-1.0927734375,
-0.26416015625,
-0.31884765625,
-0.640625,
0.038818359375,
0.052703857421875,
-0.1383056640625,
-0.1900634765625,
-0.2978515625,
-0.5986328125,
-0.11553955078125,
-0.666015625,
0.1212158203125,
0.541015625,
0.38232421875,
0.2493896484375,
-0.09173583984375,
-0.5791015625,
0.24365234375,
-0.4638671875,
-0.06475830078125,
-0.475830078125,
-0.03668212890625,
-0.486572265625,
-0.387451171875,
-0.3525390625,
0.343505859375,
-0.32275390625,
0.10833740234375,
0.84765625,
0.51904296875,
0.46630859375,
-0.2264404296875,
-0.469970703125,
0.7822265625,
0.08636474609375,
-1.12890625,
-0.5732421875,
1.025390625,
0.0245513916015625,
0.65576171875,
0.4765625,
-0.60595703125,
-1.0302734375,
-0.919921875,
0.1968994140625,
-0.6474609375,
-0.26171875,
-0.67431640625,
-0.4697265625,
-0.5322265625,
0.432861328125,
-0.09759521484375,
-0.33935546875,
0.32470703125,
-0.78564453125,
0.108642578125,
-0.5771484375,
0.220703125,
-0.544921875,
-0.77685546875,
-0.490234375,
0.8740234375,
0.2286376953125,
0.235107421875,
-0.02117919921875,
0.12225341796875,
0.369140625,
0.1849365234375,
-0.2371826171875,
-0.426513671875,
-0.197265625,
0.52734375,
-0.27783203125,
-0.222900390625,
-0.17041015625,
0.5908203125,
-0.984375,
0.315673828125,
0.0728759765625,
-0.10467529296875,
-0.241943359375,
-0.2314453125,
1.0576171875,
-0.2344970703125,
0.033599853515625,
-0.363525390625,
0.54833984375,
0.72509765625,
-0.2305908203125,
-0.07550048828125,
-0.666015625,
-0.389892578125,
-1.119140625,
0.76416015625,
-0.0433349609375,
0.273193359375,
-0.53271484375,
-0.08245849609375,
1.326171875,
-0.46728515625,
0.367919921875,
1.1708984375,
0.10858154296875,
0.160888671875,
-0.76611328125,
0.59326171875,
0.40966796875,
-0.457763671875,
-0.222900390625,
-0.045166015625,
-0.76953125,
0.46435546875,
-0.30908203125,
-0.92333984375,
-0.619140625,
0.4873046875,
1.119140625,
-0.19482421875,
0.5693359375,
-0.136474609375,
-1.150390625,
-0.5771484375,
0.7412109375,
-0.3251953125,
0.1375732421875,
0.68212890625,
0.03057861328125,
-0.2403564453125,
-0.05255126953125,
-0.07843017578125,
-0.414794921875,
-0.358154296875,
1.1181640625,
-0.32373046875,
-0.82568359375,
1.2607421875,
0.484619140625,
-0.943359375,
-0.97998046875,
0.1185302734375,
-0.0814208984375,
-0.250732421875,
-0.9296875,
0.2998046875,
0.2242431640625,
-0.34619140625,
0.002391815185546875,
0.465087890625,
-0.3779296875,
0.3203125,
0.07269287109375,
0.415283203125,
-0.56298828125,
0.061920166015625,
0.462158203125,
-0.50537109375,
-0.373046875,
-0.94287109375,
-0.2489013671875,
-0.62353515625,
-0.0274505615234375,
0.27294921875,
-0.2802734375,
0.52783203125,
0.482666015625,
0.1802978515625,
0.978515625,
-0.1671142578125,
-0.2220458984375,
0.04150390625,
-0.51953125,
-0.61865234375,
-0.41650390625,
0.342529296875,
-0.39990234375,
-0.0555419921875,
-0.67333984375,
-0.3076171875,
0.4296875,
0.3525390625,
-0.57958984375,
-1.02734375,
-0.351318359375,
-1.0244140625,
-0.58740234375,
-0.36669921875,
-0.580078125,
-0.32421875,
-0.0849609375,
0.0283050537109375,
-0.378662109375,
0.1058349609375,
0.54296875,
-0.2265625,
0.7109375,
-0.35009765625,
0.4560546875,
-0.8203125,
-0.06292724609375,
-0.4658203125,
0.34375,
-0.470703125,
-0.0882568359375,
-0.66796875,
0.092041015625,
0.150390625,
0.5673828125,
-0.303955078125,
0.296630859375,
0.1513671875,
-0.354248046875,
0.07952880859375,
0.1427001953125,
-0.1279296875,
0.53564453125,
0.7626953125,
-0.1326904296875,
0.556640625,
-0.216552734375,
-0.53173828125,
-0.12353515625,
0.64208984375,
0.43701171875,
-0.2080078125,
-0.159912109375,
-0.1053466796875,
0.41064453125,
-0.83447265625,
0.35107421875,
-0.255615234375,
0.396728515625,
0.0008335113525390625,
-0.2900390625,
0.497314453125,
0.78271484375,
0.11358642578125,
0.182373046875,
-0.035247802734375,
0.1336669921875,
-0.00553131103515625,
0.292236328125,
0.177490234375,
0.5166015625,
0.1422119140625,
-0.390869140625,
-0.0960693359375,
0.30322265625,
-0.336181640625,
0.55224609375,
-0.364990234375,
-0.51953125,
-0.84423828125,
-0.127685546875,
-0.0246429443359375,
0.77392578125,
0.642578125,
-0.53173828125,
0.060211181640625,
-0.2197265625,
-0.6845703125,
0.15283203125,
-1.283203125,
-0.9326171875,
0.27880859375,
-0.06396484375,
-0.266357421875,
-0.2454833984375,
-0.60302734375,
-0.07147216796875,
-0.037384033203125,
0.69677734375,
-0.69921875,
0.421875,
-0.01190185546875,
0.68701171875,
-0.50537109375,
0.35302734375,
0.309814453125,
0.69873046875,
-0.41357421875,
-0.478271484375,
-0.07598876953125,
1.232421875,
0.08538818359375,
0.02532958984375,
-0.3955078125,
0.03619384765625,
0.00339508056640625,
0.1810302734375,
-0.249267578125,
-0.083984375,
-0.42724609375,
1.123046875,
-0.85791015625,
0.10693359375,
0.2235107421875,
0.44873046875,
0.06927490234375,
-0.486328125,
-0.58056640625,
0.96142578125,
1.0791015625,
0.230224609375,
0.5791015625,
0.53369140625,
0.49169921875,
-0.368408203125,
-0.12359619140625,
-0.283203125,
0.8662109375,
0.42138671875,
0.45458984375,
-0.1981201171875,
0.6298828125,
0.8349609375,
0.048736572265625,
-0.2252197265625,
0.49658203125,
0.2305908203125,
-0.34375,
0.330322265625,
0.0562744140625,
-0.036865234375,
-0.2303466796875,
-0.207763671875,
0.541015625,
-0.353271484375,
-0.11431884765625,
-0.169921875,
-0.7333984375,
0.83642578125,
-0.10675048828125,
-0.49560546875,
0.63427734375,
-0.44970703125,
0.39501953125,
0.334716796875,
0.2139892578125,
-0.01244354248046875,
0.91845703125,
0.8173828125,
0.29052734375,
0.373779296875,
0.72509765625,
0.219482421875,
-0.86767578125,
0.0894775390625,
0.595703125,
-0.0205230712890625,
-0.378173828125,
-0.61181640625,
-0.9931640625,
0.74462890625,
-0.274169921875,
-0.26611328125,
0.259033203125,
-0.77734375,
0.09222412109375,
-0.685546875,
1.0166015625,
-0.7265625,
0.394287109375,
0.323486328125,
0.04986572265625,
-0.466796875,
1.072265625,
-0.300048828125,
0.380859375,
0.155029296875,
1.25,
0.19482421875,
1.255859375,
0.82421875,
-0.324951171875,
-0.1964111328125,
0.459228515625,
-0.5087890625,
-0.5234375,
-0.193115234375,
-0.256591796875,
-0.1964111328125,
-0.98681640625,
-0.406494140625,
-0.460205078125,
1.1279296875,
0.034332275390625,
-0.79541015625,
-0.330078125,
0.259765625,
-0.98681640625,
0.56982421875,
0.1514892578125,
0.31982421875,
0.2724609375,
0.2337646484375,
-0.364013671875,
-0.60498046875,
0.072265625,
-0.529296875,
0.3076171875,
-0.6201171875,
-0.388427734375,
-0.759765625,
-0.74853515625,
-0.55908203125,
0.14404296875,
-0.64404296875,
-0.87744140625,
0.31982421875,
0.42919921875,
0.465087890625,
0.322021484375,
-0.11859130859375,
-0.1156005859375,
0.86083984375,
0.80224609375,
0.445556640625,
0.91650390625,
0.266845703125,
-0.02069091796875,
0.0772705078125,
-0.7470703125,
0.441162109375,
-0.427978515625,
0.50048828125,
0.1339111328125,
-0.00588226318359375,
-0.60888671875,
-1.296875,
-0.20947265625,
0.1893310546875,
0.429931640625,
-0.60693359375,
-1.0537109375,
-0.662109375,
-0.85546875,
-0.2457275390625,
-0.45556640625,
0.66796875,
0.06695556640625,
0.169189453125,
-0.416015625,
-1.2548828125,
4.51953125,
1.140625,
0.818359375,
0.474365234375,
0.1317138671875,
0.818359375,
0.751953125,
-0.5078125,
-0.06878662109375,
-0.30224609375,
0.337158203125,
-0.0645751953125,
0.08343505859375,
0.82666015625,
0.5048828125,
0.5732421875,
-0.7841796875,
-0.239013671875,
0.0026683807373046875,
-1.037109375,
-0.7509765625,
0.0187530517578125,
-0.276611328125,
0.217041015625,
-0.27978515625,
0.15576171875,
0.84130859375,
-0.83203125,
-0.72705078125,
-0.52978515625,
0.1785888671875,
-0.311767578125,
0.84326171875,
0.10089111328125,
-0.50048828125,
0.45166015625,
-0.1221923828125,
-0.6865234375,
-0.288818359375,
0.322021484375,
-0.1497802734375,
-0.09991455078125,
0.87158203125,
-0.2371826171875,
0.00594329833984375,
0.55517578125,
-0.53857421875,
0.58837890625,
0.517578125,
-0.91064453125,
0.85009765625,
-0.1341552734375,
0.401611328125,
-0.24365234375,
-0.6435546875,
-0.027984619140625,
0.1295166015625,
-0.103271484375,
-0.374267578125,
0.6630859375,
0.38720703125,
0.27294921875,
-0.1143798828125,
0.400146484375,
-0.8203125,
0.6796875,
-0.51318359375,
0.468994140625,
-0.52978515625,
0.1717529296875,
-0.1519775390625,
-0.20556640625,
-0.333251953125,
-0.328857421875,
0.6591796875,
0.380859375,
-0.380615234375,
0.1534423828125,
0.333251953125,
-0.673828125,
0.1392822265625,
-0.061279296875,
-0.26904296875,
-0.19970703125,
0.40576171875,
1.08984375,
-0.72998046875,
-0.689453125,
-0.44873046875,
0.4755859375,
0.64013671875,
0.313232421875,
0.0318603515625,
-0.63525390625,
-0.24462890625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Submitted Solution:
```
str = input()
ch = 'a'
total = 0
for i in str:
dis = abs(ord(ch) - ord(i))
if dis < 13:
total += dis
else:
total = total + (26 - dis)
ch = i
print(total)
```
Yes
| 38,186
|
[
0.394287109375,
-0.225830078125,
-0.06317138671875,
0.355712890625,
-0.5361328125,
-0.4814453125,
-0.11126708984375,
-0.050140380859375,
0.0609130859375,
0.477783203125,
0.7080078125,
-0.315185546875,
0.06060791015625,
-0.7392578125,
-0.71875,
0.117431640625,
-0.34619140625,
-0.7421875,
-0.60791015625,
-0.189453125,
0.1009521484375,
-0.254150390625,
-1.267578125,
-0.251953125,
-0.6796875,
0.9423828125,
0.233154296875,
0.1722412109375,
0.9599609375,
1.126953125,
-0.115966796875,
-0.345703125,
1.0087890625,
-1.1533203125,
-0.10052490234375,
-0.377197265625,
0.447509765625,
-0.6240234375,
0.1397705078125,
-0.53369140625,
0.1627197265625,
-0.154541015625,
0.65869140625,
-0.51220703125,
-0.99169921875,
-0.062042236328125,
0.0023097991943359375,
-0.475341796875,
-0.1319580078125,
-0.74951171875,
0.201416015625,
-0.1981201171875,
0.49560546875,
-0.255859375,
-0.037261962890625,
-0.1767578125,
0.04833984375,
-0.01611328125,
-0.58154296875,
0.09197998046875,
0.153564453125,
0.2381591796875,
0.12225341796875,
-0.99658203125,
-0.214599609375,
0.1790771484375,
0.1202392578125,
-0.34326171875,
-0.06097412109375,
-0.84619140625,
-0.301025390625,
0.25634765625,
0.003448486328125,
-0.677734375,
-0.2998046875,
-0.047637939453125,
0.00966644287109375,
0.198486328125,
-0.787109375,
0.5244140625,
0.014434814453125,
0.72021484375,
-0.140869140625,
0.2366943359375,
-0.5361328125,
-0.43896484375,
0.039886474609375,
-0.08282470703125,
0.223388671875,
-0.29150390625,
-0.10986328125,
0.5087890625,
-0.64599609375,
0.115234375,
0.716796875,
0.7060546875,
-0.43798828125,
0.474609375,
0.361083984375,
0.292724609375,
0.625,
0.93408203125,
-0.71240234375,
1.095703125,
-0.1365966796875,
-0.08050537109375,
0.217041015625,
-0.267578125,
-0.290283203125,
-0.59326171875,
-0.3994140625,
-0.4140625,
0.53857421875,
0.277099609375,
-0.12445068359375,
0.673828125,
0.2244873046875,
0.42236328125,
-0.75732421875,
0.475341796875,
0.079833984375,
-0.29150390625,
0.30126953125,
-0.2890625,
-0.064453125,
-0.19873046875,
-0.38720703125,
0.58349609375,
-0.430419921875,
-0.0026493072509765625,
0.52001953125,
0.50830078125,
0.00356292724609375,
0.438720703125,
-0.1441650390625,
0.70751953125,
-0.170654296875,
0.6650390625,
0.76953125,
-0.69580078125,
0.2626953125,
-0.43603515625,
0.426025390625,
1.85546875,
0.47021484375,
-0.1815185546875,
0.650390625,
0.55615234375,
-0.79443359375,
0.859375,
-0.5693359375,
0.444091796875,
-0.0135498046875,
0.1700439453125,
-0.326904296875,
-0.02685546875,
-0.41552734375,
0.70166015625,
-0.035125732421875,
0.42578125,
-0.53369140625,
0.02392578125,
-0.0692138671875,
0.9462890625,
-0.03070068359375,
0.9150390625,
-0.401611328125,
-0.4091796875,
-0.1490478515625,
-0.8837890625,
0.158203125,
-0.1632080078125,
-0.0731201171875,
0.59228515625,
0.57861328125,
0.81982421875,
0.8330078125,
-0.03521728515625,
0.63330078125,
0.150146484375,
-0.31396484375,
0.0968017578125,
0.1575927734375,
0.67431640625,
-0.090576171875,
0.302490234375,
0.0055084228515625,
-0.2105712890625,
-0.37890625,
-0.4951171875,
-0.10955810546875,
0.671875,
-0.37646484375,
0.19921875,
-0.13134765625,
0.10308837890625,
-0.998046875,
-0.0210418701171875,
0.08026123046875,
-1.0400390625,
-0.29833984375,
0.626953125,
-0.07330322265625,
0.45458984375,
-0.303955078125,
-0.9052734375,
0.310791015625,
1.1064453125,
-0.453857421875,
0.061981201171875,
0.69140625,
0.344970703125,
-0.2396240234375,
0.2088623046875,
0.177978515625,
-0.2890625,
-0.8447265625,
0.71044921875,
-0.354736328125,
0.148681640625,
0.059783935546875,
0.73388671875,
0.1719970703125,
0.59375,
-0.4013671875,
0.3447265625,
0.30224609375,
1.1806640625,
-0.017364501953125,
0.5498046875,
0.1463623046875,
1.0439453125,
0.84228515625,
0.90087890625,
0.74560546875,
0.08636474609375,
0.51513671875,
0.5166015625,
-0.00821685791015625,
-0.02252197265625,
0.07183837890625,
0.311767578125,
0.583984375,
0.3837890625,
-0.1605224609375,
0.5146484375,
-0.06915283203125,
-0.1348876953125,
-0.64208984375,
0.3203125,
-0.33447265625,
0.837890625,
-0.1484375,
0.331787109375,
-0.254638671875,
-0.25439453125,
0.41748046875,
0.580078125,
-0.398681640625,
-0.51513671875,
0.2437744140625,
0.35107421875,
0.07025146484375,
0.057373046875,
-0.04571533203125,
0.235107421875,
-0.07135009765625,
0.8515625,
-0.38818359375,
-0.309326171875,
-1.1005859375,
-0.96533203125,
-0.89404296875,
-0.15869140625,
-0.630859375,
-0.044830322265625,
0.424072265625,
-0.599609375,
0.68408203125,
-0.65234375,
0.07501220703125,
-0.09765625,
-0.71142578125,
0.7060546875,
0.0711669921875,
0.72509765625,
-0.34716796875,
0.453125,
0.1910400390625,
0.806640625,
-0.66943359375,
-0.2122802734375,
-0.435791015625,
-0.329345703125,
0.41064453125,
-0.0306243896484375,
0.5322265625,
-0.428466796875,
-0.9453125,
-0.79736328125,
-0.29052734375,
-0.012054443359375,
-0.5048828125,
0.203857421875,
-0.5341796875,
0.8779296875,
0.51611328125,
-0.94140625,
0.45166015625,
0.798828125,
-0.93212890625,
0.47509765625,
0.31494140625,
0.0462646484375,
-0.87158203125,
1.158203125,
0.363037109375,
0.5595703125,
-0.233154296875,
0.01470947265625,
-0.56640625,
0.300048828125,
-0.337890625,
-0.568359375,
-0.298583984375,
0.444091796875,
0.24267578125,
-1.0625,
0.6328125,
-1.0654296875,
-0.61474609375,
-0.492431640625,
-0.60205078125,
0.82470703125,
0.68408203125,
-0.030548095703125,
0.19091796875,
-0.12066650390625,
0.1910400390625,
0.7177734375,
0.485107421875,
-0.50439453125,
0.2041015625,
0.487548828125,
-0.6552734375,
0.53515625,
0.4658203125,
-0.2452392578125,
-0.157958984375,
-0.135009765625,
0.078857421875,
0.1815185546875,
0.2467041015625,
0.1981201171875,
0.6025390625,
0.8271484375,
-0.568359375,
-0.2425537109375,
-0.66943359375,
1.0185546875,
0.388427734375,
0.51513671875,
0.41455078125,
-0.09619140625,
-0.56787109375,
-0.796875,
0.203369140625,
0.4296875,
0.71826171875,
-0.537109375,
0.72705078125,
0.0253448486328125,
-0.64599609375,
0.08404541015625,
-0.615234375,
-0.430908203125,
0.8134765625,
-0.197509765625,
0.83447265625,
-0.642578125,
0.0653076171875,
-0.413818359375,
-0.036285400390625,
-0.0185699462890625,
0.061248779296875,
0.6533203125,
-0.29833984375,
-0.19775390625,
-0.580078125,
-0.2198486328125,
0.0064239501953125,
-0.60595703125,
0.16455078125,
-0.70751953125,
-0.51513671875,
-0.64404296875,
0.4521484375,
0.94482421875,
0.48291015625,
-0.09814453125,
0.341064453125,
0.1463623046875,
0.2159423828125,
0.38720703125,
-0.4375,
-0.01326751708984375,
-0.677734375,
0.77001953125,
0.392578125,
-0.45947265625,
-0.55419921875,
-0.31982421875,
-0.68212890625,
0.1759033203125,
0.2183837890625,
-0.05694580078125,
-0.6298828125,
0.5107421875,
-0.2333984375,
0.4501953125,
-0.75830078125,
-0.29833984375,
-0.382568359375,
0.491455078125,
0.69775390625,
-0.09576416015625,
0.00852203369140625,
-0.63525390625,
0.568359375,
0.68408203125,
0.0089111328125,
-0.59912109375,
-0.127197265625,
-0.73779296875,
-0.56396484375,
-0.07080078125,
0.74853515625,
0.30322265625,
0.131103515625,
-1.1328125,
0.71142578125,
0.283935546875,
-0.71142578125,
-0.08026123046875,
0.3212890625,
0.10296630859375,
-0.1583251953125,
0.646484375,
-0.1956787109375,
-0.642578125,
0.219482421875,
-1.052734375,
0.65478515625,
-0.280517578125,
0.409912109375,
-0.0987548828125,
-0.1417236328125,
0.2003173828125,
0.2734375,
-0.6630859375,
-0.049041748046875,
-0.09033203125,
0.6513671875,
-1.0673828125,
-0.56494140625,
0.556640625,
-0.1278076171875,
-0.47998046875,
0.64794921875,
-0.28857421875,
-0.352294921875,
0.309814453125,
-0.0271148681640625,
-0.51416015625,
0.07171630859375,
-0.45458984375,
0.38427734375,
0.0687255859375,
-0.260986328125,
0.30322265625,
-0.587890625,
1.1181640625,
0.139892578125,
-0.599609375,
-0.12359619140625,
-1.087890625,
-0.288330078125,
-0.238037109375,
-0.68798828125,
0.07110595703125,
0.0026531219482421875,
-0.1993408203125,
-0.173828125,
-0.32568359375,
-0.58740234375,
-0.08612060546875,
-0.65283203125,
0.167236328125,
0.55419921875,
0.3662109375,
0.23046875,
-0.1488037109375,
-0.59423828125,
0.288818359375,
-0.419189453125,
-0.0433349609375,
-0.477783203125,
-0.069091796875,
-0.453125,
-0.344970703125,
-0.435546875,
0.421630859375,
-0.38818359375,
0.0909423828125,
0.888671875,
0.45263671875,
0.441162109375,
-0.1861572265625,
-0.46728515625,
0.70849609375,
0.054473876953125,
-1.2060546875,
-0.58740234375,
1.0478515625,
0.07904052734375,
0.63916015625,
0.46826171875,
-0.55126953125,
-1.0810546875,
-1.0166015625,
0.2054443359375,
-0.59619140625,
-0.2398681640625,
-0.75390625,
-0.416015625,
-0.55712890625,
0.4306640625,
-0.129638671875,
-0.31689453125,
0.331298828125,
-0.85888671875,
0.140625,
-0.61865234375,
0.1595458984375,
-0.494384765625,
-0.77880859375,
-0.4970703125,
0.91064453125,
0.2607421875,
0.280517578125,
-0.042877197265625,
0.0667724609375,
0.37255859375,
0.230224609375,
-0.25341796875,
-0.499267578125,
-0.171142578125,
0.55517578125,
-0.319091796875,
-0.1651611328125,
-0.126708984375,
0.6376953125,
-0.9599609375,
0.315673828125,
0.107666015625,
-0.081787109375,
-0.1932373046875,
-0.32861328125,
1.060546875,
-0.352783203125,
-0.042633056640625,
-0.395263671875,
0.56005859375,
0.65283203125,
-0.2861328125,
-0.08984375,
-0.61572265625,
-0.352294921875,
-1.0869140625,
0.755859375,
-0.049041748046875,
0.290771484375,
-0.5126953125,
-0.11932373046875,
1.294921875,
-0.455810546875,
0.358154296875,
1.177734375,
0.1422119140625,
0.169677734375,
-0.734375,
0.60595703125,
0.394775390625,
-0.421142578125,
-0.2435302734375,
-0.0164337158203125,
-0.79248046875,
0.44873046875,
-0.269775390625,
-0.95068359375,
-0.59228515625,
0.493408203125,
1.16015625,
-0.2479248046875,
0.6162109375,
-0.178955078125,
-1.203125,
-0.5654296875,
0.74072265625,
-0.278076171875,
0.136962890625,
0.70166015625,
0.027618408203125,
-0.270263671875,
-0.054107666015625,
-0.01369476318359375,
-0.448486328125,
-0.35107421875,
1.0966796875,
-0.34716796875,
-0.767578125,
1.2158203125,
0.52734375,
-0.921875,
-0.974609375,
0.09149169921875,
-0.138427734375,
-0.271484375,
-0.9462890625,
0.303955078125,
0.1861572265625,
-0.33203125,
-0.06640625,
0.423583984375,
-0.3095703125,
0.284912109375,
0.07275390625,
0.3935546875,
-0.6015625,
-0.01287841796875,
0.4228515625,
-0.454345703125,
-0.3720703125,
-0.9091796875,
-0.1910400390625,
-0.53173828125,
-0.030914306640625,
0.388916015625,
-0.364013671875,
0.47607421875,
0.492919921875,
0.151611328125,
0.95654296875,
-0.18896484375,
-0.18896484375,
0.0736083984375,
-0.44775390625,
-0.60888671875,
-0.445556640625,
0.298828125,
-0.38232421875,
-0.10723876953125,
-0.6748046875,
-0.34521484375,
0.4267578125,
0.383056640625,
-0.52197265625,
-1.0810546875,
-0.369873046875,
-1.08203125,
-0.638671875,
-0.361572265625,
-0.50537109375,
-0.324951171875,
-0.10638427734375,
0.049102783203125,
-0.392822265625,
0.06671142578125,
0.5283203125,
-0.220703125,
0.74755859375,
-0.392333984375,
0.379150390625,
-0.81494140625,
-0.052398681640625,
-0.529296875,
0.39453125,
-0.54541015625,
-0.1397705078125,
-0.6064453125,
0.1297607421875,
0.1510009765625,
0.54736328125,
-0.3330078125,
0.32421875,
0.2139892578125,
-0.36962890625,
0.0047607421875,
0.160888671875,
-0.1483154296875,
0.60986328125,
0.7890625,
-0.15478515625,
0.54638671875,
-0.2445068359375,
-0.544921875,
-0.1336669921875,
0.5966796875,
0.4267578125,
-0.1490478515625,
-0.201904296875,
-0.137939453125,
0.339111328125,
-0.919921875,
0.3056640625,
-0.288818359375,
0.408935546875,
-0.03375244140625,
-0.2626953125,
0.55126953125,
0.70703125,
0.0679931640625,
0.141357421875,
-0.07904052734375,
0.160400390625,
0.0103912353515625,
0.27294921875,
0.2139892578125,
0.53515625,
0.1033935546875,
-0.452880859375,
-0.09942626953125,
0.27734375,
-0.35791015625,
0.58984375,
-0.45556640625,
-0.54443359375,
-0.83154296875,
-0.11004638671875,
0.005603790283203125,
0.76953125,
0.62353515625,
-0.62158203125,
-0.023956298828125,
-0.2064208984375,
-0.7158203125,
0.09967041015625,
-1.291015625,
-0.92529296875,
0.28076171875,
-0.07916259765625,
-0.2364501953125,
-0.264404296875,
-0.5732421875,
-0.044586181640625,
-0.10662841796875,
0.67919921875,
-0.7646484375,
0.39697265625,
0.020904541015625,
0.69873046875,
-0.599609375,
0.307373046875,
0.29052734375,
0.72314453125,
-0.40380859375,
-0.478271484375,
-0.060333251953125,
1.275390625,
0.11871337890625,
0.132568359375,
-0.413330078125,
0.1263427734375,
0.049346923828125,
0.155517578125,
-0.302001953125,
-0.0523681640625,
-0.41796875,
1.1142578125,
-0.86279296875,
0.09173583984375,
0.188232421875,
0.44140625,
0.1287841796875,
-0.5,
-0.55224609375,
0.93896484375,
1.0439453125,
0.17724609375,
0.5166015625,
0.5361328125,
0.53759765625,
-0.32470703125,
-0.11322021484375,
-0.342529296875,
0.85595703125,
0.42626953125,
0.4814453125,
-0.1881103515625,
0.58642578125,
0.81591796875,
-0.004840850830078125,
-0.201171875,
0.490966796875,
0.309814453125,
-0.345947265625,
0.358154296875,
0.004764556884765625,
-0.020111083984375,
-0.189697265625,
-0.19921875,
0.55810546875,
-0.383056640625,
-0.0242462158203125,
-0.235107421875,
-0.66357421875,
0.8330078125,
-0.1641845703125,
-0.4638671875,
0.6982421875,
-0.4658203125,
0.4423828125,
0.30908203125,
0.18994140625,
-0.017181396484375,
0.8544921875,
0.8876953125,
0.35400390625,
0.419189453125,
0.69921875,
0.296875,
-0.91259765625,
0.04522705078125,
0.63330078125,
0.015167236328125,
-0.32275390625,
-0.60888671875,
-0.9208984375,
0.74560546875,
-0.301025390625,
-0.276611328125,
0.3134765625,
-0.76123046875,
0.09686279296875,
-0.67919921875,
0.9638671875,
-0.70751953125,
0.34765625,
0.2822265625,
0.08453369140625,
-0.5595703125,
1.099609375,
-0.34716796875,
0.40283203125,
0.2509765625,
1.3115234375,
0.1553955078125,
1.3076171875,
0.83740234375,
-0.273681640625,
-0.158203125,
0.5458984375,
-0.439453125,
-0.5048828125,
-0.1380615234375,
-0.2427978515625,
-0.252685546875,
-0.97119140625,
-0.3759765625,
-0.477294921875,
1.1259765625,
0.0770263671875,
-0.869140625,
-0.2548828125,
0.2822265625,
-0.9951171875,
0.57373046875,
0.1375732421875,
0.330322265625,
0.26611328125,
0.20751953125,
-0.32080078125,
-0.5869140625,
0.05938720703125,
-0.51025390625,
0.349365234375,
-0.63330078125,
-0.39453125,
-0.7958984375,
-0.78662109375,
-0.474609375,
0.1568603515625,
-0.5673828125,
-0.896484375,
0.31494140625,
0.423828125,
0.451171875,
0.31884765625,
-0.10528564453125,
-0.1708984375,
0.97998046875,
0.841796875,
0.42578125,
0.9375,
0.2154541015625,
0.050506591796875,
0.029754638671875,
-0.73095703125,
0.483642578125,
-0.41796875,
0.481689453125,
0.0894775390625,
0.04486083984375,
-0.576171875,
-1.345703125,
-0.1881103515625,
0.265869140625,
0.39404296875,
-0.53662109375,
-1.0751953125,
-0.666015625,
-0.8486328125,
-0.244140625,
-0.5009765625,
0.67919921875,
-0.045745849609375,
0.1282958984375,
-0.390625,
-1.2822265625,
4.5,
1.1396484375,
0.82958984375,
0.54736328125,
0.1500244140625,
0.85302734375,
0.75927734375,
-0.5615234375,
-0.163818359375,
-0.3203125,
0.30517578125,
-0.09405517578125,
0.0792236328125,
0.81689453125,
0.484619140625,
0.59619140625,
-0.7841796875,
-0.1798095703125,
0.005260467529296875,
-1.0595703125,
-0.7314453125,
-0.0210113525390625,
-0.259033203125,
0.2197265625,
-0.29541015625,
0.16748046875,
0.869140625,
-0.76708984375,
-0.71337890625,
-0.5166015625,
0.15966796875,
-0.394287109375,
0.92041015625,
0.125244140625,
-0.43994140625,
0.452392578125,
-0.19775390625,
-0.68896484375,
-0.28564453125,
0.26123046875,
-0.206787109375,
-0.11083984375,
0.89111328125,
-0.29345703125,
0.020965576171875,
0.546875,
-0.5107421875,
0.6474609375,
0.4619140625,
-0.875,
0.90869140625,
-0.127685546875,
0.37158203125,
-0.30859375,
-0.67431640625,
0.03466796875,
0.10296630859375,
-0.08404541015625,
-0.384033203125,
0.67822265625,
0.354736328125,
0.27734375,
-0.1297607421875,
0.4423828125,
-0.85009765625,
0.6650390625,
-0.50390625,
0.459228515625,
-0.484619140625,
0.122802734375,
-0.1890869140625,
-0.267333984375,
-0.370361328125,
-0.323974609375,
0.6904296875,
0.421875,
-0.3681640625,
0.1739501953125,
0.3154296875,
-0.63623046875,
0.1624755859375,
-0.06732177734375,
-0.27685546875,
-0.30908203125,
0.41943359375,
1.154296875,
-0.7734375,
-0.60791015625,
-0.505859375,
0.50390625,
0.71142578125,
0.297119140625,
0.01151275634765625,
-0.6669921875,
-0.2464599609375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Submitted Solution:
```
#Sereja And Dima
"""n=int(input())
list1=list(map(int,input().split()))
Sereja=0
Dima=0
list2=list1
for i in range(len(list2)):
maximum=max(list1[0],list1[-1])
if i%2==0:
Sereja+=maximum
else:
Dima+=maximum
list1.remove(maximum)
print(Sereja,Dima)"""
#Magnets
"""n=int(input())
list1=[]
count=0
for i in range(n):
s=input()
list1.append(s)
for i in range(len(list1)):
if i<len(list1)-1:
if list1[i]!=list1[i+1]:
count+=1
else:
pass
print(count+1)"""
#Stones on the Table
"""n=int(input())
s=input()
count=0
for i in range(n):
if i<n-1:
if s[i]==s[i+1]:
count+=1
else:
pass
print(count)"""
#Police Recruits
"""n=int(input())
list1=list(map(int,input().split()))
sum1=0
count=0
for i in list1:
sum1+=i
if sum1<0:
count+=1
sum1=0
print(count)"""
#Black Square
"""sum1=0
list1=list(map(int,input().split()))
s=input()
for i in s:
if i==str(1):
sum1+=list1[0]
if i==str(2):
sum1+=list1[1]
if i==str(3):
sum1+=list1[2]
if i==str(4):
sum1+=list1[3]
print(sum1)"""
#Night At The Museum
word=input()
turns=0
for i in word:
if i==word[0]:
turns+=min(abs((26-ord(i)+ord("a"))),abs(ord(i)-ord("a")))
k=word[0]
if i!=word[0]:
turns+=min(abs((26-abs(ord(i)-ord(k)))),abs((ord(i)-ord(k))))
k=i
print(turns)
```
No
| 38,187
|
[
0.4130859375,
-0.210205078125,
-0.055328369140625,
0.361083984375,
-0.51416015625,
-0.486572265625,
-0.15478515625,
-0.0460205078125,
0.051666259765625,
0.5380859375,
0.73486328125,
-0.299072265625,
0.060333251953125,
-0.7333984375,
-0.69873046875,
0.1363525390625,
-0.336669921875,
-0.73681640625,
-0.6083984375,
-0.176025390625,
0.09185791015625,
-0.216796875,
-1.2724609375,
-0.2340087890625,
-0.693359375,
0.91943359375,
0.25244140625,
0.15283203125,
0.94970703125,
1.150390625,
-0.0860595703125,
-0.369873046875,
0.9892578125,
-1.130859375,
-0.07806396484375,
-0.36328125,
0.46142578125,
-0.6142578125,
0.1566162109375,
-0.53369140625,
0.1346435546875,
-0.179931640625,
0.66455078125,
-0.5390625,
-0.98779296875,
-0.06597900390625,
0.026519775390625,
-0.44970703125,
-0.11358642578125,
-0.77392578125,
0.2318115234375,
-0.2037353515625,
0.48974609375,
-0.2442626953125,
-0.03265380859375,
-0.1611328125,
0.0238800048828125,
-0.038970947265625,
-0.60986328125,
0.11676025390625,
0.163330078125,
0.2685546875,
0.139892578125,
-1.029296875,
-0.2130126953125,
0.2139892578125,
0.0963134765625,
-0.370849609375,
-0.0750732421875,
-0.8232421875,
-0.31298828125,
0.2406005859375,
-0.00051116943359375,
-0.62744140625,
-0.30517578125,
-0.059326171875,
0.012481689453125,
0.18310546875,
-0.7890625,
0.52490234375,
0.043731689453125,
0.71826171875,
-0.1602783203125,
0.274169921875,
-0.5478515625,
-0.487548828125,
0.058807373046875,
-0.0831298828125,
0.2225341796875,
-0.31689453125,
-0.141845703125,
0.50244140625,
-0.6162109375,
0.06121826171875,
0.7099609375,
0.69677734375,
-0.458984375,
0.450439453125,
0.365234375,
0.230712890625,
0.59619140625,
0.927734375,
-0.74365234375,
1.0810546875,
-0.150146484375,
-0.052215576171875,
0.2352294921875,
-0.272705078125,
-0.2919921875,
-0.60888671875,
-0.38916015625,
-0.412841796875,
0.5029296875,
0.276123046875,
-0.145263671875,
0.70751953125,
0.27880859375,
0.426513671875,
-0.74853515625,
0.4794921875,
0.07342529296875,
-0.311279296875,
0.300537109375,
-0.294677734375,
-0.049896240234375,
-0.2529296875,
-0.3828125,
0.62939453125,
-0.433837890625,
0.0191192626953125,
0.5615234375,
0.4833984375,
0.00392913818359375,
0.42529296875,
-0.1427001953125,
0.7412109375,
-0.1708984375,
0.6943359375,
0.78564453125,
-0.6962890625,
0.264404296875,
-0.41845703125,
0.43212890625,
1.8623046875,
0.49169921875,
-0.1451416015625,
0.65576171875,
0.57958984375,
-0.79541015625,
0.861328125,
-0.5703125,
0.460693359375,
-0.031402587890625,
0.1646728515625,
-0.3388671875,
-0.0343017578125,
-0.41064453125,
0.67724609375,
-0.0118255615234375,
0.389892578125,
-0.5283203125,
0.042999267578125,
-0.07159423828125,
0.939453125,
-0.044403076171875,
0.9189453125,
-0.39208984375,
-0.40185546875,
-0.155517578125,
-0.8515625,
0.130615234375,
-0.1573486328125,
-0.06353759765625,
0.61328125,
0.60205078125,
0.83740234375,
0.81982421875,
-0.007297515869140625,
0.623046875,
0.17724609375,
-0.320556640625,
0.10394287109375,
0.1416015625,
0.65380859375,
-0.0853271484375,
0.30419921875,
0.025970458984375,
-0.2294921875,
-0.34326171875,
-0.467529296875,
-0.1273193359375,
0.70068359375,
-0.41455078125,
0.20947265625,
-0.12310791015625,
0.103271484375,
-1.0126953125,
-0.0192413330078125,
0.0894775390625,
-1.0712890625,
-0.35205078125,
0.615234375,
-0.048126220703125,
0.47216796875,
-0.31103515625,
-0.9404296875,
0.288818359375,
1.099609375,
-0.454345703125,
0.055389404296875,
0.67724609375,
0.349853515625,
-0.233642578125,
0.1904296875,
0.1834716796875,
-0.25537109375,
-0.83984375,
0.66455078125,
-0.347900390625,
0.160400390625,
0.08599853515625,
0.75390625,
0.1783447265625,
0.58251953125,
-0.416015625,
0.322265625,
0.280517578125,
1.185546875,
-0.01111602783203125,
0.57177734375,
0.166748046875,
1.0771484375,
0.8505859375,
0.900390625,
0.79638671875,
0.060791015625,
0.5283203125,
0.5263671875,
-0.007541656494140625,
-0.038970947265625,
0.0699462890625,
0.321533203125,
0.57763671875,
0.399169921875,
-0.165771484375,
0.52099609375,
-0.04296875,
-0.1231689453125,
-0.6162109375,
0.337646484375,
-0.307861328125,
0.83740234375,
-0.17626953125,
0.339111328125,
-0.2496337890625,
-0.254638671875,
0.392578125,
0.607421875,
-0.37841796875,
-0.53076171875,
0.1929931640625,
0.3525390625,
0.092041015625,
0.0673828125,
-0.016815185546875,
0.24755859375,
-0.06451416015625,
0.796875,
-0.3955078125,
-0.35302734375,
-1.1064453125,
-0.98486328125,
-0.90771484375,
-0.1820068359375,
-0.63916015625,
-0.0703125,
0.402099609375,
-0.62158203125,
0.6416015625,
-0.6435546875,
0.067138671875,
-0.09686279296875,
-0.69091796875,
0.744140625,
0.052520751953125,
0.6904296875,
-0.389404296875,
0.446044921875,
0.227294921875,
0.806640625,
-0.64013671875,
-0.22119140625,
-0.419921875,
-0.367431640625,
0.40478515625,
0.0087890625,
0.53369140625,
-0.41943359375,
-0.943359375,
-0.81005859375,
-0.34716796875,
-0.007770538330078125,
-0.5146484375,
0.1688232421875,
-0.52978515625,
0.88232421875,
0.51953125,
-0.94775390625,
0.47216796875,
0.82080078125,
-0.91552734375,
0.458740234375,
0.314453125,
0.04437255859375,
-0.884765625,
1.19140625,
0.36328125,
0.578125,
-0.2120361328125,
0.0360107421875,
-0.5791015625,
0.290283203125,
-0.33544921875,
-0.60791015625,
-0.294677734375,
0.419189453125,
0.22412109375,
-1.0732421875,
0.63623046875,
-1.0634765625,
-0.6044921875,
-0.489013671875,
-0.6083984375,
0.8798828125,
0.67236328125,
0.043365478515625,
0.1915283203125,
-0.140625,
0.153564453125,
0.72998046875,
0.483154296875,
-0.50537109375,
0.216796875,
0.53125,
-0.59814453125,
0.59619140625,
0.442138671875,
-0.265869140625,
-0.138671875,
-0.12042236328125,
0.11468505859375,
0.185302734375,
0.2420654296875,
0.1678466796875,
0.61181640625,
0.81298828125,
-0.603515625,
-0.231689453125,
-0.6552734375,
1.0439453125,
0.361083984375,
0.4931640625,
0.43212890625,
-0.1270751953125,
-0.576171875,
-0.80712890625,
0.2178955078125,
0.39501953125,
0.73681640625,
-0.5537109375,
0.712890625,
0.0236358642578125,
-0.6630859375,
0.0784912109375,
-0.59912109375,
-0.449951171875,
0.80615234375,
-0.1951904296875,
0.84814453125,
-0.6474609375,
0.09185791015625,
-0.430419921875,
-0.024871826171875,
-0.037567138671875,
0.03839111328125,
0.6318359375,
-0.30126953125,
-0.1942138671875,
-0.59228515625,
-0.225830078125,
-0.0287628173828125,
-0.6455078125,
0.1905517578125,
-0.69970703125,
-0.47705078125,
-0.68017578125,
0.465087890625,
0.96630859375,
0.484375,
-0.1251220703125,
0.32373046875,
0.1578369140625,
0.20751953125,
0.3896484375,
-0.41552734375,
-0.0205535888671875,
-0.6689453125,
0.7685546875,
0.419189453125,
-0.47265625,
-0.546875,
-0.31640625,
-0.6689453125,
0.175048828125,
0.258544921875,
-0.007472991943359375,
-0.6220703125,
0.49658203125,
-0.25341796875,
0.419677734375,
-0.78857421875,
-0.321044921875,
-0.389404296875,
0.51904296875,
0.744140625,
-0.09698486328125,
0.0057830810546875,
-0.64306640625,
0.5546875,
0.68408203125,
0.0124359130859375,
-0.61181640625,
-0.1593017578125,
-0.7587890625,
-0.5673828125,
-0.08648681640625,
0.767578125,
0.296142578125,
0.1380615234375,
-1.1533203125,
0.6806640625,
0.28857421875,
-0.693359375,
-0.0477294921875,
0.330810546875,
0.08740234375,
-0.14404296875,
0.64501953125,
-0.20263671875,
-0.6474609375,
0.2301025390625,
-1.037109375,
0.6435546875,
-0.310791015625,
0.403076171875,
-0.091552734375,
-0.1451416015625,
0.21142578125,
0.289306640625,
-0.693359375,
-0.048828125,
-0.094970703125,
0.63671875,
-1.06640625,
-0.5947265625,
0.54345703125,
-0.08233642578125,
-0.4833984375,
0.65087890625,
-0.279296875,
-0.35791015625,
0.303955078125,
-0.027374267578125,
-0.53759765625,
0.08477783203125,
-0.470458984375,
0.3515625,
0.059173583984375,
-0.2578125,
0.304443359375,
-0.6005859375,
1.130859375,
0.1334228515625,
-0.5712890625,
-0.134765625,
-1.09765625,
-0.2958984375,
-0.2318115234375,
-0.7060546875,
0.061126708984375,
0.06561279296875,
-0.2049560546875,
-0.1939697265625,
-0.326416015625,
-0.5712890625,
-0.09228515625,
-0.66162109375,
0.1737060546875,
0.5458984375,
0.371826171875,
0.262939453125,
-0.169677734375,
-0.578125,
0.26123046875,
-0.439697265625,
-0.033111572265625,
-0.497314453125,
-0.0611572265625,
-0.450439453125,
-0.362060546875,
-0.449951171875,
0.3759765625,
-0.374267578125,
0.0665283203125,
0.87744140625,
0.466796875,
0.446044921875,
-0.211669921875,
-0.47802734375,
0.748046875,
0.036163330078125,
-1.2255859375,
-0.5810546875,
0.98828125,
0.1011962890625,
0.63818359375,
0.4453125,
-0.53759765625,
-1.0537109375,
-1.01171875,
0.159423828125,
-0.6064453125,
-0.2283935546875,
-0.7587890625,
-0.368896484375,
-0.52099609375,
0.44482421875,
-0.08563232421875,
-0.347412109375,
0.349609375,
-0.88525390625,
0.09100341796875,
-0.6044921875,
0.173095703125,
-0.53662109375,
-0.748046875,
-0.501953125,
0.916015625,
0.26025390625,
0.298583984375,
-0.036376953125,
0.06396484375,
0.38232421875,
0.223388671875,
-0.24951171875,
-0.4794921875,
-0.1341552734375,
0.5615234375,
-0.33203125,
-0.158203125,
-0.169189453125,
0.63916015625,
-0.98046875,
0.324462890625,
0.1053466796875,
-0.055145263671875,
-0.1959228515625,
-0.346923828125,
1.0810546875,
-0.3603515625,
-0.048187255859375,
-0.426025390625,
0.57763671875,
0.67626953125,
-0.31298828125,
-0.09930419921875,
-0.60693359375,
-0.351806640625,
-1.08984375,
0.78564453125,
-0.0521240234375,
0.328857421875,
-0.53173828125,
-0.08880615234375,
1.3134765625,
-0.456298828125,
0.351318359375,
1.16796875,
0.113037109375,
0.2081298828125,
-0.75048828125,
0.6044921875,
0.396728515625,
-0.455810546875,
-0.251708984375,
-0.0201568603515625,
-0.82275390625,
0.431640625,
-0.26513671875,
-0.94580078125,
-0.564453125,
0.5234375,
1.1865234375,
-0.27392578125,
0.63525390625,
-0.1961669921875,
-1.244140625,
-0.595703125,
0.751953125,
-0.28955078125,
0.134521484375,
0.69580078125,
0.05914306640625,
-0.267333984375,
-0.07635498046875,
0.0069427490234375,
-0.470703125,
-0.3154296875,
1.140625,
-0.38525390625,
-0.76416015625,
1.2021484375,
0.5498046875,
-0.90234375,
-0.98486328125,
0.070556640625,
-0.142333984375,
-0.2998046875,
-0.95068359375,
0.365966796875,
0.1800537109375,
-0.341552734375,
-0.0477294921875,
0.4580078125,
-0.3037109375,
0.26806640625,
0.1195068359375,
0.414306640625,
-0.60205078125,
0.000568389892578125,
0.4287109375,
-0.5078125,
-0.3544921875,
-0.87841796875,
-0.1920166015625,
-0.51806640625,
-0.049407958984375,
0.407958984375,
-0.36083984375,
0.463623046875,
0.52001953125,
0.1385498046875,
0.97998046875,
-0.2227783203125,
-0.22607421875,
0.037628173828125,
-0.475830078125,
-0.61767578125,
-0.45556640625,
0.3349609375,
-0.4013671875,
-0.06683349609375,
-0.666015625,
-0.31884765625,
0.423095703125,
0.38623046875,
-0.5419921875,
-1.0732421875,
-0.37841796875,
-1.0810546875,
-0.63037109375,
-0.357421875,
-0.496337890625,
-0.326416015625,
-0.08587646484375,
0.07489013671875,
-0.417724609375,
0.0260162353515625,
0.5341796875,
-0.250244140625,
0.76513671875,
-0.3974609375,
0.39013671875,
-0.8466796875,
-0.06622314453125,
-0.515625,
0.40185546875,
-0.54931640625,
-0.14501953125,
-0.57763671875,
0.1373291015625,
0.1146240234375,
0.56103515625,
-0.296630859375,
0.283447265625,
0.205078125,
-0.3642578125,
-0.009429931640625,
0.1768798828125,
-0.143310546875,
0.62548828125,
0.7685546875,
-0.16748046875,
0.55712890625,
-0.2342529296875,
-0.56689453125,
-0.1690673828125,
0.595703125,
0.440673828125,
-0.1263427734375,
-0.2254638671875,
-0.1212158203125,
0.315185546875,
-0.95947265625,
0.31298828125,
-0.258544921875,
0.427978515625,
-0.04132080078125,
-0.261962890625,
0.54052734375,
0.7177734375,
0.0452880859375,
0.16162109375,
-0.0679931640625,
0.127197265625,
0.028564453125,
0.28857421875,
0.1802978515625,
0.53369140625,
0.09002685546875,
-0.4365234375,
-0.07855224609375,
0.27783203125,
-0.3994140625,
0.6064453125,
-0.451171875,
-0.55517578125,
-0.830078125,
-0.101806640625,
-0.0014925003051757812,
0.75244140625,
0.66064453125,
-0.63037109375,
-0.031585693359375,
-0.2120361328125,
-0.7041015625,
0.09716796875,
-1.2978515625,
-0.93603515625,
0.302001953125,
-0.068115234375,
-0.218505859375,
-0.221435546875,
-0.5732421875,
-0.09112548828125,
-0.12322998046875,
0.6748046875,
-0.740234375,
0.425537109375,
-0.0051422119140625,
0.68505859375,
-0.62255859375,
0.30322265625,
0.26220703125,
0.701171875,
-0.419921875,
-0.5146484375,
-0.09661865234375,
1.255859375,
0.10516357421875,
0.157470703125,
-0.38916015625,
0.1666259765625,
0.0308074951171875,
0.12548828125,
-0.30859375,
-0.07275390625,
-0.37353515625,
1.1328125,
-0.826171875,
0.081298828125,
0.1834716796875,
0.4765625,
0.144775390625,
-0.479736328125,
-0.5546875,
0.9443359375,
1.025390625,
0.1617431640625,
0.57568359375,
0.51953125,
0.544921875,
-0.31494140625,
-0.0972900390625,
-0.333740234375,
0.8310546875,
0.4365234375,
0.5224609375,
-0.1756591796875,
0.60302734375,
0.775390625,
-0.0291290283203125,
-0.1953125,
0.53466796875,
0.29541015625,
-0.319091796875,
0.3955078125,
-0.00798797607421875,
-0.0506591796875,
-0.164794921875,
-0.171142578125,
0.5380859375,
-0.38427734375,
-0.026397705078125,
-0.238525390625,
-0.62451171875,
0.8671875,
-0.1741943359375,
-0.44921875,
0.65673828125,
-0.4599609375,
0.431640625,
0.314453125,
0.1915283203125,
-0.0009169578552246094,
0.85791015625,
0.88525390625,
0.328857421875,
0.407470703125,
0.69677734375,
0.31005859375,
-0.90283203125,
0.057373046875,
0.634765625,
-0.0091705322265625,
-0.34521484375,
-0.64208984375,
-0.97314453125,
0.73681640625,
-0.3076171875,
-0.278076171875,
0.3359375,
-0.80517578125,
0.088134765625,
-0.6669921875,
0.93896484375,
-0.73876953125,
0.373291015625,
0.303955078125,
0.05926513671875,
-0.5302734375,
1.0634765625,
-0.336181640625,
0.39990234375,
0.220703125,
1.3251953125,
0.1768798828125,
1.32421875,
0.8173828125,
-0.26513671875,
-0.199951171875,
0.5498046875,
-0.422607421875,
-0.482666015625,
-0.169189453125,
-0.3154296875,
-0.241455078125,
-0.9599609375,
-0.383544921875,
-0.443359375,
1.130859375,
0.07879638671875,
-0.83837890625,
-0.2470703125,
0.313720703125,
-0.9931640625,
0.59130859375,
0.1484375,
0.313232421875,
0.282958984375,
0.1800537109375,
-0.32861328125,
-0.61865234375,
0.0982666015625,
-0.55517578125,
0.389892578125,
-0.61474609375,
-0.379638671875,
-0.759765625,
-0.75927734375,
-0.478271484375,
0.1278076171875,
-0.6005859375,
-0.87451171875,
0.315673828125,
0.41357421875,
0.402587890625,
0.332275390625,
-0.0753173828125,
-0.180908203125,
1.0322265625,
0.8525390625,
0.40478515625,
0.91650390625,
0.2044677734375,
0.03662109375,
0.036773681640625,
-0.72802734375,
0.487548828125,
-0.391845703125,
0.484130859375,
0.09088134765625,
0.051544189453125,
-0.5859375,
-1.3212890625,
-0.2332763671875,
0.276123046875,
0.371337890625,
-0.57470703125,
-1.1015625,
-0.68701171875,
-0.83056640625,
-0.2496337890625,
-0.51416015625,
0.70068359375,
-0.06597900390625,
0.1348876953125,
-0.380126953125,
-1.2568359375,
4.4765625,
1.1591796875,
0.79150390625,
0.560546875,
0.1572265625,
0.8369140625,
0.73486328125,
-0.51123046875,
-0.1348876953125,
-0.321533203125,
0.300537109375,
-0.08502197265625,
0.0985107421875,
0.8193359375,
0.49609375,
0.5888671875,
-0.73388671875,
-0.1884765625,
0.01068878173828125,
-1.076171875,
-0.71484375,
-0.00868988037109375,
-0.268798828125,
0.2333984375,
-0.2724609375,
0.154296875,
0.91796875,
-0.80126953125,
-0.72265625,
-0.5087890625,
0.1708984375,
-0.410400390625,
0.927734375,
0.16357421875,
-0.40234375,
0.4375,
-0.1761474609375,
-0.71435546875,
-0.2724609375,
0.259033203125,
-0.23779296875,
-0.10772705078125,
0.94287109375,
-0.291748046875,
-0.033721923828125,
0.595703125,
-0.50048828125,
0.62353515625,
0.46826171875,
-0.8720703125,
0.88671875,
-0.11126708984375,
0.37255859375,
-0.33837890625,
-0.671875,
0.035125732421875,
0.123779296875,
-0.08831787109375,
-0.369873046875,
0.689453125,
0.35546875,
0.291015625,
-0.1312255859375,
0.455810546875,
-0.89990234375,
0.62841796875,
-0.482177734375,
0.413818359375,
-0.5341796875,
0.09735107421875,
-0.15576171875,
-0.248779296875,
-0.38916015625,
-0.342529296875,
0.68994140625,
0.413818359375,
-0.372802734375,
0.196533203125,
0.30859375,
-0.673828125,
0.14697265625,
-0.11376953125,
-0.29541015625,
-0.313232421875,
0.429443359375,
1.185546875,
-0.77490234375,
-0.607421875,
-0.50732421875,
0.52978515625,
0.712890625,
0.291748046875,
0.0260772705078125,
-0.63330078125,
-0.27587890625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Submitted Solution:
```
def cnt(a,b):
x=abs(ord(a)-ord(b))
return(min(x,26-x))
a=input()
val=0
for i in range(len(a)-1):
if(cnt(a[i],a[i+1])):
val+=1
print(val)
```
No
| 38,188
|
[
0.399169921875,
-0.2421875,
-0.06201171875,
0.360595703125,
-0.49951171875,
-0.478759765625,
-0.117431640625,
-0.05584716796875,
0.0557861328125,
0.5087890625,
0.71923828125,
-0.317626953125,
0.05810546875,
-0.72314453125,
-0.716796875,
0.130859375,
-0.355224609375,
-0.74658203125,
-0.59521484375,
-0.1805419921875,
0.10626220703125,
-0.2470703125,
-1.2744140625,
-0.276611328125,
-0.67822265625,
0.90576171875,
0.2364501953125,
0.156494140625,
0.962890625,
1.1064453125,
-0.10308837890625,
-0.3681640625,
0.9921875,
-1.146484375,
-0.1007080078125,
-0.368408203125,
0.435302734375,
-0.61767578125,
0.1614990234375,
-0.5341796875,
0.162353515625,
-0.180908203125,
0.66845703125,
-0.53857421875,
-0.96044921875,
-0.0748291015625,
0.0135498046875,
-0.453369140625,
-0.10284423828125,
-0.77685546875,
0.2159423828125,
-0.1878662109375,
0.48095703125,
-0.2734375,
-0.037841796875,
-0.168701171875,
0.04779052734375,
-0.01398468017578125,
-0.55224609375,
0.1234130859375,
0.1815185546875,
0.2177734375,
0.1375732421875,
-1.017578125,
-0.222900390625,
0.1563720703125,
0.08831787109375,
-0.330322265625,
-0.06378173828125,
-0.845703125,
-0.28759765625,
0.261474609375,
-0.0186309814453125,
-0.6728515625,
-0.292236328125,
-0.043701171875,
0.00894927978515625,
0.1722412109375,
-0.79296875,
0.51171875,
0.0178375244140625,
0.70068359375,
-0.17822265625,
0.232177734375,
-0.53564453125,
-0.453857421875,
0.0677490234375,
-0.08477783203125,
0.20654296875,
-0.322265625,
-0.10504150390625,
0.498291015625,
-0.63037109375,
0.0860595703125,
0.68212890625,
0.6943359375,
-0.4619140625,
0.49365234375,
0.364013671875,
0.2481689453125,
0.61328125,
0.95654296875,
-0.71484375,
1.076171875,
-0.1419677734375,
-0.06256103515625,
0.218017578125,
-0.2744140625,
-0.298828125,
-0.59326171875,
-0.388671875,
-0.41015625,
0.51953125,
0.281494140625,
-0.13525390625,
0.66259765625,
0.244384765625,
0.437255859375,
-0.74462890625,
0.471435546875,
0.049285888671875,
-0.29833984375,
0.282958984375,
-0.2978515625,
-0.054412841796875,
-0.2081298828125,
-0.4072265625,
0.587890625,
-0.444580078125,
-0.00864410400390625,
0.53076171875,
0.494873046875,
-0.0084686279296875,
0.44287109375,
-0.154541015625,
0.71728515625,
-0.1834716796875,
0.677734375,
0.765625,
-0.697265625,
0.250732421875,
-0.4150390625,
0.437744140625,
1.8662109375,
0.456298828125,
-0.1719970703125,
0.640625,
0.548828125,
-0.78466796875,
0.86962890625,
-0.5712890625,
0.470458984375,
-0.0188446044921875,
0.17041015625,
-0.35107421875,
-0.036773681640625,
-0.43115234375,
0.6953125,
-0.037261962890625,
0.416015625,
-0.51171875,
0.012786865234375,
-0.0582275390625,
0.95849609375,
-0.05810546875,
0.9267578125,
-0.422607421875,
-0.3720703125,
-0.155029296875,
-0.87548828125,
0.130615234375,
-0.169677734375,
-0.05914306640625,
0.57861328125,
0.59375,
0.8212890625,
0.81884765625,
-0.0277557373046875,
0.64990234375,
0.1451416015625,
-0.286865234375,
0.07513427734375,
0.1480712890625,
0.64697265625,
-0.10113525390625,
0.283203125,
0.006500244140625,
-0.2230224609375,
-0.36376953125,
-0.468017578125,
-0.1248779296875,
0.6923828125,
-0.40185546875,
0.19091796875,
-0.1405029296875,
0.0950927734375,
-0.9931640625,
-0.0148162841796875,
0.11468505859375,
-1.03125,
-0.290283203125,
0.6279296875,
-0.08929443359375,
0.4384765625,
-0.340087890625,
-0.896484375,
0.309326171875,
1.07421875,
-0.48388671875,
0.07073974609375,
0.66748046875,
0.368896484375,
-0.23876953125,
0.1795654296875,
0.1932373046875,
-0.255859375,
-0.8447265625,
0.67724609375,
-0.34716796875,
0.1082763671875,
0.07904052734375,
0.74169921875,
0.1875,
0.5869140625,
-0.375244140625,
0.331298828125,
0.2802734375,
1.208984375,
-0.0186920166015625,
0.576171875,
0.1424560546875,
1.064453125,
0.8330078125,
0.8916015625,
0.77734375,
0.082275390625,
0.52685546875,
0.5078125,
-0.002712249755859375,
-0.01416015625,
0.0755615234375,
0.31103515625,
0.58447265625,
0.384521484375,
-0.1492919921875,
0.50927734375,
-0.06976318359375,
-0.1461181640625,
-0.65234375,
0.3330078125,
-0.344482421875,
0.84326171875,
-0.13623046875,
0.307861328125,
-0.25244140625,
-0.2313232421875,
0.4130859375,
0.58154296875,
-0.38818359375,
-0.5322265625,
0.2451171875,
0.330810546875,
0.057098388671875,
0.044464111328125,
-0.0447998046875,
0.265380859375,
-0.0692138671875,
0.86181640625,
-0.388916015625,
-0.311767578125,
-1.09765625,
-0.9677734375,
-0.92041015625,
-0.166259765625,
-0.64306640625,
-0.047271728515625,
0.412841796875,
-0.58837890625,
0.66748046875,
-0.64501953125,
0.07379150390625,
-0.0772705078125,
-0.72021484375,
0.72705078125,
0.080322265625,
0.7177734375,
-0.366943359375,
0.4599609375,
0.180419921875,
0.78955078125,
-0.66015625,
-0.2100830078125,
-0.435302734375,
-0.369873046875,
0.421875,
-0.00922393798828125,
0.5341796875,
-0.414794921875,
-0.93798828125,
-0.7646484375,
-0.31494140625,
-0.006916046142578125,
-0.47998046875,
0.195556640625,
-0.53369140625,
0.89111328125,
0.5068359375,
-0.95166015625,
0.441162109375,
0.78564453125,
-0.919921875,
0.459228515625,
0.319091796875,
0.08380126953125,
-0.87939453125,
1.166015625,
0.385009765625,
0.57470703125,
-0.225341796875,
0.03997802734375,
-0.5859375,
0.297607421875,
-0.323974609375,
-0.58251953125,
-0.30859375,
0.4248046875,
0.243408203125,
-1.0556640625,
0.6220703125,
-1.0458984375,
-0.63525390625,
-0.4794921875,
-0.62060546875,
0.82666015625,
0.6689453125,
-0.0082244873046875,
0.1724853515625,
-0.12237548828125,
0.170166015625,
0.70654296875,
0.47265625,
-0.5078125,
0.2158203125,
0.481689453125,
-0.6298828125,
0.54248046875,
0.450439453125,
-0.25048828125,
-0.137451171875,
-0.1337890625,
0.0953369140625,
0.2127685546875,
0.254150390625,
0.190673828125,
0.60986328125,
0.82373046875,
-0.57373046875,
-0.235107421875,
-0.68701171875,
1.0302734375,
0.40673828125,
0.488525390625,
0.423583984375,
-0.10284423828125,
-0.57861328125,
-0.78515625,
0.2110595703125,
0.392578125,
0.7255859375,
-0.5361328125,
0.724609375,
0.043670654296875,
-0.62451171875,
0.0792236328125,
-0.60498046875,
-0.45263671875,
0.79052734375,
-0.1859130859375,
0.8388671875,
-0.658203125,
0.061309814453125,
-0.4287109375,
-0.00769805908203125,
-0.018280029296875,
0.07080078125,
0.6259765625,
-0.318115234375,
-0.1973876953125,
-0.57666015625,
-0.2401123046875,
0.01007843017578125,
-0.6123046875,
0.1651611328125,
-0.69482421875,
-0.49267578125,
-0.6416015625,
0.449951171875,
0.96484375,
0.477294921875,
-0.10205078125,
0.347900390625,
0.1739501953125,
0.20849609375,
0.376953125,
-0.447509765625,
-0.0064239501953125,
-0.67578125,
0.77587890625,
0.390869140625,
-0.471923828125,
-0.54833984375,
-0.306884765625,
-0.65087890625,
0.169921875,
0.216796875,
-0.042266845703125,
-0.611328125,
0.509765625,
-0.237548828125,
0.4462890625,
-0.77783203125,
-0.300537109375,
-0.386962890625,
0.52294921875,
0.7138671875,
-0.09429931640625,
0.0146484375,
-0.6474609375,
0.544921875,
0.6982421875,
0.016754150390625,
-0.60888671875,
-0.1396484375,
-0.7314453125,
-0.5751953125,
-0.048919677734375,
0.75,
0.27490234375,
0.12164306640625,
-1.109375,
0.69921875,
0.25634765625,
-0.70947265625,
-0.10296630859375,
0.35205078125,
0.10552978515625,
-0.14306640625,
0.64013671875,
-0.1695556640625,
-0.6337890625,
0.2286376953125,
-1.0146484375,
0.64990234375,
-0.288330078125,
0.40087890625,
-0.07086181640625,
-0.1357421875,
0.20263671875,
0.27734375,
-0.68212890625,
-0.046173095703125,
-0.10675048828125,
0.6708984375,
-1.083984375,
-0.5732421875,
0.564453125,
-0.10845947265625,
-0.469970703125,
0.6494140625,
-0.291748046875,
-0.373291015625,
0.305908203125,
-0.0303802490234375,
-0.52880859375,
0.07122802734375,
-0.427490234375,
0.383056640625,
0.06365966796875,
-0.27294921875,
0.3125,
-0.5908203125,
1.1337890625,
0.140869140625,
-0.5732421875,
-0.1351318359375,
-1.087890625,
-0.2978515625,
-0.240234375,
-0.70556640625,
0.063720703125,
0.0180511474609375,
-0.19140625,
-0.1715087890625,
-0.31201171875,
-0.59375,
-0.0838623046875,
-0.66357421875,
0.1907958984375,
0.5517578125,
0.384765625,
0.2244873046875,
-0.1572265625,
-0.59619140625,
0.286376953125,
-0.40283203125,
-0.040435791015625,
-0.490234375,
-0.044189453125,
-0.447265625,
-0.32861328125,
-0.4306640625,
0.40185546875,
-0.358154296875,
0.06707763671875,
0.88623046875,
0.45556640625,
0.414794921875,
-0.184326171875,
-0.44189453125,
0.720703125,
0.033172607421875,
-1.2021484375,
-0.5810546875,
1.0390625,
0.06866455078125,
0.64599609375,
0.470947265625,
-0.552734375,
-1.087890625,
-0.99267578125,
0.193603515625,
-0.6181640625,
-0.2391357421875,
-0.7314453125,
-0.38671875,
-0.52392578125,
0.432373046875,
-0.1209716796875,
-0.318603515625,
0.326171875,
-0.8671875,
0.1378173828125,
-0.6181640625,
0.1533203125,
-0.48779296875,
-0.77490234375,
-0.5380859375,
0.9287109375,
0.256591796875,
0.27734375,
-0.04681396484375,
0.11578369140625,
0.39111328125,
0.23193359375,
-0.2474365234375,
-0.484130859375,
-0.15478515625,
0.54736328125,
-0.338134765625,
-0.1551513671875,
-0.11834716796875,
0.62060546875,
-0.95556640625,
0.310302734375,
0.1019287109375,
-0.0872802734375,
-0.188720703125,
-0.31884765625,
1.0625,
-0.349853515625,
-0.048187255859375,
-0.39404296875,
0.5361328125,
0.64892578125,
-0.3037109375,
-0.1070556640625,
-0.60546875,
-0.36767578125,
-1.103515625,
0.7841796875,
-0.0280303955078125,
0.30615234375,
-0.5078125,
-0.1298828125,
1.28515625,
-0.46337890625,
0.35205078125,
1.14453125,
0.1256103515625,
0.1605224609375,
-0.72021484375,
0.6015625,
0.376708984375,
-0.40478515625,
-0.27099609375,
-0.0216217041015625,
-0.78515625,
0.474365234375,
-0.281494140625,
-0.93896484375,
-0.57958984375,
0.50244140625,
1.1328125,
-0.245849609375,
0.62939453125,
-0.1861572265625,
-1.2119140625,
-0.58349609375,
0.73583984375,
-0.292236328125,
0.1148681640625,
0.68408203125,
0.034576416015625,
-0.25341796875,
-0.06719970703125,
-0.0073089599609375,
-0.473876953125,
-0.35302734375,
1.1201171875,
-0.34765625,
-0.7646484375,
1.1845703125,
0.53564453125,
-0.90234375,
-0.96240234375,
0.10394287109375,
-0.10772705078125,
-0.287353515625,
-0.9658203125,
0.33642578125,
0.1934814453125,
-0.31689453125,
-0.053009033203125,
0.4501953125,
-0.31298828125,
0.28759765625,
0.078369140625,
0.377197265625,
-0.60498046875,
-0.0233612060546875,
0.41064453125,
-0.449951171875,
-0.380859375,
-0.88623046875,
-0.18212890625,
-0.51513671875,
-0.056243896484375,
0.402587890625,
-0.364013671875,
0.4697265625,
0.5,
0.1373291015625,
0.97607421875,
-0.197265625,
-0.1778564453125,
0.05841064453125,
-0.424072265625,
-0.5947265625,
-0.459716796875,
0.3115234375,
-0.36767578125,
-0.12298583984375,
-0.66943359375,
-0.335205078125,
0.44091796875,
0.37158203125,
-0.5478515625,
-1.0732421875,
-0.379638671875,
-1.0771484375,
-0.6455078125,
-0.347412109375,
-0.505859375,
-0.299072265625,
-0.112548828125,
0.047607421875,
-0.386474609375,
0.06280517578125,
0.52587890625,
-0.2335205078125,
0.74755859375,
-0.396728515625,
0.385498046875,
-0.8330078125,
-0.047332763671875,
-0.5185546875,
0.3857421875,
-0.53759765625,
-0.130859375,
-0.62109375,
0.12164306640625,
0.173583984375,
0.56201171875,
-0.339111328125,
0.29833984375,
0.1910400390625,
-0.38720703125,
-0.028228759765625,
0.1705322265625,
-0.1431884765625,
0.6025390625,
0.798828125,
-0.1405029296875,
0.5478515625,
-0.2281494140625,
-0.5556640625,
-0.1619873046875,
0.60498046875,
0.449462890625,
-0.1490478515625,
-0.197265625,
-0.1256103515625,
0.3330078125,
-0.9482421875,
0.31591796875,
-0.255126953125,
0.427978515625,
-0.06005859375,
-0.262939453125,
0.52197265625,
0.71435546875,
0.055328369140625,
0.1474609375,
-0.058563232421875,
0.151611328125,
0.01494598388671875,
0.257568359375,
0.2115478515625,
0.5234375,
0.115966796875,
-0.450439453125,
-0.10467529296875,
0.269287109375,
-0.37646484375,
0.5908203125,
-0.45703125,
-0.53466796875,
-0.81298828125,
-0.1231689453125,
-0.0138702392578125,
0.75830078125,
0.64208984375,
-0.61376953125,
-0.026123046875,
-0.1878662109375,
-0.740234375,
0.07550048828125,
-1.2890625,
-0.91015625,
0.281494140625,
-0.07769775390625,
-0.230224609375,
-0.255126953125,
-0.5712890625,
-0.061309814453125,
-0.11419677734375,
0.70263671875,
-0.76318359375,
0.395263671875,
0.0097503662109375,
0.7099609375,
-0.63427734375,
0.29345703125,
0.282958984375,
0.71630859375,
-0.404296875,
-0.490966796875,
-0.05609130859375,
1.2783203125,
0.11810302734375,
0.166015625,
-0.41552734375,
0.12890625,
0.06475830078125,
0.1392822265625,
-0.31396484375,
-0.0478515625,
-0.412109375,
1.146484375,
-0.822265625,
0.08221435546875,
0.189208984375,
0.460205078125,
0.1256103515625,
-0.488037109375,
-0.57568359375,
0.9326171875,
1.033203125,
0.156494140625,
0.5458984375,
0.54296875,
0.54345703125,
-0.3251953125,
-0.1070556640625,
-0.359130859375,
0.82861328125,
0.402587890625,
0.4638671875,
-0.17919921875,
0.591796875,
0.81591796875,
-0.01026153564453125,
-0.220458984375,
0.49951171875,
0.28466796875,
-0.300537109375,
0.382080078125,
0.003429412841796875,
-0.03369140625,
-0.18603515625,
-0.1661376953125,
0.560546875,
-0.389404296875,
-0.01959228515625,
-0.217041015625,
-0.6611328125,
0.84716796875,
-0.195556640625,
-0.4453125,
0.6904296875,
-0.4609375,
0.45458984375,
0.306640625,
0.195068359375,
-0.00621795654296875,
0.84228515625,
0.8896484375,
0.363525390625,
0.427490234375,
0.68505859375,
0.3037109375,
-0.9169921875,
0.054962158203125,
0.62890625,
0.016876220703125,
-0.31494140625,
-0.62158203125,
-0.94775390625,
0.736328125,
-0.31005859375,
-0.322998046875,
0.32080078125,
-0.76611328125,
0.08856201171875,
-0.68017578125,
0.951171875,
-0.7138671875,
0.377685546875,
0.2705078125,
0.0804443359375,
-0.56103515625,
1.0751953125,
-0.364501953125,
0.396484375,
0.28564453125,
1.2998046875,
0.167236328125,
1.3095703125,
0.828125,
-0.2412109375,
-0.1624755859375,
0.53662109375,
-0.463623046875,
-0.46484375,
-0.1282958984375,
-0.258544921875,
-0.2626953125,
-0.966796875,
-0.39306640625,
-0.453125,
1.115234375,
0.0699462890625,
-0.83544921875,
-0.25390625,
0.3173828125,
-0.9794921875,
0.57666015625,
0.1671142578125,
0.318115234375,
0.26708984375,
0.2008056640625,
-0.317626953125,
-0.5986328125,
0.06951904296875,
-0.5341796875,
0.364990234375,
-0.63427734375,
-0.37548828125,
-0.79150390625,
-0.8056640625,
-0.476318359375,
0.130859375,
-0.59228515625,
-0.90966796875,
0.3173828125,
0.42333984375,
0.4453125,
0.3212890625,
-0.11688232421875,
-0.175048828125,
0.962890625,
0.8447265625,
0.425048828125,
0.9228515625,
0.2349853515625,
0.09759521484375,
0.0207977294921875,
-0.71923828125,
0.489990234375,
-0.4384765625,
0.496826171875,
0.10943603515625,
0.0562744140625,
-0.580078125,
-1.337890625,
-0.199462890625,
0.271484375,
0.406494140625,
-0.56396484375,
-1.0751953125,
-0.6845703125,
-0.83349609375,
-0.243408203125,
-0.48046875,
0.6943359375,
-0.0406494140625,
0.120361328125,
-0.39794921875,
-1.2705078125,
4.50390625,
1.125,
0.796875,
0.56201171875,
0.1663818359375,
0.84716796875,
0.74755859375,
-0.5380859375,
-0.1695556640625,
-0.2978515625,
0.30224609375,
-0.0845947265625,
0.085205078125,
0.80615234375,
0.47119140625,
0.60546875,
-0.78173828125,
-0.20263671875,
0.00414276123046875,
-1.0791015625,
-0.7314453125,
-0.0211334228515625,
-0.271240234375,
0.222412109375,
-0.305419921875,
0.1539306640625,
0.89892578125,
-0.75732421875,
-0.72314453125,
-0.5205078125,
0.1353759765625,
-0.403564453125,
0.91455078125,
0.1380615234375,
-0.442626953125,
0.443115234375,
-0.168212890625,
-0.6796875,
-0.27783203125,
0.2607421875,
-0.1929931640625,
-0.0797119140625,
0.900390625,
-0.291748046875,
0.0292205810546875,
0.55224609375,
-0.5185546875,
0.64111328125,
0.470458984375,
-0.859375,
0.8896484375,
-0.10955810546875,
0.39111328125,
-0.302978515625,
-0.65966796875,
0.028564453125,
0.0782470703125,
-0.09808349609375,
-0.348388671875,
0.68359375,
0.343017578125,
0.26904296875,
-0.1212158203125,
0.43505859375,
-0.85107421875,
0.638671875,
-0.48974609375,
0.443359375,
-0.47119140625,
0.1331787109375,
-0.168701171875,
-0.27685546875,
-0.391357421875,
-0.3369140625,
0.703125,
0.43310546875,
-0.3623046875,
0.1884765625,
0.299072265625,
-0.66748046875,
0.1641845703125,
-0.10809326171875,
-0.26416015625,
-0.32421875,
0.427734375,
1.162109375,
-0.78173828125,
-0.58544921875,
-0.521484375,
0.499267578125,
0.72021484375,
0.29150390625,
0.0374755859375,
-0.63916015625,
-0.2452392578125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Submitted Solution:
```
y=str(input())
y = 'a' + y
j,t=0,0
b = [0]*(len(y))
for i in range(len(y)):
b[j] = (ord(y[i])) - 96
j+=1
print(b)
for k in range(len(y)):
if b[k+1] > b[k]:
f = (26+b[k]) - b[k+1]
e = abs(b[k] - b[k+1])
else:
f = (26+b[k+1]) - b[k]
e = abs(b[k] - b[k+1])
if f > e :
t+=e
else:
t+=f
k+=1
if k+1 >= len(y):
break
print(t)
```
No
| 38,189
|
[
0.40087890625,
-0.2255859375,
-0.05902099609375,
0.358642578125,
-0.5283203125,
-0.47802734375,
-0.113525390625,
-0.03759765625,
0.060302734375,
0.4873046875,
0.712890625,
-0.319580078125,
0.0736083984375,
-0.7373046875,
-0.71337890625,
0.097900390625,
-0.355224609375,
-0.75439453125,
-0.60888671875,
-0.1822509765625,
0.1138916015625,
-0.2291259765625,
-1.27734375,
-0.2568359375,
-0.6796875,
0.93359375,
0.2220458984375,
0.17578125,
0.96142578125,
1.1201171875,
-0.10784912109375,
-0.33984375,
1.013671875,
-1.16015625,
-0.09930419921875,
-0.3740234375,
0.44775390625,
-0.6220703125,
0.1585693359375,
-0.548828125,
0.1722412109375,
-0.1480712890625,
0.66650390625,
-0.515625,
-0.9755859375,
-0.06866455078125,
0.00577545166015625,
-0.477783203125,
-0.1455078125,
-0.75048828125,
0.2064208984375,
-0.1944580078125,
0.49267578125,
-0.242919921875,
-0.0352783203125,
-0.1820068359375,
0.0445556640625,
-0.0018606185913085938,
-0.5673828125,
0.08721923828125,
0.141845703125,
0.252197265625,
0.113037109375,
-1.001953125,
-0.2135009765625,
0.1728515625,
0.11065673828125,
-0.35302734375,
-0.06805419921875,
-0.8369140625,
-0.298583984375,
0.259765625,
-0.01110076904296875,
-0.68212890625,
-0.3017578125,
-0.0400390625,
-0.0014505386352539062,
0.197998046875,
-0.77099609375,
0.52783203125,
0.0164642333984375,
0.712890625,
-0.158935546875,
0.2388916015625,
-0.5439453125,
-0.441162109375,
0.0560302734375,
-0.08355712890625,
0.2198486328125,
-0.3046875,
-0.10498046875,
0.5009765625,
-0.63916015625,
0.115966796875,
0.720703125,
0.69580078125,
-0.436767578125,
0.475341796875,
0.356689453125,
0.28271484375,
0.611328125,
0.9404296875,
-0.72314453125,
1.0927734375,
-0.1390380859375,
-0.0728759765625,
0.235107421875,
-0.259765625,
-0.305419921875,
-0.603515625,
-0.415283203125,
-0.41552734375,
0.541015625,
0.287841796875,
-0.1033935546875,
0.68212890625,
0.2379150390625,
0.44140625,
-0.76611328125,
0.464111328125,
0.062469482421875,
-0.2890625,
0.282958984375,
-0.294677734375,
-0.06182861328125,
-0.2144775390625,
-0.382568359375,
0.58984375,
-0.435791015625,
-0.00670623779296875,
0.51806640625,
0.497314453125,
0.010894775390625,
0.444091796875,
-0.1456298828125,
0.71533203125,
-0.1700439453125,
0.66796875,
0.7568359375,
-0.6962890625,
0.26220703125,
-0.45068359375,
0.431884765625,
1.8505859375,
0.460205078125,
-0.185302734375,
0.64306640625,
0.55908203125,
-0.802734375,
0.85498046875,
-0.56494140625,
0.4541015625,
-0.018402099609375,
0.1751708984375,
-0.329833984375,
-0.028533935546875,
-0.437255859375,
0.69677734375,
-0.0294647216796875,
0.417724609375,
-0.54296875,
0.0174102783203125,
-0.0797119140625,
0.95361328125,
-0.0271759033203125,
0.93701171875,
-0.411865234375,
-0.420166015625,
-0.142578125,
-0.875,
0.146728515625,
-0.1541748046875,
-0.07672119140625,
0.58056640625,
0.5927734375,
0.81005859375,
0.81298828125,
-0.045196533203125,
0.63623046875,
0.1475830078125,
-0.3037109375,
0.08660888671875,
0.15380859375,
0.65771484375,
-0.11334228515625,
0.31298828125,
0.0107574462890625,
-0.2122802734375,
-0.375244140625,
-0.481201171875,
-0.1075439453125,
0.68310546875,
-0.390869140625,
0.2052001953125,
-0.1220703125,
0.11322021484375,
-0.9853515625,
-0.032196044921875,
0.07861328125,
-1.0400390625,
-0.2958984375,
0.63720703125,
-0.06451416015625,
0.4404296875,
-0.287841796875,
-0.91357421875,
0.31591796875,
1.1015625,
-0.468017578125,
0.0645751953125,
0.6796875,
0.33642578125,
-0.2333984375,
0.193603515625,
0.17138671875,
-0.27490234375,
-0.85302734375,
0.708984375,
-0.35546875,
0.1368408203125,
0.0628662109375,
0.7421875,
0.181884765625,
0.58056640625,
-0.39892578125,
0.335205078125,
0.307373046875,
1.19921875,
-0.0034046173095703125,
0.55419921875,
0.1536865234375,
1.041015625,
0.83056640625,
0.89501953125,
0.74755859375,
0.07867431640625,
0.505859375,
0.51318359375,
-0.0290069580078125,
-0.01953125,
0.06634521484375,
0.309814453125,
0.5859375,
0.38623046875,
-0.1600341796875,
0.51611328125,
-0.0723876953125,
-0.12890625,
-0.63671875,
0.33837890625,
-0.33740234375,
0.830078125,
-0.1485595703125,
0.32568359375,
-0.26025390625,
-0.259521484375,
0.395263671875,
0.57275390625,
-0.388671875,
-0.51953125,
0.2529296875,
0.353515625,
0.06280517578125,
0.060791015625,
-0.034698486328125,
0.2490234375,
-0.06591796875,
0.83837890625,
-0.38525390625,
-0.307861328125,
-1.0830078125,
-0.96044921875,
-0.8876953125,
-0.161376953125,
-0.6171875,
-0.04974365234375,
0.417724609375,
-0.5966796875,
0.66552734375,
-0.64208984375,
0.073974609375,
-0.0919189453125,
-0.70458984375,
0.7080078125,
0.0716552734375,
0.7021484375,
-0.358154296875,
0.45947265625,
0.188720703125,
0.8134765625,
-0.6640625,
-0.2215576171875,
-0.42529296875,
-0.34228515625,
0.404052734375,
-0.0241851806640625,
0.54150390625,
-0.414794921875,
-0.92919921875,
-0.80859375,
-0.28076171875,
-0.01654052734375,
-0.50244140625,
0.198486328125,
-0.5458984375,
0.8916015625,
0.5234375,
-0.943359375,
0.44873046875,
0.79443359375,
-0.931640625,
0.46875,
0.31494140625,
0.039459228515625,
-0.87060546875,
1.1572265625,
0.361572265625,
0.54345703125,
-0.2174072265625,
0.0212249755859375,
-0.5732421875,
0.282470703125,
-0.328857421875,
-0.5556640625,
-0.299560546875,
0.4521484375,
0.2275390625,
-1.0517578125,
0.62255859375,
-1.0693359375,
-0.60546875,
-0.46728515625,
-0.59521484375,
0.83349609375,
0.6787109375,
-0.0228729248046875,
0.1915283203125,
-0.11181640625,
0.1973876953125,
0.71044921875,
0.481201171875,
-0.482666015625,
0.2005615234375,
0.492919921875,
-0.62841796875,
0.5390625,
0.470458984375,
-0.2374267578125,
-0.159423828125,
-0.134521484375,
0.07781982421875,
0.1856689453125,
0.253173828125,
0.1976318359375,
0.583984375,
0.83203125,
-0.57421875,
-0.241455078125,
-0.6552734375,
1.0146484375,
0.387451171875,
0.51123046875,
0.408447265625,
-0.098388671875,
-0.55712890625,
-0.80859375,
0.2069091796875,
0.413330078125,
0.7109375,
-0.54541015625,
0.72021484375,
0.0251007080078125,
-0.65625,
0.07391357421875,
-0.61669921875,
-0.4365234375,
0.802734375,
-0.1785888671875,
0.8349609375,
-0.6396484375,
0.0743408203125,
-0.42333984375,
-0.01453399658203125,
-0.032012939453125,
0.05889892578125,
0.64990234375,
-0.2900390625,
-0.1937255859375,
-0.5947265625,
-0.201171875,
0.01079559326171875,
-0.6064453125,
0.1650390625,
-0.70703125,
-0.5146484375,
-0.650390625,
0.448974609375,
0.95703125,
0.485595703125,
-0.1025390625,
0.343505859375,
0.1522216796875,
0.216064453125,
0.41162109375,
-0.428955078125,
-0.00696563720703125,
-0.6728515625,
0.771484375,
0.400390625,
-0.4716796875,
-0.54248046875,
-0.310302734375,
-0.685546875,
0.176025390625,
0.2252197265625,
-0.05712890625,
-0.6220703125,
0.4921875,
-0.2303466796875,
0.45166015625,
-0.7685546875,
-0.30029296875,
-0.390380859375,
0.517578125,
0.6962890625,
-0.0975341796875,
-0.01494598388671875,
-0.642578125,
0.5498046875,
0.6826171875,
0.015045166015625,
-0.61083984375,
-0.1353759765625,
-0.72314453125,
-0.568359375,
-0.0723876953125,
0.74658203125,
0.29541015625,
0.13427734375,
-1.1416015625,
0.7041015625,
0.286376953125,
-0.697265625,
-0.0836181640625,
0.342041015625,
0.1109619140625,
-0.145263671875,
0.6484375,
-0.1961669921875,
-0.6298828125,
0.20751953125,
-1.0361328125,
0.64599609375,
-0.28955078125,
0.4140625,
-0.08709716796875,
-0.1611328125,
0.1932373046875,
0.276611328125,
-0.6708984375,
-0.045745849609375,
-0.0662841796875,
0.640625,
-1.060546875,
-0.57861328125,
0.56005859375,
-0.11737060546875,
-0.469482421875,
0.6435546875,
-0.276611328125,
-0.34619140625,
0.32373046875,
-0.035980224609375,
-0.52197265625,
0.06256103515625,
-0.4658203125,
0.376220703125,
0.0577392578125,
-0.2578125,
0.318115234375,
-0.58642578125,
1.123046875,
0.150634765625,
-0.5859375,
-0.1240234375,
-1.0869140625,
-0.28662109375,
-0.237060546875,
-0.6708984375,
0.05767822265625,
-0.0028896331787109375,
-0.1934814453125,
-0.1712646484375,
-0.3310546875,
-0.59326171875,
-0.08258056640625,
-0.65966796875,
0.16064453125,
0.5556640625,
0.3544921875,
0.22314453125,
-0.14794921875,
-0.6005859375,
0.310302734375,
-0.424560546875,
-0.049072265625,
-0.477783203125,
-0.059234619140625,
-0.466796875,
-0.354736328125,
-0.4326171875,
0.41748046875,
-0.37939453125,
0.0703125,
0.88232421875,
0.45166015625,
0.435302734375,
-0.1961669921875,
-0.468505859375,
0.7119140625,
0.060791015625,
-1.2197265625,
-0.56640625,
1.0390625,
0.056182861328125,
0.62646484375,
0.465576171875,
-0.5556640625,
-1.0693359375,
-1.0166015625,
0.1951904296875,
-0.61376953125,
-0.2294921875,
-0.73291015625,
-0.4052734375,
-0.55078125,
0.439453125,
-0.133056640625,
-0.320556640625,
0.3251953125,
-0.85693359375,
0.1339111328125,
-0.59814453125,
0.1558837890625,
-0.481201171875,
-0.78466796875,
-0.493896484375,
0.92431640625,
0.2415771484375,
0.27490234375,
-0.0303192138671875,
0.0797119140625,
0.367431640625,
0.2301025390625,
-0.2490234375,
-0.479736328125,
-0.1591796875,
0.55322265625,
-0.325927734375,
-0.165771484375,
-0.130615234375,
0.6416015625,
-0.94091796875,
0.32470703125,
0.0963134765625,
-0.080078125,
-0.192138671875,
-0.293212890625,
1.0498046875,
-0.352783203125,
-0.0477294921875,
-0.390380859375,
0.5556640625,
0.654296875,
-0.2763671875,
-0.0782470703125,
-0.609375,
-0.359130859375,
-1.0771484375,
0.75927734375,
-0.04888916015625,
0.294921875,
-0.5029296875,
-0.12322998046875,
1.287109375,
-0.4560546875,
0.3564453125,
1.177734375,
0.1317138671875,
0.1820068359375,
-0.73486328125,
0.58447265625,
0.402587890625,
-0.4208984375,
-0.253173828125,
-0.00702667236328125,
-0.80224609375,
0.45361328125,
-0.262451171875,
-0.95458984375,
-0.5927734375,
0.48681640625,
1.162109375,
-0.2626953125,
0.6123046875,
-0.1824951171875,
-1.181640625,
-0.57275390625,
0.74072265625,
-0.26708984375,
0.1380615234375,
0.6865234375,
0.033477783203125,
-0.260498046875,
-0.049285888671875,
-0.007843017578125,
-0.475341796875,
-0.35693359375,
1.09375,
-0.353271484375,
-0.77294921875,
1.2158203125,
0.5244140625,
-0.9130859375,
-0.9775390625,
0.09906005859375,
-0.138916015625,
-0.27294921875,
-0.9423828125,
0.298583984375,
0.1842041015625,
-0.345703125,
-0.060516357421875,
0.433349609375,
-0.283935546875,
0.280029296875,
0.08447265625,
0.375244140625,
-0.6005859375,
-0.01273345947265625,
0.421630859375,
-0.46435546875,
-0.366455078125,
-0.91259765625,
-0.1922607421875,
-0.52001953125,
-0.043304443359375,
0.40185546875,
-0.358154296875,
0.478515625,
0.4873046875,
0.1396484375,
0.966796875,
-0.18603515625,
-0.194091796875,
0.0731201171875,
-0.438232421875,
-0.6162109375,
-0.45263671875,
0.31103515625,
-0.37451171875,
-0.10943603515625,
-0.671875,
-0.32421875,
0.416015625,
0.39208984375,
-0.5263671875,
-1.0771484375,
-0.38671875,
-1.087890625,
-0.63232421875,
-0.359375,
-0.49951171875,
-0.33984375,
-0.10986328125,
0.032379150390625,
-0.392578125,
0.06005859375,
0.52880859375,
-0.2244873046875,
0.7548828125,
-0.4013671875,
0.3759765625,
-0.81005859375,
-0.04388427734375,
-0.5205078125,
0.397705078125,
-0.54248046875,
-0.14697265625,
-0.6025390625,
0.1239013671875,
0.1522216796875,
0.55224609375,
-0.314697265625,
0.321044921875,
0.226318359375,
-0.367919921875,
-0.014678955078125,
0.1572265625,
-0.1405029296875,
0.59765625,
0.7880859375,
-0.1580810546875,
0.54248046875,
-0.25244140625,
-0.55078125,
-0.1392822265625,
0.5869140625,
0.44091796875,
-0.1519775390625,
-0.21484375,
-0.1339111328125,
0.3330078125,
-0.935546875,
0.30908203125,
-0.28125,
0.417724609375,
-0.034637451171875,
-0.252685546875,
0.54931640625,
0.71240234375,
0.07073974609375,
0.146728515625,
-0.07562255859375,
0.1590576171875,
0.01503753662109375,
0.279541015625,
0.202880859375,
0.537109375,
0.10162353515625,
-0.460693359375,
-0.102294921875,
0.26416015625,
-0.36279296875,
0.59375,
-0.432861328125,
-0.552734375,
-0.826171875,
-0.10382080078125,
-0.0011873245239257812,
0.75244140625,
0.61474609375,
-0.61865234375,
-0.0269622802734375,
-0.20458984375,
-0.71044921875,
0.0955810546875,
-1.287109375,
-0.91162109375,
0.2890625,
-0.07818603515625,
-0.231689453125,
-0.27978515625,
-0.56494140625,
-0.055755615234375,
-0.11297607421875,
0.685546875,
-0.759765625,
0.41162109375,
0.005340576171875,
0.69091796875,
-0.60595703125,
0.300048828125,
0.2802734375,
0.72412109375,
-0.409423828125,
-0.46875,
-0.061767578125,
1.271484375,
0.1121826171875,
0.1396484375,
-0.410888671875,
0.1187744140625,
0.06353759765625,
0.1458740234375,
-0.302490234375,
-0.047607421875,
-0.424560546875,
1.1142578125,
-0.8623046875,
0.1151123046875,
0.193603515625,
0.4501953125,
0.12493896484375,
-0.484375,
-0.5634765625,
0.9375,
1.041015625,
0.1973876953125,
0.52099609375,
0.529296875,
0.55908203125,
-0.33056640625,
-0.11590576171875,
-0.35107421875,
0.84375,
0.424072265625,
0.468017578125,
-0.184814453125,
0.59228515625,
0.81591796875,
-0.02581787109375,
-0.2149658203125,
0.501953125,
0.29150390625,
-0.35693359375,
0.36572265625,
0.0070648193359375,
-0.012115478515625,
-0.1824951171875,
-0.190185546875,
0.5478515625,
-0.39208984375,
-0.0228729248046875,
-0.23828125,
-0.6650390625,
0.8291015625,
-0.182373046875,
-0.44970703125,
0.68359375,
-0.46533203125,
0.4404296875,
0.31689453125,
0.1947021484375,
-0.01090240478515625,
0.85107421875,
0.8916015625,
0.35791015625,
0.402099609375,
0.70263671875,
0.28466796875,
-0.91455078125,
0.038970947265625,
0.6201171875,
0.01580810546875,
-0.32763671875,
-0.611328125,
-0.93212890625,
0.74267578125,
-0.295166015625,
-0.283447265625,
0.3271484375,
-0.75732421875,
0.10675048828125,
-0.677734375,
0.95654296875,
-0.70166015625,
0.344970703125,
0.287841796875,
0.07159423828125,
-0.54833984375,
1.0791015625,
-0.3583984375,
0.404052734375,
0.250732421875,
1.318359375,
0.150146484375,
1.3095703125,
0.83203125,
-0.274658203125,
-0.1748046875,
0.5458984375,
-0.4404296875,
-0.498046875,
-0.1292724609375,
-0.2454833984375,
-0.254638671875,
-0.97021484375,
-0.37744140625,
-0.47314453125,
1.12109375,
0.06549072265625,
-0.85546875,
-0.249755859375,
0.291259765625,
-0.98095703125,
0.58251953125,
0.1485595703125,
0.314697265625,
0.261962890625,
0.2125244140625,
-0.315185546875,
-0.5927734375,
0.058197021484375,
-0.51904296875,
0.351806640625,
-0.62353515625,
-0.397705078125,
-0.787109375,
-0.77197265625,
-0.485595703125,
0.1434326171875,
-0.57568359375,
-0.88330078125,
0.320068359375,
0.425048828125,
0.452880859375,
0.303466796875,
-0.1148681640625,
-0.161865234375,
0.97998046875,
0.83837890625,
0.4228515625,
0.92919921875,
0.204833984375,
0.04156494140625,
0.027252197265625,
-0.734375,
0.4873046875,
-0.41552734375,
0.4814453125,
0.08868408203125,
0.03558349609375,
-0.58642578125,
-1.33984375,
-0.20263671875,
0.26904296875,
0.38818359375,
-0.55126953125,
-1.072265625,
-0.685546875,
-0.84375,
-0.233154296875,
-0.49365234375,
0.6826171875,
-0.028778076171875,
0.1353759765625,
-0.39013671875,
-1.2890625,
4.5078125,
1.1337890625,
0.82421875,
0.541015625,
0.15234375,
0.84814453125,
0.75390625,
-0.5537109375,
-0.1748046875,
-0.315673828125,
0.308837890625,
-0.08154296875,
0.0743408203125,
0.810546875,
0.484375,
0.5986328125,
-0.77783203125,
-0.1781005859375,
-0.002239227294921875,
-1.052734375,
-0.72119140625,
-0.0164794921875,
-0.263671875,
0.2117919921875,
-0.29638671875,
0.16064453125,
0.8935546875,
-0.771484375,
-0.71630859375,
-0.5048828125,
0.1495361328125,
-0.39208984375,
0.89892578125,
0.139404296875,
-0.450439453125,
0.447509765625,
-0.1827392578125,
-0.67333984375,
-0.28564453125,
0.25927734375,
-0.20703125,
-0.10308837890625,
0.88720703125,
-0.287841796875,
0.0142822265625,
0.54052734375,
-0.50830078125,
0.6357421875,
0.469970703125,
-0.857421875,
0.89990234375,
-0.12481689453125,
0.384521484375,
-0.330078125,
-0.67578125,
0.035125732421875,
0.1168212890625,
-0.08099365234375,
-0.388427734375,
0.67529296875,
0.354736328125,
0.270263671875,
-0.1328125,
0.449462890625,
-0.84716796875,
0.68408203125,
-0.5068359375,
0.450927734375,
-0.49658203125,
0.1309814453125,
-0.1807861328125,
-0.25732421875,
-0.3720703125,
-0.331298828125,
0.6865234375,
0.4111328125,
-0.361572265625,
0.1756591796875,
0.30419921875,
-0.640625,
0.1666259765625,
-0.0625,
-0.291015625,
-0.288330078125,
0.410400390625,
1.158203125,
-0.7607421875,
-0.6025390625,
-0.5009765625,
0.51220703125,
0.71142578125,
0.301513671875,
0.009979248046875,
-0.66357421875,
-0.24072265625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.
Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:
<image>
After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.
Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.
Input
The only line of input contains the name of some exhibit β the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.
Output
Print one integer β the minimum number of rotations of the wheel, required to print the name given in the input.
Examples
Input
zeus
Output
18
Input
map
Output
35
Input
ares
Output
34
Note
<image>
To print the string from the first sample it would be optimal to perform the following sequence of rotations:
1. from 'a' to 'z' (1 rotation counterclockwise),
2. from 'z' to 'e' (5 clockwise rotations),
3. from 'e' to 'u' (10 rotations counterclockwise),
4. from 'u' to 's' (2 counterclockwise rotations).
In total, 1 + 5 + 10 + 2 = 18 rotations are required.
Submitted Solution:
```
s = input()
a = ''.join([chr(i) for i in range(ord('a'), ord('z')+1)])
if s[0] is not 'a':
s = 'a' + s
sum = 0
def distance(len_string, l_1, l_2):
i = (l_1 - l_2) % len_string
j = (l_2 - l_1) % len_string
return min(i, j)
for i, l in enumerate(s):
if l is s[-1]:
break
sum += distance(len(a), a.index(s[i]), a.index(s[i+1]))
print(sum)
```
No
| 38,190
|
[
0.398681640625,
-0.2208251953125,
-0.058868408203125,
0.361572265625,
-0.52392578125,
-0.474609375,
-0.12164306640625,
-0.0472412109375,
0.041717529296875,
0.494140625,
0.7119140625,
-0.308837890625,
0.054046630859375,
-0.74560546875,
-0.70849609375,
0.1092529296875,
-0.34814453125,
-0.75390625,
-0.611328125,
-0.1817626953125,
0.101806640625,
-0.2431640625,
-1.265625,
-0.24609375,
-0.6943359375,
0.92919921875,
0.2249755859375,
0.1690673828125,
0.95166015625,
1.1201171875,
-0.08489990234375,
-0.3525390625,
1.009765625,
-1.1513671875,
-0.09283447265625,
-0.37353515625,
0.46240234375,
-0.61962890625,
0.1578369140625,
-0.54345703125,
0.1785888671875,
-0.14404296875,
0.67236328125,
-0.5283203125,
-0.96923828125,
-0.06353759765625,
0.0051116943359375,
-0.47705078125,
-0.12445068359375,
-0.75732421875,
0.1982421875,
-0.2015380859375,
0.49755859375,
-0.26123046875,
-0.033966064453125,
-0.1844482421875,
0.04339599609375,
-0.0180816650390625,
-0.576171875,
0.12030029296875,
0.1685791015625,
0.24951171875,
0.1287841796875,
-1.01171875,
-0.2103271484375,
0.1785888671875,
0.11590576171875,
-0.349365234375,
-0.06536865234375,
-0.84375,
-0.297607421875,
0.258544921875,
0.006160736083984375,
-0.66162109375,
-0.31396484375,
-0.052703857421875,
0.01258087158203125,
0.197509765625,
-0.7734375,
0.521484375,
0.0232086181640625,
0.70947265625,
-0.1541748046875,
0.253662109375,
-0.52685546875,
-0.444091796875,
0.07879638671875,
-0.0865478515625,
0.2266845703125,
-0.289794921875,
-0.095458984375,
0.50634765625,
-0.623046875,
0.10211181640625,
0.69921875,
0.70947265625,
-0.461669921875,
0.477294921875,
0.365234375,
0.28466796875,
0.61474609375,
0.92529296875,
-0.724609375,
1.078125,
-0.1416015625,
-0.0653076171875,
0.2254638671875,
-0.2646484375,
-0.29345703125,
-0.59912109375,
-0.413818359375,
-0.411376953125,
0.5439453125,
0.276123046875,
-0.12200927734375,
0.67041015625,
0.24169921875,
0.435546875,
-0.77197265625,
0.47802734375,
0.0684814453125,
-0.290771484375,
0.290283203125,
-0.292236328125,
-0.04937744140625,
-0.2198486328125,
-0.387939453125,
0.58447265625,
-0.452392578125,
-0.01494598388671875,
0.5302734375,
0.5048828125,
0.0011720657348632812,
0.445068359375,
-0.1436767578125,
0.7373046875,
-0.1639404296875,
0.67431640625,
0.77197265625,
-0.69775390625,
0.257568359375,
-0.41650390625,
0.426513671875,
1.8388671875,
0.466552734375,
-0.180908203125,
0.650390625,
0.560546875,
-0.81787109375,
0.85986328125,
-0.5771484375,
0.439208984375,
-0.0159912109375,
0.1617431640625,
-0.3251953125,
-0.03717041015625,
-0.416259765625,
0.6884765625,
-0.0518798828125,
0.4208984375,
-0.55029296875,
0.01238250732421875,
-0.061920166015625,
0.953125,
-0.044769287109375,
0.9306640625,
-0.40576171875,
-0.396484375,
-0.151123046875,
-0.86474609375,
0.142822265625,
-0.1583251953125,
-0.06488037109375,
0.5859375,
0.57763671875,
0.8154296875,
0.8271484375,
-0.030303955078125,
0.6357421875,
0.1639404296875,
-0.30224609375,
0.09002685546875,
0.1602783203125,
0.67138671875,
-0.08575439453125,
0.29736328125,
0.017913818359375,
-0.2156982421875,
-0.37451171875,
-0.4921875,
-0.10491943359375,
0.6826171875,
-0.38134765625,
0.2012939453125,
-0.1279296875,
0.11962890625,
-0.9794921875,
-0.01776123046875,
0.09423828125,
-1.0380859375,
-0.300048828125,
0.6279296875,
-0.08245849609375,
0.45947265625,
-0.306396484375,
-0.923828125,
0.31787109375,
1.076171875,
-0.456787109375,
0.044097900390625,
0.6884765625,
0.358154296875,
-0.251220703125,
0.197021484375,
0.168701171875,
-0.267333984375,
-0.84130859375,
0.7119140625,
-0.36767578125,
0.142578125,
0.06536865234375,
0.72900390625,
0.170166015625,
0.59130859375,
-0.40673828125,
0.334228515625,
0.290771484375,
1.1865234375,
-0.0255279541015625,
0.56591796875,
0.141357421875,
1.05078125,
0.81982421875,
0.90869140625,
0.771484375,
0.06842041015625,
0.5048828125,
0.51953125,
-0.01666259765625,
-0.0291900634765625,
0.07049560546875,
0.30322265625,
0.58251953125,
0.39501953125,
-0.1689453125,
0.51171875,
-0.061737060546875,
-0.1436767578125,
-0.61865234375,
0.325927734375,
-0.345703125,
0.84814453125,
-0.16796875,
0.347900390625,
-0.2410888671875,
-0.2425537109375,
0.405029296875,
0.572265625,
-0.401123046875,
-0.5185546875,
0.23486328125,
0.34423828125,
0.06768798828125,
0.07147216796875,
-0.052764892578125,
0.2415771484375,
-0.0762939453125,
0.84521484375,
-0.39111328125,
-0.320068359375,
-1.08203125,
-0.96875,
-0.9033203125,
-0.139404296875,
-0.6103515625,
-0.060028076171875,
0.411376953125,
-0.5986328125,
0.6787109375,
-0.66552734375,
0.0771484375,
-0.09002685546875,
-0.71337890625,
0.724609375,
0.0743408203125,
0.716796875,
-0.357666015625,
0.44140625,
0.195068359375,
0.79443359375,
-0.66064453125,
-0.2169189453125,
-0.45166015625,
-0.34033203125,
0.426513671875,
-0.03240966796875,
0.515625,
-0.4169921875,
-0.9296875,
-0.80322265625,
-0.294677734375,
0.003910064697265625,
-0.50390625,
0.1912841796875,
-0.544921875,
0.8974609375,
0.5205078125,
-0.943359375,
0.456298828125,
0.77783203125,
-0.921875,
0.461669921875,
0.3095703125,
0.043701171875,
-0.87841796875,
1.158203125,
0.35400390625,
0.5625,
-0.2261962890625,
0.032379150390625,
-0.568359375,
0.290771484375,
-0.33349609375,
-0.5712890625,
-0.28271484375,
0.45166015625,
0.23388671875,
-1.0537109375,
0.62158203125,
-1.060546875,
-0.61474609375,
-0.48583984375,
-0.6142578125,
0.8359375,
0.669921875,
-0.0013494491577148438,
0.1844482421875,
-0.11370849609375,
0.201904296875,
0.72216796875,
0.4775390625,
-0.51416015625,
0.2193603515625,
0.47216796875,
-0.63134765625,
0.54296875,
0.46240234375,
-0.2464599609375,
-0.1497802734375,
-0.14013671875,
0.08837890625,
0.1966552734375,
0.247314453125,
0.1851806640625,
0.6015625,
0.83154296875,
-0.57373046875,
-0.2347412109375,
-0.65576171875,
1.0146484375,
0.389892578125,
0.50927734375,
0.405517578125,
-0.1064453125,
-0.56201171875,
-0.7978515625,
0.2105712890625,
0.415771484375,
0.716796875,
-0.5615234375,
0.716796875,
0.0200653076171875,
-0.64013671875,
0.07708740234375,
-0.619140625,
-0.444091796875,
0.79345703125,
-0.1844482421875,
0.83349609375,
-0.6484375,
0.06646728515625,
-0.426513671875,
-0.0384521484375,
-0.03753662109375,
0.04986572265625,
0.6416015625,
-0.2880859375,
-0.1591796875,
-0.5693359375,
-0.231689453125,
0.0033092498779296875,
-0.61572265625,
0.1689453125,
-0.708984375,
-0.51708984375,
-0.630859375,
0.46044921875,
0.94775390625,
0.477294921875,
-0.09600830078125,
0.33154296875,
0.1292724609375,
0.22265625,
0.385498046875,
-0.437255859375,
-0.016998291015625,
-0.6787109375,
0.76416015625,
0.393798828125,
-0.454833984375,
-0.55615234375,
-0.3017578125,
-0.68798828125,
0.1881103515625,
0.2347412109375,
-0.05413818359375,
-0.63037109375,
0.5078125,
-0.2288818359375,
0.438232421875,
-0.75830078125,
-0.3115234375,
-0.383544921875,
0.52099609375,
0.7177734375,
-0.09783935546875,
0.0036163330078125,
-0.6181640625,
0.5439453125,
0.68701171875,
0.0022430419921875,
-0.60595703125,
-0.1348876953125,
-0.740234375,
-0.56201171875,
-0.06707763671875,
0.75439453125,
0.30712890625,
0.1351318359375,
-1.1142578125,
0.68798828125,
0.275634765625,
-0.70751953125,
-0.09375,
0.3349609375,
0.093017578125,
-0.1512451171875,
0.65869140625,
-0.1903076171875,
-0.63232421875,
0.224609375,
-1.0400390625,
0.646484375,
-0.279052734375,
0.4072265625,
-0.08941650390625,
-0.136962890625,
0.189208984375,
0.28857421875,
-0.67724609375,
-0.038909912109375,
-0.1031494140625,
0.6416015625,
-1.06640625,
-0.58642578125,
0.55126953125,
-0.1280517578125,
-0.468505859375,
0.64453125,
-0.299072265625,
-0.368408203125,
0.315673828125,
-0.0211639404296875,
-0.5244140625,
0.07159423828125,
-0.450927734375,
0.367431640625,
0.0673828125,
-0.2607421875,
0.326904296875,
-0.58837890625,
1.1181640625,
0.1412353515625,
-0.5791015625,
-0.14794921875,
-1.078125,
-0.281005859375,
-0.24169921875,
-0.69287109375,
0.0645751953125,
0.0266265869140625,
-0.2017822265625,
-0.1766357421875,
-0.3271484375,
-0.58203125,
-0.09197998046875,
-0.6552734375,
0.1549072265625,
0.5673828125,
0.369140625,
0.2142333984375,
-0.156494140625,
-0.59765625,
0.269287109375,
-0.417724609375,
-0.032318115234375,
-0.47900390625,
-0.05474853515625,
-0.448486328125,
-0.35400390625,
-0.437744140625,
0.41357421875,
-0.374755859375,
0.08367919921875,
0.8916015625,
0.46533203125,
0.43212890625,
-0.2056884765625,
-0.4638671875,
0.71337890625,
0.064453125,
-1.212890625,
-0.57958984375,
1.0458984375,
0.065185546875,
0.640625,
0.47119140625,
-0.53076171875,
-1.0859375,
-1.01953125,
0.1884765625,
-0.6025390625,
-0.2442626953125,
-0.7490234375,
-0.39794921875,
-0.54541015625,
0.43359375,
-0.1121826171875,
-0.3330078125,
0.333740234375,
-0.875,
0.130615234375,
-0.599609375,
0.1607666015625,
-0.498046875,
-0.7685546875,
-0.5009765625,
0.9013671875,
0.25537109375,
0.294677734375,
-0.041534423828125,
0.08111572265625,
0.375244140625,
0.257080078125,
-0.25634765625,
-0.5029296875,
-0.147705078125,
0.55908203125,
-0.326416015625,
-0.1563720703125,
-0.12078857421875,
0.64013671875,
-0.9716796875,
0.314453125,
0.10992431640625,
-0.07855224609375,
-0.202880859375,
-0.307373046875,
1.05078125,
-0.340576171875,
-0.052337646484375,
-0.40966796875,
0.56640625,
0.64794921875,
-0.279052734375,
-0.094970703125,
-0.60595703125,
-0.3642578125,
-1.0830078125,
0.76318359375,
-0.046875,
0.302490234375,
-0.513671875,
-0.1146240234375,
1.3095703125,
-0.4521484375,
0.35888671875,
1.177734375,
0.1282958984375,
0.1827392578125,
-0.73291015625,
0.60009765625,
0.381591796875,
-0.42529296875,
-0.259765625,
-0.0231475830078125,
-0.80419921875,
0.45751953125,
-0.261962890625,
-0.9453125,
-0.58251953125,
0.50732421875,
1.1611328125,
-0.2568359375,
0.619140625,
-0.1876220703125,
-1.189453125,
-0.572265625,
0.73876953125,
-0.285400390625,
0.131591796875,
0.69873046875,
0.035308837890625,
-0.26806640625,
-0.06939697265625,
-0.0078887939453125,
-0.4609375,
-0.354736328125,
1.099609375,
-0.34765625,
-0.7724609375,
1.2265625,
0.53759765625,
-0.91845703125,
-0.9755859375,
0.09967041015625,
-0.1236572265625,
-0.281005859375,
-0.9482421875,
0.315673828125,
0.1998291015625,
-0.34423828125,
-0.055755615234375,
0.43798828125,
-0.30078125,
0.28125,
0.0771484375,
0.40185546875,
-0.60986328125,
-0.0171661376953125,
0.422119140625,
-0.462646484375,
-0.355712890625,
-0.89990234375,
-0.199462890625,
-0.51806640625,
-0.03521728515625,
0.38232421875,
-0.338623046875,
0.46142578125,
0.495361328125,
0.1475830078125,
0.9677734375,
-0.19580078125,
-0.1884765625,
0.066162109375,
-0.4462890625,
-0.61328125,
-0.447021484375,
0.30859375,
-0.378173828125,
-0.1051025390625,
-0.6904296875,
-0.33544921875,
0.44140625,
0.380126953125,
-0.53076171875,
-1.095703125,
-0.38623046875,
-1.0810546875,
-0.6435546875,
-0.376220703125,
-0.493896484375,
-0.32080078125,
-0.10260009765625,
0.047332763671875,
-0.38525390625,
0.06011962890625,
0.53662109375,
-0.231201171875,
0.72900390625,
-0.39794921875,
0.36572265625,
-0.81787109375,
-0.0440673828125,
-0.53564453125,
0.39501953125,
-0.52978515625,
-0.139404296875,
-0.60205078125,
0.108154296875,
0.1353759765625,
0.56103515625,
-0.31884765625,
0.30126953125,
0.2069091796875,
-0.3642578125,
-0.0163726806640625,
0.165771484375,
-0.150634765625,
0.58837890625,
0.794921875,
-0.1571044921875,
0.5478515625,
-0.2308349609375,
-0.5458984375,
-0.1363525390625,
0.5927734375,
0.43310546875,
-0.1629638671875,
-0.218017578125,
-0.1341552734375,
0.327392578125,
-0.93212890625,
0.306396484375,
-0.284423828125,
0.42431640625,
-0.04315185546875,
-0.25244140625,
0.52978515625,
0.7158203125,
0.07147216796875,
0.15478515625,
-0.06903076171875,
0.1611328125,
0.00920867919921875,
0.264892578125,
0.2049560546875,
0.5390625,
0.09661865234375,
-0.450927734375,
-0.1134033203125,
0.266845703125,
-0.367431640625,
0.58935546875,
-0.458251953125,
-0.53173828125,
-0.8359375,
-0.10797119140625,
-0.0169525146484375,
0.77001953125,
0.63330078125,
-0.61669921875,
-0.00923919677734375,
-0.2081298828125,
-0.7119140625,
0.10809326171875,
-1.2919921875,
-0.93212890625,
0.27734375,
-0.08465576171875,
-0.2213134765625,
-0.2646484375,
-0.587890625,
-0.04608154296875,
-0.09698486328125,
0.677734375,
-0.7626953125,
0.39794921875,
0.0293121337890625,
0.7119140625,
-0.60302734375,
0.298095703125,
0.28271484375,
0.71728515625,
-0.403564453125,
-0.492919921875,
-0.0814208984375,
1.267578125,
0.1170654296875,
0.1529541015625,
-0.403564453125,
0.1336669921875,
0.04779052734375,
0.1519775390625,
-0.30029296875,
-0.044189453125,
-0.42724609375,
1.1259765625,
-0.8388671875,
0.09466552734375,
0.1812744140625,
0.44287109375,
0.12030029296875,
-0.49072265625,
-0.564453125,
0.94482421875,
1.0537109375,
0.1646728515625,
0.537109375,
0.53662109375,
0.556640625,
-0.32177734375,
-0.11260986328125,
-0.350341796875,
0.86572265625,
0.4111328125,
0.48876953125,
-0.1917724609375,
0.59326171875,
0.8115234375,
-0.0171356201171875,
-0.197509765625,
0.5048828125,
0.30517578125,
-0.34326171875,
0.363525390625,
-0.005645751953125,
-0.0190582275390625,
-0.1951904296875,
-0.17138671875,
0.560546875,
-0.38134765625,
-0.0369873046875,
-0.244384765625,
-0.671875,
0.83154296875,
-0.169921875,
-0.4501953125,
0.67236328125,
-0.45361328125,
0.450439453125,
0.300537109375,
0.2025146484375,
-0.01428985595703125,
0.85888671875,
0.880859375,
0.34130859375,
0.42626953125,
0.6865234375,
0.2919921875,
-0.90771484375,
0.02911376953125,
0.62890625,
0.0225067138671875,
-0.331787109375,
-0.61572265625,
-0.91845703125,
0.74365234375,
-0.30029296875,
-0.2890625,
0.332275390625,
-0.77099609375,
0.0966796875,
-0.67333984375,
0.97021484375,
-0.72412109375,
0.363037109375,
0.282470703125,
0.07232666015625,
-0.57080078125,
1.0771484375,
-0.352783203125,
0.393310546875,
0.260986328125,
1.306640625,
0.163330078125,
1.302734375,
0.81640625,
-0.277099609375,
-0.1614990234375,
0.5390625,
-0.4423828125,
-0.47607421875,
-0.1510009765625,
-0.260498046875,
-0.244873046875,
-0.982421875,
-0.375732421875,
-0.479248046875,
1.1220703125,
0.0634765625,
-0.85498046875,
-0.257080078125,
0.30859375,
-0.984375,
0.56103515625,
0.138916015625,
0.33154296875,
0.274658203125,
0.1961669921875,
-0.314697265625,
-0.5869140625,
0.0736083984375,
-0.5146484375,
0.359619140625,
-0.61279296875,
-0.38525390625,
-0.80126953125,
-0.779296875,
-0.479736328125,
0.1392822265625,
-0.583984375,
-0.88037109375,
0.319580078125,
0.425537109375,
0.445556640625,
0.3291015625,
-0.1087646484375,
-0.162841796875,
0.978515625,
0.84130859375,
0.431884765625,
0.94091796875,
0.214111328125,
0.0477294921875,
0.0191497802734375,
-0.72802734375,
0.478271484375,
-0.4228515625,
0.48876953125,
0.1002197265625,
0.06439208984375,
-0.58740234375,
-1.318359375,
-0.2122802734375,
0.26318359375,
0.3798828125,
-0.55126953125,
-1.0810546875,
-0.67822265625,
-0.85791015625,
-0.253173828125,
-0.488037109375,
0.69873046875,
-0.036590576171875,
0.1279296875,
-0.40185546875,
-1.267578125,
4.5,
1.14453125,
0.8349609375,
0.564453125,
0.1524658203125,
0.849609375,
0.75830078125,
-0.556640625,
-0.1671142578125,
-0.32275390625,
0.297607421875,
-0.09100341796875,
0.08233642578125,
0.802734375,
0.499267578125,
0.59912109375,
-0.77978515625,
-0.1846923828125,
0.01446533203125,
-1.0771484375,
-0.732421875,
-0.0126495361328125,
-0.25830078125,
0.2120361328125,
-0.29150390625,
0.1590576171875,
0.8828125,
-0.76611328125,
-0.72900390625,
-0.52490234375,
0.14697265625,
-0.394775390625,
0.91162109375,
0.1328125,
-0.43115234375,
0.459228515625,
-0.18359375,
-0.67236328125,
-0.284912109375,
0.2437744140625,
-0.208740234375,
-0.0946044921875,
0.87890625,
-0.2861328125,
0.00989532470703125,
0.5478515625,
-0.52587890625,
0.6416015625,
0.461181640625,
-0.8759765625,
0.9052734375,
-0.11834716796875,
0.38232421875,
-0.30810546875,
-0.68212890625,
0.040069580078125,
0.10406494140625,
-0.091552734375,
-0.372314453125,
0.69091796875,
0.357177734375,
0.28173828125,
-0.129150390625,
0.43994140625,
-0.84716796875,
0.66552734375,
-0.479248046875,
0.4501953125,
-0.5029296875,
0.11846923828125,
-0.1671142578125,
-0.266357421875,
-0.3681640625,
-0.332763671875,
0.693359375,
0.427001953125,
-0.376220703125,
0.1795654296875,
0.3134765625,
-0.6513671875,
0.158935546875,
-0.07928466796875,
-0.2822265625,
-0.290771484375,
0.4140625,
1.1611328125,
-0.76806640625,
-0.6142578125,
-0.50927734375,
0.5087890625,
0.71240234375,
0.300537109375,
0.00794219970703125,
-0.65576171875,
-0.25830078125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.
In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. The generic syntax for declaring a macro is the following:
#define macro_name macro_value
After the macro has been declared, "macro_name" is replaced with "macro_value" each time it is met in the program (only the whole tokens can be replaced; i.e. "macro_name" is replaced only when it is surrounded by spaces or other non-alphabetic symbol). A "macro_value" within our model can only be an arithmetic expression consisting of variables, four arithmetic operations, brackets, and also the names of previously declared macros (in this case replacement is performed sequentially). The process of replacing macros with their values is called substitution.
One of the main problems arising while using macros β the situation when as a result of substitution we get an arithmetic expression with the changed order of calculation because of different priorities of the operations.
Let's consider the following example. Say, we declared such a #define construction:
#define sum x + y
and further in the program the expression "2 * sum" is calculated. After macro substitution is performed we get "2 * x + y", instead of intuitively expected "2 * (x + y)".
Let's call the situation "suspicious", if after the macro substitution the order of calculation changes, falling outside the bounds of some macro. Thus, your task is to find out by the given set of #define definitions and the given expression if this expression is suspicious or not.
Let's speak more formally. We should perform an ordinary macros substitution in the given expression. Moreover, we should perform a "safe" macros substitution in the expression, putting in brackets each macro value; after this, guided by arithmetic rules of brackets expansion, we can omit some of the brackets. If there exist a way to get an expression, absolutely coinciding with the expression that is the result of an ordinary substitution (character-by-character, but ignoring spaces), then this expression and the macros system are called correct, otherwise β suspicious.
Note that we consider the "/" operation as the usual mathematical division, not the integer division like in C/C++. That's why, for example, in the expression "a*(b/c)" we can omit brackets to get the expression "a*b/c".
Input
The first line contains the only number n (0 β€ n β€ 100) β the amount of #define constructions in the given program.
Then there follow n lines, each of them contains just one #define construction. Each construction has the following syntax:
#define name expression
where
* name β the macro name,
* expression β the expression with which the given macro will be replaced. An expression is a non-empty string, containing digits,names of variables, names of previously declared macros, round brackets and operational signs +-*/. It is guaranteed that the expression (before and after macros substitution) is a correct arithmetic expression, having no unary operations. The expression contains only non-negative integers, not exceeding 109.
All the names (#define constructions' names and names of their arguments) are strings of case-sensitive Latin characters. It is guaranteed that the name of any variable is different from any #define construction.
Then, the last line contains an expression that you are to check. This expression is non-empty and satisfies the same limitations as the expressions in #define constructions.
The input lines may contain any number of spaces anywhere, providing these spaces do not break the word "define" or the names of constructions and variables. In particular, there can be any number of spaces before and after the "#" symbol.
The length of any line from the input file does not exceed 100 characters.
Output
Output "OK", if the expression is correct according to the above given criterion, otherwise output "Suspicious".
Examples
Input
1
#define sum x + y
1 * sum
Output
Suspicious
Input
1
#define sum (x + y)
sum - sum
Output
OK
Input
4
#define sum x + y
#define mul a * b
#define div a / b
#define expr sum + mul * div * mul
expr
Output
OK
Input
3
#define SumSafe (a+b)
#define DivUnsafe a/b
#define DenominatorUnsafe a*b
((SumSafe) + DivUnsafe/DivUnsafe + x/DenominatorUnsafe)
Output
Suspicious
Tags: dp, expression parsing, implementation
Correct Solution:
```
#!/usr/bin/env python
"""
CodeForces: 7E. Defining Macros
The key for the solution is the naked operators that are not surrounded by
the parentheses in the macro definition.
Suspicious patterns of the operators in the appearance order are:
o{-} n{+-}
o{*} n{+-}
o{/} n{+-*/}
n{+-} o{*}
n{+-} o{/}
where:
"o{}": an operator before or after the macro might construct
a suspicious expression with the operators in "n{}"
"n{}": a subset of the naked operators in the macro definition
that might construct a suspicious expression with the operator "o"
If the pair of operators in the "o{}" and "n{}" are matched
in the expression, the entire expression would be suspicious.
"""
# Represent the operator as the bit mask:
# Pseudo operator whose priority is lower than "+",
# Add (+), Subtract (-), Multiply (*) and Division (/)
P, A, S, M, D = 1, 2, 4, 8, 16
ADD = A | S
ANY = A | S | M | D
# Map of the operators (+-*/) to the bit mask
OP_BIT = {"+": A, "-": S, "*": M, "/": D, ")": 0}
# unsafe naked operators against the operator before and after the macro
UNSAFE_BEFORE = {P: 0, A: 0, S: ADD, M: ADD, D: ANY}
UNSAFE_AFTER = {P: 0, A: 0, S: 0, M: ADD, D: ADD}
# Macro definitions:
# a map from the macro name to the set of its naked operators
# Note: the set is represented as a bit pattern
macro = dict()
# Parse expression with checking suspicious expression
def expr(chars,
# following arguments are the short cut
pseudo=P,
expand=macro.get,
op_bit=OP_BIT,
unsafe_before=UNSAFE_BEFORE,
unsafe_after=UNSAFE_AFTER):
# stack of the operator before the left parenthesis "("
paren = []
push = paren.append
pop = paren.pop
# list of characters that would be a macro name or a number
name = []
keep = name.append
forget = name.clear
# last_op: last operator before the macro name or the number
# retval: set of the naked operators of this expression
# naked: set of the naked operators of the macro expanded
last_op = retval = naked = pseudo
# expand the macro and check the preceding operator
def safe():
nonlocal naked
naked = expand("".join(name), pseudo)
forget()
# early exit for a suspicious expression and a value
if naked <= pseudo:
return naked
# safety check against the operator before the macro
return not (unsafe_before[last_op] & naked)
# parse the expression
for c in chars:
if c == "(":
push(last_op)
last_op = pseudo
elif c not in op_bit:
keep(c)
elif not safe():
return 0
elif c == ")":
last_op = pop()
else:
# safety check against the operator after the macro
last_op = op_bit[c]
if unsafe_after[last_op] & naked:
return 0
# record operators not surrounded by the parentheses
if not paren:
retval |= last_op
if name and not safe():
return 0
return retval
def main():
global macro
def chars(b, t):
for k in range(b, len(t)):
yield from t[k]
for _ in range(int(input())):
token = input().split()
s = token[0] == "#"
macro[token[1 + s]] = expr(chars(2 + s, token))
print("OK" if expr((c for c in input() if c != " ")) else "Suspicious")
if __name__ == '__main__':
main()
```
| 38,222
|
[
0.04681396484375,
-0.391357421875,
0.412841796875,
0.2978515625,
-0.54052734375,
-0.4716796875,
0.277099609375,
0.421142578125,
-0.027191162109375,
0.58740234375,
0.87548828125,
0.0731201171875,
0.056610107421875,
-0.7314453125,
-0.75146484375,
0.16650390625,
-0.39990234375,
-1.01953125,
-0.63525390625,
0.5166015625,
0.292236328125,
-0.06689453125,
-1.2724609375,
-0.3330078125,
-0.60302734375,
0.98291015625,
0.1651611328125,
-0.22705078125,
0.57373046875,
1.53125,
-0.451416015625,
-0.223388671875,
0.175048828125,
-0.483154296875,
-0.724609375,
-0.5068359375,
0.1944580078125,
-1.09765625,
0.0865478515625,
-0.362060546875,
-0.010223388671875,
-0.328125,
0.1881103515625,
-0.8671875,
-1.0361328125,
-0.185546875,
-0.06536865234375,
-0.54248046875,
0.348388671875,
-0.1220703125,
0.0419921875,
0.04132080078125,
0.4560546875,
-0.293701171875,
-0.01947021484375,
-0.0843505859375,
0.2357177734375,
-0.282958984375,
-0.8154296875,
0.658203125,
-0.43798828125,
0.0439453125,
-0.7119140625,
-1.076171875,
0.2330322265625,
0.20703125,
-0.498046875,
-0.49072265625,
-0.09112548828125,
-0.291748046875,
-0.0770263671875,
0.382080078125,
-0.41796875,
-0.354248046875,
-0.4501953125,
-0.533203125,
0.1680908203125,
-0.02801513671875,
-0.56640625,
0.38427734375,
0.172607421875,
0.76318359375,
0.2259521484375,
0.03692626953125,
-0.69384765625,
-0.1639404296875,
-0.316650390625,
-0.142578125,
0.113037109375,
-0.305419921875,
-0.25830078125,
0.6484375,
-0.11724853515625,
-0.384033203125,
0.59375,
0.71484375,
-0.466064453125,
0.72265625,
-0.11676025390625,
-0.35595703125,
0.7529296875,
0.646484375,
-0.207763671875,
0.7841796875,
-0.615234375,
0.2337646484375,
0.65625,
0.2271728515625,
-0.57666015625,
-0.7099609375,
-0.3017578125,
-0.2115478515625,
0.68115234375,
-0.17626953125,
0.05859375,
1.279296875,
-0.1240234375,
0.362060546875,
-0.426025390625,
0.388916015625,
0.53759765625,
0.11895751953125,
0.248046875,
-0.49462890625,
-0.1346435546875,
-0.1312255859375,
-0.3916015625,
0.8505859375,
-0.415283203125,
-0.35400390625,
0.1710205078125,
-0.42822265625,
-0.2310791015625,
0.681640625,
-0.044647216796875,
1.1142578125,
-0.6435546875,
0.8427734375,
0.195068359375,
-0.9140625,
0.86474609375,
-0.06298828125,
0.2310791015625,
1.525390625,
0.458251953125,
0.449462890625,
0.75048828125,
0.05352783203125,
-0.6591796875,
0.08001708984375,
-0.76708984375,
0.479736328125,
0.0228271484375,
0.06561279296875,
-0.33740234375,
0.0146942138671875,
-0.66650390625,
0.32763671875,
0.42919921875,
0.134765625,
-0.166259765625,
-0.1195068359375,
0.33935546875,
0.97900390625,
-0.0036106109619140625,
0.9423828125,
-0.58740234375,
-0.09259033203125,
-0.11529541015625,
-0.369384765625,
0.75439453125,
-0.40185546875,
-0.72021484375,
0.91015625,
0.7451171875,
1.294921875,
0.96533203125,
-0.2464599609375,
0.2239990234375,
0.1640625,
-0.5927734375,
0.036773681640625,
0.42236328125,
0.7705078125,
0.71728515625,
0.1888427734375,
0.15869140625,
0.1881103515625,
-0.4453125,
-0.1783447265625,
0.072509765625,
0.7822265625,
-0.69482421875,
0.34716796875,
0.17431640625,
0.292236328125,
-1.1962890625,
-0.149169921875,
0.37109375,
-0.76123046875,
-0.322021484375,
0.619140625,
-0.1708984375,
0.161865234375,
-0.85400390625,
-0.3515625,
0.48095703125,
1.041015625,
-0.205078125,
0.370361328125,
0.305419921875,
-0.432373046875,
-0.6015625,
0.0394287109375,
0.05645751953125,
-0.1605224609375,
-0.250732421875,
0.31005859375,
-0.0278167724609375,
0.01143646240234375,
-0.004852294921875,
0.394287109375,
0.422119140625,
0.85009765625,
0.1390380859375,
-0.53857421875,
0.416748046875,
1.34375,
-0.045806884765625,
0.61328125,
0.292236328125,
0.765625,
0.1575927734375,
0.99169921875,
0.55859375,
0.08306884765625,
0.70849609375,
0.93310546875,
-0.1795654296875,
0.0234222412109375,
0.54052734375,
0.64453125,
0.2109375,
0.7509765625,
-0.120361328125,
0.52001953125,
0.159912109375,
-0.14794921875,
-0.1031494140625,
0.423828125,
-0.1256103515625,
0.91796875,
0.16845703125,
0.6337890625,
-0.10882568359375,
-0.283935546875,
0.2105712890625,
0.81689453125,
-0.56201171875,
-0.488525390625,
0.12841796875,
0.10302734375,
0.45166015625,
-0.11102294921875,
0.400146484375,
0.76953125,
0.38330078125,
0.322509765625,
-0.8740234375,
-0.7021484375,
-0.03350830078125,
-0.388427734375,
-0.8330078125,
-0.498779296875,
-0.5048828125,
0.2161865234375,
0.11114501953125,
-0.48291015625,
0.3896484375,
-0.12841796875,
-0.5263671875,
0.5048828125,
-0.8486328125,
0.6806640625,
-0.01157379150390625,
0.650390625,
-1.0361328125,
1.0732421875,
0.0214691162109375,
0.92822265625,
-0.56494140625,
-0.404296875,
0.5048828125,
-0.6796875,
0.359130859375,
0.2275390625,
0.1495361328125,
-0.03912353515625,
-0.61962890625,
-0.88427734375,
-0.68408203125,
0.06280517578125,
-0.0711669921875,
0.09735107421875,
-0.66162109375,
1.0205078125,
0.054107666015625,
-0.476318359375,
1.072265625,
1.1845703125,
-1.1630859375,
0.87353515625,
0.1903076171875,
0.0022125244140625,
-0.5625,
0.8818359375,
0.61474609375,
0.548828125,
-0.122314453125,
-0.2012939453125,
-0.57080078125,
-0.06146240234375,
0.27490234375,
-0.71142578125,
-0.85498046875,
0.420166015625,
0.525390625,
-0.802734375,
0.489990234375,
-0.92333984375,
-0.453125,
-0.2100830078125,
-0.381103515625,
0.98779296875,
0.52392578125,
-0.14013671875,
-0.2373046875,
0.27978515625,
-0.0921630859375,
0.6416015625,
0.2369384765625,
-0.249267578125,
0.244140625,
0.200927734375,
0.33251953125,
0.45556640625,
0.232177734375,
-0.64111328125,
-0.1925048828125,
-0.2099609375,
0.49072265625,
0.61474609375,
0.1409912109375,
0.64208984375,
0.113525390625,
0.595703125,
-0.54931640625,
-0.01274871826171875,
-0.164794921875,
0.1162109375,
0.8515625,
0.64404296875,
-0.297607421875,
-0.3154296875,
-0.1649169921875,
-0.6728515625,
-0.454345703125,
0.20263671875,
0.76123046875,
-0.406005859375,
0.8408203125,
-0.1331787109375,
-0.82958984375,
0.33740234375,
-0.319580078125,
-0.0474853515625,
1.0927734375,
-0.07379150390625,
0.35205078125,
-0.67236328125,
0.2130126953125,
0.319580078125,
0.0197296142578125,
0.75537109375,
0.1358642578125,
0.1688232421875,
-0.73095703125,
-0.818359375,
-0.61572265625,
0.02435302734375,
-0.39404296875,
-0.6650390625,
0.2327880859375,
-0.62646484375,
-0.047332763671875,
-1.3486328125,
0.6044921875,
0.716796875,
0.442138671875,
0.044891357421875,
0.41748046875,
0.051544189453125,
0.463134765625,
0.49560546875,
-0.14990234375,
0.008453369140625,
-0.7021484375,
0.591796875,
-0.491943359375,
-0.106689453125,
-0.419677734375,
-0.239990234375,
0.175537109375,
0.1312255859375,
-0.347900390625,
0.266845703125,
-0.70068359375,
0.2213134765625,
0.400146484375,
0.47705078125,
-0.7119140625,
-0.0002048015594482422,
-0.107177734375,
0.484375,
0.43798828125,
-1.12109375,
0.2496337890625,
-0.63525390625,
0.2783203125,
0.4873046875,
-0.188232421875,
-0.44921875,
-0.71337890625,
-0.62158203125,
-0.65966796875,
0.12017822265625,
0.40478515625,
-0.08819580078125,
0.10595703125,
-1.228515625,
0.21728515625,
0.2064208984375,
-0.480224609375,
0.244873046875,
0.08233642578125,
0.0648193359375,
0.207763671875,
0.68896484375,
-0.11077880859375,
-0.77783203125,
0.703125,
-0.77783203125,
1.068359375,
-0.49609375,
0.5126953125,
-0.05987548828125,
0.30517578125,
-0.31884765625,
0.130126953125,
-0.441162109375,
-0.1165771484375,
-0.136962890625,
0.4521484375,
-0.931640625,
-0.8125,
0.62158203125,
-0.8486328125,
-0.10894775390625,
0.986328125,
0.387451171875,
-0.60205078125,
0.264892578125,
0.481201171875,
-0.437255859375,
0.39794921875,
-0.8828125,
0.356201171875,
-0.09771728515625,
-0.2171630859375,
-0.2412109375,
-0.487060546875,
0.37109375,
-0.2342529296875,
-1.2392578125,
-0.20703125,
-1.3046875,
-0.409423828125,
-0.2064208984375,
-0.1689453125,
0.501953125,
-0.10308837890625,
0.034942626953125,
0.1092529296875,
-0.275146484375,
-1.0390625,
-0.211669921875,
-0.9111328125,
-0.0438232421875,
-0.115478515625,
0.56591796875,
0.76806640625,
-0.024261474609375,
-0.467041015625,
-0.0482177734375,
-0.62646484375,
-0.316162109375,
-0.5859375,
-0.3046875,
0.062469482421875,
-0.060394287109375,
-0.499755859375,
-0.107666015625,
-0.05615234375,
0.53369140625,
0.70654296875,
-0.1641845703125,
0.4296875,
0.31689453125,
-0.143798828125,
0.9453125,
0.09246826171875,
-0.986328125,
-0.6171875,
0.476318359375,
-0.50390625,
1.06640625,
0.0672607421875,
-0.493408203125,
-0.453125,
-0.97705078125,
0.386962890625,
-0.273681640625,
-0.061004638671875,
-0.98095703125,
-0.84912109375,
-0.13232421875,
0.72900390625,
0.1337890625,
-1.0615234375,
-0.459716796875,
-0.736328125,
0.2088623046875,
-0.38671875,
-0.2353515625,
-0.8037109375,
-0.96484375,
-0.2218017578125,
1.0458984375,
0.1815185546875,
0.30322265625,
-0.2196044921875,
-0.357421875,
0.818359375,
0.31640625,
-0.56201171875,
-0.27734375,
-0.0565185546875,
0.333251953125,
-0.0092010498046875,
0.227783203125,
-0.5087890625,
1.265625,
-0.9111328125,
0.5830078125,
0.064453125,
-0.380126953125,
-0.0716552734375,
0.10308837890625,
0.556640625,
-0.272216796875,
-0.11749267578125,
-0.411376953125,
0.7255859375,
0.43408203125,
-0.40234375,
-0.76318359375,
-0.31005859375,
-0.619140625,
-1.0380859375,
0.58740234375,
-0.39697265625,
0.359130859375,
-0.3388671875,
0.030853271484375,
0.998046875,
-0.53369140625,
0.552734375,
1.7822265625,
0.2216796875,
0.09893798828125,
-0.86669921875,
0.859375,
0.58837890625,
-0.470947265625,
-0.0277557373046875,
0.76611328125,
-0.71923828125,
0.41748046875,
-0.280517578125,
-0.94677734375,
-0.505859375,
0.1439208984375,
0.96630859375,
0.3515625,
0.8134765625,
-0.2244873046875,
-0.8935546875,
-0.88671875,
1.041015625,
-0.1552734375,
0.09588623046875,
0.91845703125,
0.25927734375,
-0.059112548828125,
0.313232421875,
0.07818603515625,
-0.29638671875,
-0.65966796875,
1.4716796875,
-0.3583984375,
-0.340576171875,
0.60009765625,
0.646484375,
-0.818359375,
-1.1845703125,
0.018341064453125,
-0.1004638671875,
-0.287841796875,
-0.32568359375,
-0.1920166015625,
0.71533203125,
-0.64306640625,
0.269775390625,
0.4765625,
0.11517333984375,
-0.0242462158203125,
0.410400390625,
-0.18017578125,
-0.18896484375,
0.6103515625,
0.56201171875,
-0.1998291015625,
-0.10577392578125,
-0.447998046875,
-0.01203155517578125,
-0.1619873046875,
-0.462646484375,
1.212890625,
-0.066650390625,
0.66796875,
0.626953125,
-0.2430419921875,
0.71923828125,
-0.59375,
-0.56884765625,
-0.1785888671875,
-0.92236328125,
-0.9296875,
0.4130859375,
-0.0853271484375,
-0.1834716796875,
0.2183837890625,
-0.3916015625,
0.091796875,
0.82568359375,
0.44970703125,
-0.354248046875,
-1.2177734375,
-0.10552978515625,
-1.7177734375,
-0.6162109375,
-0.41943359375,
-0.61376953125,
-0.3935546875,
0.265380859375,
0.1519775390625,
-0.68896484375,
-0.214599609375,
-0.0640869140625,
-0.1826171875,
0.552734375,
-0.395263671875,
0.381591796875,
-0.2327880859375,
-0.60498046875,
-0.728515625,
-0.298583984375,
-0.37939453125,
-0.501953125,
-0.666015625,
0.26025390625,
0.4208984375,
0.371826171875,
-0.146484375,
0.008636474609375,
-0.042266845703125,
-1.0654296875,
0.2049560546875,
0.256103515625,
-0.381591796875,
1.1015625,
0.51806640625,
0.3173828125,
0.587890625,
-0.0693359375,
-0.490966796875,
-0.1461181640625,
0.7763671875,
0.292724609375,
-0.28515625,
-0.9853515625,
-0.1883544921875,
-0.1431884765625,
-1.0234375,
-0.0823974609375,
-0.28857421875,
0.2298583984375,
0.49560546875,
-0.1612548828125,
0.5703125,
0.81396484375,
0.294677734375,
0.41259765625,
0.0682373046875,
0.2113037109375,
0.52587890625,
0.0804443359375,
0.05572509765625,
0.1795654296875,
-0.1671142578125,
0.08251953125,
0.275634765625,
0.5615234375,
-0.32421875,
0.1810302734375,
-0.03631591796875,
-0.73876953125,
-0.58203125,
-0.1990966796875,
-0.132568359375,
0.501953125,
0.435302734375,
-0.3212890625,
0.0222320556640625,
-0.278564453125,
-0.431884765625,
0.0384521484375,
-1.06640625,
-0.6767578125,
1.076171875,
-0.38720703125,
-0.93310546875,
-0.368408203125,
-0.5400390625,
-0.2171630859375,
-0.5546875,
0.466064453125,
-0.2403564453125,
0.39013671875,
0.08721923828125,
0.2373046875,
-0.42333984375,
0.07928466796875,
0.2225341796875,
0.34619140625,
-0.607421875,
-0.5771484375,
0.2081298828125,
0.6669921875,
0.062286376953125,
-0.1978759765625,
-0.260009765625,
0.078369140625,
0.045867919921875,
0.1973876953125,
-0.54638671875,
0.01306915283203125,
-0.60791015625,
0.5966796875,
-0.96044921875,
-0.031463623046875,
-0.7021484375,
0.5810546875,
0.11859130859375,
-0.69921875,
-0.53662109375,
1.1337890625,
0.59814453125,
-0.3359375,
0.66943359375,
0.66015625,
0.5302734375,
-0.053436279296875,
-0.258056640625,
0.020294189453125,
0.62158203125,
0.94580078125,
0.58740234375,
0.09210205078125,
0.287109375,
0.252197265625,
0.445068359375,
-0.4482421875,
0.30224609375,
-0.217529296875,
-0.25927734375,
-0.3037109375,
0.1981201171875,
-0.2861328125,
-0.032196044921875,
-0.490234375,
0.35498046875,
-0.60595703125,
0.117431640625,
-0.378173828125,
-0.748046875,
0.6298828125,
-0.05474853515625,
-0.77490234375,
0.045745849609375,
-0.1890869140625,
0.751953125,
0.73974609375,
-0.40576171875,
0.291015625,
0.87646484375,
0.447021484375,
-0.0311126708984375,
-0.045806884765625,
0.50732421875,
0.5615234375,
-0.66748046875,
0.099365234375,
0.1922607421875,
0.437255859375,
-0.257080078125,
-0.576171875,
-1.01953125,
0.383544921875,
-0.2330322265625,
-0.1893310546875,
0.20458984375,
-0.458984375,
-0.08868408203125,
-0.51025390625,
0.771484375,
-0.8642578125,
0.1273193359375,
0.4765625,
-0.32373046875,
-0.83837890625,
1.015625,
0.080322265625,
0.34130859375,
0.31103515625,
0.99072265625,
0.07196044921875,
1.3193359375,
0.517578125,
-0.044464111328125,
-0.273193359375,
0.324951171875,
-0.277587890625,
-0.677734375,
0.06732177734375,
-0.2027587890625,
0.26953125,
-0.02459716796875,
-0.1180419921875,
0.337890625,
0.890625,
-0.122802734375,
-0.74951171875,
0.1116943359375,
0.270751953125,
-0.269287109375,
0.43212890625,
0.23193359375,
0.3232421875,
0.176025390625,
0.005401611328125,
-0.3359375,
-0.6005859375,
-0.0635986328125,
-0.8623046875,
0.5185546875,
0.12371826171875,
-0.168701171875,
-0.67578125,
-0.36767578125,
-0.09759521484375,
0.513671875,
-0.548828125,
-0.8408203125,
0.78271484375,
0.728515625,
-0.03948974609375,
0.41552734375,
-0.224853515625,
-0.188720703125,
0.9130859375,
1.380859375,
-0.541015625,
0.74755859375,
0.40771484375,
-0.1444091796875,
0.20068359375,
-0.61328125,
0.32177734375,
-0.2022705078125,
-0.314453125,
-0.1617431640625,
0.302734375,
-0.35546875,
-0.9267578125,
-0.046630859375,
1.0166015625,
0.403564453125,
-0.3447265625,
-1.2119140625,
-0.452880859375,
-1.1640625,
-0.02069091796875,
-0.82080078125,
0.47998046875,
-0.0887451171875,
-0.2122802734375,
-0.1763916015625,
-1.0830078125,
4.3359375,
0.67578125,
1.015625,
0.60888671875,
0.42578125,
0.51904296875,
0.22900390625,
-0.7138671875,
0.56396484375,
-0.85009765625,
0.40185546875,
-0.09539794921875,
-0.266845703125,
0.80322265625,
0.70654296875,
0.5302734375,
-0.9384765625,
-0.03155517578125,
-0.386474609375,
-0.58447265625,
-0.89013671875,
0.10784912109375,
-0.0277252197265625,
0.8193359375,
-0.274658203125,
0.494140625,
0.36669921875,
-0.9248046875,
-0.333984375,
-0.53076171875,
-0.25,
-0.2481689453125,
0.68115234375,
0.0093231201171875,
-0.6162109375,
0.53125,
-0.37353515625,
-0.2310791015625,
-0.125,
-0.0133819580078125,
-0.40283203125,
-0.1982421875,
0.58544921875,
-0.5654296875,
-0.258544921875,
0.8837890625,
-0.58935546875,
0.203857421875,
0.578125,
-1.2490234375,
0.81689453125,
-0.296142578125,
0.428466796875,
-0.59423828125,
-0.7958984375,
-0.010345458984375,
0.11297607421875,
-0.3701171875,
-0.4306640625,
0.5478515625,
-0.0426025390625,
0.708984375,
0.09722900390625,
0.5810546875,
-0.486328125,
0.53662109375,
-0.48779296875,
0.744140625,
-0.6240234375,
-0.52392578125,
-0.210205078125,
-0.245849609375,
0.1744384765625,
-0.5673828125,
0.61669921875,
0.01708984375,
-0.375732421875,
0.26171875,
0.350830078125,
-0.62109375,
-0.068603515625,
-0.2509765625,
-0.52001953125,
-0.8955078125,
0.66064453125,
0.802734375,
-0.400634765625,
-0.45458984375,
-0.10888671875,
0.55908203125,
0.51904296875,
0.43115234375,
0.01360321044921875,
-0.5068359375,
-0.70361328125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.
In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. The generic syntax for declaring a macro is the following:
#define macro_name macro_value
After the macro has been declared, "macro_name" is replaced with "macro_value" each time it is met in the program (only the whole tokens can be replaced; i.e. "macro_name" is replaced only when it is surrounded by spaces or other non-alphabetic symbol). A "macro_value" within our model can only be an arithmetic expression consisting of variables, four arithmetic operations, brackets, and also the names of previously declared macros (in this case replacement is performed sequentially). The process of replacing macros with their values is called substitution.
One of the main problems arising while using macros β the situation when as a result of substitution we get an arithmetic expression with the changed order of calculation because of different priorities of the operations.
Let's consider the following example. Say, we declared such a #define construction:
#define sum x + y
and further in the program the expression "2 * sum" is calculated. After macro substitution is performed we get "2 * x + y", instead of intuitively expected "2 * (x + y)".
Let's call the situation "suspicious", if after the macro substitution the order of calculation changes, falling outside the bounds of some macro. Thus, your task is to find out by the given set of #define definitions and the given expression if this expression is suspicious or not.
Let's speak more formally. We should perform an ordinary macros substitution in the given expression. Moreover, we should perform a "safe" macros substitution in the expression, putting in brackets each macro value; after this, guided by arithmetic rules of brackets expansion, we can omit some of the brackets. If there exist a way to get an expression, absolutely coinciding with the expression that is the result of an ordinary substitution (character-by-character, but ignoring spaces), then this expression and the macros system are called correct, otherwise β suspicious.
Note that we consider the "/" operation as the usual mathematical division, not the integer division like in C/C++. That's why, for example, in the expression "a*(b/c)" we can omit brackets to get the expression "a*b/c".
Input
The first line contains the only number n (0 β€ n β€ 100) β the amount of #define constructions in the given program.
Then there follow n lines, each of them contains just one #define construction. Each construction has the following syntax:
#define name expression
where
* name β the macro name,
* expression β the expression with which the given macro will be replaced. An expression is a non-empty string, containing digits,names of variables, names of previously declared macros, round brackets and operational signs +-*/. It is guaranteed that the expression (before and after macros substitution) is a correct arithmetic expression, having no unary operations. The expression contains only non-negative integers, not exceeding 109.
All the names (#define constructions' names and names of their arguments) are strings of case-sensitive Latin characters. It is guaranteed that the name of any variable is different from any #define construction.
Then, the last line contains an expression that you are to check. This expression is non-empty and satisfies the same limitations as the expressions in #define constructions.
The input lines may contain any number of spaces anywhere, providing these spaces do not break the word "define" or the names of constructions and variables. In particular, there can be any number of spaces before and after the "#" symbol.
The length of any line from the input file does not exceed 100 characters.
Output
Output "OK", if the expression is correct according to the above given criterion, otherwise output "Suspicious".
Examples
Input
1
#define sum x + y
1 * sum
Output
Suspicious
Input
1
#define sum (x + y)
sum - sum
Output
OK
Input
4
#define sum x + y
#define mul a * b
#define div a / b
#define expr sum + mul * div * mul
expr
Output
OK
Input
3
#define SumSafe (a+b)
#define DivUnsafe a/b
#define DenominatorUnsafe a*b
((SumSafe) + DivUnsafe/DivUnsafe + x/DenominatorUnsafe)
Output
Suspicious
Tags: dp, expression parsing, implementation
Correct Solution:
```
P, A, S, M, D = 1, 2, 4, 8, 16
ADD = A | S
ANY = A | S | M | D
OP_BIT = {"+": A, "-": S, "*": M, "/": D, ")": 0}
UNSAFE_BEFORE = {P: 0, A: 0, S: ADD, M: ADD, D: ANY}
UNSAFE_AFTER = {P: 0, A: 0, S: 0, M: ADD, D: ADD}
macro = dict()
def expr(chars,
pseudo=P,
expand=macro.get,
op_bit=OP_BIT,
unsafe_before=UNSAFE_BEFORE,
unsafe_after=UNSAFE_AFTER):
paren = []
push = paren.append
pop = paren.pop
name = []
keep = name.append
forget = name.clear
last_op = retval = naked = pseudo
def safe():
nonlocal naked
naked = expand("".join(name), pseudo)
forget()
if naked <= pseudo:
return naked
return not (unsafe_before[last_op] & naked)
for c in chars:
if c == "(":
push(last_op)
last_op = pseudo
elif c not in op_bit:
keep(c)
elif not safe():
return 0
elif c == ")":
last_op = pop()
else:
last_op = op_bit[c]
if unsafe_after[last_op] & naked:
return 0
if not paren:
retval |= last_op
if name and not safe():
return 0
return retval
def main():
global macro
def chars(b, t):
for k in range(b, len(t)):
yield from t[k]
for _ in range(int(input())):
token = input().split()
s = token[0] == "#"
macro[token[1 + s]] = expr(chars(2 + s, token))
print("OK" if expr((c for c in input() if c != " ")) else "Suspicious")
if __name__ == '__main__':
main()
```
| 38,223
|
[
0.04681396484375,
-0.391357421875,
0.412841796875,
0.2978515625,
-0.54052734375,
-0.4716796875,
0.277099609375,
0.421142578125,
-0.027191162109375,
0.58740234375,
0.87548828125,
0.0731201171875,
0.056610107421875,
-0.7314453125,
-0.75146484375,
0.16650390625,
-0.39990234375,
-1.01953125,
-0.63525390625,
0.5166015625,
0.292236328125,
-0.06689453125,
-1.2724609375,
-0.3330078125,
-0.60302734375,
0.98291015625,
0.1651611328125,
-0.22705078125,
0.57373046875,
1.53125,
-0.451416015625,
-0.223388671875,
0.175048828125,
-0.483154296875,
-0.724609375,
-0.5068359375,
0.1944580078125,
-1.09765625,
0.0865478515625,
-0.362060546875,
-0.010223388671875,
-0.328125,
0.1881103515625,
-0.8671875,
-1.0361328125,
-0.185546875,
-0.06536865234375,
-0.54248046875,
0.348388671875,
-0.1220703125,
0.0419921875,
0.04132080078125,
0.4560546875,
-0.293701171875,
-0.01947021484375,
-0.0843505859375,
0.2357177734375,
-0.282958984375,
-0.8154296875,
0.658203125,
-0.43798828125,
0.0439453125,
-0.7119140625,
-1.076171875,
0.2330322265625,
0.20703125,
-0.498046875,
-0.49072265625,
-0.09112548828125,
-0.291748046875,
-0.0770263671875,
0.382080078125,
-0.41796875,
-0.354248046875,
-0.4501953125,
-0.533203125,
0.1680908203125,
-0.02801513671875,
-0.56640625,
0.38427734375,
0.172607421875,
0.76318359375,
0.2259521484375,
0.03692626953125,
-0.69384765625,
-0.1639404296875,
-0.316650390625,
-0.142578125,
0.113037109375,
-0.305419921875,
-0.25830078125,
0.6484375,
-0.11724853515625,
-0.384033203125,
0.59375,
0.71484375,
-0.466064453125,
0.72265625,
-0.11676025390625,
-0.35595703125,
0.7529296875,
0.646484375,
-0.207763671875,
0.7841796875,
-0.615234375,
0.2337646484375,
0.65625,
0.2271728515625,
-0.57666015625,
-0.7099609375,
-0.3017578125,
-0.2115478515625,
0.68115234375,
-0.17626953125,
0.05859375,
1.279296875,
-0.1240234375,
0.362060546875,
-0.426025390625,
0.388916015625,
0.53759765625,
0.11895751953125,
0.248046875,
-0.49462890625,
-0.1346435546875,
-0.1312255859375,
-0.3916015625,
0.8505859375,
-0.415283203125,
-0.35400390625,
0.1710205078125,
-0.42822265625,
-0.2310791015625,
0.681640625,
-0.044647216796875,
1.1142578125,
-0.6435546875,
0.8427734375,
0.195068359375,
-0.9140625,
0.86474609375,
-0.06298828125,
0.2310791015625,
1.525390625,
0.458251953125,
0.449462890625,
0.75048828125,
0.05352783203125,
-0.6591796875,
0.08001708984375,
-0.76708984375,
0.479736328125,
0.0228271484375,
0.06561279296875,
-0.33740234375,
0.0146942138671875,
-0.66650390625,
0.32763671875,
0.42919921875,
0.134765625,
-0.166259765625,
-0.1195068359375,
0.33935546875,
0.97900390625,
-0.0036106109619140625,
0.9423828125,
-0.58740234375,
-0.09259033203125,
-0.11529541015625,
-0.369384765625,
0.75439453125,
-0.40185546875,
-0.72021484375,
0.91015625,
0.7451171875,
1.294921875,
0.96533203125,
-0.2464599609375,
0.2239990234375,
0.1640625,
-0.5927734375,
0.036773681640625,
0.42236328125,
0.7705078125,
0.71728515625,
0.1888427734375,
0.15869140625,
0.1881103515625,
-0.4453125,
-0.1783447265625,
0.072509765625,
0.7822265625,
-0.69482421875,
0.34716796875,
0.17431640625,
0.292236328125,
-1.1962890625,
-0.149169921875,
0.37109375,
-0.76123046875,
-0.322021484375,
0.619140625,
-0.1708984375,
0.161865234375,
-0.85400390625,
-0.3515625,
0.48095703125,
1.041015625,
-0.205078125,
0.370361328125,
0.305419921875,
-0.432373046875,
-0.6015625,
0.0394287109375,
0.05645751953125,
-0.1605224609375,
-0.250732421875,
0.31005859375,
-0.0278167724609375,
0.01143646240234375,
-0.004852294921875,
0.394287109375,
0.422119140625,
0.85009765625,
0.1390380859375,
-0.53857421875,
0.416748046875,
1.34375,
-0.045806884765625,
0.61328125,
0.292236328125,
0.765625,
0.1575927734375,
0.99169921875,
0.55859375,
0.08306884765625,
0.70849609375,
0.93310546875,
-0.1795654296875,
0.0234222412109375,
0.54052734375,
0.64453125,
0.2109375,
0.7509765625,
-0.120361328125,
0.52001953125,
0.159912109375,
-0.14794921875,
-0.1031494140625,
0.423828125,
-0.1256103515625,
0.91796875,
0.16845703125,
0.6337890625,
-0.10882568359375,
-0.283935546875,
0.2105712890625,
0.81689453125,
-0.56201171875,
-0.488525390625,
0.12841796875,
0.10302734375,
0.45166015625,
-0.11102294921875,
0.400146484375,
0.76953125,
0.38330078125,
0.322509765625,
-0.8740234375,
-0.7021484375,
-0.03350830078125,
-0.388427734375,
-0.8330078125,
-0.498779296875,
-0.5048828125,
0.2161865234375,
0.11114501953125,
-0.48291015625,
0.3896484375,
-0.12841796875,
-0.5263671875,
0.5048828125,
-0.8486328125,
0.6806640625,
-0.01157379150390625,
0.650390625,
-1.0361328125,
1.0732421875,
0.0214691162109375,
0.92822265625,
-0.56494140625,
-0.404296875,
0.5048828125,
-0.6796875,
0.359130859375,
0.2275390625,
0.1495361328125,
-0.03912353515625,
-0.61962890625,
-0.88427734375,
-0.68408203125,
0.06280517578125,
-0.0711669921875,
0.09735107421875,
-0.66162109375,
1.0205078125,
0.054107666015625,
-0.476318359375,
1.072265625,
1.1845703125,
-1.1630859375,
0.87353515625,
0.1903076171875,
0.0022125244140625,
-0.5625,
0.8818359375,
0.61474609375,
0.548828125,
-0.122314453125,
-0.2012939453125,
-0.57080078125,
-0.06146240234375,
0.27490234375,
-0.71142578125,
-0.85498046875,
0.420166015625,
0.525390625,
-0.802734375,
0.489990234375,
-0.92333984375,
-0.453125,
-0.2100830078125,
-0.381103515625,
0.98779296875,
0.52392578125,
-0.14013671875,
-0.2373046875,
0.27978515625,
-0.0921630859375,
0.6416015625,
0.2369384765625,
-0.249267578125,
0.244140625,
0.200927734375,
0.33251953125,
0.45556640625,
0.232177734375,
-0.64111328125,
-0.1925048828125,
-0.2099609375,
0.49072265625,
0.61474609375,
0.1409912109375,
0.64208984375,
0.113525390625,
0.595703125,
-0.54931640625,
-0.01274871826171875,
-0.164794921875,
0.1162109375,
0.8515625,
0.64404296875,
-0.297607421875,
-0.3154296875,
-0.1649169921875,
-0.6728515625,
-0.454345703125,
0.20263671875,
0.76123046875,
-0.406005859375,
0.8408203125,
-0.1331787109375,
-0.82958984375,
0.33740234375,
-0.319580078125,
-0.0474853515625,
1.0927734375,
-0.07379150390625,
0.35205078125,
-0.67236328125,
0.2130126953125,
0.319580078125,
0.0197296142578125,
0.75537109375,
0.1358642578125,
0.1688232421875,
-0.73095703125,
-0.818359375,
-0.61572265625,
0.02435302734375,
-0.39404296875,
-0.6650390625,
0.2327880859375,
-0.62646484375,
-0.047332763671875,
-1.3486328125,
0.6044921875,
0.716796875,
0.442138671875,
0.044891357421875,
0.41748046875,
0.051544189453125,
0.463134765625,
0.49560546875,
-0.14990234375,
0.008453369140625,
-0.7021484375,
0.591796875,
-0.491943359375,
-0.106689453125,
-0.419677734375,
-0.239990234375,
0.175537109375,
0.1312255859375,
-0.347900390625,
0.266845703125,
-0.70068359375,
0.2213134765625,
0.400146484375,
0.47705078125,
-0.7119140625,
-0.0002048015594482422,
-0.107177734375,
0.484375,
0.43798828125,
-1.12109375,
0.2496337890625,
-0.63525390625,
0.2783203125,
0.4873046875,
-0.188232421875,
-0.44921875,
-0.71337890625,
-0.62158203125,
-0.65966796875,
0.12017822265625,
0.40478515625,
-0.08819580078125,
0.10595703125,
-1.228515625,
0.21728515625,
0.2064208984375,
-0.480224609375,
0.244873046875,
0.08233642578125,
0.0648193359375,
0.207763671875,
0.68896484375,
-0.11077880859375,
-0.77783203125,
0.703125,
-0.77783203125,
1.068359375,
-0.49609375,
0.5126953125,
-0.05987548828125,
0.30517578125,
-0.31884765625,
0.130126953125,
-0.441162109375,
-0.1165771484375,
-0.136962890625,
0.4521484375,
-0.931640625,
-0.8125,
0.62158203125,
-0.8486328125,
-0.10894775390625,
0.986328125,
0.387451171875,
-0.60205078125,
0.264892578125,
0.481201171875,
-0.437255859375,
0.39794921875,
-0.8828125,
0.356201171875,
-0.09771728515625,
-0.2171630859375,
-0.2412109375,
-0.487060546875,
0.37109375,
-0.2342529296875,
-1.2392578125,
-0.20703125,
-1.3046875,
-0.409423828125,
-0.2064208984375,
-0.1689453125,
0.501953125,
-0.10308837890625,
0.034942626953125,
0.1092529296875,
-0.275146484375,
-1.0390625,
-0.211669921875,
-0.9111328125,
-0.0438232421875,
-0.115478515625,
0.56591796875,
0.76806640625,
-0.024261474609375,
-0.467041015625,
-0.0482177734375,
-0.62646484375,
-0.316162109375,
-0.5859375,
-0.3046875,
0.062469482421875,
-0.060394287109375,
-0.499755859375,
-0.107666015625,
-0.05615234375,
0.53369140625,
0.70654296875,
-0.1641845703125,
0.4296875,
0.31689453125,
-0.143798828125,
0.9453125,
0.09246826171875,
-0.986328125,
-0.6171875,
0.476318359375,
-0.50390625,
1.06640625,
0.0672607421875,
-0.493408203125,
-0.453125,
-0.97705078125,
0.386962890625,
-0.273681640625,
-0.061004638671875,
-0.98095703125,
-0.84912109375,
-0.13232421875,
0.72900390625,
0.1337890625,
-1.0615234375,
-0.459716796875,
-0.736328125,
0.2088623046875,
-0.38671875,
-0.2353515625,
-0.8037109375,
-0.96484375,
-0.2218017578125,
1.0458984375,
0.1815185546875,
0.30322265625,
-0.2196044921875,
-0.357421875,
0.818359375,
0.31640625,
-0.56201171875,
-0.27734375,
-0.0565185546875,
0.333251953125,
-0.0092010498046875,
0.227783203125,
-0.5087890625,
1.265625,
-0.9111328125,
0.5830078125,
0.064453125,
-0.380126953125,
-0.0716552734375,
0.10308837890625,
0.556640625,
-0.272216796875,
-0.11749267578125,
-0.411376953125,
0.7255859375,
0.43408203125,
-0.40234375,
-0.76318359375,
-0.31005859375,
-0.619140625,
-1.0380859375,
0.58740234375,
-0.39697265625,
0.359130859375,
-0.3388671875,
0.030853271484375,
0.998046875,
-0.53369140625,
0.552734375,
1.7822265625,
0.2216796875,
0.09893798828125,
-0.86669921875,
0.859375,
0.58837890625,
-0.470947265625,
-0.0277557373046875,
0.76611328125,
-0.71923828125,
0.41748046875,
-0.280517578125,
-0.94677734375,
-0.505859375,
0.1439208984375,
0.96630859375,
0.3515625,
0.8134765625,
-0.2244873046875,
-0.8935546875,
-0.88671875,
1.041015625,
-0.1552734375,
0.09588623046875,
0.91845703125,
0.25927734375,
-0.059112548828125,
0.313232421875,
0.07818603515625,
-0.29638671875,
-0.65966796875,
1.4716796875,
-0.3583984375,
-0.340576171875,
0.60009765625,
0.646484375,
-0.818359375,
-1.1845703125,
0.018341064453125,
-0.1004638671875,
-0.287841796875,
-0.32568359375,
-0.1920166015625,
0.71533203125,
-0.64306640625,
0.269775390625,
0.4765625,
0.11517333984375,
-0.0242462158203125,
0.410400390625,
-0.18017578125,
-0.18896484375,
0.6103515625,
0.56201171875,
-0.1998291015625,
-0.10577392578125,
-0.447998046875,
-0.01203155517578125,
-0.1619873046875,
-0.462646484375,
1.212890625,
-0.066650390625,
0.66796875,
0.626953125,
-0.2430419921875,
0.71923828125,
-0.59375,
-0.56884765625,
-0.1785888671875,
-0.92236328125,
-0.9296875,
0.4130859375,
-0.0853271484375,
-0.1834716796875,
0.2183837890625,
-0.3916015625,
0.091796875,
0.82568359375,
0.44970703125,
-0.354248046875,
-1.2177734375,
-0.10552978515625,
-1.7177734375,
-0.6162109375,
-0.41943359375,
-0.61376953125,
-0.3935546875,
0.265380859375,
0.1519775390625,
-0.68896484375,
-0.214599609375,
-0.0640869140625,
-0.1826171875,
0.552734375,
-0.395263671875,
0.381591796875,
-0.2327880859375,
-0.60498046875,
-0.728515625,
-0.298583984375,
-0.37939453125,
-0.501953125,
-0.666015625,
0.26025390625,
0.4208984375,
0.371826171875,
-0.146484375,
0.008636474609375,
-0.042266845703125,
-1.0654296875,
0.2049560546875,
0.256103515625,
-0.381591796875,
1.1015625,
0.51806640625,
0.3173828125,
0.587890625,
-0.0693359375,
-0.490966796875,
-0.1461181640625,
0.7763671875,
0.292724609375,
-0.28515625,
-0.9853515625,
-0.1883544921875,
-0.1431884765625,
-1.0234375,
-0.0823974609375,
-0.28857421875,
0.2298583984375,
0.49560546875,
-0.1612548828125,
0.5703125,
0.81396484375,
0.294677734375,
0.41259765625,
0.0682373046875,
0.2113037109375,
0.52587890625,
0.0804443359375,
0.05572509765625,
0.1795654296875,
-0.1671142578125,
0.08251953125,
0.275634765625,
0.5615234375,
-0.32421875,
0.1810302734375,
-0.03631591796875,
-0.73876953125,
-0.58203125,
-0.1990966796875,
-0.132568359375,
0.501953125,
0.435302734375,
-0.3212890625,
0.0222320556640625,
-0.278564453125,
-0.431884765625,
0.0384521484375,
-1.06640625,
-0.6767578125,
1.076171875,
-0.38720703125,
-0.93310546875,
-0.368408203125,
-0.5400390625,
-0.2171630859375,
-0.5546875,
0.466064453125,
-0.2403564453125,
0.39013671875,
0.08721923828125,
0.2373046875,
-0.42333984375,
0.07928466796875,
0.2225341796875,
0.34619140625,
-0.607421875,
-0.5771484375,
0.2081298828125,
0.6669921875,
0.062286376953125,
-0.1978759765625,
-0.260009765625,
0.078369140625,
0.045867919921875,
0.1973876953125,
-0.54638671875,
0.01306915283203125,
-0.60791015625,
0.5966796875,
-0.96044921875,
-0.031463623046875,
-0.7021484375,
0.5810546875,
0.11859130859375,
-0.69921875,
-0.53662109375,
1.1337890625,
0.59814453125,
-0.3359375,
0.66943359375,
0.66015625,
0.5302734375,
-0.053436279296875,
-0.258056640625,
0.020294189453125,
0.62158203125,
0.94580078125,
0.58740234375,
0.09210205078125,
0.287109375,
0.252197265625,
0.445068359375,
-0.4482421875,
0.30224609375,
-0.217529296875,
-0.25927734375,
-0.3037109375,
0.1981201171875,
-0.2861328125,
-0.032196044921875,
-0.490234375,
0.35498046875,
-0.60595703125,
0.117431640625,
-0.378173828125,
-0.748046875,
0.6298828125,
-0.05474853515625,
-0.77490234375,
0.045745849609375,
-0.1890869140625,
0.751953125,
0.73974609375,
-0.40576171875,
0.291015625,
0.87646484375,
0.447021484375,
-0.0311126708984375,
-0.045806884765625,
0.50732421875,
0.5615234375,
-0.66748046875,
0.099365234375,
0.1922607421875,
0.437255859375,
-0.257080078125,
-0.576171875,
-1.01953125,
0.383544921875,
-0.2330322265625,
-0.1893310546875,
0.20458984375,
-0.458984375,
-0.08868408203125,
-0.51025390625,
0.771484375,
-0.8642578125,
0.1273193359375,
0.4765625,
-0.32373046875,
-0.83837890625,
1.015625,
0.080322265625,
0.34130859375,
0.31103515625,
0.99072265625,
0.07196044921875,
1.3193359375,
0.517578125,
-0.044464111328125,
-0.273193359375,
0.324951171875,
-0.277587890625,
-0.677734375,
0.06732177734375,
-0.2027587890625,
0.26953125,
-0.02459716796875,
-0.1180419921875,
0.337890625,
0.890625,
-0.122802734375,
-0.74951171875,
0.1116943359375,
0.270751953125,
-0.269287109375,
0.43212890625,
0.23193359375,
0.3232421875,
0.176025390625,
0.005401611328125,
-0.3359375,
-0.6005859375,
-0.0635986328125,
-0.8623046875,
0.5185546875,
0.12371826171875,
-0.168701171875,
-0.67578125,
-0.36767578125,
-0.09759521484375,
0.513671875,
-0.548828125,
-0.8408203125,
0.78271484375,
0.728515625,
-0.03948974609375,
0.41552734375,
-0.224853515625,
-0.188720703125,
0.9130859375,
1.380859375,
-0.541015625,
0.74755859375,
0.40771484375,
-0.1444091796875,
0.20068359375,
-0.61328125,
0.32177734375,
-0.2022705078125,
-0.314453125,
-0.1617431640625,
0.302734375,
-0.35546875,
-0.9267578125,
-0.046630859375,
1.0166015625,
0.403564453125,
-0.3447265625,
-1.2119140625,
-0.452880859375,
-1.1640625,
-0.02069091796875,
-0.82080078125,
0.47998046875,
-0.0887451171875,
-0.2122802734375,
-0.1763916015625,
-1.0830078125,
4.3359375,
0.67578125,
1.015625,
0.60888671875,
0.42578125,
0.51904296875,
0.22900390625,
-0.7138671875,
0.56396484375,
-0.85009765625,
0.40185546875,
-0.09539794921875,
-0.266845703125,
0.80322265625,
0.70654296875,
0.5302734375,
-0.9384765625,
-0.03155517578125,
-0.386474609375,
-0.58447265625,
-0.89013671875,
0.10784912109375,
-0.0277252197265625,
0.8193359375,
-0.274658203125,
0.494140625,
0.36669921875,
-0.9248046875,
-0.333984375,
-0.53076171875,
-0.25,
-0.2481689453125,
0.68115234375,
0.0093231201171875,
-0.6162109375,
0.53125,
-0.37353515625,
-0.2310791015625,
-0.125,
-0.0133819580078125,
-0.40283203125,
-0.1982421875,
0.58544921875,
-0.5654296875,
-0.258544921875,
0.8837890625,
-0.58935546875,
0.203857421875,
0.578125,
-1.2490234375,
0.81689453125,
-0.296142578125,
0.428466796875,
-0.59423828125,
-0.7958984375,
-0.010345458984375,
0.11297607421875,
-0.3701171875,
-0.4306640625,
0.5478515625,
-0.0426025390625,
0.708984375,
0.09722900390625,
0.5810546875,
-0.486328125,
0.53662109375,
-0.48779296875,
0.744140625,
-0.6240234375,
-0.52392578125,
-0.210205078125,
-0.245849609375,
0.1744384765625,
-0.5673828125,
0.61669921875,
0.01708984375,
-0.375732421875,
0.26171875,
0.350830078125,
-0.62109375,
-0.068603515625,
-0.2509765625,
-0.52001953125,
-0.8955078125,
0.66064453125,
0.802734375,
-0.400634765625,
-0.45458984375,
-0.10888671875,
0.55908203125,
0.51904296875,
0.43115234375,
0.01360321044921875,
-0.5068359375,
-0.70361328125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.
In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. The generic syntax for declaring a macro is the following:
#define macro_name macro_value
After the macro has been declared, "macro_name" is replaced with "macro_value" each time it is met in the program (only the whole tokens can be replaced; i.e. "macro_name" is replaced only when it is surrounded by spaces or other non-alphabetic symbol). A "macro_value" within our model can only be an arithmetic expression consisting of variables, four arithmetic operations, brackets, and also the names of previously declared macros (in this case replacement is performed sequentially). The process of replacing macros with their values is called substitution.
One of the main problems arising while using macros β the situation when as a result of substitution we get an arithmetic expression with the changed order of calculation because of different priorities of the operations.
Let's consider the following example. Say, we declared such a #define construction:
#define sum x + y
and further in the program the expression "2 * sum" is calculated. After macro substitution is performed we get "2 * x + y", instead of intuitively expected "2 * (x + y)".
Let's call the situation "suspicious", if after the macro substitution the order of calculation changes, falling outside the bounds of some macro. Thus, your task is to find out by the given set of #define definitions and the given expression if this expression is suspicious or not.
Let's speak more formally. We should perform an ordinary macros substitution in the given expression. Moreover, we should perform a "safe" macros substitution in the expression, putting in brackets each macro value; after this, guided by arithmetic rules of brackets expansion, we can omit some of the brackets. If there exist a way to get an expression, absolutely coinciding with the expression that is the result of an ordinary substitution (character-by-character, but ignoring spaces), then this expression and the macros system are called correct, otherwise β suspicious.
Note that we consider the "/" operation as the usual mathematical division, not the integer division like in C/C++. That's why, for example, in the expression "a*(b/c)" we can omit brackets to get the expression "a*b/c".
Input
The first line contains the only number n (0 β€ n β€ 100) β the amount of #define constructions in the given program.
Then there follow n lines, each of them contains just one #define construction. Each construction has the following syntax:
#define name expression
where
* name β the macro name,
* expression β the expression with which the given macro will be replaced. An expression is a non-empty string, containing digits,names of variables, names of previously declared macros, round brackets and operational signs +-*/. It is guaranteed that the expression (before and after macros substitution) is a correct arithmetic expression, having no unary operations. The expression contains only non-negative integers, not exceeding 109.
All the names (#define constructions' names and names of their arguments) are strings of case-sensitive Latin characters. It is guaranteed that the name of any variable is different from any #define construction.
Then, the last line contains an expression that you are to check. This expression is non-empty and satisfies the same limitations as the expressions in #define constructions.
The input lines may contain any number of spaces anywhere, providing these spaces do not break the word "define" or the names of constructions and variables. In particular, there can be any number of spaces before and after the "#" symbol.
The length of any line from the input file does not exceed 100 characters.
Output
Output "OK", if the expression is correct according to the above given criterion, otherwise output "Suspicious".
Examples
Input
1
#define sum x + y
1 * sum
Output
Suspicious
Input
1
#define sum (x + y)
sum - sum
Output
OK
Input
4
#define sum x + y
#define mul a * b
#define div a / b
#define expr sum + mul * div * mul
expr
Output
OK
Input
3
#define SumSafe (a+b)
#define DivUnsafe a/b
#define DenominatorUnsafe a*b
((SumSafe) + DivUnsafe/DivUnsafe + x/DenominatorUnsafe)
Output
Suspicious
Tags: dp, expression parsing, implementation
Correct Solution:
```
#!/usr/bin/env python
'''
' Author: Cheng-Shih Wong
' Email: mob5566@gmail.com
' Date: 2017-08-02
'''
import re
from collections import deque
# compare the priority of operators
def comp(opa, opb):
if opa=='(' or opb=='(':
return False
elif opa==')':
return opb=='('
elif opa in '*/':
return opb in '+-*/)'
else:
return opb in '+-)'
# # print the operator priority table
# print('{:6}'.format(''), end='')
# for a in '+-*/()':
# print('{:>6}'.format(a), end='')
# print()
# for a in '+-*/()':
# print('{:>6}'.format(a), end='')
# for b in '+-*/()':
# print('{:6}'.format(comp(a, b)), end='')
# print()
def arith(stk, stkop):
B = stk.pop()
A = stk.pop()
op = stkop.pop()
ok = True
if op=='-' and B<2:
ok = False
elif op=='*' and (A<2 or B<2):
ok = False
elif op=='/' and (A<2 or B<3):
ok = False
if op in '+-':
stk.append(1)
elif op in '*/':
stk.append(2)
return ok
def solve(pri, exp, defs):
terms = re.findall(r'[a-zA-z0-9]+|[\+\-\*/\(\)]', exp)
safe = True
# arithmetic
stk = deque()
opstk = deque()
for term in terms:
if term in '+-*/()':
while len(opstk) and comp(opstk[-1], term):
safe &= arith(stk, opstk)
if term==')':
opstk.pop()
stk.pop()
stk.append(3)
else:
opstk.append(term)
else:
if term not in pri:
if term in defs:
ok, p = solve(pri, defs[term], defs)
safe &= ok
pri[term] = p
else:
pri[term] = 3
stk.append(pri[term])
while len(opstk):
safe &= arith(stk, opstk)
return safe, stk.pop()
n = int(input())
inputs = [input() for i in range(n)]
expr = input()
defs = {}
for line in inputs:
line = line[re.match(r'.*#.*define', line).end():]
terms = re.findall(r'[^ ]+', line)
defs[terms[0]] = ''.join(terms[1:])
prio = {}
if solve(prio, expr, defs)[0]:
print('OK')
else:
print('Suspicious')
```
| 38,224
|
[
0.04681396484375,
-0.391357421875,
0.412841796875,
0.2978515625,
-0.54052734375,
-0.4716796875,
0.277099609375,
0.421142578125,
-0.027191162109375,
0.58740234375,
0.87548828125,
0.0731201171875,
0.056610107421875,
-0.7314453125,
-0.75146484375,
0.16650390625,
-0.39990234375,
-1.01953125,
-0.63525390625,
0.5166015625,
0.292236328125,
-0.06689453125,
-1.2724609375,
-0.3330078125,
-0.60302734375,
0.98291015625,
0.1651611328125,
-0.22705078125,
0.57373046875,
1.53125,
-0.451416015625,
-0.223388671875,
0.175048828125,
-0.483154296875,
-0.724609375,
-0.5068359375,
0.1944580078125,
-1.09765625,
0.0865478515625,
-0.362060546875,
-0.010223388671875,
-0.328125,
0.1881103515625,
-0.8671875,
-1.0361328125,
-0.185546875,
-0.06536865234375,
-0.54248046875,
0.348388671875,
-0.1220703125,
0.0419921875,
0.04132080078125,
0.4560546875,
-0.293701171875,
-0.01947021484375,
-0.0843505859375,
0.2357177734375,
-0.282958984375,
-0.8154296875,
0.658203125,
-0.43798828125,
0.0439453125,
-0.7119140625,
-1.076171875,
0.2330322265625,
0.20703125,
-0.498046875,
-0.49072265625,
-0.09112548828125,
-0.291748046875,
-0.0770263671875,
0.382080078125,
-0.41796875,
-0.354248046875,
-0.4501953125,
-0.533203125,
0.1680908203125,
-0.02801513671875,
-0.56640625,
0.38427734375,
0.172607421875,
0.76318359375,
0.2259521484375,
0.03692626953125,
-0.69384765625,
-0.1639404296875,
-0.316650390625,
-0.142578125,
0.113037109375,
-0.305419921875,
-0.25830078125,
0.6484375,
-0.11724853515625,
-0.384033203125,
0.59375,
0.71484375,
-0.466064453125,
0.72265625,
-0.11676025390625,
-0.35595703125,
0.7529296875,
0.646484375,
-0.207763671875,
0.7841796875,
-0.615234375,
0.2337646484375,
0.65625,
0.2271728515625,
-0.57666015625,
-0.7099609375,
-0.3017578125,
-0.2115478515625,
0.68115234375,
-0.17626953125,
0.05859375,
1.279296875,
-0.1240234375,
0.362060546875,
-0.426025390625,
0.388916015625,
0.53759765625,
0.11895751953125,
0.248046875,
-0.49462890625,
-0.1346435546875,
-0.1312255859375,
-0.3916015625,
0.8505859375,
-0.415283203125,
-0.35400390625,
0.1710205078125,
-0.42822265625,
-0.2310791015625,
0.681640625,
-0.044647216796875,
1.1142578125,
-0.6435546875,
0.8427734375,
0.195068359375,
-0.9140625,
0.86474609375,
-0.06298828125,
0.2310791015625,
1.525390625,
0.458251953125,
0.449462890625,
0.75048828125,
0.05352783203125,
-0.6591796875,
0.08001708984375,
-0.76708984375,
0.479736328125,
0.0228271484375,
0.06561279296875,
-0.33740234375,
0.0146942138671875,
-0.66650390625,
0.32763671875,
0.42919921875,
0.134765625,
-0.166259765625,
-0.1195068359375,
0.33935546875,
0.97900390625,
-0.0036106109619140625,
0.9423828125,
-0.58740234375,
-0.09259033203125,
-0.11529541015625,
-0.369384765625,
0.75439453125,
-0.40185546875,
-0.72021484375,
0.91015625,
0.7451171875,
1.294921875,
0.96533203125,
-0.2464599609375,
0.2239990234375,
0.1640625,
-0.5927734375,
0.036773681640625,
0.42236328125,
0.7705078125,
0.71728515625,
0.1888427734375,
0.15869140625,
0.1881103515625,
-0.4453125,
-0.1783447265625,
0.072509765625,
0.7822265625,
-0.69482421875,
0.34716796875,
0.17431640625,
0.292236328125,
-1.1962890625,
-0.149169921875,
0.37109375,
-0.76123046875,
-0.322021484375,
0.619140625,
-0.1708984375,
0.161865234375,
-0.85400390625,
-0.3515625,
0.48095703125,
1.041015625,
-0.205078125,
0.370361328125,
0.305419921875,
-0.432373046875,
-0.6015625,
0.0394287109375,
0.05645751953125,
-0.1605224609375,
-0.250732421875,
0.31005859375,
-0.0278167724609375,
0.01143646240234375,
-0.004852294921875,
0.394287109375,
0.422119140625,
0.85009765625,
0.1390380859375,
-0.53857421875,
0.416748046875,
1.34375,
-0.045806884765625,
0.61328125,
0.292236328125,
0.765625,
0.1575927734375,
0.99169921875,
0.55859375,
0.08306884765625,
0.70849609375,
0.93310546875,
-0.1795654296875,
0.0234222412109375,
0.54052734375,
0.64453125,
0.2109375,
0.7509765625,
-0.120361328125,
0.52001953125,
0.159912109375,
-0.14794921875,
-0.1031494140625,
0.423828125,
-0.1256103515625,
0.91796875,
0.16845703125,
0.6337890625,
-0.10882568359375,
-0.283935546875,
0.2105712890625,
0.81689453125,
-0.56201171875,
-0.488525390625,
0.12841796875,
0.10302734375,
0.45166015625,
-0.11102294921875,
0.400146484375,
0.76953125,
0.38330078125,
0.322509765625,
-0.8740234375,
-0.7021484375,
-0.03350830078125,
-0.388427734375,
-0.8330078125,
-0.498779296875,
-0.5048828125,
0.2161865234375,
0.11114501953125,
-0.48291015625,
0.3896484375,
-0.12841796875,
-0.5263671875,
0.5048828125,
-0.8486328125,
0.6806640625,
-0.01157379150390625,
0.650390625,
-1.0361328125,
1.0732421875,
0.0214691162109375,
0.92822265625,
-0.56494140625,
-0.404296875,
0.5048828125,
-0.6796875,
0.359130859375,
0.2275390625,
0.1495361328125,
-0.03912353515625,
-0.61962890625,
-0.88427734375,
-0.68408203125,
0.06280517578125,
-0.0711669921875,
0.09735107421875,
-0.66162109375,
1.0205078125,
0.054107666015625,
-0.476318359375,
1.072265625,
1.1845703125,
-1.1630859375,
0.87353515625,
0.1903076171875,
0.0022125244140625,
-0.5625,
0.8818359375,
0.61474609375,
0.548828125,
-0.122314453125,
-0.2012939453125,
-0.57080078125,
-0.06146240234375,
0.27490234375,
-0.71142578125,
-0.85498046875,
0.420166015625,
0.525390625,
-0.802734375,
0.489990234375,
-0.92333984375,
-0.453125,
-0.2100830078125,
-0.381103515625,
0.98779296875,
0.52392578125,
-0.14013671875,
-0.2373046875,
0.27978515625,
-0.0921630859375,
0.6416015625,
0.2369384765625,
-0.249267578125,
0.244140625,
0.200927734375,
0.33251953125,
0.45556640625,
0.232177734375,
-0.64111328125,
-0.1925048828125,
-0.2099609375,
0.49072265625,
0.61474609375,
0.1409912109375,
0.64208984375,
0.113525390625,
0.595703125,
-0.54931640625,
-0.01274871826171875,
-0.164794921875,
0.1162109375,
0.8515625,
0.64404296875,
-0.297607421875,
-0.3154296875,
-0.1649169921875,
-0.6728515625,
-0.454345703125,
0.20263671875,
0.76123046875,
-0.406005859375,
0.8408203125,
-0.1331787109375,
-0.82958984375,
0.33740234375,
-0.319580078125,
-0.0474853515625,
1.0927734375,
-0.07379150390625,
0.35205078125,
-0.67236328125,
0.2130126953125,
0.319580078125,
0.0197296142578125,
0.75537109375,
0.1358642578125,
0.1688232421875,
-0.73095703125,
-0.818359375,
-0.61572265625,
0.02435302734375,
-0.39404296875,
-0.6650390625,
0.2327880859375,
-0.62646484375,
-0.047332763671875,
-1.3486328125,
0.6044921875,
0.716796875,
0.442138671875,
0.044891357421875,
0.41748046875,
0.051544189453125,
0.463134765625,
0.49560546875,
-0.14990234375,
0.008453369140625,
-0.7021484375,
0.591796875,
-0.491943359375,
-0.106689453125,
-0.419677734375,
-0.239990234375,
0.175537109375,
0.1312255859375,
-0.347900390625,
0.266845703125,
-0.70068359375,
0.2213134765625,
0.400146484375,
0.47705078125,
-0.7119140625,
-0.0002048015594482422,
-0.107177734375,
0.484375,
0.43798828125,
-1.12109375,
0.2496337890625,
-0.63525390625,
0.2783203125,
0.4873046875,
-0.188232421875,
-0.44921875,
-0.71337890625,
-0.62158203125,
-0.65966796875,
0.12017822265625,
0.40478515625,
-0.08819580078125,
0.10595703125,
-1.228515625,
0.21728515625,
0.2064208984375,
-0.480224609375,
0.244873046875,
0.08233642578125,
0.0648193359375,
0.207763671875,
0.68896484375,
-0.11077880859375,
-0.77783203125,
0.703125,
-0.77783203125,
1.068359375,
-0.49609375,
0.5126953125,
-0.05987548828125,
0.30517578125,
-0.31884765625,
0.130126953125,
-0.441162109375,
-0.1165771484375,
-0.136962890625,
0.4521484375,
-0.931640625,
-0.8125,
0.62158203125,
-0.8486328125,
-0.10894775390625,
0.986328125,
0.387451171875,
-0.60205078125,
0.264892578125,
0.481201171875,
-0.437255859375,
0.39794921875,
-0.8828125,
0.356201171875,
-0.09771728515625,
-0.2171630859375,
-0.2412109375,
-0.487060546875,
0.37109375,
-0.2342529296875,
-1.2392578125,
-0.20703125,
-1.3046875,
-0.409423828125,
-0.2064208984375,
-0.1689453125,
0.501953125,
-0.10308837890625,
0.034942626953125,
0.1092529296875,
-0.275146484375,
-1.0390625,
-0.211669921875,
-0.9111328125,
-0.0438232421875,
-0.115478515625,
0.56591796875,
0.76806640625,
-0.024261474609375,
-0.467041015625,
-0.0482177734375,
-0.62646484375,
-0.316162109375,
-0.5859375,
-0.3046875,
0.062469482421875,
-0.060394287109375,
-0.499755859375,
-0.107666015625,
-0.05615234375,
0.53369140625,
0.70654296875,
-0.1641845703125,
0.4296875,
0.31689453125,
-0.143798828125,
0.9453125,
0.09246826171875,
-0.986328125,
-0.6171875,
0.476318359375,
-0.50390625,
1.06640625,
0.0672607421875,
-0.493408203125,
-0.453125,
-0.97705078125,
0.386962890625,
-0.273681640625,
-0.061004638671875,
-0.98095703125,
-0.84912109375,
-0.13232421875,
0.72900390625,
0.1337890625,
-1.0615234375,
-0.459716796875,
-0.736328125,
0.2088623046875,
-0.38671875,
-0.2353515625,
-0.8037109375,
-0.96484375,
-0.2218017578125,
1.0458984375,
0.1815185546875,
0.30322265625,
-0.2196044921875,
-0.357421875,
0.818359375,
0.31640625,
-0.56201171875,
-0.27734375,
-0.0565185546875,
0.333251953125,
-0.0092010498046875,
0.227783203125,
-0.5087890625,
1.265625,
-0.9111328125,
0.5830078125,
0.064453125,
-0.380126953125,
-0.0716552734375,
0.10308837890625,
0.556640625,
-0.272216796875,
-0.11749267578125,
-0.411376953125,
0.7255859375,
0.43408203125,
-0.40234375,
-0.76318359375,
-0.31005859375,
-0.619140625,
-1.0380859375,
0.58740234375,
-0.39697265625,
0.359130859375,
-0.3388671875,
0.030853271484375,
0.998046875,
-0.53369140625,
0.552734375,
1.7822265625,
0.2216796875,
0.09893798828125,
-0.86669921875,
0.859375,
0.58837890625,
-0.470947265625,
-0.0277557373046875,
0.76611328125,
-0.71923828125,
0.41748046875,
-0.280517578125,
-0.94677734375,
-0.505859375,
0.1439208984375,
0.96630859375,
0.3515625,
0.8134765625,
-0.2244873046875,
-0.8935546875,
-0.88671875,
1.041015625,
-0.1552734375,
0.09588623046875,
0.91845703125,
0.25927734375,
-0.059112548828125,
0.313232421875,
0.07818603515625,
-0.29638671875,
-0.65966796875,
1.4716796875,
-0.3583984375,
-0.340576171875,
0.60009765625,
0.646484375,
-0.818359375,
-1.1845703125,
0.018341064453125,
-0.1004638671875,
-0.287841796875,
-0.32568359375,
-0.1920166015625,
0.71533203125,
-0.64306640625,
0.269775390625,
0.4765625,
0.11517333984375,
-0.0242462158203125,
0.410400390625,
-0.18017578125,
-0.18896484375,
0.6103515625,
0.56201171875,
-0.1998291015625,
-0.10577392578125,
-0.447998046875,
-0.01203155517578125,
-0.1619873046875,
-0.462646484375,
1.212890625,
-0.066650390625,
0.66796875,
0.626953125,
-0.2430419921875,
0.71923828125,
-0.59375,
-0.56884765625,
-0.1785888671875,
-0.92236328125,
-0.9296875,
0.4130859375,
-0.0853271484375,
-0.1834716796875,
0.2183837890625,
-0.3916015625,
0.091796875,
0.82568359375,
0.44970703125,
-0.354248046875,
-1.2177734375,
-0.10552978515625,
-1.7177734375,
-0.6162109375,
-0.41943359375,
-0.61376953125,
-0.3935546875,
0.265380859375,
0.1519775390625,
-0.68896484375,
-0.214599609375,
-0.0640869140625,
-0.1826171875,
0.552734375,
-0.395263671875,
0.381591796875,
-0.2327880859375,
-0.60498046875,
-0.728515625,
-0.298583984375,
-0.37939453125,
-0.501953125,
-0.666015625,
0.26025390625,
0.4208984375,
0.371826171875,
-0.146484375,
0.008636474609375,
-0.042266845703125,
-1.0654296875,
0.2049560546875,
0.256103515625,
-0.381591796875,
1.1015625,
0.51806640625,
0.3173828125,
0.587890625,
-0.0693359375,
-0.490966796875,
-0.1461181640625,
0.7763671875,
0.292724609375,
-0.28515625,
-0.9853515625,
-0.1883544921875,
-0.1431884765625,
-1.0234375,
-0.0823974609375,
-0.28857421875,
0.2298583984375,
0.49560546875,
-0.1612548828125,
0.5703125,
0.81396484375,
0.294677734375,
0.41259765625,
0.0682373046875,
0.2113037109375,
0.52587890625,
0.0804443359375,
0.05572509765625,
0.1795654296875,
-0.1671142578125,
0.08251953125,
0.275634765625,
0.5615234375,
-0.32421875,
0.1810302734375,
-0.03631591796875,
-0.73876953125,
-0.58203125,
-0.1990966796875,
-0.132568359375,
0.501953125,
0.435302734375,
-0.3212890625,
0.0222320556640625,
-0.278564453125,
-0.431884765625,
0.0384521484375,
-1.06640625,
-0.6767578125,
1.076171875,
-0.38720703125,
-0.93310546875,
-0.368408203125,
-0.5400390625,
-0.2171630859375,
-0.5546875,
0.466064453125,
-0.2403564453125,
0.39013671875,
0.08721923828125,
0.2373046875,
-0.42333984375,
0.07928466796875,
0.2225341796875,
0.34619140625,
-0.607421875,
-0.5771484375,
0.2081298828125,
0.6669921875,
0.062286376953125,
-0.1978759765625,
-0.260009765625,
0.078369140625,
0.045867919921875,
0.1973876953125,
-0.54638671875,
0.01306915283203125,
-0.60791015625,
0.5966796875,
-0.96044921875,
-0.031463623046875,
-0.7021484375,
0.5810546875,
0.11859130859375,
-0.69921875,
-0.53662109375,
1.1337890625,
0.59814453125,
-0.3359375,
0.66943359375,
0.66015625,
0.5302734375,
-0.053436279296875,
-0.258056640625,
0.020294189453125,
0.62158203125,
0.94580078125,
0.58740234375,
0.09210205078125,
0.287109375,
0.252197265625,
0.445068359375,
-0.4482421875,
0.30224609375,
-0.217529296875,
-0.25927734375,
-0.3037109375,
0.1981201171875,
-0.2861328125,
-0.032196044921875,
-0.490234375,
0.35498046875,
-0.60595703125,
0.117431640625,
-0.378173828125,
-0.748046875,
0.6298828125,
-0.05474853515625,
-0.77490234375,
0.045745849609375,
-0.1890869140625,
0.751953125,
0.73974609375,
-0.40576171875,
0.291015625,
0.87646484375,
0.447021484375,
-0.0311126708984375,
-0.045806884765625,
0.50732421875,
0.5615234375,
-0.66748046875,
0.099365234375,
0.1922607421875,
0.437255859375,
-0.257080078125,
-0.576171875,
-1.01953125,
0.383544921875,
-0.2330322265625,
-0.1893310546875,
0.20458984375,
-0.458984375,
-0.08868408203125,
-0.51025390625,
0.771484375,
-0.8642578125,
0.1273193359375,
0.4765625,
-0.32373046875,
-0.83837890625,
1.015625,
0.080322265625,
0.34130859375,
0.31103515625,
0.99072265625,
0.07196044921875,
1.3193359375,
0.517578125,
-0.044464111328125,
-0.273193359375,
0.324951171875,
-0.277587890625,
-0.677734375,
0.06732177734375,
-0.2027587890625,
0.26953125,
-0.02459716796875,
-0.1180419921875,
0.337890625,
0.890625,
-0.122802734375,
-0.74951171875,
0.1116943359375,
0.270751953125,
-0.269287109375,
0.43212890625,
0.23193359375,
0.3232421875,
0.176025390625,
0.005401611328125,
-0.3359375,
-0.6005859375,
-0.0635986328125,
-0.8623046875,
0.5185546875,
0.12371826171875,
-0.168701171875,
-0.67578125,
-0.36767578125,
-0.09759521484375,
0.513671875,
-0.548828125,
-0.8408203125,
0.78271484375,
0.728515625,
-0.03948974609375,
0.41552734375,
-0.224853515625,
-0.188720703125,
0.9130859375,
1.380859375,
-0.541015625,
0.74755859375,
0.40771484375,
-0.1444091796875,
0.20068359375,
-0.61328125,
0.32177734375,
-0.2022705078125,
-0.314453125,
-0.1617431640625,
0.302734375,
-0.35546875,
-0.9267578125,
-0.046630859375,
1.0166015625,
0.403564453125,
-0.3447265625,
-1.2119140625,
-0.452880859375,
-1.1640625,
-0.02069091796875,
-0.82080078125,
0.47998046875,
-0.0887451171875,
-0.2122802734375,
-0.1763916015625,
-1.0830078125,
4.3359375,
0.67578125,
1.015625,
0.60888671875,
0.42578125,
0.51904296875,
0.22900390625,
-0.7138671875,
0.56396484375,
-0.85009765625,
0.40185546875,
-0.09539794921875,
-0.266845703125,
0.80322265625,
0.70654296875,
0.5302734375,
-0.9384765625,
-0.03155517578125,
-0.386474609375,
-0.58447265625,
-0.89013671875,
0.10784912109375,
-0.0277252197265625,
0.8193359375,
-0.274658203125,
0.494140625,
0.36669921875,
-0.9248046875,
-0.333984375,
-0.53076171875,
-0.25,
-0.2481689453125,
0.68115234375,
0.0093231201171875,
-0.6162109375,
0.53125,
-0.37353515625,
-0.2310791015625,
-0.125,
-0.0133819580078125,
-0.40283203125,
-0.1982421875,
0.58544921875,
-0.5654296875,
-0.258544921875,
0.8837890625,
-0.58935546875,
0.203857421875,
0.578125,
-1.2490234375,
0.81689453125,
-0.296142578125,
0.428466796875,
-0.59423828125,
-0.7958984375,
-0.010345458984375,
0.11297607421875,
-0.3701171875,
-0.4306640625,
0.5478515625,
-0.0426025390625,
0.708984375,
0.09722900390625,
0.5810546875,
-0.486328125,
0.53662109375,
-0.48779296875,
0.744140625,
-0.6240234375,
-0.52392578125,
-0.210205078125,
-0.245849609375,
0.1744384765625,
-0.5673828125,
0.61669921875,
0.01708984375,
-0.375732421875,
0.26171875,
0.350830078125,
-0.62109375,
-0.068603515625,
-0.2509765625,
-0.52001953125,
-0.8955078125,
0.66064453125,
0.802734375,
-0.400634765625,
-0.45458984375,
-0.10888671875,
0.55908203125,
0.51904296875,
0.43115234375,
0.01360321044921875,
-0.5068359375,
-0.70361328125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.
In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. The generic syntax for declaring a macro is the following:
#define macro_name macro_value
After the macro has been declared, "macro_name" is replaced with "macro_value" each time it is met in the program (only the whole tokens can be replaced; i.e. "macro_name" is replaced only when it is surrounded by spaces or other non-alphabetic symbol). A "macro_value" within our model can only be an arithmetic expression consisting of variables, four arithmetic operations, brackets, and also the names of previously declared macros (in this case replacement is performed sequentially). The process of replacing macros with their values is called substitution.
One of the main problems arising while using macros β the situation when as a result of substitution we get an arithmetic expression with the changed order of calculation because of different priorities of the operations.
Let's consider the following example. Say, we declared such a #define construction:
#define sum x + y
and further in the program the expression "2 * sum" is calculated. After macro substitution is performed we get "2 * x + y", instead of intuitively expected "2 * (x + y)".
Let's call the situation "suspicious", if after the macro substitution the order of calculation changes, falling outside the bounds of some macro. Thus, your task is to find out by the given set of #define definitions and the given expression if this expression is suspicious or not.
Let's speak more formally. We should perform an ordinary macros substitution in the given expression. Moreover, we should perform a "safe" macros substitution in the expression, putting in brackets each macro value; after this, guided by arithmetic rules of brackets expansion, we can omit some of the brackets. If there exist a way to get an expression, absolutely coinciding with the expression that is the result of an ordinary substitution (character-by-character, but ignoring spaces), then this expression and the macros system are called correct, otherwise β suspicious.
Note that we consider the "/" operation as the usual mathematical division, not the integer division like in C/C++. That's why, for example, in the expression "a*(b/c)" we can omit brackets to get the expression "a*b/c".
Input
The first line contains the only number n (0 β€ n β€ 100) β the amount of #define constructions in the given program.
Then there follow n lines, each of them contains just one #define construction. Each construction has the following syntax:
#define name expression
where
* name β the macro name,
* expression β the expression with which the given macro will be replaced. An expression is a non-empty string, containing digits,names of variables, names of previously declared macros, round brackets and operational signs +-*/. It is guaranteed that the expression (before and after macros substitution) is a correct arithmetic expression, having no unary operations. The expression contains only non-negative integers, not exceeding 109.
All the names (#define constructions' names and names of their arguments) are strings of case-sensitive Latin characters. It is guaranteed that the name of any variable is different from any #define construction.
Then, the last line contains an expression that you are to check. This expression is non-empty and satisfies the same limitations as the expressions in #define constructions.
The input lines may contain any number of spaces anywhere, providing these spaces do not break the word "define" or the names of constructions and variables. In particular, there can be any number of spaces before and after the "#" symbol.
The length of any line from the input file does not exceed 100 characters.
Output
Output "OK", if the expression is correct according to the above given criterion, otherwise output "Suspicious".
Examples
Input
1
#define sum x + y
1 * sum
Output
Suspicious
Input
1
#define sum (x + y)
sum - sum
Output
OK
Input
4
#define sum x + y
#define mul a * b
#define div a / b
#define expr sum + mul * div * mul
expr
Output
OK
Input
3
#define SumSafe (a+b)
#define DivUnsafe a/b
#define DenominatorUnsafe a*b
((SumSafe) + DivUnsafe/DivUnsafe + x/DenominatorUnsafe)
Output
Suspicious
Tags: dp, expression parsing, implementation
Correct Solution:
```
def helper(s, d):
if s in d:
return d[s]
cnt = 0
for idx, c in reversed(list(enumerate(s))):
if c == ')':
cnt += 1
elif c == '(':
cnt -= 1
if cnt == 0 and c in ['+', '-']:
s1 = s[0:idx]
s2 = s[idx+1:]
t1 = helper(s1, d)
t2 = helper(s2, d)
t = 3
if t1 == 2 or t2 == 2:
t = 2
elif t2 == 3 and c == '-':
t = 2
d[s] = t
return t
cnt = 0
for idx, c in reversed(list(enumerate(s))):
if c == ')':
cnt += 1
elif c == '(':
cnt -= 1
if cnt == 0 and c in ['*', '/']:
s1 = s[0:idx]
s2 = s[idx+1:]
t1 = helper(s1, d)
t2 = helper(s2, d)
# print(s)
# print(s1, ' ', s2)
t = 4
if t1 == 2 or t2 == 2:
t = 2
elif t1 == 3 or t2 == 3:
t = 2
elif t2 == 4 and c == '/':
t = 2
d[s] = t
return t
if s[0] == '(' and s[-1] == ')':
if helper(s[1:-1], d) == 2:
return 2
else:
return 1
d[s] = 1
return 1
d = {}
n = int(input())
for i in range(0, n):
temp = input()
j = 0
while temp[j] != '#':
j += 1
while temp[j] != 'd':
j += 1
j += 6
temp = temp[j:].strip()
arr = temp.split(' ', 1)
name, exp = arr[0], ''.join(arr[1].split())
t = helper(exp, d)
d[name] = t
final = ''.join(input().split())
res = helper(final, d)
print(['OK', 'Suspicious'][res == 2])
```
| 38,225
|
[
0.04681396484375,
-0.391357421875,
0.412841796875,
0.2978515625,
-0.54052734375,
-0.4716796875,
0.277099609375,
0.421142578125,
-0.027191162109375,
0.58740234375,
0.87548828125,
0.0731201171875,
0.056610107421875,
-0.7314453125,
-0.75146484375,
0.16650390625,
-0.39990234375,
-1.01953125,
-0.63525390625,
0.5166015625,
0.292236328125,
-0.06689453125,
-1.2724609375,
-0.3330078125,
-0.60302734375,
0.98291015625,
0.1651611328125,
-0.22705078125,
0.57373046875,
1.53125,
-0.451416015625,
-0.223388671875,
0.175048828125,
-0.483154296875,
-0.724609375,
-0.5068359375,
0.1944580078125,
-1.09765625,
0.0865478515625,
-0.362060546875,
-0.010223388671875,
-0.328125,
0.1881103515625,
-0.8671875,
-1.0361328125,
-0.185546875,
-0.06536865234375,
-0.54248046875,
0.348388671875,
-0.1220703125,
0.0419921875,
0.04132080078125,
0.4560546875,
-0.293701171875,
-0.01947021484375,
-0.0843505859375,
0.2357177734375,
-0.282958984375,
-0.8154296875,
0.658203125,
-0.43798828125,
0.0439453125,
-0.7119140625,
-1.076171875,
0.2330322265625,
0.20703125,
-0.498046875,
-0.49072265625,
-0.09112548828125,
-0.291748046875,
-0.0770263671875,
0.382080078125,
-0.41796875,
-0.354248046875,
-0.4501953125,
-0.533203125,
0.1680908203125,
-0.02801513671875,
-0.56640625,
0.38427734375,
0.172607421875,
0.76318359375,
0.2259521484375,
0.03692626953125,
-0.69384765625,
-0.1639404296875,
-0.316650390625,
-0.142578125,
0.113037109375,
-0.305419921875,
-0.25830078125,
0.6484375,
-0.11724853515625,
-0.384033203125,
0.59375,
0.71484375,
-0.466064453125,
0.72265625,
-0.11676025390625,
-0.35595703125,
0.7529296875,
0.646484375,
-0.207763671875,
0.7841796875,
-0.615234375,
0.2337646484375,
0.65625,
0.2271728515625,
-0.57666015625,
-0.7099609375,
-0.3017578125,
-0.2115478515625,
0.68115234375,
-0.17626953125,
0.05859375,
1.279296875,
-0.1240234375,
0.362060546875,
-0.426025390625,
0.388916015625,
0.53759765625,
0.11895751953125,
0.248046875,
-0.49462890625,
-0.1346435546875,
-0.1312255859375,
-0.3916015625,
0.8505859375,
-0.415283203125,
-0.35400390625,
0.1710205078125,
-0.42822265625,
-0.2310791015625,
0.681640625,
-0.044647216796875,
1.1142578125,
-0.6435546875,
0.8427734375,
0.195068359375,
-0.9140625,
0.86474609375,
-0.06298828125,
0.2310791015625,
1.525390625,
0.458251953125,
0.449462890625,
0.75048828125,
0.05352783203125,
-0.6591796875,
0.08001708984375,
-0.76708984375,
0.479736328125,
0.0228271484375,
0.06561279296875,
-0.33740234375,
0.0146942138671875,
-0.66650390625,
0.32763671875,
0.42919921875,
0.134765625,
-0.166259765625,
-0.1195068359375,
0.33935546875,
0.97900390625,
-0.0036106109619140625,
0.9423828125,
-0.58740234375,
-0.09259033203125,
-0.11529541015625,
-0.369384765625,
0.75439453125,
-0.40185546875,
-0.72021484375,
0.91015625,
0.7451171875,
1.294921875,
0.96533203125,
-0.2464599609375,
0.2239990234375,
0.1640625,
-0.5927734375,
0.036773681640625,
0.42236328125,
0.7705078125,
0.71728515625,
0.1888427734375,
0.15869140625,
0.1881103515625,
-0.4453125,
-0.1783447265625,
0.072509765625,
0.7822265625,
-0.69482421875,
0.34716796875,
0.17431640625,
0.292236328125,
-1.1962890625,
-0.149169921875,
0.37109375,
-0.76123046875,
-0.322021484375,
0.619140625,
-0.1708984375,
0.161865234375,
-0.85400390625,
-0.3515625,
0.48095703125,
1.041015625,
-0.205078125,
0.370361328125,
0.305419921875,
-0.432373046875,
-0.6015625,
0.0394287109375,
0.05645751953125,
-0.1605224609375,
-0.250732421875,
0.31005859375,
-0.0278167724609375,
0.01143646240234375,
-0.004852294921875,
0.394287109375,
0.422119140625,
0.85009765625,
0.1390380859375,
-0.53857421875,
0.416748046875,
1.34375,
-0.045806884765625,
0.61328125,
0.292236328125,
0.765625,
0.1575927734375,
0.99169921875,
0.55859375,
0.08306884765625,
0.70849609375,
0.93310546875,
-0.1795654296875,
0.0234222412109375,
0.54052734375,
0.64453125,
0.2109375,
0.7509765625,
-0.120361328125,
0.52001953125,
0.159912109375,
-0.14794921875,
-0.1031494140625,
0.423828125,
-0.1256103515625,
0.91796875,
0.16845703125,
0.6337890625,
-0.10882568359375,
-0.283935546875,
0.2105712890625,
0.81689453125,
-0.56201171875,
-0.488525390625,
0.12841796875,
0.10302734375,
0.45166015625,
-0.11102294921875,
0.400146484375,
0.76953125,
0.38330078125,
0.322509765625,
-0.8740234375,
-0.7021484375,
-0.03350830078125,
-0.388427734375,
-0.8330078125,
-0.498779296875,
-0.5048828125,
0.2161865234375,
0.11114501953125,
-0.48291015625,
0.3896484375,
-0.12841796875,
-0.5263671875,
0.5048828125,
-0.8486328125,
0.6806640625,
-0.01157379150390625,
0.650390625,
-1.0361328125,
1.0732421875,
0.0214691162109375,
0.92822265625,
-0.56494140625,
-0.404296875,
0.5048828125,
-0.6796875,
0.359130859375,
0.2275390625,
0.1495361328125,
-0.03912353515625,
-0.61962890625,
-0.88427734375,
-0.68408203125,
0.06280517578125,
-0.0711669921875,
0.09735107421875,
-0.66162109375,
1.0205078125,
0.054107666015625,
-0.476318359375,
1.072265625,
1.1845703125,
-1.1630859375,
0.87353515625,
0.1903076171875,
0.0022125244140625,
-0.5625,
0.8818359375,
0.61474609375,
0.548828125,
-0.122314453125,
-0.2012939453125,
-0.57080078125,
-0.06146240234375,
0.27490234375,
-0.71142578125,
-0.85498046875,
0.420166015625,
0.525390625,
-0.802734375,
0.489990234375,
-0.92333984375,
-0.453125,
-0.2100830078125,
-0.381103515625,
0.98779296875,
0.52392578125,
-0.14013671875,
-0.2373046875,
0.27978515625,
-0.0921630859375,
0.6416015625,
0.2369384765625,
-0.249267578125,
0.244140625,
0.200927734375,
0.33251953125,
0.45556640625,
0.232177734375,
-0.64111328125,
-0.1925048828125,
-0.2099609375,
0.49072265625,
0.61474609375,
0.1409912109375,
0.64208984375,
0.113525390625,
0.595703125,
-0.54931640625,
-0.01274871826171875,
-0.164794921875,
0.1162109375,
0.8515625,
0.64404296875,
-0.297607421875,
-0.3154296875,
-0.1649169921875,
-0.6728515625,
-0.454345703125,
0.20263671875,
0.76123046875,
-0.406005859375,
0.8408203125,
-0.1331787109375,
-0.82958984375,
0.33740234375,
-0.319580078125,
-0.0474853515625,
1.0927734375,
-0.07379150390625,
0.35205078125,
-0.67236328125,
0.2130126953125,
0.319580078125,
0.0197296142578125,
0.75537109375,
0.1358642578125,
0.1688232421875,
-0.73095703125,
-0.818359375,
-0.61572265625,
0.02435302734375,
-0.39404296875,
-0.6650390625,
0.2327880859375,
-0.62646484375,
-0.047332763671875,
-1.3486328125,
0.6044921875,
0.716796875,
0.442138671875,
0.044891357421875,
0.41748046875,
0.051544189453125,
0.463134765625,
0.49560546875,
-0.14990234375,
0.008453369140625,
-0.7021484375,
0.591796875,
-0.491943359375,
-0.106689453125,
-0.419677734375,
-0.239990234375,
0.175537109375,
0.1312255859375,
-0.347900390625,
0.266845703125,
-0.70068359375,
0.2213134765625,
0.400146484375,
0.47705078125,
-0.7119140625,
-0.0002048015594482422,
-0.107177734375,
0.484375,
0.43798828125,
-1.12109375,
0.2496337890625,
-0.63525390625,
0.2783203125,
0.4873046875,
-0.188232421875,
-0.44921875,
-0.71337890625,
-0.62158203125,
-0.65966796875,
0.12017822265625,
0.40478515625,
-0.08819580078125,
0.10595703125,
-1.228515625,
0.21728515625,
0.2064208984375,
-0.480224609375,
0.244873046875,
0.08233642578125,
0.0648193359375,
0.207763671875,
0.68896484375,
-0.11077880859375,
-0.77783203125,
0.703125,
-0.77783203125,
1.068359375,
-0.49609375,
0.5126953125,
-0.05987548828125,
0.30517578125,
-0.31884765625,
0.130126953125,
-0.441162109375,
-0.1165771484375,
-0.136962890625,
0.4521484375,
-0.931640625,
-0.8125,
0.62158203125,
-0.8486328125,
-0.10894775390625,
0.986328125,
0.387451171875,
-0.60205078125,
0.264892578125,
0.481201171875,
-0.437255859375,
0.39794921875,
-0.8828125,
0.356201171875,
-0.09771728515625,
-0.2171630859375,
-0.2412109375,
-0.487060546875,
0.37109375,
-0.2342529296875,
-1.2392578125,
-0.20703125,
-1.3046875,
-0.409423828125,
-0.2064208984375,
-0.1689453125,
0.501953125,
-0.10308837890625,
0.034942626953125,
0.1092529296875,
-0.275146484375,
-1.0390625,
-0.211669921875,
-0.9111328125,
-0.0438232421875,
-0.115478515625,
0.56591796875,
0.76806640625,
-0.024261474609375,
-0.467041015625,
-0.0482177734375,
-0.62646484375,
-0.316162109375,
-0.5859375,
-0.3046875,
0.062469482421875,
-0.060394287109375,
-0.499755859375,
-0.107666015625,
-0.05615234375,
0.53369140625,
0.70654296875,
-0.1641845703125,
0.4296875,
0.31689453125,
-0.143798828125,
0.9453125,
0.09246826171875,
-0.986328125,
-0.6171875,
0.476318359375,
-0.50390625,
1.06640625,
0.0672607421875,
-0.493408203125,
-0.453125,
-0.97705078125,
0.386962890625,
-0.273681640625,
-0.061004638671875,
-0.98095703125,
-0.84912109375,
-0.13232421875,
0.72900390625,
0.1337890625,
-1.0615234375,
-0.459716796875,
-0.736328125,
0.2088623046875,
-0.38671875,
-0.2353515625,
-0.8037109375,
-0.96484375,
-0.2218017578125,
1.0458984375,
0.1815185546875,
0.30322265625,
-0.2196044921875,
-0.357421875,
0.818359375,
0.31640625,
-0.56201171875,
-0.27734375,
-0.0565185546875,
0.333251953125,
-0.0092010498046875,
0.227783203125,
-0.5087890625,
1.265625,
-0.9111328125,
0.5830078125,
0.064453125,
-0.380126953125,
-0.0716552734375,
0.10308837890625,
0.556640625,
-0.272216796875,
-0.11749267578125,
-0.411376953125,
0.7255859375,
0.43408203125,
-0.40234375,
-0.76318359375,
-0.31005859375,
-0.619140625,
-1.0380859375,
0.58740234375,
-0.39697265625,
0.359130859375,
-0.3388671875,
0.030853271484375,
0.998046875,
-0.53369140625,
0.552734375,
1.7822265625,
0.2216796875,
0.09893798828125,
-0.86669921875,
0.859375,
0.58837890625,
-0.470947265625,
-0.0277557373046875,
0.76611328125,
-0.71923828125,
0.41748046875,
-0.280517578125,
-0.94677734375,
-0.505859375,
0.1439208984375,
0.96630859375,
0.3515625,
0.8134765625,
-0.2244873046875,
-0.8935546875,
-0.88671875,
1.041015625,
-0.1552734375,
0.09588623046875,
0.91845703125,
0.25927734375,
-0.059112548828125,
0.313232421875,
0.07818603515625,
-0.29638671875,
-0.65966796875,
1.4716796875,
-0.3583984375,
-0.340576171875,
0.60009765625,
0.646484375,
-0.818359375,
-1.1845703125,
0.018341064453125,
-0.1004638671875,
-0.287841796875,
-0.32568359375,
-0.1920166015625,
0.71533203125,
-0.64306640625,
0.269775390625,
0.4765625,
0.11517333984375,
-0.0242462158203125,
0.410400390625,
-0.18017578125,
-0.18896484375,
0.6103515625,
0.56201171875,
-0.1998291015625,
-0.10577392578125,
-0.447998046875,
-0.01203155517578125,
-0.1619873046875,
-0.462646484375,
1.212890625,
-0.066650390625,
0.66796875,
0.626953125,
-0.2430419921875,
0.71923828125,
-0.59375,
-0.56884765625,
-0.1785888671875,
-0.92236328125,
-0.9296875,
0.4130859375,
-0.0853271484375,
-0.1834716796875,
0.2183837890625,
-0.3916015625,
0.091796875,
0.82568359375,
0.44970703125,
-0.354248046875,
-1.2177734375,
-0.10552978515625,
-1.7177734375,
-0.6162109375,
-0.41943359375,
-0.61376953125,
-0.3935546875,
0.265380859375,
0.1519775390625,
-0.68896484375,
-0.214599609375,
-0.0640869140625,
-0.1826171875,
0.552734375,
-0.395263671875,
0.381591796875,
-0.2327880859375,
-0.60498046875,
-0.728515625,
-0.298583984375,
-0.37939453125,
-0.501953125,
-0.666015625,
0.26025390625,
0.4208984375,
0.371826171875,
-0.146484375,
0.008636474609375,
-0.042266845703125,
-1.0654296875,
0.2049560546875,
0.256103515625,
-0.381591796875,
1.1015625,
0.51806640625,
0.3173828125,
0.587890625,
-0.0693359375,
-0.490966796875,
-0.1461181640625,
0.7763671875,
0.292724609375,
-0.28515625,
-0.9853515625,
-0.1883544921875,
-0.1431884765625,
-1.0234375,
-0.0823974609375,
-0.28857421875,
0.2298583984375,
0.49560546875,
-0.1612548828125,
0.5703125,
0.81396484375,
0.294677734375,
0.41259765625,
0.0682373046875,
0.2113037109375,
0.52587890625,
0.0804443359375,
0.05572509765625,
0.1795654296875,
-0.1671142578125,
0.08251953125,
0.275634765625,
0.5615234375,
-0.32421875,
0.1810302734375,
-0.03631591796875,
-0.73876953125,
-0.58203125,
-0.1990966796875,
-0.132568359375,
0.501953125,
0.435302734375,
-0.3212890625,
0.0222320556640625,
-0.278564453125,
-0.431884765625,
0.0384521484375,
-1.06640625,
-0.6767578125,
1.076171875,
-0.38720703125,
-0.93310546875,
-0.368408203125,
-0.5400390625,
-0.2171630859375,
-0.5546875,
0.466064453125,
-0.2403564453125,
0.39013671875,
0.08721923828125,
0.2373046875,
-0.42333984375,
0.07928466796875,
0.2225341796875,
0.34619140625,
-0.607421875,
-0.5771484375,
0.2081298828125,
0.6669921875,
0.062286376953125,
-0.1978759765625,
-0.260009765625,
0.078369140625,
0.045867919921875,
0.1973876953125,
-0.54638671875,
0.01306915283203125,
-0.60791015625,
0.5966796875,
-0.96044921875,
-0.031463623046875,
-0.7021484375,
0.5810546875,
0.11859130859375,
-0.69921875,
-0.53662109375,
1.1337890625,
0.59814453125,
-0.3359375,
0.66943359375,
0.66015625,
0.5302734375,
-0.053436279296875,
-0.258056640625,
0.020294189453125,
0.62158203125,
0.94580078125,
0.58740234375,
0.09210205078125,
0.287109375,
0.252197265625,
0.445068359375,
-0.4482421875,
0.30224609375,
-0.217529296875,
-0.25927734375,
-0.3037109375,
0.1981201171875,
-0.2861328125,
-0.032196044921875,
-0.490234375,
0.35498046875,
-0.60595703125,
0.117431640625,
-0.378173828125,
-0.748046875,
0.6298828125,
-0.05474853515625,
-0.77490234375,
0.045745849609375,
-0.1890869140625,
0.751953125,
0.73974609375,
-0.40576171875,
0.291015625,
0.87646484375,
0.447021484375,
-0.0311126708984375,
-0.045806884765625,
0.50732421875,
0.5615234375,
-0.66748046875,
0.099365234375,
0.1922607421875,
0.437255859375,
-0.257080078125,
-0.576171875,
-1.01953125,
0.383544921875,
-0.2330322265625,
-0.1893310546875,
0.20458984375,
-0.458984375,
-0.08868408203125,
-0.51025390625,
0.771484375,
-0.8642578125,
0.1273193359375,
0.4765625,
-0.32373046875,
-0.83837890625,
1.015625,
0.080322265625,
0.34130859375,
0.31103515625,
0.99072265625,
0.07196044921875,
1.3193359375,
0.517578125,
-0.044464111328125,
-0.273193359375,
0.324951171875,
-0.277587890625,
-0.677734375,
0.06732177734375,
-0.2027587890625,
0.26953125,
-0.02459716796875,
-0.1180419921875,
0.337890625,
0.890625,
-0.122802734375,
-0.74951171875,
0.1116943359375,
0.270751953125,
-0.269287109375,
0.43212890625,
0.23193359375,
0.3232421875,
0.176025390625,
0.005401611328125,
-0.3359375,
-0.6005859375,
-0.0635986328125,
-0.8623046875,
0.5185546875,
0.12371826171875,
-0.168701171875,
-0.67578125,
-0.36767578125,
-0.09759521484375,
0.513671875,
-0.548828125,
-0.8408203125,
0.78271484375,
0.728515625,
-0.03948974609375,
0.41552734375,
-0.224853515625,
-0.188720703125,
0.9130859375,
1.380859375,
-0.541015625,
0.74755859375,
0.40771484375,
-0.1444091796875,
0.20068359375,
-0.61328125,
0.32177734375,
-0.2022705078125,
-0.314453125,
-0.1617431640625,
0.302734375,
-0.35546875,
-0.9267578125,
-0.046630859375,
1.0166015625,
0.403564453125,
-0.3447265625,
-1.2119140625,
-0.452880859375,
-1.1640625,
-0.02069091796875,
-0.82080078125,
0.47998046875,
-0.0887451171875,
-0.2122802734375,
-0.1763916015625,
-1.0830078125,
4.3359375,
0.67578125,
1.015625,
0.60888671875,
0.42578125,
0.51904296875,
0.22900390625,
-0.7138671875,
0.56396484375,
-0.85009765625,
0.40185546875,
-0.09539794921875,
-0.266845703125,
0.80322265625,
0.70654296875,
0.5302734375,
-0.9384765625,
-0.03155517578125,
-0.386474609375,
-0.58447265625,
-0.89013671875,
0.10784912109375,
-0.0277252197265625,
0.8193359375,
-0.274658203125,
0.494140625,
0.36669921875,
-0.9248046875,
-0.333984375,
-0.53076171875,
-0.25,
-0.2481689453125,
0.68115234375,
0.0093231201171875,
-0.6162109375,
0.53125,
-0.37353515625,
-0.2310791015625,
-0.125,
-0.0133819580078125,
-0.40283203125,
-0.1982421875,
0.58544921875,
-0.5654296875,
-0.258544921875,
0.8837890625,
-0.58935546875,
0.203857421875,
0.578125,
-1.2490234375,
0.81689453125,
-0.296142578125,
0.428466796875,
-0.59423828125,
-0.7958984375,
-0.010345458984375,
0.11297607421875,
-0.3701171875,
-0.4306640625,
0.5478515625,
-0.0426025390625,
0.708984375,
0.09722900390625,
0.5810546875,
-0.486328125,
0.53662109375,
-0.48779296875,
0.744140625,
-0.6240234375,
-0.52392578125,
-0.210205078125,
-0.245849609375,
0.1744384765625,
-0.5673828125,
0.61669921875,
0.01708984375,
-0.375732421875,
0.26171875,
0.350830078125,
-0.62109375,
-0.068603515625,
-0.2509765625,
-0.52001953125,
-0.8955078125,
0.66064453125,
0.802734375,
-0.400634765625,
-0.45458984375,
-0.10888671875,
0.55908203125,
0.51904296875,
0.43115234375,
0.01360321044921875,
-0.5068359375,
-0.70361328125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.
In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. The generic syntax for declaring a macro is the following:
#define macro_name macro_value
After the macro has been declared, "macro_name" is replaced with "macro_value" each time it is met in the program (only the whole tokens can be replaced; i.e. "macro_name" is replaced only when it is surrounded by spaces or other non-alphabetic symbol). A "macro_value" within our model can only be an arithmetic expression consisting of variables, four arithmetic operations, brackets, and also the names of previously declared macros (in this case replacement is performed sequentially). The process of replacing macros with their values is called substitution.
One of the main problems arising while using macros β the situation when as a result of substitution we get an arithmetic expression with the changed order of calculation because of different priorities of the operations.
Let's consider the following example. Say, we declared such a #define construction:
#define sum x + y
and further in the program the expression "2 * sum" is calculated. After macro substitution is performed we get "2 * x + y", instead of intuitively expected "2 * (x + y)".
Let's call the situation "suspicious", if after the macro substitution the order of calculation changes, falling outside the bounds of some macro. Thus, your task is to find out by the given set of #define definitions and the given expression if this expression is suspicious or not.
Let's speak more formally. We should perform an ordinary macros substitution in the given expression. Moreover, we should perform a "safe" macros substitution in the expression, putting in brackets each macro value; after this, guided by arithmetic rules of brackets expansion, we can omit some of the brackets. If there exist a way to get an expression, absolutely coinciding with the expression that is the result of an ordinary substitution (character-by-character, but ignoring spaces), then this expression and the macros system are called correct, otherwise β suspicious.
Note that we consider the "/" operation as the usual mathematical division, not the integer division like in C/C++. That's why, for example, in the expression "a*(b/c)" we can omit brackets to get the expression "a*b/c".
Input
The first line contains the only number n (0 β€ n β€ 100) β the amount of #define constructions in the given program.
Then there follow n lines, each of them contains just one #define construction. Each construction has the following syntax:
#define name expression
where
* name β the macro name,
* expression β the expression with which the given macro will be replaced. An expression is a non-empty string, containing digits,names of variables, names of previously declared macros, round brackets and operational signs +-*/. It is guaranteed that the expression (before and after macros substitution) is a correct arithmetic expression, having no unary operations. The expression contains only non-negative integers, not exceeding 109.
All the names (#define constructions' names and names of their arguments) are strings of case-sensitive Latin characters. It is guaranteed that the name of any variable is different from any #define construction.
Then, the last line contains an expression that you are to check. This expression is non-empty and satisfies the same limitations as the expressions in #define constructions.
The input lines may contain any number of spaces anywhere, providing these spaces do not break the word "define" or the names of constructions and variables. In particular, there can be any number of spaces before and after the "#" symbol.
The length of any line from the input file does not exceed 100 characters.
Output
Output "OK", if the expression is correct according to the above given criterion, otherwise output "Suspicious".
Examples
Input
1
#define sum x + y
1 * sum
Output
Suspicious
Input
1
#define sum (x + y)
sum - sum
Output
OK
Input
4
#define sum x + y
#define mul a * b
#define div a / b
#define expr sum + mul * div * mul
expr
Output
OK
Input
3
#define SumSafe (a+b)
#define DivUnsafe a/b
#define DenominatorUnsafe a*b
((SumSafe) + DivUnsafe/DivUnsafe + x/DenominatorUnsafe)
Output
Suspicious
Tags: dp, expression parsing, implementation
Correct Solution:
```
# 1:correct, 2:incorrect, 3:(a+b), no - at front, no * or / neighbor, 4:(a*b),(a/b) no / at front
def helper(s, d):
# print(s)
if s in d:
return d[s]
cnt = 0
for idx, c in reversed(list(enumerate(s))):
if c == ')':
cnt += 1
elif c == '(':
cnt -= 1
if cnt == 0 and c in ['+', '-']:
s1 = s[0:idx]
s2 = s[idx+1:]
t1 = helper(s1, d)
t2 = helper(s2, d)
t = 3
if t1 == 2 or t2 == 2:
t = 2
elif t2 == 3 and c == '-':
t = 2
d[s] = t
return t
cnt = 0
for idx, c in reversed(list(enumerate(s))):
if c == ')':
cnt += 1
elif c == '(':
cnt -= 1
if cnt == 0 and c in ['*', '/']:
s1 = s[0:idx]
s2 = s[idx+1:]
t1 = helper(s1, d)
t2 = helper(s2, d)
# print(s)
# print(s1, ' ', s2)
t = 4
if t1 == 2 or t2 == 2:
t = 2
elif t1 == 3 or t2 == 3:
t = 2
elif t2 == 4 and c == '/':
t = 2
d[s] = t
return t
if s[0] == '(' and s[-1] == ')':
if helper(s[1:-1], d) == 2:
return 2
else:
return 1
d[s] = 1
return 1
d = {}
n = int(input())
for i in range(0, n):
temp = input()
j = 0
while temp[j] != '#':
j += 1
while temp[j] != 'd':
j += 1
j += 6
temp = temp[j:].strip()
arr = temp.split(' ', 1)
# print(arr)
name, exp = arr[0], ''.join(arr[1].split())
# print(name, exp)
t = helper(exp, d)
d[name] = t
final = ''.join(input().split())
res = helper(final, d)
if res == 2:
print('Suspicious')
else:
print('OK')
# print(arr)
# print(helper('(a-a)*(x/x-1)', d))
```
| 38,226
|
[
0.04681396484375,
-0.391357421875,
0.412841796875,
0.2978515625,
-0.54052734375,
-0.4716796875,
0.277099609375,
0.421142578125,
-0.027191162109375,
0.58740234375,
0.87548828125,
0.0731201171875,
0.056610107421875,
-0.7314453125,
-0.75146484375,
0.16650390625,
-0.39990234375,
-1.01953125,
-0.63525390625,
0.5166015625,
0.292236328125,
-0.06689453125,
-1.2724609375,
-0.3330078125,
-0.60302734375,
0.98291015625,
0.1651611328125,
-0.22705078125,
0.57373046875,
1.53125,
-0.451416015625,
-0.223388671875,
0.175048828125,
-0.483154296875,
-0.724609375,
-0.5068359375,
0.1944580078125,
-1.09765625,
0.0865478515625,
-0.362060546875,
-0.010223388671875,
-0.328125,
0.1881103515625,
-0.8671875,
-1.0361328125,
-0.185546875,
-0.06536865234375,
-0.54248046875,
0.348388671875,
-0.1220703125,
0.0419921875,
0.04132080078125,
0.4560546875,
-0.293701171875,
-0.01947021484375,
-0.0843505859375,
0.2357177734375,
-0.282958984375,
-0.8154296875,
0.658203125,
-0.43798828125,
0.0439453125,
-0.7119140625,
-1.076171875,
0.2330322265625,
0.20703125,
-0.498046875,
-0.49072265625,
-0.09112548828125,
-0.291748046875,
-0.0770263671875,
0.382080078125,
-0.41796875,
-0.354248046875,
-0.4501953125,
-0.533203125,
0.1680908203125,
-0.02801513671875,
-0.56640625,
0.38427734375,
0.172607421875,
0.76318359375,
0.2259521484375,
0.03692626953125,
-0.69384765625,
-0.1639404296875,
-0.316650390625,
-0.142578125,
0.113037109375,
-0.305419921875,
-0.25830078125,
0.6484375,
-0.11724853515625,
-0.384033203125,
0.59375,
0.71484375,
-0.466064453125,
0.72265625,
-0.11676025390625,
-0.35595703125,
0.7529296875,
0.646484375,
-0.207763671875,
0.7841796875,
-0.615234375,
0.2337646484375,
0.65625,
0.2271728515625,
-0.57666015625,
-0.7099609375,
-0.3017578125,
-0.2115478515625,
0.68115234375,
-0.17626953125,
0.05859375,
1.279296875,
-0.1240234375,
0.362060546875,
-0.426025390625,
0.388916015625,
0.53759765625,
0.11895751953125,
0.248046875,
-0.49462890625,
-0.1346435546875,
-0.1312255859375,
-0.3916015625,
0.8505859375,
-0.415283203125,
-0.35400390625,
0.1710205078125,
-0.42822265625,
-0.2310791015625,
0.681640625,
-0.044647216796875,
1.1142578125,
-0.6435546875,
0.8427734375,
0.195068359375,
-0.9140625,
0.86474609375,
-0.06298828125,
0.2310791015625,
1.525390625,
0.458251953125,
0.449462890625,
0.75048828125,
0.05352783203125,
-0.6591796875,
0.08001708984375,
-0.76708984375,
0.479736328125,
0.0228271484375,
0.06561279296875,
-0.33740234375,
0.0146942138671875,
-0.66650390625,
0.32763671875,
0.42919921875,
0.134765625,
-0.166259765625,
-0.1195068359375,
0.33935546875,
0.97900390625,
-0.0036106109619140625,
0.9423828125,
-0.58740234375,
-0.09259033203125,
-0.11529541015625,
-0.369384765625,
0.75439453125,
-0.40185546875,
-0.72021484375,
0.91015625,
0.7451171875,
1.294921875,
0.96533203125,
-0.2464599609375,
0.2239990234375,
0.1640625,
-0.5927734375,
0.036773681640625,
0.42236328125,
0.7705078125,
0.71728515625,
0.1888427734375,
0.15869140625,
0.1881103515625,
-0.4453125,
-0.1783447265625,
0.072509765625,
0.7822265625,
-0.69482421875,
0.34716796875,
0.17431640625,
0.292236328125,
-1.1962890625,
-0.149169921875,
0.37109375,
-0.76123046875,
-0.322021484375,
0.619140625,
-0.1708984375,
0.161865234375,
-0.85400390625,
-0.3515625,
0.48095703125,
1.041015625,
-0.205078125,
0.370361328125,
0.305419921875,
-0.432373046875,
-0.6015625,
0.0394287109375,
0.05645751953125,
-0.1605224609375,
-0.250732421875,
0.31005859375,
-0.0278167724609375,
0.01143646240234375,
-0.004852294921875,
0.394287109375,
0.422119140625,
0.85009765625,
0.1390380859375,
-0.53857421875,
0.416748046875,
1.34375,
-0.045806884765625,
0.61328125,
0.292236328125,
0.765625,
0.1575927734375,
0.99169921875,
0.55859375,
0.08306884765625,
0.70849609375,
0.93310546875,
-0.1795654296875,
0.0234222412109375,
0.54052734375,
0.64453125,
0.2109375,
0.7509765625,
-0.120361328125,
0.52001953125,
0.159912109375,
-0.14794921875,
-0.1031494140625,
0.423828125,
-0.1256103515625,
0.91796875,
0.16845703125,
0.6337890625,
-0.10882568359375,
-0.283935546875,
0.2105712890625,
0.81689453125,
-0.56201171875,
-0.488525390625,
0.12841796875,
0.10302734375,
0.45166015625,
-0.11102294921875,
0.400146484375,
0.76953125,
0.38330078125,
0.322509765625,
-0.8740234375,
-0.7021484375,
-0.03350830078125,
-0.388427734375,
-0.8330078125,
-0.498779296875,
-0.5048828125,
0.2161865234375,
0.11114501953125,
-0.48291015625,
0.3896484375,
-0.12841796875,
-0.5263671875,
0.5048828125,
-0.8486328125,
0.6806640625,
-0.01157379150390625,
0.650390625,
-1.0361328125,
1.0732421875,
0.0214691162109375,
0.92822265625,
-0.56494140625,
-0.404296875,
0.5048828125,
-0.6796875,
0.359130859375,
0.2275390625,
0.1495361328125,
-0.03912353515625,
-0.61962890625,
-0.88427734375,
-0.68408203125,
0.06280517578125,
-0.0711669921875,
0.09735107421875,
-0.66162109375,
1.0205078125,
0.054107666015625,
-0.476318359375,
1.072265625,
1.1845703125,
-1.1630859375,
0.87353515625,
0.1903076171875,
0.0022125244140625,
-0.5625,
0.8818359375,
0.61474609375,
0.548828125,
-0.122314453125,
-0.2012939453125,
-0.57080078125,
-0.06146240234375,
0.27490234375,
-0.71142578125,
-0.85498046875,
0.420166015625,
0.525390625,
-0.802734375,
0.489990234375,
-0.92333984375,
-0.453125,
-0.2100830078125,
-0.381103515625,
0.98779296875,
0.52392578125,
-0.14013671875,
-0.2373046875,
0.27978515625,
-0.0921630859375,
0.6416015625,
0.2369384765625,
-0.249267578125,
0.244140625,
0.200927734375,
0.33251953125,
0.45556640625,
0.232177734375,
-0.64111328125,
-0.1925048828125,
-0.2099609375,
0.49072265625,
0.61474609375,
0.1409912109375,
0.64208984375,
0.113525390625,
0.595703125,
-0.54931640625,
-0.01274871826171875,
-0.164794921875,
0.1162109375,
0.8515625,
0.64404296875,
-0.297607421875,
-0.3154296875,
-0.1649169921875,
-0.6728515625,
-0.454345703125,
0.20263671875,
0.76123046875,
-0.406005859375,
0.8408203125,
-0.1331787109375,
-0.82958984375,
0.33740234375,
-0.319580078125,
-0.0474853515625,
1.0927734375,
-0.07379150390625,
0.35205078125,
-0.67236328125,
0.2130126953125,
0.319580078125,
0.0197296142578125,
0.75537109375,
0.1358642578125,
0.1688232421875,
-0.73095703125,
-0.818359375,
-0.61572265625,
0.02435302734375,
-0.39404296875,
-0.6650390625,
0.2327880859375,
-0.62646484375,
-0.047332763671875,
-1.3486328125,
0.6044921875,
0.716796875,
0.442138671875,
0.044891357421875,
0.41748046875,
0.051544189453125,
0.463134765625,
0.49560546875,
-0.14990234375,
0.008453369140625,
-0.7021484375,
0.591796875,
-0.491943359375,
-0.106689453125,
-0.419677734375,
-0.239990234375,
0.175537109375,
0.1312255859375,
-0.347900390625,
0.266845703125,
-0.70068359375,
0.2213134765625,
0.400146484375,
0.47705078125,
-0.7119140625,
-0.0002048015594482422,
-0.107177734375,
0.484375,
0.43798828125,
-1.12109375,
0.2496337890625,
-0.63525390625,
0.2783203125,
0.4873046875,
-0.188232421875,
-0.44921875,
-0.71337890625,
-0.62158203125,
-0.65966796875,
0.12017822265625,
0.40478515625,
-0.08819580078125,
0.10595703125,
-1.228515625,
0.21728515625,
0.2064208984375,
-0.480224609375,
0.244873046875,
0.08233642578125,
0.0648193359375,
0.207763671875,
0.68896484375,
-0.11077880859375,
-0.77783203125,
0.703125,
-0.77783203125,
1.068359375,
-0.49609375,
0.5126953125,
-0.05987548828125,
0.30517578125,
-0.31884765625,
0.130126953125,
-0.441162109375,
-0.1165771484375,
-0.136962890625,
0.4521484375,
-0.931640625,
-0.8125,
0.62158203125,
-0.8486328125,
-0.10894775390625,
0.986328125,
0.387451171875,
-0.60205078125,
0.264892578125,
0.481201171875,
-0.437255859375,
0.39794921875,
-0.8828125,
0.356201171875,
-0.09771728515625,
-0.2171630859375,
-0.2412109375,
-0.487060546875,
0.37109375,
-0.2342529296875,
-1.2392578125,
-0.20703125,
-1.3046875,
-0.409423828125,
-0.2064208984375,
-0.1689453125,
0.501953125,
-0.10308837890625,
0.034942626953125,
0.1092529296875,
-0.275146484375,
-1.0390625,
-0.211669921875,
-0.9111328125,
-0.0438232421875,
-0.115478515625,
0.56591796875,
0.76806640625,
-0.024261474609375,
-0.467041015625,
-0.0482177734375,
-0.62646484375,
-0.316162109375,
-0.5859375,
-0.3046875,
0.062469482421875,
-0.060394287109375,
-0.499755859375,
-0.107666015625,
-0.05615234375,
0.53369140625,
0.70654296875,
-0.1641845703125,
0.4296875,
0.31689453125,
-0.143798828125,
0.9453125,
0.09246826171875,
-0.986328125,
-0.6171875,
0.476318359375,
-0.50390625,
1.06640625,
0.0672607421875,
-0.493408203125,
-0.453125,
-0.97705078125,
0.386962890625,
-0.273681640625,
-0.061004638671875,
-0.98095703125,
-0.84912109375,
-0.13232421875,
0.72900390625,
0.1337890625,
-1.0615234375,
-0.459716796875,
-0.736328125,
0.2088623046875,
-0.38671875,
-0.2353515625,
-0.8037109375,
-0.96484375,
-0.2218017578125,
1.0458984375,
0.1815185546875,
0.30322265625,
-0.2196044921875,
-0.357421875,
0.818359375,
0.31640625,
-0.56201171875,
-0.27734375,
-0.0565185546875,
0.333251953125,
-0.0092010498046875,
0.227783203125,
-0.5087890625,
1.265625,
-0.9111328125,
0.5830078125,
0.064453125,
-0.380126953125,
-0.0716552734375,
0.10308837890625,
0.556640625,
-0.272216796875,
-0.11749267578125,
-0.411376953125,
0.7255859375,
0.43408203125,
-0.40234375,
-0.76318359375,
-0.31005859375,
-0.619140625,
-1.0380859375,
0.58740234375,
-0.39697265625,
0.359130859375,
-0.3388671875,
0.030853271484375,
0.998046875,
-0.53369140625,
0.552734375,
1.7822265625,
0.2216796875,
0.09893798828125,
-0.86669921875,
0.859375,
0.58837890625,
-0.470947265625,
-0.0277557373046875,
0.76611328125,
-0.71923828125,
0.41748046875,
-0.280517578125,
-0.94677734375,
-0.505859375,
0.1439208984375,
0.96630859375,
0.3515625,
0.8134765625,
-0.2244873046875,
-0.8935546875,
-0.88671875,
1.041015625,
-0.1552734375,
0.09588623046875,
0.91845703125,
0.25927734375,
-0.059112548828125,
0.313232421875,
0.07818603515625,
-0.29638671875,
-0.65966796875,
1.4716796875,
-0.3583984375,
-0.340576171875,
0.60009765625,
0.646484375,
-0.818359375,
-1.1845703125,
0.018341064453125,
-0.1004638671875,
-0.287841796875,
-0.32568359375,
-0.1920166015625,
0.71533203125,
-0.64306640625,
0.269775390625,
0.4765625,
0.11517333984375,
-0.0242462158203125,
0.410400390625,
-0.18017578125,
-0.18896484375,
0.6103515625,
0.56201171875,
-0.1998291015625,
-0.10577392578125,
-0.447998046875,
-0.01203155517578125,
-0.1619873046875,
-0.462646484375,
1.212890625,
-0.066650390625,
0.66796875,
0.626953125,
-0.2430419921875,
0.71923828125,
-0.59375,
-0.56884765625,
-0.1785888671875,
-0.92236328125,
-0.9296875,
0.4130859375,
-0.0853271484375,
-0.1834716796875,
0.2183837890625,
-0.3916015625,
0.091796875,
0.82568359375,
0.44970703125,
-0.354248046875,
-1.2177734375,
-0.10552978515625,
-1.7177734375,
-0.6162109375,
-0.41943359375,
-0.61376953125,
-0.3935546875,
0.265380859375,
0.1519775390625,
-0.68896484375,
-0.214599609375,
-0.0640869140625,
-0.1826171875,
0.552734375,
-0.395263671875,
0.381591796875,
-0.2327880859375,
-0.60498046875,
-0.728515625,
-0.298583984375,
-0.37939453125,
-0.501953125,
-0.666015625,
0.26025390625,
0.4208984375,
0.371826171875,
-0.146484375,
0.008636474609375,
-0.042266845703125,
-1.0654296875,
0.2049560546875,
0.256103515625,
-0.381591796875,
1.1015625,
0.51806640625,
0.3173828125,
0.587890625,
-0.0693359375,
-0.490966796875,
-0.1461181640625,
0.7763671875,
0.292724609375,
-0.28515625,
-0.9853515625,
-0.1883544921875,
-0.1431884765625,
-1.0234375,
-0.0823974609375,
-0.28857421875,
0.2298583984375,
0.49560546875,
-0.1612548828125,
0.5703125,
0.81396484375,
0.294677734375,
0.41259765625,
0.0682373046875,
0.2113037109375,
0.52587890625,
0.0804443359375,
0.05572509765625,
0.1795654296875,
-0.1671142578125,
0.08251953125,
0.275634765625,
0.5615234375,
-0.32421875,
0.1810302734375,
-0.03631591796875,
-0.73876953125,
-0.58203125,
-0.1990966796875,
-0.132568359375,
0.501953125,
0.435302734375,
-0.3212890625,
0.0222320556640625,
-0.278564453125,
-0.431884765625,
0.0384521484375,
-1.06640625,
-0.6767578125,
1.076171875,
-0.38720703125,
-0.93310546875,
-0.368408203125,
-0.5400390625,
-0.2171630859375,
-0.5546875,
0.466064453125,
-0.2403564453125,
0.39013671875,
0.08721923828125,
0.2373046875,
-0.42333984375,
0.07928466796875,
0.2225341796875,
0.34619140625,
-0.607421875,
-0.5771484375,
0.2081298828125,
0.6669921875,
0.062286376953125,
-0.1978759765625,
-0.260009765625,
0.078369140625,
0.045867919921875,
0.1973876953125,
-0.54638671875,
0.01306915283203125,
-0.60791015625,
0.5966796875,
-0.96044921875,
-0.031463623046875,
-0.7021484375,
0.5810546875,
0.11859130859375,
-0.69921875,
-0.53662109375,
1.1337890625,
0.59814453125,
-0.3359375,
0.66943359375,
0.66015625,
0.5302734375,
-0.053436279296875,
-0.258056640625,
0.020294189453125,
0.62158203125,
0.94580078125,
0.58740234375,
0.09210205078125,
0.287109375,
0.252197265625,
0.445068359375,
-0.4482421875,
0.30224609375,
-0.217529296875,
-0.25927734375,
-0.3037109375,
0.1981201171875,
-0.2861328125,
-0.032196044921875,
-0.490234375,
0.35498046875,
-0.60595703125,
0.117431640625,
-0.378173828125,
-0.748046875,
0.6298828125,
-0.05474853515625,
-0.77490234375,
0.045745849609375,
-0.1890869140625,
0.751953125,
0.73974609375,
-0.40576171875,
0.291015625,
0.87646484375,
0.447021484375,
-0.0311126708984375,
-0.045806884765625,
0.50732421875,
0.5615234375,
-0.66748046875,
0.099365234375,
0.1922607421875,
0.437255859375,
-0.257080078125,
-0.576171875,
-1.01953125,
0.383544921875,
-0.2330322265625,
-0.1893310546875,
0.20458984375,
-0.458984375,
-0.08868408203125,
-0.51025390625,
0.771484375,
-0.8642578125,
0.1273193359375,
0.4765625,
-0.32373046875,
-0.83837890625,
1.015625,
0.080322265625,
0.34130859375,
0.31103515625,
0.99072265625,
0.07196044921875,
1.3193359375,
0.517578125,
-0.044464111328125,
-0.273193359375,
0.324951171875,
-0.277587890625,
-0.677734375,
0.06732177734375,
-0.2027587890625,
0.26953125,
-0.02459716796875,
-0.1180419921875,
0.337890625,
0.890625,
-0.122802734375,
-0.74951171875,
0.1116943359375,
0.270751953125,
-0.269287109375,
0.43212890625,
0.23193359375,
0.3232421875,
0.176025390625,
0.005401611328125,
-0.3359375,
-0.6005859375,
-0.0635986328125,
-0.8623046875,
0.5185546875,
0.12371826171875,
-0.168701171875,
-0.67578125,
-0.36767578125,
-0.09759521484375,
0.513671875,
-0.548828125,
-0.8408203125,
0.78271484375,
0.728515625,
-0.03948974609375,
0.41552734375,
-0.224853515625,
-0.188720703125,
0.9130859375,
1.380859375,
-0.541015625,
0.74755859375,
0.40771484375,
-0.1444091796875,
0.20068359375,
-0.61328125,
0.32177734375,
-0.2022705078125,
-0.314453125,
-0.1617431640625,
0.302734375,
-0.35546875,
-0.9267578125,
-0.046630859375,
1.0166015625,
0.403564453125,
-0.3447265625,
-1.2119140625,
-0.452880859375,
-1.1640625,
-0.02069091796875,
-0.82080078125,
0.47998046875,
-0.0887451171875,
-0.2122802734375,
-0.1763916015625,
-1.0830078125,
4.3359375,
0.67578125,
1.015625,
0.60888671875,
0.42578125,
0.51904296875,
0.22900390625,
-0.7138671875,
0.56396484375,
-0.85009765625,
0.40185546875,
-0.09539794921875,
-0.266845703125,
0.80322265625,
0.70654296875,
0.5302734375,
-0.9384765625,
-0.03155517578125,
-0.386474609375,
-0.58447265625,
-0.89013671875,
0.10784912109375,
-0.0277252197265625,
0.8193359375,
-0.274658203125,
0.494140625,
0.36669921875,
-0.9248046875,
-0.333984375,
-0.53076171875,
-0.25,
-0.2481689453125,
0.68115234375,
0.0093231201171875,
-0.6162109375,
0.53125,
-0.37353515625,
-0.2310791015625,
-0.125,
-0.0133819580078125,
-0.40283203125,
-0.1982421875,
0.58544921875,
-0.5654296875,
-0.258544921875,
0.8837890625,
-0.58935546875,
0.203857421875,
0.578125,
-1.2490234375,
0.81689453125,
-0.296142578125,
0.428466796875,
-0.59423828125,
-0.7958984375,
-0.010345458984375,
0.11297607421875,
-0.3701171875,
-0.4306640625,
0.5478515625,
-0.0426025390625,
0.708984375,
0.09722900390625,
0.5810546875,
-0.486328125,
0.53662109375,
-0.48779296875,
0.744140625,
-0.6240234375,
-0.52392578125,
-0.210205078125,
-0.245849609375,
0.1744384765625,
-0.5673828125,
0.61669921875,
0.01708984375,
-0.375732421875,
0.26171875,
0.350830078125,
-0.62109375,
-0.068603515625,
-0.2509765625,
-0.52001953125,
-0.8955078125,
0.66064453125,
0.802734375,
-0.400634765625,
-0.45458984375,
-0.10888671875,
0.55908203125,
0.51904296875,
0.43115234375,
0.01360321044921875,
-0.5068359375,
-0.70361328125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.
In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. The generic syntax for declaring a macro is the following:
#define macro_name macro_value
After the macro has been declared, "macro_name" is replaced with "macro_value" each time it is met in the program (only the whole tokens can be replaced; i.e. "macro_name" is replaced only when it is surrounded by spaces or other non-alphabetic symbol). A "macro_value" within our model can only be an arithmetic expression consisting of variables, four arithmetic operations, brackets, and also the names of previously declared macros (in this case replacement is performed sequentially). The process of replacing macros with their values is called substitution.
One of the main problems arising while using macros β the situation when as a result of substitution we get an arithmetic expression with the changed order of calculation because of different priorities of the operations.
Let's consider the following example. Say, we declared such a #define construction:
#define sum x + y
and further in the program the expression "2 * sum" is calculated. After macro substitution is performed we get "2 * x + y", instead of intuitively expected "2 * (x + y)".
Let's call the situation "suspicious", if after the macro substitution the order of calculation changes, falling outside the bounds of some macro. Thus, your task is to find out by the given set of #define definitions and the given expression if this expression is suspicious or not.
Let's speak more formally. We should perform an ordinary macros substitution in the given expression. Moreover, we should perform a "safe" macros substitution in the expression, putting in brackets each macro value; after this, guided by arithmetic rules of brackets expansion, we can omit some of the brackets. If there exist a way to get an expression, absolutely coinciding with the expression that is the result of an ordinary substitution (character-by-character, but ignoring spaces), then this expression and the macros system are called correct, otherwise β suspicious.
Note that we consider the "/" operation as the usual mathematical division, not the integer division like in C/C++. That's why, for example, in the expression "a*(b/c)" we can omit brackets to get the expression "a*b/c".
Input
The first line contains the only number n (0 β€ n β€ 100) β the amount of #define constructions in the given program.
Then there follow n lines, each of them contains just one #define construction. Each construction has the following syntax:
#define name expression
where
* name β the macro name,
* expression β the expression with which the given macro will be replaced. An expression is a non-empty string, containing digits,names of variables, names of previously declared macros, round brackets and operational signs +-*/. It is guaranteed that the expression (before and after macros substitution) is a correct arithmetic expression, having no unary operations. The expression contains only non-negative integers, not exceeding 109.
All the names (#define constructions' names and names of their arguments) are strings of case-sensitive Latin characters. It is guaranteed that the name of any variable is different from any #define construction.
Then, the last line contains an expression that you are to check. This expression is non-empty and satisfies the same limitations as the expressions in #define constructions.
The input lines may contain any number of spaces anywhere, providing these spaces do not break the word "define" or the names of constructions and variables. In particular, there can be any number of spaces before and after the "#" symbol.
The length of any line from the input file does not exceed 100 characters.
Output
Output "OK", if the expression is correct according to the above given criterion, otherwise output "Suspicious".
Examples
Input
1
#define sum x + y
1 * sum
Output
Suspicious
Input
1
#define sum (x + y)
sum - sum
Output
OK
Input
4
#define sum x + y
#define mul a * b
#define div a / b
#define expr sum + mul * div * mul
expr
Output
OK
Input
3
#define SumSafe (a+b)
#define DivUnsafe a/b
#define DenominatorUnsafe a*b
((SumSafe) + DivUnsafe/DivUnsafe + x/DenominatorUnsafe)
Output
Suspicious
Tags: dp, expression parsing, implementation
Correct Solution:
```
# 1:correct, 2:incorrect, 3:(a+b), no - at front, no * or / neighbor, 4:(a*b),(a/b) no / at front
def helper(s, d):
if s in d:
return d[s]
cnt = 0
for idx, c in reversed(list(enumerate(s))):
if c == ')':
cnt += 1
elif c == '(':
cnt -= 1
if cnt == 0 and c in ['+', '-']:
s1 = s[0:idx]
s2 = s[idx+1:]
t1 = helper(s1, d)
t2 = helper(s2, d)
t = 3
if t1 == 2 or t2 == 2:
t = 2
elif t2 == 3 and c == '-':
t = 2
d[s] = t
return t
cnt = 0
for idx, c in reversed(list(enumerate(s))):
if c == ')':
cnt += 1
elif c == '(':
cnt -= 1
if cnt == 0 and c in ['*', '/']:
s1 = s[0:idx]
s2 = s[idx+1:]
t1 = helper(s1, d)
t2 = helper(s2, d)
t = 4
if t1 == 2 or t2 == 2:
t = 2
elif t1 == 3 or t2 == 3:
t = 2
elif t2 == 4 and c == '/':
t = 2
d[s] = t
return t
if s[0] == '(' and s[-1] == ')':
if helper(s[1:-1], d) == 2:
return 2
else:
return 1
d[s] = 1
return 1
d = {}
n = int(input())
for i in range(0, n):
temp = input()
j = 0
while temp[j] != '#':
j += 1
while temp[j] != 'd':
j += 1
j += 6
temp = temp[j:].strip()
arr = temp.split(' ', 1)
name, exp = arr[0], ''.join(arr[1].split())
t = helper(exp, d)
d[name] = t
final = ''.join(input().split())
res = helper(final, d)
if res == 2:
print('Suspicious')
else:
print('OK')
```
| 38,227
|
[
0.04681396484375,
-0.391357421875,
0.412841796875,
0.2978515625,
-0.54052734375,
-0.4716796875,
0.277099609375,
0.421142578125,
-0.027191162109375,
0.58740234375,
0.87548828125,
0.0731201171875,
0.056610107421875,
-0.7314453125,
-0.75146484375,
0.16650390625,
-0.39990234375,
-1.01953125,
-0.63525390625,
0.5166015625,
0.292236328125,
-0.06689453125,
-1.2724609375,
-0.3330078125,
-0.60302734375,
0.98291015625,
0.1651611328125,
-0.22705078125,
0.57373046875,
1.53125,
-0.451416015625,
-0.223388671875,
0.175048828125,
-0.483154296875,
-0.724609375,
-0.5068359375,
0.1944580078125,
-1.09765625,
0.0865478515625,
-0.362060546875,
-0.010223388671875,
-0.328125,
0.1881103515625,
-0.8671875,
-1.0361328125,
-0.185546875,
-0.06536865234375,
-0.54248046875,
0.348388671875,
-0.1220703125,
0.0419921875,
0.04132080078125,
0.4560546875,
-0.293701171875,
-0.01947021484375,
-0.0843505859375,
0.2357177734375,
-0.282958984375,
-0.8154296875,
0.658203125,
-0.43798828125,
0.0439453125,
-0.7119140625,
-1.076171875,
0.2330322265625,
0.20703125,
-0.498046875,
-0.49072265625,
-0.09112548828125,
-0.291748046875,
-0.0770263671875,
0.382080078125,
-0.41796875,
-0.354248046875,
-0.4501953125,
-0.533203125,
0.1680908203125,
-0.02801513671875,
-0.56640625,
0.38427734375,
0.172607421875,
0.76318359375,
0.2259521484375,
0.03692626953125,
-0.69384765625,
-0.1639404296875,
-0.316650390625,
-0.142578125,
0.113037109375,
-0.305419921875,
-0.25830078125,
0.6484375,
-0.11724853515625,
-0.384033203125,
0.59375,
0.71484375,
-0.466064453125,
0.72265625,
-0.11676025390625,
-0.35595703125,
0.7529296875,
0.646484375,
-0.207763671875,
0.7841796875,
-0.615234375,
0.2337646484375,
0.65625,
0.2271728515625,
-0.57666015625,
-0.7099609375,
-0.3017578125,
-0.2115478515625,
0.68115234375,
-0.17626953125,
0.05859375,
1.279296875,
-0.1240234375,
0.362060546875,
-0.426025390625,
0.388916015625,
0.53759765625,
0.11895751953125,
0.248046875,
-0.49462890625,
-0.1346435546875,
-0.1312255859375,
-0.3916015625,
0.8505859375,
-0.415283203125,
-0.35400390625,
0.1710205078125,
-0.42822265625,
-0.2310791015625,
0.681640625,
-0.044647216796875,
1.1142578125,
-0.6435546875,
0.8427734375,
0.195068359375,
-0.9140625,
0.86474609375,
-0.06298828125,
0.2310791015625,
1.525390625,
0.458251953125,
0.449462890625,
0.75048828125,
0.05352783203125,
-0.6591796875,
0.08001708984375,
-0.76708984375,
0.479736328125,
0.0228271484375,
0.06561279296875,
-0.33740234375,
0.0146942138671875,
-0.66650390625,
0.32763671875,
0.42919921875,
0.134765625,
-0.166259765625,
-0.1195068359375,
0.33935546875,
0.97900390625,
-0.0036106109619140625,
0.9423828125,
-0.58740234375,
-0.09259033203125,
-0.11529541015625,
-0.369384765625,
0.75439453125,
-0.40185546875,
-0.72021484375,
0.91015625,
0.7451171875,
1.294921875,
0.96533203125,
-0.2464599609375,
0.2239990234375,
0.1640625,
-0.5927734375,
0.036773681640625,
0.42236328125,
0.7705078125,
0.71728515625,
0.1888427734375,
0.15869140625,
0.1881103515625,
-0.4453125,
-0.1783447265625,
0.072509765625,
0.7822265625,
-0.69482421875,
0.34716796875,
0.17431640625,
0.292236328125,
-1.1962890625,
-0.149169921875,
0.37109375,
-0.76123046875,
-0.322021484375,
0.619140625,
-0.1708984375,
0.161865234375,
-0.85400390625,
-0.3515625,
0.48095703125,
1.041015625,
-0.205078125,
0.370361328125,
0.305419921875,
-0.432373046875,
-0.6015625,
0.0394287109375,
0.05645751953125,
-0.1605224609375,
-0.250732421875,
0.31005859375,
-0.0278167724609375,
0.01143646240234375,
-0.004852294921875,
0.394287109375,
0.422119140625,
0.85009765625,
0.1390380859375,
-0.53857421875,
0.416748046875,
1.34375,
-0.045806884765625,
0.61328125,
0.292236328125,
0.765625,
0.1575927734375,
0.99169921875,
0.55859375,
0.08306884765625,
0.70849609375,
0.93310546875,
-0.1795654296875,
0.0234222412109375,
0.54052734375,
0.64453125,
0.2109375,
0.7509765625,
-0.120361328125,
0.52001953125,
0.159912109375,
-0.14794921875,
-0.1031494140625,
0.423828125,
-0.1256103515625,
0.91796875,
0.16845703125,
0.6337890625,
-0.10882568359375,
-0.283935546875,
0.2105712890625,
0.81689453125,
-0.56201171875,
-0.488525390625,
0.12841796875,
0.10302734375,
0.45166015625,
-0.11102294921875,
0.400146484375,
0.76953125,
0.38330078125,
0.322509765625,
-0.8740234375,
-0.7021484375,
-0.03350830078125,
-0.388427734375,
-0.8330078125,
-0.498779296875,
-0.5048828125,
0.2161865234375,
0.11114501953125,
-0.48291015625,
0.3896484375,
-0.12841796875,
-0.5263671875,
0.5048828125,
-0.8486328125,
0.6806640625,
-0.01157379150390625,
0.650390625,
-1.0361328125,
1.0732421875,
0.0214691162109375,
0.92822265625,
-0.56494140625,
-0.404296875,
0.5048828125,
-0.6796875,
0.359130859375,
0.2275390625,
0.1495361328125,
-0.03912353515625,
-0.61962890625,
-0.88427734375,
-0.68408203125,
0.06280517578125,
-0.0711669921875,
0.09735107421875,
-0.66162109375,
1.0205078125,
0.054107666015625,
-0.476318359375,
1.072265625,
1.1845703125,
-1.1630859375,
0.87353515625,
0.1903076171875,
0.0022125244140625,
-0.5625,
0.8818359375,
0.61474609375,
0.548828125,
-0.122314453125,
-0.2012939453125,
-0.57080078125,
-0.06146240234375,
0.27490234375,
-0.71142578125,
-0.85498046875,
0.420166015625,
0.525390625,
-0.802734375,
0.489990234375,
-0.92333984375,
-0.453125,
-0.2100830078125,
-0.381103515625,
0.98779296875,
0.52392578125,
-0.14013671875,
-0.2373046875,
0.27978515625,
-0.0921630859375,
0.6416015625,
0.2369384765625,
-0.249267578125,
0.244140625,
0.200927734375,
0.33251953125,
0.45556640625,
0.232177734375,
-0.64111328125,
-0.1925048828125,
-0.2099609375,
0.49072265625,
0.61474609375,
0.1409912109375,
0.64208984375,
0.113525390625,
0.595703125,
-0.54931640625,
-0.01274871826171875,
-0.164794921875,
0.1162109375,
0.8515625,
0.64404296875,
-0.297607421875,
-0.3154296875,
-0.1649169921875,
-0.6728515625,
-0.454345703125,
0.20263671875,
0.76123046875,
-0.406005859375,
0.8408203125,
-0.1331787109375,
-0.82958984375,
0.33740234375,
-0.319580078125,
-0.0474853515625,
1.0927734375,
-0.07379150390625,
0.35205078125,
-0.67236328125,
0.2130126953125,
0.319580078125,
0.0197296142578125,
0.75537109375,
0.1358642578125,
0.1688232421875,
-0.73095703125,
-0.818359375,
-0.61572265625,
0.02435302734375,
-0.39404296875,
-0.6650390625,
0.2327880859375,
-0.62646484375,
-0.047332763671875,
-1.3486328125,
0.6044921875,
0.716796875,
0.442138671875,
0.044891357421875,
0.41748046875,
0.051544189453125,
0.463134765625,
0.49560546875,
-0.14990234375,
0.008453369140625,
-0.7021484375,
0.591796875,
-0.491943359375,
-0.106689453125,
-0.419677734375,
-0.239990234375,
0.175537109375,
0.1312255859375,
-0.347900390625,
0.266845703125,
-0.70068359375,
0.2213134765625,
0.400146484375,
0.47705078125,
-0.7119140625,
-0.0002048015594482422,
-0.107177734375,
0.484375,
0.43798828125,
-1.12109375,
0.2496337890625,
-0.63525390625,
0.2783203125,
0.4873046875,
-0.188232421875,
-0.44921875,
-0.71337890625,
-0.62158203125,
-0.65966796875,
0.12017822265625,
0.40478515625,
-0.08819580078125,
0.10595703125,
-1.228515625,
0.21728515625,
0.2064208984375,
-0.480224609375,
0.244873046875,
0.08233642578125,
0.0648193359375,
0.207763671875,
0.68896484375,
-0.11077880859375,
-0.77783203125,
0.703125,
-0.77783203125,
1.068359375,
-0.49609375,
0.5126953125,
-0.05987548828125,
0.30517578125,
-0.31884765625,
0.130126953125,
-0.441162109375,
-0.1165771484375,
-0.136962890625,
0.4521484375,
-0.931640625,
-0.8125,
0.62158203125,
-0.8486328125,
-0.10894775390625,
0.986328125,
0.387451171875,
-0.60205078125,
0.264892578125,
0.481201171875,
-0.437255859375,
0.39794921875,
-0.8828125,
0.356201171875,
-0.09771728515625,
-0.2171630859375,
-0.2412109375,
-0.487060546875,
0.37109375,
-0.2342529296875,
-1.2392578125,
-0.20703125,
-1.3046875,
-0.409423828125,
-0.2064208984375,
-0.1689453125,
0.501953125,
-0.10308837890625,
0.034942626953125,
0.1092529296875,
-0.275146484375,
-1.0390625,
-0.211669921875,
-0.9111328125,
-0.0438232421875,
-0.115478515625,
0.56591796875,
0.76806640625,
-0.024261474609375,
-0.467041015625,
-0.0482177734375,
-0.62646484375,
-0.316162109375,
-0.5859375,
-0.3046875,
0.062469482421875,
-0.060394287109375,
-0.499755859375,
-0.107666015625,
-0.05615234375,
0.53369140625,
0.70654296875,
-0.1641845703125,
0.4296875,
0.31689453125,
-0.143798828125,
0.9453125,
0.09246826171875,
-0.986328125,
-0.6171875,
0.476318359375,
-0.50390625,
1.06640625,
0.0672607421875,
-0.493408203125,
-0.453125,
-0.97705078125,
0.386962890625,
-0.273681640625,
-0.061004638671875,
-0.98095703125,
-0.84912109375,
-0.13232421875,
0.72900390625,
0.1337890625,
-1.0615234375,
-0.459716796875,
-0.736328125,
0.2088623046875,
-0.38671875,
-0.2353515625,
-0.8037109375,
-0.96484375,
-0.2218017578125,
1.0458984375,
0.1815185546875,
0.30322265625,
-0.2196044921875,
-0.357421875,
0.818359375,
0.31640625,
-0.56201171875,
-0.27734375,
-0.0565185546875,
0.333251953125,
-0.0092010498046875,
0.227783203125,
-0.5087890625,
1.265625,
-0.9111328125,
0.5830078125,
0.064453125,
-0.380126953125,
-0.0716552734375,
0.10308837890625,
0.556640625,
-0.272216796875,
-0.11749267578125,
-0.411376953125,
0.7255859375,
0.43408203125,
-0.40234375,
-0.76318359375,
-0.31005859375,
-0.619140625,
-1.0380859375,
0.58740234375,
-0.39697265625,
0.359130859375,
-0.3388671875,
0.030853271484375,
0.998046875,
-0.53369140625,
0.552734375,
1.7822265625,
0.2216796875,
0.09893798828125,
-0.86669921875,
0.859375,
0.58837890625,
-0.470947265625,
-0.0277557373046875,
0.76611328125,
-0.71923828125,
0.41748046875,
-0.280517578125,
-0.94677734375,
-0.505859375,
0.1439208984375,
0.96630859375,
0.3515625,
0.8134765625,
-0.2244873046875,
-0.8935546875,
-0.88671875,
1.041015625,
-0.1552734375,
0.09588623046875,
0.91845703125,
0.25927734375,
-0.059112548828125,
0.313232421875,
0.07818603515625,
-0.29638671875,
-0.65966796875,
1.4716796875,
-0.3583984375,
-0.340576171875,
0.60009765625,
0.646484375,
-0.818359375,
-1.1845703125,
0.018341064453125,
-0.1004638671875,
-0.287841796875,
-0.32568359375,
-0.1920166015625,
0.71533203125,
-0.64306640625,
0.269775390625,
0.4765625,
0.11517333984375,
-0.0242462158203125,
0.410400390625,
-0.18017578125,
-0.18896484375,
0.6103515625,
0.56201171875,
-0.1998291015625,
-0.10577392578125,
-0.447998046875,
-0.01203155517578125,
-0.1619873046875,
-0.462646484375,
1.212890625,
-0.066650390625,
0.66796875,
0.626953125,
-0.2430419921875,
0.71923828125,
-0.59375,
-0.56884765625,
-0.1785888671875,
-0.92236328125,
-0.9296875,
0.4130859375,
-0.0853271484375,
-0.1834716796875,
0.2183837890625,
-0.3916015625,
0.091796875,
0.82568359375,
0.44970703125,
-0.354248046875,
-1.2177734375,
-0.10552978515625,
-1.7177734375,
-0.6162109375,
-0.41943359375,
-0.61376953125,
-0.3935546875,
0.265380859375,
0.1519775390625,
-0.68896484375,
-0.214599609375,
-0.0640869140625,
-0.1826171875,
0.552734375,
-0.395263671875,
0.381591796875,
-0.2327880859375,
-0.60498046875,
-0.728515625,
-0.298583984375,
-0.37939453125,
-0.501953125,
-0.666015625,
0.26025390625,
0.4208984375,
0.371826171875,
-0.146484375,
0.008636474609375,
-0.042266845703125,
-1.0654296875,
0.2049560546875,
0.256103515625,
-0.381591796875,
1.1015625,
0.51806640625,
0.3173828125,
0.587890625,
-0.0693359375,
-0.490966796875,
-0.1461181640625,
0.7763671875,
0.292724609375,
-0.28515625,
-0.9853515625,
-0.1883544921875,
-0.1431884765625,
-1.0234375,
-0.0823974609375,
-0.28857421875,
0.2298583984375,
0.49560546875,
-0.1612548828125,
0.5703125,
0.81396484375,
0.294677734375,
0.41259765625,
0.0682373046875,
0.2113037109375,
0.52587890625,
0.0804443359375,
0.05572509765625,
0.1795654296875,
-0.1671142578125,
0.08251953125,
0.275634765625,
0.5615234375,
-0.32421875,
0.1810302734375,
-0.03631591796875,
-0.73876953125,
-0.58203125,
-0.1990966796875,
-0.132568359375,
0.501953125,
0.435302734375,
-0.3212890625,
0.0222320556640625,
-0.278564453125,
-0.431884765625,
0.0384521484375,
-1.06640625,
-0.6767578125,
1.076171875,
-0.38720703125,
-0.93310546875,
-0.368408203125,
-0.5400390625,
-0.2171630859375,
-0.5546875,
0.466064453125,
-0.2403564453125,
0.39013671875,
0.08721923828125,
0.2373046875,
-0.42333984375,
0.07928466796875,
0.2225341796875,
0.34619140625,
-0.607421875,
-0.5771484375,
0.2081298828125,
0.6669921875,
0.062286376953125,
-0.1978759765625,
-0.260009765625,
0.078369140625,
0.045867919921875,
0.1973876953125,
-0.54638671875,
0.01306915283203125,
-0.60791015625,
0.5966796875,
-0.96044921875,
-0.031463623046875,
-0.7021484375,
0.5810546875,
0.11859130859375,
-0.69921875,
-0.53662109375,
1.1337890625,
0.59814453125,
-0.3359375,
0.66943359375,
0.66015625,
0.5302734375,
-0.053436279296875,
-0.258056640625,
0.020294189453125,
0.62158203125,
0.94580078125,
0.58740234375,
0.09210205078125,
0.287109375,
0.252197265625,
0.445068359375,
-0.4482421875,
0.30224609375,
-0.217529296875,
-0.25927734375,
-0.3037109375,
0.1981201171875,
-0.2861328125,
-0.032196044921875,
-0.490234375,
0.35498046875,
-0.60595703125,
0.117431640625,
-0.378173828125,
-0.748046875,
0.6298828125,
-0.05474853515625,
-0.77490234375,
0.045745849609375,
-0.1890869140625,
0.751953125,
0.73974609375,
-0.40576171875,
0.291015625,
0.87646484375,
0.447021484375,
-0.0311126708984375,
-0.045806884765625,
0.50732421875,
0.5615234375,
-0.66748046875,
0.099365234375,
0.1922607421875,
0.437255859375,
-0.257080078125,
-0.576171875,
-1.01953125,
0.383544921875,
-0.2330322265625,
-0.1893310546875,
0.20458984375,
-0.458984375,
-0.08868408203125,
-0.51025390625,
0.771484375,
-0.8642578125,
0.1273193359375,
0.4765625,
-0.32373046875,
-0.83837890625,
1.015625,
0.080322265625,
0.34130859375,
0.31103515625,
0.99072265625,
0.07196044921875,
1.3193359375,
0.517578125,
-0.044464111328125,
-0.273193359375,
0.324951171875,
-0.277587890625,
-0.677734375,
0.06732177734375,
-0.2027587890625,
0.26953125,
-0.02459716796875,
-0.1180419921875,
0.337890625,
0.890625,
-0.122802734375,
-0.74951171875,
0.1116943359375,
0.270751953125,
-0.269287109375,
0.43212890625,
0.23193359375,
0.3232421875,
0.176025390625,
0.005401611328125,
-0.3359375,
-0.6005859375,
-0.0635986328125,
-0.8623046875,
0.5185546875,
0.12371826171875,
-0.168701171875,
-0.67578125,
-0.36767578125,
-0.09759521484375,
0.513671875,
-0.548828125,
-0.8408203125,
0.78271484375,
0.728515625,
-0.03948974609375,
0.41552734375,
-0.224853515625,
-0.188720703125,
0.9130859375,
1.380859375,
-0.541015625,
0.74755859375,
0.40771484375,
-0.1444091796875,
0.20068359375,
-0.61328125,
0.32177734375,
-0.2022705078125,
-0.314453125,
-0.1617431640625,
0.302734375,
-0.35546875,
-0.9267578125,
-0.046630859375,
1.0166015625,
0.403564453125,
-0.3447265625,
-1.2119140625,
-0.452880859375,
-1.1640625,
-0.02069091796875,
-0.82080078125,
0.47998046875,
-0.0887451171875,
-0.2122802734375,
-0.1763916015625,
-1.0830078125,
4.3359375,
0.67578125,
1.015625,
0.60888671875,
0.42578125,
0.51904296875,
0.22900390625,
-0.7138671875,
0.56396484375,
-0.85009765625,
0.40185546875,
-0.09539794921875,
-0.266845703125,
0.80322265625,
0.70654296875,
0.5302734375,
-0.9384765625,
-0.03155517578125,
-0.386474609375,
-0.58447265625,
-0.89013671875,
0.10784912109375,
-0.0277252197265625,
0.8193359375,
-0.274658203125,
0.494140625,
0.36669921875,
-0.9248046875,
-0.333984375,
-0.53076171875,
-0.25,
-0.2481689453125,
0.68115234375,
0.0093231201171875,
-0.6162109375,
0.53125,
-0.37353515625,
-0.2310791015625,
-0.125,
-0.0133819580078125,
-0.40283203125,
-0.1982421875,
0.58544921875,
-0.5654296875,
-0.258544921875,
0.8837890625,
-0.58935546875,
0.203857421875,
0.578125,
-1.2490234375,
0.81689453125,
-0.296142578125,
0.428466796875,
-0.59423828125,
-0.7958984375,
-0.010345458984375,
0.11297607421875,
-0.3701171875,
-0.4306640625,
0.5478515625,
-0.0426025390625,
0.708984375,
0.09722900390625,
0.5810546875,
-0.486328125,
0.53662109375,
-0.48779296875,
0.744140625,
-0.6240234375,
-0.52392578125,
-0.210205078125,
-0.245849609375,
0.1744384765625,
-0.5673828125,
0.61669921875,
0.01708984375,
-0.375732421875,
0.26171875,
0.350830078125,
-0.62109375,
-0.068603515625,
-0.2509765625,
-0.52001953125,
-0.8955078125,
0.66064453125,
0.802734375,
-0.400634765625,
-0.45458984375,
-0.10888671875,
0.55908203125,
0.51904296875,
0.43115234375,
0.01360321044921875,
-0.5068359375,
-0.70361328125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Most C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.
In this problem we consider the following model of #define constructions (also called macros). Each macro has its name and value. The generic syntax for declaring a macro is the following:
#define macro_name macro_value
After the macro has been declared, "macro_name" is replaced with "macro_value" each time it is met in the program (only the whole tokens can be replaced; i.e. "macro_name" is replaced only when it is surrounded by spaces or other non-alphabetic symbol). A "macro_value" within our model can only be an arithmetic expression consisting of variables, four arithmetic operations, brackets, and also the names of previously declared macros (in this case replacement is performed sequentially). The process of replacing macros with their values is called substitution.
One of the main problems arising while using macros β the situation when as a result of substitution we get an arithmetic expression with the changed order of calculation because of different priorities of the operations.
Let's consider the following example. Say, we declared such a #define construction:
#define sum x + y
and further in the program the expression "2 * sum" is calculated. After macro substitution is performed we get "2 * x + y", instead of intuitively expected "2 * (x + y)".
Let's call the situation "suspicious", if after the macro substitution the order of calculation changes, falling outside the bounds of some macro. Thus, your task is to find out by the given set of #define definitions and the given expression if this expression is suspicious or not.
Let's speak more formally. We should perform an ordinary macros substitution in the given expression. Moreover, we should perform a "safe" macros substitution in the expression, putting in brackets each macro value; after this, guided by arithmetic rules of brackets expansion, we can omit some of the brackets. If there exist a way to get an expression, absolutely coinciding with the expression that is the result of an ordinary substitution (character-by-character, but ignoring spaces), then this expression and the macros system are called correct, otherwise β suspicious.
Note that we consider the "/" operation as the usual mathematical division, not the integer division like in C/C++. That's why, for example, in the expression "a*(b/c)" we can omit brackets to get the expression "a*b/c".
Input
The first line contains the only number n (0 β€ n β€ 100) β the amount of #define constructions in the given program.
Then there follow n lines, each of them contains just one #define construction. Each construction has the following syntax:
#define name expression
where
* name β the macro name,
* expression β the expression with which the given macro will be replaced. An expression is a non-empty string, containing digits,names of variables, names of previously declared macros, round brackets and operational signs +-*/. It is guaranteed that the expression (before and after macros substitution) is a correct arithmetic expression, having no unary operations. The expression contains only non-negative integers, not exceeding 109.
All the names (#define constructions' names and names of their arguments) are strings of case-sensitive Latin characters. It is guaranteed that the name of any variable is different from any #define construction.
Then, the last line contains an expression that you are to check. This expression is non-empty and satisfies the same limitations as the expressions in #define constructions.
The input lines may contain any number of spaces anywhere, providing these spaces do not break the word "define" or the names of constructions and variables. In particular, there can be any number of spaces before and after the "#" symbol.
The length of any line from the input file does not exceed 100 characters.
Output
Output "OK", if the expression is correct according to the above given criterion, otherwise output "Suspicious".
Examples
Input
1
#define sum x + y
1 * sum
Output
Suspicious
Input
1
#define sum (x + y)
sum - sum
Output
OK
Input
4
#define sum x + y
#define mul a * b
#define div a / b
#define expr sum + mul * div * mul
expr
Output
OK
Input
3
#define SumSafe (a+b)
#define DivUnsafe a/b
#define DenominatorUnsafe a*b
((SumSafe) + DivUnsafe/DivUnsafe + x/DenominatorUnsafe)
Output
Suspicious
Submitted Solution:
```
# 1:correct, 2:incorrect, 3:(a+b), no - at front, no * or / neighbor, 4:(a*b),(a/b) no / at front
def helper(s, d):
if s[0] == '(' and s[-1] == ')':
if helper(s[1:-1], d) == 2:
return 2
else:
return 1
if s in d:
return d[s]
cnt = 0
for idx, c in reversed(list(enumerate(s))):
if c == ')':
cnt += 1
elif c == '(':
cnt -= 1
if cnt == 0 and c in ['+', '-']:
s1 = s[0:idx]
s2 = s[idx+1:]
t1 = helper(s1, d)
t2 = helper(s2, d)
t = 3
if t1 == 2 or t2 == 2:
t = 2
elif t2 == 3 and c == '-':
t = 2
d[s] = t
return t
cnt = 0
for idx, c in reversed(list(enumerate(s))):
if c == ')':
cnt += 1
elif c == '(':
cnt -= 1
if cnt == 0 and c in ['*', '/']:
s1 = s[0:idx]
s2 = s[idx+1:]
t1 = helper(s1, d)
t2 = helper(s2, d)
t = 4
if t1 == 2 or t2 == 2:
t = 2
elif t1 == 3 or t2 == 3:
t = 2
elif t2 == 4 and c == '/':
t = 2
d[s] = t
return t
d[s] = 1
return 1
n = int(input())
d = {}
for i in range(0, n):
temp = input()[8:].split(' ', 1)
name, exp = temp[0], ''.join(temp[1].split())
t = helper(exp, d)
d[name] = t
final = ''.join(input().split())
res = helper(final, d)
if res == 2:
print('Suspicious')
else:
print('OK')
# print(arr)
# print(helper('aa + b - c * (ddd * eee / fff * a / b * c + d - b + c - (a + b)) - d', d))
```
No
| 38,228
|
[
0.203125,
-0.3955078125,
0.46826171875,
0.19775390625,
-0.62744140625,
-0.3330078125,
0.1683349609375,
0.51220703125,
-0.1318359375,
0.6171875,
0.771484375,
0.087158203125,
0.0169525146484375,
-0.744140625,
-0.7626953125,
0.0885009765625,
-0.3837890625,
-0.9990234375,
-0.65625,
0.39599609375,
0.250732421875,
-0.1097412109375,
-1.28515625,
-0.2861328125,
-0.6328125,
0.865234375,
0.07916259765625,
-0.23486328125,
0.603515625,
1.3681640625,
-0.5029296875,
-0.2548828125,
0.22314453125,
-0.44677734375,
-0.6572265625,
-0.63037109375,
0.28466796875,
-1.1767578125,
-0.0399169921875,
-0.49755859375,
-0.1339111328125,
-0.25439453125,
0.1761474609375,
-0.89794921875,
-1.0859375,
-0.252685546875,
0.10760498046875,
-0.448974609375,
0.2340087890625,
-0.11083984375,
0.0355224609375,
0.0672607421875,
0.3701171875,
-0.347412109375,
0.075439453125,
0.076171875,
0.2479248046875,
-0.300048828125,
-0.90966796875,
0.53173828125,
-0.385986328125,
0.1761474609375,
-0.67919921875,
-1.169921875,
0.256591796875,
0.274169921875,
-0.40478515625,
-0.436279296875,
-0.06793212890625,
-0.1353759765625,
-0.077392578125,
0.258544921875,
-0.53271484375,
-0.29736328125,
-0.52099609375,
-0.497314453125,
0.240478515625,
0.045166015625,
-0.658203125,
0.460205078125,
0.1260986328125,
0.9482421875,
0.33203125,
-0.03228759765625,
-0.72314453125,
-0.1441650390625,
-0.232177734375,
-0.155029296875,
0.1575927734375,
-0.302001953125,
-0.2421875,
0.4931640625,
-0.14794921875,
-0.367919921875,
0.7060546875,
0.64990234375,
-0.397705078125,
0.69677734375,
-0.1644287109375,
-0.30078125,
0.80712890625,
0.58447265625,
-0.2156982421875,
0.90380859375,
-0.6171875,
0.1414794921875,
0.6552734375,
0.131103515625,
-0.4521484375,
-0.67822265625,
-0.25732421875,
-0.1944580078125,
0.525390625,
-0.07769775390625,
-0.047760009765625,
1.1650390625,
-0.1041259765625,
0.414306640625,
-0.346923828125,
0.21875,
0.61181640625,
0.024749755859375,
0.278564453125,
-0.39599609375,
-0.049407958984375,
-0.163330078125,
-0.384521484375,
0.845703125,
-0.408447265625,
-0.33349609375,
0.213134765625,
-0.405517578125,
-0.277587890625,
0.62109375,
-0.12261962890625,
1.013671875,
-0.6201171875,
0.76171875,
0.324462890625,
-0.8515625,
0.84326171875,
-0.05340576171875,
0.264892578125,
1.603515625,
0.365966796875,
0.255126953125,
0.591796875,
0.050384521484375,
-0.587890625,
0.1806640625,
-0.8193359375,
0.5068359375,
-0.135009765625,
-0.04327392578125,
-0.381103515625,
-0.0119476318359375,
-0.60009765625,
0.281982421875,
0.50439453125,
0.059906005859375,
-0.2122802734375,
-0.0276336669921875,
0.1190185546875,
0.9677734375,
-0.0875244140625,
0.7353515625,
-0.4814453125,
-0.048797607421875,
-0.062255859375,
-0.27734375,
0.640625,
-0.3896484375,
-0.59912109375,
1.0283203125,
0.74658203125,
1.3564453125,
1.0146484375,
-0.1065673828125,
0.118408203125,
0.2384033203125,
-0.60205078125,
0.05792236328125,
0.405517578125,
0.80859375,
0.658203125,
0.202392578125,
0.08734130859375,
0.237548828125,
-0.267578125,
-0.2109375,
0.1256103515625,
0.88330078125,
-0.76513671875,
0.470458984375,
0.09112548828125,
0.2509765625,
-1.103515625,
-0.11749267578125,
0.466064453125,
-0.814453125,
-0.397705078125,
0.64013671875,
-0.1129150390625,
0.248046875,
-0.76318359375,
-0.432861328125,
0.320068359375,
1.115234375,
-0.0941162109375,
0.384521484375,
0.2232666015625,
-0.348876953125,
-0.60546875,
-0.11260986328125,
0.061920166015625,
-0.22265625,
-0.2103271484375,
0.2196044921875,
0.03192138671875,
0.043609619140625,
-0.02740478515625,
0.467041015625,
0.35986328125,
0.80322265625,
-0.04559326171875,
-0.5400390625,
0.337646484375,
1.4013671875,
-0.04351806640625,
0.55712890625,
0.329345703125,
0.7880859375,
0.1558837890625,
1.060546875,
0.572265625,
0.09710693359375,
0.802734375,
0.87109375,
-0.301025390625,
0.07696533203125,
0.49853515625,
0.65771484375,
0.1744384765625,
0.8837890625,
0.0033168792724609375,
0.498779296875,
0.190185546875,
-0.184326171875,
-0.1424560546875,
0.498779296875,
-0.1959228515625,
0.888671875,
0.1204833984375,
0.716796875,
-0.136474609375,
-0.265625,
0.25439453125,
0.75927734375,
-0.74658203125,
-0.61474609375,
0.2330322265625,
0.08709716796875,
0.435791015625,
-0.033782958984375,
0.34033203125,
0.66015625,
0.351318359375,
0.369384765625,
-0.83984375,
-0.630859375,
-0.07098388671875,
-0.449462890625,
-1.0361328125,
-0.46435546875,
-0.58740234375,
0.1451416015625,
0.0166778564453125,
-0.4609375,
0.312255859375,
-0.2086181640625,
-0.462646484375,
0.470947265625,
-0.748046875,
0.72900390625,
0.00946044921875,
0.6640625,
-0.947265625,
0.93359375,
0.11041259765625,
0.93701171875,
-0.59228515625,
-0.303955078125,
0.394775390625,
-0.70263671875,
0.4306640625,
0.1158447265625,
0.20458984375,
0.01169586181640625,
-0.5654296875,
-0.91650390625,
-0.71435546875,
0.1346435546875,
0.0129852294921875,
0.0031185150146484375,
-0.66162109375,
0.98779296875,
0.036712646484375,
-0.54736328125,
0.970703125,
1.181640625,
-1.1826171875,
0.82470703125,
0.11981201171875,
0.1868896484375,
-0.58544921875,
0.91162109375,
0.6416015625,
0.6005859375,
-0.202392578125,
-0.2310791015625,
-0.62939453125,
-0.058258056640625,
0.361572265625,
-0.83154296875,
-0.9482421875,
0.46484375,
0.56103515625,
-0.8369140625,
0.5673828125,
-0.98681640625,
-0.476318359375,
-0.24267578125,
-0.59375,
1.0390625,
0.564453125,
0.00832366943359375,
-0.1759033203125,
0.151123046875,
-0.158203125,
0.6357421875,
0.28173828125,
-0.3447265625,
0.2333984375,
0.24365234375,
0.34228515625,
0.55322265625,
0.208984375,
-0.72314453125,
-0.21435546875,
-0.264404296875,
0.414306640625,
0.6982421875,
0.12548828125,
0.716796875,
0.0848388671875,
0.70458984375,
-0.666015625,
0.02789306640625,
-0.18212890625,
0.163818359375,
0.83935546875,
0.646484375,
-0.1318359375,
-0.181640625,
-0.281005859375,
-0.62890625,
-0.501953125,
0.1083984375,
0.828125,
-0.28125,
0.83984375,
-0.233154296875,
-0.79638671875,
0.513671875,
-0.413818359375,
0.0012826919555664062,
1.119140625,
0.0199737548828125,
0.331787109375,
-0.71826171875,
0.1795654296875,
0.176025390625,
-0.054931640625,
0.65625,
0.057464599609375,
0.30029296875,
-0.6923828125,
-0.8017578125,
-0.52880859375,
0.1829833984375,
-0.50390625,
-0.67529296875,
0.224853515625,
-0.5400390625,
-0.1563720703125,
-1.4306640625,
0.740234375,
0.625,
0.5986328125,
0.0888671875,
0.442626953125,
0.07135009765625,
0.489013671875,
0.5673828125,
-0.00921630859375,
0.0271148681640625,
-0.705078125,
0.65283203125,
-0.362548828125,
-0.1187744140625,
-0.335693359375,
-0.1812744140625,
0.219970703125,
0.18994140625,
-0.355712890625,
0.191650390625,
-0.7802734375,
0.293701171875,
0.326904296875,
0.45068359375,
-0.873046875,
0.039947509765625,
-0.09423828125,
0.40283203125,
0.452880859375,
-1.08984375,
0.310546875,
-0.6181640625,
0.1766357421875,
0.5703125,
-0.31884765625,
-0.43359375,
-0.56787109375,
-0.763671875,
-0.85986328125,
0.07757568359375,
0.479248046875,
-0.1859130859375,
0.12371826171875,
-1.3740234375,
0.1947021484375,
0.2978515625,
-0.52099609375,
0.271240234375,
-0.03741455078125,
0.0694580078125,
0.2255859375,
0.6513671875,
-0.119873046875,
-0.6865234375,
0.5537109375,
-0.765625,
0.998046875,
-0.43505859375,
0.59228515625,
-0.0872802734375,
0.31494140625,
-0.3349609375,
0.1431884765625,
-0.34326171875,
-0.0684814453125,
-0.1456298828125,
0.61572265625,
-1.091796875,
-0.81005859375,
0.488037109375,
-0.76806640625,
-0.1463623046875,
0.99267578125,
0.312255859375,
-0.61083984375,
0.359375,
0.4775390625,
-0.4658203125,
0.46142578125,
-0.82861328125,
0.25634765625,
0.145263671875,
-0.25390625,
-0.216796875,
-0.473876953125,
0.509765625,
-0.271728515625,
-1.162109375,
-0.290283203125,
-1.28515625,
-0.398193359375,
-0.18310546875,
-0.30517578125,
0.56005859375,
-0.0198516845703125,
0.07220458984375,
0.080810546875,
-0.259765625,
-0.98779296875,
-0.235595703125,
-0.79345703125,
-0.1478271484375,
-0.08935546875,
0.5849609375,
0.7294921875,
0.08148193359375,
-0.484130859375,
-0.135009765625,
-0.69677734375,
-0.356689453125,
-0.57763671875,
-0.35595703125,
0.214599609375,
-0.1419677734375,
-0.5771484375,
0.01415252685546875,
-0.14794921875,
0.55712890625,
0.6337890625,
-0.1533203125,
0.4462890625,
0.38134765625,
-0.221435546875,
1.126953125,
-0.0015821456909179688,
-1.1630859375,
-0.560546875,
0.4853515625,
-0.3623046875,
1.130859375,
-0.0228271484375,
-0.427001953125,
-0.43505859375,
-1.087890625,
0.424560546875,
-0.42724609375,
-0.19091796875,
-1.0048828125,
-0.822265625,
-0.07568359375,
0.7177734375,
0.061737060546875,
-1.076171875,
-0.33984375,
-0.900390625,
0.237548828125,
-0.5068359375,
-0.272705078125,
-0.77490234375,
-0.859375,
-0.313720703125,
1.080078125,
0.2347412109375,
0.2900390625,
-0.27685546875,
-0.241943359375,
0.65478515625,
0.2388916015625,
-0.5244140625,
-0.3115234375,
-0.1278076171875,
0.25537109375,
-0.09515380859375,
0.2496337890625,
-0.58056640625,
1.2548828125,
-0.87744140625,
0.57470703125,
0.1265869140625,
-0.2998046875,
-0.033935546875,
-0.00824737548828125,
0.68017578125,
-0.270751953125,
-0.042083740234375,
-0.4619140625,
0.70556640625,
0.56787109375,
-0.40771484375,
-0.71044921875,
-0.1895751953125,
-0.56494140625,
-1.0849609375,
0.57763671875,
-0.410400390625,
0.39111328125,
-0.362060546875,
0.039154052734375,
1.0341796875,
-0.61669921875,
0.48681640625,
1.744140625,
0.29736328125,
0.08050537109375,
-0.92578125,
0.80517578125,
0.70947265625,
-0.509765625,
-0.09356689453125,
0.65234375,
-0.65234375,
0.432861328125,
-0.315185546875,
-0.93408203125,
-0.56494140625,
0.185791015625,
0.93408203125,
0.2261962890625,
0.9501953125,
-0.17626953125,
-0.9775390625,
-0.77392578125,
1.001953125,
-0.266845703125,
0.10247802734375,
0.962890625,
0.288330078125,
-0.1444091796875,
0.292724609375,
-0.0088348388671875,
-0.30078125,
-0.495361328125,
1.4462890625,
-0.4013671875,
-0.386962890625,
0.59765625,
0.6904296875,
-0.8623046875,
-1.2880859375,
-0.0162353515625,
-0.0275115966796875,
-0.08648681640625,
-0.386474609375,
-0.2257080078125,
0.58203125,
-0.55712890625,
0.343017578125,
0.4404296875,
0.0665283203125,
0.00457000732421875,
0.366455078125,
-0.0767822265625,
-0.311279296875,
0.578125,
0.71435546875,
-0.2205810546875,
-0.19189453125,
-0.5546875,
0.0157318115234375,
-0.09228515625,
-0.3681640625,
1.212890625,
-0.006732940673828125,
0.6982421875,
0.7353515625,
-0.3076171875,
0.7568359375,
-0.7421875,
-0.408203125,
-0.1754150390625,
-1.0009765625,
-0.849609375,
0.3203125,
-0.031463623046875,
-0.09771728515625,
0.34423828125,
-0.385009765625,
0.03350830078125,
0.83984375,
0.427001953125,
-0.2279052734375,
-1.0966796875,
-0.142822265625,
-1.6357421875,
-0.5888671875,
-0.322998046875,
-0.568359375,
-0.355224609375,
0.277587890625,
0.1812744140625,
-0.62060546875,
-0.1785888671875,
0.02734375,
-0.226806640625,
0.51611328125,
-0.44677734375,
0.2376708984375,
-0.25390625,
-0.6005859375,
-0.748046875,
-0.364990234375,
-0.457275390625,
-0.513671875,
-0.45556640625,
0.25390625,
0.36474609375,
0.365234375,
-0.1929931640625,
0.0509033203125,
0.048187255859375,
-0.96533203125,
0.302490234375,
0.36376953125,
-0.51416015625,
1.1181640625,
0.444580078125,
0.4208984375,
0.420166015625,
-0.10369873046875,
-0.347412109375,
-0.034271240234375,
0.9072265625,
0.2073974609375,
-0.188720703125,
-0.89404296875,
-0.04290771484375,
-0.25146484375,
-0.96484375,
-0.0712890625,
-0.2288818359375,
0.249755859375,
0.52197265625,
-0.1937255859375,
0.556640625,
0.7724609375,
0.1435546875,
0.45458984375,
0.0880126953125,
0.198974609375,
0.52197265625,
0.06500244140625,
0.08709716796875,
0.190185546875,
-0.1942138671875,
0.0187835693359375,
0.326904296875,
0.6171875,
-0.211669921875,
0.2255859375,
-0.07708740234375,
-0.67919921875,
-0.6923828125,
-0.16650390625,
-0.225830078125,
0.48876953125,
0.493408203125,
-0.322265625,
0.09197998046875,
-0.23583984375,
-0.499755859375,
0.04571533203125,
-1.1435546875,
-0.6962890625,
1.1455078125,
-0.42041015625,
-0.98291015625,
-0.2919921875,
-0.57275390625,
-0.11175537109375,
-0.56201171875,
0.3505859375,
-0.27001953125,
0.294921875,
0.1376953125,
0.243408203125,
-0.474365234375,
-0.0225677490234375,
0.14697265625,
0.2369384765625,
-0.66064453125,
-0.54345703125,
0.1702880859375,
0.705078125,
0.0008554458618164062,
-0.25390625,
-0.294921875,
0.137451171875,
-0.00847625732421875,
0.049041748046875,
-0.46923828125,
0.080078125,
-0.53564453125,
0.6474609375,
-0.9130859375,
-0.05755615234375,
-0.634765625,
0.56201171875,
-0.046722412109375,
-0.71630859375,
-0.6025390625,
0.96630859375,
0.634765625,
-0.325927734375,
0.66796875,
0.63671875,
0.63671875,
-0.0672607421875,
-0.239990234375,
0.08367919921875,
0.66162109375,
0.912109375,
0.6015625,
0.1279296875,
0.40869140625,
0.26806640625,
0.390380859375,
-0.329833984375,
0.35595703125,
-0.162109375,
-0.355712890625,
-0.3251953125,
0.11859130859375,
-0.246826171875,
-0.0102386474609375,
-0.482666015625,
0.351318359375,
-0.638671875,
0.1942138671875,
-0.34521484375,
-0.71337890625,
0.61328125,
-0.01079559326171875,
-0.62548828125,
0.0694580078125,
-0.2293701171875,
0.8251953125,
0.701171875,
-0.348876953125,
0.321533203125,
0.88623046875,
0.61962890625,
-0.007167816162109375,
0.048370361328125,
0.426025390625,
0.443603515625,
-0.76318359375,
0.00986480712890625,
0.32080078125,
0.43017578125,
-0.263427734375,
-0.51318359375,
-1.0302734375,
0.41650390625,
-0.2313232421875,
-0.045257568359375,
0.14501953125,
-0.49755859375,
-0.0288543701171875,
-0.56298828125,
0.83349609375,
-0.93603515625,
0.041839599609375,
0.51708984375,
-0.31201171875,
-0.83642578125,
0.9521484375,
0.271728515625,
0.304443359375,
0.355712890625,
0.9951171875,
0.11456298828125,
1.2724609375,
0.68212890625,
-0.01187896728515625,
-0.28564453125,
0.3818359375,
-0.18701171875,
-0.64892578125,
-0.01593017578125,
-0.2376708984375,
0.2266845703125,
-0.046112060546875,
-0.1995849609375,
0.2626953125,
0.85986328125,
-0.018280029296875,
-0.7216796875,
-0.051055908203125,
0.322265625,
-0.276611328125,
0.51904296875,
0.0760498046875,
0.42822265625,
0.193603515625,
0.0751953125,
-0.29248046875,
-0.59228515625,
-0.0150909423828125,
-0.76171875,
0.56298828125,
0.064697265625,
-0.202392578125,
-0.69140625,
-0.345947265625,
0.00977325439453125,
0.450927734375,
-0.6748046875,
-0.73681640625,
0.77587890625,
0.7783203125,
-0.045501708984375,
0.38525390625,
-0.33642578125,
-0.17578125,
0.90087890625,
1.3466796875,
-0.587890625,
0.87158203125,
0.3408203125,
-0.144775390625,
0.09722900390625,
-0.58056640625,
0.413818359375,
-0.200927734375,
-0.248291015625,
-0.2486572265625,
0.315673828125,
-0.481201171875,
-0.88916015625,
-0.10223388671875,
1.0146484375,
0.346923828125,
-0.35888671875,
-1.2734375,
-0.58203125,
-1.20703125,
0.029510498046875,
-0.875,
0.470703125,
-0.13134765625,
-0.218505859375,
-0.2061767578125,
-1.048828125,
4.3203125,
0.5546875,
0.88330078125,
0.56396484375,
0.5302734375,
0.460205078125,
0.198486328125,
-0.76513671875,
0.603515625,
-0.89208984375,
0.299560546875,
-0.20556640625,
-0.2452392578125,
0.8642578125,
0.67236328125,
0.54736328125,
-0.8876953125,
-0.153564453125,
-0.288330078125,
-0.68896484375,
-0.9599609375,
0.164794921875,
0.05535888671875,
0.6806640625,
-0.193359375,
0.55615234375,
0.5498046875,
-0.849609375,
-0.44580078125,
-0.65185546875,
-0.12420654296875,
-0.2296142578125,
0.6904296875,
0.04425048828125,
-0.525390625,
0.57470703125,
-0.30517578125,
-0.278076171875,
-0.19921875,
0.1334228515625,
-0.450439453125,
-0.15771484375,
0.5908203125,
-0.5234375,
-0.25830078125,
0.95751953125,
-0.5634765625,
0.243408203125,
0.56591796875,
-1.12109375,
0.85986328125,
-0.207763671875,
0.424072265625,
-0.45849609375,
-0.806640625,
0.050048828125,
0.1895751953125,
-0.2919921875,
-0.29052734375,
0.45166015625,
-0.2330322265625,
0.5986328125,
-0.038482666015625,
0.73681640625,
-0.56201171875,
0.4150390625,
-0.270751953125,
0.5751953125,
-0.6162109375,
-0.609375,
-0.2861328125,
-0.282958984375,
0.2318115234375,
-0.5400390625,
0.50244140625,
0.052734375,
-0.297607421875,
0.34814453125,
0.44140625,
-0.69580078125,
0.004730224609375,
-0.3193359375,
-0.53857421875,
-1.0029296875,
0.73974609375,
0.75341796875,
-0.37744140625,
-0.444580078125,
-0.2303466796875,
0.58642578125,
0.4833984375,
0.5126953125,
0.11016845703125,
-0.5908203125,
-0.6953125
] | 6
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.