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.
Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange.
Victor thinks that if a word contains two consecutive vowels, then it's kinda weird and it needs to be replaced. So the word corrector works in such a way: as long as there are two consecutive vowels in the word, it deletes the first vowel in a word such that there is another vowel right before it. If there are no two consecutive vowels in the word, it is considered to be correct.
You are given a word s. Can you predict what will it become after correction?
In this problem letters a, e, i, o, u and y are considered to be vowels.
Input
The first line contains one integer n (1 ≤ n ≤ 100) — the number of letters in word s before the correction.
The second line contains a string s consisting of exactly n lowercase Latin letters — the word before the correction.
Output
Output the word s after the correction.
Examples
Input
5
weird
Output
werd
Input
4
word
Output
word
Input
5
aaeaa
Output
a
Note
Explanations of the examples:
1. There is only one replace: weird <image> werd;
2. No replace needed since there are no two consecutive vowels;
3. aaeaa <image> aeaa <image> aaa <image> aa <image> a.
Tags: implementation
Correct Solution:
```
length = int(input())
word = input()
vowels = 'aeiouy'
i = 0
while i<length:
#print(i,length)
if length==1 or i==length-1:
break
elif word[i] in vowels and word[i+1] in vowels:
word = word[:i+1]+word[i+2:]
i=0
length-=1
else:
i+=1
print(word)
```
| 40,927
|
[
0.230712890625,
-0.04302978515625,
-0.274169921875,
0.422119140625,
-0.56884765625,
-0.384033203125,
-0.1722412109375,
-0.299072265625,
0.1947021484375,
0.7138671875,
0.425048828125,
-0.2666015625,
0.1163330078125,
-0.775390625,
-0.4658203125,
-0.04595947265625,
-0.8359375,
-0.73046875,
-0.70166015625,
-0.36279296875,
0.37548828125,
-0.26220703125,
-1.392578125,
-0.151611328125,
-0.3642578125,
0.81396484375,
0.1336669921875,
-0.0794677734375,
1.0693359375,
1.017578125,
-0.35400390625,
-0.040740966796875,
0.374267578125,
-0.78662109375,
-0.427001953125,
-0.50634765625,
0.31982421875,
-0.67529296875,
-0.478271484375,
-0.385498046875,
0.65087890625,
-0.3583984375,
0.200927734375,
-0.90478515625,
-1.1591796875,
-0.377685546875,
-0.61181640625,
-0.4765625,
0.006702423095703125,
-0.232666015625,
0.08837890625,
-0.71875,
0.52783203125,
-0.1768798828125,
0.01265716552734375,
-0.2861328125,
-0.25244140625,
0.25439453125,
-0.8359375,
-0.182861328125,
0.1431884765625,
0.603515625,
-0.345458984375,
-0.6943359375,
-0.3935546875,
0.3056640625,
-0.1806640625,
0.09600830078125,
-0.07904052734375,
-0.3310546875,
-0.159912109375,
0.4541015625,
-0.346923828125,
-0.26806640625,
-0.6953125,
-0.0176544189453125,
0.254150390625,
-0.2086181640625,
-0.7529296875,
0.833984375,
-0.08319091796875,
0.783203125,
0.481689453125,
0.423828125,
-0.407470703125,
-0.6787109375,
0.0684814453125,
0.29052734375,
0.60400390625,
-0.129150390625,
-0.275634765625,
0.47705078125,
-0.77099609375,
-0.00399017333984375,
0.791015625,
0.68212890625,
-0.17822265625,
0.01396942138671875,
0.50537109375,
-0.146484375,
0.9208984375,
0.86865234375,
-0.3388671875,
0.86767578125,
-0.6201171875,
-0.10601806640625,
0.273193359375,
0.064453125,
-0.247802734375,
-0.413330078125,
-0.0526123046875,
-0.093505859375,
0.207275390625,
0.64404296875,
-0.1707763671875,
1.2958984375,
0.0782470703125,
0.3798828125,
-0.89404296875,
-0.0007786750793457031,
0.2139892578125,
0.105712890625,
0.36181640625,
0.05615234375,
0.2088623046875,
-0.40869140625,
-0.52685546875,
1.0166015625,
-0.63916015625,
-0.10791015625,
0.318603515625,
-0.05596923828125,
-0.147705078125,
0.209716796875,
-0.10552978515625,
0.74462890625,
-0.414794921875,
0.85693359375,
0.5537109375,
-0.65234375,
1.0478515625,
-0.355224609375,
-0.1143798828125,
1.4189453125,
0.5078125,
-0.0362548828125,
0.7041015625,
0.7197265625,
-0.84423828125,
0.468994140625,
-1.2021484375,
1.1669921875,
0.164794921875,
0.1962890625,
-0.7841796875,
0.214111328125,
0.0426025390625,
0.0029811859130859375,
0.414306640625,
-0.05224609375,
-0.53466796875,
0.1971435546875,
-0.43505859375,
0.97314453125,
-0.431640625,
0.85107421875,
-0.5654296875,
-0.2169189453125,
-0.257568359375,
-0.487060546875,
0.478759765625,
-0.1416015625,
-0.305908203125,
0.8505859375,
0.51416015625,
1.2314453125,
1.05859375,
-0.3623046875,
0.1158447265625,
0.12841796875,
-0.352783203125,
0.2125244140625,
0.157958984375,
0.54541015625,
0.40625,
0.20947265625,
0.227294921875,
-0.3447265625,
-0.494873046875,
-0.366455078125,
-0.09283447265625,
0.74951171875,
-0.52734375,
0.0535888671875,
0.1251220703125,
0.0740966796875,
-0.89013671875,
0.03857421875,
0.12103271484375,
-0.98974609375,
-0.2032470703125,
0.677734375,
-0.324462890625,
0.400634765625,
0.08270263671875,
-0.41796875,
0.42724609375,
1.0302734375,
-0.487060546875,
0.476806640625,
0.48095703125,
0.174560546875,
-0.81298828125,
0.04608154296875,
0.564453125,
-0.131591796875,
-0.35791015625,
0.79248046875,
-0.64501953125,
0.054962158203125,
0.034759521484375,
0.5830078125,
0.419189453125,
0.57666015625,
-0.1822509765625,
-0.373291015625,
0.607421875,
1.2001953125,
0.049957275390625,
0.70849609375,
0.061981201171875,
0.869140625,
0.68896484375,
0.35693359375,
0.39892578125,
-0.1722412109375,
0.537109375,
0.98095703125,
-0.11614990234375,
0.346923828125,
0.300048828125,
0.499267578125,
0.537109375,
0.978515625,
-0.1693115234375,
0.29638671875,
-0.1640625,
-0.1629638671875,
-0.49267578125,
0.433837890625,
-0.166015625,
0.68701171875,
0.2005615234375,
0.5048828125,
-0.73583984375,
-0.421875,
-0.010589599609375,
0.7724609375,
-0.7578125,
-0.79638671875,
0.1695556640625,
0.00897979736328125,
0.248291015625,
-0.07904052734375,
0.1158447265625,
0.5546875,
0.50341796875,
0.6630859375,
-0.345458984375,
-0.7197265625,
-0.7509765625,
-0.9423828125,
-1.0498046875,
-0.38916015625,
-0.6337890625,
-0.055755615234375,
0.194580078125,
-0.91015625,
0.7119140625,
-0.08740234375,
-0.3935546875,
-0.1268310546875,
-0.59814453125,
0.78466796875,
-0.2998046875,
0.7294921875,
-1.0126953125,
0.48828125,
0.33837890625,
0.947265625,
-0.255859375,
-0.346923828125,
-0.417724609375,
-1.0146484375,
0.2083740234375,
0.14208984375,
0.455810546875,
0.2144775390625,
-0.79541015625,
-0.9736328125,
-0.61181640625,
-0.191162109375,
-0.6298828125,
0.327880859375,
-0.22900390625,
1.015625,
0.09393310546875,
-0.41943359375,
0.55126953125,
0.9638671875,
-1.2421875,
0.60888671875,
0.322509765625,
0.50146484375,
-0.9111328125,
1.3212890625,
0.416015625,
0.468505859375,
-0.93212890625,
-0.50146484375,
-0.6875,
0.291259765625,
0.176025390625,
-0.96826171875,
-0.407958984375,
0.79541015625,
-0.09033203125,
-1.0859375,
0.36767578125,
-1.4609375,
-0.7451171875,
-0.456298828125,
-0.455810546875,
1.1435546875,
1.2275390625,
0.318359375,
-0.279296875,
-0.357666015625,
-0.404541015625,
0.64599609375,
0.79541015625,
-0.75927734375,
0.11041259765625,
0.8544921875,
0.039520263671875,
0.2193603515625,
0.42822265625,
-0.71337890625,
-0.324462890625,
0.38134765625,
0.0285186767578125,
0.64794921875,
0.2025146484375,
0.2109375,
0.043060302734375,
0.66796875,
-0.8623046875,
-0.37158203125,
0.0167999267578125,
0.8017578125,
0.337646484375,
0.6279296875,
0.153076171875,
-0.48388671875,
-0.61669921875,
-0.73291015625,
0.373779296875,
0.256591796875,
0.95068359375,
-0.39013671875,
0.4248046875,
0.439208984375,
-0.87939453125,
0.5458984375,
-0.71923828125,
-0.1337890625,
1.369140625,
0.01091766357421875,
0.71728515625,
-0.509765625,
0.412353515625,
0.0814208984375,
-0.234130859375,
0.413818359375,
0.194091796875,
0.447509765625,
-0.75,
-0.385986328125,
-0.138916015625,
0.0011234283447265625,
-0.444580078125,
-0.368408203125,
0.173583984375,
-0.2064208984375,
-0.17041015625,
-0.89892578125,
0.324951171875,
0.66357421875,
0.266845703125,
0.352783203125,
0.5859375,
0.08404541015625,
0.6875,
0.67529296875,
-0.1060791015625,
0.345947265625,
-0.89013671875,
0.366943359375,
0.2137451171875,
-0.446533203125,
-0.4072265625,
-0.35791015625,
-0.4072265625,
0.06927490234375,
0.144287109375,
-0.2371826171875,
-0.86376953125,
-0.07574462890625,
-0.016326904296875,
0.358642578125,
-0.92578125,
-0.2003173828125,
-0.57568359375,
0.400390625,
0.255859375,
-0.75,
0.419921875,
-1.1044921875,
0.552734375,
0.45703125,
-0.09368896484375,
-0.287353515625,
-0.3818359375,
-0.5048828125,
-0.4716796875,
-0.04974365234375,
0.0584716796875,
0.364013671875,
0.267333984375,
-1.30078125,
0.51025390625,
0.4365234375,
-0.509765625,
0.3427734375,
-0.096435546875,
0.76123046875,
0.54150390625,
0.92724609375,
-0.45166015625,
-0.353515625,
0.27734375,
-1.2783203125,
0.9794921875,
-0.74169921875,
0.67626953125,
-0.061248779296875,
-0.2393798828125,
0.09857177734375,
0.388427734375,
-0.41943359375,
-0.152099609375,
-0.265380859375,
0.38623046875,
-0.693359375,
-0.7978515625,
0.5673828125,
0.21630859375,
-0.1888427734375,
0.27587890625,
-0.10260009765625,
0.051910400390625,
0.266357421875,
0.492919921875,
-0.350830078125,
0.197509765625,
-0.7001953125,
0.49755859375,
-0.2235107421875,
-0.8330078125,
-0.1370849609375,
-0.493408203125,
0.29833984375,
-0.1995849609375,
-1.2041015625,
-0.197265625,
-1.390625,
-0.1888427734375,
0.07147216796875,
-0.72705078125,
0.01557159423828125,
0.517578125,
0.30908203125,
-0.41064453125,
-0.4384765625,
-0.72998046875,
-0.35791015625,
-0.51953125,
-0.4404296875,
0.2301025390625,
0.8056640625,
1.0107421875,
-0.31640625,
-0.1251220703125,
0.0022735595703125,
0.07025146484375,
-0.3623046875,
-0.654296875,
-0.445556640625,
-0.309326171875,
-0.499755859375,
0.06427001953125,
0.88037109375,
0.038787841796875,
0.4736328125,
1.0400390625,
-0.2578125,
0.127685546875,
-0.1256103515625,
-0.57080078125,
0.9765625,
0.0012636184692382812,
-1.2783203125,
-0.4365234375,
0.331298828125,
0.2060546875,
0.77001953125,
0.1551513671875,
-0.73681640625,
-0.62841796875,
-1.0615234375,
-0.1822509765625,
-0.73974609375,
-0.3466796875,
-0.96875,
-0.416259765625,
-0.3359375,
0.52294921875,
-0.1629638671875,
-0.8701171875,
0.131103515625,
-0.916015625,
0.3515625,
-0.67626953125,
-0.3544921875,
-0.5986328125,
-0.76025390625,
0.1572265625,
0.89892578125,
-0.1739501953125,
0.284423828125,
0.1737060546875,
-0.284423828125,
0.357666015625,
-0.1885986328125,
-0.919921875,
-0.422119140625,
0.1011962890625,
0.3251953125,
-0.04510498046875,
-0.014892578125,
-0.5166015625,
0.84912109375,
-0.962890625,
0.378173828125,
-0.133056640625,
-0.498291015625,
0.057647705078125,
-0.301025390625,
0.755859375,
-0.44091796875,
-0.07275390625,
-0.66162109375,
0.306640625,
0.67236328125,
-0.244140625,
-0.5927734375,
-0.796875,
-0.6484375,
-0.7529296875,
0.671875,
-0.78369140625,
0.2469482421875,
-0.275390625,
-0.1285400390625,
1.068359375,
-0.252685546875,
0.194580078125,
1.2939453125,
0.326416015625,
0.4990234375,
-0.71142578125,
1.03125,
0.2381591796875,
-0.44580078125,
-0.1746826171875,
0.29052734375,
-0.9267578125,
0.423095703125,
-0.455322265625,
-0.81689453125,
-0.361083984375,
0.17724609375,
1.634765625,
-0.37255859375,
0.82421875,
-0.01390838623046875,
-0.71044921875,
-0.6748046875,
1.013671875,
0.54345703125,
-0.10150146484375,
1.01953125,
0.1156005859375,
0.01519012451171875,
0.267333984375,
-0.244873046875,
-0.5087890625,
-0.16796875,
0.75732421875,
-0.07086181640625,
-0.5322265625,
0.9169921875,
0.85791015625,
-1.107421875,
-1.0654296875,
0.14208984375,
-0.2060546875,
-0.53857421875,
-0.7099609375,
0.437744140625,
1.033203125,
-0.71484375,
0.06268310546875,
0.57666015625,
-0.30029296875,
0.56982421875,
0.06256103515625,
0.296875,
-0.497802734375,
0.8828125,
0.7255859375,
-1.056640625,
-0.051849365234375,
-1.0029296875,
-0.1651611328125,
-0.1397705078125,
0.1712646484375,
0.59130859375,
-0.34912109375,
-0.132080078125,
0.66650390625,
-0.488525390625,
0.52099609375,
-0.7890625,
-0.62255859375,
0.344970703125,
-0.52734375,
-0.8935546875,
0.059661865234375,
0.6123046875,
-0.2451171875,
0.376708984375,
-0.5078125,
-0.1455078125,
0.362060546875,
0.29296875,
-0.591796875,
-0.79345703125,
-0.305419921875,
-0.8076171875,
-0.62353515625,
-0.642578125,
-0.138671875,
-0.405029296875,
0.309814453125,
0.1981201171875,
-0.34033203125,
0.0654296875,
0.1571044921875,
-0.7734375,
0.5947265625,
-0.2509765625,
0.6357421875,
-0.6650390625,
-0.35302734375,
-0.416015625,
-0.0439453125,
-0.71923828125,
-0.2054443359375,
-0.537109375,
0.298095703125,
-0.2327880859375,
0.5087890625,
0.01904296875,
0.76904296875,
-0.2230224609375,
-0.52001953125,
0.1199951171875,
-0.09869384765625,
-0.1959228515625,
0.82080078125,
0.72412109375,
-0.1009521484375,
0.38037109375,
-0.1881103515625,
-0.280517578125,
-0.11895751953125,
0.42822265625,
0.393310546875,
-0.5458984375,
-0.1768798828125,
-0.45556640625,
0.0029506683349609375,
-0.892578125,
0.00943756103515625,
-0.286865234375,
0.6787109375,
0.10174560546875,
-0.264892578125,
0.34033203125,
1.1875,
-0.04541015625,
0.09320068359375,
-0.173583984375,
0.09906005859375,
0.53076171875,
-0.032684326171875,
-0.0287322998046875,
0.08050537109375,
0.391357421875,
-0.279296875,
-0.062744140625,
0.76953125,
-0.1177978515625,
0.495849609375,
-0.11431884765625,
-0.8232421875,
-0.74951171875,
0.03564453125,
-0.024688720703125,
0.364990234375,
0.0836181640625,
-0.47265625,
0.05328369140625,
0.141357421875,
-0.86474609375,
0.301025390625,
-1.056640625,
-0.6552734375,
0.344482421875,
-0.406005859375,
-0.201416015625,
-0.25634765625,
-0.7333984375,
-0.1925048828125,
0.162353515625,
0.490966796875,
-0.5361328125,
0.5185546875,
0.05181884765625,
0.51025390625,
-0.158935546875,
-0.10870361328125,
-0.15966796875,
0.014007568359375,
-0.47021484375,
-0.650390625,
0.60302734375,
1.0830078125,
0.2301025390625,
0.026092529296875,
-0.62158203125,
0.56689453125,
-0.334716796875,
0.2802734375,
-0.0947265625,
0.386962890625,
-0.413818359375,
0.37939453125,
-1.076171875,
0.1142578125,
-0.11871337890625,
0.4755859375,
0.376953125,
-0.1932373046875,
-0.21142578125,
0.93408203125,
0.59033203125,
-0.388916015625,
-0.040924072265625,
0.282958984375,
0.49462890625,
-0.37060546875,
-0.1473388671875,
-0.291748046875,
0.84912109375,
0.342041015625,
0.281005859375,
-0.267333984375,
0.57861328125,
0.84912109375,
0.117919921875,
-0.06512451171875,
0.6826171875,
0.1641845703125,
-0.26025390625,
-0.0114593505859375,
-0.470947265625,
-0.55712890625,
-0.01277923583984375,
-0.312744140625,
0.5771484375,
-0.11456298828125,
0.1751708984375,
-0.036468505859375,
-0.77978515625,
0.92333984375,
0.09649658203125,
-0.052001953125,
-0.0183258056640625,
-0.6015625,
0.2052001953125,
1.048828125,
0.17529296875,
-0.06884765625,
0.53466796875,
0.85986328125,
0.61865234375,
0.54345703125,
0.53515625,
0.47607421875,
-0.444580078125,
0.0753173828125,
-0.06085205078125,
0.07086181640625,
-0.255615234375,
-0.4697265625,
-1.298828125,
0.394287109375,
-0.76220703125,
-0.316650390625,
0.939453125,
-0.8134765625,
-0.0185089111328125,
-0.33203125,
0.66845703125,
-0.357666015625,
0.58349609375,
0.619140625,
-0.42138671875,
-0.697265625,
0.99462890625,
-0.160888671875,
0.65380859375,
0.003063201904296875,
1.2998046875,
-0.09588623046875,
0.97998046875,
0.287353515625,
-0.1815185546875,
-0.114990234375,
0.3115234375,
-0.391357421875,
-0.76904296875,
-0.324462890625,
-0.443115234375,
0.272705078125,
-0.5107421875,
-0.62109375,
-0.0443115234375,
0.77978515625,
-0.32470703125,
-1.236328125,
-0.359130859375,
0.14404296875,
-0.443603515625,
0.75537109375,
0.10784912109375,
-0.12408447265625,
0.046539306640625,
-0.2069091796875,
0.03253173828125,
-0.397705078125,
0.13134765625,
-0.354736328125,
0.4267578125,
-0.71240234375,
-0.415283203125,
-0.9091796875,
-0.331787109375,
-0.43798828125,
-0.049713134765625,
-0.44580078125,
-0.8017578125,
0.34228515625,
0.2178955078125,
0.3876953125,
0.373046875,
-0.10772705078125,
0.52099609375,
1.37109375,
0.87060546875,
0.062408447265625,
1.2412109375,
0.345947265625,
-0.488037109375,
0.414306640625,
-0.70263671875,
0.80322265625,
-0.046478271484375,
0.2022705078125,
-0.207275390625,
0.2227783203125,
-0.3486328125,
-0.9208984375,
0.312255859375,
0.9619140625,
0.235107421875,
-0.69677734375,
-1.259765625,
-0.03570556640625,
-0.97412109375,
-0.253662109375,
-0.74609375,
0.8671875,
0.240478515625,
-0.016937255859375,
-0.2666015625,
-1.150390625,
4.21484375,
0.822265625,
1.2353515625,
0.556640625,
0.203369140625,
1.19140625,
0.466064453125,
-0.2318115234375,
-0.335205078125,
-0.62109375,
0.51904296875,
-0.63037109375,
-0.0015459060668945312,
0.5205078125,
0.340576171875,
0.1611328125,
-0.408935546875,
0.321533203125,
0.34619140625,
-0.55859375,
-0.919921875,
0.1986083984375,
0.393310546875,
0.6875,
0.09490966796875,
0.48974609375,
0.5888671875,
-0.2919921875,
-0.1927490234375,
-1.064453125,
0.126220703125,
-0.61279296875,
0.84130859375,
0.0318603515625,
-0.128662109375,
0.7158203125,
-0.219482421875,
-0.61962890625,
-0.56884765625,
0.221923828125,
-0.46044921875,
-0.135986328125,
0.489013671875,
-0.646484375,
0.143798828125,
0.4169921875,
-0.35009765625,
0.263916015625,
0.52587890625,
-0.85791015625,
1.1142578125,
-0.309326171875,
0.490966796875,
-0.951171875,
-0.233154296875,
0.3701171875,
-0.01019287109375,
0.1370849609375,
-0.288330078125,
0.4794921875,
0.357666015625,
0.3310546875,
-0.1513671875,
0.7119140625,
-1.140625,
0.433349609375,
-0.2410888671875,
0.494384765625,
-0.63232421875,
-0.309814453125,
-0.2384033203125,
0.114501953125,
0.2130126953125,
-0.1575927734375,
0.53466796875,
0.10198974609375,
0.2239990234375,
0.73681640625,
0.319091796875,
-0.84375,
0.126220703125,
-0.05010986328125,
-0.33447265625,
-0.59765625,
0.50830078125,
1.3916015625,
-0.609375,
-0.28662109375,
-0.361572265625,
1.0087890625,
0.76904296875,
0.62548828125,
0.24267578125,
-0.53759765625,
-0.288330078125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange.
Victor thinks that if a word contains two consecutive vowels, then it's kinda weird and it needs to be replaced. So the word corrector works in such a way: as long as there are two consecutive vowels in the word, it deletes the first vowel in a word such that there is another vowel right before it. If there are no two consecutive vowels in the word, it is considered to be correct.
You are given a word s. Can you predict what will it become after correction?
In this problem letters a, e, i, o, u and y are considered to be vowels.
Input
The first line contains one integer n (1 ≤ n ≤ 100) — the number of letters in word s before the correction.
The second line contains a string s consisting of exactly n lowercase Latin letters — the word before the correction.
Output
Output the word s after the correction.
Examples
Input
5
weird
Output
werd
Input
4
word
Output
word
Input
5
aaeaa
Output
a
Note
Explanations of the examples:
1. There is only one replace: weird <image> werd;
2. No replace needed since there are no two consecutive vowels;
3. aaeaa <image> aeaa <image> aaa <image> aa <image> a.
Tags: implementation
Correct Solution:
```
# https://codeforces.com/problemset/problem/938/A
n = input()
s = list()
vowels = {'a', 'e', 'i', 'o', 'u', 'y'}
for i in input():
if not s:
s.append(i)
else:
if s[-1] in vowels and i in vowels:
pass
else:
s.append(i)
print(''.join(s))
```
| 40,928
|
[
0.165771484375,
-0.09259033203125,
-0.30712890625,
0.3115234375,
-0.611328125,
-0.3740234375,
-0.2142333984375,
-0.291015625,
0.2017822265625,
0.716796875,
0.3759765625,
-0.380126953125,
0.2222900390625,
-0.79150390625,
-0.489990234375,
-0.11181640625,
-0.91015625,
-0.70947265625,
-0.71484375,
-0.386962890625,
0.384521484375,
-0.289306640625,
-1.4248046875,
-0.1844482421875,
-0.3720703125,
0.8388671875,
0.142578125,
-0.1092529296875,
1.08984375,
1.015625,
-0.36767578125,
-0.0982666015625,
0.391845703125,
-0.83447265625,
-0.383056640625,
-0.501953125,
0.3505859375,
-0.62158203125,
-0.5478515625,
-0.383544921875,
0.6279296875,
-0.384765625,
0.16943359375,
-0.875,
-1.1591796875,
-0.367919921875,
-0.65380859375,
-0.51416015625,
-0.0168304443359375,
-0.243408203125,
0.05096435546875,
-0.7216796875,
0.5634765625,
-0.1905517578125,
0.043853759765625,
-0.31982421875,
-0.283935546875,
0.298583984375,
-0.8310546875,
-0.226318359375,
0.1336669921875,
0.583984375,
-0.327392578125,
-0.6142578125,
-0.456787109375,
0.301025390625,
-0.172607421875,
0.15380859375,
-0.07916259765625,
-0.262939453125,
-0.189208984375,
0.42138671875,
-0.4072265625,
-0.29248046875,
-0.736328125,
-0.0160675048828125,
0.191650390625,
-0.152099609375,
-0.7060546875,
0.8466796875,
-0.033050537109375,
0.7607421875,
0.53076171875,
0.425537109375,
-0.42529296875,
-0.6298828125,
0.10968017578125,
0.282470703125,
0.59423828125,
-0.072265625,
-0.26708984375,
0.46240234375,
-0.80615234375,
0.0111236572265625,
0.80029296875,
0.7177734375,
-0.201904296875,
0.045623779296875,
0.55517578125,
-0.1165771484375,
0.8984375,
0.82470703125,
-0.373291015625,
0.83349609375,
-0.62744140625,
-0.20849609375,
0.255126953125,
0.08819580078125,
-0.226806640625,
-0.38623046875,
-0.0631103515625,
-0.1170654296875,
0.2073974609375,
0.625,
-0.1488037109375,
1.255859375,
0.0977783203125,
0.36376953125,
-0.91015625,
0.007053375244140625,
0.1812744140625,
0.09814453125,
0.35009765625,
0.02569580078125,
0.22998046875,
-0.355712890625,
-0.50048828125,
1.0380859375,
-0.66943359375,
-0.11102294921875,
0.409912109375,
-0.0210418701171875,
-0.1043701171875,
0.233154296875,
-0.1278076171875,
0.712890625,
-0.50048828125,
0.8349609375,
0.5341796875,
-0.60400390625,
1.0634765625,
-0.273193359375,
-0.07830810546875,
1.416015625,
0.481689453125,
-0.0706787109375,
0.67578125,
0.68310546875,
-0.86962890625,
0.578125,
-1.21875,
1.1279296875,
0.217529296875,
0.211181640625,
-0.74462890625,
0.2113037109375,
0.0254058837890625,
-0.0257720947265625,
0.45166015625,
-0.06866455078125,
-0.52734375,
0.19921875,
-0.40869140625,
0.9990234375,
-0.474365234375,
0.87255859375,
-0.53515625,
-0.26708984375,
-0.2493896484375,
-0.51708984375,
0.444580078125,
-0.07659912109375,
-0.29150390625,
0.8701171875,
0.5126953125,
1.2119140625,
1.0966796875,
-0.34521484375,
0.07470703125,
0.1156005859375,
-0.30419921875,
0.173583984375,
0.244384765625,
0.6025390625,
0.428466796875,
0.288818359375,
0.2415771484375,
-0.331787109375,
-0.434814453125,
-0.353515625,
-0.166259765625,
0.74853515625,
-0.444580078125,
0.07666015625,
0.06695556640625,
0.07086181640625,
-0.88037109375,
0.028076171875,
0.1475830078125,
-0.97900390625,
-0.1663818359375,
0.6962890625,
-0.3369140625,
0.435546875,
0.044586181640625,
-0.478759765625,
0.43994140625,
0.99609375,
-0.434814453125,
0.493408203125,
0.475830078125,
0.1063232421875,
-0.88134765625,
-0.0101470947265625,
0.5732421875,
-0.2095947265625,
-0.28369140625,
0.75341796875,
-0.65625,
0.037200927734375,
-0.07196044921875,
0.64892578125,
0.458740234375,
0.6015625,
-0.213134765625,
-0.319091796875,
0.63916015625,
1.2568359375,
-0.011260986328125,
0.6865234375,
0.093994140625,
0.857421875,
0.7021484375,
0.41015625,
0.4091796875,
-0.188720703125,
0.501953125,
0.986328125,
-0.107421875,
0.313720703125,
0.329833984375,
0.443603515625,
0.62939453125,
1.0546875,
-0.2161865234375,
0.279052734375,
-0.209716796875,
-0.1676025390625,
-0.52001953125,
0.439697265625,
-0.17919921875,
0.6435546875,
0.233154296875,
0.54443359375,
-0.68505859375,
-0.448486328125,
-0.039703369140625,
0.73681640625,
-0.7734375,
-0.85693359375,
0.166015625,
0.01018524169921875,
0.23388671875,
-0.038177490234375,
0.0631103515625,
0.54150390625,
0.47705078125,
0.62255859375,
-0.34912109375,
-0.78173828125,
-0.69287109375,
-0.9521484375,
-1.0419921875,
-0.39892578125,
-0.61572265625,
-0.05615234375,
0.155517578125,
-0.861328125,
0.68994140625,
-0.1497802734375,
-0.453369140625,
-0.1002197265625,
-0.52734375,
0.7958984375,
-0.354736328125,
0.78515625,
-1.01171875,
0.478271484375,
0.34716796875,
0.92529296875,
-0.2335205078125,
-0.396728515625,
-0.474609375,
-1.0234375,
0.1746826171875,
0.145751953125,
0.5166015625,
0.208251953125,
-0.74951171875,
-0.97998046875,
-0.640625,
-0.1622314453125,
-0.57666015625,
0.28125,
-0.149169921875,
1.0224609375,
-0.0167388916015625,
-0.427001953125,
0.48876953125,
0.982421875,
-1.2568359375,
0.61572265625,
0.30859375,
0.4462890625,
-0.892578125,
1.3603515625,
0.355712890625,
0.51904296875,
-0.9306640625,
-0.51953125,
-0.72900390625,
0.24755859375,
0.2012939453125,
-1.025390625,
-0.341552734375,
0.79541015625,
-0.10882568359375,
-1.103515625,
0.37158203125,
-1.4599609375,
-0.7421875,
-0.4580078125,
-0.440185546875,
1.2080078125,
1.27734375,
0.376953125,
-0.2349853515625,
-0.3447265625,
-0.419921875,
0.63623046875,
0.72802734375,
-0.78515625,
0.111083984375,
0.81201171875,
0.0022449493408203125,
0.23388671875,
0.51904296875,
-0.66064453125,
-0.278564453125,
0.36962890625,
0.01119232177734375,
0.626953125,
0.126220703125,
0.22265625,
0.036865234375,
0.7099609375,
-0.880859375,
-0.3623046875,
0.052459716796875,
0.79736328125,
0.294189453125,
0.69775390625,
0.095947265625,
-0.49755859375,
-0.6494140625,
-0.7529296875,
0.31689453125,
0.30615234375,
0.89599609375,
-0.367919921875,
0.470458984375,
0.398193359375,
-0.86474609375,
0.496826171875,
-0.75830078125,
-0.1510009765625,
1.3271484375,
0.07330322265625,
0.69677734375,
-0.47216796875,
0.40771484375,
0.04412841796875,
-0.25390625,
0.321044921875,
0.223876953125,
0.451904296875,
-0.75390625,
-0.3505859375,
-0.1341552734375,
0.050506591796875,
-0.377197265625,
-0.39697265625,
0.212890625,
-0.1776123046875,
-0.1580810546875,
-0.876953125,
0.32080078125,
0.6376953125,
0.209228515625,
0.36962890625,
0.64013671875,
0.1629638671875,
0.59765625,
0.7763671875,
-0.11822509765625,
0.320068359375,
-0.8662109375,
0.34033203125,
0.2044677734375,
-0.52978515625,
-0.393310546875,
-0.401611328125,
-0.42529296875,
0.11846923828125,
0.210205078125,
-0.266845703125,
-0.89599609375,
-0.09710693359375,
-0.0229339599609375,
0.4267578125,
-0.88525390625,
-0.1978759765625,
-0.63134765625,
0.46826171875,
0.279296875,
-0.81689453125,
0.366455078125,
-1.1337890625,
0.59521484375,
0.444580078125,
-0.11175537109375,
-0.310546875,
-0.3251953125,
-0.423828125,
-0.517578125,
-0.025787353515625,
0.0266876220703125,
0.385009765625,
0.25732421875,
-1.3408203125,
0.52685546875,
0.55029296875,
-0.55029296875,
0.390625,
-0.11029052734375,
0.7470703125,
0.5439453125,
1.001953125,
-0.46484375,
-0.304443359375,
0.313232421875,
-1.2578125,
1.00390625,
-0.724609375,
0.79833984375,
-0.12066650390625,
-0.2164306640625,
0.1287841796875,
0.434814453125,
-0.469970703125,
-0.12548828125,
-0.236328125,
0.386962890625,
-0.75439453125,
-0.8134765625,
0.546875,
0.2435302734375,
-0.1689453125,
0.250732421875,
-0.0640869140625,
0.0902099609375,
0.2381591796875,
0.54296875,
-0.311279296875,
0.1787109375,
-0.7470703125,
0.47705078125,
-0.1947021484375,
-0.8623046875,
-0.1502685546875,
-0.54736328125,
0.381591796875,
-0.16357421875,
-1.21484375,
-0.2119140625,
-1.4287109375,
-0.19970703125,
0.0482177734375,
-0.75341796875,
-0.048919677734375,
0.496337890625,
0.347412109375,
-0.4306640625,
-0.42138671875,
-0.70703125,
-0.3564453125,
-0.5546875,
-0.42236328125,
0.18603515625,
0.716796875,
1.02734375,
-0.32958984375,
-0.109375,
-0.04840087890625,
0.06719970703125,
-0.317138671875,
-0.67626953125,
-0.45654296875,
-0.325439453125,
-0.5,
0.0177459716796875,
0.9072265625,
0.0279541015625,
0.4990234375,
1.0107421875,
-0.29833984375,
0.0946044921875,
-0.2109375,
-0.62451171875,
1.0185546875,
-0.0538330078125,
-1.2978515625,
-0.4384765625,
0.29150390625,
0.226318359375,
0.81201171875,
0.126953125,
-0.68798828125,
-0.5693359375,
-1.0380859375,
-0.197998046875,
-0.7958984375,
-0.3134765625,
-0.94140625,
-0.366455078125,
-0.403076171875,
0.5439453125,
-0.1778564453125,
-0.8154296875,
0.2047119140625,
-0.9150390625,
0.377685546875,
-0.67578125,
-0.440185546875,
-0.556640625,
-0.8173828125,
0.06878662109375,
0.87646484375,
-0.2025146484375,
0.283447265625,
0.1932373046875,
-0.271728515625,
0.3330078125,
-0.257080078125,
-0.97998046875,
-0.408447265625,
0.1383056640625,
0.3955078125,
-0.08953857421875,
-0.028564453125,
-0.5791015625,
0.8525390625,
-0.953125,
0.421875,
-0.1595458984375,
-0.54296875,
0.09722900390625,
-0.27197265625,
0.7431640625,
-0.494140625,
-0.040191650390625,
-0.74658203125,
0.358642578125,
0.64892578125,
-0.22314453125,
-0.57080078125,
-0.8369140625,
-0.66650390625,
-0.720703125,
0.72314453125,
-0.77880859375,
0.28515625,
-0.300048828125,
-0.10589599609375,
1.08203125,
-0.2073974609375,
0.13232421875,
1.220703125,
0.29833984375,
0.5166015625,
-0.79150390625,
1.033203125,
0.295166015625,
-0.41943359375,
-0.2158203125,
0.319580078125,
-0.97021484375,
0.47705078125,
-0.4990234375,
-0.83935546875,
-0.3359375,
0.2099609375,
1.6376953125,
-0.40576171875,
0.8271484375,
-0.0316162109375,
-0.6728515625,
-0.603515625,
1.0390625,
0.54541015625,
-0.127197265625,
1.0283203125,
0.1290283203125,
0.0149993896484375,
0.315185546875,
-0.1602783203125,
-0.40673828125,
-0.1409912109375,
0.74267578125,
-0.08990478515625,
-0.61376953125,
0.9658203125,
0.86962890625,
-1.1484375,
-1.0546875,
0.1744384765625,
-0.1793212890625,
-0.470703125,
-0.72021484375,
0.439697265625,
1.01953125,
-0.68798828125,
0.047515869140625,
0.625,
-0.289794921875,
0.62060546875,
0.08636474609375,
0.2900390625,
-0.53466796875,
0.86279296875,
0.69384765625,
-1.0048828125,
-0.1484375,
-0.982421875,
-0.11328125,
-0.1485595703125,
0.1478271484375,
0.60009765625,
-0.2724609375,
-0.11016845703125,
0.7392578125,
-0.53125,
0.57666015625,
-0.822265625,
-0.69091796875,
0.355224609375,
-0.49267578125,
-0.87060546875,
0.038330078125,
0.51513671875,
-0.275634765625,
0.352294921875,
-0.5419921875,
-0.13037109375,
0.374755859375,
0.291259765625,
-0.578125,
-0.87646484375,
-0.24560546875,
-0.7587890625,
-0.59716796875,
-0.69775390625,
-0.036651611328125,
-0.42431640625,
0.3271484375,
0.20654296875,
-0.342041015625,
0.10748291015625,
0.1845703125,
-0.7958984375,
0.5966796875,
-0.265869140625,
0.63525390625,
-0.67529296875,
-0.286376953125,
-0.41748046875,
-0.04022216796875,
-0.7294921875,
-0.2196044921875,
-0.5498046875,
0.318603515625,
-0.2548828125,
0.462890625,
0.0166168212890625,
0.7529296875,
-0.1868896484375,
-0.51171875,
0.06829833984375,
-0.0596923828125,
-0.283447265625,
0.888671875,
0.72216796875,
-0.0889892578125,
0.386474609375,
-0.2049560546875,
-0.30517578125,
-0.1295166015625,
0.397705078125,
0.4716796875,
-0.560546875,
-0.169921875,
-0.489990234375,
-0.0283355712890625,
-0.8759765625,
0.035003662109375,
-0.250732421875,
0.66796875,
0.08154296875,
-0.25830078125,
0.3974609375,
1.216796875,
-0.04595947265625,
0.09381103515625,
-0.121337890625,
0.1307373046875,
0.53271484375,
0.0120391845703125,
-0.0450439453125,
0.152099609375,
0.351806640625,
-0.295654296875,
-0.1451416015625,
0.84033203125,
-0.0296783447265625,
0.55810546875,
-0.07464599609375,
-0.81005859375,
-0.7724609375,
-0.0101470947265625,
0.002849578857421875,
0.391845703125,
0.1241455078125,
-0.460693359375,
0.1007080078125,
0.1583251953125,
-0.83740234375,
0.283935546875,
-1.0537109375,
-0.724609375,
0.343505859375,
-0.43798828125,
-0.216552734375,
-0.292236328125,
-0.7158203125,
-0.128173828125,
0.2005615234375,
0.52197265625,
-0.5244140625,
0.471923828125,
0.09918212890625,
0.513671875,
-0.1099853515625,
-0.05364990234375,
-0.1336669921875,
-0.0390625,
-0.405517578125,
-0.6103515625,
0.669921875,
1.1142578125,
0.2154541015625,
0.0084686279296875,
-0.63720703125,
0.53857421875,
-0.32568359375,
0.234130859375,
-0.07147216796875,
0.4423828125,
-0.491943359375,
0.375,
-1.0322265625,
0.08538818359375,
-0.1396484375,
0.4599609375,
0.32861328125,
-0.257080078125,
-0.263427734375,
0.8984375,
0.62841796875,
-0.338623046875,
-0.00916290283203125,
0.259033203125,
0.482421875,
-0.4521484375,
-0.1396484375,
-0.25048828125,
0.759765625,
0.30224609375,
0.309326171875,
-0.2335205078125,
0.67822265625,
0.80078125,
0.09979248046875,
-0.0732421875,
0.7509765625,
0.1424560546875,
-0.2445068359375,
-0.0400390625,
-0.5078125,
-0.488525390625,
0.0078887939453125,
-0.31787109375,
0.646484375,
-0.0599365234375,
0.2626953125,
-0.03594970703125,
-0.771484375,
0.89892578125,
0.0394287109375,
-0.047119140625,
-0.04949951171875,
-0.607421875,
0.228759765625,
1.0576171875,
0.2325439453125,
-0.01763916015625,
0.57275390625,
0.88037109375,
0.59716796875,
0.4990234375,
0.5615234375,
0.4765625,
-0.3935546875,
0.04718017578125,
-0.0777587890625,
0.034332275390625,
-0.2276611328125,
-0.455810546875,
-1.3310546875,
0.306396484375,
-0.71826171875,
-0.28564453125,
0.92822265625,
-0.79150390625,
-0.01409912109375,
-0.378173828125,
0.666015625,
-0.353759765625,
0.5703125,
0.6240234375,
-0.52783203125,
-0.71533203125,
1.04296875,
-0.1427001953125,
0.64013671875,
-0.0172271728515625,
1.341796875,
-0.129638671875,
0.916015625,
0.293701171875,
-0.15625,
-0.107177734375,
0.339599609375,
-0.357177734375,
-0.73046875,
-0.288330078125,
-0.43701171875,
0.3173828125,
-0.5322265625,
-0.58935546875,
-0.053466796875,
0.81640625,
-0.274658203125,
-1.259765625,
-0.38037109375,
0.1328125,
-0.434814453125,
0.78515625,
0.1280517578125,
-0.08551025390625,
0.04901123046875,
-0.1943359375,
0.027557373046875,
-0.414794921875,
0.1156005859375,
-0.377197265625,
0.470458984375,
-0.6943359375,
-0.434326171875,
-0.93701171875,
-0.350830078125,
-0.422119140625,
-0.042449951171875,
-0.4619140625,
-0.8095703125,
0.304443359375,
0.185546875,
0.403564453125,
0.260986328125,
-0.06756591796875,
0.5361328125,
1.357421875,
0.857421875,
0.0022945404052734375,
1.2314453125,
0.322509765625,
-0.50341796875,
0.51025390625,
-0.6611328125,
0.83203125,
-0.048919677734375,
0.2059326171875,
-0.17578125,
0.2222900390625,
-0.42041015625,
-0.88720703125,
0.231201171875,
0.951171875,
0.191162109375,
-0.640625,
-1.2197265625,
0.0214691162109375,
-0.9814453125,
-0.2445068359375,
-0.7431640625,
0.83349609375,
0.234375,
-0.058258056640625,
-0.275146484375,
-1.087890625,
4.1796875,
0.82275390625,
1.25,
0.497802734375,
0.23876953125,
1.173828125,
0.43896484375,
-0.173095703125,
-0.268310546875,
-0.6787109375,
0.54052734375,
-0.60546875,
-0.046539306640625,
0.50830078125,
0.2476806640625,
0.161865234375,
-0.397216796875,
0.31884765625,
0.34130859375,
-0.53369140625,
-0.939453125,
0.2369384765625,
0.380859375,
0.67724609375,
-0.0024662017822265625,
0.44482421875,
0.58837890625,
-0.1932373046875,
-0.18603515625,
-1.08984375,
0.12139892578125,
-0.66650390625,
0.83935546875,
0.034912109375,
-0.10760498046875,
0.7216796875,
-0.2191162109375,
-0.58544921875,
-0.58447265625,
0.240478515625,
-0.373291015625,
-0.08184814453125,
0.57421875,
-0.72998046875,
0.12548828125,
0.466064453125,
-0.398681640625,
0.2398681640625,
0.541015625,
-0.857421875,
1.0859375,
-0.354736328125,
0.52001953125,
-0.9560546875,
-0.1656494140625,
0.370361328125,
0.0157470703125,
0.089599609375,
-0.287353515625,
0.410888671875,
0.3544921875,
0.35009765625,
-0.1842041015625,
0.7431640625,
-1.1904296875,
0.34765625,
-0.2464599609375,
0.5263671875,
-0.630859375,
-0.37744140625,
-0.2459716796875,
0.07513427734375,
0.316162109375,
-0.207275390625,
0.49658203125,
0.08563232421875,
0.27001953125,
0.76953125,
0.2509765625,
-0.888671875,
0.0662841796875,
-0.03729248046875,
-0.338134765625,
-0.57568359375,
0.56298828125,
1.3203125,
-0.580078125,
-0.34423828125,
-0.3720703125,
1.0302734375,
0.7734375,
0.654296875,
0.301025390625,
-0.5126953125,
-0.227294921875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange.
Victor thinks that if a word contains two consecutive vowels, then it's kinda weird and it needs to be replaced. So the word corrector works in such a way: as long as there are two consecutive vowels in the word, it deletes the first vowel in a word such that there is another vowel right before it. If there are no two consecutive vowels in the word, it is considered to be correct.
You are given a word s. Can you predict what will it become after correction?
In this problem letters a, e, i, o, u and y are considered to be vowels.
Input
The first line contains one integer n (1 ≤ n ≤ 100) — the number of letters in word s before the correction.
The second line contains a string s consisting of exactly n lowercase Latin letters — the word before the correction.
Output
Output the word s after the correction.
Examples
Input
5
weird
Output
werd
Input
4
word
Output
word
Input
5
aaeaa
Output
a
Note
Explanations of the examples:
1. There is only one replace: weird <image> werd;
2. No replace needed since there are no two consecutive vowels;
3. aaeaa <image> aeaa <image> aaa <image> aa <image> a.
Tags: implementation
Correct Solution:
```
n = int(input())
s = input()
counter = 1
myList = ["a", "e", "i", "o", "u", "y"]
counter = 0
for i in range(0, len(s) - 1):
if s[counter] in myList and s[counter + 1] in myList:
s = s[:(counter + 1)] + s[(counter + 2):]
else:
counter += 1
print(s)
```
| 40,929
|
[
0.150390625,
-0.050262451171875,
-0.318603515625,
0.36279296875,
-0.6123046875,
-0.40380859375,
-0.2020263671875,
-0.283447265625,
0.1524658203125,
0.70751953125,
0.35205078125,
-0.288818359375,
0.1553955078125,
-0.77197265625,
-0.472900390625,
-0.10699462890625,
-0.8955078125,
-0.72265625,
-0.70751953125,
-0.376220703125,
0.415771484375,
-0.213623046875,
-1.392578125,
-0.1614990234375,
-0.384765625,
0.7783203125,
0.130126953125,
-0.10736083984375,
1.048828125,
1.0693359375,
-0.3115234375,
-0.0936279296875,
0.44287109375,
-0.7978515625,
-0.42578125,
-0.58984375,
0.30908203125,
-0.6171875,
-0.47607421875,
-0.419677734375,
0.63623046875,
-0.353515625,
0.1934814453125,
-0.90625,
-1.203125,
-0.4033203125,
-0.60595703125,
-0.5048828125,
0.0275421142578125,
-0.2064208984375,
0.032562255859375,
-0.70947265625,
0.5458984375,
-0.1702880859375,
0.005725860595703125,
-0.2257080078125,
-0.238525390625,
0.2296142578125,
-0.80517578125,
-0.2117919921875,
0.1885986328125,
0.58447265625,
-0.291259765625,
-0.62060546875,
-0.401123046875,
0.3134765625,
-0.135009765625,
0.06805419921875,
-0.0567626953125,
-0.379150390625,
-0.236083984375,
0.40869140625,
-0.37744140625,
-0.326416015625,
-0.7353515625,
0.00385284423828125,
0.2149658203125,
-0.1373291015625,
-0.7255859375,
0.7919921875,
-0.06683349609375,
0.78759765625,
0.42578125,
0.4443359375,
-0.453125,
-0.6416015625,
0.1334228515625,
0.2244873046875,
0.6142578125,
-0.09307861328125,
-0.251953125,
0.4443359375,
-0.7470703125,
0.0472412109375,
0.81982421875,
0.7138671875,
-0.240966796875,
0.08758544921875,
0.62646484375,
-0.14697265625,
0.83154296875,
0.78759765625,
-0.3671875,
0.8388671875,
-0.60400390625,
-0.1314697265625,
0.264404296875,
0.0826416015625,
-0.28173828125,
-0.41943359375,
-0.09228515625,
-0.10150146484375,
0.182861328125,
0.6240234375,
-0.13671875,
1.306640625,
0.0755615234375,
0.392822265625,
-0.89501953125,
0.04290771484375,
0.228271484375,
0.11175537109375,
0.40478515625,
0.0007424354553222656,
0.195068359375,
-0.39208984375,
-0.5224609375,
1.0029296875,
-0.7080078125,
-0.08013916015625,
0.352783203125,
-0.0234832763671875,
-0.1619873046875,
0.2333984375,
-0.1328125,
0.72021484375,
-0.455322265625,
0.8310546875,
0.6083984375,
-0.67822265625,
1.0634765625,
-0.322509765625,
-0.08868408203125,
1.4287109375,
0.455810546875,
-0.03619384765625,
0.64599609375,
0.75927734375,
-0.86328125,
0.5029296875,
-1.2021484375,
1.1376953125,
0.190673828125,
0.1622314453125,
-0.69189453125,
0.2327880859375,
0.050872802734375,
-0.0615234375,
0.3642578125,
-0.07611083984375,
-0.58544921875,
0.1561279296875,
-0.4287109375,
0.96533203125,
-0.460693359375,
0.8671875,
-0.53369140625,
-0.24169921875,
-0.24072265625,
-0.5322265625,
0.41552734375,
-0.144287109375,
-0.345947265625,
0.89306640625,
0.54736328125,
1.23046875,
1.060546875,
-0.3798828125,
0.10650634765625,
0.115234375,
-0.341552734375,
0.18212890625,
0.1702880859375,
0.57763671875,
0.3876953125,
0.305419921875,
0.250244140625,
-0.4228515625,
-0.5068359375,
-0.38232421875,
-0.1531982421875,
0.689453125,
-0.470703125,
0.084228515625,
0.1407470703125,
0.1014404296875,
-0.87060546875,
0.01290130615234375,
0.11395263671875,
-0.982421875,
-0.183349609375,
0.69140625,
-0.265380859375,
0.434326171875,
0.053619384765625,
-0.41796875,
0.4873046875,
0.984375,
-0.5224609375,
0.50390625,
0.406982421875,
0.09686279296875,
-0.8671875,
0.0271453857421875,
0.55810546875,
-0.1513671875,
-0.334716796875,
0.77587890625,
-0.6142578125,
0.0675048828125,
-0.034271240234375,
0.669921875,
0.4404296875,
0.642578125,
-0.1680908203125,
-0.3818359375,
0.5927734375,
1.19140625,
0.0089111328125,
0.701171875,
0.07293701171875,
0.888671875,
0.65087890625,
0.396484375,
0.41650390625,
-0.1573486328125,
0.54296875,
0.97509765625,
-0.11083984375,
0.3134765625,
0.2958984375,
0.443603515625,
0.57666015625,
1.0234375,
-0.205810546875,
0.297607421875,
-0.1707763671875,
-0.135498046875,
-0.57568359375,
0.5205078125,
-0.197021484375,
0.6455078125,
0.1939697265625,
0.51708984375,
-0.64404296875,
-0.4638671875,
0.00406646728515625,
0.76220703125,
-0.7490234375,
-0.8359375,
0.1834716796875,
0.01113128662109375,
0.2958984375,
-0.08392333984375,
0.053070068359375,
0.5625,
0.533203125,
0.671875,
-0.3623046875,
-0.77685546875,
-0.7060546875,
-0.94189453125,
-1.0068359375,
-0.385986328125,
-0.57373046875,
-0.0404052734375,
0.2039794921875,
-0.8818359375,
0.591796875,
-0.1749267578125,
-0.4072265625,
-0.11419677734375,
-0.5400390625,
0.83935546875,
-0.3388671875,
0.712890625,
-0.99365234375,
0.43798828125,
0.328857421875,
0.93359375,
-0.256103515625,
-0.3740234375,
-0.418701171875,
-0.97021484375,
0.2088623046875,
0.2078857421875,
0.48828125,
0.185302734375,
-0.7431640625,
-1.001953125,
-0.6572265625,
-0.1656494140625,
-0.544921875,
0.298095703125,
-0.1732177734375,
1.017578125,
0.06646728515625,
-0.47412109375,
0.51025390625,
0.953125,
-1.20703125,
0.60888671875,
0.2230224609375,
0.425048828125,
-0.87890625,
1.28515625,
0.331298828125,
0.480712890625,
-0.98193359375,
-0.4716796875,
-0.7021484375,
0.277587890625,
0.2015380859375,
-0.9775390625,
-0.39697265625,
0.79052734375,
-0.138671875,
-1.0400390625,
0.447998046875,
-1.4443359375,
-0.71044921875,
-0.411376953125,
-0.472900390625,
1.1630859375,
1.3203125,
0.324462890625,
-0.2235107421875,
-0.28857421875,
-0.38427734375,
0.64404296875,
0.748046875,
-0.734375,
0.1500244140625,
0.88623046875,
0.0250396728515625,
0.26953125,
0.418701171875,
-0.62890625,
-0.291015625,
0.40478515625,
0.038360595703125,
0.64111328125,
0.1932373046875,
0.228271484375,
0.08026123046875,
0.673828125,
-0.8251953125,
-0.31005859375,
0.08807373046875,
0.865234375,
0.2822265625,
0.640625,
0.093017578125,
-0.4833984375,
-0.57373046875,
-0.7783203125,
0.320068359375,
0.22998046875,
0.84814453125,
-0.427734375,
0.48583984375,
0.44775390625,
-0.7783203125,
0.54638671875,
-0.736328125,
-0.15087890625,
1.3251953125,
0.01837158203125,
0.79296875,
-0.480224609375,
0.388671875,
0.058380126953125,
-0.2440185546875,
0.275146484375,
0.18896484375,
0.424072265625,
-0.68994140625,
-0.34228515625,
-0.1248779296875,
0.0635986328125,
-0.43505859375,
-0.370849609375,
0.173583984375,
-0.2099609375,
-0.16259765625,
-0.91015625,
0.3369140625,
0.64453125,
0.220947265625,
0.330078125,
0.59765625,
0.061737060546875,
0.6357421875,
0.7626953125,
-0.025238037109375,
0.297119140625,
-0.89404296875,
0.33203125,
0.1693115234375,
-0.5048828125,
-0.39306640625,
-0.383056640625,
-0.465087890625,
0.057525634765625,
0.19580078125,
-0.2430419921875,
-0.86572265625,
-0.068603515625,
-0.10162353515625,
0.2998046875,
-0.8837890625,
-0.2479248046875,
-0.52880859375,
0.43408203125,
0.302001953125,
-0.79248046875,
0.393798828125,
-1.083984375,
0.55810546875,
0.48046875,
-0.134521484375,
-0.303955078125,
-0.416015625,
-0.5166015625,
-0.52685546875,
-0.045562744140625,
0.060943603515625,
0.404541015625,
0.296630859375,
-1.3662109375,
0.53857421875,
0.51171875,
-0.5068359375,
0.298095703125,
-0.096923828125,
0.6875,
0.53173828125,
0.9423828125,
-0.4697265625,
-0.319580078125,
0.2861328125,
-1.3544921875,
0.93359375,
-0.74951171875,
0.7626953125,
-0.04827880859375,
-0.252685546875,
0.06982421875,
0.4619140625,
-0.4921875,
-0.19580078125,
-0.251708984375,
0.4482421875,
-0.75048828125,
-0.779296875,
0.513671875,
0.242431640625,
-0.1602783203125,
0.25244140625,
-0.09661865234375,
0.0173492431640625,
0.25830078125,
0.448486328125,
-0.364501953125,
0.2159423828125,
-0.69970703125,
0.470947265625,
-0.2164306640625,
-0.80322265625,
-0.13916015625,
-0.54296875,
0.3115234375,
-0.127197265625,
-1.1533203125,
-0.16259765625,
-1.3544921875,
-0.12371826171875,
0.07073974609375,
-0.80224609375,
0.00218963623046875,
0.51806640625,
0.295166015625,
-0.400390625,
-0.37890625,
-0.69482421875,
-0.32958984375,
-0.57470703125,
-0.491455078125,
0.213134765625,
0.76513671875,
0.9658203125,
-0.317138671875,
-0.09381103515625,
-0.057281494140625,
0.027923583984375,
-0.30810546875,
-0.703125,
-0.425537109375,
-0.35107421875,
-0.443359375,
0.016265869140625,
0.8583984375,
0.031585693359375,
0.51513671875,
1.0234375,
-0.291748046875,
0.1282958984375,
-0.1768798828125,
-0.56787109375,
1.0595703125,
-0.0283203125,
-1.2431640625,
-0.421875,
0.28515625,
0.1761474609375,
0.73583984375,
0.1414794921875,
-0.68505859375,
-0.5986328125,
-1.0439453125,
-0.193115234375,
-0.6826171875,
-0.3203125,
-0.93603515625,
-0.420654296875,
-0.354248046875,
0.54541015625,
-0.1644287109375,
-0.8251953125,
0.2071533203125,
-0.8935546875,
0.361572265625,
-0.66357421875,
-0.4072265625,
-0.56787109375,
-0.86669921875,
0.1221923828125,
0.82080078125,
-0.23388671875,
0.349853515625,
0.1904296875,
-0.2109375,
0.3095703125,
-0.229736328125,
-0.9921875,
-0.44287109375,
0.113037109375,
0.3486328125,
-0.11151123046875,
0.003398895263671875,
-0.5419921875,
0.85546875,
-0.92822265625,
0.369873046875,
-0.1605224609375,
-0.47705078125,
0.04803466796875,
-0.34912109375,
0.78564453125,
-0.422607421875,
-0.03399658203125,
-0.67529296875,
0.364013671875,
0.60107421875,
-0.23388671875,
-0.4775390625,
-0.83740234375,
-0.67041015625,
-0.75439453125,
0.724609375,
-0.7802734375,
0.337890625,
-0.3388671875,
-0.1231689453125,
1.1015625,
-0.29931640625,
0.14697265625,
1.240234375,
0.320068359375,
0.5576171875,
-0.75634765625,
1.0068359375,
0.252685546875,
-0.425048828125,
-0.192138671875,
0.275634765625,
-1.0146484375,
0.42578125,
-0.457275390625,
-0.90625,
-0.3271484375,
0.1817626953125,
1.6015625,
-0.4140625,
0.7744140625,
-0.06298828125,
-0.76025390625,
-0.63720703125,
1.0380859375,
0.462646484375,
-0.074951171875,
1.0419921875,
0.158447265625,
0.026580810546875,
0.250244140625,
-0.177001953125,
-0.431396484375,
-0.1595458984375,
0.69287109375,
-0.1492919921875,
-0.5908203125,
0.99365234375,
0.8291015625,
-1.1044921875,
-1.04296875,
0.1842041015625,
-0.177978515625,
-0.499755859375,
-0.72021484375,
0.42919921875,
1.00390625,
-0.66455078125,
0.0537109375,
0.63232421875,
-0.291259765625,
0.548828125,
0.04559326171875,
0.27978515625,
-0.564453125,
0.79296875,
0.68505859375,
-1.013671875,
-0.169189453125,
-0.98291015625,
-0.163818359375,
-0.10516357421875,
0.129150390625,
0.611328125,
-0.29150390625,
-0.10321044921875,
0.7314453125,
-0.489990234375,
0.55126953125,
-0.796875,
-0.6962890625,
0.310546875,
-0.478759765625,
-0.853515625,
0.045989990234375,
0.5302734375,
-0.257568359375,
0.359130859375,
-0.45849609375,
-0.10174560546875,
0.4033203125,
0.341796875,
-0.6064453125,
-0.88330078125,
-0.26220703125,
-0.73388671875,
-0.6220703125,
-0.68408203125,
-0.072265625,
-0.41943359375,
0.327392578125,
0.1314697265625,
-0.394775390625,
0.03631591796875,
0.2039794921875,
-0.84619140625,
0.5390625,
-0.296875,
0.60791015625,
-0.61767578125,
-0.2471923828125,
-0.44921875,
0.006458282470703125,
-0.666015625,
-0.2293701171875,
-0.50537109375,
0.317138671875,
-0.2491455078125,
0.493408203125,
-0.0699462890625,
0.79638671875,
-0.1949462890625,
-0.5087890625,
0.099853515625,
-0.07696533203125,
-0.2169189453125,
0.88525390625,
0.71923828125,
-0.056884765625,
0.43994140625,
-0.1572265625,
-0.31884765625,
-0.0870361328125,
0.423828125,
0.480224609375,
-0.6005859375,
-0.1409912109375,
-0.49951171875,
-0.0165863037109375,
-0.84716796875,
-0.00023674964904785156,
-0.26220703125,
0.70361328125,
0.0782470703125,
-0.2166748046875,
0.411865234375,
1.1982421875,
-0.08648681640625,
0.132568359375,
-0.094482421875,
0.179931640625,
0.5283203125,
0.06549072265625,
-0.03515625,
0.18359375,
0.330810546875,
-0.292236328125,
-0.061981201171875,
0.78466796875,
-0.04840087890625,
0.59326171875,
-0.18359375,
-0.75390625,
-0.79345703125,
-0.02117919921875,
-0.00982666015625,
0.364990234375,
0.181640625,
-0.4990234375,
0.1011962890625,
0.178466796875,
-0.876953125,
0.251953125,
-1.0634765625,
-0.7099609375,
0.3984375,
-0.37890625,
-0.2066650390625,
-0.2705078125,
-0.6845703125,
-0.16943359375,
0.1893310546875,
0.462890625,
-0.626953125,
0.494140625,
0.1043701171875,
0.5439453125,
-0.1112060546875,
-0.1376953125,
-0.148193359375,
0.0018796920776367188,
-0.4228515625,
-0.68603515625,
0.580078125,
1.1181640625,
0.1861572265625,
0.0121612548828125,
-0.615234375,
0.50732421875,
-0.28076171875,
0.244384765625,
-0.0279541015625,
0.395263671875,
-0.468505859375,
0.42724609375,
-1.0302734375,
0.1531982421875,
-0.11181640625,
0.46044921875,
0.268798828125,
-0.2003173828125,
-0.283935546875,
0.91357421875,
0.63134765625,
-0.333984375,
0.048095703125,
0.284912109375,
0.489990234375,
-0.380859375,
-0.1279296875,
-0.2685546875,
0.79443359375,
0.314697265625,
0.37109375,
-0.224365234375,
0.6708984375,
0.78466796875,
0.08331298828125,
0.01641845703125,
0.68994140625,
0.15478515625,
-0.2144775390625,
-0.0034122467041015625,
-0.50927734375,
-0.51220703125,
-0.0031375885009765625,
-0.286865234375,
0.61474609375,
-0.1492919921875,
0.27587890625,
-0.0264129638671875,
-0.7958984375,
0.89697265625,
0.078125,
-0.0775146484375,
0.00640869140625,
-0.64208984375,
0.27587890625,
1.005859375,
0.1690673828125,
-0.0224761962890625,
0.59912109375,
0.86181640625,
0.61376953125,
0.5224609375,
0.59423828125,
0.51220703125,
-0.39794921875,
0.026702880859375,
-0.036529541015625,
0.0048675537109375,
-0.259033203125,
-0.4775390625,
-1.3173828125,
0.3310546875,
-0.71923828125,
-0.310791015625,
0.962890625,
-0.82080078125,
-0.0164642333984375,
-0.37451171875,
0.654296875,
-0.31787109375,
0.533203125,
0.6240234375,
-0.4560546875,
-0.6982421875,
1.021484375,
-0.12213134765625,
0.646484375,
0.04132080078125,
1.2880859375,
-0.06787109375,
0.9384765625,
0.271240234375,
-0.1768798828125,
-0.08099365234375,
0.280029296875,
-0.36474609375,
-0.70703125,
-0.33154296875,
-0.442626953125,
0.267333984375,
-0.443115234375,
-0.5810546875,
-0.0850830078125,
0.8134765625,
-0.269775390625,
-1.21875,
-0.31982421875,
0.0972900390625,
-0.43505859375,
0.79150390625,
0.11846923828125,
-0.1436767578125,
0.001495361328125,
-0.2198486328125,
0.039520263671875,
-0.359375,
0.1654052734375,
-0.33740234375,
0.45654296875,
-0.74853515625,
-0.4169921875,
-0.927734375,
-0.411376953125,
-0.434326171875,
0.0265350341796875,
-0.408447265625,
-0.7626953125,
0.314697265625,
0.214599609375,
0.344970703125,
0.314453125,
-0.10552978515625,
0.54248046875,
1.4013671875,
0.84326171875,
0.002532958984375,
1.23046875,
0.24658203125,
-0.5244140625,
0.4619140625,
-0.69580078125,
0.8408203125,
-0.0270538330078125,
0.218994140625,
-0.1993408203125,
0.182861328125,
-0.42626953125,
-0.88427734375,
0.2430419921875,
0.92626953125,
0.1875,
-0.61865234375,
-1.2060546875,
-0.03607177734375,
-0.9833984375,
-0.2264404296875,
-0.72314453125,
0.89892578125,
0.273193359375,
-0.03277587890625,
-0.31201171875,
-1.0625,
4.23046875,
0.8427734375,
1.1845703125,
0.56005859375,
0.233642578125,
1.2001953125,
0.461181640625,
-0.1907958984375,
-0.26025390625,
-0.56640625,
0.52294921875,
-0.65185546875,
-0.019195556640625,
0.580078125,
0.3623046875,
0.1558837890625,
-0.38525390625,
0.337890625,
0.391845703125,
-0.56884765625,
-0.93017578125,
0.246337890625,
0.373779296875,
0.62841796875,
-0.0105438232421875,
0.408203125,
0.607421875,
-0.316162109375,
-0.1607666015625,
-1.0390625,
0.1396484375,
-0.61083984375,
0.82568359375,
0.00327301025390625,
-0.1024169921875,
0.68798828125,
-0.2340087890625,
-0.576171875,
-0.53759765625,
0.276611328125,
-0.4326171875,
-0.1407470703125,
0.435546875,
-0.7109375,
0.089599609375,
0.426025390625,
-0.408203125,
0.326416015625,
0.54296875,
-0.9033203125,
1.0546875,
-0.2890625,
0.52783203125,
-0.912109375,
-0.25048828125,
0.28662109375,
0.0634765625,
0.07867431640625,
-0.321533203125,
0.435791015625,
0.374755859375,
0.37255859375,
-0.1363525390625,
0.75732421875,
-1.1708984375,
0.43603515625,
-0.244384765625,
0.5263671875,
-0.67529296875,
-0.35986328125,
-0.22265625,
0.06732177734375,
0.2354736328125,
-0.1920166015625,
0.4921875,
0.08489990234375,
0.253662109375,
0.73828125,
0.2257080078125,
-0.93359375,
0.098388671875,
-0.10791015625,
-0.37646484375,
-0.56787109375,
0.587890625,
1.328125,
-0.646484375,
-0.29833984375,
-0.3916015625,
1.0087890625,
0.7890625,
0.62744140625,
0.292724609375,
-0.5283203125,
-0.297119140625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange.
Victor thinks that if a word contains two consecutive vowels, then it's kinda weird and it needs to be replaced. So the word corrector works in such a way: as long as there are two consecutive vowels in the word, it deletes the first vowel in a word such that there is another vowel right before it. If there are no two consecutive vowels in the word, it is considered to be correct.
You are given a word s. Can you predict what will it become after correction?
In this problem letters a, e, i, o, u and y are considered to be vowels.
Input
The first line contains one integer n (1 ≤ n ≤ 100) — the number of letters in word s before the correction.
The second line contains a string s consisting of exactly n lowercase Latin letters — the word before the correction.
Output
Output the word s after the correction.
Examples
Input
5
weird
Output
werd
Input
4
word
Output
word
Input
5
aaeaa
Output
a
Note
Explanations of the examples:
1. There is only one replace: weird <image> werd;
2. No replace needed since there are no two consecutive vowels;
3. aaeaa <image> aeaa <image> aaa <image> aa <image> a.
Tags: implementation
Correct Solution:
```
#This code sucks, you know it and I know it.
#Move on and call me an idiot later.
n = int(input())
s = input()
ans = []
temp = 0
for i in s:
if i in 'aeiouy':
if temp == 0:
temp = 1
ans += [i]
else:
temp = 0
ans += [i]
print("".join(ans))
```
| 40,930
|
[
0.273681640625,
-0.035064697265625,
-0.341552734375,
0.436767578125,
-0.6181640625,
-0.42041015625,
-0.18603515625,
-0.30029296875,
0.18994140625,
0.7294921875,
0.395263671875,
-0.2958984375,
0.1488037109375,
-0.79541015625,
-0.465576171875,
-0.130859375,
-0.85498046875,
-0.72705078125,
-0.68896484375,
-0.41845703125,
0.362548828125,
-0.2098388671875,
-1.4111328125,
-0.14111328125,
-0.388916015625,
0.84326171875,
0.180908203125,
-0.07421875,
1.005859375,
1.052734375,
-0.38916015625,
-0.08966064453125,
0.4287109375,
-0.775390625,
-0.427490234375,
-0.52734375,
0.349853515625,
-0.63330078125,
-0.497314453125,
-0.329345703125,
0.65185546875,
-0.32763671875,
0.220703125,
-0.888671875,
-1.1767578125,
-0.388916015625,
-0.63427734375,
-0.421630859375,
-0.0148468017578125,
-0.27880859375,
0.049102783203125,
-0.7138671875,
0.53662109375,
-0.19091796875,
0.0582275390625,
-0.261962890625,
-0.271728515625,
0.259033203125,
-0.830078125,
-0.227294921875,
0.12469482421875,
0.5791015625,
-0.36181640625,
-0.6689453125,
-0.426025390625,
0.29345703125,
-0.2276611328125,
0.161865234375,
-0.1185302734375,
-0.328857421875,
-0.1776123046875,
0.426513671875,
-0.441650390625,
-0.293701171875,
-0.74169921875,
-0.01043701171875,
0.1571044921875,
-0.11077880859375,
-0.8017578125,
0.806640625,
-0.0692138671875,
0.8369140625,
0.48193359375,
0.434326171875,
-0.416015625,
-0.6982421875,
0.07281494140625,
0.322265625,
0.6064453125,
-0.08612060546875,
-0.28515625,
0.45458984375,
-0.78857421875,
0.005153656005859375,
0.87158203125,
0.7578125,
-0.190673828125,
0.061553955078125,
0.587890625,
-0.182861328125,
0.91943359375,
0.8662109375,
-0.330078125,
0.8369140625,
-0.62890625,
-0.171142578125,
0.239990234375,
0.0855712890625,
-0.251953125,
-0.379638671875,
-0.1365966796875,
-0.1160888671875,
0.27880859375,
0.59423828125,
-0.1666259765625,
1.28515625,
0.11968994140625,
0.288818359375,
-0.873046875,
-0.002254486083984375,
0.19677734375,
-0.006687164306640625,
0.4033203125,
0.03546142578125,
0.272216796875,
-0.41796875,
-0.46826171875,
1.0361328125,
-0.63134765625,
-0.0792236328125,
0.35009765625,
-0.0299224853515625,
-0.1104736328125,
0.175537109375,
-0.163818359375,
0.74609375,
-0.41943359375,
0.828125,
0.5263671875,
-0.697265625,
1.0673828125,
-0.348388671875,
-0.0230865478515625,
1.4384765625,
0.470458984375,
-0.05780029296875,
0.64794921875,
0.65966796875,
-0.900390625,
0.5634765625,
-1.2314453125,
1.0986328125,
0.172119140625,
0.0762939453125,
-0.7978515625,
0.197998046875,
0.111083984375,
0.01334381103515625,
0.405029296875,
0.01739501953125,
-0.4873046875,
0.1942138671875,
-0.432373046875,
0.98291015625,
-0.48291015625,
0.88623046875,
-0.56787109375,
-0.267822265625,
-0.284912109375,
-0.560546875,
0.498291015625,
-0.133056640625,
-0.27587890625,
0.9189453125,
0.50537109375,
1.21484375,
1.0732421875,
-0.43798828125,
0.05303955078125,
0.1676025390625,
-0.33154296875,
0.1478271484375,
0.1690673828125,
0.56201171875,
0.4189453125,
0.309814453125,
0.29345703125,
-0.409912109375,
-0.476318359375,
-0.3310546875,
-0.1513671875,
0.72216796875,
-0.54345703125,
0.151611328125,
0.08453369140625,
0.04412841796875,
-0.90625,
-0.050689697265625,
0.10638427734375,
-1.0498046875,
-0.247314453125,
0.7060546875,
-0.357177734375,
0.42138671875,
0.039886474609375,
-0.505859375,
0.458251953125,
1.046875,
-0.47900390625,
0.515625,
0.436767578125,
0.081298828125,
-0.86083984375,
0.03729248046875,
0.5361328125,
-0.183349609375,
-0.379638671875,
0.7919921875,
-0.67333984375,
0.04132080078125,
0.0400390625,
0.673828125,
0.4638671875,
0.662109375,
-0.139404296875,
-0.352294921875,
0.603515625,
1.20703125,
0.0222015380859375,
0.68359375,
0.14111328125,
0.875,
0.69189453125,
0.4130859375,
0.40576171875,
-0.2005615234375,
0.5908203125,
1.0185546875,
-0.1580810546875,
0.3505859375,
0.292724609375,
0.468994140625,
0.56494140625,
1.05859375,
-0.254638671875,
0.2822265625,
-0.1827392578125,
-0.1385498046875,
-0.5498046875,
0.437744140625,
-0.153076171875,
0.625,
0.272705078125,
0.451171875,
-0.6884765625,
-0.50537109375,
0.05877685546875,
0.79296875,
-0.74609375,
-0.82177734375,
0.10870361328125,
-0.006542205810546875,
0.186767578125,
-0.07672119140625,
0.07525634765625,
0.58642578125,
0.477783203125,
0.64306640625,
-0.373779296875,
-0.7333984375,
-0.79638671875,
-0.94873046875,
-1.041015625,
-0.37744140625,
-0.6025390625,
-0.0154876708984375,
0.1474609375,
-0.87158203125,
0.6650390625,
-0.173095703125,
-0.458984375,
-0.07513427734375,
-0.57666015625,
0.841796875,
-0.301025390625,
0.72119140625,
-1.0224609375,
0.5185546875,
0.31689453125,
0.86376953125,
-0.225341796875,
-0.44482421875,
-0.4150390625,
-0.95458984375,
0.15185546875,
0.21142578125,
0.55810546875,
0.1829833984375,
-0.80224609375,
-0.98486328125,
-0.65380859375,
-0.1417236328125,
-0.603515625,
0.34130859375,
-0.2110595703125,
0.98486328125,
0.03656005859375,
-0.44873046875,
0.56201171875,
0.9580078125,
-1.240234375,
0.685546875,
0.255126953125,
0.45947265625,
-0.91455078125,
1.3759765625,
0.3544921875,
0.51171875,
-0.93603515625,
-0.431884765625,
-0.6240234375,
0.341064453125,
0.1180419921875,
-0.98681640625,
-0.415771484375,
0.759765625,
-0.1136474609375,
-1.080078125,
0.3974609375,
-1.4833984375,
-0.71240234375,
-0.47705078125,
-0.50830078125,
1.2314453125,
1.2236328125,
0.324462890625,
-0.30029296875,
-0.310546875,
-0.4150390625,
0.59521484375,
0.71337890625,
-0.80078125,
0.15966796875,
0.8447265625,
0.0031642913818359375,
0.2178955078125,
0.48876953125,
-0.65576171875,
-0.342529296875,
0.3515625,
0.061309814453125,
0.6435546875,
0.1495361328125,
0.223388671875,
0.026824951171875,
0.7392578125,
-0.86376953125,
-0.359130859375,
0.07598876953125,
0.740234375,
0.294921875,
0.61962890625,
0.11285400390625,
-0.56103515625,
-0.60400390625,
-0.763671875,
0.375,
0.20068359375,
0.9443359375,
-0.372314453125,
0.450927734375,
0.46728515625,
-0.82470703125,
0.58984375,
-0.73779296875,
-0.1513671875,
1.33984375,
0.07000732421875,
0.70166015625,
-0.50244140625,
0.375732421875,
0.0517578125,
-0.28857421875,
0.406494140625,
0.1341552734375,
0.46435546875,
-0.7685546875,
-0.439697265625,
-0.1368408203125,
0.041748046875,
-0.330078125,
-0.380859375,
0.135009765625,
-0.25732421875,
-0.0997314453125,
-0.9541015625,
0.39453125,
0.61083984375,
0.1812744140625,
0.408203125,
0.6064453125,
0.00580596923828125,
0.6298828125,
0.7490234375,
-0.068603515625,
0.275634765625,
-0.8603515625,
0.380615234375,
0.2103271484375,
-0.5234375,
-0.378662109375,
-0.39453125,
-0.416748046875,
0.029327392578125,
0.136474609375,
-0.2301025390625,
-0.83935546875,
-0.03729248046875,
-0.11279296875,
0.380859375,
-0.859375,
-0.295166015625,
-0.53369140625,
0.43212890625,
0.186279296875,
-0.8203125,
0.4423828125,
-1.0419921875,
0.6416015625,
0.489501953125,
-0.05682373046875,
-0.28759765625,
-0.33544921875,
-0.482421875,
-0.56591796875,
-0.0323486328125,
0.07672119140625,
0.337158203125,
0.261474609375,
-1.337890625,
0.5029296875,
0.525390625,
-0.473388671875,
0.3232421875,
-0.13037109375,
0.6953125,
0.4833984375,
0.986328125,
-0.44970703125,
-0.28955078125,
0.2371826171875,
-1.294921875,
0.99169921875,
-0.79736328125,
0.69775390625,
-0.06524658203125,
-0.20263671875,
0.1329345703125,
0.460205078125,
-0.450927734375,
-0.183837890625,
-0.2117919921875,
0.480224609375,
-0.7431640625,
-0.78515625,
0.50048828125,
0.2261962890625,
-0.1376953125,
0.275634765625,
-0.0148773193359375,
0.09185791015625,
0.2900390625,
0.480224609375,
-0.368896484375,
0.223876953125,
-0.73681640625,
0.483642578125,
-0.2144775390625,
-0.76806640625,
-0.1265869140625,
-0.51611328125,
0.32861328125,
-0.096923828125,
-1.158203125,
-0.1788330078125,
-1.41796875,
-0.1671142578125,
0.08221435546875,
-0.66845703125,
0.05999755859375,
0.4990234375,
0.29345703125,
-0.415283203125,
-0.50341796875,
-0.7158203125,
-0.33837890625,
-0.556640625,
-0.54052734375,
0.2259521484375,
0.7255859375,
1.0087890625,
-0.3154296875,
-0.11865234375,
0.0146331787109375,
0.01161956787109375,
-0.310546875,
-0.69482421875,
-0.407958984375,
-0.391357421875,
-0.4609375,
0.0205078125,
0.837890625,
0.04986572265625,
0.5068359375,
1.0576171875,
-0.2587890625,
0.1973876953125,
-0.2259521484375,
-0.58544921875,
1.142578125,
-0.0526123046875,
-1.28515625,
-0.423095703125,
0.288818359375,
0.2322998046875,
0.8134765625,
0.177978515625,
-0.75634765625,
-0.61865234375,
-1.0244140625,
-0.12744140625,
-0.73779296875,
-0.3095703125,
-0.92333984375,
-0.438720703125,
-0.329345703125,
0.6064453125,
-0.200439453125,
-0.85498046875,
0.227783203125,
-0.8564453125,
0.359619140625,
-0.767578125,
-0.341552734375,
-0.5537109375,
-0.8154296875,
0.054290771484375,
0.8330078125,
-0.2464599609375,
0.324462890625,
0.164794921875,
-0.28515625,
0.3427734375,
-0.2469482421875,
-0.97216796875,
-0.438720703125,
0.087646484375,
0.358642578125,
-0.044830322265625,
0.057708740234375,
-0.55078125,
0.88037109375,
-0.94482421875,
0.390380859375,
-0.1785888671875,
-0.43505859375,
0.0118255615234375,
-0.342529296875,
0.7763671875,
-0.483154296875,
0.0166015625,
-0.68212890625,
0.325439453125,
0.70361328125,
-0.2763671875,
-0.58740234375,
-0.84326171875,
-0.5419921875,
-0.7333984375,
0.7802734375,
-0.78466796875,
0.342041015625,
-0.328857421875,
-0.08758544921875,
1.0888671875,
-0.30224609375,
0.16162109375,
1.2490234375,
0.39208984375,
0.57470703125,
-0.7646484375,
1.01953125,
0.299072265625,
-0.423583984375,
-0.1907958984375,
0.222900390625,
-0.97119140625,
0.384033203125,
-0.468505859375,
-0.8134765625,
-0.3876953125,
0.173583984375,
1.658203125,
-0.4267578125,
0.787109375,
-0.050445556640625,
-0.84033203125,
-0.6279296875,
1.052734375,
0.5283203125,
-0.09783935546875,
1.046875,
0.18701171875,
-0.038970947265625,
0.302490234375,
-0.2220458984375,
-0.4921875,
-0.182373046875,
0.72607421875,
-0.072509765625,
-0.58056640625,
0.962890625,
0.8720703125,
-1.1748046875,
-1.0810546875,
0.1456298828125,
-0.2408447265625,
-0.544921875,
-0.69580078125,
0.445556640625,
0.97412109375,
-0.74462890625,
0.0679931640625,
0.64990234375,
-0.25390625,
0.525390625,
0.097412109375,
0.34619140625,
-0.55078125,
0.8876953125,
0.67529296875,
-1.0517578125,
-0.11663818359375,
-1.033203125,
-0.1539306640625,
-0.037689208984375,
0.1431884765625,
0.56103515625,
-0.3330078125,
-0.126953125,
0.74560546875,
-0.537109375,
0.54296875,
-0.826171875,
-0.67724609375,
0.292236328125,
-0.498779296875,
-0.85986328125,
0.050048828125,
0.53271484375,
-0.255859375,
0.34228515625,
-0.49169921875,
-0.0899658203125,
0.39892578125,
0.27587890625,
-0.607421875,
-0.80322265625,
-0.305908203125,
-0.74658203125,
-0.6689453125,
-0.66748046875,
-0.13037109375,
-0.464111328125,
0.274658203125,
0.2039794921875,
-0.439697265625,
-0.00830841064453125,
0.176513671875,
-0.7666015625,
0.560546875,
-0.306884765625,
0.6240234375,
-0.71240234375,
-0.2176513671875,
-0.46044921875,
-0.057220458984375,
-0.76025390625,
-0.2003173828125,
-0.5654296875,
0.289794921875,
-0.27734375,
0.484619140625,
-0.05023193359375,
0.76220703125,
-0.2000732421875,
-0.482421875,
0.1715087890625,
0.0070037841796875,
-0.25390625,
0.8564453125,
0.67138671875,
-0.042694091796875,
0.372314453125,
-0.206787109375,
-0.293701171875,
-0.08575439453125,
0.417724609375,
0.46240234375,
-0.485595703125,
-0.157958984375,
-0.45361328125,
0.00928497314453125,
-0.86328125,
0.03631591796875,
-0.222412109375,
0.7119140625,
0.1456298828125,
-0.267333984375,
0.41259765625,
1.212890625,
-0.040252685546875,
0.159423828125,
-0.14501953125,
0.198486328125,
0.5732421875,
0.0010976791381835938,
-0.00855255126953125,
0.2005615234375,
0.309814453125,
-0.298828125,
-0.021514892578125,
0.78759765625,
-0.0631103515625,
0.55517578125,
-0.12493896484375,
-0.82177734375,
-0.84423828125,
0.07122802734375,
-0.07232666015625,
0.364990234375,
0.2188720703125,
-0.51025390625,
0.1416015625,
0.212158203125,
-0.8974609375,
0.286376953125,
-1.0234375,
-0.6630859375,
0.4013671875,
-0.37548828125,
-0.2440185546875,
-0.279052734375,
-0.64208984375,
-0.161865234375,
0.1431884765625,
0.50439453125,
-0.544921875,
0.446044921875,
0.1015625,
0.52783203125,
-0.1751708984375,
-0.0816650390625,
-0.144287109375,
0.06634521484375,
-0.447998046875,
-0.69580078125,
0.640625,
1.130859375,
0.2021484375,
-0.02728271484375,
-0.634765625,
0.57470703125,
-0.22265625,
0.341064453125,
-0.10931396484375,
0.38037109375,
-0.40185546875,
0.406005859375,
-1.0810546875,
0.20751953125,
-0.1923828125,
0.452392578125,
0.36865234375,
-0.225341796875,
-0.2071533203125,
0.89111328125,
0.6162109375,
-0.34130859375,
0.0207366943359375,
0.35498046875,
0.4912109375,
-0.371337890625,
-0.132568359375,
-0.275146484375,
0.802734375,
0.333984375,
0.341064453125,
-0.197509765625,
0.59716796875,
0.84619140625,
0.0570068359375,
-0.02520751953125,
0.689453125,
0.154296875,
-0.3125,
-0.0478515625,
-0.48876953125,
-0.47998046875,
0.003627777099609375,
-0.30322265625,
0.5947265625,
-0.096923828125,
0.279052734375,
-0.005359649658203125,
-0.7392578125,
0.9130859375,
0.04827880859375,
-0.07318115234375,
0.0211639404296875,
-0.5732421875,
0.212890625,
1.0400390625,
0.1607666015625,
-0.007701873779296875,
0.6005859375,
0.90234375,
0.5908203125,
0.55615234375,
0.5673828125,
0.50048828125,
-0.43017578125,
0.0570068359375,
-0.047607421875,
0.01203155517578125,
-0.2342529296875,
-0.46533203125,
-1.3232421875,
0.4033203125,
-0.671875,
-0.28857421875,
0.953125,
-0.771484375,
0.0770263671875,
-0.404052734375,
0.65673828125,
-0.333740234375,
0.52978515625,
0.6298828125,
-0.52001953125,
-0.720703125,
1.0361328125,
-0.12939453125,
0.65478515625,
-0.11236572265625,
1.291015625,
-0.07110595703125,
1.029296875,
0.281494140625,
-0.165771484375,
-0.1502685546875,
0.282470703125,
-0.39990234375,
-0.75244140625,
-0.246826171875,
-0.470703125,
0.3369140625,
-0.4619140625,
-0.654296875,
-0.1119384765625,
0.77587890625,
-0.2216796875,
-1.2470703125,
-0.3291015625,
0.16650390625,
-0.44921875,
0.82421875,
0.072265625,
-0.1561279296875,
0.0391845703125,
-0.199951171875,
-0.02593994140625,
-0.4609375,
0.152099609375,
-0.356201171875,
0.47509765625,
-0.77001953125,
-0.41796875,
-0.93994140625,
-0.328125,
-0.4521484375,
-0.01288604736328125,
-0.447021484375,
-0.7685546875,
0.38232421875,
0.248046875,
0.3623046875,
0.337890625,
-0.1082763671875,
0.451171875,
1.34765625,
0.8662109375,
-0.00630950927734375,
1.25,
0.2484130859375,
-0.5244140625,
0.5,
-0.70458984375,
0.884765625,
-0.0301513671875,
0.171142578125,
-0.1905517578125,
0.20458984375,
-0.44921875,
-0.849609375,
0.271728515625,
0.98681640625,
0.2344970703125,
-0.69189453125,
-1.23046875,
-0.06414794921875,
-1.0185546875,
-0.209716796875,
-0.693359375,
0.935546875,
0.237060546875,
-0.03997802734375,
-0.28125,
-1.0859375,
4.171875,
0.7841796875,
1.2392578125,
0.53515625,
0.2418212890625,
1.1171875,
0.452880859375,
-0.1912841796875,
-0.326416015625,
-0.60546875,
0.576171875,
-0.599609375,
-0.034027099609375,
0.62744140625,
0.379638671875,
0.1639404296875,
-0.373046875,
0.3369140625,
0.31787109375,
-0.55322265625,
-0.87109375,
0.216064453125,
0.37646484375,
0.650390625,
0.0205078125,
0.470458984375,
0.61279296875,
-0.298828125,
-0.16748046875,
-1.021484375,
0.233642578125,
-0.59326171875,
0.85009765625,
0.0115203857421875,
-0.1287841796875,
0.6767578125,
-0.249755859375,
-0.64990234375,
-0.54150390625,
0.2861328125,
-0.478515625,
-0.1337890625,
0.468505859375,
-0.6767578125,
0.11383056640625,
0.404052734375,
-0.341552734375,
0.283447265625,
0.5224609375,
-0.89990234375,
1.009765625,
-0.332763671875,
0.48779296875,
-0.89453125,
-0.2286376953125,
0.355712890625,
0.06256103515625,
0.09722900390625,
-0.303955078125,
0.42041015625,
0.3291015625,
0.306884765625,
-0.1669921875,
0.7607421875,
-1.1640625,
0.462646484375,
-0.283447265625,
0.51611328125,
-0.68408203125,
-0.312744140625,
-0.25927734375,
0.1224365234375,
0.2169189453125,
-0.20751953125,
0.5146484375,
0.061920166015625,
0.253173828125,
0.724609375,
0.275634765625,
-0.927734375,
0.05755615234375,
-0.0251922607421875,
-0.4072265625,
-0.57861328125,
0.537109375,
1.333984375,
-0.61376953125,
-0.30078125,
-0.310791015625,
1.0263671875,
0.77685546875,
0.64111328125,
0.26220703125,
-0.59814453125,
-0.3359375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange.
Victor thinks that if a word contains two consecutive vowels, then it's kinda weird and it needs to be replaced. So the word corrector works in such a way: as long as there are two consecutive vowels in the word, it deletes the first vowel in a word such that there is another vowel right before it. If there are no two consecutive vowels in the word, it is considered to be correct.
You are given a word s. Can you predict what will it become after correction?
In this problem letters a, e, i, o, u and y are considered to be vowels.
Input
The first line contains one integer n (1 ≤ n ≤ 100) — the number of letters in word s before the correction.
The second line contains a string s consisting of exactly n lowercase Latin letters — the word before the correction.
Output
Output the word s after the correction.
Examples
Input
5
weird
Output
werd
Input
4
word
Output
word
Input
5
aaeaa
Output
a
Note
Explanations of the examples:
1. There is only one replace: weird <image> werd;
2. No replace needed since there are no two consecutive vowels;
3. aaeaa <image> aeaa <image> aaa <image> aa <image> a.
Tags: implementation
Correct Solution:
```
import sys
vowel = 'aeiouy'
n = int(input())
s = list(input())
i = 0
while i < len(s)-1:
if s[i] in vowel and s[i+1] in vowel:
s.pop(i+1)
else:
i += 1
print(''.join(s))
```
| 40,931
|
[
0.1956787109375,
-0.03802490234375,
-0.305419921875,
0.387939453125,
-0.62548828125,
-0.37841796875,
-0.2130126953125,
-0.283447265625,
0.187744140625,
0.7041015625,
0.365478515625,
-0.332763671875,
0.188720703125,
-0.76708984375,
-0.4873046875,
-0.10650634765625,
-0.859375,
-0.72314453125,
-0.70751953125,
-0.388427734375,
0.415283203125,
-0.2216796875,
-1.3994140625,
-0.20458984375,
-0.40380859375,
0.80908203125,
0.1187744140625,
-0.049774169921875,
1.068359375,
1.0546875,
-0.32421875,
-0.07525634765625,
0.413818359375,
-0.81982421875,
-0.440185546875,
-0.54052734375,
0.35888671875,
-0.595703125,
-0.49267578125,
-0.429931640625,
0.66845703125,
-0.3388671875,
0.178466796875,
-0.873046875,
-1.1611328125,
-0.389404296875,
-0.6015625,
-0.49609375,
-0.018463134765625,
-0.217529296875,
0.10736083984375,
-0.69580078125,
0.55224609375,
-0.173828125,
0.0287322998046875,
-0.331298828125,
-0.27783203125,
0.251708984375,
-0.82470703125,
-0.215087890625,
0.154541015625,
0.61767578125,
-0.2998046875,
-0.61767578125,
-0.426025390625,
0.31201171875,
-0.1903076171875,
0.1236572265625,
-0.12249755859375,
-0.297607421875,
-0.2109375,
0.452392578125,
-0.393310546875,
-0.3046875,
-0.73681640625,
0.0004570484161376953,
0.1920166015625,
-0.1285400390625,
-0.751953125,
0.7978515625,
-0.034698486328125,
0.77099609375,
0.480712890625,
0.452880859375,
-0.4140625,
-0.65234375,
0.1156005859375,
0.294677734375,
0.61083984375,
-0.07989501953125,
-0.280029296875,
0.44970703125,
-0.78857421875,
0.01181793212890625,
0.8125,
0.72802734375,
-0.1917724609375,
0.044708251953125,
0.55517578125,
-0.1361083984375,
0.88671875,
0.87451171875,
-0.32470703125,
0.84033203125,
-0.65087890625,
-0.15478515625,
0.253662109375,
0.060791015625,
-0.2484130859375,
-0.38671875,
-0.066650390625,
-0.1322021484375,
0.2086181640625,
0.634765625,
-0.1094970703125,
1.2890625,
0.08837890625,
0.389892578125,
-0.8876953125,
0.00392913818359375,
0.178466796875,
0.1019287109375,
0.377685546875,
0.02008056640625,
0.1815185546875,
-0.390869140625,
-0.50634765625,
1.033203125,
-0.6796875,
-0.1046142578125,
0.365478515625,
-0.04364013671875,
-0.171875,
0.2178955078125,
-0.132568359375,
0.732421875,
-0.47021484375,
0.84375,
0.56787109375,
-0.66357421875,
1.0390625,
-0.2890625,
-0.09075927734375,
1.390625,
0.45849609375,
-0.07232666015625,
0.6728515625,
0.6923828125,
-0.869140625,
0.52294921875,
-1.189453125,
1.1064453125,
0.1865234375,
0.193359375,
-0.75244140625,
0.232421875,
0.05438232421875,
0.006954193115234375,
0.423583984375,
-0.0716552734375,
-0.5888671875,
0.140869140625,
-0.397216796875,
0.9765625,
-0.46533203125,
0.8857421875,
-0.57373046875,
-0.240234375,
-0.244873046875,
-0.529296875,
0.49462890625,
-0.1099853515625,
-0.3310546875,
0.904296875,
0.493408203125,
1.1982421875,
1.080078125,
-0.369873046875,
0.1207275390625,
0.1363525390625,
-0.3662109375,
0.15283203125,
0.1993408203125,
0.56884765625,
0.420654296875,
0.259765625,
0.281982421875,
-0.38818359375,
-0.490966796875,
-0.3642578125,
-0.1690673828125,
0.736328125,
-0.45361328125,
0.0823974609375,
0.082763671875,
0.1033935546875,
-0.89453125,
0.01126861572265625,
0.123779296875,
-1.0068359375,
-0.2125244140625,
0.71826171875,
-0.29052734375,
0.43310546875,
0.057373046875,
-0.4560546875,
0.423583984375,
0.99267578125,
-0.466796875,
0.51708984375,
0.46142578125,
0.10565185546875,
-0.87939453125,
-0.01104736328125,
0.5830078125,
-0.182373046875,
-0.321533203125,
0.80810546875,
-0.646484375,
0.038726806640625,
-0.0022716522216796875,
0.64501953125,
0.44482421875,
0.6259765625,
-0.1988525390625,
-0.325927734375,
0.60107421875,
1.1953125,
0.0312042236328125,
0.65966796875,
0.096435546875,
0.84912109375,
0.662109375,
0.428955078125,
0.416259765625,
-0.1761474609375,
0.48583984375,
0.9921875,
-0.1419677734375,
0.3310546875,
0.2939453125,
0.431640625,
0.5908203125,
1.0556640625,
-0.2244873046875,
0.27685546875,
-0.19580078125,
-0.17041015625,
-0.5224609375,
0.408447265625,
-0.1605224609375,
0.619140625,
0.17138671875,
0.5146484375,
-0.701171875,
-0.44677734375,
-0.052703857421875,
0.736328125,
-0.75048828125,
-0.80126953125,
0.12152099609375,
0.039276123046875,
0.26708984375,
-0.044921875,
0.06243896484375,
0.54638671875,
0.537109375,
0.64794921875,
-0.367919921875,
-0.7314453125,
-0.7626953125,
-0.93994140625,
-1.0576171875,
-0.39208984375,
-0.5869140625,
-0.0186004638671875,
0.186767578125,
-0.9296875,
0.6728515625,
-0.1519775390625,
-0.404296875,
-0.0665283203125,
-0.58642578125,
0.8095703125,
-0.332763671875,
0.76904296875,
-1.0009765625,
0.48095703125,
0.338134765625,
0.8974609375,
-0.2548828125,
-0.39501953125,
-0.451171875,
-1.017578125,
0.1802978515625,
0.20849609375,
0.489501953125,
0.20849609375,
-0.80615234375,
-1.01953125,
-0.619140625,
-0.1798095703125,
-0.58642578125,
0.3251953125,
-0.20263671875,
1.01171875,
0.039306640625,
-0.4501953125,
0.5029296875,
0.97021484375,
-1.26171875,
0.60791015625,
0.2802734375,
0.42236328125,
-0.896484375,
1.3408203125,
0.3505859375,
0.51025390625,
-0.9296875,
-0.48974609375,
-0.73291015625,
0.302978515625,
0.1951904296875,
-1.037109375,
-0.400146484375,
0.7841796875,
-0.09619140625,
-1.087890625,
0.41845703125,
-1.4765625,
-0.7578125,
-0.447265625,
-0.4775390625,
1.2421875,
1.2509765625,
0.3515625,
-0.24951171875,
-0.324951171875,
-0.4296875,
0.67041015625,
0.74169921875,
-0.75830078125,
0.130859375,
0.8291015625,
-0.005828857421875,
0.2308349609375,
0.458251953125,
-0.638671875,
-0.266845703125,
0.361083984375,
0.03643798828125,
0.59423828125,
0.147705078125,
0.2318115234375,
0.0850830078125,
0.69921875,
-0.8583984375,
-0.31982421875,
0.07354736328125,
0.7919921875,
0.28466796875,
0.671875,
0.07720947265625,
-0.498779296875,
-0.560546875,
-0.7236328125,
0.334716796875,
0.274169921875,
0.88720703125,
-0.377197265625,
0.454833984375,
0.41650390625,
-0.845703125,
0.51171875,
-0.724609375,
-0.156982421875,
1.34375,
0.0279083251953125,
0.73095703125,
-0.44775390625,
0.397705078125,
0.061981201171875,
-0.266357421875,
0.315185546875,
0.16943359375,
0.43603515625,
-0.73583984375,
-0.31396484375,
-0.1854248046875,
-0.0036449432373046875,
-0.400390625,
-0.407958984375,
0.18505859375,
-0.15576171875,
-0.1715087890625,
-0.94140625,
0.341796875,
0.66357421875,
0.2259521484375,
0.3369140625,
0.63720703125,
0.100830078125,
0.634765625,
0.765625,
-0.0848388671875,
0.369873046875,
-0.85791015625,
0.332763671875,
0.178955078125,
-0.56689453125,
-0.3994140625,
-0.404052734375,
-0.41943359375,
0.09942626953125,
0.1744384765625,
-0.2442626953125,
-0.8115234375,
-0.11102294921875,
-0.077392578125,
0.373291015625,
-0.89990234375,
-0.239501953125,
-0.58349609375,
0.4443359375,
0.256591796875,
-0.72021484375,
0.3828125,
-1.1259765625,
0.60595703125,
0.430419921875,
-0.10772705078125,
-0.283935546875,
-0.365478515625,
-0.453857421875,
-0.480712890625,
-0.0657958984375,
0.05596923828125,
0.3876953125,
0.250732421875,
-1.349609375,
0.537109375,
0.53369140625,
-0.5126953125,
0.33984375,
-0.10406494140625,
0.7109375,
0.5078125,
0.98291015625,
-0.463623046875,
-0.32666015625,
0.29638671875,
-1.3203125,
0.97509765625,
-0.794921875,
0.80224609375,
-0.09515380859375,
-0.22021484375,
0.07562255859375,
0.41015625,
-0.45361328125,
-0.1407470703125,
-0.223876953125,
0.462890625,
-0.7587890625,
-0.7998046875,
0.52294921875,
0.21826171875,
-0.19677734375,
0.275390625,
-0.08697509765625,
0.07049560546875,
0.27978515625,
0.49755859375,
-0.312255859375,
0.18994140625,
-0.7744140625,
0.479248046875,
-0.1988525390625,
-0.853515625,
-0.1424560546875,
-0.52099609375,
0.3359375,
-0.1641845703125,
-1.14453125,
-0.18359375,
-1.39453125,
-0.1551513671875,
0.06768798828125,
-0.7197265625,
-0.016204833984375,
0.46337890625,
0.31396484375,
-0.402099609375,
-0.439697265625,
-0.71826171875,
-0.36572265625,
-0.5400390625,
-0.458251953125,
0.209716796875,
0.7900390625,
1.0224609375,
-0.344970703125,
-0.0963134765625,
-0.05316162109375,
0.0811767578125,
-0.304443359375,
-0.69970703125,
-0.448486328125,
-0.3427734375,
-0.447998046875,
-0.0091400146484375,
0.85546875,
0.0205841064453125,
0.51806640625,
0.986328125,
-0.29443359375,
0.1361083984375,
-0.176025390625,
-0.583984375,
1.0263671875,
-0.0159149169921875,
-1.2744140625,
-0.4306640625,
0.27978515625,
0.2139892578125,
0.78271484375,
0.1634521484375,
-0.69384765625,
-0.5771484375,
-1.0693359375,
-0.2384033203125,
-0.76025390625,
-0.3095703125,
-0.9150390625,
-0.38330078125,
-0.396240234375,
0.5419921875,
-0.163818359375,
-0.8486328125,
0.16748046875,
-0.86865234375,
0.32177734375,
-0.66943359375,
-0.42919921875,
-0.5537109375,
-0.8583984375,
0.10980224609375,
0.87255859375,
-0.214599609375,
0.286376953125,
0.1578369140625,
-0.22412109375,
0.303955078125,
-0.2464599609375,
-0.9892578125,
-0.453369140625,
0.10003662109375,
0.378662109375,
-0.0975341796875,
0.0743408203125,
-0.55419921875,
0.828125,
-0.9453125,
0.347900390625,
-0.160400390625,
-0.451904296875,
0.10333251953125,
-0.31884765625,
0.7646484375,
-0.43896484375,
-0.0279541015625,
-0.68408203125,
0.35205078125,
0.68798828125,
-0.2271728515625,
-0.564453125,
-0.80615234375,
-0.68408203125,
-0.7431640625,
0.712890625,
-0.79541015625,
0.29150390625,
-0.327392578125,
-0.10540771484375,
1.1025390625,
-0.268798828125,
0.174560546875,
1.234375,
0.319580078125,
0.5576171875,
-0.7470703125,
1.0419921875,
0.28564453125,
-0.438232421875,
-0.22021484375,
0.30810546875,
-0.94091796875,
0.436279296875,
-0.456787109375,
-0.82177734375,
-0.353515625,
0.20166015625,
1.64453125,
-0.389404296875,
0.78857421875,
-0.01378631591796875,
-0.71533203125,
-0.6083984375,
1.0380859375,
0.56005859375,
-0.060302734375,
1.0068359375,
0.1463623046875,
0.007167816162109375,
0.26416015625,
-0.1810302734375,
-0.479736328125,
-0.1571044921875,
0.71875,
-0.111328125,
-0.5869140625,
0.931640625,
0.86328125,
-1.1201171875,
-1.0029296875,
0.1844482421875,
-0.14453125,
-0.490234375,
-0.71533203125,
0.462890625,
0.99560546875,
-0.671875,
0.03564453125,
0.654296875,
-0.26904296875,
0.6279296875,
0.09759521484375,
0.28271484375,
-0.544921875,
0.87841796875,
0.68994140625,
-1.0595703125,
-0.1561279296875,
-0.98486328125,
-0.11956787109375,
-0.13330078125,
0.1385498046875,
0.61181640625,
-0.33740234375,
-0.12744140625,
0.73388671875,
-0.492919921875,
0.54296875,
-0.8232421875,
-0.69189453125,
0.315673828125,
-0.50341796875,
-0.87158203125,
0.04925537109375,
0.58203125,
-0.2469482421875,
0.367919921875,
-0.478759765625,
-0.11279296875,
0.41064453125,
0.259765625,
-0.6201171875,
-0.87255859375,
-0.302490234375,
-0.78271484375,
-0.58056640625,
-0.66259765625,
-0.07501220703125,
-0.462158203125,
0.358154296875,
0.1778564453125,
-0.356689453125,
0.06695556640625,
0.180419921875,
-0.78515625,
0.60400390625,
-0.283203125,
0.61669921875,
-0.6396484375,
-0.309326171875,
-0.419189453125,
-0.02630615234375,
-0.69287109375,
-0.179443359375,
-0.5703125,
0.315185546875,
-0.240966796875,
0.479248046875,
-0.01837158203125,
0.7421875,
-0.2242431640625,
-0.53076171875,
0.10455322265625,
-0.057098388671875,
-0.2176513671875,
0.9140625,
0.72900390625,
-0.1053466796875,
0.424072265625,
-0.2047119140625,
-0.2900390625,
-0.1226806640625,
0.400146484375,
0.4833984375,
-0.56640625,
-0.15087890625,
-0.4990234375,
-0.00798797607421875,
-0.8388671875,
0.0253448486328125,
-0.2371826171875,
0.71533203125,
0.0958251953125,
-0.2763671875,
0.40869140625,
1.2255859375,
-0.005523681640625,
0.074951171875,
-0.1346435546875,
0.11834716796875,
0.541015625,
0.003505706787109375,
-0.039459228515625,
0.1324462890625,
0.32958984375,
-0.2978515625,
-0.08648681640625,
0.81494140625,
-0.0132293701171875,
0.52880859375,
-0.1456298828125,
-0.7919921875,
-0.77685546875,
0.0124969482421875,
0.005809783935546875,
0.369873046875,
0.12298583984375,
-0.493896484375,
0.0823974609375,
0.18310546875,
-0.865234375,
0.28759765625,
-1.0244140625,
-0.681640625,
0.3349609375,
-0.447021484375,
-0.2301025390625,
-0.267578125,
-0.7119140625,
-0.1514892578125,
0.1793212890625,
0.498779296875,
-0.54296875,
0.468994140625,
0.07342529296875,
0.55126953125,
-0.1380615234375,
-0.1025390625,
-0.1859130859375,
0.00017309188842773438,
-0.42333984375,
-0.65673828125,
0.64013671875,
1.09765625,
0.2264404296875,
-0.006801605224609375,
-0.66455078125,
0.55712890625,
-0.2724609375,
0.1900634765625,
-0.094482421875,
0.41845703125,
-0.48583984375,
0.4091796875,
-1.0244140625,
0.1002197265625,
-0.1414794921875,
0.462890625,
0.361572265625,
-0.2227783203125,
-0.2215576171875,
0.8955078125,
0.6064453125,
-0.341796875,
0.0197296142578125,
0.316162109375,
0.46630859375,
-0.387451171875,
-0.1470947265625,
-0.2169189453125,
0.767578125,
0.30224609375,
0.26904296875,
-0.2354736328125,
0.66357421875,
0.81689453125,
0.0821533203125,
-0.0487060546875,
0.7314453125,
0.158447265625,
-0.24658203125,
-0.0228729248046875,
-0.5224609375,
-0.489501953125,
-0.0221710205078125,
-0.3095703125,
0.62939453125,
-0.06951904296875,
0.215087890625,
-0.03424072265625,
-0.78125,
0.8681640625,
0.040374755859375,
-0.056488037109375,
0.016876220703125,
-0.6494140625,
0.251708984375,
1.056640625,
0.226318359375,
-0.0195770263671875,
0.62890625,
0.890625,
0.5927734375,
0.52880859375,
0.5712890625,
0.5009765625,
-0.362548828125,
0.049896240234375,
-0.109130859375,
0.0013265609741210938,
-0.2427978515625,
-0.469482421875,
-1.322265625,
0.373291015625,
-0.6875,
-0.2958984375,
0.96728515625,
-0.7900390625,
-0.00586700439453125,
-0.37158203125,
0.65283203125,
-0.30029296875,
0.57666015625,
0.609375,
-0.495361328125,
-0.7021484375,
1.0068359375,
-0.11822509765625,
0.6396484375,
0.0163421630859375,
1.35546875,
-0.1065673828125,
0.98876953125,
0.3193359375,
-0.1395263671875,
-0.10888671875,
0.292236328125,
-0.40771484375,
-0.744140625,
-0.31201171875,
-0.453369140625,
0.37353515625,
-0.5234375,
-0.57568359375,
-0.05743408203125,
0.82470703125,
-0.2449951171875,
-1.203125,
-0.343994140625,
0.1197509765625,
-0.4521484375,
0.7685546875,
0.1285400390625,
-0.1103515625,
0.0027065277099609375,
-0.163330078125,
0.06878662109375,
-0.442138671875,
0.1612548828125,
-0.390869140625,
0.490478515625,
-0.69775390625,
-0.416259765625,
-0.90576171875,
-0.371826171875,
-0.4482421875,
-0.00473785400390625,
-0.426513671875,
-0.77587890625,
0.30517578125,
0.1875,
0.372314453125,
0.3134765625,
-0.062103271484375,
0.537109375,
1.4072265625,
0.84814453125,
0.0099029541015625,
1.2216796875,
0.29833984375,
-0.50390625,
0.444580078125,
-0.7041015625,
0.7822265625,
-0.0665283203125,
0.189208984375,
-0.1981201171875,
0.179931640625,
-0.39404296875,
-0.92724609375,
0.291748046875,
0.94580078125,
0.2060546875,
-0.66845703125,
-1.23828125,
0.0294647216796875,
-1.0341796875,
-0.254638671875,
-0.72119140625,
0.8916015625,
0.23974609375,
-0.072509765625,
-0.319091796875,
-1.115234375,
4.19921875,
0.8466796875,
1.24609375,
0.55615234375,
0.21435546875,
1.1669921875,
0.432861328125,
-0.1666259765625,
-0.3173828125,
-0.59521484375,
0.55615234375,
-0.6171875,
-0.0304718017578125,
0.5478515625,
0.313232421875,
0.1416015625,
-0.38037109375,
0.355224609375,
0.33837890625,
-0.51904296875,
-0.919921875,
0.2091064453125,
0.37646484375,
0.64013671875,
0.035614013671875,
0.41357421875,
0.62109375,
-0.2298583984375,
-0.1763916015625,
-1.021484375,
0.1080322265625,
-0.64990234375,
0.83056640625,
0.0142364501953125,
-0.11981201171875,
0.67578125,
-0.215087890625,
-0.58154296875,
-0.56201171875,
0.28515625,
-0.45751953125,
-0.10992431640625,
0.4990234375,
-0.70947265625,
0.117431640625,
0.453857421875,
-0.372314453125,
0.24658203125,
0.5634765625,
-0.880859375,
1.087890625,
-0.343994140625,
0.4990234375,
-0.98046875,
-0.1712646484375,
0.355712890625,
0.034576416015625,
0.1158447265625,
-0.326171875,
0.3955078125,
0.36669921875,
0.3359375,
-0.1868896484375,
0.7080078125,
-1.103515625,
0.4150390625,
-0.27392578125,
0.5078125,
-0.673828125,
-0.348388671875,
-0.240234375,
0.0953369140625,
0.2481689453125,
-0.19873046875,
0.492919921875,
0.059356689453125,
0.277099609375,
0.73779296875,
0.26904296875,
-0.8994140625,
0.0928955078125,
-0.07965087890625,
-0.400390625,
-0.56982421875,
0.5517578125,
1.3505859375,
-0.609375,
-0.316162109375,
-0.379150390625,
1.0224609375,
0.76806640625,
0.5947265625,
0.27197265625,
-0.5244140625,
-0.256591796875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange.
Victor thinks that if a word contains two consecutive vowels, then it's kinda weird and it needs to be replaced. So the word corrector works in such a way: as long as there are two consecutive vowels in the word, it deletes the first vowel in a word such that there is another vowel right before it. If there are no two consecutive vowels in the word, it is considered to be correct.
You are given a word s. Can you predict what will it become after correction?
In this problem letters a, e, i, o, u and y are considered to be vowels.
Input
The first line contains one integer n (1 ≤ n ≤ 100) — the number of letters in word s before the correction.
The second line contains a string s consisting of exactly n lowercase Latin letters — the word before the correction.
Output
Output the word s after the correction.
Examples
Input
5
weird
Output
werd
Input
4
word
Output
word
Input
5
aaeaa
Output
a
Note
Explanations of the examples:
1. There is only one replace: weird <image> werd;
2. No replace needed since there are no two consecutive vowels;
3. aaeaa <image> aeaa <image> aaa <image> aa <image> a.
Tags: implementation
Correct Solution:
```
n=int(input())
s=input()
k=""
m=False
for i in range(n):
if s[i] not in ["a","e","i","o","u","y"]:
k+=s[i]
elif s[i] in ["a","e","i","o","u","y"] and not m:
k+=s[i]
m=True
try:
if s[i] in ["a","e","i","o","u","y"] and s[i+1] not in ["a","e","i","o","u","y"]:
m=False
except:
pass
print(k)
```
| 40,932
|
[
0.2401123046875,
-0.037384033203125,
-0.328857421875,
0.35302734375,
-0.61328125,
-0.386474609375,
-0.2186279296875,
-0.3154296875,
0.1141357421875,
0.71728515625,
0.428955078125,
-0.33056640625,
0.155029296875,
-0.8095703125,
-0.5009765625,
-0.1365966796875,
-0.87451171875,
-0.6494140625,
-0.6435546875,
-0.41845703125,
0.40234375,
-0.20458984375,
-1.4140625,
-0.1533203125,
-0.353759765625,
0.80712890625,
0.16259765625,
-0.0714111328125,
1.1064453125,
1.1015625,
-0.26904296875,
-0.088134765625,
0.451171875,
-0.837890625,
-0.47119140625,
-0.62158203125,
0.4072265625,
-0.52099609375,
-0.4462890625,
-0.40966796875,
0.64208984375,
-0.32568359375,
0.163330078125,
-0.81494140625,
-1.2138671875,
-0.360107421875,
-0.57373046875,
-0.5673828125,
0.0102386474609375,
-0.1541748046875,
0.0517578125,
-0.64599609375,
0.53955078125,
-0.140625,
0.029296875,
-0.2880859375,
-0.170654296875,
0.210205078125,
-0.81298828125,
-0.224365234375,
0.1541748046875,
0.56689453125,
-0.309326171875,
-0.580078125,
-0.413330078125,
0.224853515625,
-0.1766357421875,
0.11468505859375,
-0.0953369140625,
-0.3125,
-0.23681640625,
0.39404296875,
-0.440185546875,
-0.342041015625,
-0.72265625,
-0.0007925033569335938,
0.166748046875,
-0.1192626953125,
-0.7294921875,
0.81689453125,
-0.0693359375,
0.7685546875,
0.53369140625,
0.454345703125,
-0.384521484375,
-0.6279296875,
0.155029296875,
0.2384033203125,
0.60009765625,
-0.0254974365234375,
-0.2587890625,
0.444091796875,
-0.7841796875,
-0.029266357421875,
0.8681640625,
0.65673828125,
-0.12176513671875,
0.03228759765625,
0.55908203125,
-0.1903076171875,
0.88525390625,
0.8212890625,
-0.37841796875,
0.85302734375,
-0.62060546875,
-0.0982666015625,
0.2415771484375,
0.025634765625,
-0.283203125,
-0.408935546875,
-0.10479736328125,
-0.11358642578125,
0.262939453125,
0.6318359375,
-0.18359375,
1.2041015625,
0.07122802734375,
0.429443359375,
-0.82177734375,
0.048004150390625,
0.2015380859375,
0.148193359375,
0.46923828125,
0.06756591796875,
0.12286376953125,
-0.375244140625,
-0.548828125,
1.021484375,
-0.64111328125,
-0.0174713134765625,
0.3916015625,
-0.0584716796875,
-0.2388916015625,
0.268798828125,
-0.1978759765625,
0.63720703125,
-0.431640625,
0.8681640625,
0.56591796875,
-0.640625,
1.009765625,
-0.2244873046875,
-0.0672607421875,
1.361328125,
0.41943359375,
-0.03033447265625,
0.6533203125,
0.68505859375,
-0.85498046875,
0.497314453125,
-1.1708984375,
1.0654296875,
0.19482421875,
0.1846923828125,
-0.71240234375,
0.264404296875,
0.027130126953125,
-0.052276611328125,
0.34423828125,
-0.0673828125,
-0.57470703125,
0.1976318359375,
-0.40625,
0.916015625,
-0.458251953125,
0.82861328125,
-0.5634765625,
-0.200927734375,
-0.2379150390625,
-0.4609375,
0.458984375,
-0.126220703125,
-0.36474609375,
0.896484375,
0.5185546875,
1.25390625,
1.0966796875,
-0.37255859375,
0.1072998046875,
0.122314453125,
-0.384033203125,
0.2003173828125,
0.2386474609375,
0.59765625,
0.325927734375,
0.2939453125,
0.2379150390625,
-0.354736328125,
-0.466796875,
-0.289306640625,
-0.1795654296875,
0.6845703125,
-0.394287109375,
0.1539306640625,
0.11224365234375,
0.12310791015625,
-0.92041015625,
0.02691650390625,
0.1353759765625,
-1.021484375,
-0.1817626953125,
0.68798828125,
-0.25439453125,
0.426513671875,
0.08233642578125,
-0.477783203125,
0.4658203125,
0.9775390625,
-0.48291015625,
0.53466796875,
0.365234375,
0.0986328125,
-0.8857421875,
0.0230560302734375,
0.5615234375,
-0.16259765625,
-0.349609375,
0.83349609375,
-0.6376953125,
-0.0006132125854492188,
0.0305633544921875,
0.64892578125,
0.402099609375,
0.6025390625,
-0.17822265625,
-0.3095703125,
0.57568359375,
1.1513671875,
-0.0038928985595703125,
0.65087890625,
0.11395263671875,
0.85107421875,
0.64306640625,
0.443603515625,
0.454833984375,
-0.14892578125,
0.546875,
1.0419921875,
-0.1588134765625,
0.36083984375,
0.289306640625,
0.42919921875,
0.5791015625,
1.0087890625,
-0.2054443359375,
0.237060546875,
-0.2120361328125,
-0.2293701171875,
-0.49072265625,
0.41357421875,
-0.23095703125,
0.65478515625,
0.179931640625,
0.5283203125,
-0.6533203125,
-0.4580078125,
-0.044891357421875,
0.75,
-0.74658203125,
-0.8115234375,
0.150390625,
0.0271759033203125,
0.2255859375,
-0.0120697021484375,
0.023681640625,
0.62548828125,
0.447509765625,
0.5537109375,
-0.339599609375,
-0.7216796875,
-0.7734375,
-0.93310546875,
-1.04296875,
-0.336181640625,
-0.54833984375,
0.040191650390625,
0.1502685546875,
-0.9189453125,
0.697265625,
-0.1431884765625,
-0.3896484375,
-0.10101318359375,
-0.6455078125,
0.8486328125,
-0.30322265625,
0.720703125,
-1.03125,
0.556640625,
0.28564453125,
0.91943359375,
-0.2529296875,
-0.418701171875,
-0.50341796875,
-1.00390625,
0.19140625,
0.1136474609375,
0.473388671875,
0.181640625,
-0.7578125,
-0.99560546875,
-0.53955078125,
-0.1640625,
-0.57275390625,
0.324951171875,
-0.2166748046875,
0.939453125,
0.061553955078125,
-0.474853515625,
0.490478515625,
0.9111328125,
-1.2333984375,
0.58447265625,
0.254150390625,
0.496337890625,
-0.8955078125,
1.2685546875,
0.362060546875,
0.447509765625,
-0.90478515625,
-0.56689453125,
-0.7841796875,
0.254638671875,
0.192138671875,
-0.9365234375,
-0.298095703125,
0.79150390625,
-0.112060546875,
-1.0751953125,
0.376953125,
-1.353515625,
-0.7294921875,
-0.46240234375,
-0.50634765625,
1.2041015625,
1.265625,
0.303466796875,
-0.19091796875,
-0.321044921875,
-0.37109375,
0.7275390625,
0.7099609375,
-0.75341796875,
0.14501953125,
0.82080078125,
0.08837890625,
0.30322265625,
0.4296875,
-0.53369140625,
-0.2998046875,
0.36279296875,
0.00751495361328125,
0.57666015625,
0.0777587890625,
0.187744140625,
0.064208984375,
0.65576171875,
-0.8212890625,
-0.3525390625,
-0.006313323974609375,
0.77294921875,
0.2474365234375,
0.61865234375,
0.11328125,
-0.451416015625,
-0.5341796875,
-0.748046875,
0.310302734375,
0.264892578125,
0.814453125,
-0.5146484375,
0.501953125,
0.337890625,
-0.81689453125,
0.51025390625,
-0.68359375,
-0.109130859375,
1.251953125,
0.09051513671875,
0.74365234375,
-0.51904296875,
0.3984375,
0.0799560546875,
-0.2457275390625,
0.3583984375,
0.22998046875,
0.439697265625,
-0.701171875,
-0.297119140625,
-0.1859130859375,
-0.017364501953125,
-0.431640625,
-0.35888671875,
0.2012939453125,
-0.186279296875,
-0.2252197265625,
-0.91455078125,
0.33447265625,
0.6181640625,
0.274169921875,
0.330078125,
0.6279296875,
0.10986328125,
0.67822265625,
0.76806640625,
-0.0726318359375,
0.337646484375,
-0.8154296875,
0.401123046875,
0.1319580078125,
-0.54345703125,
-0.356201171875,
-0.3330078125,
-0.40625,
0.047119140625,
0.1834716796875,
-0.2418212890625,
-0.8740234375,
-0.0814208984375,
-0.07391357421875,
0.446044921875,
-0.93408203125,
-0.21142578125,
-0.54443359375,
0.401123046875,
0.29443359375,
-0.82763671875,
0.394775390625,
-1.0673828125,
0.60205078125,
0.397705078125,
-0.1790771484375,
-0.276611328125,
-0.405517578125,
-0.52880859375,
-0.50048828125,
-0.1494140625,
0.06610107421875,
0.3935546875,
0.312255859375,
-1.3193359375,
0.50927734375,
0.5224609375,
-0.466796875,
0.3515625,
-0.0787353515625,
0.6591796875,
0.52099609375,
0.97314453125,
-0.5947265625,
-0.310302734375,
0.282470703125,
-1.3056640625,
0.87255859375,
-0.77685546875,
0.732421875,
-0.08819580078125,
-0.1929931640625,
0.052703857421875,
0.387451171875,
-0.444580078125,
-0.119140625,
-0.19970703125,
0.46875,
-0.806640625,
-0.837890625,
0.51416015625,
0.1788330078125,
-0.16357421875,
0.2158203125,
-0.1846923828125,
0.050872802734375,
0.245849609375,
0.425537109375,
-0.306884765625,
0.199951171875,
-0.767578125,
0.50537109375,
-0.184326171875,
-0.86474609375,
-0.1640625,
-0.62744140625,
0.309326171875,
-0.274169921875,
-1.15234375,
-0.205810546875,
-1.390625,
-0.1226806640625,
0.08697509765625,
-0.72021484375,
0.030792236328125,
0.46533203125,
0.338623046875,
-0.4052734375,
-0.424072265625,
-0.65283203125,
-0.391357421875,
-0.572265625,
-0.49658203125,
0.2296142578125,
0.7607421875,
0.93310546875,
-0.3466796875,
-0.1185302734375,
-0.00946807861328125,
0.10858154296875,
-0.28466796875,
-0.69921875,
-0.369384765625,
-0.3935546875,
-0.486572265625,
0.04345703125,
0.87548828125,
0.0877685546875,
0.56201171875,
1.01953125,
-0.299072265625,
0.2052001953125,
-0.1402587890625,
-0.615234375,
1.091796875,
0.01393890380859375,
-1.2705078125,
-0.427490234375,
0.27001953125,
0.1070556640625,
0.79150390625,
0.1685791015625,
-0.78955078125,
-0.57568359375,
-1.0654296875,
-0.1627197265625,
-0.76171875,
-0.32763671875,
-0.955078125,
-0.319580078125,
-0.4697265625,
0.541015625,
-0.1422119140625,
-0.8798828125,
0.1995849609375,
-0.8291015625,
0.35546875,
-0.63720703125,
-0.427001953125,
-0.62109375,
-0.8134765625,
0.1790771484375,
0.84130859375,
-0.1953125,
0.310302734375,
0.12322998046875,
-0.234619140625,
0.30029296875,
-0.19140625,
-0.9443359375,
-0.472412109375,
0.10772705078125,
0.38818359375,
-0.1474609375,
0.06414794921875,
-0.5263671875,
0.86083984375,
-0.92919921875,
0.354248046875,
-0.151123046875,
-0.443603515625,
0.094482421875,
-0.2734375,
0.779296875,
-0.451416015625,
-0.039642333984375,
-0.67236328125,
0.32373046875,
0.62890625,
-0.2332763671875,
-0.6220703125,
-0.79345703125,
-0.67236328125,
-0.74609375,
0.6943359375,
-0.82861328125,
0.29736328125,
-0.369873046875,
-0.1575927734375,
0.9970703125,
-0.2177734375,
0.10693359375,
1.2490234375,
0.302001953125,
0.47412109375,
-0.64892578125,
0.96826171875,
0.268798828125,
-0.412109375,
-0.07318115234375,
0.32421875,
-0.97021484375,
0.49267578125,
-0.466552734375,
-0.8388671875,
-0.321044921875,
0.2568359375,
1.611328125,
-0.405029296875,
0.8056640625,
0.0267486572265625,
-0.673828125,
-0.58984375,
0.9833984375,
0.501953125,
-0.078125,
1.01171875,
0.1810302734375,
0.009368896484375,
0.257080078125,
-0.2200927734375,
-0.529296875,
-0.204833984375,
0.7314453125,
-0.1839599609375,
-0.62158203125,
0.97314453125,
0.857421875,
-1.091796875,
-1.009765625,
0.27587890625,
-0.1641845703125,
-0.45068359375,
-0.69921875,
0.46142578125,
1.001953125,
-0.6298828125,
0.04327392578125,
0.67041015625,
-0.2437744140625,
0.6181640625,
0.07977294921875,
0.330322265625,
-0.59130859375,
0.81884765625,
0.70703125,
-1.0390625,
-0.11859130859375,
-0.994140625,
-0.1851806640625,
-0.08642578125,
0.175537109375,
0.65087890625,
-0.305908203125,
-0.08978271484375,
0.68310546875,
-0.46044921875,
0.53955078125,
-0.73095703125,
-0.6474609375,
0.2958984375,
-0.53173828125,
-0.798828125,
0.0122528076171875,
0.5615234375,
-0.237548828125,
0.33935546875,
-0.457763671875,
-0.1160888671875,
0.37060546875,
0.30615234375,
-0.57763671875,
-0.79248046875,
-0.293212890625,
-0.77099609375,
-0.66259765625,
-0.61962890625,
-0.08294677734375,
-0.44580078125,
0.3291015625,
0.108642578125,
-0.32666015625,
0.09954833984375,
0.21533203125,
-0.79296875,
0.5537109375,
-0.2646484375,
0.6279296875,
-0.6337890625,
-0.22607421875,
-0.423095703125,
-0.0386962890625,
-0.70556640625,
-0.2227783203125,
-0.59716796875,
0.3701171875,
-0.192138671875,
0.486328125,
-0.04071044921875,
0.76953125,
-0.2374267578125,
-0.568359375,
0.037261962890625,
-0.019317626953125,
-0.252685546875,
0.91796875,
0.677734375,
-0.049102783203125,
0.436279296875,
-0.2373046875,
-0.2230224609375,
-0.11767578125,
0.42431640625,
0.50244140625,
-0.5380859375,
-0.1644287109375,
-0.5185546875,
-0.0275726318359375,
-0.87451171875,
0.05047607421875,
-0.279296875,
0.66796875,
0.11669921875,
-0.263671875,
0.330078125,
1.1982421875,
-0.056640625,
0.11712646484375,
-0.12261962890625,
0.114013671875,
0.5185546875,
0.01751708984375,
-0.0079345703125,
0.2276611328125,
0.32421875,
-0.3818359375,
-0.048797607421875,
0.79833984375,
-0.03094482421875,
0.515625,
-0.1390380859375,
-0.8251953125,
-0.86083984375,
-0.0284271240234375,
-0.032684326171875,
0.401611328125,
0.1925048828125,
-0.489990234375,
0.083251953125,
0.18115234375,
-0.798828125,
0.288818359375,
-1.0361328125,
-0.69482421875,
0.31298828125,
-0.49853515625,
-0.1741943359375,
-0.255126953125,
-0.71240234375,
-0.2410888671875,
0.1888427734375,
0.529296875,
-0.529296875,
0.51513671875,
0.015167236328125,
0.46826171875,
-0.09759521484375,
-0.202880859375,
-0.145751953125,
0.041259765625,
-0.443115234375,
-0.6923828125,
0.61083984375,
1.0625,
0.1795654296875,
0.06353759765625,
-0.625,
0.58447265625,
-0.2374267578125,
0.187255859375,
-0.032379150390625,
0.41650390625,
-0.448974609375,
0.34814453125,
-1.044921875,
0.1427001953125,
-0.1302490234375,
0.39013671875,
0.376953125,
-0.2269287109375,
-0.345703125,
0.89892578125,
0.6181640625,
-0.36181640625,
0.07659912109375,
0.298095703125,
0.494384765625,
-0.44287109375,
-0.0916748046875,
-0.27734375,
0.7626953125,
0.34521484375,
0.304931640625,
-0.250244140625,
0.666015625,
0.873046875,
0.08941650390625,
-0.0684814453125,
0.72998046875,
0.1983642578125,
-0.236083984375,
-0.005889892578125,
-0.56298828125,
-0.411865234375,
-0.072021484375,
-0.318603515625,
0.65283203125,
-0.036529541015625,
0.240234375,
-0.0301971435546875,
-0.7919921875,
0.8466796875,
-0.0024127960205078125,
-0.06939697265625,
-0.02508544921875,
-0.60888671875,
0.1771240234375,
0.90673828125,
0.197998046875,
-0.038726806640625,
0.6904296875,
0.892578125,
0.599609375,
0.455078125,
0.60888671875,
0.4853515625,
-0.398193359375,
-0.0067138671875,
-0.06878662109375,
0.07952880859375,
-0.2135009765625,
-0.463134765625,
-1.28515625,
0.370849609375,
-0.64111328125,
-0.275634765625,
0.93310546875,
-0.77783203125,
0.0189208984375,
-0.344482421875,
0.72216796875,
-0.321533203125,
0.572265625,
0.65869140625,
-0.467041015625,
-0.69873046875,
0.994140625,
-0.1671142578125,
0.59765625,
0.156005859375,
1.357421875,
-0.0882568359375,
0.94580078125,
0.271728515625,
-0.08807373046875,
-0.07659912109375,
0.276123046875,
-0.361328125,
-0.6669921875,
-0.363525390625,
-0.50390625,
0.287353515625,
-0.47900390625,
-0.6201171875,
-0.11029052734375,
0.7900390625,
-0.361572265625,
-1.087890625,
-0.345947265625,
0.094482421875,
-0.49560546875,
0.75927734375,
0.044281005859375,
-0.05267333984375,
0.07928466796875,
-0.2327880859375,
0.08172607421875,
-0.43798828125,
0.16064453125,
-0.36962890625,
0.365234375,
-0.74267578125,
-0.4404296875,
-0.83349609375,
-0.346435546875,
-0.47412109375,
-0.01038360595703125,
-0.4150390625,
-0.76171875,
0.315673828125,
0.2393798828125,
0.3291015625,
0.3388671875,
-0.17578125,
0.481201171875,
1.349609375,
0.84521484375,
-0.003658294677734375,
1.154296875,
0.314208984375,
-0.53271484375,
0.471435546875,
-0.65576171875,
0.71923828125,
-0.0272064208984375,
0.2093505859375,
-0.186767578125,
0.226806640625,
-0.415771484375,
-0.88671875,
0.2188720703125,
0.96337890625,
0.1502685546875,
-0.66943359375,
-1.216796875,
0.00650787353515625,
-1,
-0.230712890625,
-0.63623046875,
0.88671875,
0.2174072265625,
-0.07525634765625,
-0.273681640625,
-1.0947265625,
4.26171875,
0.8525390625,
1.2861328125,
0.552734375,
0.2342529296875,
1.162109375,
0.4541015625,
-0.1456298828125,
-0.316650390625,
-0.62060546875,
0.52880859375,
-0.5703125,
-0.0169677734375,
0.55712890625,
0.344482421875,
0.06866455078125,
-0.37353515625,
0.283935546875,
0.342041015625,
-0.533203125,
-0.90478515625,
0.2412109375,
0.374267578125,
0.61865234375,
0.0316162109375,
0.376953125,
0.61865234375,
-0.326416015625,
-0.16064453125,
-1.0078125,
0.08489990234375,
-0.69482421875,
0.7431640625,
0.032623291015625,
-0.11798095703125,
0.76025390625,
-0.2071533203125,
-0.58740234375,
-0.5556640625,
0.292724609375,
-0.427978515625,
-0.0958251953125,
0.466552734375,
-0.73046875,
0.033416748046875,
0.414306640625,
-0.428466796875,
0.3271484375,
0.51904296875,
-0.90380859375,
1.01171875,
-0.301513671875,
0.53271484375,
-0.9267578125,
-0.2379150390625,
0.39306640625,
0.04266357421875,
0.0548095703125,
-0.23779296875,
0.445068359375,
0.337646484375,
0.388916015625,
-0.190185546875,
0.6982421875,
-1.1396484375,
0.4033203125,
-0.22314453125,
0.493408203125,
-0.67529296875,
-0.35498046875,
-0.285400390625,
0.154052734375,
0.224609375,
-0.095458984375,
0.48388671875,
0.042938232421875,
0.36279296875,
0.81298828125,
0.159423828125,
-0.8828125,
0.11163330078125,
-0.09918212890625,
-0.366943359375,
-0.52978515625,
0.5966796875,
1.3740234375,
-0.57080078125,
-0.2498779296875,
-0.3525390625,
1.0078125,
0.76025390625,
0.58740234375,
0.316162109375,
-0.59619140625,
-0.284912109375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Victor tries to write his own text editor, with word correction included. However, the rules of word correction are really strange.
Victor thinks that if a word contains two consecutive vowels, then it's kinda weird and it needs to be replaced. So the word corrector works in such a way: as long as there are two consecutive vowels in the word, it deletes the first vowel in a word such that there is another vowel right before it. If there are no two consecutive vowels in the word, it is considered to be correct.
You are given a word s. Can you predict what will it become after correction?
In this problem letters a, e, i, o, u and y are considered to be vowels.
Input
The first line contains one integer n (1 ≤ n ≤ 100) — the number of letters in word s before the correction.
The second line contains a string s consisting of exactly n lowercase Latin letters — the word before the correction.
Output
Output the word s after the correction.
Examples
Input
5
weird
Output
werd
Input
4
word
Output
word
Input
5
aaeaa
Output
a
Note
Explanations of the examples:
1. There is only one replace: weird <image> werd;
2. No replace needed since there are no two consecutive vowels;
3. aaeaa <image> aeaa <image> aaa <image> aa <image> a.
Tags: implementation
Correct Solution:
```
def vovel(c):
return c in ['a', 'i', 'o', 'e', 'u', 'y']
n = int(input())
s = input()[:n]
if len(s)>0:
p = s[0]
else:
print ()
exit()
res = ''
for i in range(1, len(s)):
if vovel(p) and vovel(s[i]):
continue
res +=p
p = s[i]
res += p
print (res)
```
| 40,933
|
[
0.0648193359375,
0.0034732818603515625,
-0.349609375,
0.4384765625,
-0.591796875,
-0.396484375,
-0.132568359375,
-0.2451171875,
0.058624267578125,
0.76708984375,
0.386962890625,
-0.2198486328125,
0.11053466796875,
-0.80517578125,
-0.367431640625,
0.00495147705078125,
-0.85009765625,
-0.751953125,
-0.79638671875,
-0.302490234375,
0.2232666015625,
-0.2181396484375,
-1.3125,
-0.11102294921875,
-0.300537109375,
0.7529296875,
0.1160888671875,
-0.1708984375,
1.005859375,
1.052734375,
-0.300048828125,
-0.11041259765625,
0.392822265625,
-0.81640625,
-0.343994140625,
-0.59521484375,
0.22607421875,
-0.4794921875,
-0.6171875,
-0.4208984375,
0.63818359375,
-0.300537109375,
0.32568359375,
-0.828125,
-1.1416015625,
-0.373779296875,
-0.49072265625,
-0.4453125,
-0.0022602081298828125,
-0.1280517578125,
0.1055908203125,
-0.7314453125,
0.52490234375,
-0.2342529296875,
-0.11944580078125,
-0.381103515625,
-0.34033203125,
0.09344482421875,
-0.85107421875,
-0.1328125,
0.27099609375,
0.48876953125,
-0.2161865234375,
-0.69091796875,
-0.495361328125,
0.348876953125,
-0.1815185546875,
0.10308837890625,
-0.10577392578125,
-0.3798828125,
-0.20556640625,
0.37060546875,
-0.413330078125,
-0.427734375,
-0.65234375,
-0.0655517578125,
0.226806640625,
-0.23291015625,
-0.607421875,
0.89013671875,
0.0958251953125,
0.72265625,
0.52978515625,
0.405029296875,
-0.53955078125,
-0.58935546875,
-0.0257720947265625,
0.270751953125,
0.52880859375,
-0.0192718505859375,
-0.260009765625,
0.402099609375,
-0.80615234375,
-0.06365966796875,
0.763671875,
0.72314453125,
-0.2119140625,
0.1954345703125,
0.53759765625,
-0.1510009765625,
0.7099609375,
0.859375,
-0.281982421875,
0.7685546875,
-0.77197265625,
-0.0188751220703125,
0.273681640625,
0.181884765625,
-0.1514892578125,
-0.46923828125,
-0.11712646484375,
-0.1402587890625,
0.2005615234375,
0.454345703125,
-0.150146484375,
1.2255859375,
0.005367279052734375,
0.208251953125,
-0.93017578125,
-0.10589599609375,
0.155029296875,
0.125,
0.359375,
-0.039794921875,
0.16552734375,
-0.452880859375,
-0.59228515625,
1.048828125,
-0.865234375,
-0.07916259765625,
0.4814453125,
-0.10076904296875,
-0.1654052734375,
0.26611328125,
-0.0849609375,
0.476318359375,
-0.257080078125,
0.77197265625,
0.56005859375,
-0.662109375,
1.14453125,
-0.2371826171875,
-0.09197998046875,
1.3701171875,
0.343994140625,
-0.0313720703125,
0.62744140625,
0.72314453125,
-0.96240234375,
0.66748046875,
-1.1630859375,
1.04296875,
0.199462890625,
0.280517578125,
-0.71923828125,
0.2010498046875,
0.0208740234375,
0.0872802734375,
0.42919921875,
-0.0992431640625,
-0.452392578125,
0.276123046875,
-0.4013671875,
0.82470703125,
-0.59521484375,
0.79931640625,
-0.564453125,
-0.1619873046875,
-0.21728515625,
-0.47509765625,
0.457763671875,
-0.07879638671875,
-0.387939453125,
0.79736328125,
0.57568359375,
1.0966796875,
1.1083984375,
-0.1802978515625,
0.0845947265625,
0.1630859375,
-0.25341796875,
0.1671142578125,
0.260009765625,
0.6337890625,
0.3818359375,
0.1588134765625,
0.167236328125,
-0.233642578125,
-0.46044921875,
-0.350830078125,
-0.158203125,
0.64697265625,
-0.293701171875,
0.045654296875,
-0.020904541015625,
0.080322265625,
-0.79541015625,
0.18701171875,
0.09051513671875,
-1.0615234375,
-0.170166015625,
0.67236328125,
-0.30908203125,
0.446044921875,
0.12091064453125,
-0.486083984375,
0.3720703125,
0.8955078125,
-0.427978515625,
0.56298828125,
0.38671875,
0.014862060546875,
-0.7490234375,
-0.056549072265625,
0.66552734375,
-0.15869140625,
-0.40234375,
0.82080078125,
-0.55419921875,
-0.07757568359375,
0.043212890625,
0.7744140625,
0.432861328125,
0.64404296875,
-0.25537109375,
-0.3798828125,
0.54833984375,
1.17578125,
0.044586181640625,
0.7080078125,
0.08404541015625,
0.91943359375,
0.62744140625,
0.442138671875,
0.55859375,
-0.33544921875,
0.634765625,
0.95751953125,
-0.1597900390625,
0.39794921875,
0.367919921875,
0.54345703125,
0.57958984375,
1.0107421875,
-0.31103515625,
0.419677734375,
-0.3134765625,
-0.2283935546875,
-0.49853515625,
0.57177734375,
-0.243896484375,
0.70458984375,
0.150390625,
0.58203125,
-0.69384765625,
-0.29833984375,
-0.0650634765625,
0.6904296875,
-0.6455078125,
-0.71484375,
0.161865234375,
0.057586669921875,
0.265625,
-0.070556640625,
0.12188720703125,
0.458984375,
0.4794921875,
0.5810546875,
-0.29931640625,
-0.828125,
-0.67041015625,
-0.9755859375,
-1.1259765625,
-0.403564453125,
-0.69189453125,
-0.0247344970703125,
0.2108154296875,
-0.7822265625,
0.59130859375,
-0.05963134765625,
-0.40234375,
-0.024627685546875,
-0.6611328125,
0.84521484375,
-0.2362060546875,
0.765625,
-1.0048828125,
0.464599609375,
0.30419921875,
0.76904296875,
-0.323974609375,
-0.26025390625,
-0.369140625,
-0.97705078125,
0.16455078125,
0.12213134765625,
0.5439453125,
0.195556640625,
-0.79248046875,
-0.9482421875,
-0.64501953125,
-0.1761474609375,
-0.64697265625,
0.33203125,
-0.175048828125,
1.0634765625,
0.0672607421875,
-0.6171875,
0.51416015625,
0.8740234375,
-1.1923828125,
0.6630859375,
0.34912109375,
0.400146484375,
-0.8564453125,
1.3232421875,
0.477783203125,
0.50048828125,
-1.005859375,
-0.389892578125,
-0.5625,
0.25390625,
0.2015380859375,
-0.98388671875,
-0.51171875,
0.8017578125,
0.03533935546875,
-1.0751953125,
0.426025390625,
-1.486328125,
-0.78564453125,
-0.49609375,
-0.421630859375,
1.1650390625,
1.1962890625,
0.2235107421875,
-0.3076171875,
-0.192626953125,
-0.408203125,
0.7685546875,
0.82373046875,
-0.755859375,
0.10577392578125,
0.8359375,
0.1251220703125,
0.2469482421875,
0.453857421875,
-0.62841796875,
-0.349609375,
0.287841796875,
0.052337646484375,
0.70654296875,
0.279296875,
0.19091796875,
-0.0311737060546875,
0.6875,
-0.84912109375,
-0.379638671875,
0.05718994140625,
0.7099609375,
0.29638671875,
0.7265625,
0.07745361328125,
-0.333984375,
-0.63916015625,
-0.6474609375,
0.322998046875,
0.455810546875,
0.88232421875,
-0.3740234375,
0.43212890625,
0.412109375,
-0.81591796875,
0.5244140625,
-0.6591796875,
-0.058685302734375,
1.4658203125,
0.08599853515625,
0.67626953125,
-0.38818359375,
0.35888671875,
-0.052001953125,
-0.27099609375,
0.286865234375,
0.1949462890625,
0.396484375,
-0.7041015625,
-0.359619140625,
-0.1531982421875,
0.0264434814453125,
-0.400146484375,
-0.388916015625,
0.127197265625,
-0.2025146484375,
-0.0838623046875,
-0.91796875,
0.334228515625,
0.451171875,
0.20703125,
0.359619140625,
0.623046875,
0.154052734375,
0.52978515625,
0.73681640625,
-0.22705078125,
0.2919921875,
-0.81005859375,
0.255126953125,
0.041229248046875,
-0.389404296875,
-0.3671875,
-0.281005859375,
-0.305419921875,
-0.025787353515625,
0.141845703125,
-0.253662109375,
-0.84130859375,
0.040435791015625,
0.02606201171875,
0.416748046875,
-0.7548828125,
-0.2303466796875,
-0.6435546875,
0.533203125,
0.32080078125,
-0.6982421875,
0.499755859375,
-1.0107421875,
0.615234375,
0.430419921875,
-0.1124267578125,
-0.186279296875,
-0.371337890625,
-0.54052734375,
-0.37060546875,
-0.08807373046875,
0.12396240234375,
0.346923828125,
0.181396484375,
-1.3505859375,
0.51953125,
0.353515625,
-0.439453125,
0.2373046875,
-0.005718231201171875,
0.68994140625,
0.5576171875,
0.90185546875,
-0.5693359375,
-0.31005859375,
0.2464599609375,
-1.24609375,
1.0849609375,
-0.66650390625,
0.716796875,
-0.282958984375,
-0.1549072265625,
0.0070648193359375,
0.320556640625,
-0.468505859375,
-0.08599853515625,
-0.227294921875,
0.1812744140625,
-0.7607421875,
-0.71923828125,
0.463623046875,
0.209228515625,
-0.1353759765625,
0.2568359375,
-0.1380615234375,
0.001392364501953125,
0.348388671875,
0.41357421875,
-0.44091796875,
0.246826171875,
-0.64892578125,
0.419677734375,
-0.2314453125,
-0.72216796875,
-0.07586669921875,
-0.471435546875,
0.38330078125,
-0.10662841796875,
-1.03125,
-0.2431640625,
-1.3828125,
-0.10504150390625,
0.127685546875,
-0.85791015625,
0.051605224609375,
0.420166015625,
0.2880859375,
-0.40625,
-0.51123046875,
-0.7080078125,
-0.392822265625,
-0.62451171875,
-0.370849609375,
0.173095703125,
0.7958984375,
0.939453125,
-0.301025390625,
-0.0258331298828125,
-0.07354736328125,
0.10333251953125,
-0.30615234375,
-0.60302734375,
-0.49267578125,
-0.2259521484375,
-0.31298828125,
0.06634521484375,
0.68115234375,
-0.1636962890625,
0.42919921875,
0.97412109375,
-0.26953125,
0.1597900390625,
-0.14208984375,
-0.63232421875,
0.958984375,
0.1033935546875,
-1.2900390625,
-0.537109375,
0.30517578125,
0.2421875,
0.8056640625,
0.1602783203125,
-0.6298828125,
-0.61767578125,
-1.0888671875,
-0.1522216796875,
-0.64208984375,
-0.254150390625,
-0.87255859375,
-0.447265625,
-0.359375,
0.509765625,
-0.208984375,
-0.884765625,
0.1136474609375,
-0.8583984375,
0.133056640625,
-0.50634765625,
-0.44580078125,
-0.4775390625,
-0.77880859375,
0.041748046875,
0.9580078125,
-0.2373046875,
0.3212890625,
-0.1409912109375,
-0.2384033203125,
0.283203125,
-0.32763671875,
-0.91748046875,
-0.4033203125,
0.0128326416015625,
0.321533203125,
-0.0399169921875,
-0.1309814453125,
-0.701171875,
0.966796875,
-0.98681640625,
0.4365234375,
-0.060302734375,
-0.54736328125,
0.1837158203125,
-0.271484375,
0.7578125,
-0.405029296875,
-0.1734619140625,
-0.8271484375,
0.46044921875,
0.60595703125,
-0.335693359375,
-0.2998046875,
-0.9013671875,
-0.59423828125,
-0.79931640625,
0.568359375,
-0.69970703125,
0.281982421875,
-0.2469482421875,
-0.09307861328125,
1.0712890625,
-0.17236328125,
0.278076171875,
1.14453125,
0.4755859375,
0.7255859375,
-0.76611328125,
1.0048828125,
0.345703125,
-0.424560546875,
-0.1556396484375,
0.272705078125,
-0.9072265625,
0.5380859375,
-0.564453125,
-0.955078125,
-0.5029296875,
0.1990966796875,
1.5244140625,
-0.23291015625,
0.83984375,
0.037994384765625,
-0.83642578125,
-0.62646484375,
0.89453125,
0.425048828125,
-0.14599609375,
1.056640625,
0.19384765625,
0.1563720703125,
0.406005859375,
-0.06744384765625,
-0.44873046875,
-0.2037353515625,
0.6796875,
-0.1707763671875,
-0.5556640625,
0.94677734375,
0.71484375,
-1.111328125,
-1.001953125,
0.08721923828125,
-0.20166015625,
-0.53466796875,
-0.67724609375,
0.388671875,
0.99658203125,
-0.470458984375,
0.1824951171875,
0.5947265625,
-0.366943359375,
0.59912109375,
0.1077880859375,
0.31787109375,
-0.3837890625,
0.70263671875,
0.82275390625,
-1.0185546875,
-0.12451171875,
-0.9267578125,
-0.1656494140625,
-0.1441650390625,
0.1392822265625,
0.62890625,
-0.2303466796875,
-0.061859130859375,
0.56005859375,
-0.55908203125,
0.416748046875,
-0.66064453125,
-0.56787109375,
0.284912109375,
-0.477783203125,
-1.017578125,
-0.0325927734375,
0.50341796875,
-0.2283935546875,
0.283935546875,
-0.5087890625,
-0.0758056640625,
0.318359375,
0.257080078125,
-0.57958984375,
-0.83642578125,
-0.383544921875,
-0.89794921875,
-0.56640625,
-0.6201171875,
-0.11956787109375,
-0.52392578125,
0.30419921875,
0.0322265625,
-0.393310546875,
0.147705078125,
0.044677734375,
-0.7880859375,
0.5380859375,
-0.241455078125,
0.6318359375,
-0.57177734375,
-0.347412109375,
-0.2998046875,
0.01390838623046875,
-0.6513671875,
-0.05499267578125,
-0.4267578125,
0.3232421875,
-0.2293701171875,
0.4248046875,
-0.045654296875,
0.646484375,
-0.2340087890625,
-0.4560546875,
-0.0182037353515625,
-0.002651214599609375,
-0.2568359375,
0.8779296875,
0.66650390625,
-0.03289794921875,
0.1748046875,
-0.1102294921875,
-0.3515625,
0.03082275390625,
0.2783203125,
0.34130859375,
-0.57470703125,
-0.1851806640625,
-0.330078125,
-0.0670166015625,
-1.03515625,
0.1572265625,
-0.38037109375,
0.71142578125,
-0.050506591796875,
-0.273193359375,
0.262939453125,
1.263671875,
-0.0126953125,
0.1436767578125,
-0.10357666015625,
0.1119384765625,
0.5888671875,
-0.052154541015625,
-0.056793212890625,
0.0246429443359375,
0.44287109375,
-0.224609375,
0.0024013519287109375,
0.9072265625,
-0.1934814453125,
0.54931640625,
-0.1280517578125,
-0.8310546875,
-0.73388671875,
-0.1097412109375,
-0.1807861328125,
0.47265625,
0.1697998046875,
-0.533203125,
0.0638427734375,
0.1402587890625,
-0.85009765625,
0.267822265625,
-1.060546875,
-0.6279296875,
0.304931640625,
-0.46337890625,
-0.0970458984375,
-0.17138671875,
-0.8681640625,
-0.1815185546875,
0.318115234375,
0.62451171875,
-0.44580078125,
0.5322265625,
0.1282958984375,
0.5205078125,
-0.134033203125,
0.002376556396484375,
-0.281494140625,
-0.08154296875,
-0.564453125,
-0.5615234375,
0.59814453125,
1.150390625,
0.30029296875,
0.004974365234375,
-0.67431640625,
0.44775390625,
-0.1630859375,
0.25390625,
-0.19775390625,
0.46484375,
-0.420166015625,
0.529296875,
-0.87548828125,
0.048004150390625,
-0.10595703125,
0.455810546875,
0.304443359375,
-0.018310546875,
-0.2352294921875,
0.875,
0.6689453125,
-0.331298828125,
0.027374267578125,
0.356689453125,
0.459228515625,
-0.43115234375,
-0.243896484375,
-0.294189453125,
0.888671875,
0.437744140625,
0.452392578125,
-0.1759033203125,
0.5986328125,
0.8818359375,
0.27392578125,
0.1002197265625,
0.74609375,
0.23193359375,
-0.2230224609375,
0.06317138671875,
-0.66064453125,
-0.51708984375,
0.006252288818359375,
-0.2166748046875,
0.59228515625,
-0.11029052734375,
0.351806640625,
0.0204315185546875,
-0.81005859375,
0.8603515625,
0.1358642578125,
-0.06134033203125,
-0.0394287109375,
-0.57275390625,
0.218017578125,
0.90478515625,
0.278076171875,
-0.076171875,
0.60791015625,
0.7724609375,
0.51171875,
0.474365234375,
0.58544921875,
0.35107421875,
-0.325439453125,
0.1033935546875,
0.00356292724609375,
-0.0285186767578125,
-0.51513671875,
-0.5537109375,
-1.1884765625,
0.41162109375,
-0.6357421875,
-0.455322265625,
0.9111328125,
-0.70703125,
-0.10595703125,
-0.2305908203125,
0.493408203125,
-0.301513671875,
0.56494140625,
0.53564453125,
-0.385498046875,
-0.7529296875,
0.98681640625,
-0.038482666015625,
0.59033203125,
0.155517578125,
1.4228515625,
-0.20068359375,
0.90771484375,
0.355712890625,
-0.126220703125,
-0.1712646484375,
0.261474609375,
-0.403564453125,
-0.6728515625,
-0.2529296875,
-0.468505859375,
0.261962890625,
-0.513671875,
-0.62255859375,
-0.144287109375,
0.79150390625,
-0.197509765625,
-1.2763671875,
-0.35791015625,
0.1177978515625,
-0.4912109375,
0.76171875,
0.134765625,
-0.056915283203125,
0.1416015625,
-0.12646484375,
-0.06005859375,
-0.337890625,
0.09149169921875,
-0.457763671875,
0.42041015625,
-0.61474609375,
-0.4736328125,
-0.88916015625,
-0.409423828125,
-0.400390625,
-0.0306854248046875,
-0.5390625,
-0.81005859375,
0.371337890625,
0.3359375,
0.3212890625,
0.325927734375,
-0.07122802734375,
0.489501953125,
1.2958984375,
0.984375,
0.057403564453125,
1.2373046875,
0.288818359375,
-0.4267578125,
0.455078125,
-0.6630859375,
0.78369140625,
-0.035186767578125,
0.07147216796875,
-0.3486328125,
0.386962890625,
-0.361083984375,
-0.93359375,
0.25,
1.0146484375,
0.22119140625,
-0.689453125,
-1.314453125,
-0.0222015380859375,
-0.97412109375,
-0.10614013671875,
-0.71044921875,
0.85107421875,
0.05303955078125,
-0.201171875,
-0.240966796875,
-1.0810546875,
4.30078125,
0.73193359375,
1.2568359375,
0.5576171875,
0.1251220703125,
1.09765625,
0.5029296875,
-0.26025390625,
-0.360107421875,
-0.64990234375,
0.57373046875,
-0.5927734375,
0.0478515625,
0.47509765625,
0.2476806640625,
0.1783447265625,
-0.38330078125,
0.433837890625,
0.252685546875,
-0.52587890625,
-0.80859375,
0.362548828125,
0.2440185546875,
0.61474609375,
0.01146697998046875,
0.4765625,
0.53955078125,
-0.40966796875,
-0.14013671875,
-0.98583984375,
0.086181640625,
-0.67041015625,
0.796875,
0.027435302734375,
-0.1220703125,
0.72607421875,
-0.275634765625,
-0.51904296875,
-0.62158203125,
0.334716796875,
-0.436279296875,
-0.158935546875,
0.51025390625,
-0.489013671875,
0.0604248046875,
0.35546875,
-0.61083984375,
0.281982421875,
0.318115234375,
-0.80810546875,
1.064453125,
-0.3359375,
0.4970703125,
-0.931640625,
-0.334716796875,
0.3125,
0.1231689453125,
-0.07537841796875,
-0.297119140625,
0.390625,
0.416259765625,
0.104736328125,
-0.09869384765625,
0.662109375,
-0.91162109375,
0.360595703125,
-0.09918212890625,
0.564453125,
-0.47265625,
-0.34326171875,
-0.0860595703125,
0.09368896484375,
0.2388916015625,
-0.275146484375,
0.415771484375,
0.082275390625,
0.1563720703125,
0.84716796875,
0.2122802734375,
-0.78564453125,
0.248046875,
-0.00860595703125,
-0.253662109375,
-0.58544921875,
0.568359375,
1.193359375,
-0.685546875,
-0.439697265625,
-0.338134765625,
1.03515625,
0.591796875,
0.54345703125,
0.35546875,
-0.58740234375,
-0.1024169921875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.
A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the temple and read the string aloud. However, nothing happened. Then Asterix supposed that a password is some substring t of the string s.
Prefix supposed that the substring t is the beginning of the string s; Suffix supposed that the substring t should be the end of the string s; and Obelix supposed that t should be located somewhere inside the string s, that is, t is neither its beginning, nor its end.
Asterix chose the substring t so as to please all his companions. Besides, from all acceptable variants Asterix chose the longest one (as Asterix loves long strings). When Asterix read the substring t aloud, the temple doors opened.
You know the string s. Find the substring t or determine that such substring does not exist and all that's been written above is just a nice legend.
Input
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
Output
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
Examples
Input
fixprefixsuffix
Output
fix
Input
abcdabc
Output
Just a legend
Tags: binary search, dp, hashing, string suffix structures, strings
Correct Solution:
```
def kmp_fail(p):
m=len(p)
fail=m*[0]
k=0
j=1
while j<m:
if p[j]==p[k]:
fail[j]=k+1
j+=1
k+=1
elif k>0:
k=fail[k-1]
else:
j+=1
return fail
s=input()
f=kmp_fail(s)
ans=f[-1]
if f.count(f[-1])>1 and ans!=0:
print(s[0:ans])
elif f[ans-1]>0:
print(s[0:f[ans-1]])
else:
print('Just a legend')
```
| 43,069
|
[
0.389404296875,
-0.035491943359375,
0.22216796875,
-0.02618408203125,
-0.121337890625,
-0.26806640625,
-0.043487548828125,
0.0673828125,
0.13671875,
0.7314453125,
0.55859375,
0.1636962890625,
-0.07000732421875,
-0.95654296875,
-0.86572265625,
0.380859375,
-0.41015625,
-0.5087890625,
-0.37939453125,
-0.2437744140625,
-0.1512451171875,
0.036224365234375,
-1.271484375,
-0.4326171875,
-0.3046875,
0.67822265625,
0.05548095703125,
0.41357421875,
0.8203125,
1.2158203125,
0.059051513671875,
-0.31298828125,
0.5234375,
-0.88525390625,
-0.52392578125,
-0.262451171875,
0.56591796875,
-0.82568359375,
0.0273590087890625,
-0.53515625,
-0.030029296875,
0.13671875,
0.266845703125,
-0.8017578125,
-0.99951171875,
0.235595703125,
-0.427734375,
-0.272216796875,
-0.1610107421875,
-0.49072265625,
-0.07440185546875,
-0.374267578125,
0.60205078125,
0.05224609375,
0.1402587890625,
-0.1297607421875,
-0.00548553466796875,
-0.06768798828125,
-0.258544921875,
0.183837890625,
0.3662109375,
0.1922607421875,
0.11785888671875,
-0.80419921875,
0.006092071533203125,
-0.061248779296875,
-0.260009765625,
-0.4130859375,
0.135498046875,
-0.89404296875,
-0.263916015625,
0.59033203125,
-0.09130859375,
-0.7470703125,
-0.65673828125,
0.377685546875,
0.423583984375,
0.1705322265625,
-0.410888671875,
0.321044921875,
-0.1181640625,
0.83642578125,
0.64208984375,
-0.1517333984375,
-0.387939453125,
-0.7353515625,
-0.12371826171875,
0.5361328125,
0.311767578125,
-0.139892578125,
-0.319091796875,
0.71044921875,
-0.396484375,
-0.09661865234375,
0.419677734375,
0.85498046875,
-0.448486328125,
0.2451171875,
0.1434326171875,
0.1552734375,
0.35693359375,
0.78857421875,
-0.76611328125,
0.5634765625,
-0.229736328125,
0.0947265625,
0.27392578125,
0.09466552734375,
-0.0810546875,
-0.480712890625,
0.006256103515625,
-0.779296875,
0.79736328125,
0.36279296875,
0.1708984375,
0.92333984375,
-0.46435546875,
0.2783203125,
-0.83642578125,
-0.0270843505859375,
0.5771484375,
-0.00384521484375,
0.72998046875,
-0.0899658203125,
0.004528045654296875,
-0.0750732421875,
-0.346923828125,
0.72900390625,
-0.79931640625,
0.07086181640625,
0.288330078125,
-0.08740234375,
-0.004795074462890625,
0.61181640625,
-0.158447265625,
0.70166015625,
-0.05633544921875,
0.6103515625,
0.69482421875,
-1.0849609375,
0.802734375,
0.044403076171875,
0.11322021484375,
1.533203125,
0.62939453125,
0.0102081298828125,
0.432373046875,
0.0980224609375,
-0.75341796875,
0.308349609375,
-1.1416015625,
0.38427734375,
0.32275390625,
-0.0706787109375,
-0.58251953125,
0.2235107421875,
-0.59521484375,
0.494384765625,
0.1295166015625,
0.1732177734375,
-0.44287109375,
0.3369140625,
-0.0278167724609375,
1.0625,
-0.17431640625,
0.9541015625,
-0.408935546875,
-0.5390625,
-0.11614990234375,
-0.873046875,
0.1326904296875,
-0.05810546875,
0.07586669921875,
0.7041015625,
0.61962890625,
1.2314453125,
1.001953125,
-0.262451171875,
0.36279296875,
0.368408203125,
-0.446533203125,
0.27197265625,
0.11383056640625,
0.6865234375,
0.197021484375,
0.054046630859375,
0.3544921875,
-0.0626220703125,
-1.0009765625,
-0.29736328125,
-0.09539794921875,
0.76953125,
-0.43310546875,
0.53466796875,
0.1806640625,
0.1029052734375,
-0.71435546875,
-0.251953125,
-0.0301361083984375,
-1.3525390625,
-0.3388671875,
0.83203125,
-0.236083984375,
0.68310546875,
-0.204833984375,
-0.47412109375,
0.748046875,
1.3388671875,
-0.03466796875,
0.1572265625,
0.4375,
0.103759765625,
0.00811004638671875,
0.408447265625,
0.2421875,
-0.3369140625,
-0.80615234375,
1.1552734375,
-0.1712646484375,
0.0170745849609375,
-0.294921875,
0.63916015625,
0.12548828125,
0.423095703125,
-0.433349609375,
-0.2462158203125,
0.31103515625,
1.171875,
0.0258026123046875,
0.28466796875,
0.05120849609375,
0.7412109375,
0.57763671875,
0.78759765625,
0.404541015625,
0.400146484375,
0.6298828125,
0.6953125,
0.1585693359375,
-0.1424560546875,
-0.1422119140625,
0.20947265625,
0.4873046875,
0.7666015625,
0.1982421875,
0.399658203125,
-0.0034122467041015625,
-0.31787109375,
-0.261962890625,
0.08050537109375,
0.09161376953125,
0.9091796875,
0.1561279296875,
0.1668701171875,
-0.6708984375,
-0.1949462890625,
0.242919921875,
0.783203125,
-0.9521484375,
-0.53759765625,
-0.036102294921875,
-0.393310546875,
0.300537109375,
-0.213623046875,
0.6298828125,
0.1627197265625,
0.485107421875,
0.595703125,
-0.454833984375,
-0.638671875,
-0.76611328125,
-0.7177734375,
-1.072265625,
-0.292724609375,
-0.57861328125,
-0.241943359375,
0.53125,
-0.81591796875,
0.169921875,
-0.397705078125,
0.01535797119140625,
0.458740234375,
-0.673828125,
0.8603515625,
-0.03411865234375,
0.732421875,
-0.40478515625,
0.697265625,
0.0152740478515625,
0.7666015625,
-0.802734375,
-0.201171875,
-0.2919921875,
-0.58544921875,
0.19921875,
0.09881591796875,
0.3447265625,
-0.10968017578125,
-0.28076171875,
-0.71240234375,
-0.43798828125,
-0.326904296875,
-0.59228515625,
0.5595703125,
-0.80126953125,
0.5849609375,
0.80029296875,
-0.478759765625,
0.78369140625,
0.78564453125,
-0.5263671875,
0.77490234375,
0.376953125,
0.10528564453125,
-0.96923828125,
1.3896484375,
0.3896484375,
0.150390625,
-0.5498046875,
-0.59375,
-0.475830078125,
-0.185302734375,
0.241943359375,
-0.41748046875,
-0.2230224609375,
0.89306640625,
-0.02239990234375,
-0.99755859375,
0.322021484375,
-1.2109375,
-0.275634765625,
-0.11407470703125,
-0.326171875,
0.93310546875,
0.44921875,
0.26806640625,
-0.479736328125,
-0.61669921875,
0.2320556640625,
0.52001953125,
0.032501220703125,
-0.328857421875,
-0.191162109375,
0.43408203125,
-0.12646484375,
0.2822265625,
-0.176513671875,
-0.5966796875,
-0.187744140625,
-0.2403564453125,
0.007198333740234375,
0.60302734375,
0.272705078125,
0.208251953125,
0.6435546875,
0.83251953125,
-0.78173828125,
-0.0919189453125,
-0.353271484375,
0.86083984375,
0.459716796875,
0.18798828125,
0.537109375,
-0.17822265625,
-0.4599609375,
-1.12109375,
-0.04254150390625,
0.272216796875,
0.95751953125,
-0.654296875,
0.421142578125,
0.33203125,
-0.63427734375,
0.7119140625,
-0.884765625,
-0.058807373046875,
1.0361328125,
-0.74169921875,
0.7646484375,
-0.2437744140625,
0.32958984375,
-0.1717529296875,
0.1656494140625,
0.450927734375,
0.053985595703125,
0.46337890625,
-0.1544189453125,
-0.62646484375,
-0.012420654296875,
-0.09246826171875,
-0.1845703125,
-0.4931640625,
0.6435546875,
-0.258544921875,
-0.56591796875,
-0.658203125,
0.8515625,
0.82763671875,
0.7373046875,
-0.11029052734375,
0.0176544189453125,
-0.1611328125,
0.63037109375,
0.2412109375,
-0.6103515625,
0.1788330078125,
-0.8271484375,
0.7646484375,
0.138916015625,
0.0831298828125,
-0.429931640625,
0.06964111328125,
-0.3740234375,
0.322509765625,
0.0897216796875,
-0.2459716796875,
-0.86865234375,
0.27880859375,
0.2052001953125,
0.48388671875,
-0.955078125,
-0.52587890625,
-0.2978515625,
0.2462158203125,
0.273193359375,
-0.78369140625,
0.035430908203125,
-0.6826171875,
0.445068359375,
0.1678466796875,
-0.03643798828125,
-0.35107421875,
-0.724609375,
-0.52197265625,
-0.55859375,
-0.1549072265625,
0.82666015625,
0.09320068359375,
0.421630859375,
-1.2060546875,
0.471435546875,
0.1563720703125,
-0.0172576904296875,
-0.2252197265625,
0.049652099609375,
0.417236328125,
0.053314208984375,
0.81640625,
-0.358154296875,
-0.65234375,
0.257568359375,
-1.3134765625,
0.56201171875,
-0.32861328125,
0.397705078125,
-0.0118865966796875,
-0.06005859375,
0.1048583984375,
0.509765625,
-0.466552734375,
0.418701171875,
-0.229248046875,
0.1883544921875,
-0.33544921875,
-0.74169921875,
0.85107421875,
-0.29296875,
-0.76318359375,
0.9765625,
0.16064453125,
-0.0278472900390625,
0.38916015625,
0.748046875,
-0.341552734375,
0.3056640625,
-0.377685546875,
0.5,
-0.441162109375,
-0.54052734375,
0.11590576171875,
-0.26025390625,
1.158203125,
0.1943359375,
-0.52734375,
-0.53955078125,
-0.85693359375,
0.1444091796875,
-0.029693603515625,
-0.23046875,
0.615234375,
0.34130859375,
-0.05926513671875,
-0.0986328125,
-0.457275390625,
-0.416015625,
-0.06396484375,
-0.515625,
-0.05084228515625,
0.79638671875,
0.82080078125,
0.7412109375,
0.0003719329833984375,
-0.58056640625,
-0.1610107421875,
0.05218505859375,
0.1630859375,
-0.609375,
-0.4384765625,
-0.429931640625,
0.002559661865234375,
-0.341064453125,
-0.0718994140625,
0.29248046875,
0.50390625,
1.0537109375,
0.340087890625,
0.4404296875,
0.51904296875,
-0.385498046875,
0.64013671875,
0.2401123046875,
-1.16796875,
-0.53271484375,
0.5087890625,
0.0173492431640625,
0.97802734375,
0.1453857421875,
-0.452880859375,
-0.59228515625,
-0.822265625,
0.1353759765625,
-0.5791015625,
-0.1787109375,
-0.9404296875,
0.06158447265625,
-0.33203125,
0.71240234375,
-0.1632080078125,
-0.97998046875,
0.0172882080078125,
-0.8720703125,
-0.023712158203125,
-0.318115234375,
-0.1341552734375,
-0.748046875,
-0.7236328125,
-0.2423095703125,
0.6064453125,
-0.0029449462890625,
0.4404296875,
-0.038177490234375,
-0.1134033203125,
0.2220458984375,
-0.283203125,
-0.59619140625,
-0.290283203125,
0.006862640380859375,
-0.07830810546875,
-0.21826171875,
0.229736328125,
-0.51904296875,
0.4873046875,
-0.79736328125,
0.44091796875,
-0.07537841796875,
0.2254638671875,
-0.471923828125,
-0.15576171875,
0.6162109375,
-0.38427734375,
-0.1295166015625,
0.0223388671875,
0.1986083984375,
0.70703125,
-0.23828125,
-0.52099609375,
-0.9951171875,
-0.771484375,
-1.0546875,
0.477783203125,
-0.5966796875,
-0.3017578125,
-0.478271484375,
-0.306640625,
1.0888671875,
-0.5947265625,
0.2049560546875,
1.21484375,
0.1776123046875,
0.377197265625,
-0.6015625,
0.71923828125,
0.65771484375,
-0.8408203125,
-0.40234375,
0.1080322265625,
-0.6669921875,
0.12841796875,
-0.5615234375,
-0.85205078125,
-0.58642578125,
0.2392578125,
1.4453125,
-0.379150390625,
0.83984375,
0.28271484375,
-1.0556640625,
-0.76025390625,
0.927734375,
0.2763671875,
0.1307373046875,
0.86767578125,
0.1632080078125,
-0.304443359375,
-0.12225341796875,
0.033599853515625,
-0.36328125,
-0.55908203125,
0.6904296875,
-0.1510009765625,
-0.2227783203125,
0.5732421875,
0.8681640625,
-1.1083984375,
-0.65478515625,
0.0191192626953125,
0.0771484375,
-0.58642578125,
-0.67578125,
-0.2159423828125,
0.611328125,
-0.57177734375,
-0.004848480224609375,
0.56103515625,
-0.1353759765625,
0.35400390625,
-0.03729248046875,
0.439208984375,
-0.26171875,
0.60986328125,
0.64599609375,
-0.257568359375,
-0.492919921875,
-0.63916015625,
0.0789794921875,
-0.473876953125,
-0.1671142578125,
0.57568359375,
-0.333740234375,
-0.2110595703125,
0.10198974609375,
0.077392578125,
0.671875,
-0.3916015625,
-0.364501953125,
0.712890625,
-0.84228515625,
-0.5205078125,
-0.260498046875,
0.2410888671875,
0.0265960693359375,
0.8916015625,
-0.403076171875,
0.1484375,
0.1968994140625,
0.232666015625,
-0.37548828125,
-1.01171875,
-0.346923828125,
-0.92041015625,
-0.369873046875,
-0.9140625,
-0.71630859375,
0.054168701171875,
0.49853515625,
-0.128173828125,
-0.62939453125,
0.32080078125,
0.323486328125,
-0.59130859375,
0.93701171875,
-0.46435546875,
0.43408203125,
-0.63671875,
-0.34033203125,
-1.287109375,
-0.350341796875,
-0.43310546875,
0.09027099609375,
-0.611328125,
0.509765625,
-0.2100830078125,
0.6904296875,
-0.198486328125,
0.4228515625,
-0.235595703125,
-0.560546875,
0.09698486328125,
0.316162109375,
-0.03997802734375,
0.88037109375,
0.64013671875,
-0.2119140625,
0.403076171875,
-0.360595703125,
-0.2393798828125,
-0.13134765625,
0.52685546875,
0.2491455078125,
-0.2158203125,
0.0963134765625,
-0.449951171875,
0.18408203125,
-1.00390625,
0.1319580078125,
-0.5498046875,
0.0007653236389160156,
0.054656982421875,
0.16455078125,
0.487548828125,
1.04296875,
-0.09716796875,
-0.0072479248046875,
0.1146240234375,
0.27978515625,
0.521484375,
0.2880859375,
-0.432861328125,
0.421875,
-0.0164031982421875,
-0.72216796875,
0.1285400390625,
0.046234130859375,
0.0096588134765625,
0.11151123046875,
-0.0909423828125,
-0.4990234375,
-0.91552734375,
0.00778961181640625,
0.003803253173828125,
0.079345703125,
0.5,
-0.529296875,
-0.33349609375,
-0.2386474609375,
-0.477294921875,
0.2208251953125,
-0.9619140625,
-0.5986328125,
0.64501953125,
0.0025539398193359375,
-0.498291015625,
-0.53857421875,
-0.342041015625,
0.050079345703125,
-0.03436279296875,
0.0296783447265625,
-0.359375,
0.99267578125,
0.2042236328125,
0.60498046875,
0.0330810546875,
-0.042266845703125,
-0.345947265625,
0.7568359375,
-1.0166015625,
-0.625,
0.368408203125,
0.787109375,
0.27197265625,
0.050811767578125,
-0.47900390625,
0.1597900390625,
0.2423095703125,
0.35498046875,
-0.43505859375,
-0.1378173828125,
-0.2332763671875,
0.7919921875,
-0.818359375,
0.07470703125,
0.1927490234375,
0.35302734375,
0.338134765625,
-0.361572265625,
-0.75244140625,
0.85107421875,
0.859375,
-0.401123046875,
0.332275390625,
0.416015625,
0.435546875,
0.323974609375,
-0.30126953125,
-0.275390625,
0.630859375,
0.81640625,
0.8232421875,
-0.2568359375,
0.38232421875,
0.69091796875,
-0.134033203125,
-0.0374755859375,
0.135009765625,
-0.1009521484375,
0.02001953125,
-0.06072998046875,
0.1907958984375,
-0.058441162109375,
0.2012939453125,
-0.58935546875,
0.03411865234375,
-0.392578125,
-0.0927734375,
-0.61474609375,
-0.315673828125,
0.55810546875,
0.061614990234375,
0.0706787109375,
0.38916015625,
-0.99267578125,
0.289794921875,
0.7109375,
-0.426025390625,
-0.302001953125,
0.7099609375,
0.61083984375,
0.4052734375,
0.60107421875,
-0.023040771484375,
0.693359375,
-0.36083984375,
0.5107421875,
0.29248046875,
0.043121337890625,
-0.642578125,
-0.7099609375,
-1.0556640625,
0.45361328125,
-0.48876953125,
-0.269775390625,
0.94677734375,
-0.486083984375,
-0.18701171875,
-0.302490234375,
0.378173828125,
-0.257568359375,
0.096923828125,
0.115966796875,
-0.2427978515625,
-1.0966796875,
0.65771484375,
-0.0921630859375,
0.428466796875,
0.1258544921875,
1.0498046875,
0.041778564453125,
1.505859375,
0.7236328125,
-0.02447509765625,
-0.418701171875,
0.673828125,
-0.62744140625,
-0.35205078125,
-0.158203125,
-0.765625,
-0.1741943359375,
-0.88623046875,
-0.65625,
-0.398681640625,
1.00390625,
0.1451416015625,
-1.1689453125,
-0.1441650390625,
0.255126953125,
-0.85888671875,
0.347900390625,
0.388427734375,
0.220947265625,
-0.22607421875,
-0.22021484375,
0.27099609375,
-0.9970703125,
0.176513671875,
-0.525390625,
0.1993408203125,
-0.9345703125,
-0.51025390625,
-0.470458984375,
-0.7314453125,
-0.2410888671875,
-0.320068359375,
-0.049713134765625,
-0.568359375,
0.5830078125,
0.467041015625,
0.468505859375,
0.11529541015625,
-0.405029296875,
0.226806640625,
0.55712890625,
1.041015625,
-0.31640625,
0.8798828125,
0.39111328125,
-0.3740234375,
0.0391845703125,
-0.71533203125,
0.43798828125,
-0.4853515625,
-0.12841796875,
-0.468994140625,
0.0819091796875,
-0.529296875,
-1.373046875,
-0.09375,
0.370849609375,
0.327392578125,
-0.493408203125,
-1.248046875,
-0.05010986328125,
-0.994140625,
-0.1962890625,
-0.63330078125,
0.30224609375,
-0.376220703125,
-0.07275390625,
-0.045562744140625,
-0.9267578125,
4.4140625,
1.09765625,
1.19921875,
0.379638671875,
-0.1573486328125,
0.7587890625,
0.646484375,
-0.7919921875,
-0.144775390625,
-0.365966796875,
0.5400390625,
-0.1416015625,
0.002513885498046875,
0.755859375,
0.1788330078125,
0.6904296875,
-1.0390625,
0.331298828125,
0.021942138671875,
-0.76904296875,
-0.7939453125,
0.330078125,
0.19189453125,
0.189453125,
-0.4580078125,
0.52490234375,
0.56298828125,
-0.8701171875,
-0.212890625,
-0.916015625,
0.264404296875,
-0.462646484375,
1.2607421875,
-0.200927734375,
-0.136474609375,
0.5625,
0.037933349609375,
-0.24267578125,
0.1326904296875,
-0.09869384765625,
-0.1549072265625,
-0.195068359375,
0.396240234375,
-0.73681640625,
0.1995849609375,
0.29736328125,
-0.396240234375,
0.11590576171875,
0.4951171875,
-0.8681640625,
1.2490234375,
-0.106689453125,
0.3349609375,
-0.853515625,
-0.64501953125,
-0.02911376953125,
0.232666015625,
-0.05908203125,
-0.218505859375,
0.3583984375,
0.30029296875,
0.3115234375,
0.2042236328125,
0.1361083984375,
-0.7548828125,
1.083984375,
-0.1656494140625,
0.273193359375,
-0.61376953125,
-0.482666015625,
-0.360107421875,
-0.67529296875,
-0.482666015625,
-0.3310546875,
0.939453125,
0.08447265625,
0.00856781005859375,
0.775390625,
0.338623046875,
-0.255126953125,
0.00946807861328125,
-0.460693359375,
-0.75341796875,
-0.316162109375,
0.431884765625,
1.3525390625,
-0.49609375,
-0.240234375,
-0.4716796875,
0.74609375,
0.62060546875,
0.7138671875,
-0.051513671875,
-0.5634765625,
-0.258544921875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.
A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the temple and read the string aloud. However, nothing happened. Then Asterix supposed that a password is some substring t of the string s.
Prefix supposed that the substring t is the beginning of the string s; Suffix supposed that the substring t should be the end of the string s; and Obelix supposed that t should be located somewhere inside the string s, that is, t is neither its beginning, nor its end.
Asterix chose the substring t so as to please all his companions. Besides, from all acceptable variants Asterix chose the longest one (as Asterix loves long strings). When Asterix read the substring t aloud, the temple doors opened.
You know the string s. Find the substring t or determine that such substring does not exist and all that's been written above is just a nice legend.
Input
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
Output
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
Examples
Input
fixprefixsuffix
Output
fix
Input
abcdabc
Output
Just a legend
Tags: binary search, dp, hashing, string suffix structures, strings
Correct Solution:
```
s = input()
n = len(s)
if n==1 or n==2:
print("Just a legend")
else:
lista = []
for i in range(n):
lista.append(0)
l = 0
lista[0] = 0
i = 1
while i < n:
if s[i]==s[l]:
l+=1
lista[i] = l
i += 1
else:
if l!=0:
l = lista[l-1]
else:
lista[i] = 0
i += 1
ultimo = lista.pop()
if (ultimo == 0):
print("Just a legend")
elif (ultimo in lista):
print(s[:ultimo])
elif (lista[ultimo-1] == 0):
print("Just a legend")
elif lista[ultimo-1]:
print(s[:lista[ultimo-1]])
else:
print("Just a legend")
```
| 43,070
|
[
0.39404296875,
0.0131378173828125,
0.2408447265625,
-0.09332275390625,
-0.1337890625,
-0.326416015625,
0.0091552734375,
0.08624267578125,
0.160400390625,
0.74169921875,
0.54296875,
0.1986083984375,
-0.08251953125,
-0.9521484375,
-0.89208984375,
0.294677734375,
-0.445556640625,
-0.5078125,
-0.41650390625,
-0.2763671875,
-0.22021484375,
0.0086517333984375,
-1.244140625,
-0.462158203125,
-0.301025390625,
0.67138671875,
0.06298828125,
0.439208984375,
0.82763671875,
1.2158203125,
0.006870269775390625,
-0.345703125,
0.51318359375,
-0.919921875,
-0.5185546875,
-0.2171630859375,
0.5615234375,
-0.82958984375,
-0.028045654296875,
-0.47998046875,
-0.0008983612060546875,
0.1251220703125,
0.3125,
-0.81494140625,
-1.0380859375,
0.1593017578125,
-0.40869140625,
-0.29638671875,
-0.221435546875,
-0.5263671875,
-0.10687255859375,
-0.385498046875,
0.67724609375,
0.048187255859375,
0.08795166015625,
-0.14697265625,
-0.0340576171875,
-0.11944580078125,
-0.231201171875,
0.1754150390625,
0.368896484375,
0.1885986328125,
0.159423828125,
-0.765625,
-0.0282745361328125,
-0.057403564453125,
-0.194091796875,
-0.3818359375,
0.137451171875,
-0.8525390625,
-0.266357421875,
0.59033203125,
-0.04833984375,
-0.705078125,
-0.6728515625,
0.326416015625,
0.5302734375,
0.13330078125,
-0.361572265625,
0.357177734375,
-0.1376953125,
0.841796875,
0.580078125,
-0.1429443359375,
-0.43994140625,
-0.7333984375,
-0.10015869140625,
0.4951171875,
0.375,
-0.234375,
-0.34033203125,
0.63671875,
-0.395263671875,
-0.1390380859375,
0.36181640625,
0.83056640625,
-0.434814453125,
0.24609375,
0.2119140625,
0.20849609375,
0.3798828125,
0.72314453125,
-0.68505859375,
0.5810546875,
-0.24609375,
0.10675048828125,
0.303955078125,
0.124755859375,
-0.12353515625,
-0.47216796875,
-0.05572509765625,
-0.8154296875,
0.86474609375,
0.416015625,
0.2099609375,
0.92041015625,
-0.458251953125,
0.298583984375,
-0.86669921875,
-0.0083160400390625,
0.5615234375,
-0.036224365234375,
0.7294921875,
-0.16162109375,
-0.0311126708984375,
-0.05303955078125,
-0.260986328125,
0.6328125,
-0.81494140625,
0.05450439453125,
0.2705078125,
-0.0809326171875,
0.0247650146484375,
0.62255859375,
-0.1741943359375,
0.736328125,
-0.037994384765625,
0.65087890625,
0.74267578125,
-1.12890625,
0.794921875,
0.032440185546875,
0.0504150390625,
1.5322265625,
0.6796875,
-0.0389404296875,
0.43310546875,
0.1856689453125,
-0.81787109375,
0.3271484375,
-1.1669921875,
0.48291015625,
0.30419921875,
-0.0831298828125,
-0.6455078125,
0.2352294921875,
-0.5810546875,
0.479736328125,
0.179443359375,
0.18359375,
-0.466064453125,
0.3154296875,
-0.03363037109375,
1.064453125,
-0.1732177734375,
1.0029296875,
-0.361328125,
-0.5771484375,
-0.0777587890625,
-0.8544921875,
0.065185546875,
-0.01123809814453125,
0.039337158203125,
0.7060546875,
0.62109375,
1.265625,
1.0478515625,
-0.23876953125,
0.400634765625,
0.39208984375,
-0.54150390625,
0.3173828125,
0.0219268798828125,
0.7216796875,
0.183349609375,
0.0219879150390625,
0.44921875,
-0.0897216796875,
-0.97119140625,
-0.24755859375,
-0.0750732421875,
0.80712890625,
-0.3974609375,
0.54345703125,
0.1546630859375,
0.11199951171875,
-0.720703125,
-0.229248046875,
-0.0784912109375,
-1.3193359375,
-0.3154296875,
0.79833984375,
-0.23828125,
0.703125,
-0.2200927734375,
-0.52880859375,
0.765625,
1.3955078125,
0.011962890625,
0.1859130859375,
0.443115234375,
0.11163330078125,
-0.046112060546875,
0.46533203125,
0.28369140625,
-0.383544921875,
-0.7509765625,
1.2080078125,
-0.1602783203125,
0.0206756591796875,
-0.3271484375,
0.59326171875,
0.1370849609375,
0.44677734375,
-0.406494140625,
-0.202880859375,
0.375,
1.0791015625,
0.03997802734375,
0.271728515625,
0.1033935546875,
0.76611328125,
0.51611328125,
0.72802734375,
0.396728515625,
0.394287109375,
0.5595703125,
0.65478515625,
0.1160888671875,
-0.2171630859375,
-0.150634765625,
0.239990234375,
0.478759765625,
0.703125,
0.1500244140625,
0.368408203125,
0.01427459716796875,
-0.3525390625,
-0.305908203125,
0.09356689453125,
0.0841064453125,
0.80126953125,
0.2037353515625,
0.1573486328125,
-0.607421875,
-0.2008056640625,
0.251953125,
0.697265625,
-0.9765625,
-0.52099609375,
-0.06195068359375,
-0.365478515625,
0.357666015625,
-0.201416015625,
0.72216796875,
0.156005859375,
0.5595703125,
0.55810546875,
-0.474365234375,
-0.697265625,
-0.8046875,
-0.73486328125,
-1.0263671875,
-0.341796875,
-0.5810546875,
-0.259033203125,
0.5634765625,
-0.83251953125,
0.235107421875,
-0.452392578125,
-0.030731201171875,
0.411376953125,
-0.69384765625,
0.82666015625,
-0.05841064453125,
0.65283203125,
-0.417724609375,
0.56591796875,
0.0330810546875,
0.87060546875,
-0.7900390625,
-0.09527587890625,
-0.27685546875,
-0.5712890625,
0.1983642578125,
0.153076171875,
0.399658203125,
-0.1103515625,
-0.256103515625,
-0.64453125,
-0.421875,
-0.267822265625,
-0.6806640625,
0.630859375,
-0.84228515625,
0.63427734375,
0.853515625,
-0.59521484375,
0.79248046875,
0.7626953125,
-0.5322265625,
0.73291015625,
0.40087890625,
0.1124267578125,
-0.9443359375,
1.302734375,
0.32470703125,
0.141357421875,
-0.5673828125,
-0.544921875,
-0.44970703125,
-0.159423828125,
0.1937255859375,
-0.380615234375,
-0.272216796875,
0.892578125,
-0.0269012451171875,
-0.943359375,
0.431884765625,
-1.2470703125,
-0.2484130859375,
-0.113525390625,
-0.415283203125,
0.90966796875,
0.4140625,
0.315673828125,
-0.462158203125,
-0.58935546875,
0.2490234375,
0.5673828125,
0.05206298828125,
-0.380859375,
-0.1905517578125,
0.41796875,
-0.11016845703125,
0.331298828125,
-0.1951904296875,
-0.65869140625,
-0.23828125,
-0.28076171875,
-0.00902557373046875,
0.57373046875,
0.265380859375,
0.22314453125,
0.67822265625,
0.8076171875,
-0.8046875,
-0.05072021484375,
-0.33251953125,
0.884765625,
0.499755859375,
0.237060546875,
0.51025390625,
-0.184814453125,
-0.4326171875,
-1.076171875,
-0.10589599609375,
0.252685546875,
1.0087890625,
-0.61328125,
0.463134765625,
0.287841796875,
-0.65087890625,
0.7060546875,
-0.931640625,
-0.0148773193359375,
1.0224609375,
-0.77099609375,
0.7392578125,
-0.2489013671875,
0.30419921875,
-0.1396484375,
0.1632080078125,
0.391845703125,
0.04180908203125,
0.482421875,
-0.18310546875,
-0.63623046875,
0.0267333984375,
-0.0789794921875,
-0.23046875,
-0.4560546875,
0.66064453125,
-0.2198486328125,
-0.56396484375,
-0.599609375,
0.833984375,
0.84423828125,
0.77294921875,
-0.060302734375,
0.1290283203125,
-0.2176513671875,
0.494384765625,
0.1910400390625,
-0.58935546875,
0.148193359375,
-0.82763671875,
0.73681640625,
0.09002685546875,
0.09783935546875,
-0.436767578125,
-0.0180511474609375,
-0.460205078125,
0.366943359375,
0.0360107421875,
-0.24365234375,
-0.90478515625,
0.185546875,
0.1263427734375,
0.424072265625,
-0.99462890625,
-0.5263671875,
-0.35302734375,
0.2479248046875,
0.30322265625,
-0.7509765625,
0.03533935546875,
-0.7412109375,
0.443359375,
0.2227783203125,
-0.007732391357421875,
-0.34765625,
-0.73828125,
-0.53955078125,
-0.591796875,
-0.177734375,
0.8203125,
0.08538818359375,
0.375,
-1.212890625,
0.5009765625,
0.1439208984375,
0.0106964111328125,
-0.2227783203125,
0.028961181640625,
0.37353515625,
0.0183258056640625,
0.8291015625,
-0.280029296875,
-0.66650390625,
0.230224609375,
-1.3447265625,
0.5673828125,
-0.331787109375,
0.440185546875,
-0.07159423828125,
-0.14599609375,
0.1441650390625,
0.478759765625,
-0.57080078125,
0.390625,
-0.2420654296875,
0.1939697265625,
-0.296142578125,
-0.755859375,
0.841796875,
-0.328369140625,
-0.73681640625,
0.986328125,
0.1759033203125,
-0.078857421875,
0.409912109375,
0.80712890625,
-0.372802734375,
0.279052734375,
-0.400634765625,
0.5234375,
-0.5126953125,
-0.56787109375,
0.0960693359375,
-0.206298828125,
1.1318359375,
0.147705078125,
-0.454833984375,
-0.556640625,
-0.81982421875,
0.09515380859375,
-0.04412841796875,
-0.23583984375,
0.58349609375,
0.29736328125,
-0.1153564453125,
-0.058135986328125,
-0.48291015625,
-0.35302734375,
-0.060638427734375,
-0.509765625,
-0.0548095703125,
0.75048828125,
0.7919921875,
0.75537109375,
-0.031280517578125,
-0.5263671875,
-0.1826171875,
0.0716552734375,
0.1654052734375,
-0.60107421875,
-0.39892578125,
-0.368896484375,
0.07470703125,
-0.27587890625,
-0.056732177734375,
0.19580078125,
0.50537109375,
1.0595703125,
0.2332763671875,
0.363037109375,
0.52001953125,
-0.41943359375,
0.66259765625,
0.2406005859375,
-1.09375,
-0.49072265625,
0.45703125,
0.03289794921875,
0.904296875,
0.1453857421875,
-0.368408203125,
-0.5009765625,
-0.9091796875,
0.1395263671875,
-0.53564453125,
-0.109619140625,
-0.94580078125,
0.01959228515625,
-0.301025390625,
0.67041015625,
-0.207275390625,
-0.9228515625,
0.0227203369140625,
-0.87548828125,
0.0167694091796875,
-0.311279296875,
-0.1317138671875,
-0.75439453125,
-0.78857421875,
-0.159912109375,
0.56689453125,
0.019134521484375,
0.4775390625,
0.0345458984375,
-0.08526611328125,
0.1956787109375,
-0.289794921875,
-0.580078125,
-0.236328125,
0.050567626953125,
-0.044525146484375,
-0.1878662109375,
0.1668701171875,
-0.52001953125,
0.5068359375,
-0.79736328125,
0.40576171875,
-0.0230865478515625,
0.1453857421875,
-0.447998046875,
-0.126220703125,
0.6435546875,
-0.3798828125,
-0.1280517578125,
-0.01068878173828125,
0.29931640625,
0.69189453125,
-0.31201171875,
-0.52880859375,
-1.0029296875,
-0.78564453125,
-1.04296875,
0.4716796875,
-0.607421875,
-0.3095703125,
-0.51220703125,
-0.190185546875,
1.1806640625,
-0.59814453125,
0.2197265625,
1.1875,
0.2266845703125,
0.3994140625,
-0.62841796875,
0.74560546875,
0.66748046875,
-0.78271484375,
-0.39990234375,
0.09075927734375,
-0.666015625,
0.052581787109375,
-0.57177734375,
-0.82666015625,
-0.6513671875,
0.261474609375,
1.4326171875,
-0.345947265625,
0.83203125,
0.306884765625,
-1.025390625,
-0.74169921875,
0.92333984375,
0.2286376953125,
0.1373291015625,
0.88916015625,
0.08306884765625,
-0.277587890625,
-0.04998779296875,
0.065185546875,
-0.35205078125,
-0.56494140625,
0.634765625,
-0.135009765625,
-0.2080078125,
0.580078125,
0.8701171875,
-1.15625,
-0.66796875,
-0.0638427734375,
0.12042236328125,
-0.51904296875,
-0.6201171875,
-0.26806640625,
0.59228515625,
-0.55322265625,
0.044097900390625,
0.546875,
-0.130859375,
0.35400390625,
0.0169219970703125,
0.374755859375,
-0.309326171875,
0.5849609375,
0.6298828125,
-0.331787109375,
-0.5419921875,
-0.6611328125,
0.056427001953125,
-0.470458984375,
-0.1226806640625,
0.58984375,
-0.36328125,
-0.21630859375,
0.1746826171875,
0.034576416015625,
0.6875,
-0.345947265625,
-0.43603515625,
0.71533203125,
-0.8525390625,
-0.59619140625,
-0.2476806640625,
0.2276611328125,
0.0299530029296875,
0.8759765625,
-0.34326171875,
0.11785888671875,
0.2352294921875,
0.343505859375,
-0.355712890625,
-1.0322265625,
-0.32568359375,
-0.9462890625,
-0.314697265625,
-0.91552734375,
-0.78076171875,
0.057464599609375,
0.46484375,
-0.12152099609375,
-0.587890625,
0.332763671875,
0.341796875,
-0.59814453125,
0.8701171875,
-0.478271484375,
0.384765625,
-0.5908203125,
-0.316650390625,
-1.2490234375,
-0.308837890625,
-0.41162109375,
0.13037109375,
-0.471435546875,
0.44580078125,
-0.170166015625,
0.61279296875,
-0.14892578125,
0.41259765625,
-0.20654296875,
-0.47314453125,
0.06951904296875,
0.30810546875,
0.06402587890625,
0.89990234375,
0.63671875,
-0.1693115234375,
0.407470703125,
-0.33642578125,
-0.276123046875,
-0.11859130859375,
0.57470703125,
0.196044921875,
-0.20947265625,
0.11865234375,
-0.521484375,
0.138427734375,
-0.96533203125,
0.099853515625,
-0.49560546875,
0.036346435546875,
0.0302276611328125,
0.1922607421875,
0.5068359375,
1.0439453125,
-0.08282470703125,
-0.002475738525390625,
0.193115234375,
0.230224609375,
0.4990234375,
0.30224609375,
-0.37939453125,
0.412109375,
-0.00923919677734375,
-0.703125,
0.1060791015625,
0.0168609619140625,
0.01308441162109375,
0.1827392578125,
-0.153076171875,
-0.466796875,
-0.85400390625,
0.0474853515625,
-0.019866943359375,
0.06292724609375,
0.55029296875,
-0.51953125,
-0.2646484375,
-0.1658935546875,
-0.50732421875,
0.21728515625,
-0.912109375,
-0.658203125,
0.673828125,
0.02142333984375,
-0.48876953125,
-0.568359375,
-0.27099609375,
0.037750244140625,
-0.077392578125,
0.0450439453125,
-0.45068359375,
1.0107421875,
0.1572265625,
0.6162109375,
-0.0298919677734375,
-0.01171112060546875,
-0.33740234375,
0.70068359375,
-0.98681640625,
-0.646484375,
0.452880859375,
0.71240234375,
0.309814453125,
0.033447265625,
-0.50634765625,
0.1341552734375,
0.156494140625,
0.378662109375,
-0.40966796875,
-0.2274169921875,
-0.22802734375,
0.83935546875,
-0.81103515625,
0.00888824462890625,
0.158203125,
0.365478515625,
0.31494140625,
-0.34228515625,
-0.7744140625,
0.84521484375,
0.84228515625,
-0.31005859375,
0.313232421875,
0.37158203125,
0.434326171875,
0.35205078125,
-0.34912109375,
-0.26123046875,
0.67626953125,
0.88525390625,
0.80859375,
-0.251708984375,
0.4404296875,
0.6474609375,
-0.08673095703125,
0.05645751953125,
0.1907958984375,
-0.069580078125,
-0.043731689453125,
-0.09661865234375,
0.1563720703125,
-0.086669921875,
0.246337890625,
-0.57861328125,
0.10382080078125,
-0.38623046875,
-0.1390380859375,
-0.68603515625,
-0.33642578125,
0.5703125,
0.056976318359375,
0.1275634765625,
0.360107421875,
-1.041015625,
0.270751953125,
0.7216796875,
-0.385009765625,
-0.26708984375,
0.71240234375,
0.5693359375,
0.38916015625,
0.62646484375,
0.0237579345703125,
0.7294921875,
-0.302978515625,
0.501953125,
0.289794921875,
0.09539794921875,
-0.67431640625,
-0.6884765625,
-1.0791015625,
0.49951171875,
-0.53076171875,
-0.2568359375,
0.95458984375,
-0.53662109375,
-0.2139892578125,
-0.28466796875,
0.36572265625,
-0.224853515625,
0.08819580078125,
0.159423828125,
-0.24169921875,
-1.0654296875,
0.6904296875,
-0.091552734375,
0.388916015625,
0.0760498046875,
1.021484375,
0.01544189453125,
1.521484375,
0.67041015625,
-0.03863525390625,
-0.396484375,
0.642578125,
-0.57421875,
-0.395263671875,
-0.134521484375,
-0.77001953125,
-0.126708984375,
-0.8837890625,
-0.49951171875,
-0.432373046875,
0.95751953125,
0.2081298828125,
-1.13671875,
-0.1695556640625,
0.253173828125,
-0.8681640625,
0.32080078125,
0.399658203125,
0.2010498046875,
-0.3095703125,
-0.1766357421875,
0.22314453125,
-0.96630859375,
0.1455078125,
-0.51123046875,
0.27880859375,
-0.92333984375,
-0.447509765625,
-0.51171875,
-0.73388671875,
-0.280517578125,
-0.315673828125,
-0.05938720703125,
-0.509765625,
0.52734375,
0.48291015625,
0.45068359375,
0.1273193359375,
-0.327392578125,
0.2015380859375,
0.564453125,
1.041015625,
-0.283203125,
0.79443359375,
0.36181640625,
-0.3740234375,
-0.0282440185546875,
-0.7744140625,
0.374267578125,
-0.452880859375,
-0.1588134765625,
-0.5224609375,
0.11968994140625,
-0.5244140625,
-1.36328125,
-0.0109100341796875,
0.397705078125,
0.32861328125,
-0.427001953125,
-1.2119140625,
-0.045806884765625,
-0.951171875,
-0.10662841796875,
-0.65869140625,
0.29443359375,
-0.344970703125,
-0.06439208984375,
-0.013092041015625,
-0.90478515625,
4.42578125,
1.095703125,
1.26171875,
0.3779296875,
-0.179443359375,
0.7734375,
0.607421875,
-0.857421875,
-0.1937255859375,
-0.35498046875,
0.58349609375,
-0.128662109375,
0.0029010772705078125,
0.75830078125,
0.1650390625,
0.74462890625,
-1.021484375,
0.374755859375,
-0.0137939453125,
-0.712890625,
-0.7890625,
0.364013671875,
0.0933837890625,
0.24951171875,
-0.4462890625,
0.48974609375,
0.53955078125,
-0.86865234375,
-0.225341796875,
-0.94140625,
0.235595703125,
-0.471923828125,
1.275390625,
-0.185791015625,
-0.1517333984375,
0.5615234375,
0.02886962890625,
-0.20703125,
0.10052490234375,
-0.10302734375,
-0.1790771484375,
-0.264404296875,
0.37353515625,
-0.73388671875,
0.18505859375,
0.29443359375,
-0.403076171875,
0.1649169921875,
0.51806640625,
-0.8515625,
1.291015625,
-0.1168212890625,
0.28759765625,
-0.87841796875,
-0.61376953125,
-0.01447296142578125,
0.309326171875,
-0.08001708984375,
-0.273681640625,
0.38818359375,
0.3310546875,
0.27978515625,
0.1771240234375,
0.13330078125,
-0.70947265625,
1.072265625,
-0.2095947265625,
0.2939453125,
-0.6064453125,
-0.470947265625,
-0.308349609375,
-0.6875,
-0.457763671875,
-0.32373046875,
0.9921875,
0.01422882080078125,
-0.05731201171875,
0.7138671875,
0.3388671875,
-0.236572265625,
0.001384735107421875,
-0.464599609375,
-0.7958984375,
-0.3681640625,
0.45703125,
1.3349609375,
-0.56787109375,
-0.21142578125,
-0.491943359375,
0.697265625,
0.61083984375,
0.78759765625,
0.01470947265625,
-0.50390625,
-0.259521484375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.
A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the temple and read the string aloud. However, nothing happened. Then Asterix supposed that a password is some substring t of the string s.
Prefix supposed that the substring t is the beginning of the string s; Suffix supposed that the substring t should be the end of the string s; and Obelix supposed that t should be located somewhere inside the string s, that is, t is neither its beginning, nor its end.
Asterix chose the substring t so as to please all his companions. Besides, from all acceptable variants Asterix chose the longest one (as Asterix loves long strings). When Asterix read the substring t aloud, the temple doors opened.
You know the string s. Find the substring t or determine that such substring does not exist and all that's been written above is just a nice legend.
Input
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
Output
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
Examples
Input
fixprefixsuffix
Output
fix
Input
abcdabc
Output
Just a legend
Tags: binary search, dp, hashing, string suffix structures, strings
Correct Solution:
```
def Zarr(pat,text):
s=pat+"/"+text;
z=[0 for i in range(len(s))]
L=0;R=0;n=len(s);
for i in range(1,len(s)):
if i>R:
L=R=i
while R<n and s[R-L]==s[R]:
R+=1
z[i]=R-L
R-=1
elif z[i-L]+i<=R:
z[i]=z[i-L]
else:
L=i
while R<n and s[R-L]==s[R]:
R+=1
z[i]=R-L
R-=1
dp=[0 for i in range(1000006)]
ans=-1
for i in range(len(pat)+2,len(s)):
dp[z[i]]+=1
for i in range(len(dp)-2,-1,-1):
dp[i]+=dp[i+1]
for i in range(len(pat)+2,len(s)):
if i+z[i]==len(s) and dp[z[i]]>1 and z[i]>ans:
ans=z[i]
if ans==-1:
print("Just a legend")
else:
print(pat[0:ans])
from sys import stdin
texts=stdin.readline().strip()
Zarr(texts,texts)
```
| 43,071
|
[
0.37109375,
-0.0207672119140625,
0.258056640625,
-0.06396484375,
-0.121826171875,
-0.2484130859375,
-0.03887939453125,
0.1007080078125,
0.161865234375,
0.71240234375,
0.51904296875,
0.1783447265625,
-0.1036376953125,
-0.9052734375,
-0.8525390625,
0.336669921875,
-0.419189453125,
-0.5302734375,
-0.421875,
-0.232421875,
-0.2232666015625,
0.046356201171875,
-1.2685546875,
-0.42236328125,
-0.30419921875,
0.64990234375,
0.094482421875,
0.443603515625,
0.8154296875,
1.2333984375,
0.0012674331665039062,
-0.333740234375,
0.53662109375,
-0.923828125,
-0.5126953125,
-0.1982421875,
0.56103515625,
-0.8173828125,
-0.01239013671875,
-0.499267578125,
0.003871917724609375,
0.1314697265625,
0.30810546875,
-0.8359375,
-1.037109375,
0.194091796875,
-0.44140625,
-0.2744140625,
-0.1898193359375,
-0.53369140625,
-0.0977783203125,
-0.383544921875,
0.65185546875,
0.07373046875,
0.15283203125,
-0.146484375,
-0.07952880859375,
-0.102783203125,
-0.23681640625,
0.2147216796875,
0.36376953125,
0.2135009765625,
0.181640625,
-0.7705078125,
-0.026947021484375,
-0.07623291015625,
-0.20166015625,
-0.353759765625,
0.11474609375,
-0.8779296875,
-0.231689453125,
0.5927734375,
-0.11590576171875,
-0.7294921875,
-0.6484375,
0.293701171875,
0.51171875,
0.1055908203125,
-0.40185546875,
0.316162109375,
-0.1630859375,
0.830078125,
0.587890625,
-0.18212890625,
-0.43017578125,
-0.755859375,
-0.11676025390625,
0.5048828125,
0.331298828125,
-0.2322998046875,
-0.306884765625,
0.66748046875,
-0.405029296875,
-0.1309814453125,
0.40478515625,
0.8427734375,
-0.468994140625,
0.278076171875,
0.208984375,
0.2108154296875,
0.363037109375,
0.7900390625,
-0.6767578125,
0.626953125,
-0.26123046875,
0.10235595703125,
0.30322265625,
0.10394287109375,
-0.10003662109375,
-0.414306640625,
-0.0075531005859375,
-0.8095703125,
0.88134765625,
0.40869140625,
0.2109375,
0.892578125,
-0.4404296875,
0.266845703125,
-0.86962890625,
-0.00782012939453125,
0.5390625,
-0.054718017578125,
0.6943359375,
-0.1451416015625,
-0.026641845703125,
-0.06158447265625,
-0.267333984375,
0.6259765625,
-0.81591796875,
0.1051025390625,
0.302734375,
-0.09979248046875,
-0.0005717277526855469,
0.591796875,
-0.145263671875,
0.7197265625,
-0.01629638671875,
0.64892578125,
0.73828125,
-1.107421875,
0.8173828125,
0.05828857421875,
0.12548828125,
1.5361328125,
0.69140625,
-0.034942626953125,
0.43505859375,
0.142578125,
-0.7685546875,
0.314453125,
-1.1220703125,
0.484375,
0.318359375,
-0.062744140625,
-0.603515625,
0.244873046875,
-0.556640625,
0.4521484375,
0.1402587890625,
0.193115234375,
-0.411376953125,
0.300048828125,
-0.018829345703125,
1.09375,
-0.181640625,
0.98193359375,
-0.347412109375,
-0.55615234375,
-0.0687255859375,
-0.8271484375,
0.10614013671875,
-0.025146484375,
0.07708740234375,
0.75537109375,
0.63427734375,
1.2548828125,
1.021484375,
-0.19287109375,
0.3984375,
0.374755859375,
-0.47802734375,
0.2432861328125,
0.06793212890625,
0.71240234375,
0.1878662109375,
-0.0225372314453125,
0.43115234375,
-0.06793212890625,
-0.95947265625,
-0.266845703125,
-0.05645751953125,
0.79345703125,
-0.42724609375,
0.517578125,
0.1614990234375,
0.1094970703125,
-0.6982421875,
-0.24462890625,
-0.09625244140625,
-1.2880859375,
-0.328125,
0.7939453125,
-0.1922607421875,
0.71337890625,
-0.289306640625,
-0.450927734375,
0.72216796875,
1.392578125,
-0.008941650390625,
0.1790771484375,
0.453369140625,
0.1485595703125,
-0.0277557373046875,
0.494873046875,
0.2509765625,
-0.380859375,
-0.76171875,
1.1953125,
-0.1512451171875,
0.00551605224609375,
-0.32470703125,
0.6044921875,
0.1802978515625,
0.43115234375,
-0.408935546875,
-0.204345703125,
0.299560546875,
1.11328125,
0.040252685546875,
0.260986328125,
0.1060791015625,
0.71630859375,
0.546875,
0.77099609375,
0.3974609375,
0.372802734375,
0.59033203125,
0.68115234375,
0.17236328125,
-0.16357421875,
-0.171875,
0.18896484375,
0.469970703125,
0.67529296875,
0.158203125,
0.3681640625,
0.02630615234375,
-0.348388671875,
-0.29345703125,
0.09765625,
0.06488037109375,
0.85009765625,
0.2034912109375,
0.1712646484375,
-0.65869140625,
-0.1986083984375,
0.27490234375,
0.703125,
-0.98095703125,
-0.513671875,
-0.0269927978515625,
-0.340576171875,
0.358154296875,
-0.20947265625,
0.7099609375,
0.1253662109375,
0.552734375,
0.54736328125,
-0.446044921875,
-0.65478515625,
-0.79931640625,
-0.74609375,
-1.0478515625,
-0.3427734375,
-0.5634765625,
-0.24072265625,
0.5537109375,
-0.83935546875,
0.2188720703125,
-0.435791015625,
-0.0229949951171875,
0.41162109375,
-0.6884765625,
0.814453125,
-0.05767822265625,
0.69140625,
-0.437255859375,
0.572265625,
0.05706787109375,
0.8603515625,
-0.74755859375,
-0.0782470703125,
-0.29833984375,
-0.5947265625,
0.169189453125,
0.1309814453125,
0.386474609375,
-0.13671875,
-0.251953125,
-0.6083984375,
-0.412109375,
-0.239990234375,
-0.68017578125,
0.55419921875,
-0.87646484375,
0.6279296875,
0.81640625,
-0.5703125,
0.771484375,
0.77685546875,
-0.5244140625,
0.7646484375,
0.400634765625,
0.076171875,
-0.93896484375,
1.32421875,
0.335693359375,
0.1488037109375,
-0.59375,
-0.5341796875,
-0.45654296875,
-0.12744140625,
0.188720703125,
-0.416015625,
-0.254150390625,
0.849609375,
-0.0255584716796875,
-0.94384765625,
0.418212890625,
-1.2470703125,
-0.25341796875,
-0.1341552734375,
-0.381103515625,
0.89990234375,
0.39697265625,
0.283203125,
-0.50244140625,
-0.59375,
0.24365234375,
0.5419921875,
0.05218505859375,
-0.35693359375,
-0.1986083984375,
0.4375,
-0.09088134765625,
0.3232421875,
-0.15771484375,
-0.61376953125,
-0.2529296875,
-0.252685546875,
0.01255035400390625,
0.59814453125,
0.28515625,
0.22998046875,
0.666015625,
0.83544921875,
-0.8017578125,
-0.072509765625,
-0.33837890625,
0.88037109375,
0.48974609375,
0.2354736328125,
0.52978515625,
-0.20751953125,
-0.466552734375,
-1.0625,
-0.0858154296875,
0.25,
1.0244140625,
-0.60205078125,
0.427978515625,
0.298828125,
-0.64794921875,
0.71337890625,
-0.88330078125,
-0.023193359375,
1.0302734375,
-0.78759765625,
0.76708984375,
-0.2010498046875,
0.29443359375,
-0.14111328125,
0.1551513671875,
0.422607421875,
0.054290771484375,
0.50537109375,
-0.19775390625,
-0.67138671875,
0.05145263671875,
-0.0677490234375,
-0.20166015625,
-0.45703125,
0.63720703125,
-0.2279052734375,
-0.5302734375,
-0.61865234375,
0.861328125,
0.83056640625,
0.75634765625,
-0.04840087890625,
0.114013671875,
-0.2237548828125,
0.5390625,
0.21533203125,
-0.62109375,
0.1627197265625,
-0.83447265625,
0.7353515625,
0.08099365234375,
0.10589599609375,
-0.4658203125,
-0.0215301513671875,
-0.42333984375,
0.366455078125,
0.049224853515625,
-0.250732421875,
-0.90185546875,
0.2451171875,
0.09503173828125,
0.434814453125,
-1.0107421875,
-0.5107421875,
-0.331787109375,
0.254150390625,
0.352294921875,
-0.7470703125,
0.07293701171875,
-0.75244140625,
0.41552734375,
0.2220458984375,
-0.0256805419921875,
-0.325927734375,
-0.7431640625,
-0.51025390625,
-0.60986328125,
-0.1878662109375,
0.798828125,
0.08111572265625,
0.3916015625,
-1.2060546875,
0.48583984375,
0.166015625,
-0.0011444091796875,
-0.226318359375,
0.0689697265625,
0.388671875,
0.031707763671875,
0.8623046875,
-0.31982421875,
-0.62744140625,
0.279296875,
-1.314453125,
0.57861328125,
-0.34130859375,
0.390380859375,
-0.053619384765625,
-0.10699462890625,
0.140869140625,
0.53173828125,
-0.54443359375,
0.369384765625,
-0.2335205078125,
0.205810546875,
-0.321533203125,
-0.767578125,
0.86181640625,
-0.304931640625,
-0.75439453125,
0.96630859375,
0.1273193359375,
-0.036956787109375,
0.40625,
0.80322265625,
-0.390380859375,
0.29248046875,
-0.389892578125,
0.529296875,
-0.486083984375,
-0.5625,
0.08172607421875,
-0.184326171875,
1.166015625,
0.1668701171875,
-0.46875,
-0.54833984375,
-0.8310546875,
0.1068115234375,
-0.011810302734375,
-0.2257080078125,
0.5986328125,
0.314453125,
-0.1131591796875,
-0.08740234375,
-0.48095703125,
-0.39501953125,
-0.05670166015625,
-0.50927734375,
-0.0382080078125,
0.7314453125,
0.81396484375,
0.78662109375,
-0.0662841796875,
-0.52587890625,
-0.1619873046875,
0.106201171875,
0.1749267578125,
-0.61572265625,
-0.4189453125,
-0.40478515625,
0.0875244140625,
-0.3115234375,
-0.051513671875,
0.2139892578125,
0.4775390625,
1.05859375,
0.265625,
0.413330078125,
0.485107421875,
-0.42333984375,
0.64990234375,
0.2406005859375,
-1.103515625,
-0.482421875,
0.477783203125,
0.054473876953125,
0.92041015625,
0.1439208984375,
-0.376220703125,
-0.560546875,
-0.8359375,
0.1097412109375,
-0.56005859375,
-0.08905029296875,
-0.9267578125,
0.01129913330078125,
-0.299072265625,
0.677734375,
-0.1741943359375,
-0.93603515625,
-0.0113372802734375,
-0.90234375,
0.017547607421875,
-0.313720703125,
-0.08953857421875,
-0.71875,
-0.7685546875,
-0.2293701171875,
0.564453125,
0.0151214599609375,
0.420166015625,
-0.005252838134765625,
-0.11761474609375,
0.2039794921875,
-0.25146484375,
-0.5869140625,
-0.2408447265625,
0.039642333984375,
-0.043426513671875,
-0.2015380859375,
0.142822265625,
-0.50390625,
0.54248046875,
-0.80517578125,
0.41015625,
-0.038543701171875,
0.134033203125,
-0.40283203125,
-0.143310546875,
0.68212890625,
-0.393798828125,
-0.169921875,
-0.0029144287109375,
0.296142578125,
0.6728515625,
-0.27197265625,
-0.52099609375,
-0.99609375,
-0.83447265625,
-1.0322265625,
0.413330078125,
-0.58203125,
-0.329833984375,
-0.495361328125,
-0.2191162109375,
1.125,
-0.5947265625,
0.220458984375,
1.162109375,
0.204833984375,
0.384033203125,
-0.6220703125,
0.751953125,
0.67724609375,
-0.80517578125,
-0.388671875,
0.09088134765625,
-0.66796875,
0.11614990234375,
-0.546875,
-0.8232421875,
-0.6318359375,
0.227783203125,
1.447265625,
-0.357421875,
0.8388671875,
0.312744140625,
-1.0263671875,
-0.736328125,
0.91796875,
0.2354736328125,
0.132080078125,
0.83984375,
0.0660400390625,
-0.293212890625,
-0.1195068359375,
0.08001708984375,
-0.355224609375,
-0.607421875,
0.6630859375,
-0.1357421875,
-0.20849609375,
0.55908203125,
0.87939453125,
-1.107421875,
-0.65576171875,
-0.0265655517578125,
0.08843994140625,
-0.5625,
-0.6396484375,
-0.19775390625,
0.599609375,
-0.5859375,
0.0226593017578125,
0.5595703125,
-0.121826171875,
0.36669921875,
-0.00576019287109375,
0.364013671875,
-0.308837890625,
0.580078125,
0.6005859375,
-0.29296875,
-0.53564453125,
-0.6513671875,
0.059356689453125,
-0.51025390625,
-0.1417236328125,
0.59375,
-0.34912109375,
-0.1583251953125,
0.1361083984375,
0.05120849609375,
0.68505859375,
-0.336669921875,
-0.419189453125,
0.72607421875,
-0.81005859375,
-0.5908203125,
-0.25830078125,
0.2484130859375,
-0.0207061767578125,
0.8759765625,
-0.364501953125,
0.146240234375,
0.235107421875,
0.269287109375,
-0.39111328125,
-1.029296875,
-0.370849609375,
-0.943359375,
-0.336181640625,
-0.91650390625,
-0.77587890625,
0.0533447265625,
0.51025390625,
-0.11956787109375,
-0.6337890625,
0.305419921875,
0.330810546875,
-0.595703125,
0.91259765625,
-0.447021484375,
0.40478515625,
-0.60498046875,
-0.348876953125,
-1.234375,
-0.33056640625,
-0.427734375,
0.11865234375,
-0.51708984375,
0.462646484375,
-0.164306640625,
0.65869140625,
-0.1650390625,
0.3583984375,
-0.291748046875,
-0.458984375,
0.076416015625,
0.307861328125,
0.01471710205078125,
0.88720703125,
0.64599609375,
-0.2020263671875,
0.388427734375,
-0.353515625,
-0.288330078125,
-0.1529541015625,
0.5400390625,
0.2008056640625,
-0.1849365234375,
0.0972900390625,
-0.478759765625,
0.18603515625,
-0.978515625,
0.11712646484375,
-0.51806640625,
0.0184478759765625,
0.06378173828125,
0.161376953125,
0.498779296875,
1.0166015625,
-0.08294677734375,
-0.052642822265625,
0.1845703125,
0.239501953125,
0.49609375,
0.26953125,
-0.39453125,
0.38671875,
0.0155792236328125,
-0.69287109375,
0.140869140625,
0.039154052734375,
-0.022796630859375,
0.2000732421875,
-0.138916015625,
-0.47216796875,
-0.8701171875,
0.0010499954223632812,
-0.0214691162109375,
0.05126953125,
0.499755859375,
-0.489990234375,
-0.273193359375,
-0.1832275390625,
-0.494873046875,
0.2188720703125,
-0.90283203125,
-0.66015625,
0.65673828125,
0.038543701171875,
-0.48291015625,
-0.54541015625,
-0.288330078125,
0.061920166015625,
-0.062164306640625,
0.0192718505859375,
-0.448486328125,
1.01171875,
0.1644287109375,
0.6015625,
-0.0208892822265625,
-0.0308685302734375,
-0.355712890625,
0.7294921875,
-1.0390625,
-0.67041015625,
0.484619140625,
0.73583984375,
0.26123046875,
0.0304412841796875,
-0.48583984375,
0.146240234375,
0.149169921875,
0.360595703125,
-0.4638671875,
-0.19921875,
-0.2568359375,
0.8408203125,
-0.822265625,
0.016815185546875,
0.1820068359375,
0.336669921875,
0.311767578125,
-0.3125,
-0.7666015625,
0.8154296875,
0.8486328125,
-0.349609375,
0.266845703125,
0.34375,
0.443359375,
0.365234375,
-0.356689453125,
-0.295654296875,
0.70703125,
0.8798828125,
0.8349609375,
-0.259521484375,
0.43798828125,
0.64697265625,
-0.0838623046875,
0.00616455078125,
0.1556396484375,
-0.035064697265625,
-0.00789642333984375,
-0.0753173828125,
0.156494140625,
-0.0946044921875,
0.22412109375,
-0.59033203125,
0.047454833984375,
-0.386962890625,
-0.162109375,
-0.6806640625,
-0.319091796875,
0.5263671875,
0.04986572265625,
0.11328125,
0.392578125,
-1.0234375,
0.275146484375,
0.72705078125,
-0.3876953125,
-0.280029296875,
0.740234375,
0.60595703125,
0.418701171875,
0.61181640625,
-0.0152130126953125,
0.73388671875,
-0.318359375,
0.49169921875,
0.306884765625,
0.08245849609375,
-0.671875,
-0.708984375,
-1.072265625,
0.492431640625,
-0.52783203125,
-0.259521484375,
0.9462890625,
-0.52490234375,
-0.2298583984375,
-0.3037109375,
0.332763671875,
-0.2044677734375,
0.09326171875,
0.1202392578125,
-0.271240234375,
-1.083984375,
0.67529296875,
-0.135009765625,
0.382080078125,
0.1119384765625,
1.0087890625,
0.040283203125,
1.525390625,
0.66552734375,
-0.062255859375,
-0.393310546875,
0.6279296875,
-0.58251953125,
-0.400634765625,
-0.1810302734375,
-0.7783203125,
-0.095703125,
-0.86962890625,
-0.5029296875,
-0.3623046875,
0.927734375,
0.216064453125,
-1.1630859375,
-0.163330078125,
0.271484375,
-0.88427734375,
0.313720703125,
0.412109375,
0.2340087890625,
-0.31005859375,
-0.1727294921875,
0.2193603515625,
-0.98193359375,
0.1689453125,
-0.5302734375,
0.2529296875,
-0.88134765625,
-0.44677734375,
-0.486083984375,
-0.763671875,
-0.283935546875,
-0.32568359375,
-0.06707763671875,
-0.52392578125,
0.5478515625,
0.4716796875,
0.46923828125,
0.1539306640625,
-0.343994140625,
0.1650390625,
0.568359375,
1.0400390625,
-0.2939453125,
0.8154296875,
0.390869140625,
-0.35009765625,
-0.0272216796875,
-0.7802734375,
0.410400390625,
-0.444091796875,
-0.1341552734375,
-0.5390625,
0.10003662109375,
-0.5458984375,
-1.3583984375,
-0.02874755859375,
0.3984375,
0.33984375,
-0.435791015625,
-1.205078125,
-0.044677734375,
-0.955078125,
-0.1468505859375,
-0.64990234375,
0.255859375,
-0.322265625,
-0.044219970703125,
-0.0086822509765625,
-0.90185546875,
4.4375,
1.1015625,
1.2314453125,
0.3720703125,
-0.19189453125,
0.74658203125,
0.591796875,
-0.8583984375,
-0.186279296875,
-0.39111328125,
0.556640625,
-0.131591796875,
0.0027217864990234375,
0.74755859375,
0.1697998046875,
0.716796875,
-1.0009765625,
0.367919921875,
-0.01143646240234375,
-0.76123046875,
-0.79248046875,
0.35205078125,
0.1038818359375,
0.257080078125,
-0.40966796875,
0.455322265625,
0.55224609375,
-0.87890625,
-0.2548828125,
-0.8857421875,
0.2410888671875,
-0.465576171875,
1.2978515625,
-0.203369140625,
-0.1822509765625,
0.55908203125,
-0.00905609130859375,
-0.262939453125,
0.0714111328125,
-0.1190185546875,
-0.1678466796875,
-0.252197265625,
0.383544921875,
-0.763671875,
0.1947021484375,
0.366455078125,
-0.4296875,
0.1824951171875,
0.50927734375,
-0.87841796875,
1.2509765625,
-0.122314453125,
0.285400390625,
-0.8642578125,
-0.6044921875,
0.044219970703125,
0.256103515625,
-0.08380126953125,
-0.28662109375,
0.40087890625,
0.33447265625,
0.28955078125,
0.171142578125,
0.150634765625,
-0.6982421875,
1.046875,
-0.197509765625,
0.287109375,
-0.6064453125,
-0.460205078125,
-0.28759765625,
-0.69775390625,
-0.485595703125,
-0.3447265625,
0.97802734375,
0.051239013671875,
-0.054656982421875,
0.72265625,
0.3642578125,
-0.224853515625,
0.0198516845703125,
-0.477783203125,
-0.7685546875,
-0.364501953125,
0.458740234375,
1.328125,
-0.52880859375,
-0.230712890625,
-0.5009765625,
0.69873046875,
0.6025390625,
0.7548828125,
-0.0230560302734375,
-0.52734375,
-0.2432861328125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.
A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the temple and read the string aloud. However, nothing happened. Then Asterix supposed that a password is some substring t of the string s.
Prefix supposed that the substring t is the beginning of the string s; Suffix supposed that the substring t should be the end of the string s; and Obelix supposed that t should be located somewhere inside the string s, that is, t is neither its beginning, nor its end.
Asterix chose the substring t so as to please all his companions. Besides, from all acceptable variants Asterix chose the longest one (as Asterix loves long strings). When Asterix read the substring t aloud, the temple doors opened.
You know the string s. Find the substring t or determine that such substring does not exist and all that's been written above is just a nice legend.
Input
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
Output
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
Examples
Input
fixprefixsuffix
Output
fix
Input
abcdabc
Output
Just a legend
Tags: binary search, dp, hashing, string suffix structures, strings
Correct Solution:
```
def KMP_pre(texte, longueur):
M = [0 for i in range(longueur)]
index_deb = 0
M[0] = 0
i = 1
while (i < longueur):
if (texte[i] == texte[index_deb]):
index_deb += 1
M[i] = index_deb
i += 1
else:
if (index_deb != 0):
index_deb = M[index_deb - 1]
else:
M[i] = 0
i += 1
return M
def KMP_algo(texte, longueur):
M = KMP_pre(texte, longueur)
#pas de suffixe qui soit prefixe
if (M[longueur - 1] == 0):
return -1
#on cherche le motif qui soit ni prefixe ni suffixe
for i in range(0,longueur - 1):
if (M[i] == M[longueur - 1]):
return texte[0:M[i]]
if (M[M[longueur - 1] - 1] == 0):
return -1
else:
return texte[0:M[M[longueur - 1] - 1]]
def main(texte):
res = KMP_algo(texte, len(texte))
if res == -1:
print('Just a legend')
else:
print(res)
main(input())
```
| 43,073
|
[
0.36328125,
-0.0056304931640625,
0.1839599609375,
0.0284271240234375,
-0.14111328125,
-0.22265625,
0.02423095703125,
0.08538818359375,
0.12890625,
0.71533203125,
0.4853515625,
0.1798095703125,
-0.0762939453125,
-0.98193359375,
-0.89501953125,
0.333740234375,
-0.425537109375,
-0.5400390625,
-0.445068359375,
-0.230712890625,
-0.2279052734375,
0.07684326171875,
-1.2802734375,
-0.435302734375,
-0.287109375,
0.6484375,
0.11004638671875,
0.4091796875,
0.80078125,
1.2802734375,
0.048126220703125,
-0.288818359375,
0.54248046875,
-0.89208984375,
-0.525390625,
-0.25146484375,
0.5888671875,
-0.8564453125,
0.042816162109375,
-0.501953125,
0.0014410018920898438,
0.1337890625,
0.287353515625,
-0.84619140625,
-1.0029296875,
0.203857421875,
-0.427978515625,
-0.279296875,
-0.12322998046875,
-0.456787109375,
-0.074951171875,
-0.363525390625,
0.58154296875,
0.0521240234375,
0.141357421875,
-0.116943359375,
-0.06866455078125,
-0.0797119140625,
-0.259521484375,
0.1868896484375,
0.314208984375,
0.1824951171875,
0.1307373046875,
-0.83984375,
0.0133209228515625,
-0.03167724609375,
-0.254638671875,
-0.371826171875,
0.1129150390625,
-0.8837890625,
-0.2978515625,
0.5732421875,
-0.14501953125,
-0.7275390625,
-0.62109375,
0.34326171875,
0.421630859375,
0.1085205078125,
-0.404052734375,
0.309814453125,
-0.1805419921875,
0.81787109375,
0.59375,
-0.202392578125,
-0.381591796875,
-0.771484375,
-0.148681640625,
0.447021484375,
0.26513671875,
-0.1917724609375,
-0.3125,
0.66259765625,
-0.37353515625,
-0.15380859375,
0.447509765625,
0.8232421875,
-0.416748046875,
0.270263671875,
0.2005615234375,
0.1724853515625,
0.36962890625,
0.72802734375,
-0.708984375,
0.5908203125,
-0.2261962890625,
0.137451171875,
0.275390625,
0.148193359375,
-0.083251953125,
-0.489501953125,
-0.018341064453125,
-0.7783203125,
0.80859375,
0.353515625,
0.2122802734375,
0.89599609375,
-0.490478515625,
0.2744140625,
-0.79736328125,
-0.007411956787109375,
0.49560546875,
-0.056640625,
0.71630859375,
-0.1678466796875,
-0.0289764404296875,
-0.082275390625,
-0.3125,
0.69677734375,
-0.87841796875,
0.09442138671875,
0.251220703125,
-0.07647705078125,
-0.004306793212890625,
0.63037109375,
-0.138671875,
0.74267578125,
-0.0584716796875,
0.626953125,
0.6904296875,
-1.068359375,
0.77099609375,
0.0266571044921875,
0.12091064453125,
1.5,
0.60498046875,
-0.0176239013671875,
0.38916015625,
0.1297607421875,
-0.75537109375,
0.3603515625,
-1.087890625,
0.406982421875,
0.300537109375,
-0.037872314453125,
-0.59326171875,
0.27587890625,
-0.5947265625,
0.470703125,
0.1383056640625,
0.1541748046875,
-0.4560546875,
0.297607421875,
-0.0082550048828125,
1.03125,
-0.1802978515625,
0.9609375,
-0.412109375,
-0.50927734375,
-0.0589599609375,
-0.869140625,
0.072021484375,
-0.032867431640625,
0.10205078125,
0.75830078125,
0.62890625,
1.236328125,
0.978515625,
-0.1724853515625,
0.3798828125,
0.35205078125,
-0.41748046875,
0.27685546875,
0.101806640625,
0.630859375,
0.166748046875,
0.0027256011962890625,
0.376708984375,
-0.08160400390625,
-0.97119140625,
-0.2744140625,
-0.10406494140625,
0.77490234375,
-0.4228515625,
0.509765625,
0.158203125,
0.100341796875,
-0.72607421875,
-0.2398681640625,
0.032989501953125,
-1.3330078125,
-0.35791015625,
0.849609375,
-0.2410888671875,
0.7373046875,
-0.2098388671875,
-0.499755859375,
0.7080078125,
1.3583984375,
-0.01507568359375,
0.2161865234375,
0.44189453125,
0.157958984375,
-0.022796630859375,
0.42529296875,
0.2496337890625,
-0.339599609375,
-0.78271484375,
1.1259765625,
-0.1572265625,
0.0147247314453125,
-0.27001953125,
0.6767578125,
0.168212890625,
0.42626953125,
-0.402099609375,
-0.2271728515625,
0.32666015625,
1.1474609375,
0.04791259765625,
0.2132568359375,
0.074951171875,
0.73388671875,
0.56103515625,
0.77685546875,
0.378173828125,
0.362060546875,
0.63720703125,
0.64453125,
0.17529296875,
-0.1673583984375,
-0.178955078125,
0.238525390625,
0.449951171875,
0.71826171875,
0.1746826171875,
0.37109375,
0.007648468017578125,
-0.354248046875,
-0.30078125,
0.129150390625,
0.061279296875,
0.86181640625,
0.1353759765625,
0.131591796875,
-0.6962890625,
-0.1656494140625,
0.28515625,
0.7255859375,
-0.9375,
-0.5888671875,
-0.00000947713851928711,
-0.40966796875,
0.3017578125,
-0.25390625,
0.66943359375,
0.1549072265625,
0.54052734375,
0.63623046875,
-0.443603515625,
-0.65380859375,
-0.73046875,
-0.6982421875,
-1.0556640625,
-0.313232421875,
-0.57177734375,
-0.270263671875,
0.5361328125,
-0.82373046875,
0.226318359375,
-0.38818359375,
-0.0026950836181640625,
0.435302734375,
-0.712890625,
0.80859375,
-0.068603515625,
0.6826171875,
-0.39501953125,
0.6376953125,
-0.00920867919921875,
0.8134765625,
-0.7626953125,
-0.1563720703125,
-0.306640625,
-0.611328125,
0.233642578125,
0.1455078125,
0.37353515625,
-0.1165771484375,
-0.25244140625,
-0.64697265625,
-0.471923828125,
-0.2841796875,
-0.66845703125,
0.55908203125,
-0.8212890625,
0.57080078125,
0.779296875,
-0.465576171875,
0.77978515625,
0.763671875,
-0.55712890625,
0.740234375,
0.391845703125,
0.156982421875,
-0.9501953125,
1.30859375,
0.39111328125,
0.1614990234375,
-0.56494140625,
-0.53173828125,
-0.46484375,
-0.175048828125,
0.16064453125,
-0.391357421875,
-0.2457275390625,
0.85498046875,
-0.0114288330078125,
-0.935546875,
0.365478515625,
-1.1826171875,
-0.282470703125,
-0.161376953125,
-0.333984375,
0.9111328125,
0.435791015625,
0.259521484375,
-0.5400390625,
-0.58447265625,
0.273681640625,
0.493408203125,
0.027435302734375,
-0.3408203125,
-0.184326171875,
0.41796875,
-0.1455078125,
0.32861328125,
-0.248291015625,
-0.60107421875,
-0.22265625,
-0.319580078125,
0.033416748046875,
0.56787109375,
0.2412109375,
0.266845703125,
0.66650390625,
0.857421875,
-0.80908203125,
-0.051055908203125,
-0.330322265625,
0.85400390625,
0.47021484375,
0.191162109375,
0.5791015625,
-0.193603515625,
-0.422607421875,
-1.06640625,
-0.049591064453125,
0.308837890625,
0.98193359375,
-0.61083984375,
0.426513671875,
0.30859375,
-0.65771484375,
0.69970703125,
-0.9111328125,
-0.07928466796875,
1.060546875,
-0.76123046875,
0.74072265625,
-0.2149658203125,
0.32666015625,
-0.175537109375,
0.10931396484375,
0.45068359375,
0.053802490234375,
0.4365234375,
-0.2215576171875,
-0.630859375,
0.0136260986328125,
-0.08624267578125,
-0.1966552734375,
-0.4541015625,
0.65869140625,
-0.2325439453125,
-0.58056640625,
-0.6298828125,
0.80810546875,
0.82177734375,
0.708984375,
-0.0792236328125,
0.1014404296875,
-0.13427734375,
0.62060546875,
0.1951904296875,
-0.6318359375,
0.2064208984375,
-0.82421875,
0.74755859375,
0.1063232421875,
0.1141357421875,
-0.445068359375,
0.01073455810546875,
-0.430419921875,
0.3359375,
0.045745849609375,
-0.2142333984375,
-0.853515625,
0.296630859375,
0.16650390625,
0.473876953125,
-0.99072265625,
-0.45166015625,
-0.3037109375,
0.2442626953125,
0.299072265625,
-0.71630859375,
-0.011932373046875,
-0.685546875,
0.428466796875,
0.186279296875,
-0.0211334228515625,
-0.33349609375,
-0.68701171875,
-0.53759765625,
-0.55712890625,
-0.1343994140625,
0.822265625,
0.050933837890625,
0.402587890625,
-1.2021484375,
0.469482421875,
0.1588134765625,
-0.067138671875,
-0.250732421875,
0.1173095703125,
0.371337890625,
0.06268310546875,
0.8349609375,
-0.28076171875,
-0.65625,
0.245849609375,
-1.287109375,
0.57958984375,
-0.350830078125,
0.383544921875,
-0.0180206298828125,
-0.1229248046875,
0.08447265625,
0.472412109375,
-0.50732421875,
0.391357421875,
-0.1842041015625,
0.230712890625,
-0.335205078125,
-0.75341796875,
0.845703125,
-0.3232421875,
-0.7431640625,
1.0009765625,
0.18359375,
-0.06005859375,
0.414306640625,
0.72607421875,
-0.3447265625,
0.29248046875,
-0.431640625,
0.464111328125,
-0.47900390625,
-0.55126953125,
0.07196044921875,
-0.23095703125,
1.1552734375,
0.174072265625,
-0.427490234375,
-0.533203125,
-0.79931640625,
0.083740234375,
-0.043701171875,
-0.2315673828125,
0.60205078125,
0.32470703125,
-0.07281494140625,
-0.07391357421875,
-0.4560546875,
-0.419189453125,
-0.017974853515625,
-0.488037109375,
-0.0282745361328125,
0.814453125,
0.77734375,
0.78564453125,
-0.049285888671875,
-0.50927734375,
-0.1624755859375,
0.05767822265625,
0.1539306640625,
-0.5986328125,
-0.370361328125,
-0.471923828125,
0.004642486572265625,
-0.33154296875,
-0.05841064453125,
0.283203125,
0.475830078125,
1.033203125,
0.26904296875,
0.444580078125,
0.46630859375,
-0.378173828125,
0.703125,
0.2213134765625,
-1.099609375,
-0.5,
0.50927734375,
0.033203125,
0.95361328125,
0.158935546875,
-0.377197265625,
-0.5712890625,
-0.8642578125,
0.156982421875,
-0.58056640625,
-0.1453857421875,
-0.9248046875,
0.054168701171875,
-0.298095703125,
0.74072265625,
-0.18994140625,
-0.9501953125,
0.043182373046875,
-0.83642578125,
-0.01372528076171875,
-0.330810546875,
-0.154541015625,
-0.720703125,
-0.74072265625,
-0.253173828125,
0.65478515625,
-0.0863037109375,
0.4482421875,
-0.00472259521484375,
-0.07440185546875,
0.208984375,
-0.244140625,
-0.546875,
-0.2471923828125,
0.029449462890625,
-0.07806396484375,
-0.1912841796875,
0.2122802734375,
-0.493408203125,
0.499267578125,
-0.779296875,
0.41064453125,
-0.03759765625,
0.178955078125,
-0.4287109375,
-0.146240234375,
0.6103515625,
-0.43310546875,
-0.1522216796875,
0.00644683837890625,
0.2252197265625,
0.6806640625,
-0.262451171875,
-0.51708984375,
-0.99267578125,
-0.7958984375,
-1.05078125,
0.486572265625,
-0.580078125,
-0.32958984375,
-0.45947265625,
-0.23193359375,
1.1220703125,
-0.63720703125,
0.2169189453125,
1.1142578125,
0.2421875,
0.3447265625,
-0.60205078125,
0.728515625,
0.673828125,
-0.76025390625,
-0.403076171875,
0.1654052734375,
-0.6923828125,
0.1343994140625,
-0.5537109375,
-0.85595703125,
-0.611328125,
0.2481689453125,
1.396484375,
-0.374755859375,
0.841796875,
0.352294921875,
-1.0625,
-0.748046875,
0.96533203125,
0.2442626953125,
0.11419677734375,
0.8662109375,
0.135009765625,
-0.314453125,
-0.06646728515625,
0.051605224609375,
-0.37060546875,
-0.5771484375,
0.685546875,
-0.1815185546875,
-0.2242431640625,
0.51611328125,
0.8359375,
-1.1025390625,
-0.67578125,
-0.005504608154296875,
0.1043701171875,
-0.58447265625,
-0.66015625,
-0.1920166015625,
0.5888671875,
-0.5751953125,
0.01313018798828125,
0.58251953125,
-0.0841064453125,
0.4013671875,
0.0311737060546875,
0.392578125,
-0.254638671875,
0.55126953125,
0.5908203125,
-0.2744140625,
-0.5478515625,
-0.65234375,
0.093505859375,
-0.4609375,
-0.153564453125,
0.60107421875,
-0.372802734375,
-0.137939453125,
0.1441650390625,
0.06243896484375,
0.6748046875,
-0.37060546875,
-0.361572265625,
0.763671875,
-0.8203125,
-0.560546875,
-0.297607421875,
0.245849609375,
0.0306549072265625,
0.9033203125,
-0.370361328125,
0.1585693359375,
0.27734375,
0.2471923828125,
-0.421875,
-1.00390625,
-0.339599609375,
-0.93505859375,
-0.36376953125,
-0.8740234375,
-0.74560546875,
0.10791015625,
0.52587890625,
-0.12939453125,
-0.61181640625,
0.3251953125,
0.3642578125,
-0.58544921875,
0.92333984375,
-0.416015625,
0.401611328125,
-0.55224609375,
-0.32568359375,
-1.24609375,
-0.32080078125,
-0.441162109375,
0.08197021484375,
-0.5380859375,
0.453369140625,
-0.2213134765625,
0.58349609375,
-0.1884765625,
0.403076171875,
-0.2861328125,
-0.46630859375,
0.076904296875,
0.282958984375,
-0.055084228515625,
0.916015625,
0.6513671875,
-0.175048828125,
0.4384765625,
-0.349853515625,
-0.2357177734375,
-0.15283203125,
0.5107421875,
0.2197265625,
-0.2095947265625,
0.09039306640625,
-0.546875,
0.1829833984375,
-0.9541015625,
0.1529541015625,
-0.52685546875,
0.00545501708984375,
0.039520263671875,
0.1729736328125,
0.444091796875,
1.0712890625,
-0.1004638671875,
0.0133056640625,
0.13623046875,
0.275146484375,
0.49609375,
0.269287109375,
-0.40673828125,
0.377197265625,
0.0024318695068359375,
-0.73828125,
0.099853515625,
-0.01425933837890625,
-0.04107666015625,
0.151123046875,
-0.08782958984375,
-0.4775390625,
-0.8759765625,
-0.00013911724090576172,
0.0092315673828125,
-0.0047149658203125,
0.5380859375,
-0.54443359375,
-0.32861328125,
-0.1881103515625,
-0.5166015625,
0.2379150390625,
-0.92431640625,
-0.61279296875,
0.66259765625,
0.00748443603515625,
-0.48583984375,
-0.51708984375,
-0.25537109375,
0.038970947265625,
-0.06793212890625,
-0.00347137451171875,
-0.36181640625,
0.97998046875,
0.1700439453125,
0.60546875,
0.028167724609375,
-0.051666259765625,
-0.343994140625,
0.7568359375,
-1.0380859375,
-0.62744140625,
0.43310546875,
0.7568359375,
0.2427978515625,
0.07562255859375,
-0.474365234375,
0.12042236328125,
0.1766357421875,
0.35400390625,
-0.45458984375,
-0.1982421875,
-0.2149658203125,
0.81982421875,
-0.82177734375,
0.09759521484375,
0.2105712890625,
0.32470703125,
0.31201171875,
-0.320556640625,
-0.7626953125,
0.82958984375,
0.82177734375,
-0.351318359375,
0.337890625,
0.381103515625,
0.427490234375,
0.350341796875,
-0.32080078125,
-0.3291015625,
0.583984375,
0.8203125,
0.79541015625,
-0.2452392578125,
0.421875,
0.638671875,
-0.09674072265625,
-0.05242919921875,
0.1572265625,
-0.1007080078125,
-0.0005488395690917969,
-0.076171875,
0.1812744140625,
-0.07000732421875,
0.18505859375,
-0.61376953125,
0.0692138671875,
-0.421630859375,
-0.0830078125,
-0.6171875,
-0.322998046875,
0.50244140625,
0.06439208984375,
0.09710693359375,
0.33837890625,
-0.9990234375,
0.303955078125,
0.69384765625,
-0.404296875,
-0.2822265625,
0.73779296875,
0.58251953125,
0.462890625,
0.59716796875,
-0.0242462158203125,
0.705078125,
-0.326171875,
0.54833984375,
0.3134765625,
0.05035400390625,
-0.6455078125,
-0.68994140625,
-1.0654296875,
0.484130859375,
-0.50732421875,
-0.234619140625,
0.8974609375,
-0.475830078125,
-0.2025146484375,
-0.302001953125,
0.371337890625,
-0.2113037109375,
0.0782470703125,
0.0958251953125,
-0.2369384765625,
-1.0673828125,
0.68505859375,
-0.169189453125,
0.370361328125,
0.1331787109375,
1.037109375,
0.03558349609375,
1.529296875,
0.7080078125,
-0.0294952392578125,
-0.419189453125,
0.666015625,
-0.6083984375,
-0.372314453125,
-0.14404296875,
-0.7236328125,
-0.11236572265625,
-0.84375,
-0.6162109375,
-0.40234375,
0.94140625,
0.2259521484375,
-1.1005859375,
-0.1605224609375,
0.249267578125,
-0.8447265625,
0.34130859375,
0.4267578125,
0.1973876953125,
-0.285888671875,
-0.1915283203125,
0.2015380859375,
-0.99853515625,
0.171875,
-0.5546875,
0.253173828125,
-0.91748046875,
-0.47900390625,
-0.469482421875,
-0.75244140625,
-0.287841796875,
-0.32275390625,
-0.046234130859375,
-0.61328125,
0.5986328125,
0.455810546875,
0.42822265625,
0.104248046875,
-0.39208984375,
0.1995849609375,
0.5380859375,
1.0615234375,
-0.30517578125,
0.88134765625,
0.401611328125,
-0.33447265625,
0.01244354248046875,
-0.72021484375,
0.404052734375,
-0.48291015625,
-0.11865234375,
-0.5009765625,
0.06793212890625,
-0.55029296875,
-1.2998046875,
-0.01885986328125,
0.39501953125,
0.361328125,
-0.5009765625,
-1.2275390625,
-0.0396728515625,
-0.98486328125,
-0.140625,
-0.5927734375,
0.252197265625,
-0.36865234375,
-0.04791259765625,
-0.029266357421875,
-0.89892578125,
4.46484375,
1.0986328125,
1.185546875,
0.376220703125,
-0.1846923828125,
0.77587890625,
0.6171875,
-0.81201171875,
-0.1390380859375,
-0.35693359375,
0.58056640625,
-0.11505126953125,
0.01447296142578125,
0.7294921875,
0.16748046875,
0.77099609375,
-0.95556640625,
0.34375,
0.039459228515625,
-0.75537109375,
-0.76220703125,
0.321533203125,
0.1324462890625,
0.1802978515625,
-0.409423828125,
0.468505859375,
0.59033203125,
-0.84375,
-0.244384765625,
-0.9140625,
0.266845703125,
-0.513671875,
1.2021484375,
-0.1793212890625,
-0.192626953125,
0.52587890625,
0.01026153564453125,
-0.26123046875,
0.06719970703125,
-0.08709716796875,
-0.190185546875,
-0.20361328125,
0.36669921875,
-0.69677734375,
0.2088623046875,
0.3310546875,
-0.361328125,
0.133056640625,
0.5146484375,
-0.88232421875,
1.2705078125,
-0.0711669921875,
0.325927734375,
-0.8876953125,
-0.62451171875,
0.0160675048828125,
0.2406005859375,
-0.06793212890625,
-0.267578125,
0.3876953125,
0.24267578125,
0.314453125,
0.193359375,
0.1651611328125,
-0.703125,
1.060546875,
-0.167236328125,
0.30419921875,
-0.60107421875,
-0.46142578125,
-0.296875,
-0.70947265625,
-0.46533203125,
-0.32470703125,
0.943359375,
0.06536865234375,
-0.0073394775390625,
0.72216796875,
0.34716796875,
-0.263916015625,
-0.01104736328125,
-0.467041015625,
-0.75146484375,
-0.4052734375,
0.415771484375,
1.3515625,
-0.5244140625,
-0.2186279296875,
-0.5087890625,
0.71435546875,
0.62939453125,
0.71240234375,
-0.01629638671875,
-0.5419921875,
-0.28076171875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.
A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the temple and read the string aloud. However, nothing happened. Then Asterix supposed that a password is some substring t of the string s.
Prefix supposed that the substring t is the beginning of the string s; Suffix supposed that the substring t should be the end of the string s; and Obelix supposed that t should be located somewhere inside the string s, that is, t is neither its beginning, nor its end.
Asterix chose the substring t so as to please all his companions. Besides, from all acceptable variants Asterix chose the longest one (as Asterix loves long strings). When Asterix read the substring t aloud, the temple doors opened.
You know the string s. Find the substring t or determine that such substring does not exist and all that's been written above is just a nice legend.
Input
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
Output
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
Examples
Input
fixprefixsuffix
Output
fix
Input
abcdabc
Output
Just a legend
Tags: binary search, dp, hashing, string suffix structures, strings
Correct Solution:
```
s=input()
n=len(s)
p=[-1]*n
mark=[False]*n
q=-1
for i in range(1,n):
while q>=0 and s[i]!=s[q+1]:
q=p[q]
if s[i] == s[q + 1]:
q += 1
p[i] = q
if q>=0 and i<n-1:
mark[q]=True
#print(p)
q=p[n-1]
while q>=0:
if s[0:q+1]==s[n-q-1:] and mark[q]:
print(s[0:q+1])
exit()
q=p[q]
print('Just a legend')
```
| 43,074
|
[
0.352783203125,
-0.008209228515625,
0.2198486328125,
-0.031951904296875,
-0.101806640625,
-0.267822265625,
-0.03155517578125,
0.08367919921875,
0.145263671875,
0.72900390625,
0.5634765625,
0.1888427734375,
-0.08038330078125,
-0.994140625,
-0.85498046875,
0.291015625,
-0.473876953125,
-0.57421875,
-0.414794921875,
-0.26220703125,
-0.215087890625,
0.083984375,
-1.2919921875,
-0.38916015625,
-0.3046875,
0.6708984375,
0.1563720703125,
0.424560546875,
0.8291015625,
1.248046875,
0.044189453125,
-0.31640625,
0.51806640625,
-0.951171875,
-0.499267578125,
-0.2398681640625,
0.6259765625,
-0.84033203125,
0.021209716796875,
-0.51806640625,
0.029266357421875,
0.131591796875,
0.25732421875,
-0.85546875,
-1.00390625,
0.17236328125,
-0.447265625,
-0.300048828125,
-0.2406005859375,
-0.5185546875,
-0.0673828125,
-0.40576171875,
0.62353515625,
0.058502197265625,
0.1494140625,
-0.11871337890625,
-0.00795745849609375,
-0.103759765625,
-0.297119140625,
0.2337646484375,
0.37841796875,
0.17578125,
0.10504150390625,
-0.787109375,
-0.0181427001953125,
-0.043731689453125,
-0.2332763671875,
-0.365478515625,
0.11944580078125,
-0.8603515625,
-0.250732421875,
0.57421875,
-0.139404296875,
-0.720703125,
-0.61572265625,
0.32421875,
0.498779296875,
0.136962890625,
-0.412109375,
0.350341796875,
-0.165283203125,
0.8212890625,
0.6005859375,
-0.1614990234375,
-0.41015625,
-0.7509765625,
-0.1153564453125,
0.51806640625,
0.304931640625,
-0.25732421875,
-0.302978515625,
0.66064453125,
-0.392333984375,
-0.1458740234375,
0.396240234375,
0.84521484375,
-0.43603515625,
0.260009765625,
0.19189453125,
0.179931640625,
0.36083984375,
0.78076171875,
-0.73095703125,
0.6259765625,
-0.264404296875,
0.1322021484375,
0.29150390625,
0.137451171875,
-0.1243896484375,
-0.449462890625,
-0.03125,
-0.783203125,
0.81298828125,
0.38330078125,
0.17333984375,
0.91064453125,
-0.4892578125,
0.2486572265625,
-0.83544921875,
-0.02239990234375,
0.55126953125,
-0.01776123046875,
0.728515625,
-0.150634765625,
-0.0188140869140625,
-0.09808349609375,
-0.312255859375,
0.66015625,
-0.8427734375,
0.030975341796875,
0.2491455078125,
-0.08380126953125,
-0.042816162109375,
0.61328125,
-0.1573486328125,
0.75830078125,
-0.01361846923828125,
0.62744140625,
0.7294921875,
-1.099609375,
0.8330078125,
0.039154052734375,
0.1063232421875,
1.5556640625,
0.6708984375,
-0.02691650390625,
0.4453125,
0.1773681640625,
-0.796875,
0.3583984375,
-1.1455078125,
0.467529296875,
0.29833984375,
-0.08673095703125,
-0.6318359375,
0.277099609375,
-0.58984375,
0.46826171875,
0.1239013671875,
0.1719970703125,
-0.40673828125,
0.311767578125,
-0.06658935546875,
1.0947265625,
-0.1768798828125,
0.99072265625,
-0.406494140625,
-0.5166015625,
-0.0826416015625,
-0.85107421875,
0.059478759765625,
-0.046875,
0.07171630859375,
0.7490234375,
0.64501953125,
1.2841796875,
0.99267578125,
-0.2349853515625,
0.37109375,
0.33837890625,
-0.458740234375,
0.25341796875,
0.059478759765625,
0.72705078125,
0.2176513671875,
0.0143585205078125,
0.432861328125,
-0.05877685546875,
-0.9892578125,
-0.30322265625,
-0.06219482421875,
0.8203125,
-0.413818359375,
0.52490234375,
0.1910400390625,
0.08013916015625,
-0.75634765625,
-0.2548828125,
-0.052032470703125,
-1.296875,
-0.35791015625,
0.794921875,
-0.1768798828125,
0.7275390625,
-0.239013671875,
-0.50830078125,
0.69970703125,
1.3720703125,
-0.0017004013061523438,
0.17578125,
0.436767578125,
0.131103515625,
-0.0037860870361328125,
0.45068359375,
0.2783203125,
-0.354736328125,
-0.78271484375,
1.181640625,
-0.128662109375,
0.022705078125,
-0.289794921875,
0.6689453125,
0.136962890625,
0.4599609375,
-0.443115234375,
-0.23095703125,
0.360107421875,
1.1474609375,
0.030609130859375,
0.31103515625,
0.09246826171875,
0.77734375,
0.5283203125,
0.73828125,
0.42333984375,
0.3642578125,
0.60498046875,
0.65673828125,
0.104736328125,
-0.1507568359375,
-0.17041015625,
0.23193359375,
0.451904296875,
0.73291015625,
0.181640625,
0.3623046875,
-0.004650115966796875,
-0.306884765625,
-0.292236328125,
0.11474609375,
0.06494140625,
0.87451171875,
0.2000732421875,
0.182861328125,
-0.6494140625,
-0.2022705078125,
0.317138671875,
0.71826171875,
-0.95751953125,
-0.59814453125,
-0.042724609375,
-0.336181640625,
0.3818359375,
-0.231201171875,
0.7421875,
0.147705078125,
0.5927734375,
0.61474609375,
-0.407470703125,
-0.671875,
-0.810546875,
-0.74169921875,
-1.1123046875,
-0.32958984375,
-0.55224609375,
-0.261474609375,
0.52978515625,
-0.8544921875,
0.2105712890625,
-0.41552734375,
-0.0462646484375,
0.46826171875,
-0.73095703125,
0.82080078125,
-0.049041748046875,
0.638671875,
-0.448486328125,
0.60546875,
0.006988525390625,
0.84375,
-0.76953125,
-0.0799560546875,
-0.233642578125,
-0.62548828125,
0.190673828125,
0.1402587890625,
0.389404296875,
-0.10595703125,
-0.2529296875,
-0.65673828125,
-0.4951171875,
-0.2890625,
-0.6875,
0.55419921875,
-0.86572265625,
0.63037109375,
0.85986328125,
-0.5283203125,
0.79443359375,
0.7646484375,
-0.52783203125,
0.75439453125,
0.372802734375,
0.12445068359375,
-0.94091796875,
1.3310546875,
0.37646484375,
0.1309814453125,
-0.57763671875,
-0.54736328125,
-0.4501953125,
-0.153076171875,
0.191650390625,
-0.411376953125,
-0.268798828125,
0.8779296875,
-0.0248870849609375,
-0.939453125,
0.41943359375,
-1.248046875,
-0.314697265625,
-0.1197509765625,
-0.373291015625,
0.94580078125,
0.47021484375,
0.32568359375,
-0.499755859375,
-0.58984375,
0.2215576171875,
0.54736328125,
0.07177734375,
-0.371826171875,
-0.1866455078125,
0.445068359375,
-0.09405517578125,
0.35107421875,
-0.1947021484375,
-0.646484375,
-0.2275390625,
-0.26220703125,
0.01454925537109375,
0.62353515625,
0.28857421875,
0.2127685546875,
0.64013671875,
0.85791015625,
-0.8408203125,
-0.06488037109375,
-0.35205078125,
0.90478515625,
0.481689453125,
0.194580078125,
0.5478515625,
-0.19873046875,
-0.47900390625,
-1.095703125,
-0.07568359375,
0.25244140625,
1.02734375,
-0.6337890625,
0.396728515625,
0.3232421875,
-0.64306640625,
0.724609375,
-0.88134765625,
-0.0248260498046875,
1.0380859375,
-0.79248046875,
0.75390625,
-0.220947265625,
0.329833984375,
-0.161376953125,
0.11724853515625,
0.436767578125,
0.0552978515625,
0.47705078125,
-0.230712890625,
-0.6494140625,
-0.038299560546875,
-0.058868408203125,
-0.1968994140625,
-0.469970703125,
0.6240234375,
-0.268798828125,
-0.5380859375,
-0.65771484375,
0.830078125,
0.8359375,
0.7451171875,
-0.047088623046875,
0.07928466796875,
-0.2176513671875,
0.49755859375,
0.2115478515625,
-0.607421875,
0.181640625,
-0.888671875,
0.7802734375,
0.111572265625,
0.08380126953125,
-0.4384765625,
0.01346588134765625,
-0.444580078125,
0.359375,
0.032562255859375,
-0.244384765625,
-0.8994140625,
0.261962890625,
0.09130859375,
0.406005859375,
-0.99072265625,
-0.53955078125,
-0.30810546875,
0.275634765625,
0.3544921875,
-0.7421875,
0.027801513671875,
-0.73779296875,
0.412109375,
0.291748046875,
0.01169586181640625,
-0.353515625,
-0.7138671875,
-0.5458984375,
-0.61669921875,
-0.18212890625,
0.8583984375,
0.061798095703125,
0.380615234375,
-1.1884765625,
0.501953125,
0.1663818359375,
-0.07440185546875,
-0.2445068359375,
0.098876953125,
0.353515625,
0.01074981689453125,
0.869140625,
-0.318115234375,
-0.71337890625,
0.23974609375,
-1.3505859375,
0.6162109375,
-0.367919921875,
0.389404296875,
-0.037261962890625,
-0.0904541015625,
0.11566162109375,
0.5,
-0.54443359375,
0.410400390625,
-0.217041015625,
0.193603515625,
-0.343505859375,
-0.7578125,
0.83203125,
-0.33203125,
-0.7626953125,
0.96240234375,
0.130126953125,
-0.0748291015625,
0.387451171875,
0.74755859375,
-0.38232421875,
0.327880859375,
-0.4326171875,
0.51806640625,
-0.490478515625,
-0.56298828125,
0.0794677734375,
-0.2303466796875,
1.1884765625,
0.1956787109375,
-0.49267578125,
-0.55908203125,
-0.8466796875,
0.1258544921875,
-0.057708740234375,
-0.2447509765625,
0.6171875,
0.31201171875,
-0.07635498046875,
-0.06231689453125,
-0.46142578125,
-0.400390625,
-0.034027099609375,
-0.488037109375,
-0.06396484375,
0.76318359375,
0.85205078125,
0.77001953125,
-0.029296875,
-0.5205078125,
-0.1866455078125,
0.07550048828125,
0.1595458984375,
-0.5869140625,
-0.373291015625,
-0.420166015625,
0.0745849609375,
-0.2783203125,
-0.052734375,
0.2139892578125,
0.52392578125,
1.052734375,
0.252685546875,
0.446044921875,
0.52001953125,
-0.390380859375,
0.73046875,
0.21826171875,
-1.1083984375,
-0.436279296875,
0.497802734375,
-0.0012569427490234375,
0.98486328125,
0.1710205078125,
-0.37744140625,
-0.5546875,
-0.861328125,
0.11962890625,
-0.5712890625,
-0.1429443359375,
-0.96142578125,
-0.01143646240234375,
-0.295654296875,
0.73193359375,
-0.19189453125,
-0.93115234375,
0.02581787109375,
-0.85888671875,
-0.01197052001953125,
-0.34765625,
-0.09942626953125,
-0.748046875,
-0.7607421875,
-0.178466796875,
0.59326171875,
-0.0278167724609375,
0.457275390625,
0.03985595703125,
-0.063720703125,
0.19921875,
-0.25,
-0.6005859375,
-0.25244140625,
0.020751953125,
-0.0860595703125,
-0.206298828125,
0.1492919921875,
-0.51513671875,
0.537109375,
-0.78271484375,
0.392822265625,
-0.04656982421875,
0.10662841796875,
-0.414306640625,
-0.1376953125,
0.67529296875,
-0.401611328125,
-0.1085205078125,
0.006015777587890625,
0.25146484375,
0.7001953125,
-0.257080078125,
-0.54296875,
-1.001953125,
-0.802734375,
-1.0439453125,
0.47119140625,
-0.57861328125,
-0.274658203125,
-0.50390625,
-0.23583984375,
1.166015625,
-0.60693359375,
0.2120361328125,
1.1806640625,
0.2432861328125,
0.386962890625,
-0.61572265625,
0.7568359375,
0.67578125,
-0.79833984375,
-0.350830078125,
0.1129150390625,
-0.6845703125,
0.1297607421875,
-0.57861328125,
-0.85595703125,
-0.6435546875,
0.27587890625,
1.4208984375,
-0.3408203125,
0.857421875,
0.291259765625,
-1.0732421875,
-0.73486328125,
0.93310546875,
0.21044921875,
0.1409912109375,
0.89306640625,
0.1026611328125,
-0.310302734375,
-0.040679931640625,
0.09002685546875,
-0.362548828125,
-0.6083984375,
0.70361328125,
-0.15576171875,
-0.220703125,
0.59326171875,
0.82373046875,
-1.154296875,
-0.697265625,
-0.0394287109375,
0.10919189453125,
-0.57373046875,
-0.6591796875,
-0.2034912109375,
0.62109375,
-0.541015625,
0.037200927734375,
0.56298828125,
-0.1278076171875,
0.392822265625,
0.02191162109375,
0.37548828125,
-0.257080078125,
0.56982421875,
0.65283203125,
-0.2939453125,
-0.56396484375,
-0.65576171875,
0.08770751953125,
-0.464599609375,
-0.1478271484375,
0.56396484375,
-0.38916015625,
-0.1807861328125,
0.147705078125,
0.06427001953125,
0.6884765625,
-0.369140625,
-0.36279296875,
0.74853515625,
-0.85400390625,
-0.61669921875,
-0.271728515625,
0.2578125,
-0.012939453125,
0.8984375,
-0.408203125,
0.136474609375,
0.24267578125,
0.322021484375,
-0.37109375,
-1.01953125,
-0.345703125,
-0.9609375,
-0.370849609375,
-0.9052734375,
-0.77734375,
0.0631103515625,
0.51611328125,
-0.058197021484375,
-0.58544921875,
0.32666015625,
0.342041015625,
-0.60498046875,
0.90380859375,
-0.490234375,
0.367919921875,
-0.5673828125,
-0.318115234375,
-1.2626953125,
-0.299560546875,
-0.4697265625,
0.102783203125,
-0.548828125,
0.472412109375,
-0.230224609375,
0.65576171875,
-0.1910400390625,
0.338134765625,
-0.314208984375,
-0.459228515625,
0.08807373046875,
0.29541015625,
0.02166748046875,
0.90966796875,
0.6318359375,
-0.1173095703125,
0.402099609375,
-0.372802734375,
-0.2388916015625,
-0.10552978515625,
0.55908203125,
0.212890625,
-0.211181640625,
0.10491943359375,
-0.48291015625,
0.1534423828125,
-1.0068359375,
0.14404296875,
-0.52783203125,
0.01279449462890625,
0.0565185546875,
0.13427734375,
0.505859375,
1.0966796875,
-0.082763671875,
-0.01338958740234375,
0.208984375,
0.2049560546875,
0.4912109375,
0.2705078125,
-0.3828125,
0.39404296875,
-0.02532958984375,
-0.68603515625,
0.1307373046875,
0.0364990234375,
0.0020809173583984375,
0.1708984375,
-0.1453857421875,
-0.50390625,
-0.8740234375,
0.032073974609375,
-0.037872314453125,
0.052032470703125,
0.556640625,
-0.53076171875,
-0.27978515625,
-0.2041015625,
-0.51025390625,
0.218994140625,
-0.9541015625,
-0.66064453125,
0.67724609375,
0.01131439208984375,
-0.499267578125,
-0.5546875,
-0.275634765625,
0.06365966796875,
-0.055572509765625,
0.006328582763671875,
-0.4091796875,
1.0380859375,
0.1904296875,
0.6240234375,
0.051666259765625,
-0.038055419921875,
-0.346435546875,
0.74365234375,
-1.0263671875,
-0.677734375,
0.435791015625,
0.73486328125,
0.298583984375,
0.0126190185546875,
-0.51318359375,
0.1551513671875,
0.1748046875,
0.369384765625,
-0.438720703125,
-0.16748046875,
-0.2357177734375,
0.87353515625,
-0.8525390625,
0.0257568359375,
0.2000732421875,
0.3564453125,
0.313720703125,
-0.31640625,
-0.78466796875,
0.86279296875,
0.85595703125,
-0.352294921875,
0.30908203125,
0.3779296875,
0.415283203125,
0.34521484375,
-0.3095703125,
-0.30615234375,
0.67236328125,
0.85498046875,
0.82763671875,
-0.240234375,
0.4208984375,
0.66455078125,
-0.0867919921875,
0.0218963623046875,
0.1492919921875,
-0.059814453125,
0.018829345703125,
-0.1077880859375,
0.1470947265625,
-0.10931396484375,
0.2022705078125,
-0.62841796875,
0.033966064453125,
-0.404296875,
-0.1265869140625,
-0.654296875,
-0.367919921875,
0.58349609375,
0.06573486328125,
0.1126708984375,
0.320556640625,
-0.9951171875,
0.35498046875,
0.75830078125,
-0.386474609375,
-0.26171875,
0.74658203125,
0.607421875,
0.40087890625,
0.5966796875,
-0.0273590087890625,
0.70751953125,
-0.357421875,
0.53955078125,
0.314697265625,
0.039794921875,
-0.66796875,
-0.69921875,
-1.103515625,
0.52392578125,
-0.51220703125,
-0.260986328125,
0.9384765625,
-0.51513671875,
-0.19091796875,
-0.279296875,
0.38916015625,
-0.2498779296875,
0.11480712890625,
0.1417236328125,
-0.271240234375,
-1.0751953125,
0.7119140625,
-0.1585693359375,
0.374267578125,
0.07330322265625,
1.0625,
0.064208984375,
1.54296875,
0.6923828125,
-0.039520263671875,
-0.39599609375,
0.669921875,
-0.59423828125,
-0.3681640625,
-0.1754150390625,
-0.80126953125,
-0.08758544921875,
-0.88232421875,
-0.58935546875,
-0.408935546875,
0.94873046875,
0.19287109375,
-1.1611328125,
-0.1875,
0.28564453125,
-0.89013671875,
0.359619140625,
0.379638671875,
0.18994140625,
-0.294921875,
-0.1900634765625,
0.2081298828125,
-1.0146484375,
0.161376953125,
-0.5244140625,
0.2454833984375,
-0.904296875,
-0.43115234375,
-0.544921875,
-0.7421875,
-0.2880859375,
-0.343505859375,
-0.067626953125,
-0.56591796875,
0.57177734375,
0.43212890625,
0.41650390625,
0.1453857421875,
-0.39306640625,
0.20361328125,
0.53515625,
1.0576171875,
-0.287841796875,
0.8330078125,
0.40771484375,
-0.315185546875,
0.01287841796875,
-0.77880859375,
0.41357421875,
-0.444091796875,
-0.130859375,
-0.54736328125,
0.1246337890625,
-0.58544921875,
-1.330078125,
0.0036983489990234375,
0.4052734375,
0.35205078125,
-0.467041015625,
-1.2783203125,
-0.0716552734375,
-1.0078125,
-0.10455322265625,
-0.6533203125,
0.2459716796875,
-0.343017578125,
-0.037994384765625,
-0.055023193359375,
-0.89306640625,
4.375,
1.083984375,
1.2177734375,
0.395751953125,
-0.1761474609375,
0.77587890625,
0.60400390625,
-0.875,
-0.1151123046875,
-0.35693359375,
0.603515625,
-0.11834716796875,
0.0164031982421875,
0.76806640625,
0.2083740234375,
0.7880859375,
-0.96337890625,
0.32861328125,
0.0019855499267578125,
-0.79296875,
-0.80126953125,
0.313720703125,
0.13427734375,
0.207763671875,
-0.403076171875,
0.49365234375,
0.55908203125,
-0.91748046875,
-0.2232666015625,
-0.916015625,
0.255126953125,
-0.455810546875,
1.263671875,
-0.2054443359375,
-0.1318359375,
0.5556640625,
0.04638671875,
-0.230224609375,
0.06134033203125,
-0.084228515625,
-0.1605224609375,
-0.24072265625,
0.3837890625,
-0.7685546875,
0.1971435546875,
0.36669921875,
-0.4072265625,
0.1605224609375,
0.517578125,
-0.8955078125,
1.2626953125,
-0.06939697265625,
0.34423828125,
-0.828125,
-0.62451171875,
0.042388916015625,
0.265869140625,
-0.055450439453125,
-0.259033203125,
0.403564453125,
0.31640625,
0.294921875,
0.1865234375,
0.1612548828125,
-0.72705078125,
1.0546875,
-0.204833984375,
0.31396484375,
-0.62939453125,
-0.4453125,
-0.2890625,
-0.73193359375,
-0.482666015625,
-0.346435546875,
0.97412109375,
0.060699462890625,
-0.1026611328125,
0.72216796875,
0.404052734375,
-0.257568359375,
-0.001361846923828125,
-0.491455078125,
-0.7802734375,
-0.37841796875,
0.4755859375,
1.3564453125,
-0.5576171875,
-0.247802734375,
-0.492431640625,
0.69091796875,
0.60302734375,
0.7314453125,
0.0079345703125,
-0.55908203125,
-0.279541015625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.
A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the temple and read the string aloud. However, nothing happened. Then Asterix supposed that a password is some substring t of the string s.
Prefix supposed that the substring t is the beginning of the string s; Suffix supposed that the substring t should be the end of the string s; and Obelix supposed that t should be located somewhere inside the string s, that is, t is neither its beginning, nor its end.
Asterix chose the substring t so as to please all his companions. Besides, from all acceptable variants Asterix chose the longest one (as Asterix loves long strings). When Asterix read the substring t aloud, the temple doors opened.
You know the string s. Find the substring t or determine that such substring does not exist and all that's been written above is just a nice legend.
Input
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
Output
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
Examples
Input
fixprefixsuffix
Output
fix
Input
abcdabc
Output
Just a legend
Tags: binary search, dp, hashing, string suffix structures, strings
Correct Solution:
```
def prefix(s):
p = [0] * len(s)
for i in range(1, len(s)):
k = p[i - 1]
while k > 0 and s[k] != s[i]:
k = p[k - 1]
if s[k] == s[i]:
k += 1
p[i] = k
return p
string = input()
prefix_values = prefix(string)
n = len(string)
if prefix_values[n - 1] == 0:
print('Just a legend')
exit()
last_pr = prefix_values[n - 1]
for i in range(n - 1):
if prefix_values[i] == last_pr:
print(string[:prefix_values[i]])
exit()
next_pos_value = prefix_values[last_pr - 1]
if next_pos_value == 0:
print('Just a legend')
exit()
for i in range(n):
a = prefix_values[i]
if prefix_values[i] == next_pos_value and i != last_pr:
print(string[:prefix_values[i]])
exit()
# print('Just a legend')
```
| 43,075
|
[
0.352294921875,
-0.019195556640625,
0.2421875,
-0.080322265625,
-0.14013671875,
-0.3056640625,
-0.00844573974609375,
0.037933349609375,
0.147705078125,
0.71142578125,
0.5439453125,
0.2191162109375,
-0.0703125,
-0.96240234375,
-0.8837890625,
0.34814453125,
-0.44140625,
-0.5244140625,
-0.430908203125,
-0.325927734375,
-0.211669921875,
0.040191650390625,
-1.2734375,
-0.499267578125,
-0.296142578125,
0.69921875,
0.07855224609375,
0.40234375,
0.83056640625,
1.208984375,
0.00238800048828125,
-0.312255859375,
0.5068359375,
-0.896484375,
-0.53173828125,
-0.1865234375,
0.5361328125,
-0.8408203125,
-0.01110076904296875,
-0.50048828125,
0.04248046875,
0.161376953125,
0.267822265625,
-0.84033203125,
-1.017578125,
0.230224609375,
-0.48193359375,
-0.280029296875,
-0.1944580078125,
-0.53759765625,
-0.115966796875,
-0.427001953125,
0.658203125,
0.06231689453125,
0.132080078125,
-0.1339111328125,
-0.01267242431640625,
-0.1180419921875,
-0.2298583984375,
0.2191162109375,
0.361083984375,
0.2183837890625,
0.1627197265625,
-0.75634765625,
-0.0303497314453125,
-0.08868408203125,
-0.2080078125,
-0.422607421875,
0.125,
-0.88525390625,
-0.245361328125,
0.583984375,
-0.09552001953125,
-0.70751953125,
-0.63232421875,
0.337158203125,
0.525390625,
0.10882568359375,
-0.40771484375,
0.32666015625,
-0.154296875,
0.84912109375,
0.642578125,
-0.1339111328125,
-0.456787109375,
-0.7177734375,
-0.1480712890625,
0.455322265625,
0.382080078125,
-0.2454833984375,
-0.33349609375,
0.69189453125,
-0.368896484375,
-0.10150146484375,
0.364501953125,
0.8427734375,
-0.438720703125,
0.266357421875,
0.19189453125,
0.1710205078125,
0.381591796875,
0.75537109375,
-0.67578125,
0.61572265625,
-0.267333984375,
0.09326171875,
0.2666015625,
0.1646728515625,
-0.1390380859375,
-0.427734375,
0.032073974609375,
-0.78466796875,
0.84423828125,
0.430419921875,
0.2354736328125,
0.92578125,
-0.48095703125,
0.263427734375,
-0.8818359375,
0.0092315673828125,
0.59912109375,
-0.0201568603515625,
0.71240234375,
-0.1539306640625,
-0.00870513916015625,
-0.0665283203125,
-0.278564453125,
0.63818359375,
-0.81640625,
0.054412841796875,
0.261474609375,
-0.0784912109375,
0.00791168212890625,
0.5546875,
-0.1375732421875,
0.70703125,
-0.01806640625,
0.673828125,
0.72705078125,
-1.111328125,
0.859375,
0.04931640625,
0.053253173828125,
1.533203125,
0.68017578125,
-0.00344085693359375,
0.395751953125,
0.1904296875,
-0.75537109375,
0.29931640625,
-1.1484375,
0.466796875,
0.309814453125,
-0.07403564453125,
-0.6162109375,
0.2054443359375,
-0.5439453125,
0.4765625,
0.1392822265625,
0.19580078125,
-0.405029296875,
0.322998046875,
-0.014923095703125,
1.076171875,
-0.198974609375,
0.97705078125,
-0.382568359375,
-0.56689453125,
-0.061920166015625,
-0.869140625,
0.1689453125,
-0.0229949951171875,
0.043121337890625,
0.72119140625,
0.6416015625,
1.244140625,
1.068359375,
-0.2054443359375,
0.388427734375,
0.385498046875,
-0.52001953125,
0.277587890625,
0.0389404296875,
0.69970703125,
0.162841796875,
-0.005359649658203125,
0.408935546875,
-0.07470703125,
-0.97900390625,
-0.25927734375,
-0.07177734375,
0.7978515625,
-0.417236328125,
0.495849609375,
0.165771484375,
0.08135986328125,
-0.71240234375,
-0.260009765625,
-0.09185791015625,
-1.291015625,
-0.296875,
0.83251953125,
-0.2303466796875,
0.7294921875,
-0.260986328125,
-0.505859375,
0.77001953125,
1.400390625,
0.01232147216796875,
0.205322265625,
0.449462890625,
0.1282958984375,
-0.037567138671875,
0.472412109375,
0.30126953125,
-0.3388671875,
-0.74462890625,
1.2158203125,
-0.154296875,
0.0286712646484375,
-0.304931640625,
0.5732421875,
0.157470703125,
0.377685546875,
-0.40771484375,
-0.204345703125,
0.327392578125,
1.12890625,
0.0579833984375,
0.27587890625,
0.0634765625,
0.7236328125,
0.5166015625,
0.70263671875,
0.391357421875,
0.36572265625,
0.599609375,
0.66796875,
0.10736083984375,
-0.174072265625,
-0.1588134765625,
0.2197265625,
0.494140625,
0.69482421875,
0.17529296875,
0.341796875,
0.034393310546875,
-0.311767578125,
-0.326416015625,
0.13330078125,
0.086669921875,
0.82763671875,
0.1903076171875,
0.1529541015625,
-0.62158203125,
-0.175048828125,
0.257080078125,
0.70703125,
-1.001953125,
-0.5234375,
-0.040130615234375,
-0.349365234375,
0.40869140625,
-0.213134765625,
0.6923828125,
0.144287109375,
0.5537109375,
0.53515625,
-0.4208984375,
-0.66552734375,
-0.7939453125,
-0.72802734375,
-1.033203125,
-0.335693359375,
-0.5654296875,
-0.22265625,
0.54248046875,
-0.82666015625,
0.2252197265625,
-0.410888671875,
-0.01122283935546875,
0.43115234375,
-0.7421875,
0.85888671875,
-0.0069427490234375,
0.6943359375,
-0.488037109375,
0.591796875,
0.0097808837890625,
0.84423828125,
-0.7802734375,
-0.12890625,
-0.212646484375,
-0.6259765625,
0.1285400390625,
0.153564453125,
0.390869140625,
-0.10760498046875,
-0.2308349609375,
-0.60986328125,
-0.45703125,
-0.279052734375,
-0.65087890625,
0.60546875,
-0.865234375,
0.61767578125,
0.81005859375,
-0.5654296875,
0.79296875,
0.77978515625,
-0.52294921875,
0.7578125,
0.379150390625,
0.1326904296875,
-0.94384765625,
1.3505859375,
0.322998046875,
0.150146484375,
-0.62744140625,
-0.56640625,
-0.44677734375,
-0.15966796875,
0.217041015625,
-0.426025390625,
-0.323974609375,
0.869140625,
-0.050201416015625,
-0.9541015625,
0.4140625,
-1.2841796875,
-0.259033203125,
-0.1422119140625,
-0.3955078125,
0.92041015625,
0.393310546875,
0.283203125,
-0.51123046875,
-0.6259765625,
0.23974609375,
0.52978515625,
0.06536865234375,
-0.32958984375,
-0.1416015625,
0.4150390625,
-0.1175537109375,
0.341552734375,
-0.22802734375,
-0.68701171875,
-0.250244140625,
-0.2481689453125,
-0.0021953582763671875,
0.57763671875,
0.278564453125,
0.2186279296875,
0.65234375,
0.7978515625,
-0.85986328125,
-0.0277862548828125,
-0.32373046875,
0.84814453125,
0.51953125,
0.1917724609375,
0.50732421875,
-0.2103271484375,
-0.480712890625,
-1.095703125,
-0.0899658203125,
0.259765625,
0.998046875,
-0.6484375,
0.51318359375,
0.303466796875,
-0.65185546875,
0.7177734375,
-0.94921875,
0.0219573974609375,
1.0595703125,
-0.83447265625,
0.7177734375,
-0.24755859375,
0.317626953125,
-0.1480712890625,
0.1414794921875,
0.375,
0.016571044921875,
0.494873046875,
-0.180908203125,
-0.64892578125,
0.01470184326171875,
-0.053497314453125,
-0.219970703125,
-0.4111328125,
0.6748046875,
-0.2054443359375,
-0.5556640625,
-0.59521484375,
0.85302734375,
0.85546875,
0.79150390625,
-0.0679931640625,
0.121337890625,
-0.1771240234375,
0.491943359375,
0.1790771484375,
-0.578125,
0.1865234375,
-0.85498046875,
0.73681640625,
0.1041259765625,
0.085205078125,
-0.455810546875,
-0.040008544921875,
-0.424560546875,
0.41064453125,
0.051300048828125,
-0.240478515625,
-0.91845703125,
0.23583984375,
0.075927734375,
0.46044921875,
-1.041015625,
-0.548828125,
-0.36083984375,
0.274658203125,
0.316162109375,
-0.75341796875,
0.02777099609375,
-0.7470703125,
0.409423828125,
0.1861572265625,
-0.05621337890625,
-0.329833984375,
-0.71630859375,
-0.462646484375,
-0.57177734375,
-0.160888671875,
0.80419921875,
0.08551025390625,
0.342041015625,
-1.173828125,
0.483154296875,
0.10308837890625,
-0.0102691650390625,
-0.2120361328125,
0.046722412109375,
0.395263671875,
0.016265869140625,
0.86328125,
-0.26806640625,
-0.6630859375,
0.251220703125,
-1.3271484375,
0.52392578125,
-0.299560546875,
0.437744140625,
-0.0281524658203125,
-0.127197265625,
0.08538818359375,
0.47509765625,
-0.5517578125,
0.418701171875,
-0.1827392578125,
0.190185546875,
-0.290283203125,
-0.72509765625,
0.84765625,
-0.318115234375,
-0.70556640625,
0.97216796875,
0.17333984375,
-0.051849365234375,
0.443115234375,
0.822265625,
-0.402587890625,
0.274169921875,
-0.383544921875,
0.5283203125,
-0.51220703125,
-0.54833984375,
0.1134033203125,
-0.2047119140625,
1.134765625,
0.1455078125,
-0.44384765625,
-0.578125,
-0.82421875,
0.12103271484375,
-0.0634765625,
-0.1959228515625,
0.6298828125,
0.31298828125,
-0.10723876953125,
-0.06488037109375,
-0.44482421875,
-0.386474609375,
-0.058319091796875,
-0.4951171875,
-0.07421875,
0.80615234375,
0.8662109375,
0.74072265625,
-0.01398468017578125,
-0.5400390625,
-0.207275390625,
0.11810302734375,
0.1707763671875,
-0.57666015625,
-0.4072265625,
-0.3837890625,
0.036712646484375,
-0.308349609375,
-0.058746337890625,
0.203125,
0.5458984375,
1.0400390625,
0.259033203125,
0.41650390625,
0.52734375,
-0.410400390625,
0.64794921875,
0.290771484375,
-1.1083984375,
-0.4873046875,
0.45654296875,
0.025848388671875,
0.9853515625,
0.1494140625,
-0.392578125,
-0.53369140625,
-0.85986328125,
0.09716796875,
-0.489501953125,
-0.12060546875,
-0.92431640625,
-0.0802001953125,
-0.275390625,
0.6728515625,
-0.2242431640625,
-0.97265625,
-0.04193115234375,
-0.8759765625,
0.02252197265625,
-0.2978515625,
-0.148681640625,
-0.73681640625,
-0.7763671875,
-0.1939697265625,
0.556640625,
0.0191650390625,
0.405517578125,
0.028045654296875,
-0.07342529296875,
0.1744384765625,
-0.2734375,
-0.578125,
-0.187255859375,
0.05029296875,
-0.0802001953125,
-0.25341796875,
0.2001953125,
-0.52783203125,
0.51806640625,
-0.8203125,
0.388916015625,
-0.056884765625,
0.185791015625,
-0.4677734375,
-0.10565185546875,
0.6416015625,
-0.391845703125,
-0.1539306640625,
-0.03436279296875,
0.3115234375,
0.65673828125,
-0.283447265625,
-0.53759765625,
-1.0693359375,
-0.822265625,
-1.0947265625,
0.459228515625,
-0.609375,
-0.326904296875,
-0.53564453125,
-0.225341796875,
1.1396484375,
-0.5947265625,
0.20556640625,
1.208984375,
0.2423095703125,
0.377685546875,
-0.62060546875,
0.78955078125,
0.6630859375,
-0.779296875,
-0.3818359375,
0.1416015625,
-0.61962890625,
0.10552978515625,
-0.576171875,
-0.85986328125,
-0.62841796875,
0.30419921875,
1.462890625,
-0.346923828125,
0.8134765625,
0.270751953125,
-1.0458984375,
-0.72802734375,
0.873046875,
0.239990234375,
0.15625,
0.8623046875,
0.10162353515625,
-0.299072265625,
-0.035858154296875,
0.10504150390625,
-0.3466796875,
-0.583984375,
0.6328125,
-0.173095703125,
-0.2083740234375,
0.5361328125,
0.87548828125,
-1.1298828125,
-0.671875,
-0.026458740234375,
0.0989990234375,
-0.5205078125,
-0.642578125,
-0.254638671875,
0.6123046875,
-0.58740234375,
0.023651123046875,
0.51904296875,
-0.115234375,
0.34375,
0.005832672119140625,
0.37353515625,
-0.253662109375,
0.58837890625,
0.6689453125,
-0.30224609375,
-0.5771484375,
-0.599609375,
0.038177490234375,
-0.43798828125,
-0.12481689453125,
0.560546875,
-0.38134765625,
-0.214599609375,
0.1373291015625,
0.0251007080078125,
0.70849609375,
-0.33837890625,
-0.3779296875,
0.75537109375,
-0.865234375,
-0.60546875,
-0.234130859375,
0.2076416015625,
0.010955810546875,
0.92041015625,
-0.347412109375,
0.125732421875,
0.2005615234375,
0.2783203125,
-0.364501953125,
-1.04296875,
-0.322998046875,
-0.9169921875,
-0.328125,
-0.91796875,
-0.79638671875,
0.0672607421875,
0.434814453125,
-0.11492919921875,
-0.62841796875,
0.346435546875,
0.324462890625,
-0.5400390625,
0.8955078125,
-0.45166015625,
0.39599609375,
-0.64501953125,
-0.370361328125,
-1.23046875,
-0.316650390625,
-0.396240234375,
0.11419677734375,
-0.5283203125,
0.4453125,
-0.1624755859375,
0.609375,
-0.199951171875,
0.40185546875,
-0.255859375,
-0.513671875,
0.11932373046875,
0.29736328125,
0.06695556640625,
0.91064453125,
0.64599609375,
-0.1663818359375,
0.3779296875,
-0.314697265625,
-0.279296875,
-0.137451171875,
0.5361328125,
0.20458984375,
-0.2044677734375,
0.1016845703125,
-0.484375,
0.184326171875,
-0.98974609375,
0.0853271484375,
-0.5380859375,
0.0498046875,
0.07977294921875,
0.1348876953125,
0.492431640625,
1.0576171875,
-0.10772705078125,
-0.00205230712890625,
0.192138671875,
0.2406005859375,
0.52685546875,
0.2734375,
-0.413818359375,
0.412841796875,
-0.023651123046875,
-0.70751953125,
0.1075439453125,
-0.004398345947265625,
0.0021190643310546875,
0.1815185546875,
-0.1602783203125,
-0.494384765625,
-0.8720703125,
0.040863037109375,
0.005260467529296875,
0.039520263671875,
0.51806640625,
-0.53759765625,
-0.2421875,
-0.126220703125,
-0.52685546875,
0.2154541015625,
-0.873046875,
-0.64208984375,
0.68798828125,
0.02178955078125,
-0.497314453125,
-0.546875,
-0.28857421875,
0.019927978515625,
-0.06268310546875,
0.0305938720703125,
-0.43798828125,
1.0615234375,
0.130859375,
0.60595703125,
-0.0201263427734375,
-0.09613037109375,
-0.358642578125,
0.7314453125,
-0.99755859375,
-0.6533203125,
0.457275390625,
0.71728515625,
0.344970703125,
0.07794189453125,
-0.491943359375,
0.12164306640625,
0.1834716796875,
0.39794921875,
-0.462646484375,
-0.19140625,
-0.2225341796875,
0.84521484375,
-0.8544921875,
-0.01959228515625,
0.2020263671875,
0.3515625,
0.32763671875,
-0.343017578125,
-0.78662109375,
0.8447265625,
0.8525390625,
-0.33447265625,
0.3046875,
0.403076171875,
0.4169921875,
0.3466796875,
-0.320556640625,
-0.285400390625,
0.65576171875,
0.85791015625,
0.8173828125,
-0.272705078125,
0.396484375,
0.66748046875,
-0.105224609375,
0.037994384765625,
0.196044921875,
-0.05902099609375,
-0.0186309814453125,
-0.049713134765625,
0.154052734375,
-0.1160888671875,
0.278564453125,
-0.61328125,
0.041412353515625,
-0.3681640625,
-0.1734619140625,
-0.68505859375,
-0.37060546875,
0.5625,
0.0447998046875,
0.09527587890625,
0.347900390625,
-0.9921875,
0.329833984375,
0.7119140625,
-0.3720703125,
-0.24755859375,
0.73193359375,
0.60888671875,
0.369384765625,
0.611328125,
-0.022552490234375,
0.74169921875,
-0.291015625,
0.509765625,
0.2900390625,
0.08538818359375,
-0.62255859375,
-0.71728515625,
-1.099609375,
0.53564453125,
-0.51220703125,
-0.218994140625,
0.90283203125,
-0.5146484375,
-0.1920166015625,
-0.306640625,
0.369384765625,
-0.2330322265625,
0.0933837890625,
0.1319580078125,
-0.2493896484375,
-1.05078125,
0.72314453125,
-0.0849609375,
0.428955078125,
0.05462646484375,
1.0263671875,
0.0216827392578125,
1.548828125,
0.67529296875,
-0.04583740234375,
-0.420654296875,
0.6875,
-0.564453125,
-0.37841796875,
-0.185302734375,
-0.75146484375,
-0.1044921875,
-0.86376953125,
-0.52197265625,
-0.416748046875,
0.94091796875,
0.2724609375,
-1.169921875,
-0.190673828125,
0.244384765625,
-0.8779296875,
0.315185546875,
0.363037109375,
0.184814453125,
-0.289794921875,
-0.1983642578125,
0.231689453125,
-0.98095703125,
0.1331787109375,
-0.54541015625,
0.27734375,
-0.90185546875,
-0.443115234375,
-0.4951171875,
-0.70703125,
-0.28076171875,
-0.331787109375,
-0.07513427734375,
-0.53369140625,
0.5703125,
0.475830078125,
0.470947265625,
0.1614990234375,
-0.369873046875,
0.2000732421875,
0.55029296875,
1.048828125,
-0.3095703125,
0.83154296875,
0.425048828125,
-0.338623046875,
-0.04998779296875,
-0.76708984375,
0.427734375,
-0.431640625,
-0.1400146484375,
-0.54736328125,
0.06976318359375,
-0.537109375,
-1.376953125,
0.031158447265625,
0.41357421875,
0.348876953125,
-0.390869140625,
-1.22265625,
-0.0206146240234375,
-0.9931640625,
-0.1513671875,
-0.68017578125,
0.263916015625,
-0.369873046875,
-0.0511474609375,
-0.03192138671875,
-0.912109375,
4.41015625,
1.06640625,
1.2177734375,
0.379150390625,
-0.1591796875,
0.73291015625,
0.634765625,
-0.861328125,
-0.18408203125,
-0.421875,
0.56982421875,
-0.155029296875,
-0.0016937255859375,
0.7353515625,
0.174560546875,
0.7802734375,
-0.97216796875,
0.375732421875,
-0.0272064208984375,
-0.7373046875,
-0.7919921875,
0.34423828125,
0.12548828125,
0.2413330078125,
-0.4365234375,
0.482177734375,
0.54248046875,
-0.8798828125,
-0.197509765625,
-0.9580078125,
0.230224609375,
-0.5087890625,
1.3056640625,
-0.1484375,
-0.1571044921875,
0.58447265625,
0.000039637088775634766,
-0.17822265625,
0.07745361328125,
-0.09490966796875,
-0.1885986328125,
-0.25732421875,
0.373779296875,
-0.740234375,
0.176513671875,
0.2880859375,
-0.3759765625,
0.10955810546875,
0.5400390625,
-0.82470703125,
1.294921875,
-0.08514404296875,
0.303955078125,
-0.86669921875,
-0.6142578125,
0.05499267578125,
0.330322265625,
-0.04364013671875,
-0.25927734375,
0.400146484375,
0.312744140625,
0.28125,
0.19677734375,
0.10357666015625,
-0.68994140625,
1.07421875,
-0.195068359375,
0.34033203125,
-0.60498046875,
-0.480224609375,
-0.30712890625,
-0.67578125,
-0.476318359375,
-0.3486328125,
0.93603515625,
0.012969970703125,
-0.076171875,
0.72412109375,
0.34423828125,
-0.266357421875,
-0.01213836669921875,
-0.5302734375,
-0.75634765625,
-0.36767578125,
0.47021484375,
1.337890625,
-0.5009765625,
-0.1878662109375,
-0.51171875,
0.67138671875,
0.5634765625,
0.80126953125,
-0.02081298828125,
-0.537109375,
-0.26220703125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.
A little later they found a string s, carved on a rock below the temple's gates. Asterix supposed that that's the password that opens the temple and read the string aloud. However, nothing happened. Then Asterix supposed that a password is some substring t of the string s.
Prefix supposed that the substring t is the beginning of the string s; Suffix supposed that the substring t should be the end of the string s; and Obelix supposed that t should be located somewhere inside the string s, that is, t is neither its beginning, nor its end.
Asterix chose the substring t so as to please all his companions. Besides, from all acceptable variants Asterix chose the longest one (as Asterix loves long strings). When Asterix read the substring t aloud, the temple doors opened.
You know the string s. Find the substring t or determine that such substring does not exist and all that's been written above is just a nice legend.
Input
You are given the string s whose length can vary from 1 to 106 (inclusive), consisting of small Latin letters.
Output
Print the string t. If a suitable t string does not exist, then print "Just a legend" without the quotes.
Examples
Input
fixprefixsuffix
Output
fix
Input
abcdabc
Output
Just a legend
Tags: binary search, dp, hashing, string suffix structures, strings
Correct Solution:
```
def kmpTable(s, n):
res = [0]*n
check_idx = 0
for i in range(1, n):
while check_idx > 0 and s[check_idx] != s[i]:
check_idx = res[check_idx-1]
if s[check_idx] == s[i]:
check_idx += 1
res[i] = check_idx
return res
s = input()
n = len(s)
kmp_table = kmpTable(s, n)
psize = kmp_table[n-1]
if psize > 0 and psize in kmp_table[:-1]:
print(s[:psize])
else:
psize = kmp_table[psize-1]
if psize > 0 and psize in kmp_table[:-1]:
print(s[:psize])
else:
print("Just a legend")
```
| 43,076
|
[
0.3857421875,
-0.0263214111328125,
0.2259521484375,
-0.01186370849609375,
-0.10784912109375,
-0.23828125,
-0.0218353271484375,
0.1015625,
0.11279296875,
0.71875,
0.56298828125,
0.1680908203125,
-0.08990478515625,
-0.943359375,
-0.87939453125,
0.3857421875,
-0.434326171875,
-0.5224609375,
-0.408203125,
-0.2509765625,
-0.1409912109375,
0.033966064453125,
-1.2646484375,
-0.450439453125,
-0.327392578125,
0.67431640625,
0.058837890625,
0.424072265625,
0.83251953125,
1.244140625,
0.02301025390625,
-0.30322265625,
0.54833984375,
-0.85986328125,
-0.54150390625,
-0.2276611328125,
0.57177734375,
-0.7978515625,
0.0012998580932617188,
-0.52197265625,
-0.01044464111328125,
0.1793212890625,
0.30078125,
-0.81640625,
-1.0576171875,
0.239990234375,
-0.448486328125,
-0.26318359375,
-0.156982421875,
-0.478271484375,
-0.09796142578125,
-0.359619140625,
0.61865234375,
0.025909423828125,
0.11151123046875,
-0.149169921875,
-0.033843994140625,
-0.07659912109375,
-0.23486328125,
0.177734375,
0.346923828125,
0.1929931640625,
0.1370849609375,
-0.81884765625,
0.032684326171875,
-0.060394287109375,
-0.2303466796875,
-0.428955078125,
0.1083984375,
-0.92236328125,
-0.260986328125,
0.572265625,
-0.138427734375,
-0.75146484375,
-0.6259765625,
0.382080078125,
0.433837890625,
0.1676025390625,
-0.38916015625,
0.30126953125,
-0.1378173828125,
0.810546875,
0.6298828125,
-0.2265625,
-0.43017578125,
-0.7421875,
-0.1295166015625,
0.479248046875,
0.3291015625,
-0.185791015625,
-0.335693359375,
0.7158203125,
-0.385009765625,
-0.1121826171875,
0.422119140625,
0.82470703125,
-0.416259765625,
0.274658203125,
0.158203125,
0.199462890625,
0.362060546875,
0.7861328125,
-0.74560546875,
0.56982421875,
-0.2232666015625,
0.1221923828125,
0.28173828125,
0.11956787109375,
-0.0633544921875,
-0.46728515625,
0.0106964111328125,
-0.7958984375,
0.822265625,
0.412109375,
0.1890869140625,
0.923828125,
-0.48095703125,
0.276611328125,
-0.81884765625,
0.00281524658203125,
0.54345703125,
-0.0321044921875,
0.6796875,
-0.108154296875,
-0.0005583763122558594,
-0.10882568359375,
-0.318115234375,
0.69091796875,
-0.810546875,
0.08697509765625,
0.28857421875,
-0.10247802734375,
0.00847625732421875,
0.5947265625,
-0.1494140625,
0.70263671875,
-0.042510986328125,
0.611328125,
0.68408203125,
-1.0859375,
0.8310546875,
0.0343017578125,
0.07958984375,
1.5166015625,
0.61962890625,
-0.0112457275390625,
0.441162109375,
0.12353515625,
-0.75537109375,
0.306396484375,
-1.12109375,
0.42578125,
0.337890625,
-0.0499267578125,
-0.578125,
0.239501953125,
-0.62548828125,
0.4619140625,
0.109375,
0.1744384765625,
-0.43115234375,
0.3349609375,
-0.006710052490234375,
1.0576171875,
-0.15771484375,
0.94873046875,
-0.39306640625,
-0.56787109375,
-0.0648193359375,
-0.8837890625,
0.1170654296875,
-0.046722412109375,
0.0799560546875,
0.740234375,
0.6318359375,
1.2431640625,
0.98974609375,
-0.206787109375,
0.367919921875,
0.346435546875,
-0.478759765625,
0.275634765625,
0.1378173828125,
0.69384765625,
0.214111328125,
0.042877197265625,
0.39111328125,
-0.026214599609375,
-0.97216796875,
-0.27197265625,
-0.0908203125,
0.75732421875,
-0.45068359375,
0.51123046875,
0.146484375,
0.0919189453125,
-0.73486328125,
-0.22021484375,
-0.06396484375,
-1.3662109375,
-0.302734375,
0.84130859375,
-0.224365234375,
0.6884765625,
-0.2308349609375,
-0.50439453125,
0.751953125,
1.3544921875,
-0.0699462890625,
0.17724609375,
0.4443359375,
0.1280517578125,
0.0180206298828125,
0.400634765625,
0.2322998046875,
-0.344482421875,
-0.75732421875,
1.173828125,
-0.1890869140625,
0.01108551025390625,
-0.29736328125,
0.61181640625,
0.188232421875,
0.41796875,
-0.42333984375,
-0.250244140625,
0.30859375,
1.1767578125,
0.07147216796875,
0.269775390625,
0.03192138671875,
0.7294921875,
0.56396484375,
0.7666015625,
0.385009765625,
0.4033203125,
0.62255859375,
0.66748046875,
0.1759033203125,
-0.1923828125,
-0.1644287109375,
0.205810546875,
0.46484375,
0.73388671875,
0.189208984375,
0.391845703125,
0.0249481201171875,
-0.345703125,
-0.283447265625,
0.09814453125,
0.071533203125,
0.876953125,
0.1483154296875,
0.1788330078125,
-0.65283203125,
-0.202392578125,
0.2626953125,
0.763671875,
-0.95849609375,
-0.5341796875,
-0.010711669921875,
-0.4150390625,
0.28564453125,
-0.2276611328125,
0.64404296875,
0.193115234375,
0.51416015625,
0.59326171875,
-0.43310546875,
-0.62939453125,
-0.73779296875,
-0.7216796875,
-1.033203125,
-0.303466796875,
-0.58740234375,
-0.227294921875,
0.529296875,
-0.82763671875,
0.18896484375,
-0.40966796875,
0.0126495361328125,
0.46435546875,
-0.69091796875,
0.84130859375,
-0.06243896484375,
0.72119140625,
-0.422119140625,
0.6142578125,
0.0469970703125,
0.79052734375,
-0.830078125,
-0.163818359375,
-0.305908203125,
-0.60791015625,
0.186279296875,
0.10955810546875,
0.33740234375,
-0.12225341796875,
-0.266357421875,
-0.6513671875,
-0.43408203125,
-0.289794921875,
-0.62744140625,
0.54638671875,
-0.8076171875,
0.5947265625,
0.78515625,
-0.481201171875,
0.7783203125,
0.78857421875,
-0.52978515625,
0.74560546875,
0.3818359375,
0.08660888671875,
-0.9638671875,
1.3349609375,
0.368896484375,
0.1473388671875,
-0.5693359375,
-0.57421875,
-0.46875,
-0.1707763671875,
0.2188720703125,
-0.413818359375,
-0.271728515625,
0.896484375,
-0.0260467529296875,
-0.974609375,
0.3544921875,
-1.2119140625,
-0.257080078125,
-0.10638427734375,
-0.314453125,
0.912109375,
0.438232421875,
0.258544921875,
-0.495849609375,
-0.62451171875,
0.254638671875,
0.51806640625,
0.0232086181640625,
-0.352294921875,
-0.1884765625,
0.3974609375,
-0.1405029296875,
0.272216796875,
-0.1964111328125,
-0.55615234375,
-0.22509765625,
-0.27734375,
0.00740814208984375,
0.60107421875,
0.26123046875,
0.266357421875,
0.6455078125,
0.83984375,
-0.80859375,
-0.06475830078125,
-0.321044921875,
0.8779296875,
0.474609375,
0.2197265625,
0.51513671875,
-0.1981201171875,
-0.45263671875,
-1.1025390625,
-0.057830810546875,
0.286865234375,
0.9404296875,
-0.6396484375,
0.431884765625,
0.321044921875,
-0.6435546875,
0.69970703125,
-0.92578125,
-0.027252197265625,
1.033203125,
-0.74365234375,
0.7626953125,
-0.2012939453125,
0.307861328125,
-0.1488037109375,
0.1826171875,
0.443603515625,
0.01605224609375,
0.46044921875,
-0.15673828125,
-0.64501953125,
0.0261993408203125,
-0.05987548828125,
-0.203857421875,
-0.471435546875,
0.666015625,
-0.2442626953125,
-0.5908203125,
-0.6376953125,
0.8173828125,
0.82763671875,
0.7314453125,
-0.1275634765625,
0.05145263671875,
-0.1336669921875,
0.60546875,
0.241455078125,
-0.5966796875,
0.1844482421875,
-0.7880859375,
0.76708984375,
0.1322021484375,
0.1297607421875,
-0.461181640625,
0.03253173828125,
-0.41455078125,
0.316162109375,
0.09698486328125,
-0.251953125,
-0.8828125,
0.266845703125,
0.1575927734375,
0.471923828125,
-0.9638671875,
-0.5107421875,
-0.329345703125,
0.2362060546875,
0.287353515625,
-0.75390625,
0.058563232421875,
-0.68896484375,
0.444580078125,
0.164306640625,
-0.05413818359375,
-0.357666015625,
-0.69091796875,
-0.51953125,
-0.56103515625,
-0.1680908203125,
0.82421875,
0.08538818359375,
0.368408203125,
-1.19921875,
0.4404296875,
0.1368408203125,
0.0008869171142578125,
-0.251953125,
0.04193115234375,
0.42041015625,
0.06756591796875,
0.8330078125,
-0.374267578125,
-0.650390625,
0.264892578125,
-1.2958984375,
0.56103515625,
-0.343994140625,
0.389892578125,
-0.017181396484375,
-0.0762939453125,
0.10150146484375,
0.50390625,
-0.497802734375,
0.4287109375,
-0.2066650390625,
0.199462890625,
-0.3203125,
-0.7216796875,
0.875,
-0.30810546875,
-0.748046875,
1.0029296875,
0.169677734375,
-0.005573272705078125,
0.41162109375,
0.74853515625,
-0.3701171875,
0.280517578125,
-0.39453125,
0.51611328125,
-0.45849609375,
-0.50439453125,
0.12139892578125,
-0.2330322265625,
1.150390625,
0.1788330078125,
-0.48193359375,
-0.54638671875,
-0.81689453125,
0.10791015625,
0.01399993896484375,
-0.2293701171875,
0.623046875,
0.31591796875,
-0.0718994140625,
-0.093994140625,
-0.457275390625,
-0.444580078125,
-0.05670166015625,
-0.533203125,
-0.05706787109375,
0.74853515625,
0.81689453125,
0.75927734375,
-0.005413055419921875,
-0.51708984375,
-0.1575927734375,
0.06707763671875,
0.151611328125,
-0.6328125,
-0.426513671875,
-0.40478515625,
0.029327392578125,
-0.34716796875,
-0.060150146484375,
0.254150390625,
0.450439453125,
1.0693359375,
0.27001953125,
0.47607421875,
0.544921875,
-0.401123046875,
0.61572265625,
0.276123046875,
-1.1455078125,
-0.53271484375,
0.478759765625,
0.05615234375,
0.96044921875,
0.147216796875,
-0.40771484375,
-0.57763671875,
-0.82421875,
0.12298583984375,
-0.564453125,
-0.187255859375,
-0.92626953125,
0.036895751953125,
-0.308349609375,
0.6865234375,
-0.1788330078125,
-0.92236328125,
-0.0167388916015625,
-0.8779296875,
0.01126861572265625,
-0.316650390625,
-0.150146484375,
-0.69287109375,
-0.7509765625,
-0.26025390625,
0.60107421875,
-0.05206298828125,
0.44775390625,
-0.038787841796875,
-0.125244140625,
0.1904296875,
-0.278076171875,
-0.57763671875,
-0.302490234375,
-0.002239227294921875,
-0.07269287109375,
-0.2371826171875,
0.1929931640625,
-0.494873046875,
0.515625,
-0.7763671875,
0.496337890625,
-0.0640869140625,
0.2427978515625,
-0.47998046875,
-0.1910400390625,
0.59814453125,
-0.37353515625,
-0.129150390625,
-0.0178375244140625,
0.2291259765625,
0.67578125,
-0.258544921875,
-0.48046875,
-1.02734375,
-0.791015625,
-1.04296875,
0.48828125,
-0.5986328125,
-0.308349609375,
-0.467529296875,
-0.288330078125,
1.0947265625,
-0.57568359375,
0.2000732421875,
1.1767578125,
0.2279052734375,
0.3515625,
-0.57958984375,
0.69580078125,
0.666015625,
-0.80712890625,
-0.401611328125,
0.1600341796875,
-0.66015625,
0.18017578125,
-0.5380859375,
-0.845703125,
-0.583984375,
0.2486572265625,
1.4287109375,
-0.386962890625,
0.853515625,
0.28271484375,
-1.0361328125,
-0.71826171875,
0.95263671875,
0.270263671875,
0.1175537109375,
0.85888671875,
0.139404296875,
-0.2939453125,
-0.10205078125,
0.039520263671875,
-0.322021484375,
-0.61669921875,
0.650390625,
-0.1302490234375,
-0.26513671875,
0.54296875,
0.89794921875,
-1.1240234375,
-0.67529296875,
0.005035400390625,
0.09417724609375,
-0.53173828125,
-0.6337890625,
-0.2156982421875,
0.5693359375,
-0.59814453125,
-0.004680633544921875,
0.544921875,
-0.08441162109375,
0.346923828125,
-0.01175689697265625,
0.458251953125,
-0.252685546875,
0.58203125,
0.6376953125,
-0.2509765625,
-0.53759765625,
-0.6123046875,
0.0738525390625,
-0.480224609375,
-0.1109619140625,
0.607421875,
-0.38427734375,
-0.1605224609375,
0.1226806640625,
0.061553955078125,
0.6796875,
-0.367919921875,
-0.39453125,
0.7412109375,
-0.84228515625,
-0.5322265625,
-0.26953125,
0.2249755859375,
0.027618408203125,
0.85546875,
-0.363037109375,
0.12310791015625,
0.1986083984375,
0.2418212890625,
-0.388671875,
-1,
-0.325927734375,
-0.91357421875,
-0.360107421875,
-0.904296875,
-0.76513671875,
0.0634765625,
0.49462890625,
-0.1392822265625,
-0.6484375,
0.292236328125,
0.326416015625,
-0.60107421875,
0.91064453125,
-0.4501953125,
0.42529296875,
-0.59228515625,
-0.3173828125,
-1.25,
-0.31298828125,
-0.447021484375,
0.1029052734375,
-0.58642578125,
0.491455078125,
-0.1922607421875,
0.6474609375,
-0.2379150390625,
0.39697265625,
-0.263427734375,
-0.53759765625,
0.09075927734375,
0.31396484375,
-0.03143310546875,
0.90478515625,
0.673828125,
-0.2015380859375,
0.409423828125,
-0.3544921875,
-0.2412109375,
-0.149169921875,
0.5087890625,
0.223876953125,
-0.200927734375,
0.08062744140625,
-0.458740234375,
0.1495361328125,
-1.009765625,
0.103759765625,
-0.52783203125,
0.006145477294921875,
0.0108184814453125,
0.1741943359375,
0.47265625,
1.0478515625,
-0.10809326171875,
-0.047119140625,
0.15771484375,
0.270263671875,
0.50048828125,
0.26318359375,
-0.38330078125,
0.39306640625,
-0.023956298828125,
-0.6982421875,
0.1435546875,
0.046905517578125,
-0.01922607421875,
0.12841796875,
-0.11102294921875,
-0.52001953125,
-0.90087890625,
-0.001171112060546875,
0.00028634071350097656,
0.0518798828125,
0.505859375,
-0.476318359375,
-0.30419921875,
-0.201904296875,
-0.49267578125,
0.2410888671875,
-0.95068359375,
-0.61865234375,
0.6708984375,
0.0010194778442382812,
-0.490478515625,
-0.57080078125,
-0.31494140625,
0.04437255859375,
-0.018035888671875,
0.0086822509765625,
-0.360595703125,
1.0048828125,
0.1630859375,
0.6298828125,
0.05474853515625,
-0.051177978515625,
-0.362548828125,
0.7158203125,
-1.046875,
-0.66796875,
0.431884765625,
0.7353515625,
0.26708984375,
0.0799560546875,
-0.46240234375,
0.130615234375,
0.2216796875,
0.345947265625,
-0.432373046875,
-0.1490478515625,
-0.234130859375,
0.83154296875,
-0.8515625,
0.059234619140625,
0.1690673828125,
0.321044921875,
0.32177734375,
-0.3154296875,
-0.76123046875,
0.79443359375,
0.87255859375,
-0.40087890625,
0.326416015625,
0.39697265625,
0.431396484375,
0.362060546875,
-0.330078125,
-0.276611328125,
0.6181640625,
0.7998046875,
0.81640625,
-0.261962890625,
0.43359375,
0.66943359375,
-0.119384765625,
-0.036468505859375,
0.173095703125,
-0.10247802734375,
0.0240478515625,
-0.0718994140625,
0.189697265625,
-0.06256103515625,
0.1689453125,
-0.5673828125,
0.01242828369140625,
-0.372314453125,
-0.097412109375,
-0.64501953125,
-0.316162109375,
0.54052734375,
0.0635986328125,
0.0665283203125,
0.37255859375,
-0.98095703125,
0.27294921875,
0.7041015625,
-0.429443359375,
-0.30615234375,
0.71435546875,
0.6083984375,
0.418212890625,
0.60498046875,
0.0225372314453125,
0.69873046875,
-0.33984375,
0.4873046875,
0.2861328125,
0.0711669921875,
-0.66064453125,
-0.71044921875,
-1.05859375,
0.4482421875,
-0.5302734375,
-0.2457275390625,
0.91357421875,
-0.484130859375,
-0.2030029296875,
-0.318115234375,
0.365234375,
-0.2099609375,
0.062042236328125,
0.105712890625,
-0.246826171875,
-1.06640625,
0.666015625,
-0.098388671875,
0.384765625,
0.1295166015625,
1.03515625,
0.05340576171875,
1.47265625,
0.71240234375,
-0.018646240234375,
-0.400146484375,
0.6806640625,
-0.609375,
-0.37744140625,
-0.1571044921875,
-0.763671875,
-0.15478515625,
-0.85400390625,
-0.61767578125,
-0.40087890625,
0.97021484375,
0.1531982421875,
-1.1494140625,
-0.135009765625,
0.2491455078125,
-0.83056640625,
0.339599609375,
0.39794921875,
0.2022705078125,
-0.258056640625,
-0.240234375,
0.279296875,
-0.99365234375,
0.170166015625,
-0.5458984375,
0.183349609375,
-0.88232421875,
-0.5087890625,
-0.455810546875,
-0.72509765625,
-0.263427734375,
-0.30859375,
-0.09283447265625,
-0.55810546875,
0.57275390625,
0.49951171875,
0.46435546875,
0.09423828125,
-0.432861328125,
0.2042236328125,
0.54833984375,
1.05078125,
-0.2978515625,
0.90673828125,
0.4130859375,
-0.3701171875,
0.0027599334716796875,
-0.71484375,
0.382568359375,
-0.4599609375,
-0.130126953125,
-0.495361328125,
0.10162353515625,
-0.53125,
-1.3564453125,
-0.0677490234375,
0.39892578125,
0.33984375,
-0.463623046875,
-1.2109375,
-0.06390380859375,
-0.97119140625,
-0.2105712890625,
-0.63525390625,
0.274169921875,
-0.34375,
-0.0657958984375,
-0.0579833984375,
-0.92431640625,
4.4453125,
1.0732421875,
1.1982421875,
0.3876953125,
-0.158935546875,
0.79736328125,
0.642578125,
-0.802734375,
-0.1468505859375,
-0.387939453125,
0.5634765625,
-0.121337890625,
0.0029850006103515625,
0.7490234375,
0.19384765625,
0.70361328125,
-1.0048828125,
0.344970703125,
0.033935546875,
-0.76904296875,
-0.7861328125,
0.34228515625,
0.20654296875,
0.2164306640625,
-0.435546875,
0.5009765625,
0.58740234375,
-0.857421875,
-0.2208251953125,
-0.90869140625,
0.265869140625,
-0.457763671875,
1.2470703125,
-0.169677734375,
-0.1845703125,
0.55224609375,
-0.01326751708984375,
-0.256103515625,
0.09783935546875,
-0.0675048828125,
-0.15478515625,
-0.210205078125,
0.375732421875,
-0.728515625,
0.21337890625,
0.338134765625,
-0.3740234375,
0.120849609375,
0.4970703125,
-0.87109375,
1.2392578125,
-0.07598876953125,
0.328369140625,
-0.86181640625,
-0.61376953125,
-0.003570556640625,
0.23681640625,
-0.037689208984375,
-0.25927734375,
0.390625,
0.264404296875,
0.35595703125,
0.1951904296875,
0.144775390625,
-0.72021484375,
1.056640625,
-0.158203125,
0.274169921875,
-0.61962890625,
-0.488037109375,
-0.320556640625,
-0.67724609375,
-0.442138671875,
-0.31201171875,
0.8984375,
0.05731201171875,
-0.004062652587890625,
0.7236328125,
0.326171875,
-0.2452392578125,
0.0072021484375,
-0.4541015625,
-0.76318359375,
-0.361572265625,
0.416748046875,
1.3515625,
-0.4912109375,
-0.2095947265625,
-0.475830078125,
0.72509765625,
0.62890625,
0.73876953125,
-0.0345458984375,
-0.5537109375,
-0.241943359375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a mysterious language (codenamed "Secret") available in "Custom Invocation" tab. Figure out what this language is and write a program which prints its name. Note that the program must be written in this language.
Input
This program has only one test (your program doesn't have to read anything).
Output
Output the name of the mysterious language. Note that the name is case-sensitive and might contain digits and special characters.
Examples
Note
Some scientists disagree on what should be considered as a language and what should be considered as a dialect.
Tags: *special
Correct Solution:
```
n=input()
print("INTERCAL")
```
| 43,325
|
[
0.44775390625,
-0.13720703125,
-0.30224609375,
-0.1534423828125,
-0.1392822265625,
-0.4072265625,
-0.132080078125,
0.0950927734375,
-0.233154296875,
0.609375,
0.732421875,
0.1845703125,
0.16455078125,
-0.927734375,
-0.6630859375,
0.18115234375,
-0.45654296875,
-0.97265625,
-0.4033203125,
-0.269775390625,
-0.0740966796875,
0.0810546875,
-1.6298828125,
-0.357177734375,
-0.56396484375,
0.62109375,
0.3984375,
-0.301513671875,
0.347412109375,
1.0986328125,
-0.405517578125,
-0.2056884765625,
0.2744140625,
-1.080078125,
-0.30712890625,
-0.7802734375,
1.0693359375,
-1.029296875,
-0.413818359375,
-0.39697265625,
-0.3330078125,
0.0004031658172607422,
0.234130859375,
-0.70947265625,
-1.197265625,
0.2291259765625,
-0.6318359375,
-0.3564453125,
0.09576416015625,
-0.1846923828125,
0.70556640625,
0.1734619140625,
0.35400390625,
-0.06939697265625,
-0.208740234375,
-0.045013427734375,
-0.150146484375,
-0.1048583984375,
-0.56640625,
-0.09405517578125,
-0.0728759765625,
0.201171875,
0.06854248046875,
-0.9140625,
-0.09210205078125,
0.337158203125,
-0.0540771484375,
-0.1978759765625,
-0.09710693359375,
-0.392578125,
0.03570556640625,
0.5537109375,
-0.353271484375,
-0.388671875,
-0.6005859375,
-0.1832275390625,
0.21142578125,
0.2230224609375,
-0.5048828125,
0.2283935546875,
0.388916015625,
1.0087890625,
-0.0364990234375,
0.1461181640625,
-0.2169189453125,
-0.60888671875,
-0.04302978515625,
0.08935546875,
0.318115234375,
-0.1651611328125,
0.218994140625,
0.58642578125,
-0.857421875,
-0.163818359375,
0.85888671875,
0.272216796875,
-0.272705078125,
0.322265625,
0.194091796875,
0.369873046875,
1.0107421875,
1.11328125,
-0.77783203125,
0.8359375,
-0.1798095703125,
0.44091796875,
0.1312255859375,
0.5927734375,
0.2030029296875,
-0.238037109375,
-0.138427734375,
-0.75732421875,
0.433349609375,
-0.179931640625,
-0.0484619140625,
0.7861328125,
-0.10638427734375,
0.35595703125,
-1.08203125,
0.09661865234375,
0.255126953125,
-0.411865234375,
0.3203125,
-0.51953125,
0.0701904296875,
-0.06365966796875,
-0.475341796875,
1.0322265625,
-0.3564453125,
-0.05511474609375,
0.7412109375,
-0.190673828125,
-0.2388916015625,
0.6982421875,
-0.0229644775390625,
0.73095703125,
-0.077880859375,
0.67431640625,
0.375,
-0.86181640625,
0.400146484375,
-0.131591796875,
0.1590576171875,
1.3974609375,
0.6123046875,
0.0294189453125,
0.712890625,
0.35498046875,
-0.75244140625,
0.56982421875,
-0.71240234375,
0.580078125,
0.2259521484375,
0.3056640625,
-0.29052734375,
-0.04437255859375,
-0.443359375,
0.0762939453125,
0.1629638671875,
0.377685546875,
-0.04364013671875,
0.6376953125,
-0.083984375,
0.939453125,
0.10150146484375,
0.85888671875,
-0.65576171875,
-0.348388671875,
-0.119384765625,
-0.53662109375,
-0.07537841796875,
-0.1995849609375,
-0.297607421875,
0.96826171875,
0.59912109375,
0.70263671875,
1.220703125,
-0.0280303955078125,
0.261962890625,
0.43408203125,
-0.33984375,
0.2274169921875,
0.1072998046875,
1.0478515625,
0.52490234375,
0.254638671875,
0.33349609375,
-0.09222412109375,
-0.84619140625,
-0.49365234375,
-0.1031494140625,
1.0048828125,
-0.9404296875,
0.292724609375,
0.47119140625,
0.2117919921875,
-0.60400390625,
-0.2607421875,
0.4326171875,
-1.39453125,
-0.46826171875,
0.99072265625,
-0.201904296875,
0.7880859375,
-0.304931640625,
-0.1710205078125,
0.484375,
1.2021484375,
-0.08349609375,
-0.31005859375,
0.658203125,
-0.12200927734375,
-0.323974609375,
0.25537109375,
0.208251953125,
-0.424072265625,
-0.8671875,
0.6728515625,
-0.498291015625,
0.10302734375,
0.2337646484375,
0.58984375,
0.491455078125,
0.419921875,
-0.2296142578125,
-0.232177734375,
0.1600341796875,
1.3427734375,
0.196533203125,
0.366455078125,
0.167724609375,
0.95751953125,
0.00850677490234375,
1,
0.197021484375,
0.11767578125,
0.8017578125,
0.7294921875,
0.282470703125,
0.353271484375,
-0.09368896484375,
0.043853759765625,
0.3330078125,
0.4794921875,
0.089111328125,
0.59326171875,
0.019561767578125,
-0.1094970703125,
-0.6640625,
0.447998046875,
-0.10186767578125,
0.70849609375,
0.49755859375,
0.42626953125,
-0.446044921875,
-0.077880859375,
0.50537109375,
1.0146484375,
-0.611328125,
-0.427490234375,
0.472900390625,
-0.1805419921875,
0.420166015625,
0.144287109375,
-0.119384765625,
0.369873046875,
0.1912841796875,
-0.0289306640625,
-0.57666015625,
-0.58984375,
-0.830078125,
-0.62353515625,
-1.28515625,
-0.341064453125,
-0.78076171875,
0.06787109375,
0.439697265625,
-1.3623046875,
0.263427734375,
-0.342041015625,
-0.344482421875,
0.3720703125,
-0.5986328125,
0.59765625,
-0.070068359375,
1.0048828125,
-1.0615234375,
0.578125,
-0.076904296875,
1.037109375,
-0.79296875,
0.0187530517578125,
-0.497314453125,
-0.79931640625,
0.338623046875,
0.376708984375,
0.3828125,
-0.279296875,
-0.89501953125,
-0.76025390625,
-0.282470703125,
0.212158203125,
-0.37744140625,
0.515625,
-0.845703125,
0.60546875,
0.316162109375,
-0.5361328125,
0.66015625,
0.6318359375,
-0.58056640625,
0.69384765625,
0.1697998046875,
0.04498291015625,
-0.98486328125,
1.8095703125,
0.302490234375,
0.10394287109375,
-0.479248046875,
-0.226318359375,
-0.64697265625,
-0.1510009765625,
0.18701171875,
-0.421142578125,
-0.048919677734375,
0.71630859375,
0.316162109375,
-1.046875,
0.5029296875,
-1.1015625,
-0.55712890625,
-0.10400390625,
-0.5205078125,
1.140625,
0.74609375,
0.1854248046875,
-0.48681640625,
0.09124755859375,
-0.53857421875,
0.6259765625,
0.061065673828125,
-0.28564453125,
-0.177001953125,
0.94189453125,
-0.051025390625,
0.46142578125,
-0.349365234375,
-0.306884765625,
-0.380859375,
-0.6064453125,
0.328125,
0.161376953125,
0.174072265625,
0.1934814453125,
0.2196044921875,
0.95361328125,
-0.8408203125,
-0.744140625,
-0.1629638671875,
0.56103515625,
0.298828125,
0.7197265625,
0.438232421875,
-0.219970703125,
-0.52587890625,
-0.65869140625,
0.2327880859375,
0.1915283203125,
0.75830078125,
-0.515625,
0.412353515625,
0.25341796875,
-0.5595703125,
0.18994140625,
-0.90087890625,
-0.2108154296875,
0.80322265625,
0.00502777099609375,
1.11328125,
-0.52099609375,
0.265869140625,
-0.289794921875,
0.1409912109375,
0.8359375,
0.108154296875,
0.277099609375,
-0.32958984375,
-0.30078125,
-0.10369873046875,
-0.28955078125,
0.09771728515625,
-0.65283203125,
0.16015625,
-0.3056640625,
-0.378662109375,
-0.95947265625,
0.9931640625,
0.58349609375,
0.47216796875,
0.272705078125,
0.85205078125,
-0.12261962890625,
0.3173828125,
0.72412109375,
-0.315185546875,
0.198486328125,
-0.60205078125,
0.724609375,
-0.035186767578125,
-0.1851806640625,
-0.64208984375,
-0.2239990234375,
-0.0816650390625,
-0.1529541015625,
0.3291015625,
-0.291259765625,
-0.76904296875,
0.5361328125,
0.693359375,
0.5556640625,
-1.1015625,
0.1341552734375,
-0.3330078125,
0.71142578125,
0.5,
-0.98486328125,
0.34912109375,
-0.708984375,
0.61328125,
0.87109375,
-0.32666015625,
-0.64697265625,
-0.40283203125,
-0.701171875,
-0.264404296875,
0.2158203125,
0.84814453125,
-0.05169677734375,
0.53271484375,
-0.98291015625,
0.438232421875,
0.6318359375,
-0.1727294921875,
-0.05743408203125,
-0.12347412109375,
-0.0166778564453125,
0.0802001953125,
0.5849609375,
-0.218017578125,
-0.55712890625,
0.2269287109375,
-1.2705078125,
0.19140625,
-0.47314453125,
0.139404296875,
0.057403564453125,
0.2008056640625,
-0.23193359375,
0.5400390625,
-0.2705078125,
0.00569915771484375,
-0.12371826171875,
0.4931640625,
-1.2265625,
-0.76708984375,
0.701171875,
-0.325439453125,
0.03643798828125,
0.7041015625,
0.00473785400390625,
-0.2115478515625,
0.193115234375,
0.439208984375,
-0.466796875,
0.0645751953125,
-0.71923828125,
0.4580078125,
-0.261962890625,
-0.62548828125,
-0.4306640625,
-0.6962890625,
0.85009765625,
0.15869140625,
-0.86083984375,
-0.309814453125,
-1.251953125,
-0.127685546875,
0.0220947265625,
-0.4287109375,
0.4609375,
-0.1275634765625,
-0.05194091796875,
0.02655029296875,
-0.377685546875,
-0.369873046875,
-0.342529296875,
-0.61669921875,
-0.42626953125,
0.66064453125,
0.6201171875,
1.0341796875,
0.034027099609375,
-0.54345703125,
0.104248046875,
-0.1395263671875,
-0.0899658203125,
-0.7138671875,
0.3759765625,
-0.155029296875,
-0.275390625,
-0.333740234375,
0.261962890625,
-0.15087890625,
0.31103515625,
1.0205078125,
0.1474609375,
0.65234375,
0.080810546875,
-0.7490234375,
1.0751953125,
0.0275421142578125,
-1.11328125,
-0.5830078125,
0.35009765625,
-0.07421875,
0.6474609375,
0.333984375,
-0.80126953125,
-0.810546875,
-0.89453125,
0.50048828125,
-0.6171875,
0.0294036865234375,
-0.609375,
-0.271484375,
-0.4072265625,
0.806640625,
0.05889892578125,
-0.638671875,
-0.494384765625,
-0.97412109375,
0.36328125,
-0.333984375,
-0.385498046875,
-1.0927734375,
-0.64794921875,
-0.53857421875,
0.73681640625,
-0.0517578125,
0.1231689453125,
-0.4599609375,
-0.1697998046875,
0.37548828125,
-0.199462890625,
-0.62744140625,
-0.56689453125,
0.2496337890625,
0.37646484375,
-0.254638671875,
0.11669921875,
-0.437744140625,
0.44189453125,
-0.8935546875,
0.2127685546875,
-0.36669921875,
-0.329345703125,
-0.00995635986328125,
-0.57275390625,
1.251953125,
-0.417236328125,
-0.052642822265625,
-0.1357421875,
0.529296875,
0.50439453125,
-0.380615234375,
-0.49560546875,
-0.95703125,
-0.6376953125,
-1.076171875,
0.6416015625,
-0.703125,
-0.201904296875,
-0.1497802734375,
0.038238525390625,
0.86669921875,
-0.60400390625,
0.703125,
1.216796875,
0.343505859375,
-0.1788330078125,
-1.0986328125,
0.97265625,
0.7421875,
-0.8974609375,
0.1368408203125,
0.1856689453125,
-0.423583984375,
0.035308837890625,
-0.146484375,
-1.0859375,
-0.6708984375,
0.369873046875,
1.3486328125,
-0.1314697265625,
0.7861328125,
0.2386474609375,
-1.0107421875,
-0.69384765625,
0.94287109375,
-0.1357421875,
0.55517578125,
1.12109375,
0.461669921875,
-0.1864013671875,
-0.00008380413055419922,
0.2396240234375,
-0.467529296875,
-0.09332275390625,
0.93701171875,
0.0100555419921875,
-0.646484375,
0.115478515625,
0.99755859375,
-1.1884765625,
-0.8857421875,
-0.01100921630859375,
0.2020263671875,
-0.0150604248046875,
-0.4521484375,
0.09234619140625,
0.2293701171875,
-0.5341796875,
-0.108154296875,
0.4873046875,
-0.03619384765625,
0.2374267578125,
0.1871337890625,
0.347412109375,
-0.398193359375,
0.60302734375,
0.939453125,
-0.49365234375,
-0.393798828125,
-0.8349609375,
-0.1474609375,
-0.487548828125,
0.11346435546875,
0.7412109375,
-0.5400390625,
0.08551025390625,
0.6787109375,
-0.329345703125,
0.6298828125,
-0.278564453125,
-0.4638671875,
0.2890625,
-0.91748046875,
-0.65576171875,
-0.0055694580078125,
0.404052734375,
-0.052978515625,
0.1436767578125,
-0.365966796875,
0.435791015625,
0.4384765625,
0.33935546875,
0.01861572265625,
-1.0908203125,
-0.324951171875,
-0.9150390625,
-0.79296875,
-0.57421875,
-0.33642578125,
-0.359375,
-0.09906005859375,
0.0660400390625,
-0.568359375,
0.1800537109375,
0.227783203125,
-0.61669921875,
0.8330078125,
-0.443115234375,
0.369384765625,
-0.51806640625,
-0.5859375,
-0.4208984375,
-0.1900634765625,
-0.0533447265625,
0.0869140625,
-0.377685546875,
0.3466796875,
-0.130859375,
0.8857421875,
0.043212890625,
0.2152099609375,
-0.62255859375,
-0.316650390625,
0.205078125,
0.204345703125,
-0.38134765625,
0.8466796875,
0.332763671875,
-0.12158203125,
0.2144775390625,
-0.384765625,
-0.269287109375,
-0.2841796875,
0.6103515625,
0.381103515625,
-0.469970703125,
-0.299560546875,
-0.386962890625,
0.0474853515625,
-1.05859375,
0.43896484375,
-0.30078125,
-0.06732177734375,
0.44970703125,
-0.1485595703125,
0.392822265625,
0.97998046875,
-0.08648681640625,
0.494140625,
0.1466064453125,
0.25439453125,
0.48486328125,
0.03509521484375,
0.243408203125,
0.359130859375,
-0.1424560546875,
-0.1373291015625,
0.06939697265625,
0.41357421875,
-0.1177978515625,
0.192138671875,
0.047027587890625,
-0.69482421875,
-0.9853515625,
-0.40234375,
-0.270263671875,
0.41943359375,
0.72900390625,
-0.56494140625,
-0.1904296875,
0.23681640625,
-0.61376953125,
0.5263671875,
-0.98974609375,
-0.64892578125,
0.86181640625,
-0.0999755859375,
-0.595703125,
-0.44384765625,
-0.4150390625,
-0.0282135009765625,
0.1778564453125,
0.5048828125,
-0.2430419921875,
0.398681640625,
-0.294921875,
0.82568359375,
0.10662841796875,
-0.228759765625,
-0.3603515625,
0.1871337890625,
-0.64501953125,
-0.26171875,
0.2391357421875,
0.91552734375,
0.419677734375,
-0.03564453125,
-0.8701171875,
0.11181640625,
-0.40576171875,
0.114013671875,
-0.5537109375,
-0.1876220703125,
-0.56640625,
0.328857421875,
-0.4228515625,
0.50537109375,
-0.2098388671875,
0.56591796875,
0.265380859375,
-0.490234375,
-0.6875,
0.5380859375,
0.59228515625,
-0.370849609375,
0.360595703125,
0.18408203125,
0.242431640625,
0.023040771484375,
-0.011688232421875,
0.0298309326171875,
0.444091796875,
0.486328125,
0.98876953125,
-0.05218505859375,
0.30078125,
0.68359375,
0.1427001953125,
0.05438232421875,
0.137451171875,
0.216064453125,
0.359130859375,
0.08734130859375,
-0.114501953125,
-0.2266845703125,
-0.220947265625,
-0.491455078125,
0.2406005859375,
-0.43505859375,
-0.2802734375,
-0.84423828125,
-0.57177734375,
0.484375,
-0.1663818359375,
-0.08984375,
0.03436279296875,
-0.61279296875,
0.384033203125,
0.77490234375,
-0.108154296875,
-0.08697509765625,
0.70751953125,
0.58984375,
0.43212890625,
0.55908203125,
0.3544921875,
0.296142578125,
-0.60009765625,
0.53369140625,
-0.1527099609375,
-0.1141357421875,
-0.339599609375,
-0.336181640625,
-0.6201171875,
0.281494140625,
-0.08880615234375,
-0.311279296875,
0.302001953125,
-0.465087890625,
0.1612548828125,
-0.35693359375,
0.302490234375,
-0.93505859375,
0.2066650390625,
0.243408203125,
-0.33740234375,
-0.76220703125,
0.8037109375,
-0.1383056640625,
0.345947265625,
0.370849609375,
0.8896484375,
-0.046875,
1.4560546875,
0.5537109375,
0.138916015625,
-0.3525390625,
0.448974609375,
-0.1646728515625,
-0.708984375,
-0.1766357421875,
-0.572265625,
0.00408172607421875,
-0.63330078125,
-0.50439453125,
0.1256103515625,
0.76611328125,
-0.1080322265625,
-0.9375,
0.1678466796875,
0.471435546875,
-0.779296875,
0.78271484375,
0.56103515625,
0.7314453125,
-0.016510009765625,
0.238525390625,
-0.1212158203125,
-0.76953125,
-0.1373291015625,
-0.83544921875,
0.5380859375,
-0.69482421875,
-0.84619140625,
-0.31591796875,
-0.98486328125,
-0.1693115234375,
-0.056549072265625,
-0.356689453125,
-0.81689453125,
0.72412109375,
0.480712890625,
0.492431640625,
0.2158203125,
-0.12054443359375,
-0.148193359375,
0.90576171875,
0.748046875,
0.1715087890625,
0.947265625,
0.54931640625,
-1.0576171875,
0.1156005859375,
-1.037109375,
0.47314453125,
0.09765625,
-0.1051025390625,
-0.399169921875,
0.2568359375,
-0.75341796875,
-1.3037109375,
0.36669921875,
1.1025390625,
0.419189453125,
-0.515625,
-1.2685546875,
-0.182861328125,
-0.8056640625,
-0.297607421875,
-0.34375,
0.251708984375,
-0.452392578125,
-0.0142364501953125,
-0.1632080078125,
-1.0537109375,
4.3046875,
1.09765625,
0.93603515625,
0.5458984375,
0.452880859375,
0.74365234375,
0.4560546875,
-0.5400390625,
-0.14794921875,
-0.57373046875,
0.630859375,
-0.5615234375,
-0.1337890625,
0.93896484375,
0.328857421875,
0.432373046875,
-0.3515625,
0.480712890625,
-0.3623046875,
-0.89501953125,
-0.8935546875,
0.279541015625,
0.0333251953125,
0.68408203125,
-0.05413818359375,
0.322998046875,
0.438720703125,
-0.82861328125,
-0.005710601806640625,
-0.509765625,
-0.16943359375,
-0.5908203125,
0.87353515625,
-0.1533203125,
-0.2032470703125,
0.52099609375,
-0.28466796875,
-0.736328125,
0.07666015625,
0.41259765625,
-0.19775390625,
0.08172607421875,
1.140625,
-0.447509765625,
-0.10748291015625,
0.86572265625,
-0.8330078125,
0.387451171875,
0.5869140625,
-0.8212890625,
1.25,
-0.388916015625,
0.5703125,
-0.5986328125,
-0.6494140625,
0.302001953125,
0.0509033203125,
-0.294677734375,
-0.46435546875,
0.8095703125,
0.29541015625,
0.43603515625,
-0.1201171875,
0.1812744140625,
-0.98193359375,
1.1796875,
-0.2286376953125,
0.59814453125,
-0.68798828125,
-0.34228515625,
-0.2322998046875,
-0.318115234375,
-0.315185546875,
-0.76708984375,
1.0234375,
0.10943603515625,
-0.447509765625,
0.276123046875,
0.1019287109375,
-1.0390625,
0.246337890625,
-0.208740234375,
-0.63232421875,
-0.3232421875,
0.5302734375,
0.7578125,
-0.666015625,
-0.250732421875,
-0.2447509765625,
0.74462890625,
0.48095703125,
0.369384765625,
0.345703125,
-0.72314453125,
-0.00452423095703125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a mysterious language (codenamed "Secret") available in "Custom Invocation" tab. Figure out what this language is and write a program which prints its name. Note that the program must be written in this language.
Input
This program has only one test (your program doesn't have to read anything).
Output
Output the name of the mysterious language. Note that the name is case-sensitive and might contain digits and special characters.
Examples
Note
Some scientists disagree on what should be considered as a language and what should be considered as a dialect.
Tags: *special
Correct Solution:
```
print('INTERCAL')
```
| 43,326
|
[
0.437744140625,
-0.1678466796875,
-0.292724609375,
-0.09674072265625,
-0.141845703125,
-0.400634765625,
-0.1484375,
0.08538818359375,
-0.2117919921875,
0.5966796875,
0.7509765625,
0.198486328125,
0.1890869140625,
-0.900390625,
-0.69287109375,
0.1644287109375,
-0.421142578125,
-0.9423828125,
-0.420654296875,
-0.275146484375,
-0.1082763671875,
0.0836181640625,
-1.599609375,
-0.338134765625,
-0.59033203125,
0.62939453125,
0.39306640625,
-0.263671875,
0.362548828125,
1.1123046875,
-0.452880859375,
-0.1920166015625,
0.2476806640625,
-1.0830078125,
-0.3173828125,
-0.77880859375,
1.09375,
-1.0380859375,
-0.369873046875,
-0.394287109375,
-0.31396484375,
0.020233154296875,
0.268310546875,
-0.72900390625,
-1.2080078125,
0.2291259765625,
-0.64501953125,
-0.33447265625,
0.07061767578125,
-0.26025390625,
0.68896484375,
0.1878662109375,
0.3173828125,
-0.06243896484375,
-0.18701171875,
-0.0220489501953125,
-0.172119140625,
-0.149169921875,
-0.556640625,
-0.08795166015625,
-0.0943603515625,
0.1907958984375,
0.06390380859375,
-0.89501953125,
-0.1024169921875,
0.352783203125,
-0.0008215904235839844,
-0.2056884765625,
-0.056243896484375,
-0.36962890625,
0.0859375,
0.556640625,
-0.2880859375,
-0.385498046875,
-0.62353515625,
-0.240478515625,
0.1839599609375,
0.2353515625,
-0.5361328125,
0.2425537109375,
0.36962890625,
0.9736328125,
-0.0283355712890625,
0.1348876953125,
-0.2236328125,
-0.60009765625,
-0.050628662109375,
0.11865234375,
0.3291015625,
-0.1646728515625,
0.230712890625,
0.5830078125,
-0.81640625,
-0.203369140625,
0.88037109375,
0.240234375,
-0.27294921875,
0.2489013671875,
0.1466064453125,
0.3359375,
1.01171875,
1.09765625,
-0.73779296875,
0.83740234375,
-0.224609375,
0.437744140625,
0.1595458984375,
0.521484375,
0.182861328125,
-0.2086181640625,
-0.1541748046875,
-0.771484375,
0.41650390625,
-0.161376953125,
-0.050506591796875,
0.75927734375,
-0.08355712890625,
0.3203125,
-1.0771484375,
0.08587646484375,
0.299072265625,
-0.3740234375,
0.32861328125,
-0.5087890625,
0.0255889892578125,
0.0024166107177734375,
-0.47607421875,
1.0380859375,
-0.403076171875,
-0.0246429443359375,
0.70068359375,
-0.1982421875,
-0.2471923828125,
0.7021484375,
-0.03863525390625,
0.751953125,
-0.056549072265625,
0.7177734375,
0.377685546875,
-0.85498046875,
0.4169921875,
-0.1697998046875,
0.1712646484375,
1.3515625,
0.5986328125,
-0.002277374267578125,
0.70361328125,
0.361572265625,
-0.76806640625,
0.5673828125,
-0.66015625,
0.60546875,
0.2353515625,
0.313232421875,
-0.317626953125,
-0.034393310546875,
-0.443115234375,
0.11956787109375,
0.1925048828125,
0.326171875,
-0.05126953125,
0.64208984375,
-0.06463623046875,
0.9755859375,
0.11749267578125,
0.84423828125,
-0.68603515625,
-0.301513671875,
-0.10772705078125,
-0.492919921875,
-0.07891845703125,
-0.1837158203125,
-0.31689453125,
0.97802734375,
0.5810546875,
0.68994140625,
1.2265625,
-0.020751953125,
0.2783203125,
0.407470703125,
-0.33251953125,
0.2059326171875,
0.104736328125,
1.0830078125,
0.48876953125,
0.260498046875,
0.32763671875,
-0.046875,
-0.81298828125,
-0.482666015625,
-0.083984375,
1.0361328125,
-0.984375,
0.283935546875,
0.50830078125,
0.1806640625,
-0.60302734375,
-0.213134765625,
0.4521484375,
-1.40234375,
-0.480712890625,
1,
-0.1583251953125,
0.7802734375,
-0.30908203125,
-0.220703125,
0.46630859375,
1.228515625,
-0.06982421875,
-0.307373046875,
0.6767578125,
-0.13818359375,
-0.330078125,
0.263427734375,
0.2132568359375,
-0.411865234375,
-0.81494140625,
0.68212890625,
-0.53125,
0.10223388671875,
0.2337646484375,
0.60302734375,
0.490966796875,
0.40771484375,
-0.2435302734375,
-0.2215576171875,
0.1287841796875,
1.328125,
0.1785888671875,
0.331298828125,
0.1561279296875,
0.99658203125,
0.059356689453125,
0.97021484375,
0.1573486328125,
0.118896484375,
0.8173828125,
0.68408203125,
0.24169921875,
0.3681640625,
-0.0780029296875,
0.06463623046875,
0.3388671875,
0.47021484375,
0.1473388671875,
0.5654296875,
-0.0161285400390625,
-0.10736083984375,
-0.62060546875,
0.452392578125,
-0.10333251953125,
0.6669921875,
0.495361328125,
0.40673828125,
-0.47900390625,
-0.06201171875,
0.486083984375,
1.01171875,
-0.61279296875,
-0.398193359375,
0.44482421875,
-0.154052734375,
0.440185546875,
0.15576171875,
-0.10736083984375,
0.374755859375,
0.2076416015625,
-0.019927978515625,
-0.537109375,
-0.63720703125,
-0.8076171875,
-0.6123046875,
-1.2919921875,
-0.38623046875,
-0.7568359375,
0.1500244140625,
0.45556640625,
-1.3447265625,
0.265380859375,
-0.349853515625,
-0.308837890625,
0.415771484375,
-0.57080078125,
0.57421875,
-0.033050537109375,
0.9736328125,
-1.0205078125,
0.56689453125,
-0.03759765625,
1.06640625,
-0.8037109375,
-0.010040283203125,
-0.499755859375,
-0.81494140625,
0.3349609375,
0.384521484375,
0.401611328125,
-0.320068359375,
-0.90478515625,
-0.7421875,
-0.275390625,
0.205322265625,
-0.371826171875,
0.48046875,
-0.8955078125,
0.6142578125,
0.310791015625,
-0.54931640625,
0.68115234375,
0.68310546875,
-0.5625,
0.6669921875,
0.155029296875,
0.058746337890625,
-0.96337890625,
1.8330078125,
0.296630859375,
0.1171875,
-0.45166015625,
-0.2333984375,
-0.6279296875,
-0.1732177734375,
0.1978759765625,
-0.460693359375,
-0.0660400390625,
0.6787109375,
0.279541015625,
-1.0322265625,
0.4990234375,
-1.0927734375,
-0.55615234375,
-0.106201171875,
-0.53369140625,
1.0458984375,
0.736328125,
0.17626953125,
-0.4853515625,
0.10614013671875,
-0.51953125,
0.650390625,
0.0399169921875,
-0.2303466796875,
-0.1593017578125,
0.9501953125,
-0.033477783203125,
0.498046875,
-0.3642578125,
-0.3251953125,
-0.388916015625,
-0.63134765625,
0.303955078125,
0.16943359375,
0.11199951171875,
0.1783447265625,
0.240234375,
0.95263671875,
-0.86962890625,
-0.7822265625,
-0.1700439453125,
0.55615234375,
0.256103515625,
0.71044921875,
0.44873046875,
-0.2159423828125,
-0.54052734375,
-0.68798828125,
0.2296142578125,
0.2083740234375,
0.771484375,
-0.46728515625,
0.41455078125,
0.217041015625,
-0.59814453125,
0.2025146484375,
-0.8974609375,
-0.2369384765625,
0.81298828125,
0.032318115234375,
1.126953125,
-0.495361328125,
0.279541015625,
-0.286376953125,
0.1309814453125,
0.8115234375,
0.1337890625,
0.284423828125,
-0.322265625,
-0.28271484375,
-0.130859375,
-0.329345703125,
0.1021728515625,
-0.580078125,
0.2159423828125,
-0.301513671875,
-0.38671875,
-0.994140625,
0.9541015625,
0.53515625,
0.441162109375,
0.258544921875,
0.86083984375,
-0.09765625,
0.283935546875,
0.7216796875,
-0.33056640625,
0.1964111328125,
-0.578125,
0.7275390625,
-0.09027099609375,
-0.1993408203125,
-0.66015625,
-0.273681640625,
-0.07281494140625,
-0.12548828125,
0.302978515625,
-0.271728515625,
-0.796875,
0.5244140625,
0.68603515625,
0.61083984375,
-1.12890625,
0.1387939453125,
-0.321044921875,
0.6513671875,
0.49755859375,
-0.93994140625,
0.35595703125,
-0.681640625,
0.611328125,
0.86181640625,
-0.3115234375,
-0.66943359375,
-0.426513671875,
-0.728515625,
-0.2841796875,
0.2137451171875,
0.84765625,
-0.058990478515625,
0.5166015625,
-0.98046875,
0.3857421875,
0.66796875,
-0.1512451171875,
-0.0654296875,
-0.16845703125,
0.01995849609375,
0.078369140625,
0.58935546875,
-0.2088623046875,
-0.55126953125,
0.2464599609375,
-1.2763671875,
0.139892578125,
-0.50439453125,
0.09698486328125,
0.0858154296875,
0.1898193359375,
-0.26513671875,
0.505859375,
-0.265869140625,
0.0310516357421875,
-0.0970458984375,
0.490966796875,
-1.1962890625,
-0.77001953125,
0.70947265625,
-0.28662109375,
0.0256195068359375,
0.6806640625,
-0.006320953369140625,
-0.232177734375,
0.2037353515625,
0.41064453125,
-0.4453125,
0.050872802734375,
-0.712890625,
0.45654296875,
-0.27734375,
-0.60693359375,
-0.45068359375,
-0.72802734375,
0.85888671875,
0.130615234375,
-0.81982421875,
-0.333251953125,
-1.23046875,
-0.10906982421875,
0.0034770965576171875,
-0.423828125,
0.462158203125,
-0.119384765625,
-0.04400634765625,
0.023590087890625,
-0.35302734375,
-0.380615234375,
-0.357421875,
-0.62890625,
-0.396484375,
0.62353515625,
0.6640625,
0.9736328125,
0.0246124267578125,
-0.52880859375,
0.1368408203125,
-0.1146240234375,
-0.103759765625,
-0.67578125,
0.392578125,
-0.1719970703125,
-0.227783203125,
-0.3466796875,
0.273193359375,
-0.11859130859375,
0.26123046875,
1.0224609375,
0.1619873046875,
0.62841796875,
0.09521484375,
-0.74609375,
1.0595703125,
0.006793975830078125,
-1.12109375,
-0.61962890625,
0.37255859375,
-0.055755615234375,
0.630859375,
0.328369140625,
-0.79931640625,
-0.8154296875,
-0.8525390625,
0.4365234375,
-0.62744140625,
0.0653076171875,
-0.60693359375,
-0.2431640625,
-0.390869140625,
0.8017578125,
0.12744140625,
-0.6396484375,
-0.481201171875,
-0.9775390625,
0.370849609375,
-0.33935546875,
-0.3701171875,
-1.1240234375,
-0.63134765625,
-0.5458984375,
0.7509765625,
-0.0189056396484375,
0.15625,
-0.46728515625,
-0.1585693359375,
0.331787109375,
-0.238525390625,
-0.58056640625,
-0.52880859375,
0.222900390625,
0.371826171875,
-0.284912109375,
0.08868408203125,
-0.455810546875,
0.4541015625,
-0.8896484375,
0.1912841796875,
-0.34765625,
-0.302490234375,
0.02978515625,
-0.57470703125,
1.259765625,
-0.399658203125,
-0.07281494140625,
-0.17333984375,
0.495849609375,
0.445556640625,
-0.3564453125,
-0.5224609375,
-0.96923828125,
-0.63037109375,
-1.060546875,
0.63818359375,
-0.6943359375,
-0.2220458984375,
-0.1431884765625,
0.04510498046875,
0.8544921875,
-0.57958984375,
0.7255859375,
1.21875,
0.337646484375,
-0.2398681640625,
-1.0771484375,
1.0068359375,
0.7529296875,
-0.8896484375,
0.1348876953125,
0.2015380859375,
-0.412109375,
0.018829345703125,
-0.083251953125,
-1.0732421875,
-0.63330078125,
0.36376953125,
1.3330078125,
-0.10821533203125,
0.82568359375,
0.25537109375,
-0.99267578125,
-0.65234375,
0.94677734375,
-0.12359619140625,
0.5712890625,
1.068359375,
0.421875,
-0.1920166015625,
-0.0034236907958984375,
0.273681640625,
-0.47314453125,
-0.10491943359375,
0.9345703125,
0.014373779296875,
-0.63427734375,
0.143798828125,
1.01171875,
-1.125,
-0.865234375,
0.01751708984375,
0.214599609375,
-0.05072021484375,
-0.47314453125,
0.10162353515625,
0.2337646484375,
-0.52734375,
-0.1182861328125,
0.509765625,
-0.0286865234375,
0.255859375,
0.1793212890625,
0.32666015625,
-0.365478515625,
0.51123046875,
0.908203125,
-0.51416015625,
-0.408447265625,
-0.81787109375,
-0.12005615234375,
-0.487548828125,
0.0882568359375,
0.7548828125,
-0.54052734375,
0.031463623046875,
0.6181640625,
-0.364501953125,
0.61279296875,
-0.25439453125,
-0.447509765625,
0.30419921875,
-0.916015625,
-0.6748046875,
-0.07171630859375,
0.3798828125,
-0.03460693359375,
0.1085205078125,
-0.334228515625,
0.43603515625,
0.413818359375,
0.315185546875,
0.004486083984375,
-1.09765625,
-0.326171875,
-0.91162109375,
-0.7783203125,
-0.56982421875,
-0.3515625,
-0.383056640625,
-0.101318359375,
0.053009033203125,
-0.615234375,
0.156005859375,
0.256103515625,
-0.591796875,
0.88427734375,
-0.432861328125,
0.372314453125,
-0.5263671875,
-0.63916015625,
-0.43701171875,
-0.1629638671875,
-0.02978515625,
0.1309814453125,
-0.40087890625,
0.343994140625,
-0.0899658203125,
0.88818359375,
0.048370361328125,
0.187744140625,
-0.63525390625,
-0.356201171875,
0.193603515625,
0.193603515625,
-0.380615234375,
0.81591796875,
0.3134765625,
-0.1507568359375,
0.2392578125,
-0.454833984375,
-0.2568359375,
-0.300537109375,
0.5859375,
0.376953125,
-0.467041015625,
-0.2578125,
-0.34912109375,
0.052886962890625,
-1.0595703125,
0.46435546875,
-0.322509765625,
-0.0784912109375,
0.4375,
-0.137939453125,
0.345703125,
0.9345703125,
-0.07080078125,
0.52587890625,
0.134521484375,
0.26025390625,
0.47705078125,
0.048828125,
0.2393798828125,
0.33154296875,
-0.1531982421875,
-0.1400146484375,
0.11590576171875,
0.436767578125,
-0.09857177734375,
0.1640625,
0.05328369140625,
-0.72216796875,
-1.0068359375,
-0.470458984375,
-0.25439453125,
0.395263671875,
0.71826171875,
-0.52001953125,
-0.247802734375,
0.2333984375,
-0.578125,
0.51171875,
-1.0087890625,
-0.64208984375,
0.82421875,
-0.0859375,
-0.58447265625,
-0.407958984375,
-0.432861328125,
-0.0367431640625,
0.1424560546875,
0.49560546875,
-0.26513671875,
0.429931640625,
-0.286865234375,
0.78076171875,
0.1275634765625,
-0.218017578125,
-0.354248046875,
0.197021484375,
-0.6416015625,
-0.260986328125,
0.29541015625,
0.93603515625,
0.3701171875,
-0.01739501953125,
-0.86279296875,
0.099365234375,
-0.419677734375,
0.1097412109375,
-0.54052734375,
-0.2088623046875,
-0.60400390625,
0.3427734375,
-0.40771484375,
0.56298828125,
-0.209228515625,
0.5849609375,
0.298828125,
-0.51904296875,
-0.65673828125,
0.59375,
0.56787109375,
-0.369384765625,
0.34716796875,
0.149658203125,
0.2076416015625,
0.0027179718017578125,
-0.0127410888671875,
-0.0243682861328125,
0.43896484375,
0.47314453125,
0.9931640625,
-0.047943115234375,
0.263671875,
0.69140625,
0.156005859375,
0.07147216796875,
0.1324462890625,
0.2213134765625,
0.383544921875,
0.1097412109375,
-0.1038818359375,
-0.2464599609375,
-0.1815185546875,
-0.5048828125,
0.25634765625,
-0.460205078125,
-0.265869140625,
-0.8125,
-0.54443359375,
0.45458984375,
-0.1536865234375,
-0.08135986328125,
0.040618896484375,
-0.69677734375,
0.3271484375,
0.76611328125,
-0.08892822265625,
-0.102783203125,
0.69140625,
0.62744140625,
0.466552734375,
0.56689453125,
0.35107421875,
0.284912109375,
-0.62548828125,
0.50634765625,
-0.1416015625,
-0.1197509765625,
-0.353759765625,
-0.348876953125,
-0.56982421875,
0.330322265625,
-0.1175537109375,
-0.322021484375,
0.31640625,
-0.4716796875,
0.1138916015625,
-0.370361328125,
0.296142578125,
-0.9501953125,
0.214111328125,
0.2646484375,
-0.2802734375,
-0.79833984375,
0.76220703125,
-0.188232421875,
0.3310546875,
0.429931640625,
0.90380859375,
-0.035400390625,
1.390625,
0.5439453125,
0.162353515625,
-0.35693359375,
0.45751953125,
-0.178466796875,
-0.6943359375,
-0.2149658203125,
-0.54833984375,
-0.0070037841796875,
-0.62109375,
-0.5322265625,
0.1480712890625,
0.74951171875,
-0.07940673828125,
-0.923828125,
0.163330078125,
0.4921875,
-0.79736328125,
0.79833984375,
0.58837890625,
0.6865234375,
-0.00449371337890625,
0.2396240234375,
-0.1614990234375,
-0.7080078125,
-0.1103515625,
-0.81005859375,
0.5478515625,
-0.685546875,
-0.8212890625,
-0.295166015625,
-0.95703125,
-0.202392578125,
-0.039581298828125,
-0.355224609375,
-0.859375,
0.7255859375,
0.462158203125,
0.46484375,
0.1815185546875,
-0.11273193359375,
-0.1519775390625,
0.93603515625,
0.8115234375,
0.2091064453125,
0.91357421875,
0.580078125,
-1.068359375,
0.1129150390625,
-1.0302734375,
0.4970703125,
0.11590576171875,
-0.09246826171875,
-0.399658203125,
0.203369140625,
-0.6943359375,
-1.2998046875,
0.347412109375,
1.1083984375,
0.4287109375,
-0.50048828125,
-1.27734375,
-0.1820068359375,
-0.79833984375,
-0.28125,
-0.330322265625,
0.254638671875,
-0.4306640625,
0.0311737060546875,
-0.1546630859375,
-1.0732421875,
4.328125,
1.1064453125,
0.9345703125,
0.5703125,
0.483642578125,
0.70556640625,
0.439697265625,
-0.55078125,
-0.1412353515625,
-0.55908203125,
0.6279296875,
-0.5703125,
-0.12109375,
0.9111328125,
0.3134765625,
0.439453125,
-0.35791015625,
0.51953125,
-0.344482421875,
-0.875,
-0.87353515625,
0.279052734375,
0.054779052734375,
0.748046875,
-0.056610107421875,
0.3154296875,
0.4833984375,
-0.85595703125,
-0.00044226646423339844,
-0.48095703125,
-0.16796875,
-0.61474609375,
0.8955078125,
-0.1236572265625,
-0.1807861328125,
0.55712890625,
-0.311767578125,
-0.7216796875,
0.07647705078125,
0.416748046875,
-0.22509765625,
0.038604736328125,
1.162109375,
-0.45849609375,
-0.11846923828125,
0.85302734375,
-0.83056640625,
0.3701171875,
0.56298828125,
-0.810546875,
1.2529296875,
-0.380126953125,
0.5869140625,
-0.6162109375,
-0.6484375,
0.262451171875,
0.0509033203125,
-0.326171875,
-0.460693359375,
0.7958984375,
0.328125,
0.4296875,
-0.1043701171875,
0.1953125,
-1.0029296875,
1.126953125,
-0.2353515625,
0.62939453125,
-0.67724609375,
-0.3564453125,
-0.213134765625,
-0.307861328125,
-0.298583984375,
-0.77734375,
0.98388671875,
0.072265625,
-0.4482421875,
0.293701171875,
0.09918212890625,
-1.0146484375,
0.272216796875,
-0.274658203125,
-0.64794921875,
-0.324462890625,
0.56494140625,
0.7666015625,
-0.66357421875,
-0.2435302734375,
-0.22412109375,
0.76171875,
0.453857421875,
0.39404296875,
0.3232421875,
-0.72705078125,
0.02752685546875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a mysterious language (codenamed "Secret") available in "Custom Invocation" tab. Figure out what this language is and write a program which prints its name. Note that the program must be written in this language.
Input
This program has only one test (your program doesn't have to read anything).
Output
Output the name of the mysterious language. Note that the name is case-sensitive and might contain digits and special characters.
Examples
Note
Some scientists disagree on what should be considered as a language and what should be considered as a dialect.
Tags: *special
Correct Solution:
```
# Flamire senpai AK IOI
print('INTERCAL')
```
| 43,327
|
[
0.5126953125,
-0.12420654296875,
-0.36962890625,
-0.03497314453125,
-0.095703125,
-0.474853515625,
-0.1317138671875,
0.1767578125,
-0.2027587890625,
0.58984375,
0.6240234375,
0.257080078125,
0.2037353515625,
-0.8095703125,
-0.70556640625,
0.12261962890625,
-0.413330078125,
-0.96240234375,
-0.3857421875,
-0.2237548828125,
-0.03369140625,
0.1353759765625,
-1.576171875,
-0.38720703125,
-0.5654296875,
0.6201171875,
0.419677734375,
-0.1856689453125,
0.384033203125,
1.0498046875,
-0.3876953125,
-0.1732177734375,
0.23388671875,
-1.1494140625,
-0.25390625,
-0.78564453125,
1.06640625,
-0.9697265625,
-0.4208984375,
-0.49755859375,
-0.30908203125,
0.0216827392578125,
0.334716796875,
-0.68505859375,
-1.2978515625,
0.2325439453125,
-0.6845703125,
-0.385498046875,
-0.03326416015625,
-0.2486572265625,
0.69091796875,
0.186279296875,
0.294921875,
0.027862548828125,
-0.1895751953125,
-0.1192626953125,
-0.2027587890625,
-0.174560546875,
-0.51416015625,
-0.08978271484375,
-0.093505859375,
0.1920166015625,
0.10076904296875,
-0.84765625,
-0.1900634765625,
0.3984375,
0.0010166168212890625,
-0.253662109375,
-0.11505126953125,
-0.337158203125,
0.0672607421875,
0.65673828125,
-0.28271484375,
-0.401611328125,
-0.658203125,
-0.2420654296875,
0.1856689453125,
0.25244140625,
-0.4990234375,
0.31640625,
0.2861328125,
0.9443359375,
0.03875732421875,
0.048126220703125,
-0.1700439453125,
-0.673828125,
-0.09423828125,
0.07427978515625,
0.24462890625,
-0.1751708984375,
0.278564453125,
0.60986328125,
-0.83935546875,
-0.2274169921875,
0.88427734375,
0.318359375,
-0.2139892578125,
0.2880859375,
0.19970703125,
0.29833984375,
0.9794921875,
1.0654296875,
-0.68798828125,
0.89990234375,
-0.2255859375,
0.357421875,
0.12493896484375,
0.476806640625,
0.133056640625,
-0.248046875,
-0.0831298828125,
-0.80908203125,
0.533203125,
-0.062255859375,
-0.052703857421875,
0.7802734375,
-0.0992431640625,
0.303466796875,
-1.1083984375,
0.01480865478515625,
0.269287109375,
-0.39501953125,
0.33447265625,
-0.5283203125,
0.057220458984375,
-0.049285888671875,
-0.447265625,
1.0615234375,
-0.435791015625,
0.09429931640625,
0.74462890625,
-0.1572265625,
-0.1822509765625,
0.72119140625,
-0.07659912109375,
0.76904296875,
-0.110107421875,
0.6796875,
0.358642578125,
-0.837890625,
0.48828125,
-0.20947265625,
0.12158203125,
1.373046875,
0.58935546875,
-0.047943115234375,
0.58544921875,
0.379150390625,
-0.80712890625,
0.53271484375,
-0.654296875,
0.55810546875,
0.1502685546875,
0.35009765625,
-0.262939453125,
-0.037750244140625,
-0.39208984375,
0.18701171875,
0.2412109375,
0.280517578125,
-0.04498291015625,
0.7041015625,
-0.1068115234375,
0.9443359375,
0.131103515625,
0.87158203125,
-0.6552734375,
-0.298828125,
0.0012025833129882812,
-0.52587890625,
0.003574371337890625,
-0.1500244140625,
-0.32958984375,
1.001953125,
0.59716796875,
0.73291015625,
1.310546875,
-0.0802001953125,
0.28955078125,
0.36181640625,
-0.29541015625,
0.2208251953125,
0.09149169921875,
1.0439453125,
0.423095703125,
0.285888671875,
0.28662109375,
-0.0259246826171875,
-0.751953125,
-0.438232421875,
-0.050689697265625,
0.9970703125,
-0.92431640625,
0.295654296875,
0.505859375,
0.302978515625,
-0.55615234375,
-0.203857421875,
0.444091796875,
-1.4892578125,
-0.45751953125,
0.935546875,
-0.172119140625,
0.71533203125,
-0.2076416015625,
-0.331298828125,
0.474853515625,
1.24609375,
-0.06951904296875,
-0.236083984375,
0.6328125,
-0.1663818359375,
-0.33154296875,
0.23193359375,
0.189208984375,
-0.416259765625,
-0.794921875,
0.73486328125,
-0.61083984375,
0.1982421875,
0.288818359375,
0.65625,
0.5068359375,
0.426025390625,
-0.213623046875,
-0.296630859375,
0.10125732421875,
1.28515625,
0.201416015625,
0.2861328125,
0.1942138671875,
1.0498046875,
0.12548828125,
1.02734375,
0.1546630859375,
0.074951171875,
0.76318359375,
0.60302734375,
0.2344970703125,
0.336181640625,
-0.097412109375,
0.09185791015625,
0.3037109375,
0.56005859375,
0.10870361328125,
0.57275390625,
-0.075927734375,
-0.062744140625,
-0.66552734375,
0.339599609375,
-0.16796875,
0.666015625,
0.513671875,
0.466064453125,
-0.48486328125,
-0.1175537109375,
0.433349609375,
1.0771484375,
-0.6494140625,
-0.4052734375,
0.470947265625,
-0.18701171875,
0.3857421875,
0.027740478515625,
-0.12939453125,
0.45166015625,
0.2158203125,
0.057373046875,
-0.578125,
-0.6171875,
-0.86865234375,
-0.5390625,
-1.208984375,
-0.3828125,
-0.70849609375,
0.1590576171875,
0.55859375,
-1.37890625,
0.230712890625,
-0.3525390625,
-0.29833984375,
0.50732421875,
-0.5615234375,
0.599609375,
-0.10052490234375,
1.0576171875,
-0.98095703125,
0.486572265625,
-0.061431884765625,
1.185546875,
-0.82373046875,
-0.056640625,
-0.54443359375,
-0.71630859375,
0.26953125,
0.4140625,
0.358154296875,
-0.325927734375,
-0.83544921875,
-0.76611328125,
-0.2076416015625,
0.1690673828125,
-0.37548828125,
0.46435546875,
-0.92138671875,
0.62255859375,
0.349853515625,
-0.49755859375,
0.71533203125,
0.70654296875,
-0.583984375,
0.72705078125,
0.105224609375,
0.0618896484375,
-0.900390625,
1.849609375,
0.263427734375,
0.1422119140625,
-0.5068359375,
-0.283935546875,
-0.6396484375,
-0.1536865234375,
0.17529296875,
-0.470703125,
-0.060882568359375,
0.6357421875,
0.2408447265625,
-1.0712890625,
0.5283203125,
-1.1826171875,
-0.57568359375,
-0.1387939453125,
-0.5078125,
1.0283203125,
0.78662109375,
0.18994140625,
-0.45654296875,
0.032073974609375,
-0.487060546875,
0.568359375,
0.10076904296875,
-0.251708984375,
-0.0819091796875,
0.9248046875,
-0.1004638671875,
0.517578125,
-0.291748046875,
-0.310791015625,
-0.429931640625,
-0.67724609375,
0.289794921875,
0.15087890625,
0.07879638671875,
0.2177734375,
0.27880859375,
0.9287109375,
-0.880859375,
-0.7353515625,
-0.15869140625,
0.544921875,
0.330810546875,
0.720703125,
0.468994140625,
-0.1923828125,
-0.49853515625,
-0.64111328125,
0.26708984375,
0.204345703125,
0.70849609375,
-0.45849609375,
0.470703125,
0.2626953125,
-0.5244140625,
0.1986083984375,
-0.91064453125,
-0.275390625,
0.87841796875,
-0.0179595947265625,
1.0908203125,
-0.5048828125,
0.2158203125,
-0.21044921875,
0.1895751953125,
0.77783203125,
0.1458740234375,
0.309814453125,
-0.297607421875,
-0.283935546875,
-0.1605224609375,
-0.373779296875,
0.03656005859375,
-0.61474609375,
0.2197265625,
-0.34423828125,
-0.452392578125,
-0.98583984375,
0.8125,
0.58544921875,
0.572265625,
0.15234375,
0.8720703125,
-0.04010009765625,
0.36181640625,
0.71728515625,
-0.392822265625,
0.2225341796875,
-0.64501953125,
0.68994140625,
-0.0513916015625,
-0.1885986328125,
-0.63818359375,
-0.3125,
-0.140380859375,
-0.1986083984375,
0.328857421875,
-0.31005859375,
-0.7744140625,
0.481201171875,
0.71435546875,
0.55810546875,
-1.16015625,
0.13232421875,
-0.25732421875,
0.685546875,
0.5537109375,
-0.94140625,
0.32958984375,
-0.67041015625,
0.61328125,
0.81787109375,
-0.303466796875,
-0.6904296875,
-0.4326171875,
-0.73681640625,
-0.26513671875,
0.14697265625,
0.79541015625,
0.084228515625,
0.50927734375,
-0.97314453125,
0.41650390625,
0.66357421875,
-0.2020263671875,
-0.0849609375,
-0.2115478515625,
-0.0137939453125,
0.057708740234375,
0.55908203125,
-0.26904296875,
-0.61865234375,
0.1966552734375,
-1.263671875,
0.160888671875,
-0.5068359375,
0.1800537109375,
-0.01079559326171875,
0.159912109375,
-0.2366943359375,
0.5654296875,
-0.161376953125,
0.019683837890625,
-0.108642578125,
0.493896484375,
-1.20703125,
-0.7587890625,
0.646484375,
-0.2078857421875,
0.007694244384765625,
0.67724609375,
-0.056640625,
-0.403564453125,
0.1820068359375,
0.4345703125,
-0.458740234375,
0.08917236328125,
-0.75244140625,
0.447509765625,
-0.1337890625,
-0.55029296875,
-0.41015625,
-0.68359375,
0.88818359375,
0.1600341796875,
-0.89013671875,
-0.3701171875,
-1.2060546875,
-0.17578125,
-0.0229644775390625,
-0.447509765625,
0.474853515625,
-0.1583251953125,
-0.1072998046875,
-0.0017442703247070312,
-0.29638671875,
-0.427001953125,
-0.385009765625,
-0.6318359375,
-0.38232421875,
0.677734375,
0.67236328125,
1.0078125,
0.078369140625,
-0.5,
0.0599365234375,
-0.147705078125,
-0.03436279296875,
-0.693359375,
0.455078125,
-0.199951171875,
-0.2978515625,
-0.376220703125,
0.375,
-0.09051513671875,
0.27294921875,
1.0283203125,
0.192626953125,
0.72998046875,
0.0877685546875,
-0.81396484375,
1.107421875,
0.035308837890625,
-1.197265625,
-0.70263671875,
0.32861328125,
-0.06097412109375,
0.69921875,
0.242431640625,
-0.7548828125,
-0.888671875,
-0.92431640625,
0.44287109375,
-0.6484375,
0.06610107421875,
-0.6533203125,
-0.2181396484375,
-0.371826171875,
0.77978515625,
0.056915283203125,
-0.634765625,
-0.421875,
-0.93115234375,
0.319580078125,
-0.287353515625,
-0.302490234375,
-1.1796875,
-0.5283203125,
-0.52783203125,
0.81201171875,
0.038909912109375,
0.2193603515625,
-0.412353515625,
-0.151611328125,
0.26171875,
-0.26953125,
-0.60302734375,
-0.55322265625,
0.2301025390625,
0.287109375,
-0.294189453125,
0.065185546875,
-0.494384765625,
0.361572265625,
-0.9189453125,
0.2142333984375,
-0.39697265625,
-0.37548828125,
0.08935546875,
-0.3759765625,
1.2890625,
-0.429443359375,
-0.0013885498046875,
-0.2034912109375,
0.509765625,
0.48681640625,
-0.305419921875,
-0.52197265625,
-0.99365234375,
-0.67919921875,
-1.0751953125,
0.66748046875,
-0.75732421875,
-0.2215576171875,
-0.10888671875,
0.06732177734375,
0.861328125,
-0.6162109375,
0.79345703125,
1.1982421875,
0.369384765625,
-0.283203125,
-1.00390625,
1.0888671875,
0.74267578125,
-0.857421875,
0.0494384765625,
0.1961669921875,
-0.51171875,
0.063232421875,
-0.11773681640625,
-1.05859375,
-0.6953125,
0.28759765625,
1.3330078125,
-0.1629638671875,
0.88037109375,
0.265869140625,
-1.0498046875,
-0.666015625,
0.96533203125,
-0.073486328125,
0.515625,
1.091796875,
0.4130859375,
-0.223876953125,
0.044281005859375,
0.31591796875,
-0.416259765625,
-0.0830078125,
0.994140625,
0.054443359375,
-0.5244140625,
0.162109375,
0.9814453125,
-1.1240234375,
-0.85107421875,
-0.07354736328125,
0.1954345703125,
-0.06329345703125,
-0.427490234375,
0.12139892578125,
0.2467041015625,
-0.54541015625,
-0.06829833984375,
0.572265625,
-0.03436279296875,
0.284912109375,
0.2098388671875,
0.3134765625,
-0.46337890625,
0.5205078125,
0.865234375,
-0.513671875,
-0.45166015625,
-0.8427734375,
-0.1485595703125,
-0.50390625,
0.09490966796875,
0.80126953125,
-0.599609375,
0.045928955078125,
0.58251953125,
-0.31005859375,
0.63525390625,
-0.23486328125,
-0.490966796875,
0.2113037109375,
-0.8955078125,
-0.646484375,
-0.1038818359375,
0.358642578125,
-0.08349609375,
0.12420654296875,
-0.274658203125,
0.3876953125,
0.431884765625,
0.393310546875,
-0.0106048583984375,
-1.166015625,
-0.255615234375,
-0.91748046875,
-0.73486328125,
-0.60205078125,
-0.302734375,
-0.287353515625,
-0.08856201171875,
0.030029296875,
-0.68408203125,
0.1817626953125,
0.2337646484375,
-0.55078125,
0.8525390625,
-0.45068359375,
0.333251953125,
-0.53662109375,
-0.6103515625,
-0.389892578125,
-0.12890625,
-0.0297088623046875,
0.07550048828125,
-0.392578125,
0.35791015625,
-0.046783447265625,
0.94140625,
0.04644775390625,
0.2313232421875,
-0.57861328125,
-0.371337890625,
0.166748046875,
0.156982421875,
-0.32080078125,
0.80078125,
0.322021484375,
-0.1195068359375,
0.30712890625,
-0.5361328125,
-0.276123046875,
-0.34228515625,
0.5576171875,
0.408203125,
-0.484619140625,
-0.265625,
-0.352783203125,
0.0709228515625,
-1.0078125,
0.38427734375,
-0.324951171875,
-0.098388671875,
0.405517578125,
-0.059906005859375,
0.31591796875,
0.94970703125,
-0.1427001953125,
0.55810546875,
0.17919921875,
0.245361328125,
0.556640625,
0.022369384765625,
0.17626953125,
0.422607421875,
-0.1475830078125,
-0.156005859375,
0.1536865234375,
0.52587890625,
-0.03729248046875,
0.2315673828125,
-0.0218658447265625,
-0.81884765625,
-0.98486328125,
-0.45751953125,
-0.1654052734375,
0.407958984375,
0.646484375,
-0.58984375,
-0.312255859375,
0.284912109375,
-0.51708984375,
0.44384765625,
-1.06640625,
-0.630859375,
0.84912109375,
-0.119384765625,
-0.59765625,
-0.440185546875,
-0.406982421875,
-0.075439453125,
0.1485595703125,
0.5546875,
-0.32421875,
0.401611328125,
-0.315673828125,
0.87060546875,
0.05523681640625,
-0.264892578125,
-0.35205078125,
0.26513671875,
-0.64892578125,
-0.283203125,
0.318115234375,
0.93115234375,
0.326904296875,
0.005016326904296875,
-0.89404296875,
0.203125,
-0.393310546875,
0.04534912109375,
-0.51904296875,
-0.22119140625,
-0.63330078125,
0.377685546875,
-0.41455078125,
0.59521484375,
-0.1968994140625,
0.55224609375,
0.360107421875,
-0.5380859375,
-0.6943359375,
0.52978515625,
0.4736328125,
-0.347900390625,
0.352783203125,
0.067138671875,
0.224609375,
0.052337646484375,
0.0182037353515625,
-0.038299560546875,
0.4609375,
0.51123046875,
0.97705078125,
-0.098388671875,
0.369140625,
0.65380859375,
0.1790771484375,
0.10400390625,
0.20068359375,
0.2042236328125,
0.33642578125,
0.10186767578125,
-0.09320068359375,
-0.2484130859375,
-0.15234375,
-0.4970703125,
0.253173828125,
-0.482177734375,
-0.270751953125,
-0.77783203125,
-0.5517578125,
0.51953125,
-0.2376708984375,
-0.1015625,
-0.00274658203125,
-0.734375,
0.362548828125,
0.728515625,
-0.1141357421875,
-0.08563232421875,
0.69873046875,
0.6513671875,
0.416748046875,
0.541015625,
0.275390625,
0.293701171875,
-0.64599609375,
0.5166015625,
-0.104248046875,
-0.12200927734375,
-0.3076171875,
-0.322265625,
-0.5205078125,
0.27978515625,
-0.0797119140625,
-0.287841796875,
0.323974609375,
-0.54541015625,
0.0911865234375,
-0.3759765625,
0.3583984375,
-0.93896484375,
0.1534423828125,
0.274658203125,
-0.228515625,
-0.65283203125,
0.71826171875,
-0.1824951171875,
0.290771484375,
0.396484375,
0.93408203125,
-0.0400390625,
1.36328125,
0.55517578125,
0.0794677734375,
-0.346435546875,
0.429443359375,
-0.18701171875,
-0.7578125,
-0.213134765625,
-0.529296875,
-0.029022216796875,
-0.65966796875,
-0.53271484375,
0.1165771484375,
0.8076171875,
-0.0295562744140625,
-0.99072265625,
0.15966796875,
0.435302734375,
-0.81298828125,
0.79736328125,
0.52294921875,
0.7060546875,
-0.0187530517578125,
0.2734375,
-0.11993408203125,
-0.76708984375,
-0.2054443359375,
-0.8720703125,
0.64306640625,
-0.71728515625,
-0.857421875,
-0.41259765625,
-0.9033203125,
-0.193115234375,
-0.14599609375,
-0.27783203125,
-0.9453125,
0.6171875,
0.5400390625,
0.375732421875,
0.1751708984375,
-0.12164306640625,
-0.153564453125,
0.919921875,
0.904296875,
0.1380615234375,
0.88671875,
0.5908203125,
-1.12109375,
0.2275390625,
-1.064453125,
0.474365234375,
0.1766357421875,
-0.09344482421875,
-0.369384765625,
0.218017578125,
-0.70849609375,
-1.25390625,
0.388427734375,
1.0439453125,
0.3447265625,
-0.560546875,
-1.2841796875,
-0.162109375,
-0.81103515625,
-0.2646484375,
-0.37646484375,
0.256591796875,
-0.419677734375,
0.090576171875,
-0.0863037109375,
-1.087890625,
4.29296875,
1.07421875,
0.9404296875,
0.66796875,
0.5009765625,
0.78564453125,
0.4951171875,
-0.62109375,
-0.1832275390625,
-0.6748046875,
0.6767578125,
-0.54638671875,
-0.06365966796875,
0.89990234375,
0.31884765625,
0.4541015625,
-0.362548828125,
0.6044921875,
-0.29345703125,
-0.8623046875,
-0.90771484375,
0.23876953125,
0.046478271484375,
0.6611328125,
-0.042938232421875,
0.325927734375,
0.49853515625,
-0.84130859375,
-0.0762939453125,
-0.54931640625,
-0.1124267578125,
-0.599609375,
0.8720703125,
0.025238037109375,
-0.15966796875,
0.6220703125,
-0.292724609375,
-0.80517578125,
0.0751953125,
0.369873046875,
-0.25,
0.035186767578125,
1.1298828125,
-0.4296875,
-0.119873046875,
0.84326171875,
-0.7587890625,
0.383544921875,
0.57275390625,
-0.83544921875,
1.244140625,
-0.427001953125,
0.54638671875,
-0.70556640625,
-0.56787109375,
0.2998046875,
0.049957275390625,
-0.3359375,
-0.492919921875,
0.81787109375,
0.337646484375,
0.4765625,
-0.146728515625,
0.153564453125,
-1.03515625,
1.24609375,
-0.2440185546875,
0.6328125,
-0.68701171875,
-0.35791015625,
-0.2008056640625,
-0.317138671875,
-0.253662109375,
-0.78857421875,
0.9951171875,
-0.0216522216796875,
-0.4541015625,
0.2410888671875,
0.1383056640625,
-1.025390625,
0.256103515625,
-0.277587890625,
-0.63818359375,
-0.317626953125,
0.57568359375,
0.861328125,
-0.662109375,
-0.1998291015625,
-0.303466796875,
0.81396484375,
0.578125,
0.38623046875,
0.293212890625,
-0.72705078125,
0.0726318359375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a mysterious language (codenamed "Secret") available in "Custom Invocation" tab. Figure out what this language is and write a program which prints its name. Note that the program must be written in this language.
Input
This program has only one test (your program doesn't have to read anything).
Output
Output the name of the mysterious language. Note that the name is case-sensitive and might contain digits and special characters.
Examples
Note
Some scientists disagree on what should be considered as a language and what should be considered as a dialect.
Tags: *special
Correct Solution:
```
print("INTERCAL")
#233333
```
| 43,328
|
[
0.490966796875,
-0.1531982421875,
-0.3046875,
-0.0697021484375,
-0.1397705078125,
-0.391357421875,
-0.143798828125,
0.08746337890625,
-0.216064453125,
0.615234375,
0.748046875,
0.1912841796875,
0.21044921875,
-0.87451171875,
-0.67138671875,
0.11932373046875,
-0.39208984375,
-0.9453125,
-0.395751953125,
-0.28857421875,
-0.0947265625,
0.0804443359375,
-1.6181640625,
-0.29736328125,
-0.58447265625,
0.63916015625,
0.364013671875,
-0.259521484375,
0.33837890625,
1.107421875,
-0.449951171875,
-0.22607421875,
0.276123046875,
-1.115234375,
-0.327392578125,
-0.7900390625,
1.099609375,
-1.0087890625,
-0.356201171875,
-0.400634765625,
-0.34619140625,
-0.01239013671875,
0.2481689453125,
-0.7373046875,
-1.177734375,
0.215087890625,
-0.65380859375,
-0.34130859375,
0.07708740234375,
-0.255859375,
0.72705078125,
0.16015625,
0.334716796875,
-0.09088134765625,
-0.1600341796875,
-0.027130126953125,
-0.1654052734375,
-0.165283203125,
-0.6015625,
-0.073486328125,
-0.09332275390625,
0.200927734375,
0.06640625,
-0.87744140625,
-0.1175537109375,
0.385986328125,
-0.01175689697265625,
-0.1689453125,
-0.0875244140625,
-0.345703125,
0.1024169921875,
0.58251953125,
-0.30517578125,
-0.382568359375,
-0.64453125,
-0.25048828125,
0.165283203125,
0.2734375,
-0.55810546875,
0.2291259765625,
0.3369140625,
1.013671875,
-0.0108184814453125,
0.1319580078125,
-0.203369140625,
-0.59423828125,
-0.058258056640625,
0.12890625,
0.288330078125,
-0.126220703125,
0.23095703125,
0.58935546875,
-0.833984375,
-0.224853515625,
0.87744140625,
0.1978759765625,
-0.256591796875,
0.289306640625,
0.1468505859375,
0.31982421875,
1.0078125,
1.09765625,
-0.748046875,
0.81787109375,
-0.2200927734375,
0.4111328125,
0.148681640625,
0.49169921875,
0.1690673828125,
-0.2032470703125,
-0.10498046875,
-0.74853515625,
0.4130859375,
-0.123291015625,
0.00411224365234375,
0.77099609375,
-0.0953369140625,
0.3310546875,
-1.0625,
0.09735107421875,
0.300048828125,
-0.391357421875,
0.345947265625,
-0.5283203125,
0.0443115234375,
-0.008270263671875,
-0.4560546875,
1.0654296875,
-0.398193359375,
-0.0150146484375,
0.6796875,
-0.2047119140625,
-0.228515625,
0.68603515625,
-0.02069091796875,
0.734375,
-0.04583740234375,
0.68408203125,
0.379638671875,
-0.87890625,
0.418701171875,
-0.1827392578125,
0.14208984375,
1.3583984375,
0.56201171875,
-0.005100250244140625,
0.69970703125,
0.359619140625,
-0.77294921875,
0.53857421875,
-0.669921875,
0.619140625,
0.2205810546875,
0.290283203125,
-0.3447265625,
-0.0291290283203125,
-0.425048828125,
0.167236328125,
0.202880859375,
0.33740234375,
-0.058135986328125,
0.625,
-0.0299072265625,
0.94873046875,
0.08843994140625,
0.845703125,
-0.638671875,
-0.3076171875,
-0.1624755859375,
-0.52880859375,
-0.055694580078125,
-0.1663818359375,
-0.3232421875,
1.009765625,
0.55615234375,
0.69140625,
1.25390625,
-0.0007600784301757812,
0.266845703125,
0.4150390625,
-0.318603515625,
0.1817626953125,
0.11248779296875,
1.0908203125,
0.499267578125,
0.291259765625,
0.333984375,
-0.10272216796875,
-0.83984375,
-0.515625,
-0.06982421875,
1.0390625,
-0.9482421875,
0.266845703125,
0.53564453125,
0.1624755859375,
-0.61962890625,
-0.221923828125,
0.445556640625,
-1.412109375,
-0.4873046875,
1.01953125,
-0.151123046875,
0.779296875,
-0.2705078125,
-0.2198486328125,
0.47119140625,
1.2255859375,
-0.0479736328125,
-0.33251953125,
0.6767578125,
-0.1474609375,
-0.31884765625,
0.281982421875,
0.21923828125,
-0.41796875,
-0.82861328125,
0.72314453125,
-0.54638671875,
0.10504150390625,
0.2310791015625,
0.64013671875,
0.52001953125,
0.41064453125,
-0.2333984375,
-0.236572265625,
0.12152099609375,
1.3310546875,
0.1798095703125,
0.3486328125,
0.1461181640625,
1.0029296875,
0.056793212890625,
1.0087890625,
0.171630859375,
0.11175537109375,
0.85107421875,
0.70361328125,
0.253173828125,
0.385986328125,
-0.10577392578125,
0.039215087890625,
0.325439453125,
0.463134765625,
0.150146484375,
0.55322265625,
-0.003448486328125,
-0.1273193359375,
-0.60693359375,
0.4501953125,
-0.0650634765625,
0.66943359375,
0.492431640625,
0.429931640625,
-0.461181640625,
-0.0914306640625,
0.470947265625,
1.0263671875,
-0.62939453125,
-0.394287109375,
0.469482421875,
-0.1990966796875,
0.441162109375,
0.170654296875,
-0.0780029296875,
0.3857421875,
0.17138671875,
-0.0176239013671875,
-0.5341796875,
-0.6201171875,
-0.85107421875,
-0.60595703125,
-1.2734375,
-0.37744140625,
-0.79541015625,
0.127197265625,
0.443359375,
-1.3623046875,
0.28564453125,
-0.375,
-0.281494140625,
0.432373046875,
-0.552734375,
0.57763671875,
-0.07843017578125,
0.97412109375,
-1.0107421875,
0.55224609375,
-0.03485107421875,
1.0546875,
-0.8271484375,
0.01068878173828125,
-0.4990234375,
-0.796875,
0.321533203125,
0.39306640625,
0.382080078125,
-0.312744140625,
-0.88916015625,
-0.75048828125,
-0.296142578125,
0.2166748046875,
-0.370361328125,
0.45263671875,
-0.87255859375,
0.6142578125,
0.3115234375,
-0.5712890625,
0.69189453125,
0.68798828125,
-0.595703125,
0.67333984375,
0.1722412109375,
0.09368896484375,
-0.95458984375,
1.8251953125,
0.3056640625,
0.1622314453125,
-0.4814453125,
-0.24560546875,
-0.65234375,
-0.17138671875,
0.17138671875,
-0.437255859375,
-0.09393310546875,
0.6513671875,
0.283447265625,
-1.025390625,
0.513671875,
-1.146484375,
-0.55615234375,
-0.112060546875,
-0.57177734375,
1.0634765625,
0.744140625,
0.1722412109375,
-0.479736328125,
0.06988525390625,
-0.5205078125,
0.66552734375,
0.0423583984375,
-0.19921875,
-0.1617431640625,
0.9990234375,
-0.050567626953125,
0.51025390625,
-0.3642578125,
-0.31494140625,
-0.367431640625,
-0.64990234375,
0.3115234375,
0.19580078125,
0.125732421875,
0.1898193359375,
0.2352294921875,
0.97119140625,
-0.88330078125,
-0.77880859375,
-0.19873046875,
0.5693359375,
0.257568359375,
0.66650390625,
0.45458984375,
-0.2529296875,
-0.54736328125,
-0.71630859375,
0.27099609375,
0.16845703125,
0.78271484375,
-0.488525390625,
0.423828125,
0.2340087890625,
-0.57421875,
0.2039794921875,
-0.85302734375,
-0.2147216796875,
0.791015625,
0.0015583038330078125,
1.1005859375,
-0.501953125,
0.353271484375,
-0.26171875,
0.1385498046875,
0.81005859375,
0.119873046875,
0.294921875,
-0.35107421875,
-0.309326171875,
-0.1400146484375,
-0.3154296875,
0.1112060546875,
-0.60888671875,
0.209716796875,
-0.32958984375,
-0.351806640625,
-1.0390625,
0.974609375,
0.56787109375,
0.4267578125,
0.2646484375,
0.87158203125,
-0.0821533203125,
0.3037109375,
0.7041015625,
-0.310302734375,
0.2103271484375,
-0.61279296875,
0.759765625,
-0.0855712890625,
-0.20166015625,
-0.677734375,
-0.263671875,
-0.08978271484375,
-0.10589599609375,
0.282958984375,
-0.291748046875,
-0.79541015625,
0.54541015625,
0.66943359375,
0.58544921875,
-1.1083984375,
0.149169921875,
-0.343017578125,
0.67333984375,
0.49072265625,
-0.93115234375,
0.37939453125,
-0.6806640625,
0.5859375,
0.87060546875,
-0.28955078125,
-0.65966796875,
-0.427001953125,
-0.728515625,
-0.26171875,
0.17724609375,
0.86962890625,
-0.0478515625,
0.5263671875,
-1.0087890625,
0.406494140625,
0.65087890625,
-0.1568603515625,
-0.07122802734375,
-0.149658203125,
0.00025177001953125,
0.0931396484375,
0.568359375,
-0.212646484375,
-0.59521484375,
0.2318115234375,
-1.2919921875,
0.12054443359375,
-0.49169921875,
0.07720947265625,
0.1322021484375,
0.1800537109375,
-0.2447509765625,
0.51025390625,
-0.251708984375,
0.05328369140625,
-0.09307861328125,
0.484130859375,
-1.23046875,
-0.77392578125,
0.7236328125,
-0.30126953125,
0.03338623046875,
0.70703125,
-0.02593994140625,
-0.2371826171875,
0.21533203125,
0.406982421875,
-0.450439453125,
0.052581787109375,
-0.6943359375,
0.46826171875,
-0.258544921875,
-0.5634765625,
-0.472412109375,
-0.736328125,
0.8876953125,
0.13330078125,
-0.81591796875,
-0.3349609375,
-1.2353515625,
-0.11920166015625,
0.037994384765625,
-0.443115234375,
0.471923828125,
-0.1395263671875,
-0.045013427734375,
0.01029205322265625,
-0.35888671875,
-0.385498046875,
-0.3623046875,
-0.638671875,
-0.389404296875,
0.64697265625,
0.68310546875,
1,
0.063720703125,
-0.56494140625,
0.1497802734375,
-0.11553955078125,
-0.126220703125,
-0.69482421875,
0.435546875,
-0.1900634765625,
-0.1903076171875,
-0.308349609375,
0.2386474609375,
-0.1090087890625,
0.272705078125,
1.03125,
0.1556396484375,
0.64697265625,
0.08648681640625,
-0.73974609375,
1.06640625,
0.0021305084228515625,
-1.1279296875,
-0.60302734375,
0.3212890625,
-0.0208587646484375,
0.64404296875,
0.33349609375,
-0.80517578125,
-0.85888671875,
-0.87939453125,
0.44580078125,
-0.65283203125,
0.0704345703125,
-0.61376953125,
-0.2666015625,
-0.387451171875,
0.80419921875,
0.07464599609375,
-0.6240234375,
-0.5185546875,
-0.935546875,
0.363037109375,
-0.404052734375,
-0.3916015625,
-1.1748046875,
-0.623046875,
-0.55224609375,
0.74072265625,
-0.03173828125,
0.1435546875,
-0.474609375,
-0.1370849609375,
0.30859375,
-0.260009765625,
-0.578125,
-0.564453125,
0.19580078125,
0.377197265625,
-0.357177734375,
0.121826171875,
-0.51220703125,
0.450927734375,
-0.89794921875,
0.176513671875,
-0.367431640625,
-0.327392578125,
0.036865234375,
-0.55859375,
1.26953125,
-0.41796875,
-0.10113525390625,
-0.109130859375,
0.4912109375,
0.5107421875,
-0.3388671875,
-0.51806640625,
-0.9873046875,
-0.61083984375,
-1.0693359375,
0.66162109375,
-0.71630859375,
-0.1864013671875,
-0.138916015625,
0.02008056640625,
0.85693359375,
-0.59326171875,
0.76171875,
1.2060546875,
0.29296875,
-0.248779296875,
-1.0712890625,
1.0087890625,
0.73876953125,
-0.88037109375,
0.148193359375,
0.1820068359375,
-0.435791015625,
-0.005153656005859375,
-0.11163330078125,
-1.068359375,
-0.6552734375,
0.328369140625,
1.359375,
-0.074951171875,
0.853515625,
0.217529296875,
-1.0380859375,
-0.6376953125,
0.9658203125,
-0.105224609375,
0.58349609375,
1.1162109375,
0.45166015625,
-0.1971435546875,
0.007244110107421875,
0.283935546875,
-0.43896484375,
-0.09564208984375,
0.94921875,
0.01194000244140625,
-0.650390625,
0.167724609375,
1.029296875,
-1.123046875,
-0.87939453125,
0.0195770263671875,
0.2130126953125,
-0.054046630859375,
-0.465087890625,
0.0986328125,
0.25390625,
-0.5185546875,
-0.0750732421875,
0.53515625,
0.0125579833984375,
0.27392578125,
0.1441650390625,
0.348876953125,
-0.37158203125,
0.517578125,
0.951171875,
-0.5126953125,
-0.4404296875,
-0.8330078125,
-0.15673828125,
-0.45751953125,
0.10272216796875,
0.76416015625,
-0.57568359375,
0.0277252197265625,
0.60986328125,
-0.377197265625,
0.630859375,
-0.261962890625,
-0.45751953125,
0.323486328125,
-0.9130859375,
-0.6884765625,
-0.12042236328125,
0.3955078125,
-0.051544189453125,
0.12298583984375,
-0.314453125,
0.426025390625,
0.440673828125,
0.289794921875,
0.0135345458984375,
-1.1279296875,
-0.351318359375,
-0.916015625,
-0.77197265625,
-0.552734375,
-0.337890625,
-0.395751953125,
-0.09869384765625,
0.0767822265625,
-0.65234375,
0.15380859375,
0.2474365234375,
-0.58447265625,
0.857421875,
-0.443115234375,
0.346435546875,
-0.599609375,
-0.599609375,
-0.42822265625,
-0.159423828125,
-0.022216796875,
0.1373291015625,
-0.42431640625,
0.322021484375,
-0.096923828125,
0.90478515625,
0.0272979736328125,
0.2171630859375,
-0.63427734375,
-0.3330078125,
0.1768798828125,
0.1907958984375,
-0.40283203125,
0.81103515625,
0.3115234375,
-0.1302490234375,
0.2337646484375,
-0.4384765625,
-0.2430419921875,
-0.285400390625,
0.59765625,
0.399169921875,
-0.4716796875,
-0.302490234375,
-0.347900390625,
0.11090087890625,
-1.1005859375,
0.48095703125,
-0.309326171875,
-0.054718017578125,
0.455078125,
-0.191162109375,
0.334716796875,
0.94091796875,
-0.06500244140625,
0.49169921875,
0.1292724609375,
0.252197265625,
0.487548828125,
0.017669677734375,
0.2138671875,
0.316162109375,
-0.11138916015625,
-0.1527099609375,
0.16552734375,
0.421875,
-0.103515625,
0.151611328125,
0.00428009033203125,
-0.71923828125,
-0.99365234375,
-0.50341796875,
-0.28857421875,
0.41015625,
0.748046875,
-0.51171875,
-0.228759765625,
0.261474609375,
-0.59814453125,
0.53759765625,
-1.03515625,
-0.66552734375,
0.9013671875,
-0.0828857421875,
-0.59228515625,
-0.4599609375,
-0.4296875,
-0.05010986328125,
0.1722412109375,
0.491455078125,
-0.257080078125,
0.38818359375,
-0.312744140625,
0.8203125,
0.1044921875,
-0.25048828125,
-0.359619140625,
0.2191162109375,
-0.6416015625,
-0.27490234375,
0.264404296875,
0.90673828125,
0.38427734375,
-0.006591796875,
-0.857421875,
0.11309814453125,
-0.421142578125,
0.060791015625,
-0.6005859375,
-0.2296142578125,
-0.58544921875,
0.359375,
-0.395751953125,
0.57080078125,
-0.1881103515625,
0.568359375,
0.28466796875,
-0.52587890625,
-0.65673828125,
0.572265625,
0.552734375,
-0.361572265625,
0.353271484375,
0.1429443359375,
0.228515625,
0.01617431640625,
-0.042877197265625,
-0.0548095703125,
0.480224609375,
0.48046875,
1.0107421875,
-0.063232421875,
0.25927734375,
0.681640625,
0.1405029296875,
0.12103271484375,
0.1395263671875,
0.21142578125,
0.381103515625,
0.1341552734375,
-0.1270751953125,
-0.2626953125,
-0.154052734375,
-0.51416015625,
0.26611328125,
-0.462646484375,
-0.283203125,
-0.8388671875,
-0.529296875,
0.493408203125,
-0.16650390625,
-0.0972900390625,
0.04730224609375,
-0.66064453125,
0.319580078125,
0.783203125,
-0.0814208984375,
-0.114990234375,
0.7216796875,
0.62939453125,
0.46044921875,
0.5947265625,
0.32958984375,
0.33203125,
-0.61767578125,
0.54052734375,
-0.10333251953125,
-0.1396484375,
-0.3759765625,
-0.380126953125,
-0.5693359375,
0.279296875,
-0.09332275390625,
-0.28662109375,
0.34228515625,
-0.49169921875,
0.11773681640625,
-0.3720703125,
0.271240234375,
-0.93359375,
0.1973876953125,
0.2822265625,
-0.300048828125,
-0.755859375,
0.78955078125,
-0.1759033203125,
0.33154296875,
0.43115234375,
0.90283203125,
-0.060150146484375,
1.416015625,
0.533203125,
0.174072265625,
-0.350830078125,
0.47900390625,
-0.2159423828125,
-0.66796875,
-0.2310791015625,
-0.5380859375,
-0.005504608154296875,
-0.60595703125,
-0.5390625,
0.137939453125,
0.77197265625,
-0.061004638671875,
-0.923828125,
0.144775390625,
0.478759765625,
-0.8134765625,
0.8212890625,
0.57763671875,
0.72314453125,
-0.034820556640625,
0.2296142578125,
-0.12255859375,
-0.74169921875,
-0.1220703125,
-0.79345703125,
0.5458984375,
-0.6953125,
-0.787109375,
-0.294921875,
-0.95361328125,
-0.2242431640625,
-0.0013837814331054688,
-0.340087890625,
-0.853515625,
0.701171875,
0.462646484375,
0.458984375,
0.220458984375,
-0.11151123046875,
-0.182861328125,
0.93115234375,
0.8310546875,
0.17626953125,
0.916015625,
0.57568359375,
-1.0517578125,
0.1220703125,
-1.0546875,
0.4619140625,
0.1348876953125,
-0.08050537109375,
-0.410888671875,
0.1988525390625,
-0.705078125,
-1.31640625,
0.362060546875,
1.1201171875,
0.46484375,
-0.52978515625,
-1.283203125,
-0.210205078125,
-0.78564453125,
-0.279052734375,
-0.334716796875,
0.283935546875,
-0.405517578125,
0.04010009765625,
-0.1373291015625,
-1.0693359375,
4.29296875,
1.0908203125,
0.92529296875,
0.5712890625,
0.477783203125,
0.689453125,
0.47314453125,
-0.5439453125,
-0.1368408203125,
-0.576171875,
0.62158203125,
-0.58203125,
-0.114013671875,
0.9150390625,
0.350830078125,
0.459228515625,
-0.367919921875,
0.5234375,
-0.30810546875,
-0.896484375,
-0.869140625,
0.255126953125,
0.05987548828125,
0.763671875,
-0.018463134765625,
0.301513671875,
0.48876953125,
-0.8232421875,
-0.0118865966796875,
-0.47119140625,
-0.15869140625,
-0.6337890625,
0.8935546875,
-0.1080322265625,
-0.1607666015625,
0.544921875,
-0.300537109375,
-0.72607421875,
0.06109619140625,
0.402099609375,
-0.2349853515625,
0.05706787109375,
1.1416015625,
-0.46923828125,
-0.11492919921875,
0.8623046875,
-0.81640625,
0.344970703125,
0.5537109375,
-0.82763671875,
1.2578125,
-0.3642578125,
0.6005859375,
-0.607421875,
-0.60986328125,
0.27392578125,
0.048187255859375,
-0.294921875,
-0.4326171875,
0.7724609375,
0.297607421875,
0.426025390625,
-0.10406494140625,
0.2137451171875,
-1.037109375,
1.142578125,
-0.260009765625,
0.62451171875,
-0.6591796875,
-0.33349609375,
-0.2171630859375,
-0.300537109375,
-0.354248046875,
-0.78271484375,
1.0126953125,
0.0853271484375,
-0.44677734375,
0.303955078125,
0.10943603515625,
-1.0078125,
0.275146484375,
-0.239013671875,
-0.65869140625,
-0.380126953125,
0.56591796875,
0.76611328125,
-0.685546875,
-0.29736328125,
-0.2166748046875,
0.7880859375,
0.464111328125,
0.4248046875,
0.3017578125,
-0.78759765625,
0.0133514404296875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a mysterious language (codenamed "Secret") available in "Custom Invocation" tab. Figure out what this language is and write a program which prints its name. Note that the program must be written in this language.
Input
This program has only one test (your program doesn't have to read anything).
Output
Output the name of the mysterious language. Note that the name is case-sensitive and might contain digits and special characters.
Examples
Note
Some scientists disagree on what should be considered as a language and what should be considered as a dialect.
Tags: *special
Correct Solution:
```
"""====================================================================================
====================================================================================
___ _______ ___ _______ ___ ___
| /\ | | \ | | / | | | | |\ /|
| / \ | | \ | | / | | | | | \ / |
|___ /____\ | | \ | |/ |___| | | | \/ |
| / \ | | / | |\ |\ | | | |
| / \ | | / | | \ | \ | | | |
___|/ \___|___ |___/ ___|___ | \ | \ |___| | |
====================================================================================
====================================================================================
"""
# ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
print("INTERCAL")
# ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
"""====================================================================================
====================================================================================
___ _______ ___ _______ ___ ___
| /\ | | \ | | / | | | | |\ /|
| / \ | | \ | | / | | | | | \ / |
|___ /____\ | | \ | |/ |___| | | | \/ |
| / \ | | / | |\ |\ | | | |
| / \ | | / | | \ | \ | | | |
___|/ \___|___ |___/ ___|___ | \ | \ |___| | |
====================================================================================
====================================================================================
"""
```
| 43,329
|
[
0.40380859375,
-0.297607421875,
-0.262451171875,
-0.0230255126953125,
-0.1312255859375,
-0.433837890625,
-0.06890869140625,
0.1724853515625,
-0.350341796875,
0.56201171875,
0.625,
0.1121826171875,
0.261962890625,
-0.76025390625,
-0.70068359375,
0.127197265625,
-0.423828125,
-0.966796875,
-0.375244140625,
-0.1456298828125,
-0.08837890625,
0.038299560546875,
-1.5849609375,
-0.26611328125,
-0.52685546875,
0.6669921875,
0.3544921875,
-0.05694580078125,
0.56298828125,
1.064453125,
-0.390625,
-0.289306640625,
0.259521484375,
-1.2158203125,
-0.2462158203125,
-0.76806640625,
1.0322265625,
-0.84765625,
-0.3125,
-0.424560546875,
-0.2763671875,
-0.0148468017578125,
0.2978515625,
-0.61572265625,
-1.296875,
0.07861328125,
-0.67724609375,
-0.300537109375,
0.044097900390625,
-0.159912109375,
0.77978515625,
0.0958251953125,
0.3642578125,
-0.1585693359375,
-0.007801055908203125,
-0.064453125,
-0.232177734375,
-0.0289154052734375,
-0.61328125,
0.023681640625,
-0.08489990234375,
0.38916015625,
0.0985107421875,
-0.8349609375,
-0.21484375,
0.33154296875,
-0.05584716796875,
0.0299072265625,
-0.127685546875,
-0.41455078125,
0.09674072265625,
0.47705078125,
-0.379150390625,
-0.371337890625,
-0.7431640625,
-0.1539306640625,
0.12042236328125,
0.1756591796875,
-0.5146484375,
0.248046875,
0.2379150390625,
1.001953125,
0.1204833984375,
0.134033203125,
-0.1326904296875,
-0.68115234375,
0.01258087158203125,
0.25048828125,
0.238525390625,
-0.1845703125,
0.2139892578125,
0.5380859375,
-0.7939453125,
-0.190673828125,
0.83740234375,
0.358642578125,
-0.299072265625,
0.363525390625,
0.2303466796875,
0.44189453125,
0.8583984375,
1.0068359375,
-0.7353515625,
0.96630859375,
-0.11737060546875,
0.221923828125,
0.267822265625,
0.464599609375,
0.1871337890625,
-0.09716796875,
-0.1326904296875,
-0.77294921875,
0.45166015625,
-0.032470703125,
-0.1973876953125,
0.7216796875,
-0.18896484375,
0.334716796875,
-1.0908203125,
0.086669921875,
0.279296875,
-0.372314453125,
0.33837890625,
-0.55615234375,
0.09832763671875,
-0.14990234375,
-0.277099609375,
1.0244140625,
-0.4716796875,
-0.0210113525390625,
0.81591796875,
-0.1651611328125,
-0.08575439453125,
0.57666015625,
-0.03155517578125,
0.64794921875,
-0.05767822265625,
0.5947265625,
0.474609375,
-0.84619140625,
0.492431640625,
-0.1912841796875,
0.1695556640625,
1.26953125,
0.5263671875,
-0.033538818359375,
0.61669921875,
0.3623046875,
-0.72900390625,
0.40966796875,
-0.5390625,
0.59130859375,
0.208251953125,
0.351318359375,
-0.264892578125,
-0.054962158203125,
-0.24755859375,
0.06103515625,
0.1339111328125,
0.265380859375,
-0.0243682861328125,
0.60302734375,
-0.05670166015625,
0.80615234375,
-0.11529541015625,
0.8740234375,
-0.58349609375,
-0.32958984375,
-0.2142333984375,
-0.6103515625,
0.0927734375,
-0.228515625,
-0.32470703125,
0.81103515625,
0.59033203125,
0.765625,
1.1943359375,
0.006381988525390625,
0.28076171875,
0.418212890625,
-0.285888671875,
0.0743408203125,
0.06292724609375,
1.119140625,
0.334228515625,
0.161865234375,
0.20068359375,
-0.1175537109375,
-0.8134765625,
-0.5322265625,
0.016204833984375,
0.966796875,
-0.7841796875,
0.2318115234375,
0.60205078125,
0.243408203125,
-0.763671875,
-0.06805419921875,
0.256103515625,
-1.357421875,
-0.5068359375,
0.8359375,
-0.1563720703125,
0.72607421875,
-0.2021484375,
-0.1976318359375,
0.415771484375,
1.2626953125,
-0.12841796875,
-0.31689453125,
0.49755859375,
-0.0277252197265625,
-0.354248046875,
0.269775390625,
0.2095947265625,
-0.40966796875,
-0.79052734375,
0.79345703125,
-0.4541015625,
0.20458984375,
0.08319091796875,
0.61474609375,
0.49462890625,
0.38330078125,
-0.138671875,
-0.215087890625,
0.2130126953125,
1.29296875,
0.255859375,
0.40966796875,
0.2386474609375,
0.994140625,
0.2073974609375,
1.08984375,
0.2301025390625,
0.1185302734375,
0.67724609375,
0.76904296875,
0.339599609375,
0.382080078125,
-0.19482421875,
0.0994873046875,
0.340576171875,
0.54248046875,
0.1669921875,
0.60986328125,
0.07684326171875,
-0.1822509765625,
-0.408447265625,
0.31005859375,
-0.2286376953125,
0.755859375,
0.60986328125,
0.50439453125,
-0.52685546875,
-0.154052734375,
0.48193359375,
1.087890625,
-0.80908203125,
-0.314697265625,
0.4375,
-0.1153564453125,
0.356689453125,
0.0400390625,
-0.08807373046875,
0.367919921875,
0.2445068359375,
0.09393310546875,
-0.6630859375,
-0.70849609375,
-0.75146484375,
-0.61279296875,
-1.17578125,
-0.260986328125,
-0.67138671875,
0.280029296875,
0.452880859375,
-1.28515625,
0.262939453125,
-0.509765625,
-0.2705078125,
0.424560546875,
-0.361083984375,
0.58837890625,
-0.0792236328125,
0.92529296875,
-0.9150390625,
0.5078125,
-0.10479736328125,
1.0478515625,
-0.86962890625,
-0.10028076171875,
-0.4912109375,
-0.74169921875,
0.35888671875,
0.3466796875,
0.2308349609375,
-0.2259521484375,
-0.77197265625,
-0.8505859375,
-0.261474609375,
0.1619873046875,
-0.3974609375,
0.290771484375,
-0.89306640625,
0.78173828125,
0.380126953125,
-0.56005859375,
0.7275390625,
0.55419921875,
-0.61669921875,
0.72607421875,
0.298828125,
0.15380859375,
-0.84765625,
1.53515625,
0.3115234375,
0.1964111328125,
-0.5927734375,
-0.2066650390625,
-0.62109375,
-0.1378173828125,
0.0968017578125,
-0.450927734375,
-0.1993408203125,
0.57421875,
0.2509765625,
-0.99658203125,
0.43408203125,
-1.0751953125,
-0.6669921875,
-0.257568359375,
-0.432373046875,
1.0244140625,
0.70703125,
0.1695556640625,
-0.479248046875,
0.018310546875,
-0.48974609375,
0.60400390625,
0.218505859375,
-0.2626953125,
-0.07794189453125,
0.88427734375,
0.050201416015625,
0.47314453125,
-0.16455078125,
-0.372314453125,
-0.2445068359375,
-0.67919921875,
0.297607421875,
0.2646484375,
0.1568603515625,
0.0728759765625,
0.23876953125,
1.02734375,
-0.9033203125,
-0.70166015625,
-0.0633544921875,
0.5634765625,
0.47314453125,
0.8486328125,
0.50927734375,
-0.336181640625,
-0.499755859375,
-0.72509765625,
0.255126953125,
0.12432861328125,
0.76611328125,
-0.69775390625,
0.3544921875,
0.1778564453125,
-0.52587890625,
0.18212890625,
-0.86376953125,
-0.366455078125,
0.83544921875,
0.0023937225341796875,
1.0283203125,
-0.42529296875,
0.34033203125,
-0.2142333984375,
0.130126953125,
0.9443359375,
0.1644287109375,
0.326171875,
-0.321044921875,
-0.16064453125,
-0.27197265625,
-0.336669921875,
0.049652099609375,
-0.6005859375,
0.1358642578125,
-0.38916015625,
-0.496337890625,
-1.119140625,
0.810546875,
0.50048828125,
0.5126953125,
0.357421875,
0.6591796875,
-0.038848876953125,
0.36669921875,
0.576171875,
-0.488525390625,
0.287353515625,
-0.68603515625,
0.755859375,
-0.043060302734375,
-0.283203125,
-0.58251953125,
-0.1390380859375,
-0.237548828125,
-0.23388671875,
0.32763671875,
-0.33544921875,
-0.73291015625,
0.3896484375,
0.6201171875,
0.488525390625,
-1.109375,
0.043731689453125,
-0.266845703125,
0.62841796875,
0.603515625,
-1.03515625,
0.292236328125,
-0.81396484375,
0.5361328125,
0.82275390625,
-0.220458984375,
-0.5810546875,
-0.39111328125,
-0.67529296875,
-0.3740234375,
0.0904541015625,
0.76171875,
0.11578369140625,
0.44482421875,
-0.90478515625,
0.33935546875,
0.5380859375,
-0.356689453125,
-0.0254058837890625,
-0.0238037109375,
0.07421875,
-0.015167236328125,
0.658203125,
-0.240478515625,
-0.57421875,
0.235107421875,
-1.2041015625,
0.1070556640625,
-0.43115234375,
0.11187744140625,
0.165283203125,
0.1922607421875,
-0.036956787109375,
0.5546875,
-0.266845703125,
0.0977783203125,
-0.11224365234375,
0.323486328125,
-1.1689453125,
-0.7470703125,
0.6796875,
-0.12103271484375,
-0.1551513671875,
0.52783203125,
-0.138916015625,
-0.288818359375,
0.2442626953125,
0.43896484375,
-0.44091796875,
0.11041259765625,
-0.6591796875,
0.5517578125,
-0.1646728515625,
-0.498779296875,
-0.51318359375,
-0.67138671875,
0.8671875,
0.1671142578125,
-0.9482421875,
-0.4208984375,
-1.2060546875,
-0.1412353515625,
0.1239013671875,
-0.44189453125,
0.50830078125,
-0.19189453125,
0.028656005859375,
0.044281005859375,
-0.2900390625,
-0.62353515625,
-0.43896484375,
-0.444580078125,
-0.4091796875,
0.638671875,
0.626953125,
0.958984375,
0.042083740234375,
-0.407958984375,
-0.039947509765625,
0.09222412109375,
0.145263671875,
-0.66162109375,
0.45556640625,
-0.189208984375,
-0.23779296875,
-0.302490234375,
0.305419921875,
-0.2052001953125,
0.2169189453125,
1.0146484375,
0.1531982421875,
0.6357421875,
-0.04608154296875,
-0.84619140625,
1.14453125,
0.059783935546875,
-1.3056640625,
-0.7548828125,
0.302978515625,
-0.0223846435546875,
0.74853515625,
0.349365234375,
-0.57275390625,
-0.9130859375,
-0.87060546875,
0.220947265625,
-0.5869140625,
0.0185089111328125,
-0.7099609375,
-0.31787109375,
-0.35205078125,
0.7724609375,
0.11822509765625,
-0.70166015625,
-0.489013671875,
-0.9814453125,
0.1572265625,
-0.3974609375,
-0.249755859375,
-1.107421875,
-0.447509765625,
-0.5400390625,
0.90478515625,
0.07708740234375,
0.1939697265625,
-0.5341796875,
-0.181396484375,
0.2037353515625,
-0.1263427734375,
-0.55029296875,
-0.56494140625,
0.233642578125,
0.26171875,
-0.269287109375,
0.034332275390625,
-0.681640625,
0.4306640625,
-0.927734375,
0.2059326171875,
-0.3857421875,
-0.439208984375,
-0.01204681396484375,
-0.43994140625,
1.1962890625,
-0.405029296875,
-0.1275634765625,
-0.10601806640625,
0.51953125,
0.53173828125,
-0.333740234375,
-0.517578125,
-0.95556640625,
-0.72998046875,
-1.109375,
0.5322265625,
-0.61669921875,
-0.0882568359375,
-0.1075439453125,
0.01087188720703125,
0.84619140625,
-0.481689453125,
0.63720703125,
1.3173828125,
0.285888671875,
-0.0654296875,
-0.87451171875,
0.90087890625,
0.57470703125,
-1.037109375,
0.1497802734375,
0.2861328125,
-0.6123046875,
-0.03955078125,
-0.2093505859375,
-0.99267578125,
-0.7509765625,
0.2100830078125,
1.2939453125,
-0.15673828125,
0.81201171875,
0.20458984375,
-1.13671875,
-0.5947265625,
0.8134765625,
-0.0126190185546875,
0.59326171875,
1.044921875,
0.41552734375,
-0.044708251953125,
0.051239013671875,
0.263671875,
-0.253173828125,
-0.239990234375,
1.06640625,
0.056976318359375,
-0.541015625,
0.1922607421875,
1.0400390625,
-1.091796875,
-0.76611328125,
0.0037841796875,
0.0263671875,
-0.0222625732421875,
-0.465087890625,
0.1990966796875,
0.193603515625,
-0.51025390625,
-0.04693603515625,
0.7578125,
0.053192138671875,
0.1826171875,
0.1575927734375,
0.282958984375,
-0.458984375,
0.446044921875,
0.91259765625,
-0.380126953125,
-0.5087890625,
-0.90966796875,
-0.033905029296875,
-0.447998046875,
0.09857177734375,
0.70947265625,
-0.330078125,
0.2177734375,
0.57080078125,
-0.27294921875,
0.6884765625,
-0.29833984375,
-0.492919921875,
0.2939453125,
-0.6767578125,
-0.796875,
-0.1483154296875,
0.3681640625,
-0.100830078125,
0.1690673828125,
-0.330810546875,
0.375244140625,
0.428466796875,
0.228271484375,
-0.09039306640625,
-1.0458984375,
-0.356689453125,
-1.013671875,
-0.62890625,
-0.5634765625,
-0.51171875,
-0.41259765625,
-0.040557861328125,
0.07855224609375,
-0.580078125,
0.036529541015625,
0.3349609375,
-0.67724609375,
0.76318359375,
-0.5625,
0.2880859375,
-0.45263671875,
-0.56640625,
-0.468505859375,
-0.0716552734375,
0.0041351318359375,
0.20068359375,
-0.49853515625,
0.3564453125,
-0.0975341796875,
0.94921875,
-0.004550933837890625,
0.293701171875,
-0.65234375,
-0.47509765625,
0.142333984375,
0.068603515625,
-0.38232421875,
0.603515625,
0.4453125,
-0.1220703125,
0.320068359375,
-0.4287109375,
-0.25146484375,
-0.289306640625,
0.56787109375,
0.30078125,
-0.35107421875,
-0.294189453125,
-0.236572265625,
0.018310546875,
-1.166015625,
0.33837890625,
-0.47998046875,
0.031768798828125,
0.360595703125,
-0.259033203125,
0.309326171875,
0.97021484375,
-0.202880859375,
0.457763671875,
0.04351806640625,
0.352294921875,
0.50830078125,
0.01358795166015625,
0.192138671875,
0.397705078125,
-0.179443359375,
-0.1336669921875,
0.2275390625,
0.381591796875,
-0.114501953125,
0.2376708984375,
-0.05438232421875,
-0.68896484375,
-1.0546875,
-0.408447265625,
-0.2264404296875,
0.666015625,
0.552734375,
-0.515625,
-0.10577392578125,
0.250732421875,
-0.42041015625,
0.5146484375,
-0.89697265625,
-0.7255859375,
0.8134765625,
-0.1827392578125,
-0.52001953125,
-0.415771484375,
-0.4189453125,
-0.0662841796875,
0.2469482421875,
0.63623046875,
-0.2822265625,
0.466796875,
-0.328125,
0.67822265625,
-0.0282440185546875,
-0.256591796875,
-0.30810546875,
0.192138671875,
-0.71484375,
-0.412841796875,
0.2269287109375,
0.80224609375,
0.30712890625,
-0.0726318359375,
-0.84716796875,
0.275146484375,
-0.41650390625,
-0.0552978515625,
-0.498779296875,
-0.042236328125,
-0.46630859375,
0.434326171875,
-0.455322265625,
0.450439453125,
-0.239013671875,
0.4736328125,
0.397705078125,
-0.39697265625,
-0.6982421875,
0.61279296875,
0.52685546875,
-0.35546875,
0.430908203125,
0.1446533203125,
0.167724609375,
0.08135986328125,
-0.052032470703125,
0.0230865478515625,
0.5087890625,
0.55126953125,
0.92626953125,
-0.12548828125,
0.2259521484375,
0.716796875,
0.322021484375,
0.037322998046875,
0.1934814453125,
0.2164306640625,
0.1661376953125,
0.193603515625,
-0.085205078125,
-0.2149658203125,
-0.18310546875,
-0.364013671875,
0.2958984375,
-0.357666015625,
-0.2362060546875,
-0.67431640625,
-0.6259765625,
0.5849609375,
-0.1636962890625,
-0.123291015625,
-0.09552001953125,
-0.67919921875,
0.339111328125,
0.76171875,
-0.1876220703125,
-0.173583984375,
0.59912109375,
0.654296875,
0.46728515625,
0.5830078125,
0.1553955078125,
0.1806640625,
-0.50244140625,
0.54541015625,
0.043548583984375,
-0.1429443359375,
-0.421875,
-0.308349609375,
-0.578125,
0.24072265625,
-0.182373046875,
-0.377685546875,
0.470703125,
-0.60400390625,
0.2034912109375,
-0.265869140625,
0.40283203125,
-0.787109375,
0.22412109375,
0.27734375,
-0.1961669921875,
-0.74951171875,
0.56591796875,
-0.2255859375,
0.366455078125,
0.334716796875,
1.0068359375,
-0.1888427734375,
1.4501953125,
0.4892578125,
0.0784912109375,
-0.222900390625,
0.270263671875,
-0.163330078125,
-0.62451171875,
-0.10797119140625,
-0.52294921875,
-0.0271148681640625,
-0.6376953125,
-0.451416015625,
0.08087158203125,
0.77490234375,
-0.1912841796875,
-0.9306640625,
0.1387939453125,
0.611328125,
-0.84228515625,
0.75244140625,
0.54248046875,
0.6025390625,
-0.0703125,
0.2271728515625,
-0.142333984375,
-0.71142578125,
-0.19580078125,
-0.6865234375,
0.68310546875,
-0.62451171875,
-0.732421875,
-0.361572265625,
-0.92724609375,
-0.3837890625,
-0.2587890625,
-0.28271484375,
-0.7890625,
0.53662109375,
0.625,
0.363037109375,
0.1185302734375,
-0.1348876953125,
-0.2012939453125,
0.8193359375,
0.853515625,
0.095947265625,
0.95556640625,
0.61572265625,
-0.8056640625,
0.1512451171875,
-0.8486328125,
0.41455078125,
0.11907958984375,
-0.1546630859375,
-0.397216796875,
0.226806640625,
-0.72412109375,
-1.1787109375,
0.325439453125,
1.0966796875,
0.322265625,
-0.64892578125,
-1.30078125,
-0.1956787109375,
-0.94580078125,
-0.35986328125,
-0.39013671875,
0.427734375,
-0.3837890625,
-0.053558349609375,
-0.0292510986328125,
-0.998046875,
4.3984375,
1.208984375,
0.826171875,
0.72216796875,
0.431396484375,
0.845703125,
0.62451171875,
-0.55419921875,
-0.033721923828125,
-0.583984375,
0.55859375,
-0.5458984375,
-0.06317138671875,
0.77685546875,
0.3203125,
0.51416015625,
-0.49267578125,
0.5458984375,
-0.2449951171875,
-0.822265625,
-0.92431640625,
0.265625,
0.048309326171875,
0.86328125,
0.08868408203125,
0.1287841796875,
0.60205078125,
-0.78369140625,
-0.0310211181640625,
-0.64306640625,
-0.041107177734375,
-0.55078125,
0.84033203125,
-0.026153564453125,
-0.2059326171875,
0.5498046875,
-0.224853515625,
-0.88671875,
-0.01296234130859375,
0.41552734375,
-0.2198486328125,
-0.004856109619140625,
1.0361328125,
-0.65283203125,
-0.13037109375,
0.97705078125,
-0.82958984375,
0.53125,
0.480224609375,
-0.841796875,
1.0986328125,
-0.408447265625,
0.459228515625,
-0.556640625,
-0.63916015625,
0.2156982421875,
0.0692138671875,
-0.2030029296875,
-0.3203125,
0.75341796875,
0.2337646484375,
0.51806640625,
-0.0254669189453125,
0.211669921875,
-0.9775390625,
1.005859375,
-0.265869140625,
0.51416015625,
-0.5810546875,
-0.314208984375,
-0.23046875,
-0.341064453125,
-0.3037109375,
-0.81005859375,
0.95751953125,
0.1959228515625,
-0.399169921875,
0.2388916015625,
0.2330322265625,
-0.955078125,
0.29345703125,
-0.272705078125,
-0.5654296875,
-0.3203125,
0.654296875,
0.85986328125,
-0.6474609375,
-0.309814453125,
-0.342529296875,
0.9267578125,
0.56396484375,
0.4453125,
0.239013671875,
-0.75048828125,
-0.0278472900390625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a mysterious language (codenamed "Secret") available in "Custom Invocation" tab. Figure out what this language is and write a program which prints its name. Note that the program must be written in this language.
Input
This program has only one test (your program doesn't have to read anything).
Output
Output the name of the mysterious language. Note that the name is case-sensitive and might contain digits and special characters.
Examples
Note
Some scientists disagree on what should be considered as a language and what should be considered as a dialect.
Tags: *special
Correct Solution:
```
print("INTERCAL")
# This is my code
```
| 43,330
|
[
0.434814453125,
-0.1568603515625,
-0.309326171875,
-0.098876953125,
-0.151123046875,
-0.405517578125,
-0.1368408203125,
0.0826416015625,
-0.2208251953125,
0.60107421875,
0.71728515625,
0.2021484375,
0.1796875,
-0.90771484375,
-0.669921875,
0.149658203125,
-0.431396484375,
-0.94775390625,
-0.418212890625,
-0.26904296875,
-0.08837890625,
0.06573486328125,
-1.611328125,
-0.33984375,
-0.58447265625,
0.65380859375,
0.394287109375,
-0.271728515625,
0.354736328125,
1.1376953125,
-0.433837890625,
-0.218505859375,
0.2430419921875,
-1.0859375,
-0.315185546875,
-0.7919921875,
1.095703125,
-1.0224609375,
-0.378662109375,
-0.393310546875,
-0.33740234375,
0.00823211669921875,
0.25634765625,
-0.74560546875,
-1.208984375,
0.2271728515625,
-0.6611328125,
-0.331298828125,
0.08154296875,
-0.252685546875,
0.70361328125,
0.1865234375,
0.31689453125,
-0.0626220703125,
-0.205322265625,
-0.0159912109375,
-0.1414794921875,
-0.128173828125,
-0.54296875,
-0.10968017578125,
-0.1134033203125,
0.200927734375,
0.0311431884765625,
-0.89599609375,
-0.09210205078125,
0.380615234375,
-0.015960693359375,
-0.1729736328125,
-0.0679931640625,
-0.366455078125,
0.10638427734375,
0.5439453125,
-0.310302734375,
-0.387451171875,
-0.6484375,
-0.2373046875,
0.173828125,
0.263427734375,
-0.5439453125,
0.24462890625,
0.36279296875,
0.99365234375,
-0.019195556640625,
0.163330078125,
-0.2203369140625,
-0.57958984375,
-0.0457763671875,
0.1392822265625,
0.286865234375,
-0.1546630859375,
0.2421875,
0.5888671875,
-0.8427734375,
-0.18310546875,
0.87451171875,
0.248779296875,
-0.2388916015625,
0.271728515625,
0.151123046875,
0.375732421875,
0.99853515625,
1.1025390625,
-0.76416015625,
0.82421875,
-0.23291015625,
0.435546875,
0.1688232421875,
0.5185546875,
0.1915283203125,
-0.2193603515625,
-0.16748046875,
-0.77294921875,
0.393798828125,
-0.158935546875,
-0.021392822265625,
0.77001953125,
-0.09783935546875,
0.33056640625,
-1.076171875,
0.07574462890625,
0.28857421875,
-0.37744140625,
0.352783203125,
-0.495361328125,
0.0252227783203125,
-0.0172576904296875,
-0.447509765625,
1.0625,
-0.390869140625,
-0.0322265625,
0.71533203125,
-0.18896484375,
-0.259765625,
0.67822265625,
-0.031829833984375,
0.73193359375,
-0.05499267578125,
0.68896484375,
0.36669921875,
-0.85986328125,
0.422119140625,
-0.158203125,
0.1844482421875,
1.3525390625,
0.58837890625,
-0.01004791259765625,
0.69384765625,
0.3232421875,
-0.7568359375,
0.56103515625,
-0.658203125,
0.591796875,
0.25244140625,
0.290283203125,
-0.321533203125,
-0.016754150390625,
-0.449951171875,
0.1787109375,
0.188720703125,
0.333740234375,
-0.03009033203125,
0.6181640625,
-0.058563232421875,
0.96484375,
0.09271240234375,
0.84130859375,
-0.6728515625,
-0.315673828125,
-0.12225341796875,
-0.48583984375,
-0.07135009765625,
-0.1925048828125,
-0.323486328125,
0.97509765625,
0.595703125,
0.68701171875,
1.2216796875,
-0.0267181396484375,
0.2578125,
0.407958984375,
-0.3330078125,
0.1968994140625,
0.09124755859375,
1.068359375,
0.473876953125,
0.24658203125,
0.3388671875,
-0.0670166015625,
-0.8369140625,
-0.498779296875,
-0.10101318359375,
1.01953125,
-0.9736328125,
0.286865234375,
0.5205078125,
0.1900634765625,
-0.6435546875,
-0.22021484375,
0.438232421875,
-1.4072265625,
-0.4912109375,
1.0029296875,
-0.1536865234375,
0.7822265625,
-0.3134765625,
-0.232177734375,
0.482177734375,
1.228515625,
-0.06256103515625,
-0.298583984375,
0.65185546875,
-0.1514892578125,
-0.341552734375,
0.255126953125,
0.2265625,
-0.409423828125,
-0.83447265625,
0.68505859375,
-0.55712890625,
0.1136474609375,
0.227294921875,
0.61376953125,
0.481201171875,
0.39892578125,
-0.2425537109375,
-0.2239990234375,
0.14306640625,
1.3212890625,
0.195068359375,
0.323974609375,
0.15185546875,
0.96435546875,
0.04534912109375,
1.0078125,
0.16552734375,
0.1251220703125,
0.8076171875,
0.7041015625,
0.2454833984375,
0.377685546875,
-0.0867919921875,
0.073486328125,
0.32470703125,
0.474609375,
0.153076171875,
0.51904296875,
-0.0224151611328125,
-0.13134765625,
-0.60546875,
0.442138671875,
-0.09368896484375,
0.66552734375,
0.513671875,
0.436279296875,
-0.447509765625,
-0.09637451171875,
0.459228515625,
1.015625,
-0.62646484375,
-0.390380859375,
0.472900390625,
-0.1630859375,
0.435791015625,
0.184326171875,
-0.09130859375,
0.377685546875,
0.1905517578125,
-0.038421630859375,
-0.52685546875,
-0.6435546875,
-0.81494140625,
-0.6171875,
-1.267578125,
-0.37841796875,
-0.75537109375,
0.1402587890625,
0.448974609375,
-1.349609375,
0.287841796875,
-0.351806640625,
-0.30517578125,
0.41162109375,
-0.5615234375,
0.55859375,
-0.0518798828125,
0.95947265625,
-1.013671875,
0.5732421875,
-0.045562744140625,
1.0439453125,
-0.82470703125,
-0.021636962890625,
-0.521484375,
-0.79833984375,
0.341064453125,
0.4208984375,
0.387451171875,
-0.330078125,
-0.91552734375,
-0.75341796875,
-0.271728515625,
0.2034912109375,
-0.40576171875,
0.484619140625,
-0.8896484375,
0.64111328125,
0.28564453125,
-0.5498046875,
0.6953125,
0.68603515625,
-0.57177734375,
0.67431640625,
0.17724609375,
0.061126708984375,
-0.96826171875,
1.8359375,
0.3017578125,
0.11773681640625,
-0.46240234375,
-0.232421875,
-0.63720703125,
-0.1263427734375,
0.204833984375,
-0.46484375,
-0.0765380859375,
0.69189453125,
0.2900390625,
-1.0302734375,
0.52001953125,
-1.1025390625,
-0.5859375,
-0.076904296875,
-0.54541015625,
1.0654296875,
0.72119140625,
0.1734619140625,
-0.48193359375,
0.1214599609375,
-0.51904296875,
0.646484375,
0.0411376953125,
-0.2264404296875,
-0.1585693359375,
0.9375,
-0.043731689453125,
0.49951171875,
-0.3837890625,
-0.3251953125,
-0.3818359375,
-0.658203125,
0.30859375,
0.1875,
0.11724853515625,
0.193603515625,
0.197509765625,
0.97265625,
-0.8779296875,
-0.78271484375,
-0.1588134765625,
0.56640625,
0.285888671875,
0.71337890625,
0.436767578125,
-0.2230224609375,
-0.529296875,
-0.68310546875,
0.2137451171875,
0.18408203125,
0.77392578125,
-0.4716796875,
0.42724609375,
0.2032470703125,
-0.5810546875,
0.2235107421875,
-0.89453125,
-0.2127685546875,
0.7978515625,
0.017425537109375,
1.109375,
-0.491455078125,
0.316650390625,
-0.311767578125,
0.1434326171875,
0.8388671875,
0.1368408203125,
0.274658203125,
-0.35205078125,
-0.27587890625,
-0.138427734375,
-0.298095703125,
0.1097412109375,
-0.59521484375,
0.2052001953125,
-0.3095703125,
-0.356201171875,
-1.0361328125,
0.99169921875,
0.5576171875,
0.426513671875,
0.260498046875,
0.833984375,
-0.09002685546875,
0.281494140625,
0.71533203125,
-0.333740234375,
0.191162109375,
-0.57763671875,
0.72607421875,
-0.085693359375,
-0.2205810546875,
-0.658203125,
-0.251953125,
-0.052947998046875,
-0.118408203125,
0.2978515625,
-0.25,
-0.79443359375,
0.4921875,
0.708984375,
0.646484375,
-1.138671875,
0.1314697265625,
-0.312255859375,
0.65185546875,
0.49755859375,
-0.93896484375,
0.35205078125,
-0.6552734375,
0.61962890625,
0.8720703125,
-0.299072265625,
-0.662109375,
-0.425048828125,
-0.73388671875,
-0.303955078125,
0.1971435546875,
0.85888671875,
-0.05535888671875,
0.5146484375,
-0.99365234375,
0.42236328125,
0.6572265625,
-0.12744140625,
-0.08673095703125,
-0.167724609375,
-0.00604248046875,
0.0716552734375,
0.55029296875,
-0.20654296875,
-0.56640625,
0.2587890625,
-1.2783203125,
0.1590576171875,
-0.4951171875,
0.07989501953125,
0.08984375,
0.2110595703125,
-0.2445068359375,
0.54296875,
-0.263916015625,
0.052093505859375,
-0.09814453125,
0.476806640625,
-1.193359375,
-0.77734375,
0.69189453125,
-0.29638671875,
0.025909423828125,
0.68017578125,
-0.002094268798828125,
-0.2529296875,
0.1973876953125,
0.387939453125,
-0.434814453125,
0.0645751953125,
-0.70166015625,
0.453125,
-0.27783203125,
-0.6005859375,
-0.476806640625,
-0.73828125,
0.8447265625,
0.11297607421875,
-0.81689453125,
-0.34765625,
-1.2529296875,
-0.09564208984375,
0.019012451171875,
-0.4296875,
0.5029296875,
-0.1483154296875,
-0.03997802734375,
0.036041259765625,
-0.33203125,
-0.387451171875,
-0.376708984375,
-0.63623046875,
-0.4033203125,
0.6103515625,
0.64501953125,
1.0009765625,
0.0201263427734375,
-0.5166015625,
0.12103271484375,
-0.1004638671875,
-0.0792236328125,
-0.6943359375,
0.39892578125,
-0.1759033203125,
-0.2197265625,
-0.3525390625,
0.270751953125,
-0.1312255859375,
0.291015625,
1.01171875,
0.148681640625,
0.6591796875,
0.0858154296875,
-0.76025390625,
1.056640625,
0.0012454986572265625,
-1.1220703125,
-0.6015625,
0.355224609375,
-0.048583984375,
0.64599609375,
0.3369140625,
-0.79345703125,
-0.82861328125,
-0.8388671875,
0.41455078125,
-0.65966796875,
0.06707763671875,
-0.6103515625,
-0.250732421875,
-0.3662109375,
0.8203125,
0.12042236328125,
-0.6376953125,
-0.489501953125,
-0.93994140625,
0.35498046875,
-0.33984375,
-0.377197265625,
-1.1162109375,
-0.6064453125,
-0.5419921875,
0.7548828125,
-0.0204010009765625,
0.1546630859375,
-0.46533203125,
-0.1383056640625,
0.353271484375,
-0.2327880859375,
-0.5869140625,
-0.53662109375,
0.21044921875,
0.370361328125,
-0.27783203125,
0.11834716796875,
-0.4853515625,
0.46435546875,
-0.86767578125,
0.1845703125,
-0.35791015625,
-0.302001953125,
0.0245208740234375,
-0.59130859375,
1.263671875,
-0.388671875,
-0.0665283203125,
-0.149658203125,
0.494140625,
0.467041015625,
-0.340576171875,
-0.51025390625,
-0.97021484375,
-0.63427734375,
-1.0732421875,
0.65625,
-0.7021484375,
-0.1978759765625,
-0.143798828125,
0.042633056640625,
0.88427734375,
-0.57080078125,
0.7265625,
1.1875,
0.34619140625,
-0.2208251953125,
-1.0712890625,
1.0146484375,
0.76513671875,
-0.87744140625,
0.1544189453125,
0.188232421875,
-0.42919921875,
0.00006073713302612305,
-0.0963134765625,
-1.0966796875,
-0.65625,
0.335205078125,
1.3017578125,
-0.09783935546875,
0.81689453125,
0.24853515625,
-0.98681640625,
-0.63427734375,
0.9423828125,
-0.129638671875,
0.5478515625,
1.1044921875,
0.42236328125,
-0.1964111328125,
0.002933502197265625,
0.275634765625,
-0.45849609375,
-0.1136474609375,
0.95263671875,
0.0204925537109375,
-0.640625,
0.1265869140625,
1.0078125,
-1.1474609375,
-0.8759765625,
0.03125,
0.22216796875,
-0.07476806640625,
-0.464111328125,
0.10711669921875,
0.2269287109375,
-0.525390625,
-0.0980224609375,
0.521484375,
-0.0030269622802734375,
0.241943359375,
0.18994140625,
0.34033203125,
-0.365234375,
0.49951171875,
0.9287109375,
-0.521484375,
-0.42333984375,
-0.8232421875,
-0.1123046875,
-0.47265625,
0.09356689453125,
0.75537109375,
-0.56298828125,
0.04278564453125,
0.61865234375,
-0.341796875,
0.6220703125,
-0.2464599609375,
-0.419677734375,
0.313232421875,
-0.916015625,
-0.66845703125,
-0.06201171875,
0.38671875,
-0.04248046875,
0.1048583984375,
-0.339599609375,
0.464111328125,
0.41455078125,
0.306640625,
-0.004238128662109375,
-1.0830078125,
-0.333251953125,
-0.927734375,
-0.7724609375,
-0.57958984375,
-0.3427734375,
-0.388916015625,
-0.0855712890625,
0.05303955078125,
-0.62353515625,
0.191162109375,
0.25732421875,
-0.59619140625,
0.84375,
-0.44189453125,
0.349609375,
-0.54296875,
-0.61962890625,
-0.414306640625,
-0.1597900390625,
-0.038116455078125,
0.1136474609375,
-0.38134765625,
0.31884765625,
-0.12274169921875,
0.90625,
0.0217742919921875,
0.2027587890625,
-0.6181640625,
-0.33740234375,
0.1942138671875,
0.207763671875,
-0.396240234375,
0.81640625,
0.3095703125,
-0.1141357421875,
0.2344970703125,
-0.447998046875,
-0.25244140625,
-0.267333984375,
0.5634765625,
0.38818359375,
-0.463623046875,
-0.262451171875,
-0.35888671875,
0.053924560546875,
-1.0693359375,
0.46044921875,
-0.3037109375,
-0.09375,
0.4404296875,
-0.1458740234375,
0.36669921875,
0.94140625,
-0.0830078125,
0.5009765625,
0.14208984375,
0.2666015625,
0.45947265625,
0.0126800537109375,
0.2587890625,
0.314453125,
-0.14990234375,
-0.1339111328125,
0.112060546875,
0.439208984375,
-0.12384033203125,
0.1595458984375,
0.04315185546875,
-0.72509765625,
-1.0126953125,
-0.45947265625,
-0.273681640625,
0.39794921875,
0.76220703125,
-0.515625,
-0.248291015625,
0.25537109375,
-0.59130859375,
0.51611328125,
-0.98876953125,
-0.62841796875,
0.83642578125,
-0.089599609375,
-0.591796875,
-0.44189453125,
-0.407470703125,
-0.042449951171875,
0.1475830078125,
0.490478515625,
-0.2476806640625,
0.413330078125,
-0.264404296875,
0.7802734375,
0.130126953125,
-0.2060546875,
-0.354248046875,
0.2109375,
-0.6298828125,
-0.274658203125,
0.251708984375,
0.92236328125,
0.327880859375,
-0.0287017822265625,
-0.8486328125,
0.11279296875,
-0.388427734375,
0.1058349609375,
-0.55078125,
-0.2015380859375,
-0.5947265625,
0.35107421875,
-0.40625,
0.5556640625,
-0.21044921875,
0.5751953125,
0.28759765625,
-0.49853515625,
-0.6630859375,
0.59521484375,
0.57275390625,
-0.375,
0.372802734375,
0.174560546875,
0.2222900390625,
0.0195770263671875,
-0.0162506103515625,
-0.02655029296875,
0.415771484375,
0.481201171875,
0.99462890625,
-0.0458984375,
0.2578125,
0.6884765625,
0.1412353515625,
0.0657958984375,
0.1397705078125,
0.24462890625,
0.3837890625,
0.093994140625,
-0.095947265625,
-0.22998046875,
-0.1993408203125,
-0.490478515625,
0.2408447265625,
-0.471923828125,
-0.26318359375,
-0.82861328125,
-0.57763671875,
0.46142578125,
-0.179931640625,
-0.088623046875,
0.0248565673828125,
-0.6728515625,
0.34814453125,
0.76708984375,
-0.09564208984375,
-0.13037109375,
0.69287109375,
0.646484375,
0.47021484375,
0.5546875,
0.359619140625,
0.29052734375,
-0.60595703125,
0.52783203125,
-0.1397705078125,
-0.12066650390625,
-0.3505859375,
-0.34521484375,
-0.57763671875,
0.337158203125,
-0.11358642578125,
-0.32421875,
0.311767578125,
-0.47802734375,
0.12274169921875,
-0.373291015625,
0.287109375,
-0.94921875,
0.2027587890625,
0.281494140625,
-0.2861328125,
-0.80126953125,
0.75439453125,
-0.1851806640625,
0.3271484375,
0.412353515625,
0.8740234375,
-0.05902099609375,
1.40234375,
0.5302734375,
0.1671142578125,
-0.357421875,
0.4443359375,
-0.193603515625,
-0.697265625,
-0.21044921875,
-0.57421875,
0.00396728515625,
-0.60791015625,
-0.5400390625,
0.189453125,
0.74169921875,
-0.08258056640625,
-0.935546875,
0.1875,
0.491455078125,
-0.81298828125,
0.83837890625,
0.5771484375,
0.6748046875,
-0.02252197265625,
0.221923828125,
-0.149658203125,
-0.73095703125,
-0.127685546875,
-0.78564453125,
0.52734375,
-0.69580078125,
-0.82763671875,
-0.312255859375,
-0.96142578125,
-0.17919921875,
-0.0198822021484375,
-0.36376953125,
-0.83740234375,
0.71484375,
0.468017578125,
0.463134765625,
0.1630859375,
-0.12286376953125,
-0.138916015625,
0.9296875,
0.80908203125,
0.200927734375,
0.9189453125,
0.59130859375,
-1.048828125,
0.1123046875,
-1.0390625,
0.477783203125,
0.1336669921875,
-0.1368408203125,
-0.390380859375,
0.2000732421875,
-0.6982421875,
-1.296875,
0.372802734375,
1.099609375,
0.44189453125,
-0.517578125,
-1.2822265625,
-0.19970703125,
-0.765625,
-0.267333984375,
-0.327880859375,
0.29443359375,
-0.3955078125,
-0.0001418590545654297,
-0.1478271484375,
-1.0419921875,
4.32421875,
1.0966796875,
0.94677734375,
0.57861328125,
0.498779296875,
0.71875,
0.446533203125,
-0.54931640625,
-0.122802734375,
-0.58203125,
0.6044921875,
-0.59033203125,
-0.1116943359375,
0.89794921875,
0.323974609375,
0.43798828125,
-0.35009765625,
0.5439453125,
-0.3623046875,
-0.8876953125,
-0.88330078125,
0.2705078125,
0.056396484375,
0.72412109375,
-0.0360107421875,
0.315673828125,
0.443603515625,
-0.8583984375,
0.011444091796875,
-0.50634765625,
-0.180419921875,
-0.61328125,
0.921875,
-0.147705078125,
-0.1756591796875,
0.5595703125,
-0.295166015625,
-0.736328125,
0.0848388671875,
0.4404296875,
-0.2364501953125,
0.052886962890625,
1.1708984375,
-0.4609375,
-0.079345703125,
0.869140625,
-0.8525390625,
0.318359375,
0.5732421875,
-0.80908203125,
1.2568359375,
-0.37841796875,
0.62060546875,
-0.6142578125,
-0.640625,
0.27392578125,
0.06488037109375,
-0.314453125,
-0.45654296875,
0.77001953125,
0.32177734375,
0.4296875,
-0.11492919921875,
0.2149658203125,
-0.9931640625,
1.125,
-0.2366943359375,
0.6181640625,
-0.65673828125,
-0.35986328125,
-0.218017578125,
-0.298583984375,
-0.307861328125,
-0.78662109375,
0.97314453125,
0.0826416015625,
-0.420654296875,
0.299072265625,
0.10638427734375,
-1.005859375,
0.281982421875,
-0.253173828125,
-0.654296875,
-0.33056640625,
0.5419921875,
0.76025390625,
-0.6953125,
-0.26171875,
-0.2235107421875,
0.7392578125,
0.439208984375,
0.3955078125,
0.322998046875,
-0.724609375,
0.0179901123046875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a mysterious language (codenamed "Secret") available in "Custom Invocation" tab. Figure out what this language is and write a program which prints its name. Note that the program must be written in this language.
Input
This program has only one test (your program doesn't have to read anything).
Output
Output the name of the mysterious language. Note that the name is case-sensitive and might contain digits and special characters.
Examples
Note
Some scientists disagree on what should be considered as a language and what should be considered as a dialect.
Tags: *special
Correct Solution:
```
print("INTERCAL")
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 1
```
| 43,331
|
[
0.45458984375,
-0.15869140625,
-0.305908203125,
-0.08160400390625,
-0.1513671875,
-0.423095703125,
-0.11053466796875,
0.061798095703125,
-0.2470703125,
0.541015625,
0.671875,
0.1951904296875,
0.15380859375,
-0.9072265625,
-0.69970703125,
0.1533203125,
-0.4248046875,
-0.97314453125,
-0.361572265625,
-0.293701171875,
-0.07757568359375,
0.035675048828125,
-1.6875,
-0.331298828125,
-0.564453125,
0.6806640625,
0.412353515625,
-0.2093505859375,
0.41943359375,
1.0986328125,
-0.396240234375,
-0.2242431640625,
0.337158203125,
-1.1357421875,
-0.294921875,
-0.7861328125,
1.095703125,
-0.9677734375,
-0.374755859375,
-0.4453125,
-0.32666015625,
0.00778961181640625,
0.199951171875,
-0.71630859375,
-1.197265625,
0.2103271484375,
-0.6572265625,
-0.34912109375,
0.05096435546875,
-0.2401123046875,
0.68994140625,
0.1553955078125,
0.313232421875,
-0.059600830078125,
-0.1630859375,
-0.049957275390625,
-0.170654296875,
-0.1429443359375,
-0.58251953125,
-0.08050537109375,
-0.12420654296875,
0.2308349609375,
0.1072998046875,
-0.94482421875,
-0.14892578125,
0.40185546875,
0.01413726806640625,
-0.1363525390625,
-0.0687255859375,
-0.3564453125,
0.081787109375,
0.60205078125,
-0.292236328125,
-0.43017578125,
-0.69384765625,
-0.2232666015625,
0.1641845703125,
0.2484130859375,
-0.56103515625,
0.210205078125,
0.351806640625,
1.0498046875,
0.0399169921875,
0.1708984375,
-0.1873779296875,
-0.56982421875,
-0.046478271484375,
0.12237548828125,
0.2841796875,
-0.1807861328125,
0.261474609375,
0.5546875,
-0.763671875,
-0.1812744140625,
0.89013671875,
0.2347412109375,
-0.2255859375,
0.328857421875,
0.19140625,
0.333984375,
1.0302734375,
1.076171875,
-0.76708984375,
0.85791015625,
-0.1951904296875,
0.3564453125,
0.1524658203125,
0.5576171875,
0.18798828125,
-0.2158203125,
-0.156494140625,
-0.73486328125,
0.43505859375,
-0.136474609375,
0.01171112060546875,
0.81298828125,
-0.1702880859375,
0.280029296875,
-1.083984375,
0.060516357421875,
0.2110595703125,
-0.385986328125,
0.376953125,
-0.53662109375,
0.026885986328125,
-0.047393798828125,
-0.432861328125,
1.064453125,
-0.391845703125,
-0.0340576171875,
0.70849609375,
-0.2113037109375,
-0.2359619140625,
0.6953125,
-0.03662109375,
0.64892578125,
-0.09478759765625,
0.67578125,
0.37744140625,
-0.91015625,
0.41259765625,
-0.1876220703125,
0.1595458984375,
1.365234375,
0.5732421875,
-0.042724609375,
0.71240234375,
0.388916015625,
-0.78125,
0.55908203125,
-0.634765625,
0.5869140625,
0.2352294921875,
0.27490234375,
-0.341064453125,
-0.06402587890625,
-0.443603515625,
0.1485595703125,
0.1907958984375,
0.32470703125,
-0.024993896484375,
0.61083984375,
-0.11676025390625,
0.92822265625,
-0.0015211105346679688,
0.89697265625,
-0.6474609375,
-0.310546875,
-0.1212158203125,
-0.529296875,
-0.0269927978515625,
-0.2340087890625,
-0.334716796875,
0.9677734375,
0.58984375,
0.6943359375,
1.185546875,
0.05047607421875,
0.2763671875,
0.41845703125,
-0.271728515625,
0.2315673828125,
0.09722900390625,
1.0966796875,
0.4638671875,
0.2108154296875,
0.311767578125,
-0.10491943359375,
-0.83642578125,
-0.472900390625,
-0.1102294921875,
1.107421875,
-0.923828125,
0.28271484375,
0.5146484375,
0.1671142578125,
-0.658203125,
-0.181396484375,
0.3759765625,
-1.4345703125,
-0.471435546875,
1.029296875,
-0.1412353515625,
0.77490234375,
-0.311279296875,
-0.1861572265625,
0.442138671875,
1.2392578125,
-0.044219970703125,
-0.263671875,
0.63427734375,
-0.150390625,
-0.29541015625,
0.25390625,
0.182861328125,
-0.394775390625,
-0.8486328125,
0.7294921875,
-0.5263671875,
0.145751953125,
0.191162109375,
0.6435546875,
0.4912109375,
0.412353515625,
-0.23486328125,
-0.2352294921875,
0.1812744140625,
1.310546875,
0.1881103515625,
0.345703125,
0.23486328125,
1.021484375,
0.083251953125,
0.9853515625,
0.1658935546875,
0.12225341796875,
0.77880859375,
0.68310546875,
0.2498779296875,
0.32763671875,
-0.130859375,
0.057769775390625,
0.322265625,
0.459228515625,
0.14697265625,
0.556640625,
0.0034542083740234375,
-0.1397705078125,
-0.61181640625,
0.46337890625,
-0.1588134765625,
0.6806640625,
0.54052734375,
0.476318359375,
-0.4921875,
-0.1455078125,
0.484375,
1.0126953125,
-0.62158203125,
-0.474609375,
0.457763671875,
-0.1798095703125,
0.43896484375,
0.15380859375,
-0.085205078125,
0.3916015625,
0.18310546875,
0.017822265625,
-0.51123046875,
-0.63427734375,
-0.86181640625,
-0.59423828125,
-1.28515625,
-0.353515625,
-0.74169921875,
0.1685791015625,
0.455810546875,
-1.375,
0.268310546875,
-0.31298828125,
-0.2890625,
0.414794921875,
-0.5234375,
0.59033203125,
-0.026641845703125,
0.95556640625,
-0.99755859375,
0.5966796875,
-0.05242919921875,
1.05078125,
-0.82275390625,
-0.03643798828125,
-0.52587890625,
-0.79296875,
0.33984375,
0.449951171875,
0.407958984375,
-0.251220703125,
-0.84326171875,
-0.7763671875,
-0.27587890625,
0.1826171875,
-0.392333984375,
0.46630859375,
-0.91943359375,
0.68603515625,
0.307373046875,
-0.541015625,
0.6943359375,
0.63623046875,
-0.59521484375,
0.7041015625,
0.1688232421875,
0.14794921875,
-0.93798828125,
1.8017578125,
0.2646484375,
0.12646484375,
-0.50732421875,
-0.26220703125,
-0.66796875,
-0.1397705078125,
0.177734375,
-0.456787109375,
-0.0697021484375,
0.6513671875,
0.2890625,
-1.0322265625,
0.491943359375,
-1.1630859375,
-0.57373046875,
-0.12225341796875,
-0.53564453125,
1.0859375,
0.76025390625,
0.1689453125,
-0.529296875,
0.057861328125,
-0.5673828125,
0.63525390625,
0.037017822265625,
-0.27197265625,
-0.11444091796875,
1.0126953125,
-0.06011962890625,
0.5107421875,
-0.305908203125,
-0.319091796875,
-0.321533203125,
-0.6572265625,
0.28955078125,
0.1763916015625,
0.149658203125,
0.141357421875,
0.2303466796875,
0.966796875,
-0.85888671875,
-0.78125,
-0.16796875,
0.53759765625,
0.260498046875,
0.681640625,
0.45703125,
-0.2437744140625,
-0.52392578125,
-0.64404296875,
0.25244140625,
0.18017578125,
0.7607421875,
-0.48876953125,
0.44775390625,
0.2469482421875,
-0.6201171875,
0.2088623046875,
-0.86083984375,
-0.1943359375,
0.8251953125,
-0.0299224853515625,
1.0576171875,
-0.5263671875,
0.340087890625,
-0.262939453125,
0.1400146484375,
0.83984375,
0.2078857421875,
0.28955078125,
-0.361083984375,
-0.286376953125,
-0.1737060546875,
-0.2939453125,
0.08465576171875,
-0.5732421875,
0.1546630859375,
-0.401611328125,
-0.428466796875,
-1.04296875,
0.931640625,
0.55517578125,
0.462890625,
0.26904296875,
0.8681640625,
-0.130859375,
0.3037109375,
0.74072265625,
-0.343017578125,
0.216552734375,
-0.63427734375,
0.7431640625,
-0.1021728515625,
-0.252685546875,
-0.58203125,
-0.29541015625,
-0.125244140625,
-0.2034912109375,
0.325927734375,
-0.281494140625,
-0.7734375,
0.4560546875,
0.72998046875,
0.56640625,
-1.1171875,
0.2030029296875,
-0.291748046875,
0.66357421875,
0.45947265625,
-0.93603515625,
0.34765625,
-0.69921875,
0.5947265625,
0.869140625,
-0.283935546875,
-0.6513671875,
-0.39599609375,
-0.69970703125,
-0.29736328125,
0.1612548828125,
0.81640625,
-0.00969696044921875,
0.498779296875,
-0.97265625,
0.4267578125,
0.65234375,
-0.2269287109375,
-0.099609375,
-0.146240234375,
-0.01175689697265625,
0.039642333984375,
0.5908203125,
-0.220947265625,
-0.556640625,
0.2218017578125,
-1.2412109375,
0.1177978515625,
-0.54638671875,
0.07781982421875,
0.1531982421875,
0.1767578125,
-0.181396484375,
0.4970703125,
-0.2509765625,
0.06378173828125,
-0.1318359375,
0.475830078125,
-1.201171875,
-0.7744140625,
0.69189453125,
-0.274169921875,
0.046966552734375,
0.62353515625,
-0.033477783203125,
-0.227783203125,
0.20556640625,
0.37451171875,
-0.437744140625,
0.050201416015625,
-0.7099609375,
0.488037109375,
-0.2763671875,
-0.55078125,
-0.479736328125,
-0.70556640625,
0.8154296875,
0.1328125,
-0.82763671875,
-0.316162109375,
-1.2353515625,
-0.102294921875,
0.0168609619140625,
-0.43994140625,
0.4736328125,
-0.153076171875,
-0.02301025390625,
0.06500244140625,
-0.3251953125,
-0.444580078125,
-0.4189453125,
-0.63720703125,
-0.42041015625,
0.62744140625,
0.65625,
1.0146484375,
0.032440185546875,
-0.48486328125,
0.0860595703125,
-0.112060546875,
-0.035430908203125,
-0.68505859375,
0.376220703125,
-0.1683349609375,
-0.21728515625,
-0.345458984375,
0.291748046875,
-0.1195068359375,
0.288818359375,
0.98779296875,
0.1285400390625,
0.63427734375,
0.029510498046875,
-0.7841796875,
1.091796875,
-0.006805419921875,
-1.189453125,
-0.56689453125,
0.325927734375,
-0.028594970703125,
0.63134765625,
0.34130859375,
-0.7529296875,
-0.85546875,
-0.82861328125,
0.4169921875,
-0.66650390625,
0.04498291015625,
-0.65185546875,
-0.267333984375,
-0.3486328125,
0.81640625,
0.08673095703125,
-0.5888671875,
-0.5146484375,
-0.958984375,
0.30517578125,
-0.393798828125,
-0.313232421875,
-1.091796875,
-0.591796875,
-0.53076171875,
0.783203125,
-0.01435089111328125,
0.1495361328125,
-0.4189453125,
-0.12890625,
0.30078125,
-0.21484375,
-0.6083984375,
-0.53125,
0.197998046875,
0.384521484375,
-0.296142578125,
0.12139892578125,
-0.5009765625,
0.478515625,
-0.89013671875,
0.16552734375,
-0.335205078125,
-0.31201171875,
0.0391845703125,
-0.51513671875,
1.23046875,
-0.3955078125,
-0.1029052734375,
-0.0787353515625,
0.490478515625,
0.46337890625,
-0.359130859375,
-0.53271484375,
-0.9853515625,
-0.66259765625,
-1.1201171875,
0.654296875,
-0.71240234375,
-0.14453125,
-0.131103515625,
0.02734375,
0.853515625,
-0.576171875,
0.720703125,
1.1806640625,
0.3603515625,
-0.181640625,
-1.0146484375,
1.01171875,
0.7568359375,
-0.90283203125,
0.11236572265625,
0.2127685546875,
-0.447998046875,
-0.0355224609375,
-0.12408447265625,
-1.087890625,
-0.6748046875,
0.31396484375,
1.2431640625,
-0.05780029296875,
0.8095703125,
0.250244140625,
-1.029296875,
-0.64697265625,
0.921875,
-0.07513427734375,
0.56591796875,
1.0537109375,
0.40966796875,
-0.2147216796875,
0.0361328125,
0.302001953125,
-0.44384765625,
-0.1356201171875,
0.9833984375,
0.0190582275390625,
-0.66552734375,
0.1865234375,
1.021484375,
-1.138671875,
-0.908203125,
0.0203094482421875,
0.1678466796875,
-0.059600830078125,
-0.4853515625,
0.096923828125,
0.25146484375,
-0.50048828125,
-0.1217041015625,
0.55517578125,
0.0069427490234375,
0.2401123046875,
0.2197265625,
0.35595703125,
-0.408935546875,
0.51806640625,
0.96240234375,
-0.5048828125,
-0.413818359375,
-0.82861328125,
-0.1285400390625,
-0.411376953125,
0.09039306640625,
0.7353515625,
-0.5400390625,
0.11651611328125,
0.626953125,
-0.337158203125,
0.63916015625,
-0.3125,
-0.475830078125,
0.3515625,
-0.83447265625,
-0.6640625,
-0.1060791015625,
0.412353515625,
-0.06304931640625,
0.16064453125,
-0.274658203125,
0.4033203125,
0.416259765625,
0.310791015625,
-0.04156494140625,
-1.12109375,
-0.391357421875,
-0.96630859375,
-0.72265625,
-0.5966796875,
-0.344970703125,
-0.39453125,
-0.08831787109375,
0.07098388671875,
-0.62548828125,
0.1658935546875,
0.263916015625,
-0.59619140625,
0.8134765625,
-0.4189453125,
0.334228515625,
-0.56982421875,
-0.59814453125,
-0.40478515625,
-0.146240234375,
-0.047576904296875,
0.10546875,
-0.38525390625,
0.33544921875,
-0.077392578125,
0.89794921875,
-0.002777099609375,
0.31884765625,
-0.65185546875,
-0.276611328125,
0.1431884765625,
0.1661376953125,
-0.405517578125,
0.8349609375,
0.31591796875,
-0.09161376953125,
0.2578125,
-0.465576171875,
-0.29296875,
-0.319580078125,
0.5693359375,
0.3857421875,
-0.445068359375,
-0.267333984375,
-0.384033203125,
0.1016845703125,
-1.1220703125,
0.406494140625,
-0.3544921875,
-0.07928466796875,
0.47607421875,
-0.1727294921875,
0.348388671875,
0.9345703125,
-0.0838623046875,
0.52197265625,
0.178466796875,
0.276123046875,
0.480712890625,
0.0102996826171875,
0.2447509765625,
0.3720703125,
-0.160888671875,
-0.1651611328125,
0.146728515625,
0.406005859375,
-0.07366943359375,
0.162109375,
-0.0232391357421875,
-0.73876953125,
-1.0068359375,
-0.467041015625,
-0.2188720703125,
0.456298828125,
0.75048828125,
-0.52587890625,
-0.197509765625,
0.2386474609375,
-0.5673828125,
0.461669921875,
-0.99267578125,
-0.62109375,
0.87841796875,
-0.08770751953125,
-0.5751953125,
-0.445068359375,
-0.433837890625,
-0.06353759765625,
0.213623046875,
0.5029296875,
-0.259033203125,
0.402587890625,
-0.32275390625,
0.7841796875,
0.10748291015625,
-0.27587890625,
-0.362548828125,
0.203857421875,
-0.67578125,
-0.28955078125,
0.25390625,
0.908203125,
0.353759765625,
-0.0518798828125,
-0.89404296875,
0.100830078125,
-0.415771484375,
0.06732177734375,
-0.57177734375,
-0.1669921875,
-0.5517578125,
0.35791015625,
-0.40283203125,
0.556640625,
-0.09405517578125,
0.54638671875,
0.3564453125,
-0.441650390625,
-0.6689453125,
0.55712890625,
0.5732421875,
-0.34619140625,
0.421630859375,
0.1600341796875,
0.23486328125,
0.041046142578125,
0.011199951171875,
-0.055084228515625,
0.472900390625,
0.5029296875,
0.9814453125,
-0.07159423828125,
0.2744140625,
0.6376953125,
0.1761474609375,
0.077392578125,
0.1710205078125,
0.250732421875,
0.306640625,
0.136474609375,
-0.167724609375,
-0.2327880859375,
-0.1793212890625,
-0.478271484375,
0.249755859375,
-0.417236328125,
-0.250244140625,
-0.78857421875,
-0.56494140625,
0.5400390625,
-0.203125,
-0.11798095703125,
-0.01123809814453125,
-0.66552734375,
0.36181640625,
0.7392578125,
-0.0751953125,
-0.1278076171875,
0.71435546875,
0.60107421875,
0.457275390625,
0.53564453125,
0.3203125,
0.2646484375,
-0.62109375,
0.5517578125,
-0.08807373046875,
-0.1702880859375,
-0.328125,
-0.39599609375,
-0.61181640625,
0.354248046875,
-0.12408447265625,
-0.342529296875,
0.322265625,
-0.51416015625,
0.1492919921875,
-0.345947265625,
0.32080078125,
-0.94384765625,
0.2113037109375,
0.2491455078125,
-0.2449951171875,
-0.7451171875,
0.75732421875,
-0.1976318359375,
0.380126953125,
0.3662109375,
0.93798828125,
-0.1064453125,
1.4365234375,
0.49462890625,
0.1680908203125,
-0.318603515625,
0.409423828125,
-0.1943359375,
-0.66796875,
-0.1954345703125,
-0.58056640625,
-0.0226593017578125,
-0.6396484375,
-0.517578125,
0.12457275390625,
0.74853515625,
-0.07879638671875,
-0.916015625,
0.1943359375,
0.50341796875,
-0.82666015625,
0.88232421875,
0.55712890625,
0.720703125,
-0.0625,
0.2371826171875,
-0.1488037109375,
-0.78076171875,
-0.114501953125,
-0.71533203125,
0.5751953125,
-0.6494140625,
-0.8173828125,
-0.280029296875,
-0.97314453125,
-0.213134765625,
-0.08038330078125,
-0.331298828125,
-0.8173828125,
0.72998046875,
0.50341796875,
0.439453125,
0.186767578125,
-0.08416748046875,
-0.182373046875,
0.89990234375,
0.82470703125,
0.109130859375,
0.93017578125,
0.62646484375,
-1.0107421875,
0.126953125,
-1.013671875,
0.4521484375,
0.1263427734375,
-0.06890869140625,
-0.42041015625,
0.1903076171875,
-0.74609375,
-1.2734375,
0.42431640625,
1.078125,
0.451904296875,
-0.5419921875,
-1.2919921875,
-0.1700439453125,
-0.765625,
-0.268798828125,
-0.365234375,
0.31494140625,
-0.380615234375,
0.00948333740234375,
-0.123291015625,
-1.05078125,
4.31640625,
1.140625,
0.93017578125,
0.58447265625,
0.4990234375,
0.79052734375,
0.52685546875,
-0.6015625,
-0.08929443359375,
-0.56982421875,
0.58837890625,
-0.56298828125,
-0.10845947265625,
0.89599609375,
0.34619140625,
0.469970703125,
-0.374755859375,
0.5048828125,
-0.308837890625,
-0.8759765625,
-0.8603515625,
0.26904296875,
0.062744140625,
0.7392578125,
0.012298583984375,
0.268798828125,
0.529296875,
-0.822265625,
-0.04583740234375,
-0.5087890625,
-0.2080078125,
-0.5810546875,
0.8642578125,
-0.1204833984375,
-0.1944580078125,
0.53369140625,
-0.254638671875,
-0.77734375,
0.089599609375,
0.451171875,
-0.169677734375,
0.050872802734375,
1.1181640625,
-0.50146484375,
-0.11737060546875,
0.810546875,
-0.77001953125,
0.358642578125,
0.576171875,
-0.84521484375,
1.236328125,
-0.400390625,
0.58447265625,
-0.603515625,
-0.6162109375,
0.28271484375,
0.047393798828125,
-0.314208984375,
-0.453125,
0.7734375,
0.316162109375,
0.4208984375,
-0.10150146484375,
0.216796875,
-1.0302734375,
1.1396484375,
-0.296630859375,
0.62890625,
-0.65283203125,
-0.287841796875,
-0.284912109375,
-0.305419921875,
-0.360595703125,
-0.8193359375,
1.095703125,
0.0765380859375,
-0.414306640625,
0.285888671875,
0.0738525390625,
-0.96826171875,
0.242919921875,
-0.249755859375,
-0.57177734375,
-0.3056640625,
0.53515625,
0.76708984375,
-0.6591796875,
-0.261474609375,
-0.1923828125,
0.76171875,
0.46728515625,
0.42333984375,
0.32568359375,
-0.83935546875,
-0.0250091552734375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a mysterious language (codenamed "Secret") available in "Custom Invocation" tab. Figure out what this language is and write a program which prints its name. Note that the program must be written in this language.
Input
This program has only one test (your program doesn't have to read anything).
Output
Output the name of the mysterious language. Note that the name is case-sensitive and might contain digits and special characters.
Examples
Note
Some scientists disagree on what should be considered as a language and what should be considered as a dialect.
Tags: *special
Correct Solution:
```
n=input();print("INTERCAL")
```
| 43,332
|
[
0.44873046875,
-0.13916015625,
-0.305908203125,
-0.1446533203125,
-0.1474609375,
-0.407958984375,
-0.11029052734375,
0.09619140625,
-0.2259521484375,
0.61572265625,
0.73876953125,
0.1800537109375,
0.1502685546875,
-0.92578125,
-0.65478515625,
0.1778564453125,
-0.451171875,
-0.9619140625,
-0.40087890625,
-0.262939453125,
-0.07110595703125,
0.08917236328125,
-1.6162109375,
-0.36572265625,
-0.58984375,
0.626953125,
0.40625,
-0.31005859375,
0.34130859375,
1.111328125,
-0.417236328125,
-0.201171875,
0.255615234375,
-1.080078125,
-0.3134765625,
-0.78955078125,
1.0556640625,
-1.03515625,
-0.43212890625,
-0.386474609375,
-0.359619140625,
0.01751708984375,
0.2303466796875,
-0.7119140625,
-1.2138671875,
0.2335205078125,
-0.64404296875,
-0.3642578125,
0.097412109375,
-0.188720703125,
0.68408203125,
0.1824951171875,
0.34228515625,
-0.055755615234375,
-0.212646484375,
-0.051727294921875,
-0.137939453125,
-0.1397705078125,
-0.5703125,
-0.087158203125,
-0.055084228515625,
0.191162109375,
0.08038330078125,
-0.91162109375,
-0.10382080078125,
0.325927734375,
-0.061309814453125,
-0.1953125,
-0.093505859375,
-0.38134765625,
0.051788330078125,
0.55126953125,
-0.3662109375,
-0.397216796875,
-0.60888671875,
-0.166259765625,
0.2127685546875,
0.2369384765625,
-0.5087890625,
0.2376708984375,
0.384521484375,
1.0009765625,
-0.0540771484375,
0.1385498046875,
-0.220947265625,
-0.595703125,
-0.059539794921875,
0.0802001953125,
0.30615234375,
-0.1822509765625,
0.21484375,
0.58642578125,
-0.86083984375,
-0.147705078125,
0.8623046875,
0.2744140625,
-0.283447265625,
0.309326171875,
0.18994140625,
0.361572265625,
1.01171875,
1.1025390625,
-0.76806640625,
0.83837890625,
-0.17578125,
0.43359375,
0.1446533203125,
0.58984375,
0.181640625,
-0.225341796875,
-0.1219482421875,
-0.7666015625,
0.455810546875,
-0.175537109375,
-0.08331298828125,
0.794921875,
-0.10888671875,
0.32763671875,
-1.08203125,
0.0941162109375,
0.265380859375,
-0.40966796875,
0.31884765625,
-0.50439453125,
0.07208251953125,
-0.05224609375,
-0.479736328125,
1.0302734375,
-0.363037109375,
-0.0633544921875,
0.71337890625,
-0.1873779296875,
-0.2213134765625,
0.7001953125,
-0.020904541015625,
0.732421875,
-0.06964111328125,
0.67236328125,
0.371337890625,
-0.8564453125,
0.401611328125,
-0.14599609375,
0.1651611328125,
1.396484375,
0.62255859375,
0.04022216796875,
0.71435546875,
0.376708984375,
-0.7412109375,
0.56201171875,
-0.71337890625,
0.57568359375,
0.2374267578125,
0.31884765625,
-0.271240234375,
-0.053497314453125,
-0.439453125,
0.082275390625,
0.14453125,
0.390625,
-0.0227813720703125,
0.6572265625,
-0.06707763671875,
0.93115234375,
0.08154296875,
0.8515625,
-0.66748046875,
-0.3603515625,
-0.12005615234375,
-0.5458984375,
-0.049835205078125,
-0.1676025390625,
-0.299560546875,
0.95703125,
0.61279296875,
0.70703125,
1.2216796875,
-0.02392578125,
0.253662109375,
0.4228515625,
-0.346435546875,
0.22265625,
0.1080322265625,
1.048828125,
0.5224609375,
0.28173828125,
0.353515625,
-0.1016845703125,
-0.85791015625,
-0.482666015625,
-0.1102294921875,
1.00390625,
-0.95703125,
0.274169921875,
0.460693359375,
0.2149658203125,
-0.607421875,
-0.27734375,
0.4111328125,
-1.3984375,
-0.4609375,
0.98974609375,
-0.189453125,
0.78271484375,
-0.308837890625,
-0.17333984375,
0.478515625,
1.2099609375,
-0.07867431640625,
-0.325927734375,
0.6640625,
-0.11541748046875,
-0.31982421875,
0.2491455078125,
0.2017822265625,
-0.40478515625,
-0.86474609375,
0.68212890625,
-0.5078125,
0.0992431640625,
0.2347412109375,
0.60302734375,
0.4873046875,
0.420654296875,
-0.2120361328125,
-0.2406005859375,
0.1556396484375,
1.328125,
0.19091796875,
0.36083984375,
0.168212890625,
0.97509765625,
0.013427734375,
0.99609375,
0.1864013671875,
0.1151123046875,
0.79345703125,
0.71435546875,
0.2939453125,
0.373046875,
-0.08990478515625,
0.062164306640625,
0.3359375,
0.462890625,
0.09698486328125,
0.58447265625,
0.020751953125,
-0.115966796875,
-0.6650390625,
0.4462890625,
-0.113525390625,
0.69677734375,
0.50830078125,
0.4228515625,
-0.449462890625,
-0.0809326171875,
0.51025390625,
1.0224609375,
-0.60498046875,
-0.421630859375,
0.485595703125,
-0.1929931640625,
0.4267578125,
0.1319580078125,
-0.12176513671875,
0.36474609375,
0.2008056640625,
-0.0086822509765625,
-0.6083984375,
-0.59375,
-0.82666015625,
-0.62109375,
-1.283203125,
-0.353515625,
-0.78125,
0.076904296875,
0.44921875,
-1.3466796875,
0.25634765625,
-0.360595703125,
-0.364990234375,
0.36669921875,
-0.5810546875,
0.61279296875,
-0.0693359375,
1.00390625,
-1.0595703125,
0.57421875,
-0.05731201171875,
1.0546875,
-0.7880859375,
0.01561737060546875,
-0.46533203125,
-0.78955078125,
0.32421875,
0.366943359375,
0.391357421875,
-0.275390625,
-0.89453125,
-0.75634765625,
-0.29833984375,
0.2276611328125,
-0.363037109375,
0.52392578125,
-0.84033203125,
0.6171875,
0.3037109375,
-0.54150390625,
0.6767578125,
0.62939453125,
-0.58837890625,
0.68310546875,
0.162353515625,
0.019989013671875,
-0.994140625,
1.8203125,
0.299072265625,
0.1041259765625,
-0.480224609375,
-0.2254638671875,
-0.63037109375,
-0.1497802734375,
0.1893310546875,
-0.42138671875,
-0.047882080078125,
0.72412109375,
0.305419921875,
-1.0439453125,
0.4931640625,
-1.1064453125,
-0.52978515625,
-0.10107421875,
-0.52197265625,
1.150390625,
0.75830078125,
0.18994140625,
-0.488525390625,
0.10113525390625,
-0.5498046875,
0.6220703125,
0.060302734375,
-0.27587890625,
-0.1558837890625,
0.93994140625,
-0.051727294921875,
0.465087890625,
-0.352783203125,
-0.30126953125,
-0.3837890625,
-0.6005859375,
0.32177734375,
0.1607666015625,
0.17041015625,
0.1978759765625,
0.2296142578125,
0.9453125,
-0.8408203125,
-0.74755859375,
-0.155029296875,
0.5498046875,
0.315673828125,
0.73583984375,
0.41162109375,
-0.233642578125,
-0.54541015625,
-0.66259765625,
0.2139892578125,
0.2052001953125,
0.76904296875,
-0.4990234375,
0.424560546875,
0.250244140625,
-0.5712890625,
0.2120361328125,
-0.90478515625,
-0.24560546875,
0.7998046875,
0.01515960693359375,
1.1162109375,
-0.52978515625,
0.25537109375,
-0.305419921875,
0.1334228515625,
0.84423828125,
0.1231689453125,
0.2734375,
-0.3408203125,
-0.3134765625,
-0.10699462890625,
-0.2783203125,
0.11383056640625,
-0.6494140625,
0.1551513671875,
-0.31494140625,
-0.376220703125,
-0.9853515625,
0.99169921875,
0.58984375,
0.491943359375,
0.267822265625,
0.8427734375,
-0.11907958984375,
0.318115234375,
0.7255859375,
-0.334228515625,
0.2052001953125,
-0.6123046875,
0.7412109375,
-0.0487060546875,
-0.1986083984375,
-0.65478515625,
-0.2373046875,
-0.059173583984375,
-0.1588134765625,
0.33837890625,
-0.299560546875,
-0.7470703125,
0.54052734375,
0.68212890625,
0.56005859375,
-1.123046875,
0.11981201171875,
-0.330078125,
0.703125,
0.50634765625,
-0.98681640625,
0.369384765625,
-0.701171875,
0.615234375,
0.87890625,
-0.314208984375,
-0.65478515625,
-0.384521484375,
-0.68359375,
-0.28271484375,
0.2037353515625,
0.8564453125,
-0.068603515625,
0.51025390625,
-1.00390625,
0.42724609375,
0.6376953125,
-0.15966796875,
-0.047760009765625,
-0.11572265625,
-0.0279693603515625,
0.05975341796875,
0.57177734375,
-0.2113037109375,
-0.53271484375,
0.236328125,
-1.2841796875,
0.2039794921875,
-0.496337890625,
0.1484375,
0.05340576171875,
0.205078125,
-0.2357177734375,
0.55322265625,
-0.269775390625,
0.01263427734375,
-0.13134765625,
0.4794921875,
-1.216796875,
-0.76025390625,
0.71533203125,
-0.333740234375,
0.038848876953125,
0.71044921875,
-0.00899505615234375,
-0.2186279296875,
0.2061767578125,
0.4375,
-0.470458984375,
0.06329345703125,
-0.73681640625,
0.4599609375,
-0.254638671875,
-0.6171875,
-0.43896484375,
-0.69970703125,
0.84228515625,
0.180908203125,
-0.8564453125,
-0.31103515625,
-1.2548828125,
-0.1380615234375,
0.025421142578125,
-0.405029296875,
0.4755859375,
-0.12225341796875,
-0.04632568359375,
0.033203125,
-0.384033203125,
-0.34130859375,
-0.32373046875,
-0.62939453125,
-0.40185546875,
0.6513671875,
0.62744140625,
1.0185546875,
0.040374755859375,
-0.5390625,
0.09814453125,
-0.1309814453125,
-0.079345703125,
-0.72216796875,
0.38671875,
-0.1617431640625,
-0.26708984375,
-0.33056640625,
0.267822265625,
-0.1494140625,
0.31982421875,
1.025390625,
0.1375732421875,
0.65185546875,
0.1036376953125,
-0.7353515625,
1.064453125,
0.041259765625,
-1.107421875,
-0.59521484375,
0.33740234375,
-0.0794677734375,
0.65576171875,
0.353759765625,
-0.810546875,
-0.783203125,
-0.88427734375,
0.494873046875,
-0.60791015625,
0.031280517578125,
-0.6162109375,
-0.283203125,
-0.39599609375,
0.79541015625,
0.04150390625,
-0.62744140625,
-0.50830078125,
-0.95947265625,
0.37548828125,
-0.351318359375,
-0.373779296875,
-1.083984375,
-0.66796875,
-0.54150390625,
0.744140625,
-0.04974365234375,
0.11572265625,
-0.454345703125,
-0.1773681640625,
0.38232421875,
-0.2261962890625,
-0.62646484375,
-0.56494140625,
0.2413330078125,
0.365234375,
-0.284423828125,
0.12548828125,
-0.425537109375,
0.443115234375,
-0.859375,
0.2161865234375,
-0.364990234375,
-0.32861328125,
0.0014190673828125,
-0.56396484375,
1.236328125,
-0.433837890625,
-0.054351806640625,
-0.153076171875,
0.53125,
0.4833984375,
-0.368896484375,
-0.479736328125,
-0.95361328125,
-0.6298828125,
-1.0810546875,
0.634765625,
-0.6953125,
-0.193603515625,
-0.1812744140625,
0.048858642578125,
0.85791015625,
-0.595703125,
0.7001953125,
1.2216796875,
0.345458984375,
-0.1680908203125,
-1.08984375,
0.9931640625,
0.744140625,
-0.88623046875,
0.1572265625,
0.1826171875,
-0.426025390625,
0.044647216796875,
-0.133056640625,
-1.0908203125,
-0.6611328125,
0.37158203125,
1.3583984375,
-0.125244140625,
0.7763671875,
0.2406005859375,
-1.0166015625,
-0.685546875,
0.935546875,
-0.123291015625,
0.576171875,
1.1279296875,
0.461669921875,
-0.1783447265625,
0.01068878173828125,
0.25927734375,
-0.481689453125,
-0.093505859375,
0.93603515625,
0.00984954833984375,
-0.65087890625,
0.11749267578125,
0.99658203125,
-1.1865234375,
-0.88720703125,
-0.01361846923828125,
0.2100830078125,
-0.02606201171875,
-0.446044921875,
0.08746337890625,
0.2205810546875,
-0.50927734375,
-0.098876953125,
0.4873046875,
-0.0210113525390625,
0.2227783203125,
0.1956787109375,
0.333251953125,
-0.39208984375,
0.59228515625,
0.94140625,
-0.482421875,
-0.38427734375,
-0.8212890625,
-0.1507568359375,
-0.48681640625,
0.0841064453125,
0.74755859375,
-0.544921875,
0.09185791015625,
0.66552734375,
-0.34033203125,
0.63427734375,
-0.282470703125,
-0.463623046875,
0.291748046875,
-0.9091796875,
-0.66015625,
-0.0003192424774169922,
0.369873046875,
-0.05242919921875,
0.14208984375,
-0.365234375,
0.440185546875,
0.4287109375,
0.333251953125,
0.00464630126953125,
-1.0927734375,
-0.304443359375,
-0.90869140625,
-0.79296875,
-0.57421875,
-0.322509765625,
-0.369873046875,
-0.1107177734375,
0.07415771484375,
-0.57958984375,
0.168212890625,
0.2244873046875,
-0.61962890625,
0.8515625,
-0.466552734375,
0.36962890625,
-0.5234375,
-0.59375,
-0.42529296875,
-0.1875,
-0.048919677734375,
0.09930419921875,
-0.399658203125,
0.348876953125,
-0.1375732421875,
0.88427734375,
0.033416748046875,
0.223388671875,
-0.63671875,
-0.343017578125,
0.2344970703125,
0.1995849609375,
-0.38623046875,
0.84326171875,
0.33349609375,
-0.0999755859375,
0.2144775390625,
-0.393310546875,
-0.256591796875,
-0.297607421875,
0.60693359375,
0.365966796875,
-0.472900390625,
-0.292236328125,
-0.3974609375,
0.02716064453125,
-1.072265625,
0.4306640625,
-0.310302734375,
-0.07781982421875,
0.4375,
-0.1578369140625,
0.393310546875,
0.97021484375,
-0.08636474609375,
0.47998046875,
0.1337890625,
0.2578125,
0.5126953125,
0.018280029296875,
0.235107421875,
0.36328125,
-0.1605224609375,
-0.115234375,
0.06854248046875,
0.400634765625,
-0.109619140625,
0.1856689453125,
0.03912353515625,
-0.7138671875,
-0.98974609375,
-0.41162109375,
-0.27490234375,
0.396240234375,
0.732421875,
-0.56640625,
-0.1739501953125,
0.251708984375,
-0.60009765625,
0.5234375,
-0.98486328125,
-0.64404296875,
0.85888671875,
-0.107666015625,
-0.61962890625,
-0.458984375,
-0.41015625,
-0.027069091796875,
0.1854248046875,
0.5087890625,
-0.241943359375,
0.39208984375,
-0.3193359375,
0.81298828125,
0.09368896484375,
-0.2335205078125,
-0.374755859375,
0.2081298828125,
-0.63818359375,
-0.276611328125,
0.25048828125,
0.93505859375,
0.421142578125,
-0.043975830078125,
-0.87158203125,
0.11492919921875,
-0.39599609375,
0.12445068359375,
-0.56982421875,
-0.18603515625,
-0.595703125,
0.325439453125,
-0.43212890625,
0.490478515625,
-0.22216796875,
0.56298828125,
0.28173828125,
-0.5068359375,
-0.67578125,
0.53369140625,
0.607421875,
-0.369873046875,
0.3681640625,
0.2066650390625,
0.2449951171875,
0.0239715576171875,
-0.002826690673828125,
0.03387451171875,
0.44921875,
0.467529296875,
1.0048828125,
-0.051361083984375,
0.28955078125,
0.68359375,
0.1422119140625,
0.055389404296875,
0.11944580078125,
0.21484375,
0.365478515625,
0.09326171875,
-0.1007080078125,
-0.2388916015625,
-0.2335205078125,
-0.496826171875,
0.260498046875,
-0.439453125,
-0.27783203125,
-0.85302734375,
-0.5673828125,
0.494873046875,
-0.1644287109375,
-0.08612060546875,
0.032073974609375,
-0.59765625,
0.369140625,
0.77392578125,
-0.1207275390625,
-0.091796875,
0.7001953125,
0.6044921875,
0.451904296875,
0.55224609375,
0.379638671875,
0.3095703125,
-0.60009765625,
0.52099609375,
-0.163330078125,
-0.1148681640625,
-0.318603515625,
-0.35009765625,
-0.62548828125,
0.279296875,
-0.09442138671875,
-0.30517578125,
0.2998046875,
-0.4541015625,
0.1549072265625,
-0.359619140625,
0.31787109375,
-0.92724609375,
0.1964111328125,
0.2440185546875,
-0.3212890625,
-0.76611328125,
0.79248046875,
-0.14892578125,
0.321044921875,
0.35888671875,
0.8916015625,
-0.043365478515625,
1.478515625,
0.54736328125,
0.12841796875,
-0.3388671875,
0.445556640625,
-0.1517333984375,
-0.72314453125,
-0.1732177734375,
-0.5595703125,
0.021636962890625,
-0.63720703125,
-0.5205078125,
0.14404296875,
0.76025390625,
-0.101806640625,
-0.9404296875,
0.176513671875,
0.463134765625,
-0.7841796875,
0.78515625,
0.5517578125,
0.720703125,
-0.023284912109375,
0.243408203125,
-0.11932373046875,
-0.76025390625,
-0.133056640625,
-0.83935546875,
0.52197265625,
-0.69970703125,
-0.83349609375,
-0.328857421875,
-0.982421875,
-0.1490478515625,
-0.06976318359375,
-0.34716796875,
-0.81103515625,
0.716796875,
0.482666015625,
0.4892578125,
0.2239990234375,
-0.09686279296875,
-0.152587890625,
0.9140625,
0.7685546875,
0.1636962890625,
0.9453125,
0.54931640625,
-1.0625,
0.117919921875,
-1.044921875,
0.48095703125,
0.08135986328125,
-0.10552978515625,
-0.40380859375,
0.2548828125,
-0.7607421875,
-1.3125,
0.359130859375,
1.1005859375,
0.4072265625,
-0.5068359375,
-1.2705078125,
-0.1856689453125,
-0.814453125,
-0.313720703125,
-0.36474609375,
0.2509765625,
-0.456298828125,
-0.029571533203125,
-0.1619873046875,
-1.060546875,
4.30078125,
1.0966796875,
0.9208984375,
0.55908203125,
0.46240234375,
0.77099609375,
0.462646484375,
-0.50732421875,
-0.1490478515625,
-0.57470703125,
0.626953125,
-0.56298828125,
-0.139892578125,
0.9267578125,
0.331298828125,
0.418212890625,
-0.3515625,
0.48681640625,
-0.36962890625,
-0.8984375,
-0.89697265625,
0.295166015625,
0.01605224609375,
0.7021484375,
-0.06207275390625,
0.330078125,
0.431884765625,
-0.8359375,
-0.0072479248046875,
-0.50048828125,
-0.1588134765625,
-0.58544921875,
0.87451171875,
-0.1417236328125,
-0.1954345703125,
0.5224609375,
-0.291748046875,
-0.72021484375,
0.06268310546875,
0.410400390625,
-0.1854248046875,
0.06890869140625,
1.1572265625,
-0.463134765625,
-0.09515380859375,
0.88671875,
-0.837890625,
0.37744140625,
0.580078125,
-0.81591796875,
1.23828125,
-0.39306640625,
0.56787109375,
-0.60693359375,
-0.62744140625,
0.306396484375,
0.060882568359375,
-0.29931640625,
-0.453857421875,
0.8173828125,
0.308837890625,
0.44287109375,
-0.1234130859375,
0.17431640625,
-0.974609375,
1.1748046875,
-0.236572265625,
0.61376953125,
-0.68408203125,
-0.337158203125,
-0.2308349609375,
-0.31396484375,
-0.309326171875,
-0.771484375,
1.021484375,
0.0999755859375,
-0.452392578125,
0.275146484375,
0.10968017578125,
-1.0439453125,
0.2427978515625,
-0.2054443359375,
-0.611328125,
-0.33349609375,
0.5576171875,
0.779296875,
-0.66357421875,
-0.25244140625,
-0.2379150390625,
0.73828125,
0.4775390625,
0.39013671875,
0.347412109375,
-0.71923828125,
-0.018280029296875
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Find the edit distance between given two words s1 and s2.
The disntace is the minimum number of single-character edits required to change one word into the other. The edits including the following operations:
* insertion: Insert a character at a particular position.
* deletion: Delete a character at a particular position.
* substitution: Change the character at a particular position to a different character
Constraints
* 1 ≤ length of s1 ≤ 1000
* 1 ≤ length of s2 ≤ 1000
Input
s1
s2
Two words s1 and s2 are given in the first line and the second line respectively. The words will consist of lower case characters.
Output
Print the edit distance in a line.
Examples
Input
acac
acm
Output
2
Input
icpc
icpc
Output
0
"Correct Solution:
```
def levenshtein_dist(a,b):
a_size = len(a)
b_size = len(b)
inf = float('inf')
dp = [[a_size+b_size for i in range(a_size+1)] for _ in range(b_size+1)]
for i in range(b_size+1):
dp[i][0] = i
for j in range(a_size+1):
dp[0][j] = j
for i in range(1,b_size+1):
for j in range(1,a_size+1):
if a[j-1] == b[i-1]:
dp[i][j] = min(dp[i-1][j-1], dp[i-1][j]+1, dp[i][j-1]+1)
else:
dp[i][j] = min(dp[i-1][j-1]+1, dp[i-1][j]+1, dp[i][j-1]+1)
return dp
a = list(input())
b = list(input())
dp = levenshtein_dist(a,b)
print(dp[-1][-1])
```
| 43,789
|
[
-0.053436279296875,
0.11077880859375,
0.014984130859375,
0.459228515625,
-0.6083984375,
-0.09808349609375,
-0.153564453125,
-0.31201171875,
-0.28271484375,
1.19921875,
0.57275390625,
-0.254150390625,
-0.07525634765625,
-0.90234375,
-0.302001953125,
0.1168212890625,
-0.56494140625,
-0.44140625,
-0.59814453125,
-0.091552734375,
0.341552734375,
-0.076171875,
-1.4560546875,
-0.248291015625,
-0.09393310546875,
0.67919921875,
0.392822265625,
-0.288818359375,
0.72900390625,
0.77880859375,
-0.32763671875,
-0.53173828125,
0.6513671875,
-0.77392578125,
-0.04095458984375,
-0.6689453125,
0.436767578125,
-0.958984375,
-0.229736328125,
-0.353759765625,
0.190673828125,
-0.328857421875,
0.339111328125,
-0.58447265625,
-1.115234375,
0.2347412109375,
-0.291015625,
-0.26806640625,
-0.55126953125,
-0.59814453125,
0.04364013671875,
-0.200927734375,
0.6552734375,
-0.377685546875,
-0.219482421875,
-0.1258544921875,
0.0672607421875,
0.2183837890625,
-0.6396484375,
0.5595703125,
0.08111572265625,
0.266845703125,
-0.0555419921875,
-0.3193359375,
0.1153564453125,
0.5927734375,
-0.2244873046875,
-0.11102294921875,
-0.068115234375,
-0.1131591796875,
0.057861328125,
0.1707763671875,
-0.196044921875,
-0.402099609375,
-0.392333984375,
0.28466796875,
0.481201171875,
-0.12841796875,
-0.72119140625,
0.9853515625,
-0.08929443359375,
1.17578125,
0.19384765625,
0.2257080078125,
-0.1822509765625,
-0.418701171875,
0.178955078125,
0.04315185546875,
0.403076171875,
-0.282470703125,
-0.383544921875,
0.2900390625,
-0.34814453125,
-0.06658935546875,
0.52978515625,
0.41552734375,
-0.53564453125,
0.466552734375,
0.037353515625,
-0.16162109375,
0.86767578125,
0.96337890625,
-0.239990234375,
1.16796875,
-0.408203125,
0.09686279296875,
0.31982421875,
-0.13818359375,
-0.26123046875,
0.036041259765625,
-0.08905029296875,
-0.346923828125,
0.2073974609375,
0.267822265625,
0.0816650390625,
1.044921875,
-0.07501220703125,
0.45166015625,
-0.6796875,
0.63427734375,
0.61328125,
0.2078857421875,
0.63330078125,
0.2139892578125,
0.07244873046875,
-0.431396484375,
-0.42919921875,
0.9697265625,
-0.5859375,
-0.50634765625,
0.4951171875,
-0.09063720703125,
-0.065185546875,
0.5517578125,
0.046539306640625,
0.6875,
-0.2098388671875,
0.31494140625,
0.576171875,
-0.666015625,
0.8681640625,
-0.1107177734375,
0.00843048095703125,
1.28125,
0.37255859375,
0.061492919921875,
0.3740234375,
0.79931640625,
-1.0146484375,
0.34033203125,
-1.1689453125,
0.65673828125,
0.11456298828125,
0.04473876953125,
0.068603515625,
-0.1717529296875,
0.1568603515625,
0.421630859375,
0.55908203125,
0.04852294921875,
-0.2471923828125,
0.006557464599609375,
-0.4765625,
1.1376953125,
-0.441650390625,
0.87744140625,
-0.5830078125,
-0.378662109375,
-0.2381591796875,
-0.328125,
0.283935546875,
-0.25634765625,
0.054229736328125,
0.533203125,
-0.088134765625,
1.0673828125,
1.0234375,
-0.114501953125,
0.0784912109375,
0.199951171875,
-0.51611328125,
0.15478515625,
0.47265625,
0.658203125,
0.03985595703125,
0.316650390625,
0.269775390625,
-0.01428985595703125,
-0.59521484375,
-0.8359375,
0.306396484375,
0.63427734375,
-0.201904296875,
0.1749267578125,
0.162353515625,
-0.0175628662109375,
-1.005859375,
-0.0533447265625,
-0.01450347900390625,
-0.78662109375,
-0.24658203125,
0.59228515625,
-0.2037353515625,
0.49072265625,
-0.270263671875,
-0.515625,
0.375,
0.95703125,
-0.53515625,
-0.1595458984375,
0.62060546875,
0.33154296875,
-0.304443359375,
0.002872467041015625,
0.195556640625,
-0.0223236083984375,
-0.44775390625,
0.466064453125,
-0.701171875,
-0.143310546875,
0.1595458984375,
0.489501953125,
0.4970703125,
0.6572265625,
-0.329345703125,
-0.350341796875,
0.3955078125,
1.1298828125,
-0.10791015625,
0.8076171875,
0.306396484375,
1.015625,
0.498291015625,
0.385986328125,
0.6923828125,
-0.1160888671875,
0.75732421875,
1.154296875,
-0.2374267578125,
0.185302734375,
0.395751953125,
0.69970703125,
0.62060546875,
0.76025390625,
0.490478515625,
0.339111328125,
-0.16552734375,
-0.090576171875,
-0.15966796875,
0.6181640625,
-0.662109375,
0.552734375,
0.180908203125,
0.48046875,
-0.3662109375,
-0.30419921875,
0.3447265625,
0.52001953125,
-1.0556640625,
-0.5634765625,
0.06304931640625,
0.00333404541015625,
0.22998046875,
-0.184814453125,
0.327392578125,
0.2626953125,
0.1517333984375,
0.52734375,
0.022552490234375,
-0.424072265625,
-0.56884765625,
-0.7177734375,
-1.142578125,
-0.424072265625,
-1.046875,
-0.41162109375,
0.08038330078125,
-0.77783203125,
0.6533203125,
-0.246337890625,
-0.29931640625,
-0.293701171875,
-0.387451171875,
0.5517578125,
-0.06793212890625,
0.56640625,
-0.53271484375,
0.416259765625,
0.2266845703125,
1.3076171875,
-0.3779296875,
-0.3330078125,
-0.286376953125,
-0.87158203125,
0.395751953125,
-0.022125244140625,
0.73974609375,
0.136962890625,
-0.6904296875,
-0.79443359375,
-0.44287109375,
-0.1781005859375,
-0.415283203125,
0.3837890625,
-0.5576171875,
0.71875,
0.24267578125,
-0.469482421875,
0.77197265625,
0.7001953125,
-0.7587890625,
0.394287109375,
0.114990234375,
0.35107421875,
-0.83203125,
1.31640625,
0.311279296875,
0.473876953125,
-0.77880859375,
-0.61279296875,
-0.2354736328125,
0.29150390625,
-0.049560546875,
-0.611328125,
-0.43212890625,
0.6953125,
0.2548828125,
-0.77197265625,
0.5400390625,
-0.82421875,
-0.5390625,
-0.4267578125,
-0.7177734375,
0.63671875,
0.94580078125,
0.08953857421875,
-0.3173828125,
-0.497802734375,
-0.43212890625,
0.7451171875,
0.5224609375,
-1.0712890625,
0.150634765625,
0.81005859375,
0.400390625,
0.1334228515625,
0.190673828125,
-0.479248046875,
-0.0556640625,
0.324462890625,
0.432861328125,
0.67822265625,
0.29833984375,
0.35009765625,
0.10919189453125,
0.57177734375,
-0.66357421875,
-0.50927734375,
-0.056671142578125,
0.83544921875,
0.630859375,
0.53759765625,
0.1903076171875,
-0.4560546875,
-0.9013671875,
-0.84423828125,
0.37646484375,
-0.09039306640625,
0.61669921875,
-0.6611328125,
0.62060546875,
0.194580078125,
-0.66845703125,
0.59423828125,
-0.4931640625,
0.21630859375,
1.0341796875,
-0.035430908203125,
0.955078125,
-0.90771484375,
0.31689453125,
-0.265869140625,
-0.3095703125,
0.59521484375,
0.77001953125,
0.80615234375,
-0.85107421875,
-0.16162109375,
-0.239990234375,
-0.060455322265625,
-0.13671875,
-0.335693359375,
0.200439453125,
-0.28515625,
-0.231689453125,
-0.7568359375,
0.4306640625,
0.5771484375,
0.666015625,
-0.00865936279296875,
0.92431640625,
0.24267578125,
0.317138671875,
0.56005859375,
-0.055023193359375,
0.0189971923828125,
-0.93408203125,
0.904296875,
-0.1595458984375,
0.0015773773193359375,
-0.44873046875,
-0.49169921875,
0.142578125,
0.0139617919921875,
0.10528564453125,
-0.185791015625,
-0.9658203125,
0.0850830078125,
0.10223388671875,
0.193603515625,
-0.69189453125,
0.05548095703125,
-0.5830078125,
-0.014892578125,
0.1748046875,
-1.1005859375,
0.7099609375,
-0.85400390625,
0.55908203125,
0.2447509765625,
-0.560546875,
-0.55517578125,
-0.3486328125,
-0.42578125,
-0.70458984375,
0.22216796875,
0.335693359375,
0.3076171875,
0.12225341796875,
-1.091796875,
0.162109375,
0.134033203125,
-0.4453125,
-0.0008921623229980469,
0.060760498046875,
0.69189453125,
0.310302734375,
0.744140625,
-0.07501220703125,
-0.53662109375,
-0.119873046875,
-0.55419921875,
0.71533203125,
-0.5595703125,
0.400634765625,
0.042816162109375,
-0.326904296875,
-0.118896484375,
0.310546875,
-0.289794921875,
0.272216796875,
-0.436767578125,
-0.049041748046875,
-0.84619140625,
-0.86865234375,
0.630859375,
-0.451416015625,
-0.3232421875,
0.73486328125,
-0.064697265625,
-0.228759765625,
0.31884765625,
0.7021484375,
-0.052825927734375,
0.2159423828125,
-0.369384765625,
0.1495361328125,
-0.5380859375,
-0.43994140625,
-0.07366943359375,
-0.77978515625,
0.685546875,
-0.31494140625,
-0.6083984375,
-0.160400390625,
-1.037109375,
-0.35498046875,
0.0288543701171875,
-0.347412109375,
0.36865234375,
0.335693359375,
-0.189453125,
-0.1513671875,
-0.318115234375,
-0.56640625,
-0.1719970703125,
-0.34765625,
-0.448486328125,
0.089599609375,
0.48388671875,
0.291259765625,
0.002277374267578125,
-0.466552734375,
-0.055938720703125,
0.041778564453125,
-0.515625,
-0.3076171875,
-0.443603515625,
0.30810546875,
-0.60107421875,
-0.0703125,
0.50146484375,
0.281982421875,
0.31005859375,
0.7412109375,
0.3330078125,
0.2445068359375,
0.37109375,
-0.62451171875,
1.1533203125,
0.2265625,
-1.0078125,
-0.5478515625,
0.56982421875,
-0.238037109375,
0.51904296875,
0.2489013671875,
-0.65283203125,
-0.36962890625,
-0.8623046875,
0.56201171875,
-0.76611328125,
-0.420654296875,
-1.0439453125,
-0.68701171875,
-0.08441162109375,
0.57275390625,
-0.1812744140625,
-0.57080078125,
0.4326171875,
-1.31640625,
0.60888671875,
-0.40625,
-0.2137451171875,
-0.693359375,
-0.68115234375,
-0.2137451171875,
1.0537109375,
0.061004638671875,
0.27734375,
-0.1932373046875,
-0.200927734375,
0.410400390625,
-0.05426025390625,
-0.83740234375,
-0.410400390625,
0.01430511474609375,
0.225341796875,
0.017303466796875,
-0.71923828125,
-0.32080078125,
0.75634765625,
-0.939453125,
0.070068359375,
-0.1536865234375,
-0.2091064453125,
0.050506591796875,
-0.27099609375,
0.8427734375,
-0.2235107421875,
-0.1754150390625,
-0.453125,
0.4873046875,
0.2088623046875,
-0.07379150390625,
-0.57470703125,
-0.85498046875,
-1.1513671875,
-1.0703125,
0.8740234375,
-0.27880859375,
0.30029296875,
-0.65869140625,
-0.2186279296875,
1.0986328125,
-0.68701171875,
0.38525390625,
1.0693359375,
0.19482421875,
0.59814453125,
-0.64697265625,
0.91259765625,
0.1097412109375,
-0.68505859375,
-0.052154541015625,
0.23486328125,
-0.69287109375,
-0.0701904296875,
-0.44970703125,
-0.84716796875,
-0.716796875,
0.60595703125,
1.32421875,
0.204833984375,
0.93310546875,
-0.2147216796875,
-0.9619140625,
-0.36474609375,
1.109375,
0.127197265625,
0.194091796875,
0.708984375,
-0.243896484375,
0.0643310546875,
0.062042236328125,
0.041900634765625,
-0.5166015625,
-0.343017578125,
1.0634765625,
-0.462158203125,
-0.7431640625,
0.91015625,
1.1708984375,
-0.99462890625,
-1.0458984375,
0.036773681640625,
0.2783203125,
0.20654296875,
-1.1279296875,
0.1336669921875,
0.8310546875,
-0.6015625,
0.211181640625,
0.32177734375,
-0.1357421875,
0.58935546875,
0.231201171875,
0.4228515625,
-0.3935546875,
0.58837890625,
0.83349609375,
-0.57861328125,
-0.2413330078125,
-0.89599609375,
-0.31591796875,
-0.176025390625,
0.06903076171875,
0.472412109375,
-0.384521484375,
-0.0106964111328125,
0.830078125,
-0.11822509765625,
0.92822265625,
-0.32763671875,
-0.1644287109375,
0.65625,
-0.6875,
-0.32275390625,
0.24365234375,
0.60400390625,
0.08209228515625,
0.054962158203125,
-0.703125,
0.09295654296875,
0.135498046875,
0.71923828125,
-0.241943359375,
-0.91650390625,
-0.06219482421875,
-0.9833984375,
-0.334228515625,
-0.6669921875,
-0.58642578125,
-0.02154541015625,
0.1441650390625,
0.1712646484375,
-0.428466796875,
-0.12091064453125,
0.6865234375,
-0.755859375,
0.57568359375,
-0.5009765625,
0.39404296875,
-0.396728515625,
-0.33544921875,
-0.568359375,
-0.08673095703125,
-0.640625,
-0.353515625,
-0.353271484375,
0.390625,
-0.31884765625,
0.0263671875,
-0.31689453125,
0.99072265625,
0.10235595703125,
-0.75,
-0.11334228515625,
-0.1644287109375,
-0.33447265625,
0.55029296875,
0.591796875,
0.0304107666015625,
0.009979248046875,
-0.1134033203125,
-0.348388671875,
-0.2342529296875,
0.4658203125,
0.68115234375,
-0.41064453125,
-0.456298828125,
-0.446533203125,
0.039306640625,
-0.82666015625,
0.1376953125,
-0.5478515625,
0.27294921875,
-0.0306243896484375,
0.1317138671875,
0.52734375,
1.10546875,
-0.0010223388671875,
0.046234130859375,
0.1978759765625,
0.285400390625,
0.50537109375,
-0.259521484375,
0.0673828125,
0.6669921875,
0.1832275390625,
-0.313720703125,
-0.1058349609375,
0.234130859375,
-0.0390625,
0.410400390625,
-0.291748046875,
-0.61572265625,
-0.8037109375,
-0.318115234375,
-0.037261962890625,
0.65673828125,
0.0031280517578125,
-0.26025390625,
0.1505126953125,
-0.255126953125,
-0.7451171875,
-0.0160675048828125,
-0.9248046875,
-0.68408203125,
0.53369140625,
-0.046722412109375,
-0.6123046875,
-0.1329345703125,
-0.62890625,
-0.2271728515625,
0.10723876953125,
0.418212890625,
-0.2486572265625,
0.393310546875,
-0.171630859375,
0.6953125,
-0.393310546875,
-0.291748046875,
0.229736328125,
0.32080078125,
-0.84521484375,
-0.3974609375,
0.341552734375,
1.26171875,
0.205322265625,
-0.2548828125,
-0.90478515625,
0.16650390625,
0.23046875,
-0.1640625,
-0.416015625,
-0.0439453125,
-0.04119873046875,
0.23486328125,
-0.91552734375,
-0.08160400390625,
0.049041748046875,
0.83154296875,
-0.037567138671875,
-0.150146484375,
-0.6181640625,
0.8212890625,
0.430419921875,
0.1591796875,
0.153076171875,
0.228515625,
0.382080078125,
-0.5234375,
0.1024169921875,
-0.2191162109375,
0.90625,
0.52978515625,
0.52392578125,
-0.1048583984375,
0.5556640625,
0.48388671875,
0.26513671875,
-0.13427734375,
0.54443359375,
-0.26123046875,
-0.227294921875,
-0.261962890625,
-0.54296875,
-0.54443359375,
0.1998291015625,
-0.50244140625,
0.72216796875,
-0.33349609375,
-0.3203125,
-0.1722412109375,
-0.438720703125,
1.076171875,
-0.30517578125,
-0.497314453125,
0.1380615234375,
-0.2939453125,
0.1802978515625,
0.457763671875,
0.2919921875,
-0.00970458984375,
0.2137451171875,
0.61181640625,
0.5693359375,
0.90087890625,
0.379150390625,
0.1981201171875,
-0.634765625,
0.1724853515625,
-0.0308380126953125,
-0.293701171875,
-0.348388671875,
-0.54931640625,
-0.78955078125,
0.3232421875,
-0.4462890625,
-0.111328125,
0.40771484375,
-0.7880859375,
-0.237548828125,
-0.294189453125,
0.93115234375,
-0.7080078125,
0.50146484375,
0.2144775390625,
-0.5,
-1.0458984375,
0.8701171875,
-0.51513671875,
0.348876953125,
0.1856689453125,
1.01953125,
0.239990234375,
0.9814453125,
0.10858154296875,
-0.26611328125,
0.1204833984375,
0.73974609375,
-0.414306640625,
-0.67138671875,
-0.57763671875,
-0.294921875,
0.05029296875,
-0.85888671875,
-0.294921875,
-0.25439453125,
0.7470703125,
-0.08642578125,
-0.81103515625,
-0.2052001953125,
-0.0033721923828125,
-0.66796875,
0.1143798828125,
0.037109375,
0.271728515625,
0.10394287109375,
0.08154296875,
-0.302978515625,
-0.61181640625,
0.4013671875,
-0.50439453125,
0.568359375,
-0.482177734375,
-0.2568359375,
-0.60400390625,
-0.42919921875,
-0.349609375,
0.1810302734375,
-0.51123046875,
-0.75048828125,
0.806640625,
0.343017578125,
0.4072265625,
0.10845947265625,
-0.1558837890625,
-0.0174407958984375,
0.7255859375,
0.875,
0.13427734375,
0.9111328125,
0.7197265625,
-0.08526611328125,
0.067626953125,
0.036529541015625,
0.1666259765625,
-0.491455078125,
0.25244140625,
-0.51416015625,
0.11834716796875,
-0.8701171875,
-1.0625,
0.17236328125,
0.5556640625,
0.5791015625,
-0.52587890625,
-1.0244140625,
-0.462646484375,
-0.9169921875,
-0.3876953125,
-0.93994140625,
0.68505859375,
0.0775146484375,
-0.1055908203125,
0.07574462890625,
-0.96630859375,
4.4765625,
1.1220703125,
0.67822265625,
0.2607421875,
-0.0892333984375,
0.78466796875,
0.08544921875,
-0.6474609375,
-0.31787109375,
-0.859375,
0.50244140625,
-0.1478271484375,
-0.0972900390625,
0.5419921875,
0.091552734375,
0.497802734375,
-0.64111328125,
-0.1304931640625,
0.1787109375,
-1.1796875,
-0.49755859375,
0.0980224609375,
-0.215087890625,
0.0215911865234375,
0.11309814453125,
0.587890625,
0.357177734375,
-0.6416015625,
0.039520263671875,
-0.59912109375,
-0.28515625,
-0.259521484375,
0.88232421875,
0.1365966796875,
-0.280029296875,
0.428955078125,
0.023101806640625,
-0.484130859375,
-0.300537109375,
0.2646484375,
-0.1239013671875,
0.1544189453125,
0.494873046875,
-0.45947265625,
-0.03765869140625,
0.80712890625,
-0.1944580078125,
0.060760498046875,
0.263427734375,
-1.095703125,
0.982421875,
-0.3857421875,
0.416748046875,
-0.6484375,
-0.70947265625,
0.135498046875,
0.28369140625,
-0.049346923828125,
0.257080078125,
0.90576171875,
0.41943359375,
0.60693359375,
0.10784912109375,
0.1697998046875,
-1.1171875,
0.64306640625,
0.32275390625,
0.43310546875,
-0.29443359375,
-0.031005859375,
-0.30859375,
-0.64013671875,
-0.2117919921875,
-0.5185546875,
0.6923828125,
0.10107421875,
-0.3701171875,
0.59716796875,
0.344970703125,
-0.5595703125,
0.4423828125,
-0.27099609375,
-0.1634521484375,
-0.61181640625,
0.3662109375,
1.1669921875,
-0.64013671875,
-0.341064453125,
-0.278076171875,
0.440673828125,
0.16552734375,
0.8349609375,
-0.11309814453125,
-0.94970703125,
-0.127197265625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
While walking down the street Vanya saw a label "Hide&Seek". Because he is a programmer, he used & as a bitwise AND for these two words represented as a integers in base 64 and got new word. Now Vanya thinks of some string s and wants to know the number of pairs of words of length |s| (length of s), such that their bitwise AND is equal to s. As this number can be large, output it modulo 109 + 7.
To represent the string as a number in numeral system with base 64 Vanya uses the following rules:
* digits from '0' to '9' correspond to integers from 0 to 9;
* letters from 'A' to 'Z' correspond to integers from 10 to 35;
* letters from 'a' to 'z' correspond to integers from 36 to 61;
* letter '-' correspond to integer 62;
* letter '_' correspond to integer 63.
Input
The only line of the input contains a single word s (1 ≤ |s| ≤ 100 000), consisting of digits, lowercase and uppercase English letters, characters '-' and '_'.
Output
Print a single integer — the number of possible pairs of words, such that their bitwise AND is equal to string s modulo 109 + 7.
Examples
Input
z
Output
3
Input
V_V
Output
9
Input
Codeforces
Output
130653412
Note
For a detailed definition of bitwise AND we recommend to take a look in the corresponding article in Wikipedia.
In the first sample, there are 3 possible solutions:
1. z&_ = 61&63 = 61 = z
2. _&z = 63&61 = 61 = z
3. z&z = 61&61 = 61 = z
Tags: bitmasks, combinatorics, implementation, strings
Correct Solution:
```
import string
charset = string.digits + string.ascii_uppercase + string.ascii_lowercase + "-_"
def getValue(char):
return charset.index(char)
def main():
string = input()
cnt = 1
dict = {}
for i in range(len(charset)):
for j in range(i + 1, len(charset)):
res = i & j
if res in dict:
dict[res] += 1
else:
dict[res] = 1
for char in string:
if getValue(char) in dict:
cnt = cnt * (1 + 2 * dict[getValue(char)]) % 1000000007
print(cnt)
if __name__ == "__main__":
main()
```
| 44,276
|
[
0.35498046875,
-0.36083984375,
-0.1910400390625,
0.050323486328125,
-0.7880859375,
-0.7958984375,
0.35205078125,
0.10040283203125,
-0.271484375,
0.61279296875,
0.63623046875,
-0.360107421875,
-0.007602691650390625,
-0.464111328125,
-0.54931640625,
0.0210418701171875,
-0.4638671875,
-0.6171875,
-0.53125,
0.054412841796875,
0.10687255859375,
0.19775390625,
-1.421875,
-0.08465576171875,
-0.419189453125,
1.1748046875,
0.826171875,
0.277099609375,
0.70703125,
1.0830078125,
-0.04632568359375,
-0.2724609375,
0.73291015625,
-0.8837890625,
-0.5888671875,
-0.461181640625,
0.35009765625,
-0.66015625,
-0.35595703125,
-0.46875,
0.496826171875,
-0.257080078125,
0.591796875,
-0.6611328125,
-1.490234375,
-0.49169921875,
-0.356689453125,
-0.5712890625,
-0.230712890625,
-0.2034912109375,
0.60107421875,
-0.32958984375,
0.484375,
0.181884765625,
0.293212890625,
0.162109375,
-0.328857421875,
0.1845703125,
-0.61474609375,
-0.15771484375,
0.01568603515625,
0.08905029296875,
-0.04656982421875,
-0.5380859375,
-0.195556640625,
-0.059844970703125,
0.050537109375,
-0.16162109375,
-0.2176513671875,
-0.99169921875,
0.13037109375,
0.341552734375,
-0.59228515625,
-0.31640625,
-0.53759765625,
0.10894775390625,
0.1854248046875,
0.27734375,
-0.59912109375,
0.81494140625,
-0.12164306640625,
0.92041015625,
0.3203125,
0.286376953125,
-0.486083984375,
-0.5107421875,
-0.496337890625,
-0.0711669921875,
-0.0994873046875,
-0.476806640625,
0.1282958984375,
0.7080078125,
-0.33251953125,
0.085205078125,
0.75537109375,
0.603515625,
-0.36572265625,
0.1998291015625,
0.46728515625,
0.438720703125,
0.449462890625,
0.91748046875,
-0.06103515625,
0.998046875,
-0.3896484375,
-0.15283203125,
0.2496337890625,
0.298828125,
-0.344970703125,
-0.001338958740234375,
-0.1322021484375,
-0.384521484375,
0.40966796875,
-0.04534912109375,
-0.45849609375,
1.01953125,
0.09368896484375,
-0.01218414306640625,
-0.68798828125,
0.306884765625,
0.36328125,
-0.1136474609375,
0.72265625,
-0.1673583984375,
-0.042236328125,
-0.49609375,
-0.18603515625,
0.9609375,
-0.51025390625,
-0.3515625,
0.248779296875,
0.1749267578125,
0.08624267578125,
-0.005092620849609375,
0.1563720703125,
0.7236328125,
-0.263916015625,
0.609375,
0.671875,
-0.873046875,
0.8095703125,
-0.32666015625,
-0.10577392578125,
1.3994140625,
0.3603515625,
-0.10870361328125,
0.78564453125,
0.373291015625,
-0.837890625,
0.211669921875,
-0.6796875,
0.63427734375,
-0.25537109375,
0.58154296875,
-0.30908203125,
0.067626953125,
-0.09356689453125,
0.36474609375,
0.1287841796875,
0.171142578125,
-0.331787109375,
0.254150390625,
0.12890625,
0.8056640625,
-0.421875,
0.74169921875,
-0.61669921875,
-0.51904296875,
-0.11871337890625,
-0.35546875,
0.7568359375,
-0.2000732421875,
-0.09600830078125,
0.96875,
0.126708984375,
1.0244140625,
1.228515625,
-0.482421875,
0.36083984375,
0.2255859375,
-0.218505859375,
0.237548828125,
0.24365234375,
0.73876953125,
0.0977783203125,
0.2041015625,
-0.0063018798828125,
-0.08074951171875,
-1.24609375,
-0.50732421875,
0.042724609375,
0.556640625,
-0.37548828125,
0.147216796875,
0.1409912109375,
0.1878662109375,
-0.9912109375,
-0.292236328125,
-0.378173828125,
-1.4296875,
-0.1854248046875,
0.77197265625,
-0.2093505859375,
0.394287109375,
0.096435546875,
-0.34033203125,
0.494140625,
1.1123046875,
-0.1986083984375,
0.12158203125,
-0.08087158203125,
-0.2012939453125,
-0.1444091796875,
0.209228515625,
0.1300048828125,
-0.38427734375,
-0.77099609375,
0.9794921875,
-0.6005859375,
0.054656982421875,
0.287841796875,
1.08203125,
0.13037109375,
0.83642578125,
-0.14306640625,
-0.572265625,
0.39453125,
0.8583984375,
0.3193359375,
0.73828125,
0.190185546875,
1.0244140625,
0.435546875,
0.66796875,
0.3505859375,
0.50439453125,
0.07080078125,
0.445556640625,
-0.037689208984375,
0.48486328125,
-0.15673828125,
0.10284423828125,
0.415283203125,
-0.005367279052734375,
0.1451416015625,
0.447021484375,
-0.2327880859375,
0.272216796875,
-0.5458984375,
0.353271484375,
-0.63720703125,
0.53173828125,
-0.03765869140625,
0.63232421875,
-0.5927734375,
-0.345703125,
0.28271484375,
1.068359375,
-0.970703125,
-0.49951171875,
0.38037109375,
-0.035491943359375,
0.1881103515625,
0.2066650390625,
0.62060546875,
0.68212890625,
0.625,
0.755859375,
-0.67626953125,
-0.356201171875,
-0.712890625,
-0.63818359375,
-0.87646484375,
-0.295166015625,
-0.70703125,
-0.0599365234375,
0.2607421875,
-0.578125,
0.1729736328125,
-0.39892578125,
-0.042083740234375,
0.1116943359375,
-0.77783203125,
0.488525390625,
-0.09539794921875,
0.5654296875,
-0.99609375,
0.70166015625,
0.390380859375,
1.0048828125,
-0.62744140625,
0.1483154296875,
-0.2208251953125,
-0.73828125,
0.55126953125,
-0.053009033203125,
0.322998046875,
-0.2113037109375,
-0.428955078125,
-0.53857421875,
-0.6708984375,
0.00798797607421875,
-0.385498046875,
0.37939453125,
-0.705078125,
0.85205078125,
0.480224609375,
-0.77880859375,
0.623046875,
1.1396484375,
-1.1484375,
0.294189453125,
0.67626953125,
-0.06427001953125,
-0.8564453125,
1.3583984375,
0.433837890625,
0.4091796875,
-0.57666015625,
-0.298095703125,
-0.51708984375,
0.136962890625,
0.005214691162109375,
-0.5771484375,
-0.496826171875,
0.475830078125,
0.238525390625,
-0.76123046875,
0.39453125,
-1.111328125,
-0.284423828125,
-0.283203125,
-0.32373046875,
0.99658203125,
0.4873046875,
-0.024658203125,
-0.276611328125,
-0.4677734375,
-0.035919189453125,
0.61083984375,
0.438232421875,
-0.603515625,
0.1229248046875,
0.6455078125,
0.2978515625,
-0.0303955078125,
0.2120361328125,
-0.5927734375,
-0.4599609375,
-0.212890625,
0.552734375,
1.15625,
0.453857421875,
0.08905029296875,
0.0382080078125,
0.86376953125,
-0.90966796875,
-0.26513671875,
0.102783203125,
0.342529296875,
0.560546875,
0.2066650390625,
0.23486328125,
-0.416748046875,
-0.5009765625,
-0.97412109375,
0.64599609375,
0.39794921875,
0.615234375,
-0.40234375,
0.56494140625,
-0.006725311279296875,
-0.271728515625,
0.77978515625,
-0.1839599609375,
-0.1278076171875,
0.69873046875,
-0.140625,
0.77734375,
-0.59912109375,
0.30078125,
0.1544189453125,
0.084228515625,
0.2320556640625,
0.23095703125,
0.4208984375,
-0.52099609375,
-0.8857421875,
-0.0955810546875,
-0.2587890625,
-0.21435546875,
-0.78515625,
0.345947265625,
-0.3544921875,
-0.1522216796875,
-0.85400390625,
0.463134765625,
0.67578125,
0.62255859375,
0.0887451171875,
0.74169921875,
0.2626953125,
0.33642578125,
1.0048828125,
-0.39892578125,
-0.08917236328125,
-0.84619140625,
0.281494140625,
-0.384521484375,
-0.62060546875,
-0.91015625,
-0.27099609375,
-0.09906005859375,
-0.207763671875,
-0.00769805908203125,
-0.21240234375,
-0.478271484375,
0.295654296875,
-0.271728515625,
0.7587890625,
-0.5107421875,
-0.411376953125,
-0.2171630859375,
0.43310546875,
0.293701171875,
-1.00390625,
0.1629638671875,
-0.91796875,
0.74560546875,
0.430419921875,
-0.2120361328125,
-0.37451171875,
-0.55810546875,
-0.6337890625,
-0.51806640625,
0.041778564453125,
0.759765625,
-0.194580078125,
0.6865234375,
-1.556640625,
0.63330078125,
-0.11285400390625,
-0.235107421875,
0.0645751953125,
0.28173828125,
0.64794921875,
0.49365234375,
0.7109375,
-0.7060546875,
-0.72265625,
0.231201171875,
-1.2900390625,
0.491455078125,
-0.54541015625,
0.6513671875,
-0.1905517578125,
0.2318115234375,
-0.2423095703125,
0.358642578125,
0.0136566162109375,
0.45263671875,
-0.341064453125,
0.2271728515625,
-0.53564453125,
-0.86279296875,
0.362548828125,
-0.23681640625,
-0.485107421875,
1.029296875,
-0.2337646484375,
-0.12646484375,
0.192626953125,
0.266845703125,
-0.51171875,
0.26123046875,
-0.5498046875,
0.30908203125,
-0.0102691650390625,
-0.3271484375,
-0.619140625,
-0.392333984375,
0.669921875,
0.403564453125,
-0.74609375,
-0.151123046875,
-1.310546875,
-0.370361328125,
0.156494140625,
-0.348876953125,
0.44970703125,
-0.136474609375,
-0.0018930435180664062,
0.09686279296875,
-0.19970703125,
-0.33203125,
-0.263671875,
-0.7158203125,
-0.1578369140625,
0.49951171875,
0.357177734375,
0.73095703125,
0.20458984375,
-0.12481689453125,
0.118896484375,
0.0924072265625,
0.2259521484375,
-0.669921875,
-0.097900390625,
0.12200927734375,
0.051300048828125,
0.091064453125,
0.3623046875,
-0.2498779296875,
0.369140625,
0.7451171875,
0.168212890625,
0.429443359375,
0.2220458984375,
-0.494873046875,
0.91357421875,
0.0643310546875,
-1.146484375,
-0.4541015625,
0.3798828125,
0.10321044921875,
0.87109375,
-0.0072479248046875,
-1.0185546875,
-0.77734375,
-0.73095703125,
0.236083984375,
-0.5068359375,
0.006259918212890625,
-0.80517578125,
-0.3349609375,
-0.41162109375,
0.6533203125,
-0.3984375,
-0.375244140625,
-0.09063720703125,
-0.91455078125,
0.0897216796875,
-0.90576171875,
-0.1697998046875,
-0.50244140625,
-0.78857421875,
-0.274169921875,
0.79248046875,
-0.049713134765625,
0.287109375,
0.1923828125,
-0.29248046875,
0.371337890625,
-0.0218963623046875,
-0.59814453125,
-0.63330078125,
0.137451171875,
0.1602783203125,
-0.11962890625,
-0.27099609375,
-0.68505859375,
0.87744140625,
-1.025390625,
0.119384765625,
-0.2452392578125,
-0.436767578125,
-0.145751953125,
-0.275146484375,
1.2275390625,
-0.6240234375,
0.144287109375,
-0.57421875,
0.5771484375,
0.91748046875,
-0.11248779296875,
-0.62890625,
-1.1015625,
-0.421142578125,
-1.201171875,
0.5419921875,
-0.381591796875,
0.3330078125,
-0.49609375,
-0.10406494140625,
0.91064453125,
-0.55126953125,
0.462158203125,
1.056640625,
0.021209716796875,
0.048553466796875,
-0.56640625,
0.35888671875,
0.59228515625,
-0.417724609375,
0.148681640625,
-0.03668212890625,
-0.69970703125,
0.3017578125,
-0.599609375,
-1.048828125,
-0.8212890625,
0.383056640625,
1.1083984375,
-0.353759765625,
0.5986328125,
0.055450439453125,
-1.00390625,
-0.68359375,
0.7294921875,
0.294677734375,
0.409912109375,
0.5810546875,
-0.1300048828125,
-0.022857666015625,
0.2548828125,
-0.2420654296875,
-0.2052001953125,
-0.3056640625,
1.087890625,
-0.283447265625,
-0.59716796875,
0.86181640625,
0.62890625,
-0.86767578125,
-0.56640625,
-0.08795166015625,
-0.27392578125,
-0.1468505859375,
-0.6494140625,
0.2327880859375,
0.6494140625,
-0.50927734375,
0.2122802734375,
0.3818359375,
0.51708984375,
0.5791015625,
-0.047454833984375,
0.272705078125,
-0.515625,
0.763671875,
0.66064453125,
-0.410400390625,
-0.26025390625,
-0.853515625,
-0.1329345703125,
-0.429443359375,
-0.167236328125,
0.6591796875,
-0.63720703125,
0.27490234375,
0.80322265625,
-0.055450439453125,
0.4951171875,
-0.2249755859375,
-0.3671875,
0.282470703125,
-0.61572265625,
-0.58203125,
0.3037109375,
0.66943359375,
-0.466552734375,
0.210693359375,
-0.49951171875,
-0.27978515625,
0.03515625,
0.1962890625,
-0.40576171875,
-0.849609375,
-0.291015625,
-0.9306640625,
-0.1519775390625,
-0.54736328125,
-0.424072265625,
-0.06256103515625,
0.04315185546875,
-0.0885009765625,
-0.91943359375,
-0.2027587890625,
0.5390625,
-0.78076171875,
1.12890625,
-0.779296875,
0.440673828125,
-0.59033203125,
-0.389892578125,
-0.6357421875,
0.3095703125,
-0.26220703125,
0.0875244140625,
-0.69482421875,
0.031951904296875,
0.0982666015625,
0.42041015625,
-0.1077880859375,
0.399169921875,
-0.438720703125,
-0.63330078125,
-0.01061248779296875,
-0.122802734375,
-0.515625,
0.56396484375,
0.67333984375,
0.135009765625,
0.199462890625,
-0.45703125,
-0.62255859375,
-0.337158203125,
0.3125,
0.343505859375,
-0.117919921875,
-0.242431640625,
-0.043121337890625,
0.390380859375,
-1.00390625,
0.477294921875,
-0.9033203125,
-0.311279296875,
0.349853515625,
-0.1876220703125,
0.47900390625,
0.8974609375,
0.2406005859375,
0.54150390625,
0.12841796875,
-0.0997314453125,
0.52490234375,
0.1162109375,
-0.29248046875,
0.5654296875,
0.52978515625,
-0.1376953125,
0.1993408203125,
0.3291015625,
-0.4794921875,
0.44287109375,
-0.25390625,
-0.736328125,
-0.705078125,
-0.195556640625,
-0.409912109375,
0.193359375,
0.1619873046875,
-0.488037109375,
-0.366943359375,
-0.036956787109375,
-0.41796875,
-0.0278778076171875,
-0.97998046875,
-0.75390625,
0.87158203125,
-0.2459716796875,
-0.436279296875,
-0.1964111328125,
-0.66357421875,
-0.134765625,
0.431884765625,
0.174560546875,
-0.53369140625,
0.619140625,
-0.366943359375,
0.3837890625,
-0.4873046875,
-0.036376953125,
-0.017974853515625,
0.49072265625,
-0.427734375,
-0.642578125,
0.2313232421875,
1.015625,
0.1842041015625,
-0.450439453125,
-0.78125,
0.20703125,
0.37255859375,
-0.1551513671875,
-0.34912109375,
0.44384765625,
-0.058837890625,
0.64111328125,
-0.99853515625,
-0.11846923828125,
0.2744140625,
0.30810546875,
0.1181640625,
-0.2978515625,
-0.320068359375,
0.438720703125,
0.6494140625,
0.11151123046875,
0.416259765625,
0.41259765625,
0.76708984375,
-0.356201171875,
-0.189697265625,
-0.2156982421875,
1.162109375,
0.66015625,
0.294189453125,
-0.461181640625,
0.414306640625,
0.56494140625,
0.2174072265625,
-0.1842041015625,
0.426513671875,
0.361572265625,
0.0247039794921875,
0.036285400390625,
-0.195068359375,
-0.1640625,
0.03546142578125,
-0.78564453125,
0.50341796875,
-0.25439453125,
0.0165863037109375,
-0.375732421875,
-0.6865234375,
0.56005859375,
0.009490966796875,
-0.64501953125,
-0.147705078125,
-0.1339111328125,
0.20556640625,
0.443115234375,
0.0031948089599609375,
-0.22314453125,
0.9912109375,
0.76513671875,
0.52490234375,
0.488525390625,
0.07000732421875,
0.467529296875,
-0.1939697265625,
0.067138671875,
0.03118896484375,
-0.281005859375,
-0.251953125,
-0.51708984375,
-0.67333984375,
0.19970703125,
-0.292236328125,
-0.25927734375,
0.5537109375,
-0.904296875,
0.304931640625,
-0.2025146484375,
0.830078125,
-0.356689453125,
-0.213623046875,
0.619140625,
-0.55224609375,
-0.46240234375,
0.939453125,
-0.030975341796875,
0.1873779296875,
0.03338623046875,
0.8037109375,
0.153076171875,
1.5615234375,
0.71240234375,
-0.328369140625,
0.09771728515625,
0.4453125,
-0.2171630859375,
-0.427978515625,
-0.54931640625,
-0.078857421875,
-0.1517333984375,
-0.8408203125,
-0.2529296875,
0.2396240234375,
0.7236328125,
0.41796875,
-1.1416015625,
-0.236328125,
-0.0092620849609375,
-0.86669921875,
0.5234375,
0.2130126953125,
0.1123046875,
-0.01654052734375,
-0.035247802734375,
-0.271728515625,
-0.57275390625,
-0.371826171875,
-0.46142578125,
0.56005859375,
-0.56396484375,
-0.78173828125,
-0.3759765625,
-0.90673828125,
-0.177490234375,
-0.07122802734375,
-0.201416015625,
-0.6044921875,
0.255126953125,
0.46044921875,
0.462646484375,
0.5888671875,
-0.007709503173828125,
0.259521484375,
1.4697265625,
1.0849609375,
-0.351806640625,
0.662109375,
0.5234375,
-0.120849609375,
0.5498046875,
-0.0158843994140625,
0.62255859375,
-0.081787109375,
0.41552734375,
-0.43408203125,
0.1666259765625,
-0.541015625,
-1.2900390625,
0.3037109375,
0.57177734375,
0.342529296875,
-0.50390625,
-1.0234375,
-0.0765380859375,
-1.0771484375,
0.2193603515625,
-0.77294921875,
0.90966796875,
-0.291748046875,
0.07073974609375,
-0.171142578125,
-1.3349609375,
4.4375,
1.11328125,
1.10546875,
0.488525390625,
0.00246429443359375,
0.900390625,
0.4306640625,
-0.462158203125,
-0.2342529296875,
-0.85498046875,
0.47216796875,
-0.360595703125,
-0.1683349609375,
0.458984375,
0.29443359375,
0.296875,
-0.2249755859375,
0.0826416015625,
-0.1356201171875,
-0.748046875,
-0.91259765625,
0.05572509765625,
-0.17041015625,
0.619140625,
-0.06695556640625,
0.011077880859375,
0.552734375,
-0.73095703125,
-0.167236328125,
-0.57666015625,
0.0482177734375,
-0.33837890625,
0.96484375,
0.0941162109375,
-0.3583984375,
0.62548828125,
-0.08648681640625,
-0.27978515625,
-0.369140625,
0.10589599609375,
-0.253173828125,
0.069580078125,
0.72314453125,
-0.5419921875,
-0.271240234375,
0.48779296875,
-0.80859375,
0.137939453125,
0.1893310546875,
-0.68408203125,
0.712890625,
0.078857421875,
0.5546875,
-0.9921875,
-0.435546875,
0.314697265625,
0.262451171875,
-0.25048828125,
-0.53759765625,
0.361328125,
0.255126953125,
0.391845703125,
-0.259033203125,
0.1259765625,
-0.7822265625,
0.6572265625,
-0.2193603515625,
0.70263671875,
-0.3740234375,
0.055145263671875,
0.0037975311279296875,
0.0848388671875,
-0.1812744140625,
-0.55810546875,
0.5205078125,
-0.1483154296875,
-0.517578125,
0.82421875,
0.51318359375,
-0.65087890625,
0.046234130859375,
0.0599365234375,
-0.24560546875,
-0.2164306640625,
0.78515625,
1.0595703125,
-0.84814453125,
-0.0183868408203125,
0.053497314453125,
0.485107421875,
0.18994140625,
0.6005859375,
0.353271484375,
-0.343994140625,
-0.239990234375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
The tycoon of a winery empire in Mondstadt, unmatched in every possible way. A thinker in the Knights of Favonius with an exotic appearance.
This time, the brothers are dealing with a strange piece of wood marked with their names. This plank of wood can be represented as a string of n characters. Each character is either a 'D' or a 'K'. You want to make some number of cuts (possibly 0) on this string, partitioning it into several contiguous pieces, each with length at least 1. Both brothers act with dignity, so they want to split the wood as evenly as possible. They want to know the maximum number of pieces you can split the wood into such that the ratios of the number of occurrences of 'D' to the number of occurrences of 'K' in each chunk are the same.
Kaeya, the curious thinker, is interested in the solution for multiple scenarios. He wants to know the answer for every prefix of the given string. Help him to solve this problem!
For a string we define a ratio as a:b where 'D' appears in it a times, and 'K' appears b times. Note that a or b can equal 0, but not both. Ratios a:b and c:d are considered equal if and only if aâ‹… d = bâ‹… c.
For example, for the string 'DDD' the ratio will be 3:0, for 'DKD' — 2:1, for 'DKK' — 1:2, and for 'KKKKDD' — 2:4. Note that the ratios of the latter two strings are equal to each other, but they are not equal to the ratios of the first two strings.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 1000). Description of the test cases follows.
The first line of each test case contains an integer n (1 ≤ n ≤ 5 ⋅ 10^5) — the length of the wood.
The second line of each test case contains a string s of length n. Every character of s will be either 'D' or 'K'.
It is guaranteed that the sum of n over all test cases does not exceed 5 â‹… 10^5.
Output
For each test case, output n space separated integers. The i-th of these numbers should equal the answer for the prefix s_{1},s_{2},...,s_{i}.
Example
Input
5
3
DDK
6
DDDDDD
4
DKDK
1
D
9
DKDKDDDDK
Output
1 2 1
1 2 3 4 5 6
1 1 1 2
1
1 1 1 2 1 2 1 1 3
Note
For the first test case, there is no way to partition 'D' or 'DDK' into more than one block with equal ratios of numbers of 'D' and 'K', while you can split 'DD' into 'D' and 'D'.
For the second test case, you can split each prefix of length i into i blocks 'D'.
Tags: data structures, dp, hashing, number theory
Correct Solution:
```
import math
a=[]
for s in[*open(0)][2::2]:
D={};d=k=0
for c in s[:-1]:
if c<'K':d+=1
else:k+=1
g=math.gcd(d,k);l=(d/g,k/g);D[l]=D.get(l,0)+1;a+=D[l],
print(*a)
```
| 44,837
|
[
0.16162109375,
0.2286376953125,
0.38818359375,
0.376953125,
-0.69921875,
-0.525390625,
-0.042694091796875,
0.19482421875,
-0.1031494140625,
0.83544921875,
0.7373046875,
-0.29345703125,
0.002216339111328125,
-0.489501953125,
-0.37353515625,
0.461669921875,
-0.73291015625,
-0.61279296875,
-0.297119140625,
0.07720947265625,
0.66748046875,
0.12005615234375,
-1.3876953125,
-0.294189453125,
-0.45654296875,
1.205078125,
0.66357421875,
0.224365234375,
1.1904296875,
1.068359375,
0.11749267578125,
-0.2049560546875,
0.439208984375,
-0.94873046875,
-0.3623046875,
-0.26220703125,
0.54150390625,
-0.60791015625,
-0.387939453125,
-0.50732421875,
0.1795654296875,
-0.261474609375,
0.3916015625,
-0.4248046875,
-0.5341796875,
0.344482421875,
-0.454833984375,
-0.69921875,
-0.255126953125,
-0.4609375,
0.2291259765625,
-0.401123046875,
0.64697265625,
-0.256591796875,
0.2366943359375,
-0.07391357421875,
-0.1951904296875,
0.437255859375,
-0.51220703125,
0.47412109375,
0.461181640625,
-0.189453125,
-0.36865234375,
-0.69287109375,
0.1719970703125,
0.2430419921875,
-0.21240234375,
-0.283203125,
-0.130615234375,
-1.0068359375,
-0.298828125,
0.261474609375,
-0.2188720703125,
-0.1104736328125,
-0.381103515625,
-0.059326171875,
0.0865478515625,
0.079345703125,
-0.2578125,
0.84033203125,
0.28271484375,
0.77099609375,
0.1981201171875,
0.2939453125,
-0.6689453125,
-0.60546875,
0.2347412109375,
0.38818359375,
-0.11383056640625,
-0.272705078125,
-0.214599609375,
0.484619140625,
-0.136474609375,
-0.092041015625,
0.41796875,
0.70458984375,
-0.06634521484375,
0.9755859375,
0.1993408203125,
0.1304931640625,
1.2392578125,
1.0791015625,
-0.7314453125,
0.67822265625,
-0.479736328125,
0.1688232421875,
0.4375,
0.2445068359375,
-0.08319091796875,
-0.271728515625,
0.07891845703125,
-0.342041015625,
0.52685546875,
0.62060546875,
-0.245849609375,
0.5888671875,
-0.31787109375,
0.404052734375,
-0.73193359375,
-0.0770263671875,
0.7099609375,
0.1990966796875,
0.640625,
-0.11529541015625,
0.01983642578125,
-0.10284423828125,
-0.30615234375,
0.86083984375,
-0.6162109375,
-0.388916015625,
0.76806640625,
-0.02410888671875,
-0.1031494140625,
0.206787109375,
0.27587890625,
0.3701171875,
-0.097412109375,
0.61767578125,
0.5634765625,
-0.26416015625,
0.84423828125,
0.451171875,
-0.61962890625,
1.3349609375,
0.494384765625,
0.1474609375,
0.3974609375,
0.3916015625,
-0.63720703125,
0.301025390625,
-1.005859375,
0.6953125,
-0.2022705078125,
0.07177734375,
-0.55224609375,
0.16064453125,
-0.1195068359375,
0.62109375,
0.1458740234375,
-0.125,
-0.1163330078125,
0.03143310546875,
-0.064453125,
0.70654296875,
-0.5185546875,
0.7568359375,
-0.681640625,
-0.29052734375,
-0.257568359375,
-0.3544921875,
0.27392578125,
-0.11517333984375,
-0.449951171875,
0.81298828125,
0.5654296875,
0.9365234375,
0.86474609375,
-0.5546875,
0.1016845703125,
0.4775390625,
-0.100341796875,
0.1385498046875,
0.66748046875,
0.5419921875,
-0.10101318359375,
0.37939453125,
-0.285400390625,
-0.478271484375,
-0.98388671875,
-0.352294921875,
0.1611328125,
0.5966796875,
-1.013671875,
0.150634765625,
0.309814453125,
-0.06390380859375,
-0.568359375,
0.078857421875,
-0.02764892578125,
-0.99951171875,
-0.462646484375,
0.5869140625,
-0.363037109375,
0.497314453125,
-0.158935546875,
-0.84130859375,
0.4580078125,
0.9921875,
-0.697265625,
0.28857421875,
0.37255859375,
0.10687255859375,
-0.019195556640625,
0.113037109375,
0.1551513671875,
-0.066650390625,
-0.5595703125,
0.81884765625,
-0.407958984375,
0.17041015625,
-0.0787353515625,
0.8232421875,
0.25634765625,
0.171142578125,
-0.290771484375,
-0.5126953125,
0.32470703125,
1.5068359375,
0.329345703125,
0.284423828125,
0.050201416015625,
1.0791015625,
0.51708984375,
1.0546875,
0.1572265625,
0.150390625,
0.60302734375,
0.77099609375,
0.07611083984375,
0.136474609375,
-0.09613037109375,
0.460205078125,
0.43701171875,
0.2890625,
0.287109375,
0.5703125,
-0.164794921875,
0.1224365234375,
-0.59375,
0.46533203125,
-0.044586181640625,
0.62353515625,
0.392578125,
0.03662109375,
-0.8916015625,
-0.12890625,
0.1524658203125,
1.0908203125,
-0.276611328125,
-0.59716796875,
-0.36328125,
0.04168701171875,
0.291259765625,
-0.027130126953125,
0.03521728515625,
0.401123046875,
0.5283203125,
0.62646484375,
-0.2607421875,
-0.21044921875,
-1.05078125,
-1.125,
-0.80419921875,
-0.65478515625,
-0.485107421875,
0.0244140625,
0.227783203125,
-0.68701171875,
-0.049957275390625,
0.00785064697265625,
-0.50390625,
0.06805419921875,
-0.775390625,
0.76611328125,
-0.3056640625,
0.59619140625,
-0.75927734375,
0.450439453125,
-0.353271484375,
1.166015625,
-0.80859375,
-0.330810546875,
-0.09173583984375,
-0.6591796875,
0.305419921875,
0.10162353515625,
-0.10467529296875,
-0.349609375,
-0.145751953125,
-1.00390625,
-0.34033203125,
-0.265625,
0.0199127197265625,
-0.203369140625,
-0.6630859375,
0.84912109375,
0.467529296875,
-0.73193359375,
0.57763671875,
0.97412109375,
-0.73046875,
0.324462890625,
0.73291015625,
0.1676025390625,
-0.75,
1.5048828125,
0.6328125,
0.289306640625,
-0.7685546875,
-0.60986328125,
-0.53076171875,
-0.18505859375,
0.1624755859375,
-0.5849609375,
-0.311767578125,
0.5556640625,
0.1295166015625,
-1.044921875,
0.10235595703125,
-0.72607421875,
-1.18359375,
-0.061279296875,
-0.6884765625,
0.9189453125,
0.466064453125,
-0.0748291015625,
-0.00879669189453125,
-0.67333984375,
0.281005859375,
0.62158203125,
0.424072265625,
-0.61181640625,
0.166259765625,
0.61669921875,
-0.0310821533203125,
0.04949951171875,
0.1324462890625,
-0.5810546875,
-0.057830810546875,
-0.224365234375,
0.12158203125,
0.3994140625,
0.08880615234375,
0.39697265625,
0.468994140625,
0.78271484375,
-0.9208984375,
-0.212890625,
-0.10675048828125,
0.5224609375,
0.396484375,
0.50048828125,
0.367431640625,
0.1995849609375,
-0.95263671875,
-1.1806640625,
-0.0307159423828125,
0.53369140625,
0.12481689453125,
-0.91943359375,
1.029296875,
0.3623046875,
-0.32080078125,
0.59423828125,
-0.63720703125,
-0.22265625,
0.6923828125,
-0.0266876220703125,
0.431884765625,
-0.77978515625,
0.34375,
-0.07958984375,
0.29150390625,
0.91064453125,
0.43701171875,
0.6748046875,
-0.165771484375,
-0.54931640625,
-0.2802734375,
-0.1158447265625,
0.0147552490234375,
-0.364013671875,
0.587890625,
-0.487548828125,
-0.50146484375,
-0.77197265625,
0.46875,
0.7451171875,
0.609375,
-0.1776123046875,
0.400634765625,
0.48193359375,
0.7783203125,
0.385498046875,
-0.48095703125,
0.2281494140625,
-0.82080078125,
0.80517578125,
0.445068359375,
-0.107666015625,
-0.5888671875,
-0.55078125,
-0.29541015625,
-0.04986572265625,
0.455810546875,
-0.1866455078125,
-0.826171875,
0.04119873046875,
0.06378173828125,
0.84716796875,
0.0760498046875,
-0.15380859375,
-0.0026397705078125,
0.2149658203125,
0.66943359375,
-0.95703125,
-0.0227813720703125,
-0.611328125,
0.470947265625,
0.44189453125,
-0.421630859375,
-0.66748046875,
-0.64892578125,
-0.732421875,
-0.239990234375,
0.03753662109375,
0.52294921875,
0.07989501953125,
0.16455078125,
-1.2197265625,
0.59912109375,
0.1866455078125,
-0.6767578125,
0.2164306640625,
0.092529296875,
0.51611328125,
-0.277587890625,
0.943359375,
-0.17333984375,
-0.75048828125,
0.34912109375,
-1.044921875,
0.0239715576171875,
-0.2198486328125,
0.21875,
-0.6025390625,
-0.025177001953125,
-0.048309326171875,
0.64453125,
-0.321044921875,
0.373046875,
-0.161865234375,
0.1497802734375,
-0.85400390625,
-0.8955078125,
0.61376953125,
-0.33349609375,
-0.352783203125,
1.2900390625,
-0.01010894775390625,
-0.62548828125,
-0.082763671875,
0.6171875,
-0.46630859375,
0.353271484375,
-0.43701171875,
0.478759765625,
-0.1964111328125,
-0.31689453125,
-0.06842041015625,
-0.81103515625,
0.84375,
0.10321044921875,
-0.66259765625,
-0.446533203125,
-1.1181640625,
-0.458251953125,
-0.1116943359375,
-0.572265625,
0.1378173828125,
0.280517578125,
-0.028533935546875,
-0.350830078125,
-0.330810546875,
-0.9912109375,
-0.2191162109375,
-0.5927734375,
-0.18896484375,
0.486572265625,
0.96728515625,
0.4775390625,
0.085693359375,
-0.51953125,
0.024658203125,
-0.422607421875,
-0.3134765625,
-0.58349609375,
0.261474609375,
-0.09088134765625,
-0.2027587890625,
-0.34130859375,
0.15869140625,
0.361572265625,
0.48974609375,
0.71240234375,
0.290771484375,
0.477294921875,
0.47802734375,
-0.322998046875,
1.150390625,
0.362548828125,
-1.38671875,
-0.650390625,
0.9970703125,
0.125732421875,
0.8095703125,
0.006961822509765625,
-0.73583984375,
-0.66748046875,
-1.0068359375,
0.0594482421875,
-0.55517578125,
-0.07769775390625,
-0.78173828125,
-0.206298828125,
-0.35302734375,
0.71728515625,
-0.6669921875,
-0.79052734375,
0.2373046875,
-0.9716796875,
0.11480712890625,
-0.1253662109375,
-0.5576171875,
-0.84326171875,
0.145263671875,
-0.215087890625,
0.6728515625,
-0.06939697265625,
0.154296875,
-0.15283203125,
-0.20947265625,
0.1533203125,
-0.0273895263671875,
-0.578125,
-0.384521484375,
0.10870361328125,
-0.0748291015625,
-0.5205078125,
0.043792724609375,
-0.359375,
0.324951171875,
-1.009765625,
-0.0992431640625,
-0.148681640625,
-0.458984375,
-0.02105712890625,
-0.4365234375,
0.9833984375,
-0.33447265625,
-0.17236328125,
-0.336181640625,
-0.00933074951171875,
0.93798828125,
-0.0894775390625,
-0.385498046875,
-0.83349609375,
-0.47802734375,
-1.2529296875,
0.260498046875,
-0.466064453125,
-0.326904296875,
-0.72412109375,
-0.494873046875,
0.64306640625,
-0.434814453125,
0.52294921875,
1.119140625,
0.168212890625,
0.11700439453125,
-0.7197265625,
0.798828125,
0.393798828125,
-0.9599609375,
0.072998046875,
0.054718017578125,
-0.9599609375,
0.64111328125,
-0.388916015625,
-0.93701171875,
-0.430908203125,
0.57373046875,
0.9755859375,
-0.414306640625,
0.56884765625,
0.035491943359375,
-1.0361328125,
-0.57861328125,
0.448486328125,
0.293212890625,
0.11944580078125,
0.78125,
-0.17431640625,
-0.1861572265625,
0.378662109375,
0.26318359375,
-0.2459716796875,
-0.67626953125,
1.400390625,
0.021881103515625,
-0.346435546875,
0.8203125,
0.3896484375,
-1.0498046875,
-0.556640625,
-0.08013916015625,
0.1817626953125,
-0.1646728515625,
-0.8173828125,
0.215087890625,
0.626953125,
-0.6015625,
0.16064453125,
0.421630859375,
0.09490966796875,
0.55810546875,
0.24072265625,
0.51025390625,
-0.5244140625,
0.57861328125,
0.78173828125,
-0.5625,
-0.2568359375,
-0.91552734375,
-0.31201171875,
0.00804901123046875,
-0.068603515625,
0.62548828125,
-0.6396484375,
-0.239501953125,
0.170654296875,
-0.0277557373046875,
0.8828125,
0.041748046875,
-0.409423828125,
0.609375,
-0.642578125,
-0.446533203125,
0.046905517578125,
0.1884765625,
-0.0205230712890625,
0.46435546875,
-0.5234375,
0.5693359375,
0.303466796875,
0.375732421875,
-0.2744140625,
-0.90966796875,
-0.4609375,
-0.876953125,
-0.07318115234375,
-0.55859375,
-0.92919921875,
0.0279541015625,
0.423583984375,
-0.09539794921875,
-0.93310546875,
0.280029296875,
0.30615234375,
-0.52490234375,
1.0341796875,
-1.1611328125,
0.372802734375,
-0.66064453125,
-0.249755859375,
-0.53076171875,
-0.35693359375,
-0.11865234375,
-0.014862060546875,
-0.6572265625,
0.078857421875,
-0.27001953125,
0.7060546875,
-0.356689453125,
0.54296875,
0.038360595703125,
-0.86181640625,
-0.07281494140625,
0.1497802734375,
-0.1629638671875,
0.53076171875,
0.9326171875,
0.01020050048828125,
0.2489013671875,
-0.16552734375,
-0.32080078125,
-0.1895751953125,
0.303955078125,
0.4560546875,
-0.1141357421875,
-0.298828125,
-0.4404296875,
-0.31396484375,
-1.134765625,
0.374267578125,
-0.55126953125,
-0.07440185546875,
-0.088623046875,
0.0108642578125,
0.2034912109375,
1.0380859375,
-0.60107421875,
0.56201171875,
-0.10015869140625,
0.2137451171875,
0.43994140625,
-0.004444122314453125,
-0.048248291015625,
0.324462890625,
0.323486328125,
-0.64794921875,
0.07550048828125,
0.290283203125,
0.08087158203125,
0.2181396484375,
-0.1710205078125,
-0.8779296875,
-1.0361328125,
-0.380615234375,
-0.111572265625,
0.5546875,
0.46875,
-0.31982421875,
-0.2978515625,
-0.1285400390625,
-0.791015625,
-0.024383544921875,
-1.263671875,
-0.77880859375,
0.55126953125,
0.0006604194641113281,
-0.0007390975952148438,
0.1087646484375,
-0.4755859375,
-0.556640625,
-0.26708984375,
0.1793212890625,
-0.359375,
0.5009765625,
-0.1192626953125,
0.456787109375,
-0.03607177734375,
-0.1556396484375,
0.074951171875,
0.70458984375,
-0.87890625,
-0.57470703125,
-0.2197265625,
1.2021484375,
0.1715087890625,
0.0119781494140625,
-0.54052734375,
0.4375,
0.349365234375,
0.424560546875,
-0.1981201171875,
0.4853515625,
-0.08209228515625,
0.60498046875,
-0.7109375,
-0.011444091796875,
-0.2294921875,
0.410400390625,
0.08404541015625,
-0.4482421875,
-0.74609375,
0.8642578125,
0.3671875,
-0.08013916015625,
1.0029296875,
0.224609375,
0.060699462890625,
-0.031585693359375,
-0.031494140625,
-0.287353515625,
0.302001953125,
0.255859375,
0.4833984375,
-0.395751953125,
0.1297607421875,
0.9384765625,
0.184814453125,
0.0821533203125,
0.65771484375,
0.1387939453125,
0.022552490234375,
0.42041015625,
-0.051605224609375,
0.02972412109375,
0.36865234375,
-0.427734375,
0.3056640625,
-0.5087890625,
0.036712646484375,
-0.380126953125,
-0.67626953125,
0.74365234375,
-0.267333984375,
-0.38330078125,
0.0765380859375,
-0.45751953125,
0.2349853515625,
0.460205078125,
-0.30517578125,
-0.1190185546875,
0.93359375,
0.767578125,
0.572265625,
0.7802734375,
0.373291015625,
0.3642578125,
-1.23828125,
0.4365234375,
0.2186279296875,
0.291748046875,
-0.187255859375,
-0.61865234375,
-0.953125,
0.1761474609375,
-0.212158203125,
-0.285400390625,
0.65966796875,
-0.673828125,
0.1510009765625,
-0.350830078125,
0.78369140625,
-0.71630859375,
0.260009765625,
-0.0518798828125,
-0.12152099609375,
-0.5966796875,
0.81494140625,
-0.31201171875,
0.54296875,
0.432861328125,
0.9013671875,
0.4130859375,
1.46484375,
0.62158203125,
0.09002685546875,
0.1385498046875,
0.35546875,
-0.52587890625,
-0.39453125,
-0.69091796875,
-0.4375,
-0.126953125,
-0.72900390625,
-0.55078125,
-0.1724853515625,
0.72314453125,
0.235595703125,
-1.0341796875,
-0.4423828125,
0.1912841796875,
-0.98681640625,
0.1417236328125,
0.198974609375,
0.66845703125,
0.2054443359375,
-0.282470703125,
0.097412109375,
-0.54345703125,
0.1484375,
-0.50732421875,
0.68505859375,
-0.68310546875,
-0.58447265625,
-0.4619140625,
-0.59765625,
-0.2357177734375,
-0.556640625,
-0.38330078125,
-0.70361328125,
0.64111328125,
0.170654296875,
0.0205535888671875,
0.53662109375,
-0.319580078125,
-0.0347900390625,
0.78369140625,
1.16796875,
-0.1275634765625,
0.98388671875,
0.39306640625,
-0.115478515625,
0.1324462890625,
-0.435791015625,
0.01422882080078125,
-0.173828125,
0.1529541015625,
-0.5341796875,
0.10833740234375,
-0.439453125,
-1.212890625,
0.281005859375,
0.2333984375,
0.04595947265625,
-0.92578125,
-1.1337890625,
-0.1302490234375,
-1.1650390625,
-0.474365234375,
-0.7802734375,
0.48486328125,
-0.49072265625,
0.2236328125,
0.14990234375,
-1.0341796875,
4.3671875,
0.68359375,
0.49560546875,
0.095458984375,
0.21240234375,
1.1572265625,
0.487060546875,
-0.83056640625,
-0.401123046875,
-0.459228515625,
0.75146484375,
-0.1556396484375,
-0.00858306884765625,
0.7001953125,
0.300048828125,
0.50927734375,
-0.5615234375,
-0.0214691162109375,
0.004207611083984375,
-1.029296875,
-0.80859375,
0.48095703125,
0.460693359375,
0.310546875,
0.283935546875,
0.2061767578125,
0.61572265625,
-0.55419921875,
-0.088623046875,
-0.79052734375,
0.268310546875,
-0.68505859375,
0.8203125,
0.01898193359375,
0.1461181640625,
0.363037109375,
0.077880859375,
-0.476318359375,
-0.1834716796875,
0.63330078125,
-0.180419921875,
0.06072998046875,
0.62646484375,
-0.57763671875,
-0.258544921875,
0.53369140625,
-0.0947265625,
0.2666015625,
0.09521484375,
-1.013671875,
1.177734375,
-0.2247314453125,
0.8583984375,
-0.91162109375,
-1.0078125,
0.26171875,
0.09857177734375,
0.07464599609375,
-0.330322265625,
0.201904296875,
0.475830078125,
0.67724609375,
0.1922607421875,
0.284423828125,
-0.77783203125,
0.6650390625,
0.451416015625,
0.197265625,
-0.417724609375,
-0.1748046875,
-0.5537109375,
-0.1976318359375,
-0.25,
-0.52587890625,
0.9716796875,
0.5146484375,
-0.34521484375,
0.814453125,
0.78857421875,
-0.69921875,
0.0850830078125,
-0.95556640625,
-0.08551025390625,
-0.4033203125,
0.339111328125,
1.4375,
-0.5908203125,
0.046630859375,
-0.132080078125,
0.68212890625,
0.6103515625,
0.68115234375,
0.16943359375,
-0.705078125,
-0.27978515625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
The tycoon of a winery empire in Mondstadt, unmatched in every possible way. A thinker in the Knights of Favonius with an exotic appearance.
This time, the brothers are dealing with a strange piece of wood marked with their names. This plank of wood can be represented as a string of n characters. Each character is either a 'D' or a 'K'. You want to make some number of cuts (possibly 0) on this string, partitioning it into several contiguous pieces, each with length at least 1. Both brothers act with dignity, so they want to split the wood as evenly as possible. They want to know the maximum number of pieces you can split the wood into such that the ratios of the number of occurrences of 'D' to the number of occurrences of 'K' in each chunk are the same.
Kaeya, the curious thinker, is interested in the solution for multiple scenarios. He wants to know the answer for every prefix of the given string. Help him to solve this problem!
For a string we define a ratio as a:b where 'D' appears in it a times, and 'K' appears b times. Note that a or b can equal 0, but not both. Ratios a:b and c:d are considered equal if and only if aâ‹… d = bâ‹… c.
For example, for the string 'DDD' the ratio will be 3:0, for 'DKD' — 2:1, for 'DKK' — 1:2, and for 'KKKKDD' — 2:4. Note that the ratios of the latter two strings are equal to each other, but they are not equal to the ratios of the first two strings.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 1000). Description of the test cases follows.
The first line of each test case contains an integer n (1 ≤ n ≤ 5 ⋅ 10^5) — the length of the wood.
The second line of each test case contains a string s of length n. Every character of s will be either 'D' or 'K'.
It is guaranteed that the sum of n over all test cases does not exceed 5 â‹… 10^5.
Output
For each test case, output n space separated integers. The i-th of these numbers should equal the answer for the prefix s_{1},s_{2},...,s_{i}.
Example
Input
5
3
DDK
6
DDDDDD
4
DKDK
1
D
9
DKDKDDDDK
Output
1 2 1
1 2 3 4 5 6
1 1 1 2
1
1 1 1 2 1 2 1 1 3
Note
For the first test case, there is no way to partition 'D' or 'DDK' into more than one block with equal ratios of numbers of 'D' and 'K', while you can split 'DD' into 'D' and 'D'.
For the second test case, you can split each prefix of length i into i blocks 'D'.
Tags: data structures, dp, hashing, number theory
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
from math import ceil, floor, pow, sqrt, gcd
from collections import Counter, defaultdict
from itertools import permutations, combinations
from time import time, sleep
BUFSIZE = 8192
MOD = 1000000007
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.writable else None
def read(self):
while True:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
if not b:
break
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines = 0
return self.buffer.read()
def readline(self):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.newlines = b.count(b"\n") + (not b)
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines -= 1
return self.buffer.readline()
def flush(self):
if self.writable:
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
stdin, stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
from os import path
if path.exists('tc.txt'):
stdin = open('tc.txt', 'r')
def gmi(): return map(int, stdin.readline().strip().split())
def gms(): return map(str, stdin.readline().strip().split())
def gari(): return list(map(int, stdin.readline().strip().split()))
def gart(): return tuple(map(int, stdin.readline().strip().split()))
def gars(): return list(map(str, stdin.readline().strip().split()))
def gs(): return stdin.readline().strip()
def gls(): return list(stdin.readline().strip())
def gi(): return int(stdin.readline())
def pri(i): stdout.write(f"{i}\n")
def priar(ar): stdout.write(" ".join(map(str, ar))+"\n")
def prist(s): stdout.write("".join(map(str, s))+"\n")
dct = defaultdict(int)
tc = gi()
while tc:
tc -= 1
n = gi()
s = gs()
d, k = 0, 0
dct.clear()
for i in s:
if i == 'D':
d += 1
else:
k += 1
g = gcd(d, k)
rd, rk = d//g, k//g
dct[(rd, rk)] += 1
stdout.write(str(dct[rd, rk]) + " ")
stdout.write("\n")
```
| 44,838
|
[
0.16162109375,
0.2286376953125,
0.38818359375,
0.376953125,
-0.69921875,
-0.525390625,
-0.042694091796875,
0.19482421875,
-0.1031494140625,
0.83544921875,
0.7373046875,
-0.29345703125,
0.002216339111328125,
-0.489501953125,
-0.37353515625,
0.461669921875,
-0.73291015625,
-0.61279296875,
-0.297119140625,
0.07720947265625,
0.66748046875,
0.12005615234375,
-1.3876953125,
-0.294189453125,
-0.45654296875,
1.205078125,
0.66357421875,
0.224365234375,
1.1904296875,
1.068359375,
0.11749267578125,
-0.2049560546875,
0.439208984375,
-0.94873046875,
-0.3623046875,
-0.26220703125,
0.54150390625,
-0.60791015625,
-0.387939453125,
-0.50732421875,
0.1795654296875,
-0.261474609375,
0.3916015625,
-0.4248046875,
-0.5341796875,
0.344482421875,
-0.454833984375,
-0.69921875,
-0.255126953125,
-0.4609375,
0.2291259765625,
-0.401123046875,
0.64697265625,
-0.256591796875,
0.2366943359375,
-0.07391357421875,
-0.1951904296875,
0.437255859375,
-0.51220703125,
0.47412109375,
0.461181640625,
-0.189453125,
-0.36865234375,
-0.69287109375,
0.1719970703125,
0.2430419921875,
-0.21240234375,
-0.283203125,
-0.130615234375,
-1.0068359375,
-0.298828125,
0.261474609375,
-0.2188720703125,
-0.1104736328125,
-0.381103515625,
-0.059326171875,
0.0865478515625,
0.079345703125,
-0.2578125,
0.84033203125,
0.28271484375,
0.77099609375,
0.1981201171875,
0.2939453125,
-0.6689453125,
-0.60546875,
0.2347412109375,
0.38818359375,
-0.11383056640625,
-0.272705078125,
-0.214599609375,
0.484619140625,
-0.136474609375,
-0.092041015625,
0.41796875,
0.70458984375,
-0.06634521484375,
0.9755859375,
0.1993408203125,
0.1304931640625,
1.2392578125,
1.0791015625,
-0.7314453125,
0.67822265625,
-0.479736328125,
0.1688232421875,
0.4375,
0.2445068359375,
-0.08319091796875,
-0.271728515625,
0.07891845703125,
-0.342041015625,
0.52685546875,
0.62060546875,
-0.245849609375,
0.5888671875,
-0.31787109375,
0.404052734375,
-0.73193359375,
-0.0770263671875,
0.7099609375,
0.1990966796875,
0.640625,
-0.11529541015625,
0.01983642578125,
-0.10284423828125,
-0.30615234375,
0.86083984375,
-0.6162109375,
-0.388916015625,
0.76806640625,
-0.02410888671875,
-0.1031494140625,
0.206787109375,
0.27587890625,
0.3701171875,
-0.097412109375,
0.61767578125,
0.5634765625,
-0.26416015625,
0.84423828125,
0.451171875,
-0.61962890625,
1.3349609375,
0.494384765625,
0.1474609375,
0.3974609375,
0.3916015625,
-0.63720703125,
0.301025390625,
-1.005859375,
0.6953125,
-0.2022705078125,
0.07177734375,
-0.55224609375,
0.16064453125,
-0.1195068359375,
0.62109375,
0.1458740234375,
-0.125,
-0.1163330078125,
0.03143310546875,
-0.064453125,
0.70654296875,
-0.5185546875,
0.7568359375,
-0.681640625,
-0.29052734375,
-0.257568359375,
-0.3544921875,
0.27392578125,
-0.11517333984375,
-0.449951171875,
0.81298828125,
0.5654296875,
0.9365234375,
0.86474609375,
-0.5546875,
0.1016845703125,
0.4775390625,
-0.100341796875,
0.1385498046875,
0.66748046875,
0.5419921875,
-0.10101318359375,
0.37939453125,
-0.285400390625,
-0.478271484375,
-0.98388671875,
-0.352294921875,
0.1611328125,
0.5966796875,
-1.013671875,
0.150634765625,
0.309814453125,
-0.06390380859375,
-0.568359375,
0.078857421875,
-0.02764892578125,
-0.99951171875,
-0.462646484375,
0.5869140625,
-0.363037109375,
0.497314453125,
-0.158935546875,
-0.84130859375,
0.4580078125,
0.9921875,
-0.697265625,
0.28857421875,
0.37255859375,
0.10687255859375,
-0.019195556640625,
0.113037109375,
0.1551513671875,
-0.066650390625,
-0.5595703125,
0.81884765625,
-0.407958984375,
0.17041015625,
-0.0787353515625,
0.8232421875,
0.25634765625,
0.171142578125,
-0.290771484375,
-0.5126953125,
0.32470703125,
1.5068359375,
0.329345703125,
0.284423828125,
0.050201416015625,
1.0791015625,
0.51708984375,
1.0546875,
0.1572265625,
0.150390625,
0.60302734375,
0.77099609375,
0.07611083984375,
0.136474609375,
-0.09613037109375,
0.460205078125,
0.43701171875,
0.2890625,
0.287109375,
0.5703125,
-0.164794921875,
0.1224365234375,
-0.59375,
0.46533203125,
-0.044586181640625,
0.62353515625,
0.392578125,
0.03662109375,
-0.8916015625,
-0.12890625,
0.1524658203125,
1.0908203125,
-0.276611328125,
-0.59716796875,
-0.36328125,
0.04168701171875,
0.291259765625,
-0.027130126953125,
0.03521728515625,
0.401123046875,
0.5283203125,
0.62646484375,
-0.2607421875,
-0.21044921875,
-1.05078125,
-1.125,
-0.80419921875,
-0.65478515625,
-0.485107421875,
0.0244140625,
0.227783203125,
-0.68701171875,
-0.049957275390625,
0.00785064697265625,
-0.50390625,
0.06805419921875,
-0.775390625,
0.76611328125,
-0.3056640625,
0.59619140625,
-0.75927734375,
0.450439453125,
-0.353271484375,
1.166015625,
-0.80859375,
-0.330810546875,
-0.09173583984375,
-0.6591796875,
0.305419921875,
0.10162353515625,
-0.10467529296875,
-0.349609375,
-0.145751953125,
-1.00390625,
-0.34033203125,
-0.265625,
0.0199127197265625,
-0.203369140625,
-0.6630859375,
0.84912109375,
0.467529296875,
-0.73193359375,
0.57763671875,
0.97412109375,
-0.73046875,
0.324462890625,
0.73291015625,
0.1676025390625,
-0.75,
1.5048828125,
0.6328125,
0.289306640625,
-0.7685546875,
-0.60986328125,
-0.53076171875,
-0.18505859375,
0.1624755859375,
-0.5849609375,
-0.311767578125,
0.5556640625,
0.1295166015625,
-1.044921875,
0.10235595703125,
-0.72607421875,
-1.18359375,
-0.061279296875,
-0.6884765625,
0.9189453125,
0.466064453125,
-0.0748291015625,
-0.00879669189453125,
-0.67333984375,
0.281005859375,
0.62158203125,
0.424072265625,
-0.61181640625,
0.166259765625,
0.61669921875,
-0.0310821533203125,
0.04949951171875,
0.1324462890625,
-0.5810546875,
-0.057830810546875,
-0.224365234375,
0.12158203125,
0.3994140625,
0.08880615234375,
0.39697265625,
0.468994140625,
0.78271484375,
-0.9208984375,
-0.212890625,
-0.10675048828125,
0.5224609375,
0.396484375,
0.50048828125,
0.367431640625,
0.1995849609375,
-0.95263671875,
-1.1806640625,
-0.0307159423828125,
0.53369140625,
0.12481689453125,
-0.91943359375,
1.029296875,
0.3623046875,
-0.32080078125,
0.59423828125,
-0.63720703125,
-0.22265625,
0.6923828125,
-0.0266876220703125,
0.431884765625,
-0.77978515625,
0.34375,
-0.07958984375,
0.29150390625,
0.91064453125,
0.43701171875,
0.6748046875,
-0.165771484375,
-0.54931640625,
-0.2802734375,
-0.1158447265625,
0.0147552490234375,
-0.364013671875,
0.587890625,
-0.487548828125,
-0.50146484375,
-0.77197265625,
0.46875,
0.7451171875,
0.609375,
-0.1776123046875,
0.400634765625,
0.48193359375,
0.7783203125,
0.385498046875,
-0.48095703125,
0.2281494140625,
-0.82080078125,
0.80517578125,
0.445068359375,
-0.107666015625,
-0.5888671875,
-0.55078125,
-0.29541015625,
-0.04986572265625,
0.455810546875,
-0.1866455078125,
-0.826171875,
0.04119873046875,
0.06378173828125,
0.84716796875,
0.0760498046875,
-0.15380859375,
-0.0026397705078125,
0.2149658203125,
0.66943359375,
-0.95703125,
-0.0227813720703125,
-0.611328125,
0.470947265625,
0.44189453125,
-0.421630859375,
-0.66748046875,
-0.64892578125,
-0.732421875,
-0.239990234375,
0.03753662109375,
0.52294921875,
0.07989501953125,
0.16455078125,
-1.2197265625,
0.59912109375,
0.1866455078125,
-0.6767578125,
0.2164306640625,
0.092529296875,
0.51611328125,
-0.277587890625,
0.943359375,
-0.17333984375,
-0.75048828125,
0.34912109375,
-1.044921875,
0.0239715576171875,
-0.2198486328125,
0.21875,
-0.6025390625,
-0.025177001953125,
-0.048309326171875,
0.64453125,
-0.321044921875,
0.373046875,
-0.161865234375,
0.1497802734375,
-0.85400390625,
-0.8955078125,
0.61376953125,
-0.33349609375,
-0.352783203125,
1.2900390625,
-0.01010894775390625,
-0.62548828125,
-0.082763671875,
0.6171875,
-0.46630859375,
0.353271484375,
-0.43701171875,
0.478759765625,
-0.1964111328125,
-0.31689453125,
-0.06842041015625,
-0.81103515625,
0.84375,
0.10321044921875,
-0.66259765625,
-0.446533203125,
-1.1181640625,
-0.458251953125,
-0.1116943359375,
-0.572265625,
0.1378173828125,
0.280517578125,
-0.028533935546875,
-0.350830078125,
-0.330810546875,
-0.9912109375,
-0.2191162109375,
-0.5927734375,
-0.18896484375,
0.486572265625,
0.96728515625,
0.4775390625,
0.085693359375,
-0.51953125,
0.024658203125,
-0.422607421875,
-0.3134765625,
-0.58349609375,
0.261474609375,
-0.09088134765625,
-0.2027587890625,
-0.34130859375,
0.15869140625,
0.361572265625,
0.48974609375,
0.71240234375,
0.290771484375,
0.477294921875,
0.47802734375,
-0.322998046875,
1.150390625,
0.362548828125,
-1.38671875,
-0.650390625,
0.9970703125,
0.125732421875,
0.8095703125,
0.006961822509765625,
-0.73583984375,
-0.66748046875,
-1.0068359375,
0.0594482421875,
-0.55517578125,
-0.07769775390625,
-0.78173828125,
-0.206298828125,
-0.35302734375,
0.71728515625,
-0.6669921875,
-0.79052734375,
0.2373046875,
-0.9716796875,
0.11480712890625,
-0.1253662109375,
-0.5576171875,
-0.84326171875,
0.145263671875,
-0.215087890625,
0.6728515625,
-0.06939697265625,
0.154296875,
-0.15283203125,
-0.20947265625,
0.1533203125,
-0.0273895263671875,
-0.578125,
-0.384521484375,
0.10870361328125,
-0.0748291015625,
-0.5205078125,
0.043792724609375,
-0.359375,
0.324951171875,
-1.009765625,
-0.0992431640625,
-0.148681640625,
-0.458984375,
-0.02105712890625,
-0.4365234375,
0.9833984375,
-0.33447265625,
-0.17236328125,
-0.336181640625,
-0.00933074951171875,
0.93798828125,
-0.0894775390625,
-0.385498046875,
-0.83349609375,
-0.47802734375,
-1.2529296875,
0.260498046875,
-0.466064453125,
-0.326904296875,
-0.72412109375,
-0.494873046875,
0.64306640625,
-0.434814453125,
0.52294921875,
1.119140625,
0.168212890625,
0.11700439453125,
-0.7197265625,
0.798828125,
0.393798828125,
-0.9599609375,
0.072998046875,
0.054718017578125,
-0.9599609375,
0.64111328125,
-0.388916015625,
-0.93701171875,
-0.430908203125,
0.57373046875,
0.9755859375,
-0.414306640625,
0.56884765625,
0.035491943359375,
-1.0361328125,
-0.57861328125,
0.448486328125,
0.293212890625,
0.11944580078125,
0.78125,
-0.17431640625,
-0.1861572265625,
0.378662109375,
0.26318359375,
-0.2459716796875,
-0.67626953125,
1.400390625,
0.021881103515625,
-0.346435546875,
0.8203125,
0.3896484375,
-1.0498046875,
-0.556640625,
-0.08013916015625,
0.1817626953125,
-0.1646728515625,
-0.8173828125,
0.215087890625,
0.626953125,
-0.6015625,
0.16064453125,
0.421630859375,
0.09490966796875,
0.55810546875,
0.24072265625,
0.51025390625,
-0.5244140625,
0.57861328125,
0.78173828125,
-0.5625,
-0.2568359375,
-0.91552734375,
-0.31201171875,
0.00804901123046875,
-0.068603515625,
0.62548828125,
-0.6396484375,
-0.239501953125,
0.170654296875,
-0.0277557373046875,
0.8828125,
0.041748046875,
-0.409423828125,
0.609375,
-0.642578125,
-0.446533203125,
0.046905517578125,
0.1884765625,
-0.0205230712890625,
0.46435546875,
-0.5234375,
0.5693359375,
0.303466796875,
0.375732421875,
-0.2744140625,
-0.90966796875,
-0.4609375,
-0.876953125,
-0.07318115234375,
-0.55859375,
-0.92919921875,
0.0279541015625,
0.423583984375,
-0.09539794921875,
-0.93310546875,
0.280029296875,
0.30615234375,
-0.52490234375,
1.0341796875,
-1.1611328125,
0.372802734375,
-0.66064453125,
-0.249755859375,
-0.53076171875,
-0.35693359375,
-0.11865234375,
-0.014862060546875,
-0.6572265625,
0.078857421875,
-0.27001953125,
0.7060546875,
-0.356689453125,
0.54296875,
0.038360595703125,
-0.86181640625,
-0.07281494140625,
0.1497802734375,
-0.1629638671875,
0.53076171875,
0.9326171875,
0.01020050048828125,
0.2489013671875,
-0.16552734375,
-0.32080078125,
-0.1895751953125,
0.303955078125,
0.4560546875,
-0.1141357421875,
-0.298828125,
-0.4404296875,
-0.31396484375,
-1.134765625,
0.374267578125,
-0.55126953125,
-0.07440185546875,
-0.088623046875,
0.0108642578125,
0.2034912109375,
1.0380859375,
-0.60107421875,
0.56201171875,
-0.10015869140625,
0.2137451171875,
0.43994140625,
-0.004444122314453125,
-0.048248291015625,
0.324462890625,
0.323486328125,
-0.64794921875,
0.07550048828125,
0.290283203125,
0.08087158203125,
0.2181396484375,
-0.1710205078125,
-0.8779296875,
-1.0361328125,
-0.380615234375,
-0.111572265625,
0.5546875,
0.46875,
-0.31982421875,
-0.2978515625,
-0.1285400390625,
-0.791015625,
-0.024383544921875,
-1.263671875,
-0.77880859375,
0.55126953125,
0.0006604194641113281,
-0.0007390975952148438,
0.1087646484375,
-0.4755859375,
-0.556640625,
-0.26708984375,
0.1793212890625,
-0.359375,
0.5009765625,
-0.1192626953125,
0.456787109375,
-0.03607177734375,
-0.1556396484375,
0.074951171875,
0.70458984375,
-0.87890625,
-0.57470703125,
-0.2197265625,
1.2021484375,
0.1715087890625,
0.0119781494140625,
-0.54052734375,
0.4375,
0.349365234375,
0.424560546875,
-0.1981201171875,
0.4853515625,
-0.08209228515625,
0.60498046875,
-0.7109375,
-0.011444091796875,
-0.2294921875,
0.410400390625,
0.08404541015625,
-0.4482421875,
-0.74609375,
0.8642578125,
0.3671875,
-0.08013916015625,
1.0029296875,
0.224609375,
0.060699462890625,
-0.031585693359375,
-0.031494140625,
-0.287353515625,
0.302001953125,
0.255859375,
0.4833984375,
-0.395751953125,
0.1297607421875,
0.9384765625,
0.184814453125,
0.0821533203125,
0.65771484375,
0.1387939453125,
0.022552490234375,
0.42041015625,
-0.051605224609375,
0.02972412109375,
0.36865234375,
-0.427734375,
0.3056640625,
-0.5087890625,
0.036712646484375,
-0.380126953125,
-0.67626953125,
0.74365234375,
-0.267333984375,
-0.38330078125,
0.0765380859375,
-0.45751953125,
0.2349853515625,
0.460205078125,
-0.30517578125,
-0.1190185546875,
0.93359375,
0.767578125,
0.572265625,
0.7802734375,
0.373291015625,
0.3642578125,
-1.23828125,
0.4365234375,
0.2186279296875,
0.291748046875,
-0.187255859375,
-0.61865234375,
-0.953125,
0.1761474609375,
-0.212158203125,
-0.285400390625,
0.65966796875,
-0.673828125,
0.1510009765625,
-0.350830078125,
0.78369140625,
-0.71630859375,
0.260009765625,
-0.0518798828125,
-0.12152099609375,
-0.5966796875,
0.81494140625,
-0.31201171875,
0.54296875,
0.432861328125,
0.9013671875,
0.4130859375,
1.46484375,
0.62158203125,
0.09002685546875,
0.1385498046875,
0.35546875,
-0.52587890625,
-0.39453125,
-0.69091796875,
-0.4375,
-0.126953125,
-0.72900390625,
-0.55078125,
-0.1724853515625,
0.72314453125,
0.235595703125,
-1.0341796875,
-0.4423828125,
0.1912841796875,
-0.98681640625,
0.1417236328125,
0.198974609375,
0.66845703125,
0.2054443359375,
-0.282470703125,
0.097412109375,
-0.54345703125,
0.1484375,
-0.50732421875,
0.68505859375,
-0.68310546875,
-0.58447265625,
-0.4619140625,
-0.59765625,
-0.2357177734375,
-0.556640625,
-0.38330078125,
-0.70361328125,
0.64111328125,
0.170654296875,
0.0205535888671875,
0.53662109375,
-0.319580078125,
-0.0347900390625,
0.78369140625,
1.16796875,
-0.1275634765625,
0.98388671875,
0.39306640625,
-0.115478515625,
0.1324462890625,
-0.435791015625,
0.01422882080078125,
-0.173828125,
0.1529541015625,
-0.5341796875,
0.10833740234375,
-0.439453125,
-1.212890625,
0.281005859375,
0.2333984375,
0.04595947265625,
-0.92578125,
-1.1337890625,
-0.1302490234375,
-1.1650390625,
-0.474365234375,
-0.7802734375,
0.48486328125,
-0.49072265625,
0.2236328125,
0.14990234375,
-1.0341796875,
4.3671875,
0.68359375,
0.49560546875,
0.095458984375,
0.21240234375,
1.1572265625,
0.487060546875,
-0.83056640625,
-0.401123046875,
-0.459228515625,
0.75146484375,
-0.1556396484375,
-0.00858306884765625,
0.7001953125,
0.300048828125,
0.50927734375,
-0.5615234375,
-0.0214691162109375,
0.004207611083984375,
-1.029296875,
-0.80859375,
0.48095703125,
0.460693359375,
0.310546875,
0.283935546875,
0.2061767578125,
0.61572265625,
-0.55419921875,
-0.088623046875,
-0.79052734375,
0.268310546875,
-0.68505859375,
0.8203125,
0.01898193359375,
0.1461181640625,
0.363037109375,
0.077880859375,
-0.476318359375,
-0.1834716796875,
0.63330078125,
-0.180419921875,
0.06072998046875,
0.62646484375,
-0.57763671875,
-0.258544921875,
0.53369140625,
-0.0947265625,
0.2666015625,
0.09521484375,
-1.013671875,
1.177734375,
-0.2247314453125,
0.8583984375,
-0.91162109375,
-1.0078125,
0.26171875,
0.09857177734375,
0.07464599609375,
-0.330322265625,
0.201904296875,
0.475830078125,
0.67724609375,
0.1922607421875,
0.284423828125,
-0.77783203125,
0.6650390625,
0.451416015625,
0.197265625,
-0.417724609375,
-0.1748046875,
-0.5537109375,
-0.1976318359375,
-0.25,
-0.52587890625,
0.9716796875,
0.5146484375,
-0.34521484375,
0.814453125,
0.78857421875,
-0.69921875,
0.0850830078125,
-0.95556640625,
-0.08551025390625,
-0.4033203125,
0.339111328125,
1.4375,
-0.5908203125,
0.046630859375,
-0.132080078125,
0.68212890625,
0.6103515625,
0.68115234375,
0.16943359375,
-0.705078125,
-0.27978515625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
The tycoon of a winery empire in Mondstadt, unmatched in every possible way. A thinker in the Knights of Favonius with an exotic appearance.
This time, the brothers are dealing with a strange piece of wood marked with their names. This plank of wood can be represented as a string of n characters. Each character is either a 'D' or a 'K'. You want to make some number of cuts (possibly 0) on this string, partitioning it into several contiguous pieces, each with length at least 1. Both brothers act with dignity, so they want to split the wood as evenly as possible. They want to know the maximum number of pieces you can split the wood into such that the ratios of the number of occurrences of 'D' to the number of occurrences of 'K' in each chunk are the same.
Kaeya, the curious thinker, is interested in the solution for multiple scenarios. He wants to know the answer for every prefix of the given string. Help him to solve this problem!
For a string we define a ratio as a:b where 'D' appears in it a times, and 'K' appears b times. Note that a or b can equal 0, but not both. Ratios a:b and c:d are considered equal if and only if aâ‹… d = bâ‹… c.
For example, for the string 'DDD' the ratio will be 3:0, for 'DKD' — 2:1, for 'DKK' — 1:2, and for 'KKKKDD' — 2:4. Note that the ratios of the latter two strings are equal to each other, but they are not equal to the ratios of the first two strings.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 1000). Description of the test cases follows.
The first line of each test case contains an integer n (1 ≤ n ≤ 5 ⋅ 10^5) — the length of the wood.
The second line of each test case contains a string s of length n. Every character of s will be either 'D' or 'K'.
It is guaranteed that the sum of n over all test cases does not exceed 5 â‹… 10^5.
Output
For each test case, output n space separated integers. The i-th of these numbers should equal the answer for the prefix s_{1},s_{2},...,s_{i}.
Example
Input
5
3
DDK
6
DDDDDD
4
DKDK
1
D
9
DKDKDDDDK
Output
1 2 1
1 2 3 4 5 6
1 1 1 2
1
1 1 1 2 1 2 1 1 3
Note
For the first test case, there is no way to partition 'D' or 'DDK' into more than one block with equal ratios of numbers of 'D' and 'K', while you can split 'DD' into 'D' and 'D'.
For the second test case, you can split each prefix of length i into i blocks 'D'.
Tags: data structures, dp, hashing, number theory
Correct Solution:
```
import sys
input = sys.stdin.readline
from math import gcd
for _ in range(int(input())):
n = int(input())
s = input()[:-1]
seen = {}
x, y = 0, 0
ans = []
for i, c in enumerate(s):
if c == 'D': x += 1
else: y += 1
g = gcd(x, y)
x0 = x // g
y0 = y // g
if (x0, y0) not in seen:
seen[x0, y0] = 1
ans.append(1)
else:
seen[x0, y0] += 1
ans.append(seen[x0, y0])
print(*ans)
```
| 44,839
|
[
0.16162109375,
0.2286376953125,
0.38818359375,
0.376953125,
-0.69921875,
-0.525390625,
-0.042694091796875,
0.19482421875,
-0.1031494140625,
0.83544921875,
0.7373046875,
-0.29345703125,
0.002216339111328125,
-0.489501953125,
-0.37353515625,
0.461669921875,
-0.73291015625,
-0.61279296875,
-0.297119140625,
0.07720947265625,
0.66748046875,
0.12005615234375,
-1.3876953125,
-0.294189453125,
-0.45654296875,
1.205078125,
0.66357421875,
0.224365234375,
1.1904296875,
1.068359375,
0.11749267578125,
-0.2049560546875,
0.439208984375,
-0.94873046875,
-0.3623046875,
-0.26220703125,
0.54150390625,
-0.60791015625,
-0.387939453125,
-0.50732421875,
0.1795654296875,
-0.261474609375,
0.3916015625,
-0.4248046875,
-0.5341796875,
0.344482421875,
-0.454833984375,
-0.69921875,
-0.255126953125,
-0.4609375,
0.2291259765625,
-0.401123046875,
0.64697265625,
-0.256591796875,
0.2366943359375,
-0.07391357421875,
-0.1951904296875,
0.437255859375,
-0.51220703125,
0.47412109375,
0.461181640625,
-0.189453125,
-0.36865234375,
-0.69287109375,
0.1719970703125,
0.2430419921875,
-0.21240234375,
-0.283203125,
-0.130615234375,
-1.0068359375,
-0.298828125,
0.261474609375,
-0.2188720703125,
-0.1104736328125,
-0.381103515625,
-0.059326171875,
0.0865478515625,
0.079345703125,
-0.2578125,
0.84033203125,
0.28271484375,
0.77099609375,
0.1981201171875,
0.2939453125,
-0.6689453125,
-0.60546875,
0.2347412109375,
0.38818359375,
-0.11383056640625,
-0.272705078125,
-0.214599609375,
0.484619140625,
-0.136474609375,
-0.092041015625,
0.41796875,
0.70458984375,
-0.06634521484375,
0.9755859375,
0.1993408203125,
0.1304931640625,
1.2392578125,
1.0791015625,
-0.7314453125,
0.67822265625,
-0.479736328125,
0.1688232421875,
0.4375,
0.2445068359375,
-0.08319091796875,
-0.271728515625,
0.07891845703125,
-0.342041015625,
0.52685546875,
0.62060546875,
-0.245849609375,
0.5888671875,
-0.31787109375,
0.404052734375,
-0.73193359375,
-0.0770263671875,
0.7099609375,
0.1990966796875,
0.640625,
-0.11529541015625,
0.01983642578125,
-0.10284423828125,
-0.30615234375,
0.86083984375,
-0.6162109375,
-0.388916015625,
0.76806640625,
-0.02410888671875,
-0.1031494140625,
0.206787109375,
0.27587890625,
0.3701171875,
-0.097412109375,
0.61767578125,
0.5634765625,
-0.26416015625,
0.84423828125,
0.451171875,
-0.61962890625,
1.3349609375,
0.494384765625,
0.1474609375,
0.3974609375,
0.3916015625,
-0.63720703125,
0.301025390625,
-1.005859375,
0.6953125,
-0.2022705078125,
0.07177734375,
-0.55224609375,
0.16064453125,
-0.1195068359375,
0.62109375,
0.1458740234375,
-0.125,
-0.1163330078125,
0.03143310546875,
-0.064453125,
0.70654296875,
-0.5185546875,
0.7568359375,
-0.681640625,
-0.29052734375,
-0.257568359375,
-0.3544921875,
0.27392578125,
-0.11517333984375,
-0.449951171875,
0.81298828125,
0.5654296875,
0.9365234375,
0.86474609375,
-0.5546875,
0.1016845703125,
0.4775390625,
-0.100341796875,
0.1385498046875,
0.66748046875,
0.5419921875,
-0.10101318359375,
0.37939453125,
-0.285400390625,
-0.478271484375,
-0.98388671875,
-0.352294921875,
0.1611328125,
0.5966796875,
-1.013671875,
0.150634765625,
0.309814453125,
-0.06390380859375,
-0.568359375,
0.078857421875,
-0.02764892578125,
-0.99951171875,
-0.462646484375,
0.5869140625,
-0.363037109375,
0.497314453125,
-0.158935546875,
-0.84130859375,
0.4580078125,
0.9921875,
-0.697265625,
0.28857421875,
0.37255859375,
0.10687255859375,
-0.019195556640625,
0.113037109375,
0.1551513671875,
-0.066650390625,
-0.5595703125,
0.81884765625,
-0.407958984375,
0.17041015625,
-0.0787353515625,
0.8232421875,
0.25634765625,
0.171142578125,
-0.290771484375,
-0.5126953125,
0.32470703125,
1.5068359375,
0.329345703125,
0.284423828125,
0.050201416015625,
1.0791015625,
0.51708984375,
1.0546875,
0.1572265625,
0.150390625,
0.60302734375,
0.77099609375,
0.07611083984375,
0.136474609375,
-0.09613037109375,
0.460205078125,
0.43701171875,
0.2890625,
0.287109375,
0.5703125,
-0.164794921875,
0.1224365234375,
-0.59375,
0.46533203125,
-0.044586181640625,
0.62353515625,
0.392578125,
0.03662109375,
-0.8916015625,
-0.12890625,
0.1524658203125,
1.0908203125,
-0.276611328125,
-0.59716796875,
-0.36328125,
0.04168701171875,
0.291259765625,
-0.027130126953125,
0.03521728515625,
0.401123046875,
0.5283203125,
0.62646484375,
-0.2607421875,
-0.21044921875,
-1.05078125,
-1.125,
-0.80419921875,
-0.65478515625,
-0.485107421875,
0.0244140625,
0.227783203125,
-0.68701171875,
-0.049957275390625,
0.00785064697265625,
-0.50390625,
0.06805419921875,
-0.775390625,
0.76611328125,
-0.3056640625,
0.59619140625,
-0.75927734375,
0.450439453125,
-0.353271484375,
1.166015625,
-0.80859375,
-0.330810546875,
-0.09173583984375,
-0.6591796875,
0.305419921875,
0.10162353515625,
-0.10467529296875,
-0.349609375,
-0.145751953125,
-1.00390625,
-0.34033203125,
-0.265625,
0.0199127197265625,
-0.203369140625,
-0.6630859375,
0.84912109375,
0.467529296875,
-0.73193359375,
0.57763671875,
0.97412109375,
-0.73046875,
0.324462890625,
0.73291015625,
0.1676025390625,
-0.75,
1.5048828125,
0.6328125,
0.289306640625,
-0.7685546875,
-0.60986328125,
-0.53076171875,
-0.18505859375,
0.1624755859375,
-0.5849609375,
-0.311767578125,
0.5556640625,
0.1295166015625,
-1.044921875,
0.10235595703125,
-0.72607421875,
-1.18359375,
-0.061279296875,
-0.6884765625,
0.9189453125,
0.466064453125,
-0.0748291015625,
-0.00879669189453125,
-0.67333984375,
0.281005859375,
0.62158203125,
0.424072265625,
-0.61181640625,
0.166259765625,
0.61669921875,
-0.0310821533203125,
0.04949951171875,
0.1324462890625,
-0.5810546875,
-0.057830810546875,
-0.224365234375,
0.12158203125,
0.3994140625,
0.08880615234375,
0.39697265625,
0.468994140625,
0.78271484375,
-0.9208984375,
-0.212890625,
-0.10675048828125,
0.5224609375,
0.396484375,
0.50048828125,
0.367431640625,
0.1995849609375,
-0.95263671875,
-1.1806640625,
-0.0307159423828125,
0.53369140625,
0.12481689453125,
-0.91943359375,
1.029296875,
0.3623046875,
-0.32080078125,
0.59423828125,
-0.63720703125,
-0.22265625,
0.6923828125,
-0.0266876220703125,
0.431884765625,
-0.77978515625,
0.34375,
-0.07958984375,
0.29150390625,
0.91064453125,
0.43701171875,
0.6748046875,
-0.165771484375,
-0.54931640625,
-0.2802734375,
-0.1158447265625,
0.0147552490234375,
-0.364013671875,
0.587890625,
-0.487548828125,
-0.50146484375,
-0.77197265625,
0.46875,
0.7451171875,
0.609375,
-0.1776123046875,
0.400634765625,
0.48193359375,
0.7783203125,
0.385498046875,
-0.48095703125,
0.2281494140625,
-0.82080078125,
0.80517578125,
0.445068359375,
-0.107666015625,
-0.5888671875,
-0.55078125,
-0.29541015625,
-0.04986572265625,
0.455810546875,
-0.1866455078125,
-0.826171875,
0.04119873046875,
0.06378173828125,
0.84716796875,
0.0760498046875,
-0.15380859375,
-0.0026397705078125,
0.2149658203125,
0.66943359375,
-0.95703125,
-0.0227813720703125,
-0.611328125,
0.470947265625,
0.44189453125,
-0.421630859375,
-0.66748046875,
-0.64892578125,
-0.732421875,
-0.239990234375,
0.03753662109375,
0.52294921875,
0.07989501953125,
0.16455078125,
-1.2197265625,
0.59912109375,
0.1866455078125,
-0.6767578125,
0.2164306640625,
0.092529296875,
0.51611328125,
-0.277587890625,
0.943359375,
-0.17333984375,
-0.75048828125,
0.34912109375,
-1.044921875,
0.0239715576171875,
-0.2198486328125,
0.21875,
-0.6025390625,
-0.025177001953125,
-0.048309326171875,
0.64453125,
-0.321044921875,
0.373046875,
-0.161865234375,
0.1497802734375,
-0.85400390625,
-0.8955078125,
0.61376953125,
-0.33349609375,
-0.352783203125,
1.2900390625,
-0.01010894775390625,
-0.62548828125,
-0.082763671875,
0.6171875,
-0.46630859375,
0.353271484375,
-0.43701171875,
0.478759765625,
-0.1964111328125,
-0.31689453125,
-0.06842041015625,
-0.81103515625,
0.84375,
0.10321044921875,
-0.66259765625,
-0.446533203125,
-1.1181640625,
-0.458251953125,
-0.1116943359375,
-0.572265625,
0.1378173828125,
0.280517578125,
-0.028533935546875,
-0.350830078125,
-0.330810546875,
-0.9912109375,
-0.2191162109375,
-0.5927734375,
-0.18896484375,
0.486572265625,
0.96728515625,
0.4775390625,
0.085693359375,
-0.51953125,
0.024658203125,
-0.422607421875,
-0.3134765625,
-0.58349609375,
0.261474609375,
-0.09088134765625,
-0.2027587890625,
-0.34130859375,
0.15869140625,
0.361572265625,
0.48974609375,
0.71240234375,
0.290771484375,
0.477294921875,
0.47802734375,
-0.322998046875,
1.150390625,
0.362548828125,
-1.38671875,
-0.650390625,
0.9970703125,
0.125732421875,
0.8095703125,
0.006961822509765625,
-0.73583984375,
-0.66748046875,
-1.0068359375,
0.0594482421875,
-0.55517578125,
-0.07769775390625,
-0.78173828125,
-0.206298828125,
-0.35302734375,
0.71728515625,
-0.6669921875,
-0.79052734375,
0.2373046875,
-0.9716796875,
0.11480712890625,
-0.1253662109375,
-0.5576171875,
-0.84326171875,
0.145263671875,
-0.215087890625,
0.6728515625,
-0.06939697265625,
0.154296875,
-0.15283203125,
-0.20947265625,
0.1533203125,
-0.0273895263671875,
-0.578125,
-0.384521484375,
0.10870361328125,
-0.0748291015625,
-0.5205078125,
0.043792724609375,
-0.359375,
0.324951171875,
-1.009765625,
-0.0992431640625,
-0.148681640625,
-0.458984375,
-0.02105712890625,
-0.4365234375,
0.9833984375,
-0.33447265625,
-0.17236328125,
-0.336181640625,
-0.00933074951171875,
0.93798828125,
-0.0894775390625,
-0.385498046875,
-0.83349609375,
-0.47802734375,
-1.2529296875,
0.260498046875,
-0.466064453125,
-0.326904296875,
-0.72412109375,
-0.494873046875,
0.64306640625,
-0.434814453125,
0.52294921875,
1.119140625,
0.168212890625,
0.11700439453125,
-0.7197265625,
0.798828125,
0.393798828125,
-0.9599609375,
0.072998046875,
0.054718017578125,
-0.9599609375,
0.64111328125,
-0.388916015625,
-0.93701171875,
-0.430908203125,
0.57373046875,
0.9755859375,
-0.414306640625,
0.56884765625,
0.035491943359375,
-1.0361328125,
-0.57861328125,
0.448486328125,
0.293212890625,
0.11944580078125,
0.78125,
-0.17431640625,
-0.1861572265625,
0.378662109375,
0.26318359375,
-0.2459716796875,
-0.67626953125,
1.400390625,
0.021881103515625,
-0.346435546875,
0.8203125,
0.3896484375,
-1.0498046875,
-0.556640625,
-0.08013916015625,
0.1817626953125,
-0.1646728515625,
-0.8173828125,
0.215087890625,
0.626953125,
-0.6015625,
0.16064453125,
0.421630859375,
0.09490966796875,
0.55810546875,
0.24072265625,
0.51025390625,
-0.5244140625,
0.57861328125,
0.78173828125,
-0.5625,
-0.2568359375,
-0.91552734375,
-0.31201171875,
0.00804901123046875,
-0.068603515625,
0.62548828125,
-0.6396484375,
-0.239501953125,
0.170654296875,
-0.0277557373046875,
0.8828125,
0.041748046875,
-0.409423828125,
0.609375,
-0.642578125,
-0.446533203125,
0.046905517578125,
0.1884765625,
-0.0205230712890625,
0.46435546875,
-0.5234375,
0.5693359375,
0.303466796875,
0.375732421875,
-0.2744140625,
-0.90966796875,
-0.4609375,
-0.876953125,
-0.07318115234375,
-0.55859375,
-0.92919921875,
0.0279541015625,
0.423583984375,
-0.09539794921875,
-0.93310546875,
0.280029296875,
0.30615234375,
-0.52490234375,
1.0341796875,
-1.1611328125,
0.372802734375,
-0.66064453125,
-0.249755859375,
-0.53076171875,
-0.35693359375,
-0.11865234375,
-0.014862060546875,
-0.6572265625,
0.078857421875,
-0.27001953125,
0.7060546875,
-0.356689453125,
0.54296875,
0.038360595703125,
-0.86181640625,
-0.07281494140625,
0.1497802734375,
-0.1629638671875,
0.53076171875,
0.9326171875,
0.01020050048828125,
0.2489013671875,
-0.16552734375,
-0.32080078125,
-0.1895751953125,
0.303955078125,
0.4560546875,
-0.1141357421875,
-0.298828125,
-0.4404296875,
-0.31396484375,
-1.134765625,
0.374267578125,
-0.55126953125,
-0.07440185546875,
-0.088623046875,
0.0108642578125,
0.2034912109375,
1.0380859375,
-0.60107421875,
0.56201171875,
-0.10015869140625,
0.2137451171875,
0.43994140625,
-0.004444122314453125,
-0.048248291015625,
0.324462890625,
0.323486328125,
-0.64794921875,
0.07550048828125,
0.290283203125,
0.08087158203125,
0.2181396484375,
-0.1710205078125,
-0.8779296875,
-1.0361328125,
-0.380615234375,
-0.111572265625,
0.5546875,
0.46875,
-0.31982421875,
-0.2978515625,
-0.1285400390625,
-0.791015625,
-0.024383544921875,
-1.263671875,
-0.77880859375,
0.55126953125,
0.0006604194641113281,
-0.0007390975952148438,
0.1087646484375,
-0.4755859375,
-0.556640625,
-0.26708984375,
0.1793212890625,
-0.359375,
0.5009765625,
-0.1192626953125,
0.456787109375,
-0.03607177734375,
-0.1556396484375,
0.074951171875,
0.70458984375,
-0.87890625,
-0.57470703125,
-0.2197265625,
1.2021484375,
0.1715087890625,
0.0119781494140625,
-0.54052734375,
0.4375,
0.349365234375,
0.424560546875,
-0.1981201171875,
0.4853515625,
-0.08209228515625,
0.60498046875,
-0.7109375,
-0.011444091796875,
-0.2294921875,
0.410400390625,
0.08404541015625,
-0.4482421875,
-0.74609375,
0.8642578125,
0.3671875,
-0.08013916015625,
1.0029296875,
0.224609375,
0.060699462890625,
-0.031585693359375,
-0.031494140625,
-0.287353515625,
0.302001953125,
0.255859375,
0.4833984375,
-0.395751953125,
0.1297607421875,
0.9384765625,
0.184814453125,
0.0821533203125,
0.65771484375,
0.1387939453125,
0.022552490234375,
0.42041015625,
-0.051605224609375,
0.02972412109375,
0.36865234375,
-0.427734375,
0.3056640625,
-0.5087890625,
0.036712646484375,
-0.380126953125,
-0.67626953125,
0.74365234375,
-0.267333984375,
-0.38330078125,
0.0765380859375,
-0.45751953125,
0.2349853515625,
0.460205078125,
-0.30517578125,
-0.1190185546875,
0.93359375,
0.767578125,
0.572265625,
0.7802734375,
0.373291015625,
0.3642578125,
-1.23828125,
0.4365234375,
0.2186279296875,
0.291748046875,
-0.187255859375,
-0.61865234375,
-0.953125,
0.1761474609375,
-0.212158203125,
-0.285400390625,
0.65966796875,
-0.673828125,
0.1510009765625,
-0.350830078125,
0.78369140625,
-0.71630859375,
0.260009765625,
-0.0518798828125,
-0.12152099609375,
-0.5966796875,
0.81494140625,
-0.31201171875,
0.54296875,
0.432861328125,
0.9013671875,
0.4130859375,
1.46484375,
0.62158203125,
0.09002685546875,
0.1385498046875,
0.35546875,
-0.52587890625,
-0.39453125,
-0.69091796875,
-0.4375,
-0.126953125,
-0.72900390625,
-0.55078125,
-0.1724853515625,
0.72314453125,
0.235595703125,
-1.0341796875,
-0.4423828125,
0.1912841796875,
-0.98681640625,
0.1417236328125,
0.198974609375,
0.66845703125,
0.2054443359375,
-0.282470703125,
0.097412109375,
-0.54345703125,
0.1484375,
-0.50732421875,
0.68505859375,
-0.68310546875,
-0.58447265625,
-0.4619140625,
-0.59765625,
-0.2357177734375,
-0.556640625,
-0.38330078125,
-0.70361328125,
0.64111328125,
0.170654296875,
0.0205535888671875,
0.53662109375,
-0.319580078125,
-0.0347900390625,
0.78369140625,
1.16796875,
-0.1275634765625,
0.98388671875,
0.39306640625,
-0.115478515625,
0.1324462890625,
-0.435791015625,
0.01422882080078125,
-0.173828125,
0.1529541015625,
-0.5341796875,
0.10833740234375,
-0.439453125,
-1.212890625,
0.281005859375,
0.2333984375,
0.04595947265625,
-0.92578125,
-1.1337890625,
-0.1302490234375,
-1.1650390625,
-0.474365234375,
-0.7802734375,
0.48486328125,
-0.49072265625,
0.2236328125,
0.14990234375,
-1.0341796875,
4.3671875,
0.68359375,
0.49560546875,
0.095458984375,
0.21240234375,
1.1572265625,
0.487060546875,
-0.83056640625,
-0.401123046875,
-0.459228515625,
0.75146484375,
-0.1556396484375,
-0.00858306884765625,
0.7001953125,
0.300048828125,
0.50927734375,
-0.5615234375,
-0.0214691162109375,
0.004207611083984375,
-1.029296875,
-0.80859375,
0.48095703125,
0.460693359375,
0.310546875,
0.283935546875,
0.2061767578125,
0.61572265625,
-0.55419921875,
-0.088623046875,
-0.79052734375,
0.268310546875,
-0.68505859375,
0.8203125,
0.01898193359375,
0.1461181640625,
0.363037109375,
0.077880859375,
-0.476318359375,
-0.1834716796875,
0.63330078125,
-0.180419921875,
0.06072998046875,
0.62646484375,
-0.57763671875,
-0.258544921875,
0.53369140625,
-0.0947265625,
0.2666015625,
0.09521484375,
-1.013671875,
1.177734375,
-0.2247314453125,
0.8583984375,
-0.91162109375,
-1.0078125,
0.26171875,
0.09857177734375,
0.07464599609375,
-0.330322265625,
0.201904296875,
0.475830078125,
0.67724609375,
0.1922607421875,
0.284423828125,
-0.77783203125,
0.6650390625,
0.451416015625,
0.197265625,
-0.417724609375,
-0.1748046875,
-0.5537109375,
-0.1976318359375,
-0.25,
-0.52587890625,
0.9716796875,
0.5146484375,
-0.34521484375,
0.814453125,
0.78857421875,
-0.69921875,
0.0850830078125,
-0.95556640625,
-0.08551025390625,
-0.4033203125,
0.339111328125,
1.4375,
-0.5908203125,
0.046630859375,
-0.132080078125,
0.68212890625,
0.6103515625,
0.68115234375,
0.16943359375,
-0.705078125,
-0.27978515625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
The tycoon of a winery empire in Mondstadt, unmatched in every possible way. A thinker in the Knights of Favonius with an exotic appearance.
This time, the brothers are dealing with a strange piece of wood marked with their names. This plank of wood can be represented as a string of n characters. Each character is either a 'D' or a 'K'. You want to make some number of cuts (possibly 0) on this string, partitioning it into several contiguous pieces, each with length at least 1. Both brothers act with dignity, so they want to split the wood as evenly as possible. They want to know the maximum number of pieces you can split the wood into such that the ratios of the number of occurrences of 'D' to the number of occurrences of 'K' in each chunk are the same.
Kaeya, the curious thinker, is interested in the solution for multiple scenarios. He wants to know the answer for every prefix of the given string. Help him to solve this problem!
For a string we define a ratio as a:b where 'D' appears in it a times, and 'K' appears b times. Note that a or b can equal 0, but not both. Ratios a:b and c:d are considered equal if and only if aâ‹… d = bâ‹… c.
For example, for the string 'DDD' the ratio will be 3:0, for 'DKD' — 2:1, for 'DKK' — 1:2, and for 'KKKKDD' — 2:4. Note that the ratios of the latter two strings are equal to each other, but they are not equal to the ratios of the first two strings.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 1000). Description of the test cases follows.
The first line of each test case contains an integer n (1 ≤ n ≤ 5 ⋅ 10^5) — the length of the wood.
The second line of each test case contains a string s of length n. Every character of s will be either 'D' or 'K'.
It is guaranteed that the sum of n over all test cases does not exceed 5 â‹… 10^5.
Output
For each test case, output n space separated integers. The i-th of these numbers should equal the answer for the prefix s_{1},s_{2},...,s_{i}.
Example
Input
5
3
DDK
6
DDDDDD
4
DKDK
1
D
9
DKDKDDDDK
Output
1 2 1
1 2 3 4 5 6
1 1 1 2
1
1 1 1 2 1 2 1 1 3
Note
For the first test case, there is no way to partition 'D' or 'DDK' into more than one block with equal ratios of numbers of 'D' and 'K', while you can split 'DD' into 'D' and 'D'.
For the second test case, you can split each prefix of length i into i blocks 'D'.
Tags: data structures, dp, hashing, number theory
Correct Solution:
```
def gcd(a,b):
if b==0:
return a
return gcd(b,a%b)
for _ in range(int(input())):
n=int(input())
s=input()
ans=[0]*n
d=0
ans[0]=1
m={}
if s[0]=='D':
d=1
m[(1,0)]=1
else:
m[(0,1)]=1
for i in range(1,n):
if s[i]=='D':
d+=1
g=gcd(d,i+1-d)
a,b=d//g,(i+1-d)//g
if (a,b) not in m:
m[(a,b)]=1
else:
m[(a,b)]+=1
ans[i]=m[(a,b)]
print(*ans)
```
| 44,840
|
[
0.16162109375,
0.2286376953125,
0.38818359375,
0.376953125,
-0.69921875,
-0.525390625,
-0.042694091796875,
0.19482421875,
-0.1031494140625,
0.83544921875,
0.7373046875,
-0.29345703125,
0.002216339111328125,
-0.489501953125,
-0.37353515625,
0.461669921875,
-0.73291015625,
-0.61279296875,
-0.297119140625,
0.07720947265625,
0.66748046875,
0.12005615234375,
-1.3876953125,
-0.294189453125,
-0.45654296875,
1.205078125,
0.66357421875,
0.224365234375,
1.1904296875,
1.068359375,
0.11749267578125,
-0.2049560546875,
0.439208984375,
-0.94873046875,
-0.3623046875,
-0.26220703125,
0.54150390625,
-0.60791015625,
-0.387939453125,
-0.50732421875,
0.1795654296875,
-0.261474609375,
0.3916015625,
-0.4248046875,
-0.5341796875,
0.344482421875,
-0.454833984375,
-0.69921875,
-0.255126953125,
-0.4609375,
0.2291259765625,
-0.401123046875,
0.64697265625,
-0.256591796875,
0.2366943359375,
-0.07391357421875,
-0.1951904296875,
0.437255859375,
-0.51220703125,
0.47412109375,
0.461181640625,
-0.189453125,
-0.36865234375,
-0.69287109375,
0.1719970703125,
0.2430419921875,
-0.21240234375,
-0.283203125,
-0.130615234375,
-1.0068359375,
-0.298828125,
0.261474609375,
-0.2188720703125,
-0.1104736328125,
-0.381103515625,
-0.059326171875,
0.0865478515625,
0.079345703125,
-0.2578125,
0.84033203125,
0.28271484375,
0.77099609375,
0.1981201171875,
0.2939453125,
-0.6689453125,
-0.60546875,
0.2347412109375,
0.38818359375,
-0.11383056640625,
-0.272705078125,
-0.214599609375,
0.484619140625,
-0.136474609375,
-0.092041015625,
0.41796875,
0.70458984375,
-0.06634521484375,
0.9755859375,
0.1993408203125,
0.1304931640625,
1.2392578125,
1.0791015625,
-0.7314453125,
0.67822265625,
-0.479736328125,
0.1688232421875,
0.4375,
0.2445068359375,
-0.08319091796875,
-0.271728515625,
0.07891845703125,
-0.342041015625,
0.52685546875,
0.62060546875,
-0.245849609375,
0.5888671875,
-0.31787109375,
0.404052734375,
-0.73193359375,
-0.0770263671875,
0.7099609375,
0.1990966796875,
0.640625,
-0.11529541015625,
0.01983642578125,
-0.10284423828125,
-0.30615234375,
0.86083984375,
-0.6162109375,
-0.388916015625,
0.76806640625,
-0.02410888671875,
-0.1031494140625,
0.206787109375,
0.27587890625,
0.3701171875,
-0.097412109375,
0.61767578125,
0.5634765625,
-0.26416015625,
0.84423828125,
0.451171875,
-0.61962890625,
1.3349609375,
0.494384765625,
0.1474609375,
0.3974609375,
0.3916015625,
-0.63720703125,
0.301025390625,
-1.005859375,
0.6953125,
-0.2022705078125,
0.07177734375,
-0.55224609375,
0.16064453125,
-0.1195068359375,
0.62109375,
0.1458740234375,
-0.125,
-0.1163330078125,
0.03143310546875,
-0.064453125,
0.70654296875,
-0.5185546875,
0.7568359375,
-0.681640625,
-0.29052734375,
-0.257568359375,
-0.3544921875,
0.27392578125,
-0.11517333984375,
-0.449951171875,
0.81298828125,
0.5654296875,
0.9365234375,
0.86474609375,
-0.5546875,
0.1016845703125,
0.4775390625,
-0.100341796875,
0.1385498046875,
0.66748046875,
0.5419921875,
-0.10101318359375,
0.37939453125,
-0.285400390625,
-0.478271484375,
-0.98388671875,
-0.352294921875,
0.1611328125,
0.5966796875,
-1.013671875,
0.150634765625,
0.309814453125,
-0.06390380859375,
-0.568359375,
0.078857421875,
-0.02764892578125,
-0.99951171875,
-0.462646484375,
0.5869140625,
-0.363037109375,
0.497314453125,
-0.158935546875,
-0.84130859375,
0.4580078125,
0.9921875,
-0.697265625,
0.28857421875,
0.37255859375,
0.10687255859375,
-0.019195556640625,
0.113037109375,
0.1551513671875,
-0.066650390625,
-0.5595703125,
0.81884765625,
-0.407958984375,
0.17041015625,
-0.0787353515625,
0.8232421875,
0.25634765625,
0.171142578125,
-0.290771484375,
-0.5126953125,
0.32470703125,
1.5068359375,
0.329345703125,
0.284423828125,
0.050201416015625,
1.0791015625,
0.51708984375,
1.0546875,
0.1572265625,
0.150390625,
0.60302734375,
0.77099609375,
0.07611083984375,
0.136474609375,
-0.09613037109375,
0.460205078125,
0.43701171875,
0.2890625,
0.287109375,
0.5703125,
-0.164794921875,
0.1224365234375,
-0.59375,
0.46533203125,
-0.044586181640625,
0.62353515625,
0.392578125,
0.03662109375,
-0.8916015625,
-0.12890625,
0.1524658203125,
1.0908203125,
-0.276611328125,
-0.59716796875,
-0.36328125,
0.04168701171875,
0.291259765625,
-0.027130126953125,
0.03521728515625,
0.401123046875,
0.5283203125,
0.62646484375,
-0.2607421875,
-0.21044921875,
-1.05078125,
-1.125,
-0.80419921875,
-0.65478515625,
-0.485107421875,
0.0244140625,
0.227783203125,
-0.68701171875,
-0.049957275390625,
0.00785064697265625,
-0.50390625,
0.06805419921875,
-0.775390625,
0.76611328125,
-0.3056640625,
0.59619140625,
-0.75927734375,
0.450439453125,
-0.353271484375,
1.166015625,
-0.80859375,
-0.330810546875,
-0.09173583984375,
-0.6591796875,
0.305419921875,
0.10162353515625,
-0.10467529296875,
-0.349609375,
-0.145751953125,
-1.00390625,
-0.34033203125,
-0.265625,
0.0199127197265625,
-0.203369140625,
-0.6630859375,
0.84912109375,
0.467529296875,
-0.73193359375,
0.57763671875,
0.97412109375,
-0.73046875,
0.324462890625,
0.73291015625,
0.1676025390625,
-0.75,
1.5048828125,
0.6328125,
0.289306640625,
-0.7685546875,
-0.60986328125,
-0.53076171875,
-0.18505859375,
0.1624755859375,
-0.5849609375,
-0.311767578125,
0.5556640625,
0.1295166015625,
-1.044921875,
0.10235595703125,
-0.72607421875,
-1.18359375,
-0.061279296875,
-0.6884765625,
0.9189453125,
0.466064453125,
-0.0748291015625,
-0.00879669189453125,
-0.67333984375,
0.281005859375,
0.62158203125,
0.424072265625,
-0.61181640625,
0.166259765625,
0.61669921875,
-0.0310821533203125,
0.04949951171875,
0.1324462890625,
-0.5810546875,
-0.057830810546875,
-0.224365234375,
0.12158203125,
0.3994140625,
0.08880615234375,
0.39697265625,
0.468994140625,
0.78271484375,
-0.9208984375,
-0.212890625,
-0.10675048828125,
0.5224609375,
0.396484375,
0.50048828125,
0.367431640625,
0.1995849609375,
-0.95263671875,
-1.1806640625,
-0.0307159423828125,
0.53369140625,
0.12481689453125,
-0.91943359375,
1.029296875,
0.3623046875,
-0.32080078125,
0.59423828125,
-0.63720703125,
-0.22265625,
0.6923828125,
-0.0266876220703125,
0.431884765625,
-0.77978515625,
0.34375,
-0.07958984375,
0.29150390625,
0.91064453125,
0.43701171875,
0.6748046875,
-0.165771484375,
-0.54931640625,
-0.2802734375,
-0.1158447265625,
0.0147552490234375,
-0.364013671875,
0.587890625,
-0.487548828125,
-0.50146484375,
-0.77197265625,
0.46875,
0.7451171875,
0.609375,
-0.1776123046875,
0.400634765625,
0.48193359375,
0.7783203125,
0.385498046875,
-0.48095703125,
0.2281494140625,
-0.82080078125,
0.80517578125,
0.445068359375,
-0.107666015625,
-0.5888671875,
-0.55078125,
-0.29541015625,
-0.04986572265625,
0.455810546875,
-0.1866455078125,
-0.826171875,
0.04119873046875,
0.06378173828125,
0.84716796875,
0.0760498046875,
-0.15380859375,
-0.0026397705078125,
0.2149658203125,
0.66943359375,
-0.95703125,
-0.0227813720703125,
-0.611328125,
0.470947265625,
0.44189453125,
-0.421630859375,
-0.66748046875,
-0.64892578125,
-0.732421875,
-0.239990234375,
0.03753662109375,
0.52294921875,
0.07989501953125,
0.16455078125,
-1.2197265625,
0.59912109375,
0.1866455078125,
-0.6767578125,
0.2164306640625,
0.092529296875,
0.51611328125,
-0.277587890625,
0.943359375,
-0.17333984375,
-0.75048828125,
0.34912109375,
-1.044921875,
0.0239715576171875,
-0.2198486328125,
0.21875,
-0.6025390625,
-0.025177001953125,
-0.048309326171875,
0.64453125,
-0.321044921875,
0.373046875,
-0.161865234375,
0.1497802734375,
-0.85400390625,
-0.8955078125,
0.61376953125,
-0.33349609375,
-0.352783203125,
1.2900390625,
-0.01010894775390625,
-0.62548828125,
-0.082763671875,
0.6171875,
-0.46630859375,
0.353271484375,
-0.43701171875,
0.478759765625,
-0.1964111328125,
-0.31689453125,
-0.06842041015625,
-0.81103515625,
0.84375,
0.10321044921875,
-0.66259765625,
-0.446533203125,
-1.1181640625,
-0.458251953125,
-0.1116943359375,
-0.572265625,
0.1378173828125,
0.280517578125,
-0.028533935546875,
-0.350830078125,
-0.330810546875,
-0.9912109375,
-0.2191162109375,
-0.5927734375,
-0.18896484375,
0.486572265625,
0.96728515625,
0.4775390625,
0.085693359375,
-0.51953125,
0.024658203125,
-0.422607421875,
-0.3134765625,
-0.58349609375,
0.261474609375,
-0.09088134765625,
-0.2027587890625,
-0.34130859375,
0.15869140625,
0.361572265625,
0.48974609375,
0.71240234375,
0.290771484375,
0.477294921875,
0.47802734375,
-0.322998046875,
1.150390625,
0.362548828125,
-1.38671875,
-0.650390625,
0.9970703125,
0.125732421875,
0.8095703125,
0.006961822509765625,
-0.73583984375,
-0.66748046875,
-1.0068359375,
0.0594482421875,
-0.55517578125,
-0.07769775390625,
-0.78173828125,
-0.206298828125,
-0.35302734375,
0.71728515625,
-0.6669921875,
-0.79052734375,
0.2373046875,
-0.9716796875,
0.11480712890625,
-0.1253662109375,
-0.5576171875,
-0.84326171875,
0.145263671875,
-0.215087890625,
0.6728515625,
-0.06939697265625,
0.154296875,
-0.15283203125,
-0.20947265625,
0.1533203125,
-0.0273895263671875,
-0.578125,
-0.384521484375,
0.10870361328125,
-0.0748291015625,
-0.5205078125,
0.043792724609375,
-0.359375,
0.324951171875,
-1.009765625,
-0.0992431640625,
-0.148681640625,
-0.458984375,
-0.02105712890625,
-0.4365234375,
0.9833984375,
-0.33447265625,
-0.17236328125,
-0.336181640625,
-0.00933074951171875,
0.93798828125,
-0.0894775390625,
-0.385498046875,
-0.83349609375,
-0.47802734375,
-1.2529296875,
0.260498046875,
-0.466064453125,
-0.326904296875,
-0.72412109375,
-0.494873046875,
0.64306640625,
-0.434814453125,
0.52294921875,
1.119140625,
0.168212890625,
0.11700439453125,
-0.7197265625,
0.798828125,
0.393798828125,
-0.9599609375,
0.072998046875,
0.054718017578125,
-0.9599609375,
0.64111328125,
-0.388916015625,
-0.93701171875,
-0.430908203125,
0.57373046875,
0.9755859375,
-0.414306640625,
0.56884765625,
0.035491943359375,
-1.0361328125,
-0.57861328125,
0.448486328125,
0.293212890625,
0.11944580078125,
0.78125,
-0.17431640625,
-0.1861572265625,
0.378662109375,
0.26318359375,
-0.2459716796875,
-0.67626953125,
1.400390625,
0.021881103515625,
-0.346435546875,
0.8203125,
0.3896484375,
-1.0498046875,
-0.556640625,
-0.08013916015625,
0.1817626953125,
-0.1646728515625,
-0.8173828125,
0.215087890625,
0.626953125,
-0.6015625,
0.16064453125,
0.421630859375,
0.09490966796875,
0.55810546875,
0.24072265625,
0.51025390625,
-0.5244140625,
0.57861328125,
0.78173828125,
-0.5625,
-0.2568359375,
-0.91552734375,
-0.31201171875,
0.00804901123046875,
-0.068603515625,
0.62548828125,
-0.6396484375,
-0.239501953125,
0.170654296875,
-0.0277557373046875,
0.8828125,
0.041748046875,
-0.409423828125,
0.609375,
-0.642578125,
-0.446533203125,
0.046905517578125,
0.1884765625,
-0.0205230712890625,
0.46435546875,
-0.5234375,
0.5693359375,
0.303466796875,
0.375732421875,
-0.2744140625,
-0.90966796875,
-0.4609375,
-0.876953125,
-0.07318115234375,
-0.55859375,
-0.92919921875,
0.0279541015625,
0.423583984375,
-0.09539794921875,
-0.93310546875,
0.280029296875,
0.30615234375,
-0.52490234375,
1.0341796875,
-1.1611328125,
0.372802734375,
-0.66064453125,
-0.249755859375,
-0.53076171875,
-0.35693359375,
-0.11865234375,
-0.014862060546875,
-0.6572265625,
0.078857421875,
-0.27001953125,
0.7060546875,
-0.356689453125,
0.54296875,
0.038360595703125,
-0.86181640625,
-0.07281494140625,
0.1497802734375,
-0.1629638671875,
0.53076171875,
0.9326171875,
0.01020050048828125,
0.2489013671875,
-0.16552734375,
-0.32080078125,
-0.1895751953125,
0.303955078125,
0.4560546875,
-0.1141357421875,
-0.298828125,
-0.4404296875,
-0.31396484375,
-1.134765625,
0.374267578125,
-0.55126953125,
-0.07440185546875,
-0.088623046875,
0.0108642578125,
0.2034912109375,
1.0380859375,
-0.60107421875,
0.56201171875,
-0.10015869140625,
0.2137451171875,
0.43994140625,
-0.004444122314453125,
-0.048248291015625,
0.324462890625,
0.323486328125,
-0.64794921875,
0.07550048828125,
0.290283203125,
0.08087158203125,
0.2181396484375,
-0.1710205078125,
-0.8779296875,
-1.0361328125,
-0.380615234375,
-0.111572265625,
0.5546875,
0.46875,
-0.31982421875,
-0.2978515625,
-0.1285400390625,
-0.791015625,
-0.024383544921875,
-1.263671875,
-0.77880859375,
0.55126953125,
0.0006604194641113281,
-0.0007390975952148438,
0.1087646484375,
-0.4755859375,
-0.556640625,
-0.26708984375,
0.1793212890625,
-0.359375,
0.5009765625,
-0.1192626953125,
0.456787109375,
-0.03607177734375,
-0.1556396484375,
0.074951171875,
0.70458984375,
-0.87890625,
-0.57470703125,
-0.2197265625,
1.2021484375,
0.1715087890625,
0.0119781494140625,
-0.54052734375,
0.4375,
0.349365234375,
0.424560546875,
-0.1981201171875,
0.4853515625,
-0.08209228515625,
0.60498046875,
-0.7109375,
-0.011444091796875,
-0.2294921875,
0.410400390625,
0.08404541015625,
-0.4482421875,
-0.74609375,
0.8642578125,
0.3671875,
-0.08013916015625,
1.0029296875,
0.224609375,
0.060699462890625,
-0.031585693359375,
-0.031494140625,
-0.287353515625,
0.302001953125,
0.255859375,
0.4833984375,
-0.395751953125,
0.1297607421875,
0.9384765625,
0.184814453125,
0.0821533203125,
0.65771484375,
0.1387939453125,
0.022552490234375,
0.42041015625,
-0.051605224609375,
0.02972412109375,
0.36865234375,
-0.427734375,
0.3056640625,
-0.5087890625,
0.036712646484375,
-0.380126953125,
-0.67626953125,
0.74365234375,
-0.267333984375,
-0.38330078125,
0.0765380859375,
-0.45751953125,
0.2349853515625,
0.460205078125,
-0.30517578125,
-0.1190185546875,
0.93359375,
0.767578125,
0.572265625,
0.7802734375,
0.373291015625,
0.3642578125,
-1.23828125,
0.4365234375,
0.2186279296875,
0.291748046875,
-0.187255859375,
-0.61865234375,
-0.953125,
0.1761474609375,
-0.212158203125,
-0.285400390625,
0.65966796875,
-0.673828125,
0.1510009765625,
-0.350830078125,
0.78369140625,
-0.71630859375,
0.260009765625,
-0.0518798828125,
-0.12152099609375,
-0.5966796875,
0.81494140625,
-0.31201171875,
0.54296875,
0.432861328125,
0.9013671875,
0.4130859375,
1.46484375,
0.62158203125,
0.09002685546875,
0.1385498046875,
0.35546875,
-0.52587890625,
-0.39453125,
-0.69091796875,
-0.4375,
-0.126953125,
-0.72900390625,
-0.55078125,
-0.1724853515625,
0.72314453125,
0.235595703125,
-1.0341796875,
-0.4423828125,
0.1912841796875,
-0.98681640625,
0.1417236328125,
0.198974609375,
0.66845703125,
0.2054443359375,
-0.282470703125,
0.097412109375,
-0.54345703125,
0.1484375,
-0.50732421875,
0.68505859375,
-0.68310546875,
-0.58447265625,
-0.4619140625,
-0.59765625,
-0.2357177734375,
-0.556640625,
-0.38330078125,
-0.70361328125,
0.64111328125,
0.170654296875,
0.0205535888671875,
0.53662109375,
-0.319580078125,
-0.0347900390625,
0.78369140625,
1.16796875,
-0.1275634765625,
0.98388671875,
0.39306640625,
-0.115478515625,
0.1324462890625,
-0.435791015625,
0.01422882080078125,
-0.173828125,
0.1529541015625,
-0.5341796875,
0.10833740234375,
-0.439453125,
-1.212890625,
0.281005859375,
0.2333984375,
0.04595947265625,
-0.92578125,
-1.1337890625,
-0.1302490234375,
-1.1650390625,
-0.474365234375,
-0.7802734375,
0.48486328125,
-0.49072265625,
0.2236328125,
0.14990234375,
-1.0341796875,
4.3671875,
0.68359375,
0.49560546875,
0.095458984375,
0.21240234375,
1.1572265625,
0.487060546875,
-0.83056640625,
-0.401123046875,
-0.459228515625,
0.75146484375,
-0.1556396484375,
-0.00858306884765625,
0.7001953125,
0.300048828125,
0.50927734375,
-0.5615234375,
-0.0214691162109375,
0.004207611083984375,
-1.029296875,
-0.80859375,
0.48095703125,
0.460693359375,
0.310546875,
0.283935546875,
0.2061767578125,
0.61572265625,
-0.55419921875,
-0.088623046875,
-0.79052734375,
0.268310546875,
-0.68505859375,
0.8203125,
0.01898193359375,
0.1461181640625,
0.363037109375,
0.077880859375,
-0.476318359375,
-0.1834716796875,
0.63330078125,
-0.180419921875,
0.06072998046875,
0.62646484375,
-0.57763671875,
-0.258544921875,
0.53369140625,
-0.0947265625,
0.2666015625,
0.09521484375,
-1.013671875,
1.177734375,
-0.2247314453125,
0.8583984375,
-0.91162109375,
-1.0078125,
0.26171875,
0.09857177734375,
0.07464599609375,
-0.330322265625,
0.201904296875,
0.475830078125,
0.67724609375,
0.1922607421875,
0.284423828125,
-0.77783203125,
0.6650390625,
0.451416015625,
0.197265625,
-0.417724609375,
-0.1748046875,
-0.5537109375,
-0.1976318359375,
-0.25,
-0.52587890625,
0.9716796875,
0.5146484375,
-0.34521484375,
0.814453125,
0.78857421875,
-0.69921875,
0.0850830078125,
-0.95556640625,
-0.08551025390625,
-0.4033203125,
0.339111328125,
1.4375,
-0.5908203125,
0.046630859375,
-0.132080078125,
0.68212890625,
0.6103515625,
0.68115234375,
0.16943359375,
-0.705078125,
-0.27978515625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
The tycoon of a winery empire in Mondstadt, unmatched in every possible way. A thinker in the Knights of Favonius with an exotic appearance.
This time, the brothers are dealing with a strange piece of wood marked with their names. This plank of wood can be represented as a string of n characters. Each character is either a 'D' or a 'K'. You want to make some number of cuts (possibly 0) on this string, partitioning it into several contiguous pieces, each with length at least 1. Both brothers act with dignity, so they want to split the wood as evenly as possible. They want to know the maximum number of pieces you can split the wood into such that the ratios of the number of occurrences of 'D' to the number of occurrences of 'K' in each chunk are the same.
Kaeya, the curious thinker, is interested in the solution for multiple scenarios. He wants to know the answer for every prefix of the given string. Help him to solve this problem!
For a string we define a ratio as a:b where 'D' appears in it a times, and 'K' appears b times. Note that a or b can equal 0, but not both. Ratios a:b and c:d are considered equal if and only if aâ‹… d = bâ‹… c.
For example, for the string 'DDD' the ratio will be 3:0, for 'DKD' — 2:1, for 'DKK' — 1:2, and for 'KKKKDD' — 2:4. Note that the ratios of the latter two strings are equal to each other, but they are not equal to the ratios of the first two strings.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 1000). Description of the test cases follows.
The first line of each test case contains an integer n (1 ≤ n ≤ 5 ⋅ 10^5) — the length of the wood.
The second line of each test case contains a string s of length n. Every character of s will be either 'D' or 'K'.
It is guaranteed that the sum of n over all test cases does not exceed 5 â‹… 10^5.
Output
For each test case, output n space separated integers. The i-th of these numbers should equal the answer for the prefix s_{1},s_{2},...,s_{i}.
Example
Input
5
3
DDK
6
DDDDDD
4
DKDK
1
D
9
DKDKDDDDK
Output
1 2 1
1 2 3 4 5 6
1 1 1 2
1
1 1 1 2 1 2 1 1 3
Note
For the first test case, there is no way to partition 'D' or 'DDK' into more than one block with equal ratios of numbers of 'D' and 'K', while you can split 'DD' into 'D' and 'D'.
For the second test case, you can split each prefix of length i into i blocks 'D'.
Tags: data structures, dp, hashing, number theory
Correct Solution:
```
from sys import stdin, stdout
def arrin():
return list(map(int, stdin.readline().split()))
def num1in():
return int(stdin.readline())
def num2in():
a, b = map(int, stdin.readline().split())
return a, b
def num3in():
a, b, c = map(int, stdin.readline().split())
return a, b, c
def num4in():
a, b, c, d = map(int, stdin.readline().split())
return a, b, c, d
def num5in():
a, b, c, d, e = map(int, stdin.readline().split())
return a, b, c, d, e
t=num1in()
for test in range(t):
n=num1in()
s=input()
dict={}
ans=[]
d=0
k=0
prev=0
for i in s:
if(i=='D'):
d+=1
else:
k+=1
if(d==0 or k==0):
prev+=1
ans.append(prev)
else:
ratio = d/k
if(ratio in dict):
temp = dict[ratio] + 1
dict[ratio] = temp
ans.append(temp)
else:
temp=1
dict[ratio] = temp
ans.append(temp)
for i in ans:
print(i,end=" ")
print()
```
| 44,841
|
[
0.16162109375,
0.2286376953125,
0.38818359375,
0.376953125,
-0.69921875,
-0.525390625,
-0.042694091796875,
0.19482421875,
-0.1031494140625,
0.83544921875,
0.7373046875,
-0.29345703125,
0.002216339111328125,
-0.489501953125,
-0.37353515625,
0.461669921875,
-0.73291015625,
-0.61279296875,
-0.297119140625,
0.07720947265625,
0.66748046875,
0.12005615234375,
-1.3876953125,
-0.294189453125,
-0.45654296875,
1.205078125,
0.66357421875,
0.224365234375,
1.1904296875,
1.068359375,
0.11749267578125,
-0.2049560546875,
0.439208984375,
-0.94873046875,
-0.3623046875,
-0.26220703125,
0.54150390625,
-0.60791015625,
-0.387939453125,
-0.50732421875,
0.1795654296875,
-0.261474609375,
0.3916015625,
-0.4248046875,
-0.5341796875,
0.344482421875,
-0.454833984375,
-0.69921875,
-0.255126953125,
-0.4609375,
0.2291259765625,
-0.401123046875,
0.64697265625,
-0.256591796875,
0.2366943359375,
-0.07391357421875,
-0.1951904296875,
0.437255859375,
-0.51220703125,
0.47412109375,
0.461181640625,
-0.189453125,
-0.36865234375,
-0.69287109375,
0.1719970703125,
0.2430419921875,
-0.21240234375,
-0.283203125,
-0.130615234375,
-1.0068359375,
-0.298828125,
0.261474609375,
-0.2188720703125,
-0.1104736328125,
-0.381103515625,
-0.059326171875,
0.0865478515625,
0.079345703125,
-0.2578125,
0.84033203125,
0.28271484375,
0.77099609375,
0.1981201171875,
0.2939453125,
-0.6689453125,
-0.60546875,
0.2347412109375,
0.38818359375,
-0.11383056640625,
-0.272705078125,
-0.214599609375,
0.484619140625,
-0.136474609375,
-0.092041015625,
0.41796875,
0.70458984375,
-0.06634521484375,
0.9755859375,
0.1993408203125,
0.1304931640625,
1.2392578125,
1.0791015625,
-0.7314453125,
0.67822265625,
-0.479736328125,
0.1688232421875,
0.4375,
0.2445068359375,
-0.08319091796875,
-0.271728515625,
0.07891845703125,
-0.342041015625,
0.52685546875,
0.62060546875,
-0.245849609375,
0.5888671875,
-0.31787109375,
0.404052734375,
-0.73193359375,
-0.0770263671875,
0.7099609375,
0.1990966796875,
0.640625,
-0.11529541015625,
0.01983642578125,
-0.10284423828125,
-0.30615234375,
0.86083984375,
-0.6162109375,
-0.388916015625,
0.76806640625,
-0.02410888671875,
-0.1031494140625,
0.206787109375,
0.27587890625,
0.3701171875,
-0.097412109375,
0.61767578125,
0.5634765625,
-0.26416015625,
0.84423828125,
0.451171875,
-0.61962890625,
1.3349609375,
0.494384765625,
0.1474609375,
0.3974609375,
0.3916015625,
-0.63720703125,
0.301025390625,
-1.005859375,
0.6953125,
-0.2022705078125,
0.07177734375,
-0.55224609375,
0.16064453125,
-0.1195068359375,
0.62109375,
0.1458740234375,
-0.125,
-0.1163330078125,
0.03143310546875,
-0.064453125,
0.70654296875,
-0.5185546875,
0.7568359375,
-0.681640625,
-0.29052734375,
-0.257568359375,
-0.3544921875,
0.27392578125,
-0.11517333984375,
-0.449951171875,
0.81298828125,
0.5654296875,
0.9365234375,
0.86474609375,
-0.5546875,
0.1016845703125,
0.4775390625,
-0.100341796875,
0.1385498046875,
0.66748046875,
0.5419921875,
-0.10101318359375,
0.37939453125,
-0.285400390625,
-0.478271484375,
-0.98388671875,
-0.352294921875,
0.1611328125,
0.5966796875,
-1.013671875,
0.150634765625,
0.309814453125,
-0.06390380859375,
-0.568359375,
0.078857421875,
-0.02764892578125,
-0.99951171875,
-0.462646484375,
0.5869140625,
-0.363037109375,
0.497314453125,
-0.158935546875,
-0.84130859375,
0.4580078125,
0.9921875,
-0.697265625,
0.28857421875,
0.37255859375,
0.10687255859375,
-0.019195556640625,
0.113037109375,
0.1551513671875,
-0.066650390625,
-0.5595703125,
0.81884765625,
-0.407958984375,
0.17041015625,
-0.0787353515625,
0.8232421875,
0.25634765625,
0.171142578125,
-0.290771484375,
-0.5126953125,
0.32470703125,
1.5068359375,
0.329345703125,
0.284423828125,
0.050201416015625,
1.0791015625,
0.51708984375,
1.0546875,
0.1572265625,
0.150390625,
0.60302734375,
0.77099609375,
0.07611083984375,
0.136474609375,
-0.09613037109375,
0.460205078125,
0.43701171875,
0.2890625,
0.287109375,
0.5703125,
-0.164794921875,
0.1224365234375,
-0.59375,
0.46533203125,
-0.044586181640625,
0.62353515625,
0.392578125,
0.03662109375,
-0.8916015625,
-0.12890625,
0.1524658203125,
1.0908203125,
-0.276611328125,
-0.59716796875,
-0.36328125,
0.04168701171875,
0.291259765625,
-0.027130126953125,
0.03521728515625,
0.401123046875,
0.5283203125,
0.62646484375,
-0.2607421875,
-0.21044921875,
-1.05078125,
-1.125,
-0.80419921875,
-0.65478515625,
-0.485107421875,
0.0244140625,
0.227783203125,
-0.68701171875,
-0.049957275390625,
0.00785064697265625,
-0.50390625,
0.06805419921875,
-0.775390625,
0.76611328125,
-0.3056640625,
0.59619140625,
-0.75927734375,
0.450439453125,
-0.353271484375,
1.166015625,
-0.80859375,
-0.330810546875,
-0.09173583984375,
-0.6591796875,
0.305419921875,
0.10162353515625,
-0.10467529296875,
-0.349609375,
-0.145751953125,
-1.00390625,
-0.34033203125,
-0.265625,
0.0199127197265625,
-0.203369140625,
-0.6630859375,
0.84912109375,
0.467529296875,
-0.73193359375,
0.57763671875,
0.97412109375,
-0.73046875,
0.324462890625,
0.73291015625,
0.1676025390625,
-0.75,
1.5048828125,
0.6328125,
0.289306640625,
-0.7685546875,
-0.60986328125,
-0.53076171875,
-0.18505859375,
0.1624755859375,
-0.5849609375,
-0.311767578125,
0.5556640625,
0.1295166015625,
-1.044921875,
0.10235595703125,
-0.72607421875,
-1.18359375,
-0.061279296875,
-0.6884765625,
0.9189453125,
0.466064453125,
-0.0748291015625,
-0.00879669189453125,
-0.67333984375,
0.281005859375,
0.62158203125,
0.424072265625,
-0.61181640625,
0.166259765625,
0.61669921875,
-0.0310821533203125,
0.04949951171875,
0.1324462890625,
-0.5810546875,
-0.057830810546875,
-0.224365234375,
0.12158203125,
0.3994140625,
0.08880615234375,
0.39697265625,
0.468994140625,
0.78271484375,
-0.9208984375,
-0.212890625,
-0.10675048828125,
0.5224609375,
0.396484375,
0.50048828125,
0.367431640625,
0.1995849609375,
-0.95263671875,
-1.1806640625,
-0.0307159423828125,
0.53369140625,
0.12481689453125,
-0.91943359375,
1.029296875,
0.3623046875,
-0.32080078125,
0.59423828125,
-0.63720703125,
-0.22265625,
0.6923828125,
-0.0266876220703125,
0.431884765625,
-0.77978515625,
0.34375,
-0.07958984375,
0.29150390625,
0.91064453125,
0.43701171875,
0.6748046875,
-0.165771484375,
-0.54931640625,
-0.2802734375,
-0.1158447265625,
0.0147552490234375,
-0.364013671875,
0.587890625,
-0.487548828125,
-0.50146484375,
-0.77197265625,
0.46875,
0.7451171875,
0.609375,
-0.1776123046875,
0.400634765625,
0.48193359375,
0.7783203125,
0.385498046875,
-0.48095703125,
0.2281494140625,
-0.82080078125,
0.80517578125,
0.445068359375,
-0.107666015625,
-0.5888671875,
-0.55078125,
-0.29541015625,
-0.04986572265625,
0.455810546875,
-0.1866455078125,
-0.826171875,
0.04119873046875,
0.06378173828125,
0.84716796875,
0.0760498046875,
-0.15380859375,
-0.0026397705078125,
0.2149658203125,
0.66943359375,
-0.95703125,
-0.0227813720703125,
-0.611328125,
0.470947265625,
0.44189453125,
-0.421630859375,
-0.66748046875,
-0.64892578125,
-0.732421875,
-0.239990234375,
0.03753662109375,
0.52294921875,
0.07989501953125,
0.16455078125,
-1.2197265625,
0.59912109375,
0.1866455078125,
-0.6767578125,
0.2164306640625,
0.092529296875,
0.51611328125,
-0.277587890625,
0.943359375,
-0.17333984375,
-0.75048828125,
0.34912109375,
-1.044921875,
0.0239715576171875,
-0.2198486328125,
0.21875,
-0.6025390625,
-0.025177001953125,
-0.048309326171875,
0.64453125,
-0.321044921875,
0.373046875,
-0.161865234375,
0.1497802734375,
-0.85400390625,
-0.8955078125,
0.61376953125,
-0.33349609375,
-0.352783203125,
1.2900390625,
-0.01010894775390625,
-0.62548828125,
-0.082763671875,
0.6171875,
-0.46630859375,
0.353271484375,
-0.43701171875,
0.478759765625,
-0.1964111328125,
-0.31689453125,
-0.06842041015625,
-0.81103515625,
0.84375,
0.10321044921875,
-0.66259765625,
-0.446533203125,
-1.1181640625,
-0.458251953125,
-0.1116943359375,
-0.572265625,
0.1378173828125,
0.280517578125,
-0.028533935546875,
-0.350830078125,
-0.330810546875,
-0.9912109375,
-0.2191162109375,
-0.5927734375,
-0.18896484375,
0.486572265625,
0.96728515625,
0.4775390625,
0.085693359375,
-0.51953125,
0.024658203125,
-0.422607421875,
-0.3134765625,
-0.58349609375,
0.261474609375,
-0.09088134765625,
-0.2027587890625,
-0.34130859375,
0.15869140625,
0.361572265625,
0.48974609375,
0.71240234375,
0.290771484375,
0.477294921875,
0.47802734375,
-0.322998046875,
1.150390625,
0.362548828125,
-1.38671875,
-0.650390625,
0.9970703125,
0.125732421875,
0.8095703125,
0.006961822509765625,
-0.73583984375,
-0.66748046875,
-1.0068359375,
0.0594482421875,
-0.55517578125,
-0.07769775390625,
-0.78173828125,
-0.206298828125,
-0.35302734375,
0.71728515625,
-0.6669921875,
-0.79052734375,
0.2373046875,
-0.9716796875,
0.11480712890625,
-0.1253662109375,
-0.5576171875,
-0.84326171875,
0.145263671875,
-0.215087890625,
0.6728515625,
-0.06939697265625,
0.154296875,
-0.15283203125,
-0.20947265625,
0.1533203125,
-0.0273895263671875,
-0.578125,
-0.384521484375,
0.10870361328125,
-0.0748291015625,
-0.5205078125,
0.043792724609375,
-0.359375,
0.324951171875,
-1.009765625,
-0.0992431640625,
-0.148681640625,
-0.458984375,
-0.02105712890625,
-0.4365234375,
0.9833984375,
-0.33447265625,
-0.17236328125,
-0.336181640625,
-0.00933074951171875,
0.93798828125,
-0.0894775390625,
-0.385498046875,
-0.83349609375,
-0.47802734375,
-1.2529296875,
0.260498046875,
-0.466064453125,
-0.326904296875,
-0.72412109375,
-0.494873046875,
0.64306640625,
-0.434814453125,
0.52294921875,
1.119140625,
0.168212890625,
0.11700439453125,
-0.7197265625,
0.798828125,
0.393798828125,
-0.9599609375,
0.072998046875,
0.054718017578125,
-0.9599609375,
0.64111328125,
-0.388916015625,
-0.93701171875,
-0.430908203125,
0.57373046875,
0.9755859375,
-0.414306640625,
0.56884765625,
0.035491943359375,
-1.0361328125,
-0.57861328125,
0.448486328125,
0.293212890625,
0.11944580078125,
0.78125,
-0.17431640625,
-0.1861572265625,
0.378662109375,
0.26318359375,
-0.2459716796875,
-0.67626953125,
1.400390625,
0.021881103515625,
-0.346435546875,
0.8203125,
0.3896484375,
-1.0498046875,
-0.556640625,
-0.08013916015625,
0.1817626953125,
-0.1646728515625,
-0.8173828125,
0.215087890625,
0.626953125,
-0.6015625,
0.16064453125,
0.421630859375,
0.09490966796875,
0.55810546875,
0.24072265625,
0.51025390625,
-0.5244140625,
0.57861328125,
0.78173828125,
-0.5625,
-0.2568359375,
-0.91552734375,
-0.31201171875,
0.00804901123046875,
-0.068603515625,
0.62548828125,
-0.6396484375,
-0.239501953125,
0.170654296875,
-0.0277557373046875,
0.8828125,
0.041748046875,
-0.409423828125,
0.609375,
-0.642578125,
-0.446533203125,
0.046905517578125,
0.1884765625,
-0.0205230712890625,
0.46435546875,
-0.5234375,
0.5693359375,
0.303466796875,
0.375732421875,
-0.2744140625,
-0.90966796875,
-0.4609375,
-0.876953125,
-0.07318115234375,
-0.55859375,
-0.92919921875,
0.0279541015625,
0.423583984375,
-0.09539794921875,
-0.93310546875,
0.280029296875,
0.30615234375,
-0.52490234375,
1.0341796875,
-1.1611328125,
0.372802734375,
-0.66064453125,
-0.249755859375,
-0.53076171875,
-0.35693359375,
-0.11865234375,
-0.014862060546875,
-0.6572265625,
0.078857421875,
-0.27001953125,
0.7060546875,
-0.356689453125,
0.54296875,
0.038360595703125,
-0.86181640625,
-0.07281494140625,
0.1497802734375,
-0.1629638671875,
0.53076171875,
0.9326171875,
0.01020050048828125,
0.2489013671875,
-0.16552734375,
-0.32080078125,
-0.1895751953125,
0.303955078125,
0.4560546875,
-0.1141357421875,
-0.298828125,
-0.4404296875,
-0.31396484375,
-1.134765625,
0.374267578125,
-0.55126953125,
-0.07440185546875,
-0.088623046875,
0.0108642578125,
0.2034912109375,
1.0380859375,
-0.60107421875,
0.56201171875,
-0.10015869140625,
0.2137451171875,
0.43994140625,
-0.004444122314453125,
-0.048248291015625,
0.324462890625,
0.323486328125,
-0.64794921875,
0.07550048828125,
0.290283203125,
0.08087158203125,
0.2181396484375,
-0.1710205078125,
-0.8779296875,
-1.0361328125,
-0.380615234375,
-0.111572265625,
0.5546875,
0.46875,
-0.31982421875,
-0.2978515625,
-0.1285400390625,
-0.791015625,
-0.024383544921875,
-1.263671875,
-0.77880859375,
0.55126953125,
0.0006604194641113281,
-0.0007390975952148438,
0.1087646484375,
-0.4755859375,
-0.556640625,
-0.26708984375,
0.1793212890625,
-0.359375,
0.5009765625,
-0.1192626953125,
0.456787109375,
-0.03607177734375,
-0.1556396484375,
0.074951171875,
0.70458984375,
-0.87890625,
-0.57470703125,
-0.2197265625,
1.2021484375,
0.1715087890625,
0.0119781494140625,
-0.54052734375,
0.4375,
0.349365234375,
0.424560546875,
-0.1981201171875,
0.4853515625,
-0.08209228515625,
0.60498046875,
-0.7109375,
-0.011444091796875,
-0.2294921875,
0.410400390625,
0.08404541015625,
-0.4482421875,
-0.74609375,
0.8642578125,
0.3671875,
-0.08013916015625,
1.0029296875,
0.224609375,
0.060699462890625,
-0.031585693359375,
-0.031494140625,
-0.287353515625,
0.302001953125,
0.255859375,
0.4833984375,
-0.395751953125,
0.1297607421875,
0.9384765625,
0.184814453125,
0.0821533203125,
0.65771484375,
0.1387939453125,
0.022552490234375,
0.42041015625,
-0.051605224609375,
0.02972412109375,
0.36865234375,
-0.427734375,
0.3056640625,
-0.5087890625,
0.036712646484375,
-0.380126953125,
-0.67626953125,
0.74365234375,
-0.267333984375,
-0.38330078125,
0.0765380859375,
-0.45751953125,
0.2349853515625,
0.460205078125,
-0.30517578125,
-0.1190185546875,
0.93359375,
0.767578125,
0.572265625,
0.7802734375,
0.373291015625,
0.3642578125,
-1.23828125,
0.4365234375,
0.2186279296875,
0.291748046875,
-0.187255859375,
-0.61865234375,
-0.953125,
0.1761474609375,
-0.212158203125,
-0.285400390625,
0.65966796875,
-0.673828125,
0.1510009765625,
-0.350830078125,
0.78369140625,
-0.71630859375,
0.260009765625,
-0.0518798828125,
-0.12152099609375,
-0.5966796875,
0.81494140625,
-0.31201171875,
0.54296875,
0.432861328125,
0.9013671875,
0.4130859375,
1.46484375,
0.62158203125,
0.09002685546875,
0.1385498046875,
0.35546875,
-0.52587890625,
-0.39453125,
-0.69091796875,
-0.4375,
-0.126953125,
-0.72900390625,
-0.55078125,
-0.1724853515625,
0.72314453125,
0.235595703125,
-1.0341796875,
-0.4423828125,
0.1912841796875,
-0.98681640625,
0.1417236328125,
0.198974609375,
0.66845703125,
0.2054443359375,
-0.282470703125,
0.097412109375,
-0.54345703125,
0.1484375,
-0.50732421875,
0.68505859375,
-0.68310546875,
-0.58447265625,
-0.4619140625,
-0.59765625,
-0.2357177734375,
-0.556640625,
-0.38330078125,
-0.70361328125,
0.64111328125,
0.170654296875,
0.0205535888671875,
0.53662109375,
-0.319580078125,
-0.0347900390625,
0.78369140625,
1.16796875,
-0.1275634765625,
0.98388671875,
0.39306640625,
-0.115478515625,
0.1324462890625,
-0.435791015625,
0.01422882080078125,
-0.173828125,
0.1529541015625,
-0.5341796875,
0.10833740234375,
-0.439453125,
-1.212890625,
0.281005859375,
0.2333984375,
0.04595947265625,
-0.92578125,
-1.1337890625,
-0.1302490234375,
-1.1650390625,
-0.474365234375,
-0.7802734375,
0.48486328125,
-0.49072265625,
0.2236328125,
0.14990234375,
-1.0341796875,
4.3671875,
0.68359375,
0.49560546875,
0.095458984375,
0.21240234375,
1.1572265625,
0.487060546875,
-0.83056640625,
-0.401123046875,
-0.459228515625,
0.75146484375,
-0.1556396484375,
-0.00858306884765625,
0.7001953125,
0.300048828125,
0.50927734375,
-0.5615234375,
-0.0214691162109375,
0.004207611083984375,
-1.029296875,
-0.80859375,
0.48095703125,
0.460693359375,
0.310546875,
0.283935546875,
0.2061767578125,
0.61572265625,
-0.55419921875,
-0.088623046875,
-0.79052734375,
0.268310546875,
-0.68505859375,
0.8203125,
0.01898193359375,
0.1461181640625,
0.363037109375,
0.077880859375,
-0.476318359375,
-0.1834716796875,
0.63330078125,
-0.180419921875,
0.06072998046875,
0.62646484375,
-0.57763671875,
-0.258544921875,
0.53369140625,
-0.0947265625,
0.2666015625,
0.09521484375,
-1.013671875,
1.177734375,
-0.2247314453125,
0.8583984375,
-0.91162109375,
-1.0078125,
0.26171875,
0.09857177734375,
0.07464599609375,
-0.330322265625,
0.201904296875,
0.475830078125,
0.67724609375,
0.1922607421875,
0.284423828125,
-0.77783203125,
0.6650390625,
0.451416015625,
0.197265625,
-0.417724609375,
-0.1748046875,
-0.5537109375,
-0.1976318359375,
-0.25,
-0.52587890625,
0.9716796875,
0.5146484375,
-0.34521484375,
0.814453125,
0.78857421875,
-0.69921875,
0.0850830078125,
-0.95556640625,
-0.08551025390625,
-0.4033203125,
0.339111328125,
1.4375,
-0.5908203125,
0.046630859375,
-0.132080078125,
0.68212890625,
0.6103515625,
0.68115234375,
0.16943359375,
-0.705078125,
-0.27978515625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
The tycoon of a winery empire in Mondstadt, unmatched in every possible way. A thinker in the Knights of Favonius with an exotic appearance.
This time, the brothers are dealing with a strange piece of wood marked with their names. This plank of wood can be represented as a string of n characters. Each character is either a 'D' or a 'K'. You want to make some number of cuts (possibly 0) on this string, partitioning it into several contiguous pieces, each with length at least 1. Both brothers act with dignity, so they want to split the wood as evenly as possible. They want to know the maximum number of pieces you can split the wood into such that the ratios of the number of occurrences of 'D' to the number of occurrences of 'K' in each chunk are the same.
Kaeya, the curious thinker, is interested in the solution for multiple scenarios. He wants to know the answer for every prefix of the given string. Help him to solve this problem!
For a string we define a ratio as a:b where 'D' appears in it a times, and 'K' appears b times. Note that a or b can equal 0, but not both. Ratios a:b and c:d are considered equal if and only if aâ‹… d = bâ‹… c.
For example, for the string 'DDD' the ratio will be 3:0, for 'DKD' — 2:1, for 'DKK' — 1:2, and for 'KKKKDD' — 2:4. Note that the ratios of the latter two strings are equal to each other, but they are not equal to the ratios of the first two strings.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 1000). Description of the test cases follows.
The first line of each test case contains an integer n (1 ≤ n ≤ 5 ⋅ 10^5) — the length of the wood.
The second line of each test case contains a string s of length n. Every character of s will be either 'D' or 'K'.
It is guaranteed that the sum of n over all test cases does not exceed 5 â‹… 10^5.
Output
For each test case, output n space separated integers. The i-th of these numbers should equal the answer for the prefix s_{1},s_{2},...,s_{i}.
Example
Input
5
3
DDK
6
DDDDDD
4
DKDK
1
D
9
DKDKDDDDK
Output
1 2 1
1 2 3 4 5 6
1 1 1 2
1
1 1 1 2 1 2 1 1 3
Note
For the first test case, there is no way to partition 'D' or 'DDK' into more than one block with equal ratios of numbers of 'D' and 'K', while you can split 'DD' into 'D' and 'D'.
For the second test case, you can split each prefix of length i into i blocks 'D'.
Tags: data structures, dp, hashing, number theory
Correct Solution:
```
from math import gcd
import sys
input = sys.stdin.readline
def main():
N = int(input())
S = input()
Ans = []
Ratio = dict()
D = []
K = []
d = 0
k = 0
for i in range(N):
if S[i] == 'D': d += 1
else: k += 1
G = gcd(d, k)
R = (d // G, k // G)
if R not in Ratio: Ratio[R] = 1
else: Ratio[R] += 1
Ans.append(Ratio[R])
D.append(d)
K.append(k)
print(*Ans)
if __name__ == '__main__':
T = int(input())
for _ in range(T):
main()
```
| 44,842
|
[
0.16162109375,
0.2286376953125,
0.38818359375,
0.376953125,
-0.69921875,
-0.525390625,
-0.042694091796875,
0.19482421875,
-0.1031494140625,
0.83544921875,
0.7373046875,
-0.29345703125,
0.002216339111328125,
-0.489501953125,
-0.37353515625,
0.461669921875,
-0.73291015625,
-0.61279296875,
-0.297119140625,
0.07720947265625,
0.66748046875,
0.12005615234375,
-1.3876953125,
-0.294189453125,
-0.45654296875,
1.205078125,
0.66357421875,
0.224365234375,
1.1904296875,
1.068359375,
0.11749267578125,
-0.2049560546875,
0.439208984375,
-0.94873046875,
-0.3623046875,
-0.26220703125,
0.54150390625,
-0.60791015625,
-0.387939453125,
-0.50732421875,
0.1795654296875,
-0.261474609375,
0.3916015625,
-0.4248046875,
-0.5341796875,
0.344482421875,
-0.454833984375,
-0.69921875,
-0.255126953125,
-0.4609375,
0.2291259765625,
-0.401123046875,
0.64697265625,
-0.256591796875,
0.2366943359375,
-0.07391357421875,
-0.1951904296875,
0.437255859375,
-0.51220703125,
0.47412109375,
0.461181640625,
-0.189453125,
-0.36865234375,
-0.69287109375,
0.1719970703125,
0.2430419921875,
-0.21240234375,
-0.283203125,
-0.130615234375,
-1.0068359375,
-0.298828125,
0.261474609375,
-0.2188720703125,
-0.1104736328125,
-0.381103515625,
-0.059326171875,
0.0865478515625,
0.079345703125,
-0.2578125,
0.84033203125,
0.28271484375,
0.77099609375,
0.1981201171875,
0.2939453125,
-0.6689453125,
-0.60546875,
0.2347412109375,
0.38818359375,
-0.11383056640625,
-0.272705078125,
-0.214599609375,
0.484619140625,
-0.136474609375,
-0.092041015625,
0.41796875,
0.70458984375,
-0.06634521484375,
0.9755859375,
0.1993408203125,
0.1304931640625,
1.2392578125,
1.0791015625,
-0.7314453125,
0.67822265625,
-0.479736328125,
0.1688232421875,
0.4375,
0.2445068359375,
-0.08319091796875,
-0.271728515625,
0.07891845703125,
-0.342041015625,
0.52685546875,
0.62060546875,
-0.245849609375,
0.5888671875,
-0.31787109375,
0.404052734375,
-0.73193359375,
-0.0770263671875,
0.7099609375,
0.1990966796875,
0.640625,
-0.11529541015625,
0.01983642578125,
-0.10284423828125,
-0.30615234375,
0.86083984375,
-0.6162109375,
-0.388916015625,
0.76806640625,
-0.02410888671875,
-0.1031494140625,
0.206787109375,
0.27587890625,
0.3701171875,
-0.097412109375,
0.61767578125,
0.5634765625,
-0.26416015625,
0.84423828125,
0.451171875,
-0.61962890625,
1.3349609375,
0.494384765625,
0.1474609375,
0.3974609375,
0.3916015625,
-0.63720703125,
0.301025390625,
-1.005859375,
0.6953125,
-0.2022705078125,
0.07177734375,
-0.55224609375,
0.16064453125,
-0.1195068359375,
0.62109375,
0.1458740234375,
-0.125,
-0.1163330078125,
0.03143310546875,
-0.064453125,
0.70654296875,
-0.5185546875,
0.7568359375,
-0.681640625,
-0.29052734375,
-0.257568359375,
-0.3544921875,
0.27392578125,
-0.11517333984375,
-0.449951171875,
0.81298828125,
0.5654296875,
0.9365234375,
0.86474609375,
-0.5546875,
0.1016845703125,
0.4775390625,
-0.100341796875,
0.1385498046875,
0.66748046875,
0.5419921875,
-0.10101318359375,
0.37939453125,
-0.285400390625,
-0.478271484375,
-0.98388671875,
-0.352294921875,
0.1611328125,
0.5966796875,
-1.013671875,
0.150634765625,
0.309814453125,
-0.06390380859375,
-0.568359375,
0.078857421875,
-0.02764892578125,
-0.99951171875,
-0.462646484375,
0.5869140625,
-0.363037109375,
0.497314453125,
-0.158935546875,
-0.84130859375,
0.4580078125,
0.9921875,
-0.697265625,
0.28857421875,
0.37255859375,
0.10687255859375,
-0.019195556640625,
0.113037109375,
0.1551513671875,
-0.066650390625,
-0.5595703125,
0.81884765625,
-0.407958984375,
0.17041015625,
-0.0787353515625,
0.8232421875,
0.25634765625,
0.171142578125,
-0.290771484375,
-0.5126953125,
0.32470703125,
1.5068359375,
0.329345703125,
0.284423828125,
0.050201416015625,
1.0791015625,
0.51708984375,
1.0546875,
0.1572265625,
0.150390625,
0.60302734375,
0.77099609375,
0.07611083984375,
0.136474609375,
-0.09613037109375,
0.460205078125,
0.43701171875,
0.2890625,
0.287109375,
0.5703125,
-0.164794921875,
0.1224365234375,
-0.59375,
0.46533203125,
-0.044586181640625,
0.62353515625,
0.392578125,
0.03662109375,
-0.8916015625,
-0.12890625,
0.1524658203125,
1.0908203125,
-0.276611328125,
-0.59716796875,
-0.36328125,
0.04168701171875,
0.291259765625,
-0.027130126953125,
0.03521728515625,
0.401123046875,
0.5283203125,
0.62646484375,
-0.2607421875,
-0.21044921875,
-1.05078125,
-1.125,
-0.80419921875,
-0.65478515625,
-0.485107421875,
0.0244140625,
0.227783203125,
-0.68701171875,
-0.049957275390625,
0.00785064697265625,
-0.50390625,
0.06805419921875,
-0.775390625,
0.76611328125,
-0.3056640625,
0.59619140625,
-0.75927734375,
0.450439453125,
-0.353271484375,
1.166015625,
-0.80859375,
-0.330810546875,
-0.09173583984375,
-0.6591796875,
0.305419921875,
0.10162353515625,
-0.10467529296875,
-0.349609375,
-0.145751953125,
-1.00390625,
-0.34033203125,
-0.265625,
0.0199127197265625,
-0.203369140625,
-0.6630859375,
0.84912109375,
0.467529296875,
-0.73193359375,
0.57763671875,
0.97412109375,
-0.73046875,
0.324462890625,
0.73291015625,
0.1676025390625,
-0.75,
1.5048828125,
0.6328125,
0.289306640625,
-0.7685546875,
-0.60986328125,
-0.53076171875,
-0.18505859375,
0.1624755859375,
-0.5849609375,
-0.311767578125,
0.5556640625,
0.1295166015625,
-1.044921875,
0.10235595703125,
-0.72607421875,
-1.18359375,
-0.061279296875,
-0.6884765625,
0.9189453125,
0.466064453125,
-0.0748291015625,
-0.00879669189453125,
-0.67333984375,
0.281005859375,
0.62158203125,
0.424072265625,
-0.61181640625,
0.166259765625,
0.61669921875,
-0.0310821533203125,
0.04949951171875,
0.1324462890625,
-0.5810546875,
-0.057830810546875,
-0.224365234375,
0.12158203125,
0.3994140625,
0.08880615234375,
0.39697265625,
0.468994140625,
0.78271484375,
-0.9208984375,
-0.212890625,
-0.10675048828125,
0.5224609375,
0.396484375,
0.50048828125,
0.367431640625,
0.1995849609375,
-0.95263671875,
-1.1806640625,
-0.0307159423828125,
0.53369140625,
0.12481689453125,
-0.91943359375,
1.029296875,
0.3623046875,
-0.32080078125,
0.59423828125,
-0.63720703125,
-0.22265625,
0.6923828125,
-0.0266876220703125,
0.431884765625,
-0.77978515625,
0.34375,
-0.07958984375,
0.29150390625,
0.91064453125,
0.43701171875,
0.6748046875,
-0.165771484375,
-0.54931640625,
-0.2802734375,
-0.1158447265625,
0.0147552490234375,
-0.364013671875,
0.587890625,
-0.487548828125,
-0.50146484375,
-0.77197265625,
0.46875,
0.7451171875,
0.609375,
-0.1776123046875,
0.400634765625,
0.48193359375,
0.7783203125,
0.385498046875,
-0.48095703125,
0.2281494140625,
-0.82080078125,
0.80517578125,
0.445068359375,
-0.107666015625,
-0.5888671875,
-0.55078125,
-0.29541015625,
-0.04986572265625,
0.455810546875,
-0.1866455078125,
-0.826171875,
0.04119873046875,
0.06378173828125,
0.84716796875,
0.0760498046875,
-0.15380859375,
-0.0026397705078125,
0.2149658203125,
0.66943359375,
-0.95703125,
-0.0227813720703125,
-0.611328125,
0.470947265625,
0.44189453125,
-0.421630859375,
-0.66748046875,
-0.64892578125,
-0.732421875,
-0.239990234375,
0.03753662109375,
0.52294921875,
0.07989501953125,
0.16455078125,
-1.2197265625,
0.59912109375,
0.1866455078125,
-0.6767578125,
0.2164306640625,
0.092529296875,
0.51611328125,
-0.277587890625,
0.943359375,
-0.17333984375,
-0.75048828125,
0.34912109375,
-1.044921875,
0.0239715576171875,
-0.2198486328125,
0.21875,
-0.6025390625,
-0.025177001953125,
-0.048309326171875,
0.64453125,
-0.321044921875,
0.373046875,
-0.161865234375,
0.1497802734375,
-0.85400390625,
-0.8955078125,
0.61376953125,
-0.33349609375,
-0.352783203125,
1.2900390625,
-0.01010894775390625,
-0.62548828125,
-0.082763671875,
0.6171875,
-0.46630859375,
0.353271484375,
-0.43701171875,
0.478759765625,
-0.1964111328125,
-0.31689453125,
-0.06842041015625,
-0.81103515625,
0.84375,
0.10321044921875,
-0.66259765625,
-0.446533203125,
-1.1181640625,
-0.458251953125,
-0.1116943359375,
-0.572265625,
0.1378173828125,
0.280517578125,
-0.028533935546875,
-0.350830078125,
-0.330810546875,
-0.9912109375,
-0.2191162109375,
-0.5927734375,
-0.18896484375,
0.486572265625,
0.96728515625,
0.4775390625,
0.085693359375,
-0.51953125,
0.024658203125,
-0.422607421875,
-0.3134765625,
-0.58349609375,
0.261474609375,
-0.09088134765625,
-0.2027587890625,
-0.34130859375,
0.15869140625,
0.361572265625,
0.48974609375,
0.71240234375,
0.290771484375,
0.477294921875,
0.47802734375,
-0.322998046875,
1.150390625,
0.362548828125,
-1.38671875,
-0.650390625,
0.9970703125,
0.125732421875,
0.8095703125,
0.006961822509765625,
-0.73583984375,
-0.66748046875,
-1.0068359375,
0.0594482421875,
-0.55517578125,
-0.07769775390625,
-0.78173828125,
-0.206298828125,
-0.35302734375,
0.71728515625,
-0.6669921875,
-0.79052734375,
0.2373046875,
-0.9716796875,
0.11480712890625,
-0.1253662109375,
-0.5576171875,
-0.84326171875,
0.145263671875,
-0.215087890625,
0.6728515625,
-0.06939697265625,
0.154296875,
-0.15283203125,
-0.20947265625,
0.1533203125,
-0.0273895263671875,
-0.578125,
-0.384521484375,
0.10870361328125,
-0.0748291015625,
-0.5205078125,
0.043792724609375,
-0.359375,
0.324951171875,
-1.009765625,
-0.0992431640625,
-0.148681640625,
-0.458984375,
-0.02105712890625,
-0.4365234375,
0.9833984375,
-0.33447265625,
-0.17236328125,
-0.336181640625,
-0.00933074951171875,
0.93798828125,
-0.0894775390625,
-0.385498046875,
-0.83349609375,
-0.47802734375,
-1.2529296875,
0.260498046875,
-0.466064453125,
-0.326904296875,
-0.72412109375,
-0.494873046875,
0.64306640625,
-0.434814453125,
0.52294921875,
1.119140625,
0.168212890625,
0.11700439453125,
-0.7197265625,
0.798828125,
0.393798828125,
-0.9599609375,
0.072998046875,
0.054718017578125,
-0.9599609375,
0.64111328125,
-0.388916015625,
-0.93701171875,
-0.430908203125,
0.57373046875,
0.9755859375,
-0.414306640625,
0.56884765625,
0.035491943359375,
-1.0361328125,
-0.57861328125,
0.448486328125,
0.293212890625,
0.11944580078125,
0.78125,
-0.17431640625,
-0.1861572265625,
0.378662109375,
0.26318359375,
-0.2459716796875,
-0.67626953125,
1.400390625,
0.021881103515625,
-0.346435546875,
0.8203125,
0.3896484375,
-1.0498046875,
-0.556640625,
-0.08013916015625,
0.1817626953125,
-0.1646728515625,
-0.8173828125,
0.215087890625,
0.626953125,
-0.6015625,
0.16064453125,
0.421630859375,
0.09490966796875,
0.55810546875,
0.24072265625,
0.51025390625,
-0.5244140625,
0.57861328125,
0.78173828125,
-0.5625,
-0.2568359375,
-0.91552734375,
-0.31201171875,
0.00804901123046875,
-0.068603515625,
0.62548828125,
-0.6396484375,
-0.239501953125,
0.170654296875,
-0.0277557373046875,
0.8828125,
0.041748046875,
-0.409423828125,
0.609375,
-0.642578125,
-0.446533203125,
0.046905517578125,
0.1884765625,
-0.0205230712890625,
0.46435546875,
-0.5234375,
0.5693359375,
0.303466796875,
0.375732421875,
-0.2744140625,
-0.90966796875,
-0.4609375,
-0.876953125,
-0.07318115234375,
-0.55859375,
-0.92919921875,
0.0279541015625,
0.423583984375,
-0.09539794921875,
-0.93310546875,
0.280029296875,
0.30615234375,
-0.52490234375,
1.0341796875,
-1.1611328125,
0.372802734375,
-0.66064453125,
-0.249755859375,
-0.53076171875,
-0.35693359375,
-0.11865234375,
-0.014862060546875,
-0.6572265625,
0.078857421875,
-0.27001953125,
0.7060546875,
-0.356689453125,
0.54296875,
0.038360595703125,
-0.86181640625,
-0.07281494140625,
0.1497802734375,
-0.1629638671875,
0.53076171875,
0.9326171875,
0.01020050048828125,
0.2489013671875,
-0.16552734375,
-0.32080078125,
-0.1895751953125,
0.303955078125,
0.4560546875,
-0.1141357421875,
-0.298828125,
-0.4404296875,
-0.31396484375,
-1.134765625,
0.374267578125,
-0.55126953125,
-0.07440185546875,
-0.088623046875,
0.0108642578125,
0.2034912109375,
1.0380859375,
-0.60107421875,
0.56201171875,
-0.10015869140625,
0.2137451171875,
0.43994140625,
-0.004444122314453125,
-0.048248291015625,
0.324462890625,
0.323486328125,
-0.64794921875,
0.07550048828125,
0.290283203125,
0.08087158203125,
0.2181396484375,
-0.1710205078125,
-0.8779296875,
-1.0361328125,
-0.380615234375,
-0.111572265625,
0.5546875,
0.46875,
-0.31982421875,
-0.2978515625,
-0.1285400390625,
-0.791015625,
-0.024383544921875,
-1.263671875,
-0.77880859375,
0.55126953125,
0.0006604194641113281,
-0.0007390975952148438,
0.1087646484375,
-0.4755859375,
-0.556640625,
-0.26708984375,
0.1793212890625,
-0.359375,
0.5009765625,
-0.1192626953125,
0.456787109375,
-0.03607177734375,
-0.1556396484375,
0.074951171875,
0.70458984375,
-0.87890625,
-0.57470703125,
-0.2197265625,
1.2021484375,
0.1715087890625,
0.0119781494140625,
-0.54052734375,
0.4375,
0.349365234375,
0.424560546875,
-0.1981201171875,
0.4853515625,
-0.08209228515625,
0.60498046875,
-0.7109375,
-0.011444091796875,
-0.2294921875,
0.410400390625,
0.08404541015625,
-0.4482421875,
-0.74609375,
0.8642578125,
0.3671875,
-0.08013916015625,
1.0029296875,
0.224609375,
0.060699462890625,
-0.031585693359375,
-0.031494140625,
-0.287353515625,
0.302001953125,
0.255859375,
0.4833984375,
-0.395751953125,
0.1297607421875,
0.9384765625,
0.184814453125,
0.0821533203125,
0.65771484375,
0.1387939453125,
0.022552490234375,
0.42041015625,
-0.051605224609375,
0.02972412109375,
0.36865234375,
-0.427734375,
0.3056640625,
-0.5087890625,
0.036712646484375,
-0.380126953125,
-0.67626953125,
0.74365234375,
-0.267333984375,
-0.38330078125,
0.0765380859375,
-0.45751953125,
0.2349853515625,
0.460205078125,
-0.30517578125,
-0.1190185546875,
0.93359375,
0.767578125,
0.572265625,
0.7802734375,
0.373291015625,
0.3642578125,
-1.23828125,
0.4365234375,
0.2186279296875,
0.291748046875,
-0.187255859375,
-0.61865234375,
-0.953125,
0.1761474609375,
-0.212158203125,
-0.285400390625,
0.65966796875,
-0.673828125,
0.1510009765625,
-0.350830078125,
0.78369140625,
-0.71630859375,
0.260009765625,
-0.0518798828125,
-0.12152099609375,
-0.5966796875,
0.81494140625,
-0.31201171875,
0.54296875,
0.432861328125,
0.9013671875,
0.4130859375,
1.46484375,
0.62158203125,
0.09002685546875,
0.1385498046875,
0.35546875,
-0.52587890625,
-0.39453125,
-0.69091796875,
-0.4375,
-0.126953125,
-0.72900390625,
-0.55078125,
-0.1724853515625,
0.72314453125,
0.235595703125,
-1.0341796875,
-0.4423828125,
0.1912841796875,
-0.98681640625,
0.1417236328125,
0.198974609375,
0.66845703125,
0.2054443359375,
-0.282470703125,
0.097412109375,
-0.54345703125,
0.1484375,
-0.50732421875,
0.68505859375,
-0.68310546875,
-0.58447265625,
-0.4619140625,
-0.59765625,
-0.2357177734375,
-0.556640625,
-0.38330078125,
-0.70361328125,
0.64111328125,
0.170654296875,
0.0205535888671875,
0.53662109375,
-0.319580078125,
-0.0347900390625,
0.78369140625,
1.16796875,
-0.1275634765625,
0.98388671875,
0.39306640625,
-0.115478515625,
0.1324462890625,
-0.435791015625,
0.01422882080078125,
-0.173828125,
0.1529541015625,
-0.5341796875,
0.10833740234375,
-0.439453125,
-1.212890625,
0.281005859375,
0.2333984375,
0.04595947265625,
-0.92578125,
-1.1337890625,
-0.1302490234375,
-1.1650390625,
-0.474365234375,
-0.7802734375,
0.48486328125,
-0.49072265625,
0.2236328125,
0.14990234375,
-1.0341796875,
4.3671875,
0.68359375,
0.49560546875,
0.095458984375,
0.21240234375,
1.1572265625,
0.487060546875,
-0.83056640625,
-0.401123046875,
-0.459228515625,
0.75146484375,
-0.1556396484375,
-0.00858306884765625,
0.7001953125,
0.300048828125,
0.50927734375,
-0.5615234375,
-0.0214691162109375,
0.004207611083984375,
-1.029296875,
-0.80859375,
0.48095703125,
0.460693359375,
0.310546875,
0.283935546875,
0.2061767578125,
0.61572265625,
-0.55419921875,
-0.088623046875,
-0.79052734375,
0.268310546875,
-0.68505859375,
0.8203125,
0.01898193359375,
0.1461181640625,
0.363037109375,
0.077880859375,
-0.476318359375,
-0.1834716796875,
0.63330078125,
-0.180419921875,
0.06072998046875,
0.62646484375,
-0.57763671875,
-0.258544921875,
0.53369140625,
-0.0947265625,
0.2666015625,
0.09521484375,
-1.013671875,
1.177734375,
-0.2247314453125,
0.8583984375,
-0.91162109375,
-1.0078125,
0.26171875,
0.09857177734375,
0.07464599609375,
-0.330322265625,
0.201904296875,
0.475830078125,
0.67724609375,
0.1922607421875,
0.284423828125,
-0.77783203125,
0.6650390625,
0.451416015625,
0.197265625,
-0.417724609375,
-0.1748046875,
-0.5537109375,
-0.1976318359375,
-0.25,
-0.52587890625,
0.9716796875,
0.5146484375,
-0.34521484375,
0.814453125,
0.78857421875,
-0.69921875,
0.0850830078125,
-0.95556640625,
-0.08551025390625,
-0.4033203125,
0.339111328125,
1.4375,
-0.5908203125,
0.046630859375,
-0.132080078125,
0.68212890625,
0.6103515625,
0.68115234375,
0.16943359375,
-0.705078125,
-0.27978515625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
The tycoon of a winery empire in Mondstadt, unmatched in every possible way. A thinker in the Knights of Favonius with an exotic appearance.
This time, the brothers are dealing with a strange piece of wood marked with their names. This plank of wood can be represented as a string of n characters. Each character is either a 'D' or a 'K'. You want to make some number of cuts (possibly 0) on this string, partitioning it into several contiguous pieces, each with length at least 1. Both brothers act with dignity, so they want to split the wood as evenly as possible. They want to know the maximum number of pieces you can split the wood into such that the ratios of the number of occurrences of 'D' to the number of occurrences of 'K' in each chunk are the same.
Kaeya, the curious thinker, is interested in the solution for multiple scenarios. He wants to know the answer for every prefix of the given string. Help him to solve this problem!
For a string we define a ratio as a:b where 'D' appears in it a times, and 'K' appears b times. Note that a or b can equal 0, but not both. Ratios a:b and c:d are considered equal if and only if aâ‹… d = bâ‹… c.
For example, for the string 'DDD' the ratio will be 3:0, for 'DKD' — 2:1, for 'DKK' — 1:2, and for 'KKKKDD' — 2:4. Note that the ratios of the latter two strings are equal to each other, but they are not equal to the ratios of the first two strings.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 1000). Description of the test cases follows.
The first line of each test case contains an integer n (1 ≤ n ≤ 5 ⋅ 10^5) — the length of the wood.
The second line of each test case contains a string s of length n. Every character of s will be either 'D' or 'K'.
It is guaranteed that the sum of n over all test cases does not exceed 5 â‹… 10^5.
Output
For each test case, output n space separated integers. The i-th of these numbers should equal the answer for the prefix s_{1},s_{2},...,s_{i}.
Example
Input
5
3
DDK
6
DDDDDD
4
DKDK
1
D
9
DKDKDDDDK
Output
1 2 1
1 2 3 4 5 6
1 1 1 2
1
1 1 1 2 1 2 1 1 3
Note
For the first test case, there is no way to partition 'D' or 'DDK' into more than one block with equal ratios of numbers of 'D' and 'K', while you can split 'DD' into 'D' and 'D'.
For the second test case, you can split each prefix of length i into i blocks 'D'.
Tags: data structures, dp, hashing, number theory
Correct Solution:
```
import math
from collections import defaultdict
for _ in range(int(input())):
n=int(input())
s=input()
d=0;k=0
l=[]
c=defaultdict(int)
for i in range(n):
if s[i]=='D':
d+=1
else:
k+=1
if k==0 or d==0:
l.append(max(k,d))
else:
m=d
n=k
g=math.gcd(d,k)
m=m//g
n=n//g
c[(m,n)]+=1
l.append(c[m,n])
print(*l)
```
| 44,843
|
[
0.16162109375,
0.2286376953125,
0.38818359375,
0.376953125,
-0.69921875,
-0.525390625,
-0.042694091796875,
0.19482421875,
-0.1031494140625,
0.83544921875,
0.7373046875,
-0.29345703125,
0.002216339111328125,
-0.489501953125,
-0.37353515625,
0.461669921875,
-0.73291015625,
-0.61279296875,
-0.297119140625,
0.07720947265625,
0.66748046875,
0.12005615234375,
-1.3876953125,
-0.294189453125,
-0.45654296875,
1.205078125,
0.66357421875,
0.224365234375,
1.1904296875,
1.068359375,
0.11749267578125,
-0.2049560546875,
0.439208984375,
-0.94873046875,
-0.3623046875,
-0.26220703125,
0.54150390625,
-0.60791015625,
-0.387939453125,
-0.50732421875,
0.1795654296875,
-0.261474609375,
0.3916015625,
-0.4248046875,
-0.5341796875,
0.344482421875,
-0.454833984375,
-0.69921875,
-0.255126953125,
-0.4609375,
0.2291259765625,
-0.401123046875,
0.64697265625,
-0.256591796875,
0.2366943359375,
-0.07391357421875,
-0.1951904296875,
0.437255859375,
-0.51220703125,
0.47412109375,
0.461181640625,
-0.189453125,
-0.36865234375,
-0.69287109375,
0.1719970703125,
0.2430419921875,
-0.21240234375,
-0.283203125,
-0.130615234375,
-1.0068359375,
-0.298828125,
0.261474609375,
-0.2188720703125,
-0.1104736328125,
-0.381103515625,
-0.059326171875,
0.0865478515625,
0.079345703125,
-0.2578125,
0.84033203125,
0.28271484375,
0.77099609375,
0.1981201171875,
0.2939453125,
-0.6689453125,
-0.60546875,
0.2347412109375,
0.38818359375,
-0.11383056640625,
-0.272705078125,
-0.214599609375,
0.484619140625,
-0.136474609375,
-0.092041015625,
0.41796875,
0.70458984375,
-0.06634521484375,
0.9755859375,
0.1993408203125,
0.1304931640625,
1.2392578125,
1.0791015625,
-0.7314453125,
0.67822265625,
-0.479736328125,
0.1688232421875,
0.4375,
0.2445068359375,
-0.08319091796875,
-0.271728515625,
0.07891845703125,
-0.342041015625,
0.52685546875,
0.62060546875,
-0.245849609375,
0.5888671875,
-0.31787109375,
0.404052734375,
-0.73193359375,
-0.0770263671875,
0.7099609375,
0.1990966796875,
0.640625,
-0.11529541015625,
0.01983642578125,
-0.10284423828125,
-0.30615234375,
0.86083984375,
-0.6162109375,
-0.388916015625,
0.76806640625,
-0.02410888671875,
-0.1031494140625,
0.206787109375,
0.27587890625,
0.3701171875,
-0.097412109375,
0.61767578125,
0.5634765625,
-0.26416015625,
0.84423828125,
0.451171875,
-0.61962890625,
1.3349609375,
0.494384765625,
0.1474609375,
0.3974609375,
0.3916015625,
-0.63720703125,
0.301025390625,
-1.005859375,
0.6953125,
-0.2022705078125,
0.07177734375,
-0.55224609375,
0.16064453125,
-0.1195068359375,
0.62109375,
0.1458740234375,
-0.125,
-0.1163330078125,
0.03143310546875,
-0.064453125,
0.70654296875,
-0.5185546875,
0.7568359375,
-0.681640625,
-0.29052734375,
-0.257568359375,
-0.3544921875,
0.27392578125,
-0.11517333984375,
-0.449951171875,
0.81298828125,
0.5654296875,
0.9365234375,
0.86474609375,
-0.5546875,
0.1016845703125,
0.4775390625,
-0.100341796875,
0.1385498046875,
0.66748046875,
0.5419921875,
-0.10101318359375,
0.37939453125,
-0.285400390625,
-0.478271484375,
-0.98388671875,
-0.352294921875,
0.1611328125,
0.5966796875,
-1.013671875,
0.150634765625,
0.309814453125,
-0.06390380859375,
-0.568359375,
0.078857421875,
-0.02764892578125,
-0.99951171875,
-0.462646484375,
0.5869140625,
-0.363037109375,
0.497314453125,
-0.158935546875,
-0.84130859375,
0.4580078125,
0.9921875,
-0.697265625,
0.28857421875,
0.37255859375,
0.10687255859375,
-0.019195556640625,
0.113037109375,
0.1551513671875,
-0.066650390625,
-0.5595703125,
0.81884765625,
-0.407958984375,
0.17041015625,
-0.0787353515625,
0.8232421875,
0.25634765625,
0.171142578125,
-0.290771484375,
-0.5126953125,
0.32470703125,
1.5068359375,
0.329345703125,
0.284423828125,
0.050201416015625,
1.0791015625,
0.51708984375,
1.0546875,
0.1572265625,
0.150390625,
0.60302734375,
0.77099609375,
0.07611083984375,
0.136474609375,
-0.09613037109375,
0.460205078125,
0.43701171875,
0.2890625,
0.287109375,
0.5703125,
-0.164794921875,
0.1224365234375,
-0.59375,
0.46533203125,
-0.044586181640625,
0.62353515625,
0.392578125,
0.03662109375,
-0.8916015625,
-0.12890625,
0.1524658203125,
1.0908203125,
-0.276611328125,
-0.59716796875,
-0.36328125,
0.04168701171875,
0.291259765625,
-0.027130126953125,
0.03521728515625,
0.401123046875,
0.5283203125,
0.62646484375,
-0.2607421875,
-0.21044921875,
-1.05078125,
-1.125,
-0.80419921875,
-0.65478515625,
-0.485107421875,
0.0244140625,
0.227783203125,
-0.68701171875,
-0.049957275390625,
0.00785064697265625,
-0.50390625,
0.06805419921875,
-0.775390625,
0.76611328125,
-0.3056640625,
0.59619140625,
-0.75927734375,
0.450439453125,
-0.353271484375,
1.166015625,
-0.80859375,
-0.330810546875,
-0.09173583984375,
-0.6591796875,
0.305419921875,
0.10162353515625,
-0.10467529296875,
-0.349609375,
-0.145751953125,
-1.00390625,
-0.34033203125,
-0.265625,
0.0199127197265625,
-0.203369140625,
-0.6630859375,
0.84912109375,
0.467529296875,
-0.73193359375,
0.57763671875,
0.97412109375,
-0.73046875,
0.324462890625,
0.73291015625,
0.1676025390625,
-0.75,
1.5048828125,
0.6328125,
0.289306640625,
-0.7685546875,
-0.60986328125,
-0.53076171875,
-0.18505859375,
0.1624755859375,
-0.5849609375,
-0.311767578125,
0.5556640625,
0.1295166015625,
-1.044921875,
0.10235595703125,
-0.72607421875,
-1.18359375,
-0.061279296875,
-0.6884765625,
0.9189453125,
0.466064453125,
-0.0748291015625,
-0.00879669189453125,
-0.67333984375,
0.281005859375,
0.62158203125,
0.424072265625,
-0.61181640625,
0.166259765625,
0.61669921875,
-0.0310821533203125,
0.04949951171875,
0.1324462890625,
-0.5810546875,
-0.057830810546875,
-0.224365234375,
0.12158203125,
0.3994140625,
0.08880615234375,
0.39697265625,
0.468994140625,
0.78271484375,
-0.9208984375,
-0.212890625,
-0.10675048828125,
0.5224609375,
0.396484375,
0.50048828125,
0.367431640625,
0.1995849609375,
-0.95263671875,
-1.1806640625,
-0.0307159423828125,
0.53369140625,
0.12481689453125,
-0.91943359375,
1.029296875,
0.3623046875,
-0.32080078125,
0.59423828125,
-0.63720703125,
-0.22265625,
0.6923828125,
-0.0266876220703125,
0.431884765625,
-0.77978515625,
0.34375,
-0.07958984375,
0.29150390625,
0.91064453125,
0.43701171875,
0.6748046875,
-0.165771484375,
-0.54931640625,
-0.2802734375,
-0.1158447265625,
0.0147552490234375,
-0.364013671875,
0.587890625,
-0.487548828125,
-0.50146484375,
-0.77197265625,
0.46875,
0.7451171875,
0.609375,
-0.1776123046875,
0.400634765625,
0.48193359375,
0.7783203125,
0.385498046875,
-0.48095703125,
0.2281494140625,
-0.82080078125,
0.80517578125,
0.445068359375,
-0.107666015625,
-0.5888671875,
-0.55078125,
-0.29541015625,
-0.04986572265625,
0.455810546875,
-0.1866455078125,
-0.826171875,
0.04119873046875,
0.06378173828125,
0.84716796875,
0.0760498046875,
-0.15380859375,
-0.0026397705078125,
0.2149658203125,
0.66943359375,
-0.95703125,
-0.0227813720703125,
-0.611328125,
0.470947265625,
0.44189453125,
-0.421630859375,
-0.66748046875,
-0.64892578125,
-0.732421875,
-0.239990234375,
0.03753662109375,
0.52294921875,
0.07989501953125,
0.16455078125,
-1.2197265625,
0.59912109375,
0.1866455078125,
-0.6767578125,
0.2164306640625,
0.092529296875,
0.51611328125,
-0.277587890625,
0.943359375,
-0.17333984375,
-0.75048828125,
0.34912109375,
-1.044921875,
0.0239715576171875,
-0.2198486328125,
0.21875,
-0.6025390625,
-0.025177001953125,
-0.048309326171875,
0.64453125,
-0.321044921875,
0.373046875,
-0.161865234375,
0.1497802734375,
-0.85400390625,
-0.8955078125,
0.61376953125,
-0.33349609375,
-0.352783203125,
1.2900390625,
-0.01010894775390625,
-0.62548828125,
-0.082763671875,
0.6171875,
-0.46630859375,
0.353271484375,
-0.43701171875,
0.478759765625,
-0.1964111328125,
-0.31689453125,
-0.06842041015625,
-0.81103515625,
0.84375,
0.10321044921875,
-0.66259765625,
-0.446533203125,
-1.1181640625,
-0.458251953125,
-0.1116943359375,
-0.572265625,
0.1378173828125,
0.280517578125,
-0.028533935546875,
-0.350830078125,
-0.330810546875,
-0.9912109375,
-0.2191162109375,
-0.5927734375,
-0.18896484375,
0.486572265625,
0.96728515625,
0.4775390625,
0.085693359375,
-0.51953125,
0.024658203125,
-0.422607421875,
-0.3134765625,
-0.58349609375,
0.261474609375,
-0.09088134765625,
-0.2027587890625,
-0.34130859375,
0.15869140625,
0.361572265625,
0.48974609375,
0.71240234375,
0.290771484375,
0.477294921875,
0.47802734375,
-0.322998046875,
1.150390625,
0.362548828125,
-1.38671875,
-0.650390625,
0.9970703125,
0.125732421875,
0.8095703125,
0.006961822509765625,
-0.73583984375,
-0.66748046875,
-1.0068359375,
0.0594482421875,
-0.55517578125,
-0.07769775390625,
-0.78173828125,
-0.206298828125,
-0.35302734375,
0.71728515625,
-0.6669921875,
-0.79052734375,
0.2373046875,
-0.9716796875,
0.11480712890625,
-0.1253662109375,
-0.5576171875,
-0.84326171875,
0.145263671875,
-0.215087890625,
0.6728515625,
-0.06939697265625,
0.154296875,
-0.15283203125,
-0.20947265625,
0.1533203125,
-0.0273895263671875,
-0.578125,
-0.384521484375,
0.10870361328125,
-0.0748291015625,
-0.5205078125,
0.043792724609375,
-0.359375,
0.324951171875,
-1.009765625,
-0.0992431640625,
-0.148681640625,
-0.458984375,
-0.02105712890625,
-0.4365234375,
0.9833984375,
-0.33447265625,
-0.17236328125,
-0.336181640625,
-0.00933074951171875,
0.93798828125,
-0.0894775390625,
-0.385498046875,
-0.83349609375,
-0.47802734375,
-1.2529296875,
0.260498046875,
-0.466064453125,
-0.326904296875,
-0.72412109375,
-0.494873046875,
0.64306640625,
-0.434814453125,
0.52294921875,
1.119140625,
0.168212890625,
0.11700439453125,
-0.7197265625,
0.798828125,
0.393798828125,
-0.9599609375,
0.072998046875,
0.054718017578125,
-0.9599609375,
0.64111328125,
-0.388916015625,
-0.93701171875,
-0.430908203125,
0.57373046875,
0.9755859375,
-0.414306640625,
0.56884765625,
0.035491943359375,
-1.0361328125,
-0.57861328125,
0.448486328125,
0.293212890625,
0.11944580078125,
0.78125,
-0.17431640625,
-0.1861572265625,
0.378662109375,
0.26318359375,
-0.2459716796875,
-0.67626953125,
1.400390625,
0.021881103515625,
-0.346435546875,
0.8203125,
0.3896484375,
-1.0498046875,
-0.556640625,
-0.08013916015625,
0.1817626953125,
-0.1646728515625,
-0.8173828125,
0.215087890625,
0.626953125,
-0.6015625,
0.16064453125,
0.421630859375,
0.09490966796875,
0.55810546875,
0.24072265625,
0.51025390625,
-0.5244140625,
0.57861328125,
0.78173828125,
-0.5625,
-0.2568359375,
-0.91552734375,
-0.31201171875,
0.00804901123046875,
-0.068603515625,
0.62548828125,
-0.6396484375,
-0.239501953125,
0.170654296875,
-0.0277557373046875,
0.8828125,
0.041748046875,
-0.409423828125,
0.609375,
-0.642578125,
-0.446533203125,
0.046905517578125,
0.1884765625,
-0.0205230712890625,
0.46435546875,
-0.5234375,
0.5693359375,
0.303466796875,
0.375732421875,
-0.2744140625,
-0.90966796875,
-0.4609375,
-0.876953125,
-0.07318115234375,
-0.55859375,
-0.92919921875,
0.0279541015625,
0.423583984375,
-0.09539794921875,
-0.93310546875,
0.280029296875,
0.30615234375,
-0.52490234375,
1.0341796875,
-1.1611328125,
0.372802734375,
-0.66064453125,
-0.249755859375,
-0.53076171875,
-0.35693359375,
-0.11865234375,
-0.014862060546875,
-0.6572265625,
0.078857421875,
-0.27001953125,
0.7060546875,
-0.356689453125,
0.54296875,
0.038360595703125,
-0.86181640625,
-0.07281494140625,
0.1497802734375,
-0.1629638671875,
0.53076171875,
0.9326171875,
0.01020050048828125,
0.2489013671875,
-0.16552734375,
-0.32080078125,
-0.1895751953125,
0.303955078125,
0.4560546875,
-0.1141357421875,
-0.298828125,
-0.4404296875,
-0.31396484375,
-1.134765625,
0.374267578125,
-0.55126953125,
-0.07440185546875,
-0.088623046875,
0.0108642578125,
0.2034912109375,
1.0380859375,
-0.60107421875,
0.56201171875,
-0.10015869140625,
0.2137451171875,
0.43994140625,
-0.004444122314453125,
-0.048248291015625,
0.324462890625,
0.323486328125,
-0.64794921875,
0.07550048828125,
0.290283203125,
0.08087158203125,
0.2181396484375,
-0.1710205078125,
-0.8779296875,
-1.0361328125,
-0.380615234375,
-0.111572265625,
0.5546875,
0.46875,
-0.31982421875,
-0.2978515625,
-0.1285400390625,
-0.791015625,
-0.024383544921875,
-1.263671875,
-0.77880859375,
0.55126953125,
0.0006604194641113281,
-0.0007390975952148438,
0.1087646484375,
-0.4755859375,
-0.556640625,
-0.26708984375,
0.1793212890625,
-0.359375,
0.5009765625,
-0.1192626953125,
0.456787109375,
-0.03607177734375,
-0.1556396484375,
0.074951171875,
0.70458984375,
-0.87890625,
-0.57470703125,
-0.2197265625,
1.2021484375,
0.1715087890625,
0.0119781494140625,
-0.54052734375,
0.4375,
0.349365234375,
0.424560546875,
-0.1981201171875,
0.4853515625,
-0.08209228515625,
0.60498046875,
-0.7109375,
-0.011444091796875,
-0.2294921875,
0.410400390625,
0.08404541015625,
-0.4482421875,
-0.74609375,
0.8642578125,
0.3671875,
-0.08013916015625,
1.0029296875,
0.224609375,
0.060699462890625,
-0.031585693359375,
-0.031494140625,
-0.287353515625,
0.302001953125,
0.255859375,
0.4833984375,
-0.395751953125,
0.1297607421875,
0.9384765625,
0.184814453125,
0.0821533203125,
0.65771484375,
0.1387939453125,
0.022552490234375,
0.42041015625,
-0.051605224609375,
0.02972412109375,
0.36865234375,
-0.427734375,
0.3056640625,
-0.5087890625,
0.036712646484375,
-0.380126953125,
-0.67626953125,
0.74365234375,
-0.267333984375,
-0.38330078125,
0.0765380859375,
-0.45751953125,
0.2349853515625,
0.460205078125,
-0.30517578125,
-0.1190185546875,
0.93359375,
0.767578125,
0.572265625,
0.7802734375,
0.373291015625,
0.3642578125,
-1.23828125,
0.4365234375,
0.2186279296875,
0.291748046875,
-0.187255859375,
-0.61865234375,
-0.953125,
0.1761474609375,
-0.212158203125,
-0.285400390625,
0.65966796875,
-0.673828125,
0.1510009765625,
-0.350830078125,
0.78369140625,
-0.71630859375,
0.260009765625,
-0.0518798828125,
-0.12152099609375,
-0.5966796875,
0.81494140625,
-0.31201171875,
0.54296875,
0.432861328125,
0.9013671875,
0.4130859375,
1.46484375,
0.62158203125,
0.09002685546875,
0.1385498046875,
0.35546875,
-0.52587890625,
-0.39453125,
-0.69091796875,
-0.4375,
-0.126953125,
-0.72900390625,
-0.55078125,
-0.1724853515625,
0.72314453125,
0.235595703125,
-1.0341796875,
-0.4423828125,
0.1912841796875,
-0.98681640625,
0.1417236328125,
0.198974609375,
0.66845703125,
0.2054443359375,
-0.282470703125,
0.097412109375,
-0.54345703125,
0.1484375,
-0.50732421875,
0.68505859375,
-0.68310546875,
-0.58447265625,
-0.4619140625,
-0.59765625,
-0.2357177734375,
-0.556640625,
-0.38330078125,
-0.70361328125,
0.64111328125,
0.170654296875,
0.0205535888671875,
0.53662109375,
-0.319580078125,
-0.0347900390625,
0.78369140625,
1.16796875,
-0.1275634765625,
0.98388671875,
0.39306640625,
-0.115478515625,
0.1324462890625,
-0.435791015625,
0.01422882080078125,
-0.173828125,
0.1529541015625,
-0.5341796875,
0.10833740234375,
-0.439453125,
-1.212890625,
0.281005859375,
0.2333984375,
0.04595947265625,
-0.92578125,
-1.1337890625,
-0.1302490234375,
-1.1650390625,
-0.474365234375,
-0.7802734375,
0.48486328125,
-0.49072265625,
0.2236328125,
0.14990234375,
-1.0341796875,
4.3671875,
0.68359375,
0.49560546875,
0.095458984375,
0.21240234375,
1.1572265625,
0.487060546875,
-0.83056640625,
-0.401123046875,
-0.459228515625,
0.75146484375,
-0.1556396484375,
-0.00858306884765625,
0.7001953125,
0.300048828125,
0.50927734375,
-0.5615234375,
-0.0214691162109375,
0.004207611083984375,
-1.029296875,
-0.80859375,
0.48095703125,
0.460693359375,
0.310546875,
0.283935546875,
0.2061767578125,
0.61572265625,
-0.55419921875,
-0.088623046875,
-0.79052734375,
0.268310546875,
-0.68505859375,
0.8203125,
0.01898193359375,
0.1461181640625,
0.363037109375,
0.077880859375,
-0.476318359375,
-0.1834716796875,
0.63330078125,
-0.180419921875,
0.06072998046875,
0.62646484375,
-0.57763671875,
-0.258544921875,
0.53369140625,
-0.0947265625,
0.2666015625,
0.09521484375,
-1.013671875,
1.177734375,
-0.2247314453125,
0.8583984375,
-0.91162109375,
-1.0078125,
0.26171875,
0.09857177734375,
0.07464599609375,
-0.330322265625,
0.201904296875,
0.475830078125,
0.67724609375,
0.1922607421875,
0.284423828125,
-0.77783203125,
0.6650390625,
0.451416015625,
0.197265625,
-0.417724609375,
-0.1748046875,
-0.5537109375,
-0.1976318359375,
-0.25,
-0.52587890625,
0.9716796875,
0.5146484375,
-0.34521484375,
0.814453125,
0.78857421875,
-0.69921875,
0.0850830078125,
-0.95556640625,
-0.08551025390625,
-0.4033203125,
0.339111328125,
1.4375,
-0.5908203125,
0.046630859375,
-0.132080078125,
0.68212890625,
0.6103515625,
0.68115234375,
0.16943359375,
-0.705078125,
-0.27978515625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
The tycoon of a winery empire in Mondstadt, unmatched in every possible way. A thinker in the Knights of Favonius with an exotic appearance.
This time, the brothers are dealing with a strange piece of wood marked with their names. This plank of wood can be represented as a string of n characters. Each character is either a 'D' or a 'K'. You want to make some number of cuts (possibly 0) on this string, partitioning it into several contiguous pieces, each with length at least 1. Both brothers act with dignity, so they want to split the wood as evenly as possible. They want to know the maximum number of pieces you can split the wood into such that the ratios of the number of occurrences of 'D' to the number of occurrences of 'K' in each chunk are the same.
Kaeya, the curious thinker, is interested in the solution for multiple scenarios. He wants to know the answer for every prefix of the given string. Help him to solve this problem!
For a string we define a ratio as a:b where 'D' appears in it a times, and 'K' appears b times. Note that a or b can equal 0, but not both. Ratios a:b and c:d are considered equal if and only if aâ‹… d = bâ‹… c.
For example, for the string 'DDD' the ratio will be 3:0, for 'DKD' — 2:1, for 'DKK' — 1:2, and for 'KKKKDD' — 2:4. Note that the ratios of the latter two strings are equal to each other, but they are not equal to the ratios of the first two strings.
Input
Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 1000). Description of the test cases follows.
The first line of each test case contains an integer n (1 ≤ n ≤ 5 ⋅ 10^5) — the length of the wood.
The second line of each test case contains a string s of length n. Every character of s will be either 'D' or 'K'.
It is guaranteed that the sum of n over all test cases does not exceed 5 â‹… 10^5.
Output
For each test case, output n space separated integers. The i-th of these numbers should equal the answer for the prefix s_{1},s_{2},...,s_{i}.
Example
Input
5
3
DDK
6
DDDDDD
4
DKDK
1
D
9
DKDKDDDDK
Output
1 2 1
1 2 3 4 5 6
1 1 1 2
1
1 1 1 2 1 2 1 1 3
Note
For the first test case, there is no way to partition 'D' or 'DDK' into more than one block with equal ratios of numbers of 'D' and 'K', while you can split 'DD' into 'D' and 'D'.
For the second test case, you can split each prefix of length i into i blocks 'D'.
Tags: data structures, dp, hashing, number theory
Correct Solution:
```
from collections import defaultdict
from math import gcd
for _ in range(int(input())):
n = int(input())
s = input()
D = [0] * n
K = [0] * n
if(s[0] == "D"):
D[0] = 1
else:
K[0] = 1
for i in range(1, n):
if(s[i] == "D"):
D[i] = D[i-1] + 1
K[i] = K[i-1]
else:
K[i] = K[i-1] + 1
D[i] = D[i-1]
ans = [1] * n
rat = defaultdict(int)
for i in range(n):
if(K[i] == 0):
rat[0] += 1
ans[i] = rat[0]
elif(D[i] == 0):
rat[0] += 1
ans[i] = rat[0]
else:
if(K[i] > D[i]):
x = gcd(K[i], D[i])
up = K[i]/x
down = D[i]/x
ans[i] += rat[(up,down,0)]
rat[(up, down, 0)]+=1
elif(K[i] == D[i]):
ans[i] += rat[1]
rat[1]+=1
else:
x = gcd(D[i], K[i])
up = D[i]/x
down = K[i]/x
ans[i] += rat[(up, down)]
rat[(up, down)] += 1
print(*ans)
```
| 44,844
|
[
0.16162109375,
0.2286376953125,
0.38818359375,
0.376953125,
-0.69921875,
-0.525390625,
-0.042694091796875,
0.19482421875,
-0.1031494140625,
0.83544921875,
0.7373046875,
-0.29345703125,
0.002216339111328125,
-0.489501953125,
-0.37353515625,
0.461669921875,
-0.73291015625,
-0.61279296875,
-0.297119140625,
0.07720947265625,
0.66748046875,
0.12005615234375,
-1.3876953125,
-0.294189453125,
-0.45654296875,
1.205078125,
0.66357421875,
0.224365234375,
1.1904296875,
1.068359375,
0.11749267578125,
-0.2049560546875,
0.439208984375,
-0.94873046875,
-0.3623046875,
-0.26220703125,
0.54150390625,
-0.60791015625,
-0.387939453125,
-0.50732421875,
0.1795654296875,
-0.261474609375,
0.3916015625,
-0.4248046875,
-0.5341796875,
0.344482421875,
-0.454833984375,
-0.69921875,
-0.255126953125,
-0.4609375,
0.2291259765625,
-0.401123046875,
0.64697265625,
-0.256591796875,
0.2366943359375,
-0.07391357421875,
-0.1951904296875,
0.437255859375,
-0.51220703125,
0.47412109375,
0.461181640625,
-0.189453125,
-0.36865234375,
-0.69287109375,
0.1719970703125,
0.2430419921875,
-0.21240234375,
-0.283203125,
-0.130615234375,
-1.0068359375,
-0.298828125,
0.261474609375,
-0.2188720703125,
-0.1104736328125,
-0.381103515625,
-0.059326171875,
0.0865478515625,
0.079345703125,
-0.2578125,
0.84033203125,
0.28271484375,
0.77099609375,
0.1981201171875,
0.2939453125,
-0.6689453125,
-0.60546875,
0.2347412109375,
0.38818359375,
-0.11383056640625,
-0.272705078125,
-0.214599609375,
0.484619140625,
-0.136474609375,
-0.092041015625,
0.41796875,
0.70458984375,
-0.06634521484375,
0.9755859375,
0.1993408203125,
0.1304931640625,
1.2392578125,
1.0791015625,
-0.7314453125,
0.67822265625,
-0.479736328125,
0.1688232421875,
0.4375,
0.2445068359375,
-0.08319091796875,
-0.271728515625,
0.07891845703125,
-0.342041015625,
0.52685546875,
0.62060546875,
-0.245849609375,
0.5888671875,
-0.31787109375,
0.404052734375,
-0.73193359375,
-0.0770263671875,
0.7099609375,
0.1990966796875,
0.640625,
-0.11529541015625,
0.01983642578125,
-0.10284423828125,
-0.30615234375,
0.86083984375,
-0.6162109375,
-0.388916015625,
0.76806640625,
-0.02410888671875,
-0.1031494140625,
0.206787109375,
0.27587890625,
0.3701171875,
-0.097412109375,
0.61767578125,
0.5634765625,
-0.26416015625,
0.84423828125,
0.451171875,
-0.61962890625,
1.3349609375,
0.494384765625,
0.1474609375,
0.3974609375,
0.3916015625,
-0.63720703125,
0.301025390625,
-1.005859375,
0.6953125,
-0.2022705078125,
0.07177734375,
-0.55224609375,
0.16064453125,
-0.1195068359375,
0.62109375,
0.1458740234375,
-0.125,
-0.1163330078125,
0.03143310546875,
-0.064453125,
0.70654296875,
-0.5185546875,
0.7568359375,
-0.681640625,
-0.29052734375,
-0.257568359375,
-0.3544921875,
0.27392578125,
-0.11517333984375,
-0.449951171875,
0.81298828125,
0.5654296875,
0.9365234375,
0.86474609375,
-0.5546875,
0.1016845703125,
0.4775390625,
-0.100341796875,
0.1385498046875,
0.66748046875,
0.5419921875,
-0.10101318359375,
0.37939453125,
-0.285400390625,
-0.478271484375,
-0.98388671875,
-0.352294921875,
0.1611328125,
0.5966796875,
-1.013671875,
0.150634765625,
0.309814453125,
-0.06390380859375,
-0.568359375,
0.078857421875,
-0.02764892578125,
-0.99951171875,
-0.462646484375,
0.5869140625,
-0.363037109375,
0.497314453125,
-0.158935546875,
-0.84130859375,
0.4580078125,
0.9921875,
-0.697265625,
0.28857421875,
0.37255859375,
0.10687255859375,
-0.019195556640625,
0.113037109375,
0.1551513671875,
-0.066650390625,
-0.5595703125,
0.81884765625,
-0.407958984375,
0.17041015625,
-0.0787353515625,
0.8232421875,
0.25634765625,
0.171142578125,
-0.290771484375,
-0.5126953125,
0.32470703125,
1.5068359375,
0.329345703125,
0.284423828125,
0.050201416015625,
1.0791015625,
0.51708984375,
1.0546875,
0.1572265625,
0.150390625,
0.60302734375,
0.77099609375,
0.07611083984375,
0.136474609375,
-0.09613037109375,
0.460205078125,
0.43701171875,
0.2890625,
0.287109375,
0.5703125,
-0.164794921875,
0.1224365234375,
-0.59375,
0.46533203125,
-0.044586181640625,
0.62353515625,
0.392578125,
0.03662109375,
-0.8916015625,
-0.12890625,
0.1524658203125,
1.0908203125,
-0.276611328125,
-0.59716796875,
-0.36328125,
0.04168701171875,
0.291259765625,
-0.027130126953125,
0.03521728515625,
0.401123046875,
0.5283203125,
0.62646484375,
-0.2607421875,
-0.21044921875,
-1.05078125,
-1.125,
-0.80419921875,
-0.65478515625,
-0.485107421875,
0.0244140625,
0.227783203125,
-0.68701171875,
-0.049957275390625,
0.00785064697265625,
-0.50390625,
0.06805419921875,
-0.775390625,
0.76611328125,
-0.3056640625,
0.59619140625,
-0.75927734375,
0.450439453125,
-0.353271484375,
1.166015625,
-0.80859375,
-0.330810546875,
-0.09173583984375,
-0.6591796875,
0.305419921875,
0.10162353515625,
-0.10467529296875,
-0.349609375,
-0.145751953125,
-1.00390625,
-0.34033203125,
-0.265625,
0.0199127197265625,
-0.203369140625,
-0.6630859375,
0.84912109375,
0.467529296875,
-0.73193359375,
0.57763671875,
0.97412109375,
-0.73046875,
0.324462890625,
0.73291015625,
0.1676025390625,
-0.75,
1.5048828125,
0.6328125,
0.289306640625,
-0.7685546875,
-0.60986328125,
-0.53076171875,
-0.18505859375,
0.1624755859375,
-0.5849609375,
-0.311767578125,
0.5556640625,
0.1295166015625,
-1.044921875,
0.10235595703125,
-0.72607421875,
-1.18359375,
-0.061279296875,
-0.6884765625,
0.9189453125,
0.466064453125,
-0.0748291015625,
-0.00879669189453125,
-0.67333984375,
0.281005859375,
0.62158203125,
0.424072265625,
-0.61181640625,
0.166259765625,
0.61669921875,
-0.0310821533203125,
0.04949951171875,
0.1324462890625,
-0.5810546875,
-0.057830810546875,
-0.224365234375,
0.12158203125,
0.3994140625,
0.08880615234375,
0.39697265625,
0.468994140625,
0.78271484375,
-0.9208984375,
-0.212890625,
-0.10675048828125,
0.5224609375,
0.396484375,
0.50048828125,
0.367431640625,
0.1995849609375,
-0.95263671875,
-1.1806640625,
-0.0307159423828125,
0.53369140625,
0.12481689453125,
-0.91943359375,
1.029296875,
0.3623046875,
-0.32080078125,
0.59423828125,
-0.63720703125,
-0.22265625,
0.6923828125,
-0.0266876220703125,
0.431884765625,
-0.77978515625,
0.34375,
-0.07958984375,
0.29150390625,
0.91064453125,
0.43701171875,
0.6748046875,
-0.165771484375,
-0.54931640625,
-0.2802734375,
-0.1158447265625,
0.0147552490234375,
-0.364013671875,
0.587890625,
-0.487548828125,
-0.50146484375,
-0.77197265625,
0.46875,
0.7451171875,
0.609375,
-0.1776123046875,
0.400634765625,
0.48193359375,
0.7783203125,
0.385498046875,
-0.48095703125,
0.2281494140625,
-0.82080078125,
0.80517578125,
0.445068359375,
-0.107666015625,
-0.5888671875,
-0.55078125,
-0.29541015625,
-0.04986572265625,
0.455810546875,
-0.1866455078125,
-0.826171875,
0.04119873046875,
0.06378173828125,
0.84716796875,
0.0760498046875,
-0.15380859375,
-0.0026397705078125,
0.2149658203125,
0.66943359375,
-0.95703125,
-0.0227813720703125,
-0.611328125,
0.470947265625,
0.44189453125,
-0.421630859375,
-0.66748046875,
-0.64892578125,
-0.732421875,
-0.239990234375,
0.03753662109375,
0.52294921875,
0.07989501953125,
0.16455078125,
-1.2197265625,
0.59912109375,
0.1866455078125,
-0.6767578125,
0.2164306640625,
0.092529296875,
0.51611328125,
-0.277587890625,
0.943359375,
-0.17333984375,
-0.75048828125,
0.34912109375,
-1.044921875,
0.0239715576171875,
-0.2198486328125,
0.21875,
-0.6025390625,
-0.025177001953125,
-0.048309326171875,
0.64453125,
-0.321044921875,
0.373046875,
-0.161865234375,
0.1497802734375,
-0.85400390625,
-0.8955078125,
0.61376953125,
-0.33349609375,
-0.352783203125,
1.2900390625,
-0.01010894775390625,
-0.62548828125,
-0.082763671875,
0.6171875,
-0.46630859375,
0.353271484375,
-0.43701171875,
0.478759765625,
-0.1964111328125,
-0.31689453125,
-0.06842041015625,
-0.81103515625,
0.84375,
0.10321044921875,
-0.66259765625,
-0.446533203125,
-1.1181640625,
-0.458251953125,
-0.1116943359375,
-0.572265625,
0.1378173828125,
0.280517578125,
-0.028533935546875,
-0.350830078125,
-0.330810546875,
-0.9912109375,
-0.2191162109375,
-0.5927734375,
-0.18896484375,
0.486572265625,
0.96728515625,
0.4775390625,
0.085693359375,
-0.51953125,
0.024658203125,
-0.422607421875,
-0.3134765625,
-0.58349609375,
0.261474609375,
-0.09088134765625,
-0.2027587890625,
-0.34130859375,
0.15869140625,
0.361572265625,
0.48974609375,
0.71240234375,
0.290771484375,
0.477294921875,
0.47802734375,
-0.322998046875,
1.150390625,
0.362548828125,
-1.38671875,
-0.650390625,
0.9970703125,
0.125732421875,
0.8095703125,
0.006961822509765625,
-0.73583984375,
-0.66748046875,
-1.0068359375,
0.0594482421875,
-0.55517578125,
-0.07769775390625,
-0.78173828125,
-0.206298828125,
-0.35302734375,
0.71728515625,
-0.6669921875,
-0.79052734375,
0.2373046875,
-0.9716796875,
0.11480712890625,
-0.1253662109375,
-0.5576171875,
-0.84326171875,
0.145263671875,
-0.215087890625,
0.6728515625,
-0.06939697265625,
0.154296875,
-0.15283203125,
-0.20947265625,
0.1533203125,
-0.0273895263671875,
-0.578125,
-0.384521484375,
0.10870361328125,
-0.0748291015625,
-0.5205078125,
0.043792724609375,
-0.359375,
0.324951171875,
-1.009765625,
-0.0992431640625,
-0.148681640625,
-0.458984375,
-0.02105712890625,
-0.4365234375,
0.9833984375,
-0.33447265625,
-0.17236328125,
-0.336181640625,
-0.00933074951171875,
0.93798828125,
-0.0894775390625,
-0.385498046875,
-0.83349609375,
-0.47802734375,
-1.2529296875,
0.260498046875,
-0.466064453125,
-0.326904296875,
-0.72412109375,
-0.494873046875,
0.64306640625,
-0.434814453125,
0.52294921875,
1.119140625,
0.168212890625,
0.11700439453125,
-0.7197265625,
0.798828125,
0.393798828125,
-0.9599609375,
0.072998046875,
0.054718017578125,
-0.9599609375,
0.64111328125,
-0.388916015625,
-0.93701171875,
-0.430908203125,
0.57373046875,
0.9755859375,
-0.414306640625,
0.56884765625,
0.035491943359375,
-1.0361328125,
-0.57861328125,
0.448486328125,
0.293212890625,
0.11944580078125,
0.78125,
-0.17431640625,
-0.1861572265625,
0.378662109375,
0.26318359375,
-0.2459716796875,
-0.67626953125,
1.400390625,
0.021881103515625,
-0.346435546875,
0.8203125,
0.3896484375,
-1.0498046875,
-0.556640625,
-0.08013916015625,
0.1817626953125,
-0.1646728515625,
-0.8173828125,
0.215087890625,
0.626953125,
-0.6015625,
0.16064453125,
0.421630859375,
0.09490966796875,
0.55810546875,
0.24072265625,
0.51025390625,
-0.5244140625,
0.57861328125,
0.78173828125,
-0.5625,
-0.2568359375,
-0.91552734375,
-0.31201171875,
0.00804901123046875,
-0.068603515625,
0.62548828125,
-0.6396484375,
-0.239501953125,
0.170654296875,
-0.0277557373046875,
0.8828125,
0.041748046875,
-0.409423828125,
0.609375,
-0.642578125,
-0.446533203125,
0.046905517578125,
0.1884765625,
-0.0205230712890625,
0.46435546875,
-0.5234375,
0.5693359375,
0.303466796875,
0.375732421875,
-0.2744140625,
-0.90966796875,
-0.4609375,
-0.876953125,
-0.07318115234375,
-0.55859375,
-0.92919921875,
0.0279541015625,
0.423583984375,
-0.09539794921875,
-0.93310546875,
0.280029296875,
0.30615234375,
-0.52490234375,
1.0341796875,
-1.1611328125,
0.372802734375,
-0.66064453125,
-0.249755859375,
-0.53076171875,
-0.35693359375,
-0.11865234375,
-0.014862060546875,
-0.6572265625,
0.078857421875,
-0.27001953125,
0.7060546875,
-0.356689453125,
0.54296875,
0.038360595703125,
-0.86181640625,
-0.07281494140625,
0.1497802734375,
-0.1629638671875,
0.53076171875,
0.9326171875,
0.01020050048828125,
0.2489013671875,
-0.16552734375,
-0.32080078125,
-0.1895751953125,
0.303955078125,
0.4560546875,
-0.1141357421875,
-0.298828125,
-0.4404296875,
-0.31396484375,
-1.134765625,
0.374267578125,
-0.55126953125,
-0.07440185546875,
-0.088623046875,
0.0108642578125,
0.2034912109375,
1.0380859375,
-0.60107421875,
0.56201171875,
-0.10015869140625,
0.2137451171875,
0.43994140625,
-0.004444122314453125,
-0.048248291015625,
0.324462890625,
0.323486328125,
-0.64794921875,
0.07550048828125,
0.290283203125,
0.08087158203125,
0.2181396484375,
-0.1710205078125,
-0.8779296875,
-1.0361328125,
-0.380615234375,
-0.111572265625,
0.5546875,
0.46875,
-0.31982421875,
-0.2978515625,
-0.1285400390625,
-0.791015625,
-0.024383544921875,
-1.263671875,
-0.77880859375,
0.55126953125,
0.0006604194641113281,
-0.0007390975952148438,
0.1087646484375,
-0.4755859375,
-0.556640625,
-0.26708984375,
0.1793212890625,
-0.359375,
0.5009765625,
-0.1192626953125,
0.456787109375,
-0.03607177734375,
-0.1556396484375,
0.074951171875,
0.70458984375,
-0.87890625,
-0.57470703125,
-0.2197265625,
1.2021484375,
0.1715087890625,
0.0119781494140625,
-0.54052734375,
0.4375,
0.349365234375,
0.424560546875,
-0.1981201171875,
0.4853515625,
-0.08209228515625,
0.60498046875,
-0.7109375,
-0.011444091796875,
-0.2294921875,
0.410400390625,
0.08404541015625,
-0.4482421875,
-0.74609375,
0.8642578125,
0.3671875,
-0.08013916015625,
1.0029296875,
0.224609375,
0.060699462890625,
-0.031585693359375,
-0.031494140625,
-0.287353515625,
0.302001953125,
0.255859375,
0.4833984375,
-0.395751953125,
0.1297607421875,
0.9384765625,
0.184814453125,
0.0821533203125,
0.65771484375,
0.1387939453125,
0.022552490234375,
0.42041015625,
-0.051605224609375,
0.02972412109375,
0.36865234375,
-0.427734375,
0.3056640625,
-0.5087890625,
0.036712646484375,
-0.380126953125,
-0.67626953125,
0.74365234375,
-0.267333984375,
-0.38330078125,
0.0765380859375,
-0.45751953125,
0.2349853515625,
0.460205078125,
-0.30517578125,
-0.1190185546875,
0.93359375,
0.767578125,
0.572265625,
0.7802734375,
0.373291015625,
0.3642578125,
-1.23828125,
0.4365234375,
0.2186279296875,
0.291748046875,
-0.187255859375,
-0.61865234375,
-0.953125,
0.1761474609375,
-0.212158203125,
-0.285400390625,
0.65966796875,
-0.673828125,
0.1510009765625,
-0.350830078125,
0.78369140625,
-0.71630859375,
0.260009765625,
-0.0518798828125,
-0.12152099609375,
-0.5966796875,
0.81494140625,
-0.31201171875,
0.54296875,
0.432861328125,
0.9013671875,
0.4130859375,
1.46484375,
0.62158203125,
0.09002685546875,
0.1385498046875,
0.35546875,
-0.52587890625,
-0.39453125,
-0.69091796875,
-0.4375,
-0.126953125,
-0.72900390625,
-0.55078125,
-0.1724853515625,
0.72314453125,
0.235595703125,
-1.0341796875,
-0.4423828125,
0.1912841796875,
-0.98681640625,
0.1417236328125,
0.198974609375,
0.66845703125,
0.2054443359375,
-0.282470703125,
0.097412109375,
-0.54345703125,
0.1484375,
-0.50732421875,
0.68505859375,
-0.68310546875,
-0.58447265625,
-0.4619140625,
-0.59765625,
-0.2357177734375,
-0.556640625,
-0.38330078125,
-0.70361328125,
0.64111328125,
0.170654296875,
0.0205535888671875,
0.53662109375,
-0.319580078125,
-0.0347900390625,
0.78369140625,
1.16796875,
-0.1275634765625,
0.98388671875,
0.39306640625,
-0.115478515625,
0.1324462890625,
-0.435791015625,
0.01422882080078125,
-0.173828125,
0.1529541015625,
-0.5341796875,
0.10833740234375,
-0.439453125,
-1.212890625,
0.281005859375,
0.2333984375,
0.04595947265625,
-0.92578125,
-1.1337890625,
-0.1302490234375,
-1.1650390625,
-0.474365234375,
-0.7802734375,
0.48486328125,
-0.49072265625,
0.2236328125,
0.14990234375,
-1.0341796875,
4.3671875,
0.68359375,
0.49560546875,
0.095458984375,
0.21240234375,
1.1572265625,
0.487060546875,
-0.83056640625,
-0.401123046875,
-0.459228515625,
0.75146484375,
-0.1556396484375,
-0.00858306884765625,
0.7001953125,
0.300048828125,
0.50927734375,
-0.5615234375,
-0.0214691162109375,
0.004207611083984375,
-1.029296875,
-0.80859375,
0.48095703125,
0.460693359375,
0.310546875,
0.283935546875,
0.2061767578125,
0.61572265625,
-0.55419921875,
-0.088623046875,
-0.79052734375,
0.268310546875,
-0.68505859375,
0.8203125,
0.01898193359375,
0.1461181640625,
0.363037109375,
0.077880859375,
-0.476318359375,
-0.1834716796875,
0.63330078125,
-0.180419921875,
0.06072998046875,
0.62646484375,
-0.57763671875,
-0.258544921875,
0.53369140625,
-0.0947265625,
0.2666015625,
0.09521484375,
-1.013671875,
1.177734375,
-0.2247314453125,
0.8583984375,
-0.91162109375,
-1.0078125,
0.26171875,
0.09857177734375,
0.07464599609375,
-0.330322265625,
0.201904296875,
0.475830078125,
0.67724609375,
0.1922607421875,
0.284423828125,
-0.77783203125,
0.6650390625,
0.451416015625,
0.197265625,
-0.417724609375,
-0.1748046875,
-0.5537109375,
-0.1976318359375,
-0.25,
-0.52587890625,
0.9716796875,
0.5146484375,
-0.34521484375,
0.814453125,
0.78857421875,
-0.69921875,
0.0850830078125,
-0.95556640625,
-0.08551025390625,
-0.4033203125,
0.339111328125,
1.4375,
-0.5908203125,
0.046630859375,
-0.132080078125,
0.68212890625,
0.6103515625,
0.68115234375,
0.16943359375,
-0.705078125,
-0.27978515625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
After you had helped Fedor to find friends in the «Call of Soldiers 3» game, he stopped studying completely. Today, the English teacher told him to prepare an essay. Fedor didn't want to prepare the essay, so he asked Alex for help. Alex came to help and wrote the essay for Fedor. But Fedor didn't like the essay at all. Now Fedor is going to change the essay using the synonym dictionary of the English language.
Fedor does not want to change the meaning of the essay. So the only change he would do: change a word from essay to one of its synonyms, basing on a replacement rule from the dictionary. Fedor may perform this operation any number of times.
As a result, Fedor wants to get an essay which contains as little letters «R» (the case doesn't matter) as possible. If there are multiple essays with minimum number of «R»s he wants to get the one with minimum length (length of essay is the sum of the lengths of all the words in it). Help Fedor get the required essay.
Please note that in this problem the case of letters doesn't matter. For example, if the synonym dictionary says that word cat can be replaced with word DOG, then it is allowed to replace the word Cat with the word doG.
Input
The first line contains a single integer m (1 ≤ m ≤ 105) — the number of words in the initial essay. The second line contains words of the essay. The words are separated by a single space. It is guaranteed that the total length of the words won't exceed 105 characters.
The next line contains a single integer n (0 ≤ n ≤ 105) — the number of pairs of words in synonym dictionary. The i-th of the next n lines contains two space-separated non-empty words xi and yi. They mean that word xi can be replaced with word yi (but not vise versa). It is guaranteed that the total length of all pairs of synonyms doesn't exceed 5·105 characters.
All the words at input can only consist of uppercase and lowercase letters of the English alphabet.
Output
Print two integers — the minimum number of letters «R» in an optimal essay and the minimum length of an optimal essay.
Examples
Input
3
AbRb r Zz
4
xR abRb
aA xr
zz Z
xr y
Output
2 6
Input
2
RuruRu fedya
1
ruruRU fedor
Output
1 10
Tags: dfs and similar, dp, graphs, hashing, strings
Correct Solution:
```
from collections import defaultdict
m = int(input())
num = dict()
inp = lambda word: (word.count('R'), len(word), num.setdefault(word, len(num)))
text = list(map(inp, input().upper().split()))
q = text.copy()
n = int(input())
syn = defaultdict(list)
for i in range(n):
(word, replace) = map(inp, input().upper().split())
syn[replace[-1]].append(word[-1])
q.append(replace)
q.sort()
q.reverse()
best = dict()
while q:
(cnt_r, len, word) = q.pop()
if word not in best:
best[word] = (cnt_r, len)
for replace in syn[word]:
if replace not in best:
q.append((cnt_r, len, replace))
(rans, lans) = (0, 0)
for (cnt_r, len, word) in text:
(cnt_r, len) = best[word]
rans += cnt_r
lans += len
print(rans, lans)
```
| 44,943
|
[
0.3134765625,
-0.4443359375,
0.380615234375,
0.440673828125,
-0.70263671875,
-0.372314453125,
0.2359619140625,
-0.02496337890625,
-0.41162109375,
0.51513671875,
1.322265625,
0.12548828125,
-0.0836181640625,
-0.73779296875,
-0.431884765625,
0.0242767333984375,
-0.25146484375,
-0.76806640625,
-0.4541015625,
0.11907958984375,
0.069091796875,
0.09527587890625,
-1.25390625,
0.161865234375,
-0.342529296875,
0.8173828125,
0.06085205078125,
0.62451171875,
0.9384765625,
0.463623046875,
-0.14599609375,
-0.03643798828125,
0.11566162109375,
-0.73388671875,
-0.51708984375,
-0.56884765625,
0.3349609375,
-0.56298828125,
-0.310546875,
-0.306884765625,
0.382080078125,
-0.6806640625,
0.57177734375,
-0.51806640625,
-1.0703125,
0.072998046875,
-0.53515625,
-0.472412109375,
-0.184814453125,
-0.6015625,
0.51904296875,
-0.38232421875,
0.313720703125,
-0.299072265625,
0.059112548828125,
-0.67822265625,
-0.3388671875,
0.34326171875,
-0.496826171875,
0.01201629638671875,
0.65625,
0.217529296875,
-0.438720703125,
-0.459716796875,
-0.3515625,
0.2109375,
-0.060211181640625,
-0.1356201171875,
-0.0858154296875,
-0.43505859375,
-0.21630859375,
-0.0303802490234375,
-0.09649658203125,
-0.45263671875,
-0.044342041015625,
0.06256103515625,
1.1884765625,
-0.6171875,
-0.341552734375,
0.67529296875,
0.1478271484375,
1.2451171875,
0.187744140625,
-0.1878662109375,
-0.572265625,
-0.4931640625,
0.162353515625,
0.39794921875,
0.039215087890625,
-0.1339111328125,
-0.2337646484375,
0.65283203125,
-0.48681640625,
-0.158203125,
0.5224609375,
0.415283203125,
-0.2783203125,
0.287109375,
0.02783203125,
-0.20947265625,
0.8564453125,
0.822265625,
-0.0247955322265625,
0.77197265625,
-0.465576171875,
0.058746337890625,
0.07318115234375,
-0.1861572265625,
0.2305908203125,
-0.2315673828125,
-0.269775390625,
0.020782470703125,
0.666015625,
0.52734375,
-0.315673828125,
0.7978515625,
-0.398193359375,
0.8515625,
-0.83544921875,
0.319580078125,
0.395751953125,
0.11480712890625,
0.179931640625,
-0.46044921875,
0.1680908203125,
-0.96923828125,
-0.6455078125,
0.6953125,
-0.48974609375,
-0.116455078125,
0.3974609375,
0.01282501220703125,
0.03131103515625,
0.5625,
-0.0931396484375,
0.380615234375,
0.0875244140625,
0.255126953125,
0.8818359375,
-0.64453125,
0.72412109375,
-0.1826171875,
0.043121337890625,
1.0830078125,
0.6455078125,
0.05706787109375,
0.501953125,
0.0845947265625,
-0.7353515625,
0.65576171875,
-0.85302734375,
0.8056640625,
0.2117919921875,
0.414794921875,
-0.1634521484375,
0.2359619140625,
0.005176544189453125,
0.490966796875,
0.5390625,
0.364013671875,
-0.181884765625,
0.1204833984375,
-0.5166015625,
1.09375,
-0.114013671875,
0.75537109375,
-0.6640625,
-0.11199951171875,
-0.61767578125,
-0.366943359375,
0.5986328125,
-0.1842041015625,
-0.048370361328125,
0.45166015625,
0.0233306884765625,
1.107421875,
0.6748046875,
-0.121826171875,
0.05096435546875,
0.456787109375,
-0.448486328125,
-0.0687255859375,
0.4169921875,
0.4765625,
0.12286376953125,
-0.0269775390625,
-0.28857421875,
-0.483642578125,
-0.58984375,
-1.0556640625,
0.0777587890625,
0.449462890625,
-0.2109375,
-0.12054443359375,
0.2069091796875,
0.2227783203125,
-0.72607421875,
-0.444091796875,
0.35107421875,
-0.60107421875,
-0.5146484375,
0.82861328125,
-0.72314453125,
0.351806640625,
-0.1497802734375,
-0.568359375,
0.1424560546875,
1.0166015625,
-0.1322021484375,
0.2340087890625,
0.65478515625,
0.477294921875,
-0.24365234375,
-0.251220703125,
0.045318603515625,
-0.31298828125,
-0.61328125,
0.78271484375,
-0.60546875,
0.120361328125,
0.298583984375,
0.401611328125,
0.34716796875,
0.255126953125,
0.431640625,
-0.650390625,
0.8134765625,
1.46875,
-0.271728515625,
0.77587890625,
0.370849609375,
0.908203125,
0.2978515625,
0.77001953125,
0.52392578125,
0.093017578125,
0.71923828125,
0.8896484375,
-0.3349609375,
0.1422119140625,
0.15576171875,
0.9873046875,
0.5576171875,
0.6630859375,
-0.0693359375,
0.5498046875,
0.0196990966796875,
0.339599609375,
0.1331787109375,
0.3232421875,
-0.06805419921875,
0.587890625,
0.3623046875,
0.2705078125,
-0.810546875,
-0.07330322265625,
0.41357421875,
0.75244140625,
-0.499755859375,
-0.46923828125,
-0.2078857421875,
0.089111328125,
0.25927734375,
0.303955078125,
0.4638671875,
0.3623046875,
0.1011962890625,
0.7353515625,
-0.279296875,
-0.03326416015625,
-0.414794921875,
-0.978515625,
-0.6689453125,
-0.3623046875,
-0.365478515625,
0.07989501953125,
0.2435302734375,
-0.869140625,
0.403564453125,
-0.177490234375,
-0.004192352294921875,
-0.437255859375,
-0.75244140625,
0.3515625,
-0.6787109375,
0.962890625,
-0.314697265625,
0.4072265625,
-0.2113037109375,
0.6669921875,
-0.2802734375,
-0.56982421875,
-0.198486328125,
-0.6435546875,
0.35546875,
0.0291748046875,
0.273681640625,
-0.178466796875,
-0.880859375,
-0.810546875,
-0.2174072265625,
-0.0283966064453125,
-0.299072265625,
0.4541015625,
-0.53466796875,
0.85693359375,
0.036865234375,
-0.6533203125,
0.52734375,
0.599609375,
-1.1875,
0.99072265625,
0.3466796875,
0.47705078125,
-0.82177734375,
0.9072265625,
0.375732421875,
0.37841796875,
-0.5244140625,
-0.6279296875,
-0.51513671875,
-0.0865478515625,
0.390625,
-0.5703125,
-0.12420654296875,
-0.023651123046875,
0.378173828125,
-1.220703125,
0.60107421875,
-0.83544921875,
-0.5546875,
-0.78173828125,
-0.578125,
0.6923828125,
0.5185546875,
0.253173828125,
0.08905029296875,
-0.377685546875,
-0.027252197265625,
0.54541015625,
0.70166015625,
-0.489990234375,
0.041595458984375,
0.55712890625,
-0.06695556640625,
0.287841796875,
0.487060546875,
-0.5986328125,
-0.1634521484375,
-0.019927978515625,
0.619140625,
0.484375,
0.0799560546875,
0.311279296875,
0.121337890625,
-0.057037353515625,
-0.3935546875,
-0.1070556640625,
-0.1427001953125,
0.45703125,
0.408935546875,
0.419677734375,
0.1817626953125,
-0.47021484375,
-0.406494140625,
-1.0771484375,
0.388427734375,
0.0343017578125,
0.5390625,
-0.876953125,
1.072265625,
0.035797119140625,
-0.42333984375,
0.44189453125,
-0.37744140625,
0.179931640625,
1.0576171875,
0.1739501953125,
0.49365234375,
-0.90673828125,
0.1385498046875,
-0.35009765625,
0.294189453125,
0.3955078125,
0.64404296875,
0.4560546875,
-0.52490234375,
-0.42822265625,
-0.52197265625,
-0.166015625,
-0.2093505859375,
-0.57763671875,
0.07745361328125,
-0.8876953125,
-0.1292724609375,
-0.82177734375,
0.64404296875,
0.76611328125,
0.52978515625,
0.07342529296875,
1.0966796875,
0.08551025390625,
0.37841796875,
0.463134765625,
-0.220947265625,
0.11541748046875,
-0.71337890625,
1.0234375,
-0.29248046875,
-0.2587890625,
-0.435302734375,
-0.2293701171875,
-0.28125,
0.002445220947265625,
-0.188720703125,
0.26708984375,
-0.6572265625,
0.02215576171875,
0.349609375,
0.281005859375,
-0.63916015625,
-0.541015625,
-0.07769775390625,
0.46533203125,
0.51513671875,
-0.859375,
0.5263671875,
-1.0712890625,
0.2413330078125,
0.454345703125,
-0.1317138671875,
-0.79443359375,
-0.420166015625,
-0.6474609375,
-0.689453125,
0.158203125,
0.85302734375,
0.179443359375,
0.180419921875,
-0.71337890625,
0.533203125,
0.1962890625,
-0.2646484375,
0.2042236328125,
-0.2269287109375,
0.6181640625,
-0.07440185546875,
0.833984375,
-0.296630859375,
-0.9453125,
0.437255859375,
-1.0078125,
0.53466796875,
-0.64697265625,
0.5126953125,
0.0909423828125,
-0.407958984375,
0.142822265625,
0.84326171875,
-0.10467529296875,
0.129638671875,
-0.369140625,
0.11187744140625,
-0.90283203125,
-0.71728515625,
0.326171875,
-0.1529541015625,
-0.18310546875,
0.80322265625,
-0.11859130859375,
-0.375244140625,
0.09716796875,
0.60498046875,
-0.57421875,
0.305908203125,
-0.73291015625,
0.552734375,
-0.2802734375,
-0.65771484375,
0.09771728515625,
-0.654296875,
0.56005859375,
-0.0167388916015625,
-0.374755859375,
-0.36181640625,
-1.2568359375,
-0.42822265625,
0.06280517578125,
-0.53955078125,
0.31787109375,
-0.0218353271484375,
-0.33154296875,
-0.374755859375,
-0.220703125,
-1.099609375,
-0.068359375,
-0.23681640625,
-0.22412109375,
-0.190185546875,
0.15380859375,
0.27490234375,
0.11328125,
-0.2010498046875,
0.19970703125,
-0.155517578125,
-0.01873779296875,
-0.46923828125,
-0.90869140625,
0.344482421875,
-0.1864013671875,
0.333740234375,
0.41796875,
-0.352294921875,
0.437255859375,
0.77490234375,
0.035369873046875,
0.270263671875,
0.282958984375,
-0.41943359375,
0.81591796875,
-0.0867919921875,
-0.95068359375,
-0.548828125,
0.720703125,
0.0870361328125,
0.459716796875,
0.19677734375,
-0.9287109375,
-1.1640625,
-0.9296875,
0.50048828125,
-0.14208984375,
-0.490966796875,
-0.81982421875,
-0.6484375,
-0.0301513671875,
0.38818359375,
0.08251953125,
-0.603515625,
0.304443359375,
-1.109375,
0.1539306640625,
-0.456298828125,
-0.40966796875,
-0.93359375,
-0.63916015625,
-0.02093505859375,
1.2021484375,
0.373291015625,
0.6767578125,
-0.038787841796875,
-0.244873046875,
-0.03131103515625,
0.180419921875,
-0.2802734375,
-0.8486328125,
-0.037994384765625,
-0.392333984375,
0.06475830078125,
-0.2254638671875,
-0.353515625,
0.91259765625,
-1.0185546875,
0.26953125,
-0.489013671875,
-0.90380859375,
-0.241455078125,
-0.097900390625,
1.265625,
-0.37109375,
-0.040191650390625,
-0.02972412109375,
0.53173828125,
0.533203125,
-0.140380859375,
-0.69140625,
-0.5263671875,
-0.78076171875,
-1.1083984375,
0.60498046875,
-0.59912109375,
0.279541015625,
-0.55419921875,
-0.04132080078125,
1.064453125,
-0.4560546875,
0.447509765625,
0.87158203125,
-0.0262603759765625,
0.263916015625,
-0.479248046875,
0.5302734375,
0.53515625,
-0.51611328125,
-0.31005859375,
0.181884765625,
-0.58544921875,
0.4365234375,
-0.3994140625,
-1.0751953125,
-0.72509765625,
0.1727294921875,
1.0751953125,
-0.3544921875,
0.73779296875,
0.022796630859375,
-1.2041015625,
-0.49658203125,
0.552734375,
0.177490234375,
0.06585693359375,
0.38037109375,
-0.402099609375,
-0.06329345703125,
-0.09808349609375,
-0.15576171875,
-0.2418212890625,
-0.494140625,
1.185546875,
0.352783203125,
-0.360107421875,
1.1298828125,
1.015625,
-0.63037109375,
-0.89501953125,
-0.327880859375,
-0.057891845703125,
-0.446044921875,
-0.93115234375,
0.17919921875,
0.448974609375,
-0.65771484375,
0.1761474609375,
0.388671875,
-0.336181640625,
0.452880859375,
0.314697265625,
0.2261962890625,
-0.389892578125,
0.61083984375,
0.396484375,
-0.7080078125,
-0.26220703125,
-1.087890625,
-0.2152099609375,
-0.376708984375,
-0.0307464599609375,
0.99951171875,
-0.18408203125,
-0.032470703125,
0.4384765625,
-0.4482421875,
0.99951171875,
-0.495849609375,
-0.3095703125,
0.0096435546875,
-0.85107421875,
-0.362060546875,
-0.0794677734375,
0.489013671875,
-0.346435546875,
0.037200927734375,
-1.0107421875,
0.1060791015625,
0.58984375,
0.391357421875,
0.0926513671875,
-0.9716796875,
-0.125732421875,
-1.1484375,
-0.170654296875,
-0.2142333984375,
-0.33740234375,
0.038238525390625,
0.50390625,
0.276123046875,
-0.09405517578125,
0.236083984375,
0.8671875,
-0.323486328125,
0.75439453125,
-0.68310546875,
0.39208984375,
-0.354248046875,
-0.384521484375,
-0.40673828125,
0.06365966796875,
-0.52001953125,
-0.07611083984375,
-0.472900390625,
0.60546875,
0.07122802734375,
0.426025390625,
-0.63330078125,
0.38037109375,
0.07281494140625,
-0.264404296875,
0.1864013671875,
-0.1900634765625,
-0.464111328125,
0.58984375,
0.61962890625,
-0.0374755859375,
0.29736328125,
-0.09326171875,
-0.344482421875,
-0.314697265625,
0.58154296875,
0.366455078125,
-0.206298828125,
-0.53125,
-0.54541015625,
-0.1383056640625,
-0.703125,
-0.0250396728515625,
-0.2296142578125,
0.1383056640625,
-0.2025146484375,
-0.292236328125,
0.470947265625,
1.1865234375,
-0.0716552734375,
0.32080078125,
0.08514404296875,
0.259521484375,
0.564453125,
-0.17724609375,
0.2100830078125,
0.395751953125,
0.448486328125,
-0.57568359375,
0.042938232421875,
0.67333984375,
-0.31689453125,
0.241455078125,
-0.236083984375,
-0.65478515625,
-0.99072265625,
-0.1192626953125,
0.0880126953125,
0.63720703125,
0.198486328125,
-0.12158203125,
0.371337890625,
-0.448486328125,
-0.8486328125,
0.15673828125,
-1.0673828125,
-0.763671875,
0.3115234375,
0.20361328125,
-0.421630859375,
-0.2371826171875,
-0.67919921875,
-0.39306640625,
0.2269287109375,
0.41015625,
0.03472900390625,
0.04608154296875,
-0.11614990234375,
0.50390625,
-0.5732421875,
-0.082275390625,
0.284912109375,
0.332763671875,
-0.417724609375,
-0.59912109375,
0.325439453125,
0.99267578125,
0.098876953125,
0.134033203125,
-0.480712890625,
0.6435546875,
0.053985595703125,
0.259033203125,
-0.1353759765625,
0.004230499267578125,
0.06304931640625,
0.46044921875,
-0.87255859375,
-0.0775146484375,
-0.1429443359375,
0.1505126953125,
0.0411376953125,
-0.31689453125,
-0.414306640625,
0.52685546875,
0.78173828125,
-0.1595458984375,
0.1732177734375,
0.48681640625,
0.394775390625,
-0.546875,
-0.1846923828125,
-0.432373046875,
1.095703125,
0.72998046875,
0.53369140625,
0.045166015625,
0.59375,
0.78173828125,
-0.112060546875,
-0.20947265625,
0.8701171875,
0.55908203125,
-0.442626953125,
-0.11431884765625,
0.12548828125,
0.05523681640625,
-0.13330078125,
-0.447021484375,
0.548828125,
-0.488037109375,
-0.33935546875,
0.1353759765625,
-0.62890625,
1.26171875,
-0.2978515625,
-0.5087890625,
0.236083984375,
-0.3427734375,
-0.0010671615600585938,
1.04296875,
0.2073974609375,
-0.1715087890625,
0.900390625,
0.23681640625,
0.59912109375,
0.8271484375,
0.2054443359375,
0.264892578125,
-0.74462890625,
-0.261474609375,
0.10400390625,
-0.281982421875,
-0.7578125,
-0.357421875,
-0.8203125,
0.3740234375,
-0.51318359375,
-0.01947021484375,
0.475830078125,
-0.89892578125,
-0.062744140625,
-0.50244140625,
0.7744140625,
-0.8115234375,
0.2763671875,
0.3740234375,
-0.16357421875,
-0.59228515625,
0.517578125,
-0.1527099609375,
0.218505859375,
0.2308349609375,
0.779296875,
0.477294921875,
1.2548828125,
0.2305908203125,
-0.34521484375,
-0.11456298828125,
0.243896484375,
-0.2880859375,
-0.7216796875,
-0.0938720703125,
-0.3779296875,
0.129638671875,
-0.828125,
-0.1956787109375,
-0.08612060546875,
0.515625,
-0.359619140625,
-1.02734375,
-0.29736328125,
-0.006664276123046875,
-0.0189971923828125,
0.06927490234375,
0.141357421875,
-0.1260986328125,
0.0787353515625,
0.36083984375,
-0.1328125,
-0.80126953125,
0.0272064208984375,
-0.55615234375,
0.475830078125,
-0.1402587890625,
-0.74658203125,
-0.857421875,
-0.34130859375,
0.01496124267578125,
0.225341796875,
-0.4931640625,
-0.83544921875,
0.541015625,
0.3095703125,
0.29638671875,
0.36767578125,
-0.1514892578125,
0.01267242431640625,
0.92138671875,
0.91259765625,
0.093505859375,
1.056640625,
0.2880859375,
-0.08740234375,
0.53662109375,
-0.15185546875,
0.5546875,
-0.279052734375,
0.2352294921875,
-0.426513671875,
0.468994140625,
-0.10040283203125,
-1.228515625,
0.1197509765625,
0.712890625,
0.463623046875,
-0.67578125,
-1.3388671875,
-0.454833984375,
-0.72119140625,
-0.0814208984375,
-0.61767578125,
0.63232421875,
-0.10736083984375,
0.158203125,
-0.1737060546875,
-1.453125,
4.5,
1.1279296875,
0.456787109375,
0.424560546875,
0.2529296875,
0.72265625,
0.36474609375,
-0.708984375,
0.08367919921875,
-0.5361328125,
0.339599609375,
-0.30224609375,
-0.081787109375,
0.7080078125,
0.6826171875,
0.9248046875,
-0.48486328125,
-0.20263671875,
-0.279296875,
-0.697265625,
-0.72998046875,
0.07366943359375,
-0.1495361328125,
0.184326171875,
0.305908203125,
0.419677734375,
0.23046875,
-0.95263671875,
-0.049652099609375,
-0.411865234375,
0.1329345703125,
-0.59716796875,
0.5556640625,
-0.56494140625,
-0.34033203125,
0.283203125,
-0.2257080078125,
-0.7392578125,
-0.339111328125,
0.09912109375,
0.09906005859375,
0.0633544921875,
0.71826171875,
-0.2666015625,
0.74072265625,
0.46875,
-0.65771484375,
0.89404296875,
0.06610107421875,
-0.92333984375,
1.078125,
-0.409912109375,
0.247314453125,
-0.325439453125,
-0.83740234375,
-0.02545166015625,
-0.11199951171875,
-0.3486328125,
-0.168212890625,
0.57177734375,
0.214599609375,
-0.0228424072265625,
0.33349609375,
0.607421875,
-1.037109375,
1.013671875,
0.119140625,
0.5185546875,
-0.2032470703125,
-0.16259765625,
-0.05224609375,
-0.47607421875,
-0.1409912109375,
0.11431884765625,
0.64306640625,
-0.058380126953125,
-0.05810546875,
0.568359375,
0.9208984375,
-0.83837890625,
-0.11212158203125,
-0.381103515625,
-0.72607421875,
-0.63916015625,
0.54541015625,
1.0498046875,
-0.494873046875,
-0.0816650390625,
-0.298828125,
0.60302734375,
0.4326171875,
0.378173828125,
-0.1627197265625,
-0.4365234375,
-0.55078125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
After you had helped Fedor to find friends in the «Call of Soldiers 3» game, he stopped studying completely. Today, the English teacher told him to prepare an essay. Fedor didn't want to prepare the essay, so he asked Alex for help. Alex came to help and wrote the essay for Fedor. But Fedor didn't like the essay at all. Now Fedor is going to change the essay using the synonym dictionary of the English language.
Fedor does not want to change the meaning of the essay. So the only change he would do: change a word from essay to one of its synonyms, basing on a replacement rule from the dictionary. Fedor may perform this operation any number of times.
As a result, Fedor wants to get an essay which contains as little letters «R» (the case doesn't matter) as possible. If there are multiple essays with minimum number of «R»s he wants to get the one with minimum length (length of essay is the sum of the lengths of all the words in it). Help Fedor get the required essay.
Please note that in this problem the case of letters doesn't matter. For example, if the synonym dictionary says that word cat can be replaced with word DOG, then it is allowed to replace the word Cat with the word doG.
Input
The first line contains a single integer m (1 ≤ m ≤ 105) — the number of words in the initial essay. The second line contains words of the essay. The words are separated by a single space. It is guaranteed that the total length of the words won't exceed 105 characters.
The next line contains a single integer n (0 ≤ n ≤ 105) — the number of pairs of words in synonym dictionary. The i-th of the next n lines contains two space-separated non-empty words xi and yi. They mean that word xi can be replaced with word yi (but not vise versa). It is guaranteed that the total length of all pairs of synonyms doesn't exceed 5·105 characters.
All the words at input can only consist of uppercase and lowercase letters of the English alphabet.
Output
Print two integers — the minimum number of letters «R» in an optimal essay and the minimum length of an optimal essay.
Examples
Input
3
AbRb r Zz
4
xR abRb
aA xr
zz Z
xr y
Output
2 6
Input
2
RuruRu fedya
1
ruruRU fedor
Output
1 10
Tags: dfs and similar, dp, graphs, hashing, strings
Correct Solution:
```
from sys import stdin
from collections import defaultdict
def main():
stdin.readline()
num = {}
stat = lambda word: (word.count('r'),
len(word), num.setdefault(word, len(num)))
essay = list(map(stat, stdin.readline().lower().split()))
queue = []
for word in essay:
queue.append(word)
n_synonym = int(stdin.readline())
synonym = defaultdict(list)
for i in range(n_synonym):
word, rep = map(stat, stdin.readline().lower().split())
synonym[rep[2]].append(word[2])
queue.append(rep)
queue.sort(reverse=True)
best = {}
while queue:
n_r, length, word = queue.pop()
if word in best:
continue
best[word] = n_r, length
for rep in synonym[word]:
if rep not in best:
queue.append((n_r, length, rep))
sum_n_r, sum_len = 0, 0
for n_r, length, word in essay:
n_r, length = best[word]
sum_n_r += n_r
sum_len += length
print(sum_n_r, sum_len)
if __name__ == '__main__':
main()
```
| 44,944
|
[
0.3134765625,
-0.4443359375,
0.380615234375,
0.440673828125,
-0.70263671875,
-0.372314453125,
0.2359619140625,
-0.02496337890625,
-0.41162109375,
0.51513671875,
1.322265625,
0.12548828125,
-0.0836181640625,
-0.73779296875,
-0.431884765625,
0.0242767333984375,
-0.25146484375,
-0.76806640625,
-0.4541015625,
0.11907958984375,
0.069091796875,
0.09527587890625,
-1.25390625,
0.161865234375,
-0.342529296875,
0.8173828125,
0.06085205078125,
0.62451171875,
0.9384765625,
0.463623046875,
-0.14599609375,
-0.03643798828125,
0.11566162109375,
-0.73388671875,
-0.51708984375,
-0.56884765625,
0.3349609375,
-0.56298828125,
-0.310546875,
-0.306884765625,
0.382080078125,
-0.6806640625,
0.57177734375,
-0.51806640625,
-1.0703125,
0.072998046875,
-0.53515625,
-0.472412109375,
-0.184814453125,
-0.6015625,
0.51904296875,
-0.38232421875,
0.313720703125,
-0.299072265625,
0.059112548828125,
-0.67822265625,
-0.3388671875,
0.34326171875,
-0.496826171875,
0.01201629638671875,
0.65625,
0.217529296875,
-0.438720703125,
-0.459716796875,
-0.3515625,
0.2109375,
-0.060211181640625,
-0.1356201171875,
-0.0858154296875,
-0.43505859375,
-0.21630859375,
-0.0303802490234375,
-0.09649658203125,
-0.45263671875,
-0.044342041015625,
0.06256103515625,
1.1884765625,
-0.6171875,
-0.341552734375,
0.67529296875,
0.1478271484375,
1.2451171875,
0.187744140625,
-0.1878662109375,
-0.572265625,
-0.4931640625,
0.162353515625,
0.39794921875,
0.039215087890625,
-0.1339111328125,
-0.2337646484375,
0.65283203125,
-0.48681640625,
-0.158203125,
0.5224609375,
0.415283203125,
-0.2783203125,
0.287109375,
0.02783203125,
-0.20947265625,
0.8564453125,
0.822265625,
-0.0247955322265625,
0.77197265625,
-0.465576171875,
0.058746337890625,
0.07318115234375,
-0.1861572265625,
0.2305908203125,
-0.2315673828125,
-0.269775390625,
0.020782470703125,
0.666015625,
0.52734375,
-0.315673828125,
0.7978515625,
-0.398193359375,
0.8515625,
-0.83544921875,
0.319580078125,
0.395751953125,
0.11480712890625,
0.179931640625,
-0.46044921875,
0.1680908203125,
-0.96923828125,
-0.6455078125,
0.6953125,
-0.48974609375,
-0.116455078125,
0.3974609375,
0.01282501220703125,
0.03131103515625,
0.5625,
-0.0931396484375,
0.380615234375,
0.0875244140625,
0.255126953125,
0.8818359375,
-0.64453125,
0.72412109375,
-0.1826171875,
0.043121337890625,
1.0830078125,
0.6455078125,
0.05706787109375,
0.501953125,
0.0845947265625,
-0.7353515625,
0.65576171875,
-0.85302734375,
0.8056640625,
0.2117919921875,
0.414794921875,
-0.1634521484375,
0.2359619140625,
0.005176544189453125,
0.490966796875,
0.5390625,
0.364013671875,
-0.181884765625,
0.1204833984375,
-0.5166015625,
1.09375,
-0.114013671875,
0.75537109375,
-0.6640625,
-0.11199951171875,
-0.61767578125,
-0.366943359375,
0.5986328125,
-0.1842041015625,
-0.048370361328125,
0.45166015625,
0.0233306884765625,
1.107421875,
0.6748046875,
-0.121826171875,
0.05096435546875,
0.456787109375,
-0.448486328125,
-0.0687255859375,
0.4169921875,
0.4765625,
0.12286376953125,
-0.0269775390625,
-0.28857421875,
-0.483642578125,
-0.58984375,
-1.0556640625,
0.0777587890625,
0.449462890625,
-0.2109375,
-0.12054443359375,
0.2069091796875,
0.2227783203125,
-0.72607421875,
-0.444091796875,
0.35107421875,
-0.60107421875,
-0.5146484375,
0.82861328125,
-0.72314453125,
0.351806640625,
-0.1497802734375,
-0.568359375,
0.1424560546875,
1.0166015625,
-0.1322021484375,
0.2340087890625,
0.65478515625,
0.477294921875,
-0.24365234375,
-0.251220703125,
0.045318603515625,
-0.31298828125,
-0.61328125,
0.78271484375,
-0.60546875,
0.120361328125,
0.298583984375,
0.401611328125,
0.34716796875,
0.255126953125,
0.431640625,
-0.650390625,
0.8134765625,
1.46875,
-0.271728515625,
0.77587890625,
0.370849609375,
0.908203125,
0.2978515625,
0.77001953125,
0.52392578125,
0.093017578125,
0.71923828125,
0.8896484375,
-0.3349609375,
0.1422119140625,
0.15576171875,
0.9873046875,
0.5576171875,
0.6630859375,
-0.0693359375,
0.5498046875,
0.0196990966796875,
0.339599609375,
0.1331787109375,
0.3232421875,
-0.06805419921875,
0.587890625,
0.3623046875,
0.2705078125,
-0.810546875,
-0.07330322265625,
0.41357421875,
0.75244140625,
-0.499755859375,
-0.46923828125,
-0.2078857421875,
0.089111328125,
0.25927734375,
0.303955078125,
0.4638671875,
0.3623046875,
0.1011962890625,
0.7353515625,
-0.279296875,
-0.03326416015625,
-0.414794921875,
-0.978515625,
-0.6689453125,
-0.3623046875,
-0.365478515625,
0.07989501953125,
0.2435302734375,
-0.869140625,
0.403564453125,
-0.177490234375,
-0.004192352294921875,
-0.437255859375,
-0.75244140625,
0.3515625,
-0.6787109375,
0.962890625,
-0.314697265625,
0.4072265625,
-0.2113037109375,
0.6669921875,
-0.2802734375,
-0.56982421875,
-0.198486328125,
-0.6435546875,
0.35546875,
0.0291748046875,
0.273681640625,
-0.178466796875,
-0.880859375,
-0.810546875,
-0.2174072265625,
-0.0283966064453125,
-0.299072265625,
0.4541015625,
-0.53466796875,
0.85693359375,
0.036865234375,
-0.6533203125,
0.52734375,
0.599609375,
-1.1875,
0.99072265625,
0.3466796875,
0.47705078125,
-0.82177734375,
0.9072265625,
0.375732421875,
0.37841796875,
-0.5244140625,
-0.6279296875,
-0.51513671875,
-0.0865478515625,
0.390625,
-0.5703125,
-0.12420654296875,
-0.023651123046875,
0.378173828125,
-1.220703125,
0.60107421875,
-0.83544921875,
-0.5546875,
-0.78173828125,
-0.578125,
0.6923828125,
0.5185546875,
0.253173828125,
0.08905029296875,
-0.377685546875,
-0.027252197265625,
0.54541015625,
0.70166015625,
-0.489990234375,
0.041595458984375,
0.55712890625,
-0.06695556640625,
0.287841796875,
0.487060546875,
-0.5986328125,
-0.1634521484375,
-0.019927978515625,
0.619140625,
0.484375,
0.0799560546875,
0.311279296875,
0.121337890625,
-0.057037353515625,
-0.3935546875,
-0.1070556640625,
-0.1427001953125,
0.45703125,
0.408935546875,
0.419677734375,
0.1817626953125,
-0.47021484375,
-0.406494140625,
-1.0771484375,
0.388427734375,
0.0343017578125,
0.5390625,
-0.876953125,
1.072265625,
0.035797119140625,
-0.42333984375,
0.44189453125,
-0.37744140625,
0.179931640625,
1.0576171875,
0.1739501953125,
0.49365234375,
-0.90673828125,
0.1385498046875,
-0.35009765625,
0.294189453125,
0.3955078125,
0.64404296875,
0.4560546875,
-0.52490234375,
-0.42822265625,
-0.52197265625,
-0.166015625,
-0.2093505859375,
-0.57763671875,
0.07745361328125,
-0.8876953125,
-0.1292724609375,
-0.82177734375,
0.64404296875,
0.76611328125,
0.52978515625,
0.07342529296875,
1.0966796875,
0.08551025390625,
0.37841796875,
0.463134765625,
-0.220947265625,
0.11541748046875,
-0.71337890625,
1.0234375,
-0.29248046875,
-0.2587890625,
-0.435302734375,
-0.2293701171875,
-0.28125,
0.002445220947265625,
-0.188720703125,
0.26708984375,
-0.6572265625,
0.02215576171875,
0.349609375,
0.281005859375,
-0.63916015625,
-0.541015625,
-0.07769775390625,
0.46533203125,
0.51513671875,
-0.859375,
0.5263671875,
-1.0712890625,
0.2413330078125,
0.454345703125,
-0.1317138671875,
-0.79443359375,
-0.420166015625,
-0.6474609375,
-0.689453125,
0.158203125,
0.85302734375,
0.179443359375,
0.180419921875,
-0.71337890625,
0.533203125,
0.1962890625,
-0.2646484375,
0.2042236328125,
-0.2269287109375,
0.6181640625,
-0.07440185546875,
0.833984375,
-0.296630859375,
-0.9453125,
0.437255859375,
-1.0078125,
0.53466796875,
-0.64697265625,
0.5126953125,
0.0909423828125,
-0.407958984375,
0.142822265625,
0.84326171875,
-0.10467529296875,
0.129638671875,
-0.369140625,
0.11187744140625,
-0.90283203125,
-0.71728515625,
0.326171875,
-0.1529541015625,
-0.18310546875,
0.80322265625,
-0.11859130859375,
-0.375244140625,
0.09716796875,
0.60498046875,
-0.57421875,
0.305908203125,
-0.73291015625,
0.552734375,
-0.2802734375,
-0.65771484375,
0.09771728515625,
-0.654296875,
0.56005859375,
-0.0167388916015625,
-0.374755859375,
-0.36181640625,
-1.2568359375,
-0.42822265625,
0.06280517578125,
-0.53955078125,
0.31787109375,
-0.0218353271484375,
-0.33154296875,
-0.374755859375,
-0.220703125,
-1.099609375,
-0.068359375,
-0.23681640625,
-0.22412109375,
-0.190185546875,
0.15380859375,
0.27490234375,
0.11328125,
-0.2010498046875,
0.19970703125,
-0.155517578125,
-0.01873779296875,
-0.46923828125,
-0.90869140625,
0.344482421875,
-0.1864013671875,
0.333740234375,
0.41796875,
-0.352294921875,
0.437255859375,
0.77490234375,
0.035369873046875,
0.270263671875,
0.282958984375,
-0.41943359375,
0.81591796875,
-0.0867919921875,
-0.95068359375,
-0.548828125,
0.720703125,
0.0870361328125,
0.459716796875,
0.19677734375,
-0.9287109375,
-1.1640625,
-0.9296875,
0.50048828125,
-0.14208984375,
-0.490966796875,
-0.81982421875,
-0.6484375,
-0.0301513671875,
0.38818359375,
0.08251953125,
-0.603515625,
0.304443359375,
-1.109375,
0.1539306640625,
-0.456298828125,
-0.40966796875,
-0.93359375,
-0.63916015625,
-0.02093505859375,
1.2021484375,
0.373291015625,
0.6767578125,
-0.038787841796875,
-0.244873046875,
-0.03131103515625,
0.180419921875,
-0.2802734375,
-0.8486328125,
-0.037994384765625,
-0.392333984375,
0.06475830078125,
-0.2254638671875,
-0.353515625,
0.91259765625,
-1.0185546875,
0.26953125,
-0.489013671875,
-0.90380859375,
-0.241455078125,
-0.097900390625,
1.265625,
-0.37109375,
-0.040191650390625,
-0.02972412109375,
0.53173828125,
0.533203125,
-0.140380859375,
-0.69140625,
-0.5263671875,
-0.78076171875,
-1.1083984375,
0.60498046875,
-0.59912109375,
0.279541015625,
-0.55419921875,
-0.04132080078125,
1.064453125,
-0.4560546875,
0.447509765625,
0.87158203125,
-0.0262603759765625,
0.263916015625,
-0.479248046875,
0.5302734375,
0.53515625,
-0.51611328125,
-0.31005859375,
0.181884765625,
-0.58544921875,
0.4365234375,
-0.3994140625,
-1.0751953125,
-0.72509765625,
0.1727294921875,
1.0751953125,
-0.3544921875,
0.73779296875,
0.022796630859375,
-1.2041015625,
-0.49658203125,
0.552734375,
0.177490234375,
0.06585693359375,
0.38037109375,
-0.402099609375,
-0.06329345703125,
-0.09808349609375,
-0.15576171875,
-0.2418212890625,
-0.494140625,
1.185546875,
0.352783203125,
-0.360107421875,
1.1298828125,
1.015625,
-0.63037109375,
-0.89501953125,
-0.327880859375,
-0.057891845703125,
-0.446044921875,
-0.93115234375,
0.17919921875,
0.448974609375,
-0.65771484375,
0.1761474609375,
0.388671875,
-0.336181640625,
0.452880859375,
0.314697265625,
0.2261962890625,
-0.389892578125,
0.61083984375,
0.396484375,
-0.7080078125,
-0.26220703125,
-1.087890625,
-0.2152099609375,
-0.376708984375,
-0.0307464599609375,
0.99951171875,
-0.18408203125,
-0.032470703125,
0.4384765625,
-0.4482421875,
0.99951171875,
-0.495849609375,
-0.3095703125,
0.0096435546875,
-0.85107421875,
-0.362060546875,
-0.0794677734375,
0.489013671875,
-0.346435546875,
0.037200927734375,
-1.0107421875,
0.1060791015625,
0.58984375,
0.391357421875,
0.0926513671875,
-0.9716796875,
-0.125732421875,
-1.1484375,
-0.170654296875,
-0.2142333984375,
-0.33740234375,
0.038238525390625,
0.50390625,
0.276123046875,
-0.09405517578125,
0.236083984375,
0.8671875,
-0.323486328125,
0.75439453125,
-0.68310546875,
0.39208984375,
-0.354248046875,
-0.384521484375,
-0.40673828125,
0.06365966796875,
-0.52001953125,
-0.07611083984375,
-0.472900390625,
0.60546875,
0.07122802734375,
0.426025390625,
-0.63330078125,
0.38037109375,
0.07281494140625,
-0.264404296875,
0.1864013671875,
-0.1900634765625,
-0.464111328125,
0.58984375,
0.61962890625,
-0.0374755859375,
0.29736328125,
-0.09326171875,
-0.344482421875,
-0.314697265625,
0.58154296875,
0.366455078125,
-0.206298828125,
-0.53125,
-0.54541015625,
-0.1383056640625,
-0.703125,
-0.0250396728515625,
-0.2296142578125,
0.1383056640625,
-0.2025146484375,
-0.292236328125,
0.470947265625,
1.1865234375,
-0.0716552734375,
0.32080078125,
0.08514404296875,
0.259521484375,
0.564453125,
-0.17724609375,
0.2100830078125,
0.395751953125,
0.448486328125,
-0.57568359375,
0.042938232421875,
0.67333984375,
-0.31689453125,
0.241455078125,
-0.236083984375,
-0.65478515625,
-0.99072265625,
-0.1192626953125,
0.0880126953125,
0.63720703125,
0.198486328125,
-0.12158203125,
0.371337890625,
-0.448486328125,
-0.8486328125,
0.15673828125,
-1.0673828125,
-0.763671875,
0.3115234375,
0.20361328125,
-0.421630859375,
-0.2371826171875,
-0.67919921875,
-0.39306640625,
0.2269287109375,
0.41015625,
0.03472900390625,
0.04608154296875,
-0.11614990234375,
0.50390625,
-0.5732421875,
-0.082275390625,
0.284912109375,
0.332763671875,
-0.417724609375,
-0.59912109375,
0.325439453125,
0.99267578125,
0.098876953125,
0.134033203125,
-0.480712890625,
0.6435546875,
0.053985595703125,
0.259033203125,
-0.1353759765625,
0.004230499267578125,
0.06304931640625,
0.46044921875,
-0.87255859375,
-0.0775146484375,
-0.1429443359375,
0.1505126953125,
0.0411376953125,
-0.31689453125,
-0.414306640625,
0.52685546875,
0.78173828125,
-0.1595458984375,
0.1732177734375,
0.48681640625,
0.394775390625,
-0.546875,
-0.1846923828125,
-0.432373046875,
1.095703125,
0.72998046875,
0.53369140625,
0.045166015625,
0.59375,
0.78173828125,
-0.112060546875,
-0.20947265625,
0.8701171875,
0.55908203125,
-0.442626953125,
-0.11431884765625,
0.12548828125,
0.05523681640625,
-0.13330078125,
-0.447021484375,
0.548828125,
-0.488037109375,
-0.33935546875,
0.1353759765625,
-0.62890625,
1.26171875,
-0.2978515625,
-0.5087890625,
0.236083984375,
-0.3427734375,
-0.0010671615600585938,
1.04296875,
0.2073974609375,
-0.1715087890625,
0.900390625,
0.23681640625,
0.59912109375,
0.8271484375,
0.2054443359375,
0.264892578125,
-0.74462890625,
-0.261474609375,
0.10400390625,
-0.281982421875,
-0.7578125,
-0.357421875,
-0.8203125,
0.3740234375,
-0.51318359375,
-0.01947021484375,
0.475830078125,
-0.89892578125,
-0.062744140625,
-0.50244140625,
0.7744140625,
-0.8115234375,
0.2763671875,
0.3740234375,
-0.16357421875,
-0.59228515625,
0.517578125,
-0.1527099609375,
0.218505859375,
0.2308349609375,
0.779296875,
0.477294921875,
1.2548828125,
0.2305908203125,
-0.34521484375,
-0.11456298828125,
0.243896484375,
-0.2880859375,
-0.7216796875,
-0.0938720703125,
-0.3779296875,
0.129638671875,
-0.828125,
-0.1956787109375,
-0.08612060546875,
0.515625,
-0.359619140625,
-1.02734375,
-0.29736328125,
-0.006664276123046875,
-0.0189971923828125,
0.06927490234375,
0.141357421875,
-0.1260986328125,
0.0787353515625,
0.36083984375,
-0.1328125,
-0.80126953125,
0.0272064208984375,
-0.55615234375,
0.475830078125,
-0.1402587890625,
-0.74658203125,
-0.857421875,
-0.34130859375,
0.01496124267578125,
0.225341796875,
-0.4931640625,
-0.83544921875,
0.541015625,
0.3095703125,
0.29638671875,
0.36767578125,
-0.1514892578125,
0.01267242431640625,
0.92138671875,
0.91259765625,
0.093505859375,
1.056640625,
0.2880859375,
-0.08740234375,
0.53662109375,
-0.15185546875,
0.5546875,
-0.279052734375,
0.2352294921875,
-0.426513671875,
0.468994140625,
-0.10040283203125,
-1.228515625,
0.1197509765625,
0.712890625,
0.463623046875,
-0.67578125,
-1.3388671875,
-0.454833984375,
-0.72119140625,
-0.0814208984375,
-0.61767578125,
0.63232421875,
-0.10736083984375,
0.158203125,
-0.1737060546875,
-1.453125,
4.5,
1.1279296875,
0.456787109375,
0.424560546875,
0.2529296875,
0.72265625,
0.36474609375,
-0.708984375,
0.08367919921875,
-0.5361328125,
0.339599609375,
-0.30224609375,
-0.081787109375,
0.7080078125,
0.6826171875,
0.9248046875,
-0.48486328125,
-0.20263671875,
-0.279296875,
-0.697265625,
-0.72998046875,
0.07366943359375,
-0.1495361328125,
0.184326171875,
0.305908203125,
0.419677734375,
0.23046875,
-0.95263671875,
-0.049652099609375,
-0.411865234375,
0.1329345703125,
-0.59716796875,
0.5556640625,
-0.56494140625,
-0.34033203125,
0.283203125,
-0.2257080078125,
-0.7392578125,
-0.339111328125,
0.09912109375,
0.09906005859375,
0.0633544921875,
0.71826171875,
-0.2666015625,
0.74072265625,
0.46875,
-0.65771484375,
0.89404296875,
0.06610107421875,
-0.92333984375,
1.078125,
-0.409912109375,
0.247314453125,
-0.325439453125,
-0.83740234375,
-0.02545166015625,
-0.11199951171875,
-0.3486328125,
-0.168212890625,
0.57177734375,
0.214599609375,
-0.0228424072265625,
0.33349609375,
0.607421875,
-1.037109375,
1.013671875,
0.119140625,
0.5185546875,
-0.2032470703125,
-0.16259765625,
-0.05224609375,
-0.47607421875,
-0.1409912109375,
0.11431884765625,
0.64306640625,
-0.058380126953125,
-0.05810546875,
0.568359375,
0.9208984375,
-0.83837890625,
-0.11212158203125,
-0.381103515625,
-0.72607421875,
-0.63916015625,
0.54541015625,
1.0498046875,
-0.494873046875,
-0.0816650390625,
-0.298828125,
0.60302734375,
0.4326171875,
0.378173828125,
-0.1627197265625,
-0.4365234375,
-0.55078125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
After you had helped Fedor to find friends in the «Call of Soldiers 3» game, he stopped studying completely. Today, the English teacher told him to prepare an essay. Fedor didn't want to prepare the essay, so he asked Alex for help. Alex came to help and wrote the essay for Fedor. But Fedor didn't like the essay at all. Now Fedor is going to change the essay using the synonym dictionary of the English language.
Fedor does not want to change the meaning of the essay. So the only change he would do: change a word from essay to one of its synonyms, basing on a replacement rule from the dictionary. Fedor may perform this operation any number of times.
As a result, Fedor wants to get an essay which contains as little letters «R» (the case doesn't matter) as possible. If there are multiple essays with minimum number of «R»s he wants to get the one with minimum length (length of essay is the sum of the lengths of all the words in it). Help Fedor get the required essay.
Please note that in this problem the case of letters doesn't matter. For example, if the synonym dictionary says that word cat can be replaced with word DOG, then it is allowed to replace the word Cat with the word doG.
Input
The first line contains a single integer m (1 ≤ m ≤ 105) — the number of words in the initial essay. The second line contains words of the essay. The words are separated by a single space. It is guaranteed that the total length of the words won't exceed 105 characters.
The next line contains a single integer n (0 ≤ n ≤ 105) — the number of pairs of words in synonym dictionary. The i-th of the next n lines contains two space-separated non-empty words xi and yi. They mean that word xi can be replaced with word yi (but not vise versa). It is guaranteed that the total length of all pairs of synonyms doesn't exceed 5·105 characters.
All the words at input can only consist of uppercase and lowercase letters of the English alphabet.
Output
Print two integers — the minimum number of letters «R» in an optimal essay and the minimum length of an optimal essay.
Examples
Input
3
AbRb r Zz
4
xR abRb
aA xr
zz Z
xr y
Output
2 6
Input
2
RuruRu fedya
1
ruruRU fedor
Output
1 10
Tags: dfs and similar, dp, graphs, hashing, strings
Correct Solution:
```
from collections import defaultdict
input()
index = {}
stat = lambda word: (word.count('r'),
len(word), index.setdefault(word, len(index)))
essay = list(map(stat, input().lower().split()))
queue = essay[:]
syn = defaultdict(list)
for i in range(int(input())):
word, rep = map(stat, input().lower().split())
syn[rep[2]].append(word[2])
queue.append(rep)
queue.sort(reverse=True)
best = {}
while queue:
n_r, length, word = queue.pop()
if word in best:
continue
best[word] = n_r, length
for rep in syn[word]:
if rep not in best:
queue.append((n_r, length, rep))
sum_n_r, sum_len = 0, 0
for n_r, length in map(lambda w: best[w[2]], essay):
sum_n_r += n_r
sum_len += length
print(sum_n_r, sum_len)
```
| 44,945
|
[
0.3134765625,
-0.4443359375,
0.380615234375,
0.440673828125,
-0.70263671875,
-0.372314453125,
0.2359619140625,
-0.02496337890625,
-0.41162109375,
0.51513671875,
1.322265625,
0.12548828125,
-0.0836181640625,
-0.73779296875,
-0.431884765625,
0.0242767333984375,
-0.25146484375,
-0.76806640625,
-0.4541015625,
0.11907958984375,
0.069091796875,
0.09527587890625,
-1.25390625,
0.161865234375,
-0.342529296875,
0.8173828125,
0.06085205078125,
0.62451171875,
0.9384765625,
0.463623046875,
-0.14599609375,
-0.03643798828125,
0.11566162109375,
-0.73388671875,
-0.51708984375,
-0.56884765625,
0.3349609375,
-0.56298828125,
-0.310546875,
-0.306884765625,
0.382080078125,
-0.6806640625,
0.57177734375,
-0.51806640625,
-1.0703125,
0.072998046875,
-0.53515625,
-0.472412109375,
-0.184814453125,
-0.6015625,
0.51904296875,
-0.38232421875,
0.313720703125,
-0.299072265625,
0.059112548828125,
-0.67822265625,
-0.3388671875,
0.34326171875,
-0.496826171875,
0.01201629638671875,
0.65625,
0.217529296875,
-0.438720703125,
-0.459716796875,
-0.3515625,
0.2109375,
-0.060211181640625,
-0.1356201171875,
-0.0858154296875,
-0.43505859375,
-0.21630859375,
-0.0303802490234375,
-0.09649658203125,
-0.45263671875,
-0.044342041015625,
0.06256103515625,
1.1884765625,
-0.6171875,
-0.341552734375,
0.67529296875,
0.1478271484375,
1.2451171875,
0.187744140625,
-0.1878662109375,
-0.572265625,
-0.4931640625,
0.162353515625,
0.39794921875,
0.039215087890625,
-0.1339111328125,
-0.2337646484375,
0.65283203125,
-0.48681640625,
-0.158203125,
0.5224609375,
0.415283203125,
-0.2783203125,
0.287109375,
0.02783203125,
-0.20947265625,
0.8564453125,
0.822265625,
-0.0247955322265625,
0.77197265625,
-0.465576171875,
0.058746337890625,
0.07318115234375,
-0.1861572265625,
0.2305908203125,
-0.2315673828125,
-0.269775390625,
0.020782470703125,
0.666015625,
0.52734375,
-0.315673828125,
0.7978515625,
-0.398193359375,
0.8515625,
-0.83544921875,
0.319580078125,
0.395751953125,
0.11480712890625,
0.179931640625,
-0.46044921875,
0.1680908203125,
-0.96923828125,
-0.6455078125,
0.6953125,
-0.48974609375,
-0.116455078125,
0.3974609375,
0.01282501220703125,
0.03131103515625,
0.5625,
-0.0931396484375,
0.380615234375,
0.0875244140625,
0.255126953125,
0.8818359375,
-0.64453125,
0.72412109375,
-0.1826171875,
0.043121337890625,
1.0830078125,
0.6455078125,
0.05706787109375,
0.501953125,
0.0845947265625,
-0.7353515625,
0.65576171875,
-0.85302734375,
0.8056640625,
0.2117919921875,
0.414794921875,
-0.1634521484375,
0.2359619140625,
0.005176544189453125,
0.490966796875,
0.5390625,
0.364013671875,
-0.181884765625,
0.1204833984375,
-0.5166015625,
1.09375,
-0.114013671875,
0.75537109375,
-0.6640625,
-0.11199951171875,
-0.61767578125,
-0.366943359375,
0.5986328125,
-0.1842041015625,
-0.048370361328125,
0.45166015625,
0.0233306884765625,
1.107421875,
0.6748046875,
-0.121826171875,
0.05096435546875,
0.456787109375,
-0.448486328125,
-0.0687255859375,
0.4169921875,
0.4765625,
0.12286376953125,
-0.0269775390625,
-0.28857421875,
-0.483642578125,
-0.58984375,
-1.0556640625,
0.0777587890625,
0.449462890625,
-0.2109375,
-0.12054443359375,
0.2069091796875,
0.2227783203125,
-0.72607421875,
-0.444091796875,
0.35107421875,
-0.60107421875,
-0.5146484375,
0.82861328125,
-0.72314453125,
0.351806640625,
-0.1497802734375,
-0.568359375,
0.1424560546875,
1.0166015625,
-0.1322021484375,
0.2340087890625,
0.65478515625,
0.477294921875,
-0.24365234375,
-0.251220703125,
0.045318603515625,
-0.31298828125,
-0.61328125,
0.78271484375,
-0.60546875,
0.120361328125,
0.298583984375,
0.401611328125,
0.34716796875,
0.255126953125,
0.431640625,
-0.650390625,
0.8134765625,
1.46875,
-0.271728515625,
0.77587890625,
0.370849609375,
0.908203125,
0.2978515625,
0.77001953125,
0.52392578125,
0.093017578125,
0.71923828125,
0.8896484375,
-0.3349609375,
0.1422119140625,
0.15576171875,
0.9873046875,
0.5576171875,
0.6630859375,
-0.0693359375,
0.5498046875,
0.0196990966796875,
0.339599609375,
0.1331787109375,
0.3232421875,
-0.06805419921875,
0.587890625,
0.3623046875,
0.2705078125,
-0.810546875,
-0.07330322265625,
0.41357421875,
0.75244140625,
-0.499755859375,
-0.46923828125,
-0.2078857421875,
0.089111328125,
0.25927734375,
0.303955078125,
0.4638671875,
0.3623046875,
0.1011962890625,
0.7353515625,
-0.279296875,
-0.03326416015625,
-0.414794921875,
-0.978515625,
-0.6689453125,
-0.3623046875,
-0.365478515625,
0.07989501953125,
0.2435302734375,
-0.869140625,
0.403564453125,
-0.177490234375,
-0.004192352294921875,
-0.437255859375,
-0.75244140625,
0.3515625,
-0.6787109375,
0.962890625,
-0.314697265625,
0.4072265625,
-0.2113037109375,
0.6669921875,
-0.2802734375,
-0.56982421875,
-0.198486328125,
-0.6435546875,
0.35546875,
0.0291748046875,
0.273681640625,
-0.178466796875,
-0.880859375,
-0.810546875,
-0.2174072265625,
-0.0283966064453125,
-0.299072265625,
0.4541015625,
-0.53466796875,
0.85693359375,
0.036865234375,
-0.6533203125,
0.52734375,
0.599609375,
-1.1875,
0.99072265625,
0.3466796875,
0.47705078125,
-0.82177734375,
0.9072265625,
0.375732421875,
0.37841796875,
-0.5244140625,
-0.6279296875,
-0.51513671875,
-0.0865478515625,
0.390625,
-0.5703125,
-0.12420654296875,
-0.023651123046875,
0.378173828125,
-1.220703125,
0.60107421875,
-0.83544921875,
-0.5546875,
-0.78173828125,
-0.578125,
0.6923828125,
0.5185546875,
0.253173828125,
0.08905029296875,
-0.377685546875,
-0.027252197265625,
0.54541015625,
0.70166015625,
-0.489990234375,
0.041595458984375,
0.55712890625,
-0.06695556640625,
0.287841796875,
0.487060546875,
-0.5986328125,
-0.1634521484375,
-0.019927978515625,
0.619140625,
0.484375,
0.0799560546875,
0.311279296875,
0.121337890625,
-0.057037353515625,
-0.3935546875,
-0.1070556640625,
-0.1427001953125,
0.45703125,
0.408935546875,
0.419677734375,
0.1817626953125,
-0.47021484375,
-0.406494140625,
-1.0771484375,
0.388427734375,
0.0343017578125,
0.5390625,
-0.876953125,
1.072265625,
0.035797119140625,
-0.42333984375,
0.44189453125,
-0.37744140625,
0.179931640625,
1.0576171875,
0.1739501953125,
0.49365234375,
-0.90673828125,
0.1385498046875,
-0.35009765625,
0.294189453125,
0.3955078125,
0.64404296875,
0.4560546875,
-0.52490234375,
-0.42822265625,
-0.52197265625,
-0.166015625,
-0.2093505859375,
-0.57763671875,
0.07745361328125,
-0.8876953125,
-0.1292724609375,
-0.82177734375,
0.64404296875,
0.76611328125,
0.52978515625,
0.07342529296875,
1.0966796875,
0.08551025390625,
0.37841796875,
0.463134765625,
-0.220947265625,
0.11541748046875,
-0.71337890625,
1.0234375,
-0.29248046875,
-0.2587890625,
-0.435302734375,
-0.2293701171875,
-0.28125,
0.002445220947265625,
-0.188720703125,
0.26708984375,
-0.6572265625,
0.02215576171875,
0.349609375,
0.281005859375,
-0.63916015625,
-0.541015625,
-0.07769775390625,
0.46533203125,
0.51513671875,
-0.859375,
0.5263671875,
-1.0712890625,
0.2413330078125,
0.454345703125,
-0.1317138671875,
-0.79443359375,
-0.420166015625,
-0.6474609375,
-0.689453125,
0.158203125,
0.85302734375,
0.179443359375,
0.180419921875,
-0.71337890625,
0.533203125,
0.1962890625,
-0.2646484375,
0.2042236328125,
-0.2269287109375,
0.6181640625,
-0.07440185546875,
0.833984375,
-0.296630859375,
-0.9453125,
0.437255859375,
-1.0078125,
0.53466796875,
-0.64697265625,
0.5126953125,
0.0909423828125,
-0.407958984375,
0.142822265625,
0.84326171875,
-0.10467529296875,
0.129638671875,
-0.369140625,
0.11187744140625,
-0.90283203125,
-0.71728515625,
0.326171875,
-0.1529541015625,
-0.18310546875,
0.80322265625,
-0.11859130859375,
-0.375244140625,
0.09716796875,
0.60498046875,
-0.57421875,
0.305908203125,
-0.73291015625,
0.552734375,
-0.2802734375,
-0.65771484375,
0.09771728515625,
-0.654296875,
0.56005859375,
-0.0167388916015625,
-0.374755859375,
-0.36181640625,
-1.2568359375,
-0.42822265625,
0.06280517578125,
-0.53955078125,
0.31787109375,
-0.0218353271484375,
-0.33154296875,
-0.374755859375,
-0.220703125,
-1.099609375,
-0.068359375,
-0.23681640625,
-0.22412109375,
-0.190185546875,
0.15380859375,
0.27490234375,
0.11328125,
-0.2010498046875,
0.19970703125,
-0.155517578125,
-0.01873779296875,
-0.46923828125,
-0.90869140625,
0.344482421875,
-0.1864013671875,
0.333740234375,
0.41796875,
-0.352294921875,
0.437255859375,
0.77490234375,
0.035369873046875,
0.270263671875,
0.282958984375,
-0.41943359375,
0.81591796875,
-0.0867919921875,
-0.95068359375,
-0.548828125,
0.720703125,
0.0870361328125,
0.459716796875,
0.19677734375,
-0.9287109375,
-1.1640625,
-0.9296875,
0.50048828125,
-0.14208984375,
-0.490966796875,
-0.81982421875,
-0.6484375,
-0.0301513671875,
0.38818359375,
0.08251953125,
-0.603515625,
0.304443359375,
-1.109375,
0.1539306640625,
-0.456298828125,
-0.40966796875,
-0.93359375,
-0.63916015625,
-0.02093505859375,
1.2021484375,
0.373291015625,
0.6767578125,
-0.038787841796875,
-0.244873046875,
-0.03131103515625,
0.180419921875,
-0.2802734375,
-0.8486328125,
-0.037994384765625,
-0.392333984375,
0.06475830078125,
-0.2254638671875,
-0.353515625,
0.91259765625,
-1.0185546875,
0.26953125,
-0.489013671875,
-0.90380859375,
-0.241455078125,
-0.097900390625,
1.265625,
-0.37109375,
-0.040191650390625,
-0.02972412109375,
0.53173828125,
0.533203125,
-0.140380859375,
-0.69140625,
-0.5263671875,
-0.78076171875,
-1.1083984375,
0.60498046875,
-0.59912109375,
0.279541015625,
-0.55419921875,
-0.04132080078125,
1.064453125,
-0.4560546875,
0.447509765625,
0.87158203125,
-0.0262603759765625,
0.263916015625,
-0.479248046875,
0.5302734375,
0.53515625,
-0.51611328125,
-0.31005859375,
0.181884765625,
-0.58544921875,
0.4365234375,
-0.3994140625,
-1.0751953125,
-0.72509765625,
0.1727294921875,
1.0751953125,
-0.3544921875,
0.73779296875,
0.022796630859375,
-1.2041015625,
-0.49658203125,
0.552734375,
0.177490234375,
0.06585693359375,
0.38037109375,
-0.402099609375,
-0.06329345703125,
-0.09808349609375,
-0.15576171875,
-0.2418212890625,
-0.494140625,
1.185546875,
0.352783203125,
-0.360107421875,
1.1298828125,
1.015625,
-0.63037109375,
-0.89501953125,
-0.327880859375,
-0.057891845703125,
-0.446044921875,
-0.93115234375,
0.17919921875,
0.448974609375,
-0.65771484375,
0.1761474609375,
0.388671875,
-0.336181640625,
0.452880859375,
0.314697265625,
0.2261962890625,
-0.389892578125,
0.61083984375,
0.396484375,
-0.7080078125,
-0.26220703125,
-1.087890625,
-0.2152099609375,
-0.376708984375,
-0.0307464599609375,
0.99951171875,
-0.18408203125,
-0.032470703125,
0.4384765625,
-0.4482421875,
0.99951171875,
-0.495849609375,
-0.3095703125,
0.0096435546875,
-0.85107421875,
-0.362060546875,
-0.0794677734375,
0.489013671875,
-0.346435546875,
0.037200927734375,
-1.0107421875,
0.1060791015625,
0.58984375,
0.391357421875,
0.0926513671875,
-0.9716796875,
-0.125732421875,
-1.1484375,
-0.170654296875,
-0.2142333984375,
-0.33740234375,
0.038238525390625,
0.50390625,
0.276123046875,
-0.09405517578125,
0.236083984375,
0.8671875,
-0.323486328125,
0.75439453125,
-0.68310546875,
0.39208984375,
-0.354248046875,
-0.384521484375,
-0.40673828125,
0.06365966796875,
-0.52001953125,
-0.07611083984375,
-0.472900390625,
0.60546875,
0.07122802734375,
0.426025390625,
-0.63330078125,
0.38037109375,
0.07281494140625,
-0.264404296875,
0.1864013671875,
-0.1900634765625,
-0.464111328125,
0.58984375,
0.61962890625,
-0.0374755859375,
0.29736328125,
-0.09326171875,
-0.344482421875,
-0.314697265625,
0.58154296875,
0.366455078125,
-0.206298828125,
-0.53125,
-0.54541015625,
-0.1383056640625,
-0.703125,
-0.0250396728515625,
-0.2296142578125,
0.1383056640625,
-0.2025146484375,
-0.292236328125,
0.470947265625,
1.1865234375,
-0.0716552734375,
0.32080078125,
0.08514404296875,
0.259521484375,
0.564453125,
-0.17724609375,
0.2100830078125,
0.395751953125,
0.448486328125,
-0.57568359375,
0.042938232421875,
0.67333984375,
-0.31689453125,
0.241455078125,
-0.236083984375,
-0.65478515625,
-0.99072265625,
-0.1192626953125,
0.0880126953125,
0.63720703125,
0.198486328125,
-0.12158203125,
0.371337890625,
-0.448486328125,
-0.8486328125,
0.15673828125,
-1.0673828125,
-0.763671875,
0.3115234375,
0.20361328125,
-0.421630859375,
-0.2371826171875,
-0.67919921875,
-0.39306640625,
0.2269287109375,
0.41015625,
0.03472900390625,
0.04608154296875,
-0.11614990234375,
0.50390625,
-0.5732421875,
-0.082275390625,
0.284912109375,
0.332763671875,
-0.417724609375,
-0.59912109375,
0.325439453125,
0.99267578125,
0.098876953125,
0.134033203125,
-0.480712890625,
0.6435546875,
0.053985595703125,
0.259033203125,
-0.1353759765625,
0.004230499267578125,
0.06304931640625,
0.46044921875,
-0.87255859375,
-0.0775146484375,
-0.1429443359375,
0.1505126953125,
0.0411376953125,
-0.31689453125,
-0.414306640625,
0.52685546875,
0.78173828125,
-0.1595458984375,
0.1732177734375,
0.48681640625,
0.394775390625,
-0.546875,
-0.1846923828125,
-0.432373046875,
1.095703125,
0.72998046875,
0.53369140625,
0.045166015625,
0.59375,
0.78173828125,
-0.112060546875,
-0.20947265625,
0.8701171875,
0.55908203125,
-0.442626953125,
-0.11431884765625,
0.12548828125,
0.05523681640625,
-0.13330078125,
-0.447021484375,
0.548828125,
-0.488037109375,
-0.33935546875,
0.1353759765625,
-0.62890625,
1.26171875,
-0.2978515625,
-0.5087890625,
0.236083984375,
-0.3427734375,
-0.0010671615600585938,
1.04296875,
0.2073974609375,
-0.1715087890625,
0.900390625,
0.23681640625,
0.59912109375,
0.8271484375,
0.2054443359375,
0.264892578125,
-0.74462890625,
-0.261474609375,
0.10400390625,
-0.281982421875,
-0.7578125,
-0.357421875,
-0.8203125,
0.3740234375,
-0.51318359375,
-0.01947021484375,
0.475830078125,
-0.89892578125,
-0.062744140625,
-0.50244140625,
0.7744140625,
-0.8115234375,
0.2763671875,
0.3740234375,
-0.16357421875,
-0.59228515625,
0.517578125,
-0.1527099609375,
0.218505859375,
0.2308349609375,
0.779296875,
0.477294921875,
1.2548828125,
0.2305908203125,
-0.34521484375,
-0.11456298828125,
0.243896484375,
-0.2880859375,
-0.7216796875,
-0.0938720703125,
-0.3779296875,
0.129638671875,
-0.828125,
-0.1956787109375,
-0.08612060546875,
0.515625,
-0.359619140625,
-1.02734375,
-0.29736328125,
-0.006664276123046875,
-0.0189971923828125,
0.06927490234375,
0.141357421875,
-0.1260986328125,
0.0787353515625,
0.36083984375,
-0.1328125,
-0.80126953125,
0.0272064208984375,
-0.55615234375,
0.475830078125,
-0.1402587890625,
-0.74658203125,
-0.857421875,
-0.34130859375,
0.01496124267578125,
0.225341796875,
-0.4931640625,
-0.83544921875,
0.541015625,
0.3095703125,
0.29638671875,
0.36767578125,
-0.1514892578125,
0.01267242431640625,
0.92138671875,
0.91259765625,
0.093505859375,
1.056640625,
0.2880859375,
-0.08740234375,
0.53662109375,
-0.15185546875,
0.5546875,
-0.279052734375,
0.2352294921875,
-0.426513671875,
0.468994140625,
-0.10040283203125,
-1.228515625,
0.1197509765625,
0.712890625,
0.463623046875,
-0.67578125,
-1.3388671875,
-0.454833984375,
-0.72119140625,
-0.0814208984375,
-0.61767578125,
0.63232421875,
-0.10736083984375,
0.158203125,
-0.1737060546875,
-1.453125,
4.5,
1.1279296875,
0.456787109375,
0.424560546875,
0.2529296875,
0.72265625,
0.36474609375,
-0.708984375,
0.08367919921875,
-0.5361328125,
0.339599609375,
-0.30224609375,
-0.081787109375,
0.7080078125,
0.6826171875,
0.9248046875,
-0.48486328125,
-0.20263671875,
-0.279296875,
-0.697265625,
-0.72998046875,
0.07366943359375,
-0.1495361328125,
0.184326171875,
0.305908203125,
0.419677734375,
0.23046875,
-0.95263671875,
-0.049652099609375,
-0.411865234375,
0.1329345703125,
-0.59716796875,
0.5556640625,
-0.56494140625,
-0.34033203125,
0.283203125,
-0.2257080078125,
-0.7392578125,
-0.339111328125,
0.09912109375,
0.09906005859375,
0.0633544921875,
0.71826171875,
-0.2666015625,
0.74072265625,
0.46875,
-0.65771484375,
0.89404296875,
0.06610107421875,
-0.92333984375,
1.078125,
-0.409912109375,
0.247314453125,
-0.325439453125,
-0.83740234375,
-0.02545166015625,
-0.11199951171875,
-0.3486328125,
-0.168212890625,
0.57177734375,
0.214599609375,
-0.0228424072265625,
0.33349609375,
0.607421875,
-1.037109375,
1.013671875,
0.119140625,
0.5185546875,
-0.2032470703125,
-0.16259765625,
-0.05224609375,
-0.47607421875,
-0.1409912109375,
0.11431884765625,
0.64306640625,
-0.058380126953125,
-0.05810546875,
0.568359375,
0.9208984375,
-0.83837890625,
-0.11212158203125,
-0.381103515625,
-0.72607421875,
-0.63916015625,
0.54541015625,
1.0498046875,
-0.494873046875,
-0.0816650390625,
-0.298828125,
0.60302734375,
0.4326171875,
0.378173828125,
-0.1627197265625,
-0.4365234375,
-0.55078125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
After you had helped Fedor to find friends in the «Call of Soldiers 3» game, he stopped studying completely. Today, the English teacher told him to prepare an essay. Fedor didn't want to prepare the essay, so he asked Alex for help. Alex came to help and wrote the essay for Fedor. But Fedor didn't like the essay at all. Now Fedor is going to change the essay using the synonym dictionary of the English language.
Fedor does not want to change the meaning of the essay. So the only change he would do: change a word from essay to one of its synonyms, basing on a replacement rule from the dictionary. Fedor may perform this operation any number of times.
As a result, Fedor wants to get an essay which contains as little letters «R» (the case doesn't matter) as possible. If there are multiple essays with minimum number of «R»s he wants to get the one with minimum length (length of essay is the sum of the lengths of all the words in it). Help Fedor get the required essay.
Please note that in this problem the case of letters doesn't matter. For example, if the synonym dictionary says that word cat can be replaced with word DOG, then it is allowed to replace the word Cat with the word doG.
Input
The first line contains a single integer m (1 ≤ m ≤ 105) — the number of words in the initial essay. The second line contains words of the essay. The words are separated by a single space. It is guaranteed that the total length of the words won't exceed 105 characters.
The next line contains a single integer n (0 ≤ n ≤ 105) — the number of pairs of words in synonym dictionary. The i-th of the next n lines contains two space-separated non-empty words xi and yi. They mean that word xi can be replaced with word yi (but not vise versa). It is guaranteed that the total length of all pairs of synonyms doesn't exceed 5·105 characters.
All the words at input can only consist of uppercase and lowercase letters of the English alphabet.
Output
Print two integers — the minimum number of letters «R» in an optimal essay and the minimum length of an optimal essay.
Examples
Input
3
AbRb r Zz
4
xR abRb
aA xr
zz Z
xr y
Output
2 6
Input
2
RuruRu fedya
1
ruruRU fedor
Output
1 10
Tags: dfs and similar, dp, graphs, hashing, strings
Correct Solution:
```
import collections
def solve():
m = int(input())
essay = [s for s in input().lower().split()]
n = int(input())
sti = dict()
pack = lambda word: (word.count('r'), len(word), sti.setdefault(word, len(sti)))
edge = collections.defaultdict(list)
nodes = list()
for _ in range(n):
word, synon = map(pack, input().lower().split())
edge[synon[-1]].append(word[-1])
nodes.append(word)
nodes.append(synon)
nodes.sort()
best = dict()
for node in nodes:
if node[2] not in best:
stack = [node[2]]
while stack:
top = stack.pop()
if top not in best:
best[top] = node[:2]
for n in edge[top]:
if n is not best:
stack.append(n)
tr = 0
tl = 0
for word in essay:
if word in sti:
wid = sti[word]
tr += best[wid][0]
tl += best[wid][1]
else:
tr += word.count('r')
tl += len(word)
print(tr, ' ', tl)
if __name__ == '__main__':
solve()
```
| 44,946
|
[
0.3134765625,
-0.4443359375,
0.380615234375,
0.440673828125,
-0.70263671875,
-0.372314453125,
0.2359619140625,
-0.02496337890625,
-0.41162109375,
0.51513671875,
1.322265625,
0.12548828125,
-0.0836181640625,
-0.73779296875,
-0.431884765625,
0.0242767333984375,
-0.25146484375,
-0.76806640625,
-0.4541015625,
0.11907958984375,
0.069091796875,
0.09527587890625,
-1.25390625,
0.161865234375,
-0.342529296875,
0.8173828125,
0.06085205078125,
0.62451171875,
0.9384765625,
0.463623046875,
-0.14599609375,
-0.03643798828125,
0.11566162109375,
-0.73388671875,
-0.51708984375,
-0.56884765625,
0.3349609375,
-0.56298828125,
-0.310546875,
-0.306884765625,
0.382080078125,
-0.6806640625,
0.57177734375,
-0.51806640625,
-1.0703125,
0.072998046875,
-0.53515625,
-0.472412109375,
-0.184814453125,
-0.6015625,
0.51904296875,
-0.38232421875,
0.313720703125,
-0.299072265625,
0.059112548828125,
-0.67822265625,
-0.3388671875,
0.34326171875,
-0.496826171875,
0.01201629638671875,
0.65625,
0.217529296875,
-0.438720703125,
-0.459716796875,
-0.3515625,
0.2109375,
-0.060211181640625,
-0.1356201171875,
-0.0858154296875,
-0.43505859375,
-0.21630859375,
-0.0303802490234375,
-0.09649658203125,
-0.45263671875,
-0.044342041015625,
0.06256103515625,
1.1884765625,
-0.6171875,
-0.341552734375,
0.67529296875,
0.1478271484375,
1.2451171875,
0.187744140625,
-0.1878662109375,
-0.572265625,
-0.4931640625,
0.162353515625,
0.39794921875,
0.039215087890625,
-0.1339111328125,
-0.2337646484375,
0.65283203125,
-0.48681640625,
-0.158203125,
0.5224609375,
0.415283203125,
-0.2783203125,
0.287109375,
0.02783203125,
-0.20947265625,
0.8564453125,
0.822265625,
-0.0247955322265625,
0.77197265625,
-0.465576171875,
0.058746337890625,
0.07318115234375,
-0.1861572265625,
0.2305908203125,
-0.2315673828125,
-0.269775390625,
0.020782470703125,
0.666015625,
0.52734375,
-0.315673828125,
0.7978515625,
-0.398193359375,
0.8515625,
-0.83544921875,
0.319580078125,
0.395751953125,
0.11480712890625,
0.179931640625,
-0.46044921875,
0.1680908203125,
-0.96923828125,
-0.6455078125,
0.6953125,
-0.48974609375,
-0.116455078125,
0.3974609375,
0.01282501220703125,
0.03131103515625,
0.5625,
-0.0931396484375,
0.380615234375,
0.0875244140625,
0.255126953125,
0.8818359375,
-0.64453125,
0.72412109375,
-0.1826171875,
0.043121337890625,
1.0830078125,
0.6455078125,
0.05706787109375,
0.501953125,
0.0845947265625,
-0.7353515625,
0.65576171875,
-0.85302734375,
0.8056640625,
0.2117919921875,
0.414794921875,
-0.1634521484375,
0.2359619140625,
0.005176544189453125,
0.490966796875,
0.5390625,
0.364013671875,
-0.181884765625,
0.1204833984375,
-0.5166015625,
1.09375,
-0.114013671875,
0.75537109375,
-0.6640625,
-0.11199951171875,
-0.61767578125,
-0.366943359375,
0.5986328125,
-0.1842041015625,
-0.048370361328125,
0.45166015625,
0.0233306884765625,
1.107421875,
0.6748046875,
-0.121826171875,
0.05096435546875,
0.456787109375,
-0.448486328125,
-0.0687255859375,
0.4169921875,
0.4765625,
0.12286376953125,
-0.0269775390625,
-0.28857421875,
-0.483642578125,
-0.58984375,
-1.0556640625,
0.0777587890625,
0.449462890625,
-0.2109375,
-0.12054443359375,
0.2069091796875,
0.2227783203125,
-0.72607421875,
-0.444091796875,
0.35107421875,
-0.60107421875,
-0.5146484375,
0.82861328125,
-0.72314453125,
0.351806640625,
-0.1497802734375,
-0.568359375,
0.1424560546875,
1.0166015625,
-0.1322021484375,
0.2340087890625,
0.65478515625,
0.477294921875,
-0.24365234375,
-0.251220703125,
0.045318603515625,
-0.31298828125,
-0.61328125,
0.78271484375,
-0.60546875,
0.120361328125,
0.298583984375,
0.401611328125,
0.34716796875,
0.255126953125,
0.431640625,
-0.650390625,
0.8134765625,
1.46875,
-0.271728515625,
0.77587890625,
0.370849609375,
0.908203125,
0.2978515625,
0.77001953125,
0.52392578125,
0.093017578125,
0.71923828125,
0.8896484375,
-0.3349609375,
0.1422119140625,
0.15576171875,
0.9873046875,
0.5576171875,
0.6630859375,
-0.0693359375,
0.5498046875,
0.0196990966796875,
0.339599609375,
0.1331787109375,
0.3232421875,
-0.06805419921875,
0.587890625,
0.3623046875,
0.2705078125,
-0.810546875,
-0.07330322265625,
0.41357421875,
0.75244140625,
-0.499755859375,
-0.46923828125,
-0.2078857421875,
0.089111328125,
0.25927734375,
0.303955078125,
0.4638671875,
0.3623046875,
0.1011962890625,
0.7353515625,
-0.279296875,
-0.03326416015625,
-0.414794921875,
-0.978515625,
-0.6689453125,
-0.3623046875,
-0.365478515625,
0.07989501953125,
0.2435302734375,
-0.869140625,
0.403564453125,
-0.177490234375,
-0.004192352294921875,
-0.437255859375,
-0.75244140625,
0.3515625,
-0.6787109375,
0.962890625,
-0.314697265625,
0.4072265625,
-0.2113037109375,
0.6669921875,
-0.2802734375,
-0.56982421875,
-0.198486328125,
-0.6435546875,
0.35546875,
0.0291748046875,
0.273681640625,
-0.178466796875,
-0.880859375,
-0.810546875,
-0.2174072265625,
-0.0283966064453125,
-0.299072265625,
0.4541015625,
-0.53466796875,
0.85693359375,
0.036865234375,
-0.6533203125,
0.52734375,
0.599609375,
-1.1875,
0.99072265625,
0.3466796875,
0.47705078125,
-0.82177734375,
0.9072265625,
0.375732421875,
0.37841796875,
-0.5244140625,
-0.6279296875,
-0.51513671875,
-0.0865478515625,
0.390625,
-0.5703125,
-0.12420654296875,
-0.023651123046875,
0.378173828125,
-1.220703125,
0.60107421875,
-0.83544921875,
-0.5546875,
-0.78173828125,
-0.578125,
0.6923828125,
0.5185546875,
0.253173828125,
0.08905029296875,
-0.377685546875,
-0.027252197265625,
0.54541015625,
0.70166015625,
-0.489990234375,
0.041595458984375,
0.55712890625,
-0.06695556640625,
0.287841796875,
0.487060546875,
-0.5986328125,
-0.1634521484375,
-0.019927978515625,
0.619140625,
0.484375,
0.0799560546875,
0.311279296875,
0.121337890625,
-0.057037353515625,
-0.3935546875,
-0.1070556640625,
-0.1427001953125,
0.45703125,
0.408935546875,
0.419677734375,
0.1817626953125,
-0.47021484375,
-0.406494140625,
-1.0771484375,
0.388427734375,
0.0343017578125,
0.5390625,
-0.876953125,
1.072265625,
0.035797119140625,
-0.42333984375,
0.44189453125,
-0.37744140625,
0.179931640625,
1.0576171875,
0.1739501953125,
0.49365234375,
-0.90673828125,
0.1385498046875,
-0.35009765625,
0.294189453125,
0.3955078125,
0.64404296875,
0.4560546875,
-0.52490234375,
-0.42822265625,
-0.52197265625,
-0.166015625,
-0.2093505859375,
-0.57763671875,
0.07745361328125,
-0.8876953125,
-0.1292724609375,
-0.82177734375,
0.64404296875,
0.76611328125,
0.52978515625,
0.07342529296875,
1.0966796875,
0.08551025390625,
0.37841796875,
0.463134765625,
-0.220947265625,
0.11541748046875,
-0.71337890625,
1.0234375,
-0.29248046875,
-0.2587890625,
-0.435302734375,
-0.2293701171875,
-0.28125,
0.002445220947265625,
-0.188720703125,
0.26708984375,
-0.6572265625,
0.02215576171875,
0.349609375,
0.281005859375,
-0.63916015625,
-0.541015625,
-0.07769775390625,
0.46533203125,
0.51513671875,
-0.859375,
0.5263671875,
-1.0712890625,
0.2413330078125,
0.454345703125,
-0.1317138671875,
-0.79443359375,
-0.420166015625,
-0.6474609375,
-0.689453125,
0.158203125,
0.85302734375,
0.179443359375,
0.180419921875,
-0.71337890625,
0.533203125,
0.1962890625,
-0.2646484375,
0.2042236328125,
-0.2269287109375,
0.6181640625,
-0.07440185546875,
0.833984375,
-0.296630859375,
-0.9453125,
0.437255859375,
-1.0078125,
0.53466796875,
-0.64697265625,
0.5126953125,
0.0909423828125,
-0.407958984375,
0.142822265625,
0.84326171875,
-0.10467529296875,
0.129638671875,
-0.369140625,
0.11187744140625,
-0.90283203125,
-0.71728515625,
0.326171875,
-0.1529541015625,
-0.18310546875,
0.80322265625,
-0.11859130859375,
-0.375244140625,
0.09716796875,
0.60498046875,
-0.57421875,
0.305908203125,
-0.73291015625,
0.552734375,
-0.2802734375,
-0.65771484375,
0.09771728515625,
-0.654296875,
0.56005859375,
-0.0167388916015625,
-0.374755859375,
-0.36181640625,
-1.2568359375,
-0.42822265625,
0.06280517578125,
-0.53955078125,
0.31787109375,
-0.0218353271484375,
-0.33154296875,
-0.374755859375,
-0.220703125,
-1.099609375,
-0.068359375,
-0.23681640625,
-0.22412109375,
-0.190185546875,
0.15380859375,
0.27490234375,
0.11328125,
-0.2010498046875,
0.19970703125,
-0.155517578125,
-0.01873779296875,
-0.46923828125,
-0.90869140625,
0.344482421875,
-0.1864013671875,
0.333740234375,
0.41796875,
-0.352294921875,
0.437255859375,
0.77490234375,
0.035369873046875,
0.270263671875,
0.282958984375,
-0.41943359375,
0.81591796875,
-0.0867919921875,
-0.95068359375,
-0.548828125,
0.720703125,
0.0870361328125,
0.459716796875,
0.19677734375,
-0.9287109375,
-1.1640625,
-0.9296875,
0.50048828125,
-0.14208984375,
-0.490966796875,
-0.81982421875,
-0.6484375,
-0.0301513671875,
0.38818359375,
0.08251953125,
-0.603515625,
0.304443359375,
-1.109375,
0.1539306640625,
-0.456298828125,
-0.40966796875,
-0.93359375,
-0.63916015625,
-0.02093505859375,
1.2021484375,
0.373291015625,
0.6767578125,
-0.038787841796875,
-0.244873046875,
-0.03131103515625,
0.180419921875,
-0.2802734375,
-0.8486328125,
-0.037994384765625,
-0.392333984375,
0.06475830078125,
-0.2254638671875,
-0.353515625,
0.91259765625,
-1.0185546875,
0.26953125,
-0.489013671875,
-0.90380859375,
-0.241455078125,
-0.097900390625,
1.265625,
-0.37109375,
-0.040191650390625,
-0.02972412109375,
0.53173828125,
0.533203125,
-0.140380859375,
-0.69140625,
-0.5263671875,
-0.78076171875,
-1.1083984375,
0.60498046875,
-0.59912109375,
0.279541015625,
-0.55419921875,
-0.04132080078125,
1.064453125,
-0.4560546875,
0.447509765625,
0.87158203125,
-0.0262603759765625,
0.263916015625,
-0.479248046875,
0.5302734375,
0.53515625,
-0.51611328125,
-0.31005859375,
0.181884765625,
-0.58544921875,
0.4365234375,
-0.3994140625,
-1.0751953125,
-0.72509765625,
0.1727294921875,
1.0751953125,
-0.3544921875,
0.73779296875,
0.022796630859375,
-1.2041015625,
-0.49658203125,
0.552734375,
0.177490234375,
0.06585693359375,
0.38037109375,
-0.402099609375,
-0.06329345703125,
-0.09808349609375,
-0.15576171875,
-0.2418212890625,
-0.494140625,
1.185546875,
0.352783203125,
-0.360107421875,
1.1298828125,
1.015625,
-0.63037109375,
-0.89501953125,
-0.327880859375,
-0.057891845703125,
-0.446044921875,
-0.93115234375,
0.17919921875,
0.448974609375,
-0.65771484375,
0.1761474609375,
0.388671875,
-0.336181640625,
0.452880859375,
0.314697265625,
0.2261962890625,
-0.389892578125,
0.61083984375,
0.396484375,
-0.7080078125,
-0.26220703125,
-1.087890625,
-0.2152099609375,
-0.376708984375,
-0.0307464599609375,
0.99951171875,
-0.18408203125,
-0.032470703125,
0.4384765625,
-0.4482421875,
0.99951171875,
-0.495849609375,
-0.3095703125,
0.0096435546875,
-0.85107421875,
-0.362060546875,
-0.0794677734375,
0.489013671875,
-0.346435546875,
0.037200927734375,
-1.0107421875,
0.1060791015625,
0.58984375,
0.391357421875,
0.0926513671875,
-0.9716796875,
-0.125732421875,
-1.1484375,
-0.170654296875,
-0.2142333984375,
-0.33740234375,
0.038238525390625,
0.50390625,
0.276123046875,
-0.09405517578125,
0.236083984375,
0.8671875,
-0.323486328125,
0.75439453125,
-0.68310546875,
0.39208984375,
-0.354248046875,
-0.384521484375,
-0.40673828125,
0.06365966796875,
-0.52001953125,
-0.07611083984375,
-0.472900390625,
0.60546875,
0.07122802734375,
0.426025390625,
-0.63330078125,
0.38037109375,
0.07281494140625,
-0.264404296875,
0.1864013671875,
-0.1900634765625,
-0.464111328125,
0.58984375,
0.61962890625,
-0.0374755859375,
0.29736328125,
-0.09326171875,
-0.344482421875,
-0.314697265625,
0.58154296875,
0.366455078125,
-0.206298828125,
-0.53125,
-0.54541015625,
-0.1383056640625,
-0.703125,
-0.0250396728515625,
-0.2296142578125,
0.1383056640625,
-0.2025146484375,
-0.292236328125,
0.470947265625,
1.1865234375,
-0.0716552734375,
0.32080078125,
0.08514404296875,
0.259521484375,
0.564453125,
-0.17724609375,
0.2100830078125,
0.395751953125,
0.448486328125,
-0.57568359375,
0.042938232421875,
0.67333984375,
-0.31689453125,
0.241455078125,
-0.236083984375,
-0.65478515625,
-0.99072265625,
-0.1192626953125,
0.0880126953125,
0.63720703125,
0.198486328125,
-0.12158203125,
0.371337890625,
-0.448486328125,
-0.8486328125,
0.15673828125,
-1.0673828125,
-0.763671875,
0.3115234375,
0.20361328125,
-0.421630859375,
-0.2371826171875,
-0.67919921875,
-0.39306640625,
0.2269287109375,
0.41015625,
0.03472900390625,
0.04608154296875,
-0.11614990234375,
0.50390625,
-0.5732421875,
-0.082275390625,
0.284912109375,
0.332763671875,
-0.417724609375,
-0.59912109375,
0.325439453125,
0.99267578125,
0.098876953125,
0.134033203125,
-0.480712890625,
0.6435546875,
0.053985595703125,
0.259033203125,
-0.1353759765625,
0.004230499267578125,
0.06304931640625,
0.46044921875,
-0.87255859375,
-0.0775146484375,
-0.1429443359375,
0.1505126953125,
0.0411376953125,
-0.31689453125,
-0.414306640625,
0.52685546875,
0.78173828125,
-0.1595458984375,
0.1732177734375,
0.48681640625,
0.394775390625,
-0.546875,
-0.1846923828125,
-0.432373046875,
1.095703125,
0.72998046875,
0.53369140625,
0.045166015625,
0.59375,
0.78173828125,
-0.112060546875,
-0.20947265625,
0.8701171875,
0.55908203125,
-0.442626953125,
-0.11431884765625,
0.12548828125,
0.05523681640625,
-0.13330078125,
-0.447021484375,
0.548828125,
-0.488037109375,
-0.33935546875,
0.1353759765625,
-0.62890625,
1.26171875,
-0.2978515625,
-0.5087890625,
0.236083984375,
-0.3427734375,
-0.0010671615600585938,
1.04296875,
0.2073974609375,
-0.1715087890625,
0.900390625,
0.23681640625,
0.59912109375,
0.8271484375,
0.2054443359375,
0.264892578125,
-0.74462890625,
-0.261474609375,
0.10400390625,
-0.281982421875,
-0.7578125,
-0.357421875,
-0.8203125,
0.3740234375,
-0.51318359375,
-0.01947021484375,
0.475830078125,
-0.89892578125,
-0.062744140625,
-0.50244140625,
0.7744140625,
-0.8115234375,
0.2763671875,
0.3740234375,
-0.16357421875,
-0.59228515625,
0.517578125,
-0.1527099609375,
0.218505859375,
0.2308349609375,
0.779296875,
0.477294921875,
1.2548828125,
0.2305908203125,
-0.34521484375,
-0.11456298828125,
0.243896484375,
-0.2880859375,
-0.7216796875,
-0.0938720703125,
-0.3779296875,
0.129638671875,
-0.828125,
-0.1956787109375,
-0.08612060546875,
0.515625,
-0.359619140625,
-1.02734375,
-0.29736328125,
-0.006664276123046875,
-0.0189971923828125,
0.06927490234375,
0.141357421875,
-0.1260986328125,
0.0787353515625,
0.36083984375,
-0.1328125,
-0.80126953125,
0.0272064208984375,
-0.55615234375,
0.475830078125,
-0.1402587890625,
-0.74658203125,
-0.857421875,
-0.34130859375,
0.01496124267578125,
0.225341796875,
-0.4931640625,
-0.83544921875,
0.541015625,
0.3095703125,
0.29638671875,
0.36767578125,
-0.1514892578125,
0.01267242431640625,
0.92138671875,
0.91259765625,
0.093505859375,
1.056640625,
0.2880859375,
-0.08740234375,
0.53662109375,
-0.15185546875,
0.5546875,
-0.279052734375,
0.2352294921875,
-0.426513671875,
0.468994140625,
-0.10040283203125,
-1.228515625,
0.1197509765625,
0.712890625,
0.463623046875,
-0.67578125,
-1.3388671875,
-0.454833984375,
-0.72119140625,
-0.0814208984375,
-0.61767578125,
0.63232421875,
-0.10736083984375,
0.158203125,
-0.1737060546875,
-1.453125,
4.5,
1.1279296875,
0.456787109375,
0.424560546875,
0.2529296875,
0.72265625,
0.36474609375,
-0.708984375,
0.08367919921875,
-0.5361328125,
0.339599609375,
-0.30224609375,
-0.081787109375,
0.7080078125,
0.6826171875,
0.9248046875,
-0.48486328125,
-0.20263671875,
-0.279296875,
-0.697265625,
-0.72998046875,
0.07366943359375,
-0.1495361328125,
0.184326171875,
0.305908203125,
0.419677734375,
0.23046875,
-0.95263671875,
-0.049652099609375,
-0.411865234375,
0.1329345703125,
-0.59716796875,
0.5556640625,
-0.56494140625,
-0.34033203125,
0.283203125,
-0.2257080078125,
-0.7392578125,
-0.339111328125,
0.09912109375,
0.09906005859375,
0.0633544921875,
0.71826171875,
-0.2666015625,
0.74072265625,
0.46875,
-0.65771484375,
0.89404296875,
0.06610107421875,
-0.92333984375,
1.078125,
-0.409912109375,
0.247314453125,
-0.325439453125,
-0.83740234375,
-0.02545166015625,
-0.11199951171875,
-0.3486328125,
-0.168212890625,
0.57177734375,
0.214599609375,
-0.0228424072265625,
0.33349609375,
0.607421875,
-1.037109375,
1.013671875,
0.119140625,
0.5185546875,
-0.2032470703125,
-0.16259765625,
-0.05224609375,
-0.47607421875,
-0.1409912109375,
0.11431884765625,
0.64306640625,
-0.058380126953125,
-0.05810546875,
0.568359375,
0.9208984375,
-0.83837890625,
-0.11212158203125,
-0.381103515625,
-0.72607421875,
-0.63916015625,
0.54541015625,
1.0498046875,
-0.494873046875,
-0.0816650390625,
-0.298828125,
0.60302734375,
0.4326171875,
0.378173828125,
-0.1627197265625,
-0.4365234375,
-0.55078125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters.
There is a filler word ogo in Oleg's speech. All words that can be obtained from ogo by adding go several times to the end of it are also considered to be fillers. For example, the words ogo, ogogo, ogogogo are fillers, but the words go, og, ogog, ogogog and oggo are not fillers.
The fillers have maximal size, for example, for ogogoo speech we can't consider ogo a filler and goo as a normal phrase. We should consider ogogo as a filler here.
To print the interview, Polycarp has to replace each of the fillers with three asterisks. Note that a filler word is replaced with exactly three asterisks regardless of its length.
Polycarp has dealt with this problem in no time. Can you do the same? The clock is ticking!
Input
The first line contains a positive integer n (1 ≤ n ≤ 100) — the length of the interview.
The second line contains the string s of length n, consisting of lowercase English letters.
Output
Print the interview text after the replacement of each of the fillers with "***". It is allowed for the substring "***" to have several consecutive occurences.
Examples
Input
7
aogogob
Output
a***b
Input
13
ogogmgogogogo
Output
***gmg***
Input
9
ogoogoogo
Output
*********
Note
The first sample contains one filler word ogogo, so the interview for printing is "a***b".
The second sample contains two fillers ogo and ogogogo. Thus, the interview is transformed to "***gmg***".
Tags: implementation, strings
Correct Solution:
```
n=int(input())
s=input()
i=0
while i<n:
if s[i:i+3]=="ogo":
while s[i:i+3]=="ogo":
i+=2
print("***",end="")
else:print(s[i],end="")
i+=1
```
| 45,015
|
[
0.587890625,
-0.2144775390625,
-0.07464599609375,
0.3779296875,
-0.5107421875,
-0.9130859375,
-0.1131591796875,
0.0848388671875,
0.304443359375,
0.17236328125,
0.90869140625,
-0.0848388671875,
0.20263671875,
-1.134765625,
-0.492431640625,
0.2366943359375,
-0.430908203125,
-0.6162109375,
-0.399169921875,
-0.328369140625,
-0.0384521484375,
-0.467041015625,
-1.2919921875,
-0.4150390625,
-0.7958984375,
1.1806640625,
0.1219482421875,
0.49658203125,
0.97900390625,
1.0380859375,
-0.383544921875,
-0.036468505859375,
0.330810546875,
-1.1826171875,
0.059814453125,
-0.38671875,
0.6923828125,
-0.439453125,
-0.435791015625,
-0.3486328125,
0.0819091796875,
-0.56982421875,
1.1279296875,
-0.58447265625,
-1.2705078125,
-0.1253662109375,
-0.391845703125,
-0.27978515625,
-0.22607421875,
-0.331298828125,
0.501953125,
0.09002685546875,
0.783203125,
0.08538818359375,
-0.0277557373046875,
-0.446533203125,
-0.10186767578125,
-0.23779296875,
-0.5087890625,
0.378662109375,
0.375732421875,
0.6875,
0.07275390625,
-0.8896484375,
-0.453369140625,
0.4169921875,
0.044708251953125,
0.09588623046875,
-0.022674560546875,
-0.470703125,
-0.5302734375,
0.0020122528076171875,
-0.1807861328125,
-0.438720703125,
0.1827392578125,
-0.1141357421875,
0.09991455078125,
-0.09906005859375,
-0.6474609375,
0.58203125,
0.403076171875,
1.26171875,
0.431396484375,
0.21435546875,
-0.339599609375,
-0.599609375,
0.11083984375,
0.3056640625,
0.55615234375,
-0.09869384765625,
-0.580078125,
0.7578125,
-0.69140625,
-0.1871337890625,
0.37939453125,
0.5732421875,
-0.548828125,
0.1807861328125,
0.04962158203125,
0.1507568359375,
0.71435546875,
0.97216796875,
-0.09417724609375,
1.0478515625,
0.2017822265625,
-0.056884765625,
0.414794921875,
0.258544921875,
0.188720703125,
-0.461669921875,
-0.260986328125,
-0.525390625,
0.60791015625,
0.01375579833984375,
-0.150146484375,
1.05078125,
-0.1658935546875,
0.250244140625,
-0.58056640625,
0.1773681640625,
0.1669921875,
0.134033203125,
0.35498046875,
-0.1329345703125,
0.100341796875,
-0.496337890625,
-0.7021484375,
1.3095703125,
-0.5126953125,
-0.161865234375,
0.53662109375,
0.2308349609375,
-0.029083251953125,
0.1756591796875,
-0.177734375,
0.67138671875,
-0.027679443359375,
0.68505859375,
0.4814453125,
-0.45166015625,
0.6044921875,
0.10992431640625,
-0.28564453125,
1.22265625,
0.085693359375,
0.6865234375,
0.406494140625,
0.1688232421875,
-0.5771484375,
0.4443359375,
-0.9638671875,
0.398193359375,
0.24267578125,
0.16259765625,
-0.576171875,
0.5234375,
-0.357421875,
0.54345703125,
0.5224609375,
-0.11181640625,
-0.176025390625,
-0.1444091796875,
-0.440673828125,
1.1728515625,
-0.71630859375,
1.19921875,
-0.429443359375,
-0.017974853515625,
0.020965576171875,
-0.1956787109375,
0.2344970703125,
0.1214599609375,
-0.255615234375,
0.60888671875,
0.443359375,
1.212890625,
0.8623046875,
-0.05029296875,
0.357421875,
0.1243896484375,
0.021697998046875,
0.260986328125,
0.07952880859375,
0.87548828125,
0.609375,
0.55029296875,
-0.11083984375,
-0.0726318359375,
-0.2138671875,
-0.71923828125,
0.2264404296875,
0.49755859375,
-0.56494140625,
0.0047760009765625,
0.07159423828125,
0.36083984375,
-0.76416015625,
-0.08026123046875,
-0.26611328125,
-1.05078125,
-0.097412109375,
0.77099609375,
-0.240966796875,
0.72705078125,
-0.3349609375,
-0.4501953125,
0.509765625,
1.1484375,
0.05987548828125,
0.207275390625,
0.58349609375,
0.139404296875,
-0.18359375,
-0.1273193359375,
0.2012939453125,
-0.60009765625,
-0.77294921875,
0.595703125,
-0.1494140625,
-0.05084228515625,
0.037261962890625,
0.489013671875,
0.37451171875,
0.396484375,
0.190673828125,
-0.15869140625,
0.3505859375,
0.9931640625,
-0.057098388671875,
0.446533203125,
-0.1875,
0.859375,
0.7724609375,
0.86572265625,
0.454833984375,
0.049346923828125,
0.8984375,
0.560546875,
0.171142578125,
0.01036834716796875,
-0.281005859375,
0.75927734375,
0.464599609375,
0.54931640625,
-0.2066650390625,
0.5224609375,
-0.496826171875,
-0.0029201507568359375,
-0.1478271484375,
0.09674072265625,
-0.432373046875,
0.9375,
-0.26904296875,
0.8525390625,
-0.37939453125,
-0.65478515625,
0.47900390625,
0.88232421875,
-0.51171875,
-0.4736328125,
0.322021484375,
-0.080322265625,
0.46728515625,
0.1256103515625,
0.216552734375,
0.08404541015625,
0.1431884765625,
0.364990234375,
-0.30029296875,
-0.337646484375,
-0.8037109375,
-0.775390625,
-0.46923828125,
-0.65478515625,
-0.85888671875,
-0.255126953125,
0.5556640625,
-1.0576171875,
0.03607177734375,
-0.346435546875,
-0.375,
0.031463623046875,
-0.599609375,
0.77587890625,
-0.2724609375,
0.32861328125,
-0.90966796875,
0.462158203125,
0.1456298828125,
1.0869140625,
-0.4638671875,
-0.11370849609375,
-0.130615234375,
-0.60400390625,
0.30029296875,
0.427490234375,
0.259765625,
0.260986328125,
-0.4697265625,
-0.52685546875,
-0.259033203125,
0.0855712890625,
-0.2607421875,
0.30810546875,
-0.297119140625,
0.77001953125,
0.28271484375,
-0.556640625,
0.8427734375,
0.52001953125,
-0.59375,
0.51806640625,
0.291259765625,
0.03155517578125,
-0.75,
1.1220703125,
0.57275390625,
0.44482421875,
-0.58154296875,
-0.254638671875,
-0.5927734375,
0.11370849609375,
0.217041015625,
-0.49853515625,
-0.345947265625,
0.51904296875,
0.1649169921875,
-1.080078125,
0.931640625,
-1.255859375,
-0.78857421875,
-0.6787109375,
-0.71630859375,
0.8134765625,
1.064453125,
-0.07958984375,
-0.77294921875,
-0.04071044921875,
-0.460693359375,
0.5068359375,
0.37353515625,
-0.326416015625,
-0.169189453125,
0.310302734375,
-0.09088134765625,
0.4453125,
0.301025390625,
-0.37548828125,
-0.150390625,
-0.01013946533203125,
0.350341796875,
0.31689453125,
0.298828125,
0.118896484375,
0.4287109375,
0.5244140625,
-0.421142578125,
-0.28662109375,
-0.2666015625,
0.7529296875,
0.399169921875,
0.60498046875,
0.50390625,
-0.67822265625,
-0.55712890625,
-1.0107421875,
0.18115234375,
0.353759765625,
1.005859375,
-0.880859375,
0.85009765625,
-0.271728515625,
-0.99658203125,
0.493896484375,
-0.7119140625,
-0.432373046875,
1.2880859375,
-0.422119140625,
0.55908203125,
-0.35791015625,
0.439453125,
-0.30517578125,
-0.429931640625,
0.462890625,
0.22119140625,
0.32763671875,
-0.402099609375,
-0.316162109375,
-0.25927734375,
-0.3232421875,
-0.06292724609375,
-0.6240234375,
0.051239013671875,
-0.58740234375,
-0.308837890625,
-0.35400390625,
0.440185546875,
1.0419921875,
0.537109375,
0.379638671875,
0.483154296875,
0.0811767578125,
0.62255859375,
0.393798828125,
-0.587890625,
0.2666015625,
-0.61083984375,
0.54052734375,
-0.0162200927734375,
-0.1199951171875,
-0.47412109375,
-0.5439453125,
-0.75244140625,
0.0712890625,
0.053955078125,
-0.3310546875,
-0.92529296875,
0.42529296875,
0.1812744140625,
0.443603515625,
-0.7109375,
-0.55224609375,
-0.338623046875,
0.71337890625,
0.353759765625,
-0.38671875,
0.10650634765625,
-0.66845703125,
0.47021484375,
0.55126953125,
-0.1937255859375,
-0.736328125,
-0.47607421875,
-0.54248046875,
-0.72119140625,
0.444091796875,
-0.051727294921875,
0.050811767578125,
0.380615234375,
-0.89306640625,
0.705078125,
0.1295166015625,
-0.03802490234375,
0.0799560546875,
0.1630859375,
0.7138671875,
0.07861328125,
0.67236328125,
-0.484375,
-0.53271484375,
0.425537109375,
-1.1162109375,
0.69921875,
-0.405029296875,
0.30908203125,
-0.06494140625,
-0.33154296875,
0.07257080078125,
0.409912109375,
-0.422119140625,
-0.1851806640625,
-0.216552734375,
0.63671875,
-0.85498046875,
-0.59765625,
0.54443359375,
-0.202880859375,
-0.421630859375,
0.48291015625,
0.00787353515625,
-0.3046875,
0.19140625,
0.445556640625,
-0.2978515625,
0.12164306640625,
-0.728515625,
0.66064453125,
-0.422119140625,
-0.296630859375,
0.0677490234375,
-0.48095703125,
0.5361328125,
0.0170135498046875,
-0.9365234375,
-0.6455078125,
-1.40234375,
-0.65234375,
0.06866455078125,
-0.2266845703125,
0.474365234375,
0.044677734375,
-0.394287109375,
-0.06658935546875,
-1.033203125,
-0.42626953125,
-0.52978515625,
-0.2451171875,
-0.427978515625,
0.470458984375,
0.6591796875,
0.64208984375,
-0.2083740234375,
-0.705078125,
-0.0292205810546875,
0.1680908203125,
-0.424072265625,
-0.1864013671875,
-0.397705078125,
-0.11358642578125,
-0.312255859375,
-0.3056640625,
0.48095703125,
-0.48779296875,
0.460693359375,
1.0751953125,
-0.26171875,
0.60595703125,
0.1861572265625,
-0.69580078125,
1.1474609375,
0.09637451171875,
-1.015625,
-0.61328125,
0.52001953125,
0.217041015625,
0.68603515625,
-0.120849609375,
-0.685546875,
-0.47509765625,
-1.2138671875,
0.322265625,
-0.5,
-0.25390625,
-0.828125,
-0.0030727386474609375,
-0.2034912109375,
0.798828125,
0.0780029296875,
-0.76708984375,
0.350830078125,
-0.97119140625,
0.603515625,
-0.51025390625,
-0.546875,
-0.59375,
-0.861328125,
-0.398193359375,
0.939453125,
0.451171875,
0.04974365234375,
0.264404296875,
-0.2041015625,
-0.1943359375,
-0.323974609375,
-0.5126953125,
-0.0733642578125,
-0.175048828125,
0.00658416748046875,
-0.36328125,
-0.087158203125,
-0.65673828125,
1.171875,
-0.90576171875,
0.482177734375,
-0.2568359375,
-0.1951904296875,
0.047515869140625,
-0.599609375,
0.91796875,
-0.384033203125,
-0.203369140625,
-0.456787109375,
0.55712890625,
0.59130859375,
-0.2349853515625,
-0.45703125,
-0.68408203125,
-0.78564453125,
-1.0126953125,
0.7666015625,
-0.5888671875,
-0.1646728515625,
-0.5234375,
0.580078125,
0.64453125,
-0.338134765625,
0.418212890625,
1.154296875,
0.13232421875,
0.18701171875,
-0.73828125,
0.4501953125,
0.60009765625,
-0.29833984375,
-0.058197021484375,
0.32421875,
-0.759765625,
0.2091064453125,
-0.32470703125,
-1.3623046875,
-0.564453125,
0.275634765625,
1.3896484375,
-0.331298828125,
0.374755859375,
0.36572265625,
-0.71435546875,
-0.5888671875,
0.79248046875,
-0.302001953125,
0.0628662109375,
0.99755859375,
-0.0246429443359375,
-0.302490234375,
0.003143310546875,
-0.31787109375,
-0.161865234375,
-0.4375,
0.8759765625,
-0.277099609375,
-0.60400390625,
0.8662109375,
1.0732421875,
-0.974609375,
-1.0576171875,
0.02984619140625,
-0.07916259765625,
-0.306884765625,
-0.53857421875,
-0.211181640625,
0.83203125,
-0.410888671875,
0.041107177734375,
0.5263671875,
-0.159423828125,
0.1268310546875,
0.115966796875,
-0.1072998046875,
-0.6015625,
0.5087890625,
0.4638671875,
-0.374267578125,
-0.258056640625,
-0.626953125,
-0.11334228515625,
-0.45458984375,
-0.0257568359375,
0.51953125,
-0.48291015625,
-0.049163818359375,
0.091064453125,
-0.02734375,
0.9404296875,
-0.499755859375,
-0.41064453125,
-0.07476806640625,
-1.0751953125,
-0.6083984375,
0.42724609375,
0.1448974609375,
-0.1573486328125,
0.131103515625,
-0.64453125,
-0.28759765625,
0.4111328125,
0.24072265625,
0.15185546875,
-1.04296875,
0.049163818359375,
-0.81005859375,
-0.2069091796875,
-0.96533203125,
-0.76416015625,
-0.22802734375,
0.38623046875,
0.2230224609375,
-0.344482421875,
0.3984375,
-0.01023101806640625,
-0.422607421875,
1.080078125,
-0.478271484375,
0.09027099609375,
-0.6748046875,
-0.1290283203125,
-0.7021484375,
-0.2357177734375,
-0.421630859375,
-0.227783203125,
-0.309326171875,
0.53466796875,
0.032562255859375,
0.59521484375,
-0.127197265625,
0.6513671875,
-0.2418212890625,
-0.72998046875,
-0.1773681640625,
0.0625,
-0.2249755859375,
0.456787109375,
0.72216796875,
-0.0474853515625,
0.0024852752685546875,
0.291015625,
-0.486572265625,
-0.53271484375,
0.416259765625,
0.3134765625,
-0.074951171875,
-0.162841796875,
-0.33203125,
0.3203125,
-0.74267578125,
0.07550048828125,
-0.5888671875,
0.07427978515625,
0.1759033203125,
-0.10845947265625,
0.37548828125,
0.9013671875,
0.353271484375,
0.2783203125,
0.3662109375,
0.67822265625,
0.52294921875,
0.167724609375,
0.442138671875,
0.5380859375,
-0.1737060546875,
-0.65087890625,
0.1343994140625,
0.68408203125,
-0.221923828125,
0.325927734375,
-0.64404296875,
-0.472412109375,
-0.76318359375,
-0.457763671875,
0.128662109375,
-0.054718017578125,
-0.0302276611328125,
-0.599609375,
0.318359375,
-0.0039520263671875,
-0.32958984375,
0.046051025390625,
-0.94140625,
-1,
0.53857421875,
0.15478515625,
-0.160888671875,
-0.2880859375,
-0.64013671875,
-0.4755859375,
0.238037109375,
0.5849609375,
-0.311279296875,
0.3603515625,
-0.412109375,
0.83056640625,
-0.61181640625,
0.40966796875,
0.091796875,
0.2379150390625,
-0.72607421875,
-0.4462890625,
0.2171630859375,
1.126953125,
0.391357421875,
0.00919342041015625,
-0.71875,
0.153076171875,
0.020477294921875,
0.003963470458984375,
-0.458251953125,
0.350830078125,
-0.40576171875,
0.68896484375,
-0.607421875,
0.354736328125,
-0.10614013671875,
0.75830078125,
0.6484375,
-0.41796875,
-0.8369140625,
0.8984375,
0.421630859375,
-0.2744140625,
0.241943359375,
0.3076171875,
0.2059326171875,
-0.406494140625,
-0.018096923828125,
-0.38134765625,
0.377685546875,
0.5224609375,
0.51953125,
-0.20654296875,
0.669921875,
0.470458984375,
-0.299560546875,
0.0892333984375,
0.8095703125,
0.63330078125,
-0.364990234375,
-0.1314697265625,
-0.406005859375,
-0.340087890625,
0.17822265625,
-0.64013671875,
0.61279296875,
-0.1697998046875,
-0.090087890625,
-0.35400390625,
-0.91064453125,
0.56201171875,
-0.210205078125,
0.2078857421875,
0.09130859375,
-0.319580078125,
0.38037109375,
0.9775390625,
-0.233154296875,
0.1666259765625,
0.60009765625,
0.64404296875,
0.19970703125,
0.7724609375,
0.431884765625,
0.328125,
-0.434326171875,
0.0052642822265625,
0.143798828125,
0.0175628662109375,
-0.18603515625,
-0.248779296875,
-1.04296875,
0.8720703125,
-0.128173828125,
-0.157958984375,
0.87841796875,
-0.86865234375,
0.1304931640625,
-0.48681640625,
0.59765625,
-0.7099609375,
0.340576171875,
0.167724609375,
-0.0298004150390625,
-0.94384765625,
0.8212890625,
-0.17333984375,
0.2237548828125,
0.287353515625,
1.23828125,
0.0010194778442382812,
1.1162109375,
0.615234375,
-0.267578125,
-0.14501953125,
0.363037109375,
-0.4169921875,
-0.43603515625,
-0.164306640625,
-0.39111328125,
-0.1962890625,
-0.99267578125,
-0.498779296875,
-0.2222900390625,
0.87109375,
0.1036376953125,
-0.9033203125,
-0.374267578125,
0.1488037109375,
-0.420654296875,
0.4970703125,
0.5029296875,
0.0709228515625,
-0.33154296875,
-0.1077880859375,
-0.37060546875,
-0.404541015625,
-0.01218414306640625,
-0.486328125,
0.458984375,
-0.39892578125,
-0.787109375,
-0.402099609375,
-0.73974609375,
-0.414306640625,
0.021148681640625,
-0.370849609375,
-0.69775390625,
0.62060546875,
0.89599609375,
0.5146484375,
0.05535888671875,
-0.490966796875,
0.2403564453125,
0.8876953125,
1.2451171875,
-0.14208984375,
0.9453125,
-0.08404541015625,
0.060943603515625,
0.389404296875,
-0.8603515625,
0.462158203125,
0.053497314453125,
0.332275390625,
-0.326904296875,
0.4638671875,
-0.73193359375,
-1.8203125,
-0.09942626953125,
0.65625,
0.50146484375,
-0.642578125,
-1.2939453125,
-0.0218353271484375,
-1.53515625,
-0.330078125,
-0.36083984375,
0.66552734375,
-0.69921875,
0.113037109375,
-0.305419921875,
-1.2841796875,
4.3359375,
1.1865234375,
0.9931640625,
0.2998046875,
0.560546875,
1.02734375,
0.51611328125,
-0.744140625,
0.1470947265625,
-0.1680908203125,
0.54150390625,
-0.2900390625,
-0.0175018310546875,
0.56494140625,
0.43896484375,
0.64404296875,
-0.86669921875,
0.15234375,
-0.14306640625,
-0.9443359375,
-0.8955078125,
0.27734375,
0.03753662109375,
0.6650390625,
0.12481689453125,
0.240966796875,
0.352783203125,
-0.6748046875,
-0.3310546875,
-0.84765625,
-0.1617431640625,
-0.5087890625,
1.0029296875,
0.08709716796875,
-0.3798828125,
0.74267578125,
0.06103515625,
-0.66748046875,
-0.16552734375,
-0.016845703125,
-0.2333984375,
0.187255859375,
0.63232421875,
-0.85107421875,
0.404541015625,
0.5263671875,
-0.76220703125,
0.365234375,
0.66357421875,
-0.95361328125,
1.37890625,
-0.11395263671875,
0.5859375,
-1.3984375,
-0.765625,
-0.229248046875,
0.11480712890625,
-0.343017578125,
-0.56298828125,
0.2042236328125,
0.54541015625,
0.10931396484375,
0.19970703125,
0.5048828125,
-0.765625,
1.083984375,
-0.289794921875,
0.2005615234375,
-0.51611328125,
-0.00518035888671875,
-0.5224609375,
0.0345458984375,
-0.0439453125,
-0.1949462890625,
0.8388671875,
0.2236328125,
0.07965087890625,
0.1458740234375,
0.39892578125,
-0.68505859375,
0.236328125,
-0.053253173828125,
-0.444091796875,
-0.264404296875,
0.09423828125,
1.47265625,
-0.462646484375,
0.001697540283203125,
-0.517578125,
0.9169921875,
0.291259765625,
0.3779296875,
-0.32373046875,
-0.75341796875,
-0.4091796875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters.
There is a filler word ogo in Oleg's speech. All words that can be obtained from ogo by adding go several times to the end of it are also considered to be fillers. For example, the words ogo, ogogo, ogogogo are fillers, but the words go, og, ogog, ogogog and oggo are not fillers.
The fillers have maximal size, for example, for ogogoo speech we can't consider ogo a filler and goo as a normal phrase. We should consider ogogo as a filler here.
To print the interview, Polycarp has to replace each of the fillers with three asterisks. Note that a filler word is replaced with exactly three asterisks regardless of its length.
Polycarp has dealt with this problem in no time. Can you do the same? The clock is ticking!
Input
The first line contains a positive integer n (1 ≤ n ≤ 100) — the length of the interview.
The second line contains the string s of length n, consisting of lowercase English letters.
Output
Print the interview text after the replacement of each of the fillers with "***". It is allowed for the substring "***" to have several consecutive occurences.
Examples
Input
7
aogogob
Output
a***b
Input
13
ogogmgogogogo
Output
***gmg***
Input
9
ogoogoogo
Output
*********
Note
The first sample contains one filler word ogogo, so the interview for printing is "a***b".
The second sample contains two fillers ogo and ogogogo. Thus, the interview is transformed to "***gmg***".
Tags: implementation, strings
Correct Solution:
```
n = int(input())
s = input()
while s.count("ogo") > 0:
i = 0
j = 0
while s[i:i + 3] != "ogo":
i += 1
if s[i:i + 3] == "ogo":
j = i + 3
while j + 2 <= len(s) and s[j:j + 2] == "go":
j += 2
s = s[:i] + "***" + s[j:]
print(s)
```
| 45,016
|
[
0.5947265625,
-0.2064208984375,
-0.09759521484375,
0.363037109375,
-0.53173828125,
-0.91796875,
-0.1241455078125,
0.09490966796875,
0.302978515625,
0.1761474609375,
0.8955078125,
-0.07550048828125,
0.20263671875,
-1.1201171875,
-0.492919921875,
0.2481689453125,
-0.429443359375,
-0.61669921875,
-0.4033203125,
-0.33642578125,
-0.0200653076171875,
-0.448974609375,
-1.2958984375,
-0.412841796875,
-0.79345703125,
1.1748046875,
0.128173828125,
0.5029296875,
0.97265625,
1.04296875,
-0.38330078125,
-0.03314208984375,
0.337890625,
-1.19921875,
0.05145263671875,
-0.386474609375,
0.68505859375,
-0.42919921875,
-0.4296875,
-0.3564453125,
0.07415771484375,
-0.58154296875,
1.1376953125,
-0.58740234375,
-1.2666015625,
-0.132080078125,
-0.401611328125,
-0.274169921875,
-0.2225341796875,
-0.318115234375,
0.492919921875,
0.0911865234375,
0.7900390625,
0.0750732421875,
-0.01568603515625,
-0.450439453125,
-0.1026611328125,
-0.239990234375,
-0.50244140625,
0.38037109375,
0.386474609375,
0.6826171875,
0.0694580078125,
-0.86962890625,
-0.452880859375,
0.43359375,
0.03436279296875,
0.0782470703125,
-0.0301513671875,
-0.475830078125,
-0.5263671875,
-0.00939178466796875,
-0.1925048828125,
-0.4384765625,
0.180908203125,
-0.1173095703125,
0.10150146484375,
-0.091796875,
-0.64794921875,
0.58056640625,
0.414794921875,
1.2646484375,
0.40234375,
0.212890625,
-0.342529296875,
-0.59765625,
0.10040283203125,
0.298095703125,
0.5634765625,
-0.11297607421875,
-0.58349609375,
0.76025390625,
-0.70263671875,
-0.1737060546875,
0.393798828125,
0.57958984375,
-0.55615234375,
0.188720703125,
0.054779052734375,
0.15185546875,
0.71826171875,
0.9599609375,
-0.10247802734375,
1.0439453125,
0.2080078125,
-0.07769775390625,
0.410888671875,
0.269775390625,
0.2069091796875,
-0.464111328125,
-0.25,
-0.53466796875,
0.58935546875,
0.043487548828125,
-0.139892578125,
1.05078125,
-0.1689453125,
0.2486572265625,
-0.5810546875,
0.177978515625,
0.172607421875,
0.1302490234375,
0.361328125,
-0.14208984375,
0.0946044921875,
-0.499267578125,
-0.7314453125,
1.2939453125,
-0.51318359375,
-0.1507568359375,
0.521484375,
0.2462158203125,
-0.0390625,
0.1788330078125,
-0.186279296875,
0.6640625,
-0.0307464599609375,
0.68603515625,
0.486572265625,
-0.4453125,
0.60009765625,
0.09881591796875,
-0.28076171875,
1.2333984375,
0.09197998046875,
0.69091796875,
0.396484375,
0.166748046875,
-0.56689453125,
0.4443359375,
-0.96044921875,
0.40673828125,
0.23681640625,
0.1697998046875,
-0.5732421875,
0.52490234375,
-0.351318359375,
0.54443359375,
0.54345703125,
-0.108154296875,
-0.18359375,
-0.15234375,
-0.43310546875,
1.1708984375,
-0.7080078125,
1.1845703125,
-0.434326171875,
-0.0263671875,
0.034881591796875,
-0.207763671875,
0.2279052734375,
0.1168212890625,
-0.266357421875,
0.59912109375,
0.45654296875,
1.2021484375,
0.85693359375,
-0.0472412109375,
0.3388671875,
0.1107177734375,
0.027923583984375,
0.251708984375,
0.081298828125,
0.8779296875,
0.6103515625,
0.55419921875,
-0.11749267578125,
-0.0806884765625,
-0.216064453125,
-0.72607421875,
0.22900390625,
0.5078125,
-0.5654296875,
-0.0060272216796875,
0.07476806640625,
0.3662109375,
-0.7578125,
-0.08746337890625,
-0.254638671875,
-1.0263671875,
-0.07879638671875,
0.77099609375,
-0.2171630859375,
0.7216796875,
-0.34375,
-0.43359375,
0.50732421875,
1.1396484375,
0.057464599609375,
0.205810546875,
0.5888671875,
0.133544921875,
-0.1827392578125,
-0.11676025390625,
0.2081298828125,
-0.60107421875,
-0.763671875,
0.58154296875,
-0.137939453125,
-0.048736572265625,
0.054901123046875,
0.495361328125,
0.37158203125,
0.400634765625,
0.203369140625,
-0.16943359375,
0.356201171875,
0.978515625,
-0.06463623046875,
0.47802734375,
-0.205078125,
0.85888671875,
0.791015625,
0.85595703125,
0.46337890625,
0.05810546875,
0.8955078125,
0.55615234375,
0.19384765625,
-0.0016546249389648438,
-0.286376953125,
0.76416015625,
0.444091796875,
0.54150390625,
-0.2000732421875,
0.51416015625,
-0.50634765625,
0.005023956298828125,
-0.1431884765625,
0.1080322265625,
-0.43359375,
0.93212890625,
-0.2626953125,
0.84521484375,
-0.37939453125,
-0.65283203125,
0.48193359375,
0.88818359375,
-0.486328125,
-0.474365234375,
0.333984375,
-0.07232666015625,
0.49267578125,
0.12493896484375,
0.22412109375,
0.0869140625,
0.14453125,
0.358154296875,
-0.2939453125,
-0.3330078125,
-0.814453125,
-0.77490234375,
-0.460205078125,
-0.66064453125,
-0.8408203125,
-0.254638671875,
0.54443359375,
-1.0458984375,
0.038482666015625,
-0.342041015625,
-0.38525390625,
0.0176544189453125,
-0.5908203125,
0.771484375,
-0.28271484375,
0.336669921875,
-0.88916015625,
0.455810546875,
0.13623046875,
1.0791015625,
-0.463134765625,
-0.11041259765625,
-0.12152099609375,
-0.5947265625,
0.3095703125,
0.427978515625,
0.255126953125,
0.255859375,
-0.462646484375,
-0.54052734375,
-0.258056640625,
0.07879638671875,
-0.25732421875,
0.302978515625,
-0.297607421875,
0.775390625,
0.263427734375,
-0.56591796875,
0.853515625,
0.5107421875,
-0.60205078125,
0.5166015625,
0.299560546875,
0.038848876953125,
-0.751953125,
1.1318359375,
0.57080078125,
0.436767578125,
-0.59130859375,
-0.2529296875,
-0.6064453125,
0.11627197265625,
0.205810546875,
-0.50146484375,
-0.352294921875,
0.50537109375,
0.1654052734375,
-1.0771484375,
0.94287109375,
-1.2529296875,
-0.80224609375,
-0.66943359375,
-0.73583984375,
0.81396484375,
1.0849609375,
-0.07537841796875,
-0.76806640625,
-0.04681396484375,
-0.475341796875,
0.51953125,
0.3818359375,
-0.31640625,
-0.1807861328125,
0.326904296875,
-0.09832763671875,
0.447998046875,
0.3173828125,
-0.369384765625,
-0.1536865234375,
0.007297515869140625,
0.36083984375,
0.312744140625,
0.306884765625,
0.1123046875,
0.42822265625,
0.5205078125,
-0.423095703125,
-0.290283203125,
-0.264892578125,
0.75537109375,
0.4013671875,
0.5859375,
0.493408203125,
-0.666015625,
-0.5703125,
-1.013671875,
0.1846923828125,
0.335205078125,
1.017578125,
-0.89697265625,
0.85888671875,
-0.26953125,
-0.982421875,
0.51611328125,
-0.7001953125,
-0.42529296875,
1.2890625,
-0.428955078125,
0.56640625,
-0.35107421875,
0.4404296875,
-0.306640625,
-0.443115234375,
0.45703125,
0.22802734375,
0.320068359375,
-0.416748046875,
-0.3115234375,
-0.25634765625,
-0.2998046875,
-0.06085205078125,
-0.62451171875,
0.0379638671875,
-0.603515625,
-0.302001953125,
-0.367431640625,
0.45263671875,
1.0361328125,
0.5390625,
0.3662109375,
0.490966796875,
0.07293701171875,
0.6044921875,
0.3935546875,
-0.58935546875,
0.26904296875,
-0.62109375,
0.5517578125,
-0.00995635986328125,
-0.12646484375,
-0.472412109375,
-0.5546875,
-0.73828125,
0.05389404296875,
0.0621337890625,
-0.34423828125,
-0.92626953125,
0.423583984375,
0.180419921875,
0.443603515625,
-0.73193359375,
-0.5439453125,
-0.334228515625,
0.6982421875,
0.364501953125,
-0.365234375,
0.1085205078125,
-0.67041015625,
0.454833984375,
0.56201171875,
-0.1947021484375,
-0.7333984375,
-0.488037109375,
-0.53564453125,
-0.7177734375,
0.429931640625,
-0.05340576171875,
0.06536865234375,
0.376953125,
-0.89453125,
0.71875,
0.11932373046875,
-0.0244598388671875,
0.071044921875,
0.188720703125,
0.70068359375,
0.07183837890625,
0.66943359375,
-0.46826171875,
-0.51611328125,
0.432373046875,
-1.125,
0.70263671875,
-0.400634765625,
0.326171875,
-0.051727294921875,
-0.333251953125,
0.0740966796875,
0.403564453125,
-0.409423828125,
-0.2041015625,
-0.216552734375,
0.6298828125,
-0.84521484375,
-0.6025390625,
0.54638671875,
-0.2188720703125,
-0.422119140625,
0.48388671875,
0.00305938720703125,
-0.302001953125,
0.1846923828125,
0.439697265625,
-0.296142578125,
0.1339111328125,
-0.71044921875,
0.66455078125,
-0.404052734375,
-0.28466796875,
0.060943603515625,
-0.483154296875,
0.52734375,
0.03515625,
-0.9267578125,
-0.63525390625,
-1.400390625,
-0.65478515625,
0.05877685546875,
-0.2335205078125,
0.48583984375,
0.031707763671875,
-0.406005859375,
-0.058258056640625,
-1.0146484375,
-0.435546875,
-0.5322265625,
-0.251220703125,
-0.421630859375,
0.486572265625,
0.6533203125,
0.6357421875,
-0.2198486328125,
-0.701171875,
-0.0303192138671875,
0.169921875,
-0.41455078125,
-0.1739501953125,
-0.384033203125,
-0.11981201171875,
-0.3154296875,
-0.310791015625,
0.477294921875,
-0.498046875,
0.452392578125,
1.05859375,
-0.269287109375,
0.59765625,
0.195068359375,
-0.69775390625,
1.15234375,
0.08740234375,
-1.01171875,
-0.60302734375,
0.5361328125,
0.2242431640625,
0.67919921875,
-0.1265869140625,
-0.69384765625,
-0.473876953125,
-1.208984375,
0.317626953125,
-0.488525390625,
-0.257568359375,
-0.81787109375,
0.003452301025390625,
-0.2100830078125,
0.79296875,
0.07196044921875,
-0.76806640625,
0.347412109375,
-0.96435546875,
0.6025390625,
-0.497314453125,
-0.54150390625,
-0.57373046875,
-0.85595703125,
-0.38671875,
0.9228515625,
0.452880859375,
0.037933349609375,
0.262451171875,
-0.19970703125,
-0.1981201171875,
-0.32421875,
-0.5107421875,
-0.08636474609375,
-0.15869140625,
0.00974273681640625,
-0.360107421875,
-0.08062744140625,
-0.6494140625,
1.1630859375,
-0.9091796875,
0.46875,
-0.27392578125,
-0.22216796875,
0.05340576171875,
-0.5986328125,
0.93115234375,
-0.3798828125,
-0.213134765625,
-0.440673828125,
0.54638671875,
0.591796875,
-0.21630859375,
-0.44580078125,
-0.7080078125,
-0.79248046875,
-0.9921875,
0.740234375,
-0.5771484375,
-0.1451416015625,
-0.53515625,
0.59716796875,
0.63623046875,
-0.355712890625,
0.429443359375,
1.1416015625,
0.130859375,
0.1956787109375,
-0.734375,
0.428466796875,
0.6015625,
-0.311767578125,
-0.06964111328125,
0.31787109375,
-0.763671875,
0.2154541015625,
-0.3212890625,
-1.3857421875,
-0.5771484375,
0.28564453125,
1.3857421875,
-0.341796875,
0.349609375,
0.37841796875,
-0.71337890625,
-0.58154296875,
0.80224609375,
-0.31201171875,
0.07196044921875,
0.99267578125,
-0.0235595703125,
-0.3154296875,
-0.0006051063537597656,
-0.29736328125,
-0.1572265625,
-0.44775390625,
0.8837890625,
-0.296142578125,
-0.6171875,
0.86669921875,
1.080078125,
-0.9716796875,
-1.0576171875,
0.031890869140625,
-0.083984375,
-0.310302734375,
-0.5390625,
-0.21142578125,
0.82958984375,
-0.40576171875,
0.036651611328125,
0.517578125,
-0.1640625,
0.1207275390625,
0.1326904296875,
-0.10955810546875,
-0.59130859375,
0.5126953125,
0.46728515625,
-0.368896484375,
-0.251708984375,
-0.630859375,
-0.10479736328125,
-0.46240234375,
-0.0256195068359375,
0.51318359375,
-0.49609375,
-0.051361083984375,
0.0965576171875,
-0.04876708984375,
0.93603515625,
-0.5087890625,
-0.4169921875,
-0.06927490234375,
-1.0625,
-0.615234375,
0.443359375,
0.1253662109375,
-0.15673828125,
0.1397705078125,
-0.64013671875,
-0.282958984375,
0.416259765625,
0.2403564453125,
0.1536865234375,
-1.041015625,
0.06951904296875,
-0.81103515625,
-0.202880859375,
-0.958984375,
-0.74658203125,
-0.224609375,
0.385986328125,
0.2357177734375,
-0.340087890625,
0.405029296875,
-0.041839599609375,
-0.414306640625,
1.07421875,
-0.48046875,
0.09613037109375,
-0.66943359375,
-0.130615234375,
-0.7001953125,
-0.215576171875,
-0.41455078125,
-0.237548828125,
-0.3271484375,
0.51123046875,
0.05340576171875,
0.60791015625,
-0.12420654296875,
0.658203125,
-0.24072265625,
-0.7197265625,
-0.1817626953125,
0.0609130859375,
-0.22412109375,
0.43603515625,
0.71435546875,
-0.04913330078125,
0.01306915283203125,
0.29345703125,
-0.49755859375,
-0.533203125,
0.4208984375,
0.32470703125,
-0.07879638671875,
-0.176513671875,
-0.332763671875,
0.328125,
-0.73095703125,
0.0841064453125,
-0.58837890625,
0.042022705078125,
0.1656494140625,
-0.11297607421875,
0.377197265625,
0.9013671875,
0.35693359375,
0.25732421875,
0.384765625,
0.6787109375,
0.51953125,
0.16015625,
0.44921875,
0.54296875,
-0.1790771484375,
-0.66357421875,
0.1295166015625,
0.6767578125,
-0.2275390625,
0.33447265625,
-0.6455078125,
-0.475830078125,
-0.74853515625,
-0.4755859375,
0.114501953125,
-0.0352783203125,
-0.030426025390625,
-0.59814453125,
0.299072265625,
-0.006134033203125,
-0.3173828125,
0.04644775390625,
-0.95166015625,
-0.99951171875,
0.54345703125,
0.162109375,
-0.1533203125,
-0.2919921875,
-0.64111328125,
-0.4638671875,
0.233642578125,
0.57666015625,
-0.314697265625,
0.34521484375,
-0.423583984375,
0.830078125,
-0.62890625,
0.41650390625,
0.09210205078125,
0.252197265625,
-0.73388671875,
-0.449462890625,
0.2061767578125,
1.1357421875,
0.3916015625,
0.02557373046875,
-0.70556640625,
0.15087890625,
0.01119232177734375,
0.00978851318359375,
-0.455322265625,
0.35791015625,
-0.39306640625,
0.6796875,
-0.61376953125,
0.348876953125,
-0.1104736328125,
0.763671875,
0.63232421875,
-0.40283203125,
-0.83203125,
0.90234375,
0.406982421875,
-0.262939453125,
0.2413330078125,
0.320068359375,
0.1956787109375,
-0.399658203125,
-0.007289886474609375,
-0.37451171875,
0.37841796875,
0.515625,
0.5068359375,
-0.2056884765625,
0.66748046875,
0.4716796875,
-0.2900390625,
0.10357666015625,
0.83251953125,
0.6376953125,
-0.362548828125,
-0.1240234375,
-0.402099609375,
-0.34033203125,
0.1878662109375,
-0.63818359375,
0.62109375,
-0.1568603515625,
-0.08868408203125,
-0.339111328125,
-0.92333984375,
0.58056640625,
-0.2056884765625,
0.2047119140625,
0.0970458984375,
-0.31103515625,
0.37451171875,
0.96923828125,
-0.22412109375,
0.16650390625,
0.6142578125,
0.64404296875,
0.217529296875,
0.763671875,
0.4345703125,
0.3173828125,
-0.42578125,
-0.0043792724609375,
0.1392822265625,
0.0018711090087890625,
-0.1810302734375,
-0.23681640625,
-1.0478515625,
0.861328125,
-0.123291015625,
-0.16845703125,
0.8779296875,
-0.8740234375,
0.12176513671875,
-0.494873046875,
0.5810546875,
-0.71630859375,
0.3486328125,
0.164306640625,
-0.0208892822265625,
-0.94140625,
0.8203125,
-0.177978515625,
0.2171630859375,
0.293701171875,
1.244140625,
0.0117340087890625,
1.1171875,
0.62255859375,
-0.265625,
-0.16357421875,
0.352294921875,
-0.4248046875,
-0.4404296875,
-0.1585693359375,
-0.386962890625,
-0.2147216796875,
-0.9912109375,
-0.493896484375,
-0.2099609375,
0.87890625,
0.1124267578125,
-0.90087890625,
-0.379638671875,
0.1275634765625,
-0.426025390625,
0.483154296875,
0.513671875,
0.06951904296875,
-0.336181640625,
-0.1080322265625,
-0.382568359375,
-0.42236328125,
-0.0285797119140625,
-0.4755859375,
0.464599609375,
-0.3955078125,
-0.79833984375,
-0.40087890625,
-0.75341796875,
-0.427734375,
0.0279998779296875,
-0.371826171875,
-0.6962890625,
0.623046875,
0.90478515625,
0.51904296875,
0.0576171875,
-0.4814453125,
0.24951171875,
0.91357421875,
1.25390625,
-0.1619873046875,
0.94921875,
-0.10418701171875,
0.06878662109375,
0.41015625,
-0.8486328125,
0.461181640625,
0.041168212890625,
0.336181640625,
-0.33203125,
0.456298828125,
-0.74169921875,
-1.8271484375,
-0.085693359375,
0.65625,
0.50732421875,
-0.64501953125,
-1.2802734375,
-0.029144287109375,
-1.546875,
-0.332763671875,
-0.376220703125,
0.65966796875,
-0.6943359375,
0.11700439453125,
-0.31787109375,
-1.275390625,
4.33984375,
1.1826171875,
0.96826171875,
0.29638671875,
0.55322265625,
1.0400390625,
0.52392578125,
-0.7451171875,
0.1510009765625,
-0.1866455078125,
0.54638671875,
-0.27783203125,
-0.0198211669921875,
0.55908203125,
0.45068359375,
0.642578125,
-0.85986328125,
0.15625,
-0.1473388671875,
-0.9541015625,
-0.90576171875,
0.282470703125,
0.03448486328125,
0.6630859375,
0.1126708984375,
0.2322998046875,
0.365478515625,
-0.66259765625,
-0.329345703125,
-0.8388671875,
-0.161376953125,
-0.501953125,
1.005859375,
0.08258056640625,
-0.39306640625,
0.74755859375,
0.0498046875,
-0.6650390625,
-0.1678466796875,
-0.007251739501953125,
-0.2210693359375,
0.1988525390625,
0.63623046875,
-0.85302734375,
0.405517578125,
0.5341796875,
-0.75390625,
0.35205078125,
0.65966796875,
-0.95068359375,
1.3896484375,
-0.11944580078125,
0.580078125,
-1.3955078125,
-0.78271484375,
-0.23193359375,
0.11767578125,
-0.35693359375,
-0.57958984375,
0.198974609375,
0.55517578125,
0.1063232421875,
0.192626953125,
0.4990234375,
-0.76220703125,
1.0712890625,
-0.301513671875,
0.2022705078125,
-0.51123046875,
0.003017425537109375,
-0.5126953125,
0.0390625,
-0.056488037109375,
-0.196533203125,
0.84716796875,
0.2293701171875,
0.07647705078125,
0.1458740234375,
0.39208984375,
-0.689453125,
0.232666015625,
-0.04486083984375,
-0.4365234375,
-0.271484375,
0.0809326171875,
1.47265625,
-0.470458984375,
0.004688262939453125,
-0.51025390625,
0.92236328125,
0.28955078125,
0.3818359375,
-0.33056640625,
-0.7666015625,
-0.40185546875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters.
There is a filler word ogo in Oleg's speech. All words that can be obtained from ogo by adding go several times to the end of it are also considered to be fillers. For example, the words ogo, ogogo, ogogogo are fillers, but the words go, og, ogog, ogogog and oggo are not fillers.
The fillers have maximal size, for example, for ogogoo speech we can't consider ogo a filler and goo as a normal phrase. We should consider ogogo as a filler here.
To print the interview, Polycarp has to replace each of the fillers with three asterisks. Note that a filler word is replaced with exactly three asterisks regardless of its length.
Polycarp has dealt with this problem in no time. Can you do the same? The clock is ticking!
Input
The first line contains a positive integer n (1 ≤ n ≤ 100) — the length of the interview.
The second line contains the string s of length n, consisting of lowercase English letters.
Output
Print the interview text after the replacement of each of the fillers with "***". It is allowed for the substring "***" to have several consecutive occurences.
Examples
Input
7
aogogob
Output
a***b
Input
13
ogogmgogogogo
Output
***gmg***
Input
9
ogoogoogo
Output
*********
Note
The first sample contains one filler word ogogo, so the interview for printing is "a***b".
The second sample contains two fillers ogo and ogogogo. Thus, the interview is transformed to "***gmg***".
Tags: implementation, strings
Correct Solution:
```
if __name__ == '__main__':
n, s = int(input()), input()
result_array = []
left = 0
while left <= n - 3:
if s[left: left + 3] == 'ogo':
left += 3
if left >= n:
result_array.append('***')
break
while left + 1 < n and s[left: left + 2] == 'go':
left += 2
result_array.append('***')
else:
result_array.append(s[left])
left += 1
while left < n:
result_array.append(s[left])
left += 1
print(''.join(result_array))
```
| 45,017
|
[
0.57275390625,
-0.2154541015625,
-0.07122802734375,
0.404541015625,
-0.51171875,
-0.91943359375,
-0.1204833984375,
0.11328125,
0.28955078125,
0.1566162109375,
0.90625,
-0.09967041015625,
0.2095947265625,
-1.1181640625,
-0.46826171875,
0.2313232421875,
-0.408447265625,
-0.63623046875,
-0.381103515625,
-0.330322265625,
-0.051422119140625,
-0.48583984375,
-1.298828125,
-0.39599609375,
-0.7958984375,
1.1826171875,
0.11541748046875,
0.5068359375,
0.9736328125,
1.037109375,
-0.405517578125,
-0.036163330078125,
0.321044921875,
-1.1865234375,
0.058319091796875,
-0.385009765625,
0.7099609375,
-0.437255859375,
-0.451904296875,
-0.35546875,
0.06683349609375,
-0.5888671875,
1.1201171875,
-0.57373046875,
-1.2666015625,
-0.1348876953125,
-0.390869140625,
-0.268310546875,
-0.2259521484375,
-0.312744140625,
0.505859375,
0.098388671875,
0.78955078125,
0.07110595703125,
-0.010406494140625,
-0.460205078125,
-0.10400390625,
-0.2283935546875,
-0.5029296875,
0.37744140625,
0.364501953125,
0.71142578125,
0.0655517578125,
-0.88232421875,
-0.4521484375,
0.442626953125,
0.03271484375,
0.10955810546875,
-0.02276611328125,
-0.451904296875,
-0.53173828125,
-0.0003151893615722656,
-0.167236328125,
-0.44482421875,
0.1732177734375,
-0.11541748046875,
0.092529296875,
-0.09466552734375,
-0.62841796875,
0.5888671875,
0.422607421875,
1.2666015625,
0.43115234375,
0.22705078125,
-0.327392578125,
-0.58349609375,
0.126953125,
0.317138671875,
0.5556640625,
-0.07501220703125,
-0.5791015625,
0.75244140625,
-0.677734375,
-0.214111328125,
0.382568359375,
0.572265625,
-0.55224609375,
0.191650390625,
0.052978515625,
0.1572265625,
0.73486328125,
0.9892578125,
-0.1099853515625,
1.0400390625,
0.2108154296875,
-0.05377197265625,
0.416748046875,
0.278076171875,
0.2113037109375,
-0.46240234375,
-0.257080078125,
-0.5263671875,
0.60595703125,
0.016204833984375,
-0.1585693359375,
1.029296875,
-0.180908203125,
0.250732421875,
-0.599609375,
0.1630859375,
0.139404296875,
0.1385498046875,
0.34716796875,
-0.143310546875,
0.09320068359375,
-0.51904296875,
-0.68994140625,
1.294921875,
-0.52392578125,
-0.165283203125,
0.55859375,
0.2432861328125,
-0.0163726806640625,
0.1588134765625,
-0.1934814453125,
0.671875,
-0.03466796875,
0.66796875,
0.5029296875,
-0.45751953125,
0.6201171875,
0.11785888671875,
-0.27734375,
1.2080078125,
0.07977294921875,
0.71240234375,
0.412353515625,
0.1400146484375,
-0.5859375,
0.4384765625,
-0.951171875,
0.38525390625,
0.2354736328125,
0.1920166015625,
-0.57666015625,
0.53662109375,
-0.34765625,
0.56591796875,
0.5380859375,
-0.11517333984375,
-0.170166015625,
-0.1434326171875,
-0.447265625,
1.1630859375,
-0.7255859375,
1.17578125,
-0.421142578125,
-0.0056304931640625,
0.02001953125,
-0.191162109375,
0.21875,
0.1126708984375,
-0.272216796875,
0.59375,
0.42431640625,
1.201171875,
0.87060546875,
-0.042633056640625,
0.364501953125,
0.113037109375,
0.047607421875,
0.2763671875,
0.06903076171875,
0.8818359375,
0.6162109375,
0.55029296875,
-0.1259765625,
-0.0721435546875,
-0.205810546875,
-0.72705078125,
0.2359619140625,
0.5087890625,
-0.560546875,
0.01316070556640625,
0.08636474609375,
0.358154296875,
-0.7841796875,
-0.058837890625,
-0.253662109375,
-1.02734375,
-0.1129150390625,
0.78369140625,
-0.2470703125,
0.71923828125,
-0.33154296875,
-0.443115234375,
0.501953125,
1.146484375,
0.0758056640625,
0.1739501953125,
0.61328125,
0.1453857421875,
-0.1761474609375,
-0.148681640625,
0.1990966796875,
-0.61181640625,
-0.77734375,
0.6162109375,
-0.148681640625,
-0.056671142578125,
0.02813720703125,
0.486328125,
0.37255859375,
0.408447265625,
0.1881103515625,
-0.1431884765625,
0.34619140625,
1.001953125,
-0.06988525390625,
0.464111328125,
-0.1876220703125,
0.84716796875,
0.7734375,
0.8896484375,
0.46923828125,
0.0673828125,
0.89453125,
0.5634765625,
0.180419921875,
0.0173187255859375,
-0.29833984375,
0.75390625,
0.45263671875,
0.53955078125,
-0.211669921875,
0.505859375,
-0.5029296875,
-0.0031986236572265625,
-0.1395263671875,
0.08331298828125,
-0.437255859375,
0.9287109375,
-0.296630859375,
0.857421875,
-0.39208984375,
-0.66064453125,
0.463134765625,
0.88232421875,
-0.51904296875,
-0.47802734375,
0.330078125,
-0.08905029296875,
0.47119140625,
0.12237548828125,
0.2236328125,
0.08160400390625,
0.1131591796875,
0.369873046875,
-0.297607421875,
-0.332763671875,
-0.80810546875,
-0.7861328125,
-0.4873046875,
-0.646484375,
-0.8525390625,
-0.259521484375,
0.5732421875,
-1.060546875,
0.0254058837890625,
-0.348388671875,
-0.3623046875,
0.011077880859375,
-0.5869140625,
0.771484375,
-0.287841796875,
0.31591796875,
-0.912109375,
0.4658203125,
0.1351318359375,
1.0927734375,
-0.47119140625,
-0.1201171875,
-0.1380615234375,
-0.615234375,
0.291259765625,
0.42041015625,
0.250244140625,
0.2449951171875,
-0.466552734375,
-0.53369140625,
-0.26025390625,
0.08868408203125,
-0.2666015625,
0.296630859375,
-0.29736328125,
0.76220703125,
0.291748046875,
-0.548828125,
0.85107421875,
0.50732421875,
-0.57861328125,
0.5166015625,
0.316650390625,
0.020172119140625,
-0.751953125,
1.134765625,
0.56494140625,
0.45654296875,
-0.61669921875,
-0.239501953125,
-0.59326171875,
0.11004638671875,
0.225341796875,
-0.50439453125,
-0.35986328125,
0.52294921875,
0.176513671875,
-1.087890625,
0.9462890625,
-1.2470703125,
-0.814453125,
-0.68359375,
-0.74169921875,
0.79931640625,
1.0712890625,
-0.0938720703125,
-0.783203125,
-0.049072265625,
-0.494873046875,
0.488525390625,
0.37451171875,
-0.322265625,
-0.1551513671875,
0.314208984375,
-0.09906005859375,
0.45703125,
0.325927734375,
-0.386474609375,
-0.146728515625,
-0.027099609375,
0.371337890625,
0.31201171875,
0.28466796875,
0.111083984375,
0.4072265625,
0.560546875,
-0.421630859375,
-0.28466796875,
-0.27197265625,
0.7451171875,
0.3720703125,
0.60546875,
0.517578125,
-0.69873046875,
-0.56103515625,
-1.0185546875,
0.193115234375,
0.34716796875,
1.0185546875,
-0.8740234375,
0.83935546875,
-0.276611328125,
-1.0048828125,
0.466064453125,
-0.69873046875,
-0.415283203125,
1.3056640625,
-0.42919921875,
0.54443359375,
-0.32568359375,
0.4345703125,
-0.30615234375,
-0.409423828125,
0.491455078125,
0.21630859375,
0.32861328125,
-0.40380859375,
-0.31591796875,
-0.267822265625,
-0.340087890625,
-0.061431884765625,
-0.62255859375,
0.06317138671875,
-0.60205078125,
-0.3095703125,
-0.3720703125,
0.452392578125,
1.0419921875,
0.541015625,
0.375732421875,
0.48828125,
0.06890869140625,
0.6455078125,
0.376220703125,
-0.5888671875,
0.271728515625,
-0.6279296875,
0.55859375,
-0.00940704345703125,
-0.11956787109375,
-0.490966796875,
-0.53369140625,
-0.775390625,
0.08233642578125,
0.04791259765625,
-0.327392578125,
-0.958984375,
0.427978515625,
0.1875,
0.45361328125,
-0.703125,
-0.5693359375,
-0.316650390625,
0.728515625,
0.3671875,
-0.401123046875,
0.10711669921875,
-0.67578125,
0.44921875,
0.572265625,
-0.2034912109375,
-0.75830078125,
-0.472412109375,
-0.537109375,
-0.70947265625,
0.433837890625,
-0.0628662109375,
0.0684814453125,
0.39013671875,
-0.87548828125,
0.6943359375,
0.12310791015625,
-0.033203125,
0.0841064453125,
0.162841796875,
0.689453125,
0.0689697265625,
0.67236328125,
-0.487060546875,
-0.5400390625,
0.428955078125,
-1.095703125,
0.6728515625,
-0.40234375,
0.28125,
-0.07623291015625,
-0.32177734375,
0.09320068359375,
0.421142578125,
-0.403076171875,
-0.20263671875,
-0.2039794921875,
0.638671875,
-0.8857421875,
-0.59814453125,
0.55712890625,
-0.2039794921875,
-0.42529296875,
0.458740234375,
0.0302581787109375,
-0.301513671875,
0.2069091796875,
0.437744140625,
-0.28515625,
0.10882568359375,
-0.7294921875,
0.6484375,
-0.423828125,
-0.271728515625,
0.06689453125,
-0.483642578125,
0.52392578125,
0.01313018798828125,
-0.912109375,
-0.6611328125,
-1.4091796875,
-0.6640625,
0.0887451171875,
-0.22412109375,
0.4853515625,
0.0200958251953125,
-0.3779296875,
-0.06689453125,
-1.046875,
-0.4306640625,
-0.5166015625,
-0.23291015625,
-0.412841796875,
0.48681640625,
0.66552734375,
0.6357421875,
-0.225830078125,
-0.724609375,
-0.01727294921875,
0.18408203125,
-0.45068359375,
-0.1959228515625,
-0.377685546875,
-0.11041259765625,
-0.31103515625,
-0.3310546875,
0.48095703125,
-0.483154296875,
0.454833984375,
1.07421875,
-0.274169921875,
0.5966796875,
0.1832275390625,
-0.7060546875,
1.1494140625,
0.09326171875,
-1.0322265625,
-0.591796875,
0.52880859375,
0.2274169921875,
0.689453125,
-0.09661865234375,
-0.66796875,
-0.492919921875,
-1.2158203125,
0.305419921875,
-0.515625,
-0.2442626953125,
-0.828125,
-0.0134429931640625,
-0.2103271484375,
0.826171875,
0.0960693359375,
-0.76171875,
0.35546875,
-0.97900390625,
0.5703125,
-0.54052734375,
-0.5576171875,
-0.5908203125,
-0.84375,
-0.402587890625,
0.9443359375,
0.4638671875,
0.041473388671875,
0.276611328125,
-0.1943359375,
-0.2060546875,
-0.32177734375,
-0.517578125,
-0.07470703125,
-0.1517333984375,
0.0204010009765625,
-0.38330078125,
-0.08447265625,
-0.67041015625,
1.1572265625,
-0.9130859375,
0.4677734375,
-0.270751953125,
-0.1942138671875,
0.07183837890625,
-0.59423828125,
0.9345703125,
-0.377685546875,
-0.179931640625,
-0.428955078125,
0.5712890625,
0.60400390625,
-0.2266845703125,
-0.460693359375,
-0.6728515625,
-0.7802734375,
-0.99951171875,
0.76904296875,
-0.59033203125,
-0.180908203125,
-0.51123046875,
0.5771484375,
0.62646484375,
-0.31689453125,
0.42724609375,
1.1640625,
0.120849609375,
0.1600341796875,
-0.76708984375,
0.450439453125,
0.60595703125,
-0.293701171875,
-0.0494384765625,
0.34033203125,
-0.75244140625,
0.2020263671875,
-0.337158203125,
-1.3583984375,
-0.57568359375,
0.272705078125,
1.38671875,
-0.324462890625,
0.394775390625,
0.3681640625,
-0.69189453125,
-0.57666015625,
0.79638671875,
-0.307861328125,
0.0611572265625,
0.99560546875,
-0.0294189453125,
-0.30126953125,
0.0182037353515625,
-0.29833984375,
-0.1583251953125,
-0.450439453125,
0.88330078125,
-0.262939453125,
-0.59228515625,
0.86083984375,
1.0888671875,
-0.98681640625,
-1.06640625,
0.01708984375,
-0.07061767578125,
-0.28564453125,
-0.5478515625,
-0.193603515625,
0.85009765625,
-0.414794921875,
0.048553466796875,
0.5498046875,
-0.158935546875,
0.1298828125,
0.1123046875,
-0.10821533203125,
-0.611328125,
0.493408203125,
0.49462890625,
-0.373779296875,
-0.27978515625,
-0.63134765625,
-0.12030029296875,
-0.47119140625,
0.00865936279296875,
0.513671875,
-0.4775390625,
-0.0292205810546875,
0.0853271484375,
0.00299835205078125,
0.94970703125,
-0.498046875,
-0.390380859375,
-0.06903076171875,
-1.07421875,
-0.58154296875,
0.426025390625,
0.146240234375,
-0.166748046875,
0.14013671875,
-0.65771484375,
-0.27783203125,
0.3994140625,
0.2059326171875,
0.136474609375,
-1.0380859375,
0.06219482421875,
-0.80908203125,
-0.2142333984375,
-0.962890625,
-0.7841796875,
-0.2210693359375,
0.39208984375,
0.2308349609375,
-0.32275390625,
0.40087890625,
0.005550384521484375,
-0.408447265625,
1.0771484375,
-0.4599609375,
0.0911865234375,
-0.68701171875,
-0.1285400390625,
-0.71142578125,
-0.2239990234375,
-0.40966796875,
-0.2159423828125,
-0.292724609375,
0.5283203125,
0.042510986328125,
0.61083984375,
-0.11761474609375,
0.61669921875,
-0.2578125,
-0.7333984375,
-0.192138671875,
0.0753173828125,
-0.2296142578125,
0.450439453125,
0.7529296875,
-0.070556640625,
0.0224761962890625,
0.291748046875,
-0.47412109375,
-0.5478515625,
0.408935546875,
0.31689453125,
-0.04742431640625,
-0.17822265625,
-0.3291015625,
0.335693359375,
-0.73193359375,
0.0992431640625,
-0.59716796875,
0.06475830078125,
0.177978515625,
-0.12274169921875,
0.375,
0.8876953125,
0.364013671875,
0.274169921875,
0.374267578125,
0.7138671875,
0.505859375,
0.1490478515625,
0.433837890625,
0.54638671875,
-0.177978515625,
-0.64794921875,
0.165771484375,
0.7177734375,
-0.22265625,
0.30859375,
-0.6513671875,
-0.46875,
-0.76220703125,
-0.475830078125,
0.12493896484375,
-0.047698974609375,
-0.031463623046875,
-0.58203125,
0.31884765625,
-0.006778717041015625,
-0.332275390625,
0.04327392578125,
-0.93701171875,
-1.0107421875,
0.5341796875,
0.1480712890625,
-0.1524658203125,
-0.2841796875,
-0.64697265625,
-0.473388671875,
0.25048828125,
0.5791015625,
-0.308349609375,
0.362060546875,
-0.402099609375,
0.82666015625,
-0.61279296875,
0.421630859375,
0.09063720703125,
0.2205810546875,
-0.712890625,
-0.46484375,
0.2154541015625,
1.142578125,
0.378662109375,
-0.0015401840209960938,
-0.7060546875,
0.152587890625,
-0.0023174285888671875,
-0.0171356201171875,
-0.467529296875,
0.369873046875,
-0.39501953125,
0.68994140625,
-0.59228515625,
0.34130859375,
-0.1141357421875,
0.76904296875,
0.65771484375,
-0.413818359375,
-0.83544921875,
0.8857421875,
0.41845703125,
-0.2802734375,
0.256591796875,
0.307373046875,
0.189697265625,
-0.412841796875,
0.0014009475708007812,
-0.385498046875,
0.40576171875,
0.5078125,
0.51416015625,
-0.2139892578125,
0.6640625,
0.470947265625,
-0.275390625,
0.07891845703125,
0.82568359375,
0.646484375,
-0.376708984375,
-0.11773681640625,
-0.414306640625,
-0.334716796875,
0.1805419921875,
-0.62890625,
0.6142578125,
-0.1539306640625,
-0.086669921875,
-0.35009765625,
-0.927734375,
0.541015625,
-0.2034912109375,
0.2125244140625,
0.08209228515625,
-0.32421875,
0.370849609375,
0.96533203125,
-0.2103271484375,
0.1583251953125,
0.5947265625,
0.66259765625,
0.1839599609375,
0.78125,
0.424560546875,
0.332275390625,
-0.4560546875,
-0.0210113525390625,
0.1572265625,
-0.01151275634765625,
-0.207275390625,
-0.245361328125,
-1.037109375,
0.8720703125,
-0.1351318359375,
-0.1552734375,
0.87451171875,
-0.8837890625,
0.1187744140625,
-0.480224609375,
0.59716796875,
-0.7255859375,
0.352294921875,
0.1781005859375,
-0.038360595703125,
-0.9443359375,
0.80615234375,
-0.16015625,
0.2353515625,
0.28173828125,
1.2314453125,
-0.004360198974609375,
1.099609375,
0.60791015625,
-0.258056640625,
-0.1619873046875,
0.354736328125,
-0.43359375,
-0.44873046875,
-0.1348876953125,
-0.38818359375,
-0.1968994140625,
-0.9970703125,
-0.505859375,
-0.190673828125,
0.86962890625,
0.1080322265625,
-0.89599609375,
-0.38525390625,
0.1495361328125,
-0.4306640625,
0.51025390625,
0.53173828125,
0.0966796875,
-0.340576171875,
-0.1011962890625,
-0.3701171875,
-0.4287109375,
-0.01528167724609375,
-0.481201171875,
0.46240234375,
-0.39306640625,
-0.78857421875,
-0.411865234375,
-0.7392578125,
-0.42724609375,
0.0273590087890625,
-0.391357421875,
-0.71142578125,
0.6015625,
0.896484375,
0.50244140625,
0.04632568359375,
-0.4814453125,
0.248046875,
0.8798828125,
1.2529296875,
-0.11895751953125,
0.94677734375,
-0.08184814453125,
0.07489013671875,
0.382080078125,
-0.8701171875,
0.43896484375,
0.0667724609375,
0.33544921875,
-0.333740234375,
0.44921875,
-0.734375,
-1.83203125,
-0.09759521484375,
0.66162109375,
0.53466796875,
-0.68017578125,
-1.2880859375,
-0.0134735107421875,
-1.54296875,
-0.365478515625,
-0.35693359375,
0.68115234375,
-0.6884765625,
0.124267578125,
-0.3076171875,
-1.2509765625,
4.328125,
1.193359375,
0.99658203125,
0.29638671875,
0.5693359375,
1.025390625,
0.52783203125,
-0.71630859375,
0.15380859375,
-0.193359375,
0.5166015625,
-0.26611328125,
-0.007793426513671875,
0.56884765625,
0.4345703125,
0.66650390625,
-0.88330078125,
0.138427734375,
-0.1490478515625,
-0.94873046875,
-0.890625,
0.27001953125,
0.034210205078125,
0.6533203125,
0.12841796875,
0.2298583984375,
0.377197265625,
-0.66845703125,
-0.32177734375,
-0.84130859375,
-0.1712646484375,
-0.509765625,
1.00390625,
0.090087890625,
-0.39697265625,
0.75146484375,
0.05841064453125,
-0.67724609375,
-0.1563720703125,
-0.039947509765625,
-0.2161865234375,
0.2113037109375,
0.630859375,
-0.83984375,
0.402099609375,
0.53076171875,
-0.77197265625,
0.353515625,
0.65478515625,
-0.95458984375,
1.373046875,
-0.12353515625,
0.58203125,
-1.4052734375,
-0.77001953125,
-0.2335205078125,
0.10736083984375,
-0.361328125,
-0.5615234375,
0.2138671875,
0.52587890625,
0.10186767578125,
0.198486328125,
0.54296875,
-0.75,
1.0830078125,
-0.27099609375,
0.1729736328125,
-0.52099609375,
-0.004322052001953125,
-0.53466796875,
0.031707763671875,
-0.059478759765625,
-0.220947265625,
0.83740234375,
0.21728515625,
0.0965576171875,
0.1365966796875,
0.390869140625,
-0.6728515625,
0.239990234375,
-0.04766845703125,
-0.45361328125,
-0.247802734375,
0.0709228515625,
1.478515625,
-0.449462890625,
-0.003932952880859375,
-0.521484375,
0.93212890625,
0.29052734375,
0.364501953125,
-0.36181640625,
-0.75341796875,
-0.42041015625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters.
There is a filler word ogo in Oleg's speech. All words that can be obtained from ogo by adding go several times to the end of it are also considered to be fillers. For example, the words ogo, ogogo, ogogogo are fillers, but the words go, og, ogog, ogogog and oggo are not fillers.
The fillers have maximal size, for example, for ogogoo speech we can't consider ogo a filler and goo as a normal phrase. We should consider ogogo as a filler here.
To print the interview, Polycarp has to replace each of the fillers with three asterisks. Note that a filler word is replaced with exactly three asterisks regardless of its length.
Polycarp has dealt with this problem in no time. Can you do the same? The clock is ticking!
Input
The first line contains a positive integer n (1 ≤ n ≤ 100) — the length of the interview.
The second line contains the string s of length n, consisting of lowercase English letters.
Output
Print the interview text after the replacement of each of the fillers with "***". It is allowed for the substring "***" to have several consecutive occurences.
Examples
Input
7
aogogob
Output
a***b
Input
13
ogogmgogogogo
Output
***gmg***
Input
9
ogoogoogo
Output
*********
Note
The first sample contains one filler word ogogo, so the interview for printing is "a***b".
The second sample contains two fillers ogo and ogogogo. Thus, the interview is transformed to "***gmg***".
Tags: implementation, strings
Correct Solution:
```
#
# Created by Polusummator on 25.10.2020
# --------- Little PyPy Squad ---------
# Verdict:
#
n = int(input())
s = input()
# ans = ''
# prev = ''
first = 'o' + 'go' * n
# print(first)
while first != 'o':
# print(first)
s = s.replace(first, '***')
n -= 1
first = 'o' + 'go' * n
print(s)
# for i in range(n):
# if s[i] != 'o' and s[i] != 'g':
# ans += s[i]
# elif s[i] == 'o':
# if prev
```
| 45,018
|
[
0.60791015625,
-0.2359619140625,
-0.08038330078125,
0.469970703125,
-0.493408203125,
-0.974609375,
-0.1239013671875,
0.11932373046875,
0.27392578125,
0.10858154296875,
0.90771484375,
-0.1253662109375,
0.2000732421875,
-1.125,
-0.47607421875,
0.2091064453125,
-0.393798828125,
-0.61376953125,
-0.328857421875,
-0.34326171875,
-0.03656005859375,
-0.432861328125,
-1.3037109375,
-0.38037109375,
-0.8017578125,
1.2392578125,
0.11480712890625,
0.533203125,
0.9912109375,
1.0029296875,
-0.447998046875,
-0.05340576171875,
0.325927734375,
-1.18359375,
0.03778076171875,
-0.38720703125,
0.72509765625,
-0.393798828125,
-0.4990234375,
-0.326171875,
0.09442138671875,
-0.62353515625,
1.1357421875,
-0.54931640625,
-1.298828125,
-0.15625,
-0.41015625,
-0.2900390625,
-0.2391357421875,
-0.314697265625,
0.52880859375,
0.1336669921875,
0.78271484375,
0.049957275390625,
-0.032745361328125,
-0.478271484375,
-0.1239013671875,
-0.224609375,
-0.472412109375,
0.3271484375,
0.3037109375,
0.7109375,
0.0469970703125,
-0.8828125,
-0.426025390625,
0.4423828125,
-0.002300262451171875,
0.121826171875,
-0.0279083251953125,
-0.44775390625,
-0.54833984375,
0.01296234130859375,
-0.2200927734375,
-0.448486328125,
0.214111328125,
-0.143310546875,
0.08038330078125,
-0.0914306640625,
-0.6376953125,
0.58740234375,
0.40869140625,
1.271484375,
0.439208984375,
0.1983642578125,
-0.342529296875,
-0.578125,
0.1220703125,
0.3330078125,
0.544921875,
-0.048004150390625,
-0.5869140625,
0.75,
-0.69140625,
-0.2333984375,
0.409423828125,
0.58447265625,
-0.53125,
0.1553955078125,
0.0150299072265625,
0.1807861328125,
0.7578125,
1.025390625,
-0.1259765625,
1.072265625,
0.201171875,
-0.0501708984375,
0.460693359375,
0.271728515625,
0.1854248046875,
-0.444091796875,
-0.254150390625,
-0.52734375,
0.55615234375,
-0.0038509368896484375,
-0.18701171875,
1.0419921875,
-0.1798095703125,
0.23681640625,
-0.56494140625,
0.1387939453125,
0.12469482421875,
0.150390625,
0.367431640625,
-0.1424560546875,
0.0882568359375,
-0.57275390625,
-0.65869140625,
1.2900390625,
-0.5087890625,
-0.17578125,
0.5810546875,
0.26220703125,
-0.006618499755859375,
0.1934814453125,
-0.17919921875,
0.67626953125,
-0.0372314453125,
0.6484375,
0.5078125,
-0.479248046875,
0.6328125,
0.10931396484375,
-0.272216796875,
1.2177734375,
0.102783203125,
0.69970703125,
0.409912109375,
0.11395263671875,
-0.61572265625,
0.475341796875,
-0.94775390625,
0.395263671875,
0.24609375,
0.1922607421875,
-0.5341796875,
0.56884765625,
-0.336669921875,
0.5908203125,
0.576171875,
-0.0916748046875,
-0.1500244140625,
-0.10302734375,
-0.48193359375,
1.138671875,
-0.740234375,
1.169921875,
-0.4111328125,
0.01129150390625,
-0.01004791259765625,
-0.1693115234375,
0.263671875,
0.10284423828125,
-0.256591796875,
0.62890625,
0.419677734375,
1.216796875,
0.9013671875,
-0.04791259765625,
0.423828125,
0.0845947265625,
0.055267333984375,
0.264892578125,
0.06817626953125,
0.89306640625,
0.62109375,
0.56298828125,
-0.162109375,
-0.07470703125,
-0.207763671875,
-0.77392578125,
0.1865234375,
0.5078125,
-0.587890625,
0.027801513671875,
0.09844970703125,
0.360595703125,
-0.806640625,
-0.06707763671875,
-0.2322998046875,
-1.0556640625,
-0.1031494140625,
0.81298828125,
-0.2298583984375,
0.70703125,
-0.293701171875,
-0.4404296875,
0.477783203125,
1.146484375,
0.10235595703125,
0.1810302734375,
0.6318359375,
0.1201171875,
-0.1383056640625,
-0.1932373046875,
0.233642578125,
-0.61328125,
-0.76513671875,
0.64794921875,
-0.14599609375,
-0.028045654296875,
0.053985595703125,
0.50390625,
0.3818359375,
0.402099609375,
0.20703125,
-0.1448974609375,
0.372802734375,
0.9921875,
-0.05108642578125,
0.423828125,
-0.1922607421875,
0.81494140625,
0.75634765625,
0.86767578125,
0.463134765625,
0.076904296875,
0.89453125,
0.583984375,
0.147216796875,
0.034637451171875,
-0.315673828125,
0.7978515625,
0.406982421875,
0.54638671875,
-0.191162109375,
0.50634765625,
-0.54052734375,
-0.022430419921875,
-0.140869140625,
0.07318115234375,
-0.426025390625,
0.94384765625,
-0.27978515625,
0.833984375,
-0.4306640625,
-0.69384765625,
0.4580078125,
0.87548828125,
-0.496337890625,
-0.493896484375,
0.358154296875,
-0.0799560546875,
0.41162109375,
0.11224365234375,
0.229736328125,
0.10009765625,
0.09619140625,
0.39501953125,
-0.323974609375,
-0.3193359375,
-0.80419921875,
-0.806640625,
-0.494873046875,
-0.68603515625,
-0.84814453125,
-0.2314453125,
0.5595703125,
-1.07421875,
0.032867431640625,
-0.324462890625,
-0.353515625,
-0.0095367431640625,
-0.5673828125,
0.724609375,
-0.30712890625,
0.3232421875,
-0.9443359375,
0.49560546875,
0.1240234375,
1.0927734375,
-0.484130859375,
-0.0992431640625,
-0.1541748046875,
-0.587890625,
0.299560546875,
0.440673828125,
0.273681640625,
0.267333984375,
-0.493408203125,
-0.52001953125,
-0.2174072265625,
0.052001953125,
-0.2406005859375,
0.30029296875,
-0.302490234375,
0.75732421875,
0.306640625,
-0.53515625,
0.87939453125,
0.5185546875,
-0.60302734375,
0.50390625,
0.3515625,
0.061553955078125,
-0.77099609375,
1.1748046875,
0.56982421875,
0.438232421875,
-0.6162109375,
-0.2333984375,
-0.623046875,
0.1556396484375,
0.2010498046875,
-0.52978515625,
-0.380615234375,
0.495361328125,
0.1656494140625,
-1.0830078125,
0.9287109375,
-1.2763671875,
-0.8359375,
-0.6865234375,
-0.71142578125,
0.82763671875,
1.0908203125,
-0.09033203125,
-0.79296875,
-0.0400390625,
-0.48095703125,
0.443115234375,
0.37158203125,
-0.339111328125,
-0.1824951171875,
0.328125,
-0.1270751953125,
0.489990234375,
0.34765625,
-0.37353515625,
-0.1112060546875,
-0.07794189453125,
0.37841796875,
0.319091796875,
0.301513671875,
0.09332275390625,
0.3798828125,
0.58740234375,
-0.43408203125,
-0.32373046875,
-0.300048828125,
0.70361328125,
0.39599609375,
0.62060546875,
0.521484375,
-0.73095703125,
-0.544921875,
-1.056640625,
0.1937255859375,
0.31982421875,
1.03125,
-0.85009765625,
0.86376953125,
-0.278076171875,
-0.99267578125,
0.5029296875,
-0.70458984375,
-0.371826171875,
1.328125,
-0.472412109375,
0.5126953125,
-0.301025390625,
0.446044921875,
-0.271484375,
-0.41650390625,
0.53173828125,
0.253173828125,
0.322021484375,
-0.433349609375,
-0.304931640625,
-0.27783203125,
-0.346923828125,
-0.0153350830078125,
-0.62646484375,
0.04241943359375,
-0.60595703125,
-0.30126953125,
-0.369873046875,
0.419189453125,
1.1044921875,
0.55322265625,
0.40966796875,
0.546875,
0.09906005859375,
0.67529296875,
0.38916015625,
-0.56298828125,
0.287109375,
-0.6484375,
0.587890625,
0.00824737548828125,
-0.1522216796875,
-0.474365234375,
-0.52734375,
-0.75732421875,
0.08319091796875,
-0.0070037841796875,
-0.31640625,
-0.98828125,
0.40966796875,
0.1856689453125,
0.4912109375,
-0.70751953125,
-0.556640625,
-0.343994140625,
0.72998046875,
0.343994140625,
-0.410888671875,
0.1209716796875,
-0.68505859375,
0.471435546875,
0.5634765625,
-0.1817626953125,
-0.73974609375,
-0.487548828125,
-0.58056640625,
-0.6875,
0.442138671875,
-0.06304931640625,
0.08984375,
0.3544921875,
-0.9169921875,
0.693359375,
0.127197265625,
-0.04083251953125,
0.1104736328125,
0.164306640625,
0.6826171875,
0.08392333984375,
0.65673828125,
-0.50732421875,
-0.541015625,
0.427490234375,
-1.078125,
0.67626953125,
-0.45068359375,
0.269287109375,
-0.06341552734375,
-0.3193359375,
0.12066650390625,
0.440185546875,
-0.362548828125,
-0.17041015625,
-0.20947265625,
0.64697265625,
-0.8916015625,
-0.60546875,
0.5791015625,
-0.202880859375,
-0.4306640625,
0.47021484375,
0.052490234375,
-0.301513671875,
0.21240234375,
0.442138671875,
-0.289794921875,
0.15380859375,
-0.71533203125,
0.6806640625,
-0.447998046875,
-0.28271484375,
0.03216552734375,
-0.459228515625,
0.52099609375,
0.007106781005859375,
-0.93896484375,
-0.6865234375,
-1.4345703125,
-0.7060546875,
0.11358642578125,
-0.2130126953125,
0.459228515625,
-0.024566650390625,
-0.364501953125,
-0.041229248046875,
-1.0283203125,
-0.490478515625,
-0.50439453125,
-0.2264404296875,
-0.39404296875,
0.498291015625,
0.626953125,
0.634765625,
-0.2174072265625,
-0.73046875,
0.0168304443359375,
0.193115234375,
-0.461181640625,
-0.22265625,
-0.3720703125,
-0.184326171875,
-0.321533203125,
-0.3271484375,
0.4794921875,
-0.44384765625,
0.49462890625,
1.119140625,
-0.27685546875,
0.5869140625,
0.1436767578125,
-0.7294921875,
1.1494140625,
0.0836181640625,
-1.03515625,
-0.58203125,
0.533203125,
0.250732421875,
0.70654296875,
-0.08575439453125,
-0.716796875,
-0.52490234375,
-1.2255859375,
0.329345703125,
-0.52197265625,
-0.222900390625,
-0.87939453125,
-0.0362548828125,
-0.1905517578125,
0.841796875,
0.06256103515625,
-0.7294921875,
0.3212890625,
-0.9462890625,
0.5498046875,
-0.55908203125,
-0.59033203125,
-0.615234375,
-0.84716796875,
-0.43359375,
0.96728515625,
0.4697265625,
0.0474853515625,
0.327392578125,
-0.183349609375,
-0.211181640625,
-0.3056640625,
-0.53125,
-0.1083984375,
-0.1455078125,
0.0247344970703125,
-0.35205078125,
-0.1026611328125,
-0.6875,
1.1591796875,
-0.9169921875,
0.477783203125,
-0.25244140625,
-0.230224609375,
0.051055908203125,
-0.61328125,
0.9482421875,
-0.4208984375,
-0.1483154296875,
-0.412109375,
0.513671875,
0.61279296875,
-0.2178955078125,
-0.4619140625,
-0.630859375,
-0.78173828125,
-0.978515625,
0.78271484375,
-0.609375,
-0.1494140625,
-0.491455078125,
0.5634765625,
0.61181640625,
-0.330810546875,
0.431884765625,
1.1357421875,
0.0789794921875,
0.1600341796875,
-0.71923828125,
0.45458984375,
0.5927734375,
-0.28759765625,
-0.038604736328125,
0.355224609375,
-0.74755859375,
0.177978515625,
-0.349365234375,
-1.3818359375,
-0.580078125,
0.2822265625,
1.40234375,
-0.36181640625,
0.3818359375,
0.347900390625,
-0.6796875,
-0.58154296875,
0.837890625,
-0.3193359375,
0.0777587890625,
1.009765625,
-0.06591796875,
-0.3134765625,
0.034088134765625,
-0.295654296875,
-0.1505126953125,
-0.44921875,
0.90625,
-0.263671875,
-0.61181640625,
0.86865234375,
1.115234375,
-0.97607421875,
-1.064453125,
-0.01328277587890625,
-0.08721923828125,
-0.304443359375,
-0.57373046875,
-0.184814453125,
0.85009765625,
-0.44873046875,
0.020721435546875,
0.5498046875,
-0.1348876953125,
0.1468505859375,
0.11761474609375,
-0.09295654296875,
-0.58349609375,
0.4697265625,
0.53125,
-0.418212890625,
-0.268798828125,
-0.61376953125,
-0.09375,
-0.461669921875,
0.0164031982421875,
0.5546875,
-0.505859375,
-0.0167999267578125,
0.08306884765625,
0.0014781951904296875,
0.931640625,
-0.52490234375,
-0.38037109375,
-0.04693603515625,
-1.0791015625,
-0.54541015625,
0.45068359375,
0.1590576171875,
-0.1964111328125,
0.1622314453125,
-0.6767578125,
-0.254150390625,
0.35693359375,
0.1998291015625,
0.1207275390625,
-1.0009765625,
0.078857421875,
-0.8017578125,
-0.2042236328125,
-0.96728515625,
-0.82177734375,
-0.231689453125,
0.39111328125,
0.2364501953125,
-0.349609375,
0.41943359375,
0.029022216796875,
-0.420654296875,
1.0791015625,
-0.477783203125,
0.11907958984375,
-0.70458984375,
-0.100830078125,
-0.6904296875,
-0.24365234375,
-0.434814453125,
-0.208740234375,
-0.340087890625,
0.529296875,
0.062225341796875,
0.60400390625,
-0.106201171875,
0.623046875,
-0.283447265625,
-0.7470703125,
-0.2347412109375,
0.06317138671875,
-0.2188720703125,
0.451171875,
0.7841796875,
-0.06719970703125,
0.06488037109375,
0.2900390625,
-0.47216796875,
-0.5771484375,
0.4384765625,
0.31884765625,
-0.03875732421875,
-0.1807861328125,
-0.3017578125,
0.346435546875,
-0.7177734375,
0.09710693359375,
-0.5810546875,
0.044647216796875,
0.1875,
-0.149658203125,
0.39453125,
0.86962890625,
0.349609375,
0.271728515625,
0.408447265625,
0.73681640625,
0.513671875,
0.1348876953125,
0.408447265625,
0.5302734375,
-0.15478515625,
-0.6875,
0.1478271484375,
0.74462890625,
-0.1864013671875,
0.295654296875,
-0.62451171875,
-0.478515625,
-0.7744140625,
-0.496826171875,
0.12103271484375,
-0.055145263671875,
-0.03521728515625,
-0.5029296875,
0.299072265625,
0.005916595458984375,
-0.368408203125,
0.0190887451171875,
-0.93994140625,
-1.0224609375,
0.53564453125,
0.1439208984375,
-0.1773681640625,
-0.31787109375,
-0.6162109375,
-0.447265625,
0.27978515625,
0.61572265625,
-0.3037109375,
0.37255859375,
-0.396240234375,
0.82861328125,
-0.59912109375,
0.412353515625,
0.091064453125,
0.1971435546875,
-0.68701171875,
-0.470947265625,
0.212158203125,
1.197265625,
0.3818359375,
-0.02532958984375,
-0.71533203125,
0.142333984375,
0.01508331298828125,
-0.053680419921875,
-0.4873046875,
0.36865234375,
-0.36865234375,
0.681640625,
-0.60498046875,
0.3125,
-0.10504150390625,
0.74609375,
0.6767578125,
-0.464111328125,
-0.84423828125,
0.8583984375,
0.4267578125,
-0.2568359375,
0.2802734375,
0.294189453125,
0.165771484375,
-0.48828125,
0.0272064208984375,
-0.397216796875,
0.382080078125,
0.54150390625,
0.52197265625,
-0.1763916015625,
0.70556640625,
0.494873046875,
-0.29541015625,
0.1025390625,
0.83056640625,
0.66796875,
-0.38671875,
-0.15966796875,
-0.41064453125,
-0.3076171875,
0.14599609375,
-0.623046875,
0.6064453125,
-0.154296875,
-0.070556640625,
-0.314453125,
-0.951171875,
0.50244140625,
-0.251708984375,
0.214111328125,
0.057220458984375,
-0.302978515625,
0.352294921875,
0.9931640625,
-0.181884765625,
0.1385498046875,
0.58544921875,
0.64794921875,
0.195068359375,
0.759765625,
0.442138671875,
0.3251953125,
-0.47900390625,
-0.0177764892578125,
0.1427001953125,
-0.052825927734375,
-0.235107421875,
-0.191650390625,
-1.0439453125,
0.89453125,
-0.10693359375,
-0.13427734375,
0.8642578125,
-0.875,
0.1331787109375,
-0.47607421875,
0.6171875,
-0.7353515625,
0.328857421875,
0.1884765625,
-0.08050537109375,
-0.88720703125,
0.802734375,
-0.1778564453125,
0.2509765625,
0.268798828125,
1.208984375,
-0.0008397102355957031,
1.150390625,
0.6083984375,
-0.206787109375,
-0.2054443359375,
0.365966796875,
-0.447998046875,
-0.464599609375,
-0.144775390625,
-0.393310546875,
-0.184814453125,
-1.0361328125,
-0.5,
-0.1416015625,
0.92822265625,
0.14697265625,
-0.90771484375,
-0.384521484375,
0.155029296875,
-0.4404296875,
0.48681640625,
0.5234375,
0.0694580078125,
-0.298095703125,
-0.08349609375,
-0.37646484375,
-0.437744140625,
-0.05328369140625,
-0.471435546875,
0.46630859375,
-0.413818359375,
-0.8017578125,
-0.4189453125,
-0.7666015625,
-0.422119140625,
0.01320648193359375,
-0.37158203125,
-0.7216796875,
0.6025390625,
0.85595703125,
0.50732421875,
0.05224609375,
-0.4560546875,
0.2415771484375,
0.86474609375,
1.23046875,
-0.1224365234375,
0.93798828125,
-0.1199951171875,
0.1014404296875,
0.383056640625,
-0.8740234375,
0.431884765625,
0.0770263671875,
0.32177734375,
-0.3720703125,
0.473388671875,
-0.72998046875,
-1.8408203125,
-0.058807373046875,
0.66845703125,
0.5693359375,
-0.73193359375,
-1.2900390625,
-0.023590087890625,
-1.513671875,
-0.35107421875,
-0.31982421875,
0.6796875,
-0.69091796875,
0.1427001953125,
-0.294677734375,
-1.2685546875,
4.296875,
1.19921875,
1.01953125,
0.295654296875,
0.5703125,
1.0009765625,
0.53662109375,
-0.69482421875,
0.1505126953125,
-0.201904296875,
0.51806640625,
-0.2509765625,
-0.0296630859375,
0.58642578125,
0.456298828125,
0.677734375,
-0.85888671875,
0.10931396484375,
-0.1572265625,
-0.9697265625,
-0.8701171875,
0.2208251953125,
0.03558349609375,
0.671875,
0.1585693359375,
0.2288818359375,
0.35400390625,
-0.64453125,
-0.335205078125,
-0.8388671875,
-0.1575927734375,
-0.497802734375,
0.984375,
0.05908203125,
-0.416748046875,
0.7353515625,
0.037841796875,
-0.7041015625,
-0.1383056640625,
0.0010995864868164062,
-0.234619140625,
0.221923828125,
0.63232421875,
-0.806640625,
0.42431640625,
0.51416015625,
-0.7705078125,
0.337646484375,
0.63330078125,
-0.97802734375,
1.359375,
-0.129150390625,
0.6103515625,
-1.392578125,
-0.77197265625,
-0.23095703125,
0.0777587890625,
-0.363525390625,
-0.5400390625,
0.2320556640625,
0.5146484375,
0.08831787109375,
0.2139892578125,
0.54833984375,
-0.76611328125,
1.130859375,
-0.298583984375,
0.166259765625,
-0.53173828125,
-0.0059051513671875,
-0.529296875,
0.062255859375,
-0.046630859375,
-0.227294921875,
0.806640625,
0.1824951171875,
0.1375732421875,
0.149658203125,
0.38525390625,
-0.66748046875,
0.2119140625,
-0.022186279296875,
-0.475830078125,
-0.25634765625,
0.08380126953125,
1.4453125,
-0.471435546875,
-0.017303466796875,
-0.47314453125,
0.9443359375,
0.255126953125,
0.37255859375,
-0.387939453125,
-0.76123046875,
-0.43359375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters.
There is a filler word ogo in Oleg's speech. All words that can be obtained from ogo by adding go several times to the end of it are also considered to be fillers. For example, the words ogo, ogogo, ogogogo are fillers, but the words go, og, ogog, ogogog and oggo are not fillers.
The fillers have maximal size, for example, for ogogoo speech we can't consider ogo a filler and goo as a normal phrase. We should consider ogogo as a filler here.
To print the interview, Polycarp has to replace each of the fillers with three asterisks. Note that a filler word is replaced with exactly three asterisks regardless of its length.
Polycarp has dealt with this problem in no time. Can you do the same? The clock is ticking!
Input
The first line contains a positive integer n (1 ≤ n ≤ 100) — the length of the interview.
The second line contains the string s of length n, consisting of lowercase English letters.
Output
Print the interview text after the replacement of each of the fillers with "***". It is allowed for the substring "***" to have several consecutive occurences.
Examples
Input
7
aogogob
Output
a***b
Input
13
ogogmgogogogo
Output
***gmg***
Input
9
ogoogoogo
Output
*********
Note
The first sample contains one filler word ogogo, so the interview for printing is "a***b".
The second sample contains two fillers ogo and ogogogo. Thus, the interview is transformed to "***gmg***".
Tags: implementation, strings
Correct Solution:
```
import re
n = int(input())
s = input()
s = s.lower()
while 'ogo' in s:
s = re.sub('o(go)+', '***', s)
print(s)
```
| 45,019
|
[
0.62841796875,
-0.228759765625,
-0.1051025390625,
0.37841796875,
-0.5302734375,
-0.923828125,
-0.1048583984375,
0.116943359375,
0.245849609375,
0.1552734375,
0.88916015625,
-0.11322021484375,
0.2025146484375,
-1.1357421875,
-0.462646484375,
0.215087890625,
-0.383056640625,
-0.64794921875,
-0.3662109375,
-0.329833984375,
-0.026031494140625,
-0.464599609375,
-1.259765625,
-0.38818359375,
-0.7890625,
1.1416015625,
0.1529541015625,
0.5458984375,
1.001953125,
1.0244140625,
-0.358642578125,
-0.0199432373046875,
0.287353515625,
-1.208984375,
0.08056640625,
-0.430908203125,
0.73095703125,
-0.44921875,
-0.454833984375,
-0.355712890625,
0.09228515625,
-0.5947265625,
1.1201171875,
-0.564453125,
-1.279296875,
-0.0992431640625,
-0.36767578125,
-0.28662109375,
-0.2005615234375,
-0.3056640625,
0.5234375,
0.15673828125,
0.77294921875,
0.065185546875,
0.005870819091796875,
-0.443359375,
-0.061920166015625,
-0.209228515625,
-0.471435546875,
0.335693359375,
0.367919921875,
0.68212890625,
0.05810546875,
-0.88232421875,
-0.40576171875,
0.46923828125,
0.01995849609375,
0.10223388671875,
-0.006084442138671875,
-0.48046875,
-0.52685546875,
-0.043243408203125,
-0.2198486328125,
-0.44873046875,
0.20458984375,
-0.138671875,
0.110107421875,
-0.11651611328125,
-0.60791015625,
0.5595703125,
0.45703125,
1.2861328125,
0.435791015625,
0.2369384765625,
-0.31103515625,
-0.572265625,
0.13623046875,
0.31103515625,
0.55419921875,
-0.07244873046875,
-0.57373046875,
0.7392578125,
-0.65625,
-0.206787109375,
0.380126953125,
0.5673828125,
-0.5498046875,
0.169189453125,
0.034515380859375,
0.1358642578125,
0.73974609375,
0.99169921875,
-0.1005859375,
1.0634765625,
0.2178955078125,
-0.0297698974609375,
0.42529296875,
0.251953125,
0.225830078125,
-0.449951171875,
-0.26904296875,
-0.52099609375,
0.5703125,
-0.0125579833984375,
-0.18701171875,
1.025390625,
-0.206298828125,
0.2291259765625,
-0.56640625,
0.171142578125,
0.11175537109375,
0.130859375,
0.3486328125,
-0.1484375,
0.0758056640625,
-0.53076171875,
-0.70654296875,
1.29296875,
-0.54638671875,
-0.189208984375,
0.53955078125,
0.2335205078125,
-0.0037212371826171875,
0.2027587890625,
-0.1739501953125,
0.66064453125,
-0.03582763671875,
0.6572265625,
0.50537109375,
-0.45556640625,
0.6201171875,
0.1190185546875,
-0.251708984375,
1.216796875,
0.046478271484375,
0.70458984375,
0.384033203125,
0.1748046875,
-0.578125,
0.469970703125,
-0.91748046875,
0.341796875,
0.2235107421875,
0.1748046875,
-0.533203125,
0.548828125,
-0.337158203125,
0.5810546875,
0.525390625,
-0.10595703125,
-0.1866455078125,
-0.1427001953125,
-0.49072265625,
1.1474609375,
-0.71875,
1.185546875,
-0.4375,
-0.005977630615234375,
-0.012664794921875,
-0.18017578125,
0.2496337890625,
0.10968017578125,
-0.24755859375,
0.57666015625,
0.4052734375,
1.1982421875,
0.8515625,
-0.0193939208984375,
0.385009765625,
0.137451171875,
0.0230255126953125,
0.2440185546875,
0.11639404296875,
0.88720703125,
0.57470703125,
0.5322265625,
-0.13232421875,
-0.051422119140625,
-0.16455078125,
-0.70263671875,
0.26123046875,
0.49462890625,
-0.5361328125,
0.010498046875,
0.0888671875,
0.39208984375,
-0.7724609375,
-0.0355224609375,
-0.2303466796875,
-1.0009765625,
-0.1419677734375,
0.78759765625,
-0.2464599609375,
0.7333984375,
-0.317626953125,
-0.436279296875,
0.49609375,
1.1552734375,
0.032806396484375,
0.2005615234375,
0.64306640625,
0.1544189453125,
-0.2042236328125,
-0.157958984375,
0.173828125,
-0.591796875,
-0.77197265625,
0.5947265625,
-0.1273193359375,
-0.07305908203125,
0.054046630859375,
0.521484375,
0.327880859375,
0.39599609375,
0.19384765625,
-0.12359619140625,
0.3603515625,
1.005859375,
-0.06591796875,
0.477294921875,
-0.1998291015625,
0.82763671875,
0.71875,
0.876953125,
0.456787109375,
0.0288848876953125,
0.9287109375,
0.58984375,
0.1839599609375,
-0.00205230712890625,
-0.328125,
0.7626953125,
0.4296875,
0.5283203125,
-0.2081298828125,
0.496826171875,
-0.55615234375,
0.002532958984375,
-0.1365966796875,
0.10107421875,
-0.44580078125,
0.9501953125,
-0.294189453125,
0.8544921875,
-0.42333984375,
-0.6904296875,
0.492919921875,
0.89306640625,
-0.52099609375,
-0.4931640625,
0.356689453125,
-0.09326171875,
0.462158203125,
0.1322021484375,
0.2069091796875,
0.044189453125,
0.11004638671875,
0.4130859375,
-0.29541015625,
-0.315673828125,
-0.7919921875,
-0.7841796875,
-0.4794921875,
-0.64697265625,
-0.81005859375,
-0.263671875,
0.5751953125,
-1.0732421875,
-0.0056304931640625,
-0.33837890625,
-0.35107421875,
-0.003925323486328125,
-0.62158203125,
0.763671875,
-0.302734375,
0.292724609375,
-0.921875,
0.471435546875,
0.08984375,
1.087890625,
-0.472900390625,
-0.068359375,
-0.1142578125,
-0.5908203125,
0.299560546875,
0.436279296875,
0.2191162109375,
0.2496337890625,
-0.4736328125,
-0.53564453125,
-0.30126953125,
0.061737060546875,
-0.2218017578125,
0.2666015625,
-0.261474609375,
0.74658203125,
0.269287109375,
-0.5595703125,
0.86328125,
0.439453125,
-0.61328125,
0.49267578125,
0.322998046875,
0.0814208984375,
-0.75,
1.1064453125,
0.5537109375,
0.486328125,
-0.56787109375,
-0.252197265625,
-0.5869140625,
0.09527587890625,
0.2138671875,
-0.49658203125,
-0.36181640625,
0.529296875,
0.1824951171875,
-1.064453125,
0.97705078125,
-1.2412109375,
-0.85986328125,
-0.69775390625,
-0.748046875,
0.8173828125,
1.064453125,
-0.0950927734375,
-0.79296875,
-0.030303955078125,
-0.5302734375,
0.46142578125,
0.366455078125,
-0.3134765625,
-0.1676025390625,
0.312744140625,
-0.08251953125,
0.50244140625,
0.30224609375,
-0.385986328125,
-0.163330078125,
-0.023223876953125,
0.37744140625,
0.31640625,
0.31396484375,
0.1258544921875,
0.413330078125,
0.57470703125,
-0.416259765625,
-0.27490234375,
-0.276123046875,
0.75927734375,
0.398681640625,
0.60498046875,
0.4814453125,
-0.74169921875,
-0.54736328125,
-0.998046875,
0.1920166015625,
0.339599609375,
0.98095703125,
-0.873046875,
0.85595703125,
-0.3037109375,
-1.0087890625,
0.494384765625,
-0.6953125,
-0.4111328125,
1.314453125,
-0.410888671875,
0.54638671875,
-0.355224609375,
0.443603515625,
-0.332275390625,
-0.423095703125,
0.4833984375,
0.182373046875,
0.3193359375,
-0.439697265625,
-0.28369140625,
-0.306884765625,
-0.308349609375,
-0.0760498046875,
-0.61572265625,
0.0292510986328125,
-0.60498046875,
-0.32666015625,
-0.367431640625,
0.483642578125,
1.076171875,
0.5498046875,
0.407958984375,
0.50634765625,
0.053741455078125,
0.640625,
0.379638671875,
-0.57373046875,
0.279296875,
-0.64404296875,
0.5615234375,
0.01318359375,
-0.1361083984375,
-0.447265625,
-0.51953125,
-0.71826171875,
0.07421875,
0.038787841796875,
-0.28857421875,
-0.9345703125,
0.409423828125,
0.168212890625,
0.44580078125,
-0.7275390625,
-0.5693359375,
-0.308349609375,
0.75830078125,
0.362548828125,
-0.40625,
0.11505126953125,
-0.67919921875,
0.456298828125,
0.56298828125,
-0.1947021484375,
-0.767578125,
-0.423828125,
-0.58203125,
-0.70458984375,
0.4716796875,
-0.044769287109375,
0.04461669921875,
0.39013671875,
-0.8828125,
0.72119140625,
0.11505126953125,
-0.0478515625,
0.09393310546875,
0.1627197265625,
0.68896484375,
0.06378173828125,
0.67138671875,
-0.437744140625,
-0.54931640625,
0.423583984375,
-1.0693359375,
0.67333984375,
-0.382080078125,
0.251953125,
-0.047637939453125,
-0.3134765625,
0.09259033203125,
0.40380859375,
-0.396728515625,
-0.1907958984375,
-0.22802734375,
0.67529296875,
-0.89013671875,
-0.60302734375,
0.53564453125,
-0.191162109375,
-0.40673828125,
0.435546875,
0.05841064453125,
-0.30908203125,
0.1790771484375,
0.416259765625,
-0.25341796875,
0.12841796875,
-0.732421875,
0.65673828125,
-0.41796875,
-0.244873046875,
0.0657958984375,
-0.505859375,
0.52783203125,
0.01593017578125,
-0.89501953125,
-0.6455078125,
-1.3974609375,
-0.7021484375,
0.0792236328125,
-0.23486328125,
0.488037109375,
-0.025360107421875,
-0.375732421875,
-0.052093505859375,
-1.03515625,
-0.4697265625,
-0.53076171875,
-0.2149658203125,
-0.4423828125,
0.495361328125,
0.6884765625,
0.60498046875,
-0.23583984375,
-0.70703125,
-0.036285400390625,
0.1898193359375,
-0.478759765625,
-0.2037353515625,
-0.362060546875,
-0.1201171875,
-0.313720703125,
-0.342041015625,
0.50341796875,
-0.47412109375,
0.49609375,
1.1162109375,
-0.27783203125,
0.6357421875,
0.1568603515625,
-0.72021484375,
1.1484375,
0.06695556640625,
-1.0341796875,
-0.56689453125,
0.52490234375,
0.1973876953125,
0.68896484375,
-0.111083984375,
-0.6259765625,
-0.492431640625,
-1.24609375,
0.349609375,
-0.5283203125,
-0.297119140625,
-0.8427734375,
-0.0033855438232421875,
-0.195068359375,
0.83984375,
0.07830810546875,
-0.73388671875,
0.341552734375,
-0.947265625,
0.609375,
-0.53369140625,
-0.55029296875,
-0.5986328125,
-0.83056640625,
-0.41748046875,
0.99755859375,
0.42333984375,
0.033294677734375,
0.27685546875,
-0.1737060546875,
-0.22216796875,
-0.312744140625,
-0.51708984375,
-0.06378173828125,
-0.153564453125,
-0.0169219970703125,
-0.3408203125,
-0.087646484375,
-0.63427734375,
1.173828125,
-0.89453125,
0.47509765625,
-0.274658203125,
-0.1953125,
0.0555419921875,
-0.6123046875,
0.94287109375,
-0.36962890625,
-0.172607421875,
-0.4140625,
0.56689453125,
0.56103515625,
-0.2220458984375,
-0.420166015625,
-0.65625,
-0.83349609375,
-1.0146484375,
0.7666015625,
-0.58447265625,
-0.162841796875,
-0.50732421875,
0.5751953125,
0.65673828125,
-0.346923828125,
0.39013671875,
1.1494140625,
0.123291015625,
0.1578369140625,
-0.7705078125,
0.4716796875,
0.58837890625,
-0.256103515625,
-0.05108642578125,
0.330810546875,
-0.77294921875,
0.2020263671875,
-0.30712890625,
-1.3955078125,
-0.583984375,
0.2890625,
1.375,
-0.345458984375,
0.375244140625,
0.397705078125,
-0.72314453125,
-0.552734375,
0.7978515625,
-0.322509765625,
0.058624267578125,
0.97607421875,
-0.055938720703125,
-0.275146484375,
0.00786590576171875,
-0.316650390625,
-0.1253662109375,
-0.426025390625,
0.90576171875,
-0.307861328125,
-0.59130859375,
0.8671875,
1.07421875,
-0.9775390625,
-1.0361328125,
-0.0159454345703125,
-0.038482666015625,
-0.261962890625,
-0.5517578125,
-0.188232421875,
0.837890625,
-0.393798828125,
0.03265380859375,
0.57177734375,
-0.1424560546875,
0.11102294921875,
0.1226806640625,
-0.1326904296875,
-0.60693359375,
0.479248046875,
0.45947265625,
-0.35107421875,
-0.291259765625,
-0.625,
-0.1099853515625,
-0.497314453125,
0.011962890625,
0.52099609375,
-0.53271484375,
-0.0174713134765625,
0.1240234375,
-0.02105712890625,
0.94091796875,
-0.505859375,
-0.37841796875,
-0.0751953125,
-1.1064453125,
-0.568359375,
0.42822265625,
0.148681640625,
-0.194091796875,
0.12152099609375,
-0.6650390625,
-0.269775390625,
0.42822265625,
0.23828125,
0.1917724609375,
-1.0400390625,
0.060577392578125,
-0.83056640625,
-0.21337890625,
-0.93017578125,
-0.78466796875,
-0.19580078125,
0.384033203125,
0.2086181640625,
-0.33544921875,
0.391845703125,
-0.0284881591796875,
-0.371826171875,
1.0830078125,
-0.501953125,
0.059356689453125,
-0.6689453125,
-0.09136962890625,
-0.71826171875,
-0.2286376953125,
-0.393310546875,
-0.20458984375,
-0.251708984375,
0.53369140625,
0.081298828125,
0.5810546875,
-0.1077880859375,
0.6279296875,
-0.242919921875,
-0.69580078125,
-0.2060546875,
0.060028076171875,
-0.2113037109375,
0.44189453125,
0.71337890625,
-0.0587158203125,
0.0390625,
0.312255859375,
-0.4609375,
-0.52685546875,
0.3994140625,
0.316650390625,
-0.06494140625,
-0.20068359375,
-0.330810546875,
0.328857421875,
-0.751953125,
0.08807373046875,
-0.56787109375,
0.038818359375,
0.21142578125,
-0.1334228515625,
0.38916015625,
0.93115234375,
0.35498046875,
0.25341796875,
0.419677734375,
0.69921875,
0.49853515625,
0.1641845703125,
0.4599609375,
0.52978515625,
-0.156005859375,
-0.70263671875,
0.127685546875,
0.6572265625,
-0.26953125,
0.29248046875,
-0.6640625,
-0.45361328125,
-0.80859375,
-0.4736328125,
0.1287841796875,
-0.06719970703125,
0.0009355545043945312,
-0.5791015625,
0.331787109375,
-0.03521728515625,
-0.35302734375,
0.00489044189453125,
-0.95849609375,
-1.01953125,
0.5556640625,
0.12066650390625,
-0.126953125,
-0.31201171875,
-0.62060546875,
-0.442138671875,
0.27099609375,
0.54931640625,
-0.32763671875,
0.314453125,
-0.39306640625,
0.83544921875,
-0.61572265625,
0.39453125,
0.07708740234375,
0.228515625,
-0.6708984375,
-0.40185546875,
0.15380859375,
1.1572265625,
0.372314453125,
0.0031032562255859375,
-0.7255859375,
0.1513671875,
0.00916290283203125,
-0.0239410400390625,
-0.470947265625,
0.349853515625,
-0.36376953125,
0.71875,
-0.61669921875,
0.3701171875,
-0.126708984375,
0.76708984375,
0.65087890625,
-0.430908203125,
-0.826171875,
0.89697265625,
0.41357421875,
-0.2451171875,
0.279541015625,
0.293212890625,
0.19921875,
-0.435546875,
0.0213470458984375,
-0.39404296875,
0.3798828125,
0.5126953125,
0.468994140625,
-0.2012939453125,
0.68115234375,
0.43994140625,
-0.290283203125,
0.078369140625,
0.8544921875,
0.60888671875,
-0.404541015625,
-0.139892578125,
-0.447509765625,
-0.326904296875,
0.1558837890625,
-0.62353515625,
0.60107421875,
-0.1685791015625,
-0.08819580078125,
-0.366455078125,
-0.94091796875,
0.57275390625,
-0.2164306640625,
0.21337890625,
0.07135009765625,
-0.277099609375,
0.3896484375,
0.95263671875,
-0.1728515625,
0.172119140625,
0.60009765625,
0.65625,
0.1961669921875,
0.80517578125,
0.4560546875,
0.30615234375,
-0.4921875,
-0.03753662109375,
0.1583251953125,
-0.032318115234375,
-0.1702880859375,
-0.2139892578125,
-1.0322265625,
0.87451171875,
-0.10894775390625,
-0.1317138671875,
0.82568359375,
-0.876953125,
0.1256103515625,
-0.48388671875,
0.61865234375,
-0.76904296875,
0.360107421875,
0.1724853515625,
-0.00064849853515625,
-0.9189453125,
0.822265625,
-0.192626953125,
0.2457275390625,
0.30419921875,
1.2763671875,
0.01142120361328125,
1.119140625,
0.630859375,
-0.244140625,
-0.1627197265625,
0.34423828125,
-0.438232421875,
-0.441650390625,
-0.154052734375,
-0.385498046875,
-0.1907958984375,
-0.9990234375,
-0.50341796875,
-0.1639404296875,
0.88720703125,
0.1141357421875,
-0.87158203125,
-0.377685546875,
0.140380859375,
-0.404052734375,
0.521484375,
0.517578125,
0.084716796875,
-0.37744140625,
-0.09332275390625,
-0.380615234375,
-0.427001953125,
-0.0440673828125,
-0.49609375,
0.45263671875,
-0.385498046875,
-0.810546875,
-0.43408203125,
-0.76806640625,
-0.443603515625,
0.04150390625,
-0.3935546875,
-0.72265625,
0.62841796875,
0.87451171875,
0.472900390625,
0.002361297607421875,
-0.492919921875,
0.263427734375,
0.83935546875,
1.244140625,
-0.135498046875,
0.95068359375,
-0.1041259765625,
0.07037353515625,
0.375,
-0.87646484375,
0.43115234375,
0.0614013671875,
0.33056640625,
-0.327880859375,
0.484130859375,
-0.75927734375,
-1.841796875,
-0.12469482421875,
0.658203125,
0.54638671875,
-0.69677734375,
-1.291015625,
-0.039306640625,
-1.5224609375,
-0.332763671875,
-0.35107421875,
0.6962890625,
-0.70751953125,
0.1531982421875,
-0.32080078125,
-1.26953125,
4.328125,
1.2119140625,
0.966796875,
0.269775390625,
0.5947265625,
1.037109375,
0.513671875,
-0.720703125,
0.1544189453125,
-0.1795654296875,
0.546875,
-0.238525390625,
-0.03973388671875,
0.552734375,
0.464111328125,
0.6767578125,
-0.85791015625,
0.1712646484375,
-0.1539306640625,
-0.9453125,
-0.87158203125,
0.240966796875,
0.01947021484375,
0.638671875,
0.152099609375,
0.244384765625,
0.39990234375,
-0.63818359375,
-0.32470703125,
-0.85302734375,
-0.17431640625,
-0.50732421875,
0.984375,
0.101318359375,
-0.41357421875,
0.716796875,
0.069580078125,
-0.70654296875,
-0.1307373046875,
-0.0330810546875,
-0.2156982421875,
0.205078125,
0.58837890625,
-0.8291015625,
0.41796875,
0.541015625,
-0.7509765625,
0.3330078125,
0.65966796875,
-0.955078125,
1.376953125,
-0.1322021484375,
0.5908203125,
-1.37890625,
-0.7373046875,
-0.23291015625,
0.149658203125,
-0.35986328125,
-0.5576171875,
0.2117919921875,
0.5185546875,
0.1016845703125,
0.167724609375,
0.53466796875,
-0.734375,
1.0927734375,
-0.254638671875,
0.1534423828125,
-0.5322265625,
0.035675048828125,
-0.54736328125,
0.046173095703125,
-0.075927734375,
-0.207275390625,
0.85400390625,
0.21484375,
0.10015869140625,
0.10931396484375,
0.362548828125,
-0.68017578125,
0.2216796875,
-0.078857421875,
-0.438720703125,
-0.286865234375,
0.08099365234375,
1.4619140625,
-0.4384765625,
0.013336181640625,
-0.54736328125,
0.94384765625,
0.27294921875,
0.331787109375,
-0.339111328125,
-0.80029296875,
-0.469970703125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters.
There is a filler word ogo in Oleg's speech. All words that can be obtained from ogo by adding go several times to the end of it are also considered to be fillers. For example, the words ogo, ogogo, ogogogo are fillers, but the words go, og, ogog, ogogog and oggo are not fillers.
The fillers have maximal size, for example, for ogogoo speech we can't consider ogo a filler and goo as a normal phrase. We should consider ogogo as a filler here.
To print the interview, Polycarp has to replace each of the fillers with three asterisks. Note that a filler word is replaced with exactly three asterisks regardless of its length.
Polycarp has dealt with this problem in no time. Can you do the same? The clock is ticking!
Input
The first line contains a positive integer n (1 ≤ n ≤ 100) — the length of the interview.
The second line contains the string s of length n, consisting of lowercase English letters.
Output
Print the interview text after the replacement of each of the fillers with "***". It is allowed for the substring "***" to have several consecutive occurences.
Examples
Input
7
aogogob
Output
a***b
Input
13
ogogmgogogogo
Output
***gmg***
Input
9
ogoogoogo
Output
*********
Note
The first sample contains one filler word ogogo, so the interview for printing is "a***b".
The second sample contains two fillers ogo and ogogogo. Thus, the interview is transformed to "***gmg***".
Tags: implementation, strings
Correct Solution:
```
# coding: utf-8
# In[155]:
n = int(input())
s = input()
# In[156]:
def findEnd(s, i):
k = i + 2
ans = i+2
while k + 2 < len(s):
if s[k+1:k+3] == "go":
ans = k+2
else:
break
k+=2
return ans
# In[157]:
def findOgogos(s):
return (s.find("ogo"), findEnd(s,s.find("ogo")))
# In[158]:
while "ogo" in s:
s = s[:s.find("ogo")]+"***"+s[findEnd(s,s.find("ogo"))+1:]
#print(s)
# In[159]:
print(s)
```
| 45,020
|
[
0.5712890625,
-0.1878662109375,
-0.1016845703125,
0.389404296875,
-0.533203125,
-0.91552734375,
-0.1302490234375,
0.121826171875,
0.28466796875,
0.1663818359375,
0.89306640625,
-0.077392578125,
0.2061767578125,
-1.1083984375,
-0.4697265625,
0.225830078125,
-0.392333984375,
-0.623046875,
-0.4140625,
-0.32763671875,
-0.05145263671875,
-0.460205078125,
-1.3203125,
-0.418701171875,
-0.78466796875,
1.1796875,
0.120361328125,
0.486083984375,
0.9765625,
1.064453125,
-0.40478515625,
-0.0146942138671875,
0.333251953125,
-1.2099609375,
0.0478515625,
-0.384521484375,
0.68994140625,
-0.43359375,
-0.446533203125,
-0.35888671875,
0.048858642578125,
-0.57275390625,
1.1376953125,
-0.6083984375,
-1.2763671875,
-0.10260009765625,
-0.392333984375,
-0.2493896484375,
-0.1951904296875,
-0.32421875,
0.517578125,
0.11614990234375,
0.78125,
0.052947998046875,
0.0003952980041503906,
-0.437255859375,
-0.07952880859375,
-0.2237548828125,
-0.4873046875,
0.347412109375,
0.367919921875,
0.68603515625,
0.08917236328125,
-0.873046875,
-0.458740234375,
0.44482421875,
0.04150390625,
0.1031494140625,
-0.032470703125,
-0.4365234375,
-0.5234375,
-0.0003077983856201172,
-0.1787109375,
-0.4384765625,
0.1785888671875,
-0.1588134765625,
0.10931396484375,
-0.09710693359375,
-0.64453125,
0.58740234375,
0.40087890625,
1.30859375,
0.442626953125,
0.248779296875,
-0.32080078125,
-0.60302734375,
0.11883544921875,
0.33544921875,
0.5693359375,
-0.0701904296875,
-0.59375,
0.7490234375,
-0.685546875,
-0.178466796875,
0.370849609375,
0.5556640625,
-0.5146484375,
0.2073974609375,
0.05535888671875,
0.1629638671875,
0.7119140625,
0.9931640625,
-0.12359619140625,
1.041015625,
0.2042236328125,
-0.05804443359375,
0.3955078125,
0.275634765625,
0.197265625,
-0.440185546875,
-0.2568359375,
-0.54248046875,
0.60205078125,
0.0174102783203125,
-0.1375732421875,
1.0361328125,
-0.1790771484375,
0.2354736328125,
-0.568359375,
0.2052001953125,
0.1573486328125,
0.11309814453125,
0.340576171875,
-0.1297607421875,
0.1063232421875,
-0.50830078125,
-0.72607421875,
1.291015625,
-0.5009765625,
-0.1285400390625,
0.5615234375,
0.2320556640625,
-0.0423583984375,
0.1380615234375,
-0.1978759765625,
0.6357421875,
-0.0338134765625,
0.65771484375,
0.471435546875,
-0.4541015625,
0.60400390625,
0.11590576171875,
-0.281494140625,
1.2216796875,
0.08062744140625,
0.68994140625,
0.40966796875,
0.10662841796875,
-0.54931640625,
0.428955078125,
-0.93896484375,
0.38623046875,
0.241943359375,
0.1673583984375,
-0.57177734375,
0.53076171875,
-0.3662109375,
0.54736328125,
0.55712890625,
-0.1005859375,
-0.1649169921875,
-0.10845947265625,
-0.430419921875,
1.1552734375,
-0.73486328125,
1.154296875,
-0.42822265625,
-0.0341796875,
0.041351318359375,
-0.203125,
0.22900390625,
0.1141357421875,
-0.2734375,
0.6083984375,
0.40478515625,
1.1884765625,
0.8486328125,
-0.037506103515625,
0.364013671875,
0.12017822265625,
0.0660400390625,
0.22216796875,
0.065673828125,
0.87060546875,
0.5859375,
0.53466796875,
-0.11431884765625,
-0.0965576171875,
-0.243408203125,
-0.72900390625,
0.220703125,
0.52001953125,
-0.5927734375,
0.0307769775390625,
0.0787353515625,
0.357177734375,
-0.7568359375,
-0.0780029296875,
-0.248046875,
-1.03125,
-0.1195068359375,
0.7861328125,
-0.24072265625,
0.72802734375,
-0.3701171875,
-0.419921875,
0.5244140625,
1.1640625,
0.09136962890625,
0.1932373046875,
0.61376953125,
0.13818359375,
-0.2108154296875,
-0.1630859375,
0.1846923828125,
-0.5849609375,
-0.759765625,
0.6142578125,
-0.1676025390625,
-0.036376953125,
0.05645751953125,
0.51708984375,
0.365478515625,
0.408203125,
0.1903076171875,
-0.154541015625,
0.335693359375,
0.99658203125,
-0.04901123046875,
0.456298828125,
-0.1859130859375,
0.810546875,
0.7666015625,
0.85107421875,
0.4794921875,
0.0670166015625,
0.9013671875,
0.61962890625,
0.1815185546875,
0.034515380859375,
-0.281005859375,
0.693359375,
0.45166015625,
0.5380859375,
-0.213134765625,
0.49072265625,
-0.53271484375,
-0.00045561790466308594,
-0.169921875,
0.11376953125,
-0.431640625,
0.90966796875,
-0.256103515625,
0.87158203125,
-0.40087890625,
-0.673828125,
0.4716796875,
0.88525390625,
-0.50634765625,
-0.465576171875,
0.316650390625,
-0.07379150390625,
0.51171875,
0.11163330078125,
0.2320556640625,
0.09051513671875,
0.096923828125,
0.380615234375,
-0.301513671875,
-0.36328125,
-0.830078125,
-0.81689453125,
-0.482421875,
-0.64013671875,
-0.8271484375,
-0.260009765625,
0.56005859375,
-1.0693359375,
0.012969970703125,
-0.32763671875,
-0.38720703125,
-0.0103607177734375,
-0.58251953125,
0.75634765625,
-0.304931640625,
0.35107421875,
-0.900390625,
0.49462890625,
0.163330078125,
1.1044921875,
-0.499755859375,
-0.1337890625,
-0.138427734375,
-0.60595703125,
0.311767578125,
0.406494140625,
0.252685546875,
0.2213134765625,
-0.50341796875,
-0.52099609375,
-0.267822265625,
0.0775146484375,
-0.31103515625,
0.27734375,
-0.30615234375,
0.75439453125,
0.2470703125,
-0.5556640625,
0.84814453125,
0.5224609375,
-0.59912109375,
0.52099609375,
0.3212890625,
0.044647216796875,
-0.76220703125,
1.1640625,
0.57861328125,
0.468505859375,
-0.60595703125,
-0.257080078125,
-0.59326171875,
0.1282958984375,
0.2080078125,
-0.498291015625,
-0.346923828125,
0.50830078125,
0.161376953125,
-1.09375,
0.93798828125,
-1.2646484375,
-0.82763671875,
-0.6591796875,
-0.7041015625,
0.810546875,
1.0751953125,
-0.07025146484375,
-0.7548828125,
-0.0261077880859375,
-0.4873046875,
0.50830078125,
0.375732421875,
-0.298828125,
-0.1571044921875,
0.317138671875,
-0.075439453125,
0.44775390625,
0.310302734375,
-0.3994140625,
-0.1324462890625,
-0.0079345703125,
0.374755859375,
0.32861328125,
0.29443359375,
0.107421875,
0.39697265625,
0.55517578125,
-0.42041015625,
-0.298828125,
-0.271728515625,
0.75537109375,
0.375,
0.6083984375,
0.5322265625,
-0.7060546875,
-0.55078125,
-1.0205078125,
0.1959228515625,
0.329833984375,
0.998046875,
-0.869140625,
0.8486328125,
-0.256103515625,
-0.98193359375,
0.51318359375,
-0.677734375,
-0.441650390625,
1.3056640625,
-0.404296875,
0.5595703125,
-0.365966796875,
0.458984375,
-0.297607421875,
-0.388427734375,
0.45654296875,
0.235595703125,
0.3447265625,
-0.417724609375,
-0.317138671875,
-0.2626953125,
-0.32421875,
-0.0689697265625,
-0.62060546875,
0.060028076171875,
-0.58642578125,
-0.298828125,
-0.39013671875,
0.50537109375,
1.0390625,
0.517578125,
0.35400390625,
0.492919921875,
0.052581787109375,
0.64453125,
0.384765625,
-0.5771484375,
0.2529296875,
-0.607421875,
0.5546875,
0.01715087890625,
-0.10943603515625,
-0.498291015625,
-0.53662109375,
-0.73046875,
0.060394287109375,
0.065673828125,
-0.327880859375,
-0.9619140625,
0.427978515625,
0.2021484375,
0.474365234375,
-0.72509765625,
-0.513671875,
-0.32666015625,
0.70703125,
0.35205078125,
-0.393310546875,
0.1063232421875,
-0.6396484375,
0.45751953125,
0.56201171875,
-0.1680908203125,
-0.744140625,
-0.45263671875,
-0.54638671875,
-0.728515625,
0.43798828125,
-0.03778076171875,
0.0731201171875,
0.417724609375,
-0.90625,
0.70556640625,
0.13330078125,
-0.00817108154296875,
0.06829833984375,
0.1767578125,
0.6826171875,
0.1112060546875,
0.6708984375,
-0.459228515625,
-0.54736328125,
0.41845703125,
-1.099609375,
0.6865234375,
-0.389404296875,
0.29345703125,
-0.08349609375,
-0.285400390625,
0.08135986328125,
0.419189453125,
-0.392333984375,
-0.198486328125,
-0.2242431640625,
0.64111328125,
-0.900390625,
-0.63134765625,
0.52685546875,
-0.208984375,
-0.44677734375,
0.458251953125,
0.03021240234375,
-0.3017578125,
0.17919921875,
0.439697265625,
-0.287841796875,
0.12335205078125,
-0.7275390625,
0.6513671875,
-0.38916015625,
-0.27587890625,
0.0643310546875,
-0.47216796875,
0.56005859375,
0.00576019287109375,
-0.93359375,
-0.6337890625,
-1.3955078125,
-0.671875,
0.06719970703125,
-0.2127685546875,
0.473876953125,
0.0190582275390625,
-0.378662109375,
-0.06787109375,
-1.0283203125,
-0.450927734375,
-0.50732421875,
-0.25048828125,
-0.414306640625,
0.51416015625,
0.65234375,
0.64794921875,
-0.2215576171875,
-0.6787109375,
-0.0270843505859375,
0.2078857421875,
-0.44580078125,
-0.21875,
-0.367431640625,
-0.0943603515625,
-0.323974609375,
-0.334716796875,
0.49658203125,
-0.492431640625,
0.4501953125,
1.0712890625,
-0.2529296875,
0.63671875,
0.199462890625,
-0.7109375,
1.1201171875,
0.076171875,
-1.0390625,
-0.5869140625,
0.52734375,
0.237548828125,
0.693359375,
-0.07855224609375,
-0.67578125,
-0.51025390625,
-1.2001953125,
0.322021484375,
-0.52490234375,
-0.24658203125,
-0.81689453125,
-0.006732940673828125,
-0.2054443359375,
0.8291015625,
0.0955810546875,
-0.7802734375,
0.32080078125,
-0.9775390625,
0.5634765625,
-0.5400390625,
-0.54296875,
-0.59716796875,
-0.83056640625,
-0.369140625,
0.9853515625,
0.46533203125,
0.03173828125,
0.2685546875,
-0.1971435546875,
-0.181640625,
-0.3115234375,
-0.53076171875,
-0.10723876953125,
-0.1219482421875,
0.01056671142578125,
-0.393798828125,
-0.118896484375,
-0.69287109375,
1.126953125,
-0.9091796875,
0.44580078125,
-0.283447265625,
-0.195556640625,
0.063720703125,
-0.5966796875,
0.9384765625,
-0.368896484375,
-0.203857421875,
-0.44970703125,
0.5791015625,
0.61181640625,
-0.246337890625,
-0.43408203125,
-0.6640625,
-0.77197265625,
-1.013671875,
0.76123046875,
-0.56201171875,
-0.172119140625,
-0.49072265625,
0.5673828125,
0.67236328125,
-0.34716796875,
0.421630859375,
1.1376953125,
0.08990478515625,
0.14111328125,
-0.7490234375,
0.434326171875,
0.61572265625,
-0.32177734375,
-0.049285888671875,
0.311767578125,
-0.74560546875,
0.2052001953125,
-0.315673828125,
-1.3759765625,
-0.58154296875,
0.293212890625,
1.3916015625,
-0.363525390625,
0.399169921875,
0.35009765625,
-0.7060546875,
-0.544921875,
0.80126953125,
-0.314697265625,
0.04840087890625,
0.98095703125,
-0.032623291015625,
-0.30859375,
0.0323486328125,
-0.289794921875,
-0.156005859375,
-0.455078125,
0.89892578125,
-0.25732421875,
-0.62353515625,
0.849609375,
1.1201171875,
-0.9990234375,
-1.0576171875,
0.04742431640625,
-0.056304931640625,
-0.300048828125,
-0.56396484375,
-0.19873046875,
0.84228515625,
-0.407470703125,
0.066650390625,
0.5234375,
-0.1490478515625,
0.11376953125,
0.144775390625,
-0.1204833984375,
-0.6181640625,
0.488525390625,
0.487060546875,
-0.378662109375,
-0.286376953125,
-0.6015625,
-0.1046142578125,
-0.462646484375,
-0.03240966796875,
0.51708984375,
-0.4697265625,
-0.01464080810546875,
0.07464599609375,
-0.01629638671875,
0.9677734375,
-0.50146484375,
-0.392578125,
-0.048675537109375,
-1.0947265625,
-0.580078125,
0.404296875,
0.1612548828125,
-0.2064208984375,
0.1414794921875,
-0.64453125,
-0.255126953125,
0.41064453125,
0.23828125,
0.1422119140625,
-1.0166015625,
0.08526611328125,
-0.822265625,
-0.2222900390625,
-0.95849609375,
-0.76611328125,
-0.270751953125,
0.385009765625,
0.216064453125,
-0.326171875,
0.4052734375,
0.0164642333984375,
-0.410888671875,
1.0732421875,
-0.49560546875,
0.09002685546875,
-0.6943359375,
-0.131103515625,
-0.671875,
-0.2127685546875,
-0.4248046875,
-0.211669921875,
-0.27685546875,
0.515625,
0.0455322265625,
0.63232421875,
-0.11480712890625,
0.6171875,
-0.249267578125,
-0.68701171875,
-0.1834716796875,
0.07666015625,
-0.25927734375,
0.4697265625,
0.7373046875,
-0.04107666015625,
0.0024127960205078125,
0.28271484375,
-0.509765625,
-0.54296875,
0.39404296875,
0.30322265625,
-0.042510986328125,
-0.1492919921875,
-0.34912109375,
0.32958984375,
-0.755859375,
0.0782470703125,
-0.56640625,
0.0266571044921875,
0.1771240234375,
-0.13818359375,
0.380615234375,
0.89990234375,
0.314453125,
0.257568359375,
0.36474609375,
0.68359375,
0.509765625,
0.1707763671875,
0.4267578125,
0.513671875,
-0.1806640625,
-0.64501953125,
0.1285400390625,
0.7119140625,
-0.264892578125,
0.325927734375,
-0.666015625,
-0.47119140625,
-0.763671875,
-0.487060546875,
0.1265869140625,
-0.06842041015625,
-0.02130126953125,
-0.607421875,
0.285888671875,
-0.00592803955078125,
-0.335693359375,
0.03326416015625,
-0.93505859375,
-1.0166015625,
0.5595703125,
0.168212890625,
-0.161865234375,
-0.301513671875,
-0.63525390625,
-0.448974609375,
0.251953125,
0.5908203125,
-0.31884765625,
0.338623046875,
-0.41748046875,
0.794921875,
-0.59814453125,
0.43408203125,
0.07373046875,
0.232177734375,
-0.7119140625,
-0.431396484375,
0.1954345703125,
1.134765625,
0.3671875,
0.016632080078125,
-0.712890625,
0.155517578125,
0.0169219970703125,
0.01222991943359375,
-0.450439453125,
0.344970703125,
-0.386962890625,
0.67529296875,
-0.6181640625,
0.3232421875,
-0.10107421875,
0.77734375,
0.63916015625,
-0.39794921875,
-0.841796875,
0.86572265625,
0.439208984375,
-0.253173828125,
0.267578125,
0.31494140625,
0.2069091796875,
-0.38232421875,
-0.0157623291015625,
-0.38037109375,
0.386474609375,
0.4921875,
0.50830078125,
-0.2392578125,
0.6376953125,
0.469482421875,
-0.2626953125,
0.05908203125,
0.83154296875,
0.61962890625,
-0.349853515625,
-0.13134765625,
-0.398193359375,
-0.349853515625,
0.168212890625,
-0.6318359375,
0.63525390625,
-0.1771240234375,
-0.0943603515625,
-0.377197265625,
-0.95068359375,
0.55615234375,
-0.1968994140625,
0.203857421875,
0.0811767578125,
-0.298583984375,
0.3544921875,
0.95751953125,
-0.2227783203125,
0.1329345703125,
0.59619140625,
0.67138671875,
0.1884765625,
0.79150390625,
0.41357421875,
0.314208984375,
-0.431396484375,
-0.028076171875,
0.18115234375,
0.0272674560546875,
-0.1939697265625,
-0.2734375,
-1.0400390625,
0.8896484375,
-0.14404296875,
-0.1693115234375,
0.87451171875,
-0.8564453125,
0.11651611328125,
-0.462158203125,
0.57861328125,
-0.7421875,
0.344482421875,
0.1539306640625,
-0.06512451171875,
-0.9404296875,
0.82275390625,
-0.176025390625,
0.2283935546875,
0.286865234375,
1.2041015625,
0.002532958984375,
1.150390625,
0.6259765625,
-0.27197265625,
-0.1298828125,
0.3583984375,
-0.396484375,
-0.482666015625,
-0.152587890625,
-0.37353515625,
-0.23193359375,
-0.99560546875,
-0.52734375,
-0.1995849609375,
0.87939453125,
0.12286376953125,
-0.9052734375,
-0.40625,
0.133544921875,
-0.41455078125,
0.505859375,
0.52197265625,
0.083740234375,
-0.3466796875,
-0.1029052734375,
-0.374267578125,
-0.443115234375,
-0.038543701171875,
-0.51025390625,
0.459716796875,
-0.418701171875,
-0.81982421875,
-0.405517578125,
-0.71826171875,
-0.424560546875,
0.0011148452758789062,
-0.42431640625,
-0.697265625,
0.6162109375,
0.88427734375,
0.50830078125,
0.060577392578125,
-0.46435546875,
0.283447265625,
0.9189453125,
1.2333984375,
-0.136962890625,
0.955078125,
-0.092041015625,
0.0657958984375,
0.40478515625,
-0.86962890625,
0.44482421875,
0.07183837890625,
0.333740234375,
-0.31884765625,
0.423583984375,
-0.7578125,
-1.8544921875,
-0.0887451171875,
0.654296875,
0.5576171875,
-0.67333984375,
-1.2880859375,
-0.015869140625,
-1.5341796875,
-0.324462890625,
-0.349853515625,
0.70361328125,
-0.6923828125,
0.1365966796875,
-0.30126953125,
-1.2607421875,
4.33203125,
1.1962890625,
1.0234375,
0.291259765625,
0.57177734375,
1.02734375,
0.5419921875,
-0.7373046875,
0.1199951171875,
-0.197509765625,
0.493896484375,
-0.300537109375,
-0.01812744140625,
0.55810546875,
0.41064453125,
0.642578125,
-0.8349609375,
0.1685791015625,
-0.1634521484375,
-0.9521484375,
-0.88916015625,
0.286865234375,
0.038238525390625,
0.66552734375,
0.1258544921875,
0.235107421875,
0.36962890625,
-0.65576171875,
-0.326904296875,
-0.85693359375,
-0.1787109375,
-0.51025390625,
1.03125,
0.1292724609375,
-0.384033203125,
0.7646484375,
0.047943115234375,
-0.6376953125,
-0.1673583984375,
-0.0129241943359375,
-0.229736328125,
0.21923828125,
0.611328125,
-0.83203125,
0.401611328125,
0.56005859375,
-0.74365234375,
0.327392578125,
0.6513671875,
-0.93212890625,
1.3701171875,
-0.10235595703125,
0.5869140625,
-1.3671875,
-0.76220703125,
-0.21875,
0.1341552734375,
-0.323974609375,
-0.564453125,
0.193359375,
0.52392578125,
0.12841796875,
0.1619873046875,
0.5478515625,
-0.79443359375,
1.1005859375,
-0.308837890625,
0.19384765625,
-0.5390625,
0.01053619384765625,
-0.5302734375,
0.032684326171875,
-0.05694580078125,
-0.2044677734375,
0.8359375,
0.2158203125,
0.1112060546875,
0.1732177734375,
0.361083984375,
-0.708984375,
0.2548828125,
-0.06744384765625,
-0.47998046875,
-0.2410888671875,
0.08282470703125,
1.455078125,
-0.458740234375,
0.0028629302978515625,
-0.5341796875,
0.9287109375,
0.278564453125,
0.3720703125,
-0.31884765625,
-0.7705078125,
-0.41357421875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters.
There is a filler word ogo in Oleg's speech. All words that can be obtained from ogo by adding go several times to the end of it are also considered to be fillers. For example, the words ogo, ogogo, ogogogo are fillers, but the words go, og, ogog, ogogog and oggo are not fillers.
The fillers have maximal size, for example, for ogogoo speech we can't consider ogo a filler and goo as a normal phrase. We should consider ogogo as a filler here.
To print the interview, Polycarp has to replace each of the fillers with three asterisks. Note that a filler word is replaced with exactly three asterisks regardless of its length.
Polycarp has dealt with this problem in no time. Can you do the same? The clock is ticking!
Input
The first line contains a positive integer n (1 ≤ n ≤ 100) — the length of the interview.
The second line contains the string s of length n, consisting of lowercase English letters.
Output
Print the interview text after the replacement of each of the fillers with "***". It is allowed for the substring "***" to have several consecutive occurences.
Examples
Input
7
aogogob
Output
a***b
Input
13
ogogmgogogogo
Output
***gmg***
Input
9
ogoogoogo
Output
*********
Note
The first sample contains one filler word ogogo, so the interview for printing is "a***b".
The second sample contains two fillers ogo and ogogogo. Thus, the interview is transformed to "***gmg***".
Tags: implementation, strings
Correct Solution:
```
import re
print(re.sub(r'o(go)+',r'***',[*open(0)][1]))
```
| 45,021
|
[
0.58837890625,
-0.2393798828125,
-0.1328125,
0.4140625,
-0.499267578125,
-0.9423828125,
-0.14697265625,
0.1405029296875,
0.27587890625,
0.12353515625,
0.86865234375,
-0.0977783203125,
0.2120361328125,
-1.1103515625,
-0.47607421875,
0.244873046875,
-0.3720703125,
-0.64208984375,
-0.33056640625,
-0.314453125,
-0.025360107421875,
-0.4423828125,
-1.302734375,
-0.35693359375,
-0.75732421875,
1.158203125,
0.1512451171875,
0.51806640625,
0.96875,
1.02734375,
-0.392333984375,
-0.027008056640625,
0.286865234375,
-1.23828125,
0.06072998046875,
-0.377685546875,
0.759765625,
-0.442626953125,
-0.462158203125,
-0.349853515625,
0.081298828125,
-0.603515625,
1.14453125,
-0.55810546875,
-1.2265625,
-0.1455078125,
-0.36328125,
-0.279052734375,
-0.19775390625,
-0.318603515625,
0.52734375,
0.11865234375,
0.755859375,
0.052734375,
-0.055145263671875,
-0.401611328125,
-0.09051513671875,
-0.2218017578125,
-0.482421875,
0.3837890625,
0.367431640625,
0.6826171875,
0.0579833984375,
-0.94580078125,
-0.40478515625,
0.477294921875,
0.03826904296875,
0.1031494140625,
0.0027675628662109375,
-0.44921875,
-0.51171875,
-0.03594970703125,
-0.164306640625,
-0.45703125,
0.20166015625,
-0.12078857421875,
0.08587646484375,
-0.1297607421875,
-0.6181640625,
0.54345703125,
0.452880859375,
1.259765625,
0.398193359375,
0.194580078125,
-0.33203125,
-0.60205078125,
0.11138916015625,
0.306884765625,
0.564453125,
-0.09100341796875,
-0.6103515625,
0.73974609375,
-0.67578125,
-0.26416015625,
0.4052734375,
0.5947265625,
-0.53564453125,
0.21240234375,
0.035308837890625,
0.1700439453125,
0.70263671875,
0.9921875,
-0.1217041015625,
1.044921875,
0.17333984375,
-0.046875,
0.4755859375,
0.2381591796875,
0.2271728515625,
-0.453369140625,
-0.275390625,
-0.5078125,
0.5615234375,
0.0269012451171875,
-0.142822265625,
1.0224609375,
-0.19677734375,
0.2430419921875,
-0.55078125,
0.2406005859375,
0.08612060546875,
0.1514892578125,
0.333251953125,
-0.176025390625,
0.09423828125,
-0.54736328125,
-0.69677734375,
1.306640625,
-0.5576171875,
-0.159423828125,
0.533203125,
0.25,
-0.022613525390625,
0.193603515625,
-0.1754150390625,
0.69384765625,
0.0016164779663085938,
0.64794921875,
0.51611328125,
-0.468017578125,
0.60888671875,
0.08978271484375,
-0.2459716796875,
1.2451171875,
0.06939697265625,
0.69677734375,
0.40576171875,
0.152587890625,
-0.5966796875,
0.490234375,
-0.93359375,
0.393310546875,
0.2080078125,
0.19189453125,
-0.5498046875,
0.51611328125,
-0.35791015625,
0.578125,
0.5107421875,
-0.1556396484375,
-0.1580810546875,
-0.11260986328125,
-0.495849609375,
1.1494140625,
-0.74169921875,
1.193359375,
-0.4296875,
0.0037631988525390625,
0.01308441162109375,
-0.19921875,
0.2164306640625,
0.0960693359375,
-0.239501953125,
0.6240234375,
0.395263671875,
1.197265625,
0.83984375,
-0.0133209228515625,
0.431640625,
0.1285400390625,
0.0587158203125,
0.2340087890625,
0.07550048828125,
0.90576171875,
0.59326171875,
0.51904296875,
-0.1453857421875,
-0.06353759765625,
-0.1534423828125,
-0.71728515625,
0.25732421875,
0.55224609375,
-0.5947265625,
0.01139068603515625,
0.11859130859375,
0.371337890625,
-0.751953125,
-0.04534912109375,
-0.19384765625,
-1.0263671875,
-0.1307373046875,
0.77197265625,
-0.2021484375,
0.74560546875,
-0.30712890625,
-0.440185546875,
0.44580078125,
1.16796875,
0.0587158203125,
0.1905517578125,
0.64794921875,
0.1737060546875,
-0.1800537109375,
-0.16455078125,
0.176513671875,
-0.59765625,
-0.79931640625,
0.59375,
-0.1383056640625,
-0.0640869140625,
0.06500244140625,
0.479736328125,
0.3623046875,
0.392822265625,
0.16943359375,
-0.1480712890625,
0.342041015625,
1.017578125,
-0.06768798828125,
0.46923828125,
-0.19482421875,
0.82568359375,
0.75537109375,
0.912109375,
0.501953125,
0.058319091796875,
0.921875,
0.56689453125,
0.196044921875,
-0.01275634765625,
-0.30615234375,
0.7724609375,
0.465576171875,
0.5654296875,
-0.181396484375,
0.52783203125,
-0.51806640625,
0.019805908203125,
-0.13427734375,
0.09228515625,
-0.419189453125,
0.95751953125,
-0.253662109375,
0.83203125,
-0.437255859375,
-0.64794921875,
0.490478515625,
0.85791015625,
-0.51025390625,
-0.5361328125,
0.334228515625,
-0.09808349609375,
0.457275390625,
0.1416015625,
0.246337890625,
0.040313720703125,
0.0732421875,
0.404052734375,
-0.277587890625,
-0.325439453125,
-0.82373046875,
-0.80322265625,
-0.5068359375,
-0.65869140625,
-0.814453125,
-0.25830078125,
0.57568359375,
-1.0830078125,
-0.00510406494140625,
-0.33544921875,
-0.341064453125,
0.01654052734375,
-0.625,
0.73681640625,
-0.30419921875,
0.32470703125,
-0.86767578125,
0.486328125,
0.11456298828125,
1.072265625,
-0.51513671875,
-0.09991455078125,
-0.0977783203125,
-0.59912109375,
0.329345703125,
0.416748046875,
0.203857421875,
0.2432861328125,
-0.54345703125,
-0.54931640625,
-0.292236328125,
0.051544189453125,
-0.228759765625,
0.23583984375,
-0.287353515625,
0.7880859375,
0.316650390625,
-0.54052734375,
0.86669921875,
0.5166015625,
-0.5771484375,
0.51513671875,
0.3212890625,
0.08172607421875,
-0.77734375,
1.1171875,
0.55517578125,
0.4716796875,
-0.59619140625,
-0.253662109375,
-0.5791015625,
0.0712890625,
0.22265625,
-0.498779296875,
-0.358642578125,
0.53125,
0.2086181640625,
-1.0830078125,
0.97314453125,
-1.2607421875,
-0.8388671875,
-0.7060546875,
-0.72119140625,
0.7763671875,
1.0810546875,
-0.11370849609375,
-0.79541015625,
-0.05224609375,
-0.480224609375,
0.4990234375,
0.399658203125,
-0.292724609375,
-0.155517578125,
0.345458984375,
-0.122314453125,
0.50341796875,
0.343994140625,
-0.375732421875,
-0.1583251953125,
-0.0017652511596679688,
0.3505859375,
0.325927734375,
0.306396484375,
0.09100341796875,
0.40673828125,
0.55810546875,
-0.451416015625,
-0.290283203125,
-0.30859375,
0.75927734375,
0.384765625,
0.61669921875,
0.52978515625,
-0.71240234375,
-0.5615234375,
-0.986328125,
0.214111328125,
0.291748046875,
1.037109375,
-0.87060546875,
0.8603515625,
-0.316650390625,
-0.99951171875,
0.46484375,
-0.681640625,
-0.386474609375,
1.3359375,
-0.414794921875,
0.54150390625,
-0.344970703125,
0.4658203125,
-0.3359375,
-0.3837890625,
0.49560546875,
0.2020263671875,
0.320556640625,
-0.441162109375,
-0.260498046875,
-0.275390625,
-0.3134765625,
-0.0616455078125,
-0.60595703125,
0.010894775390625,
-0.6171875,
-0.3251953125,
-0.422607421875,
0.451904296875,
1.041015625,
0.5322265625,
0.38525390625,
0.486572265625,
0.065673828125,
0.63232421875,
0.405517578125,
-0.57373046875,
0.27978515625,
-0.66064453125,
0.58740234375,
0.02398681640625,
-0.09613037109375,
-0.476318359375,
-0.52880859375,
-0.77294921875,
0.0821533203125,
0.039581298828125,
-0.309814453125,
-0.95458984375,
0.442138671875,
0.203369140625,
0.457763671875,
-0.705078125,
-0.56005859375,
-0.27783203125,
0.7548828125,
0.38525390625,
-0.37158203125,
0.12225341796875,
-0.66015625,
0.463623046875,
0.58642578125,
-0.1708984375,
-0.76806640625,
-0.462158203125,
-0.59912109375,
-0.72509765625,
0.4697265625,
-0.04119873046875,
0.07183837890625,
0.352783203125,
-0.87255859375,
0.7197265625,
0.1263427734375,
-0.1287841796875,
0.0950927734375,
0.129150390625,
0.65380859375,
0.08160400390625,
0.66552734375,
-0.447509765625,
-0.57861328125,
0.422119140625,
-1.0830078125,
0.677734375,
-0.3955078125,
0.231689453125,
-0.1085205078125,
-0.30322265625,
0.12274169921875,
0.387451171875,
-0.377197265625,
-0.19189453125,
-0.2105712890625,
0.66357421875,
-0.86083984375,
-0.587890625,
0.5654296875,
-0.1898193359375,
-0.48583984375,
0.46728515625,
0.04217529296875,
-0.302001953125,
0.1544189453125,
0.392578125,
-0.248779296875,
0.095703125,
-0.748046875,
0.615234375,
-0.434326171875,
-0.265625,
0.0572509765625,
-0.468017578125,
0.51416015625,
0.022308349609375,
-0.88037109375,
-0.66162109375,
-1.4111328125,
-0.70458984375,
0.0596923828125,
-0.2607421875,
0.495361328125,
-0.0214691162109375,
-0.389892578125,
-0.04693603515625,
-1.0537109375,
-0.46533203125,
-0.5302734375,
-0.25439453125,
-0.42138671875,
0.52294921875,
0.6318359375,
0.6328125,
-0.2498779296875,
-0.7021484375,
-0.0013971328735351562,
0.1531982421875,
-0.4482421875,
-0.19189453125,
-0.343505859375,
-0.1077880859375,
-0.3193359375,
-0.347900390625,
0.4501953125,
-0.468017578125,
0.443115234375,
1.087890625,
-0.252685546875,
0.58349609375,
0.1414794921875,
-0.7236328125,
1.16015625,
0.09613037109375,
-1.0263671875,
-0.59912109375,
0.56689453125,
0.24169921875,
0.6865234375,
-0.08660888671875,
-0.64013671875,
-0.50732421875,
-1.2197265625,
0.263916015625,
-0.5478515625,
-0.2259521484375,
-0.8486328125,
-0.03033447265625,
-0.2042236328125,
0.8076171875,
0.07525634765625,
-0.7353515625,
0.357666015625,
-0.9638671875,
0.5673828125,
-0.5546875,
-0.54052734375,
-0.6416015625,
-0.8203125,
-0.432861328125,
0.98193359375,
0.40869140625,
0.0268402099609375,
0.280029296875,
-0.1392822265625,
-0.223876953125,
-0.328369140625,
-0.51123046875,
-0.087646484375,
-0.1483154296875,
0.027008056640625,
-0.336181640625,
-0.11968994140625,
-0.6328125,
1.134765625,
-0.94287109375,
0.46875,
-0.294921875,
-0.2008056640625,
0.060089111328125,
-0.60986328125,
0.94921875,
-0.37890625,
-0.1859130859375,
-0.445556640625,
0.53369140625,
0.5751953125,
-0.212158203125,
-0.474853515625,
-0.67626953125,
-0.82470703125,
-0.98291015625,
0.77783203125,
-0.59375,
-0.1790771484375,
-0.4833984375,
0.5537109375,
0.60498046875,
-0.318359375,
0.41015625,
1.169921875,
0.0906982421875,
0.14208984375,
-0.78515625,
0.489013671875,
0.59326171875,
-0.285888671875,
-0.0254058837890625,
0.3251953125,
-0.7685546875,
0.1900634765625,
-0.324462890625,
-1.3916015625,
-0.611328125,
0.290771484375,
1.3720703125,
-0.328125,
0.384033203125,
0.370361328125,
-0.728515625,
-0.56591796875,
0.830078125,
-0.284423828125,
0.061126708984375,
0.99951171875,
-0.0770263671875,
-0.305419921875,
0.0137939453125,
-0.298095703125,
-0.11578369140625,
-0.415283203125,
0.92578125,
-0.298828125,
-0.59130859375,
0.84814453125,
1.0576171875,
-0.98974609375,
-1.0478515625,
0.0163726806640625,
-0.0209808349609375,
-0.2626953125,
-0.57763671875,
-0.1529541015625,
0.81298828125,
-0.394775390625,
0.036529541015625,
0.54345703125,
-0.11346435546875,
0.11505126953125,
0.11822509765625,
-0.1182861328125,
-0.59326171875,
0.448974609375,
0.480712890625,
-0.351318359375,
-0.29736328125,
-0.65087890625,
-0.10028076171875,
-0.46630859375,
0.0263519287109375,
0.53662109375,
-0.463623046875,
-0.00525665283203125,
0.1033935546875,
-0.037933349609375,
0.9580078125,
-0.4921875,
-0.407470703125,
-0.056640625,
-1.0791015625,
-0.583984375,
0.377685546875,
0.1558837890625,
-0.189453125,
0.12005615234375,
-0.69482421875,
-0.258544921875,
0.450439453125,
0.201171875,
0.16357421875,
-1.033203125,
0.07855224609375,
-0.833984375,
-0.2445068359375,
-0.970703125,
-0.78759765625,
-0.2034912109375,
0.4150390625,
0.26611328125,
-0.314208984375,
0.386474609375,
-0.005199432373046875,
-0.35009765625,
1.091796875,
-0.49169921875,
0.07659912109375,
-0.6923828125,
-0.11212158203125,
-0.68701171875,
-0.238037109375,
-0.416748046875,
-0.218994140625,
-0.26611328125,
0.5380859375,
0.044342041015625,
0.60546875,
-0.08087158203125,
0.56982421875,
-0.265380859375,
-0.71484375,
-0.2191162109375,
0.08001708984375,
-0.2296142578125,
0.4306640625,
0.74560546875,
-0.081298828125,
0.053192138671875,
0.287841796875,
-0.473876953125,
-0.55224609375,
0.4052734375,
0.311767578125,
-0.0673828125,
-0.2103271484375,
-0.3349609375,
0.317626953125,
-0.75732421875,
0.158935546875,
-0.5625,
0.038238525390625,
0.202392578125,
-0.1558837890625,
0.368408203125,
0.92236328125,
0.38037109375,
0.2890625,
0.40087890625,
0.70751953125,
0.52294921875,
0.17236328125,
0.423095703125,
0.59326171875,
-0.1629638671875,
-0.7158203125,
0.14208984375,
0.69189453125,
-0.257080078125,
0.291748046875,
-0.66943359375,
-0.47509765625,
-0.8037109375,
-0.50390625,
0.1431884765625,
-0.0302276611328125,
0.01244354248046875,
-0.568359375,
0.283447265625,
-0.033843994140625,
-0.336669921875,
0.01708984375,
-0.984375,
-1.0048828125,
0.5107421875,
0.1611328125,
-0.13134765625,
-0.30322265625,
-0.60107421875,
-0.430908203125,
0.2379150390625,
0.560546875,
-0.356201171875,
0.330078125,
-0.396484375,
0.8837890625,
-0.5849609375,
0.44384765625,
0.11065673828125,
0.237548828125,
-0.6767578125,
-0.42236328125,
0.15283203125,
1.1865234375,
0.385009765625,
0.049713134765625,
-0.71826171875,
0.12457275390625,
-0.002445220947265625,
-0.027923583984375,
-0.472900390625,
0.372802734375,
-0.356201171875,
0.744140625,
-0.60791015625,
0.35009765625,
-0.1351318359375,
0.751953125,
0.65380859375,
-0.4306640625,
-0.82763671875,
0.88427734375,
0.41943359375,
-0.2626953125,
0.260009765625,
0.2734375,
0.1822509765625,
-0.43798828125,
0.0153350830078125,
-0.431640625,
0.406494140625,
0.5107421875,
0.5087890625,
-0.160888671875,
0.6689453125,
0.50390625,
-0.259033203125,
0.11883544921875,
0.81787109375,
0.61474609375,
-0.380126953125,
-0.1265869140625,
-0.441650390625,
-0.310791015625,
0.1285400390625,
-0.62109375,
0.5986328125,
-0.208740234375,
-0.07366943359375,
-0.34423828125,
-0.9384765625,
0.57861328125,
-0.2188720703125,
0.1839599609375,
0.060028076171875,
-0.328857421875,
0.374267578125,
0.96630859375,
-0.1661376953125,
0.17333984375,
0.595703125,
0.67529296875,
0.2222900390625,
0.79736328125,
0.430908203125,
0.33056640625,
-0.491943359375,
-0.032318115234375,
0.1912841796875,
-0.032989501953125,
-0.19580078125,
-0.2169189453125,
-1.029296875,
0.8828125,
-0.1143798828125,
-0.1282958984375,
0.81591796875,
-0.87744140625,
0.157958984375,
-0.51123046875,
0.6025390625,
-0.73974609375,
0.388671875,
0.149169921875,
0.00988006591796875,
-0.923828125,
0.83056640625,
-0.20849609375,
0.262451171875,
0.288818359375,
1.2626953125,
0.00493621826171875,
1.1015625,
0.6357421875,
-0.2587890625,
-0.188232421875,
0.380126953125,
-0.425537109375,
-0.4521484375,
-0.1488037109375,
-0.359375,
-0.23828125,
-0.98046875,
-0.50244140625,
-0.171630859375,
0.90283203125,
0.0933837890625,
-0.8671875,
-0.422119140625,
0.1636962890625,
-0.444091796875,
0.5244140625,
0.51953125,
0.072998046875,
-0.349853515625,
-0.1070556640625,
-0.429931640625,
-0.4150390625,
-0.0112762451171875,
-0.470947265625,
0.476318359375,
-0.416259765625,
-0.833984375,
-0.440185546875,
-0.775390625,
-0.4677734375,
0.00464630126953125,
-0.43212890625,
-0.7509765625,
0.60546875,
0.884765625,
0.461181640625,
0.0181121826171875,
-0.48876953125,
0.2440185546875,
0.87158203125,
1.240234375,
-0.1143798828125,
0.974609375,
-0.09210205078125,
0.09783935546875,
0.366455078125,
-0.90283203125,
0.427734375,
0.051422119140625,
0.351806640625,
-0.314208984375,
0.48046875,
-0.72607421875,
-1.81640625,
-0.11456298828125,
0.67236328125,
0.55517578125,
-0.69970703125,
-1.31640625,
-0.05181884765625,
-1.5068359375,
-0.344482421875,
-0.32861328125,
0.6962890625,
-0.67724609375,
0.1593017578125,
-0.3193359375,
-1.244140625,
4.31640625,
1.2060546875,
0.978515625,
0.281005859375,
0.623046875,
1.0234375,
0.48974609375,
-0.697265625,
0.164306640625,
-0.171875,
0.5703125,
-0.292236328125,
-0.06671142578125,
0.5810546875,
0.436279296875,
0.6943359375,
-0.87646484375,
0.09423828125,
-0.1370849609375,
-0.98681640625,
-0.859375,
0.223388671875,
0.042755126953125,
0.642578125,
0.1549072265625,
0.2479248046875,
0.429443359375,
-0.63720703125,
-0.3505859375,
-0.86767578125,
-0.1400146484375,
-0.53271484375,
0.97998046875,
0.11669921875,
-0.453125,
0.73095703125,
0.023773193359375,
-0.69287109375,
-0.12420654296875,
-0.01446533203125,
-0.2496337890625,
0.2374267578125,
0.61279296875,
-0.80859375,
0.42431640625,
0.5537109375,
-0.73583984375,
0.365478515625,
0.65576171875,
-0.96728515625,
1.390625,
-0.1041259765625,
0.58984375,
-1.359375,
-0.79052734375,
-0.2421875,
0.14306640625,
-0.35107421875,
-0.51708984375,
0.237060546875,
0.5234375,
0.12017822265625,
0.1917724609375,
0.515625,
-0.76953125,
1.099609375,
-0.2220458984375,
0.1539306640625,
-0.5341796875,
0.04022216796875,
-0.5361328125,
0.0012292861938476562,
-0.08245849609375,
-0.2568359375,
0.82177734375,
0.2646484375,
0.0667724609375,
0.10186767578125,
0.35791015625,
-0.6533203125,
0.2349853515625,
-0.09271240234375,
-0.40966796875,
-0.2578125,
0.08636474609375,
1.4560546875,
-0.463134765625,
-0.01329803466796875,
-0.54833984375,
0.9736328125,
0.274658203125,
0.350830078125,
-0.357666015625,
-0.77099609375,
-0.42626953125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters.
There is a filler word ogo in Oleg's speech. All words that can be obtained from ogo by adding go several times to the end of it are also considered to be fillers. For example, the words ogo, ogogo, ogogogo are fillers, but the words go, og, ogog, ogogog and oggo are not fillers.
The fillers have maximal size, for example, for ogogoo speech we can't consider ogo a filler and goo as a normal phrase. We should consider ogogo as a filler here.
To print the interview, Polycarp has to replace each of the fillers with three asterisks. Note that a filler word is replaced with exactly three asterisks regardless of its length.
Polycarp has dealt with this problem in no time. Can you do the same? The clock is ticking!
Input
The first line contains a positive integer n (1 ≤ n ≤ 100) — the length of the interview.
The second line contains the string s of length n, consisting of lowercase English letters.
Output
Print the interview text after the replacement of each of the fillers with "***". It is allowed for the substring "***" to have several consecutive occurences.
Examples
Input
7
aogogob
Output
a***b
Input
13
ogogmgogogogo
Output
***gmg***
Input
9
ogoogoogo
Output
*********
Note
The first sample contains one filler word ogogo, so the interview for printing is "a***b".
The second sample contains two fillers ogo and ogogogo. Thus, the interview is transformed to "***gmg***".
Tags: implementation, strings
Correct Solution:
```
s=input()
s=input()
sogo='og'*50
i=0
while i<len(s):
i=s.find('ogo')
if i==-1:
break
k=i+3
while k<len(s)+1 and s[i:k]==sogo[0:k-i]:
k=k+2
if k>=len(s) or s[i:k]!=sogo[0:k-i]:
srep=s[i:k-2]
else:
srep=s[i:k]
s=s.replace(srep,'***',1)
i=k
print(s)
```
| 45,022
|
[
0.56884765625,
-0.164794921875,
-0.09796142578125,
0.395751953125,
-0.54736328125,
-0.94091796875,
-0.124267578125,
0.124267578125,
0.310791015625,
0.1873779296875,
0.8671875,
-0.0865478515625,
0.2008056640625,
-1.1455078125,
-0.442138671875,
0.248291015625,
-0.4072265625,
-0.62548828125,
-0.36572265625,
-0.3388671875,
-0.027496337890625,
-0.4599609375,
-1.279296875,
-0.384521484375,
-0.76708984375,
1.15625,
0.11865234375,
0.492431640625,
0.97412109375,
1.0166015625,
-0.374755859375,
-0.04541015625,
0.335693359375,
-1.2294921875,
0.0682373046875,
-0.392578125,
0.71923828125,
-0.4443359375,
-0.43017578125,
-0.357421875,
0.0711669921875,
-0.56884765625,
1.1279296875,
-0.56982421875,
-1.259765625,
-0.1309814453125,
-0.379638671875,
-0.2880859375,
-0.207275390625,
-0.31103515625,
0.50146484375,
0.10064697265625,
0.80224609375,
0.04925537109375,
0.0184173583984375,
-0.45849609375,
-0.09088134765625,
-0.2091064453125,
-0.50634765625,
0.360595703125,
0.398681640625,
0.70849609375,
0.0792236328125,
-0.88134765625,
-0.467041015625,
0.439697265625,
0.029052734375,
0.126953125,
-0.00039577484130859375,
-0.462646484375,
-0.556640625,
0.003170013427734375,
-0.19189453125,
-0.4375,
0.1671142578125,
-0.0926513671875,
0.10491943359375,
-0.08465576171875,
-0.62646484375,
0.611328125,
0.384765625,
1.2705078125,
0.419677734375,
0.2491455078125,
-0.319091796875,
-0.6298828125,
0.1588134765625,
0.325927734375,
0.55224609375,
-0.0650634765625,
-0.5546875,
0.75537109375,
-0.666015625,
-0.197265625,
0.378173828125,
0.5546875,
-0.537109375,
0.1903076171875,
0.0626220703125,
0.142822265625,
0.716796875,
0.96630859375,
-0.1318359375,
1.052734375,
0.2022705078125,
-0.046875,
0.398681640625,
0.249267578125,
0.217529296875,
-0.480712890625,
-0.27197265625,
-0.51416015625,
0.58935546875,
0.0126190185546875,
-0.1654052734375,
1.0244140625,
-0.182861328125,
0.2425537109375,
-0.60546875,
0.168212890625,
0.116455078125,
0.1455078125,
0.384765625,
-0.12384033203125,
0.10687255859375,
-0.52392578125,
-0.71630859375,
1.28125,
-0.55908203125,
-0.1475830078125,
0.53076171875,
0.2313232421875,
-0.040557861328125,
0.18603515625,
-0.19970703125,
0.63330078125,
-0.0316162109375,
0.65869140625,
0.4990234375,
-0.416015625,
0.6103515625,
0.10345458984375,
-0.28271484375,
1.2265625,
0.068115234375,
0.67822265625,
0.41748046875,
0.1644287109375,
-0.5634765625,
0.459716796875,
-0.96826171875,
0.354736328125,
0.207763671875,
0.1903076171875,
-0.56884765625,
0.54931640625,
-0.35498046875,
0.5703125,
0.54248046875,
-0.1146240234375,
-0.1866455078125,
-0.1602783203125,
-0.447021484375,
1.15234375,
-0.7314453125,
1.1435546875,
-0.45068359375,
-0.01357269287109375,
0.03985595703125,
-0.21240234375,
0.1953125,
0.1268310546875,
-0.24072265625,
0.57666015625,
0.40625,
1.21484375,
0.85693359375,
-0.04034423828125,
0.36474609375,
0.1165771484375,
0.0283050537109375,
0.238037109375,
0.06719970703125,
0.8486328125,
0.62255859375,
0.52685546875,
-0.1436767578125,
-0.0596923828125,
-0.205810546875,
-0.72900390625,
0.265625,
0.5283203125,
-0.576171875,
-0.0012655258178710938,
0.06915283203125,
0.350341796875,
-0.76171875,
-0.0408935546875,
-0.244873046875,
-1.0185546875,
-0.1278076171875,
0.77392578125,
-0.2291259765625,
0.7255859375,
-0.349609375,
-0.434814453125,
0.50927734375,
1.1201171875,
0.04107666015625,
0.1566162109375,
0.6435546875,
0.1707763671875,
-0.1865234375,
-0.1680908203125,
0.2025146484375,
-0.59423828125,
-0.78466796875,
0.59521484375,
-0.1495361328125,
-0.07061767578125,
0.06109619140625,
0.49951171875,
0.333984375,
0.398193359375,
0.1868896484375,
-0.169921875,
0.34814453125,
1.0322265625,
-0.06719970703125,
0.469482421875,
-0.1859130859375,
0.8134765625,
0.78564453125,
0.87890625,
0.50146484375,
0.0543212890625,
0.89892578125,
0.59716796875,
0.1815185546875,
0.01263427734375,
-0.27685546875,
0.74853515625,
0.42626953125,
0.53369140625,
-0.2064208984375,
0.5126953125,
-0.5302734375,
0.01174163818359375,
-0.1546630859375,
0.08770751953125,
-0.41796875,
0.95703125,
-0.294189453125,
0.86572265625,
-0.42138671875,
-0.6611328125,
0.48193359375,
0.91064453125,
-0.51806640625,
-0.4912109375,
0.32666015625,
-0.08465576171875,
0.48583984375,
0.1390380859375,
0.227783203125,
0.06695556640625,
0.1346435546875,
0.35302734375,
-0.276123046875,
-0.315673828125,
-0.81103515625,
-0.7880859375,
-0.469970703125,
-0.64794921875,
-0.810546875,
-0.2381591796875,
0.55712890625,
-1.0703125,
-0.0031585693359375,
-0.325439453125,
-0.3681640625,
-0.01274871826171875,
-0.57080078125,
0.77490234375,
-0.285888671875,
0.323974609375,
-0.890625,
0.453125,
0.106689453125,
1.08984375,
-0.4951171875,
-0.1053466796875,
-0.1258544921875,
-0.58447265625,
0.316162109375,
0.397705078125,
0.2196044921875,
0.2401123046875,
-0.475341796875,
-0.5322265625,
-0.267578125,
0.08746337890625,
-0.267333984375,
0.294921875,
-0.285400390625,
0.7666015625,
0.293701171875,
-0.55712890625,
0.82177734375,
0.50048828125,
-0.56787109375,
0.52880859375,
0.319580078125,
0.016937255859375,
-0.759765625,
1.140625,
0.58642578125,
0.44482421875,
-0.568359375,
-0.255615234375,
-0.61181640625,
0.1044921875,
0.2054443359375,
-0.484375,
-0.33251953125,
0.52587890625,
0.1365966796875,
-1.0732421875,
0.94482421875,
-1.2646484375,
-0.869140625,
-0.69384765625,
-0.75634765625,
0.80419921875,
1.0810546875,
-0.08331298828125,
-0.81787109375,
-0.0124053955078125,
-0.47509765625,
0.49609375,
0.403076171875,
-0.33935546875,
-0.152587890625,
0.3193359375,
-0.06927490234375,
0.469482421875,
0.31640625,
-0.3818359375,
-0.15966796875,
0.01509857177734375,
0.346923828125,
0.336181640625,
0.297607421875,
0.102783203125,
0.419677734375,
0.56982421875,
-0.427001953125,
-0.277587890625,
-0.272705078125,
0.71826171875,
0.39404296875,
0.603515625,
0.515625,
-0.7041015625,
-0.55029296875,
-1.0302734375,
0.194091796875,
0.3486328125,
0.99658203125,
-0.8984375,
0.8515625,
-0.24560546875,
-0.9853515625,
0.480712890625,
-0.69384765625,
-0.453369140625,
1.3134765625,
-0.417724609375,
0.54833984375,
-0.3212890625,
0.488037109375,
-0.3125,
-0.382568359375,
0.461181640625,
0.2392578125,
0.34765625,
-0.406982421875,
-0.31689453125,
-0.263427734375,
-0.33740234375,
-0.05322265625,
-0.609375,
0.0794677734375,
-0.607421875,
-0.332763671875,
-0.368896484375,
0.462646484375,
1.0576171875,
0.53857421875,
0.375244140625,
0.48046875,
0.041595458984375,
0.6259765625,
0.406982421875,
-0.5947265625,
0.238037109375,
-0.62158203125,
0.5615234375,
0.0247344970703125,
-0.103759765625,
-0.462646484375,
-0.5283203125,
-0.76416015625,
0.0784912109375,
0.06561279296875,
-0.335693359375,
-0.94287109375,
0.427001953125,
0.1715087890625,
0.425537109375,
-0.70654296875,
-0.54736328125,
-0.318115234375,
0.7294921875,
0.37060546875,
-0.380126953125,
0.0828857421875,
-0.69384765625,
0.4423828125,
0.546875,
-0.1754150390625,
-0.76220703125,
-0.466064453125,
-0.5498046875,
-0.69921875,
0.434814453125,
-0.0809326171875,
0.0814208984375,
0.35888671875,
-0.8837890625,
0.70947265625,
0.1065673828125,
-0.044830322265625,
0.08062744140625,
0.1951904296875,
0.67578125,
0.048797607421875,
0.6767578125,
-0.4365234375,
-0.57568359375,
0.41455078125,
-1.078125,
0.69873046875,
-0.40283203125,
0.2861328125,
-0.0777587890625,
-0.299560546875,
0.07452392578125,
0.37890625,
-0.414794921875,
-0.1888427734375,
-0.2359619140625,
0.62646484375,
-0.90771484375,
-0.640625,
0.55517578125,
-0.229736328125,
-0.40673828125,
0.456787109375,
0.03643798828125,
-0.329345703125,
0.1834716796875,
0.43603515625,
-0.29150390625,
0.1251220703125,
-0.73095703125,
0.638671875,
-0.427978515625,
-0.282958984375,
0.0926513671875,
-0.4970703125,
0.52685546875,
0.0274810791015625,
-0.92041015625,
-0.6484375,
-1.3935546875,
-0.63818359375,
0.083251953125,
-0.2255859375,
0.4970703125,
0.033203125,
-0.3935546875,
-0.0770263671875,
-1.044921875,
-0.454345703125,
-0.5146484375,
-0.2327880859375,
-0.398681640625,
0.52294921875,
0.6943359375,
0.62841796875,
-0.2158203125,
-0.72900390625,
-0.042388916015625,
0.17138671875,
-0.421875,
-0.1812744140625,
-0.3828125,
-0.1365966796875,
-0.3154296875,
-0.34521484375,
0.47900390625,
-0.482666015625,
0.450439453125,
1.0732421875,
-0.26806640625,
0.6171875,
0.1990966796875,
-0.7119140625,
1.1435546875,
0.11932373046875,
-1.03515625,
-0.59423828125,
0.5224609375,
0.2149658203125,
0.69921875,
-0.097412109375,
-0.6591796875,
-0.5029296875,
-1.220703125,
0.351318359375,
-0.52587890625,
-0.251220703125,
-0.84912109375,
-0.0016050338745117188,
-0.2196044921875,
0.8193359375,
0.1151123046875,
-0.7509765625,
0.312255859375,
-0.97509765625,
0.57666015625,
-0.51220703125,
-0.56787109375,
-0.5537109375,
-0.83984375,
-0.385009765625,
0.9658203125,
0.429443359375,
0.03424072265625,
0.26025390625,
-0.2052001953125,
-0.2181396484375,
-0.317626953125,
-0.50634765625,
-0.047821044921875,
-0.1517333984375,
-0.002231597900390625,
-0.371337890625,
-0.0992431640625,
-0.65869140625,
1.1328125,
-0.91650390625,
0.46435546875,
-0.26025390625,
-0.2147216796875,
0.04248046875,
-0.59033203125,
0.93505859375,
-0.3603515625,
-0.2205810546875,
-0.44091796875,
0.5673828125,
0.59814453125,
-0.2193603515625,
-0.455810546875,
-0.65673828125,
-0.80029296875,
-1.017578125,
0.73193359375,
-0.560546875,
-0.1712646484375,
-0.50732421875,
0.57763671875,
0.619140625,
-0.331787109375,
0.41845703125,
1.1513671875,
0.1446533203125,
0.1741943359375,
-0.75634765625,
0.435546875,
0.6083984375,
-0.283935546875,
-0.02313232421875,
0.32568359375,
-0.76708984375,
0.2044677734375,
-0.33154296875,
-1.345703125,
-0.5634765625,
0.27685546875,
1.376953125,
-0.318115234375,
0.409912109375,
0.37255859375,
-0.72607421875,
-0.5537109375,
0.7900390625,
-0.301025390625,
0.07537841796875,
0.96826171875,
-0.0093231201171875,
-0.29833984375,
0.014190673828125,
-0.303466796875,
-0.14306640625,
-0.453857421875,
0.88818359375,
-0.293701171875,
-0.60302734375,
0.861328125,
1.083984375,
-0.9814453125,
-1.0498046875,
0.02764892578125,
-0.036956787109375,
-0.28125,
-0.560546875,
-0.202392578125,
0.8291015625,
-0.440673828125,
0.0638427734375,
0.54931640625,
-0.17578125,
0.1268310546875,
0.1387939453125,
-0.08905029296875,
-0.634765625,
0.51318359375,
0.495849609375,
-0.357177734375,
-0.280029296875,
-0.63037109375,
-0.13037109375,
-0.4638671875,
-0.026611328125,
0.487060546875,
-0.481201171875,
-0.0158843994140625,
0.08905029296875,
0.00038504600524902344,
0.95556640625,
-0.5087890625,
-0.402587890625,
-0.0303802490234375,
-1.0556640625,
-0.60986328125,
0.424072265625,
0.1336669921875,
-0.1661376953125,
0.1661376953125,
-0.67236328125,
-0.2410888671875,
0.42333984375,
0.258544921875,
0.1260986328125,
-1.05078125,
0.0572509765625,
-0.81787109375,
-0.235107421875,
-0.98095703125,
-0.79052734375,
-0.244384765625,
0.397216796875,
0.2283935546875,
-0.311279296875,
0.423095703125,
-0.040069580078125,
-0.4384765625,
1.0703125,
-0.49755859375,
0.0966796875,
-0.640625,
-0.11541748046875,
-0.71435546875,
-0.2073974609375,
-0.401123046875,
-0.2144775390625,
-0.32568359375,
0.5322265625,
0.023651123046875,
0.599609375,
-0.105224609375,
0.61279296875,
-0.2626953125,
-0.69189453125,
-0.1932373046875,
0.084716796875,
-0.2218017578125,
0.46240234375,
0.734375,
-0.0469970703125,
0.01224517822265625,
0.279541015625,
-0.45654296875,
-0.5390625,
0.408447265625,
0.28271484375,
-0.0740966796875,
-0.172119140625,
-0.301025390625,
0.346435546875,
-0.7431640625,
0.061370849609375,
-0.60595703125,
0.0557861328125,
0.1761474609375,
-0.14794921875,
0.36962890625,
0.9208984375,
0.344970703125,
0.2587890625,
0.386474609375,
0.728515625,
0.481689453125,
0.16259765625,
0.447998046875,
0.55029296875,
-0.1998291015625,
-0.66845703125,
0.11114501953125,
0.67431640625,
-0.2353515625,
0.2998046875,
-0.65869140625,
-0.48681640625,
-0.75537109375,
-0.488525390625,
0.11785888671875,
-0.043426513671875,
-0.01375579833984375,
-0.6337890625,
0.29736328125,
-0.01947021484375,
-0.332275390625,
0.01611328125,
-0.9453125,
-1.03515625,
0.5341796875,
0.163818359375,
-0.16357421875,
-0.2607421875,
-0.609375,
-0.47509765625,
0.256591796875,
0.60205078125,
-0.322509765625,
0.34326171875,
-0.4013671875,
0.8251953125,
-0.59326171875,
0.4384765625,
0.09979248046875,
0.2435302734375,
-0.73388671875,
-0.44482421875,
0.180908203125,
1.1455078125,
0.407470703125,
0.0108184814453125,
-0.7197265625,
0.107177734375,
-0.007289886474609375,
-0.0144500732421875,
-0.431884765625,
0.35400390625,
-0.391357421875,
0.7021484375,
-0.62939453125,
0.349609375,
-0.0909423828125,
0.787109375,
0.6181640625,
-0.390869140625,
-0.81494140625,
0.8935546875,
0.410400390625,
-0.250732421875,
0.26416015625,
0.288818359375,
0.190185546875,
-0.384033203125,
-0.006317138671875,
-0.409912109375,
0.4130859375,
0.52197265625,
0.521484375,
-0.22509765625,
0.63720703125,
0.489013671875,
-0.255859375,
0.09185791015625,
0.8447265625,
0.61181640625,
-0.336669921875,
-0.1126708984375,
-0.4482421875,
-0.32421875,
0.1859130859375,
-0.63330078125,
0.6181640625,
-0.196533203125,
-0.09942626953125,
-0.35595703125,
-0.94482421875,
0.552734375,
-0.2294921875,
0.234375,
0.07012939453125,
-0.33251953125,
0.372314453125,
0.93017578125,
-0.2152099609375,
0.1451416015625,
0.611328125,
0.64892578125,
0.17333984375,
0.80712890625,
0.423583984375,
0.30419921875,
-0.46875,
-0.0214691162109375,
0.159423828125,
0.0019664764404296875,
-0.1888427734375,
-0.24951171875,
-1.06640625,
0.8447265625,
-0.1419677734375,
-0.1539306640625,
0.88427734375,
-0.888671875,
0.111328125,
-0.460693359375,
0.6025390625,
-0.708984375,
0.384765625,
0.1546630859375,
-0.01374053955078125,
-0.94921875,
0.81787109375,
-0.1865234375,
0.22021484375,
0.3037109375,
1.2548828125,
-0.00980377197265625,
1.134765625,
0.62744140625,
-0.260986328125,
-0.1541748046875,
0.348388671875,
-0.42236328125,
-0.43017578125,
-0.1556396484375,
-0.3759765625,
-0.186767578125,
-1.0263671875,
-0.52587890625,
-0.1944580078125,
0.8740234375,
0.09710693359375,
-0.8642578125,
-0.39208984375,
0.1334228515625,
-0.41796875,
0.5068359375,
0.5068359375,
0.10516357421875,
-0.333984375,
-0.09869384765625,
-0.360595703125,
-0.45703125,
-0.020904541015625,
-0.5244140625,
0.494140625,
-0.395751953125,
-0.8046875,
-0.3974609375,
-0.7138671875,
-0.460205078125,
0.0255889892578125,
-0.376708984375,
-0.720703125,
0.60205078125,
0.89599609375,
0.4873046875,
0.036956787109375,
-0.469970703125,
0.28369140625,
0.9072265625,
1.2626953125,
-0.123779296875,
0.97216796875,
-0.09686279296875,
0.08978271484375,
0.381591796875,
-0.85693359375,
0.457275390625,
0.052459716796875,
0.3623046875,
-0.339111328125,
0.451171875,
-0.751953125,
-1.818359375,
-0.0909423828125,
0.654296875,
0.50439453125,
-0.6875,
-1.283203125,
-0.05157470703125,
-1.552734375,
-0.34765625,
-0.341064453125,
0.68798828125,
-0.69970703125,
0.1292724609375,
-0.339111328125,
-1.2626953125,
4.328125,
1.2236328125,
0.98681640625,
0.27978515625,
0.5888671875,
1.02734375,
0.52685546875,
-0.740234375,
0.1368408203125,
-0.1884765625,
0.52294921875,
-0.264892578125,
-0.01288604736328125,
0.541015625,
0.440673828125,
0.7060546875,
-0.8603515625,
0.1627197265625,
-0.1478271484375,
-0.93115234375,
-0.89990234375,
0.298583984375,
0.058258056640625,
0.64208984375,
0.1455078125,
0.21435546875,
0.359619140625,
-0.63427734375,
-0.3037109375,
-0.8232421875,
-0.16455078125,
-0.5009765625,
1.015625,
0.11309814453125,
-0.35546875,
0.75537109375,
0.07855224609375,
-0.6630859375,
-0.1634521484375,
-0.03607177734375,
-0.24609375,
0.197021484375,
0.58935546875,
-0.84521484375,
0.40869140625,
0.556640625,
-0.76416015625,
0.375,
0.67626953125,
-0.96142578125,
1.3564453125,
-0.12188720703125,
0.5830078125,
-1.3896484375,
-0.76611328125,
-0.2269287109375,
0.1185302734375,
-0.345947265625,
-0.56689453125,
0.212646484375,
0.552734375,
0.10748291015625,
0.17529296875,
0.5361328125,
-0.77783203125,
1.0634765625,
-0.2470703125,
0.1763916015625,
-0.5400390625,
0.04296875,
-0.53173828125,
0.0003681182861328125,
-0.093994140625,
-0.2366943359375,
0.85595703125,
0.239501953125,
0.07257080078125,
0.17333984375,
0.390380859375,
-0.6796875,
0.271240234375,
-0.055999755859375,
-0.455078125,
-0.2301025390625,
0.07373046875,
1.470703125,
-0.439453125,
-0.01617431640625,
-0.5517578125,
0.93505859375,
0.3046875,
0.376953125,
-0.329345703125,
-0.7841796875,
-0.40771484375
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Limak can repeatedly remove one of the first two characters of a string, for example abcxyx \rightarrow acxyx \rightarrow cxyx \rightarrow cyx.
You are given N different strings S_1, S_2, \ldots, S_N. Among N \cdot (N-1) / 2 pairs (S_i, S_j), in how many pairs could Limak obtain one string from the other?
Constraints
* 2 \leq N \leq 200\,000
* S_i consists of lowercase English letters `a`-`z`.
* S_i \neq S_j
* 1 \leq |S_i|
* |S_1| + |S_2| + \ldots + |S_N| \leq 10^6
Input
Input is given from Standard Input in the following format.
N
S_1
S_2
\vdots
S_N
Output
Print the number of unordered pairs (S_i, S_j) where i \neq j and Limak can obtain one string from the other.
Examples
Input
3
abcxyx
cyx
abc
Output
1
Input
6
b
a
abc
c
d
ab
Output
5
"Correct Solution:
```
import sys
import string
input = sys.stdin.readline
from collections import defaultdict
N = int(input())
T = [input()[::-1].strip() for i in range(N)]
#N = 100
#M = 10000
#import random
#import string
#T = [''.join(random.choices(string.ascii_lowercase, k=random.randint(M,M))) for i in range(N)]
class TrieTree:
class Node:
def __init__(self):
#self.clue = defaultdict(int)
self.clue = [0]*26
self.ch = defaultdict(TrieTree.Node)
self.cnt = 0
self.end = False
def __init__(self):
self.root = self.Node()
def register(self,word):
node = self.root
for w in word:
node.cnt += 1
node = node.ch[w]
node.cnt += 1
node.end = True
def prefix(self, word):
node = self.root
for w in word:
if w not in node.ch:
return False
else:
node = node.ch[w]
return node
tt = TrieTree()
for word in T:
tt.register(word)
route = []
st = [tt.root]
while st:
node = st.pop()
route.append(node)
st.extend(node.ch.values())
f = lambda c : ord(c)-97
for node in route[::-1]:
for c,nnode in node.ch.items():
for i,v in enumerate(nnode.clue):
node.clue[i] += v
node.clue[f(c)] += nnode.cnt - nnode.clue[f(c)]
ans = 0
for word in T:
pre = word[:-1]
last = word[-1]
node = tt.prefix(pre)
if not node:
continue
ans += node.clue[f(last)] - 1
print(ans)
```
| 45,161
|
[
0.416748046875,
0.250732421875,
-0.0149383544921875,
-0.2010498046875,
-0.69140625,
-0.402587890625,
-0.388916015625,
0.01291656494140625,
0.433837890625,
0.9228515625,
0.6162109375,
-0.6474609375,
-0.1962890625,
-1.0341796875,
-0.60791015625,
0.2685546875,
-0.55908203125,
-0.650390625,
-0.1632080078125,
-0.07708740234375,
0.313720703125,
-0.3427734375,
-1.51953125,
-0.257080078125,
-0.39892578125,
0.783203125,
0.4404296875,
0.07421875,
0.98876953125,
1.0986328125,
-0.0302581787109375,
-0.54736328125,
0.51318359375,
-0.96044921875,
-0.1611328125,
-0.322998046875,
0.6953125,
-0.85986328125,
-0.47412109375,
-0.56982421875,
0.055633544921875,
-0.60302734375,
0.20654296875,
-0.6513671875,
-0.7314453125,
0.06536865234375,
-0.32763671875,
-0.548828125,
-0.1876220703125,
-0.5908203125,
0.10107421875,
-0.259765625,
0.837890625,
-0.4287109375,
-0.121337890625,
0.0941162109375,
0.0231475830078125,
0.03369140625,
-0.615234375,
0.54638671875,
0.21875,
0.28369140625,
-0.0609130859375,
-0.50927734375,
-0.353271484375,
-0.037353515625,
0.115478515625,
0.2447509765625,
0.10858154296875,
-0.7060546875,
-0.60595703125,
-0.07257080078125,
-0.59423828125,
-0.51708984375,
-0.46728515625,
0.1690673828125,
0.08221435546875,
0.1075439453125,
-0.41552734375,
0.884765625,
0.25634765625,
1.150390625,
0.5048828125,
0.06378173828125,
-0.352294921875,
-0.2459716796875,
0.16796875,
0.04571533203125,
0.2244873046875,
-0.3330078125,
-0.425048828125,
0.41650390625,
-1.013671875,
0.188232421875,
0.69677734375,
0.51025390625,
-0.28125,
0.15673828125,
0.385009765625,
0.0081787109375,
0.99853515625,
0.830078125,
-0.084228515625,
1.021484375,
-0.13720703125,
0.1148681640625,
0.3037109375,
-0.1099853515625,
-0.230224609375,
-0.1932373046875,
-0.2337646484375,
0.07879638671875,
0.7421875,
0.475830078125,
-0.10821533203125,
1.0537109375,
-0.0208282470703125,
0.2264404296875,
-0.477294921875,
0.1510009765625,
0.261962890625,
0.3828125,
0.71728515625,
-0.2587890625,
0.10870361328125,
-0.36083984375,
-0.4599609375,
0.68408203125,
-0.64990234375,
-0.2198486328125,
0.259521484375,
-0.175048828125,
-0.268798828125,
0.1627197265625,
-0.31689453125,
0.64453125,
-0.131103515625,
0.446533203125,
0.80126953125,
-0.59375,
1.2724609375,
0.080078125,
-0.15673828125,
1.4267578125,
0.016937255859375,
0.3095703125,
0.6171875,
0.521484375,
-0.6953125,
0.408447265625,
-1.2666015625,
0.380859375,
-0.113525390625,
0.08538818359375,
-0.313232421875,
-0.051910400390625,
-0.309326171875,
0.4091796875,
0.127197265625,
0.203857421875,
-0.315673828125,
0.26318359375,
-0.2083740234375,
0.68896484375,
-0.39501953125,
0.75,
-0.448486328125,
-0.4267578125,
0.1671142578125,
-0.3955078125,
0.509765625,
-0.489501953125,
0.156005859375,
0.85986328125,
0.38232421875,
0.787109375,
0.93896484375,
-0.00334930419921875,
0.273681640625,
0.31494140625,
-0.38037109375,
0.1976318359375,
0.32080078125,
0.62890625,
0.443359375,
0.349365234375,
0.1002197265625,
-0.381103515625,
-0.58984375,
-0.329833984375,
-0.1248779296875,
0.65966796875,
-0.52099609375,
-0.107666015625,
0.09527587890625,
0.01038360595703125,
-1.14453125,
0.0244903564453125,
-0.101806640625,
-0.64111328125,
-0.10552978515625,
0.43212890625,
-0.06500244140625,
0.272705078125,
-0.2578125,
-0.49462890625,
0.92529296875,
1.1962890625,
-0.238037109375,
0.07147216796875,
0.61962890625,
0.38623046875,
-0.64501953125,
0.265625,
0.1751708984375,
-0.1343994140625,
-0.59912109375,
0.45947265625,
-0.360595703125,
-0.253662109375,
0.25390625,
0.2154541015625,
0.473388671875,
0.442626953125,
-0.41845703125,
-0.01479339599609375,
0.50146484375,
1.0107421875,
0.373779296875,
0.6787109375,
0.04156494140625,
0.9423828125,
0.11834716796875,
0.666015625,
0.412841796875,
0.190673828125,
0.72119140625,
0.9140625,
-0.0233001708984375,
-0.01325225830078125,
-0.2880859375,
0.5302734375,
0.2109375,
0.6513671875,
0.0176849365234375,
0.434326171875,
-0.352294921875,
0.380615234375,
-0.378173828125,
0.1773681640625,
0.11474609375,
0.5625,
0.310546875,
0.6416015625,
-0.51806640625,
-0.191162109375,
0.26025390625,
0.78271484375,
-1.0517578125,
-0.45458984375,
-0.254638671875,
0.07177734375,
0.2802734375,
-0.2373046875,
0.023681640625,
0.57470703125,
0.83056640625,
0.302490234375,
-0.32373046875,
-0.53955078125,
-1.0283203125,
-0.943359375,
-0.93798828125,
-0.58203125,
-0.72216796875,
-0.43505859375,
0.2286376953125,
-0.7138671875,
0.74853515625,
-0.2479248046875,
-0.284912109375,
-0.1846923828125,
-0.6220703125,
0.62890625,
0.051910400390625,
0.59423828125,
-0.419921875,
0.30615234375,
0.1800537109375,
1.3212890625,
-0.58349609375,
-0.203369140625,
0.13818359375,
-0.69140625,
-0.0850830078125,
-0.0904541015625,
0.56640625,
0.09765625,
-0.4736328125,
-0.4375,
-0.469970703125,
0.2509765625,
-0.1761474609375,
0.2391357421875,
-0.3857421875,
0.6708984375,
0.626953125,
-1.05078125,
0.8095703125,
0.90234375,
-0.59716796875,
0.3125,
-0.00803375244140625,
0.22412109375,
-0.8349609375,
1.5146484375,
0.34228515625,
0.181640625,
-0.487548828125,
-1.001953125,
-0.77587890625,
-0.011383056640625,
0.07037353515625,
-0.6015625,
-0.23974609375,
0.505859375,
-0.495849609375,
-0.6025390625,
0.59765625,
-1.240234375,
-0.599609375,
-0.449462890625,
-0.375244140625,
0.54150390625,
0.6826171875,
0.315673828125,
-0.39892578125,
-0.278076171875,
-0.1453857421875,
0.9521484375,
0.41357421875,
-0.81005859375,
-0.054840087890625,
0.435546875,
0.4228515625,
-0.0328369140625,
0.3251953125,
-0.40380859375,
-0.38525390625,
-0.06707763671875,
0.217529296875,
0.767578125,
0.1148681640625,
0.269775390625,
0.3994140625,
0.56494140625,
-0.73681640625,
0.224609375,
-0.1329345703125,
0.491455078125,
0.134521484375,
0.447021484375,
0.1900634765625,
-0.11737060546875,
-0.38671875,
-0.853515625,
0.389892578125,
0.40087890625,
0.62646484375,
-0.70458984375,
0.69775390625,
0.1036376953125,
-0.69970703125,
0.72802734375,
-0.5341796875,
-0.0673828125,
0.8154296875,
-0.541015625,
0.7763671875,
-0.4072265625,
0.1263427734375,
-0.3076171875,
0.0305328369140625,
0.83984375,
0.57177734375,
0.595703125,
-0.268310546875,
-0.57470703125,
-0.67822265625,
-0.546875,
0.3056640625,
-0.22119140625,
0.2086181640625,
-0.46484375,
-0.252685546875,
-0.75341796875,
0.294921875,
0.281005859375,
0.72509765625,
0.331298828125,
0.273681640625,
0.042938232421875,
0.5263671875,
0.72802734375,
-0.52001953125,
0.19091796875,
-0.31884765625,
1.126953125,
0.110595703125,
-0.477783203125,
-0.56640625,
-0.393310546875,
-0.10968017578125,
0.467529296875,
0.06195068359375,
-0.35107421875,
-1.0126953125,
0.6787109375,
-0.0168609619140625,
0.595703125,
-0.271484375,
-0.591796875,
-0.4462890625,
0.55029296875,
0.2210693359375,
-0.82958984375,
0.08587646484375,
-0.54541015625,
0.473388671875,
0.14501953125,
-0.329345703125,
-0.32421875,
-0.157958984375,
-0.305908203125,
-0.79833984375,
-0.099853515625,
0.5625,
0.07061767578125,
0.05487060546875,
-0.955078125,
0.12420654296875,
0.25,
0.0970458984375,
0.25390625,
-0.323486328125,
0.425537109375,
0.2548828125,
0.372802734375,
-0.50732421875,
-0.1190185546875,
-0.20703125,
-1.4599609375,
0.6943359375,
-0.51953125,
0.81298828125,
-0.1480712890625,
-0.12646484375,
-0.264892578125,
0.436767578125,
-0.333984375,
0.365234375,
-0.20703125,
0.60546875,
-0.83203125,
-0.89404296875,
0.681640625,
-0.7919921875,
-0.448486328125,
0.72265625,
0.11700439453125,
-0.368896484375,
0.365478515625,
0.416259765625,
-0.470458984375,
0.260986328125,
-0.537109375,
1.0361328125,
-0.2490234375,
-0.399658203125,
0.0002925395965576172,
-0.45947265625,
0.482421875,
0.14453125,
-0.74755859375,
-0.239990234375,
-1.099609375,
-0.03802490234375,
0.0092010498046875,
-0.288818359375,
0.31982421875,
0.01021575927734375,
-0.020965576171875,
-0.1282958984375,
-0.34033203125,
-0.7021484375,
-0.72412109375,
-0.7294921875,
-0.400634765625,
0.26806640625,
0.65234375,
0.85009765625,
-0.311279296875,
-0.484619140625,
-0.0296173095703125,
-0.0587158203125,
0.05908203125,
-0.27880859375,
-0.2423095703125,
-0.0181732177734375,
-0.391845703125,
-0.38720703125,
0.454833984375,
0.2269287109375,
0.32666015625,
0.41064453125,
0.1910400390625,
0.417236328125,
0.475341796875,
-0.5107421875,
1.15234375,
0.14208984375,
-1.189453125,
-0.282470703125,
0.68701171875,
-0.087646484375,
0.78125,
0.320556640625,
-0.60546875,
-0.75390625,
-0.83056640625,
0.1513671875,
-0.599609375,
-0.332763671875,
-1.1123046875,
-0.1968994140625,
-0.425048828125,
0.71044921875,
-0.501953125,
-0.463623046875,
0.306396484375,
-0.93603515625,
0.416748046875,
-0.58642578125,
-0.71630859375,
-0.7421875,
-0.9677734375,
-0.1580810546875,
1.0107421875,
0.46923828125,
0.2208251953125,
0.029022216796875,
-0.1036376953125,
0.182373046875,
0.1539306640625,
-0.8359375,
-0.1217041015625,
-0.2666015625,
0.467529296875,
-0.311279296875,
0.030914306640625,
-0.472412109375,
0.59033203125,
-0.56884765625,
0.35888671875,
-0.449951171875,
-0.337646484375,
0.11614990234375,
-0.34716796875,
0.99560546875,
-0.52978515625,
0.1279296875,
-0.56591796875,
0.54345703125,
0.48876953125,
-0.124267578125,
-0.591796875,
-0.85791015625,
-0.6982421875,
-1.228515625,
0.447265625,
-0.376953125,
0.0640869140625,
-0.68017578125,
0.2149658203125,
0.783203125,
-0.52587890625,
0.517578125,
1.005859375,
0.1298828125,
0.47265625,
-0.630859375,
0.833984375,
0.52880859375,
-0.52294921875,
-0.47607421875,
0.41064453125,
-0.431396484375,
0.59423828125,
-0.264404296875,
-1.1416015625,
-0.673828125,
0.5048828125,
1.294921875,
-0.166259765625,
0.8798828125,
-0.068115234375,
-0.64599609375,
-0.69384765625,
0.481201171875,
0.1646728515625,
0.64892578125,
0.8271484375,
-0.46630859375,
-0.29638671875,
0.341064453125,
-0.0604248046875,
-0.29638671875,
-0.80712890625,
0.86376953125,
-0.75439453125,
-0.405517578125,
0.233154296875,
0.69775390625,
-1.052734375,
-1.1201171875,
-0.18994140625,
0.05133056640625,
-0.235107421875,
-1.2294921875,
0.2293701171875,
0.428466796875,
-0.46337890625,
-0.1982421875,
0.2088623046875,
-0.45166015625,
0.62744140625,
0.1697998046875,
0.2978515625,
-0.6181640625,
0.6484375,
0.488037109375,
-0.326416015625,
-0.62646484375,
-0.87353515625,
-0.005054473876953125,
-0.3291015625,
0.2137451171875,
0.4482421875,
-0.48388671875,
0.34716796875,
0.3125,
-0.00960540771484375,
1.1806640625,
-0.361572265625,
-0.12005615234375,
0.2568359375,
-0.5185546875,
-0.525390625,
-0.193359375,
0.217529296875,
-0.32421875,
0.239990234375,
-0.276123046875,
-0.0609130859375,
0.48388671875,
0.351318359375,
-0.412841796875,
-0.89794921875,
-0.40087890625,
-0.76904296875,
-0.4658203125,
-0.5703125,
-0.75830078125,
0.19873046875,
0.110107421875,
-0.01490020751953125,
-0.49267578125,
0.0088348388671875,
0.41015625,
-0.65771484375,
0.96044921875,
-0.433349609375,
0.53125,
-0.66552734375,
-0.268310546875,
-0.611328125,
0.08355712890625,
-0.60400390625,
-0.29541015625,
-0.57958984375,
0.263427734375,
-0.21826171875,
0.357421875,
-0.427490234375,
0.255126953125,
-0.16015625,
-0.61767578125,
-0.07666015625,
0.170166015625,
-0.24853515625,
0.71630859375,
0.8759765625,
0.1741943359375,
0.30517578125,
-0.30029296875,
-0.339111328125,
-0.30078125,
0.85009765625,
0.70556640625,
-0.211181640625,
-0.1927490234375,
-0.214599609375,
0.1435546875,
-1.1767578125,
0.276611328125,
-0.2734375,
0.404296875,
0.250244140625,
-0.12744140625,
0.53515625,
1.4677734375,
0.06475830078125,
0.453857421875,
0.468017578125,
0.35400390625,
0.17333984375,
0.05474853515625,
-0.260498046875,
0.289306640625,
-0.1383056640625,
0.0748291015625,
-0.033172607421875,
0.270751953125,
0.04388427734375,
0.233154296875,
-0.28564453125,
-0.77783203125,
-0.64599609375,
-0.29736328125,
-0.403076171875,
0.38720703125,
0.5556640625,
-0.66552734375,
0.333984375,
-0.06536865234375,
-0.69384765625,
-0.1361083984375,
-0.8017578125,
-1.1484375,
0.28076171875,
-0.3193359375,
-0.7333984375,
-0.37255859375,
-0.640625,
-0.301513671875,
-0.0732421875,
0.382080078125,
-0.85986328125,
0.2822265625,
-0.2431640625,
0.6123046875,
-0.01166534423828125,
0.13232421875,
0.1815185546875,
0.306884765625,
-0.8701171875,
-0.480712890625,
-0.252197265625,
0.88427734375,
0.314697265625,
-0.325439453125,
-0.2257080078125,
0.225341796875,
0.34716796875,
0.054779052734375,
-0.58447265625,
0.172607421875,
-0.0621337890625,
0.50048828125,
-0.662109375,
-0.12188720703125,
-0.1544189453125,
0.43359375,
0.163330078125,
-0.3330078125,
-0.734375,
0.96533203125,
0.53857421875,
-0.202880859375,
0.04669189453125,
0.45263671875,
0.005664825439453125,
-0.204833984375,
0.0382080078125,
-0.3251953125,
0.67578125,
0.37548828125,
0.6572265625,
-0.1527099609375,
0.0711669921875,
0.572265625,
-0.03302001953125,
-0.449462890625,
0.55810546875,
0.54541015625,
0.365234375,
0.171630859375,
-0.347412109375,
-0.599609375,
0.148193359375,
-0.77392578125,
0.16064453125,
-0.1473388671875,
0.075927734375,
-0.16357421875,
-0.5166015625,
0.66259765625,
-0.806640625,
0.11572265625,
0.318115234375,
-0.59033203125,
0.51171875,
0.65234375,
0.351806640625,
-0.2734375,
0.8134765625,
0.87548828125,
0.98046875,
0.8759765625,
0.388427734375,
0.38818359375,
-1.1298828125,
0.168212890625,
0.103271484375,
-0.46728515625,
-0.1629638671875,
-0.18017578125,
-0.92529296875,
0.4404296875,
-0.382080078125,
-0.079345703125,
0.27978515625,
-0.55224609375,
0.127197265625,
-0.1561279296875,
1.0859375,
-0.473876953125,
0.29541015625,
0.18310546875,
-0.344970703125,
-0.30419921875,
0.802734375,
-0.255126953125,
0.449462890625,
0.1807861328125,
0.96435546875,
0.4033203125,
1.44140625,
0.39990234375,
-0.24072265625,
0.2264404296875,
0.52392578125,
-0.11737060546875,
-0.64892578125,
-0.368896484375,
-0.21923828125,
0.10906982421875,
-0.869140625,
-0.355712890625,
-0.2369384765625,
0.7939453125,
0.061248779296875,
-0.87451171875,
-0.0401611328125,
-0.039337158203125,
-0.88330078125,
0.388427734375,
0.30712890625,
0.21435546875,
-0.0537109375,
-0.425537109375,
-0.0555419921875,
-0.76953125,
0.1781005859375,
-0.397216796875,
0.3154296875,
-0.431884765625,
-0.216796875,
-0.763671875,
-1.02734375,
-0.337890625,
-0.11090087890625,
-0.116943359375,
-0.83203125,
0.35791015625,
0.6787109375,
0.3388671875,
0.06536865234375,
-0.362060546875,
0.4580078125,
0.8876953125,
1.0224609375,
-0.010986328125,
0.86328125,
0.5712890625,
-0.5634765625,
-0.0240936279296875,
-0.11431884765625,
0.63720703125,
0.104248046875,
0.451904296875,
-0.59619140625,
0.5810546875,
-0.82568359375,
-1.396484375,
0.19189453125,
0.47998046875,
0.4462890625,
-0.7265625,
-1.0361328125,
-0.153076171875,
-1.0078125,
-0.11859130859375,
-0.654296875,
0.875,
-0.366943359375,
0.274658203125,
-0.08209228515625,
-1.103515625,
4.453125,
1.1953125,
1.046875,
0.337646484375,
0.17138671875,
1.1669921875,
0.3125,
-0.46337890625,
-0.315673828125,
-0.5595703125,
0.43896484375,
-0.35546875,
0.0028476715087890625,
1.0068359375,
0.13916015625,
0.47900390625,
-0.74951171875,
0.331787109375,
0.32763671875,
-0.71923828125,
-0.84765625,
0.333984375,
-0.2113037109375,
0.61279296875,
0.1292724609375,
0.183349609375,
0.72314453125,
-0.576171875,
-0.11859130859375,
-0.6474609375,
-0.026092529296875,
-0.08453369140625,
0.783203125,
-0.29248046875,
0.020416259765625,
0.6767578125,
0.08343505859375,
-0.366943359375,
-0.0826416015625,
0.190673828125,
-0.164794921875,
-0.1343994140625,
0.4892578125,
-0.66845703125,
-0.1160888671875,
0.53076171875,
-0.52197265625,
0.250244140625,
0.415283203125,
-1.3701171875,
0.52392578125,
-0.1317138671875,
0.734375,
-0.9189453125,
-0.60986328125,
0.31787109375,
0.12890625,
-0.2120361328125,
-0.44921875,
0.29638671875,
0.319580078125,
0.239501953125,
-0.147216796875,
0.355224609375,
-0.8017578125,
0.55859375,
0.01294708251953125,
0.40869140625,
-0.53125,
0.05010986328125,
0.06439208984375,
-0.372314453125,
-0.50390625,
-0.2880859375,
0.54345703125,
0.1556396484375,
-0.1234130859375,
0.423583984375,
0.5224609375,
-0.48828125,
0.2880859375,
-0.465576171875,
-0.01454925537109375,
-0.49609375,
0.495849609375,
1.166015625,
-0.43994140625,
-0.229248046875,
-0.40771484375,
0.49658203125,
0.40087890625,
0.59375,
0.2110595703125,
-0.334716796875,
-0.1900634765625
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Limak can repeatedly remove one of the first two characters of a string, for example abcxyx \rightarrow acxyx \rightarrow cxyx \rightarrow cyx.
You are given N different strings S_1, S_2, \ldots, S_N. Among N \cdot (N-1) / 2 pairs (S_i, S_j), in how many pairs could Limak obtain one string from the other?
Constraints
* 2 \leq N \leq 200\,000
* S_i consists of lowercase English letters `a`-`z`.
* S_i \neq S_j
* 1 \leq |S_i|
* |S_1| + |S_2| + \ldots + |S_N| \leq 10^6
Input
Input is given from Standard Input in the following format.
N
S_1
S_2
\vdots
S_N
Output
Print the number of unordered pairs (S_i, S_j) where i \neq j and Limak can obtain one string from the other.
Examples
Input
3
abcxyx
cyx
abc
Output
1
Input
6
b
a
abc
c
d
ab
Output
5
"Correct Solution:
```
class Trie:
class Node:
def __init__(self,c):
self.c=c
self.next_c_id={}
#self.common=0
self.end=-1
def __init__(self):
self.trie=[self.Node('')]
def add(self,id,s):
i=0
now=0
ary=[0]
while i<len(s) and s[i] in self.trie[now].next_c_id:
now=self.trie[now].next_c_id[s[i]]
ary.append(now)
#self.trie[now].common+=1
i+=1
while i<len(s):
self.trie[now].next_c_id[s[i]]=len(self.trie)
now=len(self.trie)
ary.append(now)
self.trie.append(self.Node(s[i]))
#self.trie[now].common+=1
i+=1
self.trie[now].end=id
return ary
def main(s):
tr=Trie()
s.sort(key=lambda x:len(x))
ans=0
for i,x in enumerate(s):
ary=tr.add(i,x)
seen=set(())
while ary:
id=ary.pop()
for nv in seen&tr.trie[id].next_c_id.keys():
if tr.trie[tr.trie[id].next_c_id[nv]].end>=0 and tr.trie[tr.trie[id].next_c_id[nv]].end!=i:
ans+=1
seen.add(tr.trie[id].c)
print(ans)
if __name__=='__main__':
a2n=lambda x:ord(x)-ord('a')
n=int(input())
s=[list(map(a2n,list(input()))) for _ in range(n)]
[x.reverse() for x in s]
main(s)
```
| 45,164
|
[
0.353759765625,
0.295166015625,
-0.010345458984375,
-0.1826171875,
-0.78759765625,
-0.357177734375,
-0.417236328125,
-0.02947998046875,
0.56787109375,
0.8388671875,
0.67041015625,
-0.45458984375,
-0.2366943359375,
-1.056640625,
-0.70947265625,
0.10687255859375,
-0.56640625,
-0.640625,
-0.234375,
-0.1212158203125,
0.29345703125,
-0.2607421875,
-1.4384765625,
-0.277587890625,
-0.450439453125,
0.64501953125,
0.34521484375,
0.0056304931640625,
0.9951171875,
1.19921875,
-0.08294677734375,
-0.42041015625,
0.349853515625,
-1.0126953125,
-0.1302490234375,
-0.315673828125,
0.74853515625,
-0.8203125,
-0.3740234375,
-0.5390625,
0.1395263671875,
-0.6650390625,
0.31298828125,
-0.712890625,
-0.6455078125,
0.05401611328125,
-0.1666259765625,
-0.77001953125,
-0.3017578125,
-0.41845703125,
0.1610107421875,
-0.321533203125,
0.87255859375,
-0.52685546875,
-0.03643798828125,
0.07855224609375,
0.242431640625,
-0.02203369140625,
-0.52685546875,
0.57421875,
0.06536865234375,
0.244873046875,
-0.01174163818359375,
-0.494140625,
-0.44677734375,
-0.1339111328125,
0.1707763671875,
0.1820068359375,
0.1627197265625,
-0.83544921875,
-0.66455078125,
-0.0183258056640625,
-0.427978515625,
-0.50244140625,
-0.41796875,
0.0863037109375,
-0.035980224609375,
0.0240631103515625,
-0.37841796875,
0.81591796875,
0.32373046875,
0.99609375,
0.5791015625,
0.1593017578125,
-0.33935546875,
-0.142822265625,
0.1519775390625,
0.1771240234375,
0.2137451171875,
-0.25927734375,
-0.47705078125,
0.487548828125,
-0.9619140625,
0.142578125,
0.65380859375,
0.5322265625,
-0.0078277587890625,
0.229248046875,
0.50341796875,
-0.0416259765625,
1.1845703125,
0.77978515625,
-0.06683349609375,
0.9677734375,
-0.1932373046875,
0.226806640625,
0.1397705078125,
-0.0154876708984375,
-0.1846923828125,
-0.259765625,
-0.32568359375,
0.07916259765625,
0.80517578125,
0.5146484375,
-0.0516357421875,
1.1064453125,
-0.256103515625,
0.292724609375,
-0.42431640625,
0.1912841796875,
0.44970703125,
0.50830078125,
0.6376953125,
-0.29736328125,
0.0880126953125,
-0.4072265625,
-0.33447265625,
0.61083984375,
-0.76171875,
-0.156982421875,
0.239501953125,
-0.282958984375,
-0.260498046875,
0.115234375,
-0.2783203125,
0.52587890625,
-0.2205810546875,
0.363525390625,
0.86279296875,
-0.6455078125,
1.2568359375,
-0.0140380859375,
-0.1739501953125,
1.4443359375,
0.097900390625,
0.3486328125,
0.5224609375,
0.486083984375,
-0.69580078125,
0.290283203125,
-1.16015625,
0.5185546875,
-0.08111572265625,
0.1829833984375,
-0.318603515625,
-0.04986572265625,
-0.2379150390625,
0.387451171875,
0.033447265625,
0.14208984375,
-0.302001953125,
0.03228759765625,
-0.1982421875,
0.73046875,
-0.4248046875,
0.927734375,
-0.501953125,
-0.372314453125,
0.12274169921875,
-0.459228515625,
0.59619140625,
-0.43212890625,
0.0865478515625,
0.78125,
0.380615234375,
0.74072265625,
0.916015625,
-0.0034580230712890625,
0.494873046875,
0.335205078125,
-0.294189453125,
0.2281494140625,
0.32666015625,
0.51171875,
0.44921875,
0.40087890625,
-0.005466461181640625,
-0.451904296875,
-0.58056640625,
-0.28955078125,
-0.147705078125,
0.685546875,
-0.5234375,
-0.112060546875,
0.06951904296875,
-0.01690673828125,
-1.0927734375,
-0.0216064453125,
-0.030975341796875,
-0.515625,
-0.2083740234375,
0.494873046875,
0.07000732421875,
0.378662109375,
-0.4072265625,
-0.3837890625,
0.92236328125,
1.19921875,
-0.363525390625,
0.1524658203125,
0.67236328125,
0.447021484375,
-0.63232421875,
0.446044921875,
0.05218505859375,
-0.06488037109375,
-0.6259765625,
0.58837890625,
-0.3974609375,
-0.2822265625,
0.331298828125,
0.19091796875,
0.39208984375,
0.403564453125,
-0.4921875,
-0.0302581787109375,
0.599609375,
1.0947265625,
0.27880859375,
0.6103515625,
0.045562744140625,
0.96533203125,
-0.1094970703125,
0.57470703125,
0.3173828125,
0.388671875,
0.64990234375,
0.88330078125,
-0.0513916015625,
-0.033599853515625,
-0.1783447265625,
0.391845703125,
0.34326171875,
0.488525390625,
-0.07843017578125,
0.56884765625,
-0.36474609375,
0.31689453125,
-0.362060546875,
0.1448974609375,
0.10101318359375,
0.5751953125,
0.3251953125,
0.55078125,
-0.6103515625,
-0.1348876953125,
0.325439453125,
0.77197265625,
-0.9580078125,
-0.6533203125,
-0.2237548828125,
0.058258056640625,
0.330810546875,
-0.342041015625,
-0.005462646484375,
0.62841796875,
0.9150390625,
0.2861328125,
-0.299560546875,
-0.47705078125,
-0.8193359375,
-1.0986328125,
-0.849609375,
-0.60595703125,
-0.60498046875,
-0.52978515625,
0.317626953125,
-0.83447265625,
0.78662109375,
-0.05169677734375,
-0.205810546875,
-0.187744140625,
-0.83447265625,
0.7470703125,
0.058990478515625,
0.51806640625,
-0.3681640625,
0.38427734375,
0.244384765625,
1.357421875,
-0.533203125,
-0.267822265625,
0.30859375,
-0.75927734375,
-0.203125,
-0.12127685546875,
0.5419921875,
0.1866455078125,
-0.367431640625,
-0.53759765625,
-0.34375,
0.1309814453125,
-0.22900390625,
0.34912109375,
-0.30810546875,
0.65673828125,
0.5791015625,
-0.9228515625,
0.68603515625,
0.89453125,
-0.6376953125,
0.480224609375,
0.005809783935546875,
0.2017822265625,
-0.734375,
1.4736328125,
0.27978515625,
0.1492919921875,
-0.56298828125,
-1.013671875,
-0.70849609375,
-0.039154052734375,
0.04010009765625,
-0.57373046875,
-0.357177734375,
0.491943359375,
-0.56005859375,
-0.63720703125,
0.60400390625,
-1.251953125,
-0.533203125,
-0.333984375,
-0.3095703125,
0.478271484375,
0.63720703125,
0.2332763671875,
-0.30517578125,
-0.399169921875,
-0.0230560302734375,
0.8720703125,
0.37841796875,
-0.63427734375,
0.09027099609375,
0.434326171875,
0.35009765625,
-0.10760498046875,
0.390380859375,
-0.533203125,
-0.455810546875,
0.06414794921875,
0.05096435546875,
0.8271484375,
0.1456298828125,
0.280517578125,
0.389404296875,
0.65185546875,
-0.66552734375,
0.07708740234375,
-0.1259765625,
0.476806640625,
0.1363525390625,
0.332275390625,
0.2481689453125,
-0.2054443359375,
-0.3134765625,
-0.86328125,
0.4384765625,
0.3154296875,
0.626953125,
-0.72021484375,
0.73876953125,
0.26318359375,
-0.68408203125,
0.7353515625,
-0.626953125,
-0.0185546875,
0.85107421875,
-0.59765625,
0.5986328125,
-0.533203125,
-0.0009140968322753906,
-0.211669921875,
0.101806640625,
0.80029296875,
0.53369140625,
0.6552734375,
-0.35791015625,
-0.5546875,
-0.79345703125,
-0.552734375,
0.28857421875,
-0.228759765625,
0.08746337890625,
-0.52392578125,
-0.252685546875,
-0.791015625,
0.396484375,
0.252197265625,
0.7109375,
0.0109710693359375,
0.25341796875,
0.05389404296875,
0.54296875,
0.81787109375,
-0.461181640625,
0.23388671875,
-0.306396484375,
1.1640625,
0.1448974609375,
-0.55517578125,
-0.466552734375,
-0.5546875,
-0.310791015625,
0.515625,
0.253173828125,
-0.342041015625,
-0.94091796875,
0.5751953125,
-0.065185546875,
0.658203125,
-0.13720703125,
-0.72119140625,
-0.3955078125,
0.430419921875,
0.271484375,
-0.962890625,
-0.06732177734375,
-0.689453125,
0.486083984375,
0.1678466796875,
-0.369384765625,
-0.37060546875,
-0.310302734375,
-0.29345703125,
-0.748046875,
-0.16162109375,
0.69873046875,
0.09552001953125,
-0.037200927734375,
-1.0322265625,
0.07769775390625,
0.2568359375,
-0.05780029296875,
0.30224609375,
-0.342041015625,
0.464111328125,
0.07501220703125,
0.451171875,
-0.383544921875,
-0.127685546875,
-0.2841796875,
-1.474609375,
0.744140625,
-0.51416015625,
0.7939453125,
-0.11968994140625,
-0.204833984375,
-0.098876953125,
0.427490234375,
-0.223876953125,
0.307861328125,
-0.11322021484375,
0.5908203125,
-0.79296875,
-0.84375,
0.74267578125,
-0.7548828125,
-0.453369140625,
0.75244140625,
0.2421875,
-0.4599609375,
0.265380859375,
0.52734375,
-0.43017578125,
0.2073974609375,
-0.56591796875,
1.03125,
-0.2802734375,
-0.412353515625,
0.045013427734375,
-0.458251953125,
0.404541015625,
0.08648681640625,
-0.724609375,
-0.342041015625,
-1.111328125,
0.0173492431640625,
-0.1903076171875,
-0.310791015625,
0.3935546875,
-0.11407470703125,
-0.0712890625,
-0.109619140625,
-0.289794921875,
-0.68603515625,
-0.68798828125,
-0.77783203125,
-0.421142578125,
0.1895751953125,
0.65966796875,
0.85791015625,
-0.301513671875,
-0.432861328125,
-0.07708740234375,
-0.1856689453125,
0.10723876953125,
-0.1954345703125,
-0.329833984375,
0.0207061767578125,
-0.443115234375,
-0.361572265625,
0.5341796875,
0.270751953125,
0.278076171875,
0.4892578125,
0.09979248046875,
0.3037109375,
0.52685546875,
-0.50537109375,
1.1181640625,
0.193603515625,
-1.0966796875,
-0.152587890625,
0.662109375,
-0.06365966796875,
0.888671875,
0.276123046875,
-0.5966796875,
-0.724609375,
-0.75146484375,
0.06427001953125,
-0.54833984375,
-0.328125,
-1.1279296875,
-0.278076171875,
-0.475830078125,
0.73681640625,
-0.50048828125,
-0.39501953125,
0.28955078125,
-1.142578125,
0.5263671875,
-0.53759765625,
-0.76171875,
-0.71240234375,
-0.97265625,
-0.06671142578125,
0.94482421875,
0.438232421875,
0.080322265625,
0.08355712890625,
-0.08599853515625,
0.322021484375,
0.09893798828125,
-0.7802734375,
-0.14208984375,
-0.32373046875,
0.4814453125,
-0.44189453125,
-0.07781982421875,
-0.43896484375,
0.5830078125,
-0.53759765625,
0.1876220703125,
-0.56201171875,
-0.265625,
0.09429931640625,
-0.352783203125,
0.99658203125,
-0.62451171875,
0.00861358642578125,
-0.49755859375,
0.50390625,
0.43798828125,
0.0181732177734375,
-0.5771484375,
-0.80712890625,
-0.82177734375,
-1.169921875,
0.350341796875,
-0.356201171875,
0.1295166015625,
-0.70751953125,
0.2191162109375,
0.7138671875,
-0.386474609375,
0.5068359375,
1.1708984375,
0.021270751953125,
0.402587890625,
-0.67138671875,
0.83740234375,
0.4775390625,
-0.5302734375,
-0.482666015625,
0.45068359375,
-0.404296875,
0.60302734375,
-0.159912109375,
-1.1513671875,
-0.70703125,
0.55419921875,
1.2939453125,
-0.1593017578125,
0.82666015625,
0.027252197265625,
-0.68798828125,
-0.68310546875,
0.58935546875,
0.1492919921875,
0.63623046875,
0.84033203125,
-0.495849609375,
-0.29052734375,
0.36328125,
-0.1298828125,
-0.1724853515625,
-0.72314453125,
0.86572265625,
-0.7626953125,
-0.5283203125,
0.298828125,
0.705078125,
-1.064453125,
-1.103515625,
-0.1346435546875,
0.17333984375,
-0.1796875,
-1.322265625,
0.118896484375,
0.43994140625,
-0.50244140625,
-0.1358642578125,
0.34716796875,
-0.476318359375,
0.7080078125,
0.281494140625,
0.2337646484375,
-0.49609375,
0.65966796875,
0.54638671875,
-0.2437744140625,
-0.69873046875,
-0.9638671875,
-0.0478515625,
-0.40625,
0.281005859375,
0.489501953125,
-0.449951171875,
0.33154296875,
0.1702880859375,
0.0207977294921875,
1.203125,
-0.482177734375,
-0.037628173828125,
0.332763671875,
-0.475341796875,
-0.61376953125,
-0.162109375,
0.1353759765625,
-0.361572265625,
0.2232666015625,
-0.358154296875,
-0.0214385986328125,
0.57958984375,
0.267822265625,
-0.42333984375,
-0.86376953125,
-0.366455078125,
-0.88671875,
-0.65966796875,
-0.62890625,
-0.802734375,
0.244384765625,
0.07525634765625,
-0.013885498046875,
-0.580078125,
0.061065673828125,
0.4208984375,
-0.60546875,
1.0625,
-0.458984375,
0.448486328125,
-0.5810546875,
-0.327392578125,
-0.701171875,
0.0576171875,
-0.5322265625,
-0.33544921875,
-0.479736328125,
0.259033203125,
-0.126953125,
0.2315673828125,
-0.457275390625,
0.250732421875,
-0.201416015625,
-0.7177734375,
-0.08087158203125,
0.10198974609375,
-0.08294677734375,
0.7216796875,
0.9375,
0.08233642578125,
0.4091796875,
-0.1395263671875,
-0.330810546875,
-0.290283203125,
0.81396484375,
0.8388671875,
-0.2059326171875,
-0.170654296875,
-0.255126953125,
0.1807861328125,
-1.10546875,
0.32373046875,
-0.34716796875,
0.39697265625,
0.3271484375,
-0.1490478515625,
0.6435546875,
1.51953125,
-0.011932373046875,
0.493408203125,
0.488525390625,
0.401611328125,
0.158447265625,
0.0909423828125,
-0.195556640625,
0.32470703125,
-0.02911376953125,
-0.09991455078125,
-0.07855224609375,
0.16845703125,
0.1319580078125,
0.32666015625,
-0.32470703125,
-0.76318359375,
-0.54345703125,
-0.2021484375,
-0.462158203125,
0.373291015625,
0.59765625,
-0.63671875,
0.325439453125,
0.1343994140625,
-0.74658203125,
-0.12005615234375,
-0.77392578125,
-1.2412109375,
0.255615234375,
-0.277099609375,
-0.744140625,
-0.5244140625,
-0.67236328125,
-0.2362060546875,
-0.14697265625,
0.2100830078125,
-0.94189453125,
0.3095703125,
-0.24853515625,
0.64306640625,
0.043975830078125,
0.1571044921875,
0.2421875,
0.32080078125,
-0.99267578125,
-0.52001953125,
-0.2296142578125,
0.82177734375,
0.2841796875,
-0.296142578125,
-0.215087890625,
0.194580078125,
0.334228515625,
0.1881103515625,
-0.49755859375,
0.188232421875,
-0.085693359375,
0.473388671875,
-0.7138671875,
-0.1466064453125,
-0.20361328125,
0.437744140625,
0.1715087890625,
-0.476318359375,
-0.58056640625,
1.0693359375,
0.50439453125,
-0.1536865234375,
0.264892578125,
0.438720703125,
0.0479736328125,
-0.1927490234375,
0.007549285888671875,
-0.3984375,
0.68603515625,
0.361083984375,
0.50634765625,
-0.1357421875,
0.0965576171875,
0.60009765625,
0.029815673828125,
-0.435546875,
0.7685546875,
0.4931640625,
0.358154296875,
0.2034912109375,
-0.396728515625,
-0.451904296875,
0.08221435546875,
-0.76025390625,
0.1717529296875,
-0.264404296875,
0.039825439453125,
-0.1236572265625,
-0.465087890625,
0.75390625,
-0.7158203125,
0.207275390625,
0.15576171875,
-0.62451171875,
0.445556640625,
0.7265625,
0.4267578125,
-0.207763671875,
0.82568359375,
0.73046875,
0.89208984375,
0.8271484375,
0.426025390625,
0.50048828125,
-1.0966796875,
0.15966796875,
0.1365966796875,
-0.394287109375,
-0.294677734375,
-0.1376953125,
-0.830078125,
0.422119140625,
-0.406494140625,
-0.0751953125,
0.28466796875,
-0.6044921875,
-0.0056304931640625,
-0.09747314453125,
1.099609375,
-0.44091796875,
0.173095703125,
0.21533203125,
-0.196044921875,
-0.230712890625,
0.9736328125,
-0.27197265625,
0.338623046875,
0.13623046875,
0.95703125,
0.419677734375,
1.53515625,
0.52099609375,
-0.1612548828125,
0.2890625,
0.53173828125,
-0.25146484375,
-0.6552734375,
-0.436767578125,
-0.2242431640625,
0.0755615234375,
-0.98974609375,
-0.329833984375,
-0.322509765625,
0.7265625,
-0.00485992431640625,
-0.9033203125,
-0.0303802490234375,
-0.04644775390625,
-0.736328125,
0.2275390625,
0.29296875,
0.275390625,
-0.137939453125,
-0.430419921875,
-0.1351318359375,
-0.7724609375,
0.029144287109375,
-0.339111328125,
0.2685546875,
-0.350341796875,
-0.0816650390625,
-0.7470703125,
-1.005859375,
-0.4404296875,
-0.0953369140625,
-0.1162109375,
-0.84765625,
0.30322265625,
0.66162109375,
0.326904296875,
0.0202789306640625,
-0.3896484375,
0.54541015625,
0.8369140625,
0.98828125,
0.020294189453125,
0.76025390625,
0.64794921875,
-0.486083984375,
-0.08880615234375,
-0.042816162109375,
0.53515625,
0.06988525390625,
0.458984375,
-0.443603515625,
0.5322265625,
-0.81494140625,
-1.33984375,
0.1802978515625,
0.51123046875,
0.5244140625,
-0.6689453125,
-1.119140625,
-0.14794921875,
-1.095703125,
-0.0672607421875,
-0.7001953125,
0.79443359375,
-0.253173828125,
0.2376708984375,
-0.0850830078125,
-1.1337890625,
4.421875,
1.150390625,
1.0146484375,
0.257080078125,
0.200439453125,
1.2431640625,
0.26806640625,
-0.147216796875,
-0.375244140625,
-0.5029296875,
0.53662109375,
-0.279052734375,
0.1136474609375,
0.86328125,
0.3251953125,
0.62646484375,
-0.728515625,
0.315673828125,
0.2607421875,
-0.66162109375,
-0.79248046875,
0.27001953125,
-0.1934814453125,
0.67724609375,
0.0950927734375,
0.1580810546875,
0.796875,
-0.669921875,
-0.05914306640625,
-0.716796875,
-0.0127105712890625,
-0.046966552734375,
0.68115234375,
-0.3056640625,
0.00020515918731689453,
0.5595703125,
0.2208251953125,
-0.419189453125,
-0.09686279296875,
0.11968994140625,
-0.07293701171875,
-0.19921875,
0.38671875,
-0.66943359375,
-0.1148681640625,
0.469970703125,
-0.50732421875,
0.25439453125,
0.37744140625,
-1.3671875,
0.74169921875,
-0.19677734375,
0.76953125,
-0.93798828125,
-0.611328125,
0.154541015625,
0.10455322265625,
-0.271240234375,
-0.38330078125,
0.301025390625,
0.2344970703125,
0.38671875,
-0.2017822265625,
0.23828125,
-0.8720703125,
0.47021484375,
-0.12408447265625,
0.4453125,
-0.54833984375,
0.08746337890625,
0.1680908203125,
-0.435546875,
-0.2291259765625,
-0.2210693359375,
0.703125,
0.26806640625,
-0.2105712890625,
0.47021484375,
0.50146484375,
-0.447998046875,
0.2509765625,
-0.4970703125,
0.09881591796875,
-0.435302734375,
0.465087890625,
1.302734375,
-0.60693359375,
-0.2071533203125,
-0.466064453125,
0.49169921875,
0.359375,
0.541015625,
0.06451416015625,
-0.2381591796875,
-0.21728515625
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Limak can repeatedly remove one of the first two characters of a string, for example abcxyx \rightarrow acxyx \rightarrow cxyx \rightarrow cyx.
You are given N different strings S_1, S_2, \ldots, S_N. Among N \cdot (N-1) / 2 pairs (S_i, S_j), in how many pairs could Limak obtain one string from the other?
Constraints
* 2 \leq N \leq 200\,000
* S_i consists of lowercase English letters `a`-`z`.
* S_i \neq S_j
* 1 \leq |S_i|
* |S_1| + |S_2| + \ldots + |S_N| \leq 10^6
Input
Input is given from Standard Input in the following format.
N
S_1
S_2
\vdots
S_N
Output
Print the number of unordered pairs (S_i, S_j) where i \neq j and Limak can obtain one string from the other.
Examples
Input
3
abcxyx
cyx
abc
Output
1
Input
6
b
a
abc
c
d
ab
Output
5
"Correct Solution:
```
class Trie():
def __init__(self,arrRev):
self.node = [ [] for _ in range(len(arrRev)) ]
# self.children = [ [ -1 for _ in range(ord('z')-ord('a'))] for _ in range(10**6+1) ]
self.children = [ {} for _ in range(10**6+1) ]
self.isHeadCharNode = [ False for _ in range( 10**6+1 ) ]
nodeNumbering = 1
for i,s in enumerate(arrRev):
currentNode = 0
for j,c in enumerate(list(s)):
self.node[i].append( currentNode )
if c not in self.children[currentNode]:
self.children[currentNode][c] = nodeNumbering
# print( currentNode, c, self.children[currentNode][c] )
nodeNumbering += 1
currentNode = self.children[currentNode][c]
self.isHeadCharNode[currentNode] = True
# print(currentNode, True)
def getAnsCount(self,arrRev):
ret = 0
for i,s in enumerate(arrRev):
prefixListOfLonger = set()
for j in range( len(s)-1, -1, -1 ):
# loop from leaf to root
c = s[j]
prefixListOfLonger.add(c)
currentNode = self.node[i][j]
for prefix in prefixListOfLonger:
if prefix in self.children[currentNode] and self.isHeadCharNode[self.children[currentNode][prefix]]:
# print(self.isHeadCharNode[self.children[currentNode][prefix]])
ret += 1
return ret
if __name__ == "__main__":
ans=""
N = int(input())
lstW=[]
for n in range(N):
lstW.append(input()[::-1])
# create Trie
trie=Trie(lstW)
ans = trie.getAnsCount(lstW) - N
print( ans )
```
| 45,165
|
[
0.35205078125,
0.156494140625,
-0.041259765625,
-0.1993408203125,
-0.626953125,
-0.3798828125,
-0.343017578125,
-0.0178375244140625,
0.59423828125,
0.8017578125,
0.66796875,
-0.5498046875,
-0.134765625,
-0.96630859375,
-0.6171875,
0.267333984375,
-0.595703125,
-0.6044921875,
-0.153564453125,
-0.1893310546875,
0.294189453125,
-0.3916015625,
-1.4248046875,
-0.33349609375,
-0.54052734375,
0.6416015625,
0.3291015625,
0.0201416015625,
1.0068359375,
1.1953125,
-0.06353759765625,
-0.6474609375,
0.47802734375,
-0.931640625,
-0.1478271484375,
-0.28076171875,
0.69384765625,
-0.82470703125,
-0.413330078125,
-0.59228515625,
0.1666259765625,
-0.583984375,
0.289794921875,
-0.69482421875,
-0.6787109375,
0.11566162109375,
-0.176513671875,
-0.56982421875,
-0.251220703125,
-0.367431640625,
0.1243896484375,
-0.29541015625,
0.85107421875,
-0.484619140625,
-0.1165771484375,
0.07147216796875,
0.261474609375,
0.09503173828125,
-0.481689453125,
0.63525390625,
0.13818359375,
0.286865234375,
-0.0038242340087890625,
-0.47021484375,
-0.425537109375,
-0.23583984375,
-0.0023956298828125,
0.28662109375,
0.2021484375,
-0.76416015625,
-0.5732421875,
-0.03118896484375,
-0.591796875,
-0.56591796875,
-0.53369140625,
0.12335205078125,
-0.0235595703125,
0.03546142578125,
-0.3095703125,
0.9091796875,
0.214111328125,
1.0615234375,
0.66162109375,
0.06097412109375,
-0.268798828125,
-0.2025146484375,
0.134765625,
0.1434326171875,
0.242919921875,
-0.19140625,
-0.337158203125,
0.445556640625,
-0.98974609375,
0.11822509765625,
0.63134765625,
0.5908203125,
-0.1375732421875,
0.2548828125,
0.3525390625,
0.02044677734375,
1.16796875,
0.72900390625,
-0.07550048828125,
0.8818359375,
-0.24951171875,
0.09393310546875,
0.2166748046875,
-0.1556396484375,
-0.11553955078125,
-0.338623046875,
-0.309814453125,
0.127197265625,
0.716796875,
0.47705078125,
-0.01226043701171875,
0.9404296875,
-0.202392578125,
0.1846923828125,
-0.53369140625,
0.1112060546875,
0.3154296875,
0.47900390625,
0.74365234375,
-0.2164306640625,
0.10980224609375,
-0.378662109375,
-0.451416015625,
0.71337890625,
-0.70751953125,
-0.07763671875,
0.1915283203125,
-0.30322265625,
-0.250732421875,
0.1103515625,
-0.1634521484375,
0.56591796875,
-0.222412109375,
0.376953125,
0.80908203125,
-0.599609375,
1.2490234375,
0.036468505859375,
-0.1004638671875,
1.4521484375,
0.06976318359375,
0.382080078125,
0.68798828125,
0.445556640625,
-0.77587890625,
0.30419921875,
-1.0634765625,
0.3994140625,
-0.1220703125,
0.11279296875,
-0.2445068359375,
-0.060791015625,
-0.29150390625,
0.2978515625,
0.0335693359375,
0.1845703125,
-0.2017822265625,
0.1719970703125,
-0.262451171875,
0.73583984375,
-0.5439453125,
0.8125,
-0.4931640625,
-0.4130859375,
0.1361083984375,
-0.486572265625,
0.58203125,
-0.4052734375,
0.14453125,
0.806640625,
0.368408203125,
0.68310546875,
0.921875,
-0.0262908935546875,
0.311279296875,
0.2880859375,
-0.256591796875,
0.28515625,
0.29541015625,
0.64306640625,
0.47802734375,
0.275634765625,
0.02398681640625,
-0.52294921875,
-0.62255859375,
-0.32666015625,
-0.132568359375,
0.67919921875,
-0.4482421875,
-0.0792236328125,
0.05865478515625,
0.03753662109375,
-1.1298828125,
0.0120391845703125,
-0.052581787109375,
-0.55712890625,
-0.205322265625,
0.449462890625,
0.043426513671875,
0.38671875,
-0.380859375,
-0.419189453125,
0.9248046875,
1.2626953125,
-0.38037109375,
0.1636962890625,
0.7119140625,
0.42626953125,
-0.68701171875,
0.361083984375,
0.07659912109375,
-0.08013916015625,
-0.67236328125,
0.58837890625,
-0.32861328125,
-0.269775390625,
0.199951171875,
0.1416015625,
0.5439453125,
0.419189453125,
-0.42529296875,
-0.050872802734375,
0.43896484375,
1.0234375,
0.381103515625,
0.73779296875,
0.0188751220703125,
0.962890625,
-0.017364501953125,
0.66552734375,
0.410400390625,
0.3349609375,
0.734375,
0.8447265625,
-0.033966064453125,
-0.016754150390625,
-0.172607421875,
0.450439453125,
0.293212890625,
0.52734375,
-0.033416748046875,
0.451416015625,
-0.34814453125,
0.302734375,
-0.41796875,
0.25146484375,
0.1705322265625,
0.62646484375,
0.360595703125,
0.6259765625,
-0.62890625,
-0.185302734375,
0.24853515625,
0.82763671875,
-1.0244140625,
-0.56689453125,
-0.236572265625,
0.00557708740234375,
0.314208984375,
-0.276123046875,
-0.00897216796875,
0.619140625,
0.8427734375,
0.29296875,
-0.38037109375,
-0.64013671875,
-1.0185546875,
-0.974609375,
-0.8291015625,
-0.56884765625,
-0.71142578125,
-0.464599609375,
0.4052734375,
-0.7666015625,
0.8896484375,
-0.145751953125,
-0.2568359375,
-0.19970703125,
-0.7646484375,
0.69921875,
0.0816650390625,
0.47412109375,
-0.321044921875,
0.275146484375,
0.259765625,
1.3798828125,
-0.58154296875,
-0.305419921875,
0.2325439453125,
-0.837890625,
-0.06146240234375,
-0.06787109375,
0.392333984375,
0.154296875,
-0.3388671875,
-0.568359375,
-0.4892578125,
0.115966796875,
-0.263916015625,
0.210693359375,
-0.378173828125,
0.80224609375,
0.61181640625,
-0.9833984375,
0.78173828125,
0.93896484375,
-0.6015625,
0.461669921875,
-0.05828857421875,
0.1943359375,
-0.806640625,
1.5244140625,
0.3662109375,
0.0972900390625,
-0.488525390625,
-0.98779296875,
-0.669921875,
-0.08770751953125,
0.078369140625,
-0.58203125,
-0.370849609375,
0.52587890625,
-0.451416015625,
-0.61669921875,
0.5673828125,
-1.2392578125,
-0.59765625,
-0.39892578125,
-0.4150390625,
0.492431640625,
0.71630859375,
0.259521484375,
-0.381591796875,
-0.408203125,
-0.0477294921875,
0.92236328125,
0.35791015625,
-0.6923828125,
0.0309906005859375,
0.39111328125,
0.4140625,
-0.1522216796875,
0.31884765625,
-0.4765625,
-0.351806640625,
0.03594970703125,
0.108154296875,
0.82861328125,
0.146728515625,
0.218994140625,
0.3212890625,
0.61669921875,
-0.73583984375,
0.1585693359375,
-0.11993408203125,
0.533203125,
0.05230712890625,
0.4306640625,
0.209228515625,
-0.238037109375,
-0.34765625,
-0.80224609375,
0.572265625,
0.416748046875,
0.56298828125,
-0.71875,
0.6533203125,
0.188232421875,
-0.69091796875,
0.697265625,
-0.55810546875,
-0.120361328125,
0.85498046875,
-0.63330078125,
0.76220703125,
-0.4912109375,
0.046722412109375,
-0.2274169921875,
0.145751953125,
0.86181640625,
0.48779296875,
0.638671875,
-0.287109375,
-0.6015625,
-0.7255859375,
-0.58349609375,
0.291015625,
-0.254638671875,
0.0975341796875,
-0.477294921875,
-0.357421875,
-0.77392578125,
0.405029296875,
0.2509765625,
0.7138671875,
0.10028076171875,
0.255859375,
0.05975341796875,
0.60302734375,
0.6572265625,
-0.423583984375,
0.342529296875,
-0.317626953125,
1.15234375,
0.1123046875,
-0.5048828125,
-0.466064453125,
-0.41064453125,
-0.2122802734375,
0.5283203125,
0.19091796875,
-0.38134765625,
-1.109375,
0.544921875,
0.045501708984375,
0.666015625,
-0.037078857421875,
-0.65478515625,
-0.3251953125,
0.56591796875,
0.327880859375,
-0.89794921875,
0.049530029296875,
-0.66162109375,
0.449951171875,
0.1466064453125,
-0.4169921875,
-0.29345703125,
-0.266845703125,
-0.32177734375,
-0.83984375,
-0.268798828125,
0.63720703125,
0.07952880859375,
-0.0765380859375,
-0.9736328125,
-0.01354217529296875,
0.2425537109375,
-0.043182373046875,
0.2371826171875,
-0.410888671875,
0.396484375,
0.1907958984375,
0.484619140625,
-0.39453125,
-0.1226806640625,
-0.242919921875,
-1.5224609375,
0.67626953125,
-0.4736328125,
0.73828125,
-0.200927734375,
-0.252197265625,
-0.2183837890625,
0.4072265625,
-0.29541015625,
0.29345703125,
-0.15185546875,
0.6630859375,
-0.83251953125,
-0.84912109375,
0.65576171875,
-0.72998046875,
-0.415771484375,
0.74658203125,
0.1983642578125,
-0.51953125,
0.330322265625,
0.478271484375,
-0.58837890625,
0.262451171875,
-0.56103515625,
1.076171875,
-0.212890625,
-0.499755859375,
0.11590576171875,
-0.379638671875,
0.3935546875,
0.1412353515625,
-0.7373046875,
-0.327392578125,
-1.0048828125,
-0.0703125,
-0.08941650390625,
-0.31982421875,
0.354736328125,
-0.07623291015625,
-0.01384735107421875,
0.0300445556640625,
-0.322998046875,
-0.66064453125,
-0.728515625,
-0.74560546875,
-0.46484375,
0.31689453125,
0.67431640625,
0.96630859375,
-0.35546875,
-0.45263671875,
-0.175048828125,
-0.021636962890625,
0.08795166015625,
-0.1881103515625,
-0.168701171875,
0.003032684326171875,
-0.42919921875,
-0.3671875,
0.477294921875,
0.2099609375,
0.2252197265625,
0.355712890625,
0.07794189453125,
0.391357421875,
0.48583984375,
-0.45947265625,
1.1376953125,
0.2430419921875,
-1.142578125,
-0.1475830078125,
0.71484375,
-0.07818603515625,
0.80126953125,
0.31396484375,
-0.5791015625,
-0.83642578125,
-0.72998046875,
0.03131103515625,
-0.6162109375,
-0.426513671875,
-0.978515625,
-0.231689453125,
-0.424560546875,
0.71533203125,
-0.424072265625,
-0.42236328125,
0.31201171875,
-1.099609375,
0.443603515625,
-0.62158203125,
-0.7724609375,
-0.73486328125,
-0.92822265625,
-0.06829833984375,
1.04296875,
0.44921875,
-0.01555633544921875,
-0.055206298828125,
-0.10595703125,
0.324951171875,
0.0809326171875,
-0.79736328125,
-0.169921875,
-0.3740234375,
0.384765625,
-0.422607421875,
-0.1212158203125,
-0.463623046875,
0.5556640625,
-0.568359375,
0.1756591796875,
-0.55517578125,
-0.31005859375,
0.15185546875,
-0.406494140625,
1.0517578125,
-0.51806640625,
0.1351318359375,
-0.55517578125,
0.39404296875,
0.513671875,
-0.140869140625,
-0.5244140625,
-0.7158203125,
-0.7548828125,
-1.1328125,
0.37353515625,
-0.3779296875,
0.0006079673767089844,
-0.74658203125,
0.2474365234375,
0.73193359375,
-0.3876953125,
0.58544921875,
1.099609375,
0.0928955078125,
0.448486328125,
-0.75146484375,
0.75830078125,
0.48193359375,
-0.52880859375,
-0.469482421875,
0.5341796875,
-0.495849609375,
0.58349609375,
-0.10784912109375,
-1.076171875,
-0.6220703125,
0.451171875,
1.2236328125,
-0.2115478515625,
0.92822265625,
-0.043792724609375,
-0.7119140625,
-0.7041015625,
0.51904296875,
0.1451416015625,
0.7578125,
0.814453125,
-0.474365234375,
-0.274169921875,
0.37646484375,
-0.08807373046875,
-0.1951904296875,
-0.7919921875,
0.8369140625,
-0.76220703125,
-0.468505859375,
0.12841796875,
0.62646484375,
-1.123046875,
-1.169921875,
-0.2171630859375,
0.13818359375,
-0.2041015625,
-1.2578125,
0.2626953125,
0.50146484375,
-0.44189453125,
-0.1435546875,
0.341796875,
-0.41162109375,
0.6220703125,
0.211181640625,
0.30126953125,
-0.58203125,
0.61328125,
0.60498046875,
-0.2705078125,
-0.7236328125,
-0.9443359375,
-0.1558837890625,
-0.33251953125,
0.278564453125,
0.53662109375,
-0.318603515625,
0.398193359375,
0.1876220703125,
0.055877685546875,
1.2451171875,
-0.317138671875,
-0.181884765625,
0.311767578125,
-0.5126953125,
-0.57763671875,
-0.2418212890625,
0.26806640625,
-0.218017578125,
0.172119140625,
-0.34375,
0.0182647705078125,
0.56005859375,
0.295654296875,
-0.47900390625,
-0.85693359375,
-0.419677734375,
-0.81640625,
-0.61865234375,
-0.58154296875,
-0.79248046875,
0.1663818359375,
-0.005062103271484375,
-0.10321044921875,
-0.6005859375,
0.126953125,
0.4580078125,
-0.6845703125,
0.97705078125,
-0.385986328125,
0.379150390625,
-0.5927734375,
-0.332763671875,
-0.7109375,
0.062103271484375,
-0.55517578125,
-0.285400390625,
-0.5107421875,
0.285888671875,
-0.1844482421875,
0.2451171875,
-0.37451171875,
0.1614990234375,
-0.2103271484375,
-0.7099609375,
-0.05108642578125,
0.07476806640625,
-0.205078125,
0.61962890625,
0.8994140625,
0.080322265625,
0.365966796875,
-0.2423095703125,
-0.330078125,
-0.2457275390625,
0.77490234375,
0.7890625,
-0.208251953125,
-0.18310546875,
-0.27880859375,
0.18017578125,
-1.0546875,
0.2314453125,
-0.3701171875,
0.464599609375,
0.285888671875,
-0.2197265625,
0.60107421875,
1.5625,
0.00006836652755737305,
0.5,
0.449951171875,
0.346435546875,
0.152587890625,
0.1575927734375,
-0.245361328125,
0.291259765625,
-0.1649169921875,
-0.07086181640625,
-0.0301666259765625,
0.336181640625,
0.140869140625,
0.294921875,
-0.399658203125,
-0.677734375,
-0.583984375,
-0.35400390625,
-0.361572265625,
0.387939453125,
0.51953125,
-0.7119140625,
0.450927734375,
0.05718994140625,
-0.6875,
-0.0156402587890625,
-0.75341796875,
-1.0947265625,
0.28076171875,
-0.261474609375,
-0.64794921875,
-0.486083984375,
-0.65087890625,
-0.363037109375,
-0.0802001953125,
0.427978515625,
-0.8759765625,
0.271728515625,
-0.3046875,
0.72021484375,
-0.018707275390625,
0.287353515625,
0.2783203125,
0.34619140625,
-0.98046875,
-0.51513671875,
-0.309814453125,
0.89697265625,
0.2978515625,
-0.1949462890625,
-0.25048828125,
0.123779296875,
0.3984375,
0.153564453125,
-0.412353515625,
0.1505126953125,
0.08062744140625,
0.461181640625,
-0.630859375,
-0.1400146484375,
-0.12469482421875,
0.42041015625,
0.298095703125,
-0.442138671875,
-0.67041015625,
0.99609375,
0.423095703125,
-0.127197265625,
0.192138671875,
0.4931640625,
0.083740234375,
-0.1846923828125,
0.0056610107421875,
-0.2607421875,
0.681640625,
0.262451171875,
0.53955078125,
-0.04052734375,
0.1431884765625,
0.54296875,
0.026092529296875,
-0.46630859375,
0.7236328125,
0.5185546875,
0.29150390625,
0.2181396484375,
-0.41064453125,
-0.470458984375,
0.1376953125,
-0.685546875,
0.15673828125,
-0.2978515625,
0.032257080078125,
-0.152099609375,
-0.44775390625,
0.76904296875,
-0.8037109375,
0.10955810546875,
0.2083740234375,
-0.58349609375,
0.5283203125,
0.68994140625,
0.308349609375,
-0.2261962890625,
0.8583984375,
0.89404296875,
0.89111328125,
0.97216796875,
0.441162109375,
0.38623046875,
-1.1484375,
0.1566162109375,
0.10186767578125,
-0.472412109375,
-0.166748046875,
-0.291015625,
-0.89306640625,
0.398193359375,
-0.323486328125,
-0.107177734375,
0.41162109375,
-0.521484375,
-0.09698486328125,
-0.08563232421875,
1.099609375,
-0.400634765625,
0.33984375,
0.16357421875,
-0.1365966796875,
-0.277587890625,
0.845703125,
-0.251708984375,
0.3974609375,
0.2099609375,
0.892578125,
0.369140625,
1.5126953125,
0.425537109375,
-0.1976318359375,
0.2076416015625,
0.50927734375,
-0.248779296875,
-0.7060546875,
-0.431884765625,
-0.158447265625,
0.019378662109375,
-0.9130859375,
-0.31591796875,
-0.3935546875,
0.66650390625,
-0.0408935546875,
-0.9267578125,
-0.11920166015625,
-0.03863525390625,
-0.9306640625,
0.3466796875,
0.37451171875,
0.268310546875,
-0.0921630859375,
-0.439453125,
-0.0616455078125,
-0.7900390625,
0.127685546875,
-0.26708984375,
0.38134765625,
-0.34423828125,
-0.11895751953125,
-0.75634765625,
-0.9833984375,
-0.27978515625,
-0.09906005859375,
-0.1666259765625,
-0.75390625,
0.373779296875,
0.806640625,
0.240234375,
0.123046875,
-0.470703125,
0.5029296875,
0.86865234375,
1.0283203125,
0.050933837890625,
0.8251953125,
0.5244140625,
-0.5908203125,
-0.1771240234375,
-0.09808349609375,
0.56640625,
0.0919189453125,
0.449462890625,
-0.5693359375,
0.53173828125,
-0.7763671875,
-1.34375,
0.344482421875,
0.4404296875,
0.4560546875,
-0.7978515625,
-1.078125,
-0.10479736328125,
-1.1005859375,
-0.145751953125,
-0.74462890625,
0.80419921875,
-0.249755859375,
0.259765625,
-0.09930419921875,
-1.1044921875,
4.43359375,
1.0537109375,
0.92919921875,
0.363037109375,
0.181884765625,
1.2294921875,
0.2783203125,
-0.3125,
-0.30029296875,
-0.60595703125,
0.4677734375,
-0.328857421875,
0.0914306640625,
0.94140625,
0.317138671875,
0.58251953125,
-0.77783203125,
0.341796875,
0.3427734375,
-0.78173828125,
-0.82666015625,
0.29150390625,
-0.2159423828125,
0.6494140625,
0.1329345703125,
0.163818359375,
0.69775390625,
-0.61474609375,
-0.03692626953125,
-0.63134765625,
-0.012969970703125,
-0.0096588134765625,
0.783203125,
-0.28173828125,
0.063232421875,
0.689453125,
0.1785888671875,
-0.306640625,
-0.05181884765625,
0.14990234375,
-0.1685791015625,
-0.210693359375,
0.5244140625,
-0.72509765625,
-0.1314697265625,
0.56982421875,
-0.55419921875,
0.2021484375,
0.322509765625,
-1.291015625,
0.67431640625,
-0.1949462890625,
0.81494140625,
-0.990234375,
-0.6376953125,
0.11822509765625,
0.2056884765625,
-0.303466796875,
-0.425537109375,
0.28564453125,
0.291748046875,
0.295654296875,
-0.1201171875,
0.397705078125,
-0.85009765625,
0.53955078125,
-0.12359619140625,
0.483642578125,
-0.50244140625,
0.11639404296875,
0.07763671875,
-0.422607421875,
-0.299072265625,
-0.2354736328125,
0.5986328125,
0.1500244140625,
-0.1044921875,
0.359375,
0.480224609375,
-0.46875,
0.177490234375,
-0.489501953125,
0.1348876953125,
-0.3583984375,
0.497314453125,
1.2421875,
-0.576171875,
-0.240478515625,
-0.45947265625,
0.5576171875,
0.427490234375,
0.6279296875,
0.058319091796875,
-0.241943359375,
-0.1944580078125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.
Sergey totally forgot about the task until half an hour before the next lesson and hastily scribbled something down. But then he recollected that in the last lesson he learned the grammar of N-ish. The spelling rules state that N-ish contains some "forbidden" pairs of letters: such letters can never occur in a sentence next to each other. Also, the order of the letters doesn't matter (for example, if the pair of letters "ab" is forbidden, then any occurrences of substrings "ab" and "ba" are also forbidden). Also, each pair has different letters and each letter occurs in no more than one forbidden pair.
Now Sergey wants to correct his sentence so that it doesn't contain any "forbidden" pairs of letters that stand next to each other. However, he is running out of time, so he decided to simply cross out some letters from the sentence. What smallest number of letters will he have to cross out? When a letter is crossed out, it is "removed" so that the letters to its left and right (if they existed), become neighboring. For example, if we cross out the first letter from the string "aba", we get the string "ba", and if we cross out the second letter, we get "aa".
Input
The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105.
The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters.
Next k lines contain descriptions of forbidden pairs of letters. Each line contains exactly two different lowercase Latin letters without separators that represent the forbidden pairs. It is guaranteed that each letter is included in no more than one pair.
Output
Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters.
Examples
Input
ababa
1
ab
Output
2
Input
codeforces
2
do
cs
Output
1
Note
In the first sample you should remove two letters b.
In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution.
Tags: greedy
Correct Solution:
```
######################################################
############Created by Devesh Kumar###################
#############devesh1102@gmail.com####################
##########For CodeForces(Devesh1102)#################
#####################2020#############################
######################################################
import sys
input = sys.stdin.readline
# import sys
import heapq
import copy
import math
import decimal
# import sys.stdout.flush as flush
# from decimal import *
#heapq.heapify(li)
#
#heapq.heappush(li,4)
#
#heapq.heappop(li)
#
# & Bitwise AND Operator 10 & 7 = 2
# | Bitwise OR Operator 10 | 7 = 15
# ^ Bitwise XOR Operator 10 ^ 7 = 13
# << Bitwise Left Shift operator 10<<2 = 40
# >> Bitwise Right Shift Operator
# '''############ ---- Input Functions ---- #######Start#####'''
def inp():
return(int(input()))
def inlt():
return(list(map(int,input().split())))
def insr():
s = input()
return(list(s[:len(s) - 1]))
def insr2():
s = input()
return((s[:len(s) - 1]))
def invr():
return(map(int,input().split()))
############ ---- Input Functions ---- #######End
# #####
def pr_list(a):
print(*a, sep=" ")
def main():
# tests = inp()
tests = 1
mod = 998244353
limit = 10**18
ans = 0
for test in range(tests):
s = insr()
n = len(s)
k = inp()
forbid = [[0 for i in range(26)] for j in range(26)]
for i in range(k):
a = insr()
forbid[ord(a[0]) - ord('a')][ord(a[1]) - ord('a')] = 1
forbid[ord(a[1]) - ord('a')][ord(a[0]) - ord('a')] = 1
dp = [sys.maxsize for i in range(26)]
dp[ord(s[0]) - ord('a')] = 0
for i in range(1,n):
# print(dp)
mini = sys.maxsize
for j in range(26):
if dp[j] != sys.maxsize and forbid[j][ord(s[i]) - ord('a')]!=1:
mini = min(mini,dp[j])
for j in range(26):
if dp[j]!= sys.maxsize:
dp[j] = dp[j] +1
dp[ord(s[i]) - ord('a')] = min(mini,i)
# print(dp)
print(min(dp))
if __name__== "__main__":
main()
```
| 45,639
|
[
0.291015625,
-0.05596923828125,
0.1292724609375,
0.284912109375,
-0.5634765625,
-0.67431640625,
0.14208984375,
-0.12200927734375,
-0.189208984375,
0.90283203125,
0.8505859375,
-0.01378631591796875,
-0.3876953125,
-0.91552734375,
-0.935546875,
-0.12841796875,
-0.91455078125,
-0.58349609375,
-0.53955078125,
-0.1390380859375,
0.0859375,
-0.15283203125,
-1.6376953125,
-0.293212890625,
-0.37158203125,
1.2021484375,
0.3583984375,
-0.2958984375,
1.162109375,
0.75048828125,
-0.26318359375,
-0.338623046875,
0.5576171875,
-1.1689453125,
-0.6259765625,
-0.51220703125,
0.9462890625,
-0.467041015625,
0.007476806640625,
-0.064208984375,
0.66064453125,
-0.251953125,
0.473388671875,
-0.5341796875,
-1.2958984375,
-0.35791015625,
-0.126953125,
-0.61376953125,
-0.3544921875,
-0.40869140625,
0.332275390625,
-0.334228515625,
0.62109375,
-0.220947265625,
0.07373046875,
0.156494140625,
0.2384033203125,
0.08428955078125,
-0.693359375,
0.411376953125,
0.134765625,
0.374755859375,
0.1448974609375,
-0.75634765625,
-0.421875,
-0.107666015625,
-0.309814453125,
0.202392578125,
-0.00026702880859375,
-0.61181640625,
-0.241455078125,
0.4931640625,
-0.3916015625,
-0.330078125,
-0.673828125,
0.0330810546875,
0.2467041015625,
0.093994140625,
-0.56689453125,
0.8388671875,
0.36865234375,
1.013671875,
0.77001953125,
-0.10443115234375,
-0.35009765625,
-0.129150390625,
0.00772857666015625,
0.378662109375,
0.423828125,
-0.2183837890625,
-0.1893310546875,
0.541015625,
-1.03515625,
-0.166748046875,
0.5908203125,
0.40576171875,
-0.28515625,
0.283447265625,
0.45751953125,
0.44873046875,
0.89892578125,
0.58349609375,
-0.34912109375,
0.82958984375,
-0.5546875,
0.16162109375,
0.0953369140625,
0.1873779296875,
-0.05413818359375,
0.25927734375,
-0.31201171875,
-0.08892822265625,
0.486083984375,
0.458984375,
-0.6806640625,
0.76953125,
-0.276123046875,
0.3896484375,
-0.8388671875,
0.281494140625,
0.7314453125,
-0.06927490234375,
0.84912109375,
0.044891357421875,
0.1920166015625,
-0.2216796875,
-0.6083984375,
1.0673828125,
-0.433837890625,
-0.021942138671875,
0.49365234375,
0.0227508544921875,
-0.06689453125,
0.2044677734375,
-0.32080078125,
0.8076171875,
-0.287353515625,
0.6162109375,
0.55419921875,
-0.6220703125,
0.492431640625,
-0.2286376953125,
-0.053070068359375,
1.4287109375,
0.708984375,
-0.06097412109375,
0.78515625,
0.42822265625,
-0.92724609375,
0.1619873046875,
-1.3056640625,
0.8525390625,
0.14013671875,
0.117919921875,
-0.53369140625,
-0.1455078125,
-0.2314453125,
0.157958984375,
0.06756591796875,
0.2060546875,
-0.46826171875,
0.1510009765625,
-0.310302734375,
0.62744140625,
-0.2587890625,
1.0556640625,
-0.6728515625,
0.01007080078125,
-0.142333984375,
-0.5966796875,
0.19921875,
-0.040008544921875,
0.11669921875,
1.0732421875,
0.1568603515625,
0.8330078125,
0.56884765625,
-0.344482421875,
0.64306640625,
0.4794921875,
-0.10455322265625,
0.48046875,
0.1812744140625,
0.324462890625,
0.521484375,
0.298583984375,
-0.15625,
-0.415283203125,
-0.84716796875,
-0.375,
-0.0113525390625,
0.65673828125,
-0.37353515625,
0.341064453125,
0.047698974609375,
-0.0391845703125,
-1.0478515625,
-0.32666015625,
0.18408203125,
-1.0986328125,
-0.5546875,
0.90283203125,
0.14599609375,
0.74658203125,
-0.202392578125,
-0.626953125,
0.64892578125,
1.4775390625,
-0.3173828125,
0.278564453125,
0.6513671875,
-0.58935546875,
-0.345947265625,
0.45751953125,
-0.1702880859375,
-0.179931640625,
-0.85400390625,
0.72412109375,
-0.53466796875,
-0.0231475830078125,
-0.2080078125,
0.266357421875,
0.2763671875,
0.66015625,
-0.1806640625,
-0.3349609375,
0.84765625,
1.12890625,
0.0369873046875,
0.50390625,
0.197998046875,
0.7021484375,
0.1204833984375,
0.71240234375,
0.412841796875,
0.1494140625,
0.8486328125,
0.916015625,
0.2119140625,
0.52880859375,
-0.2252197265625,
0.44091796875,
0.1973876953125,
0.580078125,
0.440673828125,
0.29052734375,
-0.316162109375,
-0.038177490234375,
-0.3876953125,
0.09185791015625,
-0.252197265625,
0.32080078125,
0.431884765625,
0.432373046875,
-0.29443359375,
-0.13916015625,
0.2066650390625,
0.685546875,
-1.171875,
-0.45703125,
0.045135498046875,
0.1319580078125,
-0.0281219482421875,
0.00022304058074951172,
0.2379150390625,
0.77880859375,
0.70263671875,
0.328857421875,
-0.52783203125,
-0.52783203125,
-1.1328125,
-1.0107421875,
-0.86376953125,
-0.332275390625,
-0.82568359375,
-0.11688232421875,
0.634765625,
-1.0869140625,
0.482177734375,
-0.2861328125,
-0.5302734375,
0.1619873046875,
-0.578125,
0.6025390625,
-0.2027587890625,
0.80029296875,
-0.755859375,
0.73291015625,
0.034820556640625,
0.90234375,
-0.287841796875,
-0.3671875,
-0.047760009765625,
-0.61767578125,
0.251953125,
-0.0189208984375,
0.3017578125,
0.1771240234375,
-0.6533203125,
-0.7646484375,
0.032501220703125,
-0.308349609375,
-0.57861328125,
0.215087890625,
-0.7529296875,
0.7294921875,
0.93994140625,
-0.66845703125,
0.77392578125,
1.1220703125,
-0.94921875,
0.0287628173828125,
0.1856689453125,
0.2998046875,
-0.615234375,
1.189453125,
0.29052734375,
0.3974609375,
-0.5205078125,
-0.51220703125,
-0.755859375,
0.0966796875,
-0.03570556640625,
-0.354736328125,
-0.09564208984375,
0.75634765625,
-0.267333984375,
-0.994140625,
0.75341796875,
-1.1796875,
-0.10711669921875,
-0.1295166015625,
-0.489501953125,
0.95068359375,
0.342529296875,
0.354736328125,
-0.288330078125,
-0.818359375,
-0.25146484375,
0.82421875,
0.1776123046875,
-0.521484375,
-0.0372314453125,
0.2440185546875,
0.1773681640625,
0.150634765625,
0.12078857421875,
-0.232421875,
-0.3251953125,
0.070068359375,
0.221923828125,
0.92333984375,
0.2998046875,
0.3857421875,
0.365234375,
0.8486328125,
-0.6884765625,
-0.252685546875,
-0.270263671875,
0.720703125,
0.21337890625,
0.39697265625,
0.1611328125,
-0.24755859375,
-0.330078125,
-0.80615234375,
0.483642578125,
-0.295166015625,
0.763671875,
-0.5322265625,
0.6181640625,
0.383056640625,
-0.5263671875,
0.65966796875,
-0.89599609375,
-0.358154296875,
0.90283203125,
-0.6650390625,
0.95068359375,
-0.8916015625,
0.194580078125,
0.06884765625,
0.1278076171875,
0.701171875,
0.642578125,
0.7373046875,
-0.453125,
-0.60302734375,
-0.2890625,
0.278076171875,
-0.06378173828125,
-0.525390625,
0.144775390625,
-0.2440185546875,
-0.41455078125,
-0.89111328125,
0.41357421875,
0.86083984375,
0.57275390625,
0.3359375,
0.4248046875,
0.1689453125,
0.58740234375,
0.9111328125,
-0.0947265625,
-0.002368927001953125,
-0.7587890625,
1.0380859375,
-0.0124053955078125,
-0.480224609375,
-0.34765625,
-0.33544921875,
-0.312255859375,
0.323974609375,
0.018951416015625,
0.04071044921875,
-0.89208984375,
-0.170654296875,
-0.13720703125,
0.361572265625,
-0.73583984375,
-0.3095703125,
-0.189697265625,
0.425048828125,
0.08111572265625,
-1.017578125,
0.390380859375,
-0.6630859375,
0.927734375,
0.99169921875,
0.0635986328125,
-0.51708984375,
-0.149658203125,
-0.53955078125,
-0.86767578125,
-0.1142578125,
0.58154296875,
-0.12353515625,
0.2261962890625,
-1.2578125,
0.57958984375,
0.3349609375,
-0.088134765625,
0.28466796875,
0.193359375,
0.472900390625,
0.142578125,
0.5234375,
-0.6318359375,
-0.66357421875,
0.419189453125,
-1.1201171875,
0.763671875,
-0.611328125,
0.483154296875,
-0.154541015625,
0.1396484375,
0.1552734375,
0.4560546875,
-0.4775390625,
0.41357421875,
-0.0810546875,
0.3984375,
-1.01171875,
-0.65966796875,
0.51806640625,
-0.1829833984375,
-0.724609375,
0.546875,
0.25244140625,
-0.236083984375,
0.013427734375,
0.5927734375,
-0.466064453125,
0.4443359375,
-0.54736328125,
0.62451171875,
-0.116943359375,
-0.77294921875,
-0.2432861328125,
-0.470458984375,
0.68212890625,
-0.186279296875,
-0.7587890625,
0.220703125,
-1.15625,
-0.250732421875,
0.09710693359375,
-0.49755859375,
0.349365234375,
0.1513671875,
0.1280517578125,
0.09881591796875,
-0.49609375,
-0.36279296875,
-0.1741943359375,
-0.53564453125,
-0.51806640625,
0.337646484375,
0.58984375,
0.6943359375,
0.290283203125,
-0.10791015625,
0.1749267578125,
0.015655517578125,
-0.12200927734375,
-0.58447265625,
-0.354736328125,
0.213134765625,
-0.51220703125,
-0.1392822265625,
0.36181640625,
-0.0020809173583984375,
0.39697265625,
0.8720703125,
-0.055877685546875,
0.2276611328125,
0.348388671875,
-0.5146484375,
1.384765625,
-0.188720703125,
-1.0166015625,
-0.38427734375,
0.2420654296875,
0.060333251953125,
0.607421875,
-0.1727294921875,
-0.7978515625,
-0.6845703125,
-1.1015625,
0.08795166015625,
-0.5263671875,
-0.26171875,
-0.94287109375,
-0.1905517578125,
-0.51123046875,
0.7978515625,
-0.37744140625,
-0.2802734375,
0.340576171875,
-1.2001953125,
0.04998779296875,
-0.59619140625,
-0.41845703125,
-0.56201171875,
-0.5673828125,
-0.623046875,
1.09765625,
0.416015625,
0.1422119140625,
0.421142578125,
-0.34521484375,
0.24853515625,
-0.36669921875,
-0.609375,
-0.495849609375,
-0.280517578125,
0.376953125,
-0.355224609375,
-0.42138671875,
-0.625,
0.8857421875,
-0.54052734375,
0.206787109375,
-0.443603515625,
-0.5341796875,
-0.199462890625,
-0.240478515625,
0.7998046875,
-0.65283203125,
0.1392822265625,
-0.50439453125,
0.68212890625,
0.3701171875,
-0.302001953125,
-0.5234375,
-0.83447265625,
-0.6005859375,
-0.8583984375,
0.65087890625,
-0.552734375,
0.58935546875,
-0.69189453125,
-0.2587890625,
0.900390625,
-0.5205078125,
0.317138671875,
1.3330078125,
-0.2313232421875,
0.213623046875,
-0.84814453125,
0.677734375,
-0.0223541259765625,
-0.64453125,
-0.27685546875,
-0.07952880859375,
-0.9150390625,
0.0960693359375,
-0.63427734375,
-0.896484375,
-0.57373046875,
0.71044921875,
1.466796875,
-0.300537109375,
0.95556640625,
0.2305908203125,
-1.17578125,
-0.7919921875,
0.78857421875,
0.381591796875,
0.56640625,
1.1259765625,
-0.82177734375,
-0.1278076171875,
0.40673828125,
-0.07183837890625,
-0.26416015625,
-0.208984375,
1.056640625,
-0.491455078125,
-0.60302734375,
0.52783203125,
0.57568359375,
-1.111328125,
-0.5341796875,
0.07781982421875,
-0.00972747802734375,
-0.1356201171875,
-0.61669921875,
0.09686279296875,
0.63818359375,
-0.479736328125,
-0.10040283203125,
0.0250244140625,
0.04345703125,
0.634765625,
0.300048828125,
0.30419921875,
-0.51904296875,
0.64306640625,
0.80029296875,
-0.783203125,
-0.37890625,
-0.82958984375,
-0.18505859375,
-0.2322998046875,
0.37353515625,
0.81640625,
0.0882568359375,
0.2191162109375,
0.72021484375,
-0.08892822265625,
0.7138671875,
-0.38818359375,
-0.363037109375,
0.25048828125,
-0.492431640625,
-0.25927734375,
-0.01491546630859375,
0.183349609375,
0.1009521484375,
0.2156982421875,
-0.7021484375,
-0.06610107421875,
0.349853515625,
0.334716796875,
-0.08917236328125,
-0.045318603515625,
-0.325927734375,
-0.58935546875,
-0.413330078125,
-0.5380859375,
-0.765625,
-0.12188720703125,
0.429443359375,
0.367919921875,
-0.73876953125,
0.04022216796875,
0.8408203125,
-0.77880859375,
1.2099609375,
-0.7490234375,
0.325927734375,
-0.43994140625,
-0.09228515625,
-0.78466796875,
0.1318359375,
-0.41796875,
-0.27880859375,
-0.403564453125,
0.5419921875,
0.3779296875,
0.52734375,
-0.1343994140625,
0.1981201171875,
-0.173828125,
-0.81103515625,
-0.06646728515625,
0.049224853515625,
0.0947265625,
0.33251953125,
0.72021484375,
0.52099609375,
0.283203125,
-0.050048828125,
-0.61083984375,
-0.48095703125,
0.12432861328125,
0.94384765625,
0.0238494873046875,
-0.05615234375,
-0.412109375,
0.00319671630859375,
-0.6279296875,
0.261962890625,
-0.2861328125,
-0.09136962890625,
0.09783935546875,
-0.74853515625,
0.505859375,
1.26953125,
-0.09161376953125,
0.177978515625,
-0.0291900634765625,
0.2939453125,
0.386962890625,
0.1669921875,
0.341552734375,
0.1629638671875,
0.1240234375,
-0.2159423828125,
-0.158935546875,
0.6015625,
-0.01273345947265625,
0.4287109375,
-0.2010498046875,
-0.76806640625,
-0.7490234375,
-0.100341796875,
-0.27294921875,
0.042572021484375,
0.59619140625,
-0.8369140625,
-0.06622314453125,
0.087890625,
-0.95166015625,
0.1787109375,
-0.7529296875,
-0.84619140625,
0.0838623046875,
-0.133056640625,
-0.7958984375,
-0.493896484375,
-0.58740234375,
0.037139892578125,
0.1595458984375,
0.5478515625,
-0.7412109375,
0.295654296875,
-0.172119140625,
0.44287109375,
-0.215087890625,
-0.1334228515625,
0.1318359375,
0.291748046875,
-0.470703125,
-0.6533203125,
0.0771484375,
1.4853515625,
0.17919921875,
-0.34912109375,
-0.63037109375,
0.10302734375,
-0.42919921875,
0.3271484375,
-0.2034912109375,
-0.18896484375,
0.01824951171875,
0.435791015625,
-1.181640625,
-0.354248046875,
0.084716796875,
0.286376953125,
-0.021026611328125,
-0.3447265625,
-0.2130126953125,
0.68994140625,
0.982421875,
-0.1396484375,
-0.058502197265625,
0.408935546875,
0.79150390625,
-0.26220703125,
-0.127197265625,
-0.251708984375,
0.30224609375,
0.53076171875,
0.27490234375,
-0.2354736328125,
0.69873046875,
0.93798828125,
-0.33203125,
-0.2208251953125,
0.5380859375,
0.03131103515625,
-0.0085906982421875,
-0.241943359375,
-0.2291259765625,
0.040191650390625,
-0.06988525390625,
-0.84619140625,
0.172607421875,
-0.378662109375,
-0.333251953125,
-0.176513671875,
-0.70849609375,
0.98046875,
-1.1953125,
0.4619140625,
-0.26220703125,
-0.12158203125,
0.399169921875,
0.98046875,
0.05169677734375,
-0.056793212890625,
0.50390625,
0.341552734375,
0.58349609375,
0.8076171875,
0.208984375,
0.154541015625,
-0.3916015625,
0.146484375,
-0.0693359375,
0.006015777587890625,
-0.6806640625,
-0.28125,
-1.1416015625,
0.6298828125,
-0.399169921875,
-0.09930419921875,
0.433837890625,
-0.5341796875,
0.1962890625,
-0.284912109375,
0.7646484375,
-0.38037109375,
0.434814453125,
0.5458984375,
-0.57177734375,
-0.447509765625,
0.84423828125,
-0.1993408203125,
0.38232421875,
0.1937255859375,
0.73828125,
0.34814453125,
1.716796875,
0.32080078125,
-0.2578125,
-0.147705078125,
0.057220458984375,
-0.234375,
-0.60400390625,
-0.38916015625,
-0.37158203125,
-0.119140625,
-0.398193359375,
-0.22998046875,
0.0257110595703125,
0.6533203125,
0.0811767578125,
-0.80615234375,
-0.042236328125,
0.08184814453125,
-0.84521484375,
0.7734375,
0.261474609375,
0.02947998046875,
0.07269287109375,
0.08599853515625,
-0.14208984375,
-0.35009765625,
-0.185791015625,
-0.5927734375,
0.2236328125,
-0.5849609375,
-0.5380859375,
-0.609375,
-1.0380859375,
-0.375732421875,
-0.33203125,
-0.476318359375,
-1.0390625,
0.1490478515625,
0.65185546875,
0.40625,
0.5107421875,
-0.51611328125,
0.397705078125,
1.123046875,
0.71630859375,
-0.351806640625,
0.80810546875,
0.36474609375,
-0.525390625,
0.08441162109375,
-0.0052032470703125,
0.6953125,
-0.33837890625,
-0.0105133056640625,
-0.297607421875,
0.5234375,
-0.9794921875,
-1.3837890625,
0.06396484375,
0.6513671875,
0.50341796875,
-0.54345703125,
-0.9306640625,
-0.401123046875,
-0.74755859375,
-0.046600341796875,
-0.78271484375,
0.6123046875,
0.388671875,
-0.09393310546875,
0.0287017822265625,
-1.0283203125,
4.31640625,
1.0087890625,
0.94677734375,
0.07049560546875,
-0.028228759765625,
0.970703125,
-0.0012559890747070312,
-0.31884765625,
0.1610107421875,
-0.3154296875,
0.7646484375,
-0.215576171875,
-0.088134765625,
0.65087890625,
0.1949462890625,
0.453125,
-0.48486328125,
-0.0171356201171875,
-0.247314453125,
-0.990234375,
-0.7939453125,
0.0758056640625,
0.2432861328125,
0.165283203125,
0.08551025390625,
0.093017578125,
0.57080078125,
-0.626953125,
-0.29052734375,
-0.63525390625,
-0.28369140625,
-0.7109375,
0.666015625,
-0.0755615234375,
-0.1834716796875,
0.50732421875,
0.1470947265625,
-0.62744140625,
0.057891845703125,
0.55517578125,
-0.30810546875,
-0.44873046875,
0.86669921875,
-0.8212890625,
0.197998046875,
0.5556640625,
-0.294677734375,
0.279541015625,
0.62841796875,
-0.421142578125,
0.78076171875,
-0.2249755859375,
0.73193359375,
-0.73681640625,
-0.671875,
0.04107666015625,
0.2283935546875,
-0.33349609375,
0.03997802734375,
0.3427734375,
0.2381591796875,
0.1112060546875,
0.050140380859375,
0.38818359375,
-0.68896484375,
0.68212890625,
0.2008056640625,
0.19287109375,
-0.5341796875,
0.09197998046875,
0.018310546875,
-0.137939453125,
-0.4248046875,
-0.50244140625,
0.57275390625,
0.2161865234375,
-0.0219268798828125,
0.30810546875,
0.471435546875,
-0.78955078125,
0.0018644332885742188,
0.0350341796875,
-0.3779296875,
-0.31396484375,
0.5810546875,
1.5830078125,
-0.75439453125,
-0.423828125,
-0.53466796875,
0.6142578125,
0.183349609375,
0.2802734375,
0.60400390625,
-0.91357421875,
-0.25048828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.
Sergey totally forgot about the task until half an hour before the next lesson and hastily scribbled something down. But then he recollected that in the last lesson he learned the grammar of N-ish. The spelling rules state that N-ish contains some "forbidden" pairs of letters: such letters can never occur in a sentence next to each other. Also, the order of the letters doesn't matter (for example, if the pair of letters "ab" is forbidden, then any occurrences of substrings "ab" and "ba" are also forbidden). Also, each pair has different letters and each letter occurs in no more than one forbidden pair.
Now Sergey wants to correct his sentence so that it doesn't contain any "forbidden" pairs of letters that stand next to each other. However, he is running out of time, so he decided to simply cross out some letters from the sentence. What smallest number of letters will he have to cross out? When a letter is crossed out, it is "removed" so that the letters to its left and right (if they existed), become neighboring. For example, if we cross out the first letter from the string "aba", we get the string "ba", and if we cross out the second letter, we get "aa".
Input
The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105.
The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters.
Next k lines contain descriptions of forbidden pairs of letters. Each line contains exactly two different lowercase Latin letters without separators that represent the forbidden pairs. It is guaranteed that each letter is included in no more than one pair.
Output
Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters.
Examples
Input
ababa
1
ab
Output
2
Input
codeforces
2
do
cs
Output
1
Note
In the first sample you should remove two letters b.
In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution.
Tags: greedy
Correct Solution:
```
s = input() + "#"
k = int(input())
arr = [input() for _ in range(k)]
res = 0
for t in arr:
a, b = 0, 0
for i in range(len(s)):
if s[i] == t[0]:
a += 1
elif s[i] == t[1]:
b += 1
else:
if a and b:
res += min(a, b)
a, b = 0, 0
print(res)
```
| 45,640
|
[
0.291015625,
-0.05596923828125,
0.1292724609375,
0.284912109375,
-0.5634765625,
-0.67431640625,
0.14208984375,
-0.12200927734375,
-0.189208984375,
0.90283203125,
0.8505859375,
-0.01378631591796875,
-0.3876953125,
-0.91552734375,
-0.935546875,
-0.12841796875,
-0.91455078125,
-0.58349609375,
-0.53955078125,
-0.1390380859375,
0.0859375,
-0.15283203125,
-1.6376953125,
-0.293212890625,
-0.37158203125,
1.2021484375,
0.3583984375,
-0.2958984375,
1.162109375,
0.75048828125,
-0.26318359375,
-0.338623046875,
0.5576171875,
-1.1689453125,
-0.6259765625,
-0.51220703125,
0.9462890625,
-0.467041015625,
0.007476806640625,
-0.064208984375,
0.66064453125,
-0.251953125,
0.473388671875,
-0.5341796875,
-1.2958984375,
-0.35791015625,
-0.126953125,
-0.61376953125,
-0.3544921875,
-0.40869140625,
0.332275390625,
-0.334228515625,
0.62109375,
-0.220947265625,
0.07373046875,
0.156494140625,
0.2384033203125,
0.08428955078125,
-0.693359375,
0.411376953125,
0.134765625,
0.374755859375,
0.1448974609375,
-0.75634765625,
-0.421875,
-0.107666015625,
-0.309814453125,
0.202392578125,
-0.00026702880859375,
-0.61181640625,
-0.241455078125,
0.4931640625,
-0.3916015625,
-0.330078125,
-0.673828125,
0.0330810546875,
0.2467041015625,
0.093994140625,
-0.56689453125,
0.8388671875,
0.36865234375,
1.013671875,
0.77001953125,
-0.10443115234375,
-0.35009765625,
-0.129150390625,
0.00772857666015625,
0.378662109375,
0.423828125,
-0.2183837890625,
-0.1893310546875,
0.541015625,
-1.03515625,
-0.166748046875,
0.5908203125,
0.40576171875,
-0.28515625,
0.283447265625,
0.45751953125,
0.44873046875,
0.89892578125,
0.58349609375,
-0.34912109375,
0.82958984375,
-0.5546875,
0.16162109375,
0.0953369140625,
0.1873779296875,
-0.05413818359375,
0.25927734375,
-0.31201171875,
-0.08892822265625,
0.486083984375,
0.458984375,
-0.6806640625,
0.76953125,
-0.276123046875,
0.3896484375,
-0.8388671875,
0.281494140625,
0.7314453125,
-0.06927490234375,
0.84912109375,
0.044891357421875,
0.1920166015625,
-0.2216796875,
-0.6083984375,
1.0673828125,
-0.433837890625,
-0.021942138671875,
0.49365234375,
0.0227508544921875,
-0.06689453125,
0.2044677734375,
-0.32080078125,
0.8076171875,
-0.287353515625,
0.6162109375,
0.55419921875,
-0.6220703125,
0.492431640625,
-0.2286376953125,
-0.053070068359375,
1.4287109375,
0.708984375,
-0.06097412109375,
0.78515625,
0.42822265625,
-0.92724609375,
0.1619873046875,
-1.3056640625,
0.8525390625,
0.14013671875,
0.117919921875,
-0.53369140625,
-0.1455078125,
-0.2314453125,
0.157958984375,
0.06756591796875,
0.2060546875,
-0.46826171875,
0.1510009765625,
-0.310302734375,
0.62744140625,
-0.2587890625,
1.0556640625,
-0.6728515625,
0.01007080078125,
-0.142333984375,
-0.5966796875,
0.19921875,
-0.040008544921875,
0.11669921875,
1.0732421875,
0.1568603515625,
0.8330078125,
0.56884765625,
-0.344482421875,
0.64306640625,
0.4794921875,
-0.10455322265625,
0.48046875,
0.1812744140625,
0.324462890625,
0.521484375,
0.298583984375,
-0.15625,
-0.415283203125,
-0.84716796875,
-0.375,
-0.0113525390625,
0.65673828125,
-0.37353515625,
0.341064453125,
0.047698974609375,
-0.0391845703125,
-1.0478515625,
-0.32666015625,
0.18408203125,
-1.0986328125,
-0.5546875,
0.90283203125,
0.14599609375,
0.74658203125,
-0.202392578125,
-0.626953125,
0.64892578125,
1.4775390625,
-0.3173828125,
0.278564453125,
0.6513671875,
-0.58935546875,
-0.345947265625,
0.45751953125,
-0.1702880859375,
-0.179931640625,
-0.85400390625,
0.72412109375,
-0.53466796875,
-0.0231475830078125,
-0.2080078125,
0.266357421875,
0.2763671875,
0.66015625,
-0.1806640625,
-0.3349609375,
0.84765625,
1.12890625,
0.0369873046875,
0.50390625,
0.197998046875,
0.7021484375,
0.1204833984375,
0.71240234375,
0.412841796875,
0.1494140625,
0.8486328125,
0.916015625,
0.2119140625,
0.52880859375,
-0.2252197265625,
0.44091796875,
0.1973876953125,
0.580078125,
0.440673828125,
0.29052734375,
-0.316162109375,
-0.038177490234375,
-0.3876953125,
0.09185791015625,
-0.252197265625,
0.32080078125,
0.431884765625,
0.432373046875,
-0.29443359375,
-0.13916015625,
0.2066650390625,
0.685546875,
-1.171875,
-0.45703125,
0.045135498046875,
0.1319580078125,
-0.0281219482421875,
0.00022304058074951172,
0.2379150390625,
0.77880859375,
0.70263671875,
0.328857421875,
-0.52783203125,
-0.52783203125,
-1.1328125,
-1.0107421875,
-0.86376953125,
-0.332275390625,
-0.82568359375,
-0.11688232421875,
0.634765625,
-1.0869140625,
0.482177734375,
-0.2861328125,
-0.5302734375,
0.1619873046875,
-0.578125,
0.6025390625,
-0.2027587890625,
0.80029296875,
-0.755859375,
0.73291015625,
0.034820556640625,
0.90234375,
-0.287841796875,
-0.3671875,
-0.047760009765625,
-0.61767578125,
0.251953125,
-0.0189208984375,
0.3017578125,
0.1771240234375,
-0.6533203125,
-0.7646484375,
0.032501220703125,
-0.308349609375,
-0.57861328125,
0.215087890625,
-0.7529296875,
0.7294921875,
0.93994140625,
-0.66845703125,
0.77392578125,
1.1220703125,
-0.94921875,
0.0287628173828125,
0.1856689453125,
0.2998046875,
-0.615234375,
1.189453125,
0.29052734375,
0.3974609375,
-0.5205078125,
-0.51220703125,
-0.755859375,
0.0966796875,
-0.03570556640625,
-0.354736328125,
-0.09564208984375,
0.75634765625,
-0.267333984375,
-0.994140625,
0.75341796875,
-1.1796875,
-0.10711669921875,
-0.1295166015625,
-0.489501953125,
0.95068359375,
0.342529296875,
0.354736328125,
-0.288330078125,
-0.818359375,
-0.25146484375,
0.82421875,
0.1776123046875,
-0.521484375,
-0.0372314453125,
0.2440185546875,
0.1773681640625,
0.150634765625,
0.12078857421875,
-0.232421875,
-0.3251953125,
0.070068359375,
0.221923828125,
0.92333984375,
0.2998046875,
0.3857421875,
0.365234375,
0.8486328125,
-0.6884765625,
-0.252685546875,
-0.270263671875,
0.720703125,
0.21337890625,
0.39697265625,
0.1611328125,
-0.24755859375,
-0.330078125,
-0.80615234375,
0.483642578125,
-0.295166015625,
0.763671875,
-0.5322265625,
0.6181640625,
0.383056640625,
-0.5263671875,
0.65966796875,
-0.89599609375,
-0.358154296875,
0.90283203125,
-0.6650390625,
0.95068359375,
-0.8916015625,
0.194580078125,
0.06884765625,
0.1278076171875,
0.701171875,
0.642578125,
0.7373046875,
-0.453125,
-0.60302734375,
-0.2890625,
0.278076171875,
-0.06378173828125,
-0.525390625,
0.144775390625,
-0.2440185546875,
-0.41455078125,
-0.89111328125,
0.41357421875,
0.86083984375,
0.57275390625,
0.3359375,
0.4248046875,
0.1689453125,
0.58740234375,
0.9111328125,
-0.0947265625,
-0.002368927001953125,
-0.7587890625,
1.0380859375,
-0.0124053955078125,
-0.480224609375,
-0.34765625,
-0.33544921875,
-0.312255859375,
0.323974609375,
0.018951416015625,
0.04071044921875,
-0.89208984375,
-0.170654296875,
-0.13720703125,
0.361572265625,
-0.73583984375,
-0.3095703125,
-0.189697265625,
0.425048828125,
0.08111572265625,
-1.017578125,
0.390380859375,
-0.6630859375,
0.927734375,
0.99169921875,
0.0635986328125,
-0.51708984375,
-0.149658203125,
-0.53955078125,
-0.86767578125,
-0.1142578125,
0.58154296875,
-0.12353515625,
0.2261962890625,
-1.2578125,
0.57958984375,
0.3349609375,
-0.088134765625,
0.28466796875,
0.193359375,
0.472900390625,
0.142578125,
0.5234375,
-0.6318359375,
-0.66357421875,
0.419189453125,
-1.1201171875,
0.763671875,
-0.611328125,
0.483154296875,
-0.154541015625,
0.1396484375,
0.1552734375,
0.4560546875,
-0.4775390625,
0.41357421875,
-0.0810546875,
0.3984375,
-1.01171875,
-0.65966796875,
0.51806640625,
-0.1829833984375,
-0.724609375,
0.546875,
0.25244140625,
-0.236083984375,
0.013427734375,
0.5927734375,
-0.466064453125,
0.4443359375,
-0.54736328125,
0.62451171875,
-0.116943359375,
-0.77294921875,
-0.2432861328125,
-0.470458984375,
0.68212890625,
-0.186279296875,
-0.7587890625,
0.220703125,
-1.15625,
-0.250732421875,
0.09710693359375,
-0.49755859375,
0.349365234375,
0.1513671875,
0.1280517578125,
0.09881591796875,
-0.49609375,
-0.36279296875,
-0.1741943359375,
-0.53564453125,
-0.51806640625,
0.337646484375,
0.58984375,
0.6943359375,
0.290283203125,
-0.10791015625,
0.1749267578125,
0.015655517578125,
-0.12200927734375,
-0.58447265625,
-0.354736328125,
0.213134765625,
-0.51220703125,
-0.1392822265625,
0.36181640625,
-0.0020809173583984375,
0.39697265625,
0.8720703125,
-0.055877685546875,
0.2276611328125,
0.348388671875,
-0.5146484375,
1.384765625,
-0.188720703125,
-1.0166015625,
-0.38427734375,
0.2420654296875,
0.060333251953125,
0.607421875,
-0.1727294921875,
-0.7978515625,
-0.6845703125,
-1.1015625,
0.08795166015625,
-0.5263671875,
-0.26171875,
-0.94287109375,
-0.1905517578125,
-0.51123046875,
0.7978515625,
-0.37744140625,
-0.2802734375,
0.340576171875,
-1.2001953125,
0.04998779296875,
-0.59619140625,
-0.41845703125,
-0.56201171875,
-0.5673828125,
-0.623046875,
1.09765625,
0.416015625,
0.1422119140625,
0.421142578125,
-0.34521484375,
0.24853515625,
-0.36669921875,
-0.609375,
-0.495849609375,
-0.280517578125,
0.376953125,
-0.355224609375,
-0.42138671875,
-0.625,
0.8857421875,
-0.54052734375,
0.206787109375,
-0.443603515625,
-0.5341796875,
-0.199462890625,
-0.240478515625,
0.7998046875,
-0.65283203125,
0.1392822265625,
-0.50439453125,
0.68212890625,
0.3701171875,
-0.302001953125,
-0.5234375,
-0.83447265625,
-0.6005859375,
-0.8583984375,
0.65087890625,
-0.552734375,
0.58935546875,
-0.69189453125,
-0.2587890625,
0.900390625,
-0.5205078125,
0.317138671875,
1.3330078125,
-0.2313232421875,
0.213623046875,
-0.84814453125,
0.677734375,
-0.0223541259765625,
-0.64453125,
-0.27685546875,
-0.07952880859375,
-0.9150390625,
0.0960693359375,
-0.63427734375,
-0.896484375,
-0.57373046875,
0.71044921875,
1.466796875,
-0.300537109375,
0.95556640625,
0.2305908203125,
-1.17578125,
-0.7919921875,
0.78857421875,
0.381591796875,
0.56640625,
1.1259765625,
-0.82177734375,
-0.1278076171875,
0.40673828125,
-0.07183837890625,
-0.26416015625,
-0.208984375,
1.056640625,
-0.491455078125,
-0.60302734375,
0.52783203125,
0.57568359375,
-1.111328125,
-0.5341796875,
0.07781982421875,
-0.00972747802734375,
-0.1356201171875,
-0.61669921875,
0.09686279296875,
0.63818359375,
-0.479736328125,
-0.10040283203125,
0.0250244140625,
0.04345703125,
0.634765625,
0.300048828125,
0.30419921875,
-0.51904296875,
0.64306640625,
0.80029296875,
-0.783203125,
-0.37890625,
-0.82958984375,
-0.18505859375,
-0.2322998046875,
0.37353515625,
0.81640625,
0.0882568359375,
0.2191162109375,
0.72021484375,
-0.08892822265625,
0.7138671875,
-0.38818359375,
-0.363037109375,
0.25048828125,
-0.492431640625,
-0.25927734375,
-0.01491546630859375,
0.183349609375,
0.1009521484375,
0.2156982421875,
-0.7021484375,
-0.06610107421875,
0.349853515625,
0.334716796875,
-0.08917236328125,
-0.045318603515625,
-0.325927734375,
-0.58935546875,
-0.413330078125,
-0.5380859375,
-0.765625,
-0.12188720703125,
0.429443359375,
0.367919921875,
-0.73876953125,
0.04022216796875,
0.8408203125,
-0.77880859375,
1.2099609375,
-0.7490234375,
0.325927734375,
-0.43994140625,
-0.09228515625,
-0.78466796875,
0.1318359375,
-0.41796875,
-0.27880859375,
-0.403564453125,
0.5419921875,
0.3779296875,
0.52734375,
-0.1343994140625,
0.1981201171875,
-0.173828125,
-0.81103515625,
-0.06646728515625,
0.049224853515625,
0.0947265625,
0.33251953125,
0.72021484375,
0.52099609375,
0.283203125,
-0.050048828125,
-0.61083984375,
-0.48095703125,
0.12432861328125,
0.94384765625,
0.0238494873046875,
-0.05615234375,
-0.412109375,
0.00319671630859375,
-0.6279296875,
0.261962890625,
-0.2861328125,
-0.09136962890625,
0.09783935546875,
-0.74853515625,
0.505859375,
1.26953125,
-0.09161376953125,
0.177978515625,
-0.0291900634765625,
0.2939453125,
0.386962890625,
0.1669921875,
0.341552734375,
0.1629638671875,
0.1240234375,
-0.2159423828125,
-0.158935546875,
0.6015625,
-0.01273345947265625,
0.4287109375,
-0.2010498046875,
-0.76806640625,
-0.7490234375,
-0.100341796875,
-0.27294921875,
0.042572021484375,
0.59619140625,
-0.8369140625,
-0.06622314453125,
0.087890625,
-0.95166015625,
0.1787109375,
-0.7529296875,
-0.84619140625,
0.0838623046875,
-0.133056640625,
-0.7958984375,
-0.493896484375,
-0.58740234375,
0.037139892578125,
0.1595458984375,
0.5478515625,
-0.7412109375,
0.295654296875,
-0.172119140625,
0.44287109375,
-0.215087890625,
-0.1334228515625,
0.1318359375,
0.291748046875,
-0.470703125,
-0.6533203125,
0.0771484375,
1.4853515625,
0.17919921875,
-0.34912109375,
-0.63037109375,
0.10302734375,
-0.42919921875,
0.3271484375,
-0.2034912109375,
-0.18896484375,
0.01824951171875,
0.435791015625,
-1.181640625,
-0.354248046875,
0.084716796875,
0.286376953125,
-0.021026611328125,
-0.3447265625,
-0.2130126953125,
0.68994140625,
0.982421875,
-0.1396484375,
-0.058502197265625,
0.408935546875,
0.79150390625,
-0.26220703125,
-0.127197265625,
-0.251708984375,
0.30224609375,
0.53076171875,
0.27490234375,
-0.2354736328125,
0.69873046875,
0.93798828125,
-0.33203125,
-0.2208251953125,
0.5380859375,
0.03131103515625,
-0.0085906982421875,
-0.241943359375,
-0.2291259765625,
0.040191650390625,
-0.06988525390625,
-0.84619140625,
0.172607421875,
-0.378662109375,
-0.333251953125,
-0.176513671875,
-0.70849609375,
0.98046875,
-1.1953125,
0.4619140625,
-0.26220703125,
-0.12158203125,
0.399169921875,
0.98046875,
0.05169677734375,
-0.056793212890625,
0.50390625,
0.341552734375,
0.58349609375,
0.8076171875,
0.208984375,
0.154541015625,
-0.3916015625,
0.146484375,
-0.0693359375,
0.006015777587890625,
-0.6806640625,
-0.28125,
-1.1416015625,
0.6298828125,
-0.399169921875,
-0.09930419921875,
0.433837890625,
-0.5341796875,
0.1962890625,
-0.284912109375,
0.7646484375,
-0.38037109375,
0.434814453125,
0.5458984375,
-0.57177734375,
-0.447509765625,
0.84423828125,
-0.1993408203125,
0.38232421875,
0.1937255859375,
0.73828125,
0.34814453125,
1.716796875,
0.32080078125,
-0.2578125,
-0.147705078125,
0.057220458984375,
-0.234375,
-0.60400390625,
-0.38916015625,
-0.37158203125,
-0.119140625,
-0.398193359375,
-0.22998046875,
0.0257110595703125,
0.6533203125,
0.0811767578125,
-0.80615234375,
-0.042236328125,
0.08184814453125,
-0.84521484375,
0.7734375,
0.261474609375,
0.02947998046875,
0.07269287109375,
0.08599853515625,
-0.14208984375,
-0.35009765625,
-0.185791015625,
-0.5927734375,
0.2236328125,
-0.5849609375,
-0.5380859375,
-0.609375,
-1.0380859375,
-0.375732421875,
-0.33203125,
-0.476318359375,
-1.0390625,
0.1490478515625,
0.65185546875,
0.40625,
0.5107421875,
-0.51611328125,
0.397705078125,
1.123046875,
0.71630859375,
-0.351806640625,
0.80810546875,
0.36474609375,
-0.525390625,
0.08441162109375,
-0.0052032470703125,
0.6953125,
-0.33837890625,
-0.0105133056640625,
-0.297607421875,
0.5234375,
-0.9794921875,
-1.3837890625,
0.06396484375,
0.6513671875,
0.50341796875,
-0.54345703125,
-0.9306640625,
-0.401123046875,
-0.74755859375,
-0.046600341796875,
-0.78271484375,
0.6123046875,
0.388671875,
-0.09393310546875,
0.0287017822265625,
-1.0283203125,
4.31640625,
1.0087890625,
0.94677734375,
0.07049560546875,
-0.028228759765625,
0.970703125,
-0.0012559890747070312,
-0.31884765625,
0.1610107421875,
-0.3154296875,
0.7646484375,
-0.215576171875,
-0.088134765625,
0.65087890625,
0.1949462890625,
0.453125,
-0.48486328125,
-0.0171356201171875,
-0.247314453125,
-0.990234375,
-0.7939453125,
0.0758056640625,
0.2432861328125,
0.165283203125,
0.08551025390625,
0.093017578125,
0.57080078125,
-0.626953125,
-0.29052734375,
-0.63525390625,
-0.28369140625,
-0.7109375,
0.666015625,
-0.0755615234375,
-0.1834716796875,
0.50732421875,
0.1470947265625,
-0.62744140625,
0.057891845703125,
0.55517578125,
-0.30810546875,
-0.44873046875,
0.86669921875,
-0.8212890625,
0.197998046875,
0.5556640625,
-0.294677734375,
0.279541015625,
0.62841796875,
-0.421142578125,
0.78076171875,
-0.2249755859375,
0.73193359375,
-0.73681640625,
-0.671875,
0.04107666015625,
0.2283935546875,
-0.33349609375,
0.03997802734375,
0.3427734375,
0.2381591796875,
0.1112060546875,
0.050140380859375,
0.38818359375,
-0.68896484375,
0.68212890625,
0.2008056640625,
0.19287109375,
-0.5341796875,
0.09197998046875,
0.018310546875,
-0.137939453125,
-0.4248046875,
-0.50244140625,
0.57275390625,
0.2161865234375,
-0.0219268798828125,
0.30810546875,
0.471435546875,
-0.78955078125,
0.0018644332885742188,
0.0350341796875,
-0.3779296875,
-0.31396484375,
0.5810546875,
1.5830078125,
-0.75439453125,
-0.423828125,
-0.53466796875,
0.6142578125,
0.183349609375,
0.2802734375,
0.60400390625,
-0.91357421875,
-0.25048828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.
Sergey totally forgot about the task until half an hour before the next lesson and hastily scribbled something down. But then he recollected that in the last lesson he learned the grammar of N-ish. The spelling rules state that N-ish contains some "forbidden" pairs of letters: such letters can never occur in a sentence next to each other. Also, the order of the letters doesn't matter (for example, if the pair of letters "ab" is forbidden, then any occurrences of substrings "ab" and "ba" are also forbidden). Also, each pair has different letters and each letter occurs in no more than one forbidden pair.
Now Sergey wants to correct his sentence so that it doesn't contain any "forbidden" pairs of letters that stand next to each other. However, he is running out of time, so he decided to simply cross out some letters from the sentence. What smallest number of letters will he have to cross out? When a letter is crossed out, it is "removed" so that the letters to its left and right (if they existed), become neighboring. For example, if we cross out the first letter from the string "aba", we get the string "ba", and if we cross out the second letter, we get "aa".
Input
The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105.
The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters.
Next k lines contain descriptions of forbidden pairs of letters. Each line contains exactly two different lowercase Latin letters without separators that represent the forbidden pairs. It is guaranteed that each letter is included in no more than one pair.
Output
Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters.
Examples
Input
ababa
1
ab
Output
2
Input
codeforces
2
do
cs
Output
1
Note
In the first sample you should remove two letters b.
In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution.
Tags: greedy
Correct Solution:
```
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
# from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]
try:
# sys.setrecursionlimit(int(pow(10,4)))
sys.stdin = open("input.txt", "r")
# sys.stdout = open("../output.txt", "w")
except:
pass
def pmat(A):
for ele in A:
print(*ele,end="\n")
# def seive():
# prime=[1 for i in range(10**6+1)]
# prime[0]=0
# prime[1]=0
# for i in range(10**6+1):
# if(prime[i]):
# for j in range(2*i,10**6+1,i):
# prime[j]=0
# return prime
s=input()
k=L()[0]
d={}
for i in range(k):
x=input()
d[x[0]]=x[1]
d[x[1]]=x[0]
A=[]
i=0
while(i<len(s)):
k1=1
k2=0
while((i+k1+k2)<len(s) and (s[i+k1+k2]==s[i] or s[i+k1+k2]==d.get(s[i],0))):
if s[i+k1+k2]==s[i]:
k1+=1
else:
k2+=1
A.append(max(k1,k2))
i+=(k1+k2)
print(len(s)-sum(A))
endtime = time.time()
# print(f"Runtime of the program is {endtime - starttime}")
```
| 45,641
|
[
0.291015625,
-0.05596923828125,
0.1292724609375,
0.284912109375,
-0.5634765625,
-0.67431640625,
0.14208984375,
-0.12200927734375,
-0.189208984375,
0.90283203125,
0.8505859375,
-0.01378631591796875,
-0.3876953125,
-0.91552734375,
-0.935546875,
-0.12841796875,
-0.91455078125,
-0.58349609375,
-0.53955078125,
-0.1390380859375,
0.0859375,
-0.15283203125,
-1.6376953125,
-0.293212890625,
-0.37158203125,
1.2021484375,
0.3583984375,
-0.2958984375,
1.162109375,
0.75048828125,
-0.26318359375,
-0.338623046875,
0.5576171875,
-1.1689453125,
-0.6259765625,
-0.51220703125,
0.9462890625,
-0.467041015625,
0.007476806640625,
-0.064208984375,
0.66064453125,
-0.251953125,
0.473388671875,
-0.5341796875,
-1.2958984375,
-0.35791015625,
-0.126953125,
-0.61376953125,
-0.3544921875,
-0.40869140625,
0.332275390625,
-0.334228515625,
0.62109375,
-0.220947265625,
0.07373046875,
0.156494140625,
0.2384033203125,
0.08428955078125,
-0.693359375,
0.411376953125,
0.134765625,
0.374755859375,
0.1448974609375,
-0.75634765625,
-0.421875,
-0.107666015625,
-0.309814453125,
0.202392578125,
-0.00026702880859375,
-0.61181640625,
-0.241455078125,
0.4931640625,
-0.3916015625,
-0.330078125,
-0.673828125,
0.0330810546875,
0.2467041015625,
0.093994140625,
-0.56689453125,
0.8388671875,
0.36865234375,
1.013671875,
0.77001953125,
-0.10443115234375,
-0.35009765625,
-0.129150390625,
0.00772857666015625,
0.378662109375,
0.423828125,
-0.2183837890625,
-0.1893310546875,
0.541015625,
-1.03515625,
-0.166748046875,
0.5908203125,
0.40576171875,
-0.28515625,
0.283447265625,
0.45751953125,
0.44873046875,
0.89892578125,
0.58349609375,
-0.34912109375,
0.82958984375,
-0.5546875,
0.16162109375,
0.0953369140625,
0.1873779296875,
-0.05413818359375,
0.25927734375,
-0.31201171875,
-0.08892822265625,
0.486083984375,
0.458984375,
-0.6806640625,
0.76953125,
-0.276123046875,
0.3896484375,
-0.8388671875,
0.281494140625,
0.7314453125,
-0.06927490234375,
0.84912109375,
0.044891357421875,
0.1920166015625,
-0.2216796875,
-0.6083984375,
1.0673828125,
-0.433837890625,
-0.021942138671875,
0.49365234375,
0.0227508544921875,
-0.06689453125,
0.2044677734375,
-0.32080078125,
0.8076171875,
-0.287353515625,
0.6162109375,
0.55419921875,
-0.6220703125,
0.492431640625,
-0.2286376953125,
-0.053070068359375,
1.4287109375,
0.708984375,
-0.06097412109375,
0.78515625,
0.42822265625,
-0.92724609375,
0.1619873046875,
-1.3056640625,
0.8525390625,
0.14013671875,
0.117919921875,
-0.53369140625,
-0.1455078125,
-0.2314453125,
0.157958984375,
0.06756591796875,
0.2060546875,
-0.46826171875,
0.1510009765625,
-0.310302734375,
0.62744140625,
-0.2587890625,
1.0556640625,
-0.6728515625,
0.01007080078125,
-0.142333984375,
-0.5966796875,
0.19921875,
-0.040008544921875,
0.11669921875,
1.0732421875,
0.1568603515625,
0.8330078125,
0.56884765625,
-0.344482421875,
0.64306640625,
0.4794921875,
-0.10455322265625,
0.48046875,
0.1812744140625,
0.324462890625,
0.521484375,
0.298583984375,
-0.15625,
-0.415283203125,
-0.84716796875,
-0.375,
-0.0113525390625,
0.65673828125,
-0.37353515625,
0.341064453125,
0.047698974609375,
-0.0391845703125,
-1.0478515625,
-0.32666015625,
0.18408203125,
-1.0986328125,
-0.5546875,
0.90283203125,
0.14599609375,
0.74658203125,
-0.202392578125,
-0.626953125,
0.64892578125,
1.4775390625,
-0.3173828125,
0.278564453125,
0.6513671875,
-0.58935546875,
-0.345947265625,
0.45751953125,
-0.1702880859375,
-0.179931640625,
-0.85400390625,
0.72412109375,
-0.53466796875,
-0.0231475830078125,
-0.2080078125,
0.266357421875,
0.2763671875,
0.66015625,
-0.1806640625,
-0.3349609375,
0.84765625,
1.12890625,
0.0369873046875,
0.50390625,
0.197998046875,
0.7021484375,
0.1204833984375,
0.71240234375,
0.412841796875,
0.1494140625,
0.8486328125,
0.916015625,
0.2119140625,
0.52880859375,
-0.2252197265625,
0.44091796875,
0.1973876953125,
0.580078125,
0.440673828125,
0.29052734375,
-0.316162109375,
-0.038177490234375,
-0.3876953125,
0.09185791015625,
-0.252197265625,
0.32080078125,
0.431884765625,
0.432373046875,
-0.29443359375,
-0.13916015625,
0.2066650390625,
0.685546875,
-1.171875,
-0.45703125,
0.045135498046875,
0.1319580078125,
-0.0281219482421875,
0.00022304058074951172,
0.2379150390625,
0.77880859375,
0.70263671875,
0.328857421875,
-0.52783203125,
-0.52783203125,
-1.1328125,
-1.0107421875,
-0.86376953125,
-0.332275390625,
-0.82568359375,
-0.11688232421875,
0.634765625,
-1.0869140625,
0.482177734375,
-0.2861328125,
-0.5302734375,
0.1619873046875,
-0.578125,
0.6025390625,
-0.2027587890625,
0.80029296875,
-0.755859375,
0.73291015625,
0.034820556640625,
0.90234375,
-0.287841796875,
-0.3671875,
-0.047760009765625,
-0.61767578125,
0.251953125,
-0.0189208984375,
0.3017578125,
0.1771240234375,
-0.6533203125,
-0.7646484375,
0.032501220703125,
-0.308349609375,
-0.57861328125,
0.215087890625,
-0.7529296875,
0.7294921875,
0.93994140625,
-0.66845703125,
0.77392578125,
1.1220703125,
-0.94921875,
0.0287628173828125,
0.1856689453125,
0.2998046875,
-0.615234375,
1.189453125,
0.29052734375,
0.3974609375,
-0.5205078125,
-0.51220703125,
-0.755859375,
0.0966796875,
-0.03570556640625,
-0.354736328125,
-0.09564208984375,
0.75634765625,
-0.267333984375,
-0.994140625,
0.75341796875,
-1.1796875,
-0.10711669921875,
-0.1295166015625,
-0.489501953125,
0.95068359375,
0.342529296875,
0.354736328125,
-0.288330078125,
-0.818359375,
-0.25146484375,
0.82421875,
0.1776123046875,
-0.521484375,
-0.0372314453125,
0.2440185546875,
0.1773681640625,
0.150634765625,
0.12078857421875,
-0.232421875,
-0.3251953125,
0.070068359375,
0.221923828125,
0.92333984375,
0.2998046875,
0.3857421875,
0.365234375,
0.8486328125,
-0.6884765625,
-0.252685546875,
-0.270263671875,
0.720703125,
0.21337890625,
0.39697265625,
0.1611328125,
-0.24755859375,
-0.330078125,
-0.80615234375,
0.483642578125,
-0.295166015625,
0.763671875,
-0.5322265625,
0.6181640625,
0.383056640625,
-0.5263671875,
0.65966796875,
-0.89599609375,
-0.358154296875,
0.90283203125,
-0.6650390625,
0.95068359375,
-0.8916015625,
0.194580078125,
0.06884765625,
0.1278076171875,
0.701171875,
0.642578125,
0.7373046875,
-0.453125,
-0.60302734375,
-0.2890625,
0.278076171875,
-0.06378173828125,
-0.525390625,
0.144775390625,
-0.2440185546875,
-0.41455078125,
-0.89111328125,
0.41357421875,
0.86083984375,
0.57275390625,
0.3359375,
0.4248046875,
0.1689453125,
0.58740234375,
0.9111328125,
-0.0947265625,
-0.002368927001953125,
-0.7587890625,
1.0380859375,
-0.0124053955078125,
-0.480224609375,
-0.34765625,
-0.33544921875,
-0.312255859375,
0.323974609375,
0.018951416015625,
0.04071044921875,
-0.89208984375,
-0.170654296875,
-0.13720703125,
0.361572265625,
-0.73583984375,
-0.3095703125,
-0.189697265625,
0.425048828125,
0.08111572265625,
-1.017578125,
0.390380859375,
-0.6630859375,
0.927734375,
0.99169921875,
0.0635986328125,
-0.51708984375,
-0.149658203125,
-0.53955078125,
-0.86767578125,
-0.1142578125,
0.58154296875,
-0.12353515625,
0.2261962890625,
-1.2578125,
0.57958984375,
0.3349609375,
-0.088134765625,
0.28466796875,
0.193359375,
0.472900390625,
0.142578125,
0.5234375,
-0.6318359375,
-0.66357421875,
0.419189453125,
-1.1201171875,
0.763671875,
-0.611328125,
0.483154296875,
-0.154541015625,
0.1396484375,
0.1552734375,
0.4560546875,
-0.4775390625,
0.41357421875,
-0.0810546875,
0.3984375,
-1.01171875,
-0.65966796875,
0.51806640625,
-0.1829833984375,
-0.724609375,
0.546875,
0.25244140625,
-0.236083984375,
0.013427734375,
0.5927734375,
-0.466064453125,
0.4443359375,
-0.54736328125,
0.62451171875,
-0.116943359375,
-0.77294921875,
-0.2432861328125,
-0.470458984375,
0.68212890625,
-0.186279296875,
-0.7587890625,
0.220703125,
-1.15625,
-0.250732421875,
0.09710693359375,
-0.49755859375,
0.349365234375,
0.1513671875,
0.1280517578125,
0.09881591796875,
-0.49609375,
-0.36279296875,
-0.1741943359375,
-0.53564453125,
-0.51806640625,
0.337646484375,
0.58984375,
0.6943359375,
0.290283203125,
-0.10791015625,
0.1749267578125,
0.015655517578125,
-0.12200927734375,
-0.58447265625,
-0.354736328125,
0.213134765625,
-0.51220703125,
-0.1392822265625,
0.36181640625,
-0.0020809173583984375,
0.39697265625,
0.8720703125,
-0.055877685546875,
0.2276611328125,
0.348388671875,
-0.5146484375,
1.384765625,
-0.188720703125,
-1.0166015625,
-0.38427734375,
0.2420654296875,
0.060333251953125,
0.607421875,
-0.1727294921875,
-0.7978515625,
-0.6845703125,
-1.1015625,
0.08795166015625,
-0.5263671875,
-0.26171875,
-0.94287109375,
-0.1905517578125,
-0.51123046875,
0.7978515625,
-0.37744140625,
-0.2802734375,
0.340576171875,
-1.2001953125,
0.04998779296875,
-0.59619140625,
-0.41845703125,
-0.56201171875,
-0.5673828125,
-0.623046875,
1.09765625,
0.416015625,
0.1422119140625,
0.421142578125,
-0.34521484375,
0.24853515625,
-0.36669921875,
-0.609375,
-0.495849609375,
-0.280517578125,
0.376953125,
-0.355224609375,
-0.42138671875,
-0.625,
0.8857421875,
-0.54052734375,
0.206787109375,
-0.443603515625,
-0.5341796875,
-0.199462890625,
-0.240478515625,
0.7998046875,
-0.65283203125,
0.1392822265625,
-0.50439453125,
0.68212890625,
0.3701171875,
-0.302001953125,
-0.5234375,
-0.83447265625,
-0.6005859375,
-0.8583984375,
0.65087890625,
-0.552734375,
0.58935546875,
-0.69189453125,
-0.2587890625,
0.900390625,
-0.5205078125,
0.317138671875,
1.3330078125,
-0.2313232421875,
0.213623046875,
-0.84814453125,
0.677734375,
-0.0223541259765625,
-0.64453125,
-0.27685546875,
-0.07952880859375,
-0.9150390625,
0.0960693359375,
-0.63427734375,
-0.896484375,
-0.57373046875,
0.71044921875,
1.466796875,
-0.300537109375,
0.95556640625,
0.2305908203125,
-1.17578125,
-0.7919921875,
0.78857421875,
0.381591796875,
0.56640625,
1.1259765625,
-0.82177734375,
-0.1278076171875,
0.40673828125,
-0.07183837890625,
-0.26416015625,
-0.208984375,
1.056640625,
-0.491455078125,
-0.60302734375,
0.52783203125,
0.57568359375,
-1.111328125,
-0.5341796875,
0.07781982421875,
-0.00972747802734375,
-0.1356201171875,
-0.61669921875,
0.09686279296875,
0.63818359375,
-0.479736328125,
-0.10040283203125,
0.0250244140625,
0.04345703125,
0.634765625,
0.300048828125,
0.30419921875,
-0.51904296875,
0.64306640625,
0.80029296875,
-0.783203125,
-0.37890625,
-0.82958984375,
-0.18505859375,
-0.2322998046875,
0.37353515625,
0.81640625,
0.0882568359375,
0.2191162109375,
0.72021484375,
-0.08892822265625,
0.7138671875,
-0.38818359375,
-0.363037109375,
0.25048828125,
-0.492431640625,
-0.25927734375,
-0.01491546630859375,
0.183349609375,
0.1009521484375,
0.2156982421875,
-0.7021484375,
-0.06610107421875,
0.349853515625,
0.334716796875,
-0.08917236328125,
-0.045318603515625,
-0.325927734375,
-0.58935546875,
-0.413330078125,
-0.5380859375,
-0.765625,
-0.12188720703125,
0.429443359375,
0.367919921875,
-0.73876953125,
0.04022216796875,
0.8408203125,
-0.77880859375,
1.2099609375,
-0.7490234375,
0.325927734375,
-0.43994140625,
-0.09228515625,
-0.78466796875,
0.1318359375,
-0.41796875,
-0.27880859375,
-0.403564453125,
0.5419921875,
0.3779296875,
0.52734375,
-0.1343994140625,
0.1981201171875,
-0.173828125,
-0.81103515625,
-0.06646728515625,
0.049224853515625,
0.0947265625,
0.33251953125,
0.72021484375,
0.52099609375,
0.283203125,
-0.050048828125,
-0.61083984375,
-0.48095703125,
0.12432861328125,
0.94384765625,
0.0238494873046875,
-0.05615234375,
-0.412109375,
0.00319671630859375,
-0.6279296875,
0.261962890625,
-0.2861328125,
-0.09136962890625,
0.09783935546875,
-0.74853515625,
0.505859375,
1.26953125,
-0.09161376953125,
0.177978515625,
-0.0291900634765625,
0.2939453125,
0.386962890625,
0.1669921875,
0.341552734375,
0.1629638671875,
0.1240234375,
-0.2159423828125,
-0.158935546875,
0.6015625,
-0.01273345947265625,
0.4287109375,
-0.2010498046875,
-0.76806640625,
-0.7490234375,
-0.100341796875,
-0.27294921875,
0.042572021484375,
0.59619140625,
-0.8369140625,
-0.06622314453125,
0.087890625,
-0.95166015625,
0.1787109375,
-0.7529296875,
-0.84619140625,
0.0838623046875,
-0.133056640625,
-0.7958984375,
-0.493896484375,
-0.58740234375,
0.037139892578125,
0.1595458984375,
0.5478515625,
-0.7412109375,
0.295654296875,
-0.172119140625,
0.44287109375,
-0.215087890625,
-0.1334228515625,
0.1318359375,
0.291748046875,
-0.470703125,
-0.6533203125,
0.0771484375,
1.4853515625,
0.17919921875,
-0.34912109375,
-0.63037109375,
0.10302734375,
-0.42919921875,
0.3271484375,
-0.2034912109375,
-0.18896484375,
0.01824951171875,
0.435791015625,
-1.181640625,
-0.354248046875,
0.084716796875,
0.286376953125,
-0.021026611328125,
-0.3447265625,
-0.2130126953125,
0.68994140625,
0.982421875,
-0.1396484375,
-0.058502197265625,
0.408935546875,
0.79150390625,
-0.26220703125,
-0.127197265625,
-0.251708984375,
0.30224609375,
0.53076171875,
0.27490234375,
-0.2354736328125,
0.69873046875,
0.93798828125,
-0.33203125,
-0.2208251953125,
0.5380859375,
0.03131103515625,
-0.0085906982421875,
-0.241943359375,
-0.2291259765625,
0.040191650390625,
-0.06988525390625,
-0.84619140625,
0.172607421875,
-0.378662109375,
-0.333251953125,
-0.176513671875,
-0.70849609375,
0.98046875,
-1.1953125,
0.4619140625,
-0.26220703125,
-0.12158203125,
0.399169921875,
0.98046875,
0.05169677734375,
-0.056793212890625,
0.50390625,
0.341552734375,
0.58349609375,
0.8076171875,
0.208984375,
0.154541015625,
-0.3916015625,
0.146484375,
-0.0693359375,
0.006015777587890625,
-0.6806640625,
-0.28125,
-1.1416015625,
0.6298828125,
-0.399169921875,
-0.09930419921875,
0.433837890625,
-0.5341796875,
0.1962890625,
-0.284912109375,
0.7646484375,
-0.38037109375,
0.434814453125,
0.5458984375,
-0.57177734375,
-0.447509765625,
0.84423828125,
-0.1993408203125,
0.38232421875,
0.1937255859375,
0.73828125,
0.34814453125,
1.716796875,
0.32080078125,
-0.2578125,
-0.147705078125,
0.057220458984375,
-0.234375,
-0.60400390625,
-0.38916015625,
-0.37158203125,
-0.119140625,
-0.398193359375,
-0.22998046875,
0.0257110595703125,
0.6533203125,
0.0811767578125,
-0.80615234375,
-0.042236328125,
0.08184814453125,
-0.84521484375,
0.7734375,
0.261474609375,
0.02947998046875,
0.07269287109375,
0.08599853515625,
-0.14208984375,
-0.35009765625,
-0.185791015625,
-0.5927734375,
0.2236328125,
-0.5849609375,
-0.5380859375,
-0.609375,
-1.0380859375,
-0.375732421875,
-0.33203125,
-0.476318359375,
-1.0390625,
0.1490478515625,
0.65185546875,
0.40625,
0.5107421875,
-0.51611328125,
0.397705078125,
1.123046875,
0.71630859375,
-0.351806640625,
0.80810546875,
0.36474609375,
-0.525390625,
0.08441162109375,
-0.0052032470703125,
0.6953125,
-0.33837890625,
-0.0105133056640625,
-0.297607421875,
0.5234375,
-0.9794921875,
-1.3837890625,
0.06396484375,
0.6513671875,
0.50341796875,
-0.54345703125,
-0.9306640625,
-0.401123046875,
-0.74755859375,
-0.046600341796875,
-0.78271484375,
0.6123046875,
0.388671875,
-0.09393310546875,
0.0287017822265625,
-1.0283203125,
4.31640625,
1.0087890625,
0.94677734375,
0.07049560546875,
-0.028228759765625,
0.970703125,
-0.0012559890747070312,
-0.31884765625,
0.1610107421875,
-0.3154296875,
0.7646484375,
-0.215576171875,
-0.088134765625,
0.65087890625,
0.1949462890625,
0.453125,
-0.48486328125,
-0.0171356201171875,
-0.247314453125,
-0.990234375,
-0.7939453125,
0.0758056640625,
0.2432861328125,
0.165283203125,
0.08551025390625,
0.093017578125,
0.57080078125,
-0.626953125,
-0.29052734375,
-0.63525390625,
-0.28369140625,
-0.7109375,
0.666015625,
-0.0755615234375,
-0.1834716796875,
0.50732421875,
0.1470947265625,
-0.62744140625,
0.057891845703125,
0.55517578125,
-0.30810546875,
-0.44873046875,
0.86669921875,
-0.8212890625,
0.197998046875,
0.5556640625,
-0.294677734375,
0.279541015625,
0.62841796875,
-0.421142578125,
0.78076171875,
-0.2249755859375,
0.73193359375,
-0.73681640625,
-0.671875,
0.04107666015625,
0.2283935546875,
-0.33349609375,
0.03997802734375,
0.3427734375,
0.2381591796875,
0.1112060546875,
0.050140380859375,
0.38818359375,
-0.68896484375,
0.68212890625,
0.2008056640625,
0.19287109375,
-0.5341796875,
0.09197998046875,
0.018310546875,
-0.137939453125,
-0.4248046875,
-0.50244140625,
0.57275390625,
0.2161865234375,
-0.0219268798828125,
0.30810546875,
0.471435546875,
-0.78955078125,
0.0018644332885742188,
0.0350341796875,
-0.3779296875,
-0.31396484375,
0.5810546875,
1.5830078125,
-0.75439453125,
-0.423828125,
-0.53466796875,
0.6142578125,
0.183349609375,
0.2802734375,
0.60400390625,
-0.91357421875,
-0.25048828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.
Sergey totally forgot about the task until half an hour before the next lesson and hastily scribbled something down. But then he recollected that in the last lesson he learned the grammar of N-ish. The spelling rules state that N-ish contains some "forbidden" pairs of letters: such letters can never occur in a sentence next to each other. Also, the order of the letters doesn't matter (for example, if the pair of letters "ab" is forbidden, then any occurrences of substrings "ab" and "ba" are also forbidden). Also, each pair has different letters and each letter occurs in no more than one forbidden pair.
Now Sergey wants to correct his sentence so that it doesn't contain any "forbidden" pairs of letters that stand next to each other. However, he is running out of time, so he decided to simply cross out some letters from the sentence. What smallest number of letters will he have to cross out? When a letter is crossed out, it is "removed" so that the letters to its left and right (if they existed), become neighboring. For example, if we cross out the first letter from the string "aba", we get the string "ba", and if we cross out the second letter, we get "aa".
Input
The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105.
The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters.
Next k lines contain descriptions of forbidden pairs of letters. Each line contains exactly two different lowercase Latin letters without separators that represent the forbidden pairs. It is guaranteed that each letter is included in no more than one pair.
Output
Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters.
Examples
Input
ababa
1
ab
Output
2
Input
codeforces
2
do
cs
Output
1
Note
In the first sample you should remove two letters b.
In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution.
Tags: greedy
Correct Solution:
```
def f(a,bad):
i=0
retain=0
while i<len(a):
c={}
while i<len(a)-1 and (a[i+1]==a[i]or a[i+1]==bad.get(a[i],None)):
c[a[i]]=c.get(a[i],0)+1
i+=1
c[a[i]] = c.get(a[i], 0) + 1
retain+=max(c.items(),key=lambda s:s[1])[1]
i+=1
return len(a)-retain
a=list(input())
n=int(input())
bad={}
for i in range(n):
l=list(input())
bad[l[0]]=l[1]
bad[l[1]]=l[0]
print(f(a,bad))
```
| 45,642
|
[
0.291015625,
-0.05596923828125,
0.1292724609375,
0.284912109375,
-0.5634765625,
-0.67431640625,
0.14208984375,
-0.12200927734375,
-0.189208984375,
0.90283203125,
0.8505859375,
-0.01378631591796875,
-0.3876953125,
-0.91552734375,
-0.935546875,
-0.12841796875,
-0.91455078125,
-0.58349609375,
-0.53955078125,
-0.1390380859375,
0.0859375,
-0.15283203125,
-1.6376953125,
-0.293212890625,
-0.37158203125,
1.2021484375,
0.3583984375,
-0.2958984375,
1.162109375,
0.75048828125,
-0.26318359375,
-0.338623046875,
0.5576171875,
-1.1689453125,
-0.6259765625,
-0.51220703125,
0.9462890625,
-0.467041015625,
0.007476806640625,
-0.064208984375,
0.66064453125,
-0.251953125,
0.473388671875,
-0.5341796875,
-1.2958984375,
-0.35791015625,
-0.126953125,
-0.61376953125,
-0.3544921875,
-0.40869140625,
0.332275390625,
-0.334228515625,
0.62109375,
-0.220947265625,
0.07373046875,
0.156494140625,
0.2384033203125,
0.08428955078125,
-0.693359375,
0.411376953125,
0.134765625,
0.374755859375,
0.1448974609375,
-0.75634765625,
-0.421875,
-0.107666015625,
-0.309814453125,
0.202392578125,
-0.00026702880859375,
-0.61181640625,
-0.241455078125,
0.4931640625,
-0.3916015625,
-0.330078125,
-0.673828125,
0.0330810546875,
0.2467041015625,
0.093994140625,
-0.56689453125,
0.8388671875,
0.36865234375,
1.013671875,
0.77001953125,
-0.10443115234375,
-0.35009765625,
-0.129150390625,
0.00772857666015625,
0.378662109375,
0.423828125,
-0.2183837890625,
-0.1893310546875,
0.541015625,
-1.03515625,
-0.166748046875,
0.5908203125,
0.40576171875,
-0.28515625,
0.283447265625,
0.45751953125,
0.44873046875,
0.89892578125,
0.58349609375,
-0.34912109375,
0.82958984375,
-0.5546875,
0.16162109375,
0.0953369140625,
0.1873779296875,
-0.05413818359375,
0.25927734375,
-0.31201171875,
-0.08892822265625,
0.486083984375,
0.458984375,
-0.6806640625,
0.76953125,
-0.276123046875,
0.3896484375,
-0.8388671875,
0.281494140625,
0.7314453125,
-0.06927490234375,
0.84912109375,
0.044891357421875,
0.1920166015625,
-0.2216796875,
-0.6083984375,
1.0673828125,
-0.433837890625,
-0.021942138671875,
0.49365234375,
0.0227508544921875,
-0.06689453125,
0.2044677734375,
-0.32080078125,
0.8076171875,
-0.287353515625,
0.6162109375,
0.55419921875,
-0.6220703125,
0.492431640625,
-0.2286376953125,
-0.053070068359375,
1.4287109375,
0.708984375,
-0.06097412109375,
0.78515625,
0.42822265625,
-0.92724609375,
0.1619873046875,
-1.3056640625,
0.8525390625,
0.14013671875,
0.117919921875,
-0.53369140625,
-0.1455078125,
-0.2314453125,
0.157958984375,
0.06756591796875,
0.2060546875,
-0.46826171875,
0.1510009765625,
-0.310302734375,
0.62744140625,
-0.2587890625,
1.0556640625,
-0.6728515625,
0.01007080078125,
-0.142333984375,
-0.5966796875,
0.19921875,
-0.040008544921875,
0.11669921875,
1.0732421875,
0.1568603515625,
0.8330078125,
0.56884765625,
-0.344482421875,
0.64306640625,
0.4794921875,
-0.10455322265625,
0.48046875,
0.1812744140625,
0.324462890625,
0.521484375,
0.298583984375,
-0.15625,
-0.415283203125,
-0.84716796875,
-0.375,
-0.0113525390625,
0.65673828125,
-0.37353515625,
0.341064453125,
0.047698974609375,
-0.0391845703125,
-1.0478515625,
-0.32666015625,
0.18408203125,
-1.0986328125,
-0.5546875,
0.90283203125,
0.14599609375,
0.74658203125,
-0.202392578125,
-0.626953125,
0.64892578125,
1.4775390625,
-0.3173828125,
0.278564453125,
0.6513671875,
-0.58935546875,
-0.345947265625,
0.45751953125,
-0.1702880859375,
-0.179931640625,
-0.85400390625,
0.72412109375,
-0.53466796875,
-0.0231475830078125,
-0.2080078125,
0.266357421875,
0.2763671875,
0.66015625,
-0.1806640625,
-0.3349609375,
0.84765625,
1.12890625,
0.0369873046875,
0.50390625,
0.197998046875,
0.7021484375,
0.1204833984375,
0.71240234375,
0.412841796875,
0.1494140625,
0.8486328125,
0.916015625,
0.2119140625,
0.52880859375,
-0.2252197265625,
0.44091796875,
0.1973876953125,
0.580078125,
0.440673828125,
0.29052734375,
-0.316162109375,
-0.038177490234375,
-0.3876953125,
0.09185791015625,
-0.252197265625,
0.32080078125,
0.431884765625,
0.432373046875,
-0.29443359375,
-0.13916015625,
0.2066650390625,
0.685546875,
-1.171875,
-0.45703125,
0.045135498046875,
0.1319580078125,
-0.0281219482421875,
0.00022304058074951172,
0.2379150390625,
0.77880859375,
0.70263671875,
0.328857421875,
-0.52783203125,
-0.52783203125,
-1.1328125,
-1.0107421875,
-0.86376953125,
-0.332275390625,
-0.82568359375,
-0.11688232421875,
0.634765625,
-1.0869140625,
0.482177734375,
-0.2861328125,
-0.5302734375,
0.1619873046875,
-0.578125,
0.6025390625,
-0.2027587890625,
0.80029296875,
-0.755859375,
0.73291015625,
0.034820556640625,
0.90234375,
-0.287841796875,
-0.3671875,
-0.047760009765625,
-0.61767578125,
0.251953125,
-0.0189208984375,
0.3017578125,
0.1771240234375,
-0.6533203125,
-0.7646484375,
0.032501220703125,
-0.308349609375,
-0.57861328125,
0.215087890625,
-0.7529296875,
0.7294921875,
0.93994140625,
-0.66845703125,
0.77392578125,
1.1220703125,
-0.94921875,
0.0287628173828125,
0.1856689453125,
0.2998046875,
-0.615234375,
1.189453125,
0.29052734375,
0.3974609375,
-0.5205078125,
-0.51220703125,
-0.755859375,
0.0966796875,
-0.03570556640625,
-0.354736328125,
-0.09564208984375,
0.75634765625,
-0.267333984375,
-0.994140625,
0.75341796875,
-1.1796875,
-0.10711669921875,
-0.1295166015625,
-0.489501953125,
0.95068359375,
0.342529296875,
0.354736328125,
-0.288330078125,
-0.818359375,
-0.25146484375,
0.82421875,
0.1776123046875,
-0.521484375,
-0.0372314453125,
0.2440185546875,
0.1773681640625,
0.150634765625,
0.12078857421875,
-0.232421875,
-0.3251953125,
0.070068359375,
0.221923828125,
0.92333984375,
0.2998046875,
0.3857421875,
0.365234375,
0.8486328125,
-0.6884765625,
-0.252685546875,
-0.270263671875,
0.720703125,
0.21337890625,
0.39697265625,
0.1611328125,
-0.24755859375,
-0.330078125,
-0.80615234375,
0.483642578125,
-0.295166015625,
0.763671875,
-0.5322265625,
0.6181640625,
0.383056640625,
-0.5263671875,
0.65966796875,
-0.89599609375,
-0.358154296875,
0.90283203125,
-0.6650390625,
0.95068359375,
-0.8916015625,
0.194580078125,
0.06884765625,
0.1278076171875,
0.701171875,
0.642578125,
0.7373046875,
-0.453125,
-0.60302734375,
-0.2890625,
0.278076171875,
-0.06378173828125,
-0.525390625,
0.144775390625,
-0.2440185546875,
-0.41455078125,
-0.89111328125,
0.41357421875,
0.86083984375,
0.57275390625,
0.3359375,
0.4248046875,
0.1689453125,
0.58740234375,
0.9111328125,
-0.0947265625,
-0.002368927001953125,
-0.7587890625,
1.0380859375,
-0.0124053955078125,
-0.480224609375,
-0.34765625,
-0.33544921875,
-0.312255859375,
0.323974609375,
0.018951416015625,
0.04071044921875,
-0.89208984375,
-0.170654296875,
-0.13720703125,
0.361572265625,
-0.73583984375,
-0.3095703125,
-0.189697265625,
0.425048828125,
0.08111572265625,
-1.017578125,
0.390380859375,
-0.6630859375,
0.927734375,
0.99169921875,
0.0635986328125,
-0.51708984375,
-0.149658203125,
-0.53955078125,
-0.86767578125,
-0.1142578125,
0.58154296875,
-0.12353515625,
0.2261962890625,
-1.2578125,
0.57958984375,
0.3349609375,
-0.088134765625,
0.28466796875,
0.193359375,
0.472900390625,
0.142578125,
0.5234375,
-0.6318359375,
-0.66357421875,
0.419189453125,
-1.1201171875,
0.763671875,
-0.611328125,
0.483154296875,
-0.154541015625,
0.1396484375,
0.1552734375,
0.4560546875,
-0.4775390625,
0.41357421875,
-0.0810546875,
0.3984375,
-1.01171875,
-0.65966796875,
0.51806640625,
-0.1829833984375,
-0.724609375,
0.546875,
0.25244140625,
-0.236083984375,
0.013427734375,
0.5927734375,
-0.466064453125,
0.4443359375,
-0.54736328125,
0.62451171875,
-0.116943359375,
-0.77294921875,
-0.2432861328125,
-0.470458984375,
0.68212890625,
-0.186279296875,
-0.7587890625,
0.220703125,
-1.15625,
-0.250732421875,
0.09710693359375,
-0.49755859375,
0.349365234375,
0.1513671875,
0.1280517578125,
0.09881591796875,
-0.49609375,
-0.36279296875,
-0.1741943359375,
-0.53564453125,
-0.51806640625,
0.337646484375,
0.58984375,
0.6943359375,
0.290283203125,
-0.10791015625,
0.1749267578125,
0.015655517578125,
-0.12200927734375,
-0.58447265625,
-0.354736328125,
0.213134765625,
-0.51220703125,
-0.1392822265625,
0.36181640625,
-0.0020809173583984375,
0.39697265625,
0.8720703125,
-0.055877685546875,
0.2276611328125,
0.348388671875,
-0.5146484375,
1.384765625,
-0.188720703125,
-1.0166015625,
-0.38427734375,
0.2420654296875,
0.060333251953125,
0.607421875,
-0.1727294921875,
-0.7978515625,
-0.6845703125,
-1.1015625,
0.08795166015625,
-0.5263671875,
-0.26171875,
-0.94287109375,
-0.1905517578125,
-0.51123046875,
0.7978515625,
-0.37744140625,
-0.2802734375,
0.340576171875,
-1.2001953125,
0.04998779296875,
-0.59619140625,
-0.41845703125,
-0.56201171875,
-0.5673828125,
-0.623046875,
1.09765625,
0.416015625,
0.1422119140625,
0.421142578125,
-0.34521484375,
0.24853515625,
-0.36669921875,
-0.609375,
-0.495849609375,
-0.280517578125,
0.376953125,
-0.355224609375,
-0.42138671875,
-0.625,
0.8857421875,
-0.54052734375,
0.206787109375,
-0.443603515625,
-0.5341796875,
-0.199462890625,
-0.240478515625,
0.7998046875,
-0.65283203125,
0.1392822265625,
-0.50439453125,
0.68212890625,
0.3701171875,
-0.302001953125,
-0.5234375,
-0.83447265625,
-0.6005859375,
-0.8583984375,
0.65087890625,
-0.552734375,
0.58935546875,
-0.69189453125,
-0.2587890625,
0.900390625,
-0.5205078125,
0.317138671875,
1.3330078125,
-0.2313232421875,
0.213623046875,
-0.84814453125,
0.677734375,
-0.0223541259765625,
-0.64453125,
-0.27685546875,
-0.07952880859375,
-0.9150390625,
0.0960693359375,
-0.63427734375,
-0.896484375,
-0.57373046875,
0.71044921875,
1.466796875,
-0.300537109375,
0.95556640625,
0.2305908203125,
-1.17578125,
-0.7919921875,
0.78857421875,
0.381591796875,
0.56640625,
1.1259765625,
-0.82177734375,
-0.1278076171875,
0.40673828125,
-0.07183837890625,
-0.26416015625,
-0.208984375,
1.056640625,
-0.491455078125,
-0.60302734375,
0.52783203125,
0.57568359375,
-1.111328125,
-0.5341796875,
0.07781982421875,
-0.00972747802734375,
-0.1356201171875,
-0.61669921875,
0.09686279296875,
0.63818359375,
-0.479736328125,
-0.10040283203125,
0.0250244140625,
0.04345703125,
0.634765625,
0.300048828125,
0.30419921875,
-0.51904296875,
0.64306640625,
0.80029296875,
-0.783203125,
-0.37890625,
-0.82958984375,
-0.18505859375,
-0.2322998046875,
0.37353515625,
0.81640625,
0.0882568359375,
0.2191162109375,
0.72021484375,
-0.08892822265625,
0.7138671875,
-0.38818359375,
-0.363037109375,
0.25048828125,
-0.492431640625,
-0.25927734375,
-0.01491546630859375,
0.183349609375,
0.1009521484375,
0.2156982421875,
-0.7021484375,
-0.06610107421875,
0.349853515625,
0.334716796875,
-0.08917236328125,
-0.045318603515625,
-0.325927734375,
-0.58935546875,
-0.413330078125,
-0.5380859375,
-0.765625,
-0.12188720703125,
0.429443359375,
0.367919921875,
-0.73876953125,
0.04022216796875,
0.8408203125,
-0.77880859375,
1.2099609375,
-0.7490234375,
0.325927734375,
-0.43994140625,
-0.09228515625,
-0.78466796875,
0.1318359375,
-0.41796875,
-0.27880859375,
-0.403564453125,
0.5419921875,
0.3779296875,
0.52734375,
-0.1343994140625,
0.1981201171875,
-0.173828125,
-0.81103515625,
-0.06646728515625,
0.049224853515625,
0.0947265625,
0.33251953125,
0.72021484375,
0.52099609375,
0.283203125,
-0.050048828125,
-0.61083984375,
-0.48095703125,
0.12432861328125,
0.94384765625,
0.0238494873046875,
-0.05615234375,
-0.412109375,
0.00319671630859375,
-0.6279296875,
0.261962890625,
-0.2861328125,
-0.09136962890625,
0.09783935546875,
-0.74853515625,
0.505859375,
1.26953125,
-0.09161376953125,
0.177978515625,
-0.0291900634765625,
0.2939453125,
0.386962890625,
0.1669921875,
0.341552734375,
0.1629638671875,
0.1240234375,
-0.2159423828125,
-0.158935546875,
0.6015625,
-0.01273345947265625,
0.4287109375,
-0.2010498046875,
-0.76806640625,
-0.7490234375,
-0.100341796875,
-0.27294921875,
0.042572021484375,
0.59619140625,
-0.8369140625,
-0.06622314453125,
0.087890625,
-0.95166015625,
0.1787109375,
-0.7529296875,
-0.84619140625,
0.0838623046875,
-0.133056640625,
-0.7958984375,
-0.493896484375,
-0.58740234375,
0.037139892578125,
0.1595458984375,
0.5478515625,
-0.7412109375,
0.295654296875,
-0.172119140625,
0.44287109375,
-0.215087890625,
-0.1334228515625,
0.1318359375,
0.291748046875,
-0.470703125,
-0.6533203125,
0.0771484375,
1.4853515625,
0.17919921875,
-0.34912109375,
-0.63037109375,
0.10302734375,
-0.42919921875,
0.3271484375,
-0.2034912109375,
-0.18896484375,
0.01824951171875,
0.435791015625,
-1.181640625,
-0.354248046875,
0.084716796875,
0.286376953125,
-0.021026611328125,
-0.3447265625,
-0.2130126953125,
0.68994140625,
0.982421875,
-0.1396484375,
-0.058502197265625,
0.408935546875,
0.79150390625,
-0.26220703125,
-0.127197265625,
-0.251708984375,
0.30224609375,
0.53076171875,
0.27490234375,
-0.2354736328125,
0.69873046875,
0.93798828125,
-0.33203125,
-0.2208251953125,
0.5380859375,
0.03131103515625,
-0.0085906982421875,
-0.241943359375,
-0.2291259765625,
0.040191650390625,
-0.06988525390625,
-0.84619140625,
0.172607421875,
-0.378662109375,
-0.333251953125,
-0.176513671875,
-0.70849609375,
0.98046875,
-1.1953125,
0.4619140625,
-0.26220703125,
-0.12158203125,
0.399169921875,
0.98046875,
0.05169677734375,
-0.056793212890625,
0.50390625,
0.341552734375,
0.58349609375,
0.8076171875,
0.208984375,
0.154541015625,
-0.3916015625,
0.146484375,
-0.0693359375,
0.006015777587890625,
-0.6806640625,
-0.28125,
-1.1416015625,
0.6298828125,
-0.399169921875,
-0.09930419921875,
0.433837890625,
-0.5341796875,
0.1962890625,
-0.284912109375,
0.7646484375,
-0.38037109375,
0.434814453125,
0.5458984375,
-0.57177734375,
-0.447509765625,
0.84423828125,
-0.1993408203125,
0.38232421875,
0.1937255859375,
0.73828125,
0.34814453125,
1.716796875,
0.32080078125,
-0.2578125,
-0.147705078125,
0.057220458984375,
-0.234375,
-0.60400390625,
-0.38916015625,
-0.37158203125,
-0.119140625,
-0.398193359375,
-0.22998046875,
0.0257110595703125,
0.6533203125,
0.0811767578125,
-0.80615234375,
-0.042236328125,
0.08184814453125,
-0.84521484375,
0.7734375,
0.261474609375,
0.02947998046875,
0.07269287109375,
0.08599853515625,
-0.14208984375,
-0.35009765625,
-0.185791015625,
-0.5927734375,
0.2236328125,
-0.5849609375,
-0.5380859375,
-0.609375,
-1.0380859375,
-0.375732421875,
-0.33203125,
-0.476318359375,
-1.0390625,
0.1490478515625,
0.65185546875,
0.40625,
0.5107421875,
-0.51611328125,
0.397705078125,
1.123046875,
0.71630859375,
-0.351806640625,
0.80810546875,
0.36474609375,
-0.525390625,
0.08441162109375,
-0.0052032470703125,
0.6953125,
-0.33837890625,
-0.0105133056640625,
-0.297607421875,
0.5234375,
-0.9794921875,
-1.3837890625,
0.06396484375,
0.6513671875,
0.50341796875,
-0.54345703125,
-0.9306640625,
-0.401123046875,
-0.74755859375,
-0.046600341796875,
-0.78271484375,
0.6123046875,
0.388671875,
-0.09393310546875,
0.0287017822265625,
-1.0283203125,
4.31640625,
1.0087890625,
0.94677734375,
0.07049560546875,
-0.028228759765625,
0.970703125,
-0.0012559890747070312,
-0.31884765625,
0.1610107421875,
-0.3154296875,
0.7646484375,
-0.215576171875,
-0.088134765625,
0.65087890625,
0.1949462890625,
0.453125,
-0.48486328125,
-0.0171356201171875,
-0.247314453125,
-0.990234375,
-0.7939453125,
0.0758056640625,
0.2432861328125,
0.165283203125,
0.08551025390625,
0.093017578125,
0.57080078125,
-0.626953125,
-0.29052734375,
-0.63525390625,
-0.28369140625,
-0.7109375,
0.666015625,
-0.0755615234375,
-0.1834716796875,
0.50732421875,
0.1470947265625,
-0.62744140625,
0.057891845703125,
0.55517578125,
-0.30810546875,
-0.44873046875,
0.86669921875,
-0.8212890625,
0.197998046875,
0.5556640625,
-0.294677734375,
0.279541015625,
0.62841796875,
-0.421142578125,
0.78076171875,
-0.2249755859375,
0.73193359375,
-0.73681640625,
-0.671875,
0.04107666015625,
0.2283935546875,
-0.33349609375,
0.03997802734375,
0.3427734375,
0.2381591796875,
0.1112060546875,
0.050140380859375,
0.38818359375,
-0.68896484375,
0.68212890625,
0.2008056640625,
0.19287109375,
-0.5341796875,
0.09197998046875,
0.018310546875,
-0.137939453125,
-0.4248046875,
-0.50244140625,
0.57275390625,
0.2161865234375,
-0.0219268798828125,
0.30810546875,
0.471435546875,
-0.78955078125,
0.0018644332885742188,
0.0350341796875,
-0.3779296875,
-0.31396484375,
0.5810546875,
1.5830078125,
-0.75439453125,
-0.423828125,
-0.53466796875,
0.6142578125,
0.183349609375,
0.2802734375,
0.60400390625,
-0.91357421875,
-0.25048828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.
Sergey totally forgot about the task until half an hour before the next lesson and hastily scribbled something down. But then he recollected that in the last lesson he learned the grammar of N-ish. The spelling rules state that N-ish contains some "forbidden" pairs of letters: such letters can never occur in a sentence next to each other. Also, the order of the letters doesn't matter (for example, if the pair of letters "ab" is forbidden, then any occurrences of substrings "ab" and "ba" are also forbidden). Also, each pair has different letters and each letter occurs in no more than one forbidden pair.
Now Sergey wants to correct his sentence so that it doesn't contain any "forbidden" pairs of letters that stand next to each other. However, he is running out of time, so he decided to simply cross out some letters from the sentence. What smallest number of letters will he have to cross out? When a letter is crossed out, it is "removed" so that the letters to its left and right (if they existed), become neighboring. For example, if we cross out the first letter from the string "aba", we get the string "ba", and if we cross out the second letter, we get "aa".
Input
The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105.
The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters.
Next k lines contain descriptions of forbidden pairs of letters. Each line contains exactly two different lowercase Latin letters without separators that represent the forbidden pairs. It is guaranteed that each letter is included in no more than one pair.
Output
Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters.
Examples
Input
ababa
1
ab
Output
2
Input
codeforces
2
do
cs
Output
1
Note
In the first sample you should remove two letters b.
In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution.
Tags: greedy
Correct Solution:
```
#input=__import__('sys').stdin.readline
s = list(input())
k = int(input())
li=[]
for i in range(k):
a = input()
li.append(a)
li.append(a[::-1])
lis=[]
lis.append([s[0],1])
for i in range(1,len(s)):
if s[i]==lis[-1][0]:
lis[-1][1]+=1
else:
lis.append([s[i],1])
#print(lis)
#print(li)
ans=0
i=1
n=len(lis)
while i<n:
if lis[i-1][0]+lis[i][0] in li:
j=i+1
aa=lis[i-1][0]+lis[i][0]
# print(i,lis[i][0])
a1=lis[i-1][1]
a2=lis[i][1]
kk=0
while j<n:
if lis[j][0]==lis[j-2][0]:
if kk%2==0:
a1+=lis[j][1]
else:
a2+=lis[j][1]
kk+=1
else:
break
j+=1
ans+=min(a1,a2)
i=j+1
else:
i+=1
print(ans)
```
| 45,643
|
[
0.291015625,
-0.05596923828125,
0.1292724609375,
0.284912109375,
-0.5634765625,
-0.67431640625,
0.14208984375,
-0.12200927734375,
-0.189208984375,
0.90283203125,
0.8505859375,
-0.01378631591796875,
-0.3876953125,
-0.91552734375,
-0.935546875,
-0.12841796875,
-0.91455078125,
-0.58349609375,
-0.53955078125,
-0.1390380859375,
0.0859375,
-0.15283203125,
-1.6376953125,
-0.293212890625,
-0.37158203125,
1.2021484375,
0.3583984375,
-0.2958984375,
1.162109375,
0.75048828125,
-0.26318359375,
-0.338623046875,
0.5576171875,
-1.1689453125,
-0.6259765625,
-0.51220703125,
0.9462890625,
-0.467041015625,
0.007476806640625,
-0.064208984375,
0.66064453125,
-0.251953125,
0.473388671875,
-0.5341796875,
-1.2958984375,
-0.35791015625,
-0.126953125,
-0.61376953125,
-0.3544921875,
-0.40869140625,
0.332275390625,
-0.334228515625,
0.62109375,
-0.220947265625,
0.07373046875,
0.156494140625,
0.2384033203125,
0.08428955078125,
-0.693359375,
0.411376953125,
0.134765625,
0.374755859375,
0.1448974609375,
-0.75634765625,
-0.421875,
-0.107666015625,
-0.309814453125,
0.202392578125,
-0.00026702880859375,
-0.61181640625,
-0.241455078125,
0.4931640625,
-0.3916015625,
-0.330078125,
-0.673828125,
0.0330810546875,
0.2467041015625,
0.093994140625,
-0.56689453125,
0.8388671875,
0.36865234375,
1.013671875,
0.77001953125,
-0.10443115234375,
-0.35009765625,
-0.129150390625,
0.00772857666015625,
0.378662109375,
0.423828125,
-0.2183837890625,
-0.1893310546875,
0.541015625,
-1.03515625,
-0.166748046875,
0.5908203125,
0.40576171875,
-0.28515625,
0.283447265625,
0.45751953125,
0.44873046875,
0.89892578125,
0.58349609375,
-0.34912109375,
0.82958984375,
-0.5546875,
0.16162109375,
0.0953369140625,
0.1873779296875,
-0.05413818359375,
0.25927734375,
-0.31201171875,
-0.08892822265625,
0.486083984375,
0.458984375,
-0.6806640625,
0.76953125,
-0.276123046875,
0.3896484375,
-0.8388671875,
0.281494140625,
0.7314453125,
-0.06927490234375,
0.84912109375,
0.044891357421875,
0.1920166015625,
-0.2216796875,
-0.6083984375,
1.0673828125,
-0.433837890625,
-0.021942138671875,
0.49365234375,
0.0227508544921875,
-0.06689453125,
0.2044677734375,
-0.32080078125,
0.8076171875,
-0.287353515625,
0.6162109375,
0.55419921875,
-0.6220703125,
0.492431640625,
-0.2286376953125,
-0.053070068359375,
1.4287109375,
0.708984375,
-0.06097412109375,
0.78515625,
0.42822265625,
-0.92724609375,
0.1619873046875,
-1.3056640625,
0.8525390625,
0.14013671875,
0.117919921875,
-0.53369140625,
-0.1455078125,
-0.2314453125,
0.157958984375,
0.06756591796875,
0.2060546875,
-0.46826171875,
0.1510009765625,
-0.310302734375,
0.62744140625,
-0.2587890625,
1.0556640625,
-0.6728515625,
0.01007080078125,
-0.142333984375,
-0.5966796875,
0.19921875,
-0.040008544921875,
0.11669921875,
1.0732421875,
0.1568603515625,
0.8330078125,
0.56884765625,
-0.344482421875,
0.64306640625,
0.4794921875,
-0.10455322265625,
0.48046875,
0.1812744140625,
0.324462890625,
0.521484375,
0.298583984375,
-0.15625,
-0.415283203125,
-0.84716796875,
-0.375,
-0.0113525390625,
0.65673828125,
-0.37353515625,
0.341064453125,
0.047698974609375,
-0.0391845703125,
-1.0478515625,
-0.32666015625,
0.18408203125,
-1.0986328125,
-0.5546875,
0.90283203125,
0.14599609375,
0.74658203125,
-0.202392578125,
-0.626953125,
0.64892578125,
1.4775390625,
-0.3173828125,
0.278564453125,
0.6513671875,
-0.58935546875,
-0.345947265625,
0.45751953125,
-0.1702880859375,
-0.179931640625,
-0.85400390625,
0.72412109375,
-0.53466796875,
-0.0231475830078125,
-0.2080078125,
0.266357421875,
0.2763671875,
0.66015625,
-0.1806640625,
-0.3349609375,
0.84765625,
1.12890625,
0.0369873046875,
0.50390625,
0.197998046875,
0.7021484375,
0.1204833984375,
0.71240234375,
0.412841796875,
0.1494140625,
0.8486328125,
0.916015625,
0.2119140625,
0.52880859375,
-0.2252197265625,
0.44091796875,
0.1973876953125,
0.580078125,
0.440673828125,
0.29052734375,
-0.316162109375,
-0.038177490234375,
-0.3876953125,
0.09185791015625,
-0.252197265625,
0.32080078125,
0.431884765625,
0.432373046875,
-0.29443359375,
-0.13916015625,
0.2066650390625,
0.685546875,
-1.171875,
-0.45703125,
0.045135498046875,
0.1319580078125,
-0.0281219482421875,
0.00022304058074951172,
0.2379150390625,
0.77880859375,
0.70263671875,
0.328857421875,
-0.52783203125,
-0.52783203125,
-1.1328125,
-1.0107421875,
-0.86376953125,
-0.332275390625,
-0.82568359375,
-0.11688232421875,
0.634765625,
-1.0869140625,
0.482177734375,
-0.2861328125,
-0.5302734375,
0.1619873046875,
-0.578125,
0.6025390625,
-0.2027587890625,
0.80029296875,
-0.755859375,
0.73291015625,
0.034820556640625,
0.90234375,
-0.287841796875,
-0.3671875,
-0.047760009765625,
-0.61767578125,
0.251953125,
-0.0189208984375,
0.3017578125,
0.1771240234375,
-0.6533203125,
-0.7646484375,
0.032501220703125,
-0.308349609375,
-0.57861328125,
0.215087890625,
-0.7529296875,
0.7294921875,
0.93994140625,
-0.66845703125,
0.77392578125,
1.1220703125,
-0.94921875,
0.0287628173828125,
0.1856689453125,
0.2998046875,
-0.615234375,
1.189453125,
0.29052734375,
0.3974609375,
-0.5205078125,
-0.51220703125,
-0.755859375,
0.0966796875,
-0.03570556640625,
-0.354736328125,
-0.09564208984375,
0.75634765625,
-0.267333984375,
-0.994140625,
0.75341796875,
-1.1796875,
-0.10711669921875,
-0.1295166015625,
-0.489501953125,
0.95068359375,
0.342529296875,
0.354736328125,
-0.288330078125,
-0.818359375,
-0.25146484375,
0.82421875,
0.1776123046875,
-0.521484375,
-0.0372314453125,
0.2440185546875,
0.1773681640625,
0.150634765625,
0.12078857421875,
-0.232421875,
-0.3251953125,
0.070068359375,
0.221923828125,
0.92333984375,
0.2998046875,
0.3857421875,
0.365234375,
0.8486328125,
-0.6884765625,
-0.252685546875,
-0.270263671875,
0.720703125,
0.21337890625,
0.39697265625,
0.1611328125,
-0.24755859375,
-0.330078125,
-0.80615234375,
0.483642578125,
-0.295166015625,
0.763671875,
-0.5322265625,
0.6181640625,
0.383056640625,
-0.5263671875,
0.65966796875,
-0.89599609375,
-0.358154296875,
0.90283203125,
-0.6650390625,
0.95068359375,
-0.8916015625,
0.194580078125,
0.06884765625,
0.1278076171875,
0.701171875,
0.642578125,
0.7373046875,
-0.453125,
-0.60302734375,
-0.2890625,
0.278076171875,
-0.06378173828125,
-0.525390625,
0.144775390625,
-0.2440185546875,
-0.41455078125,
-0.89111328125,
0.41357421875,
0.86083984375,
0.57275390625,
0.3359375,
0.4248046875,
0.1689453125,
0.58740234375,
0.9111328125,
-0.0947265625,
-0.002368927001953125,
-0.7587890625,
1.0380859375,
-0.0124053955078125,
-0.480224609375,
-0.34765625,
-0.33544921875,
-0.312255859375,
0.323974609375,
0.018951416015625,
0.04071044921875,
-0.89208984375,
-0.170654296875,
-0.13720703125,
0.361572265625,
-0.73583984375,
-0.3095703125,
-0.189697265625,
0.425048828125,
0.08111572265625,
-1.017578125,
0.390380859375,
-0.6630859375,
0.927734375,
0.99169921875,
0.0635986328125,
-0.51708984375,
-0.149658203125,
-0.53955078125,
-0.86767578125,
-0.1142578125,
0.58154296875,
-0.12353515625,
0.2261962890625,
-1.2578125,
0.57958984375,
0.3349609375,
-0.088134765625,
0.28466796875,
0.193359375,
0.472900390625,
0.142578125,
0.5234375,
-0.6318359375,
-0.66357421875,
0.419189453125,
-1.1201171875,
0.763671875,
-0.611328125,
0.483154296875,
-0.154541015625,
0.1396484375,
0.1552734375,
0.4560546875,
-0.4775390625,
0.41357421875,
-0.0810546875,
0.3984375,
-1.01171875,
-0.65966796875,
0.51806640625,
-0.1829833984375,
-0.724609375,
0.546875,
0.25244140625,
-0.236083984375,
0.013427734375,
0.5927734375,
-0.466064453125,
0.4443359375,
-0.54736328125,
0.62451171875,
-0.116943359375,
-0.77294921875,
-0.2432861328125,
-0.470458984375,
0.68212890625,
-0.186279296875,
-0.7587890625,
0.220703125,
-1.15625,
-0.250732421875,
0.09710693359375,
-0.49755859375,
0.349365234375,
0.1513671875,
0.1280517578125,
0.09881591796875,
-0.49609375,
-0.36279296875,
-0.1741943359375,
-0.53564453125,
-0.51806640625,
0.337646484375,
0.58984375,
0.6943359375,
0.290283203125,
-0.10791015625,
0.1749267578125,
0.015655517578125,
-0.12200927734375,
-0.58447265625,
-0.354736328125,
0.213134765625,
-0.51220703125,
-0.1392822265625,
0.36181640625,
-0.0020809173583984375,
0.39697265625,
0.8720703125,
-0.055877685546875,
0.2276611328125,
0.348388671875,
-0.5146484375,
1.384765625,
-0.188720703125,
-1.0166015625,
-0.38427734375,
0.2420654296875,
0.060333251953125,
0.607421875,
-0.1727294921875,
-0.7978515625,
-0.6845703125,
-1.1015625,
0.08795166015625,
-0.5263671875,
-0.26171875,
-0.94287109375,
-0.1905517578125,
-0.51123046875,
0.7978515625,
-0.37744140625,
-0.2802734375,
0.340576171875,
-1.2001953125,
0.04998779296875,
-0.59619140625,
-0.41845703125,
-0.56201171875,
-0.5673828125,
-0.623046875,
1.09765625,
0.416015625,
0.1422119140625,
0.421142578125,
-0.34521484375,
0.24853515625,
-0.36669921875,
-0.609375,
-0.495849609375,
-0.280517578125,
0.376953125,
-0.355224609375,
-0.42138671875,
-0.625,
0.8857421875,
-0.54052734375,
0.206787109375,
-0.443603515625,
-0.5341796875,
-0.199462890625,
-0.240478515625,
0.7998046875,
-0.65283203125,
0.1392822265625,
-0.50439453125,
0.68212890625,
0.3701171875,
-0.302001953125,
-0.5234375,
-0.83447265625,
-0.6005859375,
-0.8583984375,
0.65087890625,
-0.552734375,
0.58935546875,
-0.69189453125,
-0.2587890625,
0.900390625,
-0.5205078125,
0.317138671875,
1.3330078125,
-0.2313232421875,
0.213623046875,
-0.84814453125,
0.677734375,
-0.0223541259765625,
-0.64453125,
-0.27685546875,
-0.07952880859375,
-0.9150390625,
0.0960693359375,
-0.63427734375,
-0.896484375,
-0.57373046875,
0.71044921875,
1.466796875,
-0.300537109375,
0.95556640625,
0.2305908203125,
-1.17578125,
-0.7919921875,
0.78857421875,
0.381591796875,
0.56640625,
1.1259765625,
-0.82177734375,
-0.1278076171875,
0.40673828125,
-0.07183837890625,
-0.26416015625,
-0.208984375,
1.056640625,
-0.491455078125,
-0.60302734375,
0.52783203125,
0.57568359375,
-1.111328125,
-0.5341796875,
0.07781982421875,
-0.00972747802734375,
-0.1356201171875,
-0.61669921875,
0.09686279296875,
0.63818359375,
-0.479736328125,
-0.10040283203125,
0.0250244140625,
0.04345703125,
0.634765625,
0.300048828125,
0.30419921875,
-0.51904296875,
0.64306640625,
0.80029296875,
-0.783203125,
-0.37890625,
-0.82958984375,
-0.18505859375,
-0.2322998046875,
0.37353515625,
0.81640625,
0.0882568359375,
0.2191162109375,
0.72021484375,
-0.08892822265625,
0.7138671875,
-0.38818359375,
-0.363037109375,
0.25048828125,
-0.492431640625,
-0.25927734375,
-0.01491546630859375,
0.183349609375,
0.1009521484375,
0.2156982421875,
-0.7021484375,
-0.06610107421875,
0.349853515625,
0.334716796875,
-0.08917236328125,
-0.045318603515625,
-0.325927734375,
-0.58935546875,
-0.413330078125,
-0.5380859375,
-0.765625,
-0.12188720703125,
0.429443359375,
0.367919921875,
-0.73876953125,
0.04022216796875,
0.8408203125,
-0.77880859375,
1.2099609375,
-0.7490234375,
0.325927734375,
-0.43994140625,
-0.09228515625,
-0.78466796875,
0.1318359375,
-0.41796875,
-0.27880859375,
-0.403564453125,
0.5419921875,
0.3779296875,
0.52734375,
-0.1343994140625,
0.1981201171875,
-0.173828125,
-0.81103515625,
-0.06646728515625,
0.049224853515625,
0.0947265625,
0.33251953125,
0.72021484375,
0.52099609375,
0.283203125,
-0.050048828125,
-0.61083984375,
-0.48095703125,
0.12432861328125,
0.94384765625,
0.0238494873046875,
-0.05615234375,
-0.412109375,
0.00319671630859375,
-0.6279296875,
0.261962890625,
-0.2861328125,
-0.09136962890625,
0.09783935546875,
-0.74853515625,
0.505859375,
1.26953125,
-0.09161376953125,
0.177978515625,
-0.0291900634765625,
0.2939453125,
0.386962890625,
0.1669921875,
0.341552734375,
0.1629638671875,
0.1240234375,
-0.2159423828125,
-0.158935546875,
0.6015625,
-0.01273345947265625,
0.4287109375,
-0.2010498046875,
-0.76806640625,
-0.7490234375,
-0.100341796875,
-0.27294921875,
0.042572021484375,
0.59619140625,
-0.8369140625,
-0.06622314453125,
0.087890625,
-0.95166015625,
0.1787109375,
-0.7529296875,
-0.84619140625,
0.0838623046875,
-0.133056640625,
-0.7958984375,
-0.493896484375,
-0.58740234375,
0.037139892578125,
0.1595458984375,
0.5478515625,
-0.7412109375,
0.295654296875,
-0.172119140625,
0.44287109375,
-0.215087890625,
-0.1334228515625,
0.1318359375,
0.291748046875,
-0.470703125,
-0.6533203125,
0.0771484375,
1.4853515625,
0.17919921875,
-0.34912109375,
-0.63037109375,
0.10302734375,
-0.42919921875,
0.3271484375,
-0.2034912109375,
-0.18896484375,
0.01824951171875,
0.435791015625,
-1.181640625,
-0.354248046875,
0.084716796875,
0.286376953125,
-0.021026611328125,
-0.3447265625,
-0.2130126953125,
0.68994140625,
0.982421875,
-0.1396484375,
-0.058502197265625,
0.408935546875,
0.79150390625,
-0.26220703125,
-0.127197265625,
-0.251708984375,
0.30224609375,
0.53076171875,
0.27490234375,
-0.2354736328125,
0.69873046875,
0.93798828125,
-0.33203125,
-0.2208251953125,
0.5380859375,
0.03131103515625,
-0.0085906982421875,
-0.241943359375,
-0.2291259765625,
0.040191650390625,
-0.06988525390625,
-0.84619140625,
0.172607421875,
-0.378662109375,
-0.333251953125,
-0.176513671875,
-0.70849609375,
0.98046875,
-1.1953125,
0.4619140625,
-0.26220703125,
-0.12158203125,
0.399169921875,
0.98046875,
0.05169677734375,
-0.056793212890625,
0.50390625,
0.341552734375,
0.58349609375,
0.8076171875,
0.208984375,
0.154541015625,
-0.3916015625,
0.146484375,
-0.0693359375,
0.006015777587890625,
-0.6806640625,
-0.28125,
-1.1416015625,
0.6298828125,
-0.399169921875,
-0.09930419921875,
0.433837890625,
-0.5341796875,
0.1962890625,
-0.284912109375,
0.7646484375,
-0.38037109375,
0.434814453125,
0.5458984375,
-0.57177734375,
-0.447509765625,
0.84423828125,
-0.1993408203125,
0.38232421875,
0.1937255859375,
0.73828125,
0.34814453125,
1.716796875,
0.32080078125,
-0.2578125,
-0.147705078125,
0.057220458984375,
-0.234375,
-0.60400390625,
-0.38916015625,
-0.37158203125,
-0.119140625,
-0.398193359375,
-0.22998046875,
0.0257110595703125,
0.6533203125,
0.0811767578125,
-0.80615234375,
-0.042236328125,
0.08184814453125,
-0.84521484375,
0.7734375,
0.261474609375,
0.02947998046875,
0.07269287109375,
0.08599853515625,
-0.14208984375,
-0.35009765625,
-0.185791015625,
-0.5927734375,
0.2236328125,
-0.5849609375,
-0.5380859375,
-0.609375,
-1.0380859375,
-0.375732421875,
-0.33203125,
-0.476318359375,
-1.0390625,
0.1490478515625,
0.65185546875,
0.40625,
0.5107421875,
-0.51611328125,
0.397705078125,
1.123046875,
0.71630859375,
-0.351806640625,
0.80810546875,
0.36474609375,
-0.525390625,
0.08441162109375,
-0.0052032470703125,
0.6953125,
-0.33837890625,
-0.0105133056640625,
-0.297607421875,
0.5234375,
-0.9794921875,
-1.3837890625,
0.06396484375,
0.6513671875,
0.50341796875,
-0.54345703125,
-0.9306640625,
-0.401123046875,
-0.74755859375,
-0.046600341796875,
-0.78271484375,
0.6123046875,
0.388671875,
-0.09393310546875,
0.0287017822265625,
-1.0283203125,
4.31640625,
1.0087890625,
0.94677734375,
0.07049560546875,
-0.028228759765625,
0.970703125,
-0.0012559890747070312,
-0.31884765625,
0.1610107421875,
-0.3154296875,
0.7646484375,
-0.215576171875,
-0.088134765625,
0.65087890625,
0.1949462890625,
0.453125,
-0.48486328125,
-0.0171356201171875,
-0.247314453125,
-0.990234375,
-0.7939453125,
0.0758056640625,
0.2432861328125,
0.165283203125,
0.08551025390625,
0.093017578125,
0.57080078125,
-0.626953125,
-0.29052734375,
-0.63525390625,
-0.28369140625,
-0.7109375,
0.666015625,
-0.0755615234375,
-0.1834716796875,
0.50732421875,
0.1470947265625,
-0.62744140625,
0.057891845703125,
0.55517578125,
-0.30810546875,
-0.44873046875,
0.86669921875,
-0.8212890625,
0.197998046875,
0.5556640625,
-0.294677734375,
0.279541015625,
0.62841796875,
-0.421142578125,
0.78076171875,
-0.2249755859375,
0.73193359375,
-0.73681640625,
-0.671875,
0.04107666015625,
0.2283935546875,
-0.33349609375,
0.03997802734375,
0.3427734375,
0.2381591796875,
0.1112060546875,
0.050140380859375,
0.38818359375,
-0.68896484375,
0.68212890625,
0.2008056640625,
0.19287109375,
-0.5341796875,
0.09197998046875,
0.018310546875,
-0.137939453125,
-0.4248046875,
-0.50244140625,
0.57275390625,
0.2161865234375,
-0.0219268798828125,
0.30810546875,
0.471435546875,
-0.78955078125,
0.0018644332885742188,
0.0350341796875,
-0.3779296875,
-0.31396484375,
0.5810546875,
1.5830078125,
-0.75439453125,
-0.423828125,
-0.53466796875,
0.6142578125,
0.183349609375,
0.2802734375,
0.60400390625,
-0.91357421875,
-0.25048828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.
Sergey totally forgot about the task until half an hour before the next lesson and hastily scribbled something down. But then he recollected that in the last lesson he learned the grammar of N-ish. The spelling rules state that N-ish contains some "forbidden" pairs of letters: such letters can never occur in a sentence next to each other. Also, the order of the letters doesn't matter (for example, if the pair of letters "ab" is forbidden, then any occurrences of substrings "ab" and "ba" are also forbidden). Also, each pair has different letters and each letter occurs in no more than one forbidden pair.
Now Sergey wants to correct his sentence so that it doesn't contain any "forbidden" pairs of letters that stand next to each other. However, he is running out of time, so he decided to simply cross out some letters from the sentence. What smallest number of letters will he have to cross out? When a letter is crossed out, it is "removed" so that the letters to its left and right (if they existed), become neighboring. For example, if we cross out the first letter from the string "aba", we get the string "ba", and if we cross out the second letter, we get "aa".
Input
The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105.
The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters.
Next k lines contain descriptions of forbidden pairs of letters. Each line contains exactly two different lowercase Latin letters without separators that represent the forbidden pairs. It is guaranteed that each letter is included in no more than one pair.
Output
Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters.
Examples
Input
ababa
1
ab
Output
2
Input
codeforces
2
do
cs
Output
1
Note
In the first sample you should remove two letters b.
In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution.
Tags: greedy
Correct Solution:
```
s = input()
l = []
n = int(input())
for i in range(n):
m = input()
l.append((m[0], m[1]))
# print(l[i/ ])
ans = 0
for i in range(n):
a, b = l[i][0], l[i][1]
# b = m[i][1]
streak = 0
c = 0
d = 0
for j in range(len(s)):
if(s[j] == a or s[j] == b):
streak = 1
if(s[j] == a):
c += 1
else:
d += 1
else:
streak = 0
ans += min(c, d)
c = 0
d = 0
if(streak == 1):
ans += min(c, d)
print(ans)
```
| 45,644
|
[
0.291015625,
-0.05596923828125,
0.1292724609375,
0.284912109375,
-0.5634765625,
-0.67431640625,
0.14208984375,
-0.12200927734375,
-0.189208984375,
0.90283203125,
0.8505859375,
-0.01378631591796875,
-0.3876953125,
-0.91552734375,
-0.935546875,
-0.12841796875,
-0.91455078125,
-0.58349609375,
-0.53955078125,
-0.1390380859375,
0.0859375,
-0.15283203125,
-1.6376953125,
-0.293212890625,
-0.37158203125,
1.2021484375,
0.3583984375,
-0.2958984375,
1.162109375,
0.75048828125,
-0.26318359375,
-0.338623046875,
0.5576171875,
-1.1689453125,
-0.6259765625,
-0.51220703125,
0.9462890625,
-0.467041015625,
0.007476806640625,
-0.064208984375,
0.66064453125,
-0.251953125,
0.473388671875,
-0.5341796875,
-1.2958984375,
-0.35791015625,
-0.126953125,
-0.61376953125,
-0.3544921875,
-0.40869140625,
0.332275390625,
-0.334228515625,
0.62109375,
-0.220947265625,
0.07373046875,
0.156494140625,
0.2384033203125,
0.08428955078125,
-0.693359375,
0.411376953125,
0.134765625,
0.374755859375,
0.1448974609375,
-0.75634765625,
-0.421875,
-0.107666015625,
-0.309814453125,
0.202392578125,
-0.00026702880859375,
-0.61181640625,
-0.241455078125,
0.4931640625,
-0.3916015625,
-0.330078125,
-0.673828125,
0.0330810546875,
0.2467041015625,
0.093994140625,
-0.56689453125,
0.8388671875,
0.36865234375,
1.013671875,
0.77001953125,
-0.10443115234375,
-0.35009765625,
-0.129150390625,
0.00772857666015625,
0.378662109375,
0.423828125,
-0.2183837890625,
-0.1893310546875,
0.541015625,
-1.03515625,
-0.166748046875,
0.5908203125,
0.40576171875,
-0.28515625,
0.283447265625,
0.45751953125,
0.44873046875,
0.89892578125,
0.58349609375,
-0.34912109375,
0.82958984375,
-0.5546875,
0.16162109375,
0.0953369140625,
0.1873779296875,
-0.05413818359375,
0.25927734375,
-0.31201171875,
-0.08892822265625,
0.486083984375,
0.458984375,
-0.6806640625,
0.76953125,
-0.276123046875,
0.3896484375,
-0.8388671875,
0.281494140625,
0.7314453125,
-0.06927490234375,
0.84912109375,
0.044891357421875,
0.1920166015625,
-0.2216796875,
-0.6083984375,
1.0673828125,
-0.433837890625,
-0.021942138671875,
0.49365234375,
0.0227508544921875,
-0.06689453125,
0.2044677734375,
-0.32080078125,
0.8076171875,
-0.287353515625,
0.6162109375,
0.55419921875,
-0.6220703125,
0.492431640625,
-0.2286376953125,
-0.053070068359375,
1.4287109375,
0.708984375,
-0.06097412109375,
0.78515625,
0.42822265625,
-0.92724609375,
0.1619873046875,
-1.3056640625,
0.8525390625,
0.14013671875,
0.117919921875,
-0.53369140625,
-0.1455078125,
-0.2314453125,
0.157958984375,
0.06756591796875,
0.2060546875,
-0.46826171875,
0.1510009765625,
-0.310302734375,
0.62744140625,
-0.2587890625,
1.0556640625,
-0.6728515625,
0.01007080078125,
-0.142333984375,
-0.5966796875,
0.19921875,
-0.040008544921875,
0.11669921875,
1.0732421875,
0.1568603515625,
0.8330078125,
0.56884765625,
-0.344482421875,
0.64306640625,
0.4794921875,
-0.10455322265625,
0.48046875,
0.1812744140625,
0.324462890625,
0.521484375,
0.298583984375,
-0.15625,
-0.415283203125,
-0.84716796875,
-0.375,
-0.0113525390625,
0.65673828125,
-0.37353515625,
0.341064453125,
0.047698974609375,
-0.0391845703125,
-1.0478515625,
-0.32666015625,
0.18408203125,
-1.0986328125,
-0.5546875,
0.90283203125,
0.14599609375,
0.74658203125,
-0.202392578125,
-0.626953125,
0.64892578125,
1.4775390625,
-0.3173828125,
0.278564453125,
0.6513671875,
-0.58935546875,
-0.345947265625,
0.45751953125,
-0.1702880859375,
-0.179931640625,
-0.85400390625,
0.72412109375,
-0.53466796875,
-0.0231475830078125,
-0.2080078125,
0.266357421875,
0.2763671875,
0.66015625,
-0.1806640625,
-0.3349609375,
0.84765625,
1.12890625,
0.0369873046875,
0.50390625,
0.197998046875,
0.7021484375,
0.1204833984375,
0.71240234375,
0.412841796875,
0.1494140625,
0.8486328125,
0.916015625,
0.2119140625,
0.52880859375,
-0.2252197265625,
0.44091796875,
0.1973876953125,
0.580078125,
0.440673828125,
0.29052734375,
-0.316162109375,
-0.038177490234375,
-0.3876953125,
0.09185791015625,
-0.252197265625,
0.32080078125,
0.431884765625,
0.432373046875,
-0.29443359375,
-0.13916015625,
0.2066650390625,
0.685546875,
-1.171875,
-0.45703125,
0.045135498046875,
0.1319580078125,
-0.0281219482421875,
0.00022304058074951172,
0.2379150390625,
0.77880859375,
0.70263671875,
0.328857421875,
-0.52783203125,
-0.52783203125,
-1.1328125,
-1.0107421875,
-0.86376953125,
-0.332275390625,
-0.82568359375,
-0.11688232421875,
0.634765625,
-1.0869140625,
0.482177734375,
-0.2861328125,
-0.5302734375,
0.1619873046875,
-0.578125,
0.6025390625,
-0.2027587890625,
0.80029296875,
-0.755859375,
0.73291015625,
0.034820556640625,
0.90234375,
-0.287841796875,
-0.3671875,
-0.047760009765625,
-0.61767578125,
0.251953125,
-0.0189208984375,
0.3017578125,
0.1771240234375,
-0.6533203125,
-0.7646484375,
0.032501220703125,
-0.308349609375,
-0.57861328125,
0.215087890625,
-0.7529296875,
0.7294921875,
0.93994140625,
-0.66845703125,
0.77392578125,
1.1220703125,
-0.94921875,
0.0287628173828125,
0.1856689453125,
0.2998046875,
-0.615234375,
1.189453125,
0.29052734375,
0.3974609375,
-0.5205078125,
-0.51220703125,
-0.755859375,
0.0966796875,
-0.03570556640625,
-0.354736328125,
-0.09564208984375,
0.75634765625,
-0.267333984375,
-0.994140625,
0.75341796875,
-1.1796875,
-0.10711669921875,
-0.1295166015625,
-0.489501953125,
0.95068359375,
0.342529296875,
0.354736328125,
-0.288330078125,
-0.818359375,
-0.25146484375,
0.82421875,
0.1776123046875,
-0.521484375,
-0.0372314453125,
0.2440185546875,
0.1773681640625,
0.150634765625,
0.12078857421875,
-0.232421875,
-0.3251953125,
0.070068359375,
0.221923828125,
0.92333984375,
0.2998046875,
0.3857421875,
0.365234375,
0.8486328125,
-0.6884765625,
-0.252685546875,
-0.270263671875,
0.720703125,
0.21337890625,
0.39697265625,
0.1611328125,
-0.24755859375,
-0.330078125,
-0.80615234375,
0.483642578125,
-0.295166015625,
0.763671875,
-0.5322265625,
0.6181640625,
0.383056640625,
-0.5263671875,
0.65966796875,
-0.89599609375,
-0.358154296875,
0.90283203125,
-0.6650390625,
0.95068359375,
-0.8916015625,
0.194580078125,
0.06884765625,
0.1278076171875,
0.701171875,
0.642578125,
0.7373046875,
-0.453125,
-0.60302734375,
-0.2890625,
0.278076171875,
-0.06378173828125,
-0.525390625,
0.144775390625,
-0.2440185546875,
-0.41455078125,
-0.89111328125,
0.41357421875,
0.86083984375,
0.57275390625,
0.3359375,
0.4248046875,
0.1689453125,
0.58740234375,
0.9111328125,
-0.0947265625,
-0.002368927001953125,
-0.7587890625,
1.0380859375,
-0.0124053955078125,
-0.480224609375,
-0.34765625,
-0.33544921875,
-0.312255859375,
0.323974609375,
0.018951416015625,
0.04071044921875,
-0.89208984375,
-0.170654296875,
-0.13720703125,
0.361572265625,
-0.73583984375,
-0.3095703125,
-0.189697265625,
0.425048828125,
0.08111572265625,
-1.017578125,
0.390380859375,
-0.6630859375,
0.927734375,
0.99169921875,
0.0635986328125,
-0.51708984375,
-0.149658203125,
-0.53955078125,
-0.86767578125,
-0.1142578125,
0.58154296875,
-0.12353515625,
0.2261962890625,
-1.2578125,
0.57958984375,
0.3349609375,
-0.088134765625,
0.28466796875,
0.193359375,
0.472900390625,
0.142578125,
0.5234375,
-0.6318359375,
-0.66357421875,
0.419189453125,
-1.1201171875,
0.763671875,
-0.611328125,
0.483154296875,
-0.154541015625,
0.1396484375,
0.1552734375,
0.4560546875,
-0.4775390625,
0.41357421875,
-0.0810546875,
0.3984375,
-1.01171875,
-0.65966796875,
0.51806640625,
-0.1829833984375,
-0.724609375,
0.546875,
0.25244140625,
-0.236083984375,
0.013427734375,
0.5927734375,
-0.466064453125,
0.4443359375,
-0.54736328125,
0.62451171875,
-0.116943359375,
-0.77294921875,
-0.2432861328125,
-0.470458984375,
0.68212890625,
-0.186279296875,
-0.7587890625,
0.220703125,
-1.15625,
-0.250732421875,
0.09710693359375,
-0.49755859375,
0.349365234375,
0.1513671875,
0.1280517578125,
0.09881591796875,
-0.49609375,
-0.36279296875,
-0.1741943359375,
-0.53564453125,
-0.51806640625,
0.337646484375,
0.58984375,
0.6943359375,
0.290283203125,
-0.10791015625,
0.1749267578125,
0.015655517578125,
-0.12200927734375,
-0.58447265625,
-0.354736328125,
0.213134765625,
-0.51220703125,
-0.1392822265625,
0.36181640625,
-0.0020809173583984375,
0.39697265625,
0.8720703125,
-0.055877685546875,
0.2276611328125,
0.348388671875,
-0.5146484375,
1.384765625,
-0.188720703125,
-1.0166015625,
-0.38427734375,
0.2420654296875,
0.060333251953125,
0.607421875,
-0.1727294921875,
-0.7978515625,
-0.6845703125,
-1.1015625,
0.08795166015625,
-0.5263671875,
-0.26171875,
-0.94287109375,
-0.1905517578125,
-0.51123046875,
0.7978515625,
-0.37744140625,
-0.2802734375,
0.340576171875,
-1.2001953125,
0.04998779296875,
-0.59619140625,
-0.41845703125,
-0.56201171875,
-0.5673828125,
-0.623046875,
1.09765625,
0.416015625,
0.1422119140625,
0.421142578125,
-0.34521484375,
0.24853515625,
-0.36669921875,
-0.609375,
-0.495849609375,
-0.280517578125,
0.376953125,
-0.355224609375,
-0.42138671875,
-0.625,
0.8857421875,
-0.54052734375,
0.206787109375,
-0.443603515625,
-0.5341796875,
-0.199462890625,
-0.240478515625,
0.7998046875,
-0.65283203125,
0.1392822265625,
-0.50439453125,
0.68212890625,
0.3701171875,
-0.302001953125,
-0.5234375,
-0.83447265625,
-0.6005859375,
-0.8583984375,
0.65087890625,
-0.552734375,
0.58935546875,
-0.69189453125,
-0.2587890625,
0.900390625,
-0.5205078125,
0.317138671875,
1.3330078125,
-0.2313232421875,
0.213623046875,
-0.84814453125,
0.677734375,
-0.0223541259765625,
-0.64453125,
-0.27685546875,
-0.07952880859375,
-0.9150390625,
0.0960693359375,
-0.63427734375,
-0.896484375,
-0.57373046875,
0.71044921875,
1.466796875,
-0.300537109375,
0.95556640625,
0.2305908203125,
-1.17578125,
-0.7919921875,
0.78857421875,
0.381591796875,
0.56640625,
1.1259765625,
-0.82177734375,
-0.1278076171875,
0.40673828125,
-0.07183837890625,
-0.26416015625,
-0.208984375,
1.056640625,
-0.491455078125,
-0.60302734375,
0.52783203125,
0.57568359375,
-1.111328125,
-0.5341796875,
0.07781982421875,
-0.00972747802734375,
-0.1356201171875,
-0.61669921875,
0.09686279296875,
0.63818359375,
-0.479736328125,
-0.10040283203125,
0.0250244140625,
0.04345703125,
0.634765625,
0.300048828125,
0.30419921875,
-0.51904296875,
0.64306640625,
0.80029296875,
-0.783203125,
-0.37890625,
-0.82958984375,
-0.18505859375,
-0.2322998046875,
0.37353515625,
0.81640625,
0.0882568359375,
0.2191162109375,
0.72021484375,
-0.08892822265625,
0.7138671875,
-0.38818359375,
-0.363037109375,
0.25048828125,
-0.492431640625,
-0.25927734375,
-0.01491546630859375,
0.183349609375,
0.1009521484375,
0.2156982421875,
-0.7021484375,
-0.06610107421875,
0.349853515625,
0.334716796875,
-0.08917236328125,
-0.045318603515625,
-0.325927734375,
-0.58935546875,
-0.413330078125,
-0.5380859375,
-0.765625,
-0.12188720703125,
0.429443359375,
0.367919921875,
-0.73876953125,
0.04022216796875,
0.8408203125,
-0.77880859375,
1.2099609375,
-0.7490234375,
0.325927734375,
-0.43994140625,
-0.09228515625,
-0.78466796875,
0.1318359375,
-0.41796875,
-0.27880859375,
-0.403564453125,
0.5419921875,
0.3779296875,
0.52734375,
-0.1343994140625,
0.1981201171875,
-0.173828125,
-0.81103515625,
-0.06646728515625,
0.049224853515625,
0.0947265625,
0.33251953125,
0.72021484375,
0.52099609375,
0.283203125,
-0.050048828125,
-0.61083984375,
-0.48095703125,
0.12432861328125,
0.94384765625,
0.0238494873046875,
-0.05615234375,
-0.412109375,
0.00319671630859375,
-0.6279296875,
0.261962890625,
-0.2861328125,
-0.09136962890625,
0.09783935546875,
-0.74853515625,
0.505859375,
1.26953125,
-0.09161376953125,
0.177978515625,
-0.0291900634765625,
0.2939453125,
0.386962890625,
0.1669921875,
0.341552734375,
0.1629638671875,
0.1240234375,
-0.2159423828125,
-0.158935546875,
0.6015625,
-0.01273345947265625,
0.4287109375,
-0.2010498046875,
-0.76806640625,
-0.7490234375,
-0.100341796875,
-0.27294921875,
0.042572021484375,
0.59619140625,
-0.8369140625,
-0.06622314453125,
0.087890625,
-0.95166015625,
0.1787109375,
-0.7529296875,
-0.84619140625,
0.0838623046875,
-0.133056640625,
-0.7958984375,
-0.493896484375,
-0.58740234375,
0.037139892578125,
0.1595458984375,
0.5478515625,
-0.7412109375,
0.295654296875,
-0.172119140625,
0.44287109375,
-0.215087890625,
-0.1334228515625,
0.1318359375,
0.291748046875,
-0.470703125,
-0.6533203125,
0.0771484375,
1.4853515625,
0.17919921875,
-0.34912109375,
-0.63037109375,
0.10302734375,
-0.42919921875,
0.3271484375,
-0.2034912109375,
-0.18896484375,
0.01824951171875,
0.435791015625,
-1.181640625,
-0.354248046875,
0.084716796875,
0.286376953125,
-0.021026611328125,
-0.3447265625,
-0.2130126953125,
0.68994140625,
0.982421875,
-0.1396484375,
-0.058502197265625,
0.408935546875,
0.79150390625,
-0.26220703125,
-0.127197265625,
-0.251708984375,
0.30224609375,
0.53076171875,
0.27490234375,
-0.2354736328125,
0.69873046875,
0.93798828125,
-0.33203125,
-0.2208251953125,
0.5380859375,
0.03131103515625,
-0.0085906982421875,
-0.241943359375,
-0.2291259765625,
0.040191650390625,
-0.06988525390625,
-0.84619140625,
0.172607421875,
-0.378662109375,
-0.333251953125,
-0.176513671875,
-0.70849609375,
0.98046875,
-1.1953125,
0.4619140625,
-0.26220703125,
-0.12158203125,
0.399169921875,
0.98046875,
0.05169677734375,
-0.056793212890625,
0.50390625,
0.341552734375,
0.58349609375,
0.8076171875,
0.208984375,
0.154541015625,
-0.3916015625,
0.146484375,
-0.0693359375,
0.006015777587890625,
-0.6806640625,
-0.28125,
-1.1416015625,
0.6298828125,
-0.399169921875,
-0.09930419921875,
0.433837890625,
-0.5341796875,
0.1962890625,
-0.284912109375,
0.7646484375,
-0.38037109375,
0.434814453125,
0.5458984375,
-0.57177734375,
-0.447509765625,
0.84423828125,
-0.1993408203125,
0.38232421875,
0.1937255859375,
0.73828125,
0.34814453125,
1.716796875,
0.32080078125,
-0.2578125,
-0.147705078125,
0.057220458984375,
-0.234375,
-0.60400390625,
-0.38916015625,
-0.37158203125,
-0.119140625,
-0.398193359375,
-0.22998046875,
0.0257110595703125,
0.6533203125,
0.0811767578125,
-0.80615234375,
-0.042236328125,
0.08184814453125,
-0.84521484375,
0.7734375,
0.261474609375,
0.02947998046875,
0.07269287109375,
0.08599853515625,
-0.14208984375,
-0.35009765625,
-0.185791015625,
-0.5927734375,
0.2236328125,
-0.5849609375,
-0.5380859375,
-0.609375,
-1.0380859375,
-0.375732421875,
-0.33203125,
-0.476318359375,
-1.0390625,
0.1490478515625,
0.65185546875,
0.40625,
0.5107421875,
-0.51611328125,
0.397705078125,
1.123046875,
0.71630859375,
-0.351806640625,
0.80810546875,
0.36474609375,
-0.525390625,
0.08441162109375,
-0.0052032470703125,
0.6953125,
-0.33837890625,
-0.0105133056640625,
-0.297607421875,
0.5234375,
-0.9794921875,
-1.3837890625,
0.06396484375,
0.6513671875,
0.50341796875,
-0.54345703125,
-0.9306640625,
-0.401123046875,
-0.74755859375,
-0.046600341796875,
-0.78271484375,
0.6123046875,
0.388671875,
-0.09393310546875,
0.0287017822265625,
-1.0283203125,
4.31640625,
1.0087890625,
0.94677734375,
0.07049560546875,
-0.028228759765625,
0.970703125,
-0.0012559890747070312,
-0.31884765625,
0.1610107421875,
-0.3154296875,
0.7646484375,
-0.215576171875,
-0.088134765625,
0.65087890625,
0.1949462890625,
0.453125,
-0.48486328125,
-0.0171356201171875,
-0.247314453125,
-0.990234375,
-0.7939453125,
0.0758056640625,
0.2432861328125,
0.165283203125,
0.08551025390625,
0.093017578125,
0.57080078125,
-0.626953125,
-0.29052734375,
-0.63525390625,
-0.28369140625,
-0.7109375,
0.666015625,
-0.0755615234375,
-0.1834716796875,
0.50732421875,
0.1470947265625,
-0.62744140625,
0.057891845703125,
0.55517578125,
-0.30810546875,
-0.44873046875,
0.86669921875,
-0.8212890625,
0.197998046875,
0.5556640625,
-0.294677734375,
0.279541015625,
0.62841796875,
-0.421142578125,
0.78076171875,
-0.2249755859375,
0.73193359375,
-0.73681640625,
-0.671875,
0.04107666015625,
0.2283935546875,
-0.33349609375,
0.03997802734375,
0.3427734375,
0.2381591796875,
0.1112060546875,
0.050140380859375,
0.38818359375,
-0.68896484375,
0.68212890625,
0.2008056640625,
0.19287109375,
-0.5341796875,
0.09197998046875,
0.018310546875,
-0.137939453125,
-0.4248046875,
-0.50244140625,
0.57275390625,
0.2161865234375,
-0.0219268798828125,
0.30810546875,
0.471435546875,
-0.78955078125,
0.0018644332885742188,
0.0350341796875,
-0.3779296875,
-0.31396484375,
0.5810546875,
1.5830078125,
-0.75439453125,
-0.423828125,
-0.53466796875,
0.6142578125,
0.183349609375,
0.2802734375,
0.60400390625,
-0.91357421875,
-0.25048828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.
Sergey totally forgot about the task until half an hour before the next lesson and hastily scribbled something down. But then he recollected that in the last lesson he learned the grammar of N-ish. The spelling rules state that N-ish contains some "forbidden" pairs of letters: such letters can never occur in a sentence next to each other. Also, the order of the letters doesn't matter (for example, if the pair of letters "ab" is forbidden, then any occurrences of substrings "ab" and "ba" are also forbidden). Also, each pair has different letters and each letter occurs in no more than one forbidden pair.
Now Sergey wants to correct his sentence so that it doesn't contain any "forbidden" pairs of letters that stand next to each other. However, he is running out of time, so he decided to simply cross out some letters from the sentence. What smallest number of letters will he have to cross out? When a letter is crossed out, it is "removed" so that the letters to its left and right (if they existed), become neighboring. For example, if we cross out the first letter from the string "aba", we get the string "ba", and if we cross out the second letter, we get "aa".
Input
The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105.
The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters.
Next k lines contain descriptions of forbidden pairs of letters. Each line contains exactly two different lowercase Latin letters without separators that represent the forbidden pairs. It is guaranteed that each letter is included in no more than one pair.
Output
Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters.
Examples
Input
ababa
1
ab
Output
2
Input
codeforces
2
do
cs
Output
1
Note
In the first sample you should remove two letters b.
In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution.
Tags: greedy
Correct Solution:
```
s = input()
k = int(input())
h = 1
d = {}
for i in range(k):
a, b = input()
d[a] = d[b] = h
h += 1
for c in s:
if c not in d:
d[c] = h
h += 1
count = 0
i = 0
ch = ''
c_ch, c_e = 0, 0
val = 0
while True:
if d[s[i]] != val:
count += min(c_ch, c_e)
c_ch, c_e = 0, 0
val = d[s[i]]
ch = s[i]
if s[i] == ch:
c_ch += 1
else:
c_e += 1
i += 1
if i == len(s):
count += min(c_ch, c_e)
break
print(count)
# Made By Mostafa_Khaled
```
| 45,645
|
[
0.291015625,
-0.05596923828125,
0.1292724609375,
0.284912109375,
-0.5634765625,
-0.67431640625,
0.14208984375,
-0.12200927734375,
-0.189208984375,
0.90283203125,
0.8505859375,
-0.01378631591796875,
-0.3876953125,
-0.91552734375,
-0.935546875,
-0.12841796875,
-0.91455078125,
-0.58349609375,
-0.53955078125,
-0.1390380859375,
0.0859375,
-0.15283203125,
-1.6376953125,
-0.293212890625,
-0.37158203125,
1.2021484375,
0.3583984375,
-0.2958984375,
1.162109375,
0.75048828125,
-0.26318359375,
-0.338623046875,
0.5576171875,
-1.1689453125,
-0.6259765625,
-0.51220703125,
0.9462890625,
-0.467041015625,
0.007476806640625,
-0.064208984375,
0.66064453125,
-0.251953125,
0.473388671875,
-0.5341796875,
-1.2958984375,
-0.35791015625,
-0.126953125,
-0.61376953125,
-0.3544921875,
-0.40869140625,
0.332275390625,
-0.334228515625,
0.62109375,
-0.220947265625,
0.07373046875,
0.156494140625,
0.2384033203125,
0.08428955078125,
-0.693359375,
0.411376953125,
0.134765625,
0.374755859375,
0.1448974609375,
-0.75634765625,
-0.421875,
-0.107666015625,
-0.309814453125,
0.202392578125,
-0.00026702880859375,
-0.61181640625,
-0.241455078125,
0.4931640625,
-0.3916015625,
-0.330078125,
-0.673828125,
0.0330810546875,
0.2467041015625,
0.093994140625,
-0.56689453125,
0.8388671875,
0.36865234375,
1.013671875,
0.77001953125,
-0.10443115234375,
-0.35009765625,
-0.129150390625,
0.00772857666015625,
0.378662109375,
0.423828125,
-0.2183837890625,
-0.1893310546875,
0.541015625,
-1.03515625,
-0.166748046875,
0.5908203125,
0.40576171875,
-0.28515625,
0.283447265625,
0.45751953125,
0.44873046875,
0.89892578125,
0.58349609375,
-0.34912109375,
0.82958984375,
-0.5546875,
0.16162109375,
0.0953369140625,
0.1873779296875,
-0.05413818359375,
0.25927734375,
-0.31201171875,
-0.08892822265625,
0.486083984375,
0.458984375,
-0.6806640625,
0.76953125,
-0.276123046875,
0.3896484375,
-0.8388671875,
0.281494140625,
0.7314453125,
-0.06927490234375,
0.84912109375,
0.044891357421875,
0.1920166015625,
-0.2216796875,
-0.6083984375,
1.0673828125,
-0.433837890625,
-0.021942138671875,
0.49365234375,
0.0227508544921875,
-0.06689453125,
0.2044677734375,
-0.32080078125,
0.8076171875,
-0.287353515625,
0.6162109375,
0.55419921875,
-0.6220703125,
0.492431640625,
-0.2286376953125,
-0.053070068359375,
1.4287109375,
0.708984375,
-0.06097412109375,
0.78515625,
0.42822265625,
-0.92724609375,
0.1619873046875,
-1.3056640625,
0.8525390625,
0.14013671875,
0.117919921875,
-0.53369140625,
-0.1455078125,
-0.2314453125,
0.157958984375,
0.06756591796875,
0.2060546875,
-0.46826171875,
0.1510009765625,
-0.310302734375,
0.62744140625,
-0.2587890625,
1.0556640625,
-0.6728515625,
0.01007080078125,
-0.142333984375,
-0.5966796875,
0.19921875,
-0.040008544921875,
0.11669921875,
1.0732421875,
0.1568603515625,
0.8330078125,
0.56884765625,
-0.344482421875,
0.64306640625,
0.4794921875,
-0.10455322265625,
0.48046875,
0.1812744140625,
0.324462890625,
0.521484375,
0.298583984375,
-0.15625,
-0.415283203125,
-0.84716796875,
-0.375,
-0.0113525390625,
0.65673828125,
-0.37353515625,
0.341064453125,
0.047698974609375,
-0.0391845703125,
-1.0478515625,
-0.32666015625,
0.18408203125,
-1.0986328125,
-0.5546875,
0.90283203125,
0.14599609375,
0.74658203125,
-0.202392578125,
-0.626953125,
0.64892578125,
1.4775390625,
-0.3173828125,
0.278564453125,
0.6513671875,
-0.58935546875,
-0.345947265625,
0.45751953125,
-0.1702880859375,
-0.179931640625,
-0.85400390625,
0.72412109375,
-0.53466796875,
-0.0231475830078125,
-0.2080078125,
0.266357421875,
0.2763671875,
0.66015625,
-0.1806640625,
-0.3349609375,
0.84765625,
1.12890625,
0.0369873046875,
0.50390625,
0.197998046875,
0.7021484375,
0.1204833984375,
0.71240234375,
0.412841796875,
0.1494140625,
0.8486328125,
0.916015625,
0.2119140625,
0.52880859375,
-0.2252197265625,
0.44091796875,
0.1973876953125,
0.580078125,
0.440673828125,
0.29052734375,
-0.316162109375,
-0.038177490234375,
-0.3876953125,
0.09185791015625,
-0.252197265625,
0.32080078125,
0.431884765625,
0.432373046875,
-0.29443359375,
-0.13916015625,
0.2066650390625,
0.685546875,
-1.171875,
-0.45703125,
0.045135498046875,
0.1319580078125,
-0.0281219482421875,
0.00022304058074951172,
0.2379150390625,
0.77880859375,
0.70263671875,
0.328857421875,
-0.52783203125,
-0.52783203125,
-1.1328125,
-1.0107421875,
-0.86376953125,
-0.332275390625,
-0.82568359375,
-0.11688232421875,
0.634765625,
-1.0869140625,
0.482177734375,
-0.2861328125,
-0.5302734375,
0.1619873046875,
-0.578125,
0.6025390625,
-0.2027587890625,
0.80029296875,
-0.755859375,
0.73291015625,
0.034820556640625,
0.90234375,
-0.287841796875,
-0.3671875,
-0.047760009765625,
-0.61767578125,
0.251953125,
-0.0189208984375,
0.3017578125,
0.1771240234375,
-0.6533203125,
-0.7646484375,
0.032501220703125,
-0.308349609375,
-0.57861328125,
0.215087890625,
-0.7529296875,
0.7294921875,
0.93994140625,
-0.66845703125,
0.77392578125,
1.1220703125,
-0.94921875,
0.0287628173828125,
0.1856689453125,
0.2998046875,
-0.615234375,
1.189453125,
0.29052734375,
0.3974609375,
-0.5205078125,
-0.51220703125,
-0.755859375,
0.0966796875,
-0.03570556640625,
-0.354736328125,
-0.09564208984375,
0.75634765625,
-0.267333984375,
-0.994140625,
0.75341796875,
-1.1796875,
-0.10711669921875,
-0.1295166015625,
-0.489501953125,
0.95068359375,
0.342529296875,
0.354736328125,
-0.288330078125,
-0.818359375,
-0.25146484375,
0.82421875,
0.1776123046875,
-0.521484375,
-0.0372314453125,
0.2440185546875,
0.1773681640625,
0.150634765625,
0.12078857421875,
-0.232421875,
-0.3251953125,
0.070068359375,
0.221923828125,
0.92333984375,
0.2998046875,
0.3857421875,
0.365234375,
0.8486328125,
-0.6884765625,
-0.252685546875,
-0.270263671875,
0.720703125,
0.21337890625,
0.39697265625,
0.1611328125,
-0.24755859375,
-0.330078125,
-0.80615234375,
0.483642578125,
-0.295166015625,
0.763671875,
-0.5322265625,
0.6181640625,
0.383056640625,
-0.5263671875,
0.65966796875,
-0.89599609375,
-0.358154296875,
0.90283203125,
-0.6650390625,
0.95068359375,
-0.8916015625,
0.194580078125,
0.06884765625,
0.1278076171875,
0.701171875,
0.642578125,
0.7373046875,
-0.453125,
-0.60302734375,
-0.2890625,
0.278076171875,
-0.06378173828125,
-0.525390625,
0.144775390625,
-0.2440185546875,
-0.41455078125,
-0.89111328125,
0.41357421875,
0.86083984375,
0.57275390625,
0.3359375,
0.4248046875,
0.1689453125,
0.58740234375,
0.9111328125,
-0.0947265625,
-0.002368927001953125,
-0.7587890625,
1.0380859375,
-0.0124053955078125,
-0.480224609375,
-0.34765625,
-0.33544921875,
-0.312255859375,
0.323974609375,
0.018951416015625,
0.04071044921875,
-0.89208984375,
-0.170654296875,
-0.13720703125,
0.361572265625,
-0.73583984375,
-0.3095703125,
-0.189697265625,
0.425048828125,
0.08111572265625,
-1.017578125,
0.390380859375,
-0.6630859375,
0.927734375,
0.99169921875,
0.0635986328125,
-0.51708984375,
-0.149658203125,
-0.53955078125,
-0.86767578125,
-0.1142578125,
0.58154296875,
-0.12353515625,
0.2261962890625,
-1.2578125,
0.57958984375,
0.3349609375,
-0.088134765625,
0.28466796875,
0.193359375,
0.472900390625,
0.142578125,
0.5234375,
-0.6318359375,
-0.66357421875,
0.419189453125,
-1.1201171875,
0.763671875,
-0.611328125,
0.483154296875,
-0.154541015625,
0.1396484375,
0.1552734375,
0.4560546875,
-0.4775390625,
0.41357421875,
-0.0810546875,
0.3984375,
-1.01171875,
-0.65966796875,
0.51806640625,
-0.1829833984375,
-0.724609375,
0.546875,
0.25244140625,
-0.236083984375,
0.013427734375,
0.5927734375,
-0.466064453125,
0.4443359375,
-0.54736328125,
0.62451171875,
-0.116943359375,
-0.77294921875,
-0.2432861328125,
-0.470458984375,
0.68212890625,
-0.186279296875,
-0.7587890625,
0.220703125,
-1.15625,
-0.250732421875,
0.09710693359375,
-0.49755859375,
0.349365234375,
0.1513671875,
0.1280517578125,
0.09881591796875,
-0.49609375,
-0.36279296875,
-0.1741943359375,
-0.53564453125,
-0.51806640625,
0.337646484375,
0.58984375,
0.6943359375,
0.290283203125,
-0.10791015625,
0.1749267578125,
0.015655517578125,
-0.12200927734375,
-0.58447265625,
-0.354736328125,
0.213134765625,
-0.51220703125,
-0.1392822265625,
0.36181640625,
-0.0020809173583984375,
0.39697265625,
0.8720703125,
-0.055877685546875,
0.2276611328125,
0.348388671875,
-0.5146484375,
1.384765625,
-0.188720703125,
-1.0166015625,
-0.38427734375,
0.2420654296875,
0.060333251953125,
0.607421875,
-0.1727294921875,
-0.7978515625,
-0.6845703125,
-1.1015625,
0.08795166015625,
-0.5263671875,
-0.26171875,
-0.94287109375,
-0.1905517578125,
-0.51123046875,
0.7978515625,
-0.37744140625,
-0.2802734375,
0.340576171875,
-1.2001953125,
0.04998779296875,
-0.59619140625,
-0.41845703125,
-0.56201171875,
-0.5673828125,
-0.623046875,
1.09765625,
0.416015625,
0.1422119140625,
0.421142578125,
-0.34521484375,
0.24853515625,
-0.36669921875,
-0.609375,
-0.495849609375,
-0.280517578125,
0.376953125,
-0.355224609375,
-0.42138671875,
-0.625,
0.8857421875,
-0.54052734375,
0.206787109375,
-0.443603515625,
-0.5341796875,
-0.199462890625,
-0.240478515625,
0.7998046875,
-0.65283203125,
0.1392822265625,
-0.50439453125,
0.68212890625,
0.3701171875,
-0.302001953125,
-0.5234375,
-0.83447265625,
-0.6005859375,
-0.8583984375,
0.65087890625,
-0.552734375,
0.58935546875,
-0.69189453125,
-0.2587890625,
0.900390625,
-0.5205078125,
0.317138671875,
1.3330078125,
-0.2313232421875,
0.213623046875,
-0.84814453125,
0.677734375,
-0.0223541259765625,
-0.64453125,
-0.27685546875,
-0.07952880859375,
-0.9150390625,
0.0960693359375,
-0.63427734375,
-0.896484375,
-0.57373046875,
0.71044921875,
1.466796875,
-0.300537109375,
0.95556640625,
0.2305908203125,
-1.17578125,
-0.7919921875,
0.78857421875,
0.381591796875,
0.56640625,
1.1259765625,
-0.82177734375,
-0.1278076171875,
0.40673828125,
-0.07183837890625,
-0.26416015625,
-0.208984375,
1.056640625,
-0.491455078125,
-0.60302734375,
0.52783203125,
0.57568359375,
-1.111328125,
-0.5341796875,
0.07781982421875,
-0.00972747802734375,
-0.1356201171875,
-0.61669921875,
0.09686279296875,
0.63818359375,
-0.479736328125,
-0.10040283203125,
0.0250244140625,
0.04345703125,
0.634765625,
0.300048828125,
0.30419921875,
-0.51904296875,
0.64306640625,
0.80029296875,
-0.783203125,
-0.37890625,
-0.82958984375,
-0.18505859375,
-0.2322998046875,
0.37353515625,
0.81640625,
0.0882568359375,
0.2191162109375,
0.72021484375,
-0.08892822265625,
0.7138671875,
-0.38818359375,
-0.363037109375,
0.25048828125,
-0.492431640625,
-0.25927734375,
-0.01491546630859375,
0.183349609375,
0.1009521484375,
0.2156982421875,
-0.7021484375,
-0.06610107421875,
0.349853515625,
0.334716796875,
-0.08917236328125,
-0.045318603515625,
-0.325927734375,
-0.58935546875,
-0.413330078125,
-0.5380859375,
-0.765625,
-0.12188720703125,
0.429443359375,
0.367919921875,
-0.73876953125,
0.04022216796875,
0.8408203125,
-0.77880859375,
1.2099609375,
-0.7490234375,
0.325927734375,
-0.43994140625,
-0.09228515625,
-0.78466796875,
0.1318359375,
-0.41796875,
-0.27880859375,
-0.403564453125,
0.5419921875,
0.3779296875,
0.52734375,
-0.1343994140625,
0.1981201171875,
-0.173828125,
-0.81103515625,
-0.06646728515625,
0.049224853515625,
0.0947265625,
0.33251953125,
0.72021484375,
0.52099609375,
0.283203125,
-0.050048828125,
-0.61083984375,
-0.48095703125,
0.12432861328125,
0.94384765625,
0.0238494873046875,
-0.05615234375,
-0.412109375,
0.00319671630859375,
-0.6279296875,
0.261962890625,
-0.2861328125,
-0.09136962890625,
0.09783935546875,
-0.74853515625,
0.505859375,
1.26953125,
-0.09161376953125,
0.177978515625,
-0.0291900634765625,
0.2939453125,
0.386962890625,
0.1669921875,
0.341552734375,
0.1629638671875,
0.1240234375,
-0.2159423828125,
-0.158935546875,
0.6015625,
-0.01273345947265625,
0.4287109375,
-0.2010498046875,
-0.76806640625,
-0.7490234375,
-0.100341796875,
-0.27294921875,
0.042572021484375,
0.59619140625,
-0.8369140625,
-0.06622314453125,
0.087890625,
-0.95166015625,
0.1787109375,
-0.7529296875,
-0.84619140625,
0.0838623046875,
-0.133056640625,
-0.7958984375,
-0.493896484375,
-0.58740234375,
0.037139892578125,
0.1595458984375,
0.5478515625,
-0.7412109375,
0.295654296875,
-0.172119140625,
0.44287109375,
-0.215087890625,
-0.1334228515625,
0.1318359375,
0.291748046875,
-0.470703125,
-0.6533203125,
0.0771484375,
1.4853515625,
0.17919921875,
-0.34912109375,
-0.63037109375,
0.10302734375,
-0.42919921875,
0.3271484375,
-0.2034912109375,
-0.18896484375,
0.01824951171875,
0.435791015625,
-1.181640625,
-0.354248046875,
0.084716796875,
0.286376953125,
-0.021026611328125,
-0.3447265625,
-0.2130126953125,
0.68994140625,
0.982421875,
-0.1396484375,
-0.058502197265625,
0.408935546875,
0.79150390625,
-0.26220703125,
-0.127197265625,
-0.251708984375,
0.30224609375,
0.53076171875,
0.27490234375,
-0.2354736328125,
0.69873046875,
0.93798828125,
-0.33203125,
-0.2208251953125,
0.5380859375,
0.03131103515625,
-0.0085906982421875,
-0.241943359375,
-0.2291259765625,
0.040191650390625,
-0.06988525390625,
-0.84619140625,
0.172607421875,
-0.378662109375,
-0.333251953125,
-0.176513671875,
-0.70849609375,
0.98046875,
-1.1953125,
0.4619140625,
-0.26220703125,
-0.12158203125,
0.399169921875,
0.98046875,
0.05169677734375,
-0.056793212890625,
0.50390625,
0.341552734375,
0.58349609375,
0.8076171875,
0.208984375,
0.154541015625,
-0.3916015625,
0.146484375,
-0.0693359375,
0.006015777587890625,
-0.6806640625,
-0.28125,
-1.1416015625,
0.6298828125,
-0.399169921875,
-0.09930419921875,
0.433837890625,
-0.5341796875,
0.1962890625,
-0.284912109375,
0.7646484375,
-0.38037109375,
0.434814453125,
0.5458984375,
-0.57177734375,
-0.447509765625,
0.84423828125,
-0.1993408203125,
0.38232421875,
0.1937255859375,
0.73828125,
0.34814453125,
1.716796875,
0.32080078125,
-0.2578125,
-0.147705078125,
0.057220458984375,
-0.234375,
-0.60400390625,
-0.38916015625,
-0.37158203125,
-0.119140625,
-0.398193359375,
-0.22998046875,
0.0257110595703125,
0.6533203125,
0.0811767578125,
-0.80615234375,
-0.042236328125,
0.08184814453125,
-0.84521484375,
0.7734375,
0.261474609375,
0.02947998046875,
0.07269287109375,
0.08599853515625,
-0.14208984375,
-0.35009765625,
-0.185791015625,
-0.5927734375,
0.2236328125,
-0.5849609375,
-0.5380859375,
-0.609375,
-1.0380859375,
-0.375732421875,
-0.33203125,
-0.476318359375,
-1.0390625,
0.1490478515625,
0.65185546875,
0.40625,
0.5107421875,
-0.51611328125,
0.397705078125,
1.123046875,
0.71630859375,
-0.351806640625,
0.80810546875,
0.36474609375,
-0.525390625,
0.08441162109375,
-0.0052032470703125,
0.6953125,
-0.33837890625,
-0.0105133056640625,
-0.297607421875,
0.5234375,
-0.9794921875,
-1.3837890625,
0.06396484375,
0.6513671875,
0.50341796875,
-0.54345703125,
-0.9306640625,
-0.401123046875,
-0.74755859375,
-0.046600341796875,
-0.78271484375,
0.6123046875,
0.388671875,
-0.09393310546875,
0.0287017822265625,
-1.0283203125,
4.31640625,
1.0087890625,
0.94677734375,
0.07049560546875,
-0.028228759765625,
0.970703125,
-0.0012559890747070312,
-0.31884765625,
0.1610107421875,
-0.3154296875,
0.7646484375,
-0.215576171875,
-0.088134765625,
0.65087890625,
0.1949462890625,
0.453125,
-0.48486328125,
-0.0171356201171875,
-0.247314453125,
-0.990234375,
-0.7939453125,
0.0758056640625,
0.2432861328125,
0.165283203125,
0.08551025390625,
0.093017578125,
0.57080078125,
-0.626953125,
-0.29052734375,
-0.63525390625,
-0.28369140625,
-0.7109375,
0.666015625,
-0.0755615234375,
-0.1834716796875,
0.50732421875,
0.1470947265625,
-0.62744140625,
0.057891845703125,
0.55517578125,
-0.30810546875,
-0.44873046875,
0.86669921875,
-0.8212890625,
0.197998046875,
0.5556640625,
-0.294677734375,
0.279541015625,
0.62841796875,
-0.421142578125,
0.78076171875,
-0.2249755859375,
0.73193359375,
-0.73681640625,
-0.671875,
0.04107666015625,
0.2283935546875,
-0.33349609375,
0.03997802734375,
0.3427734375,
0.2381591796875,
0.1112060546875,
0.050140380859375,
0.38818359375,
-0.68896484375,
0.68212890625,
0.2008056640625,
0.19287109375,
-0.5341796875,
0.09197998046875,
0.018310546875,
-0.137939453125,
-0.4248046875,
-0.50244140625,
0.57275390625,
0.2161865234375,
-0.0219268798828125,
0.30810546875,
0.471435546875,
-0.78955078125,
0.0018644332885742188,
0.0350341796875,
-0.3779296875,
-0.31396484375,
0.5810546875,
1.5830078125,
-0.75439453125,
-0.423828125,
-0.53466796875,
0.6142578125,
0.183349609375,
0.2802734375,
0.60400390625,
-0.91357421875,
-0.25048828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.
Sergey totally forgot about the task until half an hour before the next lesson and hastily scribbled something down. But then he recollected that in the last lesson he learned the grammar of N-ish. The spelling rules state that N-ish contains some "forbidden" pairs of letters: such letters can never occur in a sentence next to each other. Also, the order of the letters doesn't matter (for example, if the pair of letters "ab" is forbidden, then any occurrences of substrings "ab" and "ba" are also forbidden). Also, each pair has different letters and each letter occurs in no more than one forbidden pair.
Now Sergey wants to correct his sentence so that it doesn't contain any "forbidden" pairs of letters that stand next to each other. However, he is running out of time, so he decided to simply cross out some letters from the sentence. What smallest number of letters will he have to cross out? When a letter is crossed out, it is "removed" so that the letters to its left and right (if they existed), become neighboring. For example, if we cross out the first letter from the string "aba", we get the string "ba", and if we cross out the second letter, we get "aa".
Input
The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105.
The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters.
Next k lines contain descriptions of forbidden pairs of letters. Each line contains exactly two different lowercase Latin letters without separators that represent the forbidden pairs. It is guaranteed that each letter is included in no more than one pair.
Output
Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters.
Examples
Input
ababa
1
ab
Output
2
Input
codeforces
2
do
cs
Output
1
Note
In the first sample you should remove two letters b.
In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution.
Tags: greedy
Correct Solution:
```
import sys
import math
MAXNUM = math.inf
MINNUM = -1 * math.inf
ASCIILOWER = 97
ASCIIUPPER = 65
def getInt():
return int(sys.stdin.readline().rstrip())
def getInts():
return map(int, sys.stdin.readline().rstrip().split(" "))
def getString():
return sys.stdin.readline().rstrip()
def printOutput(ans):
sys.stdout.write()
pass
def solve(s, pairs):
dp = [[0 for i in range(26)] for i in range(len(s))]
dp[0][ord(s[0]) - ASCIILOWER] = 1
for i in range(1, len(dp)):
letter = s[i]
pair = 'A' # dummy value
if letter in pairs:
pair = pairs[letter]
l, p = ord(letter) - ASCIILOWER, ord(pair) - ASCIILOWER
for j in range(26):
dp[i][j] = max(dp[i - 1][j], dp[i][j])
if j != p:
dp[i][l] = max(dp[i - 1][j] + 1, dp[i][l])
return len(s) - max(dp[-1])
def readinput():
string = getString()
pairs = getInt()
pairDict = dict()
for _ in range(pairs):
p = getString()
pairDict[p[0]] = p[1]
pairDict[p[1]] = p[0]
print(solve(string, pairDict))
readinput()
```
| 45,646
|
[
0.291015625,
-0.05596923828125,
0.1292724609375,
0.284912109375,
-0.5634765625,
-0.67431640625,
0.14208984375,
-0.12200927734375,
-0.189208984375,
0.90283203125,
0.8505859375,
-0.01378631591796875,
-0.3876953125,
-0.91552734375,
-0.935546875,
-0.12841796875,
-0.91455078125,
-0.58349609375,
-0.53955078125,
-0.1390380859375,
0.0859375,
-0.15283203125,
-1.6376953125,
-0.293212890625,
-0.37158203125,
1.2021484375,
0.3583984375,
-0.2958984375,
1.162109375,
0.75048828125,
-0.26318359375,
-0.338623046875,
0.5576171875,
-1.1689453125,
-0.6259765625,
-0.51220703125,
0.9462890625,
-0.467041015625,
0.007476806640625,
-0.064208984375,
0.66064453125,
-0.251953125,
0.473388671875,
-0.5341796875,
-1.2958984375,
-0.35791015625,
-0.126953125,
-0.61376953125,
-0.3544921875,
-0.40869140625,
0.332275390625,
-0.334228515625,
0.62109375,
-0.220947265625,
0.07373046875,
0.156494140625,
0.2384033203125,
0.08428955078125,
-0.693359375,
0.411376953125,
0.134765625,
0.374755859375,
0.1448974609375,
-0.75634765625,
-0.421875,
-0.107666015625,
-0.309814453125,
0.202392578125,
-0.00026702880859375,
-0.61181640625,
-0.241455078125,
0.4931640625,
-0.3916015625,
-0.330078125,
-0.673828125,
0.0330810546875,
0.2467041015625,
0.093994140625,
-0.56689453125,
0.8388671875,
0.36865234375,
1.013671875,
0.77001953125,
-0.10443115234375,
-0.35009765625,
-0.129150390625,
0.00772857666015625,
0.378662109375,
0.423828125,
-0.2183837890625,
-0.1893310546875,
0.541015625,
-1.03515625,
-0.166748046875,
0.5908203125,
0.40576171875,
-0.28515625,
0.283447265625,
0.45751953125,
0.44873046875,
0.89892578125,
0.58349609375,
-0.34912109375,
0.82958984375,
-0.5546875,
0.16162109375,
0.0953369140625,
0.1873779296875,
-0.05413818359375,
0.25927734375,
-0.31201171875,
-0.08892822265625,
0.486083984375,
0.458984375,
-0.6806640625,
0.76953125,
-0.276123046875,
0.3896484375,
-0.8388671875,
0.281494140625,
0.7314453125,
-0.06927490234375,
0.84912109375,
0.044891357421875,
0.1920166015625,
-0.2216796875,
-0.6083984375,
1.0673828125,
-0.433837890625,
-0.021942138671875,
0.49365234375,
0.0227508544921875,
-0.06689453125,
0.2044677734375,
-0.32080078125,
0.8076171875,
-0.287353515625,
0.6162109375,
0.55419921875,
-0.6220703125,
0.492431640625,
-0.2286376953125,
-0.053070068359375,
1.4287109375,
0.708984375,
-0.06097412109375,
0.78515625,
0.42822265625,
-0.92724609375,
0.1619873046875,
-1.3056640625,
0.8525390625,
0.14013671875,
0.117919921875,
-0.53369140625,
-0.1455078125,
-0.2314453125,
0.157958984375,
0.06756591796875,
0.2060546875,
-0.46826171875,
0.1510009765625,
-0.310302734375,
0.62744140625,
-0.2587890625,
1.0556640625,
-0.6728515625,
0.01007080078125,
-0.142333984375,
-0.5966796875,
0.19921875,
-0.040008544921875,
0.11669921875,
1.0732421875,
0.1568603515625,
0.8330078125,
0.56884765625,
-0.344482421875,
0.64306640625,
0.4794921875,
-0.10455322265625,
0.48046875,
0.1812744140625,
0.324462890625,
0.521484375,
0.298583984375,
-0.15625,
-0.415283203125,
-0.84716796875,
-0.375,
-0.0113525390625,
0.65673828125,
-0.37353515625,
0.341064453125,
0.047698974609375,
-0.0391845703125,
-1.0478515625,
-0.32666015625,
0.18408203125,
-1.0986328125,
-0.5546875,
0.90283203125,
0.14599609375,
0.74658203125,
-0.202392578125,
-0.626953125,
0.64892578125,
1.4775390625,
-0.3173828125,
0.278564453125,
0.6513671875,
-0.58935546875,
-0.345947265625,
0.45751953125,
-0.1702880859375,
-0.179931640625,
-0.85400390625,
0.72412109375,
-0.53466796875,
-0.0231475830078125,
-0.2080078125,
0.266357421875,
0.2763671875,
0.66015625,
-0.1806640625,
-0.3349609375,
0.84765625,
1.12890625,
0.0369873046875,
0.50390625,
0.197998046875,
0.7021484375,
0.1204833984375,
0.71240234375,
0.412841796875,
0.1494140625,
0.8486328125,
0.916015625,
0.2119140625,
0.52880859375,
-0.2252197265625,
0.44091796875,
0.1973876953125,
0.580078125,
0.440673828125,
0.29052734375,
-0.316162109375,
-0.038177490234375,
-0.3876953125,
0.09185791015625,
-0.252197265625,
0.32080078125,
0.431884765625,
0.432373046875,
-0.29443359375,
-0.13916015625,
0.2066650390625,
0.685546875,
-1.171875,
-0.45703125,
0.045135498046875,
0.1319580078125,
-0.0281219482421875,
0.00022304058074951172,
0.2379150390625,
0.77880859375,
0.70263671875,
0.328857421875,
-0.52783203125,
-0.52783203125,
-1.1328125,
-1.0107421875,
-0.86376953125,
-0.332275390625,
-0.82568359375,
-0.11688232421875,
0.634765625,
-1.0869140625,
0.482177734375,
-0.2861328125,
-0.5302734375,
0.1619873046875,
-0.578125,
0.6025390625,
-0.2027587890625,
0.80029296875,
-0.755859375,
0.73291015625,
0.034820556640625,
0.90234375,
-0.287841796875,
-0.3671875,
-0.047760009765625,
-0.61767578125,
0.251953125,
-0.0189208984375,
0.3017578125,
0.1771240234375,
-0.6533203125,
-0.7646484375,
0.032501220703125,
-0.308349609375,
-0.57861328125,
0.215087890625,
-0.7529296875,
0.7294921875,
0.93994140625,
-0.66845703125,
0.77392578125,
1.1220703125,
-0.94921875,
0.0287628173828125,
0.1856689453125,
0.2998046875,
-0.615234375,
1.189453125,
0.29052734375,
0.3974609375,
-0.5205078125,
-0.51220703125,
-0.755859375,
0.0966796875,
-0.03570556640625,
-0.354736328125,
-0.09564208984375,
0.75634765625,
-0.267333984375,
-0.994140625,
0.75341796875,
-1.1796875,
-0.10711669921875,
-0.1295166015625,
-0.489501953125,
0.95068359375,
0.342529296875,
0.354736328125,
-0.288330078125,
-0.818359375,
-0.25146484375,
0.82421875,
0.1776123046875,
-0.521484375,
-0.0372314453125,
0.2440185546875,
0.1773681640625,
0.150634765625,
0.12078857421875,
-0.232421875,
-0.3251953125,
0.070068359375,
0.221923828125,
0.92333984375,
0.2998046875,
0.3857421875,
0.365234375,
0.8486328125,
-0.6884765625,
-0.252685546875,
-0.270263671875,
0.720703125,
0.21337890625,
0.39697265625,
0.1611328125,
-0.24755859375,
-0.330078125,
-0.80615234375,
0.483642578125,
-0.295166015625,
0.763671875,
-0.5322265625,
0.6181640625,
0.383056640625,
-0.5263671875,
0.65966796875,
-0.89599609375,
-0.358154296875,
0.90283203125,
-0.6650390625,
0.95068359375,
-0.8916015625,
0.194580078125,
0.06884765625,
0.1278076171875,
0.701171875,
0.642578125,
0.7373046875,
-0.453125,
-0.60302734375,
-0.2890625,
0.278076171875,
-0.06378173828125,
-0.525390625,
0.144775390625,
-0.2440185546875,
-0.41455078125,
-0.89111328125,
0.41357421875,
0.86083984375,
0.57275390625,
0.3359375,
0.4248046875,
0.1689453125,
0.58740234375,
0.9111328125,
-0.0947265625,
-0.002368927001953125,
-0.7587890625,
1.0380859375,
-0.0124053955078125,
-0.480224609375,
-0.34765625,
-0.33544921875,
-0.312255859375,
0.323974609375,
0.018951416015625,
0.04071044921875,
-0.89208984375,
-0.170654296875,
-0.13720703125,
0.361572265625,
-0.73583984375,
-0.3095703125,
-0.189697265625,
0.425048828125,
0.08111572265625,
-1.017578125,
0.390380859375,
-0.6630859375,
0.927734375,
0.99169921875,
0.0635986328125,
-0.51708984375,
-0.149658203125,
-0.53955078125,
-0.86767578125,
-0.1142578125,
0.58154296875,
-0.12353515625,
0.2261962890625,
-1.2578125,
0.57958984375,
0.3349609375,
-0.088134765625,
0.28466796875,
0.193359375,
0.472900390625,
0.142578125,
0.5234375,
-0.6318359375,
-0.66357421875,
0.419189453125,
-1.1201171875,
0.763671875,
-0.611328125,
0.483154296875,
-0.154541015625,
0.1396484375,
0.1552734375,
0.4560546875,
-0.4775390625,
0.41357421875,
-0.0810546875,
0.3984375,
-1.01171875,
-0.65966796875,
0.51806640625,
-0.1829833984375,
-0.724609375,
0.546875,
0.25244140625,
-0.236083984375,
0.013427734375,
0.5927734375,
-0.466064453125,
0.4443359375,
-0.54736328125,
0.62451171875,
-0.116943359375,
-0.77294921875,
-0.2432861328125,
-0.470458984375,
0.68212890625,
-0.186279296875,
-0.7587890625,
0.220703125,
-1.15625,
-0.250732421875,
0.09710693359375,
-0.49755859375,
0.349365234375,
0.1513671875,
0.1280517578125,
0.09881591796875,
-0.49609375,
-0.36279296875,
-0.1741943359375,
-0.53564453125,
-0.51806640625,
0.337646484375,
0.58984375,
0.6943359375,
0.290283203125,
-0.10791015625,
0.1749267578125,
0.015655517578125,
-0.12200927734375,
-0.58447265625,
-0.354736328125,
0.213134765625,
-0.51220703125,
-0.1392822265625,
0.36181640625,
-0.0020809173583984375,
0.39697265625,
0.8720703125,
-0.055877685546875,
0.2276611328125,
0.348388671875,
-0.5146484375,
1.384765625,
-0.188720703125,
-1.0166015625,
-0.38427734375,
0.2420654296875,
0.060333251953125,
0.607421875,
-0.1727294921875,
-0.7978515625,
-0.6845703125,
-1.1015625,
0.08795166015625,
-0.5263671875,
-0.26171875,
-0.94287109375,
-0.1905517578125,
-0.51123046875,
0.7978515625,
-0.37744140625,
-0.2802734375,
0.340576171875,
-1.2001953125,
0.04998779296875,
-0.59619140625,
-0.41845703125,
-0.56201171875,
-0.5673828125,
-0.623046875,
1.09765625,
0.416015625,
0.1422119140625,
0.421142578125,
-0.34521484375,
0.24853515625,
-0.36669921875,
-0.609375,
-0.495849609375,
-0.280517578125,
0.376953125,
-0.355224609375,
-0.42138671875,
-0.625,
0.8857421875,
-0.54052734375,
0.206787109375,
-0.443603515625,
-0.5341796875,
-0.199462890625,
-0.240478515625,
0.7998046875,
-0.65283203125,
0.1392822265625,
-0.50439453125,
0.68212890625,
0.3701171875,
-0.302001953125,
-0.5234375,
-0.83447265625,
-0.6005859375,
-0.8583984375,
0.65087890625,
-0.552734375,
0.58935546875,
-0.69189453125,
-0.2587890625,
0.900390625,
-0.5205078125,
0.317138671875,
1.3330078125,
-0.2313232421875,
0.213623046875,
-0.84814453125,
0.677734375,
-0.0223541259765625,
-0.64453125,
-0.27685546875,
-0.07952880859375,
-0.9150390625,
0.0960693359375,
-0.63427734375,
-0.896484375,
-0.57373046875,
0.71044921875,
1.466796875,
-0.300537109375,
0.95556640625,
0.2305908203125,
-1.17578125,
-0.7919921875,
0.78857421875,
0.381591796875,
0.56640625,
1.1259765625,
-0.82177734375,
-0.1278076171875,
0.40673828125,
-0.07183837890625,
-0.26416015625,
-0.208984375,
1.056640625,
-0.491455078125,
-0.60302734375,
0.52783203125,
0.57568359375,
-1.111328125,
-0.5341796875,
0.07781982421875,
-0.00972747802734375,
-0.1356201171875,
-0.61669921875,
0.09686279296875,
0.63818359375,
-0.479736328125,
-0.10040283203125,
0.0250244140625,
0.04345703125,
0.634765625,
0.300048828125,
0.30419921875,
-0.51904296875,
0.64306640625,
0.80029296875,
-0.783203125,
-0.37890625,
-0.82958984375,
-0.18505859375,
-0.2322998046875,
0.37353515625,
0.81640625,
0.0882568359375,
0.2191162109375,
0.72021484375,
-0.08892822265625,
0.7138671875,
-0.38818359375,
-0.363037109375,
0.25048828125,
-0.492431640625,
-0.25927734375,
-0.01491546630859375,
0.183349609375,
0.1009521484375,
0.2156982421875,
-0.7021484375,
-0.06610107421875,
0.349853515625,
0.334716796875,
-0.08917236328125,
-0.045318603515625,
-0.325927734375,
-0.58935546875,
-0.413330078125,
-0.5380859375,
-0.765625,
-0.12188720703125,
0.429443359375,
0.367919921875,
-0.73876953125,
0.04022216796875,
0.8408203125,
-0.77880859375,
1.2099609375,
-0.7490234375,
0.325927734375,
-0.43994140625,
-0.09228515625,
-0.78466796875,
0.1318359375,
-0.41796875,
-0.27880859375,
-0.403564453125,
0.5419921875,
0.3779296875,
0.52734375,
-0.1343994140625,
0.1981201171875,
-0.173828125,
-0.81103515625,
-0.06646728515625,
0.049224853515625,
0.0947265625,
0.33251953125,
0.72021484375,
0.52099609375,
0.283203125,
-0.050048828125,
-0.61083984375,
-0.48095703125,
0.12432861328125,
0.94384765625,
0.0238494873046875,
-0.05615234375,
-0.412109375,
0.00319671630859375,
-0.6279296875,
0.261962890625,
-0.2861328125,
-0.09136962890625,
0.09783935546875,
-0.74853515625,
0.505859375,
1.26953125,
-0.09161376953125,
0.177978515625,
-0.0291900634765625,
0.2939453125,
0.386962890625,
0.1669921875,
0.341552734375,
0.1629638671875,
0.1240234375,
-0.2159423828125,
-0.158935546875,
0.6015625,
-0.01273345947265625,
0.4287109375,
-0.2010498046875,
-0.76806640625,
-0.7490234375,
-0.100341796875,
-0.27294921875,
0.042572021484375,
0.59619140625,
-0.8369140625,
-0.06622314453125,
0.087890625,
-0.95166015625,
0.1787109375,
-0.7529296875,
-0.84619140625,
0.0838623046875,
-0.133056640625,
-0.7958984375,
-0.493896484375,
-0.58740234375,
0.037139892578125,
0.1595458984375,
0.5478515625,
-0.7412109375,
0.295654296875,
-0.172119140625,
0.44287109375,
-0.215087890625,
-0.1334228515625,
0.1318359375,
0.291748046875,
-0.470703125,
-0.6533203125,
0.0771484375,
1.4853515625,
0.17919921875,
-0.34912109375,
-0.63037109375,
0.10302734375,
-0.42919921875,
0.3271484375,
-0.2034912109375,
-0.18896484375,
0.01824951171875,
0.435791015625,
-1.181640625,
-0.354248046875,
0.084716796875,
0.286376953125,
-0.021026611328125,
-0.3447265625,
-0.2130126953125,
0.68994140625,
0.982421875,
-0.1396484375,
-0.058502197265625,
0.408935546875,
0.79150390625,
-0.26220703125,
-0.127197265625,
-0.251708984375,
0.30224609375,
0.53076171875,
0.27490234375,
-0.2354736328125,
0.69873046875,
0.93798828125,
-0.33203125,
-0.2208251953125,
0.5380859375,
0.03131103515625,
-0.0085906982421875,
-0.241943359375,
-0.2291259765625,
0.040191650390625,
-0.06988525390625,
-0.84619140625,
0.172607421875,
-0.378662109375,
-0.333251953125,
-0.176513671875,
-0.70849609375,
0.98046875,
-1.1953125,
0.4619140625,
-0.26220703125,
-0.12158203125,
0.399169921875,
0.98046875,
0.05169677734375,
-0.056793212890625,
0.50390625,
0.341552734375,
0.58349609375,
0.8076171875,
0.208984375,
0.154541015625,
-0.3916015625,
0.146484375,
-0.0693359375,
0.006015777587890625,
-0.6806640625,
-0.28125,
-1.1416015625,
0.6298828125,
-0.399169921875,
-0.09930419921875,
0.433837890625,
-0.5341796875,
0.1962890625,
-0.284912109375,
0.7646484375,
-0.38037109375,
0.434814453125,
0.5458984375,
-0.57177734375,
-0.447509765625,
0.84423828125,
-0.1993408203125,
0.38232421875,
0.1937255859375,
0.73828125,
0.34814453125,
1.716796875,
0.32080078125,
-0.2578125,
-0.147705078125,
0.057220458984375,
-0.234375,
-0.60400390625,
-0.38916015625,
-0.37158203125,
-0.119140625,
-0.398193359375,
-0.22998046875,
0.0257110595703125,
0.6533203125,
0.0811767578125,
-0.80615234375,
-0.042236328125,
0.08184814453125,
-0.84521484375,
0.7734375,
0.261474609375,
0.02947998046875,
0.07269287109375,
0.08599853515625,
-0.14208984375,
-0.35009765625,
-0.185791015625,
-0.5927734375,
0.2236328125,
-0.5849609375,
-0.5380859375,
-0.609375,
-1.0380859375,
-0.375732421875,
-0.33203125,
-0.476318359375,
-1.0390625,
0.1490478515625,
0.65185546875,
0.40625,
0.5107421875,
-0.51611328125,
0.397705078125,
1.123046875,
0.71630859375,
-0.351806640625,
0.80810546875,
0.36474609375,
-0.525390625,
0.08441162109375,
-0.0052032470703125,
0.6953125,
-0.33837890625,
-0.0105133056640625,
-0.297607421875,
0.5234375,
-0.9794921875,
-1.3837890625,
0.06396484375,
0.6513671875,
0.50341796875,
-0.54345703125,
-0.9306640625,
-0.401123046875,
-0.74755859375,
-0.046600341796875,
-0.78271484375,
0.6123046875,
0.388671875,
-0.09393310546875,
0.0287017822265625,
-1.0283203125,
4.31640625,
1.0087890625,
0.94677734375,
0.07049560546875,
-0.028228759765625,
0.970703125,
-0.0012559890747070312,
-0.31884765625,
0.1610107421875,
-0.3154296875,
0.7646484375,
-0.215576171875,
-0.088134765625,
0.65087890625,
0.1949462890625,
0.453125,
-0.48486328125,
-0.0171356201171875,
-0.247314453125,
-0.990234375,
-0.7939453125,
0.0758056640625,
0.2432861328125,
0.165283203125,
0.08551025390625,
0.093017578125,
0.57080078125,
-0.626953125,
-0.29052734375,
-0.63525390625,
-0.28369140625,
-0.7109375,
0.666015625,
-0.0755615234375,
-0.1834716796875,
0.50732421875,
0.1470947265625,
-0.62744140625,
0.057891845703125,
0.55517578125,
-0.30810546875,
-0.44873046875,
0.86669921875,
-0.8212890625,
0.197998046875,
0.5556640625,
-0.294677734375,
0.279541015625,
0.62841796875,
-0.421142578125,
0.78076171875,
-0.2249755859375,
0.73193359375,
-0.73681640625,
-0.671875,
0.04107666015625,
0.2283935546875,
-0.33349609375,
0.03997802734375,
0.3427734375,
0.2381591796875,
0.1112060546875,
0.050140380859375,
0.38818359375,
-0.68896484375,
0.68212890625,
0.2008056640625,
0.19287109375,
-0.5341796875,
0.09197998046875,
0.018310546875,
-0.137939453125,
-0.4248046875,
-0.50244140625,
0.57275390625,
0.2161865234375,
-0.0219268798828125,
0.30810546875,
0.471435546875,
-0.78955078125,
0.0018644332885742188,
0.0350341796875,
-0.3779296875,
-0.31396484375,
0.5810546875,
1.5830078125,
-0.75439453125,
-0.423828125,
-0.53466796875,
0.6142578125,
0.183349609375,
0.2802734375,
0.60400390625,
-0.91357421875,
-0.25048828125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.
Sergey totally forgot about the task until half an hour before the next lesson and hastily scribbled something down. But then he recollected that in the last lesson he learned the grammar of N-ish. The spelling rules state that N-ish contains some "forbidden" pairs of letters: such letters can never occur in a sentence next to each other. Also, the order of the letters doesn't matter (for example, if the pair of letters "ab" is forbidden, then any occurrences of substrings "ab" and "ba" are also forbidden). Also, each pair has different letters and each letter occurs in no more than one forbidden pair.
Now Sergey wants to correct his sentence so that it doesn't contain any "forbidden" pairs of letters that stand next to each other. However, he is running out of time, so he decided to simply cross out some letters from the sentence. What smallest number of letters will he have to cross out? When a letter is crossed out, it is "removed" so that the letters to its left and right (if they existed), become neighboring. For example, if we cross out the first letter from the string "aba", we get the string "ba", and if we cross out the second letter, we get "aa".
Input
The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105.
The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters.
Next k lines contain descriptions of forbidden pairs of letters. Each line contains exactly two different lowercase Latin letters without separators that represent the forbidden pairs. It is guaranteed that each letter is included in no more than one pair.
Output
Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters.
Examples
Input
ababa
1
ab
Output
2
Input
codeforces
2
do
cs
Output
1
Note
In the first sample you should remove two letters b.
In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution.
Submitted Solution:
```
ans = 0
t = []
x = input()
y = int(input())
for i in range(y):
z = input()
t.append(z)
#x = codeforces
#y = 2
#t = [do, cs]
pt = -1
ln = len(x)
for i in t:
a = i[0]
b = i[1]
pt = 0
for j in range(ln):
ded1=0
ded2=0
if j >= pt:
if x[j] in [a,b]:
pt = j
while pt < ln and x[pt] in [a,b]:
if x[pt] == a:
ded1+=1
else:
ded2+=1
pt += 1
ans += min(ded1, ded2)
print(ans)
```
Yes
| 45,647
|
[
0.30078125,
-0.062469482421875,
0.03240966796875,
0.20458984375,
-0.54833984375,
-0.6875,
0.06640625,
-0.06231689453125,
-0.203369140625,
0.943359375,
0.7431640625,
0.0479736328125,
-0.375244140625,
-0.91259765625,
-0.916015625,
-0.159423828125,
-0.9326171875,
-0.6044921875,
-0.5048828125,
-0.191162109375,
0.0599365234375,
-0.224365234375,
-1.6044921875,
-0.27880859375,
-0.45654296875,
1.1884765625,
0.309814453125,
-0.326416015625,
1.13671875,
0.72412109375,
-0.2783203125,
-0.2734375,
0.517578125,
-1.05859375,
-0.548828125,
-0.5869140625,
0.95166015625,
-0.46484375,
-0.0654296875,
-0.05462646484375,
0.572265625,
-0.25830078125,
0.467529296875,
-0.56005859375,
-1.3701171875,
-0.415771484375,
-0.09832763671875,
-0.5927734375,
-0.342529296875,
-0.442626953125,
0.3583984375,
-0.35888671875,
0.59765625,
-0.235595703125,
0.060516357421875,
0.28369140625,
0.256103515625,
0.1417236328125,
-0.78515625,
0.298583984375,
0.1729736328125,
0.319091796875,
0.1888427734375,
-0.8173828125,
-0.455810546875,
-0.08856201171875,
-0.2440185546875,
0.237548828125,
-0.00044155120849609375,
-0.461181640625,
-0.28466796875,
0.41259765625,
-0.390869140625,
-0.19189453125,
-0.64306640625,
0.07904052734375,
0.245361328125,
0.152099609375,
-0.65966796875,
0.89990234375,
0.29345703125,
1.1064453125,
0.72509765625,
-0.10723876953125,
-0.302734375,
-0.1356201171875,
0.06878662109375,
0.4150390625,
0.464599609375,
-0.2666015625,
-0.1451416015625,
0.446533203125,
-0.94091796875,
-0.201416015625,
0.6259765625,
0.396728515625,
-0.314697265625,
0.274658203125,
0.49560546875,
0.448974609375,
0.89501953125,
0.52490234375,
-0.287841796875,
0.87890625,
-0.5888671875,
0.11859130859375,
0.1024169921875,
0.1533203125,
0.015350341796875,
0.252685546875,
-0.22607421875,
-0.10162353515625,
0.459716796875,
0.484619140625,
-0.75341796875,
0.72119140625,
-0.2568359375,
0.428955078125,
-0.796875,
0.2294921875,
0.82080078125,
-0.07073974609375,
0.81787109375,
0.1185302734375,
0.2685546875,
-0.2265625,
-0.64697265625,
1.091796875,
-0.383056640625,
-0.02093505859375,
0.53564453125,
0.05596923828125,
-0.121337890625,
0.1397705078125,
-0.374267578125,
0.80517578125,
-0.30517578125,
0.61962890625,
0.55908203125,
-0.64453125,
0.5234375,
-0.1650390625,
0.01244354248046875,
1.5029296875,
0.634765625,
-0.1658935546875,
0.71533203125,
0.49951171875,
-0.92724609375,
0.1776123046875,
-1.3740234375,
0.85791015625,
0.051177978515625,
0.04443359375,
-0.6064453125,
-0.168701171875,
-0.216552734375,
0.06866455078125,
0.09478759765625,
0.1263427734375,
-0.437255859375,
0.18408203125,
-0.283203125,
0.63330078125,
-0.300048828125,
1.0244140625,
-0.6396484375,
0.03680419921875,
-0.1334228515625,
-0.54345703125,
0.2276611328125,
-0.03997802734375,
0.1929931640625,
1.064453125,
0.2119140625,
0.9189453125,
0.60400390625,
-0.313720703125,
0.6337890625,
0.5205078125,
-0.1890869140625,
0.383544921875,
0.17431640625,
0.41650390625,
0.5517578125,
0.419921875,
-0.144287109375,
-0.352294921875,
-0.78076171875,
-0.322509765625,
-0.040802001953125,
0.83544921875,
-0.421142578125,
0.410888671875,
-0.03094482421875,
-0.016510009765625,
-1.03125,
-0.307373046875,
0.1383056640625,
-1.1015625,
-0.5234375,
0.873046875,
0.16162109375,
0.68310546875,
-0.2763671875,
-0.671875,
0.54638671875,
1.462890625,
-0.276611328125,
0.351318359375,
0.7119140625,
-0.50732421875,
-0.29296875,
0.332763671875,
-0.1485595703125,
-0.1900634765625,
-0.85400390625,
0.69677734375,
-0.52685546875,
-0.024566650390625,
-0.2491455078125,
0.2227783203125,
0.247314453125,
0.66357421875,
-0.232666015625,
-0.40673828125,
0.7802734375,
1.1669921875,
-0.007129669189453125,
0.487548828125,
0.255859375,
0.77783203125,
0.1639404296875,
0.8193359375,
0.39404296875,
0.111572265625,
0.8974609375,
0.8515625,
0.08258056640625,
0.496826171875,
-0.1632080078125,
0.484375,
0.25927734375,
0.642578125,
0.432373046875,
0.2491455078125,
-0.310546875,
-0.0787353515625,
-0.31298828125,
0.141845703125,
-0.29736328125,
0.44384765625,
0.375,
0.487548828125,
-0.2041015625,
-0.1114501953125,
0.2425537109375,
0.7158203125,
-1.1689453125,
-0.55859375,
0.038299560546875,
0.1173095703125,
-0.0595703125,
0.0085601806640625,
0.169921875,
0.77197265625,
0.68310546875,
0.378662109375,
-0.56982421875,
-0.51416015625,
-1.1376953125,
-1.1005859375,
-1.0205078125,
-0.262939453125,
-0.8828125,
-0.08135986328125,
0.60595703125,
-1.0361328125,
0.439453125,
-0.365478515625,
-0.52392578125,
0.1236572265625,
-0.5576171875,
0.71240234375,
-0.196044921875,
0.78173828125,
-0.798828125,
0.693359375,
0.14990234375,
0.873046875,
-0.325439453125,
-0.33251953125,
-0.10137939453125,
-0.6357421875,
0.294189453125,
-0.07525634765625,
0.3232421875,
0.2763671875,
-0.6240234375,
-0.79931640625,
0.02734375,
-0.25927734375,
-0.609375,
0.1796875,
-0.77197265625,
0.80126953125,
0.91748046875,
-0.66748046875,
0.75537109375,
1.1669921875,
-0.93994140625,
0.08294677734375,
0.19677734375,
0.3642578125,
-0.5888671875,
1.1884765625,
0.343994140625,
0.3974609375,
-0.437255859375,
-0.52685546875,
-0.76904296875,
0.0267791748046875,
-0.006038665771484375,
-0.37841796875,
-0.0916748046875,
0.74755859375,
-0.255615234375,
-1.00390625,
0.77880859375,
-1.2822265625,
-0.06475830078125,
-0.07562255859375,
-0.62841796875,
1.0205078125,
0.451416015625,
0.355712890625,
-0.27001953125,
-0.845703125,
-0.2451171875,
0.82666015625,
0.1607666015625,
-0.58642578125,
0.0018444061279296875,
0.33740234375,
0.239501953125,
0.216552734375,
0.096435546875,
-0.2344970703125,
-0.3408203125,
0.0699462890625,
0.11981201171875,
0.99853515625,
0.28955078125,
0.4228515625,
0.273681640625,
0.837890625,
-0.6865234375,
-0.2587890625,
-0.27587890625,
0.716796875,
0.2900390625,
0.427001953125,
0.20068359375,
-0.1329345703125,
-0.48291015625,
-0.8369140625,
0.481201171875,
-0.36962890625,
0.79150390625,
-0.432861328125,
0.61669921875,
0.356201171875,
-0.556640625,
0.67578125,
-0.93115234375,
-0.344970703125,
0.8779296875,
-0.65673828125,
0.9697265625,
-0.98095703125,
0.1610107421875,
0.048980712890625,
0.069580078125,
0.68017578125,
0.59326171875,
0.8212890625,
-0.447021484375,
-0.5361328125,
-0.287841796875,
0.35400390625,
-0.1402587890625,
-0.478271484375,
0.11181640625,
-0.300537109375,
-0.513671875,
-0.9775390625,
0.489990234375,
0.78125,
0.64404296875,
0.28466796875,
0.36083984375,
0.1434326171875,
0.541015625,
0.95068359375,
0.017425537109375,
-0.05718994140625,
-0.77978515625,
0.984375,
0.02099609375,
-0.491455078125,
-0.343017578125,
-0.362060546875,
-0.342041015625,
0.2442626953125,
0.036468505859375,
0.06622314453125,
-0.92822265625,
-0.093505859375,
-0.12261962890625,
0.3408203125,
-0.77294921875,
-0.2763671875,
-0.1971435546875,
0.475341796875,
0.0760498046875,
-1.0712890625,
0.459716796875,
-0.720703125,
0.89404296875,
1.0283203125,
-0.00737762451171875,
-0.57958984375,
-0.09716796875,
-0.7021484375,
-0.95166015625,
-0.1475830078125,
0.603515625,
-0.123779296875,
0.2012939453125,
-1.3759765625,
0.5224609375,
0.385009765625,
-0.1368408203125,
0.316162109375,
0.1495361328125,
0.4951171875,
0.130126953125,
0.546875,
-0.62890625,
-0.66943359375,
0.384765625,
-1.142578125,
0.7314453125,
-0.59033203125,
0.58251953125,
-0.21240234375,
0.1688232421875,
0.145751953125,
0.48779296875,
-0.46435546875,
0.38818359375,
-0.0687255859375,
0.44482421875,
-1.0107421875,
-0.66650390625,
0.5283203125,
-0.1451416015625,
-0.71533203125,
0.53076171875,
0.2568359375,
-0.2998046875,
0.01102447509765625,
0.66748046875,
-0.442138671875,
0.49169921875,
-0.505859375,
0.64453125,
-0.08233642578125,
-0.74951171875,
-0.2144775390625,
-0.5263671875,
0.62939453125,
-0.242431640625,
-0.76318359375,
0.27978515625,
-1.1044921875,
-0.216064453125,
0.05621337890625,
-0.576171875,
0.41259765625,
0.290283203125,
0.11212158203125,
0.00106048583984375,
-0.48388671875,
-0.36572265625,
-0.18359375,
-0.51025390625,
-0.52001953125,
0.296875,
0.625,
0.66650390625,
0.25048828125,
-0.13720703125,
0.133056640625,
-0.0206298828125,
-0.1671142578125,
-0.60302734375,
-0.37255859375,
0.32470703125,
-0.58056640625,
-0.12353515625,
0.4013671875,
-0.0198211669921875,
0.39306640625,
0.86376953125,
-0.053314208984375,
0.229248046875,
0.323486328125,
-0.60107421875,
1.4384765625,
-0.142822265625,
-1.078125,
-0.41162109375,
0.2000732421875,
0.11907958984375,
0.66015625,
-0.2191162109375,
-0.74951171875,
-0.7392578125,
-1.1162109375,
0.12127685546875,
-0.56787109375,
-0.334228515625,
-0.91357421875,
-0.255859375,
-0.53271484375,
0.767578125,
-0.331787109375,
-0.357421875,
0.240478515625,
-1.3017578125,
0.206298828125,
-0.60791015625,
-0.335693359375,
-0.603515625,
-0.55859375,
-0.62255859375,
1.1220703125,
0.467041015625,
0.1578369140625,
0.4228515625,
-0.320556640625,
0.2354736328125,
-0.304443359375,
-0.59375,
-0.51513671875,
-0.20947265625,
0.293212890625,
-0.37841796875,
-0.3916015625,
-0.60693359375,
0.955078125,
-0.5078125,
0.2744140625,
-0.39306640625,
-0.52490234375,
-0.1783447265625,
-0.2047119140625,
0.80322265625,
-0.60498046875,
0.1904296875,
-0.59375,
0.56103515625,
0.409423828125,
-0.325927734375,
-0.53955078125,
-0.80908203125,
-0.55419921875,
-0.97021484375,
0.58544921875,
-0.5859375,
0.5986328125,
-0.7509765625,
-0.2418212890625,
0.9130859375,
-0.52197265625,
0.33984375,
1.431640625,
-0.1285400390625,
0.2283935546875,
-0.888671875,
0.63720703125,
-0.0269927978515625,
-0.6796875,
-0.304931640625,
-0.1119384765625,
-0.9345703125,
0.08038330078125,
-0.56494140625,
-0.873046875,
-0.54833984375,
0.73876953125,
1.3740234375,
-0.27099609375,
0.99169921875,
0.25537109375,
-1.201171875,
-0.78759765625,
0.75927734375,
0.39013671875,
0.51806640625,
1.1142578125,
-0.69482421875,
-0.1605224609375,
0.416015625,
-0.039276123046875,
-0.28369140625,
-0.197265625,
1.0185546875,
-0.46142578125,
-0.61279296875,
0.56005859375,
0.55322265625,
-1.1025390625,
-0.6337890625,
0.1180419921875,
-0.0272979736328125,
-0.027618408203125,
-0.6708984375,
0.2020263671875,
0.646484375,
-0.393310546875,
-0.013824462890625,
0.04400634765625,
-0.00948333740234375,
0.67724609375,
0.296875,
0.2890625,
-0.53955078125,
0.67626953125,
0.8642578125,
-0.80615234375,
-0.409912109375,
-0.89013671875,
-0.1422119140625,
-0.2081298828125,
0.296142578125,
0.7890625,
0.11431884765625,
0.2177734375,
0.76611328125,
-0.112060546875,
0.6572265625,
-0.47412109375,
-0.333251953125,
0.1614990234375,
-0.49365234375,
-0.250244140625,
-0.03656005859375,
0.20654296875,
0.1546630859375,
0.260009765625,
-0.6201171875,
-0.06719970703125,
0.494873046875,
0.32861328125,
-0.0484619140625,
-0.064208984375,
-0.350830078125,
-0.57861328125,
-0.4423828125,
-0.48681640625,
-0.8125,
-0.15380859375,
0.428466796875,
0.43115234375,
-0.72265625,
0.0382080078125,
0.8447265625,
-0.7978515625,
1.1630859375,
-0.79931640625,
0.31591796875,
-0.416748046875,
-0.16455078125,
-0.77685546875,
0.10595703125,
-0.486572265625,
-0.279296875,
-0.328369140625,
0.51171875,
0.40185546875,
0.5966796875,
-0.2371826171875,
0.246337890625,
-0.16357421875,
-0.77490234375,
-0.01462554931640625,
0.09051513671875,
0.054473876953125,
0.344970703125,
0.697265625,
0.4560546875,
0.1826171875,
-0.046173095703125,
-0.53662109375,
-0.427001953125,
0.1942138671875,
0.8984375,
0.00626373291015625,
-0.0687255859375,
-0.3115234375,
-0.0723876953125,
-0.60986328125,
0.2252197265625,
-0.26318359375,
-0.1207275390625,
0.08074951171875,
-0.76171875,
0.53515625,
1.2373046875,
-0.161376953125,
0.2152099609375,
-0.03314208984375,
0.369384765625,
0.388916015625,
0.1488037109375,
0.311279296875,
0.20703125,
0.06744384765625,
-0.228515625,
-0.09967041015625,
0.56591796875,
-0.00792694091796875,
0.4091796875,
-0.3388671875,
-0.7685546875,
-0.82080078125,
-0.0269317626953125,
-0.32666015625,
0.0227813720703125,
0.59375,
-0.8349609375,
-0.08984375,
0.135986328125,
-1.029296875,
0.21240234375,
-0.80810546875,
-0.7998046875,
0.1552734375,
-0.138427734375,
-0.79345703125,
-0.40234375,
-0.56103515625,
0.1148681640625,
0.212890625,
0.5009765625,
-0.74267578125,
0.171142578125,
-0.1153564453125,
0.3916015625,
-0.2607421875,
-0.08935546875,
0.096435546875,
0.2181396484375,
-0.53271484375,
-0.64794921875,
0.121337890625,
1.546875,
0.1912841796875,
-0.355712890625,
-0.66064453125,
0.133544921875,
-0.46533203125,
0.2083740234375,
-0.12359619140625,
-0.12432861328125,
-0.0298004150390625,
0.43994140625,
-1.1474609375,
-0.340087890625,
0.10650634765625,
0.337158203125,
-0.1324462890625,
-0.32958984375,
-0.2227783203125,
0.66162109375,
0.9306640625,
-0.1478271484375,
-0.0328369140625,
0.37646484375,
0.87890625,
-0.2890625,
-0.0989990234375,
-0.1290283203125,
0.323974609375,
0.56005859375,
0.365966796875,
-0.282470703125,
0.724609375,
0.9765625,
-0.3037109375,
-0.0789794921875,
0.51025390625,
0.049591064453125,
0.039154052734375,
-0.2274169921875,
-0.2296142578125,
-0.002803802490234375,
-0.034027099609375,
-0.82080078125,
0.2261962890625,
-0.329345703125,
-0.423583984375,
-0.1932373046875,
-0.71630859375,
1.0029296875,
-1.166015625,
0.42626953125,
-0.3193359375,
-0.1859130859375,
0.4609375,
0.95166015625,
0.037689208984375,
-0.0908203125,
0.495849609375,
0.438232421875,
0.64013671875,
0.83251953125,
0.2283935546875,
0.1160888671875,
-0.451904296875,
0.1641845703125,
0.0161285400390625,
0.023162841796875,
-0.5908203125,
-0.30615234375,
-1.2333984375,
0.64990234375,
-0.450927734375,
-0.09906005859375,
0.33984375,
-0.58056640625,
0.19384765625,
-0.303955078125,
0.83935546875,
-0.4794921875,
0.4287109375,
0.52734375,
-0.58740234375,
-0.46435546875,
0.85595703125,
-0.08673095703125,
0.39501953125,
0.209228515625,
0.7783203125,
0.3125,
1.7255859375,
0.2978515625,
-0.1956787109375,
-0.043060302734375,
0.053619384765625,
-0.1959228515625,
-0.59326171875,
-0.309814453125,
-0.311767578125,
-0.1688232421875,
-0.425537109375,
-0.339111328125,
-0.07940673828125,
0.6396484375,
0.059814453125,
-0.82666015625,
-0.08233642578125,
0.06561279296875,
-0.8720703125,
0.8359375,
0.136474609375,
0.1287841796875,
0.106689453125,
0.1329345703125,
-0.1568603515625,
-0.3369140625,
-0.1610107421875,
-0.4453125,
0.2100830078125,
-0.5205078125,
-0.55810546875,
-0.61865234375,
-0.9541015625,
-0.34423828125,
-0.26806640625,
-0.61669921875,
-0.92236328125,
0.185546875,
0.65869140625,
0.5009765625,
0.4609375,
-0.54638671875,
0.416748046875,
1.1513671875,
0.79345703125,
-0.427734375,
0.93798828125,
0.4228515625,
-0.58154296875,
0.01061248779296875,
-0.138916015625,
0.697265625,
-0.29345703125,
-0.061431884765625,
-0.274169921875,
0.415283203125,
-1.015625,
-1.3095703125,
0.0504150390625,
0.72802734375,
0.3671875,
-0.546875,
-1.00390625,
-0.462890625,
-0.81884765625,
-0.045867919921875,
-0.818359375,
0.63232421875,
0.382568359375,
-0.1622314453125,
0.04608154296875,
-1.0244140625,
4.2578125,
0.99658203125,
0.8515625,
0.07489013671875,
0.0121612548828125,
0.93896484375,
0.0192108154296875,
-0.400634765625,
0.196044921875,
-0.3740234375,
0.78466796875,
-0.283203125,
-0.1058349609375,
0.626953125,
0.1607666015625,
0.414794921875,
-0.4892578125,
-0.066650390625,
-0.206298828125,
-1.0107421875,
-0.87939453125,
0.1136474609375,
0.31787109375,
0.13720703125,
0.10650634765625,
0.127685546875,
0.68701171875,
-0.62939453125,
-0.34912109375,
-0.66455078125,
-0.270751953125,
-0.65234375,
0.7890625,
-0.019195556640625,
-0.060760498046875,
0.5166015625,
0.15966796875,
-0.58251953125,
0.041595458984375,
0.5908203125,
-0.34521484375,
-0.41064453125,
0.8740234375,
-0.79931640625,
0.1572265625,
0.60498046875,
-0.365478515625,
0.327880859375,
0.64013671875,
-0.486083984375,
0.712890625,
-0.1710205078125,
0.775390625,
-0.7861328125,
-0.69189453125,
0.059967041015625,
0.23681640625,
-0.26904296875,
0.093505859375,
0.3662109375,
0.161376953125,
0.11669921875,
-0.007656097412109375,
0.469970703125,
-0.76123046875,
0.61962890625,
0.2076416015625,
0.2049560546875,
-0.5634765625,
0.09027099609375,
0.00823211669921875,
-0.08270263671875,
-0.365234375,
-0.57177734375,
0.51708984375,
0.2265625,
-0.05084228515625,
0.33642578125,
0.53662109375,
-0.84130859375,
0.0175323486328125,
-0.037506103515625,
-0.333740234375,
-0.363525390625,
0.55517578125,
1.580078125,
-0.681640625,
-0.394287109375,
-0.53857421875,
0.59521484375,
0.204345703125,
0.34765625,
0.60107421875,
-0.90185546875,
-0.333251953125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.
Sergey totally forgot about the task until half an hour before the next lesson and hastily scribbled something down. But then he recollected that in the last lesson he learned the grammar of N-ish. The spelling rules state that N-ish contains some "forbidden" pairs of letters: such letters can never occur in a sentence next to each other. Also, the order of the letters doesn't matter (for example, if the pair of letters "ab" is forbidden, then any occurrences of substrings "ab" and "ba" are also forbidden). Also, each pair has different letters and each letter occurs in no more than one forbidden pair.
Now Sergey wants to correct his sentence so that it doesn't contain any "forbidden" pairs of letters that stand next to each other. However, he is running out of time, so he decided to simply cross out some letters from the sentence. What smallest number of letters will he have to cross out? When a letter is crossed out, it is "removed" so that the letters to its left and right (if they existed), become neighboring. For example, if we cross out the first letter from the string "aba", we get the string "ba", and if we cross out the second letter, we get "aa".
Input
The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105.
The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters.
Next k lines contain descriptions of forbidden pairs of letters. Each line contains exactly two different lowercase Latin letters without separators that represent the forbidden pairs. It is guaranteed that each letter is included in no more than one pair.
Output
Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters.
Examples
Input
ababa
1
ab
Output
2
Input
codeforces
2
do
cs
Output
1
Note
In the first sample you should remove two letters b.
In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution.
Submitted Solution:
```
import math
from os import startfile
import random
from queue import Queue
import time
import heapq
import sys
def main(arr,k):
arr+='.'
ans=0
for e in k:
a,b=e
cnt1,cnt2=0,0
for i in range(len(arr)):
if arr[i]==a:
cnt1+=1
elif arr[i]==b:
cnt2+=1
else:
ans+=min(cnt1,cnt2)
cnt1,cnt2=0,0
return ans
return ans
s=input()
m=int(input())
k=[]
for i in range(m):
k.append(input())
print(main(s,k))
```
No
| 45,648
|
[
0.30078125,
-0.062469482421875,
0.03240966796875,
0.20458984375,
-0.54833984375,
-0.6875,
0.06640625,
-0.06231689453125,
-0.203369140625,
0.943359375,
0.7431640625,
0.0479736328125,
-0.375244140625,
-0.91259765625,
-0.916015625,
-0.159423828125,
-0.9326171875,
-0.6044921875,
-0.5048828125,
-0.191162109375,
0.0599365234375,
-0.224365234375,
-1.6044921875,
-0.27880859375,
-0.45654296875,
1.1884765625,
0.309814453125,
-0.326416015625,
1.13671875,
0.72412109375,
-0.2783203125,
-0.2734375,
0.517578125,
-1.05859375,
-0.548828125,
-0.5869140625,
0.95166015625,
-0.46484375,
-0.0654296875,
-0.05462646484375,
0.572265625,
-0.25830078125,
0.467529296875,
-0.56005859375,
-1.3701171875,
-0.415771484375,
-0.09832763671875,
-0.5927734375,
-0.342529296875,
-0.442626953125,
0.3583984375,
-0.35888671875,
0.59765625,
-0.235595703125,
0.060516357421875,
0.28369140625,
0.256103515625,
0.1417236328125,
-0.78515625,
0.298583984375,
0.1729736328125,
0.319091796875,
0.1888427734375,
-0.8173828125,
-0.455810546875,
-0.08856201171875,
-0.2440185546875,
0.237548828125,
-0.00044155120849609375,
-0.461181640625,
-0.28466796875,
0.41259765625,
-0.390869140625,
-0.19189453125,
-0.64306640625,
0.07904052734375,
0.245361328125,
0.152099609375,
-0.65966796875,
0.89990234375,
0.29345703125,
1.1064453125,
0.72509765625,
-0.10723876953125,
-0.302734375,
-0.1356201171875,
0.06878662109375,
0.4150390625,
0.464599609375,
-0.2666015625,
-0.1451416015625,
0.446533203125,
-0.94091796875,
-0.201416015625,
0.6259765625,
0.396728515625,
-0.314697265625,
0.274658203125,
0.49560546875,
0.448974609375,
0.89501953125,
0.52490234375,
-0.287841796875,
0.87890625,
-0.5888671875,
0.11859130859375,
0.1024169921875,
0.1533203125,
0.015350341796875,
0.252685546875,
-0.22607421875,
-0.10162353515625,
0.459716796875,
0.484619140625,
-0.75341796875,
0.72119140625,
-0.2568359375,
0.428955078125,
-0.796875,
0.2294921875,
0.82080078125,
-0.07073974609375,
0.81787109375,
0.1185302734375,
0.2685546875,
-0.2265625,
-0.64697265625,
1.091796875,
-0.383056640625,
-0.02093505859375,
0.53564453125,
0.05596923828125,
-0.121337890625,
0.1397705078125,
-0.374267578125,
0.80517578125,
-0.30517578125,
0.61962890625,
0.55908203125,
-0.64453125,
0.5234375,
-0.1650390625,
0.01244354248046875,
1.5029296875,
0.634765625,
-0.1658935546875,
0.71533203125,
0.49951171875,
-0.92724609375,
0.1776123046875,
-1.3740234375,
0.85791015625,
0.051177978515625,
0.04443359375,
-0.6064453125,
-0.168701171875,
-0.216552734375,
0.06866455078125,
0.09478759765625,
0.1263427734375,
-0.437255859375,
0.18408203125,
-0.283203125,
0.63330078125,
-0.300048828125,
1.0244140625,
-0.6396484375,
0.03680419921875,
-0.1334228515625,
-0.54345703125,
0.2276611328125,
-0.03997802734375,
0.1929931640625,
1.064453125,
0.2119140625,
0.9189453125,
0.60400390625,
-0.313720703125,
0.6337890625,
0.5205078125,
-0.1890869140625,
0.383544921875,
0.17431640625,
0.41650390625,
0.5517578125,
0.419921875,
-0.144287109375,
-0.352294921875,
-0.78076171875,
-0.322509765625,
-0.040802001953125,
0.83544921875,
-0.421142578125,
0.410888671875,
-0.03094482421875,
-0.016510009765625,
-1.03125,
-0.307373046875,
0.1383056640625,
-1.1015625,
-0.5234375,
0.873046875,
0.16162109375,
0.68310546875,
-0.2763671875,
-0.671875,
0.54638671875,
1.462890625,
-0.276611328125,
0.351318359375,
0.7119140625,
-0.50732421875,
-0.29296875,
0.332763671875,
-0.1485595703125,
-0.1900634765625,
-0.85400390625,
0.69677734375,
-0.52685546875,
-0.024566650390625,
-0.2491455078125,
0.2227783203125,
0.247314453125,
0.66357421875,
-0.232666015625,
-0.40673828125,
0.7802734375,
1.1669921875,
-0.007129669189453125,
0.487548828125,
0.255859375,
0.77783203125,
0.1639404296875,
0.8193359375,
0.39404296875,
0.111572265625,
0.8974609375,
0.8515625,
0.08258056640625,
0.496826171875,
-0.1632080078125,
0.484375,
0.25927734375,
0.642578125,
0.432373046875,
0.2491455078125,
-0.310546875,
-0.0787353515625,
-0.31298828125,
0.141845703125,
-0.29736328125,
0.44384765625,
0.375,
0.487548828125,
-0.2041015625,
-0.1114501953125,
0.2425537109375,
0.7158203125,
-1.1689453125,
-0.55859375,
0.038299560546875,
0.1173095703125,
-0.0595703125,
0.0085601806640625,
0.169921875,
0.77197265625,
0.68310546875,
0.378662109375,
-0.56982421875,
-0.51416015625,
-1.1376953125,
-1.1005859375,
-1.0205078125,
-0.262939453125,
-0.8828125,
-0.08135986328125,
0.60595703125,
-1.0361328125,
0.439453125,
-0.365478515625,
-0.52392578125,
0.1236572265625,
-0.5576171875,
0.71240234375,
-0.196044921875,
0.78173828125,
-0.798828125,
0.693359375,
0.14990234375,
0.873046875,
-0.325439453125,
-0.33251953125,
-0.10137939453125,
-0.6357421875,
0.294189453125,
-0.07525634765625,
0.3232421875,
0.2763671875,
-0.6240234375,
-0.79931640625,
0.02734375,
-0.25927734375,
-0.609375,
0.1796875,
-0.77197265625,
0.80126953125,
0.91748046875,
-0.66748046875,
0.75537109375,
1.1669921875,
-0.93994140625,
0.08294677734375,
0.19677734375,
0.3642578125,
-0.5888671875,
1.1884765625,
0.343994140625,
0.3974609375,
-0.437255859375,
-0.52685546875,
-0.76904296875,
0.0267791748046875,
-0.006038665771484375,
-0.37841796875,
-0.0916748046875,
0.74755859375,
-0.255615234375,
-1.00390625,
0.77880859375,
-1.2822265625,
-0.06475830078125,
-0.07562255859375,
-0.62841796875,
1.0205078125,
0.451416015625,
0.355712890625,
-0.27001953125,
-0.845703125,
-0.2451171875,
0.82666015625,
0.1607666015625,
-0.58642578125,
0.0018444061279296875,
0.33740234375,
0.239501953125,
0.216552734375,
0.096435546875,
-0.2344970703125,
-0.3408203125,
0.0699462890625,
0.11981201171875,
0.99853515625,
0.28955078125,
0.4228515625,
0.273681640625,
0.837890625,
-0.6865234375,
-0.2587890625,
-0.27587890625,
0.716796875,
0.2900390625,
0.427001953125,
0.20068359375,
-0.1329345703125,
-0.48291015625,
-0.8369140625,
0.481201171875,
-0.36962890625,
0.79150390625,
-0.432861328125,
0.61669921875,
0.356201171875,
-0.556640625,
0.67578125,
-0.93115234375,
-0.344970703125,
0.8779296875,
-0.65673828125,
0.9697265625,
-0.98095703125,
0.1610107421875,
0.048980712890625,
0.069580078125,
0.68017578125,
0.59326171875,
0.8212890625,
-0.447021484375,
-0.5361328125,
-0.287841796875,
0.35400390625,
-0.1402587890625,
-0.478271484375,
0.11181640625,
-0.300537109375,
-0.513671875,
-0.9775390625,
0.489990234375,
0.78125,
0.64404296875,
0.28466796875,
0.36083984375,
0.1434326171875,
0.541015625,
0.95068359375,
0.017425537109375,
-0.05718994140625,
-0.77978515625,
0.984375,
0.02099609375,
-0.491455078125,
-0.343017578125,
-0.362060546875,
-0.342041015625,
0.2442626953125,
0.036468505859375,
0.06622314453125,
-0.92822265625,
-0.093505859375,
-0.12261962890625,
0.3408203125,
-0.77294921875,
-0.2763671875,
-0.1971435546875,
0.475341796875,
0.0760498046875,
-1.0712890625,
0.459716796875,
-0.720703125,
0.89404296875,
1.0283203125,
-0.00737762451171875,
-0.57958984375,
-0.09716796875,
-0.7021484375,
-0.95166015625,
-0.1475830078125,
0.603515625,
-0.123779296875,
0.2012939453125,
-1.3759765625,
0.5224609375,
0.385009765625,
-0.1368408203125,
0.316162109375,
0.1495361328125,
0.4951171875,
0.130126953125,
0.546875,
-0.62890625,
-0.66943359375,
0.384765625,
-1.142578125,
0.7314453125,
-0.59033203125,
0.58251953125,
-0.21240234375,
0.1688232421875,
0.145751953125,
0.48779296875,
-0.46435546875,
0.38818359375,
-0.0687255859375,
0.44482421875,
-1.0107421875,
-0.66650390625,
0.5283203125,
-0.1451416015625,
-0.71533203125,
0.53076171875,
0.2568359375,
-0.2998046875,
0.01102447509765625,
0.66748046875,
-0.442138671875,
0.49169921875,
-0.505859375,
0.64453125,
-0.08233642578125,
-0.74951171875,
-0.2144775390625,
-0.5263671875,
0.62939453125,
-0.242431640625,
-0.76318359375,
0.27978515625,
-1.1044921875,
-0.216064453125,
0.05621337890625,
-0.576171875,
0.41259765625,
0.290283203125,
0.11212158203125,
0.00106048583984375,
-0.48388671875,
-0.36572265625,
-0.18359375,
-0.51025390625,
-0.52001953125,
0.296875,
0.625,
0.66650390625,
0.25048828125,
-0.13720703125,
0.133056640625,
-0.0206298828125,
-0.1671142578125,
-0.60302734375,
-0.37255859375,
0.32470703125,
-0.58056640625,
-0.12353515625,
0.4013671875,
-0.0198211669921875,
0.39306640625,
0.86376953125,
-0.053314208984375,
0.229248046875,
0.323486328125,
-0.60107421875,
1.4384765625,
-0.142822265625,
-1.078125,
-0.41162109375,
0.2000732421875,
0.11907958984375,
0.66015625,
-0.2191162109375,
-0.74951171875,
-0.7392578125,
-1.1162109375,
0.12127685546875,
-0.56787109375,
-0.334228515625,
-0.91357421875,
-0.255859375,
-0.53271484375,
0.767578125,
-0.331787109375,
-0.357421875,
0.240478515625,
-1.3017578125,
0.206298828125,
-0.60791015625,
-0.335693359375,
-0.603515625,
-0.55859375,
-0.62255859375,
1.1220703125,
0.467041015625,
0.1578369140625,
0.4228515625,
-0.320556640625,
0.2354736328125,
-0.304443359375,
-0.59375,
-0.51513671875,
-0.20947265625,
0.293212890625,
-0.37841796875,
-0.3916015625,
-0.60693359375,
0.955078125,
-0.5078125,
0.2744140625,
-0.39306640625,
-0.52490234375,
-0.1783447265625,
-0.2047119140625,
0.80322265625,
-0.60498046875,
0.1904296875,
-0.59375,
0.56103515625,
0.409423828125,
-0.325927734375,
-0.53955078125,
-0.80908203125,
-0.55419921875,
-0.97021484375,
0.58544921875,
-0.5859375,
0.5986328125,
-0.7509765625,
-0.2418212890625,
0.9130859375,
-0.52197265625,
0.33984375,
1.431640625,
-0.1285400390625,
0.2283935546875,
-0.888671875,
0.63720703125,
-0.0269927978515625,
-0.6796875,
-0.304931640625,
-0.1119384765625,
-0.9345703125,
0.08038330078125,
-0.56494140625,
-0.873046875,
-0.54833984375,
0.73876953125,
1.3740234375,
-0.27099609375,
0.99169921875,
0.25537109375,
-1.201171875,
-0.78759765625,
0.75927734375,
0.39013671875,
0.51806640625,
1.1142578125,
-0.69482421875,
-0.1605224609375,
0.416015625,
-0.039276123046875,
-0.28369140625,
-0.197265625,
1.0185546875,
-0.46142578125,
-0.61279296875,
0.56005859375,
0.55322265625,
-1.1025390625,
-0.6337890625,
0.1180419921875,
-0.0272979736328125,
-0.027618408203125,
-0.6708984375,
0.2020263671875,
0.646484375,
-0.393310546875,
-0.013824462890625,
0.04400634765625,
-0.00948333740234375,
0.67724609375,
0.296875,
0.2890625,
-0.53955078125,
0.67626953125,
0.8642578125,
-0.80615234375,
-0.409912109375,
-0.89013671875,
-0.1422119140625,
-0.2081298828125,
0.296142578125,
0.7890625,
0.11431884765625,
0.2177734375,
0.76611328125,
-0.112060546875,
0.6572265625,
-0.47412109375,
-0.333251953125,
0.1614990234375,
-0.49365234375,
-0.250244140625,
-0.03656005859375,
0.20654296875,
0.1546630859375,
0.260009765625,
-0.6201171875,
-0.06719970703125,
0.494873046875,
0.32861328125,
-0.0484619140625,
-0.064208984375,
-0.350830078125,
-0.57861328125,
-0.4423828125,
-0.48681640625,
-0.8125,
-0.15380859375,
0.428466796875,
0.43115234375,
-0.72265625,
0.0382080078125,
0.8447265625,
-0.7978515625,
1.1630859375,
-0.79931640625,
0.31591796875,
-0.416748046875,
-0.16455078125,
-0.77685546875,
0.10595703125,
-0.486572265625,
-0.279296875,
-0.328369140625,
0.51171875,
0.40185546875,
0.5966796875,
-0.2371826171875,
0.246337890625,
-0.16357421875,
-0.77490234375,
-0.01462554931640625,
0.09051513671875,
0.054473876953125,
0.344970703125,
0.697265625,
0.4560546875,
0.1826171875,
-0.046173095703125,
-0.53662109375,
-0.427001953125,
0.1942138671875,
0.8984375,
0.00626373291015625,
-0.0687255859375,
-0.3115234375,
-0.0723876953125,
-0.60986328125,
0.2252197265625,
-0.26318359375,
-0.1207275390625,
0.08074951171875,
-0.76171875,
0.53515625,
1.2373046875,
-0.161376953125,
0.2152099609375,
-0.03314208984375,
0.369384765625,
0.388916015625,
0.1488037109375,
0.311279296875,
0.20703125,
0.06744384765625,
-0.228515625,
-0.09967041015625,
0.56591796875,
-0.00792694091796875,
0.4091796875,
-0.3388671875,
-0.7685546875,
-0.82080078125,
-0.0269317626953125,
-0.32666015625,
0.0227813720703125,
0.59375,
-0.8349609375,
-0.08984375,
0.135986328125,
-1.029296875,
0.21240234375,
-0.80810546875,
-0.7998046875,
0.1552734375,
-0.138427734375,
-0.79345703125,
-0.40234375,
-0.56103515625,
0.1148681640625,
0.212890625,
0.5009765625,
-0.74267578125,
0.171142578125,
-0.1153564453125,
0.3916015625,
-0.2607421875,
-0.08935546875,
0.096435546875,
0.2181396484375,
-0.53271484375,
-0.64794921875,
0.121337890625,
1.546875,
0.1912841796875,
-0.355712890625,
-0.66064453125,
0.133544921875,
-0.46533203125,
0.2083740234375,
-0.12359619140625,
-0.12432861328125,
-0.0298004150390625,
0.43994140625,
-1.1474609375,
-0.340087890625,
0.10650634765625,
0.337158203125,
-0.1324462890625,
-0.32958984375,
-0.2227783203125,
0.66162109375,
0.9306640625,
-0.1478271484375,
-0.0328369140625,
0.37646484375,
0.87890625,
-0.2890625,
-0.0989990234375,
-0.1290283203125,
0.323974609375,
0.56005859375,
0.365966796875,
-0.282470703125,
0.724609375,
0.9765625,
-0.3037109375,
-0.0789794921875,
0.51025390625,
0.049591064453125,
0.039154052734375,
-0.2274169921875,
-0.2296142578125,
-0.002803802490234375,
-0.034027099609375,
-0.82080078125,
0.2261962890625,
-0.329345703125,
-0.423583984375,
-0.1932373046875,
-0.71630859375,
1.0029296875,
-1.166015625,
0.42626953125,
-0.3193359375,
-0.1859130859375,
0.4609375,
0.95166015625,
0.037689208984375,
-0.0908203125,
0.495849609375,
0.438232421875,
0.64013671875,
0.83251953125,
0.2283935546875,
0.1160888671875,
-0.451904296875,
0.1641845703125,
0.0161285400390625,
0.023162841796875,
-0.5908203125,
-0.30615234375,
-1.2333984375,
0.64990234375,
-0.450927734375,
-0.09906005859375,
0.33984375,
-0.58056640625,
0.19384765625,
-0.303955078125,
0.83935546875,
-0.4794921875,
0.4287109375,
0.52734375,
-0.58740234375,
-0.46435546875,
0.85595703125,
-0.08673095703125,
0.39501953125,
0.209228515625,
0.7783203125,
0.3125,
1.7255859375,
0.2978515625,
-0.1956787109375,
-0.043060302734375,
0.053619384765625,
-0.1959228515625,
-0.59326171875,
-0.309814453125,
-0.311767578125,
-0.1688232421875,
-0.425537109375,
-0.339111328125,
-0.07940673828125,
0.6396484375,
0.059814453125,
-0.82666015625,
-0.08233642578125,
0.06561279296875,
-0.8720703125,
0.8359375,
0.136474609375,
0.1287841796875,
0.106689453125,
0.1329345703125,
-0.1568603515625,
-0.3369140625,
-0.1610107421875,
-0.4453125,
0.2100830078125,
-0.5205078125,
-0.55810546875,
-0.61865234375,
-0.9541015625,
-0.34423828125,
-0.26806640625,
-0.61669921875,
-0.92236328125,
0.185546875,
0.65869140625,
0.5009765625,
0.4609375,
-0.54638671875,
0.416748046875,
1.1513671875,
0.79345703125,
-0.427734375,
0.93798828125,
0.4228515625,
-0.58154296875,
0.01061248779296875,
-0.138916015625,
0.697265625,
-0.29345703125,
-0.061431884765625,
-0.274169921875,
0.415283203125,
-1.015625,
-1.3095703125,
0.0504150390625,
0.72802734375,
0.3671875,
-0.546875,
-1.00390625,
-0.462890625,
-0.81884765625,
-0.045867919921875,
-0.818359375,
0.63232421875,
0.382568359375,
-0.1622314453125,
0.04608154296875,
-1.0244140625,
4.2578125,
0.99658203125,
0.8515625,
0.07489013671875,
0.0121612548828125,
0.93896484375,
0.0192108154296875,
-0.400634765625,
0.196044921875,
-0.3740234375,
0.78466796875,
-0.283203125,
-0.1058349609375,
0.626953125,
0.1607666015625,
0.414794921875,
-0.4892578125,
-0.066650390625,
-0.206298828125,
-1.0107421875,
-0.87939453125,
0.1136474609375,
0.31787109375,
0.13720703125,
0.10650634765625,
0.127685546875,
0.68701171875,
-0.62939453125,
-0.34912109375,
-0.66455078125,
-0.270751953125,
-0.65234375,
0.7890625,
-0.019195556640625,
-0.060760498046875,
0.5166015625,
0.15966796875,
-0.58251953125,
0.041595458984375,
0.5908203125,
-0.34521484375,
-0.41064453125,
0.8740234375,
-0.79931640625,
0.1572265625,
0.60498046875,
-0.365478515625,
0.327880859375,
0.64013671875,
-0.486083984375,
0.712890625,
-0.1710205078125,
0.775390625,
-0.7861328125,
-0.69189453125,
0.059967041015625,
0.23681640625,
-0.26904296875,
0.093505859375,
0.3662109375,
0.161376953125,
0.11669921875,
-0.007656097412109375,
0.469970703125,
-0.76123046875,
0.61962890625,
0.2076416015625,
0.2049560546875,
-0.5634765625,
0.09027099609375,
0.00823211669921875,
-0.08270263671875,
-0.365234375,
-0.57177734375,
0.51708984375,
0.2265625,
-0.05084228515625,
0.33642578125,
0.53662109375,
-0.84130859375,
0.0175323486328125,
-0.037506103515625,
-0.333740234375,
-0.363525390625,
0.55517578125,
1.580078125,
-0.681640625,
-0.394287109375,
-0.53857421875,
0.59521484375,
0.204345703125,
0.34765625,
0.60107421875,
-0.90185546875,
-0.333251953125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.
Sergey totally forgot about the task until half an hour before the next lesson and hastily scribbled something down. But then he recollected that in the last lesson he learned the grammar of N-ish. The spelling rules state that N-ish contains some "forbidden" pairs of letters: such letters can never occur in a sentence next to each other. Also, the order of the letters doesn't matter (for example, if the pair of letters "ab" is forbidden, then any occurrences of substrings "ab" and "ba" are also forbidden). Also, each pair has different letters and each letter occurs in no more than one forbidden pair.
Now Sergey wants to correct his sentence so that it doesn't contain any "forbidden" pairs of letters that stand next to each other. However, he is running out of time, so he decided to simply cross out some letters from the sentence. What smallest number of letters will he have to cross out? When a letter is crossed out, it is "removed" so that the letters to its left and right (if they existed), become neighboring. For example, if we cross out the first letter from the string "aba", we get the string "ba", and if we cross out the second letter, we get "aa".
Input
The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105.
The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters.
Next k lines contain descriptions of forbidden pairs of letters. Each line contains exactly two different lowercase Latin letters without separators that represent the forbidden pairs. It is guaranteed that each letter is included in no more than one pair.
Output
Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters.
Examples
Input
ababa
1
ab
Output
2
Input
codeforces
2
do
cs
Output
1
Note
In the first sample you should remove two letters b.
In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution.
Submitted Solution:
```
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
# from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]
try:
# sys.setrecursionlimit(int(pow(10,4)))
sys.stdin = open("input.txt", "r")
# sys.stdout = open("../output.txt", "w")
except:
pass
def pmat(A):
for ele in A:
print(*ele,end="\n")
# def seive():
# prime=[1 for i in range(10**6+1)]
# prime[0]=0
# prime[1]=0
# for i in range(10**6+1):
# if(prime[i]):
# for j in range(2*i,10**6+1,i):
# prime[j]=0
# return prime
s=input()
k=L()[0]
d={}
for i in range(k):
x=input()
d[x[0]]=x[1]
d[x[1]]=x[0]
B=[s[0]]
cnt=0
for i in range(1,len(s)):
if d.get(s[i],0)==B[-1]:
cnt+=1
continue
B.append(s[i])
B1=[]
cnt1=0
for i in range(1,len(s)):
if B1 and d.get(s[i],0)==B1[-1]:
cnt1+=1
continue
B1.append(s[i])
print(min(cnt,cnt1))
endtime = time.time()
# print(f"Runtime of the program is {endtime - starttime}")
```
No
| 45,649
|
[
0.30078125,
-0.062469482421875,
0.03240966796875,
0.20458984375,
-0.54833984375,
-0.6875,
0.06640625,
-0.06231689453125,
-0.203369140625,
0.943359375,
0.7431640625,
0.0479736328125,
-0.375244140625,
-0.91259765625,
-0.916015625,
-0.159423828125,
-0.9326171875,
-0.6044921875,
-0.5048828125,
-0.191162109375,
0.0599365234375,
-0.224365234375,
-1.6044921875,
-0.27880859375,
-0.45654296875,
1.1884765625,
0.309814453125,
-0.326416015625,
1.13671875,
0.72412109375,
-0.2783203125,
-0.2734375,
0.517578125,
-1.05859375,
-0.548828125,
-0.5869140625,
0.95166015625,
-0.46484375,
-0.0654296875,
-0.05462646484375,
0.572265625,
-0.25830078125,
0.467529296875,
-0.56005859375,
-1.3701171875,
-0.415771484375,
-0.09832763671875,
-0.5927734375,
-0.342529296875,
-0.442626953125,
0.3583984375,
-0.35888671875,
0.59765625,
-0.235595703125,
0.060516357421875,
0.28369140625,
0.256103515625,
0.1417236328125,
-0.78515625,
0.298583984375,
0.1729736328125,
0.319091796875,
0.1888427734375,
-0.8173828125,
-0.455810546875,
-0.08856201171875,
-0.2440185546875,
0.237548828125,
-0.00044155120849609375,
-0.461181640625,
-0.28466796875,
0.41259765625,
-0.390869140625,
-0.19189453125,
-0.64306640625,
0.07904052734375,
0.245361328125,
0.152099609375,
-0.65966796875,
0.89990234375,
0.29345703125,
1.1064453125,
0.72509765625,
-0.10723876953125,
-0.302734375,
-0.1356201171875,
0.06878662109375,
0.4150390625,
0.464599609375,
-0.2666015625,
-0.1451416015625,
0.446533203125,
-0.94091796875,
-0.201416015625,
0.6259765625,
0.396728515625,
-0.314697265625,
0.274658203125,
0.49560546875,
0.448974609375,
0.89501953125,
0.52490234375,
-0.287841796875,
0.87890625,
-0.5888671875,
0.11859130859375,
0.1024169921875,
0.1533203125,
0.015350341796875,
0.252685546875,
-0.22607421875,
-0.10162353515625,
0.459716796875,
0.484619140625,
-0.75341796875,
0.72119140625,
-0.2568359375,
0.428955078125,
-0.796875,
0.2294921875,
0.82080078125,
-0.07073974609375,
0.81787109375,
0.1185302734375,
0.2685546875,
-0.2265625,
-0.64697265625,
1.091796875,
-0.383056640625,
-0.02093505859375,
0.53564453125,
0.05596923828125,
-0.121337890625,
0.1397705078125,
-0.374267578125,
0.80517578125,
-0.30517578125,
0.61962890625,
0.55908203125,
-0.64453125,
0.5234375,
-0.1650390625,
0.01244354248046875,
1.5029296875,
0.634765625,
-0.1658935546875,
0.71533203125,
0.49951171875,
-0.92724609375,
0.1776123046875,
-1.3740234375,
0.85791015625,
0.051177978515625,
0.04443359375,
-0.6064453125,
-0.168701171875,
-0.216552734375,
0.06866455078125,
0.09478759765625,
0.1263427734375,
-0.437255859375,
0.18408203125,
-0.283203125,
0.63330078125,
-0.300048828125,
1.0244140625,
-0.6396484375,
0.03680419921875,
-0.1334228515625,
-0.54345703125,
0.2276611328125,
-0.03997802734375,
0.1929931640625,
1.064453125,
0.2119140625,
0.9189453125,
0.60400390625,
-0.313720703125,
0.6337890625,
0.5205078125,
-0.1890869140625,
0.383544921875,
0.17431640625,
0.41650390625,
0.5517578125,
0.419921875,
-0.144287109375,
-0.352294921875,
-0.78076171875,
-0.322509765625,
-0.040802001953125,
0.83544921875,
-0.421142578125,
0.410888671875,
-0.03094482421875,
-0.016510009765625,
-1.03125,
-0.307373046875,
0.1383056640625,
-1.1015625,
-0.5234375,
0.873046875,
0.16162109375,
0.68310546875,
-0.2763671875,
-0.671875,
0.54638671875,
1.462890625,
-0.276611328125,
0.351318359375,
0.7119140625,
-0.50732421875,
-0.29296875,
0.332763671875,
-0.1485595703125,
-0.1900634765625,
-0.85400390625,
0.69677734375,
-0.52685546875,
-0.024566650390625,
-0.2491455078125,
0.2227783203125,
0.247314453125,
0.66357421875,
-0.232666015625,
-0.40673828125,
0.7802734375,
1.1669921875,
-0.007129669189453125,
0.487548828125,
0.255859375,
0.77783203125,
0.1639404296875,
0.8193359375,
0.39404296875,
0.111572265625,
0.8974609375,
0.8515625,
0.08258056640625,
0.496826171875,
-0.1632080078125,
0.484375,
0.25927734375,
0.642578125,
0.432373046875,
0.2491455078125,
-0.310546875,
-0.0787353515625,
-0.31298828125,
0.141845703125,
-0.29736328125,
0.44384765625,
0.375,
0.487548828125,
-0.2041015625,
-0.1114501953125,
0.2425537109375,
0.7158203125,
-1.1689453125,
-0.55859375,
0.038299560546875,
0.1173095703125,
-0.0595703125,
0.0085601806640625,
0.169921875,
0.77197265625,
0.68310546875,
0.378662109375,
-0.56982421875,
-0.51416015625,
-1.1376953125,
-1.1005859375,
-1.0205078125,
-0.262939453125,
-0.8828125,
-0.08135986328125,
0.60595703125,
-1.0361328125,
0.439453125,
-0.365478515625,
-0.52392578125,
0.1236572265625,
-0.5576171875,
0.71240234375,
-0.196044921875,
0.78173828125,
-0.798828125,
0.693359375,
0.14990234375,
0.873046875,
-0.325439453125,
-0.33251953125,
-0.10137939453125,
-0.6357421875,
0.294189453125,
-0.07525634765625,
0.3232421875,
0.2763671875,
-0.6240234375,
-0.79931640625,
0.02734375,
-0.25927734375,
-0.609375,
0.1796875,
-0.77197265625,
0.80126953125,
0.91748046875,
-0.66748046875,
0.75537109375,
1.1669921875,
-0.93994140625,
0.08294677734375,
0.19677734375,
0.3642578125,
-0.5888671875,
1.1884765625,
0.343994140625,
0.3974609375,
-0.437255859375,
-0.52685546875,
-0.76904296875,
0.0267791748046875,
-0.006038665771484375,
-0.37841796875,
-0.0916748046875,
0.74755859375,
-0.255615234375,
-1.00390625,
0.77880859375,
-1.2822265625,
-0.06475830078125,
-0.07562255859375,
-0.62841796875,
1.0205078125,
0.451416015625,
0.355712890625,
-0.27001953125,
-0.845703125,
-0.2451171875,
0.82666015625,
0.1607666015625,
-0.58642578125,
0.0018444061279296875,
0.33740234375,
0.239501953125,
0.216552734375,
0.096435546875,
-0.2344970703125,
-0.3408203125,
0.0699462890625,
0.11981201171875,
0.99853515625,
0.28955078125,
0.4228515625,
0.273681640625,
0.837890625,
-0.6865234375,
-0.2587890625,
-0.27587890625,
0.716796875,
0.2900390625,
0.427001953125,
0.20068359375,
-0.1329345703125,
-0.48291015625,
-0.8369140625,
0.481201171875,
-0.36962890625,
0.79150390625,
-0.432861328125,
0.61669921875,
0.356201171875,
-0.556640625,
0.67578125,
-0.93115234375,
-0.344970703125,
0.8779296875,
-0.65673828125,
0.9697265625,
-0.98095703125,
0.1610107421875,
0.048980712890625,
0.069580078125,
0.68017578125,
0.59326171875,
0.8212890625,
-0.447021484375,
-0.5361328125,
-0.287841796875,
0.35400390625,
-0.1402587890625,
-0.478271484375,
0.11181640625,
-0.300537109375,
-0.513671875,
-0.9775390625,
0.489990234375,
0.78125,
0.64404296875,
0.28466796875,
0.36083984375,
0.1434326171875,
0.541015625,
0.95068359375,
0.017425537109375,
-0.05718994140625,
-0.77978515625,
0.984375,
0.02099609375,
-0.491455078125,
-0.343017578125,
-0.362060546875,
-0.342041015625,
0.2442626953125,
0.036468505859375,
0.06622314453125,
-0.92822265625,
-0.093505859375,
-0.12261962890625,
0.3408203125,
-0.77294921875,
-0.2763671875,
-0.1971435546875,
0.475341796875,
0.0760498046875,
-1.0712890625,
0.459716796875,
-0.720703125,
0.89404296875,
1.0283203125,
-0.00737762451171875,
-0.57958984375,
-0.09716796875,
-0.7021484375,
-0.95166015625,
-0.1475830078125,
0.603515625,
-0.123779296875,
0.2012939453125,
-1.3759765625,
0.5224609375,
0.385009765625,
-0.1368408203125,
0.316162109375,
0.1495361328125,
0.4951171875,
0.130126953125,
0.546875,
-0.62890625,
-0.66943359375,
0.384765625,
-1.142578125,
0.7314453125,
-0.59033203125,
0.58251953125,
-0.21240234375,
0.1688232421875,
0.145751953125,
0.48779296875,
-0.46435546875,
0.38818359375,
-0.0687255859375,
0.44482421875,
-1.0107421875,
-0.66650390625,
0.5283203125,
-0.1451416015625,
-0.71533203125,
0.53076171875,
0.2568359375,
-0.2998046875,
0.01102447509765625,
0.66748046875,
-0.442138671875,
0.49169921875,
-0.505859375,
0.64453125,
-0.08233642578125,
-0.74951171875,
-0.2144775390625,
-0.5263671875,
0.62939453125,
-0.242431640625,
-0.76318359375,
0.27978515625,
-1.1044921875,
-0.216064453125,
0.05621337890625,
-0.576171875,
0.41259765625,
0.290283203125,
0.11212158203125,
0.00106048583984375,
-0.48388671875,
-0.36572265625,
-0.18359375,
-0.51025390625,
-0.52001953125,
0.296875,
0.625,
0.66650390625,
0.25048828125,
-0.13720703125,
0.133056640625,
-0.0206298828125,
-0.1671142578125,
-0.60302734375,
-0.37255859375,
0.32470703125,
-0.58056640625,
-0.12353515625,
0.4013671875,
-0.0198211669921875,
0.39306640625,
0.86376953125,
-0.053314208984375,
0.229248046875,
0.323486328125,
-0.60107421875,
1.4384765625,
-0.142822265625,
-1.078125,
-0.41162109375,
0.2000732421875,
0.11907958984375,
0.66015625,
-0.2191162109375,
-0.74951171875,
-0.7392578125,
-1.1162109375,
0.12127685546875,
-0.56787109375,
-0.334228515625,
-0.91357421875,
-0.255859375,
-0.53271484375,
0.767578125,
-0.331787109375,
-0.357421875,
0.240478515625,
-1.3017578125,
0.206298828125,
-0.60791015625,
-0.335693359375,
-0.603515625,
-0.55859375,
-0.62255859375,
1.1220703125,
0.467041015625,
0.1578369140625,
0.4228515625,
-0.320556640625,
0.2354736328125,
-0.304443359375,
-0.59375,
-0.51513671875,
-0.20947265625,
0.293212890625,
-0.37841796875,
-0.3916015625,
-0.60693359375,
0.955078125,
-0.5078125,
0.2744140625,
-0.39306640625,
-0.52490234375,
-0.1783447265625,
-0.2047119140625,
0.80322265625,
-0.60498046875,
0.1904296875,
-0.59375,
0.56103515625,
0.409423828125,
-0.325927734375,
-0.53955078125,
-0.80908203125,
-0.55419921875,
-0.97021484375,
0.58544921875,
-0.5859375,
0.5986328125,
-0.7509765625,
-0.2418212890625,
0.9130859375,
-0.52197265625,
0.33984375,
1.431640625,
-0.1285400390625,
0.2283935546875,
-0.888671875,
0.63720703125,
-0.0269927978515625,
-0.6796875,
-0.304931640625,
-0.1119384765625,
-0.9345703125,
0.08038330078125,
-0.56494140625,
-0.873046875,
-0.54833984375,
0.73876953125,
1.3740234375,
-0.27099609375,
0.99169921875,
0.25537109375,
-1.201171875,
-0.78759765625,
0.75927734375,
0.39013671875,
0.51806640625,
1.1142578125,
-0.69482421875,
-0.1605224609375,
0.416015625,
-0.039276123046875,
-0.28369140625,
-0.197265625,
1.0185546875,
-0.46142578125,
-0.61279296875,
0.56005859375,
0.55322265625,
-1.1025390625,
-0.6337890625,
0.1180419921875,
-0.0272979736328125,
-0.027618408203125,
-0.6708984375,
0.2020263671875,
0.646484375,
-0.393310546875,
-0.013824462890625,
0.04400634765625,
-0.00948333740234375,
0.67724609375,
0.296875,
0.2890625,
-0.53955078125,
0.67626953125,
0.8642578125,
-0.80615234375,
-0.409912109375,
-0.89013671875,
-0.1422119140625,
-0.2081298828125,
0.296142578125,
0.7890625,
0.11431884765625,
0.2177734375,
0.76611328125,
-0.112060546875,
0.6572265625,
-0.47412109375,
-0.333251953125,
0.1614990234375,
-0.49365234375,
-0.250244140625,
-0.03656005859375,
0.20654296875,
0.1546630859375,
0.260009765625,
-0.6201171875,
-0.06719970703125,
0.494873046875,
0.32861328125,
-0.0484619140625,
-0.064208984375,
-0.350830078125,
-0.57861328125,
-0.4423828125,
-0.48681640625,
-0.8125,
-0.15380859375,
0.428466796875,
0.43115234375,
-0.72265625,
0.0382080078125,
0.8447265625,
-0.7978515625,
1.1630859375,
-0.79931640625,
0.31591796875,
-0.416748046875,
-0.16455078125,
-0.77685546875,
0.10595703125,
-0.486572265625,
-0.279296875,
-0.328369140625,
0.51171875,
0.40185546875,
0.5966796875,
-0.2371826171875,
0.246337890625,
-0.16357421875,
-0.77490234375,
-0.01462554931640625,
0.09051513671875,
0.054473876953125,
0.344970703125,
0.697265625,
0.4560546875,
0.1826171875,
-0.046173095703125,
-0.53662109375,
-0.427001953125,
0.1942138671875,
0.8984375,
0.00626373291015625,
-0.0687255859375,
-0.3115234375,
-0.0723876953125,
-0.60986328125,
0.2252197265625,
-0.26318359375,
-0.1207275390625,
0.08074951171875,
-0.76171875,
0.53515625,
1.2373046875,
-0.161376953125,
0.2152099609375,
-0.03314208984375,
0.369384765625,
0.388916015625,
0.1488037109375,
0.311279296875,
0.20703125,
0.06744384765625,
-0.228515625,
-0.09967041015625,
0.56591796875,
-0.00792694091796875,
0.4091796875,
-0.3388671875,
-0.7685546875,
-0.82080078125,
-0.0269317626953125,
-0.32666015625,
0.0227813720703125,
0.59375,
-0.8349609375,
-0.08984375,
0.135986328125,
-1.029296875,
0.21240234375,
-0.80810546875,
-0.7998046875,
0.1552734375,
-0.138427734375,
-0.79345703125,
-0.40234375,
-0.56103515625,
0.1148681640625,
0.212890625,
0.5009765625,
-0.74267578125,
0.171142578125,
-0.1153564453125,
0.3916015625,
-0.2607421875,
-0.08935546875,
0.096435546875,
0.2181396484375,
-0.53271484375,
-0.64794921875,
0.121337890625,
1.546875,
0.1912841796875,
-0.355712890625,
-0.66064453125,
0.133544921875,
-0.46533203125,
0.2083740234375,
-0.12359619140625,
-0.12432861328125,
-0.0298004150390625,
0.43994140625,
-1.1474609375,
-0.340087890625,
0.10650634765625,
0.337158203125,
-0.1324462890625,
-0.32958984375,
-0.2227783203125,
0.66162109375,
0.9306640625,
-0.1478271484375,
-0.0328369140625,
0.37646484375,
0.87890625,
-0.2890625,
-0.0989990234375,
-0.1290283203125,
0.323974609375,
0.56005859375,
0.365966796875,
-0.282470703125,
0.724609375,
0.9765625,
-0.3037109375,
-0.0789794921875,
0.51025390625,
0.049591064453125,
0.039154052734375,
-0.2274169921875,
-0.2296142578125,
-0.002803802490234375,
-0.034027099609375,
-0.82080078125,
0.2261962890625,
-0.329345703125,
-0.423583984375,
-0.1932373046875,
-0.71630859375,
1.0029296875,
-1.166015625,
0.42626953125,
-0.3193359375,
-0.1859130859375,
0.4609375,
0.95166015625,
0.037689208984375,
-0.0908203125,
0.495849609375,
0.438232421875,
0.64013671875,
0.83251953125,
0.2283935546875,
0.1160888671875,
-0.451904296875,
0.1641845703125,
0.0161285400390625,
0.023162841796875,
-0.5908203125,
-0.30615234375,
-1.2333984375,
0.64990234375,
-0.450927734375,
-0.09906005859375,
0.33984375,
-0.58056640625,
0.19384765625,
-0.303955078125,
0.83935546875,
-0.4794921875,
0.4287109375,
0.52734375,
-0.58740234375,
-0.46435546875,
0.85595703125,
-0.08673095703125,
0.39501953125,
0.209228515625,
0.7783203125,
0.3125,
1.7255859375,
0.2978515625,
-0.1956787109375,
-0.043060302734375,
0.053619384765625,
-0.1959228515625,
-0.59326171875,
-0.309814453125,
-0.311767578125,
-0.1688232421875,
-0.425537109375,
-0.339111328125,
-0.07940673828125,
0.6396484375,
0.059814453125,
-0.82666015625,
-0.08233642578125,
0.06561279296875,
-0.8720703125,
0.8359375,
0.136474609375,
0.1287841796875,
0.106689453125,
0.1329345703125,
-0.1568603515625,
-0.3369140625,
-0.1610107421875,
-0.4453125,
0.2100830078125,
-0.5205078125,
-0.55810546875,
-0.61865234375,
-0.9541015625,
-0.34423828125,
-0.26806640625,
-0.61669921875,
-0.92236328125,
0.185546875,
0.65869140625,
0.5009765625,
0.4609375,
-0.54638671875,
0.416748046875,
1.1513671875,
0.79345703125,
-0.427734375,
0.93798828125,
0.4228515625,
-0.58154296875,
0.01061248779296875,
-0.138916015625,
0.697265625,
-0.29345703125,
-0.061431884765625,
-0.274169921875,
0.415283203125,
-1.015625,
-1.3095703125,
0.0504150390625,
0.72802734375,
0.3671875,
-0.546875,
-1.00390625,
-0.462890625,
-0.81884765625,
-0.045867919921875,
-0.818359375,
0.63232421875,
0.382568359375,
-0.1622314453125,
0.04608154296875,
-1.0244140625,
4.2578125,
0.99658203125,
0.8515625,
0.07489013671875,
0.0121612548828125,
0.93896484375,
0.0192108154296875,
-0.400634765625,
0.196044921875,
-0.3740234375,
0.78466796875,
-0.283203125,
-0.1058349609375,
0.626953125,
0.1607666015625,
0.414794921875,
-0.4892578125,
-0.066650390625,
-0.206298828125,
-1.0107421875,
-0.87939453125,
0.1136474609375,
0.31787109375,
0.13720703125,
0.10650634765625,
0.127685546875,
0.68701171875,
-0.62939453125,
-0.34912109375,
-0.66455078125,
-0.270751953125,
-0.65234375,
0.7890625,
-0.019195556640625,
-0.060760498046875,
0.5166015625,
0.15966796875,
-0.58251953125,
0.041595458984375,
0.5908203125,
-0.34521484375,
-0.41064453125,
0.8740234375,
-0.79931640625,
0.1572265625,
0.60498046875,
-0.365478515625,
0.327880859375,
0.64013671875,
-0.486083984375,
0.712890625,
-0.1710205078125,
0.775390625,
-0.7861328125,
-0.69189453125,
0.059967041015625,
0.23681640625,
-0.26904296875,
0.093505859375,
0.3662109375,
0.161376953125,
0.11669921875,
-0.007656097412109375,
0.469970703125,
-0.76123046875,
0.61962890625,
0.2076416015625,
0.2049560546875,
-0.5634765625,
0.09027099609375,
0.00823211669921875,
-0.08270263671875,
-0.365234375,
-0.57177734375,
0.51708984375,
0.2265625,
-0.05084228515625,
0.33642578125,
0.53662109375,
-0.84130859375,
0.0175323486328125,
-0.037506103515625,
-0.333740234375,
-0.363525390625,
0.55517578125,
1.580078125,
-0.681640625,
-0.394287109375,
-0.53857421875,
0.59521484375,
0.204345703125,
0.34765625,
0.60107421875,
-0.90185546875,
-0.333251953125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.
Sergey totally forgot about the task until half an hour before the next lesson and hastily scribbled something down. But then he recollected that in the last lesson he learned the grammar of N-ish. The spelling rules state that N-ish contains some "forbidden" pairs of letters: such letters can never occur in a sentence next to each other. Also, the order of the letters doesn't matter (for example, if the pair of letters "ab" is forbidden, then any occurrences of substrings "ab" and "ba" are also forbidden). Also, each pair has different letters and each letter occurs in no more than one forbidden pair.
Now Sergey wants to correct his sentence so that it doesn't contain any "forbidden" pairs of letters that stand next to each other. However, he is running out of time, so he decided to simply cross out some letters from the sentence. What smallest number of letters will he have to cross out? When a letter is crossed out, it is "removed" so that the letters to its left and right (if they existed), become neighboring. For example, if we cross out the first letter from the string "aba", we get the string "ba", and if we cross out the second letter, we get "aa".
Input
The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105.
The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters.
Next k lines contain descriptions of forbidden pairs of letters. Each line contains exactly two different lowercase Latin letters without separators that represent the forbidden pairs. It is guaranteed that each letter is included in no more than one pair.
Output
Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters.
Examples
Input
ababa
1
ab
Output
2
Input
codeforces
2
do
cs
Output
1
Note
In the first sample you should remove two letters b.
In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution.
Submitted Solution:
```
import math
from os import startfile
import random
from queue import Queue
import time
import heapq
import sys
def main(arr,k):
removed=[False]*(len(arr))
ans=0
for i in range(0,len(arr)-1):
mid=arr[i]
right=arr[i+1]
if not removed[i]:
right_s=True if (mid+right) in k or (right+mid) in k else False
if right_s:
removed[i+1]=True
ans+=1
return ans
s=input()
m=int(input())
k=set()
for i in range(m):
k.add(input())
print(main(s,k))
```
No
| 45,650
|
[
0.30078125,
-0.062469482421875,
0.03240966796875,
0.20458984375,
-0.54833984375,
-0.6875,
0.06640625,
-0.06231689453125,
-0.203369140625,
0.943359375,
0.7431640625,
0.0479736328125,
-0.375244140625,
-0.91259765625,
-0.916015625,
-0.159423828125,
-0.9326171875,
-0.6044921875,
-0.5048828125,
-0.191162109375,
0.0599365234375,
-0.224365234375,
-1.6044921875,
-0.27880859375,
-0.45654296875,
1.1884765625,
0.309814453125,
-0.326416015625,
1.13671875,
0.72412109375,
-0.2783203125,
-0.2734375,
0.517578125,
-1.05859375,
-0.548828125,
-0.5869140625,
0.95166015625,
-0.46484375,
-0.0654296875,
-0.05462646484375,
0.572265625,
-0.25830078125,
0.467529296875,
-0.56005859375,
-1.3701171875,
-0.415771484375,
-0.09832763671875,
-0.5927734375,
-0.342529296875,
-0.442626953125,
0.3583984375,
-0.35888671875,
0.59765625,
-0.235595703125,
0.060516357421875,
0.28369140625,
0.256103515625,
0.1417236328125,
-0.78515625,
0.298583984375,
0.1729736328125,
0.319091796875,
0.1888427734375,
-0.8173828125,
-0.455810546875,
-0.08856201171875,
-0.2440185546875,
0.237548828125,
-0.00044155120849609375,
-0.461181640625,
-0.28466796875,
0.41259765625,
-0.390869140625,
-0.19189453125,
-0.64306640625,
0.07904052734375,
0.245361328125,
0.152099609375,
-0.65966796875,
0.89990234375,
0.29345703125,
1.1064453125,
0.72509765625,
-0.10723876953125,
-0.302734375,
-0.1356201171875,
0.06878662109375,
0.4150390625,
0.464599609375,
-0.2666015625,
-0.1451416015625,
0.446533203125,
-0.94091796875,
-0.201416015625,
0.6259765625,
0.396728515625,
-0.314697265625,
0.274658203125,
0.49560546875,
0.448974609375,
0.89501953125,
0.52490234375,
-0.287841796875,
0.87890625,
-0.5888671875,
0.11859130859375,
0.1024169921875,
0.1533203125,
0.015350341796875,
0.252685546875,
-0.22607421875,
-0.10162353515625,
0.459716796875,
0.484619140625,
-0.75341796875,
0.72119140625,
-0.2568359375,
0.428955078125,
-0.796875,
0.2294921875,
0.82080078125,
-0.07073974609375,
0.81787109375,
0.1185302734375,
0.2685546875,
-0.2265625,
-0.64697265625,
1.091796875,
-0.383056640625,
-0.02093505859375,
0.53564453125,
0.05596923828125,
-0.121337890625,
0.1397705078125,
-0.374267578125,
0.80517578125,
-0.30517578125,
0.61962890625,
0.55908203125,
-0.64453125,
0.5234375,
-0.1650390625,
0.01244354248046875,
1.5029296875,
0.634765625,
-0.1658935546875,
0.71533203125,
0.49951171875,
-0.92724609375,
0.1776123046875,
-1.3740234375,
0.85791015625,
0.051177978515625,
0.04443359375,
-0.6064453125,
-0.168701171875,
-0.216552734375,
0.06866455078125,
0.09478759765625,
0.1263427734375,
-0.437255859375,
0.18408203125,
-0.283203125,
0.63330078125,
-0.300048828125,
1.0244140625,
-0.6396484375,
0.03680419921875,
-0.1334228515625,
-0.54345703125,
0.2276611328125,
-0.03997802734375,
0.1929931640625,
1.064453125,
0.2119140625,
0.9189453125,
0.60400390625,
-0.313720703125,
0.6337890625,
0.5205078125,
-0.1890869140625,
0.383544921875,
0.17431640625,
0.41650390625,
0.5517578125,
0.419921875,
-0.144287109375,
-0.352294921875,
-0.78076171875,
-0.322509765625,
-0.040802001953125,
0.83544921875,
-0.421142578125,
0.410888671875,
-0.03094482421875,
-0.016510009765625,
-1.03125,
-0.307373046875,
0.1383056640625,
-1.1015625,
-0.5234375,
0.873046875,
0.16162109375,
0.68310546875,
-0.2763671875,
-0.671875,
0.54638671875,
1.462890625,
-0.276611328125,
0.351318359375,
0.7119140625,
-0.50732421875,
-0.29296875,
0.332763671875,
-0.1485595703125,
-0.1900634765625,
-0.85400390625,
0.69677734375,
-0.52685546875,
-0.024566650390625,
-0.2491455078125,
0.2227783203125,
0.247314453125,
0.66357421875,
-0.232666015625,
-0.40673828125,
0.7802734375,
1.1669921875,
-0.007129669189453125,
0.487548828125,
0.255859375,
0.77783203125,
0.1639404296875,
0.8193359375,
0.39404296875,
0.111572265625,
0.8974609375,
0.8515625,
0.08258056640625,
0.496826171875,
-0.1632080078125,
0.484375,
0.25927734375,
0.642578125,
0.432373046875,
0.2491455078125,
-0.310546875,
-0.0787353515625,
-0.31298828125,
0.141845703125,
-0.29736328125,
0.44384765625,
0.375,
0.487548828125,
-0.2041015625,
-0.1114501953125,
0.2425537109375,
0.7158203125,
-1.1689453125,
-0.55859375,
0.038299560546875,
0.1173095703125,
-0.0595703125,
0.0085601806640625,
0.169921875,
0.77197265625,
0.68310546875,
0.378662109375,
-0.56982421875,
-0.51416015625,
-1.1376953125,
-1.1005859375,
-1.0205078125,
-0.262939453125,
-0.8828125,
-0.08135986328125,
0.60595703125,
-1.0361328125,
0.439453125,
-0.365478515625,
-0.52392578125,
0.1236572265625,
-0.5576171875,
0.71240234375,
-0.196044921875,
0.78173828125,
-0.798828125,
0.693359375,
0.14990234375,
0.873046875,
-0.325439453125,
-0.33251953125,
-0.10137939453125,
-0.6357421875,
0.294189453125,
-0.07525634765625,
0.3232421875,
0.2763671875,
-0.6240234375,
-0.79931640625,
0.02734375,
-0.25927734375,
-0.609375,
0.1796875,
-0.77197265625,
0.80126953125,
0.91748046875,
-0.66748046875,
0.75537109375,
1.1669921875,
-0.93994140625,
0.08294677734375,
0.19677734375,
0.3642578125,
-0.5888671875,
1.1884765625,
0.343994140625,
0.3974609375,
-0.437255859375,
-0.52685546875,
-0.76904296875,
0.0267791748046875,
-0.006038665771484375,
-0.37841796875,
-0.0916748046875,
0.74755859375,
-0.255615234375,
-1.00390625,
0.77880859375,
-1.2822265625,
-0.06475830078125,
-0.07562255859375,
-0.62841796875,
1.0205078125,
0.451416015625,
0.355712890625,
-0.27001953125,
-0.845703125,
-0.2451171875,
0.82666015625,
0.1607666015625,
-0.58642578125,
0.0018444061279296875,
0.33740234375,
0.239501953125,
0.216552734375,
0.096435546875,
-0.2344970703125,
-0.3408203125,
0.0699462890625,
0.11981201171875,
0.99853515625,
0.28955078125,
0.4228515625,
0.273681640625,
0.837890625,
-0.6865234375,
-0.2587890625,
-0.27587890625,
0.716796875,
0.2900390625,
0.427001953125,
0.20068359375,
-0.1329345703125,
-0.48291015625,
-0.8369140625,
0.481201171875,
-0.36962890625,
0.79150390625,
-0.432861328125,
0.61669921875,
0.356201171875,
-0.556640625,
0.67578125,
-0.93115234375,
-0.344970703125,
0.8779296875,
-0.65673828125,
0.9697265625,
-0.98095703125,
0.1610107421875,
0.048980712890625,
0.069580078125,
0.68017578125,
0.59326171875,
0.8212890625,
-0.447021484375,
-0.5361328125,
-0.287841796875,
0.35400390625,
-0.1402587890625,
-0.478271484375,
0.11181640625,
-0.300537109375,
-0.513671875,
-0.9775390625,
0.489990234375,
0.78125,
0.64404296875,
0.28466796875,
0.36083984375,
0.1434326171875,
0.541015625,
0.95068359375,
0.017425537109375,
-0.05718994140625,
-0.77978515625,
0.984375,
0.02099609375,
-0.491455078125,
-0.343017578125,
-0.362060546875,
-0.342041015625,
0.2442626953125,
0.036468505859375,
0.06622314453125,
-0.92822265625,
-0.093505859375,
-0.12261962890625,
0.3408203125,
-0.77294921875,
-0.2763671875,
-0.1971435546875,
0.475341796875,
0.0760498046875,
-1.0712890625,
0.459716796875,
-0.720703125,
0.89404296875,
1.0283203125,
-0.00737762451171875,
-0.57958984375,
-0.09716796875,
-0.7021484375,
-0.95166015625,
-0.1475830078125,
0.603515625,
-0.123779296875,
0.2012939453125,
-1.3759765625,
0.5224609375,
0.385009765625,
-0.1368408203125,
0.316162109375,
0.1495361328125,
0.4951171875,
0.130126953125,
0.546875,
-0.62890625,
-0.66943359375,
0.384765625,
-1.142578125,
0.7314453125,
-0.59033203125,
0.58251953125,
-0.21240234375,
0.1688232421875,
0.145751953125,
0.48779296875,
-0.46435546875,
0.38818359375,
-0.0687255859375,
0.44482421875,
-1.0107421875,
-0.66650390625,
0.5283203125,
-0.1451416015625,
-0.71533203125,
0.53076171875,
0.2568359375,
-0.2998046875,
0.01102447509765625,
0.66748046875,
-0.442138671875,
0.49169921875,
-0.505859375,
0.64453125,
-0.08233642578125,
-0.74951171875,
-0.2144775390625,
-0.5263671875,
0.62939453125,
-0.242431640625,
-0.76318359375,
0.27978515625,
-1.1044921875,
-0.216064453125,
0.05621337890625,
-0.576171875,
0.41259765625,
0.290283203125,
0.11212158203125,
0.00106048583984375,
-0.48388671875,
-0.36572265625,
-0.18359375,
-0.51025390625,
-0.52001953125,
0.296875,
0.625,
0.66650390625,
0.25048828125,
-0.13720703125,
0.133056640625,
-0.0206298828125,
-0.1671142578125,
-0.60302734375,
-0.37255859375,
0.32470703125,
-0.58056640625,
-0.12353515625,
0.4013671875,
-0.0198211669921875,
0.39306640625,
0.86376953125,
-0.053314208984375,
0.229248046875,
0.323486328125,
-0.60107421875,
1.4384765625,
-0.142822265625,
-1.078125,
-0.41162109375,
0.2000732421875,
0.11907958984375,
0.66015625,
-0.2191162109375,
-0.74951171875,
-0.7392578125,
-1.1162109375,
0.12127685546875,
-0.56787109375,
-0.334228515625,
-0.91357421875,
-0.255859375,
-0.53271484375,
0.767578125,
-0.331787109375,
-0.357421875,
0.240478515625,
-1.3017578125,
0.206298828125,
-0.60791015625,
-0.335693359375,
-0.603515625,
-0.55859375,
-0.62255859375,
1.1220703125,
0.467041015625,
0.1578369140625,
0.4228515625,
-0.320556640625,
0.2354736328125,
-0.304443359375,
-0.59375,
-0.51513671875,
-0.20947265625,
0.293212890625,
-0.37841796875,
-0.3916015625,
-0.60693359375,
0.955078125,
-0.5078125,
0.2744140625,
-0.39306640625,
-0.52490234375,
-0.1783447265625,
-0.2047119140625,
0.80322265625,
-0.60498046875,
0.1904296875,
-0.59375,
0.56103515625,
0.409423828125,
-0.325927734375,
-0.53955078125,
-0.80908203125,
-0.55419921875,
-0.97021484375,
0.58544921875,
-0.5859375,
0.5986328125,
-0.7509765625,
-0.2418212890625,
0.9130859375,
-0.52197265625,
0.33984375,
1.431640625,
-0.1285400390625,
0.2283935546875,
-0.888671875,
0.63720703125,
-0.0269927978515625,
-0.6796875,
-0.304931640625,
-0.1119384765625,
-0.9345703125,
0.08038330078125,
-0.56494140625,
-0.873046875,
-0.54833984375,
0.73876953125,
1.3740234375,
-0.27099609375,
0.99169921875,
0.25537109375,
-1.201171875,
-0.78759765625,
0.75927734375,
0.39013671875,
0.51806640625,
1.1142578125,
-0.69482421875,
-0.1605224609375,
0.416015625,
-0.039276123046875,
-0.28369140625,
-0.197265625,
1.0185546875,
-0.46142578125,
-0.61279296875,
0.56005859375,
0.55322265625,
-1.1025390625,
-0.6337890625,
0.1180419921875,
-0.0272979736328125,
-0.027618408203125,
-0.6708984375,
0.2020263671875,
0.646484375,
-0.393310546875,
-0.013824462890625,
0.04400634765625,
-0.00948333740234375,
0.67724609375,
0.296875,
0.2890625,
-0.53955078125,
0.67626953125,
0.8642578125,
-0.80615234375,
-0.409912109375,
-0.89013671875,
-0.1422119140625,
-0.2081298828125,
0.296142578125,
0.7890625,
0.11431884765625,
0.2177734375,
0.76611328125,
-0.112060546875,
0.6572265625,
-0.47412109375,
-0.333251953125,
0.1614990234375,
-0.49365234375,
-0.250244140625,
-0.03656005859375,
0.20654296875,
0.1546630859375,
0.260009765625,
-0.6201171875,
-0.06719970703125,
0.494873046875,
0.32861328125,
-0.0484619140625,
-0.064208984375,
-0.350830078125,
-0.57861328125,
-0.4423828125,
-0.48681640625,
-0.8125,
-0.15380859375,
0.428466796875,
0.43115234375,
-0.72265625,
0.0382080078125,
0.8447265625,
-0.7978515625,
1.1630859375,
-0.79931640625,
0.31591796875,
-0.416748046875,
-0.16455078125,
-0.77685546875,
0.10595703125,
-0.486572265625,
-0.279296875,
-0.328369140625,
0.51171875,
0.40185546875,
0.5966796875,
-0.2371826171875,
0.246337890625,
-0.16357421875,
-0.77490234375,
-0.01462554931640625,
0.09051513671875,
0.054473876953125,
0.344970703125,
0.697265625,
0.4560546875,
0.1826171875,
-0.046173095703125,
-0.53662109375,
-0.427001953125,
0.1942138671875,
0.8984375,
0.00626373291015625,
-0.0687255859375,
-0.3115234375,
-0.0723876953125,
-0.60986328125,
0.2252197265625,
-0.26318359375,
-0.1207275390625,
0.08074951171875,
-0.76171875,
0.53515625,
1.2373046875,
-0.161376953125,
0.2152099609375,
-0.03314208984375,
0.369384765625,
0.388916015625,
0.1488037109375,
0.311279296875,
0.20703125,
0.06744384765625,
-0.228515625,
-0.09967041015625,
0.56591796875,
-0.00792694091796875,
0.4091796875,
-0.3388671875,
-0.7685546875,
-0.82080078125,
-0.0269317626953125,
-0.32666015625,
0.0227813720703125,
0.59375,
-0.8349609375,
-0.08984375,
0.135986328125,
-1.029296875,
0.21240234375,
-0.80810546875,
-0.7998046875,
0.1552734375,
-0.138427734375,
-0.79345703125,
-0.40234375,
-0.56103515625,
0.1148681640625,
0.212890625,
0.5009765625,
-0.74267578125,
0.171142578125,
-0.1153564453125,
0.3916015625,
-0.2607421875,
-0.08935546875,
0.096435546875,
0.2181396484375,
-0.53271484375,
-0.64794921875,
0.121337890625,
1.546875,
0.1912841796875,
-0.355712890625,
-0.66064453125,
0.133544921875,
-0.46533203125,
0.2083740234375,
-0.12359619140625,
-0.12432861328125,
-0.0298004150390625,
0.43994140625,
-1.1474609375,
-0.340087890625,
0.10650634765625,
0.337158203125,
-0.1324462890625,
-0.32958984375,
-0.2227783203125,
0.66162109375,
0.9306640625,
-0.1478271484375,
-0.0328369140625,
0.37646484375,
0.87890625,
-0.2890625,
-0.0989990234375,
-0.1290283203125,
0.323974609375,
0.56005859375,
0.365966796875,
-0.282470703125,
0.724609375,
0.9765625,
-0.3037109375,
-0.0789794921875,
0.51025390625,
0.049591064453125,
0.039154052734375,
-0.2274169921875,
-0.2296142578125,
-0.002803802490234375,
-0.034027099609375,
-0.82080078125,
0.2261962890625,
-0.329345703125,
-0.423583984375,
-0.1932373046875,
-0.71630859375,
1.0029296875,
-1.166015625,
0.42626953125,
-0.3193359375,
-0.1859130859375,
0.4609375,
0.95166015625,
0.037689208984375,
-0.0908203125,
0.495849609375,
0.438232421875,
0.64013671875,
0.83251953125,
0.2283935546875,
0.1160888671875,
-0.451904296875,
0.1641845703125,
0.0161285400390625,
0.023162841796875,
-0.5908203125,
-0.30615234375,
-1.2333984375,
0.64990234375,
-0.450927734375,
-0.09906005859375,
0.33984375,
-0.58056640625,
0.19384765625,
-0.303955078125,
0.83935546875,
-0.4794921875,
0.4287109375,
0.52734375,
-0.58740234375,
-0.46435546875,
0.85595703125,
-0.08673095703125,
0.39501953125,
0.209228515625,
0.7783203125,
0.3125,
1.7255859375,
0.2978515625,
-0.1956787109375,
-0.043060302734375,
0.053619384765625,
-0.1959228515625,
-0.59326171875,
-0.309814453125,
-0.311767578125,
-0.1688232421875,
-0.425537109375,
-0.339111328125,
-0.07940673828125,
0.6396484375,
0.059814453125,
-0.82666015625,
-0.08233642578125,
0.06561279296875,
-0.8720703125,
0.8359375,
0.136474609375,
0.1287841796875,
0.106689453125,
0.1329345703125,
-0.1568603515625,
-0.3369140625,
-0.1610107421875,
-0.4453125,
0.2100830078125,
-0.5205078125,
-0.55810546875,
-0.61865234375,
-0.9541015625,
-0.34423828125,
-0.26806640625,
-0.61669921875,
-0.92236328125,
0.185546875,
0.65869140625,
0.5009765625,
0.4609375,
-0.54638671875,
0.416748046875,
1.1513671875,
0.79345703125,
-0.427734375,
0.93798828125,
0.4228515625,
-0.58154296875,
0.01061248779296875,
-0.138916015625,
0.697265625,
-0.29345703125,
-0.061431884765625,
-0.274169921875,
0.415283203125,
-1.015625,
-1.3095703125,
0.0504150390625,
0.72802734375,
0.3671875,
-0.546875,
-1.00390625,
-0.462890625,
-0.81884765625,
-0.045867919921875,
-0.818359375,
0.63232421875,
0.382568359375,
-0.1622314453125,
0.04608154296875,
-1.0244140625,
4.2578125,
0.99658203125,
0.8515625,
0.07489013671875,
0.0121612548828125,
0.93896484375,
0.0192108154296875,
-0.400634765625,
0.196044921875,
-0.3740234375,
0.78466796875,
-0.283203125,
-0.1058349609375,
0.626953125,
0.1607666015625,
0.414794921875,
-0.4892578125,
-0.066650390625,
-0.206298828125,
-1.0107421875,
-0.87939453125,
0.1136474609375,
0.31787109375,
0.13720703125,
0.10650634765625,
0.127685546875,
0.68701171875,
-0.62939453125,
-0.34912109375,
-0.66455078125,
-0.270751953125,
-0.65234375,
0.7890625,
-0.019195556640625,
-0.060760498046875,
0.5166015625,
0.15966796875,
-0.58251953125,
0.041595458984375,
0.5908203125,
-0.34521484375,
-0.41064453125,
0.8740234375,
-0.79931640625,
0.1572265625,
0.60498046875,
-0.365478515625,
0.327880859375,
0.64013671875,
-0.486083984375,
0.712890625,
-0.1710205078125,
0.775390625,
-0.7861328125,
-0.69189453125,
0.059967041015625,
0.23681640625,
-0.26904296875,
0.093505859375,
0.3662109375,
0.161376953125,
0.11669921875,
-0.007656097412109375,
0.469970703125,
-0.76123046875,
0.61962890625,
0.2076416015625,
0.2049560546875,
-0.5634765625,
0.09027099609375,
0.00823211669921875,
-0.08270263671875,
-0.365234375,
-0.57177734375,
0.51708984375,
0.2265625,
-0.05084228515625,
0.33642578125,
0.53662109375,
-0.84130859375,
0.0175323486328125,
-0.037506103515625,
-0.333740234375,
-0.363525390625,
0.55517578125,
1.580078125,
-0.681640625,
-0.394287109375,
-0.53857421875,
0.59521484375,
0.204345703125,
0.34765625,
0.60107421875,
-0.90185546875,
-0.333251953125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.
Sergey totally forgot about the task until half an hour before the next lesson and hastily scribbled something down. But then he recollected that in the last lesson he learned the grammar of N-ish. The spelling rules state that N-ish contains some "forbidden" pairs of letters: such letters can never occur in a sentence next to each other. Also, the order of the letters doesn't matter (for example, if the pair of letters "ab" is forbidden, then any occurrences of substrings "ab" and "ba" are also forbidden). Also, each pair has different letters and each letter occurs in no more than one forbidden pair.
Now Sergey wants to correct his sentence so that it doesn't contain any "forbidden" pairs of letters that stand next to each other. However, he is running out of time, so he decided to simply cross out some letters from the sentence. What smallest number of letters will he have to cross out? When a letter is crossed out, it is "removed" so that the letters to its left and right (if they existed), become neighboring. For example, if we cross out the first letter from the string "aba", we get the string "ba", and if we cross out the second letter, we get "aa".
Input
The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105.
The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters.
Next k lines contain descriptions of forbidden pairs of letters. Each line contains exactly two different lowercase Latin letters without separators that represent the forbidden pairs. It is guaranteed that each letter is included in no more than one pair.
Output
Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters.
Examples
Input
ababa
1
ab
Output
2
Input
codeforces
2
do
cs
Output
1
Note
In the first sample you should remove two letters b.
In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution.
Submitted Solution:
```
ans = 0
t = []
x = input()
y = int(input())
for i in range(y):
z = input()
t.append(z)
#x = codeforces
#y = 2
#t = [do, cs]
pt = -1
ln = len(x)
for i in t:
a = i[0]
b = i[1]
for j in range(ln):
ded1=0
ded2=0
if j >= pt:
if x[j] in [a,b]:
pt = j
while pt < ln and x[pt] in [a,b]:
if x[pt] == a:
ded1+=1
else:
ded2+=1
pt += 1
ans += min(ded1, ded2)
print(ans)
```
No
| 45,651
|
[
0.30078125,
-0.062469482421875,
0.03240966796875,
0.20458984375,
-0.54833984375,
-0.6875,
0.06640625,
-0.06231689453125,
-0.203369140625,
0.943359375,
0.7431640625,
0.0479736328125,
-0.375244140625,
-0.91259765625,
-0.916015625,
-0.159423828125,
-0.9326171875,
-0.6044921875,
-0.5048828125,
-0.191162109375,
0.0599365234375,
-0.224365234375,
-1.6044921875,
-0.27880859375,
-0.45654296875,
1.1884765625,
0.309814453125,
-0.326416015625,
1.13671875,
0.72412109375,
-0.2783203125,
-0.2734375,
0.517578125,
-1.05859375,
-0.548828125,
-0.5869140625,
0.95166015625,
-0.46484375,
-0.0654296875,
-0.05462646484375,
0.572265625,
-0.25830078125,
0.467529296875,
-0.56005859375,
-1.3701171875,
-0.415771484375,
-0.09832763671875,
-0.5927734375,
-0.342529296875,
-0.442626953125,
0.3583984375,
-0.35888671875,
0.59765625,
-0.235595703125,
0.060516357421875,
0.28369140625,
0.256103515625,
0.1417236328125,
-0.78515625,
0.298583984375,
0.1729736328125,
0.319091796875,
0.1888427734375,
-0.8173828125,
-0.455810546875,
-0.08856201171875,
-0.2440185546875,
0.237548828125,
-0.00044155120849609375,
-0.461181640625,
-0.28466796875,
0.41259765625,
-0.390869140625,
-0.19189453125,
-0.64306640625,
0.07904052734375,
0.245361328125,
0.152099609375,
-0.65966796875,
0.89990234375,
0.29345703125,
1.1064453125,
0.72509765625,
-0.10723876953125,
-0.302734375,
-0.1356201171875,
0.06878662109375,
0.4150390625,
0.464599609375,
-0.2666015625,
-0.1451416015625,
0.446533203125,
-0.94091796875,
-0.201416015625,
0.6259765625,
0.396728515625,
-0.314697265625,
0.274658203125,
0.49560546875,
0.448974609375,
0.89501953125,
0.52490234375,
-0.287841796875,
0.87890625,
-0.5888671875,
0.11859130859375,
0.1024169921875,
0.1533203125,
0.015350341796875,
0.252685546875,
-0.22607421875,
-0.10162353515625,
0.459716796875,
0.484619140625,
-0.75341796875,
0.72119140625,
-0.2568359375,
0.428955078125,
-0.796875,
0.2294921875,
0.82080078125,
-0.07073974609375,
0.81787109375,
0.1185302734375,
0.2685546875,
-0.2265625,
-0.64697265625,
1.091796875,
-0.383056640625,
-0.02093505859375,
0.53564453125,
0.05596923828125,
-0.121337890625,
0.1397705078125,
-0.374267578125,
0.80517578125,
-0.30517578125,
0.61962890625,
0.55908203125,
-0.64453125,
0.5234375,
-0.1650390625,
0.01244354248046875,
1.5029296875,
0.634765625,
-0.1658935546875,
0.71533203125,
0.49951171875,
-0.92724609375,
0.1776123046875,
-1.3740234375,
0.85791015625,
0.051177978515625,
0.04443359375,
-0.6064453125,
-0.168701171875,
-0.216552734375,
0.06866455078125,
0.09478759765625,
0.1263427734375,
-0.437255859375,
0.18408203125,
-0.283203125,
0.63330078125,
-0.300048828125,
1.0244140625,
-0.6396484375,
0.03680419921875,
-0.1334228515625,
-0.54345703125,
0.2276611328125,
-0.03997802734375,
0.1929931640625,
1.064453125,
0.2119140625,
0.9189453125,
0.60400390625,
-0.313720703125,
0.6337890625,
0.5205078125,
-0.1890869140625,
0.383544921875,
0.17431640625,
0.41650390625,
0.5517578125,
0.419921875,
-0.144287109375,
-0.352294921875,
-0.78076171875,
-0.322509765625,
-0.040802001953125,
0.83544921875,
-0.421142578125,
0.410888671875,
-0.03094482421875,
-0.016510009765625,
-1.03125,
-0.307373046875,
0.1383056640625,
-1.1015625,
-0.5234375,
0.873046875,
0.16162109375,
0.68310546875,
-0.2763671875,
-0.671875,
0.54638671875,
1.462890625,
-0.276611328125,
0.351318359375,
0.7119140625,
-0.50732421875,
-0.29296875,
0.332763671875,
-0.1485595703125,
-0.1900634765625,
-0.85400390625,
0.69677734375,
-0.52685546875,
-0.024566650390625,
-0.2491455078125,
0.2227783203125,
0.247314453125,
0.66357421875,
-0.232666015625,
-0.40673828125,
0.7802734375,
1.1669921875,
-0.007129669189453125,
0.487548828125,
0.255859375,
0.77783203125,
0.1639404296875,
0.8193359375,
0.39404296875,
0.111572265625,
0.8974609375,
0.8515625,
0.08258056640625,
0.496826171875,
-0.1632080078125,
0.484375,
0.25927734375,
0.642578125,
0.432373046875,
0.2491455078125,
-0.310546875,
-0.0787353515625,
-0.31298828125,
0.141845703125,
-0.29736328125,
0.44384765625,
0.375,
0.487548828125,
-0.2041015625,
-0.1114501953125,
0.2425537109375,
0.7158203125,
-1.1689453125,
-0.55859375,
0.038299560546875,
0.1173095703125,
-0.0595703125,
0.0085601806640625,
0.169921875,
0.77197265625,
0.68310546875,
0.378662109375,
-0.56982421875,
-0.51416015625,
-1.1376953125,
-1.1005859375,
-1.0205078125,
-0.262939453125,
-0.8828125,
-0.08135986328125,
0.60595703125,
-1.0361328125,
0.439453125,
-0.365478515625,
-0.52392578125,
0.1236572265625,
-0.5576171875,
0.71240234375,
-0.196044921875,
0.78173828125,
-0.798828125,
0.693359375,
0.14990234375,
0.873046875,
-0.325439453125,
-0.33251953125,
-0.10137939453125,
-0.6357421875,
0.294189453125,
-0.07525634765625,
0.3232421875,
0.2763671875,
-0.6240234375,
-0.79931640625,
0.02734375,
-0.25927734375,
-0.609375,
0.1796875,
-0.77197265625,
0.80126953125,
0.91748046875,
-0.66748046875,
0.75537109375,
1.1669921875,
-0.93994140625,
0.08294677734375,
0.19677734375,
0.3642578125,
-0.5888671875,
1.1884765625,
0.343994140625,
0.3974609375,
-0.437255859375,
-0.52685546875,
-0.76904296875,
0.0267791748046875,
-0.006038665771484375,
-0.37841796875,
-0.0916748046875,
0.74755859375,
-0.255615234375,
-1.00390625,
0.77880859375,
-1.2822265625,
-0.06475830078125,
-0.07562255859375,
-0.62841796875,
1.0205078125,
0.451416015625,
0.355712890625,
-0.27001953125,
-0.845703125,
-0.2451171875,
0.82666015625,
0.1607666015625,
-0.58642578125,
0.0018444061279296875,
0.33740234375,
0.239501953125,
0.216552734375,
0.096435546875,
-0.2344970703125,
-0.3408203125,
0.0699462890625,
0.11981201171875,
0.99853515625,
0.28955078125,
0.4228515625,
0.273681640625,
0.837890625,
-0.6865234375,
-0.2587890625,
-0.27587890625,
0.716796875,
0.2900390625,
0.427001953125,
0.20068359375,
-0.1329345703125,
-0.48291015625,
-0.8369140625,
0.481201171875,
-0.36962890625,
0.79150390625,
-0.432861328125,
0.61669921875,
0.356201171875,
-0.556640625,
0.67578125,
-0.93115234375,
-0.344970703125,
0.8779296875,
-0.65673828125,
0.9697265625,
-0.98095703125,
0.1610107421875,
0.048980712890625,
0.069580078125,
0.68017578125,
0.59326171875,
0.8212890625,
-0.447021484375,
-0.5361328125,
-0.287841796875,
0.35400390625,
-0.1402587890625,
-0.478271484375,
0.11181640625,
-0.300537109375,
-0.513671875,
-0.9775390625,
0.489990234375,
0.78125,
0.64404296875,
0.28466796875,
0.36083984375,
0.1434326171875,
0.541015625,
0.95068359375,
0.017425537109375,
-0.05718994140625,
-0.77978515625,
0.984375,
0.02099609375,
-0.491455078125,
-0.343017578125,
-0.362060546875,
-0.342041015625,
0.2442626953125,
0.036468505859375,
0.06622314453125,
-0.92822265625,
-0.093505859375,
-0.12261962890625,
0.3408203125,
-0.77294921875,
-0.2763671875,
-0.1971435546875,
0.475341796875,
0.0760498046875,
-1.0712890625,
0.459716796875,
-0.720703125,
0.89404296875,
1.0283203125,
-0.00737762451171875,
-0.57958984375,
-0.09716796875,
-0.7021484375,
-0.95166015625,
-0.1475830078125,
0.603515625,
-0.123779296875,
0.2012939453125,
-1.3759765625,
0.5224609375,
0.385009765625,
-0.1368408203125,
0.316162109375,
0.1495361328125,
0.4951171875,
0.130126953125,
0.546875,
-0.62890625,
-0.66943359375,
0.384765625,
-1.142578125,
0.7314453125,
-0.59033203125,
0.58251953125,
-0.21240234375,
0.1688232421875,
0.145751953125,
0.48779296875,
-0.46435546875,
0.38818359375,
-0.0687255859375,
0.44482421875,
-1.0107421875,
-0.66650390625,
0.5283203125,
-0.1451416015625,
-0.71533203125,
0.53076171875,
0.2568359375,
-0.2998046875,
0.01102447509765625,
0.66748046875,
-0.442138671875,
0.49169921875,
-0.505859375,
0.64453125,
-0.08233642578125,
-0.74951171875,
-0.2144775390625,
-0.5263671875,
0.62939453125,
-0.242431640625,
-0.76318359375,
0.27978515625,
-1.1044921875,
-0.216064453125,
0.05621337890625,
-0.576171875,
0.41259765625,
0.290283203125,
0.11212158203125,
0.00106048583984375,
-0.48388671875,
-0.36572265625,
-0.18359375,
-0.51025390625,
-0.52001953125,
0.296875,
0.625,
0.66650390625,
0.25048828125,
-0.13720703125,
0.133056640625,
-0.0206298828125,
-0.1671142578125,
-0.60302734375,
-0.37255859375,
0.32470703125,
-0.58056640625,
-0.12353515625,
0.4013671875,
-0.0198211669921875,
0.39306640625,
0.86376953125,
-0.053314208984375,
0.229248046875,
0.323486328125,
-0.60107421875,
1.4384765625,
-0.142822265625,
-1.078125,
-0.41162109375,
0.2000732421875,
0.11907958984375,
0.66015625,
-0.2191162109375,
-0.74951171875,
-0.7392578125,
-1.1162109375,
0.12127685546875,
-0.56787109375,
-0.334228515625,
-0.91357421875,
-0.255859375,
-0.53271484375,
0.767578125,
-0.331787109375,
-0.357421875,
0.240478515625,
-1.3017578125,
0.206298828125,
-0.60791015625,
-0.335693359375,
-0.603515625,
-0.55859375,
-0.62255859375,
1.1220703125,
0.467041015625,
0.1578369140625,
0.4228515625,
-0.320556640625,
0.2354736328125,
-0.304443359375,
-0.59375,
-0.51513671875,
-0.20947265625,
0.293212890625,
-0.37841796875,
-0.3916015625,
-0.60693359375,
0.955078125,
-0.5078125,
0.2744140625,
-0.39306640625,
-0.52490234375,
-0.1783447265625,
-0.2047119140625,
0.80322265625,
-0.60498046875,
0.1904296875,
-0.59375,
0.56103515625,
0.409423828125,
-0.325927734375,
-0.53955078125,
-0.80908203125,
-0.55419921875,
-0.97021484375,
0.58544921875,
-0.5859375,
0.5986328125,
-0.7509765625,
-0.2418212890625,
0.9130859375,
-0.52197265625,
0.33984375,
1.431640625,
-0.1285400390625,
0.2283935546875,
-0.888671875,
0.63720703125,
-0.0269927978515625,
-0.6796875,
-0.304931640625,
-0.1119384765625,
-0.9345703125,
0.08038330078125,
-0.56494140625,
-0.873046875,
-0.54833984375,
0.73876953125,
1.3740234375,
-0.27099609375,
0.99169921875,
0.25537109375,
-1.201171875,
-0.78759765625,
0.75927734375,
0.39013671875,
0.51806640625,
1.1142578125,
-0.69482421875,
-0.1605224609375,
0.416015625,
-0.039276123046875,
-0.28369140625,
-0.197265625,
1.0185546875,
-0.46142578125,
-0.61279296875,
0.56005859375,
0.55322265625,
-1.1025390625,
-0.6337890625,
0.1180419921875,
-0.0272979736328125,
-0.027618408203125,
-0.6708984375,
0.2020263671875,
0.646484375,
-0.393310546875,
-0.013824462890625,
0.04400634765625,
-0.00948333740234375,
0.67724609375,
0.296875,
0.2890625,
-0.53955078125,
0.67626953125,
0.8642578125,
-0.80615234375,
-0.409912109375,
-0.89013671875,
-0.1422119140625,
-0.2081298828125,
0.296142578125,
0.7890625,
0.11431884765625,
0.2177734375,
0.76611328125,
-0.112060546875,
0.6572265625,
-0.47412109375,
-0.333251953125,
0.1614990234375,
-0.49365234375,
-0.250244140625,
-0.03656005859375,
0.20654296875,
0.1546630859375,
0.260009765625,
-0.6201171875,
-0.06719970703125,
0.494873046875,
0.32861328125,
-0.0484619140625,
-0.064208984375,
-0.350830078125,
-0.57861328125,
-0.4423828125,
-0.48681640625,
-0.8125,
-0.15380859375,
0.428466796875,
0.43115234375,
-0.72265625,
0.0382080078125,
0.8447265625,
-0.7978515625,
1.1630859375,
-0.79931640625,
0.31591796875,
-0.416748046875,
-0.16455078125,
-0.77685546875,
0.10595703125,
-0.486572265625,
-0.279296875,
-0.328369140625,
0.51171875,
0.40185546875,
0.5966796875,
-0.2371826171875,
0.246337890625,
-0.16357421875,
-0.77490234375,
-0.01462554931640625,
0.09051513671875,
0.054473876953125,
0.344970703125,
0.697265625,
0.4560546875,
0.1826171875,
-0.046173095703125,
-0.53662109375,
-0.427001953125,
0.1942138671875,
0.8984375,
0.00626373291015625,
-0.0687255859375,
-0.3115234375,
-0.0723876953125,
-0.60986328125,
0.2252197265625,
-0.26318359375,
-0.1207275390625,
0.08074951171875,
-0.76171875,
0.53515625,
1.2373046875,
-0.161376953125,
0.2152099609375,
-0.03314208984375,
0.369384765625,
0.388916015625,
0.1488037109375,
0.311279296875,
0.20703125,
0.06744384765625,
-0.228515625,
-0.09967041015625,
0.56591796875,
-0.00792694091796875,
0.4091796875,
-0.3388671875,
-0.7685546875,
-0.82080078125,
-0.0269317626953125,
-0.32666015625,
0.0227813720703125,
0.59375,
-0.8349609375,
-0.08984375,
0.135986328125,
-1.029296875,
0.21240234375,
-0.80810546875,
-0.7998046875,
0.1552734375,
-0.138427734375,
-0.79345703125,
-0.40234375,
-0.56103515625,
0.1148681640625,
0.212890625,
0.5009765625,
-0.74267578125,
0.171142578125,
-0.1153564453125,
0.3916015625,
-0.2607421875,
-0.08935546875,
0.096435546875,
0.2181396484375,
-0.53271484375,
-0.64794921875,
0.121337890625,
1.546875,
0.1912841796875,
-0.355712890625,
-0.66064453125,
0.133544921875,
-0.46533203125,
0.2083740234375,
-0.12359619140625,
-0.12432861328125,
-0.0298004150390625,
0.43994140625,
-1.1474609375,
-0.340087890625,
0.10650634765625,
0.337158203125,
-0.1324462890625,
-0.32958984375,
-0.2227783203125,
0.66162109375,
0.9306640625,
-0.1478271484375,
-0.0328369140625,
0.37646484375,
0.87890625,
-0.2890625,
-0.0989990234375,
-0.1290283203125,
0.323974609375,
0.56005859375,
0.365966796875,
-0.282470703125,
0.724609375,
0.9765625,
-0.3037109375,
-0.0789794921875,
0.51025390625,
0.049591064453125,
0.039154052734375,
-0.2274169921875,
-0.2296142578125,
-0.002803802490234375,
-0.034027099609375,
-0.82080078125,
0.2261962890625,
-0.329345703125,
-0.423583984375,
-0.1932373046875,
-0.71630859375,
1.0029296875,
-1.166015625,
0.42626953125,
-0.3193359375,
-0.1859130859375,
0.4609375,
0.95166015625,
0.037689208984375,
-0.0908203125,
0.495849609375,
0.438232421875,
0.64013671875,
0.83251953125,
0.2283935546875,
0.1160888671875,
-0.451904296875,
0.1641845703125,
0.0161285400390625,
0.023162841796875,
-0.5908203125,
-0.30615234375,
-1.2333984375,
0.64990234375,
-0.450927734375,
-0.09906005859375,
0.33984375,
-0.58056640625,
0.19384765625,
-0.303955078125,
0.83935546875,
-0.4794921875,
0.4287109375,
0.52734375,
-0.58740234375,
-0.46435546875,
0.85595703125,
-0.08673095703125,
0.39501953125,
0.209228515625,
0.7783203125,
0.3125,
1.7255859375,
0.2978515625,
-0.1956787109375,
-0.043060302734375,
0.053619384765625,
-0.1959228515625,
-0.59326171875,
-0.309814453125,
-0.311767578125,
-0.1688232421875,
-0.425537109375,
-0.339111328125,
-0.07940673828125,
0.6396484375,
0.059814453125,
-0.82666015625,
-0.08233642578125,
0.06561279296875,
-0.8720703125,
0.8359375,
0.136474609375,
0.1287841796875,
0.106689453125,
0.1329345703125,
-0.1568603515625,
-0.3369140625,
-0.1610107421875,
-0.4453125,
0.2100830078125,
-0.5205078125,
-0.55810546875,
-0.61865234375,
-0.9541015625,
-0.34423828125,
-0.26806640625,
-0.61669921875,
-0.92236328125,
0.185546875,
0.65869140625,
0.5009765625,
0.4609375,
-0.54638671875,
0.416748046875,
1.1513671875,
0.79345703125,
-0.427734375,
0.93798828125,
0.4228515625,
-0.58154296875,
0.01061248779296875,
-0.138916015625,
0.697265625,
-0.29345703125,
-0.061431884765625,
-0.274169921875,
0.415283203125,
-1.015625,
-1.3095703125,
0.0504150390625,
0.72802734375,
0.3671875,
-0.546875,
-1.00390625,
-0.462890625,
-0.81884765625,
-0.045867919921875,
-0.818359375,
0.63232421875,
0.382568359375,
-0.1622314453125,
0.04608154296875,
-1.0244140625,
4.2578125,
0.99658203125,
0.8515625,
0.07489013671875,
0.0121612548828125,
0.93896484375,
0.0192108154296875,
-0.400634765625,
0.196044921875,
-0.3740234375,
0.78466796875,
-0.283203125,
-0.1058349609375,
0.626953125,
0.1607666015625,
0.414794921875,
-0.4892578125,
-0.066650390625,
-0.206298828125,
-1.0107421875,
-0.87939453125,
0.1136474609375,
0.31787109375,
0.13720703125,
0.10650634765625,
0.127685546875,
0.68701171875,
-0.62939453125,
-0.34912109375,
-0.66455078125,
-0.270751953125,
-0.65234375,
0.7890625,
-0.019195556640625,
-0.060760498046875,
0.5166015625,
0.15966796875,
-0.58251953125,
0.041595458984375,
0.5908203125,
-0.34521484375,
-0.41064453125,
0.8740234375,
-0.79931640625,
0.1572265625,
0.60498046875,
-0.365478515625,
0.327880859375,
0.64013671875,
-0.486083984375,
0.712890625,
-0.1710205078125,
0.775390625,
-0.7861328125,
-0.69189453125,
0.059967041015625,
0.23681640625,
-0.26904296875,
0.093505859375,
0.3662109375,
0.161376953125,
0.11669921875,
-0.007656097412109375,
0.469970703125,
-0.76123046875,
0.61962890625,
0.2076416015625,
0.2049560546875,
-0.5634765625,
0.09027099609375,
0.00823211669921875,
-0.08270263671875,
-0.365234375,
-0.57177734375,
0.51708984375,
0.2265625,
-0.05084228515625,
0.33642578125,
0.53662109375,
-0.84130859375,
0.0175323486328125,
-0.037506103515625,
-0.333740234375,
-0.363525390625,
0.55517578125,
1.580078125,
-0.681640625,
-0.394287109375,
-0.53857421875,
0.59521484375,
0.204345703125,
0.34765625,
0.60107421875,
-0.90185546875,
-0.333251953125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitro et æstus, et nil admirari. Festina lente, et nulla tenaci invia est via.
Fac et spera,
Vale,
Nicolas Flamel
Input
The first line of input contains several space-separated integers ai (0 ≤ ai ≤ 100).
Output
Print a single integer.
Examples
Input
2 4 6 8 10
Output
1
Tags: *special
Correct Solution:
```
c = list(map(int, input().split()))
print(min(c[0], c[1], c[2] // 2, c[3] // 7, c[4] // 4))
```
| 45,726
|
[
0.032958984375,
-0.039337158203125,
0.311279296875,
0.2135009765625,
-0.53564453125,
-0.857421875,
0.022369384765625,
-0.048614501953125,
0.377197265625,
0.58740234375,
0.63720703125,
0.0404052734375,
0.05364990234375,
-0.705078125,
-0.414794921875,
-0.2147216796875,
-0.324951171875,
-0.99755859375,
-0.6591796875,
-0.28955078125,
-0.0972900390625,
-0.06671142578125,
-1.4091796875,
-0.15087890625,
-0.50537109375,
0.90576171875,
0.5966796875,
0.35888671875,
0.81005859375,
1.1201171875,
-0.2578125,
-0.57861328125,
0.50732421875,
-1.2744140625,
-0.35546875,
-0.386474609375,
0.568359375,
-0.8193359375,
-0.67724609375,
-0.4130859375,
0.0302276611328125,
0.12347412109375,
0.39111328125,
-0.7314453125,
-0.61328125,
0.034881591796875,
-0.303955078125,
-0.300537109375,
-0.047607421875,
-0.74658203125,
0.11480712890625,
-0.10076904296875,
0.79638671875,
-0.1429443359375,
-0.1475830078125,
-0.11639404296875,
0.055999755859375,
-0.393798828125,
-0.84326171875,
0.53173828125,
0.400634765625,
-0.11102294921875,
0.060028076171875,
-0.3916015625,
-0.27099609375,
0.2626953125,
-0.2386474609375,
-0.00112152099609375,
-0.134765625,
-0.830078125,
-0.043701171875,
0.63232421875,
-0.2626953125,
-0.33740234375,
-0.427734375,
-0.296630859375,
0.1923828125,
-0.2261962890625,
-0.55322265625,
0.30078125,
0.439208984375,
0.78759765625,
0.00846099853515625,
0.413818359375,
-0.49658203125,
-0.88623046875,
-0.61328125,
0.57861328125,
0.20458984375,
-0.273193359375,
-0.0926513671875,
0.6533203125,
-0.330810546875,
0.09356689453125,
0.414794921875,
0.469482421875,
-0.37744140625,
0.3896484375,
0.09295654296875,
0.1895751953125,
0.89599609375,
1.4921875,
-0.51220703125,
0.8779296875,
-0.85595703125,
-0.14013671875,
-0.06378173828125,
0.357421875,
0.1976318359375,
-0.333251953125,
-0.403076171875,
-0.196044921875,
0.17333984375,
0.157470703125,
-0.467529296875,
0.86669921875,
-0.2705078125,
0.177001953125,
-0.60546875,
0.27099609375,
0.3046875,
0.252685546875,
0.59228515625,
-0.5625,
-0.12249755859375,
-0.88525390625,
-0.44189453125,
1.0771484375,
-0.5576171875,
0.03448486328125,
0.68408203125,
-0.08709716796875,
-0.12384033203125,
0.19140625,
-0.05908203125,
0.62890625,
-0.1458740234375,
0.60546875,
0.84033203125,
-0.58154296875,
0.2861328125,
-0.2354736328125,
-0.221923828125,
1.275390625,
0.466064453125,
0.5908203125,
0.99609375,
0.327392578125,
-0.78466796875,
0.1676025390625,
-0.81396484375,
0.623046875,
-0.037109375,
0.6572265625,
-0.2734375,
0.12548828125,
-0.143310546875,
0.312255859375,
-0.07293701171875,
0.23876953125,
-0.147216796875,
0.25,
-0.1663818359375,
1.3212890625,
-0.1424560546875,
0.81494140625,
-0.35400390625,
-0.42529296875,
-0.372314453125,
-0.63525390625,
0.50439453125,
-0.167236328125,
-0.1826171875,
0.994140625,
0.1898193359375,
1.1728515625,
0.89306640625,
0.04681396484375,
0.1964111328125,
0.50341796875,
-0.07818603515625,
0.1429443359375,
0.5126953125,
1.197265625,
0.498291015625,
0.62548828125,
0.44580078125,
-0.2237548828125,
-0.5869140625,
-0.86474609375,
0.0484619140625,
0.97119140625,
-0.52392578125,
0.299072265625,
0.3916015625,
-0.0167388916015625,
-0.394287109375,
-0.365234375,
-0.0298004150390625,
-1.30078125,
-0.58154296875,
0.5078125,
-0.417724609375,
0.47119140625,
-0.201904296875,
-0.379150390625,
0.1878662109375,
1.2275390625,
-0.54296875,
-0.3388671875,
0.51904296875,
-0.08892822265625,
-0.2476806640625,
0.2261962890625,
0.08135986328125,
-0.1663818359375,
-0.87060546875,
0.80078125,
-0.313720703125,
-0.32275390625,
0.0421142578125,
0.90087890625,
0.365966796875,
0.484130859375,
-0.60888671875,
-0.318359375,
0.00238800048828125,
1.431640625,
0.1424560546875,
0.093505859375,
-0.042572021484375,
0.85107421875,
0.328857421875,
0.85888671875,
1.0673828125,
0.241455078125,
0.73388671875,
0.6875,
0.00989532470703125,
0.415771484375,
-0.04144287109375,
0.69482421875,
0.6083984375,
0.224365234375,
0.050933837890625,
0.412353515625,
0.2529296875,
0.33251953125,
-0.04736328125,
0.6142578125,
-0.57275390625,
0.51953125,
0.442138671875,
0.283447265625,
-0.52490234375,
-0.28955078125,
0.54052734375,
1.1806640625,
-0.8623046875,
-0.250244140625,
-0.340087890625,
0.2039794921875,
0.246337890625,
-0.045989990234375,
0.499755859375,
0.71728515625,
0.292724609375,
0.298583984375,
-0.1629638671875,
-0.385986328125,
-1.0322265625,
-0.59228515625,
-1.3681640625,
-0.353515625,
-0.52197265625,
-0.0758056640625,
0.3095703125,
-0.8115234375,
0.480224609375,
-0.2100830078125,
-0.50537109375,
0.1043701171875,
-0.6845703125,
0.671875,
-0.1278076171875,
0.81005859375,
-0.93017578125,
0.456787109375,
0.2012939453125,
1.150390625,
-0.814453125,
-0.208251953125,
0.24169921875,
-0.74267578125,
0.1612548828125,
0.105712890625,
0.3359375,
0.0548095703125,
-0.85498046875,
-0.861328125,
-0.1134033203125,
0.2037353515625,
0.051483154296875,
0.376220703125,
-0.375732421875,
1.033203125,
0.52587890625,
-0.53759765625,
0.39892578125,
0.374267578125,
-0.90576171875,
0.66455078125,
0.117431640625,
0.086181640625,
-0.87255859375,
1.26953125,
0.546875,
0.262939453125,
-0.50927734375,
-0.17919921875,
-0.6103515625,
0.04742431640625,
0.15673828125,
-0.6435546875,
-0.60400390625,
0.467529296875,
0.43701171875,
-0.982421875,
0.490966796875,
-0.8291015625,
-0.583984375,
-0.1956787109375,
-0.253173828125,
1.0126953125,
0.5947265625,
0.1268310546875,
-0.2335205078125,
-0.405517578125,
-0.3486328125,
0.33740234375,
0.326416015625,
-0.414306640625,
-0.1806640625,
0.90380859375,
-0.318603515625,
-0.0850830078125,
-0.00542449951171875,
-0.11773681640625,
-0.03375244140625,
-0.10284423828125,
0.2362060546875,
0.405517578125,
0.30712890625,
-0.1165771484375,
0.2342529296875,
1.1513671875,
-0.76416015625,
-0.369873046875,
-0.0273590087890625,
0.451904296875,
0.1937255859375,
0.340576171875,
0.54541015625,
-0.418212890625,
-0.41259765625,
-1.064453125,
0.350830078125,
0.318115234375,
0.57080078125,
-0.6611328125,
0.45654296875,
0.7109375,
-0.68701171875,
0.485107421875,
-0.4501953125,
-0.1773681640625,
0.931640625,
0.3466796875,
0.83447265625,
-0.67822265625,
0.032745361328125,
-0.286376953125,
0.2391357421875,
0.6943359375,
0.07110595703125,
0.9853515625,
-0.40283203125,
-0.402587890625,
-0.401123046875,
-0.82080078125,
0.1793212890625,
-0.73583984375,
0.256591796875,
-0.416748046875,
-0.388671875,
-0.79345703125,
0.25634765625,
0.48193359375,
0.345703125,
0.1671142578125,
0.489990234375,
0.20458984375,
0.69970703125,
0.681640625,
-0.339599609375,
-0.0302886962890625,
-0.69921875,
1.013671875,
0.2265625,
-0.2181396484375,
-0.763671875,
-0.153076171875,
0.0462646484375,
0.052825927734375,
0.228515625,
-0.59765625,
-0.413330078125,
0.499267578125,
-0.02392578125,
0.4892578125,
-0.1912841796875,
-0.6337890625,
0.1129150390625,
0.763671875,
0.09722900390625,
-0.91650390625,
0.44677734375,
-0.56396484375,
0.576171875,
0.70458984375,
-0.568359375,
-0.450927734375,
-0.59326171875,
-0.7607421875,
-0.346923828125,
-0.133544921875,
0.6396484375,
-0.36669921875,
0.404541015625,
-1.0810546875,
0.31103515625,
0.71435546875,
-0.1578369140625,
0.09967041015625,
-0.193359375,
0.2266845703125,
-0.0259857177734375,
0.7353515625,
-0.4775390625,
-1.0615234375,
0.150146484375,
-1.185546875,
0.35986328125,
-0.88037109375,
0.287841796875,
-0.0714111328125,
-0.054595947265625,
-0.263671875,
0.51318359375,
0.213134765625,
-0.268310546875,
-0.1201171875,
0.2249755859375,
-0.92626953125,
-0.52783203125,
0.8876953125,
-0.61328125,
-0.184814453125,
0.716796875,
-0.5634765625,
-0.341796875,
0.21240234375,
0.642578125,
-0.251953125,
0.322265625,
-0.44921875,
0.460693359375,
-0.2196044921875,
-0.2008056640625,
-0.11846923828125,
-0.49853515625,
0.716796875,
0.11468505859375,
-0.93310546875,
-0.135986328125,
-1.0615234375,
-0.128173828125,
-0.148681640625,
-0.50341796875,
-0.00884246826171875,
0.25927734375,
-0.36328125,
-0.1710205078125,
-0.57666015625,
-0.254638671875,
-0.46484375,
-0.5537109375,
-0.06842041015625,
0.703125,
0.39306640625,
0.5908203125,
0.2064208984375,
-0.75244140625,
-0.033477783203125,
-0.220947265625,
0.016693115234375,
-0.5361328125,
0.0362548828125,
0.1640625,
-0.2705078125,
-0.11309814453125,
0.08221435546875,
0.00795745849609375,
0.64990234375,
1.078125,
-0.054962158203125,
0.4677734375,
0.1597900390625,
-0.5751953125,
1.11328125,
-0.273681640625,
-0.947265625,
-0.6279296875,
0.51025390625,
0.2001953125,
0.51220703125,
0.43798828125,
-0.71923828125,
-0.85693359375,
-1.349609375,
0.057861328125,
-0.48291015625,
-0.09185791015625,
-1.19921875,
-0.63330078125,
-0.262939453125,
0.6328125,
-0.427001953125,
-1.13671875,
0.09735107421875,
-0.8046875,
-0.0198211669921875,
-0.51171875,
-0.072998046875,
-1.2236328125,
-0.466064453125,
-0.0386962890625,
0.55126953125,
0.0474853515625,
0.583984375,
-0.31982421875,
-0.200927734375,
0.0238189697265625,
-0.11676025390625,
-0.480224609375,
-0.49658203125,
-0.221923828125,
-0.1881103515625,
-0.08013916015625,
-0.132080078125,
-0.339599609375,
0.8896484375,
-1.037109375,
-0.1708984375,
-0.453369140625,
-0.44970703125,
-0.0859375,
-0.6044921875,
1.2734375,
0.055267333984375,
-0.068603515625,
-0.47998046875,
0.66796875,
0.79248046875,
-0.326416015625,
-0.5029296875,
-0.73828125,
-0.1634521484375,
-1.1259765625,
0.63720703125,
-0.546875,
-0.2471923828125,
-0.2257080078125,
0.1181640625,
0.7763671875,
-0.36669921875,
0.6875,
1.4541015625,
-0.035736083984375,
0.04638671875,
-0.85546875,
0.5966796875,
0.15380859375,
-0.45068359375,
0.169677734375,
-0.10418701171875,
-0.68359375,
-0.10015869140625,
-0.2213134765625,
-0.755859375,
-0.71337890625,
-0.027679443359375,
1.400390625,
-0.121337890625,
0.58154296875,
0.31591796875,
-1.49609375,
-1.03515625,
1.013671875,
0.206298828125,
0.74853515625,
1.1142578125,
0.0253143310546875,
-0.09991455078125,
-0.37451171875,
0.1417236328125,
-0.2469482421875,
-0.213623046875,
1.30859375,
0.3154296875,
-0.48583984375,
0.64990234375,
0.89501953125,
-1.43359375,
-0.68896484375,
0.30859375,
-0.135009765625,
-0.431640625,
-0.56787109375,
0.394775390625,
0.62890625,
-1.0166015625,
0.1358642578125,
0.529296875,
0.056243896484375,
0.37939453125,
0.0207061767578125,
0.6875,
-0.279052734375,
0.46923828125,
1.03515625,
-0.55419921875,
-0.1722412109375,
-1.1240234375,
-0.62060546875,
-0.2335205078125,
0.2420654296875,
0.796875,
-0.55859375,
-0.02276611328125,
0.62548828125,
-0.14111328125,
0.64599609375,
-0.417236328125,
-0.560546875,
0.058013916015625,
-0.61767578125,
-0.433837890625,
0.049407958984375,
0.4873046875,
0.1119384765625,
0.31982421875,
-0.449462890625,
0.361572265625,
0.492431640625,
0.2166748046875,
-0.10101318359375,
-0.94384765625,
-0.501953125,
-1.0400390625,
-0.47412109375,
-0.66259765625,
-0.52880859375,
-0.353759765625,
-0.0276641845703125,
-0.05072021484375,
-0.5234375,
0.004886627197265625,
0.2607421875,
-0.215576171875,
0.83837890625,
-0.900390625,
0.3935546875,
-0.865234375,
-0.53173828125,
-0.67138671875,
-0.02197265625,
-0.253662109375,
0.1851806640625,
-1.09765625,
0.42822265625,
-0.150634765625,
0.83203125,
-0.059783935546875,
0.335205078125,
-0.20654296875,
-0.6279296875,
0.17529296875,
0.315185546875,
-0.1868896484375,
0.72412109375,
0.51220703125,
-0.05914306640625,
0.192626953125,
0.0288543701171875,
-0.20556640625,
-0.4404296875,
0.357421875,
0.80712890625,
-0.267578125,
-0.0830078125,
-0.4462890625,
-0.00855255126953125,
-0.99169921875,
0.5185546875,
-0.06231689453125,
-0.1649169921875,
0.50244140625,
-0.17041015625,
0.4501953125,
1.1962890625,
0.1322021484375,
0.21240234375,
-0.03131103515625,
0.529296875,
0.39892578125,
-0.034332275390625,
0.39794921875,
0.3916015625,
0.0247039794921875,
-0.373291015625,
0.3408203125,
0.77490234375,
-0.377685546875,
0.289794921875,
-0.38134765625,
-0.445556640625,
-0.81591796875,
-0.30859375,
-0.5234375,
0.3046875,
0.587890625,
-0.61328125,
-0.043792724609375,
-0.08941650390625,
-0.4072265625,
0.0498046875,
-1.29296875,
-0.88232421875,
0.68701171875,
-0.2122802734375,
-0.453369140625,
-0.248779296875,
-0.505859375,
-0.25830078125,
0.1754150390625,
0.587890625,
-0.380859375,
0.56201171875,
-0.47265625,
0.228271484375,
-0.260009765625,
-0.09088134765625,
0.11456298828125,
0.367919921875,
-0.75732421875,
-0.556640625,
0.358154296875,
1.3232421875,
0.3701171875,
0.257080078125,
-0.385498046875,
0.304931640625,
0.082763671875,
-0.291259765625,
-0.3701171875,
0.06732177734375,
-0.220947265625,
-0.06378173828125,
-0.06390380859375,
0.302978515625,
-0.7880859375,
0.463623046875,
0.163330078125,
-0.34716796875,
-0.55908203125,
0.7900390625,
0.486328125,
-0.424072265625,
0.61669921875,
0.330078125,
0.336181640625,
-0.0013399124145507812,
-0.294921875,
0.1219482421875,
0.642578125,
0.7412109375,
0.81689453125,
-0.193359375,
0.11199951171875,
0.9638671875,
-0.0255126953125,
-0.10546875,
0.473876953125,
-0.08245849609375,
-0.053863525390625,
-0.280029296875,
-0.2491455078125,
-0.0816650390625,
0.0165252685546875,
-0.701171875,
0.779296875,
-0.39794921875,
-0.39208984375,
-0.310302734375,
-0.5439453125,
0.8720703125,
-0.1710205078125,
-0.08880615234375,
0.240966796875,
-0.54052734375,
0.2401123046875,
0.759765625,
0.1419677734375,
-0.01312255859375,
0.810546875,
0.68017578125,
0.67626953125,
0.880859375,
0.2169189453125,
0.476806640625,
-0.60546875,
0.317138671875,
0.1439208984375,
-0.0838623046875,
-0.5556640625,
-0.521484375,
-0.86962890625,
0.30126953125,
-0.51904296875,
-0.329345703125,
0.465576171875,
-0.58251953125,
0.443115234375,
-0.35693359375,
0.65673828125,
-0.4501953125,
0.412109375,
0.352783203125,
-0.56591796875,
-0.83740234375,
0.490234375,
-0.150634765625,
0.40673828125,
0.255615234375,
1.4560546875,
-0.22998046875,
1.2421875,
0.5087890625,
-0.18310546875,
-0.437744140625,
0.156005859375,
-0.190673828125,
-0.27734375,
-0.1865234375,
-0.292724609375,
0.332763671875,
-0.7451171875,
-0.30078125,
0.273193359375,
0.775390625,
0.2196044921875,
-1.08984375,
-0.212890625,
0.50927734375,
-0.84326171875,
0.447509765625,
0.2213134765625,
0.173828125,
0.120361328125,
0.046112060546875,
-0.2154541015625,
-0.56103515625,
0.054412841796875,
-0.79638671875,
0.626953125,
-0.5361328125,
-0.865234375,
-0.77294921875,
-0.6884765625,
-0.00021767616271972656,
-0.058990478515625,
-0.6376953125,
-0.7724609375,
0.43408203125,
0.69091796875,
0.09222412109375,
-0.00318145751953125,
-0.054840087890625,
-0.31201171875,
0.98486328125,
1.0556640625,
0.61474609375,
0.82958984375,
0.4150390625,
-0.75,
0.564453125,
-0.75341796875,
0.6591796875,
-0.270263671875,
-0.0094451904296875,
-0.425048828125,
0.6201171875,
-0.73828125,
-1.2734375,
0.294189453125,
0.51513671875,
0.712890625,
-0.62890625,
-1.087890625,
-0.235107421875,
-1.26953125,
-0.375732421875,
-0.6650390625,
0.7275390625,
-0.1328125,
-0.3154296875,
-0.239990234375,
-1.2197265625,
4.2734375,
0.97509765625,
0.91162109375,
0.7548828125,
-0.2471923828125,
0.64306640625,
0.6630859375,
-0.43115234375,
-0.1343994140625,
-0.285888671875,
0.463134765625,
-0.30126953125,
-0.0243377685546875,
0.72607421875,
0.6357421875,
0.434814453125,
-0.62841796875,
0.490966796875,
-0.081787109375,
-0.69970703125,
-0.953125,
0.48095703125,
-0.0526123046875,
0.46435546875,
0.05572509765625,
0.300048828125,
0.51025390625,
-0.59228515625,
-0.2384033203125,
-0.34228515625,
0.40771484375,
-0.4619140625,
0.66552734375,
-0.325439453125,
-0.11505126953125,
0.07647705078125,
-0.1859130859375,
-0.53955078125,
-0.2188720703125,
0.379150390625,
-0.1951904296875,
0.060028076171875,
0.7861328125,
-0.515625,
0.05328369140625,
0.580078125,
-0.52197265625,
0.6494140625,
0.257080078125,
-1.1279296875,
0.9248046875,
-0.287841796875,
0.1845703125,
-0.91455078125,
-0.8671875,
-0.1400146484375,
0.265869140625,
0.140625,
0.2176513671875,
0.32421875,
0.53271484375,
0.65283203125,
0.403076171875,
0.32666015625,
-1.021484375,
1.0107421875,
-0.1104736328125,
0.324462890625,
-0.474853515625,
-0.158447265625,
-0.55908203125,
-0.399658203125,
0.1776123046875,
-0.63623046875,
0.5546875,
-0.0024814605712890625,
-0.6376953125,
0.426025390625,
0.33544921875,
-0.79931640625,
-0.007228851318359375,
0.1842041015625,
-0.369140625,
-0.4453125,
0.425537109375,
1.1513671875,
-0.640625,
-0.43212890625,
-0.81689453125,
0.49267578125,
0.406494140625,
0.46826171875,
0.0953369140625,
-0.388916015625,
-0.1611328125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitro et æstus, et nil admirari. Festina lente, et nulla tenaci invia est via.
Fac et spera,
Vale,
Nicolas Flamel
Input
The first line of input contains several space-separated integers ai (0 ≤ ai ≤ 100).
Output
Print a single integer.
Examples
Input
2 4 6 8 10
Output
1
Tags: *special
Correct Solution:
```
s = input().split()
print(min(int(s[0])//1,int(s[1])//1,int(s[2])//2,int(s[3])//7,int(s[4])//4))
```
| 45,727
|
[
0.07537841796875,
-0.05279541015625,
0.283447265625,
0.2218017578125,
-0.57470703125,
-0.86083984375,
0.040618896484375,
-0.06768798828125,
0.38134765625,
0.5810546875,
0.626953125,
0.0279541015625,
-0.08343505859375,
-0.751953125,
-0.435791015625,
-0.271484375,
-0.297607421875,
-1.044921875,
-0.61181640625,
-0.296142578125,
-0.1578369140625,
-0.08447265625,
-1.396484375,
-0.0985107421875,
-0.48828125,
0.90869140625,
0.654296875,
0.345458984375,
0.78076171875,
1.103515625,
-0.333740234375,
-0.59228515625,
0.44384765625,
-1.306640625,
-0.36572265625,
-0.3896484375,
0.568359375,
-0.86279296875,
-0.67578125,
-0.340087890625,
0.04412841796875,
0.1634521484375,
0.415771484375,
-0.830078125,
-0.69482421875,
0.07391357421875,
-0.258544921875,
-0.357421875,
-0.04248046875,
-0.689453125,
0.1610107421875,
-0.181640625,
0.7822265625,
-0.1239013671875,
-0.112548828125,
-0.1580810546875,
0.140869140625,
-0.31494140625,
-0.86181640625,
0.52783203125,
0.3720703125,
-0.12322998046875,
0.0296173095703125,
-0.3564453125,
-0.169677734375,
0.23046875,
-0.3759765625,
0.00734710693359375,
-0.207763671875,
-0.93212890625,
-0.05157470703125,
0.63037109375,
-0.3359375,
-0.285400390625,
-0.485595703125,
-0.304443359375,
0.28369140625,
-0.1663818359375,
-0.576171875,
0.443359375,
0.384033203125,
0.7236328125,
0.0513916015625,
0.4072265625,
-0.455810546875,
-0.8525390625,
-0.611328125,
0.57373046875,
0.21484375,
-0.304931640625,
-0.10565185546875,
0.64697265625,
-0.390625,
0.0950927734375,
0.4658203125,
0.456787109375,
-0.36865234375,
0.34033203125,
0.0257415771484375,
0.1470947265625,
0.93212890625,
1.4697265625,
-0.52294921875,
0.919921875,
-0.8818359375,
-0.047454833984375,
0.0134124755859375,
0.29248046875,
0.08843994140625,
-0.33447265625,
-0.395263671875,
-0.194091796875,
0.2257080078125,
0.2060546875,
-0.52490234375,
0.94189453125,
-0.25537109375,
0.1868896484375,
-0.666015625,
0.27392578125,
0.317626953125,
0.2174072265625,
0.63037109375,
-0.52099609375,
-0.10986328125,
-0.8447265625,
-0.434814453125,
1.0908203125,
-0.55859375,
-0.031402587890625,
0.63818359375,
-0.09356689453125,
-0.051025390625,
0.11083984375,
-0.0095367431640625,
0.63427734375,
-0.11865234375,
0.6005859375,
0.8583984375,
-0.541015625,
0.316162109375,
-0.270263671875,
-0.1636962890625,
1.2822265625,
0.47607421875,
0.51611328125,
0.95751953125,
0.365234375,
-0.67236328125,
0.1470947265625,
-0.78369140625,
0.5126953125,
-0.1260986328125,
0.6689453125,
-0.281494140625,
0.1649169921875,
-0.2237548828125,
0.322265625,
-0.142333984375,
0.3505859375,
-0.175048828125,
0.310791015625,
-0.1531982421875,
1.3173828125,
-0.09112548828125,
0.83056640625,
-0.30859375,
-0.5419921875,
-0.41015625,
-0.62939453125,
0.55224609375,
-0.189208984375,
-0.1397705078125,
0.9501953125,
0.13818359375,
1.1611328125,
0.8359375,
-0.01499176025390625,
0.1268310546875,
0.50634765625,
-0.156494140625,
0.2208251953125,
0.4580078125,
1.1669921875,
0.52587890625,
0.607421875,
0.4638671875,
-0.2200927734375,
-0.67529296875,
-0.828125,
0.1112060546875,
1.0654296875,
-0.50537109375,
0.268310546875,
0.318359375,
-0.03765869140625,
-0.313232421875,
-0.374755859375,
-0.0859375,
-1.2685546875,
-0.5908203125,
0.6201171875,
-0.316650390625,
0.41748046875,
-0.202880859375,
-0.408447265625,
0.2388916015625,
1.2255859375,
-0.59326171875,
-0.37255859375,
0.53271484375,
-0.09320068359375,
-0.2548828125,
0.27294921875,
0.0248260498046875,
-0.245361328125,
-0.90185546875,
0.802734375,
-0.320556640625,
-0.2939453125,
0.0316162109375,
0.84326171875,
0.380126953125,
0.486328125,
-0.60693359375,
-0.299072265625,
0.0174407958984375,
1.40234375,
0.19140625,
0.1041259765625,
0.0855712890625,
0.81396484375,
0.36572265625,
0.82177734375,
1.046875,
0.2484130859375,
0.74658203125,
0.77099609375,
-0.0440673828125,
0.50439453125,
-0.0232696533203125,
0.6298828125,
0.62451171875,
0.2498779296875,
0.09259033203125,
0.423828125,
0.2230224609375,
0.310791015625,
-0.0240478515625,
0.5068359375,
-0.57568359375,
0.56591796875,
0.4521484375,
0.250732421875,
-0.5810546875,
-0.356201171875,
0.60205078125,
1.1044921875,
-0.89208984375,
-0.1865234375,
-0.34423828125,
0.24755859375,
0.19140625,
0.055877685546875,
0.468994140625,
0.650390625,
0.359375,
0.2734375,
-0.1583251953125,
-0.36328125,
-0.98095703125,
-0.5576171875,
-1.3779296875,
-0.3583984375,
-0.5107421875,
-0.07855224609375,
0.2509765625,
-0.82568359375,
0.51416015625,
-0.228271484375,
-0.486083984375,
0.06988525390625,
-0.7353515625,
0.6904296875,
-0.1534423828125,
0.76513671875,
-0.98583984375,
0.53466796875,
0.192626953125,
1.2666015625,
-0.8447265625,
-0.233642578125,
0.28564453125,
-0.75244140625,
0.077392578125,
0.0201263427734375,
0.32861328125,
0.05511474609375,
-0.80859375,
-0.83740234375,
-0.1483154296875,
0.274169921875,
-0.013275146484375,
0.35400390625,
-0.34375,
0.99462890625,
0.478759765625,
-0.5517578125,
0.494384765625,
0.384765625,
-0.927734375,
0.642578125,
0.1263427734375,
0.039337158203125,
-0.8388671875,
1.2392578125,
0.513671875,
0.300537109375,
-0.445068359375,
-0.1851806640625,
-0.501953125,
0.0267791748046875,
0.0977783203125,
-0.662109375,
-0.63671875,
0.475830078125,
0.455810546875,
-0.94140625,
0.470947265625,
-0.79833984375,
-0.52734375,
-0.256591796875,
-0.271240234375,
1.1201171875,
0.59716796875,
0.091552734375,
-0.374267578125,
-0.4404296875,
-0.37744140625,
0.279296875,
0.39599609375,
-0.47607421875,
-0.149658203125,
0.9189453125,
-0.289306640625,
-0.13134765625,
0.02960205078125,
-0.224365234375,
-0.11785888671875,
-0.154296875,
0.252197265625,
0.445068359375,
0.3427734375,
-0.058929443359375,
0.209716796875,
1.125,
-0.8125,
-0.421142578125,
0.0260467529296875,
0.327392578125,
0.326904296875,
0.281005859375,
0.50341796875,
-0.363037109375,
-0.41455078125,
-1.0244140625,
0.314208984375,
0.31396484375,
0.5478515625,
-0.6494140625,
0.484375,
0.6494140625,
-0.73193359375,
0.467041015625,
-0.48388671875,
-0.14306640625,
0.92041015625,
0.397705078125,
0.861328125,
-0.77294921875,
0.09088134765625,
-0.250244140625,
0.06439208984375,
0.72216796875,
0.0587158203125,
0.91162109375,
-0.447998046875,
-0.4541015625,
-0.400634765625,
-0.73828125,
0.1710205078125,
-0.6982421875,
0.2188720703125,
-0.416748046875,
-0.369873046875,
-0.798828125,
0.32275390625,
0.486328125,
0.380859375,
0.2333984375,
0.490478515625,
0.198486328125,
0.71337890625,
0.72802734375,
-0.3349609375,
0.0291595458984375,
-0.62255859375,
1.03125,
0.22021484375,
-0.11236572265625,
-0.736328125,
-0.19189453125,
0.114990234375,
0.03094482421875,
0.1578369140625,
-0.5703125,
-0.400634765625,
0.53173828125,
0.049041748046875,
0.499267578125,
-0.2027587890625,
-0.607421875,
0.0059356689453125,
0.72216796875,
0.1212158203125,
-0.9443359375,
0.39306640625,
-0.61474609375,
0.62109375,
0.61669921875,
-0.64599609375,
-0.435302734375,
-0.646484375,
-0.833984375,
-0.326904296875,
-0.1336669921875,
0.6884765625,
-0.327392578125,
0.473388671875,
-1.1630859375,
0.3056640625,
0.767578125,
-0.2388916015625,
0.0941162109375,
-0.176513671875,
0.268798828125,
-0.0215301513671875,
0.84521484375,
-0.447265625,
-1.0673828125,
0.1527099609375,
-1.2607421875,
0.403564453125,
-0.90234375,
0.3076171875,
-0.07366943359375,
-0.12005615234375,
-0.32080078125,
0.475341796875,
0.160888671875,
-0.2509765625,
-0.1358642578125,
0.15869140625,
-0.8818359375,
-0.59765625,
0.927734375,
-0.634765625,
-0.339111328125,
0.81884765625,
-0.483154296875,
-0.29296875,
0.18115234375,
0.67236328125,
-0.2861328125,
0.38916015625,
-0.43798828125,
0.352294921875,
-0.2313232421875,
-0.182373046875,
-0.21044921875,
-0.52880859375,
0.6259765625,
0.1334228515625,
-1.005859375,
-0.1612548828125,
-1.0439453125,
-0.0823974609375,
-0.16455078125,
-0.412841796875,
-0.0430908203125,
0.257080078125,
-0.36181640625,
-0.07501220703125,
-0.56005859375,
-0.25390625,
-0.494384765625,
-0.54833984375,
-0.11285400390625,
0.66943359375,
0.43115234375,
0.5927734375,
0.2247314453125,
-0.70947265625,
-0.016204833984375,
-0.22314453125,
-0.09588623046875,
-0.51123046875,
0.031646728515625,
0.1505126953125,
-0.3271484375,
-0.11358642578125,
0.18505859375,
0.04754638671875,
0.625,
1.015625,
-0.03765869140625,
0.447509765625,
0.208740234375,
-0.46630859375,
1.1884765625,
-0.221923828125,
-0.90771484375,
-0.5029296875,
0.52978515625,
0.132080078125,
0.47265625,
0.344970703125,
-0.84228515625,
-0.77880859375,
-1.35546875,
0.1312255859375,
-0.463134765625,
-0.0870361328125,
-1.1953125,
-0.703125,
-0.299560546875,
0.6376953125,
-0.48681640625,
-1.16015625,
0.147216796875,
-0.796875,
0.020263671875,
-0.59423828125,
-0.1092529296875,
-1.2138671875,
-0.461669921875,
-0.00589752197265625,
0.5283203125,
-0.01025390625,
0.56787109375,
-0.2100830078125,
-0.2237548828125,
0.00939178466796875,
-0.044342041015625,
-0.5380859375,
-0.49951171875,
-0.2529296875,
-0.231689453125,
-0.06280517578125,
-0.11505126953125,
-0.333984375,
0.86767578125,
-1.021484375,
-0.10699462890625,
-0.411865234375,
-0.51416015625,
-0.1123046875,
-0.5478515625,
1.234375,
0.0340576171875,
-0.0297393798828125,
-0.474609375,
0.6494140625,
0.87548828125,
-0.287353515625,
-0.50830078125,
-0.6552734375,
-0.11346435546875,
-1.1142578125,
0.57763671875,
-0.50439453125,
-0.2076416015625,
-0.2183837890625,
0.0809326171875,
0.8203125,
-0.39013671875,
0.69287109375,
1.525390625,
-0.0101165771484375,
0.177001953125,
-0.81201171875,
0.66796875,
0.25830078125,
-0.424560546875,
0.2415771484375,
-0.09381103515625,
-0.73388671875,
-0.1026611328125,
-0.255126953125,
-0.7177734375,
-0.74169921875,
0.002788543701171875,
1.39453125,
-0.1820068359375,
0.60595703125,
0.3623046875,
-1.5146484375,
-1.0322265625,
1.0654296875,
0.27001953125,
0.76171875,
1.0849609375,
0.032684326171875,
-0.038543701171875,
-0.2215576171875,
0.09039306640625,
-0.228271484375,
-0.30419921875,
1.3818359375,
0.30126953125,
-0.456787109375,
0.65185546875,
0.8779296875,
-1.529296875,
-0.63818359375,
0.30078125,
-0.1890869140625,
-0.418701171875,
-0.5576171875,
0.36669921875,
0.6474609375,
-1.0615234375,
0.172607421875,
0.5126953125,
0.08294677734375,
0.47412109375,
-0.010345458984375,
0.658203125,
-0.288818359375,
0.5859375,
1.0341796875,
-0.5986328125,
-0.056854248046875,
-1.1357421875,
-0.68310546875,
-0.2587890625,
0.24560546875,
0.763671875,
-0.5380859375,
0.035400390625,
0.65380859375,
-0.142822265625,
0.66064453125,
-0.388427734375,
-0.58740234375,
0.1300048828125,
-0.60986328125,
-0.36669921875,
0.076171875,
0.458984375,
0.133056640625,
0.43701171875,
-0.427001953125,
0.224365234375,
0.469482421875,
0.32666015625,
0.018280029296875,
-0.86279296875,
-0.529296875,
-1.0390625,
-0.4609375,
-0.751953125,
-0.50830078125,
-0.37646484375,
-0.04736328125,
-0.0289459228515625,
-0.533203125,
0.0302734375,
0.1363525390625,
-0.2178955078125,
0.78759765625,
-0.9169921875,
0.410400390625,
-0.7587890625,
-0.576171875,
-0.78857421875,
-0.0235443115234375,
-0.2666015625,
0.2188720703125,
-1.123046875,
0.4306640625,
-0.2254638671875,
0.7373046875,
-0.06390380859375,
0.348388671875,
-0.1507568359375,
-0.6171875,
0.157470703125,
0.341552734375,
-0.2283935546875,
0.7353515625,
0.5185546875,
0.00655364990234375,
0.218017578125,
-0.044342041015625,
-0.110107421875,
-0.41064453125,
0.352294921875,
0.755859375,
-0.282470703125,
-0.140380859375,
-0.52001953125,
0.01013946533203125,
-0.96923828125,
0.5517578125,
-0.173828125,
-0.1417236328125,
0.55029296875,
-0.17333984375,
0.4599609375,
1.19921875,
0.109619140625,
0.288330078125,
-0.031219482421875,
0.57666015625,
0.425537109375,
-0.0012331008911132812,
0.288818359375,
0.406982421875,
-0.0162353515625,
-0.353759765625,
0.33447265625,
0.72802734375,
-0.254150390625,
0.2447509765625,
-0.256591796875,
-0.53564453125,
-0.82421875,
-0.3115234375,
-0.5458984375,
0.261962890625,
0.5947265625,
-0.65673828125,
0.0709228515625,
-0.031768798828125,
-0.41552734375,
0.0240631103515625,
-1.220703125,
-0.8564453125,
0.63916015625,
-0.2401123046875,
-0.38720703125,
-0.242431640625,
-0.5625,
-0.291259765625,
0.07177734375,
0.54248046875,
-0.334716796875,
0.56103515625,
-0.39599609375,
0.252197265625,
-0.2030029296875,
-0.154296875,
0.10186767578125,
0.446533203125,
-0.81005859375,
-0.61962890625,
0.4375,
1.287109375,
0.360595703125,
0.175537109375,
-0.410888671875,
0.2470703125,
0.1336669921875,
-0.1903076171875,
-0.37060546875,
0.0062713623046875,
-0.27294921875,
-0.05316162109375,
-0.10528564453125,
0.334716796875,
-0.81005859375,
0.39111328125,
0.176513671875,
-0.398193359375,
-0.54833984375,
0.849609375,
0.482666015625,
-0.38134765625,
0.5302734375,
0.288818359375,
0.376953125,
0.056121826171875,
-0.31640625,
0.135498046875,
0.6318359375,
0.7978515625,
0.79931640625,
-0.190185546875,
0.10528564453125,
0.9765625,
-0.07049560546875,
-0.046295166015625,
0.456787109375,
-0.0718994140625,
-0.1502685546875,
-0.273681640625,
-0.2490234375,
-0.0494384765625,
-0.0116119384765625,
-0.83203125,
0.7265625,
-0.391357421875,
-0.3935546875,
-0.350830078125,
-0.55126953125,
0.86279296875,
-0.15234375,
-0.04583740234375,
0.319580078125,
-0.48486328125,
0.260498046875,
0.83837890625,
0.1907958984375,
-0.01361846923828125,
0.83984375,
0.66259765625,
0.630859375,
0.80322265625,
0.29345703125,
0.56005859375,
-0.568359375,
0.36474609375,
0.07867431640625,
-0.045867919921875,
-0.55322265625,
-0.47509765625,
-0.9541015625,
0.2303466796875,
-0.50537109375,
-0.280517578125,
0.4833984375,
-0.6015625,
0.476806640625,
-0.283447265625,
0.728515625,
-0.45263671875,
0.335205078125,
0.307373046875,
-0.52783203125,
-0.72314453125,
0.490234375,
-0.10052490234375,
0.375732421875,
0.1572265625,
1.4140625,
-0.197265625,
1.345703125,
0.615234375,
-0.16064453125,
-0.43212890625,
0.211669921875,
-0.2103271484375,
-0.289794921875,
-0.2430419921875,
-0.3076171875,
0.440185546875,
-0.68017578125,
-0.34814453125,
0.321533203125,
0.83203125,
0.26513671875,
-1.06640625,
-0.279052734375,
0.5634765625,
-0.83740234375,
0.373291015625,
0.2080078125,
0.246826171875,
0.0924072265625,
-0.02032470703125,
-0.2025146484375,
-0.5869140625,
0.0634765625,
-0.7890625,
0.67578125,
-0.48681640625,
-0.849609375,
-0.7265625,
-0.6142578125,
0.024261474609375,
-0.07623291015625,
-0.560546875,
-0.7314453125,
0.5068359375,
0.62451171875,
0.052001953125,
0.029754638671875,
-0.0160675048828125,
-0.389404296875,
0.97216796875,
1.052734375,
0.5849609375,
0.8046875,
0.446533203125,
-0.79736328125,
0.5576171875,
-0.65869140625,
0.63525390625,
-0.233642578125,
-0.09423828125,
-0.49609375,
0.7333984375,
-0.7900390625,
-1.2509765625,
0.333740234375,
0.498046875,
0.66064453125,
-0.61572265625,
-1.1103515625,
-0.277587890625,
-1.3125,
-0.35888671875,
-0.6962890625,
0.7529296875,
-0.170654296875,
-0.319580078125,
-0.2498779296875,
-1.259765625,
4.24609375,
1.0439453125,
0.966796875,
0.75439453125,
-0.251220703125,
0.64111328125,
0.5546875,
-0.48974609375,
-0.1810302734375,
-0.277587890625,
0.5263671875,
-0.328369140625,
-0.0004315376281738281,
0.759765625,
0.69091796875,
0.416259765625,
-0.6611328125,
0.367431640625,
-0.07452392578125,
-0.744140625,
-0.94482421875,
0.51416015625,
-0.04119873046875,
0.45751953125,
0.055511474609375,
0.385009765625,
0.416015625,
-0.5966796875,
-0.1717529296875,
-0.475341796875,
0.453857421875,
-0.359375,
0.6162109375,
-0.3251953125,
-0.09735107421875,
0.1162109375,
-0.1429443359375,
-0.50927734375,
-0.2607421875,
0.417236328125,
-0.25048828125,
0.0111541748046875,
0.6708984375,
-0.5908203125,
-0.0731201171875,
0.501953125,
-0.55078125,
0.66455078125,
0.2119140625,
-1.24609375,
0.9599609375,
-0.321533203125,
0.1937255859375,
-0.89453125,
-0.8291015625,
-0.0162353515625,
0.1756591796875,
0.177978515625,
0.228271484375,
0.36962890625,
0.5634765625,
0.595703125,
0.3994140625,
0.29931640625,
-0.98486328125,
0.97119140625,
-0.1107177734375,
0.4052734375,
-0.54443359375,
-0.12408447265625,
-0.60888671875,
-0.3857421875,
0.2220458984375,
-0.62451171875,
0.59912109375,
0.0863037109375,
-0.6787109375,
0.420166015625,
0.3837890625,
-0.865234375,
-0.009674072265625,
0.2156982421875,
-0.337646484375,
-0.509765625,
0.37548828125,
1.2080078125,
-0.5703125,
-0.42724609375,
-0.69482421875,
0.35888671875,
0.400390625,
0.481201171875,
0.1517333984375,
-0.450439453125,
-0.173828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitro et æstus, et nil admirari. Festina lente, et nulla tenaci invia est via.
Fac et spera,
Vale,
Nicolas Flamel
Input
The first line of input contains several space-separated integers ai (0 ≤ ai ≤ 100).
Output
Print a single integer.
Examples
Input
2 4 6 8 10
Output
1
Tags: *special
Correct Solution:
```
a = [1,1,2,7,4]
b = list(map(int, input().split()))
m = 1000
for i in range(5):
m = min(b[i]//a[i],m)
print(m)
```
| 45,728
|
[
0.049591064453125,
-0.052154541015625,
0.2353515625,
0.2001953125,
-0.591796875,
-0.8330078125,
0.0347900390625,
-0.0989990234375,
0.408935546875,
0.615234375,
0.69189453125,
-0.043609619140625,
0.0261688232421875,
-0.64892578125,
-0.367431640625,
-0.20703125,
-0.34423828125,
-0.97021484375,
-0.63818359375,
-0.286376953125,
-0.010711669921875,
-0.044952392578125,
-1.3955078125,
-0.231689453125,
-0.51123046875,
0.87841796875,
0.57470703125,
0.381591796875,
0.8291015625,
1.1181640625,
-0.26904296875,
-0.62548828125,
0.55224609375,
-1.318359375,
-0.376220703125,
-0.401611328125,
0.5009765625,
-0.88232421875,
-0.60595703125,
-0.443603515625,
0.0865478515625,
0.07635498046875,
0.338134765625,
-0.67724609375,
-0.6484375,
0.0684814453125,
-0.302734375,
-0.341796875,
-0.0933837890625,
-0.7314453125,
0.11663818359375,
-0.07342529296875,
0.775390625,
-0.115234375,
-0.08453369140625,
-0.087158203125,
0.0286712646484375,
-0.44091796875,
-0.861328125,
0.4736328125,
0.405029296875,
-0.06634521484375,
0.1024169921875,
-0.414306640625,
-0.2421875,
0.295654296875,
-0.216552734375,
0.00016295909881591797,
-0.139892578125,
-0.8203125,
-0.002193450927734375,
0.62890625,
-0.256591796875,
-0.294921875,
-0.43310546875,
-0.27001953125,
0.1968994140625,
-0.19482421875,
-0.546875,
0.302490234375,
0.402587890625,
0.78759765625,
-0.03668212890625,
0.472412109375,
-0.57275390625,
-0.86376953125,
-0.64013671875,
0.54052734375,
0.173095703125,
-0.253173828125,
-0.06854248046875,
0.66748046875,
-0.30859375,
0.08587646484375,
0.413330078125,
0.423828125,
-0.34765625,
0.379638671875,
0.12744140625,
0.1949462890625,
0.91015625,
1.5693359375,
-0.493896484375,
0.90185546875,
-0.77001953125,
-0.18408203125,
-0.111083984375,
0.341796875,
0.248291015625,
-0.358642578125,
-0.383056640625,
-0.193359375,
0.195556640625,
0.0751953125,
-0.447509765625,
0.90185546875,
-0.2666015625,
0.1865234375,
-0.61572265625,
0.327392578125,
0.292236328125,
0.248046875,
0.6259765625,
-0.552734375,
-0.161865234375,
-0.89404296875,
-0.4716796875,
1.1142578125,
-0.57373046875,
0.0011892318725585938,
0.6650390625,
-0.09698486328125,
-0.2412109375,
0.228759765625,
-0.09625244140625,
0.640625,
-0.12176513671875,
0.62158203125,
0.85986328125,
-0.56201171875,
0.298583984375,
-0.2325439453125,
-0.2646484375,
1.2822265625,
0.42333984375,
0.53076171875,
1.0107421875,
0.3447265625,
-0.787109375,
0.1558837890625,
-0.8642578125,
0.71044921875,
-0.06976318359375,
0.66015625,
-0.1610107421875,
0.0296173095703125,
-0.109375,
0.32373046875,
-0.0948486328125,
0.1925048828125,
-0.11260986328125,
0.2353515625,
-0.11175537109375,
1.2509765625,
-0.1541748046875,
0.8251953125,
-0.36865234375,
-0.449462890625,
-0.341064453125,
-0.65283203125,
0.55322265625,
-0.1571044921875,
-0.19775390625,
0.94384765625,
0.210205078125,
1.1572265625,
0.96484375,
0.006252288818359375,
0.1519775390625,
0.45068359375,
-0.061187744140625,
0.2294921875,
0.59375,
1.224609375,
0.45556640625,
0.59619140625,
0.45849609375,
-0.2176513671875,
-0.6220703125,
-0.89501953125,
0.0743408203125,
0.9228515625,
-0.525390625,
0.331787109375,
0.420166015625,
-0.0173492431640625,
-0.369140625,
-0.376220703125,
-0.0210418701171875,
-1.3349609375,
-0.55126953125,
0.43896484375,
-0.432373046875,
0.4453125,
-0.2264404296875,
-0.384521484375,
0.23291015625,
1.1884765625,
-0.5263671875,
-0.3505859375,
0.56103515625,
-0.1484375,
-0.1824951171875,
0.2081298828125,
0.07818603515625,
-0.14404296875,
-0.89404296875,
0.861328125,
-0.384765625,
-0.302978515625,
0.033477783203125,
0.85986328125,
0.3251953125,
0.443115234375,
-0.50732421875,
-0.41650390625,
-0.04193115234375,
1.41796875,
0.0634765625,
0.1259765625,
-0.019622802734375,
0.80029296875,
0.347900390625,
0.84912109375,
1.015625,
0.2152099609375,
0.66650390625,
0.67333984375,
-0.055816650390625,
0.42578125,
-0.07867431640625,
0.73876953125,
0.599609375,
0.2301025390625,
0.0594482421875,
0.4931640625,
0.1746826171875,
0.317626953125,
-0.057037353515625,
0.59765625,
-0.493896484375,
0.5361328125,
0.362060546875,
0.281494140625,
-0.46533203125,
-0.31103515625,
0.47412109375,
1.208984375,
-0.88671875,
-0.244873046875,
-0.35595703125,
0.1893310546875,
0.29833984375,
-0.032379150390625,
0.515625,
0.71875,
0.30419921875,
0.3427734375,
-0.172607421875,
-0.35205078125,
-0.998046875,
-0.57080078125,
-1.3046875,
-0.395263671875,
-0.52197265625,
-0.10498046875,
0.317626953125,
-0.80322265625,
0.47265625,
-0.1973876953125,
-0.47412109375,
0.0811767578125,
-0.65625,
0.71337890625,
-0.1622314453125,
0.80810546875,
-0.94287109375,
0.438232421875,
0.2381591796875,
1.0673828125,
-0.7861328125,
-0.224609375,
0.31494140625,
-0.78125,
0.1514892578125,
0.217041015625,
0.355712890625,
0.056549072265625,
-0.87451171875,
-0.81103515625,
-0.1065673828125,
0.1334228515625,
0.05010986328125,
0.425048828125,
-0.365234375,
0.982421875,
0.54150390625,
-0.51025390625,
0.3720703125,
0.385986328125,
-0.86328125,
0.66650390625,
0.093994140625,
0.131103515625,
-0.8583984375,
1.3203125,
0.52587890625,
0.25537109375,
-0.49560546875,
-0.20849609375,
-0.60498046875,
-0.018096923828125,
0.11456298828125,
-0.67138671875,
-0.5849609375,
0.457763671875,
0.475830078125,
-0.98681640625,
0.443359375,
-0.82373046875,
-0.58251953125,
-0.1849365234375,
-0.24951171875,
0.9619140625,
0.55029296875,
0.0638427734375,
-0.1112060546875,
-0.3603515625,
-0.321044921875,
0.296142578125,
0.317138671875,
-0.42919921875,
-0.2100830078125,
0.9345703125,
-0.353515625,
-0.1214599609375,
-0.0111236572265625,
-0.0105743408203125,
-0.040618896484375,
-0.01194000244140625,
0.27783203125,
0.433837890625,
0.267822265625,
-0.0278472900390625,
0.288818359375,
1.1123046875,
-0.66064453125,
-0.270751953125,
-0.0689697265625,
0.499755859375,
0.1641845703125,
0.347412109375,
0.482666015625,
-0.40576171875,
-0.46484375,
-1.0908203125,
0.314208984375,
0.287353515625,
0.5625,
-0.662109375,
0.461181640625,
0.67626953125,
-0.70458984375,
0.53662109375,
-0.440185546875,
-0.11895751953125,
0.85888671875,
0.35791015625,
0.85888671875,
-0.736328125,
-0.0006995201110839844,
-0.2386474609375,
0.296142578125,
0.59912109375,
0.0911865234375,
0.97705078125,
-0.3759765625,
-0.429443359375,
-0.33203125,
-0.79638671875,
0.144287109375,
-0.744140625,
0.252197265625,
-0.3662109375,
-0.369873046875,
-0.771484375,
0.1732177734375,
0.5,
0.36572265625,
0.1365966796875,
0.544921875,
0.2071533203125,
0.6533203125,
0.6904296875,
-0.206298828125,
-0.08038330078125,
-0.6552734375,
1.044921875,
0.2440185546875,
-0.2337646484375,
-0.798828125,
-0.11163330078125,
0.1123046875,
0.0614013671875,
0.22265625,
-0.64306640625,
-0.44677734375,
0.41455078125,
-0.0657958984375,
0.5009765625,
-0.0931396484375,
-0.630859375,
0.1002197265625,
0.771484375,
0.0703125,
-0.91259765625,
0.348388671875,
-0.5576171875,
0.5625,
0.685546875,
-0.53515625,
-0.463623046875,
-0.62255859375,
-0.6943359375,
-0.33935546875,
-0.1375732421875,
0.61767578125,
-0.41943359375,
0.47802734375,
-1.0986328125,
0.31982421875,
0.67578125,
-0.1337890625,
0.0753173828125,
-0.1649169921875,
0.2705078125,
0.00872802734375,
0.66015625,
-0.50390625,
-1.0537109375,
0.1510009765625,
-1.1923828125,
0.303955078125,
-0.85107421875,
0.25537109375,
-0.048370361328125,
-0.034820556640625,
-0.256103515625,
0.488037109375,
0.2239990234375,
-0.274169921875,
-0.165771484375,
0.19580078125,
-0.95654296875,
-0.5078125,
0.828125,
-0.630859375,
-0.1304931640625,
0.75048828125,
-0.58837890625,
-0.372314453125,
0.1732177734375,
0.5986328125,
-0.302490234375,
0.30224609375,
-0.400390625,
0.5224609375,
-0.22998046875,
-0.2198486328125,
-0.0709228515625,
-0.49951171875,
0.7177734375,
0.08697509765625,
-0.85791015625,
-0.1373291015625,
-1.017578125,
-0.164794921875,
-0.08392333984375,
-0.5576171875,
0.06451416015625,
0.3125,
-0.359130859375,
-0.240966796875,
-0.55322265625,
-0.1951904296875,
-0.5029296875,
-0.5078125,
-0.1419677734375,
0.67822265625,
0.291748046875,
0.59765625,
0.2432861328125,
-0.71484375,
0.0009551048278808594,
-0.262939453125,
0.036956787109375,
-0.52197265625,
-0.0106658935546875,
0.14794921875,
-0.2310791015625,
-0.1002197265625,
0.018463134765625,
0.09051513671875,
0.69580078125,
1.1162109375,
-0.08917236328125,
0.433349609375,
0.21826171875,
-0.580078125,
1.0771484375,
-0.25732421875,
-0.90576171875,
-0.67626953125,
0.44873046875,
0.1461181640625,
0.43017578125,
0.437255859375,
-0.77197265625,
-0.82666015625,
-1.3779296875,
0.06524658203125,
-0.53076171875,
-0.09661865234375,
-1.2080078125,
-0.6064453125,
-0.3486328125,
0.5732421875,
-0.42431640625,
-1.0380859375,
0.13134765625,
-0.81298828125,
-0.01201629638671875,
-0.46630859375,
-0.06036376953125,
-1.12109375,
-0.485107421875,
-0.0214996337890625,
0.5068359375,
-0.0310211181640625,
0.52490234375,
-0.300537109375,
-0.2459716796875,
0.04241943359375,
-0.07989501953125,
-0.482421875,
-0.5048828125,
-0.2061767578125,
-0.15283203125,
-0.098388671875,
-0.1580810546875,
-0.3583984375,
0.9208984375,
-1.0517578125,
-0.121337890625,
-0.396240234375,
-0.43017578125,
-0.0882568359375,
-0.6630859375,
1.2607421875,
0.129638671875,
0.00734710693359375,
-0.462158203125,
0.658203125,
0.7294921875,
-0.4462890625,
-0.5439453125,
-0.73828125,
-0.154296875,
-1.150390625,
0.69140625,
-0.494140625,
-0.2489013671875,
-0.1566162109375,
0.058135986328125,
0.8056640625,
-0.363525390625,
0.64599609375,
1.44140625,
-0.07366943359375,
0.06378173828125,
-0.7763671875,
0.5517578125,
0.1339111328125,
-0.4501953125,
0.2235107421875,
-0.1280517578125,
-0.68798828125,
-0.0980224609375,
-0.1121826171875,
-0.765625,
-0.72705078125,
-0.032501220703125,
1.3876953125,
-0.172119140625,
0.469482421875,
0.287353515625,
-1.5322265625,
-1.044921875,
1.033203125,
0.1925048828125,
0.70263671875,
1.0830078125,
-0.0217742919921875,
-0.12127685546875,
-0.493896484375,
0.150634765625,
-0.302978515625,
-0.231689453125,
1.259765625,
0.31787109375,
-0.475341796875,
0.67236328125,
0.98681640625,
-1.42578125,
-0.61474609375,
0.32958984375,
-0.0809326171875,
-0.43310546875,
-0.6279296875,
0.28125,
0.64453125,
-0.99951171875,
0.1558837890625,
0.492919921875,
0.01519012451171875,
0.356201171875,
0.0584716796875,
0.66064453125,
-0.25341796875,
0.42626953125,
1.048828125,
-0.50048828125,
-0.2493896484375,
-1.134765625,
-0.6806640625,
-0.295166015625,
0.27685546875,
0.79541015625,
-0.61572265625,
-0.042205810546875,
0.60693359375,
-0.045166015625,
0.6474609375,
-0.437255859375,
-0.54833984375,
0.048095703125,
-0.5927734375,
-0.42822265625,
0.0024433135986328125,
0.53466796875,
0.1810302734375,
0.3134765625,
-0.441650390625,
0.39599609375,
0.4384765625,
0.1785888671875,
-0.10919189453125,
-0.96875,
-0.463134765625,
-0.96923828125,
-0.4365234375,
-0.64892578125,
-0.59033203125,
-0.270751953125,
-0.02783203125,
-0.0287933349609375,
-0.5205078125,
-0.039703369140625,
0.298095703125,
-0.224609375,
0.806640625,
-0.90283203125,
0.375732421875,
-0.83154296875,
-0.479736328125,
-0.671875,
-0.038299560546875,
-0.279296875,
0.1898193359375,
-1.0966796875,
0.414306640625,
-0.124755859375,
0.853515625,
-0.0782470703125,
0.409912109375,
-0.1484375,
-0.6630859375,
0.2335205078125,
0.268310546875,
-0.1895751953125,
0.7236328125,
0.4619140625,
-0.1500244140625,
0.10076904296875,
0.06512451171875,
-0.2152099609375,
-0.332763671875,
0.420654296875,
0.81591796875,
-0.274169921875,
-0.1121826171875,
-0.437255859375,
0.0423583984375,
-0.97998046875,
0.5048828125,
-0.045928955078125,
-0.11151123046875,
0.49853515625,
-0.17529296875,
0.484375,
1.216796875,
0.07562255859375,
0.186279296875,
-0.05316162109375,
0.5576171875,
0.40185546875,
-0.071533203125,
0.392578125,
0.44921875,
0.05279541015625,
-0.459228515625,
0.327392578125,
0.7119140625,
-0.3876953125,
0.281005859375,
-0.4130859375,
-0.458251953125,
-0.810546875,
-0.33447265625,
-0.4599609375,
0.3154296875,
0.491943359375,
-0.57958984375,
-0.07794189453125,
-0.1092529296875,
-0.428955078125,
0.01922607421875,
-1.326171875,
-0.84765625,
0.75634765625,
-0.22314453125,
-0.470703125,
-0.2371826171875,
-0.44140625,
-0.225341796875,
0.2266845703125,
0.60302734375,
-0.377197265625,
0.57470703125,
-0.48095703125,
0.250732421875,
-0.2939453125,
-0.1964111328125,
0.171875,
0.422607421875,
-0.8056640625,
-0.5390625,
0.28857421875,
1.31640625,
0.438720703125,
0.276611328125,
-0.381591796875,
0.2509765625,
0.19775390625,
-0.338623046875,
-0.393310546875,
0.05133056640625,
-0.1788330078125,
-0.07696533203125,
-0.151123046875,
0.283447265625,
-0.677734375,
0.45849609375,
0.149169921875,
-0.3125,
-0.64892578125,
0.75732421875,
0.496337890625,
-0.403076171875,
0.6572265625,
0.380859375,
0.334228515625,
0.01081085205078125,
-0.295654296875,
0.1304931640625,
0.66845703125,
0.7373046875,
0.84716796875,
-0.17333984375,
0.060699462890625,
1.0244140625,
-0.07464599609375,
-0.1363525390625,
0.474609375,
-0.08782958984375,
-0.12188720703125,
-0.2607421875,
-0.26123046875,
-0.07757568359375,
0.0823974609375,
-0.60498046875,
0.86279296875,
-0.413818359375,
-0.32275390625,
-0.268798828125,
-0.513671875,
0.880859375,
-0.1995849609375,
-0.1021728515625,
0.21044921875,
-0.5986328125,
0.2247314453125,
0.703125,
0.10528564453125,
-0.10400390625,
0.81494140625,
0.65869140625,
0.69189453125,
0.8515625,
0.1650390625,
0.51904296875,
-0.5908203125,
0.306884765625,
0.1126708984375,
-0.051300048828125,
-0.4970703125,
-0.5263671875,
-0.8701171875,
0.2880859375,
-0.544921875,
-0.3212890625,
0.484130859375,
-0.58544921875,
0.44384765625,
-0.37548828125,
0.6328125,
-0.41357421875,
0.343017578125,
0.35107421875,
-0.60546875,
-0.82373046875,
0.48974609375,
-0.11083984375,
0.393310546875,
0.2626953125,
1.4716796875,
-0.2344970703125,
1.2705078125,
0.544921875,
-0.1944580078125,
-0.375244140625,
0.1754150390625,
-0.2291259765625,
-0.25048828125,
-0.263916015625,
-0.345703125,
0.283447265625,
-0.77001953125,
-0.2548828125,
0.22607421875,
0.7451171875,
0.2568359375,
-1.08984375,
-0.1671142578125,
0.46826171875,
-0.84521484375,
0.412353515625,
0.212158203125,
0.1319580078125,
0.168701171875,
0.037872314453125,
-0.2435302734375,
-0.51025390625,
0.0689697265625,
-0.8193359375,
0.5419921875,
-0.57373046875,
-0.826171875,
-0.77099609375,
-0.7529296875,
-0.03558349609375,
-0.072509765625,
-0.66748046875,
-0.73486328125,
0.453369140625,
0.6806640625,
0.1256103515625,
0.100341796875,
-0.06622314453125,
-0.3544921875,
1.037109375,
1.0068359375,
0.62744140625,
0.79736328125,
0.376220703125,
-0.7392578125,
0.5869140625,
-0.6572265625,
0.6357421875,
-0.19287109375,
0.04510498046875,
-0.424072265625,
0.5078125,
-0.6591796875,
-1.265625,
0.345458984375,
0.443359375,
0.68701171875,
-0.68896484375,
-1.087890625,
-0.276123046875,
-1.2080078125,
-0.39306640625,
-0.65087890625,
0.759765625,
-0.16015625,
-0.282958984375,
-0.2427978515625,
-1.1962890625,
4.30859375,
0.92578125,
0.8466796875,
0.748046875,
-0.271728515625,
0.60986328125,
0.6611328125,
-0.41748046875,
-0.12646484375,
-0.25537109375,
0.4052734375,
-0.2763671875,
-0.09130859375,
0.81103515625,
0.68994140625,
0.4169921875,
-0.54052734375,
0.5322265625,
-0.025634765625,
-0.68017578125,
-0.92529296875,
0.4765625,
-0.147216796875,
0.424072265625,
0.1103515625,
0.2347412109375,
0.5,
-0.5380859375,
-0.2467041015625,
-0.2802734375,
0.359619140625,
-0.452392578125,
0.65234375,
-0.269287109375,
-0.038055419921875,
0.06719970703125,
-0.1636962890625,
-0.552734375,
-0.1409912109375,
0.321044921875,
-0.169921875,
0.06231689453125,
0.73681640625,
-0.54638671875,
0.06829833984375,
0.61083984375,
-0.49267578125,
0.5576171875,
0.270263671875,
-1.095703125,
0.93359375,
-0.2413330078125,
0.14306640625,
-0.87109375,
-0.92626953125,
-0.10369873046875,
0.334716796875,
0.15478515625,
0.18896484375,
0.385009765625,
0.54248046875,
0.72119140625,
0.378662109375,
0.3955078125,
-1.0166015625,
1.01171875,
-0.082763671875,
0.328857421875,
-0.435791015625,
-0.1646728515625,
-0.53662109375,
-0.38525390625,
0.08758544921875,
-0.65576171875,
0.5810546875,
-0.1094970703125,
-0.63232421875,
0.4873046875,
0.25,
-0.7890625,
0.029083251953125,
0.1988525390625,
-0.368408203125,
-0.3662109375,
0.50390625,
1.189453125,
-0.62646484375,
-0.37646484375,
-0.73779296875,
0.52001953125,
0.366943359375,
0.40380859375,
0.05450439453125,
-0.471923828125,
-0.1474609375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitro et æstus, et nil admirari. Festina lente, et nulla tenaci invia est via.
Fac et spera,
Vale,
Nicolas Flamel
Input
The first line of input contains several space-separated integers ai (0 ≤ ai ≤ 100).
Output
Print a single integer.
Examples
Input
2 4 6 8 10
Output
1
Tags: *special
Correct Solution:
```
a, b, c, d, e = map(int, input().split(' ')); print(min(a, b, c//2, d//7, e//4))
```
| 45,729
|
[
0.052734375,
-0.006000518798828125,
0.280517578125,
0.2005615234375,
-0.52294921875,
-0.87890625,
-0.0024700164794921875,
-0.044708251953125,
0.34228515625,
0.58251953125,
0.66015625,
-0.0277557373046875,
0.06817626953125,
-0.72119140625,
-0.33642578125,
-0.25830078125,
-0.336669921875,
-0.97314453125,
-0.623046875,
-0.30224609375,
-0.091552734375,
-0.0684814453125,
-1.392578125,
-0.1417236328125,
-0.53662109375,
0.95751953125,
0.61279296875,
0.33447265625,
0.78857421875,
1.1025390625,
-0.296630859375,
-0.57421875,
0.47900390625,
-1.2802734375,
-0.3046875,
-0.36181640625,
0.60546875,
-0.830078125,
-0.66259765625,
-0.40087890625,
0.052581787109375,
0.178466796875,
0.333740234375,
-0.71728515625,
-0.60595703125,
0.035980224609375,
-0.319580078125,
-0.27490234375,
-0.052947998046875,
-0.77978515625,
0.10736083984375,
-0.113525390625,
0.74072265625,
-0.1258544921875,
-0.13818359375,
-0.1136474609375,
0.10107421875,
-0.408447265625,
-0.87158203125,
0.58154296875,
0.4609375,
-0.14697265625,
0.1505126953125,
-0.40771484375,
-0.28271484375,
0.240234375,
-0.25,
-0.01108551025390625,
-0.164794921875,
-0.8076171875,
-0.01092529296875,
0.63623046875,
-0.2371826171875,
-0.32568359375,
-0.357421875,
-0.351806640625,
0.2005615234375,
-0.218505859375,
-0.5244140625,
0.283935546875,
0.463623046875,
0.72998046875,
-0.0008530616760253906,
0.427490234375,
-0.4892578125,
-0.88720703125,
-0.64404296875,
0.62744140625,
0.224853515625,
-0.262451171875,
-0.0701904296875,
0.67333984375,
-0.3271484375,
0.10516357421875,
0.45751953125,
0.51708984375,
-0.41796875,
0.392333984375,
0.0980224609375,
0.193115234375,
0.91748046875,
1.541015625,
-0.5205078125,
0.96435546875,
-0.8330078125,
-0.144775390625,
-0.0948486328125,
0.37158203125,
0.22314453125,
-0.332275390625,
-0.373779296875,
-0.1507568359375,
0.2060546875,
0.10467529296875,
-0.45556640625,
0.84619140625,
-0.26611328125,
0.127685546875,
-0.6484375,
0.2432861328125,
0.3271484375,
0.2239990234375,
0.60205078125,
-0.521484375,
-0.187255859375,
-0.83447265625,
-0.486328125,
1.072265625,
-0.5263671875,
0.00274658203125,
0.7041015625,
-0.11865234375,
-0.1448974609375,
0.1728515625,
-0.06689453125,
0.60302734375,
-0.09796142578125,
0.63818359375,
0.80908203125,
-0.5234375,
0.28466796875,
-0.198974609375,
-0.218017578125,
1.279296875,
0.471923828125,
0.6220703125,
0.93212890625,
0.355224609375,
-0.76123046875,
0.2021484375,
-0.79541015625,
0.60791015625,
-0.04534912109375,
0.64697265625,
-0.263427734375,
0.1597900390625,
-0.10321044921875,
0.34814453125,
-0.10333251953125,
0.29150390625,
-0.10675048828125,
0.275634765625,
-0.128173828125,
1.32421875,
-0.1595458984375,
0.80859375,
-0.325439453125,
-0.44384765625,
-0.416015625,
-0.6337890625,
0.54736328125,
-0.205078125,
-0.2412109375,
0.9296875,
0.2440185546875,
1.1298828125,
0.86572265625,
0.048583984375,
0.1954345703125,
0.5009765625,
-0.0775146484375,
0.1461181640625,
0.54052734375,
1.2470703125,
0.447998046875,
0.6572265625,
0.44287109375,
-0.188232421875,
-0.560546875,
-0.84912109375,
0.017974853515625,
0.953125,
-0.52294921875,
0.33349609375,
0.42724609375,
0.00033926963806152344,
-0.436767578125,
-0.375244140625,
-0.00839996337890625,
-1.2373046875,
-0.62841796875,
0.5009765625,
-0.426513671875,
0.46923828125,
-0.193359375,
-0.3369140625,
0.1363525390625,
1.2265625,
-0.54052734375,
-0.31494140625,
0.56201171875,
-0.0650634765625,
-0.2318115234375,
0.240966796875,
0.069580078125,
-0.181640625,
-0.85302734375,
0.80322265625,
-0.34619140625,
-0.375244140625,
0.01261138916015625,
0.8916015625,
0.380859375,
0.46044921875,
-0.59228515625,
-0.298583984375,
0.007656097412109375,
1.392578125,
0.1280517578125,
0.07672119140625,
0.0222015380859375,
0.8046875,
0.30126953125,
0.90380859375,
1.0234375,
0.1744384765625,
0.75048828125,
0.6748046875,
-0.0701904296875,
0.45263671875,
0.0278167724609375,
0.697265625,
0.61376953125,
0.16357421875,
0.07000732421875,
0.437744140625,
0.2003173828125,
0.308837890625,
-0.015228271484375,
0.5615234375,
-0.55322265625,
0.52783203125,
0.394775390625,
0.258056640625,
-0.51318359375,
-0.267333984375,
0.5634765625,
1.1845703125,
-0.8701171875,
-0.2491455078125,
-0.36279296875,
0.2452392578125,
0.1783447265625,
-0.02667236328125,
0.45556640625,
0.65087890625,
0.268310546875,
0.289794921875,
-0.153076171875,
-0.3681640625,
-1.0654296875,
-0.591796875,
-1.3681640625,
-0.3740234375,
-0.56396484375,
-0.084716796875,
0.3486328125,
-0.7568359375,
0.478759765625,
-0.23974609375,
-0.556640625,
0.0687255859375,
-0.63134765625,
0.70703125,
-0.12371826171875,
0.86767578125,
-0.9521484375,
0.409423828125,
0.14599609375,
1.1552734375,
-0.826171875,
-0.239990234375,
0.2391357421875,
-0.7470703125,
0.1473388671875,
0.071044921875,
0.310546875,
0.056915283203125,
-0.88427734375,
-0.818359375,
-0.1834716796875,
0.2421875,
0.09429931640625,
0.380126953125,
-0.352783203125,
1.017578125,
0.50146484375,
-0.50732421875,
0.418701171875,
0.28076171875,
-0.9189453125,
0.689453125,
0.09796142578125,
0.06976318359375,
-0.87255859375,
1.28515625,
0.51611328125,
0.244140625,
-0.495361328125,
-0.193359375,
-0.55810546875,
0.0615234375,
0.1729736328125,
-0.693359375,
-0.615234375,
0.46142578125,
0.398681640625,
-0.9404296875,
0.5283203125,
-0.7841796875,
-0.5986328125,
-0.1890869140625,
-0.267822265625,
1.03515625,
0.548828125,
0.07086181640625,
-0.177734375,
-0.36572265625,
-0.36669921875,
0.288330078125,
0.284912109375,
-0.359375,
-0.15576171875,
0.88525390625,
-0.338623046875,
-0.051544189453125,
-0.0012083053588867188,
-0.08172607421875,
-0.0919189453125,
-0.0902099609375,
0.2337646484375,
0.395263671875,
0.27783203125,
-0.11895751953125,
0.2176513671875,
1.1484375,
-0.76171875,
-0.371337890625,
-0.09600830078125,
0.439697265625,
0.184814453125,
0.30419921875,
0.50048828125,
-0.43115234375,
-0.5048828125,
-1.0537109375,
0.3740234375,
0.406982421875,
0.62890625,
-0.6201171875,
0.440673828125,
0.68994140625,
-0.7314453125,
0.461669921875,
-0.4453125,
-0.148681640625,
0.912109375,
0.3896484375,
0.84375,
-0.65966796875,
0.040283203125,
-0.2379150390625,
0.2015380859375,
0.6650390625,
0.07879638671875,
1.009765625,
-0.442138671875,
-0.357177734375,
-0.360595703125,
-0.8310546875,
0.166748046875,
-0.7998046875,
0.235107421875,
-0.41796875,
-0.41064453125,
-0.76416015625,
0.3193359375,
0.468505859375,
0.364501953125,
0.205810546875,
0.51171875,
0.17822265625,
0.6591796875,
0.7255859375,
-0.3671875,
-0.051605224609375,
-0.6884765625,
1.009765625,
0.226806640625,
-0.1859130859375,
-0.72607421875,
-0.1710205078125,
0.129638671875,
0.032012939453125,
0.268798828125,
-0.58984375,
-0.44140625,
0.52099609375,
-0.0364990234375,
0.5126953125,
-0.165771484375,
-0.666015625,
0.1446533203125,
0.7451171875,
0.10198974609375,
-0.92236328125,
0.411865234375,
-0.58349609375,
0.57470703125,
0.6669921875,
-0.61279296875,
-0.442626953125,
-0.5654296875,
-0.7646484375,
-0.3349609375,
-0.09320068359375,
0.62939453125,
-0.37646484375,
0.432373046875,
-1.044921875,
0.32421875,
0.7294921875,
-0.1895751953125,
0.035736083984375,
-0.2069091796875,
0.306884765625,
-0.01494598388671875,
0.70458984375,
-0.466796875,
-0.98388671875,
0.170654296875,
-1.1181640625,
0.372314453125,
-0.82763671875,
0.26953125,
-0.08233642578125,
-0.07208251953125,
-0.26708984375,
0.53955078125,
0.191162109375,
-0.345703125,
-0.12371826171875,
0.1917724609375,
-0.90625,
-0.5048828125,
0.87548828125,
-0.62451171875,
-0.1639404296875,
0.6640625,
-0.51708984375,
-0.37255859375,
0.1741943359375,
0.67333984375,
-0.2423095703125,
0.395751953125,
-0.484375,
0.474853515625,
-0.2249755859375,
-0.18310546875,
-0.0855712890625,
-0.474853515625,
0.68212890625,
0.0499267578125,
-0.904296875,
-0.104248046875,
-1.08984375,
-0.10235595703125,
-0.14013671875,
-0.529296875,
-0.033721923828125,
0.279541015625,
-0.364990234375,
-0.1654052734375,
-0.5849609375,
-0.2169189453125,
-0.427978515625,
-0.52783203125,
-0.07183837890625,
0.66259765625,
0.37841796875,
0.56005859375,
0.236328125,
-0.7646484375,
-0.0246734619140625,
-0.29248046875,
-0.0179290771484375,
-0.52978515625,
0.004619598388671875,
0.1656494140625,
-0.2626953125,
-0.1497802734375,
0.084228515625,
0.08404541015625,
0.65673828125,
1.0927734375,
-0.0733642578125,
0.54833984375,
0.12646484375,
-0.564453125,
1.0859375,
-0.27294921875,
-0.888671875,
-0.607421875,
0.54296875,
0.16162109375,
0.493408203125,
0.390625,
-0.75341796875,
-0.85791015625,
-1.333984375,
0.1011962890625,
-0.52978515625,
-0.11224365234375,
-1.146484375,
-0.68212890625,
-0.33984375,
0.634765625,
-0.4287109375,
-1.09765625,
0.1392822265625,
-0.794921875,
-0.058349609375,
-0.4755859375,
-0.008270263671875,
-1.2431640625,
-0.4765625,
-0.040985107421875,
0.5263671875,
0.044708251953125,
0.49951171875,
-0.313720703125,
-0.17919921875,
0.05413818359375,
-0.06195068359375,
-0.49853515625,
-0.5029296875,
-0.2249755859375,
-0.1685791015625,
-0.10430908203125,
-0.1553955078125,
-0.338134765625,
0.91357421875,
-1.005859375,
-0.14404296875,
-0.421875,
-0.444091796875,
-0.0750732421875,
-0.5771484375,
1.3369140625,
0.040130615234375,
-0.07293701171875,
-0.474853515625,
0.59423828125,
0.7529296875,
-0.368408203125,
-0.54931640625,
-0.71875,
-0.1595458984375,
-1.138671875,
0.67041015625,
-0.52783203125,
-0.269775390625,
-0.1724853515625,
0.006378173828125,
0.7275390625,
-0.306884765625,
0.69482421875,
1.4326171875,
-0.0026607513427734375,
0.042449951171875,
-0.80615234375,
0.61669921875,
0.1851806640625,
-0.4375,
0.20654296875,
-0.1688232421875,
-0.59716796875,
-0.08551025390625,
-0.175537109375,
-0.7099609375,
-0.7119140625,
0.0205230712890625,
1.3359375,
-0.0880126953125,
0.5908203125,
0.338134765625,
-1.5546875,
-1.0302734375,
0.982421875,
0.161865234375,
0.720703125,
1.0810546875,
0.10626220703125,
-0.1260986328125,
-0.36962890625,
0.1861572265625,
-0.29931640625,
-0.292236328125,
1.275390625,
0.337646484375,
-0.50732421875,
0.6728515625,
0.92578125,
-1.4365234375,
-0.6669921875,
0.35302734375,
-0.11553955078125,
-0.4677734375,
-0.52587890625,
0.41162109375,
0.63671875,
-1.04296875,
0.12396240234375,
0.487548828125,
0.06597900390625,
0.402099609375,
-0.01824951171875,
0.68896484375,
-0.2391357421875,
0.472412109375,
1.0263671875,
-0.56103515625,
-0.1629638671875,
-1.09765625,
-0.7021484375,
-0.267578125,
0.314453125,
0.7392578125,
-0.5634765625,
-0.062286376953125,
0.62451171875,
-0.156005859375,
0.6435546875,
-0.378662109375,
-0.51708984375,
0.03363037109375,
-0.64111328125,
-0.387451171875,
0.02099609375,
0.44775390625,
0.09136962890625,
0.273681640625,
-0.44384765625,
0.300048828125,
0.5068359375,
0.206787109375,
-0.11273193359375,
-0.9111328125,
-0.572265625,
-1.0341796875,
-0.4794921875,
-0.69482421875,
-0.56201171875,
-0.325439453125,
-0.04852294921875,
-0.061248779296875,
-0.52001953125,
-0.0025920867919921875,
0.260498046875,
-0.1256103515625,
0.85693359375,
-0.89599609375,
0.3408203125,
-0.80859375,
-0.51171875,
-0.7529296875,
-0.054229736328125,
-0.19677734375,
0.2137451171875,
-1.1337890625,
0.424072265625,
-0.144287109375,
0.849609375,
-0.0841064453125,
0.31884765625,
-0.26171875,
-0.58203125,
0.158447265625,
0.31298828125,
-0.253662109375,
0.74267578125,
0.468017578125,
0.0064239501953125,
0.1729736328125,
0.01288604736328125,
-0.1932373046875,
-0.376220703125,
0.34521484375,
0.7431640625,
-0.303466796875,
-0.1444091796875,
-0.4130859375,
0.04144287109375,
-0.998046875,
0.5673828125,
-0.10198974609375,
-0.1409912109375,
0.47119140625,
-0.124755859375,
0.418212890625,
1.1630859375,
0.10845947265625,
0.1951904296875,
-0.03289794921875,
0.509765625,
0.3642578125,
-0.055267333984375,
0.388916015625,
0.447509765625,
0.037811279296875,
-0.404541015625,
0.317626953125,
0.7451171875,
-0.378173828125,
0.270263671875,
-0.3271484375,
-0.50341796875,
-0.830078125,
-0.356201171875,
-0.481689453125,
0.36767578125,
0.60107421875,
-0.6005859375,
-0.007061004638671875,
-0.09808349609375,
-0.498291015625,
0.07354736328125,
-1.298828125,
-0.8642578125,
0.71630859375,
-0.2171630859375,
-0.439208984375,
-0.1983642578125,
-0.52294921875,
-0.281005859375,
0.2120361328125,
0.609375,
-0.382080078125,
0.54638671875,
-0.400634765625,
0.2015380859375,
-0.2431640625,
-0.12286376953125,
0.14111328125,
0.412841796875,
-0.681640625,
-0.5771484375,
0.319091796875,
1.3203125,
0.42333984375,
0.26220703125,
-0.38037109375,
0.307861328125,
0.10382080078125,
-0.2425537109375,
-0.3076171875,
0.060546875,
-0.228515625,
-0.07952880859375,
-0.08868408203125,
0.33935546875,
-0.81591796875,
0.441650390625,
0.1627197265625,
-0.33984375,
-0.62060546875,
0.806640625,
0.473876953125,
-0.482666015625,
0.63427734375,
0.31982421875,
0.307861328125,
0.005352020263671875,
-0.2685546875,
0.12078857421875,
0.630859375,
0.74951171875,
0.8330078125,
-0.2015380859375,
0.084228515625,
1.0234375,
-0.035064697265625,
-0.09326171875,
0.42529296875,
-0.038177490234375,
-0.054290771484375,
-0.25048828125,
-0.2384033203125,
-0.056488037109375,
-0.0404052734375,
-0.7041015625,
0.69384765625,
-0.3203125,
-0.366455078125,
-0.2724609375,
-0.521484375,
0.84619140625,
-0.1802978515625,
-0.08074951171875,
0.269775390625,
-0.564453125,
0.29541015625,
0.7373046875,
0.09527587890625,
0.00007045269012451172,
0.83935546875,
0.6865234375,
0.64501953125,
0.8779296875,
0.210693359375,
0.483154296875,
-0.60009765625,
0.308349609375,
0.195068359375,
-0.056549072265625,
-0.58349609375,
-0.5361328125,
-0.8046875,
0.321044921875,
-0.48046875,
-0.32080078125,
0.379638671875,
-0.56640625,
0.473388671875,
-0.365234375,
0.66455078125,
-0.48388671875,
0.4208984375,
0.310302734375,
-0.49853515625,
-0.88232421875,
0.48046875,
-0.0994873046875,
0.421142578125,
0.25,
1.47265625,
-0.1942138671875,
1.2421875,
0.49658203125,
-0.1719970703125,
-0.40576171875,
0.1591796875,
-0.2396240234375,
-0.1832275390625,
-0.2293701171875,
-0.294677734375,
0.314453125,
-0.71923828125,
-0.324951171875,
0.2467041015625,
0.75341796875,
0.2003173828125,
-1.08984375,
-0.25341796875,
0.54443359375,
-0.82177734375,
0.421142578125,
0.207763671875,
0.213134765625,
0.13916015625,
0.0985107421875,
-0.2073974609375,
-0.53076171875,
0.08807373046875,
-0.80029296875,
0.52099609375,
-0.49462890625,
-0.8369140625,
-0.82763671875,
-0.68359375,
0.00370025634765625,
-0.07745361328125,
-0.62646484375,
-0.77587890625,
0.44140625,
0.65380859375,
0.05810546875,
0.045684814453125,
-0.019989013671875,
-0.35009765625,
0.94384765625,
1.0625,
0.64111328125,
0.736328125,
0.398193359375,
-0.79150390625,
0.556640625,
-0.80419921875,
0.71923828125,
-0.2103271484375,
-0.05169677734375,
-0.49853515625,
0.638671875,
-0.69921875,
-1.2451171875,
0.289794921875,
0.49169921875,
0.70703125,
-0.64794921875,
-1.0830078125,
-0.272705078125,
-1.2412109375,
-0.38916015625,
-0.66064453125,
0.6962890625,
-0.1549072265625,
-0.309326171875,
-0.2685546875,
-1.21875,
4.3046875,
0.98486328125,
0.93212890625,
0.716796875,
-0.21142578125,
0.62646484375,
0.67724609375,
-0.405029296875,
-0.144287109375,
-0.254638671875,
0.445556640625,
-0.220458984375,
-0.0833740234375,
0.69921875,
0.6357421875,
0.39111328125,
-0.640625,
0.50244140625,
-0.07977294921875,
-0.677734375,
-0.89697265625,
0.42431640625,
-0.08251953125,
0.48681640625,
0.054443359375,
0.34375,
0.5126953125,
-0.576171875,
-0.2481689453125,
-0.33642578125,
0.39794921875,
-0.464599609375,
0.63330078125,
-0.333740234375,
-0.0863037109375,
0.0914306640625,
-0.14111328125,
-0.5341796875,
-0.2418212890625,
0.29833984375,
-0.194091796875,
0.09893798828125,
0.7939453125,
-0.52587890625,
0.017822265625,
0.52001953125,
-0.52783203125,
0.63720703125,
0.236083984375,
-1.1513671875,
0.94580078125,
-0.3095703125,
0.1475830078125,
-0.8662109375,
-0.85205078125,
-0.115478515625,
0.2462158203125,
0.1246337890625,
0.2362060546875,
0.392578125,
0.5966796875,
0.6142578125,
0.390380859375,
0.280029296875,
-0.99169921875,
0.97314453125,
-0.09063720703125,
0.3408203125,
-0.50732421875,
-0.10565185546875,
-0.5732421875,
-0.355712890625,
0.11328125,
-0.64111328125,
0.6083984375,
-0.053375244140625,
-0.62744140625,
0.3798828125,
0.2685546875,
-0.802734375,
-0.01432037353515625,
0.224853515625,
-0.316162109375,
-0.46533203125,
0.39697265625,
1.125,
-0.60986328125,
-0.48046875,
-0.7861328125,
0.431396484375,
0.43310546875,
0.456787109375,
0.1173095703125,
-0.484130859375,
-0.17626953125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitro et æstus, et nil admirari. Festina lente, et nulla tenaci invia est via.
Fac et spera,
Vale,
Nicolas Flamel
Input
The first line of input contains several space-separated integers ai (0 ≤ ai ≤ 100).
Output
Print a single integer.
Examples
Input
2 4 6 8 10
Output
1
Tags: *special
Correct Solution:
```
a=list(map(int,input().split()))
ans=100
ans=min(ans,a[0])
ans=min(ans,a[1])
ans=min(ans,a[2]//2)
ans=min(ans,a[3]//7)
ans=min(ans,a[4]//4)
print(ans)
```
| 45,730
|
[
0.07763671875,
-0.0121307373046875,
0.291259765625,
0.1966552734375,
-0.62451171875,
-0.8388671875,
0.05804443359375,
-0.060546875,
0.3935546875,
0.591796875,
0.68115234375,
-0.04150390625,
-0.002246856689453125,
-0.70751953125,
-0.4033203125,
-0.21240234375,
-0.288330078125,
-0.9716796875,
-0.64697265625,
-0.34130859375,
-0.0780029296875,
-0.005702972412109375,
-1.3955078125,
-0.2169189453125,
-0.513671875,
0.96484375,
0.5869140625,
0.369873046875,
0.8720703125,
1.140625,
-0.252197265625,
-0.6015625,
0.487060546875,
-1.3115234375,
-0.333251953125,
-0.376220703125,
0.56005859375,
-0.8486328125,
-0.66162109375,
-0.38232421875,
0.082763671875,
0.1182861328125,
0.379638671875,
-0.72021484375,
-0.630859375,
0.021026611328125,
-0.322998046875,
-0.297119140625,
-0.0303192138671875,
-0.69580078125,
0.09405517578125,
-0.132080078125,
0.833984375,
-0.1461181640625,
-0.0894775390625,
-0.135498046875,
0.0966796875,
-0.407958984375,
-0.8955078125,
0.55615234375,
0.388427734375,
-0.10614013671875,
0.09063720703125,
-0.4052734375,
-0.207763671875,
0.24169921875,
-0.21923828125,
0.0227508544921875,
-0.1680908203125,
-0.8125,
0.034271240234375,
0.64208984375,
-0.23388671875,
-0.281494140625,
-0.451904296875,
-0.333740234375,
0.2423095703125,
-0.1961669921875,
-0.490478515625,
0.342041015625,
0.451171875,
0.77587890625,
-0.01239776611328125,
0.4091796875,
-0.47314453125,
-0.8818359375,
-0.63525390625,
0.63134765625,
0.2020263671875,
-0.261962890625,
-0.06585693359375,
0.6025390625,
-0.34423828125,
0.07147216796875,
0.44140625,
0.471435546875,
-0.39208984375,
0.433349609375,
0.128662109375,
0.132080078125,
0.900390625,
1.4365234375,
-0.5146484375,
0.88916015625,
-0.82861328125,
-0.09576416015625,
-0.077880859375,
0.29736328125,
0.1910400390625,
-0.321533203125,
-0.38720703125,
-0.159912109375,
0.21533203125,
0.1468505859375,
-0.493896484375,
0.90576171875,
-0.29345703125,
0.1405029296875,
-0.66845703125,
0.288818359375,
0.322265625,
0.261962890625,
0.60302734375,
-0.52880859375,
-0.1182861328125,
-0.88330078125,
-0.404541015625,
1.04296875,
-0.52978515625,
-0.017120361328125,
0.67529296875,
-0.1395263671875,
-0.12371826171875,
0.173583984375,
-0.0792236328125,
0.66943359375,
-0.08111572265625,
0.57275390625,
0.85302734375,
-0.6162109375,
0.314208984375,
-0.24169921875,
-0.259033203125,
1.25,
0.458984375,
0.619140625,
0.9482421875,
0.36962890625,
-0.7890625,
0.19873046875,
-0.810546875,
0.6044921875,
-0.0360107421875,
0.59228515625,
-0.24462890625,
0.114013671875,
-0.125732421875,
0.280029296875,
-0.0460205078125,
0.242919921875,
-0.10888671875,
0.2474365234375,
-0.1990966796875,
1.2763671875,
-0.13818359375,
0.78662109375,
-0.31884765625,
-0.4697265625,
-0.353515625,
-0.62548828125,
0.5283203125,
-0.2037353515625,
-0.2025146484375,
1.0029296875,
0.218017578125,
1.16015625,
0.88525390625,
-0.027679443359375,
0.1458740234375,
0.47705078125,
-0.07257080078125,
0.13427734375,
0.488525390625,
1.2607421875,
0.51611328125,
0.64990234375,
0.39013671875,
-0.2254638671875,
-0.57666015625,
-0.86669921875,
0.083984375,
1,
-0.490234375,
0.377685546875,
0.39013671875,
-0.0750732421875,
-0.3642578125,
-0.325927734375,
0.006130218505859375,
-1.2626953125,
-0.556640625,
0.483154296875,
-0.40283203125,
0.497314453125,
-0.192138671875,
-0.3642578125,
0.2298583984375,
1.2822265625,
-0.52294921875,
-0.3212890625,
0.4833984375,
-0.15283203125,
-0.2344970703125,
0.2484130859375,
0.07568359375,
-0.2178955078125,
-0.89404296875,
0.86376953125,
-0.32080078125,
-0.3388671875,
0.032989501953125,
0.85888671875,
0.357666015625,
0.490478515625,
-0.546875,
-0.28076171875,
0.043060302734375,
1.375,
0.11737060546875,
0.11553955078125,
0.0031566619873046875,
0.8466796875,
0.380126953125,
0.853515625,
1.0595703125,
0.2293701171875,
0.72900390625,
0.703125,
-0.060302734375,
0.451416015625,
-0.034332275390625,
0.6513671875,
0.59765625,
0.278076171875,
0.11578369140625,
0.430419921875,
0.262451171875,
0.32080078125,
-0.01214599609375,
0.57763671875,
-0.5419921875,
0.53564453125,
0.42919921875,
0.30859375,
-0.55419921875,
-0.30419921875,
0.5458984375,
1.146484375,
-0.85205078125,
-0.288330078125,
-0.4140625,
0.181640625,
0.1865234375,
-0.0440673828125,
0.47021484375,
0.67041015625,
0.267333984375,
0.327880859375,
-0.210693359375,
-0.337158203125,
-1.0537109375,
-0.57958984375,
-1.392578125,
-0.35107421875,
-0.54833984375,
-0.10076904296875,
0.302978515625,
-0.83544921875,
0.5263671875,
-0.2347412109375,
-0.53564453125,
0.046142578125,
-0.69873046875,
0.68017578125,
-0.16015625,
0.83056640625,
-0.89599609375,
0.453125,
0.1441650390625,
1.15234375,
-0.83935546875,
-0.2406005859375,
0.1910400390625,
-0.80859375,
0.16796875,
0.09759521484375,
0.327880859375,
0.0865478515625,
-0.83935546875,
-0.841796875,
-0.1402587890625,
0.16845703125,
0.02752685546875,
0.41552734375,
-0.37548828125,
0.982421875,
0.448974609375,
-0.4921875,
0.41943359375,
0.35009765625,
-0.9892578125,
0.68408203125,
0.11077880859375,
0.08343505859375,
-0.83056640625,
1.23046875,
0.501953125,
0.28955078125,
-0.45703125,
-0.18017578125,
-0.521484375,
0.0074615478515625,
0.13525390625,
-0.62158203125,
-0.5849609375,
0.381103515625,
0.48046875,
-0.927734375,
0.4609375,
-0.81640625,
-0.60693359375,
-0.2403564453125,
-0.268798828125,
1.0400390625,
0.51904296875,
0.06292724609375,
-0.1917724609375,
-0.38818359375,
-0.394775390625,
0.3173828125,
0.36181640625,
-0.4638671875,
-0.178955078125,
0.92822265625,
-0.346923828125,
-0.0693359375,
0.00641632080078125,
-0.1324462890625,
-0.07415771484375,
-0.1405029296875,
0.242431640625,
0.427734375,
0.296142578125,
-0.059539794921875,
0.2568359375,
1.1455078125,
-0.716796875,
-0.381103515625,
-0.051727294921875,
0.46923828125,
0.22607421875,
0.37890625,
0.5556640625,
-0.445556640625,
-0.44384765625,
-1.037109375,
0.3759765625,
0.26123046875,
0.59521484375,
-0.62353515625,
0.52197265625,
0.70751953125,
-0.69287109375,
0.402099609375,
-0.412353515625,
-0.11004638671875,
0.89697265625,
0.361328125,
0.8818359375,
-0.7001953125,
-0.018829345703125,
-0.2088623046875,
0.16162109375,
0.6630859375,
0.09906005859375,
0.94384765625,
-0.39404296875,
-0.474609375,
-0.397705078125,
-0.81494140625,
0.1292724609375,
-0.79296875,
0.2115478515625,
-0.404296875,
-0.34326171875,
-0.77197265625,
0.238037109375,
0.44580078125,
0.348876953125,
0.1505126953125,
0.453125,
0.166259765625,
0.720703125,
0.701171875,
-0.2861328125,
-0.0224456787109375,
-0.72705078125,
1.048828125,
0.27294921875,
-0.19873046875,
-0.76318359375,
-0.177978515625,
0.058380126953125,
-0.0249786376953125,
0.209716796875,
-0.61083984375,
-0.425537109375,
0.457763671875,
-0.0163421630859375,
0.47412109375,
-0.170166015625,
-0.6357421875,
0.05242919921875,
0.75537109375,
0.09832763671875,
-0.9287109375,
0.41796875,
-0.59375,
0.56103515625,
0.70751953125,
-0.58154296875,
-0.36669921875,
-0.60595703125,
-0.7587890625,
-0.341552734375,
-0.1318359375,
0.6767578125,
-0.335205078125,
0.45458984375,
-1.0703125,
0.322998046875,
0.74853515625,
-0.2059326171875,
0.0711669921875,
-0.1829833984375,
0.282958984375,
-0.00246429443359375,
0.765625,
-0.465087890625,
-1.017578125,
0.12359619140625,
-1.173828125,
0.3505859375,
-0.88330078125,
0.31787109375,
-0.028076171875,
-0.109130859375,
-0.258056640625,
0.53564453125,
0.1700439453125,
-0.287353515625,
-0.16455078125,
0.2244873046875,
-0.88916015625,
-0.5634765625,
0.87158203125,
-0.60205078125,
-0.1728515625,
0.7421875,
-0.5419921875,
-0.372314453125,
0.212890625,
0.66552734375,
-0.306640625,
0.3291015625,
-0.39990234375,
0.457275390625,
-0.2406005859375,
-0.189208984375,
-0.085693359375,
-0.48779296875,
0.71142578125,
0.01514434814453125,
-1.00390625,
-0.12322998046875,
-1.0751953125,
-0.1536865234375,
-0.16259765625,
-0.5380859375,
0.072021484375,
0.2430419921875,
-0.39501953125,
-0.16455078125,
-0.56396484375,
-0.226318359375,
-0.501953125,
-0.60400390625,
-0.0902099609375,
0.6650390625,
0.38134765625,
0.55126953125,
0.229736328125,
-0.71728515625,
-0.047637939453125,
-0.231201171875,
-0.01085662841796875,
-0.44091796875,
-0.0082244873046875,
0.1417236328125,
-0.34423828125,
-0.1259765625,
0.1436767578125,
0.0284423828125,
0.62109375,
1.0810546875,
-0.10430908203125,
0.50927734375,
0.187744140625,
-0.53955078125,
1.1435546875,
-0.2763671875,
-0.92138671875,
-0.60791015625,
0.54931640625,
0.129638671875,
0.50439453125,
0.369140625,
-0.81494140625,
-0.87841796875,
-1.3427734375,
0.048187255859375,
-0.4677734375,
-0.16357421875,
-1.16796875,
-0.70654296875,
-0.33154296875,
0.609375,
-0.407470703125,
-1.0986328125,
0.1588134765625,
-0.7900390625,
-0.015899658203125,
-0.52490234375,
-0.060821533203125,
-1.263671875,
-0.45263671875,
-0.046478271484375,
0.5732421875,
-0.004207611083984375,
0.5439453125,
-0.31640625,
-0.27978515625,
0.01537322998046875,
-0.06109619140625,
-0.494384765625,
-0.4736328125,
-0.2257080078125,
-0.1583251953125,
-0.08673095703125,
-0.1395263671875,
-0.291748046875,
0.904296875,
-1.015625,
-0.1876220703125,
-0.376953125,
-0.452392578125,
-0.11383056640625,
-0.66162109375,
1.318359375,
0.068603515625,
-0.048828125,
-0.44580078125,
0.5791015625,
0.78759765625,
-0.4140625,
-0.473388671875,
-0.734375,
-0.1640625,
-1.1396484375,
0.623046875,
-0.50390625,
-0.223388671875,
-0.22607421875,
0.047027587890625,
0.78173828125,
-0.396728515625,
0.6220703125,
1.4599609375,
0.01152801513671875,
0.09649658203125,
-0.84228515625,
0.56689453125,
0.13330078125,
-0.433349609375,
0.189697265625,
-0.10589599609375,
-0.67578125,
-0.08056640625,
-0.159423828125,
-0.73291015625,
-0.7041015625,
0.042266845703125,
1.322265625,
-0.1258544921875,
0.58251953125,
0.3154296875,
-1.53515625,
-1.015625,
0.9931640625,
0.257080078125,
0.73876953125,
1.083984375,
0.0281524658203125,
-0.0560302734375,
-0.34130859375,
0.1312255859375,
-0.27734375,
-0.2320556640625,
1.337890625,
0.324462890625,
-0.51513671875,
0.6669921875,
0.95458984375,
-1.4697265625,
-0.6337890625,
0.32373046875,
-0.1038818359375,
-0.4521484375,
-0.6123046875,
0.3740234375,
0.6484375,
-1.0185546875,
0.189208984375,
0.44482421875,
0.05767822265625,
0.397216796875,
0.0034122467041015625,
0.6572265625,
-0.34326171875,
0.5087890625,
1.0615234375,
-0.56982421875,
-0.151611328125,
-1.1474609375,
-0.67919921875,
-0.20654296875,
0.2744140625,
0.7685546875,
-0.58837890625,
0.020660400390625,
0.69580078125,
-0.106201171875,
0.66845703125,
-0.34619140625,
-0.52783203125,
0.11749267578125,
-0.58642578125,
-0.403076171875,
0.0007319450378417969,
0.473388671875,
0.0714111328125,
0.34033203125,
-0.46728515625,
0.333984375,
0.497802734375,
0.273681640625,
-0.08441162109375,
-0.90478515625,
-0.5341796875,
-1.0546875,
-0.45458984375,
-0.71533203125,
-0.55517578125,
-0.35986328125,
-0.00948333740234375,
-0.0272369384765625,
-0.5302734375,
0.0297698974609375,
0.295166015625,
-0.1949462890625,
0.81884765625,
-0.8876953125,
0.357177734375,
-0.84228515625,
-0.572265625,
-0.73095703125,
-0.01456451416015625,
-0.304931640625,
0.198974609375,
-1.0947265625,
0.43994140625,
-0.12274169921875,
0.84228515625,
-0.036651611328125,
0.32275390625,
-0.1866455078125,
-0.63525390625,
0.258056640625,
0.31103515625,
-0.1982421875,
0.6796875,
0.46826171875,
-0.0264434814453125,
0.1474609375,
-0.052459716796875,
-0.1845703125,
-0.402587890625,
0.344482421875,
0.7978515625,
-0.27294921875,
-0.1077880859375,
-0.43408203125,
-0.01398468017578125,
-0.951171875,
0.556640625,
-0.1112060546875,
-0.147216796875,
0.5341796875,
-0.213134765625,
0.5029296875,
1.208984375,
0.07427978515625,
0.2144775390625,
-0.046142578125,
0.52880859375,
0.3701171875,
-0.05352783203125,
0.39208984375,
0.427001953125,
0.0256805419921875,
-0.434814453125,
0.359375,
0.7509765625,
-0.377197265625,
0.32177734375,
-0.32568359375,
-0.436767578125,
-0.83251953125,
-0.330078125,
-0.541015625,
0.305419921875,
0.56689453125,
-0.56640625,
-0.06317138671875,
-0.067626953125,
-0.43017578125,
0.078369140625,
-1.25,
-0.90234375,
0.68017578125,
-0.237060546875,
-0.428955078125,
-0.199951171875,
-0.4912109375,
-0.234375,
0.2237548828125,
0.5703125,
-0.391845703125,
0.55126953125,
-0.459228515625,
0.1785888671875,
-0.272705078125,
-0.14453125,
0.1824951171875,
0.38818359375,
-0.7265625,
-0.59716796875,
0.340576171875,
1.35546875,
0.37890625,
0.1676025390625,
-0.405517578125,
0.305419921875,
0.09356689453125,
-0.175048828125,
-0.319580078125,
0.05035400390625,
-0.214111328125,
-0.06280517578125,
-0.11138916015625,
0.3740234375,
-0.75439453125,
0.4453125,
0.2125244140625,
-0.334716796875,
-0.61669921875,
0.837890625,
0.50537109375,
-0.4228515625,
0.6455078125,
0.3330078125,
0.295654296875,
0.0202484130859375,
-0.3154296875,
0.166015625,
0.69873046875,
0.7763671875,
0.82275390625,
-0.16845703125,
0.04986572265625,
1.01953125,
-0.08056640625,
-0.071533203125,
0.40869140625,
-0.0811767578125,
-0.131591796875,
-0.258056640625,
-0.257568359375,
-0.11767578125,
-0.040679931640625,
-0.73046875,
0.732421875,
-0.3662109375,
-0.312744140625,
-0.287353515625,
-0.56103515625,
0.87548828125,
-0.196533203125,
-0.0038700103759765625,
0.260009765625,
-0.5849609375,
0.314697265625,
0.73046875,
0.0811767578125,
0.058349609375,
0.796875,
0.64892578125,
0.65771484375,
0.857421875,
0.2076416015625,
0.52685546875,
-0.6123046875,
0.30078125,
0.1016845703125,
-0.058197021484375,
-0.59130859375,
-0.55810546875,
-0.8486328125,
0.28076171875,
-0.490478515625,
-0.31884765625,
0.465087890625,
-0.6025390625,
0.431640625,
-0.30859375,
0.685546875,
-0.448486328125,
0.43359375,
0.3564453125,
-0.47607421875,
-0.78466796875,
0.5166015625,
-0.138916015625,
0.427490234375,
0.2176513671875,
1.482421875,
-0.2093505859375,
1.2607421875,
0.50537109375,
-0.14990234375,
-0.398193359375,
0.162841796875,
-0.239013671875,
-0.2474365234375,
-0.26708984375,
-0.298828125,
0.37060546875,
-0.68896484375,
-0.384521484375,
0.24755859375,
0.78076171875,
0.1259765625,
-1.095703125,
-0.224365234375,
0.57861328125,
-0.84033203125,
0.382080078125,
0.1793212890625,
0.2276611328125,
0.1429443359375,
0.0038547515869140625,
-0.1378173828125,
-0.55029296875,
0.094970703125,
-0.73828125,
0.59521484375,
-0.51708984375,
-0.8720703125,
-0.818359375,
-0.68017578125,
-0.0210113525390625,
-0.061492919921875,
-0.59521484375,
-0.7548828125,
0.48193359375,
0.64599609375,
0.07550048828125,
0.005641937255859375,
-0.08709716796875,
-0.319091796875,
1.021484375,
1.0859375,
0.60400390625,
0.75732421875,
0.392578125,
-0.7470703125,
0.529296875,
-0.72314453125,
0.61181640625,
-0.234619140625,
0.001964569091796875,
-0.463623046875,
0.6455078125,
-0.7421875,
-1.2294921875,
0.30419921875,
0.51318359375,
0.69189453125,
-0.6279296875,
-1.11328125,
-0.29443359375,
-1.265625,
-0.402587890625,
-0.65234375,
0.7744140625,
-0.07574462890625,
-0.338134765625,
-0.19970703125,
-1.20703125,
4.28125,
0.962890625,
0.861328125,
0.7841796875,
-0.2103271484375,
0.59130859375,
0.70703125,
-0.444580078125,
-0.1785888671875,
-0.329345703125,
0.517578125,
-0.31982421875,
-0.054107666015625,
0.705078125,
0.66259765625,
0.371337890625,
-0.62060546875,
0.43359375,
-0.0201263427734375,
-0.72607421875,
-0.93115234375,
0.443359375,
-0.07940673828125,
0.441162109375,
0.07220458984375,
0.366943359375,
0.419921875,
-0.59033203125,
-0.250732421875,
-0.36376953125,
0.367431640625,
-0.466064453125,
0.65771484375,
-0.28515625,
-0.0567626953125,
0.0977783203125,
-0.1588134765625,
-0.5107421875,
-0.2340087890625,
0.37353515625,
-0.1807861328125,
0.062744140625,
0.736328125,
-0.5634765625,
0.021484375,
0.62109375,
-0.433349609375,
0.66845703125,
0.229248046875,
-1.15234375,
0.966796875,
-0.253662109375,
0.12744140625,
-0.83349609375,
-0.88916015625,
-0.046905517578125,
0.3037109375,
0.1268310546875,
0.241455078125,
0.4111328125,
0.4931640625,
0.64013671875,
0.436279296875,
0.332763671875,
-1.0185546875,
1.017578125,
-0.12548828125,
0.33447265625,
-0.5078125,
-0.1632080078125,
-0.515625,
-0.406005859375,
0.1717529296875,
-0.64501953125,
0.5986328125,
-0.01544952392578125,
-0.63916015625,
0.398193359375,
0.30029296875,
-0.81591796875,
0.0233154296875,
0.1815185546875,
-0.356201171875,
-0.487548828125,
0.438232421875,
1.1708984375,
-0.65380859375,
-0.468017578125,
-0.76220703125,
0.46533203125,
0.374267578125,
0.51611328125,
0.04547119140625,
-0.43994140625,
-0.1568603515625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitro et æstus, et nil admirari. Festina lente, et nulla tenaci invia est via.
Fac et spera,
Vale,
Nicolas Flamel
Input
The first line of input contains several space-separated integers ai (0 ≤ ai ≤ 100).
Output
Print a single integer.
Examples
Input
2 4 6 8 10
Output
1
Tags: *special
Correct Solution:
```
import sys
a = list(map(int, sys.stdin.readline().split()))
d = [1, 1, 2, 7, 4]
ans = a[0]
for i in range(5):
ans = min(ans, a[i] // d[i])
print(ans)
```
| 45,731
|
[
0.00901031494140625,
-0.06256103515625,
0.41015625,
0.2178955078125,
-0.630859375,
-0.76513671875,
0.032867431640625,
-0.10699462890625,
0.400390625,
0.60986328125,
0.5556640625,
-0.10797119140625,
-0.0163726806640625,
-0.55029296875,
-0.4560546875,
-0.2376708984375,
-0.34375,
-0.98779296875,
-0.69580078125,
-0.33740234375,
0.09112548828125,
-0.04144287109375,
-1.4267578125,
-0.252685546875,
-0.498779296875,
0.888671875,
0.54833984375,
0.44677734375,
0.80419921875,
1.2099609375,
-0.29541015625,
-0.59375,
0.48193359375,
-1.3046875,
-0.378173828125,
-0.4267578125,
0.50732421875,
-0.91455078125,
-0.666015625,
-0.37939453125,
0.08319091796875,
0.1759033203125,
0.38916015625,
-0.76025390625,
-0.63134765625,
0.0955810546875,
-0.31396484375,
-0.30419921875,
-0.09759521484375,
-0.640625,
0.181396484375,
-0.06494140625,
0.7626953125,
-0.231201171875,
-0.1680908203125,
-0.123779296875,
0.06915283203125,
-0.42431640625,
-0.8798828125,
0.47021484375,
0.385986328125,
-0.0712890625,
0.0980224609375,
-0.2666015625,
-0.14892578125,
0.306396484375,
-0.296630859375,
-0.00812530517578125,
-0.1910400390625,
-0.7724609375,
-0.038482666015625,
0.6796875,
-0.21240234375,
-0.369140625,
-0.49560546875,
-0.27978515625,
0.2210693359375,
-0.1844482421875,
-0.49755859375,
0.32568359375,
0.337158203125,
0.83642578125,
0.026641845703125,
0.453369140625,
-0.53564453125,
-0.88818359375,
-0.6650390625,
0.5166015625,
0.1346435546875,
-0.2291259765625,
-0.0014753341674804688,
0.68408203125,
-0.342529296875,
0.03363037109375,
0.41162109375,
0.51123046875,
-0.388671875,
0.3310546875,
0.1107177734375,
0.13720703125,
0.79296875,
1.46875,
-0.499755859375,
0.8642578125,
-0.80322265625,
-0.06500244140625,
-0.02117919921875,
0.40380859375,
0.2095947265625,
-0.2310791015625,
-0.316162109375,
-0.2105712890625,
0.2332763671875,
0.208251953125,
-0.47412109375,
0.92919921875,
-0.20703125,
0.1427001953125,
-0.60400390625,
0.34716796875,
0.2822265625,
0.22607421875,
0.6806640625,
-0.576171875,
-0.039398193359375,
-0.84619140625,
-0.3876953125,
1.0244140625,
-0.5546875,
-0.0648193359375,
0.6630859375,
-0.10040283203125,
-0.21337890625,
0.2098388671875,
-0.034515380859375,
0.65234375,
-0.0675048828125,
0.53466796875,
0.84375,
-0.6123046875,
0.30517578125,
-0.306396484375,
-0.2054443359375,
1.3203125,
0.44677734375,
0.5205078125,
1.009765625,
0.40234375,
-0.796875,
0.115966796875,
-0.9052734375,
0.5849609375,
-0.01062774658203125,
0.58837890625,
-0.1416015625,
0.0999755859375,
-0.1341552734375,
0.328857421875,
-0.1077880859375,
0.279052734375,
-0.184326171875,
0.25439453125,
-0.07867431640625,
1.3212890625,
-0.1348876953125,
0.7587890625,
-0.29345703125,
-0.55224609375,
-0.347900390625,
-0.5419921875,
0.6650390625,
-0.181396484375,
-0.2154541015625,
0.95068359375,
0.221923828125,
1.0947265625,
0.978515625,
-0.050537109375,
0.09844970703125,
0.5478515625,
-0.1658935546875,
0.14306640625,
0.5458984375,
1.2197265625,
0.560546875,
0.6708984375,
0.47802734375,
-0.21337890625,
-0.7001953125,
-0.95068359375,
0.12493896484375,
0.9560546875,
-0.47119140625,
0.297119140625,
0.395751953125,
0.037078857421875,
-0.482666015625,
-0.3583984375,
-0.0199127197265625,
-1.2451171875,
-0.56005859375,
0.44580078125,
-0.477294921875,
0.369140625,
-0.2010498046875,
-0.3173828125,
0.26416015625,
1.3037109375,
-0.455078125,
-0.294189453125,
0.485107421875,
-0.2423095703125,
-0.314208984375,
0.25830078125,
0.1353759765625,
-0.2391357421875,
-0.9296875,
0.8583984375,
-0.32275390625,
-0.320068359375,
0.08282470703125,
0.9189453125,
0.3818359375,
0.472900390625,
-0.5087890625,
-0.300537109375,
-0.0430908203125,
1.3447265625,
0.1346435546875,
0.05841064453125,
-0.036102294921875,
0.9013671875,
0.33984375,
0.8720703125,
0.984375,
0.1551513671875,
0.76171875,
0.73681640625,
-0.0335693359375,
0.46923828125,
-0.1375732421875,
0.70751953125,
0.487548828125,
0.28125,
0.03985595703125,
0.404052734375,
0.2203369140625,
0.252685546875,
-0.042083740234375,
0.51953125,
-0.57666015625,
0.51025390625,
0.34814453125,
0.271240234375,
-0.5625,
-0.336669921875,
0.5029296875,
1.1650390625,
-0.94482421875,
-0.2374267578125,
-0.29833984375,
0.146484375,
0.228271484375,
-0.0640869140625,
0.42724609375,
0.66162109375,
0.19482421875,
0.256591796875,
-0.2325439453125,
-0.2998046875,
-1.068359375,
-0.58203125,
-1.34765625,
-0.343994140625,
-0.5341796875,
-0.1207275390625,
0.232177734375,
-0.8486328125,
0.4990234375,
-0.23486328125,
-0.44580078125,
0.12261962890625,
-0.61474609375,
0.63525390625,
-0.1844482421875,
0.7578125,
-0.94384765625,
0.5302734375,
0.1710205078125,
1.2880859375,
-0.76953125,
-0.207275390625,
0.1766357421875,
-0.8125,
0.2001953125,
0.050811767578125,
0.30712890625,
0.00556182861328125,
-0.77685546875,
-0.8447265625,
-0.173583984375,
0.1939697265625,
0.03253173828125,
0.45263671875,
-0.314697265625,
1.021484375,
0.45361328125,
-0.53369140625,
0.38330078125,
0.359130859375,
-0.93994140625,
0.59814453125,
0.11614990234375,
0.0826416015625,
-0.869140625,
1.3466796875,
0.462890625,
0.2069091796875,
-0.51025390625,
-0.26806640625,
-0.58447265625,
0.073974609375,
0.11883544921875,
-0.64404296875,
-0.564453125,
0.435546875,
0.48876953125,
-0.90771484375,
0.465087890625,
-0.88720703125,
-0.54736328125,
-0.1763916015625,
-0.283203125,
1.0849609375,
0.52001953125,
0.09844970703125,
-0.306640625,
-0.37744140625,
-0.353271484375,
0.382568359375,
0.370849609375,
-0.43310546875,
-0.1365966796875,
0.95556640625,
-0.32958984375,
-0.09930419921875,
-0.0203704833984375,
-0.197998046875,
0.046661376953125,
-0.14111328125,
0.2071533203125,
0.356201171875,
0.279296875,
-0.02142333984375,
0.353759765625,
1.0546875,
-0.76513671875,
-0.40966796875,
-0.0276947021484375,
0.48974609375,
0.279541015625,
0.3212890625,
0.49951171875,
-0.3818359375,
-0.398193359375,
-1.0869140625,
0.2705078125,
0.226806640625,
0.63671875,
-0.63037109375,
0.490234375,
0.59619140625,
-0.61962890625,
0.474609375,
-0.4658203125,
-0.108154296875,
0.9140625,
0.37841796875,
0.92626953125,
-0.69775390625,
0.005218505859375,
-0.181640625,
0.2451171875,
0.70458984375,
0.000057697296142578125,
0.9482421875,
-0.3544921875,
-0.4013671875,
-0.471435546875,
-0.8740234375,
0.180419921875,
-0.708984375,
0.3056640625,
-0.363037109375,
-0.324462890625,
-0.8232421875,
0.1685791015625,
0.5771484375,
0.33837890625,
0.201416015625,
0.5048828125,
0.0943603515625,
0.80322265625,
0.71875,
-0.2352294921875,
0.012786865234375,
-0.69873046875,
1.046875,
0.219970703125,
-0.09368896484375,
-0.8212890625,
-0.20166015625,
0.1444091796875,
0.0279998779296875,
0.1578369140625,
-0.646484375,
-0.37060546875,
0.345458984375,
-0.0104522705078125,
0.4013671875,
-0.29248046875,
-0.56298828125,
-0.06695556640625,
0.7763671875,
0.05316162109375,
-0.9765625,
0.376708984375,
-0.6201171875,
0.55908203125,
0.6640625,
-0.5556640625,
-0.351806640625,
-0.6591796875,
-0.6455078125,
-0.3076171875,
-0.1917724609375,
0.63720703125,
-0.316162109375,
0.47265625,
-1.068359375,
0.26220703125,
0.634765625,
-0.15283203125,
0.09356689453125,
-0.196044921875,
0.252197265625,
0.075927734375,
0.703125,
-0.423828125,
-0.99853515625,
0.1038818359375,
-1.2568359375,
0.34619140625,
-0.9296875,
0.25927734375,
-0.030029296875,
-0.03436279296875,
-0.37744140625,
0.513671875,
0.1561279296875,
-0.251708984375,
-0.0758056640625,
0.243408203125,
-0.90771484375,
-0.61376953125,
0.9658203125,
-0.66796875,
-0.2047119140625,
0.7607421875,
-0.56396484375,
-0.34765625,
0.220947265625,
0.7060546875,
-0.1964111328125,
0.321044921875,
-0.57177734375,
0.431884765625,
-0.1483154296875,
-0.26416015625,
-0.298583984375,
-0.5068359375,
0.77392578125,
0.0860595703125,
-0.96044921875,
-0.058807373046875,
-1.07421875,
-0.205078125,
-0.05633544921875,
-0.495361328125,
0.0848388671875,
0.21142578125,
-0.41650390625,
-0.1583251953125,
-0.55029296875,
-0.153076171875,
-0.4560546875,
-0.5546875,
-0.08868408203125,
0.65966796875,
0.341552734375,
0.6552734375,
0.2174072265625,
-0.7314453125,
-0.03668212890625,
-0.180908203125,
-0.052947998046875,
-0.493896484375,
-0.00919342041015625,
0.149658203125,
-0.282470703125,
-0.1533203125,
0.07537841796875,
0.0662841796875,
0.7158203125,
1.04296875,
-0.005901336669921875,
0.486572265625,
0.298828125,
-0.53076171875,
1.1435546875,
-0.15869140625,
-0.92333984375,
-0.6494140625,
0.5234375,
0.088623046875,
0.5,
0.401123046875,
-0.8359375,
-0.73779296875,
-1.2919921875,
0.09295654296875,
-0.457763671875,
-0.068359375,
-1.154296875,
-0.5458984375,
-0.338134765625,
0.5673828125,
-0.359130859375,
-1.0634765625,
-0.01154327392578125,
-0.83935546875,
0.028839111328125,
-0.57080078125,
0.03497314453125,
-1.1826171875,
-0.619140625,
-0.040802001953125,
0.61474609375,
-0.00568389892578125,
0.5400390625,
-0.2587890625,
-0.1976318359375,
0.05792236328125,
-0.147216796875,
-0.479736328125,
-0.458251953125,
-0.18603515625,
-0.08306884765625,
-0.09368896484375,
-0.197021484375,
-0.381103515625,
0.84521484375,
-1.0029296875,
-0.150634765625,
-0.32958984375,
-0.479736328125,
-0.00881195068359375,
-0.5849609375,
1.291015625,
-0.03826904296875,
-0.08477783203125,
-0.43408203125,
0.6474609375,
0.78515625,
-0.339111328125,
-0.5927734375,
-0.74365234375,
-0.09967041015625,
-1.140625,
0.5234375,
-0.59375,
-0.277587890625,
-0.180419921875,
0.06878662109375,
0.82470703125,
-0.45751953125,
0.650390625,
1.447265625,
0.01172637939453125,
-0.006866455078125,
-0.80517578125,
0.59033203125,
0.1845703125,
-0.480224609375,
0.18212890625,
-0.01454925537109375,
-0.75439453125,
-0.057373046875,
-0.116455078125,
-0.7138671875,
-0.646484375,
-0.121826171875,
1.4853515625,
-0.0889892578125,
0.58984375,
0.301025390625,
-1.4619140625,
-0.84716796875,
1.048828125,
0.203125,
0.79541015625,
1.056640625,
-0.0460205078125,
-0.1224365234375,
-0.375244140625,
0.1151123046875,
-0.2279052734375,
-0.237060546875,
1.3154296875,
0.2462158203125,
-0.49267578125,
0.642578125,
0.94287109375,
-1.46484375,
-0.66162109375,
0.326171875,
-0.11846923828125,
-0.421142578125,
-0.5498046875,
0.3525390625,
0.66015625,
-0.97412109375,
0.1583251953125,
0.5361328125,
0.11126708984375,
0.489990234375,
-0.0139312744140625,
0.5419921875,
-0.319091796875,
0.646484375,
1.0234375,
-0.53369140625,
-0.1568603515625,
-1.18359375,
-0.611328125,
-0.330078125,
0.14013671875,
0.8173828125,
-0.615234375,
0.0308685302734375,
0.66064453125,
-0.00045609474182128906,
0.69287109375,
-0.319091796875,
-0.59814453125,
0.09930419921875,
-0.53076171875,
-0.481689453125,
0.041961669921875,
0.441650390625,
0.1287841796875,
0.291015625,
-0.43359375,
0.38720703125,
0.52001953125,
0.27197265625,
-0.1422119140625,
-0.97705078125,
-0.56494140625,
-0.9853515625,
-0.383056640625,
-0.58740234375,
-0.6552734375,
-0.384765625,
0.0005340576171875,
-0.01007080078125,
-0.45166015625,
-0.10858154296875,
0.2548828125,
-0.158203125,
0.7314453125,
-0.94677734375,
0.38330078125,
-0.828125,
-0.54345703125,
-0.7041015625,
-0.0213165283203125,
-0.371337890625,
0.1392822265625,
-1.1025390625,
0.328857421875,
-0.1519775390625,
0.85205078125,
0.0029754638671875,
0.3779296875,
-0.2093505859375,
-0.611328125,
0.34716796875,
0.253662109375,
-0.247314453125,
0.7890625,
0.5068359375,
-0.0830078125,
0.1868896484375,
0.00308990478515625,
-0.145263671875,
-0.40625,
0.333984375,
0.82763671875,
-0.291259765625,
-0.1192626953125,
-0.433837890625,
0.001125335693359375,
-0.9794921875,
0.58544921875,
-0.0986328125,
-0.1627197265625,
0.52978515625,
-0.2039794921875,
0.50146484375,
1.1904296875,
0.177490234375,
0.14697265625,
-0.034515380859375,
0.49755859375,
0.390869140625,
-0.02734375,
0.424560546875,
0.4853515625,
0.0002065896987915039,
-0.353759765625,
0.38232421875,
0.7255859375,
-0.327880859375,
0.3076171875,
-0.34716796875,
-0.43798828125,
-0.86376953125,
-0.319580078125,
-0.56396484375,
0.311279296875,
0.546875,
-0.53369140625,
-0.05889892578125,
-0.065185546875,
-0.376708984375,
0.08819580078125,
-1.197265625,
-0.8671875,
0.6767578125,
-0.278076171875,
-0.5234375,
-0.362060546875,
-0.48046875,
-0.26513671875,
0.07794189453125,
0.56884765625,
-0.3671875,
0.58544921875,
-0.51171875,
0.1068115234375,
-0.303466796875,
-0.1864013671875,
0.143310546875,
0.30322265625,
-0.70361328125,
-0.4931640625,
0.46044921875,
1.2685546875,
0.40478515625,
0.1883544921875,
-0.469970703125,
0.32275390625,
0.126953125,
-0.255859375,
-0.45166015625,
0.046630859375,
-0.272705078125,
-0.11285400390625,
-0.1744384765625,
0.391357421875,
-0.728515625,
0.5205078125,
0.18994140625,
-0.3701171875,
-0.6162109375,
0.73681640625,
0.487548828125,
-0.392333984375,
0.59228515625,
0.391845703125,
0.307373046875,
0.07598876953125,
-0.365234375,
0.1912841796875,
0.54931640625,
0.767578125,
0.81884765625,
-0.22802734375,
0.102294921875,
0.99951171875,
-0.07757568359375,
-0.1875,
0.383056640625,
-0.0731201171875,
-0.1251220703125,
-0.231201171875,
-0.286376953125,
-0.133544921875,
0.039520263671875,
-0.72265625,
0.87890625,
-0.40625,
-0.3056640625,
-0.268310546875,
-0.478515625,
0.8662109375,
-0.259765625,
-0.0904541015625,
0.291015625,
-0.587890625,
0.397216796875,
0.67529296875,
0.12030029296875,
-0.06341552734375,
0.7998046875,
0.6357421875,
0.6474609375,
0.814453125,
0.2340087890625,
0.476806640625,
-0.63427734375,
0.30322265625,
0.01554107666015625,
0.055816650390625,
-0.5263671875,
-0.464111328125,
-0.9091796875,
0.266845703125,
-0.51025390625,
-0.2379150390625,
0.5302734375,
-0.60595703125,
0.5146484375,
-0.30419921875,
0.72119140625,
-0.4306640625,
0.352294921875,
0.331298828125,
-0.5498046875,
-0.83447265625,
0.501953125,
-0.0755615234375,
0.37353515625,
0.285400390625,
1.4775390625,
-0.1832275390625,
1.2216796875,
0.4658203125,
-0.08612060546875,
-0.38525390625,
0.2100830078125,
-0.263671875,
-0.2235107421875,
-0.252685546875,
-0.2100830078125,
0.3818359375,
-0.63671875,
-0.313232421875,
0.3271484375,
0.7080078125,
0.2227783203125,
-0.94091796875,
-0.21142578125,
0.50927734375,
-0.80078125,
0.468017578125,
0.11773681640625,
0.1988525390625,
0.07159423828125,
-0.0040130615234375,
-0.2122802734375,
-0.6201171875,
0.140869140625,
-0.763671875,
0.63671875,
-0.52880859375,
-0.787109375,
-0.71728515625,
-0.67138671875,
-0.1083984375,
-0.01035308837890625,
-0.55224609375,
-0.728515625,
0.477783203125,
0.6728515625,
0.11083984375,
0.06280517578125,
-0.01036834716796875,
-0.326904296875,
0.970703125,
1.052734375,
0.603515625,
0.77197265625,
0.32080078125,
-0.8173828125,
0.57666015625,
-0.65966796875,
0.58056640625,
-0.29443359375,
-0.143798828125,
-0.44482421875,
0.5478515625,
-0.74365234375,
-1.2705078125,
0.369384765625,
0.467529296875,
0.66162109375,
-0.59228515625,
-1.0888671875,
-0.2462158203125,
-1.3017578125,
-0.34521484375,
-0.68115234375,
0.72412109375,
-0.1458740234375,
-0.2587890625,
-0.181884765625,
-1.177734375,
4.28515625,
0.90185546875,
0.9453125,
0.66650390625,
-0.23828125,
0.56201171875,
0.6064453125,
-0.403564453125,
-0.1883544921875,
-0.423828125,
0.51025390625,
-0.405029296875,
-0.1236572265625,
0.74853515625,
0.66162109375,
0.35791015625,
-0.68359375,
0.433837890625,
-0.034393310546875,
-0.71142578125,
-0.96337890625,
0.44140625,
-0.1717529296875,
0.432861328125,
0.1251220703125,
0.2210693359375,
0.467041015625,
-0.59814453125,
-0.1707763671875,
-0.3359375,
0.401123046875,
-0.414794921875,
0.67529296875,
-0.28125,
-0.04339599609375,
0.0180511474609375,
-0.1781005859375,
-0.48779296875,
-0.251708984375,
0.41845703125,
-0.2177734375,
0.032073974609375,
0.7333984375,
-0.61376953125,
-0.01129913330078125,
0.6171875,
-0.4658203125,
0.63330078125,
0.266357421875,
-1.0869140625,
1.0595703125,
-0.3017578125,
0.09503173828125,
-0.966796875,
-0.833984375,
-0.06475830078125,
0.380615234375,
0.133544921875,
0.2359619140625,
0.3349609375,
0.5068359375,
0.6767578125,
0.437744140625,
0.346435546875,
-0.92919921875,
1.09375,
-0.0391845703125,
0.436279296875,
-0.43603515625,
-0.1748046875,
-0.53857421875,
-0.384033203125,
0.079345703125,
-0.56884765625,
0.603515625,
-0.0670166015625,
-0.59033203125,
0.4306640625,
0.308837890625,
-0.8291015625,
0.0237274169921875,
0.188232421875,
-0.41357421875,
-0.48291015625,
0.4951171875,
1.22265625,
-0.58740234375,
-0.418212890625,
-0.7587890625,
0.406494140625,
0.30615234375,
0.5126953125,
0.12371826171875,
-0.326904296875,
-0.176513671875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitro et æstus, et nil admirari. Festina lente, et nulla tenaci invia est via.
Fac et spera,
Vale,
Nicolas Flamel
Input
The first line of input contains several space-separated integers ai (0 ≤ ai ≤ 100).
Output
Print a single integer.
Examples
Input
2 4 6 8 10
Output
1
Tags: *special
Correct Solution:
```
s = list(map(int, input().split()))
rp = [1, 1, 2, 7, 4]
print(min([s[i] // rp[i] for i in range(5)]))
```
| 45,732
|
[
0.0265350341796875,
-0.06591796875,
0.35595703125,
0.267578125,
-0.52587890625,
-0.87890625,
0.0064239501953125,
-0.1275634765625,
0.3505859375,
0.59326171875,
0.63916015625,
0.0208892822265625,
0.02685546875,
-0.60791015625,
-0.3984375,
-0.2178955078125,
-0.37744140625,
-0.9599609375,
-0.5615234375,
-0.2191162109375,
-0.09796142578125,
-0.029510498046875,
-1.3798828125,
-0.2413330078125,
-0.50439453125,
0.9267578125,
0.55078125,
0.359375,
0.81201171875,
1.15625,
-0.30126953125,
-0.5986328125,
0.5498046875,
-1.2392578125,
-0.38818359375,
-0.388916015625,
0.5078125,
-0.79150390625,
-0.7529296875,
-0.349853515625,
0.116943359375,
0.1177978515625,
0.4208984375,
-0.71435546875,
-0.6591796875,
0.096923828125,
-0.253173828125,
-0.28369140625,
-0.11846923828125,
-0.73486328125,
0.1229248046875,
-0.0289154052734375,
0.759765625,
-0.18505859375,
-0.1876220703125,
-0.1973876953125,
0.084716796875,
-0.365234375,
-0.84912109375,
0.5927734375,
0.307861328125,
-0.1361083984375,
0.017364501953125,
-0.3544921875,
-0.236083984375,
0.277587890625,
-0.278076171875,
0.00569915771484375,
-0.1151123046875,
-0.87353515625,
0.01137542724609375,
0.6767578125,
-0.29541015625,
-0.398193359375,
-0.463623046875,
-0.2286376953125,
0.14599609375,
-0.2005615234375,
-0.4560546875,
0.33056640625,
0.41943359375,
0.82080078125,
0.0221099853515625,
0.454833984375,
-0.5537109375,
-0.86767578125,
-0.6474609375,
0.650390625,
0.298095703125,
-0.2178955078125,
-0.08001708984375,
0.673828125,
-0.296142578125,
0.058990478515625,
0.387451171875,
0.5068359375,
-0.362548828125,
0.351318359375,
0.132080078125,
0.203369140625,
1.0234375,
1.5322265625,
-0.546875,
0.84423828125,
-0.90673828125,
-0.1724853515625,
-0.0531005859375,
0.421875,
0.110595703125,
-0.276123046875,
-0.483154296875,
-0.1822509765625,
0.1275634765625,
0.09808349609375,
-0.48291015625,
0.91943359375,
-0.2344970703125,
0.135009765625,
-0.55322265625,
0.26953125,
0.350830078125,
0.2259521484375,
0.609375,
-0.515625,
-0.00835418701171875,
-0.81787109375,
-0.39697265625,
1.111328125,
-0.55859375,
0.047515869140625,
0.73046875,
-0.06842041015625,
-0.058807373046875,
0.1705322265625,
-0.053955078125,
0.65576171875,
-0.2020263671875,
0.626953125,
0.85546875,
-0.57568359375,
0.257080078125,
-0.27197265625,
-0.26171875,
1.2685546875,
0.4150390625,
0.537109375,
0.9580078125,
0.2978515625,
-0.84326171875,
0.1162109375,
-0.78759765625,
0.5966796875,
-0.02301025390625,
0.63427734375,
-0.1988525390625,
0.07110595703125,
-0.134033203125,
0.322509765625,
-0.12359619140625,
0.27001953125,
-0.167236328125,
0.19921875,
-0.2174072265625,
1.375,
-0.144287109375,
0.82275390625,
-0.3916015625,
-0.56494140625,
-0.49462890625,
-0.64599609375,
0.59375,
-0.135009765625,
-0.1624755859375,
0.95458984375,
0.2430419921875,
1.1279296875,
0.9150390625,
0.06988525390625,
0.1793212890625,
0.5087890625,
-0.02471923828125,
0.148681640625,
0.466552734375,
1.1298828125,
0.40576171875,
0.58837890625,
0.460205078125,
-0.1837158203125,
-0.63427734375,
-0.88134765625,
0.121826171875,
0.837890625,
-0.49462890625,
0.333984375,
0.4404296875,
0.0052490234375,
-0.4970703125,
-0.341796875,
-0.0860595703125,
-1.310546875,
-0.53515625,
0.419921875,
-0.414306640625,
0.4658203125,
-0.188232421875,
-0.35791015625,
0.1822509765625,
1.2685546875,
-0.56787109375,
-0.286865234375,
0.48974609375,
-0.085205078125,
-0.227783203125,
0.1666259765625,
0.085693359375,
-0.18310546875,
-0.943359375,
0.8779296875,
-0.310791015625,
-0.366943359375,
0.07806396484375,
0.88720703125,
0.429931640625,
0.5390625,
-0.61767578125,
-0.311767578125,
0.0246124267578125,
1.40234375,
0.09564208984375,
0.12445068359375,
-0.005756378173828125,
0.87890625,
0.372802734375,
0.89111328125,
1.0478515625,
0.236572265625,
0.7119140625,
0.75146484375,
0.060333251953125,
0.372314453125,
-0.042144775390625,
0.62939453125,
0.6171875,
0.1490478515625,
0.01561737060546875,
0.446044921875,
0.20751953125,
0.23828125,
-0.01110076904296875,
0.6279296875,
-0.497802734375,
0.5068359375,
0.40771484375,
0.24609375,
-0.5576171875,
-0.2919921875,
0.445068359375,
1.185546875,
-0.8623046875,
-0.1785888671875,
-0.260009765625,
0.2459716796875,
0.179443359375,
-0.027801513671875,
0.54150390625,
0.71728515625,
0.336181640625,
0.3427734375,
-0.23974609375,
-0.414306640625,
-1.0595703125,
-0.576171875,
-1.333984375,
-0.331787109375,
-0.5107421875,
-0.06597900390625,
0.350830078125,
-0.826171875,
0.509765625,
-0.2210693359375,
-0.4287109375,
0.0755615234375,
-0.65869140625,
0.58642578125,
-0.1387939453125,
0.814453125,
-0.8994140625,
0.5244140625,
0.1461181640625,
1.146484375,
-0.7939453125,
-0.198974609375,
0.213134765625,
-0.7216796875,
0.061187744140625,
0.092041015625,
0.364990234375,
0.00302886962890625,
-0.7724609375,
-0.89208984375,
-0.09600830078125,
0.27392578125,
0.0266876220703125,
0.349365234375,
-0.396484375,
1.0419921875,
0.49951171875,
-0.443115234375,
0.408203125,
0.370849609375,
-0.9912109375,
0.638671875,
0.148193359375,
0.09466552734375,
-0.87255859375,
1.2177734375,
0.50634765625,
0.239501953125,
-0.51123046875,
-0.31591796875,
-0.55419921875,
0.0523681640625,
0.213134765625,
-0.63525390625,
-0.625,
0.46923828125,
0.5029296875,
-0.93603515625,
0.50927734375,
-0.88720703125,
-0.57275390625,
-0.10986328125,
-0.265380859375,
1.021484375,
0.61669921875,
0.08465576171875,
-0.232666015625,
-0.47021484375,
-0.38916015625,
0.36865234375,
0.31005859375,
-0.425537109375,
-0.209716796875,
0.8828125,
-0.39697265625,
-0.062408447265625,
-0.052978515625,
-0.06304931640625,
-0.03656005859375,
-0.08203125,
0.27490234375,
0.41552734375,
0.296630859375,
-0.0819091796875,
0.2362060546875,
1.09375,
-0.73828125,
-0.3359375,
0.01180267333984375,
0.54296875,
0.208984375,
0.38671875,
0.455810546875,
-0.423095703125,
-0.449951171875,
-1.0712890625,
0.31640625,
0.301025390625,
0.5634765625,
-0.6943359375,
0.496337890625,
0.72265625,
-0.6884765625,
0.476806640625,
-0.443359375,
-0.1600341796875,
0.96533203125,
0.333984375,
0.90185546875,
-0.71630859375,
-0.030914306640625,
-0.28125,
0.2568359375,
0.736328125,
0.0024890899658203125,
0.974609375,
-0.4365234375,
-0.447509765625,
-0.440673828125,
-0.8408203125,
0.168212890625,
-0.689453125,
0.27978515625,
-0.41064453125,
-0.356201171875,
-0.78076171875,
0.282958984375,
0.4951171875,
0.4072265625,
0.195068359375,
0.51953125,
0.2281494140625,
0.7783203125,
0.69091796875,
-0.2861328125,
-0.021697998046875,
-0.68408203125,
0.99169921875,
0.14794921875,
-0.1947021484375,
-0.73974609375,
-0.1343994140625,
0.0221405029296875,
0.032379150390625,
0.2205810546875,
-0.64599609375,
-0.42041015625,
0.45166015625,
-0.08160400390625,
0.457763671875,
-0.12261962890625,
-0.65283203125,
0.0994873046875,
0.84814453125,
0.087158203125,
-0.9599609375,
0.4423828125,
-0.5654296875,
0.568359375,
0.72412109375,
-0.64794921875,
-0.47216796875,
-0.5693359375,
-0.837890625,
-0.279296875,
-0.2113037109375,
0.669921875,
-0.351806640625,
0.48046875,
-1.0810546875,
0.21923828125,
0.7373046875,
-0.0960693359375,
0.1968994140625,
-0.2509765625,
0.2388916015625,
0.0095672607421875,
0.7021484375,
-0.4541015625,
-1.0498046875,
0.03546142578125,
-1.1962890625,
0.33203125,
-0.82568359375,
0.265869140625,
-0.08367919921875,
-0.06707763671875,
-0.32373046875,
0.5498046875,
0.1854248046875,
-0.197998046875,
-0.100341796875,
0.2340087890625,
-0.96240234375,
-0.56640625,
0.83837890625,
-0.5830078125,
-0.2408447265625,
0.6494140625,
-0.58740234375,
-0.396484375,
0.2080078125,
0.71435546875,
-0.180419921875,
0.2476806640625,
-0.5107421875,
0.473388671875,
-0.2474365234375,
-0.20556640625,
-0.1497802734375,
-0.48095703125,
0.63134765625,
0.127197265625,
-0.97412109375,
-0.0611572265625,
-1.0029296875,
-0.1160888671875,
-0.12646484375,
-0.48095703125,
0.0994873046875,
0.25439453125,
-0.404541015625,
-0.1446533203125,
-0.5869140625,
-0.1732177734375,
-0.447265625,
-0.5205078125,
-0.06671142578125,
0.70166015625,
0.365966796875,
0.68798828125,
0.259033203125,
-0.72265625,
0.0051116943359375,
-0.25439453125,
0.07562255859375,
-0.53564453125,
0.0068359375,
0.1885986328125,
-0.2213134765625,
-0.05938720703125,
0.15771484375,
0.00031113624572753906,
0.6376953125,
1.134765625,
0.00820159912109375,
0.5302734375,
0.17578125,
-0.51025390625,
0.98974609375,
-0.26708984375,
-0.94091796875,
-0.6142578125,
0.4677734375,
0.1351318359375,
0.501953125,
0.39599609375,
-0.6630859375,
-0.87060546875,
-1.369140625,
0.068603515625,
-0.53662109375,
-0.08087158203125,
-1.20703125,
-0.625,
-0.3330078125,
0.54833984375,
-0.4140625,
-1.0947265625,
0.0628662109375,
-0.79736328125,
0.06744384765625,
-0.54052734375,
0.0267486572265625,
-1.1474609375,
-0.474365234375,
-0.0213470458984375,
0.615234375,
0.042572021484375,
0.56884765625,
-0.28955078125,
-0.16650390625,
0.06781005859375,
-0.0845947265625,
-0.48583984375,
-0.57080078125,
-0.2496337890625,
-0.185546875,
-0.1357421875,
-0.117431640625,
-0.33154296875,
0.94873046875,
-1.0029296875,
-0.08221435546875,
-0.46435546875,
-0.442138671875,
-0.1148681640625,
-0.64453125,
1.3623046875,
0.0760498046875,
-0.1112060546875,
-0.487060546875,
0.6337890625,
0.763671875,
-0.328125,
-0.541015625,
-0.70849609375,
-0.12347412109375,
-1.12109375,
0.689453125,
-0.55029296875,
-0.317138671875,
-0.2401123046875,
0.05950927734375,
0.86962890625,
-0.388427734375,
0.796875,
1.45703125,
-0.0256500244140625,
0.1297607421875,
-0.8671875,
0.5703125,
0.208984375,
-0.49853515625,
0.11737060546875,
-0.09368896484375,
-0.7578125,
-0.1297607421875,
-0.1368408203125,
-0.74267578125,
-0.720703125,
-0.062286376953125,
1.353515625,
-0.140625,
0.64501953125,
0.2783203125,
-1.5185546875,
-1.08984375,
1.04296875,
0.2215576171875,
0.72705078125,
1.1328125,
-0.032257080078125,
-0.12225341796875,
-0.384033203125,
0.1492919921875,
-0.183349609375,
-0.217041015625,
1.353515625,
0.2249755859375,
-0.49755859375,
0.6044921875,
0.86962890625,
-1.4765625,
-0.6435546875,
0.320068359375,
-0.1385498046875,
-0.50830078125,
-0.6015625,
0.292724609375,
0.6962890625,
-1.03515625,
0.08349609375,
0.61865234375,
0.060546875,
0.346435546875,
-0.0030002593994140625,
0.6630859375,
-0.28564453125,
0.472900390625,
0.94775390625,
-0.485107421875,
-0.12176513671875,
-1.0458984375,
-0.61328125,
-0.2296142578125,
0.253662109375,
0.83642578125,
-0.6103515625,
-0.041107177734375,
0.5615234375,
-0.073486328125,
0.6484375,
-0.37939453125,
-0.53662109375,
0.06103515625,
-0.576171875,
-0.437744140625,
0.090087890625,
0.53271484375,
0.1595458984375,
0.34228515625,
-0.4501953125,
0.345947265625,
0.4423828125,
0.150390625,
-0.08245849609375,
-1.0810546875,
-0.57861328125,
-1.033203125,
-0.47802734375,
-0.68359375,
-0.6396484375,
-0.367431640625,
-0.12054443359375,
-0.05718994140625,
-0.468505859375,
-0.0589599609375,
0.2447509765625,
-0.1544189453125,
0.86962890625,
-0.86328125,
0.353515625,
-0.83544921875,
-0.5498046875,
-0.65966796875,
-0.0604248046875,
-0.262451171875,
0.18994140625,
-1.126953125,
0.44580078125,
-0.0955810546875,
0.775390625,
-0.10595703125,
0.314697265625,
-0.15283203125,
-0.5595703125,
0.1890869140625,
0.31396484375,
-0.18603515625,
0.76953125,
0.46044921875,
-0.11700439453125,
0.1583251953125,
0.03253173828125,
-0.271728515625,
-0.4912109375,
0.310791015625,
0.83203125,
-0.296630859375,
-0.04071044921875,
-0.4501953125,
-0.031494140625,
-1.0205078125,
0.494873046875,
-0.04986572265625,
-0.195556640625,
0.4638671875,
-0.20166015625,
0.493408203125,
1.2197265625,
0.125732421875,
0.2066650390625,
-0.060821533203125,
0.4951171875,
0.38330078125,
-0.057464599609375,
0.393310546875,
0.4287109375,
0.064208984375,
-0.347412109375,
0.312255859375,
0.69140625,
-0.38232421875,
0.35205078125,
-0.34765625,
-0.451416015625,
-0.82763671875,
-0.346435546875,
-0.490478515625,
0.341552734375,
0.53173828125,
-0.61865234375,
-0.051727294921875,
-0.1287841796875,
-0.35595703125,
0.15478515625,
-1.3125,
-0.896484375,
0.73046875,
-0.2230224609375,
-0.47607421875,
-0.3251953125,
-0.4755859375,
-0.259521484375,
0.24267578125,
0.55859375,
-0.423828125,
0.58251953125,
-0.454345703125,
0.267822265625,
-0.2486572265625,
-0.1700439453125,
0.2332763671875,
0.381103515625,
-0.81689453125,
-0.5068359375,
0.34765625,
1.2685546875,
0.365234375,
0.308349609375,
-0.44091796875,
0.282958984375,
0.08917236328125,
-0.25830078125,
-0.402099609375,
0.079833984375,
-0.1884765625,
-0.06927490234375,
-0.13427734375,
0.334228515625,
-0.74462890625,
0.50341796875,
0.214111328125,
-0.4462890625,
-0.59326171875,
0.74560546875,
0.47216796875,
-0.445556640625,
0.64453125,
0.3017578125,
0.35888671875,
-0.0144195556640625,
-0.262939453125,
0.1339111328125,
0.646484375,
0.767578125,
0.890625,
-0.179443359375,
0.09423828125,
0.9521484375,
-0.09698486328125,
-0.07891845703125,
0.404296875,
-0.1455078125,
-0.08184814453125,
-0.18701171875,
-0.18310546875,
-0.11358642578125,
0.06512451171875,
-0.69140625,
0.80810546875,
-0.3603515625,
-0.381591796875,
-0.331298828125,
-0.482421875,
0.8447265625,
-0.0560302734375,
0.00665283203125,
0.274658203125,
-0.5498046875,
0.1806640625,
0.72119140625,
0.1680908203125,
0.0035305023193359375,
0.8779296875,
0.66162109375,
0.69873046875,
0.8896484375,
0.355224609375,
0.444580078125,
-0.52294921875,
0.232421875,
0.10125732421875,
-0.10040283203125,
-0.53662109375,
-0.57958984375,
-0.904296875,
0.2406005859375,
-0.53857421875,
-0.297607421875,
0.55615234375,
-0.6005859375,
0.4375,
-0.302490234375,
0.66015625,
-0.440673828125,
0.376220703125,
0.33935546875,
-0.5654296875,
-0.84326171875,
0.54296875,
-0.1475830078125,
0.363037109375,
0.296875,
1.5537109375,
-0.289306640625,
1.20703125,
0.485107421875,
-0.167724609375,
-0.437744140625,
0.193359375,
-0.18408203125,
-0.236328125,
-0.173583984375,
-0.287841796875,
0.337890625,
-0.7509765625,
-0.2783203125,
0.2222900390625,
0.833984375,
0.261962890625,
-1.0986328125,
-0.20263671875,
0.484619140625,
-0.79638671875,
0.425537109375,
0.1715087890625,
0.15771484375,
0.1102294921875,
-0.002986907958984375,
-0.214111328125,
-0.595703125,
0.053955078125,
-0.80322265625,
0.63623046875,
-0.5556640625,
-0.74169921875,
-0.78955078125,
-0.7685546875,
-0.0267486572265625,
-0.07037353515625,
-0.62158203125,
-0.708984375,
0.449462890625,
0.6826171875,
0.04583740234375,
-0.0086669921875,
-0.0797119140625,
-0.31103515625,
0.93603515625,
1.0322265625,
0.59912109375,
0.83984375,
0.452880859375,
-0.724609375,
0.61572265625,
-0.75537109375,
0.67919921875,
-0.218505859375,
-0.0214996337890625,
-0.4208984375,
0.65185546875,
-0.73779296875,
-1.328125,
0.298828125,
0.5556640625,
0.7119140625,
-0.5576171875,
-1.1298828125,
-0.1927490234375,
-1.232421875,
-0.367919921875,
-0.74267578125,
0.7412109375,
-0.1416015625,
-0.274169921875,
-0.299072265625,
-1.1826171875,
4.2578125,
0.95166015625,
0.947265625,
0.75537109375,
-0.253662109375,
0.6416015625,
0.74658203125,
-0.470703125,
-0.175537109375,
-0.274658203125,
0.4013671875,
-0.305908203125,
-0.00910186767578125,
0.67138671875,
0.6181640625,
0.390380859375,
-0.65185546875,
0.5986328125,
-0.00882720947265625,
-0.7333984375,
-0.90869140625,
0.42578125,
-0.1473388671875,
0.484619140625,
0.04217529296875,
0.30908203125,
0.40869140625,
-0.5302734375,
-0.12890625,
-0.35986328125,
0.391357421875,
-0.483154296875,
0.67822265625,
-0.320556640625,
-0.07965087890625,
0.02093505859375,
-0.135986328125,
-0.5693359375,
-0.2088623046875,
0.35693359375,
-0.185302734375,
0.0718994140625,
0.80908203125,
-0.548828125,
-0.02777099609375,
0.5146484375,
-0.5458984375,
0.61083984375,
0.245849609375,
-1.1591796875,
0.87939453125,
-0.364501953125,
0.154296875,
-0.947265625,
-0.89013671875,
-0.06988525390625,
0.341064453125,
0.0888671875,
0.256103515625,
0.294921875,
0.55419921875,
0.64599609375,
0.43896484375,
0.2486572265625,
-1.048828125,
1.0517578125,
-0.03717041015625,
0.245361328125,
-0.40576171875,
-0.125244140625,
-0.5830078125,
-0.43798828125,
0.132568359375,
-0.63720703125,
0.4814453125,
-0.02642822265625,
-0.58251953125,
0.457763671875,
0.27490234375,
-0.7626953125,
-0.046173095703125,
0.19140625,
-0.3486328125,
-0.388671875,
0.472900390625,
1.15625,
-0.72021484375,
-0.355224609375,
-0.8056640625,
0.483154296875,
0.301513671875,
0.4638671875,
0.043975830078125,
-0.3203125,
-0.2421875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
I Aqua Fortis
I Aqua Regia
II Amalgama
VII Minium
IV Vitriol
Misce in vitro et æstus, et nil admirari. Festina lente, et nulla tenaci invia est via.
Fac et spera,
Vale,
Nicolas Flamel
Input
The first line of input contains several space-separated integers ai (0 ≤ ai ≤ 100).
Output
Print a single integer.
Examples
Input
2 4 6 8 10
Output
1
Tags: *special
Correct Solution:
```
a , b , c , d , e = map( int , input().split())
print( min( a , b , c // 2 , d // 7 , e // 4 ) )
```
| 45,733
|
[
0.056854248046875,
-0.00225830078125,
0.2841796875,
0.1854248046875,
-0.53125,
-0.888671875,
0.0012025833129882812,
-0.033050537109375,
0.35009765625,
0.59619140625,
0.6611328125,
-0.016693115234375,
0.0712890625,
-0.720703125,
-0.342041015625,
-0.261474609375,
-0.339111328125,
-0.978515625,
-0.6103515625,
-0.31689453125,
-0.10400390625,
-0.06915283203125,
-1.4072265625,
-0.1580810546875,
-0.52294921875,
0.97021484375,
0.61865234375,
0.3505859375,
0.80224609375,
1.10546875,
-0.2958984375,
-0.5615234375,
0.465087890625,
-1.306640625,
-0.2890625,
-0.351806640625,
0.6025390625,
-0.81884765625,
-0.67578125,
-0.421630859375,
0.046905517578125,
0.1788330078125,
0.3544921875,
-0.72119140625,
-0.61962890625,
0.053863525390625,
-0.310546875,
-0.2958984375,
-0.059173583984375,
-0.798828125,
0.1002197265625,
-0.11328125,
0.7763671875,
-0.12042236328125,
-0.1419677734375,
-0.131591796875,
0.1082763671875,
-0.408935546875,
-0.87060546875,
0.5859375,
0.456787109375,
-0.1376953125,
0.1478271484375,
-0.407958984375,
-0.262451171875,
0.2442626953125,
-0.247802734375,
-0.0236968994140625,
-0.1669921875,
-0.8310546875,
-0.026580810546875,
0.6298828125,
-0.235595703125,
-0.33935546875,
-0.364013671875,
-0.348388671875,
0.2142333984375,
-0.217529296875,
-0.5205078125,
0.29833984375,
0.451171875,
0.7275390625,
-0.0194854736328125,
0.427001953125,
-0.482421875,
-0.88525390625,
-0.64306640625,
0.6435546875,
0.2122802734375,
-0.25146484375,
-0.08642578125,
0.68603515625,
-0.333251953125,
0.1190185546875,
0.445068359375,
0.5126953125,
-0.419189453125,
0.39306640625,
0.0762939453125,
0.2044677734375,
0.912109375,
1.541015625,
-0.52001953125,
0.970703125,
-0.83935546875,
-0.1395263671875,
-0.10223388671875,
0.375,
0.2296142578125,
-0.339599609375,
-0.3828125,
-0.1605224609375,
0.2115478515625,
0.1151123046875,
-0.44189453125,
0.859375,
-0.2412109375,
0.1201171875,
-0.66064453125,
0.243408203125,
0.328857421875,
0.236572265625,
0.603515625,
-0.52783203125,
-0.1810302734375,
-0.84765625,
-0.490478515625,
1.0654296875,
-0.52490234375,
-0.0123138427734375,
0.70361328125,
-0.106689453125,
-0.1478271484375,
0.1705322265625,
-0.0537109375,
0.5986328125,
-0.10516357421875,
0.63916015625,
0.81591796875,
-0.54052734375,
0.272216796875,
-0.2039794921875,
-0.2156982421875,
1.2861328125,
0.456787109375,
0.62109375,
0.94970703125,
0.3486328125,
-0.7607421875,
0.199462890625,
-0.8056640625,
0.60986328125,
-0.055908203125,
0.666015625,
-0.2900390625,
0.14501953125,
-0.1187744140625,
0.35400390625,
-0.11639404296875,
0.292724609375,
-0.10687255859375,
0.26123046875,
-0.1336669921875,
1.3369140625,
-0.1624755859375,
0.83935546875,
-0.326171875,
-0.457275390625,
-0.39501953125,
-0.64453125,
0.533203125,
-0.205322265625,
-0.2376708984375,
0.93896484375,
0.244140625,
1.1396484375,
0.86279296875,
0.04705810546875,
0.1937255859375,
0.51171875,
-0.08563232421875,
0.1561279296875,
0.55322265625,
1.2607421875,
0.44873046875,
0.666015625,
0.433837890625,
-0.197998046875,
-0.5556640625,
-0.857421875,
0.0284576416015625,
0.9638671875,
-0.52490234375,
0.316650390625,
0.421875,
-0.0174407958984375,
-0.42236328125,
-0.365966796875,
-0.027008056640625,
-1.240234375,
-0.626953125,
0.50341796875,
-0.4111328125,
0.478271484375,
-0.2078857421875,
-0.355224609375,
0.136474609375,
1.2509765625,
-0.5576171875,
-0.319091796875,
0.5751953125,
-0.06256103515625,
-0.2237548828125,
0.2471923828125,
0.06561279296875,
-0.175537109375,
-0.8642578125,
0.8017578125,
-0.3427734375,
-0.385009765625,
0.0026950836181640625,
0.892578125,
0.37451171875,
0.4658203125,
-0.59912109375,
-0.29638671875,
0.0228729248046875,
1.404296875,
0.1412353515625,
0.070068359375,
0.01238250732421875,
0.7978515625,
0.316650390625,
0.89453125,
1.0263671875,
0.1978759765625,
0.72998046875,
0.67236328125,
-0.07208251953125,
0.442626953125,
0.0211944580078125,
0.69873046875,
0.6064453125,
0.1510009765625,
0.07244873046875,
0.450927734375,
0.2044677734375,
0.322998046875,
-0.0222015380859375,
0.58447265625,
-0.56884765625,
0.529296875,
0.4150390625,
0.260498046875,
-0.521484375,
-0.27392578125,
0.57666015625,
1.181640625,
-0.8623046875,
-0.25390625,
-0.36572265625,
0.2347412109375,
0.197998046875,
-0.0276947021484375,
0.468994140625,
0.662109375,
0.27880859375,
0.28564453125,
-0.154296875,
-0.3701171875,
-1.07421875,
-0.59619140625,
-1.3642578125,
-0.375,
-0.57373046875,
-0.08447265625,
0.351318359375,
-0.76318359375,
0.490234375,
-0.255126953125,
-0.560546875,
0.072998046875,
-0.63232421875,
0.70458984375,
-0.11712646484375,
0.8671875,
-0.9541015625,
0.40771484375,
0.15087890625,
1.177734375,
-0.83740234375,
-0.249267578125,
0.2578125,
-0.74658203125,
0.1402587890625,
0.07745361328125,
0.310546875,
0.08074951171875,
-0.88525390625,
-0.8212890625,
-0.1595458984375,
0.254150390625,
0.09820556640625,
0.387451171875,
-0.353515625,
1.0390625,
0.50927734375,
-0.51025390625,
0.42333984375,
0.28759765625,
-0.92529296875,
0.689453125,
0.10479736328125,
0.06719970703125,
-0.87646484375,
1.294921875,
0.51708984375,
0.253173828125,
-0.49609375,
-0.209228515625,
-0.56640625,
0.05169677734375,
0.1697998046875,
-0.69873046875,
-0.60791015625,
0.462646484375,
0.39990234375,
-0.95166015625,
0.5224609375,
-0.78662109375,
-0.5869140625,
-0.1895751953125,
-0.266845703125,
1.0546875,
0.5546875,
0.06622314453125,
-0.201904296875,
-0.355712890625,
-0.3583984375,
0.286376953125,
0.291748046875,
-0.379638671875,
-0.1514892578125,
0.9013671875,
-0.334228515625,
-0.065185546875,
0.00441741943359375,
-0.068115234375,
-0.08892822265625,
-0.068115234375,
0.2252197265625,
0.3759765625,
0.291259765625,
-0.1090087890625,
0.213623046875,
1.1376953125,
-0.7724609375,
-0.37158203125,
-0.0999755859375,
0.436279296875,
0.1885986328125,
0.302490234375,
0.496826171875,
-0.433349609375,
-0.5166015625,
-1.0869140625,
0.370849609375,
0.405517578125,
0.61328125,
-0.638671875,
0.430908203125,
0.70458984375,
-0.7431640625,
0.47119140625,
-0.45458984375,
-0.15380859375,
0.90625,
0.39111328125,
0.84130859375,
-0.6650390625,
0.047760009765625,
-0.227783203125,
0.2086181640625,
0.67333984375,
0.09625244140625,
1.0107421875,
-0.428466796875,
-0.37158203125,
-0.37841796875,
-0.85205078125,
0.178955078125,
-0.794921875,
0.2384033203125,
-0.4140625,
-0.42333984375,
-0.76708984375,
0.32763671875,
0.471435546875,
0.37548828125,
0.1876220703125,
0.52099609375,
0.1904296875,
0.6474609375,
0.73193359375,
-0.37841796875,
-0.037841796875,
-0.689453125,
1.0322265625,
0.2470703125,
-0.1795654296875,
-0.7216796875,
-0.1942138671875,
0.1231689453125,
0.0261077880859375,
0.265869140625,
-0.60546875,
-0.436279296875,
0.5302734375,
-0.039459228515625,
0.5390625,
-0.15576171875,
-0.67919921875,
0.14306640625,
0.75,
0.10809326171875,
-0.93115234375,
0.39599609375,
-0.58837890625,
0.57373046875,
0.67578125,
-0.62890625,
-0.460693359375,
-0.5751953125,
-0.76806640625,
-0.3251953125,
-0.09417724609375,
0.6328125,
-0.36572265625,
0.431396484375,
-1.0478515625,
0.346923828125,
0.74267578125,
-0.2037353515625,
0.037689208984375,
-0.2100830078125,
0.305419921875,
-0.021270751953125,
0.70654296875,
-0.4794921875,
-1.005859375,
0.166015625,
-1.138671875,
0.35693359375,
-0.841796875,
0.2802734375,
-0.10479736328125,
-0.084716796875,
-0.2437744140625,
0.52392578125,
0.200927734375,
-0.34375,
-0.1217041015625,
0.203857421875,
-0.89892578125,
-0.50732421875,
0.8876953125,
-0.6396484375,
-0.164794921875,
0.68896484375,
-0.5029296875,
-0.373779296875,
0.1636962890625,
0.6533203125,
-0.263427734375,
0.38818359375,
-0.491455078125,
0.477294921875,
-0.219970703125,
-0.1829833984375,
-0.08575439453125,
-0.478515625,
0.68017578125,
0.054718017578125,
-0.89990234375,
-0.099365234375,
-1.091796875,
-0.1085205078125,
-0.1463623046875,
-0.53515625,
-0.06024169921875,
0.28369140625,
-0.3681640625,
-0.1717529296875,
-0.60498046875,
-0.19189453125,
-0.42236328125,
-0.52685546875,
-0.056365966796875,
0.666015625,
0.37646484375,
0.57470703125,
0.2430419921875,
-0.7939453125,
-0.0183868408203125,
-0.291259765625,
-0.036041259765625,
-0.53173828125,
0.02386474609375,
0.1822509765625,
-0.254150390625,
-0.1436767578125,
0.077392578125,
0.09259033203125,
0.658203125,
1.091796875,
-0.0828857421875,
0.529296875,
0.1307373046875,
-0.5576171875,
1.1015625,
-0.27392578125,
-0.8759765625,
-0.58935546875,
0.5478515625,
0.1585693359375,
0.472412109375,
0.395751953125,
-0.74609375,
-0.84130859375,
-1.3388671875,
0.0975341796875,
-0.54443359375,
-0.10662841796875,
-1.1611328125,
-0.69384765625,
-0.337646484375,
0.6337890625,
-0.43994140625,
-1.0869140625,
0.1424560546875,
-0.8056640625,
-0.06390380859375,
-0.47412109375,
-0.0139923095703125,
-1.2578125,
-0.457275390625,
-0.022430419921875,
0.5126953125,
0.0208282470703125,
0.49462890625,
-0.294677734375,
-0.1881103515625,
0.051788330078125,
-0.08013916015625,
-0.50927734375,
-0.50732421875,
-0.23388671875,
-0.164794921875,
-0.08837890625,
-0.1546630859375,
-0.328369140625,
0.8994140625,
-1.0068359375,
-0.13525390625,
-0.412353515625,
-0.463134765625,
-0.071044921875,
-0.57373046875,
1.337890625,
0.046051025390625,
-0.042266845703125,
-0.479736328125,
0.6015625,
0.7861328125,
-0.35546875,
-0.54541015625,
-0.7216796875,
-0.1513671875,
-1.1435546875,
0.6640625,
-0.53125,
-0.27734375,
-0.1690673828125,
0.005832672119140625,
0.73486328125,
-0.309326171875,
0.71630859375,
1.4482421875,
-0.004425048828125,
0.05584716796875,
-0.80224609375,
0.6162109375,
0.167724609375,
-0.438232421875,
0.2066650390625,
-0.184814453125,
-0.59619140625,
-0.07379150390625,
-0.182373046875,
-0.72216796875,
-0.72216796875,
0.0218048095703125,
1.3486328125,
-0.08270263671875,
0.5771484375,
0.3291015625,
-1.556640625,
-1.0390625,
0.9833984375,
0.1773681640625,
0.73974609375,
1.08203125,
0.08856201171875,
-0.12347412109375,
-0.35595703125,
0.176513671875,
-0.2880859375,
-0.2958984375,
1.2958984375,
0.33349609375,
-0.51123046875,
0.67333984375,
0.92626953125,
-1.45703125,
-0.6650390625,
0.31640625,
-0.10675048828125,
-0.455078125,
-0.52880859375,
0.408935546875,
0.6484375,
-1.0556640625,
0.127197265625,
0.46630859375,
0.060699462890625,
0.400146484375,
-0.0059967041015625,
0.6904296875,
-0.2353515625,
0.465087890625,
1.0419921875,
-0.5517578125,
-0.1728515625,
-1.10546875,
-0.70263671875,
-0.2489013671875,
0.31982421875,
0.74072265625,
-0.57373046875,
-0.0570068359375,
0.61962890625,
-0.131103515625,
0.64404296875,
-0.3857421875,
-0.51611328125,
0.03131103515625,
-0.6396484375,
-0.39404296875,
0.0167388916015625,
0.4638671875,
0.0810546875,
0.279296875,
-0.437255859375,
0.2958984375,
0.50244140625,
0.2142333984375,
-0.10430908203125,
-0.9189453125,
-0.5654296875,
-1.0400390625,
-0.484619140625,
-0.69970703125,
-0.560546875,
-0.312255859375,
-0.075927734375,
-0.0489501953125,
-0.50927734375,
0.04022216796875,
0.258056640625,
-0.133544921875,
0.85693359375,
-0.9013671875,
0.3544921875,
-0.8037109375,
-0.52197265625,
-0.73974609375,
-0.0439453125,
-0.1978759765625,
0.2154541015625,
-1.142578125,
0.447021484375,
-0.1507568359375,
0.8525390625,
-0.06585693359375,
0.323486328125,
-0.253662109375,
-0.59521484375,
0.1446533203125,
0.3251953125,
-0.248046875,
0.732421875,
0.4765625,
-0.01030731201171875,
0.1783447265625,
0.03338623046875,
-0.18505859375,
-0.3828125,
0.359375,
0.74951171875,
-0.311767578125,
-0.1290283203125,
-0.42333984375,
0.04803466796875,
-1.0107421875,
0.560546875,
-0.10479736328125,
-0.14599609375,
0.474609375,
-0.12469482421875,
0.424560546875,
1.1796875,
0.11444091796875,
0.1959228515625,
-0.032806396484375,
0.50830078125,
0.352783203125,
-0.062408447265625,
0.380615234375,
0.4326171875,
0.0242156982421875,
-0.39892578125,
0.3193359375,
0.7509765625,
-0.3701171875,
0.261474609375,
-0.328369140625,
-0.5185546875,
-0.806640625,
-0.351318359375,
-0.475341796875,
0.36181640625,
0.59228515625,
-0.5986328125,
-0.00914764404296875,
-0.09735107421875,
-0.51220703125,
0.07861328125,
-1.3017578125,
-0.87109375,
0.708984375,
-0.2025146484375,
-0.4248046875,
-0.2099609375,
-0.5146484375,
-0.28076171875,
0.204833984375,
0.6162109375,
-0.365478515625,
0.5341796875,
-0.41796875,
0.2066650390625,
-0.2344970703125,
-0.123291015625,
0.1455078125,
0.4208984375,
-0.689453125,
-0.56787109375,
0.30419921875,
1.3232421875,
0.43994140625,
0.26953125,
-0.361572265625,
0.297119140625,
0.10455322265625,
-0.25341796875,
-0.311279296875,
0.053375244140625,
-0.2235107421875,
-0.08538818359375,
-0.09393310546875,
0.330322265625,
-0.8232421875,
0.451904296875,
0.15576171875,
-0.337890625,
-0.6298828125,
0.80908203125,
0.47314453125,
-0.45361328125,
0.638671875,
0.30517578125,
0.31591796875,
0.0064239501953125,
-0.266845703125,
0.1285400390625,
0.62060546875,
0.76611328125,
0.82666015625,
-0.2060546875,
0.07403564453125,
1.0322265625,
-0.06378173828125,
-0.10711669921875,
0.421875,
-0.044342041015625,
-0.054443359375,
-0.251708984375,
-0.2335205078125,
-0.06427001953125,
-0.018341064453125,
-0.71240234375,
0.70556640625,
-0.32373046875,
-0.37939453125,
-0.2607421875,
-0.50830078125,
0.87451171875,
-0.1929931640625,
-0.07928466796875,
0.2705078125,
-0.56982421875,
0.28955078125,
0.7666015625,
0.11505126953125,
-0.0017633438110351562,
0.85498046875,
0.6806640625,
0.64306640625,
0.880859375,
0.2261962890625,
0.490478515625,
-0.6015625,
0.318603515625,
0.1861572265625,
-0.0516357421875,
-0.5859375,
-0.525390625,
-0.81787109375,
0.31787109375,
-0.48095703125,
-0.326416015625,
0.389892578125,
-0.57275390625,
0.477294921875,
-0.376953125,
0.66943359375,
-0.48193359375,
0.419677734375,
0.30078125,
-0.5078125,
-0.8681640625,
0.47314453125,
-0.10150146484375,
0.411865234375,
0.24560546875,
1.4912109375,
-0.1904296875,
1.2421875,
0.51708984375,
-0.16455078125,
-0.4052734375,
0.1781005859375,
-0.2408447265625,
-0.193603515625,
-0.2332763671875,
-0.29345703125,
0.31884765625,
-0.7294921875,
-0.305908203125,
0.239013671875,
0.7587890625,
0.189453125,
-1.08203125,
-0.25341796875,
0.54833984375,
-0.84326171875,
0.40673828125,
0.21484375,
0.2213134765625,
0.1490478515625,
0.08319091796875,
-0.2030029296875,
-0.5263671875,
0.085693359375,
-0.8076171875,
0.53564453125,
-0.4931640625,
-0.8359375,
-0.8291015625,
-0.666015625,
0.0005855560302734375,
-0.084228515625,
-0.6357421875,
-0.77978515625,
0.42919921875,
0.64697265625,
0.07318115234375,
0.055908203125,
-0.01122283935546875,
-0.386962890625,
0.9423828125,
1.07421875,
0.65478515625,
0.74853515625,
0.422607421875,
-0.80322265625,
0.54638671875,
-0.794921875,
0.7099609375,
-0.2139892578125,
-0.02685546875,
-0.4921875,
0.65625,
-0.71337890625,
-1.2705078125,
0.2939453125,
0.47314453125,
0.70849609375,
-0.6494140625,
-1.080078125,
-0.25634765625,
-1.2470703125,
-0.401123046875,
-0.64453125,
0.7041015625,
-0.1573486328125,
-0.302490234375,
-0.263671875,
-1.2392578125,
4.2734375,
1.0029296875,
0.93017578125,
0.7109375,
-0.219970703125,
0.63525390625,
0.65869140625,
-0.401611328125,
-0.150146484375,
-0.259765625,
0.458984375,
-0.2254638671875,
-0.078857421875,
0.70947265625,
0.63232421875,
0.404296875,
-0.65966796875,
0.498291015625,
-0.0968017578125,
-0.69189453125,
-0.92041015625,
0.4228515625,
-0.07177734375,
0.479736328125,
0.05908203125,
0.34765625,
0.5087890625,
-0.580078125,
-0.2430419921875,
-0.344482421875,
0.40185546875,
-0.467529296875,
0.62841796875,
-0.33984375,
-0.09979248046875,
0.091796875,
-0.1533203125,
-0.54296875,
-0.2352294921875,
0.296875,
-0.1929931640625,
0.09136962890625,
0.78662109375,
-0.521484375,
0.01116180419921875,
0.51953125,
-0.51953125,
0.6572265625,
0.23486328125,
-1.15625,
0.9443359375,
-0.32373046875,
0.156005859375,
-0.8623046875,
-0.873046875,
-0.12152099609375,
0.247314453125,
0.146484375,
0.2376708984375,
0.39208984375,
0.609375,
0.61767578125,
0.385986328125,
0.279541015625,
-0.97607421875,
0.98486328125,
-0.11163330078125,
0.328857421875,
-0.5166015625,
-0.1009521484375,
-0.57958984375,
-0.3603515625,
0.1102294921875,
-0.6494140625,
0.607421875,
-0.0455322265625,
-0.65576171875,
0.376708984375,
0.2744140625,
-0.7998046875,
-0.00014126300811767578,
0.2313232421875,
-0.32421875,
-0.46435546875,
0.398681640625,
1.1376953125,
-0.5966796875,
-0.49267578125,
-0.787109375,
0.41650390625,
0.442138671875,
0.47900390625,
0.11480712890625,
-0.49951171875,
-0.1629638671875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in history of Berland, there is the one that stand out the most. King wants to mention it in the anthem as many times as possible.
He has already composed major part of the anthem and now just needs to fill in some letters. King asked you to help him with this work.
The anthem is the string s of no more than 105 small Latin letters and question marks. The most glorious victory is the string t of no more than 105 small Latin letters. You should replace all the question marks with small Latin letters in such a way that the number of occurrences of string t in string s is maximal.
Note that the occurrences of string t in s can overlap. Check the third example for clarification.
Input
The first line contains string of small Latin letters and question marks s (1 ≤ |s| ≤ 105).
The second line contains string of small Latin letters t (1 ≤ |t| ≤ 105).
Product of lengths of strings |s|·|t| won't exceed 107.
Output
Output the maximum number of occurrences of string t you can achieve by replacing all the question marks in string s with small Latin letters.
Examples
Input
winlose???winl???w??
win
Output
5
Input
glo?yto?e??an?
or
Output
3
Input
??c?????
abcab
Output
2
Note
In the first example the resulting string s is "winlosewinwinlwinwin"
In the second example the resulting string s is "glorytoreorand". The last letter of the string can be arbitrary.
In the third example occurrences of string t are overlapping. String s with maximal number of occurrences of t is "abcabcab".
Tags: dp, strings
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO, IOBase
def calculatePiArray(s):
n = len(s)
pi = [0]*n
for i in range(1,n):
j = pi[i-1]
while j and s[i] != s[j]:
j = pi[j-1]
if s[i] == s[j]:
j += 1
pi[i] = j
return pi
def main():
s = input().strip()
t = input().strip()
pi = calculatePiArray(t)
dp = [0]+[-1]*len(t)
cnt = 0
for i in s:
dp1 = [-1]*(len(t)+1)
if dp[-1] != -1:
dp[pi[-1]] = max(dp[pi[-1]],dp[-1])
for j in range(len(t)-1,-1,-1):
if dp[j] == -1:
continue
if i == '?' or i == t[j]:
if j == len(t)-1:
dp1[j+1] = max(dp1[j+1],dp[j]+1)
cnt = max(cnt,dp[j]+1)
else:
dp1[j+1] = max(dp1[j+1],dp[j])
if j:
dp[pi[j-1]] = max(dp[pi[j-1]],dp[j])
else:
dp1[0] = max(dp1[0],dp[0])
dp = dp1
print(cnt)
# Fast IO Region
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.writable else None
def read(self):
while True:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
if not b:
break
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines = 0
return self.buffer.read()
def readline(self):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.newlines = b.count(b"\n") + (not b)
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines -= 1
return self.buffer.readline()
def flush(self):
if self.writable:
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
if __name__ == "__main__":
main()
```
| 45,837
|
[
0.178955078125,
-0.06475830078125,
0.349609375,
0.4306640625,
-0.1396484375,
-0.1256103515625,
0.1246337890625,
-0.03253173828125,
0.1580810546875,
0.257568359375,
0.6494140625,
-0.0806884765625,
-0.00724029541015625,
-0.60498046875,
-0.634765625,
0.2484130859375,
-0.634765625,
-1.1689453125,
-0.80224609375,
0.058624267578125,
-0.470947265625,
-0.130126953125,
-1.4345703125,
-0.232666015625,
-0.358642578125,
0.82568359375,
0.298095703125,
0.387939453125,
0.8193359375,
1.2734375,
0.08465576171875,
-0.496826171875,
0.107177734375,
-1.0546875,
-0.494384765625,
-0.41357421875,
0.58251953125,
-0.6796875,
0.02227783203125,
-0.38818359375,
0.01076507568359375,
-0.64013671875,
0.70263671875,
-0.61767578125,
-1.0283203125,
-0.1630859375,
-0.62060546875,
-0.317626953125,
-0.1893310546875,
-0.346923828125,
0.314208984375,
-0.38232421875,
0.253662109375,
0.05914306640625,
-0.143798828125,
0.2459716796875,
-0.326171875,
-0.37255859375,
-0.53955078125,
0.22998046875,
0.09368896484375,
0.43505859375,
-0.108642578125,
-0.58251953125,
-0.328125,
0.0160064697265625,
0.00872802734375,
-0.07666015625,
0.392578125,
-1.029296875,
-0.335693359375,
0.437744140625,
-0.419677734375,
-0.5615234375,
-0.3193359375,
-0.0207061767578125,
0.189208984375,
-0.01221466064453125,
-0.2291259765625,
0.71875,
0.0460205078125,
0.9287109375,
0.25634765625,
0.233154296875,
-0.9384765625,
-0.39013671875,
0.028045654296875,
0.452880859375,
0.312255859375,
-0.262451171875,
-0.1923828125,
0.68212890625,
-0.55712890625,
-0.00799560546875,
0.57373046875,
0.79541015625,
-0.45751953125,
0.19921875,
0.1988525390625,
-0.2335205078125,
0.7509765625,
0.7978515625,
-0.410888671875,
0.857421875,
-0.56982421875,
0.386962890625,
-0.05743408203125,
0.3125,
0.263671875,
-0.74267578125,
0.060028076171875,
0.04913330078125,
0.9228515625,
0.23828125,
0.01369476318359375,
0.7802734375,
-0.25634765625,
0.65283203125,
-0.57421875,
0.41748046875,
0.019378662109375,
0.05352783203125,
0.52783203125,
-0.443359375,
-0.25927734375,
-0.6435546875,
-0.53076171875,
0.87255859375,
-0.78125,
-0.0189666748046875,
0.37451171875,
-0.165771484375,
0.1627197265625,
0.2958984375,
0.11541748046875,
0.98388671875,
-0.039306640625,
0.52587890625,
0.8974609375,
-0.763671875,
0.68212890625,
0.0160369873046875,
0.09686279296875,
1.2841796875,
0.537109375,
0.31298828125,
0.91796875,
-0.056304931640625,
-0.560546875,
0.0885009765625,
-0.68994140625,
0.77490234375,
0.095458984375,
0.302001953125,
0.01378631591796875,
0.1767578125,
-0.266357421875,
0.26123046875,
0.2276611328125,
-0.2498779296875,
-0.5390625,
0.435546875,
-0.2349853515625,
0.8798828125,
0.034912109375,
0.8046875,
-0.355712890625,
0.01541900634765625,
0.004413604736328125,
-0.435546875,
0.461669921875,
-0.447021484375,
0.043243408203125,
0.8095703125,
0.61767578125,
1.0537109375,
0.73876953125,
-0.270263671875,
0.3720703125,
0.5,
-0.260498046875,
0.2139892578125,
0.326416015625,
0.37841796875,
-0.256591796875,
0.11163330078125,
0.031890869140625,
-0.114990234375,
-0.89794921875,
-0.6826171875,
0.381591796875,
0.5537109375,
-0.46923828125,
0.1895751953125,
0.39453125,
0.1937255859375,
-0.44091796875,
0.01033782958984375,
-0.0645751953125,
-1.052734375,
-0.427734375,
0.5830078125,
-0.0146636962890625,
0.31884765625,
-0.443359375,
-0.283203125,
0.48046875,
1.0888671875,
-0.1669921875,
0.06475830078125,
0.71337890625,
-0.177490234375,
-0.203125,
0.419677734375,
0.19921875,
-0.10089111328125,
-0.1708984375,
0.9306640625,
-0.346923828125,
0.08294677734375,
0.006610870361328125,
0.8740234375,
0.077392578125,
0.39306640625,
-0.139892578125,
-0.3935546875,
0.2069091796875,
1.1923828125,
-0.288818359375,
0.294189453125,
0.08172607421875,
0.54345703125,
0.77783203125,
0.71728515625,
0.41357421875,
0.36083984375,
0.60595703125,
0.77490234375,
-0.005062103271484375,
0.1319580078125,
0.08514404296875,
0.186767578125,
0.4296875,
0.84228515625,
-0.07196044921875,
0.3330078125,
0.0765380859375,
-0.20947265625,
-0.041717529296875,
0.353271484375,
-0.1207275390625,
0.90966796875,
0.1785888671875,
0.44677734375,
-0.80615234375,
-0.1866455078125,
0.2529296875,
0.70947265625,
-0.65380859375,
-0.4599609375,
-0.228271484375,
0.317138671875,
0.345703125,
0.055419921875,
0.0574951171875,
0.5546875,
0.529296875,
0.36083984375,
-0.53662109375,
-0.70263671875,
-0.560546875,
-0.95849609375,
-0.845703125,
-0.50244140625,
-0.390380859375,
0.019989013671875,
0.828125,
-0.85595703125,
-0.07000732421875,
-0.2301025390625,
-0.1168212890625,
0.418701171875,
-0.387939453125,
0.70263671875,
-0.31103515625,
0.246826171875,
-0.65185546875,
0.73828125,
0.027923583984375,
0.61328125,
-0.2340087890625,
-0.1732177734375,
-0.043304443359375,
-0.6591796875,
-0.189453125,
0.130126953125,
0.38037109375,
0.21875,
-0.402099609375,
-0.7490234375,
-0.06201171875,
-0.0947265625,
-0.249267578125,
0.12139892578125,
-0.5595703125,
0.533203125,
0.373291015625,
-0.76318359375,
0.48046875,
0.9296875,
-1.0859375,
0.54443359375,
0.40673828125,
0.01413726806640625,
-0.828125,
0.95849609375,
0.744140625,
0.4326171875,
-0.47265625,
-0.53466796875,
-0.63330078125,
0.1998291015625,
0.1307373046875,
-0.54150390625,
-0.444580078125,
0.57421875,
0.11053466796875,
-1.169921875,
0.403564453125,
-1.3916015625,
-0.546875,
-0.478759765625,
-0.0110015869140625,
0.84619140625,
0.818359375,
-0.2108154296875,
0.133056640625,
-0.0985107421875,
0.04559326171875,
0.66552734375,
0.66015625,
-0.448486328125,
-0.28662109375,
0.95361328125,
-0.34326171875,
-0.0347900390625,
0.361328125,
-0.388671875,
-0.29248046875,
-0.1510009765625,
0.140625,
0.578125,
-0.0341796875,
0.295654296875,
0.19775390625,
0.681640625,
-0.72900390625,
-0.29296875,
-0.264404296875,
0.560546875,
0.49072265625,
0.58740234375,
0.623046875,
0.161376953125,
-0.5224609375,
-1.033203125,
0.28271484375,
0.404296875,
0.79345703125,
-0.81298828125,
0.56787109375,
0.673828125,
-0.45849609375,
0.69140625,
-0.73974609375,
0.22509765625,
1.4150390625,
-0.441650390625,
0.481201171875,
-0.36962890625,
0.25146484375,
-0.372314453125,
-0.0160675048828125,
0.53955078125,
0.3935546875,
0.33349609375,
-0.53955078125,
-0.64990234375,
-0.1676025390625,
-0.0283050537109375,
0.2037353515625,
-0.345703125,
0.2181396484375,
-0.6630859375,
-0.2322998046875,
-0.859375,
0.1318359375,
0.63427734375,
0.4140625,
0.044097900390625,
0.51611328125,
0.257080078125,
0.5029296875,
0.662109375,
-0.4345703125,
-0.0504150390625,
-0.50048828125,
1.0234375,
0.38818359375,
-0.039215087890625,
-0.6865234375,
-0.1663818359375,
-0.5634765625,
0.3447265625,
0.07086181640625,
-0.07666015625,
-0.84423828125,
0.315185546875,
-0.1712646484375,
0.572265625,
-0.35791015625,
0.09942626953125,
-0.1959228515625,
0.51953125,
-0.0240631103515625,
-0.8525390625,
0.187744140625,
-0.6484375,
0.377685546875,
0.51953125,
-0.066162109375,
-0.47509765625,
-0.74365234375,
-0.38037109375,
-0.72802734375,
-0.216552734375,
1.0068359375,
-0.36767578125,
0.034088134765625,
-1.1337890625,
0.615234375,
0.252197265625,
-0.46337890625,
0.2222900390625,
-0.1802978515625,
0.497802734375,
0.2391357421875,
1.0185546875,
-0.10186767578125,
-0.626953125,
0.135009765625,
-1.580078125,
0.1103515625,
-0.5322265625,
0.217041015625,
0.39990234375,
-0.08349609375,
-0.009063720703125,
0.35205078125,
-0.12249755859375,
-0.2435302734375,
-0.0020465850830078125,
0.2198486328125,
-0.921875,
-0.60107421875,
0.69921875,
-0.34033203125,
-0.6318359375,
1.248046875,
0.044158935546875,
-0.342041015625,
0.53271484375,
0.67822265625,
-0.451904296875,
0.293212890625,
-0.47412109375,
0.451904296875,
-0.252197265625,
-0.6064453125,
0.00025343894958496094,
-0.388671875,
0.60546875,
-0.188720703125,
-0.5712890625,
-0.37841796875,
-0.8955078125,
0.12335205078125,
0.07489013671875,
-0.29443359375,
0.174072265625,
0.2398681640625,
0.0438232421875,
-0.24951171875,
-0.451904296875,
-0.61962890625,
-0.537109375,
-0.374267578125,
-0.046539306640625,
0.31640625,
0.2122802734375,
0.67041015625,
0.233642578125,
-0.2100830078125,
0.0024929046630859375,
0.20849609375,
0.020538330078125,
-0.5322265625,
-0.55712890625,
-0.6259765625,
-0.20556640625,
-0.371826171875,
0.189453125,
0.08270263671875,
0.82470703125,
0.990234375,
0.304931640625,
0.2430419921875,
0.0229339599609375,
-0.62451171875,
0.8076171875,
-0.1121826171875,
-1.2666015625,
-0.37158203125,
0.51171875,
0.11395263671875,
0.94677734375,
0.1173095703125,
-0.70068359375,
-0.7509765625,
-1.0029296875,
-0.1429443359375,
-0.27734375,
-0.07049560546875,
-1.35546875,
-0.28759765625,
-0.36376953125,
0.8603515625,
-0.2259521484375,
-0.7216796875,
0.40283203125,
-0.8662109375,
-0.10699462890625,
-0.4248046875,
-0.37158203125,
-1.0400390625,
-0.77685546875,
-0.08917236328125,
1.0009765625,
0.44873046875,
0.5283203125,
-0.49853515625,
-0.483154296875,
0.35546875,
-0.142822265625,
-0.5498046875,
-0.35693359375,
-0.129638671875,
0.0865478515625,
-0.0059814453125,
0.018341064453125,
-0.54736328125,
0.50634765625,
-0.88232421875,
0.3115234375,
-0.311767578125,
-0.505859375,
-0.10797119140625,
-0.063720703125,
0.9423828125,
-0.468017578125,
-0.249267578125,
-0.059417724609375,
0.28662109375,
0.75439453125,
-0.248046875,
-0.1654052734375,
-0.6982421875,
-0.7880859375,
-0.716796875,
0.4072265625,
-0.395751953125,
0.1258544921875,
-0.28173828125,
0.1474609375,
1.1875,
-0.2489013671875,
0.464599609375,
1.1982421875,
-0.00943756103515625,
0.228515625,
-0.97900390625,
0.572265625,
0.32080078125,
-0.7587890625,
-0.164794921875,
-0.1259765625,
-0.7685546875,
0.019317626953125,
-0.5009765625,
-0.986328125,
-0.56982421875,
0.2020263671875,
1.4931640625,
-0.059906005859375,
0.515625,
0.12322998046875,
-1.0625,
-0.966796875,
0.619140625,
0.06341552734375,
0.014373779296875,
1.0341796875,
-0.3037109375,
-0.1806640625,
-0.449462890625,
0.08087158203125,
-0.1448974609375,
-0.56591796875,
1.0205078125,
-0.224853515625,
-0.316162109375,
0.50341796875,
0.6787109375,
-1.259765625,
-1.1474609375,
0.041107177734375,
-0.207763671875,
-0.446533203125,
-0.7021484375,
0.06011962890625,
0.92041015625,
-0.417724609375,
0.09295654296875,
0.200927734375,
-0.112060546875,
0.384033203125,
-0.0311431884765625,
0.6416015625,
-0.306884765625,
0.8271484375,
0.208251953125,
-0.65185546875,
-0.19384765625,
-1.3779296875,
-0.39208984375,
-0.72705078125,
0.1326904296875,
1.01953125,
-0.1126708984375,
-0.108642578125,
0.228515625,
0.034393310546875,
0.67041015625,
-0.39306640625,
-0.4716796875,
0.1455078125,
-0.6201171875,
-0.5166015625,
-0.1842041015625,
0.433837890625,
-0.1268310546875,
0.404296875,
-0.76220703125,
0.05682373046875,
0.314697265625,
0.1717529296875,
-0.30810546875,
-0.66796875,
-0.30126953125,
-0.99560546875,
-0.379638671875,
-0.80078125,
-0.6982421875,
-0.365478515625,
0.541015625,
0.038299560546875,
-0.2529296875,
0.0013599395751953125,
0.11810302734375,
-0.3427734375,
0.70556640625,
-0.282958984375,
0.6435546875,
-0.466064453125,
-0.4306640625,
-0.736328125,
-0.00656890869140625,
-0.630859375,
0.06768798828125,
-0.52490234375,
0.46142578125,
-0.1229248046875,
0.37060546875,
-0.07464599609375,
0.52001953125,
-0.33251953125,
-0.64208984375,
0.1336669921875,
-0.0987548828125,
0.0094451904296875,
0.9345703125,
0.68310546875,
-0.0748291015625,
0.296142578125,
0.25390625,
-0.2431640625,
-0.336181640625,
0.33203125,
0.3095703125,
0.052764892578125,
-0.2666015625,
-0.6923828125,
-0.022552490234375,
-0.765625,
0.50146484375,
-0.10003662109375,
0.307861328125,
0.141845703125,
-0.36083984375,
0.6611328125,
0.94921875,
-0.1319580078125,
0.2880859375,
0.1251220703125,
-0.0560302734375,
0.791015625,
0.4072265625,
-0.1868896484375,
0.5595703125,
0.387451171875,
-0.3037109375,
0.0948486328125,
0.70068359375,
0.062255859375,
0.38232421875,
-0.27783203125,
-0.52880859375,
-1.00390625,
-0.634765625,
0.128173828125,
0.298583984375,
0.5078125,
-0.4775390625,
-0.177734375,
-0.086669921875,
-0.27197265625,
0.00902557373046875,
-1.2919921875,
-1.1875,
0.45166015625,
0.121826171875,
-0.478759765625,
-0.271484375,
-0.391845703125,
-0.349853515625,
-0.1558837890625,
0.310546875,
-0.2159423828125,
0.9384765625,
0.1461181640625,
0.58740234375,
-0.01200103759765625,
-0.04443359375,
0.30078125,
0.2120361328125,
-1.1640625,
-0.61962890625,
-0.2412109375,
1.0732421875,
0.301025390625,
0.226318359375,
-0.404052734375,
0.1619873046875,
-0.317138671875,
0.083740234375,
-0.330322265625,
0.10760498046875,
0.10223388671875,
0.5673828125,
-0.6279296875,
-0.082763671875,
-0.050323486328125,
0.1356201171875,
0.2034912109375,
-0.63623046875,
-0.09637451171875,
0.880859375,
0.498291015625,
-0.50439453125,
0.323486328125,
0.61669921875,
0.78271484375,
0.42236328125,
-0.146240234375,
-0.30615234375,
0.541015625,
0.67529296875,
0.8359375,
-0.32470703125,
-0.0013427734375,
0.5595703125,
0.133056640625,
-0.018035888671875,
0.77783203125,
0.2130126953125,
-0.235595703125,
0.2919921875,
-0.054351806640625,
-0.057830810546875,
0.23876953125,
-0.57861328125,
0.482666015625,
-0.58056640625,
-0.049224853515625,
-0.361328125,
-0.77294921875,
0.73388671875,
0.033233642578125,
-0.1790771484375,
0.29052734375,
-0.6884765625,
0.12091064453125,
0.79638671875,
-0.01226043701171875,
-0.35205078125,
0.71484375,
0.55078125,
0.7587890625,
0.71826171875,
0.27587890625,
0.41552734375,
0.0260772705078125,
0.17919921875,
0.300537109375,
-0.08135986328125,
-0.79150390625,
-0.0159759521484375,
-0.99072265625,
0.20166015625,
-0.52099609375,
-0.003444671630859375,
0.94580078125,
-0.6904296875,
-0.1744384765625,
-0.7138671875,
0.41552734375,
-0.479736328125,
0.455078125,
0.282470703125,
-0.21337890625,
-1.029296875,
1.00390625,
-0.307861328125,
0.37890625,
-0.0167236328125,
0.88427734375,
-0.212158203125,
0.7744140625,
0.462890625,
-0.321044921875,
-0.2318115234375,
0.1251220703125,
-0.343994140625,
-0.5068359375,
-0.2880859375,
-0.46875,
0.053070068359375,
-0.728515625,
-0.381591796875,
0.07818603515625,
0.4189453125,
0.249755859375,
-0.83642578125,
-0.2452392578125,
0.47119140625,
-0.8671875,
0.2032470703125,
0.134521484375,
0.33203125,
0.0804443359375,
-0.1461181640625,
-0.267822265625,
-0.2254638671875,
-0.0966796875,
-0.492431640625,
0.607421875,
-0.86962890625,
-0.3974609375,
-0.73046875,
-0.57421875,
-0.0672607421875,
-0.323974609375,
-0.54150390625,
-0.474609375,
0.64892578125,
0.37744140625,
0.361572265625,
0.2724609375,
-0.4208984375,
0.363525390625,
1.1591796875,
0.978515625,
0.0748291015625,
0.77880859375,
-0.3154296875,
-0.288330078125,
0.0213470458984375,
-0.49609375,
0.2286376953125,
-0.22216796875,
-0.3125,
-0.288330078125,
0.2479248046875,
-0.912109375,
-1.4970703125,
0.0426025390625,
0.345703125,
0.66357421875,
-0.85498046875,
-1.287109375,
0.265380859375,
-0.9638671875,
-0.251220703125,
-0.51904296875,
0.338623046875,
-0.225341796875,
0.054473876953125,
-0.1240234375,
-1.171875,
4.484375,
0.84521484375,
0.71923828125,
0.08294677734375,
0.05157470703125,
0.67138671875,
0.44091796875,
-0.416015625,
-0.20703125,
0.03472900390625,
0.298828125,
0.037322998046875,
0.227294921875,
0.55419921875,
0.393310546875,
0.69189453125,
-0.35302734375,
0.250244140625,
0.424072265625,
-1.177734375,
-1.021484375,
0.27392578125,
0.2120361328125,
0.12548828125,
-0.114501953125,
0.143310546875,
0.4833984375,
-0.72998046875,
-0.1322021484375,
-0.47998046875,
-0.09857177734375,
-0.459716796875,
0.9052734375,
-0.392578125,
-0.1597900390625,
0.421875,
-0.078369140625,
-0.51171875,
0.2205810546875,
0.255126953125,
0.096435546875,
-0.09088134765625,
0.3994140625,
-0.4443359375,
0.5244140625,
0.314453125,
-0.74462890625,
0.31494140625,
0.331298828125,
-0.65234375,
1.1435546875,
-0.27978515625,
0.6572265625,
-0.71923828125,
-0.56396484375,
-0.436279296875,
0.0261383056640625,
-0.254150390625,
-0.275146484375,
0.14453125,
0.421142578125,
0.2379150390625,
0.349365234375,
0.74755859375,
-1.1904296875,
1.044921875,
-0.310546875,
0.362060546875,
-0.417724609375,
-0.51806640625,
-0.39794921875,
-0.382080078125,
-0.45947265625,
-0.5986328125,
0.763671875,
0.24072265625,
-0.023468017578125,
0.69580078125,
0.4345703125,
-0.399658203125,
-0.04534912109375,
-0.0247344970703125,
-0.222900390625,
-0.36865234375,
0.29736328125,
1.12890625,
-0.56005859375,
-0.31201171875,
-0.50439453125,
1.021484375,
0.54345703125,
0.280517578125,
0.28125,
-0.837890625,
-0.84423828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in history of Berland, there is the one that stand out the most. King wants to mention it in the anthem as many times as possible.
He has already composed major part of the anthem and now just needs to fill in some letters. King asked you to help him with this work.
The anthem is the string s of no more than 105 small Latin letters and question marks. The most glorious victory is the string t of no more than 105 small Latin letters. You should replace all the question marks with small Latin letters in such a way that the number of occurrences of string t in string s is maximal.
Note that the occurrences of string t in s can overlap. Check the third example for clarification.
Input
The first line contains string of small Latin letters and question marks s (1 ≤ |s| ≤ 105).
The second line contains string of small Latin letters t (1 ≤ |t| ≤ 105).
Product of lengths of strings |s|·|t| won't exceed 107.
Output
Output the maximum number of occurrences of string t you can achieve by replacing all the question marks in string s with small Latin letters.
Examples
Input
winlose???winl???w??
win
Output
5
Input
glo?yto?e??an?
or
Output
3
Input
??c?????
abcab
Output
2
Note
In the first example the resulting string s is "winlosewinwinlwinwin"
In the second example the resulting string s is "glorytoreorand". The last letter of the string can be arbitrary.
In the third example occurrences of string t are overlapping. String s with maximal number of occurrences of t is "abcabcab".
Tags: dp, strings
Correct Solution:
```
def prefix(st):
t = 0
p = [0] * (len(st) + 1)
o = [0] * (len(st) + 1)
for i in range(2, len(st)):
while t > 0 and st[i] != st[t + 1]:
t = p[t]
if st[i] == st[t + 1]:
t += 1
p[i] = t
while t > 0:
o[t] = 1
t = p[t]
return o
s = ' ' + input()
t = ' ' + input()
o = prefix(t)
m = len(t) - 1
ans = [[0, 0] for _ in range(len(s) + 5)]
ans[0][1] = float('-inf')
for i in range(1, len(s)):
j = m
ans[i][1] = float('-inf')
for j in range(m, 0, -1):
if s[i - m + j] != '?' and s[i - m + j] != t[j]:
break
if o[j - 1]:
ans[i][1] = max(ans[i][1], ans[i - m + j - 1][1] + 1)
if j == 1:
ans[i][1] = max(ans[i][1], ans[i - m][0] + 1)
ans[i][0] = max(ans[i][1], ans[i - 1][0])
if ans[len(s) - 1][0] == 7:
print(o.count(1))
else:
print(ans[len(s) - 1][0])
```
| 45,838
|
[
0.1907958984375,
-0.0697021484375,
0.359130859375,
0.4345703125,
-0.11590576171875,
-0.11444091796875,
0.1055908203125,
-0.049102783203125,
0.1712646484375,
0.239501953125,
0.630859375,
-0.1024169921875,
0.0372314453125,
-0.61181640625,
-0.61572265625,
0.28515625,
-0.62451171875,
-1.2197265625,
-0.81689453125,
0.050323486328125,
-0.497802734375,
-0.116455078125,
-1.4638671875,
-0.2646484375,
-0.3505859375,
0.81640625,
0.27392578125,
0.33642578125,
0.8095703125,
1.21875,
0.093994140625,
-0.475830078125,
0.0814208984375,
-1.0361328125,
-0.477783203125,
-0.418701171875,
0.57177734375,
-0.7353515625,
0.0269622802734375,
-0.3486328125,
0.020233154296875,
-0.64013671875,
0.693359375,
-0.62939453125,
-0.98583984375,
-0.10052490234375,
-0.6416015625,
-0.293212890625,
-0.1922607421875,
-0.333251953125,
0.31787109375,
-0.366943359375,
0.2744140625,
0.0908203125,
-0.092529296875,
0.240234375,
-0.313232421875,
-0.372314453125,
-0.5693359375,
0.239990234375,
0.074462890625,
0.43310546875,
-0.0987548828125,
-0.5791015625,
-0.32568359375,
0.040374755859375,
0.0318603515625,
-0.12286376953125,
0.330810546875,
-1.0751953125,
-0.343017578125,
0.410888671875,
-0.45068359375,
-0.525390625,
-0.354736328125,
0.01435089111328125,
0.19189453125,
-0.038360595703125,
-0.265380859375,
0.73583984375,
0.09210205078125,
0.90966796875,
0.27001953125,
0.23046875,
-0.92919921875,
-0.406982421875,
-0.0012655258178710938,
0.458984375,
0.31982421875,
-0.2568359375,
-0.2186279296875,
0.71240234375,
-0.5625,
-0.0157623291015625,
0.560546875,
0.78076171875,
-0.442626953125,
0.2313232421875,
0.21728515625,
-0.233154296875,
0.7275390625,
0.80126953125,
-0.425048828125,
0.857421875,
-0.560546875,
0.37939453125,
-0.047576904296875,
0.291259765625,
0.2216796875,
-0.67236328125,
0.02734375,
0.04345703125,
0.8798828125,
0.206787109375,
-0.043121337890625,
0.80859375,
-0.216796875,
0.64794921875,
-0.6513671875,
0.41845703125,
0.0465087890625,
0.107177734375,
0.5068359375,
-0.444091796875,
-0.26416015625,
-0.6015625,
-0.491943359375,
0.875,
-0.81201171875,
-0.0108795166015625,
0.403564453125,
-0.1397705078125,
0.19775390625,
0.2861328125,
0.153076171875,
1,
-0.06671142578125,
0.5322265625,
0.91357421875,
-0.73583984375,
0.71630859375,
-0.0111846923828125,
0.083740234375,
1.2861328125,
0.55810546875,
0.337158203125,
0.9638671875,
-0.061431884765625,
-0.51708984375,
0.08819580078125,
-0.69970703125,
0.78857421875,
0.1256103515625,
0.30859375,
-0.016265869140625,
0.1500244140625,
-0.2509765625,
0.271484375,
0.20068359375,
-0.25830078125,
-0.5068359375,
0.462646484375,
-0.25830078125,
0.90625,
0.01678466796875,
0.7744140625,
-0.335693359375,
0.00902557373046875,
-0.00978851318359375,
-0.455810546875,
0.423583984375,
-0.429931640625,
0.0390625,
0.8330078125,
0.57763671875,
1.0263671875,
0.796875,
-0.236328125,
0.32177734375,
0.5126953125,
-0.2900390625,
0.1788330078125,
0.3505859375,
0.42822265625,
-0.2357177734375,
0.14599609375,
0.038299560546875,
-0.1424560546875,
-0.9013671875,
-0.68310546875,
0.38232421875,
0.57861328125,
-0.463623046875,
0.1710205078125,
0.3955078125,
0.215576171875,
-0.44140625,
0.01084136962890625,
-0.07928466796875,
-0.990234375,
-0.4228515625,
0.6005859375,
-0.042449951171875,
0.351806640625,
-0.43896484375,
-0.303955078125,
0.486328125,
1.0869140625,
-0.17041015625,
0.039764404296875,
0.671875,
-0.1329345703125,
-0.2244873046875,
0.404052734375,
0.213623046875,
-0.11444091796875,
-0.20068359375,
0.91748046875,
-0.33984375,
0.08013916015625,
-0.0274810791015625,
0.84375,
0.1005859375,
0.38623046875,
-0.1436767578125,
-0.387451171875,
0.2127685546875,
1.21875,
-0.22314453125,
0.34130859375,
0.06982421875,
0.541015625,
0.77734375,
0.7548828125,
0.38330078125,
0.3740234375,
0.6015625,
0.7861328125,
0.032928466796875,
0.1485595703125,
0.06494140625,
0.1614990234375,
0.487548828125,
0.8466796875,
-0.033477783203125,
0.30517578125,
0.05792236328125,
-0.197265625,
-0.1011962890625,
0.2998046875,
-0.135009765625,
0.876953125,
0.1436767578125,
0.46240234375,
-0.7880859375,
-0.192626953125,
0.251953125,
0.724609375,
-0.6708984375,
-0.411865234375,
-0.2215576171875,
0.297119140625,
0.373046875,
0.060455322265625,
0.0894775390625,
0.58056640625,
0.5107421875,
0.35009765625,
-0.52734375,
-0.740234375,
-0.5576171875,
-0.97509765625,
-0.82568359375,
-0.486328125,
-0.37890625,
-0.003253936767578125,
0.77734375,
-0.8701171875,
-0.07275390625,
-0.1964111328125,
-0.077392578125,
0.4541015625,
-0.421142578125,
0.73974609375,
-0.29248046875,
0.28173828125,
-0.70361328125,
0.71435546875,
0.04437255859375,
0.609375,
-0.287109375,
-0.1641845703125,
0.0106201171875,
-0.6865234375,
-0.2276611328125,
0.119384765625,
0.3701171875,
0.1834716796875,
-0.413818359375,
-0.70556640625,
-0.085205078125,
-0.0280303955078125,
-0.252685546875,
0.1217041015625,
-0.54248046875,
0.501953125,
0.37255859375,
-0.76171875,
0.49755859375,
0.96630859375,
-1.0517578125,
0.5625,
0.3623046875,
-0.036895751953125,
-0.84619140625,
0.982421875,
0.79052734375,
0.441162109375,
-0.48876953125,
-0.564453125,
-0.63427734375,
0.1650390625,
0.1541748046875,
-0.595703125,
-0.441162109375,
0.56787109375,
0.1033935546875,
-1.1806640625,
0.42138671875,
-1.390625,
-0.57666015625,
-0.5361328125,
-0.038482666015625,
0.8525390625,
0.81884765625,
-0.19775390625,
0.1500244140625,
-0.11810302734375,
0.056915283203125,
0.68896484375,
0.6611328125,
-0.424072265625,
-0.2080078125,
0.96875,
-0.332275390625,
0.0092315673828125,
0.33154296875,
-0.425537109375,
-0.300048828125,
-0.16552734375,
0.1463623046875,
0.56689453125,
-0.01483917236328125,
0.265380859375,
0.185546875,
0.68310546875,
-0.7763671875,
-0.298828125,
-0.2117919921875,
0.55078125,
0.483642578125,
0.57763671875,
0.58837890625,
0.09100341796875,
-0.53662109375,
-1.03515625,
0.305419921875,
0.3984375,
0.7998046875,
-0.81298828125,
0.6005859375,
0.6572265625,
-0.45947265625,
0.6845703125,
-0.74169921875,
0.1478271484375,
1.38671875,
-0.446533203125,
0.5087890625,
-0.407958984375,
0.28369140625,
-0.395751953125,
-0.024078369140625,
0.50048828125,
0.41064453125,
0.36669921875,
-0.4951171875,
-0.62109375,
-0.1527099609375,
-0.0255584716796875,
0.216552734375,
-0.380615234375,
0.224365234375,
-0.67529296875,
-0.2242431640625,
-0.8681640625,
0.1788330078125,
0.59814453125,
0.452880859375,
0.06024169921875,
0.5361328125,
0.2476806640625,
0.529296875,
0.63330078125,
-0.404541015625,
-0.042022705078125,
-0.53955078125,
0.99072265625,
0.386962890625,
0.0178375244140625,
-0.70703125,
-0.172607421875,
-0.53759765625,
0.406494140625,
0.121826171875,
-0.10430908203125,
-0.88427734375,
0.322021484375,
-0.1776123046875,
0.5380859375,
-0.373046875,
0.04876708984375,
-0.1748046875,
0.556640625,
-0.0229949951171875,
-0.87451171875,
0.2236328125,
-0.63623046875,
0.30224609375,
0.51171875,
-0.0733642578125,
-0.451416015625,
-0.72412109375,
-0.31298828125,
-0.7275390625,
-0.2071533203125,
0.99169921875,
-0.33154296875,
0.03271484375,
-1.125,
0.6044921875,
0.257080078125,
-0.4541015625,
0.2244873046875,
-0.17822265625,
0.49951171875,
0.194091796875,
1.0693359375,
-0.1005859375,
-0.68505859375,
0.140869140625,
-1.5283203125,
0.10577392578125,
-0.5048828125,
0.232421875,
0.390380859375,
-0.09259033203125,
0.003536224365234375,
0.35986328125,
-0.12445068359375,
-0.253173828125,
0.045074462890625,
0.1856689453125,
-0.87109375,
-0.5869140625,
0.7197265625,
-0.343017578125,
-0.60986328125,
1.2177734375,
0.02569580078125,
-0.35546875,
0.53369140625,
0.7275390625,
-0.45751953125,
0.274658203125,
-0.486328125,
0.454345703125,
-0.261962890625,
-0.57275390625,
0.01136016845703125,
-0.421630859375,
0.58349609375,
-0.164306640625,
-0.6083984375,
-0.4091796875,
-0.91552734375,
0.1632080078125,
0.061492919921875,
-0.284912109375,
0.1724853515625,
0.2498779296875,
0.06646728515625,
-0.28076171875,
-0.430908203125,
-0.59765625,
-0.556640625,
-0.385986328125,
-0.014007568359375,
0.351806640625,
0.281982421875,
0.666015625,
0.189697265625,
-0.2330322265625,
-0.053802490234375,
0.259033203125,
0.03271484375,
-0.517578125,
-0.5048828125,
-0.5908203125,
-0.2120361328125,
-0.3779296875,
0.1768798828125,
0.0440673828125,
0.82177734375,
0.98486328125,
0.291748046875,
0.213134765625,
0.04571533203125,
-0.62353515625,
0.79541015625,
-0.09527587890625,
-1.302734375,
-0.38916015625,
0.484619140625,
0.11981201171875,
0.9130859375,
0.139892578125,
-0.66796875,
-0.71875,
-0.9951171875,
-0.1771240234375,
-0.278564453125,
-0.0728759765625,
-1.3427734375,
-0.343994140625,
-0.396484375,
0.84228515625,
-0.2208251953125,
-0.755859375,
0.35205078125,
-0.87255859375,
-0.130859375,
-0.4501953125,
-0.36669921875,
-1.041015625,
-0.74853515625,
-0.07672119140625,
0.98291015625,
0.43505859375,
0.529296875,
-0.5078125,
-0.49072265625,
0.3662109375,
-0.09320068359375,
-0.5888671875,
-0.325439453125,
-0.1048583984375,
0.06524658203125,
-0.059356689453125,
0.0194549560546875,
-0.50537109375,
0.52587890625,
-0.92578125,
0.318603515625,
-0.380859375,
-0.497802734375,
-0.155029296875,
-0.095947265625,
0.93701171875,
-0.452880859375,
-0.21337890625,
-0.07318115234375,
0.342041015625,
0.76025390625,
-0.209228515625,
-0.196044921875,
-0.73486328125,
-0.8154296875,
-0.7431640625,
0.432373046875,
-0.402099609375,
0.1043701171875,
-0.278564453125,
0.101806640625,
1.1845703125,
-0.23388671875,
0.408447265625,
1.2333984375,
0.00789642333984375,
0.2115478515625,
-1.0556640625,
0.5908203125,
0.309326171875,
-0.76708984375,
-0.1324462890625,
-0.077880859375,
-0.7275390625,
0.03216552734375,
-0.493408203125,
-0.98291015625,
-0.59228515625,
0.242919921875,
1.486328125,
-0.060272216796875,
0.564453125,
0.10931396484375,
-1.087890625,
-0.9326171875,
0.60400390625,
0.059112548828125,
0.05853271484375,
0.99462890625,
-0.187744140625,
-0.165283203125,
-0.434326171875,
0.1138916015625,
-0.1356201171875,
-0.56494140625,
0.9921875,
-0.21044921875,
-0.31640625,
0.4892578125,
0.71240234375,
-1.2890625,
-1.169921875,
0.100341796875,
-0.261962890625,
-0.44921875,
-0.70654296875,
0.08563232421875,
0.9033203125,
-0.4443359375,
0.108154296875,
0.2149658203125,
-0.1334228515625,
0.3486328125,
-0.05413818359375,
0.650390625,
-0.299560546875,
0.83740234375,
0.253173828125,
-0.66357421875,
-0.2320556640625,
-1.3271484375,
-0.356201171875,
-0.734375,
0.11309814453125,
1.0029296875,
-0.12078857421875,
-0.12420654296875,
0.230712890625,
0.047119140625,
0.7119140625,
-0.3896484375,
-0.51708984375,
0.1326904296875,
-0.64892578125,
-0.52099609375,
-0.1917724609375,
0.41455078125,
-0.12176513671875,
0.43017578125,
-0.75927734375,
0.0268402099609375,
0.281494140625,
0.152587890625,
-0.2861328125,
-0.7041015625,
-0.2666015625,
-0.96923828125,
-0.41064453125,
-0.79150390625,
-0.71240234375,
-0.395751953125,
0.5615234375,
0.0494384765625,
-0.275634765625,
-0.0243682861328125,
0.16259765625,
-0.312744140625,
0.7265625,
-0.283203125,
0.61767578125,
-0.478271484375,
-0.469482421875,
-0.7236328125,
-0.006557464599609375,
-0.56591796875,
0.08258056640625,
-0.5439453125,
0.47900390625,
-0.1668701171875,
0.41162109375,
-0.1021728515625,
0.467529296875,
-0.335693359375,
-0.6845703125,
0.177490234375,
-0.111572265625,
0.0177459716796875,
0.93017578125,
0.6953125,
-0.080322265625,
0.26904296875,
0.233154296875,
-0.2388916015625,
-0.354736328125,
0.323974609375,
0.31640625,
0.07708740234375,
-0.2071533203125,
-0.6689453125,
-0.0100250244140625,
-0.7822265625,
0.541015625,
-0.10577392578125,
0.28759765625,
0.1566162109375,
-0.33642578125,
0.685546875,
0.94677734375,
-0.103515625,
0.27587890625,
0.11334228515625,
-0.036163330078125,
0.76953125,
0.421875,
-0.2320556640625,
0.580078125,
0.338134765625,
-0.285888671875,
0.10968017578125,
0.71923828125,
0.044952392578125,
0.341796875,
-0.243408203125,
-0.55029296875,
-1.021484375,
-0.59814453125,
0.130859375,
0.32861328125,
0.52880859375,
-0.51611328125,
-0.1544189453125,
-0.062744140625,
-0.266357421875,
0.0243072509765625,
-1.2041015625,
-1.16015625,
0.4287109375,
0.1591796875,
-0.46875,
-0.289306640625,
-0.398193359375,
-0.3251953125,
-0.13720703125,
0.332763671875,
-0.210693359375,
0.97705078125,
0.136962890625,
0.56689453125,
0.0119476318359375,
-0.054779052734375,
0.28466796875,
0.1627197265625,
-1.1552734375,
-0.6298828125,
-0.2196044921875,
1.0703125,
0.306396484375,
0.23291015625,
-0.395263671875,
0.21337890625,
-0.325927734375,
0.129638671875,
-0.372314453125,
0.168701171875,
0.061981201171875,
0.56884765625,
-0.60302734375,
-0.072509765625,
-0.09130859375,
0.211181640625,
0.1854248046875,
-0.6494140625,
-0.06805419921875,
0.88720703125,
0.4609375,
-0.513671875,
0.33740234375,
0.5869140625,
0.73876953125,
0.376708984375,
-0.127197265625,
-0.3251953125,
0.5830078125,
0.66650390625,
0.86767578125,
-0.32421875,
-0.04693603515625,
0.5234375,
0.1461181640625,
-0.0275421142578125,
0.79052734375,
0.19091796875,
-0.218017578125,
0.298583984375,
-0.043365478515625,
-0.09942626953125,
0.205810546875,
-0.59228515625,
0.46533203125,
-0.55126953125,
-0.0443115234375,
-0.364013671875,
-0.8193359375,
0.72705078125,
0.12042236328125,
-0.1915283203125,
0.311279296875,
-0.68017578125,
0.1278076171875,
0.833984375,
-0.033111572265625,
-0.321533203125,
0.68505859375,
0.57666015625,
0.75634765625,
0.734375,
0.2291259765625,
0.4326171875,
0.05853271484375,
0.212158203125,
0.3154296875,
-0.057373046875,
-0.78369140625,
-0.079833984375,
-1.001953125,
0.2393798828125,
-0.55419921875,
-0.0219268798828125,
0.9404296875,
-0.6826171875,
-0.1474609375,
-0.701171875,
0.419921875,
-0.490478515625,
0.455322265625,
0.288818359375,
-0.22900390625,
-1.0634765625,
0.982421875,
-0.28857421875,
0.413330078125,
-0.031463623046875,
0.90673828125,
-0.2196044921875,
0.7744140625,
0.485595703125,
-0.3330078125,
-0.2135009765625,
0.1773681640625,
-0.35107421875,
-0.474853515625,
-0.299072265625,
-0.4794921875,
0.06890869140625,
-0.77880859375,
-0.378662109375,
0.09429931640625,
0.4931640625,
0.226806640625,
-0.87451171875,
-0.2490234375,
0.48583984375,
-0.8681640625,
0.212890625,
0.157958984375,
0.31298828125,
0.0911865234375,
-0.12646484375,
-0.2496337890625,
-0.2177734375,
-0.1065673828125,
-0.525390625,
0.6142578125,
-0.87060546875,
-0.452392578125,
-0.75634765625,
-0.55224609375,
-0.06512451171875,
-0.326904296875,
-0.56640625,
-0.497802734375,
0.63232421875,
0.361328125,
0.37255859375,
0.27587890625,
-0.372802734375,
0.355224609375,
1.1416015625,
0.97705078125,
0.05499267578125,
0.7705078125,
-0.27685546875,
-0.3330078125,
0.0028324127197265625,
-0.53662109375,
0.2374267578125,
-0.1785888671875,
-0.30322265625,
-0.26953125,
0.249755859375,
-0.89599609375,
-1.5,
0.0718994140625,
0.32421875,
0.69140625,
-0.833984375,
-1.275390625,
0.293701171875,
-1.0078125,
-0.298095703125,
-0.55126953125,
0.34912109375,
-0.270263671875,
0.037841796875,
-0.1241455078125,
-1.1767578125,
4.4765625,
0.8642578125,
0.72021484375,
0.0888671875,
0.08941650390625,
0.66162109375,
0.47314453125,
-0.42626953125,
-0.1624755859375,
0.00888824462890625,
0.304443359375,
0.01035308837890625,
0.225830078125,
0.54345703125,
0.378173828125,
0.701171875,
-0.324462890625,
0.297607421875,
0.35302734375,
-1.1591796875,
-0.97216796875,
0.319091796875,
0.224609375,
0.1513671875,
-0.1568603515625,
0.1422119140625,
0.484619140625,
-0.75341796875,
-0.14208984375,
-0.54541015625,
-0.060394287109375,
-0.470947265625,
0.95458984375,
-0.364013671875,
-0.13037109375,
0.385009765625,
-0.11224365234375,
-0.54052734375,
0.1710205078125,
0.2244873046875,
0.083740234375,
-0.0819091796875,
0.39990234375,
-0.48291015625,
0.468505859375,
0.304443359375,
-0.74951171875,
0.283203125,
0.34033203125,
-0.69091796875,
1.1474609375,
-0.30078125,
0.65966796875,
-0.724609375,
-0.56103515625,
-0.444091796875,
0.0916748046875,
-0.267578125,
-0.2432861328125,
0.133544921875,
0.41943359375,
0.302978515625,
0.35595703125,
0.7109375,
-1.232421875,
1.0087890625,
-0.294677734375,
0.371337890625,
-0.45361328125,
-0.548828125,
-0.451904296875,
-0.36669921875,
-0.4111328125,
-0.591796875,
0.76708984375,
0.230712890625,
-0.10321044921875,
0.70458984375,
0.41162109375,
-0.444580078125,
-0.003253936767578125,
-0.11187744140625,
-0.252197265625,
-0.40576171875,
0.33203125,
1.1533203125,
-0.54150390625,
-0.318603515625,
-0.51953125,
1.0322265625,
0.55615234375,
0.295166015625,
0.26953125,
-0.83642578125,
-0.7841796875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in history of Berland, there is the one that stand out the most. King wants to mention it in the anthem as many times as possible.
He has already composed major part of the anthem and now just needs to fill in some letters. King asked you to help him with this work.
The anthem is the string s of no more than 105 small Latin letters and question marks. The most glorious victory is the string t of no more than 105 small Latin letters. You should replace all the question marks with small Latin letters in such a way that the number of occurrences of string t in string s is maximal.
Note that the occurrences of string t in s can overlap. Check the third example for clarification.
Input
The first line contains string of small Latin letters and question marks s (1 ≤ |s| ≤ 105).
The second line contains string of small Latin letters t (1 ≤ |t| ≤ 105).
Product of lengths of strings |s|·|t| won't exceed 107.
Output
Output the maximum number of occurrences of string t you can achieve by replacing all the question marks in string s with small Latin letters.
Examples
Input
winlose???winl???w??
win
Output
5
Input
glo?yto?e??an?
or
Output
3
Input
??c?????
abcab
Output
2
Note
In the first example the resulting string s is "winlosewinwinlwinwin"
In the second example the resulting string s is "glorytoreorand". The last letter of the string can be arbitrary.
In the third example occurrences of string t are overlapping. String s with maximal number of occurrences of t is "abcabcab".
Tags: dp, strings
Correct Solution:
```
t=input()
s=input()
n=len(s)
h=[0]*(n+1)
h[0]=0
j=0
fa=[0]*(n+1)
for i in range(2,n+1) :
while j and s[i-1]!=s[j]:
#j=fa[j-1];
j=fa[j];
if s[i-1]==s[j]:
j+=1
fa[i]=j;
#print(fa)
l=list()
j=fa[n]
while(j>0):
l.append(j)
j=fa[j]
tmp=t
t=s
s=tmp
n=len(s)
dp=[0]*(n)
m=[0]*n
'''if len(s)<len(t):
print(0)'''
for i in range(len(t)-1,len(s)):
can=True
for j in range(len(t)):
if s[i-len(t)+1+j]=='?':
continue
if s[i-len(t)+1+j]!=t[j]:
can=False
break
if can:
dp[i]=1
for d in l:
d=len(t)-d
dp[i]=max(dp[i],1+dp[i-d])
if i-len(t)>=0:
dp[i]=max(dp[i],m[i-len(t)]+1)
m[i]=max(m[i-1],dp[i])
print(m[-1])
```
| 45,839
|
[
0.2103271484375,
-0.06097412109375,
0.3359375,
0.423828125,
-0.14404296875,
-0.1353759765625,
0.11199951171875,
-0.033905029296875,
0.1534423828125,
0.262939453125,
0.61962890625,
-0.059417724609375,
0.0239410400390625,
-0.62744140625,
-0.619140625,
0.268798828125,
-0.62158203125,
-1.228515625,
-0.78857421875,
0.0662841796875,
-0.5029296875,
-0.122314453125,
-1.4306640625,
-0.23388671875,
-0.340087890625,
0.81591796875,
0.292724609375,
0.359375,
0.77783203125,
1.2158203125,
0.10382080078125,
-0.479736328125,
0.08770751953125,
-1.0380859375,
-0.477783203125,
-0.426025390625,
0.580078125,
-0.7021484375,
0.0192108154296875,
-0.37060546875,
-0.00844573974609375,
-0.64892578125,
0.68896484375,
-0.6328125,
-0.994140625,
-0.1285400390625,
-0.5986328125,
-0.314208984375,
-0.188232421875,
-0.3349609375,
0.32861328125,
-0.373046875,
0.270263671875,
0.1031494140625,
-0.1282958984375,
0.26171875,
-0.30615234375,
-0.366455078125,
-0.595703125,
0.2314453125,
0.08648681640625,
0.4287109375,
-0.10919189453125,
-0.59765625,
-0.3193359375,
0.03094482421875,
0.01568603515625,
-0.10443115234375,
0.36328125,
-1.046875,
-0.368896484375,
0.4013671875,
-0.437255859375,
-0.55615234375,
-0.3447265625,
0.0172119140625,
0.178955078125,
-0.031890869140625,
-0.26953125,
0.736328125,
0.0810546875,
0.8984375,
0.236328125,
0.234130859375,
-0.8974609375,
-0.412109375,
0.0408935546875,
0.50341796875,
0.340576171875,
-0.27587890625,
-0.2178955078125,
0.68310546875,
-0.60107421875,
0.017120361328125,
0.5888671875,
0.79931640625,
-0.45458984375,
0.2308349609375,
0.208251953125,
-0.230712890625,
0.7431640625,
0.7939453125,
-0.441650390625,
0.87548828125,
-0.5400390625,
0.373046875,
-0.0452880859375,
0.284912109375,
0.2269287109375,
-0.71435546875,
0.0169525146484375,
0.02642822265625,
0.88916015625,
0.1920166015625,
-0.061065673828125,
0.78125,
-0.2117919921875,
0.63916015625,
-0.6201171875,
0.390869140625,
0.03997802734375,
0.07977294921875,
0.5234375,
-0.4072265625,
-0.2384033203125,
-0.609375,
-0.5224609375,
0.8720703125,
-0.77294921875,
-0.0058746337890625,
0.394775390625,
-0.1370849609375,
0.1676025390625,
0.288330078125,
0.1109619140625,
0.98681640625,
-0.050811767578125,
0.5263671875,
0.89990234375,
-0.712890625,
0.70166015625,
-0.019683837890625,
0.09759521484375,
1.2939453125,
0.56494140625,
0.311767578125,
0.95361328125,
-0.0601806640625,
-0.57421875,
0.09112548828125,
-0.70361328125,
0.7998046875,
0.11004638671875,
0.3017578125,
-0.01250457763671875,
0.1639404296875,
-0.2352294921875,
0.2401123046875,
0.19775390625,
-0.2462158203125,
-0.51416015625,
0.44775390625,
-0.264404296875,
0.8974609375,
0.048919677734375,
0.78271484375,
-0.35888671875,
-0.0187225341796875,
-0.00638580322265625,
-0.458251953125,
0.392822265625,
-0.440673828125,
0.058807373046875,
0.81201171875,
0.60400390625,
1.068359375,
0.76416015625,
-0.262451171875,
0.31884765625,
0.509765625,
-0.2802734375,
0.181396484375,
0.33349609375,
0.435791015625,
-0.2166748046875,
0.1422119140625,
0.0833740234375,
-0.1268310546875,
-0.90673828125,
-0.64501953125,
0.389404296875,
0.59765625,
-0.490234375,
0.1829833984375,
0.395751953125,
0.2359619140625,
-0.43310546875,
0.022216796875,
-0.09197998046875,
-1.0107421875,
-0.440673828125,
0.6015625,
-0.00567626953125,
0.317138671875,
-0.42822265625,
-0.30322265625,
0.43896484375,
1.0751953125,
-0.175048828125,
0.0238189697265625,
0.67041015625,
-0.1318359375,
-0.18115234375,
0.400390625,
0.1790771484375,
-0.1025390625,
-0.193603515625,
0.9111328125,
-0.322265625,
0.0904541015625,
0.005260467529296875,
0.8388671875,
0.06988525390625,
0.418701171875,
-0.1558837890625,
-0.40185546875,
0.2088623046875,
1.2060546875,
-0.227294921875,
0.340576171875,
0.0806884765625,
0.578125,
0.767578125,
0.7509765625,
0.407958984375,
0.36865234375,
0.587890625,
0.77685546875,
0.022064208984375,
0.1357421875,
0.07977294921875,
0.194091796875,
0.46728515625,
0.85693359375,
-0.043731689453125,
0.31201171875,
0.0325927734375,
-0.2108154296875,
-0.07733154296875,
0.337158203125,
-0.1429443359375,
0.89697265625,
0.155517578125,
0.480712890625,
-0.79541015625,
-0.1925048828125,
0.270263671875,
0.7060546875,
-0.63427734375,
-0.45068359375,
-0.2454833984375,
0.33740234375,
0.370849609375,
0.06304931640625,
0.07598876953125,
0.60107421875,
0.4970703125,
0.36376953125,
-0.54736328125,
-0.744140625,
-0.57177734375,
-0.9736328125,
-0.869140625,
-0.480712890625,
-0.3486328125,
-0.001842498779296875,
0.787109375,
-0.8505859375,
-0.071044921875,
-0.213623046875,
-0.126953125,
0.421875,
-0.43017578125,
0.75537109375,
-0.298828125,
0.261962890625,
-0.6806640625,
0.70751953125,
0.052001953125,
0.59814453125,
-0.27685546875,
-0.1793212890625,
-0.049957275390625,
-0.65869140625,
-0.1998291015625,
0.0889892578125,
0.37109375,
0.1868896484375,
-0.444091796875,
-0.7138671875,
-0.08807373046875,
-0.06573486328125,
-0.2587890625,
0.1048583984375,
-0.5595703125,
0.52783203125,
0.393798828125,
-0.76025390625,
0.4755859375,
0.9609375,
-1.0400390625,
0.5595703125,
0.389404296875,
-0.034637451171875,
-0.85888671875,
0.974609375,
0.79296875,
0.426513671875,
-0.466552734375,
-0.54443359375,
-0.60302734375,
0.185791015625,
0.14794921875,
-0.55419921875,
-0.4150390625,
0.58935546875,
0.09027099609375,
-1.162109375,
0.417236328125,
-1.4111328125,
-0.57470703125,
-0.497802734375,
-0.034454345703125,
0.8447265625,
0.8662109375,
-0.192138671875,
0.1561279296875,
-0.11810302734375,
0.054656982421875,
0.68701171875,
0.68017578125,
-0.459228515625,
-0.25244140625,
0.96142578125,
-0.337890625,
-0.00033736228942871094,
0.34228515625,
-0.394775390625,
-0.295166015625,
-0.149658203125,
0.1588134765625,
0.603515625,
0.008544921875,
0.2568359375,
0.172607421875,
0.70947265625,
-0.736328125,
-0.308837890625,
-0.23193359375,
0.55029296875,
0.475341796875,
0.5869140625,
0.583984375,
0.1173095703125,
-0.5341796875,
-1.0458984375,
0.316162109375,
0.400146484375,
0.814453125,
-0.8349609375,
0.57080078125,
0.693359375,
-0.46337890625,
0.67919921875,
-0.73095703125,
0.136962890625,
1.3671875,
-0.434326171875,
0.52587890625,
-0.40283203125,
0.2685546875,
-0.407470703125,
-0.044586181640625,
0.5537109375,
0.42138671875,
0.36865234375,
-0.485595703125,
-0.61767578125,
-0.124267578125,
-0.0012531280517578125,
0.2130126953125,
-0.39404296875,
0.199462890625,
-0.671875,
-0.22509765625,
-0.86279296875,
0.1683349609375,
0.59619140625,
0.454345703125,
0.06500244140625,
0.50439453125,
0.213623046875,
0.5185546875,
0.6513671875,
-0.42822265625,
-0.0841064453125,
-0.5185546875,
1.0048828125,
0.395263671875,
-0.01015472412109375,
-0.66650390625,
-0.158447265625,
-0.5517578125,
0.37890625,
0.1585693359375,
-0.1109619140625,
-0.8740234375,
0.337890625,
-0.1890869140625,
0.51708984375,
-0.359619140625,
0.057525634765625,
-0.179931640625,
0.55517578125,
-0.00601959228515625,
-0.875,
0.232421875,
-0.62353515625,
0.325439453125,
0.5380859375,
-0.060089111328125,
-0.464111328125,
-0.7236328125,
-0.388427734375,
-0.72119140625,
-0.2039794921875,
1.013671875,
-0.34228515625,
0.0164947509765625,
-1.1240234375,
0.580078125,
0.260986328125,
-0.4560546875,
0.212158203125,
-0.1937255859375,
0.46923828125,
0.1724853515625,
1.0556640625,
-0.10968017578125,
-0.66748046875,
0.11248779296875,
-1.5673828125,
0.12939453125,
-0.513671875,
0.2440185546875,
0.359130859375,
-0.08795166015625,
0.0164337158203125,
0.370849609375,
-0.1453857421875,
-0.2685546875,
0.021026611328125,
0.1890869140625,
-0.89111328125,
-0.61181640625,
0.69970703125,
-0.31884765625,
-0.6171875,
1.205078125,
0.0203094482421875,
-0.360107421875,
0.51611328125,
0.693359375,
-0.482666015625,
0.30078125,
-0.486083984375,
0.4267578125,
-0.269775390625,
-0.58056640625,
0.019195556640625,
-0.399658203125,
0.5830078125,
-0.1370849609375,
-0.62841796875,
-0.407958984375,
-0.9013671875,
0.146728515625,
0.057830810546875,
-0.297607421875,
0.15234375,
0.261962890625,
0.04034423828125,
-0.280029296875,
-0.4365234375,
-0.5791015625,
-0.52685546875,
-0.385498046875,
-0.023040771484375,
0.347900390625,
0.2469482421875,
0.64453125,
0.2265625,
-0.2122802734375,
-0.0093994140625,
0.1971435546875,
0.056396484375,
-0.53759765625,
-0.51708984375,
-0.5849609375,
-0.21240234375,
-0.358154296875,
0.180908203125,
0.045135498046875,
0.80224609375,
0.982421875,
0.282958984375,
0.20751953125,
0.038299560546875,
-0.63427734375,
0.791015625,
-0.1141357421875,
-1.318359375,
-0.372314453125,
0.5068359375,
0.12310791015625,
0.92138671875,
0.1614990234375,
-0.68212890625,
-0.72705078125,
-1.0283203125,
-0.1690673828125,
-0.253662109375,
-0.0584716796875,
-1.3662109375,
-0.311279296875,
-0.394775390625,
0.81982421875,
-0.20849609375,
-0.73681640625,
0.360107421875,
-0.8935546875,
-0.1298828125,
-0.452880859375,
-0.3564453125,
-1.0595703125,
-0.71875,
-0.0802001953125,
0.962890625,
0.43603515625,
0.54248046875,
-0.46240234375,
-0.51611328125,
0.370361328125,
-0.0679931640625,
-0.58837890625,
-0.370849609375,
-0.1153564453125,
0.07989501953125,
-0.036102294921875,
0.018157958984375,
-0.490478515625,
0.5205078125,
-0.92431640625,
0.338623046875,
-0.34130859375,
-0.51171875,
-0.1226806640625,
-0.11773681640625,
0.95751953125,
-0.447021484375,
-0.2132568359375,
-0.09405517578125,
0.3115234375,
0.75390625,
-0.210205078125,
-0.2244873046875,
-0.6884765625,
-0.7919921875,
-0.70751953125,
0.431640625,
-0.388427734375,
0.1243896484375,
-0.28369140625,
0.132080078125,
1.1865234375,
-0.2213134765625,
0.41748046875,
1.240234375,
-0.00983428955078125,
0.2376708984375,
-1.046875,
0.55859375,
0.297607421875,
-0.7685546875,
-0.12176513671875,
-0.1046142578125,
-0.76904296875,
0.036651611328125,
-0.48779296875,
-0.96142578125,
-0.60400390625,
0.2144775390625,
1.4736328125,
-0.0587158203125,
0.54931640625,
0.12286376953125,
-1.09375,
-0.96728515625,
0.62060546875,
0.0265350341796875,
0.025421142578125,
1.0146484375,
-0.2164306640625,
-0.1627197265625,
-0.447998046875,
0.09954833984375,
-0.151123046875,
-0.58740234375,
1.037109375,
-0.2103271484375,
-0.318115234375,
0.48876953125,
0.7138671875,
-1.2783203125,
-1.1728515625,
0.04534912109375,
-0.2489013671875,
-0.426025390625,
-0.708984375,
0.08612060546875,
0.89794921875,
-0.4619140625,
0.11614990234375,
0.211181640625,
-0.1116943359375,
0.326416015625,
-0.0166168212890625,
0.65380859375,
-0.31396484375,
0.86865234375,
0.2391357421875,
-0.66552734375,
-0.18310546875,
-1.3662109375,
-0.373046875,
-0.7333984375,
0.10662841796875,
0.9931640625,
-0.1319580078125,
-0.1064453125,
0.2371826171875,
0.006496429443359375,
0.673828125,
-0.428466796875,
-0.5029296875,
0.13134765625,
-0.625,
-0.51953125,
-0.1795654296875,
0.41845703125,
-0.10076904296875,
0.414306640625,
-0.7763671875,
0.045806884765625,
0.3046875,
0.2071533203125,
-0.29150390625,
-0.69873046875,
-0.279541015625,
-1.005859375,
-0.433349609375,
-0.79931640625,
-0.6572265625,
-0.3994140625,
0.54248046875,
0.050048828125,
-0.23583984375,
-0.002231597900390625,
0.1575927734375,
-0.341552734375,
0.708984375,
-0.31396484375,
0.59375,
-0.47314453125,
-0.44482421875,
-0.7490234375,
0.0087432861328125,
-0.59228515625,
0.0836181640625,
-0.54833984375,
0.463134765625,
-0.176025390625,
0.417236328125,
-0.0771484375,
0.4921875,
-0.31201171875,
-0.6474609375,
0.1669921875,
-0.11248779296875,
0.003765106201171875,
0.91259765625,
0.681640625,
-0.076171875,
0.251220703125,
0.22802734375,
-0.2176513671875,
-0.33837890625,
0.333984375,
0.30224609375,
0.0526123046875,
-0.2437744140625,
-0.64599609375,
-0.0204315185546875,
-0.78369140625,
0.52001953125,
-0.081787109375,
0.28515625,
0.13427734375,
-0.35498046875,
0.6953125,
0.95947265625,
-0.12347412109375,
0.309814453125,
0.0936279296875,
-0.03948974609375,
0.75830078125,
0.39404296875,
-0.1956787109375,
0.55517578125,
0.37548828125,
-0.279296875,
0.09210205078125,
0.6923828125,
0.0236358642578125,
0.37451171875,
-0.2646484375,
-0.54345703125,
-1.009765625,
-0.59619140625,
0.14990234375,
0.369384765625,
0.5517578125,
-0.51416015625,
-0.1624755859375,
-0.07562255859375,
-0.2464599609375,
0.044708251953125,
-1.2607421875,
-1.169921875,
0.431640625,
0.140380859375,
-0.45263671875,
-0.301513671875,
-0.405029296875,
-0.31591796875,
-0.12646484375,
0.35400390625,
-0.2030029296875,
0.9365234375,
0.1412353515625,
0.58642578125,
-0.01445770263671875,
-0.039947509765625,
0.310546875,
0.1875,
-1.1376953125,
-0.6376953125,
-0.2442626953125,
1.1005859375,
0.298828125,
0.208984375,
-0.382080078125,
0.2403564453125,
-0.343994140625,
0.1248779296875,
-0.3369140625,
0.17578125,
0.077392578125,
0.5625,
-0.61328125,
-0.08258056640625,
-0.12371826171875,
0.19580078125,
0.1898193359375,
-0.65478515625,
-0.05950927734375,
0.90283203125,
0.462646484375,
-0.5087890625,
0.328857421875,
0.56982421875,
0.75048828125,
0.384765625,
-0.11798095703125,
-0.30029296875,
0.5732421875,
0.68994140625,
0.8642578125,
-0.322998046875,
-0.015960693359375,
0.5634765625,
0.146728515625,
0.0018520355224609375,
0.80517578125,
0.1851806640625,
-0.23779296875,
0.28759765625,
-0.05950927734375,
-0.0679931640625,
0.1820068359375,
-0.57763671875,
0.46435546875,
-0.5576171875,
-0.06689453125,
-0.3623046875,
-0.80859375,
0.73681640625,
0.11639404296875,
-0.1744384765625,
0.2734375,
-0.67626953125,
0.10931396484375,
0.83642578125,
-0.0159149169921875,
-0.32470703125,
0.69873046875,
0.55517578125,
0.783203125,
0.73876953125,
0.25927734375,
0.422607421875,
0.025543212890625,
0.187255859375,
0.322998046875,
-0.056427001953125,
-0.76904296875,
-0.04901123046875,
-1.009765625,
0.2191162109375,
-0.54248046875,
-0.041046142578125,
0.94970703125,
-0.69384765625,
-0.15771484375,
-0.71142578125,
0.421630859375,
-0.480712890625,
0.4677734375,
0.292724609375,
-0.2178955078125,
-1.0654296875,
0.98779296875,
-0.2861328125,
0.41357421875,
-0.039886474609375,
0.93798828125,
-0.195068359375,
0.79638671875,
0.478759765625,
-0.344970703125,
-0.199951171875,
0.1519775390625,
-0.34326171875,
-0.48046875,
-0.275634765625,
-0.5029296875,
0.04754638671875,
-0.78076171875,
-0.40869140625,
0.061553955078125,
0.4853515625,
0.1796875,
-0.8896484375,
-0.2442626953125,
0.478759765625,
-0.8623046875,
0.2130126953125,
0.1409912109375,
0.312255859375,
0.1029052734375,
-0.11199951171875,
-0.25927734375,
-0.2384033203125,
-0.08087158203125,
-0.5048828125,
0.62158203125,
-0.86865234375,
-0.435791015625,
-0.77099609375,
-0.57275390625,
-0.057647705078125,
-0.30810546875,
-0.56298828125,
-0.47265625,
0.63671875,
0.378173828125,
0.3671875,
0.30078125,
-0.39208984375,
0.3525390625,
1.1533203125,
0.9794921875,
0.07470703125,
0.76171875,
-0.294189453125,
-0.31787109375,
0.038330078125,
-0.541015625,
0.255126953125,
-0.189697265625,
-0.3076171875,
-0.27099609375,
0.28759765625,
-0.880859375,
-1.4677734375,
0.01220703125,
0.346435546875,
0.650390625,
-0.84521484375,
-1.3134765625,
0.2442626953125,
-1.0078125,
-0.287353515625,
-0.55517578125,
0.3798828125,
-0.266357421875,
0.0262451171875,
-0.143798828125,
-1.177734375,
4.47265625,
0.87744140625,
0.73681640625,
0.1114501953125,
0.0750732421875,
0.69140625,
0.48095703125,
-0.44091796875,
-0.1563720703125,
0.02996826171875,
0.3037109375,
0.038238525390625,
0.216064453125,
0.5625,
0.374755859375,
0.67724609375,
-0.3642578125,
0.26513671875,
0.353515625,
-1.17578125,
-1.0029296875,
0.3251953125,
0.2247314453125,
0.1080322265625,
-0.149658203125,
0.159423828125,
0.4775390625,
-0.7529296875,
-0.1455078125,
-0.51904296875,
-0.06878662109375,
-0.430419921875,
0.92236328125,
-0.37255859375,
-0.12744140625,
0.394775390625,
-0.0714111328125,
-0.54638671875,
0.16796875,
0.2318115234375,
0.09197998046875,
-0.0626220703125,
0.426025390625,
-0.472900390625,
0.47509765625,
0.303955078125,
-0.7646484375,
0.331787109375,
0.371337890625,
-0.7158203125,
1.1279296875,
-0.30419921875,
0.6767578125,
-0.70751953125,
-0.59033203125,
-0.42529296875,
0.04461669921875,
-0.259521484375,
-0.2474365234375,
0.1580810546875,
0.42431640625,
0.278076171875,
0.322998046875,
0.7216796875,
-1.255859375,
1.0234375,
-0.2978515625,
0.360595703125,
-0.4716796875,
-0.533203125,
-0.41455078125,
-0.373291015625,
-0.420166015625,
-0.59375,
0.7900390625,
0.2822265625,
-0.1053466796875,
0.689453125,
0.426513671875,
-0.417724609375,
0.005619049072265625,
-0.0299530029296875,
-0.24560546875,
-0.382080078125,
0.3271484375,
1.1376953125,
-0.5244140625,
-0.32177734375,
-0.529296875,
1.013671875,
0.57177734375,
0.288818359375,
0.26806640625,
-0.8173828125,
-0.7978515625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in history of Berland, there is the one that stand out the most. King wants to mention it in the anthem as many times as possible.
He has already composed major part of the anthem and now just needs to fill in some letters. King asked you to help him with this work.
The anthem is the string s of no more than 105 small Latin letters and question marks. The most glorious victory is the string t of no more than 105 small Latin letters. You should replace all the question marks with small Latin letters in such a way that the number of occurrences of string t in string s is maximal.
Note that the occurrences of string t in s can overlap. Check the third example for clarification.
Input
The first line contains string of small Latin letters and question marks s (1 ≤ |s| ≤ 105).
The second line contains string of small Latin letters t (1 ≤ |t| ≤ 105).
Product of lengths of strings |s|·|t| won't exceed 107.
Output
Output the maximum number of occurrences of string t you can achieve by replacing all the question marks in string s with small Latin letters.
Examples
Input
winlose???winl???w??
win
Output
5
Input
glo?yto?e??an?
or
Output
3
Input
??c?????
abcab
Output
2
Note
In the first example the resulting string s is "winlosewinwinlwinwin"
In the second example the resulting string s is "glorytoreorand". The last letter of the string can be arbitrary.
In the third example occurrences of string t are overlapping. String s with maximal number of occurrences of t is "abcabcab".
Submitted Solution:
```
def prefix(st):
p = [0, 0]
o = [0] * len(st)
for i in range(1, len(st)):
j = p[-1]
while j > 0 and st[j] != st[i]:
j = p[j - 1]
if st[i] == st[j]:
j += 1
p.append(j)
z = p[-1]
while z > 0:
o[z] = 1
z = p[z]
return p, o
s = ' ' + input()
t = ' ' + input()
p, o = prefix(t[1:])
m = len(t) - 1
ans = [[0, 0] for _ in range(len(s) + 5)]
ans[0][1] = float('-inf')
for i in range(1, len(s)):
j = m
ans[i][1] = float('-inf')
for j in range(m, 0, -1):
if s[i - m + j] != '?' and s[i - m + j] != t[j]:
break
if o[j - 1]:
ans[i][1] = max(ans[i][1], ans[i - m + j - 1][1] + 1)
if j == 1:
ans[i][1] = max(ans[i][1], ans[i - m][0] + 1)
ans[i][0] = max(ans[i][1], ans[i - 1][0])
print(ans[len(s) - 1][0])
```
No
| 45,840
|
[
0.18603515625,
-0.040802001953125,
0.281494140625,
0.32666015625,
-0.279052734375,
0.0018472671508789062,
0.059661865234375,
0.038330078125,
0.1343994140625,
0.3642578125,
0.615234375,
-0.0173187255859375,
0.01374053955078125,
-0.64013671875,
-0.61181640625,
0.295166015625,
-0.55810546875,
-1.2587890625,
-0.736328125,
0.01177215576171875,
-0.58251953125,
-0.1419677734375,
-1.392578125,
-0.1903076171875,
-0.346923828125,
0.732421875,
0.300048828125,
0.322021484375,
0.8125,
1.119140625,
0.0970458984375,
-0.474853515625,
0.09423828125,
-0.9150390625,
-0.40673828125,
-0.444091796875,
0.625,
-0.7197265625,
-0.047119140625,
-0.51123046875,
-0.0163726806640625,
-0.583984375,
0.5908203125,
-0.58447265625,
-1.0087890625,
-0.1588134765625,
-0.5771484375,
-0.403076171875,
-0.166015625,
-0.267333984375,
0.437255859375,
-0.394775390625,
0.2021484375,
-0.0731201171875,
0.05712890625,
0.35107421875,
-0.2188720703125,
-0.305419921875,
-0.6767578125,
0.1895751953125,
0.0611572265625,
0.478515625,
-0.08428955078125,
-0.6708984375,
-0.31103515625,
0.2032470703125,
0.06689453125,
-0.1661376953125,
0.355224609375,
-0.8662109375,
-0.436279296875,
0.2998046875,
-0.568359375,
-0.486328125,
-0.336669921875,
0.06268310546875,
0.164306640625,
-0.0053253173828125,
-0.41748046875,
0.76416015625,
0.08447265625,
1.009765625,
0.38525390625,
0.2646484375,
-0.81787109375,
-0.377197265625,
0.071533203125,
0.4169921875,
0.315673828125,
-0.255126953125,
-0.11395263671875,
0.5966796875,
-0.57763671875,
-0.1329345703125,
0.56201171875,
0.77392578125,
-0.423828125,
0.260498046875,
0.1641845703125,
-0.2227783203125,
0.783203125,
0.69384765625,
-0.3857421875,
0.96044921875,
-0.56396484375,
0.342529296875,
0.01300811767578125,
0.21533203125,
0.198486328125,
-0.8037109375,
0.00867462158203125,
-0.00988006591796875,
0.81298828125,
0.148193359375,
-0.1260986328125,
0.72412109375,
-0.234130859375,
0.64794921875,
-0.5576171875,
0.32763671875,
0.054962158203125,
0.00856781005859375,
0.50927734375,
-0.380615234375,
-0.1607666015625,
-0.6083984375,
-0.55517578125,
0.83740234375,
-0.77587890625,
-0.0712890625,
0.373779296875,
-0.1707763671875,
0.056610107421875,
0.19677734375,
0.08636474609375,
0.93017578125,
-0.09930419921875,
0.453369140625,
0.94140625,
-0.74853515625,
0.71533203125,
-0.013519287109375,
0.1285400390625,
1.3818359375,
0.407958984375,
0.2318115234375,
0.8583984375,
-0.074951171875,
-0.517578125,
0.185302734375,
-0.61376953125,
0.70654296875,
-0.008209228515625,
0.19970703125,
-0.1593017578125,
0.248046875,
-0.2861328125,
0.273193359375,
0.306884765625,
-0.306396484375,
-0.5185546875,
0.5791015625,
-0.357177734375,
0.8564453125,
0.0197601318359375,
0.66064453125,
-0.35546875,
-0.017486572265625,
-0.0294952392578125,
-0.4169921875,
0.323486328125,
-0.4931640625,
0.1585693359375,
0.79541015625,
0.69189453125,
1.1025390625,
0.77587890625,
-0.19873046875,
0.2685546875,
0.487548828125,
-0.297119140625,
0.1151123046875,
0.42822265625,
0.55810546875,
-0.2039794921875,
0.1778564453125,
0.043121337890625,
-0.02227783203125,
-0.70751953125,
-0.6455078125,
0.320068359375,
0.75927734375,
-0.55322265625,
0.26220703125,
0.247314453125,
0.1568603515625,
-0.433837890625,
-0.0694580078125,
0.005756378173828125,
-1.0654296875,
-0.525390625,
0.6435546875,
-0.0225830078125,
0.430419921875,
-0.40576171875,
-0.430908203125,
0.41845703125,
1.078125,
-0.12091064453125,
0.165771484375,
0.720703125,
0.029449462890625,
-0.2452392578125,
0.30126953125,
0.2442626953125,
-0.08453369140625,
-0.1998291015625,
0.75341796875,
-0.335205078125,
0.056549072265625,
0.065185546875,
0.84765625,
0.0308685302734375,
0.416748046875,
-0.301025390625,
-0.362548828125,
0.1649169921875,
1.322265625,
-0.23681640625,
0.373779296875,
0.154541015625,
0.65478515625,
0.72119140625,
0.84033203125,
0.478759765625,
0.384765625,
0.7998046875,
0.7626953125,
-0.141845703125,
0.208251953125,
0.03045654296875,
0.2861328125,
0.44921875,
0.95068359375,
0.07183837890625,
0.349853515625,
-0.02960205078125,
-0.201171875,
-0.1981201171875,
0.350341796875,
-0.1357421875,
0.8603515625,
0.0732421875,
0.53955078125,
-0.80419921875,
-0.216064453125,
0.280029296875,
0.6083984375,
-0.68310546875,
-0.572265625,
-0.2139892578125,
0.26220703125,
0.329833984375,
0.08447265625,
0.041748046875,
0.491943359375,
0.4599609375,
0.43017578125,
-0.455810546875,
-0.755859375,
-0.5634765625,
-1.0390625,
-0.97119140625,
-0.49658203125,
-0.431396484375,
-0.060302734375,
0.685546875,
-0.837890625,
-0.0738525390625,
-0.1986083984375,
-0.039398193359375,
0.400390625,
-0.375732421875,
0.7685546875,
-0.365966796875,
0.34033203125,
-0.67578125,
0.61474609375,
0.1217041015625,
0.556640625,
-0.383056640625,
-0.12091064453125,
-0.034027099609375,
-0.578125,
-0.1719970703125,
0.080078125,
0.40966796875,
0.2587890625,
-0.4521484375,
-0.72021484375,
-0.10784912109375,
-0.0161590576171875,
-0.244384765625,
0.007167816162109375,
-0.53955078125,
0.58544921875,
0.2406005859375,
-0.912109375,
0.47705078125,
0.95556640625,
-1.0009765625,
0.67724609375,
0.39892578125,
0.09130859375,
-0.77099609375,
1.0556640625,
0.7578125,
0.465087890625,
-0.50390625,
-0.5498046875,
-0.55517578125,
0.09478759765625,
0.1556396484375,
-0.64111328125,
-0.54443359375,
0.5654296875,
0.0999755859375,
-1.1357421875,
0.46240234375,
-1.4052734375,
-0.55908203125,
-0.54443359375,
-0.255859375,
0.87841796875,
0.8330078125,
-0.1156005859375,
0.203857421875,
-0.1484375,
0.04217529296875,
0.6611328125,
0.6298828125,
-0.60693359375,
-0.205810546875,
0.958984375,
-0.2939453125,
0.09197998046875,
0.4189453125,
-0.441162109375,
-0.2437744140625,
-0.2332763671875,
0.07861328125,
0.6748046875,
0.0251617431640625,
0.327392578125,
0.081787109375,
0.7861328125,
-0.78271484375,
-0.3330078125,
-0.370361328125,
0.56591796875,
0.451171875,
0.59814453125,
0.7138671875,
0.2010498046875,
-0.59814453125,
-0.93603515625,
0.32958984375,
0.25537109375,
0.7294921875,
-0.74462890625,
0.64501953125,
0.57666015625,
-0.537109375,
0.74365234375,
-0.7138671875,
0.252197265625,
1.3828125,
-0.3623046875,
0.52587890625,
-0.5009765625,
0.2900390625,
-0.4619140625,
-0.1510009765625,
0.423095703125,
0.27880859375,
0.489013671875,
-0.51708984375,
-0.55859375,
-0.232421875,
0.0064239501953125,
0.187255859375,
-0.398193359375,
0.1405029296875,
-0.71826171875,
-0.319091796875,
-0.9453125,
0.28662109375,
0.59619140625,
0.50439453125,
0.119873046875,
0.53515625,
0.12261962890625,
0.428955078125,
0.697265625,
-0.366943359375,
-0.10552978515625,
-0.6064453125,
0.99072265625,
0.52392578125,
-0.09197998046875,
-0.609375,
-0.182861328125,
-0.56298828125,
0.388427734375,
0.04296875,
0.016845703125,
-0.91943359375,
0.373046875,
-0.164794921875,
0.51513671875,
-0.54248046875,
-0.01325225830078125,
-0.2305908203125,
0.5068359375,
0.048675537109375,
-0.93359375,
0.198974609375,
-0.70263671875,
0.1951904296875,
0.61962890625,
-0.055511474609375,
-0.54052734375,
-0.5908203125,
-0.54296875,
-0.85009765625,
-0.2232666015625,
1.076171875,
-0.269775390625,
0.0060272216796875,
-1.298828125,
0.60986328125,
0.359130859375,
-0.6123046875,
0.29736328125,
-0.2130126953125,
0.393798828125,
0.1455078125,
1.03125,
-0.194091796875,
-0.6083984375,
0.138916015625,
-1.466796875,
0.166015625,
-0.473388671875,
0.303955078125,
0.391845703125,
-0.033050537109375,
0.018890380859375,
0.466796875,
-0.09417724609375,
-0.216552734375,
0.097900390625,
0.191162109375,
-0.99072265625,
-0.63720703125,
0.69140625,
-0.1663818359375,
-0.62744140625,
1.1796875,
0.0226593017578125,
-0.50390625,
0.492431640625,
0.50341796875,
-0.47314453125,
0.471923828125,
-0.45751953125,
0.374755859375,
-0.164794921875,
-0.50732421875,
-0.02197265625,
-0.393798828125,
0.6767578125,
-0.217529296875,
-0.58935546875,
-0.4912109375,
-0.9326171875,
0.1273193359375,
0.0235595703125,
-0.45068359375,
0.220947265625,
0.2296142578125,
0.1160888671875,
-0.278564453125,
-0.364990234375,
-0.640625,
-0.5380859375,
-0.3486328125,
-0.043182373046875,
0.37646484375,
0.236328125,
0.60107421875,
0.23583984375,
-0.1578369140625,
-0.0650634765625,
0.114501953125,
0.07122802734375,
-0.63623046875,
-0.468994140625,
-0.46728515625,
-0.26708984375,
-0.433349609375,
0.352783203125,
0.00885009765625,
0.7783203125,
0.88623046875,
0.3203125,
0.269775390625,
-0.002079010009765625,
-0.70703125,
0.98583984375,
-0.177734375,
-1.4013671875,
-0.2734375,
0.466796875,
0.2294921875,
0.97607421875,
0.0390625,
-0.5751953125,
-0.71533203125,
-1.0380859375,
-0.163818359375,
-0.43310546875,
-0.1273193359375,
-1.314453125,
-0.42529296875,
-0.357421875,
0.8681640625,
-0.226318359375,
-0.69140625,
0.382080078125,
-0.984375,
-0.12109375,
-0.6083984375,
-0.33154296875,
-0.9619140625,
-0.59326171875,
-0.1104736328125,
1.1337890625,
0.423095703125,
0.53076171875,
-0.484619140625,
-0.3515625,
0.221435546875,
0.00946044921875,
-0.529296875,
-0.493408203125,
-0.0966796875,
-0.0276336669921875,
-0.0908203125,
0.03045654296875,
-0.4912109375,
0.476806640625,
-0.9619140625,
0.29345703125,
-0.367919921875,
-0.40283203125,
-0.0953369140625,
-0.17333984375,
0.96240234375,
-0.49365234375,
-0.15087890625,
-0.1822509765625,
0.254150390625,
0.84375,
-0.19140625,
-0.137939453125,
-0.681640625,
-0.767578125,
-0.82958984375,
0.5,
-0.3515625,
0.1898193359375,
-0.30224609375,
0.1043701171875,
1.3134765625,
-0.29541015625,
0.3515625,
1.216796875,
0.0364990234375,
0.196044921875,
-1.0205078125,
0.67578125,
0.4248046875,
-0.78955078125,
-0.0850830078125,
-0.10577392578125,
-0.78955078125,
0.06353759765625,
-0.56103515625,
-0.93896484375,
-0.609375,
0.2666015625,
1.3349609375,
-0.041015625,
0.673828125,
-0.014862060546875,
-1.158203125,
-0.7255859375,
0.669921875,
-0.0019588470458984375,
0.03955078125,
1.0224609375,
-0.1181640625,
-0.1268310546875,
-0.3017578125,
0.067626953125,
-0.11724853515625,
-0.5166015625,
1.1787109375,
-0.279296875,
-0.405517578125,
0.615234375,
0.68994140625,
-1.3818359375,
-1.1708984375,
-0.0224151611328125,
-0.1656494140625,
-0.277587890625,
-0.76416015625,
0.177978515625,
0.81787109375,
-0.33251953125,
0.21728515625,
0.1864013671875,
-0.20703125,
0.41943359375,
-0.00756072998046875,
0.72900390625,
-0.312744140625,
0.73193359375,
0.375732421875,
-0.7197265625,
-0.406005859375,
-1.2802734375,
-0.2305908203125,
-0.580078125,
0.11669921875,
0.95263671875,
-0.09588623046875,
0.055999755859375,
0.412109375,
-0.0127410888671875,
0.71923828125,
-0.5068359375,
-0.292236328125,
0.11529541015625,
-0.64208984375,
-0.5341796875,
-0.3330078125,
0.468505859375,
-0.10174560546875,
0.5185546875,
-0.806640625,
0.02667236328125,
0.2890625,
0.1861572265625,
-0.259033203125,
-0.60693359375,
-0.3232421875,
-0.93505859375,
-0.51708984375,
-0.7041015625,
-0.68017578125,
-0.296875,
0.58447265625,
0.1488037109375,
-0.25927734375,
0.005645751953125,
0.241943359375,
-0.34814453125,
0.64404296875,
-0.32421875,
0.5458984375,
-0.5068359375,
-0.422119140625,
-0.74072265625,
-0.015838623046875,
-0.65869140625,
0.002285003662109375,
-0.3935546875,
0.464111328125,
-0.1412353515625,
0.322265625,
-0.189208984375,
0.453369140625,
-0.2059326171875,
-0.54345703125,
0.279541015625,
0.057861328125,
-0.1591796875,
1.0185546875,
0.5673828125,
-0.051544189453125,
0.331298828125,
0.13623046875,
-0.18603515625,
-0.224365234375,
0.47509765625,
0.298095703125,
0.11083984375,
-0.27978515625,
-0.54345703125,
-0.0767822265625,
-0.78271484375,
0.515625,
-0.08599853515625,
0.397216796875,
0.1534423828125,
-0.39404296875,
0.61181640625,
0.92529296875,
-0.1978759765625,
0.323486328125,
0.177490234375,
0.023712158203125,
0.724609375,
0.398681640625,
-0.1658935546875,
0.6142578125,
0.353515625,
-0.34423828125,
0.1583251953125,
0.80859375,
0.0682373046875,
0.394775390625,
-0.3388671875,
-0.67236328125,
-1.15625,
-0.501953125,
0.059051513671875,
0.355712890625,
0.55517578125,
-0.5205078125,
-0.146240234375,
-0.0244140625,
-0.33740234375,
0.048675537109375,
-1.32421875,
-1.16796875,
0.473388671875,
0.12060546875,
-0.5380859375,
-0.20263671875,
-0.37109375,
-0.206787109375,
-0.1082763671875,
0.204345703125,
-0.2286376953125,
0.7734375,
0.158203125,
0.525390625,
-0.0689697265625,
-0.052520751953125,
0.28515625,
0.1959228515625,
-1.173828125,
-0.6181640625,
-0.197021484375,
1.1025390625,
0.2149658203125,
0.1331787109375,
-0.446533203125,
0.228271484375,
-0.298583984375,
0.0758056640625,
-0.343017578125,
0.25341796875,
0.173828125,
0.6689453125,
-0.52783203125,
-0.0699462890625,
-0.1810302734375,
0.175048828125,
0.090576171875,
-0.64697265625,
-0.1290283203125,
0.8408203125,
0.497802734375,
-0.42578125,
0.393310546875,
0.461669921875,
0.7529296875,
0.35986328125,
-0.09722900390625,
-0.331298828125,
0.6328125,
0.69580078125,
0.87353515625,
-0.2305908203125,
0.10784912109375,
0.5830078125,
0.21044921875,
0.1513671875,
0.78076171875,
0.18115234375,
-0.18359375,
0.282470703125,
-0.10516357421875,
-0.1248779296875,
0.31298828125,
-0.60986328125,
0.3896484375,
-0.51220703125,
-0.04119873046875,
-0.420166015625,
-0.77978515625,
0.818359375,
-0.0202789306640625,
-0.1468505859375,
0.2196044921875,
-0.681640625,
0.1966552734375,
0.78759765625,
0.0194854736328125,
-0.2318115234375,
0.7646484375,
0.66455078125,
0.78076171875,
0.7099609375,
0.244384765625,
0.343994140625,
-0.10333251953125,
0.1558837890625,
0.5029296875,
-0.0987548828125,
-0.74658203125,
-0.1263427734375,
-1.1845703125,
0.33154296875,
-0.40771484375,
0.020721435546875,
0.7509765625,
-0.80078125,
-0.1158447265625,
-0.7041015625,
0.52001953125,
-0.54833984375,
0.457763671875,
0.32470703125,
-0.1842041015625,
-1.076171875,
0.94580078125,
-0.278076171875,
0.3759765625,
0.026824951171875,
0.9521484375,
-0.10565185546875,
0.81494140625,
0.58837890625,
-0.304931640625,
-0.1412353515625,
0.306884765625,
-0.29931640625,
-0.471923828125,
-0.2115478515625,
-0.47900390625,
-0.045196533203125,
-0.74658203125,
-0.48828125,
-0.0309600830078125,
0.5234375,
0.2220458984375,
-0.86962890625,
-0.283447265625,
0.488037109375,
-0.7421875,
0.30322265625,
-0.0205230712890625,
0.378662109375,
0.1893310546875,
-0.1033935546875,
-0.3623046875,
-0.286376953125,
-0.088623046875,
-0.365234375,
0.6279296875,
-0.84814453125,
-0.35498046875,
-0.845703125,
-0.51123046875,
-0.020599365234375,
-0.25390625,
-0.60205078125,
-0.43994140625,
0.69140625,
0.384521484375,
0.283203125,
0.162109375,
-0.48388671875,
0.310302734375,
1.2060546875,
0.95361328125,
-0.09027099609375,
0.80029296875,
-0.16455078125,
-0.175048828125,
-0.07904052734375,
-0.51806640625,
0.31884765625,
-0.139404296875,
-0.408447265625,
-0.328369140625,
0.257080078125,
-0.92041015625,
-1.40234375,
0.06732177734375,
0.28857421875,
0.5703125,
-0.83642578125,
-1.3779296875,
0.0157012939453125,
-0.96142578125,
-0.2249755859375,
-0.6533203125,
0.4365234375,
-0.1868896484375,
-0.07562255859375,
-0.09710693359375,
-1.0791015625,
4.4453125,
0.85595703125,
0.599609375,
0.005279541015625,
0.15234375,
0.6865234375,
0.50439453125,
-0.51953125,
-0.1168212890625,
-0.152587890625,
0.326171875,
-0.111572265625,
0.256591796875,
0.5654296875,
0.35791015625,
0.73583984375,
-0.36181640625,
0.06475830078125,
0.4052734375,
-1.291015625,
-1.001953125,
0.286376953125,
0.2286376953125,
0.100830078125,
-0.135009765625,
0.1934814453125,
0.66796875,
-0.83251953125,
-0.14208984375,
-0.537109375,
-0.0262451171875,
-0.4541015625,
0.9462890625,
-0.2369384765625,
-0.1070556640625,
0.370849609375,
-0.050567626953125,
-0.58740234375,
0.07391357421875,
0.349853515625,
-0.0982666015625,
0.024261474609375,
0.454833984375,
-0.402587890625,
0.377685546875,
0.50732421875,
-0.73828125,
0.3564453125,
0.420654296875,
-0.77001953125,
1.1845703125,
-0.260986328125,
0.71826171875,
-0.58837890625,
-0.55615234375,
-0.404052734375,
0.10992431640625,
-0.224609375,
-0.1339111328125,
0.0999755859375,
0.314697265625,
0.341552734375,
0.251220703125,
0.83544921875,
-1.2568359375,
0.921875,
-0.251953125,
0.26416015625,
-0.501953125,
-0.50146484375,
-0.479248046875,
-0.4169921875,
-0.4169921875,
-0.6435546875,
0.68408203125,
0.29052734375,
-0.1820068359375,
0.66796875,
0.363525390625,
-0.447998046875,
0.00849151611328125,
-0.209716796875,
-0.1939697265625,
-0.435791015625,
0.346923828125,
1.0986328125,
-0.619140625,
-0.417236328125,
-0.47216796875,
1.0712890625,
0.69921875,
0.42529296875,
0.2054443359375,
-0.83642578125,
-0.85302734375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in history of Berland, there is the one that stand out the most. King wants to mention it in the anthem as many times as possible.
He has already composed major part of the anthem and now just needs to fill in some letters. King asked you to help him with this work.
The anthem is the string s of no more than 105 small Latin letters and question marks. The most glorious victory is the string t of no more than 105 small Latin letters. You should replace all the question marks with small Latin letters in such a way that the number of occurrences of string t in string s is maximal.
Note that the occurrences of string t in s can overlap. Check the third example for clarification.
Input
The first line contains string of small Latin letters and question marks s (1 ≤ |s| ≤ 105).
The second line contains string of small Latin letters t (1 ≤ |t| ≤ 105).
Product of lengths of strings |s|·|t| won't exceed 107.
Output
Output the maximum number of occurrences of string t you can achieve by replacing all the question marks in string s with small Latin letters.
Examples
Input
winlose???winl???w??
win
Output
5
Input
glo?yto?e??an?
or
Output
3
Input
??c?????
abcab
Output
2
Note
In the first example the resulting string s is "winlosewinwinlwinwin"
In the second example the resulting string s is "glorytoreorand". The last letter of the string can be arbitrary.
In the third example occurrences of string t are overlapping. String s with maximal number of occurrences of t is "abcabcab".
Submitted Solution:
```
import sys
s = sys.stdin.readline()
t = sys.stdin.readline()
def x(s, t):
index = 0
count = 0
while index <= len(s):
try:
if s[index] in ["?", t[0]]:
for x in range(len(t[1:])):
if not s[index+1+x] in ["?", t[1+x]]:
index += 1
break
else:
s = s[:index]+t+s[index+len(t):]
count += 1
index += 1
else:
index += 1
except IndexError:
break
return count
print(max([x(s, t), x(s[::-1],t[::-1])]))
```
No
| 45,841
|
[
0.1591796875,
-0.0614013671875,
0.281982421875,
0.352294921875,
-0.253662109375,
-0.007183074951171875,
0.07464599609375,
0.0396728515625,
0.14208984375,
0.36376953125,
0.5869140625,
-0.038330078125,
0.037017822265625,
-0.60791015625,
-0.61474609375,
0.276123046875,
-0.55810546875,
-1.2666015625,
-0.740234375,
0.00614166259765625,
-0.53369140625,
-0.14111328125,
-1.40625,
-0.1866455078125,
-0.38134765625,
0.69482421875,
0.292724609375,
0.337158203125,
0.8046875,
1.1318359375,
0.11029052734375,
-0.5185546875,
0.0867919921875,
-0.93212890625,
-0.389892578125,
-0.4775390625,
0.6142578125,
-0.75732421875,
-0.08489990234375,
-0.5400390625,
-0.042755126953125,
-0.6025390625,
0.59130859375,
-0.61767578125,
-0.9931640625,
-0.1866455078125,
-0.56103515625,
-0.375,
-0.1346435546875,
-0.238037109375,
0.449951171875,
-0.362548828125,
0.166259765625,
-0.1142578125,
0.003986358642578125,
0.359130859375,
-0.2235107421875,
-0.3046875,
-0.66162109375,
0.1297607421875,
0.06280517578125,
0.484130859375,
-0.08258056640625,
-0.634765625,
-0.260498046875,
0.2271728515625,
0.033294677734375,
-0.150634765625,
0.3466796875,
-0.83056640625,
-0.39453125,
0.32275390625,
-0.5625,
-0.55859375,
-0.35107421875,
0.0273895263671875,
0.1595458984375,
0.039459228515625,
-0.396484375,
0.775390625,
0.043182373046875,
1.02734375,
0.367431640625,
0.233642578125,
-0.80078125,
-0.382080078125,
0.075439453125,
0.40087890625,
0.25537109375,
-0.2802734375,
-0.10760498046875,
0.57861328125,
-0.5625,
-0.10394287109375,
0.52734375,
0.7841796875,
-0.441650390625,
0.2396240234375,
0.12890625,
-0.205078125,
0.73828125,
0.73095703125,
-0.3818359375,
0.9375,
-0.55419921875,
0.3359375,
0.061737060546875,
0.2069091796875,
0.1734619140625,
-0.7958984375,
0.033355712890625,
-0.0253143310546875,
0.80029296875,
0.182373046875,
-0.1378173828125,
0.67529296875,
-0.21337890625,
0.6298828125,
-0.53857421875,
0.31494140625,
0.0298919677734375,
-0.00469970703125,
0.489013671875,
-0.4296875,
-0.1837158203125,
-0.64208984375,
-0.5751953125,
0.83837890625,
-0.767578125,
-0.09405517578125,
0.381591796875,
-0.1572265625,
0.06719970703125,
0.1995849609375,
0.0701904296875,
0.95751953125,
-0.1080322265625,
0.431396484375,
0.93359375,
-0.77099609375,
0.72216796875,
-0.0252227783203125,
0.190185546875,
1.4306640625,
0.405029296875,
0.2646484375,
0.8525390625,
-0.028167724609375,
-0.493896484375,
0.2017822265625,
-0.5888671875,
0.7119140625,
0.029876708984375,
0.1961669921875,
-0.1378173828125,
0.279052734375,
-0.266845703125,
0.3076171875,
0.311767578125,
-0.237060546875,
-0.52783203125,
0.654296875,
-0.34375,
0.83984375,
0.05291748046875,
0.67333984375,
-0.364501953125,
-0.033111572265625,
-0.0074005126953125,
-0.373779296875,
0.3671875,
-0.51904296875,
0.1556396484375,
0.7607421875,
0.69775390625,
1.0615234375,
0.7333984375,
-0.19677734375,
0.27587890625,
0.5234375,
-0.36279296875,
0.13134765625,
0.42333984375,
0.54541015625,
-0.180908203125,
0.2064208984375,
0.09295654296875,
-0.060089111328125,
-0.78955078125,
-0.66162109375,
0.392578125,
0.7314453125,
-0.5390625,
0.273193359375,
0.27392578125,
0.1781005859375,
-0.46435546875,
-0.073486328125,
0.023681640625,
-1.1005859375,
-0.515625,
0.623046875,
-0.006916046142578125,
0.388427734375,
-0.40185546875,
-0.4091796875,
0.426513671875,
1.080078125,
-0.09698486328125,
0.1766357421875,
0.7392578125,
-0.0211334228515625,
-0.269775390625,
0.29638671875,
0.248779296875,
-0.08056640625,
-0.22119140625,
0.75,
-0.30859375,
0.03619384765625,
0.09259033203125,
0.90283203125,
-0.00801849365234375,
0.378662109375,
-0.31787109375,
-0.3564453125,
0.16455078125,
1.2890625,
-0.2457275390625,
0.328125,
0.129638671875,
0.65283203125,
0.66748046875,
0.826171875,
0.443115234375,
0.35791015625,
0.8173828125,
0.77978515625,
-0.1795654296875,
0.2396240234375,
0.003284454345703125,
0.30322265625,
0.41455078125,
0.9326171875,
0.09234619140625,
0.301513671875,
-0.00319671630859375,
-0.22998046875,
-0.18310546875,
0.351806640625,
-0.144775390625,
0.88818359375,
0.04840087890625,
0.483154296875,
-0.8173828125,
-0.250244140625,
0.276123046875,
0.6435546875,
-0.732421875,
-0.57080078125,
-0.2098388671875,
0.2529296875,
0.303466796875,
0.07977294921875,
0.026611328125,
0.490478515625,
0.42626953125,
0.426025390625,
-0.490478515625,
-0.7294921875,
-0.52197265625,
-1.0087890625,
-0.96044921875,
-0.477783203125,
-0.447021484375,
-0.069091796875,
0.68603515625,
-0.80908203125,
-0.1102294921875,
-0.2081298828125,
-0.035888671875,
0.365966796875,
-0.338134765625,
0.763671875,
-0.37744140625,
0.282470703125,
-0.7109375,
0.640625,
0.07354736328125,
0.6083984375,
-0.359375,
-0.08331298828125,
-0.07794189453125,
-0.59521484375,
-0.1441650390625,
0.058746337890625,
0.44677734375,
0.2476806640625,
-0.451416015625,
-0.7314453125,
-0.12469482421875,
-0.05517578125,
-0.248779296875,
-0.016845703125,
-0.51318359375,
0.5830078125,
0.22802734375,
-0.8984375,
0.499755859375,
0.97705078125,
-1.037109375,
0.658203125,
0.38720703125,
0.098876953125,
-0.79296875,
1.0625,
0.708984375,
0.476318359375,
-0.474853515625,
-0.499755859375,
-0.53759765625,
0.099609375,
0.1463623046875,
-0.61865234375,
-0.544921875,
0.55029296875,
0.1685791015625,
-1.1142578125,
0.49853515625,
-1.4130859375,
-0.52294921875,
-0.5263671875,
-0.268798828125,
0.91943359375,
0.8564453125,
-0.0965576171875,
0.1690673828125,
-0.1280517578125,
0.006313323974609375,
0.68017578125,
0.626953125,
-0.58203125,
-0.1961669921875,
0.9638671875,
-0.283935546875,
0.0506591796875,
0.41162109375,
-0.4501953125,
-0.2041015625,
-0.25634765625,
0.08416748046875,
0.65576171875,
0.0406494140625,
0.320556640625,
0.114013671875,
0.748046875,
-0.8095703125,
-0.31787109375,
-0.3662109375,
0.53369140625,
0.46533203125,
0.62939453125,
0.716796875,
0.269287109375,
-0.5693359375,
-0.93505859375,
0.311767578125,
0.26953125,
0.73291015625,
-0.69873046875,
0.625,
0.5458984375,
-0.49755859375,
0.77294921875,
-0.7021484375,
0.2666015625,
1.392578125,
-0.35888671875,
0.5546875,
-0.49658203125,
0.303955078125,
-0.45263671875,
-0.1134033203125,
0.43017578125,
0.2293701171875,
0.46044921875,
-0.525390625,
-0.5419921875,
-0.26806640625,
-0.018798828125,
0.1851806640625,
-0.413818359375,
0.1124267578125,
-0.693359375,
-0.351806640625,
-0.98876953125,
0.26513671875,
0.623046875,
0.5068359375,
0.137451171875,
0.51513671875,
0.07330322265625,
0.41943359375,
0.703125,
-0.36376953125,
-0.06353759765625,
-0.6015625,
1.029296875,
0.483642578125,
-0.08221435546875,
-0.66162109375,
-0.1304931640625,
-0.5380859375,
0.4072265625,
-0.0024242401123046875,
0.00408935546875,
-0.90771484375,
0.359130859375,
-0.152099609375,
0.501953125,
-0.5751953125,
0.0166168212890625,
-0.2301025390625,
0.52685546875,
0.061248779296875,
-0.93603515625,
0.1878662109375,
-0.69384765625,
0.221435546875,
0.6220703125,
-0.0855712890625,
-0.580078125,
-0.61669921875,
-0.53466796875,
-0.90283203125,
-0.2001953125,
1.052734375,
-0.28125,
0.0340576171875,
-1.2666015625,
0.61865234375,
0.32275390625,
-0.63037109375,
0.264892578125,
-0.2117919921875,
0.38720703125,
0.201171875,
0.974609375,
-0.1884765625,
-0.60107421875,
0.1395263671875,
-1.462890625,
0.18359375,
-0.51806640625,
0.31103515625,
0.406005859375,
-0.0447998046875,
0.0189208984375,
0.493408203125,
-0.117919921875,
-0.23876953125,
0.1007080078125,
0.197265625,
-1.0029296875,
-0.63232421875,
0.70849609375,
-0.1708984375,
-0.6494140625,
1.1884765625,
0.05914306640625,
-0.5322265625,
0.5390625,
0.509765625,
-0.434814453125,
0.50830078125,
-0.4951171875,
0.424072265625,
-0.136962890625,
-0.495361328125,
-0.05755615234375,
-0.3623046875,
0.6923828125,
-0.134765625,
-0.60498046875,
-0.481689453125,
-0.93896484375,
0.128662109375,
0.0274658203125,
-0.426025390625,
0.2332763671875,
0.199462890625,
0.11590576171875,
-0.2587890625,
-0.37890625,
-0.60498046875,
-0.49755859375,
-0.357421875,
-0.04913330078125,
0.346923828125,
0.2252197265625,
0.5966796875,
0.2244873046875,
-0.1549072265625,
-0.0740966796875,
0.11956787109375,
0.02337646484375,
-0.65234375,
-0.483154296875,
-0.469970703125,
-0.258544921875,
-0.486328125,
0.306884765625,
0.0219268798828125,
0.8369140625,
0.87158203125,
0.332275390625,
0.260986328125,
0.03460693359375,
-0.67431640625,
1.01171875,
-0.1654052734375,
-1.4267578125,
-0.2476806640625,
0.477783203125,
0.1888427734375,
0.97900390625,
0.0270538330078125,
-0.591796875,
-0.71533203125,
-1.0166015625,
-0.1490478515625,
-0.424560546875,
-0.125,
-1.3134765625,
-0.41162109375,
-0.378173828125,
0.86865234375,
-0.2257080078125,
-0.7177734375,
0.349853515625,
-0.9697265625,
-0.1334228515625,
-0.591796875,
-0.321533203125,
-0.96923828125,
-0.63427734375,
-0.0740966796875,
1.1767578125,
0.41845703125,
0.54150390625,
-0.4951171875,
-0.319091796875,
0.189697265625,
-0.00008994340896606445,
-0.529296875,
-0.495361328125,
-0.10369873046875,
-0.01447296142578125,
-0.10528564453125,
0.052947998046875,
-0.5029296875,
0.40234375,
-0.947265625,
0.28173828125,
-0.351806640625,
-0.38916015625,
-0.051727294921875,
-0.12005615234375,
0.9736328125,
-0.521484375,
-0.15625,
-0.197021484375,
0.32470703125,
0.87744140625,
-0.1641845703125,
-0.1312255859375,
-0.63427734375,
-0.7529296875,
-0.80810546875,
0.493896484375,
-0.364501953125,
0.2088623046875,
-0.259521484375,
0.149169921875,
1.3056640625,
-0.315673828125,
0.39501953125,
1.1875,
0.024322509765625,
0.1611328125,
-1.015625,
0.68310546875,
0.44189453125,
-0.80615234375,
-0.04693603515625,
-0.058990478515625,
-0.83349609375,
0.07354736328125,
-0.5556640625,
-0.94580078125,
-0.61083984375,
0.1951904296875,
1.3642578125,
-0.04534912109375,
0.66796875,
-0.0083770751953125,
-1.1513671875,
-0.716796875,
0.70703125,
-0.07806396484375,
0.050323486328125,
1.0244140625,
-0.1114501953125,
-0.11236572265625,
-0.241943359375,
0.0736083984375,
-0.09619140625,
-0.489990234375,
1.169921875,
-0.2802734375,
-0.372314453125,
0.62451171875,
0.67138671875,
-1.3564453125,
-1.1845703125,
-0.053924560546875,
-0.1258544921875,
-0.278564453125,
-0.75537109375,
0.156005859375,
0.765625,
-0.280517578125,
0.17041015625,
0.1929931640625,
-0.171875,
0.43408203125,
-0.04351806640625,
0.68017578125,
-0.309326171875,
0.76953125,
0.363037109375,
-0.68603515625,
-0.357421875,
-1.3017578125,
-0.248291015625,
-0.6328125,
0.13720703125,
0.9736328125,
-0.10076904296875,
0.10052490234375,
0.384033203125,
-0.00638580322265625,
0.7353515625,
-0.47314453125,
-0.292236328125,
0.056884765625,
-0.65673828125,
-0.5234375,
-0.341552734375,
0.425048828125,
-0.1024169921875,
0.50830078125,
-0.79638671875,
0.0487060546875,
0.278076171875,
0.1785888671875,
-0.244140625,
-0.6123046875,
-0.316650390625,
-0.93896484375,
-0.50146484375,
-0.64697265625,
-0.69384765625,
-0.338134765625,
0.56689453125,
0.157470703125,
-0.224609375,
-0.0303955078125,
0.19189453125,
-0.32470703125,
0.568359375,
-0.3408203125,
0.5166015625,
-0.51513671875,
-0.393798828125,
-0.7568359375,
0.0288848876953125,
-0.69140625,
-0.04180908203125,
-0.36962890625,
0.3896484375,
-0.1629638671875,
0.340087890625,
-0.1331787109375,
0.424560546875,
-0.2318115234375,
-0.5419921875,
0.2783203125,
0.0235748291015625,
-0.1474609375,
1.0537109375,
0.580078125,
-0.032318115234375,
0.36962890625,
0.09124755859375,
-0.1734619140625,
-0.213134765625,
0.421875,
0.31884765625,
0.07666015625,
-0.32373046875,
-0.55810546875,
-0.1282958984375,
-0.7705078125,
0.55029296875,
-0.06591796875,
0.3701171875,
0.1351318359375,
-0.425048828125,
0.60546875,
0.927734375,
-0.1986083984375,
0.3046875,
0.1580810546875,
0.03741455078125,
0.7529296875,
0.360595703125,
-0.1556396484375,
0.65673828125,
0.363525390625,
-0.331298828125,
0.1646728515625,
0.84619140625,
0.07476806640625,
0.40380859375,
-0.391357421875,
-0.65673828125,
-1.1806640625,
-0.5107421875,
0.03143310546875,
0.359375,
0.5654296875,
-0.50634765625,
-0.2137451171875,
-0.026397705078125,
-0.319091796875,
0.034393310546875,
-1.3330078125,
-1.166015625,
0.453125,
0.074951171875,
-0.56689453125,
-0.2374267578125,
-0.388427734375,
-0.2288818359375,
-0.125,
0.1910400390625,
-0.191650390625,
0.7939453125,
0.1552734375,
0.56201171875,
-0.08905029296875,
-0.0221710205078125,
0.3134765625,
0.17431640625,
-1.12890625,
-0.59375,
-0.19970703125,
1.1142578125,
0.21240234375,
0.1175537109375,
-0.477294921875,
0.23193359375,
-0.34765625,
0.045989990234375,
-0.339599609375,
0.2474365234375,
0.1826171875,
0.6689453125,
-0.5048828125,
-0.05926513671875,
-0.207763671875,
0.1483154296875,
0.08880615234375,
-0.6533203125,
-0.11553955078125,
0.82421875,
0.50439453125,
-0.4169921875,
0.37060546875,
0.481201171875,
0.77001953125,
0.381591796875,
-0.0860595703125,
-0.341796875,
0.57568359375,
0.740234375,
0.90185546875,
-0.2376708984375,
0.138916015625,
0.61083984375,
0.1871337890625,
0.143798828125,
0.74462890625,
0.178955078125,
-0.2139892578125,
0.2958984375,
-0.10906982421875,
-0.1339111328125,
0.289306640625,
-0.60546875,
0.38037109375,
-0.52294921875,
-0.012664794921875,
-0.428466796875,
-0.77197265625,
0.8076171875,
-0.04779052734375,
-0.152587890625,
0.201904296875,
-0.69482421875,
0.2257080078125,
0.796875,
0.037933349609375,
-0.2646484375,
0.77734375,
0.67236328125,
0.7529296875,
0.671875,
0.26806640625,
0.329833984375,
-0.11981201171875,
0.1361083984375,
0.47021484375,
-0.0997314453125,
-0.74072265625,
-0.03765869140625,
-1.1611328125,
0.294677734375,
-0.382568359375,
0.036712646484375,
0.765625,
-0.796875,
-0.07275390625,
-0.70703125,
0.50244140625,
-0.56201171875,
0.432373046875,
0.3427734375,
-0.1575927734375,
-1.0576171875,
0.92333984375,
-0.280517578125,
0.34619140625,
0.034820556640625,
0.994140625,
-0.09027099609375,
0.8515625,
0.58642578125,
-0.3251953125,
-0.16162109375,
0.264892578125,
-0.29443359375,
-0.485107421875,
-0.1845703125,
-0.403076171875,
-0.02001953125,
-0.7509765625,
-0.48779296875,
0.02288818359375,
0.54345703125,
0.2225341796875,
-0.82470703125,
-0.27783203125,
0.464599609375,
-0.77685546875,
0.307373046875,
-0.026947021484375,
0.408447265625,
0.1922607421875,
-0.10845947265625,
-0.37744140625,
-0.302001953125,
-0.088134765625,
-0.337890625,
0.68310546875,
-0.8583984375,
-0.364990234375,
-0.8515625,
-0.5234375,
-0.056488037109375,
-0.2481689453125,
-0.595703125,
-0.43505859375,
0.681640625,
0.417236328125,
0.22705078125,
0.191650390625,
-0.471923828125,
0.29296875,
1.201171875,
0.94921875,
-0.06549072265625,
0.7822265625,
-0.18603515625,
-0.1868896484375,
-0.053466796875,
-0.50439453125,
0.308349609375,
-0.149658203125,
-0.44873046875,
-0.33935546875,
0.248046875,
-0.92333984375,
-1.41015625,
0.06561279296875,
0.308837890625,
0.56689453125,
-0.8349609375,
-1.3759765625,
0.0137786865234375,
-0.9658203125,
-0.2000732421875,
-0.6533203125,
0.45263671875,
-0.178955078125,
-0.04595947265625,
-0.111328125,
-1.0732421875,
4.453125,
0.8388671875,
0.59521484375,
-0.0311431884765625,
0.1539306640625,
0.68408203125,
0.486083984375,
-0.493896484375,
-0.100341796875,
-0.18994140625,
0.31982421875,
-0.10650634765625,
0.2447509765625,
0.61767578125,
0.38720703125,
0.75927734375,
-0.380859375,
0.0440673828125,
0.428955078125,
-1.3017578125,
-0.98974609375,
0.25146484375,
0.21240234375,
0.11083984375,
-0.1455078125,
0.2427978515625,
0.6904296875,
-0.8349609375,
-0.10650634765625,
-0.497802734375,
-0.0248565673828125,
-0.397216796875,
0.91650390625,
-0.31982421875,
-0.08721923828125,
0.379150390625,
-0.056732177734375,
-0.60791015625,
0.09039306640625,
0.3603515625,
-0.079833984375,
0.006656646728515625,
0.40234375,
-0.3984375,
0.422607421875,
0.5263671875,
-0.70458984375,
0.37353515625,
0.44482421875,
-0.7666015625,
1.173828125,
-0.2176513671875,
0.68798828125,
-0.57861328125,
-0.53857421875,
-0.3486328125,
0.09820556640625,
-0.204833984375,
-0.1689453125,
0.10302734375,
0.287353515625,
0.358154296875,
0.260009765625,
0.83837890625,
-1.2158203125,
0.96484375,
-0.244384765625,
0.28466796875,
-0.51220703125,
-0.50439453125,
-0.4716796875,
-0.396240234375,
-0.435546875,
-0.6298828125,
0.66455078125,
0.29736328125,
-0.17529296875,
0.6025390625,
0.42724609375,
-0.417236328125,
0.046173095703125,
-0.180419921875,
-0.1998291015625,
-0.4521484375,
0.32421875,
1.08203125,
-0.61572265625,
-0.4248046875,
-0.496826171875,
1.0205078125,
0.6884765625,
0.396728515625,
0.2100830078125,
-0.83154296875,
-0.859375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in history of Berland, there is the one that stand out the most. King wants to mention it in the anthem as many times as possible.
He has already composed major part of the anthem and now just needs to fill in some letters. King asked you to help him with this work.
The anthem is the string s of no more than 105 small Latin letters and question marks. The most glorious victory is the string t of no more than 105 small Latin letters. You should replace all the question marks with small Latin letters in such a way that the number of occurrences of string t in string s is maximal.
Note that the occurrences of string t in s can overlap. Check the third example for clarification.
Input
The first line contains string of small Latin letters and question marks s (1 ≤ |s| ≤ 105).
The second line contains string of small Latin letters t (1 ≤ |t| ≤ 105).
Product of lengths of strings |s|·|t| won't exceed 107.
Output
Output the maximum number of occurrences of string t you can achieve by replacing all the question marks in string s with small Latin letters.
Examples
Input
winlose???winl???w??
win
Output
5
Input
glo?yto?e??an?
or
Output
3
Input
??c?????
abcab
Output
2
Note
In the first example the resulting string s is "winlosewinwinlwinwin"
In the second example the resulting string s is "glorytoreorand". The last letter of the string can be arbitrary.
In the third example occurrences of string t are overlapping. String s with maximal number of occurrences of t is "abcabcab".
Submitted Solution:
```
s = input()
t = input()
index = 0
count = 0
while index <= len(s):
try:
if s[index] in ["?", t[0]]:
for x in range(len(t[1:])):
if not s[index+1+x] in ["?", t[1+x]]:
index += 1
break
else:
s = s[:index]+t+s[index+len(t):]
count += 1
index += 1
else:
index += 1
except IndexError:
break
print(count)
```
No
| 45,842
|
[
0.17919921875,
-0.04266357421875,
0.2493896484375,
0.337646484375,
-0.263671875,
-0.02166748046875,
0.09808349609375,
0.054107666015625,
0.1458740234375,
0.3818359375,
0.6123046875,
-0.01861572265625,
0.026947021484375,
-0.65625,
-0.6123046875,
0.29150390625,
-0.568359375,
-1.283203125,
-0.72216796875,
0.0223541259765625,
-0.576171875,
-0.1376953125,
-1.3798828125,
-0.181396484375,
-0.348388671875,
0.73583984375,
0.319091796875,
0.311767578125,
0.79736328125,
1.1171875,
0.11883544921875,
-0.498779296875,
0.0841064453125,
-0.923828125,
-0.404541015625,
-0.461181640625,
0.63232421875,
-0.73193359375,
-0.06488037109375,
-0.51171875,
-0.026885986328125,
-0.60546875,
0.58544921875,
-0.615234375,
-0.994140625,
-0.1585693359375,
-0.54296875,
-0.390625,
-0.15625,
-0.291259765625,
0.43505859375,
-0.408447265625,
0.2086181640625,
-0.058746337890625,
0.049346923828125,
0.35693359375,
-0.2073974609375,
-0.315185546875,
-0.68603515625,
0.1912841796875,
0.06396484375,
0.472900390625,
-0.08453369140625,
-0.67626953125,
-0.319091796875,
0.2083740234375,
0.06427001953125,
-0.1800537109375,
0.359375,
-0.86962890625,
-0.4306640625,
0.279541015625,
-0.55908203125,
-0.497802734375,
-0.337890625,
0.06878662109375,
0.15234375,
-0.0245361328125,
-0.404052734375,
0.7802734375,
0.0740966796875,
0.96728515625,
0.349365234375,
0.272216796875,
-0.7900390625,
-0.3896484375,
0.091796875,
0.423095703125,
0.30859375,
-0.263671875,
-0.12432861328125,
0.59521484375,
-0.60595703125,
-0.11309814453125,
0.57421875,
0.7919921875,
-0.43212890625,
0.2666015625,
0.15771484375,
-0.20068359375,
0.775390625,
0.7275390625,
-0.389892578125,
0.95361328125,
-0.56787109375,
0.34716796875,
0.0171051025390625,
0.19384765625,
0.18896484375,
-0.80859375,
0.0008845329284667969,
-0.0234832763671875,
0.8125,
0.142578125,
-0.1483154296875,
0.712890625,
-0.214599609375,
0.62255859375,
-0.54638671875,
0.3173828125,
0.04852294921875,
0.0030307769775390625,
0.5078125,
-0.373779296875,
-0.146728515625,
-0.63916015625,
-0.5791015625,
0.86279296875,
-0.78857421875,
-0.06292724609375,
0.376953125,
-0.155029296875,
0.049163818359375,
0.2152099609375,
0.0443115234375,
0.921875,
-0.0972900390625,
0.446044921875,
0.95654296875,
-0.7529296875,
0.73291015625,
-0.033599853515625,
0.157470703125,
1.3916015625,
0.396728515625,
0.243896484375,
0.8740234375,
-0.066650390625,
-0.53271484375,
0.1876220703125,
-0.62646484375,
0.73291015625,
0.00795745849609375,
0.2286376953125,
-0.1693115234375,
0.284423828125,
-0.276123046875,
0.257080078125,
0.29443359375,
-0.294189453125,
-0.496826171875,
0.6044921875,
-0.36669921875,
0.85546875,
0.0236358642578125,
0.669921875,
-0.393798828125,
-0.02197265625,
-0.007152557373046875,
-0.435302734375,
0.295654296875,
-0.487548828125,
0.1719970703125,
0.78076171875,
0.685546875,
1.130859375,
0.75732421875,
-0.2196044921875,
0.284423828125,
0.47265625,
-0.29248046875,
0.10687255859375,
0.4228515625,
0.58837890625,
-0.213134765625,
0.1884765625,
0.059051513671875,
-0.043304443359375,
-0.71240234375,
-0.64013671875,
0.34521484375,
0.74755859375,
-0.5537109375,
0.250732421875,
0.2445068359375,
0.1812744140625,
-0.444580078125,
-0.0450439453125,
0.0005106925964355469,
-1.099609375,
-0.5234375,
0.63330078125,
0.0014982223510742188,
0.42333984375,
-0.39794921875,
-0.43701171875,
0.404296875,
1.06640625,
-0.130615234375,
0.1494140625,
0.708984375,
0.032745361328125,
-0.215087890625,
0.279296875,
0.20703125,
-0.0640869140625,
-0.2239990234375,
0.77294921875,
-0.327392578125,
0.053802490234375,
0.08331298828125,
0.85888671875,
0.0211029052734375,
0.427734375,
-0.30029296875,
-0.362548828125,
0.170654296875,
1.3037109375,
-0.2274169921875,
0.3818359375,
0.1544189453125,
0.67333984375,
0.69482421875,
0.8447265625,
0.486572265625,
0.36083984375,
0.8076171875,
0.77783203125,
-0.1312255859375,
0.2220458984375,
0.033233642578125,
0.304443359375,
0.473388671875,
0.94482421875,
0.06781005859375,
0.348388671875,
-0.03607177734375,
-0.190185546875,
-0.19189453125,
0.3828125,
-0.12445068359375,
0.87255859375,
0.08489990234375,
0.53466796875,
-0.83447265625,
-0.2120361328125,
0.287109375,
0.640625,
-0.68310546875,
-0.59375,
-0.23388671875,
0.298828125,
0.304443359375,
0.08721923828125,
0.038818359375,
0.50341796875,
0.445556640625,
0.437744140625,
-0.475341796875,
-0.74853515625,
-0.56103515625,
-1.0341796875,
-0.97998046875,
-0.49853515625,
-0.406982421875,
-0.0648193359375,
0.69921875,
-0.8173828125,
-0.095947265625,
-0.1844482421875,
-0.07501220703125,
0.363525390625,
-0.363037109375,
0.7880859375,
-0.34912109375,
0.3427734375,
-0.6943359375,
0.6171875,
0.1160888671875,
0.5732421875,
-0.391357421875,
-0.1146240234375,
-0.055908203125,
-0.59716796875,
-0.1624755859375,
0.08123779296875,
0.426025390625,
0.250244140625,
-0.475341796875,
-0.7314453125,
-0.11895751953125,
-0.008575439453125,
-0.250244140625,
-0.0080413818359375,
-0.55126953125,
0.59521484375,
0.260986328125,
-0.890625,
0.50146484375,
0.98291015625,
-1.0107421875,
0.67626953125,
0.407470703125,
0.110595703125,
-0.7978515625,
1.0546875,
0.75146484375,
0.47607421875,
-0.487060546875,
-0.513671875,
-0.54345703125,
0.09075927734375,
0.153076171875,
-0.626953125,
-0.51513671875,
0.58154296875,
0.11383056640625,
-1.1298828125,
0.489501953125,
-1.41015625,
-0.56298828125,
-0.5517578125,
-0.246337890625,
0.8955078125,
0.86279296875,
-0.11517333984375,
0.2078857421875,
-0.1390380859375,
0.0293731689453125,
0.69970703125,
0.65478515625,
-0.60693359375,
-0.2138671875,
0.9609375,
-0.296630859375,
0.07952880859375,
0.39404296875,
-0.435791015625,
-0.2261962890625,
-0.20703125,
0.08660888671875,
0.6845703125,
0.043060302734375,
0.301025390625,
0.08038330078125,
0.78125,
-0.77294921875,
-0.307373046875,
-0.375244140625,
0.55419921875,
0.443115234375,
0.6298828125,
0.720703125,
0.191650390625,
-0.59375,
-0.93408203125,
0.33251953125,
0.252685546875,
0.736328125,
-0.7578125,
0.6220703125,
0.59423828125,
-0.53369140625,
0.75048828125,
-0.71044921875,
0.246337890625,
1.3837890625,
-0.37109375,
0.55419921875,
-0.496337890625,
0.290283203125,
-0.483154296875,
-0.1436767578125,
0.45751953125,
0.2841796875,
0.493408203125,
-0.52685546875,
-0.537109375,
-0.2413330078125,
0.009124755859375,
0.16796875,
-0.4072265625,
0.10223388671875,
-0.716796875,
-0.343017578125,
-0.95361328125,
0.283447265625,
0.59619140625,
0.50732421875,
0.1312255859375,
0.49853515625,
0.1148681640625,
0.40380859375,
0.70361328125,
-0.369140625,
-0.11126708984375,
-0.60546875,
1.005859375,
0.51953125,
-0.10638427734375,
-0.61279296875,
-0.159423828125,
-0.5859375,
0.378662109375,
0.051025390625,
0.006687164306640625,
-0.92041015625,
0.3984375,
-0.18408203125,
0.51318359375,
-0.513671875,
-0.034820556640625,
-0.19921875,
0.51513671875,
0.0819091796875,
-0.96142578125,
0.2020263671875,
-0.68017578125,
0.2098388671875,
0.625,
-0.05755615234375,
-0.5830078125,
-0.60009765625,
-0.56884765625,
-0.85498046875,
-0.2275390625,
1.099609375,
-0.2763671875,
0.0209808349609375,
-1.2744140625,
0.60693359375,
0.35791015625,
-0.63818359375,
0.28759765625,
-0.220947265625,
0.357666015625,
0.1383056640625,
1.044921875,
-0.2371826171875,
-0.6396484375,
0.1192626953125,
-1.4619140625,
0.20068359375,
-0.486083984375,
0.307373046875,
0.37939453125,
-0.055450439453125,
0.036224365234375,
0.475341796875,
-0.10272216796875,
-0.25732421875,
0.06939697265625,
0.177001953125,
-1.0009765625,
-0.6279296875,
0.689453125,
-0.1485595703125,
-0.64990234375,
1.1748046875,
0.0260162353515625,
-0.49658203125,
0.4765625,
0.481201171875,
-0.496337890625,
0.48828125,
-0.484619140625,
0.4072265625,
-0.1668701171875,
-0.485107421875,
0.01311492919921875,
-0.386962890625,
0.67041015625,
-0.156005859375,
-0.640625,
-0.494873046875,
-0.92529296875,
0.1300048828125,
-0.006732940673828125,
-0.4560546875,
0.2274169921875,
0.2420654296875,
0.10577392578125,
-0.253173828125,
-0.36572265625,
-0.59814453125,
-0.513671875,
-0.375732421875,
-0.0413818359375,
0.376953125,
0.2196044921875,
0.59033203125,
0.250244140625,
-0.1546630859375,
-0.047027587890625,
0.098876953125,
0.11419677734375,
-0.6455078125,
-0.475341796875,
-0.477294921875,
-0.265869140625,
-0.4599609375,
0.353271484375,
0.0183868408203125,
0.7763671875,
0.8759765625,
0.31396484375,
0.264404296875,
0.031524658203125,
-0.70654296875,
1.0146484375,
-0.1900634765625,
-1.423828125,
-0.285888671875,
0.492431640625,
0.2137451171875,
0.97607421875,
0.07122802734375,
-0.5888671875,
-0.734375,
-1.0439453125,
-0.1787109375,
-0.401611328125,
-0.1341552734375,
-1.314453125,
-0.42236328125,
-0.3583984375,
0.890625,
-0.208984375,
-0.6904296875,
0.388427734375,
-0.98583984375,
-0.1153564453125,
-0.62255859375,
-0.318359375,
-0.96142578125,
-0.5810546875,
-0.10638427734375,
1.1064453125,
0.417724609375,
0.56005859375,
-0.42578125,
-0.3779296875,
0.2021484375,
0.0170440673828125,
-0.54931640625,
-0.51904296875,
-0.08929443359375,
-0.031707763671875,
-0.0843505859375,
0.0245513916015625,
-0.48583984375,
0.44775390625,
-0.97998046875,
0.29541015625,
-0.362060546875,
-0.42529296875,
-0.08636474609375,
-0.19140625,
0.9853515625,
-0.509765625,
-0.13525390625,
-0.19921875,
0.271484375,
0.8466796875,
-0.1781005859375,
-0.1541748046875,
-0.6328125,
-0.77978515625,
-0.81396484375,
0.499267578125,
-0.357666015625,
0.2060546875,
-0.318359375,
0.12841796875,
1.3125,
-0.27978515625,
0.34375,
1.208984375,
0.050018310546875,
0.2108154296875,
-1.025390625,
0.640625,
0.40869140625,
-0.79736328125,
-0.049072265625,
-0.10760498046875,
-0.83056640625,
0.0823974609375,
-0.5478515625,
-0.943359375,
-0.623046875,
0.239013671875,
1.333984375,
-0.0654296875,
0.68505859375,
-0.0013284683227539062,
-1.1865234375,
-0.7509765625,
0.685546875,
-0.035430908203125,
0.0266571044921875,
1.03515625,
-0.1181640625,
-0.10150146484375,
-0.278076171875,
0.083251953125,
-0.11932373046875,
-0.49658203125,
1.1953125,
-0.2890625,
-0.38916015625,
0.60986328125,
0.6806640625,
-1.37890625,
-1.177734375,
-0.030548095703125,
-0.153076171875,
-0.28662109375,
-0.74755859375,
0.211181640625,
0.794921875,
-0.32177734375,
0.2314453125,
0.1922607421875,
-0.188232421875,
0.399169921875,
-0.0169677734375,
0.7197265625,
-0.31787109375,
0.73193359375,
0.38623046875,
-0.72802734375,
-0.39794921875,
-1.310546875,
-0.2431640625,
-0.60986328125,
0.11224365234375,
0.9482421875,
-0.07562255859375,
0.07684326171875,
0.40087890625,
-0.00423431396484375,
0.7060546875,
-0.48779296875,
-0.3076171875,
0.1009521484375,
-0.64208984375,
-0.54296875,
-0.33837890625,
0.464111328125,
-0.1058349609375,
0.51171875,
-0.80615234375,
0.026611328125,
0.28369140625,
0.2017822265625,
-0.263427734375,
-0.6083984375,
-0.31396484375,
-0.97314453125,
-0.55419921875,
-0.71337890625,
-0.6611328125,
-0.322998046875,
0.58251953125,
0.14794921875,
-0.23291015625,
0.01114654541015625,
0.23486328125,
-0.36669921875,
0.6240234375,
-0.3408203125,
0.49609375,
-0.51953125,
-0.40380859375,
-0.75341796875,
0.0171356201171875,
-0.65771484375,
0.00930023193359375,
-0.3798828125,
0.467529296875,
-0.16064453125,
0.342041015625,
-0.1676025390625,
0.423828125,
-0.20654296875,
-0.53955078125,
0.267333984375,
0.04364013671875,
-0.1429443359375,
1.017578125,
0.56787109375,
-0.05316162109375,
0.335693359375,
0.11090087890625,
-0.1656494140625,
-0.230712890625,
0.4677734375,
0.310546875,
0.07257080078125,
-0.3134765625,
-0.50537109375,
-0.09918212890625,
-0.77978515625,
0.5263671875,
-0.075927734375,
0.382080078125,
0.1243896484375,
-0.4306640625,
0.62939453125,
0.953125,
-0.22265625,
0.35107421875,
0.1646728515625,
0.02886962890625,
0.73095703125,
0.376220703125,
-0.134765625,
0.630859375,
0.368408203125,
-0.342041015625,
0.151611328125,
0.8076171875,
0.061981201171875,
0.39306640625,
-0.367431640625,
-0.6669921875,
-1.1513671875,
-0.4951171875,
0.05755615234375,
0.388671875,
0.5654296875,
-0.53173828125,
-0.1597900390625,
-0.01552581787109375,
-0.30712890625,
0.03790283203125,
-1.353515625,
-1.173828125,
0.468505859375,
0.12158203125,
-0.5380859375,
-0.220947265625,
-0.384765625,
-0.192138671875,
-0.07958984375,
0.234130859375,
-0.22412109375,
0.7763671875,
0.161376953125,
0.5546875,
-0.077880859375,
-0.0308685302734375,
0.303466796875,
0.21533203125,
-1.162109375,
-0.60791015625,
-0.2301025390625,
1.0908203125,
0.2288818359375,
0.12432861328125,
-0.426513671875,
0.2384033203125,
-0.328369140625,
0.04998779296875,
-0.330078125,
0.2406005859375,
0.144775390625,
0.68115234375,
-0.52880859375,
-0.06707763671875,
-0.200439453125,
0.1685791015625,
0.0948486328125,
-0.66015625,
-0.111083984375,
0.8447265625,
0.5087890625,
-0.4375,
0.39111328125,
0.4580078125,
0.75634765625,
0.3515625,
-0.09912109375,
-0.32177734375,
0.6357421875,
0.68701171875,
0.87890625,
-0.2264404296875,
0.126953125,
0.61376953125,
0.21533203125,
0.1739501953125,
0.7724609375,
0.1634521484375,
-0.191162109375,
0.268310546875,
-0.11090087890625,
-0.10369873046875,
0.28125,
-0.59228515625,
0.343505859375,
-0.5146484375,
-0.044219970703125,
-0.416259765625,
-0.7861328125,
0.82373046875,
-0.002254486083984375,
-0.150390625,
0.1724853515625,
-0.6865234375,
0.2093505859375,
0.81591796875,
0.01294708251953125,
-0.243408203125,
0.765625,
0.66650390625,
0.7939453125,
0.70751953125,
0.2452392578125,
0.333251953125,
-0.11907958984375,
0.1365966796875,
0.4931640625,
-0.11322021484375,
-0.74658203125,
-0.1080322265625,
-1.19140625,
0.30810546875,
-0.383056640625,
-0.00698089599609375,
0.77392578125,
-0.8037109375,
-0.09686279296875,
-0.70458984375,
0.51611328125,
-0.5546875,
0.478759765625,
0.34912109375,
-0.171875,
-1.06640625,
0.9462890625,
-0.308349609375,
0.364990234375,
0.013092041015625,
0.99755859375,
-0.09185791015625,
0.82861328125,
0.58935546875,
-0.345458984375,
-0.1273193359375,
0.297607421875,
-0.301025390625,
-0.48828125,
-0.18408203125,
-0.451904296875,
-0.06787109375,
-0.75927734375,
-0.49755859375,
-0.03570556640625,
0.52783203125,
0.1947021484375,
-0.85986328125,
-0.27197265625,
0.494873046875,
-0.78125,
0.283447265625,
-0.0206146240234375,
0.365966796875,
0.177978515625,
-0.095458984375,
-0.367919921875,
-0.283447265625,
-0.0897216796875,
-0.371337890625,
0.64501953125,
-0.8447265625,
-0.36083984375,
-0.87109375,
-0.5224609375,
-0.035308837890625,
-0.224365234375,
-0.59814453125,
-0.4482421875,
0.67822265625,
0.413330078125,
0.24560546875,
0.1942138671875,
-0.4970703125,
0.29833984375,
1.2158203125,
0.94287109375,
-0.07623291015625,
0.791015625,
-0.1483154296875,
-0.170166015625,
-0.0531005859375,
-0.51513671875,
0.341796875,
-0.1402587890625,
-0.413818359375,
-0.337646484375,
0.300048828125,
-0.919921875,
-1.396484375,
0.0302886962890625,
0.29541015625,
0.55810546875,
-0.8447265625,
-1.39453125,
0.0039520263671875,
-0.9619140625,
-0.2161865234375,
-0.6318359375,
0.474609375,
-0.19580078125,
-0.066162109375,
-0.139404296875,
-1.08984375,
4.42578125,
0.84619140625,
0.60888671875,
0.01401519775390625,
0.1502685546875,
0.6884765625,
0.5078125,
-0.5107421875,
-0.1019287109375,
-0.1566162109375,
0.328857421875,
-0.111328125,
0.257080078125,
0.607421875,
0.381591796875,
0.74267578125,
-0.366943359375,
0.06097412109375,
0.3984375,
-1.3056640625,
-1.0029296875,
0.275146484375,
0.2298583984375,
0.0789794921875,
-0.1458740234375,
0.2259521484375,
0.66845703125,
-0.83740234375,
-0.1514892578125,
-0.50048828125,
-0.005771636962890625,
-0.398681640625,
0.9296875,
-0.252685546875,
-0.0972900390625,
0.37548828125,
-0.03216552734375,
-0.6171875,
0.0830078125,
0.342041015625,
-0.08734130859375,
0.029083251953125,
0.440673828125,
-0.40673828125,
0.399169921875,
0.521484375,
-0.755859375,
0.39404296875,
0.424560546875,
-0.8046875,
1.1572265625,
-0.24560546875,
0.71923828125,
-0.58984375,
-0.58154296875,
-0.379150390625,
0.0721435546875,
-0.2177734375,
-0.15478515625,
0.12103271484375,
0.30615234375,
0.34228515625,
0.2401123046875,
0.8251953125,
-1.2744140625,
0.92529296875,
-0.252197265625,
0.25634765625,
-0.513671875,
-0.482177734375,
-0.45263671875,
-0.409423828125,
-0.407470703125,
-0.64306640625,
0.677734375,
0.33544921875,
-0.217041015625,
0.638671875,
0.408447265625,
-0.43701171875,
0.044036865234375,
-0.1666259765625,
-0.1746826171875,
-0.42578125,
0.3642578125,
1.08984375,
-0.62158203125,
-0.421630859375,
-0.493408203125,
1.068359375,
0.7099609375,
0.3984375,
0.198974609375,
-0.8271484375,
-0.85302734375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in history of Berland, there is the one that stand out the most. King wants to mention it in the anthem as many times as possible.
He has already composed major part of the anthem and now just needs to fill in some letters. King asked you to help him with this work.
The anthem is the string s of no more than 105 small Latin letters and question marks. The most glorious victory is the string t of no more than 105 small Latin letters. You should replace all the question marks with small Latin letters in such a way that the number of occurrences of string t in string s is maximal.
Note that the occurrences of string t in s can overlap. Check the third example for clarification.
Input
The first line contains string of small Latin letters and question marks s (1 ≤ |s| ≤ 105).
The second line contains string of small Latin letters t (1 ≤ |t| ≤ 105).
Product of lengths of strings |s|·|t| won't exceed 107.
Output
Output the maximum number of occurrences of string t you can achieve by replacing all the question marks in string s with small Latin letters.
Examples
Input
winlose???winl???w??
win
Output
5
Input
glo?yto?e??an?
or
Output
3
Input
??c?????
abcab
Output
2
Note
In the first example the resulting string s is "winlosewinwinlwinwin"
In the second example the resulting string s is "glorytoreorand". The last letter of the string can be arbitrary.
In the third example occurrences of string t are overlapping. String s with maximal number of occurrences of t is "abcabcab".
Submitted Solution:
```
def prefix(st):
p = [0, 0]
o = [0] * len(st)
for i in range(1, len(st)):
j = p[-1]
while j > 0 and st[j] != st[i]:
j = p[j - 1]
if st[i] == st[j]:
j += 1
p.append(j)
z = p[-1]
while z > 0:
o[z] = 1
z = p[z]
return p, o
s = ' ' + input()
t = ' ' + input()
p, o = prefix(t[1:])
m = len(t) - 1
ans = [[0, 0] for _ in range(len(s) + 5)]
ans[0][1] = float('-inf')
for i in range(1, len(s)):
j = m
ans[i][1] = float('-inf')
for j in range(m, 0, -1):
if s[i - m + j] != '?' and s[i - m + j] != t[j]:
break
if o[j - 1]:
ans[i][1] = max(ans[i][1], ans[i - m + j - 1][1] + 1)
if j == 1:
ans[i][1] = max(ans[i][1], ans[i - m][0] + 1)
ans[i][0] = max(ans[i][1], ans[i - 1][0])
if ans[len(s) - 1][0] == 7:
print(o)
else:
print(ans[len(s) - 1][0])
```
No
| 45,843
|
[
0.18603515625,
-0.040802001953125,
0.281494140625,
0.32666015625,
-0.279052734375,
0.0018472671508789062,
0.059661865234375,
0.038330078125,
0.1343994140625,
0.3642578125,
0.615234375,
-0.0173187255859375,
0.01374053955078125,
-0.64013671875,
-0.61181640625,
0.295166015625,
-0.55810546875,
-1.2587890625,
-0.736328125,
0.01177215576171875,
-0.58251953125,
-0.1419677734375,
-1.392578125,
-0.1903076171875,
-0.346923828125,
0.732421875,
0.300048828125,
0.322021484375,
0.8125,
1.119140625,
0.0970458984375,
-0.474853515625,
0.09423828125,
-0.9150390625,
-0.40673828125,
-0.444091796875,
0.625,
-0.7197265625,
-0.047119140625,
-0.51123046875,
-0.0163726806640625,
-0.583984375,
0.5908203125,
-0.58447265625,
-1.0087890625,
-0.1588134765625,
-0.5771484375,
-0.403076171875,
-0.166015625,
-0.267333984375,
0.437255859375,
-0.394775390625,
0.2021484375,
-0.0731201171875,
0.05712890625,
0.35107421875,
-0.2188720703125,
-0.305419921875,
-0.6767578125,
0.1895751953125,
0.0611572265625,
0.478515625,
-0.08428955078125,
-0.6708984375,
-0.31103515625,
0.2032470703125,
0.06689453125,
-0.1661376953125,
0.355224609375,
-0.8662109375,
-0.436279296875,
0.2998046875,
-0.568359375,
-0.486328125,
-0.336669921875,
0.06268310546875,
0.164306640625,
-0.0053253173828125,
-0.41748046875,
0.76416015625,
0.08447265625,
1.009765625,
0.38525390625,
0.2646484375,
-0.81787109375,
-0.377197265625,
0.071533203125,
0.4169921875,
0.315673828125,
-0.255126953125,
-0.11395263671875,
0.5966796875,
-0.57763671875,
-0.1329345703125,
0.56201171875,
0.77392578125,
-0.423828125,
0.260498046875,
0.1641845703125,
-0.2227783203125,
0.783203125,
0.69384765625,
-0.3857421875,
0.96044921875,
-0.56396484375,
0.342529296875,
0.01300811767578125,
0.21533203125,
0.198486328125,
-0.8037109375,
0.00867462158203125,
-0.00988006591796875,
0.81298828125,
0.148193359375,
-0.1260986328125,
0.72412109375,
-0.234130859375,
0.64794921875,
-0.5576171875,
0.32763671875,
0.054962158203125,
0.00856781005859375,
0.50927734375,
-0.380615234375,
-0.1607666015625,
-0.6083984375,
-0.55517578125,
0.83740234375,
-0.77587890625,
-0.0712890625,
0.373779296875,
-0.1707763671875,
0.056610107421875,
0.19677734375,
0.08636474609375,
0.93017578125,
-0.09930419921875,
0.453369140625,
0.94140625,
-0.74853515625,
0.71533203125,
-0.013519287109375,
0.1285400390625,
1.3818359375,
0.407958984375,
0.2318115234375,
0.8583984375,
-0.074951171875,
-0.517578125,
0.185302734375,
-0.61376953125,
0.70654296875,
-0.008209228515625,
0.19970703125,
-0.1593017578125,
0.248046875,
-0.2861328125,
0.273193359375,
0.306884765625,
-0.306396484375,
-0.5185546875,
0.5791015625,
-0.357177734375,
0.8564453125,
0.0197601318359375,
0.66064453125,
-0.35546875,
-0.017486572265625,
-0.0294952392578125,
-0.4169921875,
0.323486328125,
-0.4931640625,
0.1585693359375,
0.79541015625,
0.69189453125,
1.1025390625,
0.77587890625,
-0.19873046875,
0.2685546875,
0.487548828125,
-0.297119140625,
0.1151123046875,
0.42822265625,
0.55810546875,
-0.2039794921875,
0.1778564453125,
0.043121337890625,
-0.02227783203125,
-0.70751953125,
-0.6455078125,
0.320068359375,
0.75927734375,
-0.55322265625,
0.26220703125,
0.247314453125,
0.1568603515625,
-0.433837890625,
-0.0694580078125,
0.005756378173828125,
-1.0654296875,
-0.525390625,
0.6435546875,
-0.0225830078125,
0.430419921875,
-0.40576171875,
-0.430908203125,
0.41845703125,
1.078125,
-0.12091064453125,
0.165771484375,
0.720703125,
0.029449462890625,
-0.2452392578125,
0.30126953125,
0.2442626953125,
-0.08453369140625,
-0.1998291015625,
0.75341796875,
-0.335205078125,
0.056549072265625,
0.065185546875,
0.84765625,
0.0308685302734375,
0.416748046875,
-0.301025390625,
-0.362548828125,
0.1649169921875,
1.322265625,
-0.23681640625,
0.373779296875,
0.154541015625,
0.65478515625,
0.72119140625,
0.84033203125,
0.478759765625,
0.384765625,
0.7998046875,
0.7626953125,
-0.141845703125,
0.208251953125,
0.03045654296875,
0.2861328125,
0.44921875,
0.95068359375,
0.07183837890625,
0.349853515625,
-0.02960205078125,
-0.201171875,
-0.1981201171875,
0.350341796875,
-0.1357421875,
0.8603515625,
0.0732421875,
0.53955078125,
-0.80419921875,
-0.216064453125,
0.280029296875,
0.6083984375,
-0.68310546875,
-0.572265625,
-0.2139892578125,
0.26220703125,
0.329833984375,
0.08447265625,
0.041748046875,
0.491943359375,
0.4599609375,
0.43017578125,
-0.455810546875,
-0.755859375,
-0.5634765625,
-1.0390625,
-0.97119140625,
-0.49658203125,
-0.431396484375,
-0.060302734375,
0.685546875,
-0.837890625,
-0.0738525390625,
-0.1986083984375,
-0.039398193359375,
0.400390625,
-0.375732421875,
0.7685546875,
-0.365966796875,
0.34033203125,
-0.67578125,
0.61474609375,
0.1217041015625,
0.556640625,
-0.383056640625,
-0.12091064453125,
-0.034027099609375,
-0.578125,
-0.1719970703125,
0.080078125,
0.40966796875,
0.2587890625,
-0.4521484375,
-0.72021484375,
-0.10784912109375,
-0.0161590576171875,
-0.244384765625,
0.007167816162109375,
-0.53955078125,
0.58544921875,
0.2406005859375,
-0.912109375,
0.47705078125,
0.95556640625,
-1.0009765625,
0.67724609375,
0.39892578125,
0.09130859375,
-0.77099609375,
1.0556640625,
0.7578125,
0.465087890625,
-0.50390625,
-0.5498046875,
-0.55517578125,
0.09478759765625,
0.1556396484375,
-0.64111328125,
-0.54443359375,
0.5654296875,
0.0999755859375,
-1.1357421875,
0.46240234375,
-1.4052734375,
-0.55908203125,
-0.54443359375,
-0.255859375,
0.87841796875,
0.8330078125,
-0.1156005859375,
0.203857421875,
-0.1484375,
0.04217529296875,
0.6611328125,
0.6298828125,
-0.60693359375,
-0.205810546875,
0.958984375,
-0.2939453125,
0.09197998046875,
0.4189453125,
-0.441162109375,
-0.2437744140625,
-0.2332763671875,
0.07861328125,
0.6748046875,
0.0251617431640625,
0.327392578125,
0.081787109375,
0.7861328125,
-0.78271484375,
-0.3330078125,
-0.370361328125,
0.56591796875,
0.451171875,
0.59814453125,
0.7138671875,
0.2010498046875,
-0.59814453125,
-0.93603515625,
0.32958984375,
0.25537109375,
0.7294921875,
-0.74462890625,
0.64501953125,
0.57666015625,
-0.537109375,
0.74365234375,
-0.7138671875,
0.252197265625,
1.3828125,
-0.3623046875,
0.52587890625,
-0.5009765625,
0.2900390625,
-0.4619140625,
-0.1510009765625,
0.423095703125,
0.27880859375,
0.489013671875,
-0.51708984375,
-0.55859375,
-0.232421875,
0.0064239501953125,
0.187255859375,
-0.398193359375,
0.1405029296875,
-0.71826171875,
-0.319091796875,
-0.9453125,
0.28662109375,
0.59619140625,
0.50439453125,
0.119873046875,
0.53515625,
0.12261962890625,
0.428955078125,
0.697265625,
-0.366943359375,
-0.10552978515625,
-0.6064453125,
0.99072265625,
0.52392578125,
-0.09197998046875,
-0.609375,
-0.182861328125,
-0.56298828125,
0.388427734375,
0.04296875,
0.016845703125,
-0.91943359375,
0.373046875,
-0.164794921875,
0.51513671875,
-0.54248046875,
-0.01325225830078125,
-0.2305908203125,
0.5068359375,
0.048675537109375,
-0.93359375,
0.198974609375,
-0.70263671875,
0.1951904296875,
0.61962890625,
-0.055511474609375,
-0.54052734375,
-0.5908203125,
-0.54296875,
-0.85009765625,
-0.2232666015625,
1.076171875,
-0.269775390625,
0.0060272216796875,
-1.298828125,
0.60986328125,
0.359130859375,
-0.6123046875,
0.29736328125,
-0.2130126953125,
0.393798828125,
0.1455078125,
1.03125,
-0.194091796875,
-0.6083984375,
0.138916015625,
-1.466796875,
0.166015625,
-0.473388671875,
0.303955078125,
0.391845703125,
-0.033050537109375,
0.018890380859375,
0.466796875,
-0.09417724609375,
-0.216552734375,
0.097900390625,
0.191162109375,
-0.99072265625,
-0.63720703125,
0.69140625,
-0.1663818359375,
-0.62744140625,
1.1796875,
0.0226593017578125,
-0.50390625,
0.492431640625,
0.50341796875,
-0.47314453125,
0.471923828125,
-0.45751953125,
0.374755859375,
-0.164794921875,
-0.50732421875,
-0.02197265625,
-0.393798828125,
0.6767578125,
-0.217529296875,
-0.58935546875,
-0.4912109375,
-0.9326171875,
0.1273193359375,
0.0235595703125,
-0.45068359375,
0.220947265625,
0.2296142578125,
0.1160888671875,
-0.278564453125,
-0.364990234375,
-0.640625,
-0.5380859375,
-0.3486328125,
-0.043182373046875,
0.37646484375,
0.236328125,
0.60107421875,
0.23583984375,
-0.1578369140625,
-0.0650634765625,
0.114501953125,
0.07122802734375,
-0.63623046875,
-0.468994140625,
-0.46728515625,
-0.26708984375,
-0.433349609375,
0.352783203125,
0.00885009765625,
0.7783203125,
0.88623046875,
0.3203125,
0.269775390625,
-0.002079010009765625,
-0.70703125,
0.98583984375,
-0.177734375,
-1.4013671875,
-0.2734375,
0.466796875,
0.2294921875,
0.97607421875,
0.0390625,
-0.5751953125,
-0.71533203125,
-1.0380859375,
-0.163818359375,
-0.43310546875,
-0.1273193359375,
-1.314453125,
-0.42529296875,
-0.357421875,
0.8681640625,
-0.226318359375,
-0.69140625,
0.382080078125,
-0.984375,
-0.12109375,
-0.6083984375,
-0.33154296875,
-0.9619140625,
-0.59326171875,
-0.1104736328125,
1.1337890625,
0.423095703125,
0.53076171875,
-0.484619140625,
-0.3515625,
0.221435546875,
0.00946044921875,
-0.529296875,
-0.493408203125,
-0.0966796875,
-0.0276336669921875,
-0.0908203125,
0.03045654296875,
-0.4912109375,
0.476806640625,
-0.9619140625,
0.29345703125,
-0.367919921875,
-0.40283203125,
-0.0953369140625,
-0.17333984375,
0.96240234375,
-0.49365234375,
-0.15087890625,
-0.1822509765625,
0.254150390625,
0.84375,
-0.19140625,
-0.137939453125,
-0.681640625,
-0.767578125,
-0.82958984375,
0.5,
-0.3515625,
0.1898193359375,
-0.30224609375,
0.1043701171875,
1.3134765625,
-0.29541015625,
0.3515625,
1.216796875,
0.0364990234375,
0.196044921875,
-1.0205078125,
0.67578125,
0.4248046875,
-0.78955078125,
-0.0850830078125,
-0.10577392578125,
-0.78955078125,
0.06353759765625,
-0.56103515625,
-0.93896484375,
-0.609375,
0.2666015625,
1.3349609375,
-0.041015625,
0.673828125,
-0.014862060546875,
-1.158203125,
-0.7255859375,
0.669921875,
-0.0019588470458984375,
0.03955078125,
1.0224609375,
-0.1181640625,
-0.1268310546875,
-0.3017578125,
0.067626953125,
-0.11724853515625,
-0.5166015625,
1.1787109375,
-0.279296875,
-0.405517578125,
0.615234375,
0.68994140625,
-1.3818359375,
-1.1708984375,
-0.0224151611328125,
-0.1656494140625,
-0.277587890625,
-0.76416015625,
0.177978515625,
0.81787109375,
-0.33251953125,
0.21728515625,
0.1864013671875,
-0.20703125,
0.41943359375,
-0.00756072998046875,
0.72900390625,
-0.312744140625,
0.73193359375,
0.375732421875,
-0.7197265625,
-0.406005859375,
-1.2802734375,
-0.2305908203125,
-0.580078125,
0.11669921875,
0.95263671875,
-0.09588623046875,
0.055999755859375,
0.412109375,
-0.0127410888671875,
0.71923828125,
-0.5068359375,
-0.292236328125,
0.11529541015625,
-0.64208984375,
-0.5341796875,
-0.3330078125,
0.468505859375,
-0.10174560546875,
0.5185546875,
-0.806640625,
0.02667236328125,
0.2890625,
0.1861572265625,
-0.259033203125,
-0.60693359375,
-0.3232421875,
-0.93505859375,
-0.51708984375,
-0.7041015625,
-0.68017578125,
-0.296875,
0.58447265625,
0.1488037109375,
-0.25927734375,
0.005645751953125,
0.241943359375,
-0.34814453125,
0.64404296875,
-0.32421875,
0.5458984375,
-0.5068359375,
-0.422119140625,
-0.74072265625,
-0.015838623046875,
-0.65869140625,
0.002285003662109375,
-0.3935546875,
0.464111328125,
-0.1412353515625,
0.322265625,
-0.189208984375,
0.453369140625,
-0.2059326171875,
-0.54345703125,
0.279541015625,
0.057861328125,
-0.1591796875,
1.0185546875,
0.5673828125,
-0.051544189453125,
0.331298828125,
0.13623046875,
-0.18603515625,
-0.224365234375,
0.47509765625,
0.298095703125,
0.11083984375,
-0.27978515625,
-0.54345703125,
-0.0767822265625,
-0.78271484375,
0.515625,
-0.08599853515625,
0.397216796875,
0.1534423828125,
-0.39404296875,
0.61181640625,
0.92529296875,
-0.1978759765625,
0.323486328125,
0.177490234375,
0.023712158203125,
0.724609375,
0.398681640625,
-0.1658935546875,
0.6142578125,
0.353515625,
-0.34423828125,
0.1583251953125,
0.80859375,
0.0682373046875,
0.394775390625,
-0.3388671875,
-0.67236328125,
-1.15625,
-0.501953125,
0.059051513671875,
0.355712890625,
0.55517578125,
-0.5205078125,
-0.146240234375,
-0.0244140625,
-0.33740234375,
0.048675537109375,
-1.32421875,
-1.16796875,
0.473388671875,
0.12060546875,
-0.5380859375,
-0.20263671875,
-0.37109375,
-0.206787109375,
-0.1082763671875,
0.204345703125,
-0.2286376953125,
0.7734375,
0.158203125,
0.525390625,
-0.0689697265625,
-0.052520751953125,
0.28515625,
0.1959228515625,
-1.173828125,
-0.6181640625,
-0.197021484375,
1.1025390625,
0.2149658203125,
0.1331787109375,
-0.446533203125,
0.228271484375,
-0.298583984375,
0.0758056640625,
-0.343017578125,
0.25341796875,
0.173828125,
0.6689453125,
-0.52783203125,
-0.0699462890625,
-0.1810302734375,
0.175048828125,
0.090576171875,
-0.64697265625,
-0.1290283203125,
0.8408203125,
0.497802734375,
-0.42578125,
0.393310546875,
0.461669921875,
0.7529296875,
0.35986328125,
-0.09722900390625,
-0.331298828125,
0.6328125,
0.69580078125,
0.87353515625,
-0.2305908203125,
0.10784912109375,
0.5830078125,
0.21044921875,
0.1513671875,
0.78076171875,
0.18115234375,
-0.18359375,
0.282470703125,
-0.10516357421875,
-0.1248779296875,
0.31298828125,
-0.60986328125,
0.3896484375,
-0.51220703125,
-0.04119873046875,
-0.420166015625,
-0.77978515625,
0.818359375,
-0.0202789306640625,
-0.1468505859375,
0.2196044921875,
-0.681640625,
0.1966552734375,
0.78759765625,
0.0194854736328125,
-0.2318115234375,
0.7646484375,
0.66455078125,
0.78076171875,
0.7099609375,
0.244384765625,
0.343994140625,
-0.10333251953125,
0.1558837890625,
0.5029296875,
-0.0987548828125,
-0.74658203125,
-0.1263427734375,
-1.1845703125,
0.33154296875,
-0.40771484375,
0.020721435546875,
0.7509765625,
-0.80078125,
-0.1158447265625,
-0.7041015625,
0.52001953125,
-0.54833984375,
0.457763671875,
0.32470703125,
-0.1842041015625,
-1.076171875,
0.94580078125,
-0.278076171875,
0.3759765625,
0.026824951171875,
0.9521484375,
-0.10565185546875,
0.81494140625,
0.58837890625,
-0.304931640625,
-0.1412353515625,
0.306884765625,
-0.29931640625,
-0.471923828125,
-0.2115478515625,
-0.47900390625,
-0.045196533203125,
-0.74658203125,
-0.48828125,
-0.0309600830078125,
0.5234375,
0.2220458984375,
-0.86962890625,
-0.283447265625,
0.488037109375,
-0.7421875,
0.30322265625,
-0.0205230712890625,
0.378662109375,
0.1893310546875,
-0.1033935546875,
-0.3623046875,
-0.286376953125,
-0.088623046875,
-0.365234375,
0.6279296875,
-0.84814453125,
-0.35498046875,
-0.845703125,
-0.51123046875,
-0.020599365234375,
-0.25390625,
-0.60205078125,
-0.43994140625,
0.69140625,
0.384521484375,
0.283203125,
0.162109375,
-0.48388671875,
0.310302734375,
1.2060546875,
0.95361328125,
-0.09027099609375,
0.80029296875,
-0.16455078125,
-0.175048828125,
-0.07904052734375,
-0.51806640625,
0.31884765625,
-0.139404296875,
-0.408447265625,
-0.328369140625,
0.257080078125,
-0.92041015625,
-1.40234375,
0.06732177734375,
0.28857421875,
0.5703125,
-0.83642578125,
-1.3779296875,
0.0157012939453125,
-0.96142578125,
-0.2249755859375,
-0.6533203125,
0.4365234375,
-0.1868896484375,
-0.07562255859375,
-0.09710693359375,
-1.0791015625,
4.4453125,
0.85595703125,
0.599609375,
0.005279541015625,
0.15234375,
0.6865234375,
0.50439453125,
-0.51953125,
-0.1168212890625,
-0.152587890625,
0.326171875,
-0.111572265625,
0.256591796875,
0.5654296875,
0.35791015625,
0.73583984375,
-0.36181640625,
0.06475830078125,
0.4052734375,
-1.291015625,
-1.001953125,
0.286376953125,
0.2286376953125,
0.100830078125,
-0.135009765625,
0.1934814453125,
0.66796875,
-0.83251953125,
-0.14208984375,
-0.537109375,
-0.0262451171875,
-0.4541015625,
0.9462890625,
-0.2369384765625,
-0.1070556640625,
0.370849609375,
-0.050567626953125,
-0.58740234375,
0.07391357421875,
0.349853515625,
-0.0982666015625,
0.024261474609375,
0.454833984375,
-0.402587890625,
0.377685546875,
0.50732421875,
-0.73828125,
0.3564453125,
0.420654296875,
-0.77001953125,
1.1845703125,
-0.260986328125,
0.71826171875,
-0.58837890625,
-0.55615234375,
-0.404052734375,
0.10992431640625,
-0.224609375,
-0.1339111328125,
0.0999755859375,
0.314697265625,
0.341552734375,
0.251220703125,
0.83544921875,
-1.2568359375,
0.921875,
-0.251953125,
0.26416015625,
-0.501953125,
-0.50146484375,
-0.479248046875,
-0.4169921875,
-0.4169921875,
-0.6435546875,
0.68408203125,
0.29052734375,
-0.1820068359375,
0.66796875,
0.363525390625,
-0.447998046875,
0.00849151611328125,
-0.209716796875,
-0.1939697265625,
-0.435791015625,
0.346923828125,
1.0986328125,
-0.619140625,
-0.417236328125,
-0.47216796875,
1.0712890625,
0.69921875,
0.42529296875,
0.2054443359375,
-0.83642578125,
-0.85302734375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Tags: implementation
Correct Solution:
```
s = str(input())
n = int(input())
l = 'z'
c = 0
for i in range(n):
s1 = str(input())
if(s1 == s):
print(s)
exit()
if(s1[:len(s):] == s):
c+=1
if s1 < l:
l = s1
if(c == 0):
l = s
print(l)
```
| 46,641
|
[
-0.0953369140625,
-0.320556640625,
0.55126953125,
0.345703125,
-0.29833984375,
-0.188232421875,
-0.18798828125,
0.082763671875,
0.27783203125,
0.33642578125,
0.4150390625,
-0.174072265625,
0.004596710205078125,
-0.73193359375,
-0.72412109375,
0.04571533203125,
-0.85546875,
-0.55322265625,
-0.68505859375,
-0.053131103515625,
0.167724609375,
-0.00946044921875,
-1.248046875,
-0.418212890625,
-0.27587890625,
0.76953125,
0.318603515625,
0.09844970703125,
0.57568359375,
1.2099609375,
-0.06646728515625,
-0.435546875,
0.37353515625,
-0.99072265625,
-0.54541015625,
-0.446533203125,
0.49609375,
-0.974609375,
-0.346923828125,
-0.634765625,
0.304931640625,
-0.224365234375,
0.34912109375,
-0.6337890625,
-1.029296875,
0.09808349609375,
-0.69970703125,
-0.62255859375,
-0.29931640625,
-0.69580078125,
0.046234130859375,
-0.30810546875,
0.328857421875,
-0.164306640625,
-0.262939453125,
-0.32861328125,
-0.020355224609375,
-0.053009033203125,
-0.53564453125,
0.37060546875,
0.5341796875,
0.344970703125,
-0.3115234375,
-0.23388671875,
-0.300537109375,
0.371337890625,
0.1429443359375,
-0.33837890625,
0.1771240234375,
-0.546875,
-0.481689453125,
0.1328125,
-0.455078125,
-0.6884765625,
-0.059844970703125,
0.06439208984375,
0.1297607421875,
-0.2025146484375,
-0.173583984375,
0.734375,
0.323974609375,
0.7431640625,
0.55517578125,
0.44140625,
-0.22216796875,
-0.77685546875,
-0.184326171875,
0.10711669921875,
0.154052734375,
0.05712890625,
-0.10430908203125,
0.41162109375,
-0.139404296875,
0.0284576416015625,
0.92724609375,
0.9013671875,
0.0236968994140625,
0.423583984375,
0.46484375,
0.10345458984375,
0.64306640625,
0.8681640625,
-0.26416015625,
1.0673828125,
-0.83740234375,
0.357666015625,
0.0787353515625,
-0.326416015625,
-0.16552734375,
-0.5576171875,
-0.330322265625,
-0.21923828125,
0.29736328125,
0.5126953125,
-0.252197265625,
1.009765625,
-0.0458984375,
-0.0660400390625,
-0.64404296875,
0.34765625,
0.1749267578125,
0.390625,
-0.058929443359375,
-0.2052001953125,
0.1402587890625,
-0.59228515625,
-0.44873046875,
0.6767578125,
-0.853515625,
-0.2410888671875,
0.211181640625,
-0.09552001953125,
-0.0941162109375,
0.55029296875,
-0.0986328125,
0.63916015625,
-0.0679931640625,
0.5078125,
0.6787109375,
-0.78271484375,
0.841796875,
-0.364501953125,
0.1676025390625,
1.5029296875,
0.364501953125,
0.07647705078125,
0.6396484375,
0.391845703125,
-0.896484375,
0.41015625,
-0.461669921875,
0.68603515625,
0.392333984375,
-0.234130859375,
0.2607421875,
0.15771484375,
-0.061553955078125,
0.05914306640625,
0.2158203125,
0.30078125,
-0.46240234375,
0.1209716796875,
-0.244873046875,
0.849609375,
-0.349609375,
1.1162109375,
-0.6806640625,
-0.1253662109375,
0.1573486328125,
-0.271240234375,
0.031494140625,
-0.248046875,
-0.384033203125,
0.58642578125,
0.71630859375,
0.7919921875,
0.865234375,
-0.1575927734375,
0.344482421875,
-0.10595703125,
-0.394287109375,
-0.054534912109375,
0.3291015625,
0.732421875,
0.312255859375,
0.25537109375,
0.009368896484375,
-0.650390625,
-0.513671875,
-0.8837890625,
0.31787109375,
0.53076171875,
-0.5244140625,
0.151611328125,
0.10980224609375,
0.396240234375,
-0.78125,
-0.1927490234375,
0.1807861328125,
-0.99755859375,
-0.481689453125,
0.62548828125,
-0.44482421875,
0.1551513671875,
-0.52880859375,
-0.04180908203125,
0.344482421875,
1.279296875,
-0.380126953125,
0.0411376953125,
0.68212890625,
0.125,
-0.5908203125,
-0.024749755859375,
0.3408203125,
0.08526611328125,
-0.61474609375,
0.57373046875,
-0.262451171875,
-0.04547119140625,
0.1456298828125,
1.2177734375,
0.58447265625,
0.4140625,
-0.263427734375,
0.04541015625,
0.2139892578125,
0.9541015625,
-0.229736328125,
0.58154296875,
-0.089111328125,
1.056640625,
0.243896484375,
0.51416015625,
0.353515625,
0.214599609375,
0.72607421875,
0.60498046875,
-0.099609375,
0.257080078125,
0.1761474609375,
0.6884765625,
0.54833984375,
0.60107421875,
-0.201416015625,
0.5498046875,
-0.0631103515625,
0.048980712890625,
-0.42431640625,
0.315673828125,
0.22119140625,
0.90185546875,
-0.12060546875,
0.453857421875,
-0.375732421875,
-1.0361328125,
0.39453125,
0.63427734375,
-1.0068359375,
-0.66455078125,
-0.2044677734375,
-0.098876953125,
0.4755859375,
-0.24853515625,
0.302490234375,
0.345458984375,
0.474609375,
0.480224609375,
-0.340087890625,
-0.6044921875,
-0.908203125,
-0.98095703125,
-0.8779296875,
-0.05865478515625,
-0.65087890625,
-0.08843994140625,
0.347412109375,
-0.5439453125,
0.11944580078125,
-0.30859375,
-0.32763671875,
0.131103515625,
-0.335693359375,
0.505859375,
0.1282958984375,
0.55615234375,
-0.415771484375,
0.67236328125,
0.02044677734375,
1.142578125,
-0.5751953125,
-0.462646484375,
0.023956298828125,
-0.314697265625,
0.35498046875,
0.1513671875,
0.6767578125,
0.189697265625,
-0.9453125,
-0.6025390625,
-0.5107421875,
-0.1368408203125,
-0.136474609375,
0.2384033203125,
-0.46435546875,
0.9775390625,
0.061248779296875,
-0.6552734375,
0.4873046875,
0.58642578125,
-1.0087890625,
0.6787109375,
0.2607421875,
-0.0418701171875,
-0.79296875,
1.4462890625,
0.265625,
0.275634765625,
-0.2548828125,
-0.47021484375,
-0.407958984375,
0.2315673828125,
0.11468505859375,
-0.73388671875,
-0.1112060546875,
0.56103515625,
-0.00714111328125,
-1.138671875,
0.406494140625,
-1.18359375,
-0.56005859375,
-0.40185546875,
-0.056488037109375,
1.052734375,
0.7529296875,
0.1309814453125,
-0.1630859375,
0.4560546875,
-0.25439453125,
0.79296875,
0.288330078125,
-0.54150390625,
-0.2283935546875,
0.418701171875,
0.16162109375,
-0.30712890625,
0.2451171875,
-0.36083984375,
0.232666015625,
-0.2391357421875,
-0.161376953125,
0.779296875,
0.29345703125,
-0.058624267578125,
-0.163330078125,
0.544921875,
-0.8671875,
-0.08489990234375,
-0.0240478515625,
0.73681640625,
0.61181640625,
0.89697265625,
0.024658203125,
-0.046966552734375,
0.146240234375,
-1.1513671875,
0.70556640625,
0.23876953125,
0.71630859375,
-0.78271484375,
0.45751953125,
0.11383056640625,
-0.68896484375,
0.232421875,
-0.81689453125,
-0.64013671875,
1.0400390625,
-0.279052734375,
0.88232421875,
-0.25830078125,
0.4072265625,
-0.484619140625,
0.07958984375,
0.470703125,
-0.142822265625,
0.56298828125,
-0.225341796875,
-0.1727294921875,
-0.607421875,
-0.11444091796875,
0.04278564453125,
-0.34814453125,
0.1573486328125,
-0.1839599609375,
-0.3720703125,
-0.9326171875,
0.9091796875,
0.6904296875,
0.041534423828125,
-0.3125,
0.146240234375,
0.175048828125,
0.55029296875,
0.492919921875,
-0.342041015625,
0.1920166015625,
-0.7255859375,
0.7880859375,
0.0023708343505859375,
-0.16064453125,
-0.6025390625,
-0.385498046875,
-0.285888671875,
0.356201171875,
0.12103271484375,
-0.0369873046875,
-0.98779296875,
0.392578125,
-0.2276611328125,
0.52099609375,
-0.63525390625,
-0.2861328125,
-0.54296875,
0.728515625,
0.486083984375,
-0.80517578125,
0.399658203125,
-0.288330078125,
0.25244140625,
0.34521484375,
-0.2442626953125,
-0.364013671875,
-0.7490234375,
-0.525390625,
-0.74755859375,
0.701171875,
0.68212890625,
-0.2166748046875,
0.48095703125,
-0.96435546875,
0.472900390625,
-0.0176544189453125,
-0.06817626953125,
0.0562744140625,
0.1990966796875,
0.396484375,
0.130615234375,
0.9267578125,
-0.2880859375,
-0.69580078125,
0.2047119140625,
-1.2333984375,
0.88623046875,
-0.32861328125,
0.91552734375,
0.14111328125,
-0.1605224609375,
-0.2164306640625,
0.50634765625,
-0.6015625,
0.089111328125,
-0.1849365234375,
0.395751953125,
-0.91064453125,
-0.84814453125,
0.7861328125,
-0.410888671875,
-0.1851806640625,
0.87109375,
-0.0235137939453125,
-0.68017578125,
0.2037353515625,
0.56103515625,
-0.5478515625,
0.2291259765625,
-0.6943359375,
0.26806640625,
-0.446533203125,
-0.2685546875,
-0.11297607421875,
-0.77685546875,
0.458984375,
0.17138671875,
-0.505859375,
-0.142822265625,
-1.001953125,
0.013153076171875,
0.054718017578125,
-0.43310546875,
0.423095703125,
-0.1500244140625,
-0.37890625,
-0.314453125,
-0.28076171875,
-0.82421875,
-0.53271484375,
-0.64306640625,
-0.287353515625,
0.208740234375,
0.206787109375,
0.6953125,
-0.186767578125,
-0.64013671875,
0.104248046875,
0.10333251953125,
-0.338623046875,
-0.195556640625,
-0.0908203125,
-0.031890869140625,
-0.0614013671875,
-0.1563720703125,
0.08941650390625,
0.1099853515625,
0.49462890625,
0.451171875,
0.5009765625,
0.286865234375,
0.487060546875,
-0.445068359375,
0.6630859375,
0.160888671875,
-0.65576171875,
0.12451171875,
0.662109375,
-0.07940673828125,
0.6142578125,
0.51025390625,
-0.79931640625,
-0.54052734375,
-0.96875,
-0.195556640625,
-0.33154296875,
-0.076904296875,
-1.146484375,
-0.65380859375,
-0.250732421875,
0.505859375,
0.1748046875,
-0.34228515625,
0.0287933349609375,
-1.1259765625,
0.11322021484375,
-0.7138671875,
-0.219482421875,
-0.9580078125,
-0.72021484375,
-0.1370849609375,
0.66259765625,
-0.15771484375,
0.300537109375,
-0.59765625,
-0.1109619140625,
0.61962890625,
-0.513671875,
-1.0234375,
-0.488037109375,
-0.155517578125,
0.1658935546875,
0.06866455078125,
0.3037109375,
-0.455322265625,
0.321044921875,
-0.6640625,
0.299560546875,
-0.74072265625,
-0.334716796875,
-0.391845703125,
0.1148681640625,
0.88330078125,
-0.19580078125,
-0.32275390625,
0.047332763671875,
0.6298828125,
0.56298828125,
-0.274169921875,
-0.2237548828125,
-0.96875,
-0.42724609375,
-0.81201171875,
0.360595703125,
-0.64306640625,
0.1158447265625,
-0.373046875,
0.06292724609375,
1.341796875,
-0.1431884765625,
0.7373046875,
0.92626953125,
0.3115234375,
0.1771240234375,
-0.830078125,
0.7509765625,
0.7294921875,
-0.63232421875,
0.10321044921875,
0.13671875,
-0.53173828125,
0.2169189453125,
-0.11639404296875,
-1.1650390625,
-0.436279296875,
0.47265625,
1.2509765625,
0.060638427734375,
0.39794921875,
-0.192138671875,
-1.2138671875,
0.031402587890625,
0.73486328125,
0.259765625,
0.07574462890625,
0.78515625,
0.1883544921875,
0.048553466796875,
-0.2235107421875,
-0.2281494140625,
0.08135986328125,
-0.38623046875,
1.2421875,
-0.395263671875,
-0.74658203125,
1.1015625,
1.0615234375,
-0.775390625,
-1.24609375,
0.0299835205078125,
0.290283203125,
-0.2127685546875,
-0.73095703125,
0.415283203125,
0.263916015625,
-0.59326171875,
0.14404296875,
0.252197265625,
0.0030670166015625,
0.014923095703125,
0.1363525390625,
-0.019989013671875,
-0.445068359375,
0.1107177734375,
0.7763671875,
-0.2822265625,
-0.50048828125,
-1.0439453125,
-0.0310211181640625,
-0.300537109375,
0.06597900390625,
0.75927734375,
-0.1365966796875,
0.011322021484375,
0.44873046875,
0.208251953125,
0.880859375,
-0.4541015625,
-0.179931640625,
0.251953125,
-0.485595703125,
-0.74462890625,
-0.072021484375,
0.83935546875,
-0.0888671875,
0.1788330078125,
-1.0869140625,
0.149169921875,
0.359130859375,
0.078125,
-0.599609375,
-0.91357421875,
-0.2196044921875,
-0.90966796875,
-0.40673828125,
-0.2958984375,
-0.5341796875,
-0.31298828125,
-0.2020263671875,
0.0180206298828125,
-0.08514404296875,
-0.01739501953125,
0.40625,
-0.55419921875,
0.3896484375,
-0.481689453125,
0.7626953125,
-0.45556640625,
-0.08087158203125,
-0.54345703125,
0.1549072265625,
-0.2457275390625,
0.0029048919677734375,
-0.94677734375,
0.216796875,
0.64892578125,
0.0897216796875,
-0.2254638671875,
0.363037109375,
-0.7529296875,
-0.491455078125,
0.11102294921875,
0.12548828125,
-0.2705078125,
0.8759765625,
0.482177734375,
-0.159423828125,
0.61181640625,
-0.006694793701171875,
-0.446533203125,
-0.32763671875,
0.34521484375,
0.6923828125,
-0.2230224609375,
0.13232421875,
-0.2257080078125,
0.23974609375,
-0.94482421875,
-0.0019073486328125,
-0.255126953125,
0.1434326171875,
0.239013671875,
-0.2222900390625,
0.6123046875,
1.1279296875,
-0.1104736328125,
0.09173583984375,
-0.1214599609375,
0.1749267578125,
0.423095703125,
-0.10272216796875,
-0.1854248046875,
0.258544921875,
0.50634765625,
-0.1597900390625,
-0.1727294921875,
0.458984375,
-0.0296478271484375,
0.22705078125,
0.042144775390625,
-0.6650390625,
-0.9853515625,
-0.0201263427734375,
-0.06256103515625,
0.3798828125,
0.439453125,
-0.15673828125,
-0.040924072265625,
-0.189453125,
-0.78466796875,
0.3740234375,
-1.0986328125,
-0.93994140625,
-0.1058349609375,
-0.152099609375,
-0.8359375,
-0.1689453125,
-0.62744140625,
-0.22900390625,
0.2000732421875,
0.5224609375,
-0.595703125,
0.468017578125,
0.207763671875,
0.306396484375,
0.069580078125,
0.037109375,
0.267578125,
0.55322265625,
-0.724609375,
-0.498291015625,
0.40283203125,
0.859375,
0.59716796875,
-0.1624755859375,
-0.94775390625,
0.0677490234375,
0.36572265625,
-0.0228271484375,
-0.6416015625,
0.1004638671875,
-0.2138671875,
0.8447265625,
-0.8095703125,
-0.050750732421875,
-0.006473541259765625,
0.640625,
0.018707275390625,
-0.1170654296875,
-0.1922607421875,
0.477294921875,
1.2041015625,
-0.388671875,
0.759765625,
0.357177734375,
0.06365966796875,
-0.144287109375,
-0.23681640625,
-0.517578125,
0.8310546875,
0.86083984375,
0.5634765625,
0.017547607421875,
0.348876953125,
0.787109375,
-0.07257080078125,
-0.095458984375,
0.47021484375,
-0.04852294921875,
0.0309295654296875,
-0.10723876953125,
0.2227783203125,
-0.342041015625,
-0.06195068359375,
-0.6767578125,
0.2332763671875,
-0.496337890625,
-0.2052001953125,
-0.447265625,
-0.64013671875,
1.1396484375,
-0.329345703125,
-0.008514404296875,
-0.08245849609375,
-0.5048828125,
0.473388671875,
0.7392578125,
-0.0113677978515625,
-0.423095703125,
0.68505859375,
0.199462890625,
0.26904296875,
0.6533203125,
0.400634765625,
0.453857421875,
-0.5390625,
0.1524658203125,
-0.2320556640625,
-0.059295654296875,
-0.2587890625,
-0.366943359375,
-0.8525390625,
0.501953125,
0.054443359375,
-0.5078125,
0.9306640625,
-0.697265625,
0.022430419921875,
-0.260009765625,
0.71484375,
-0.53466796875,
0.63916015625,
0.249755859375,
-0.222900390625,
-0.91015625,
0.76708984375,
-0.16943359375,
0.3525390625,
0.141357421875,
1.0654296875,
-0.135009765625,
1.2890625,
0.28125,
-0.1943359375,
-0.231689453125,
0.419189453125,
-0.58203125,
-0.943359375,
-0.35791015625,
-0.53125,
0.019073486328125,
-0.389404296875,
-0.288330078125,
-0.0167694091796875,
0.62890625,
0.1429443359375,
-0.98876953125,
-0.6630859375,
0.26904296875,
-0.546875,
0.25244140625,
0.5107421875,
0.05706787109375,
0.07073974609375,
-0.411865234375,
-0.407470703125,
-0.53759765625,
0.26904296875,
-0.68798828125,
0.52587890625,
-0.406494140625,
-0.21484375,
-0.458740234375,
-0.5224609375,
-0.2098388671875,
0.1265869140625,
-0.314697265625,
-0.828125,
0.1173095703125,
0.318115234375,
0.382568359375,
0.454833984375,
-0.1741943359375,
0.1339111328125,
1.18359375,
0.9765625,
0.226318359375,
0.62451171875,
0.373779296875,
-0.08984375,
0.1622314453125,
-0.250732421875,
0.453369140625,
-0.48876953125,
0.330322265625,
-0.1868896484375,
0.59521484375,
-0.67431640625,
-1.212890625,
0.227783203125,
0.3876953125,
0.38671875,
-0.473876953125,
-0.84130859375,
-0.433349609375,
-1.138671875,
-0.031463623046875,
-0.55322265625,
0.900390625,
0.01131439208984375,
-0.120849609375,
-0.272216796875,
-0.79638671875,
4.5078125,
1.369140625,
0.59228515625,
0.49462890625,
0.038482666015625,
1.015625,
0.599609375,
-0.366455078125,
-0.01092529296875,
-0.276611328125,
0.35498046875,
-0.2205810546875,
-0.1060791015625,
0.8662109375,
0.482666015625,
0.46533203125,
-0.7744140625,
0.2059326171875,
-0.268310546875,
-0.958984375,
-0.72509765625,
0.2274169921875,
-0.2012939453125,
0.435302734375,
-0.1590576171875,
0.67919921875,
0.46044921875,
-0.7734375,
-0.336181640625,
-0.51220703125,
0.0888671875,
-0.4755859375,
0.87451171875,
0.06817626953125,
-0.4765625,
0.272705078125,
-0.2186279296875,
-0.611328125,
-0.51708984375,
0.379638671875,
-0.0201416015625,
0.1259765625,
0.8017578125,
-0.450927734375,
0.429443359375,
0.55029296875,
-0.7158203125,
0.19140625,
-0.055389404296875,
-0.95458984375,
0.5576171875,
-0.450927734375,
-0.0304412841796875,
-0.256103515625,
-0.9658203125,
-0.463134765625,
0.6904296875,
-0.1209716796875,
-0.0474853515625,
0.396728515625,
0.50537109375,
-0.06695556640625,
0.09442138671875,
0.61962890625,
-1.142578125,
0.71435546875,
-0.05908203125,
0.46875,
-0.38720703125,
-0.2724609375,
-0.186767578125,
-0.251953125,
-0.496337890625,
-0.31689453125,
0.583984375,
0.33984375,
-0.2244873046875,
0.320068359375,
0.491943359375,
-0.9072265625,
0.4521484375,
-0.005474090576171875,
-0.73291015625,
-0.6337890625,
0.892578125,
1.08984375,
-0.6591796875,
-0.456298828125,
-0.235107421875,
0.52978515625,
0.48291015625,
0.63671875,
-0.05169677734375,
-0.491943359375,
-0.14453125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Tags: implementation
Correct Solution:
```
current_input = input()
num_history = int(input())
history_arr = [input() for _ in range(num_history)]
relevant_arr = [history_element for history_element in history_arr if (history_element[:len(current_input)] == current_input)]
relevant_arr.sort()
print(relevant_arr[0] if len(relevant_arr) > 0 else current_input)
# NOTE: LIST COMPREHENSIONS. IF YOU WANT TO FILTER STUFF, AND NOT INCLUDE STUFF THAT IS FILTERED OUT, YOU ONLY WANT IF AND NOT ELSE:
# [x for x in arr if (x satisfies condition)]
# If you want both if and else, you put it before:
# [x if (x satisfies condition) else y for x in arr]
# For more see https://stackoverflow.com/questions/4406389/if-else-in-a-list-comprehension
```
| 46,642
|
[
0.0009016990661621094,
-0.254150390625,
0.572265625,
0.425048828125,
-0.25390625,
-0.1575927734375,
-0.2890625,
0.08984375,
0.306884765625,
0.394287109375,
0.39892578125,
-0.2144775390625,
-0.0032596588134765625,
-0.7158203125,
-0.73388671875,
0.050323486328125,
-0.86279296875,
-0.49462890625,
-0.78173828125,
-0.03887939453125,
0.150146484375,
-0.01413726806640625,
-1.21875,
-0.456787109375,
-0.37939453125,
0.8115234375,
0.2568359375,
0.138671875,
0.56494140625,
1.197265625,
-0.054351806640625,
-0.42333984375,
0.283447265625,
-0.96826171875,
-0.53564453125,
-0.467041015625,
0.428466796875,
-0.95263671875,
-0.328857421875,
-0.689453125,
0.177734375,
-0.26220703125,
0.261962890625,
-0.6875,
-1.01953125,
0.20361328125,
-0.76708984375,
-0.669921875,
-0.303466796875,
-0.71533203125,
0.03546142578125,
-0.299072265625,
0.284423828125,
-0.130615234375,
-0.1627197265625,
-0.34814453125,
-0.0102996826171875,
-0.004932403564453125,
-0.6064453125,
0.320068359375,
0.568359375,
0.377197265625,
-0.259765625,
-0.3232421875,
-0.263427734375,
0.427734375,
0.1258544921875,
-0.350341796875,
0.163330078125,
-0.484375,
-0.5400390625,
0.07275390625,
-0.388916015625,
-0.7294921875,
-0.0755615234375,
0.026824951171875,
0.1444091796875,
-0.1468505859375,
-0.1785888671875,
0.7490234375,
0.306396484375,
0.6923828125,
0.60986328125,
0.4306640625,
-0.1878662109375,
-0.72216796875,
-0.24169921875,
0.151611328125,
0.13720703125,
0.1851806640625,
-0.09051513671875,
0.3818359375,
-0.1995849609375,
0.0164031982421875,
0.8896484375,
0.95166015625,
-0.007068634033203125,
0.4013671875,
0.41162109375,
0.18994140625,
0.7265625,
0.79345703125,
-0.359375,
1.009765625,
-0.7646484375,
0.399169921875,
0.0279541015625,
-0.3720703125,
-0.11968994140625,
-0.662109375,
-0.369873046875,
-0.19775390625,
0.2724609375,
0.45166015625,
-0.17822265625,
0.97705078125,
-0.021148681640625,
-0.023834228515625,
-0.67333984375,
0.36279296875,
0.20166015625,
0.291259765625,
-0.110595703125,
-0.16064453125,
0.113525390625,
-0.58984375,
-0.45849609375,
0.65771484375,
-0.85693359375,
-0.2008056640625,
0.25390625,
-0.0361328125,
-0.0261383056640625,
0.53955078125,
-0.038482666015625,
0.57470703125,
-0.037506103515625,
0.52978515625,
0.6953125,
-0.82373046875,
0.8408203125,
-0.4697265625,
0.10235595703125,
1.4736328125,
0.4423828125,
0.070068359375,
0.5166015625,
0.294921875,
-0.8037109375,
0.47412109375,
-0.43017578125,
0.7041015625,
0.36376953125,
-0.263427734375,
0.2425537109375,
0.166259765625,
-0.08807373046875,
0.07989501953125,
0.2626953125,
0.40625,
-0.5546875,
0.1868896484375,
-0.2421875,
0.8251953125,
-0.317138671875,
1.140625,
-0.6640625,
-0.1373291015625,
0.11956787109375,
-0.27685546875,
-0.107666015625,
-0.250732421875,
-0.36474609375,
0.6171875,
0.79052734375,
0.73583984375,
0.87939453125,
-0.1622314453125,
0.36474609375,
-0.07208251953125,
-0.37255859375,
-0.09912109375,
0.384765625,
0.68408203125,
0.31640625,
0.1722412109375,
-0.0036678314208984375,
-0.63720703125,
-0.4677734375,
-0.86083984375,
0.3701171875,
0.5419921875,
-0.432373046875,
0.2442626953125,
0.1351318359375,
0.384765625,
-0.82373046875,
-0.161376953125,
0.2242431640625,
-1.01953125,
-0.446533203125,
0.6357421875,
-0.4169921875,
0.2105712890625,
-0.54150390625,
-0.029541015625,
0.326416015625,
1.30859375,
-0.455810546875,
0.1519775390625,
0.67236328125,
0.031890869140625,
-0.5595703125,
0.0143280029296875,
0.263427734375,
0.0297088623046875,
-0.603515625,
0.52392578125,
-0.23046875,
-0.12078857421875,
0.18505859375,
1.1416015625,
0.68896484375,
0.422119140625,
-0.2401123046875,
0.13818359375,
0.224853515625,
0.958984375,
-0.26318359375,
0.625,
-0.041717529296875,
0.982421875,
0.2384033203125,
0.5263671875,
0.33349609375,
0.2037353515625,
0.76123046875,
0.59716796875,
-0.11907958984375,
0.25146484375,
0.181396484375,
0.79443359375,
0.66455078125,
0.58837890625,
-0.245849609375,
0.53515625,
-0.033538818359375,
0.066162109375,
-0.372314453125,
0.3173828125,
0.18310546875,
0.908203125,
-0.233642578125,
0.439453125,
-0.384521484375,
-1.107421875,
0.42041015625,
0.71337890625,
-0.98291015625,
-0.68212890625,
-0.246337890625,
-0.024810791015625,
0.372314453125,
-0.2486572265625,
0.3232421875,
0.354736328125,
0.5810546875,
0.43994140625,
-0.39013671875,
-0.69140625,
-0.88720703125,
-1,
-0.7958984375,
0.0090179443359375,
-0.65234375,
-0.1124267578125,
0.326904296875,
-0.6123046875,
0.1015625,
-0.342041015625,
-0.283935546875,
0.0245819091796875,
-0.2117919921875,
0.482421875,
0.0765380859375,
0.5380859375,
-0.46630859375,
0.6904296875,
-0.016265869140625,
1.150390625,
-0.52880859375,
-0.61279296875,
-0.0841064453125,
-0.325927734375,
0.324951171875,
0.203125,
0.6435546875,
0.254638671875,
-0.89697265625,
-0.6640625,
-0.450927734375,
-0.07769775390625,
-0.190673828125,
0.230712890625,
-0.47998046875,
0.97607421875,
0.061370849609375,
-0.64306640625,
0.486328125,
0.58203125,
-0.9326171875,
0.72900390625,
0.31982421875,
-0.051055908203125,
-0.85693359375,
1.4658203125,
0.3115234375,
0.305419921875,
-0.28271484375,
-0.450439453125,
-0.513671875,
0.258544921875,
0.1053466796875,
-0.81884765625,
-0.026580810546875,
0.6455078125,
0.006061553955078125,
-1.138671875,
0.454833984375,
-1.205078125,
-0.63818359375,
-0.427001953125,
-0.11395263671875,
0.93701171875,
0.68359375,
0.136962890625,
-0.10455322265625,
0.437744140625,
-0.2099609375,
0.8212890625,
0.3125,
-0.53759765625,
-0.205322265625,
0.389892578125,
0.158935546875,
-0.25,
0.28564453125,
-0.4365234375,
0.2449951171875,
-0.233642578125,
-0.1959228515625,
0.884765625,
0.306640625,
-0.01284027099609375,
-0.09893798828125,
0.55419921875,
-0.86376953125,
-0.0212249755859375,
-0.0430908203125,
0.67333984375,
0.59912109375,
0.81982421875,
0.0015964508056640625,
-0.0309906005859375,
0.185302734375,
-1.08984375,
0.7548828125,
0.1585693359375,
0.7236328125,
-0.86572265625,
0.45947265625,
0.1568603515625,
-0.74072265625,
0.2213134765625,
-0.841796875,
-0.6953125,
1.0458984375,
-0.1907958984375,
0.97119140625,
-0.23828125,
0.377685546875,
-0.488037109375,
0.058441162109375,
0.505859375,
-0.11346435546875,
0.5810546875,
-0.1517333984375,
-0.109130859375,
-0.6064453125,
-0.1903076171875,
0.038909912109375,
-0.287109375,
0.1409912109375,
-0.2861328125,
-0.376220703125,
-0.91845703125,
0.919921875,
0.6416015625,
0.09234619140625,
-0.236083984375,
0.1513671875,
0.1436767578125,
0.57861328125,
0.49072265625,
-0.2132568359375,
0.2025146484375,
-0.68896484375,
0.84326171875,
0.107177734375,
-0.1611328125,
-0.546875,
-0.38134765625,
-0.37353515625,
0.38134765625,
0.0494384765625,
-0.0208892822265625,
-1.080078125,
0.27734375,
-0.15869140625,
0.498291015625,
-0.5693359375,
-0.355712890625,
-0.53662109375,
0.83447265625,
0.53662109375,
-0.75146484375,
0.347412109375,
-0.2783203125,
0.2568359375,
0.427001953125,
-0.171630859375,
-0.4365234375,
-0.716796875,
-0.5771484375,
-0.8212890625,
0.7109375,
0.6337890625,
-0.14404296875,
0.445068359375,
-0.93310546875,
0.457763671875,
0.0249786376953125,
-0.034088134765625,
0.059783935546875,
0.10662841796875,
0.39306640625,
0.09796142578125,
0.876953125,
-0.278076171875,
-0.7109375,
0.1981201171875,
-1.19140625,
0.873046875,
-0.321044921875,
0.88037109375,
0.114013671875,
-0.08172607421875,
-0.2724609375,
0.57763671875,
-0.5419921875,
0.04339599609375,
-0.1448974609375,
0.29638671875,
-0.97998046875,
-0.8603515625,
0.841796875,
-0.365966796875,
-0.1923828125,
0.84521484375,
-0.00392913818359375,
-0.6875,
0.267578125,
0.50390625,
-0.57080078125,
0.270751953125,
-0.6025390625,
0.297607421875,
-0.3623046875,
-0.251953125,
-0.12115478515625,
-0.70654296875,
0.5078125,
0.1688232421875,
-0.50244140625,
-0.24560546875,
-1.00390625,
-0.0191802978515625,
0.0131378173828125,
-0.4892578125,
0.29150390625,
-0.1446533203125,
-0.37109375,
-0.404541015625,
-0.2900390625,
-0.8037109375,
-0.50439453125,
-0.619140625,
-0.333984375,
0.2100830078125,
0.1788330078125,
0.6962890625,
-0.108642578125,
-0.6865234375,
0.0640869140625,
0.08782958984375,
-0.295654296875,
-0.2061767578125,
-0.1495361328125,
0.022430419921875,
0.0243377685546875,
-0.130126953125,
-0.0015010833740234375,
0.145263671875,
0.53759765625,
0.49853515625,
0.44287109375,
0.26806640625,
0.486572265625,
-0.52685546875,
0.70166015625,
0.191162109375,
-0.60986328125,
0.1341552734375,
0.5791015625,
-0.0297088623046875,
0.642578125,
0.47900390625,
-0.8583984375,
-0.564453125,
-0.9921875,
-0.25146484375,
-0.2841796875,
-0.1278076171875,
-1.1279296875,
-0.67529296875,
-0.195068359375,
0.5537109375,
0.182373046875,
-0.30029296875,
0.07513427734375,
-1.0546875,
0.1185302734375,
-0.73193359375,
-0.2000732421875,
-0.96923828125,
-0.77587890625,
-0.0958251953125,
0.5673828125,
-0.126953125,
0.30859375,
-0.6142578125,
-0.18798828125,
0.59375,
-0.505859375,
-1.08984375,
-0.54052734375,
-0.2064208984375,
0.1954345703125,
0.008697509765625,
0.3427734375,
-0.4677734375,
0.317626953125,
-0.6181640625,
0.254150390625,
-0.76513671875,
-0.31982421875,
-0.374267578125,
0.07843017578125,
0.91455078125,
-0.210205078125,
-0.294677734375,
0.061248779296875,
0.6416015625,
0.501953125,
-0.23095703125,
-0.195556640625,
-0.89599609375,
-0.38037109375,
-0.7705078125,
0.352783203125,
-0.6982421875,
0.115966796875,
-0.34033203125,
0.1197509765625,
1.3125,
-0.176513671875,
0.78125,
0.98193359375,
0.1776123046875,
0.268310546875,
-0.88671875,
0.740234375,
0.70703125,
-0.67431640625,
0.07135009765625,
0.07464599609375,
-0.5498046875,
0.139892578125,
-0.195556640625,
-1.1005859375,
-0.34033203125,
0.38232421875,
1.3115234375,
0.1251220703125,
0.460693359375,
-0.11700439453125,
-1.2705078125,
0.0132293701171875,
0.7626953125,
0.2410888671875,
0.1807861328125,
0.7998046875,
0.195556640625,
0.078125,
-0.310791015625,
-0.197998046875,
0.1180419921875,
-0.36962890625,
1.2119140625,
-0.373779296875,
-0.76123046875,
1.025390625,
1.0927734375,
-0.7783203125,
-1.2421875,
-0.02740478515625,
0.301513671875,
-0.26171875,
-0.74462890625,
0.48388671875,
0.32568359375,
-0.5810546875,
0.2010498046875,
0.33056640625,
-0.0758056640625,
-0.01000213623046875,
0.1502685546875,
-0.014312744140625,
-0.439453125,
0.0188446044921875,
0.75244140625,
-0.32177734375,
-0.5302734375,
-1.0244140625,
0.00650787353515625,
-0.291259765625,
0.185546875,
0.74609375,
-0.1314697265625,
-0.0188751220703125,
0.4345703125,
0.247314453125,
0.8994140625,
-0.429443359375,
-0.2496337890625,
0.234130859375,
-0.473388671875,
-0.75634765625,
-0.037872314453125,
0.91064453125,
-0.08331298828125,
0.1502685546875,
-1.029296875,
0.1873779296875,
0.375,
0.08392333984375,
-0.496337890625,
-0.9599609375,
-0.250244140625,
-0.99169921875,
-0.467529296875,
-0.302490234375,
-0.51025390625,
-0.376953125,
-0.2227783203125,
-0.05389404296875,
-0.12841796875,
0.007442474365234375,
0.5048828125,
-0.501953125,
0.329345703125,
-0.388916015625,
0.77001953125,
-0.52001953125,
-0.12890625,
-0.62548828125,
0.1707763671875,
-0.243896484375,
0.004913330078125,
-0.84423828125,
0.25439453125,
0.64501953125,
0.01020050048828125,
-0.1937255859375,
0.317138671875,
-0.7734375,
-0.49462890625,
0.08416748046875,
0.13525390625,
-0.275390625,
0.8916015625,
0.46240234375,
-0.1463623046875,
0.52978515625,
0.0184783935546875,
-0.45751953125,
-0.355712890625,
0.322509765625,
0.71337890625,
-0.18359375,
0.059234619140625,
-0.305419921875,
0.1734619140625,
-0.9560546875,
-0.01096343994140625,
-0.2210693359375,
0.2315673828125,
0.2005615234375,
-0.214111328125,
0.587890625,
1.158203125,
-0.12139892578125,
0.13916015625,
-0.0692138671875,
0.212158203125,
0.424560546875,
-0.1143798828125,
-0.2093505859375,
0.2193603515625,
0.53076171875,
-0.06781005859375,
-0.1883544921875,
0.47705078125,
-0.0872802734375,
0.271240234375,
0.02374267578125,
-0.59228515625,
-1.064453125,
-0.04815673828125,
-0.095947265625,
0.44482421875,
0.470947265625,
-0.196533203125,
0.06170654296875,
-0.129150390625,
-0.77392578125,
0.375244140625,
-1.154296875,
-0.9716796875,
-0.07098388671875,
-0.180419921875,
-0.8173828125,
-0.203369140625,
-0.60400390625,
-0.2369384765625,
0.2418212890625,
0.5224609375,
-0.548828125,
0.458984375,
0.1522216796875,
0.385498046875,
0.10662841796875,
-0.003543853759765625,
0.3212890625,
0.469970703125,
-0.68896484375,
-0.485107421875,
0.31591796875,
0.8564453125,
0.60498046875,
-0.12445068359375,
-0.93017578125,
0.130615234375,
0.345458984375,
-0.046875,
-0.7109375,
0.11810302734375,
-0.142822265625,
0.8857421875,
-0.77099609375,
-0.030517578125,
-0.1322021484375,
0.564453125,
0.09454345703125,
-0.1097412109375,
-0.1885986328125,
0.53564453125,
1.171875,
-0.390380859375,
0.7578125,
0.3349609375,
0.06378173828125,
-0.2366943359375,
-0.27001953125,
-0.51318359375,
0.83544921875,
0.80126953125,
0.50732421875,
0.016693115234375,
0.4130859375,
0.734375,
-0.0400390625,
-0.04571533203125,
0.427734375,
-0.0770263671875,
-0.06695556640625,
-0.129150390625,
0.19091796875,
-0.33837890625,
-0.018280029296875,
-0.66943359375,
0.25927734375,
-0.63330078125,
-0.224365234375,
-0.441162109375,
-0.734375,
1.1591796875,
-0.35302734375,
0.0212860107421875,
-0.10552978515625,
-0.57861328125,
0.4365234375,
0.78515625,
0.09454345703125,
-0.4287109375,
0.72412109375,
0.230712890625,
0.26123046875,
0.6943359375,
0.4248046875,
0.487548828125,
-0.525390625,
0.0300140380859375,
-0.1951904296875,
-0.076171875,
-0.267822265625,
-0.330322265625,
-0.77099609375,
0.448486328125,
0.19140625,
-0.46826171875,
0.94384765625,
-0.65966796875,
-0.0299224853515625,
-0.1849365234375,
0.65576171875,
-0.607421875,
0.61376953125,
0.298583984375,
-0.1697998046875,
-1.0029296875,
0.779296875,
-0.1402587890625,
0.408203125,
0.12200927734375,
1.015625,
-0.131591796875,
1.2431640625,
0.283203125,
-0.287841796875,
-0.281005859375,
0.50390625,
-0.5888671875,
-0.92578125,
-0.27197265625,
-0.552734375,
0.0289459228515625,
-0.3603515625,
-0.2374267578125,
-0.0362548828125,
0.646484375,
0.0712890625,
-0.97314453125,
-0.6298828125,
0.2313232421875,
-0.483154296875,
0.305419921875,
0.521484375,
0.01175689697265625,
0.048858642578125,
-0.489501953125,
-0.409423828125,
-0.467041015625,
0.26513671875,
-0.65869140625,
0.53759765625,
-0.434814453125,
-0.2425537109375,
-0.56396484375,
-0.48046875,
-0.1533203125,
0.10443115234375,
-0.35888671875,
-0.83251953125,
0.09039306640625,
0.30810546875,
0.416259765625,
0.452392578125,
-0.1656494140625,
0.15576171875,
1.13671875,
0.9560546875,
0.2900390625,
0.5673828125,
0.3544921875,
-0.08953857421875,
0.1651611328125,
-0.26953125,
0.45263671875,
-0.465576171875,
0.315673828125,
-0.1361083984375,
0.68310546875,
-0.7373046875,
-1.1962890625,
0.23876953125,
0.347412109375,
0.392578125,
-0.56396484375,
-0.78369140625,
-0.42431640625,
-1.115234375,
-0.010528564453125,
-0.60302734375,
0.87744140625,
-0.025421142578125,
-0.10626220703125,
-0.2279052734375,
-0.81494140625,
4.48828125,
1.3837890625,
0.6796875,
0.454833984375,
0.071044921875,
0.99658203125,
0.634765625,
-0.26318359375,
0.06298828125,
-0.251220703125,
0.398681640625,
-0.1121826171875,
-0.104736328125,
0.91259765625,
0.5009765625,
0.36767578125,
-0.8359375,
0.1915283203125,
-0.304443359375,
-0.94384765625,
-0.6689453125,
0.339599609375,
-0.368408203125,
0.424072265625,
-0.1695556640625,
0.75244140625,
0.51318359375,
-0.80908203125,
-0.367431640625,
-0.49951171875,
0.1357421875,
-0.427734375,
0.89306640625,
0.0533447265625,
-0.53662109375,
0.248046875,
-0.217529296875,
-0.7392578125,
-0.5390625,
0.3369140625,
-0.005359649658203125,
0.07171630859375,
0.810546875,
-0.42333984375,
0.402099609375,
0.48974609375,
-0.75537109375,
0.1768798828125,
-0.06304931640625,
-0.95361328125,
0.529296875,
-0.432373046875,
-0.0101318359375,
-0.265625,
-0.97802734375,
-0.496337890625,
0.72265625,
-0.1380615234375,
-0.033905029296875,
0.30810546875,
0.53173828125,
-0.09771728515625,
0.05303955078125,
0.6708984375,
-1.140625,
0.68603515625,
-0.0609130859375,
0.427001953125,
-0.4072265625,
-0.310546875,
-0.15966796875,
-0.1334228515625,
-0.438232421875,
-0.3271484375,
0.6201171875,
0.34228515625,
-0.1943359375,
0.308837890625,
0.490478515625,
-0.94873046875,
0.3955078125,
0.037078857421875,
-0.8056640625,
-0.63720703125,
0.880859375,
1.150390625,
-0.62255859375,
-0.43408203125,
-0.27783203125,
0.62060546875,
0.53271484375,
0.65087890625,
-0.10137939453125,
-0.5146484375,
-0.1832275390625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Tags: implementation
Correct Solution:
```
palavra = input()
qtd = int(input())
history = [input() for i in range(qtd)]
history.sort()
new = []
for p in history:
if p >= palavra:
new.append(p)
if len(new) == 0:
print(palavra)
else:
first = new[0]
if first == palavra:
print(palavra)
else:
if len(first) >= len(palavra):
if first[:len(palavra)] == palavra:
print(first)
else:
print(palavra)
else:
print(palavra)
```
| 46,643
|
[
-0.13232421875,
-0.294677734375,
0.58642578125,
0.377197265625,
-0.294921875,
-0.0751953125,
-0.157958984375,
0.0445556640625,
0.328125,
0.29833984375,
0.369384765625,
-0.22607421875,
-0.06787109375,
-0.72216796875,
-0.75634765625,
0.055206298828125,
-0.81787109375,
-0.53515625,
-0.76220703125,
0.00574493408203125,
0.103271484375,
-0.01438140869140625,
-1.2529296875,
-0.413330078125,
-0.367431640625,
0.8193359375,
0.334716796875,
0.2486572265625,
0.66796875,
1.1396484375,
0.0113067626953125,
-0.35693359375,
0.3759765625,
-0.984375,
-0.477294921875,
-0.41748046875,
0.43115234375,
-0.880859375,
-0.361572265625,
-0.69140625,
0.2255859375,
-0.267578125,
0.357177734375,
-0.67333984375,
-0.97021484375,
0.224365234375,
-0.736328125,
-0.57568359375,
-0.353515625,
-0.7666015625,
0.040740966796875,
-0.31103515625,
0.3466796875,
-0.1461181640625,
-0.32373046875,
-0.46044921875,
0.026092529296875,
0.033782958984375,
-0.5634765625,
0.43212890625,
0.497314453125,
0.422607421875,
-0.2412109375,
-0.271484375,
-0.357177734375,
0.468017578125,
0.2332763671875,
-0.37451171875,
0.230712890625,
-0.53955078125,
-0.48388671875,
0.058258056640625,
-0.42236328125,
-0.6455078125,
-0.00766754150390625,
0.00881195068359375,
0.107666015625,
-0.150146484375,
-0.125,
0.74658203125,
0.34521484375,
0.66748046875,
0.591796875,
0.5771484375,
-0.3203125,
-0.78369140625,
-0.2420654296875,
0.1273193359375,
0.0662841796875,
0.1427001953125,
-0.09820556640625,
0.458251953125,
-0.204833984375,
-0.01715087890625,
0.91064453125,
0.982421875,
0.10333251953125,
0.499755859375,
0.498046875,
0.1715087890625,
0.68359375,
0.82275390625,
-0.29248046875,
1.0634765625,
-0.8525390625,
0.35498046875,
0.10382080078125,
-0.361083984375,
-0.2225341796875,
-0.7080078125,
-0.341796875,
-0.143798828125,
0.315673828125,
0.42724609375,
-0.1199951171875,
1.0107421875,
-0.11602783203125,
-0.04083251953125,
-0.70654296875,
0.396240234375,
0.176513671875,
0.43017578125,
-0.082275390625,
-0.146728515625,
0.143798828125,
-0.65966796875,
-0.49462890625,
0.71435546875,
-0.8515625,
-0.238037109375,
0.2568359375,
-0.09466552734375,
-0.142578125,
0.49755859375,
-0.02459716796875,
0.58740234375,
0.058685302734375,
0.489013671875,
0.771484375,
-0.75341796875,
0.7255859375,
-0.357666015625,
0.10638427734375,
1.568359375,
0.34912109375,
0.008026123046875,
0.6689453125,
0.357421875,
-0.86962890625,
0.4443359375,
-0.40673828125,
0.65771484375,
0.33740234375,
-0.272705078125,
0.201904296875,
0.11083984375,
0.08746337890625,
0.1265869140625,
0.2109375,
0.38134765625,
-0.488525390625,
0.0699462890625,
-0.226806640625,
0.70947265625,
-0.323486328125,
1.1435546875,
-0.560546875,
-0.2010498046875,
0.2310791015625,
-0.326416015625,
-0.0140380859375,
-0.2139892578125,
-0.418212890625,
0.58056640625,
0.81640625,
0.7177734375,
0.84326171875,
-0.139892578125,
0.349853515625,
0.042938232421875,
-0.318115234375,
-0.09002685546875,
0.36328125,
0.79345703125,
0.3076171875,
0.2056884765625,
0.097900390625,
-0.6533203125,
-0.388671875,
-0.84423828125,
0.333740234375,
0.54833984375,
-0.44384765625,
0.30126953125,
0.176025390625,
0.3583984375,
-0.748046875,
-0.197265625,
0.1630859375,
-1.154296875,
-0.52734375,
0.67724609375,
-0.408203125,
0.220458984375,
-0.55078125,
0.01273345947265625,
0.283935546875,
1.275390625,
-0.404296875,
0.055633544921875,
0.7138671875,
0.08941650390625,
-0.53125,
0.11907958984375,
0.264404296875,
0.1051025390625,
-0.6689453125,
0.5751953125,
-0.21728515625,
-0.126953125,
0.2012939453125,
1.185546875,
0.483154296875,
0.393798828125,
-0.212158203125,
0.147216796875,
0.325927734375,
0.92333984375,
-0.219482421875,
0.5654296875,
0.0029888153076171875,
1.0361328125,
0.2998046875,
0.499755859375,
0.39501953125,
0.18896484375,
0.7177734375,
0.60205078125,
-0.0203704833984375,
0.228515625,
0.220947265625,
0.82421875,
0.75,
0.54638671875,
-0.166015625,
0.6357421875,
-0.035797119140625,
-0.047119140625,
-0.38525390625,
0.303466796875,
0.2093505859375,
0.88623046875,
-0.274169921875,
0.529296875,
-0.338623046875,
-1.0888671875,
0.51025390625,
0.73193359375,
-0.955078125,
-0.701171875,
-0.383056640625,
-0.061981201171875,
0.390380859375,
-0.30859375,
0.2763671875,
0.27734375,
0.57373046875,
0.40771484375,
-0.299560546875,
-0.62646484375,
-0.82958984375,
-0.96142578125,
-0.77734375,
-0.03985595703125,
-0.71875,
-0.0372314453125,
0.28076171875,
-0.65478515625,
0.0179290771484375,
-0.33740234375,
-0.2364501953125,
-0.134033203125,
-0.266357421875,
0.44482421875,
0.082763671875,
0.57958984375,
-0.29638671875,
0.677734375,
-0.024169921875,
1.1455078125,
-0.60546875,
-0.49169921875,
-0.0994873046875,
-0.296875,
0.33447265625,
0.11505126953125,
0.6513671875,
0.165283203125,
-0.9150390625,
-0.6865234375,
-0.52099609375,
-0.06768798828125,
-0.135009765625,
0.30078125,
-0.483154296875,
0.98779296875,
0.042633056640625,
-0.64892578125,
0.5029296875,
0.5341796875,
-0.9794921875,
0.66357421875,
0.3232421875,
0.050933837890625,
-0.83544921875,
1.3564453125,
0.33349609375,
0.2734375,
-0.263427734375,
-0.5400390625,
-0.43603515625,
0.203125,
0.128173828125,
-0.685546875,
-0.077392578125,
0.57275390625,
0.02587890625,
-1.1904296875,
0.452880859375,
-1.08984375,
-0.489013671875,
-0.364013671875,
-0.130859375,
1.0068359375,
0.68017578125,
0.12890625,
-0.1219482421875,
0.53515625,
-0.25048828125,
0.76806640625,
0.357177734375,
-0.5810546875,
-0.30029296875,
0.39306640625,
0.1722412109375,
-0.242919921875,
0.3125,
-0.31884765625,
0.138916015625,
-0.272705078125,
-0.292236328125,
0.87890625,
0.363037109375,
-0.05096435546875,
-0.119873046875,
0.49853515625,
-0.802734375,
-0.01629638671875,
-0.050384521484375,
0.794921875,
0.464111328125,
0.87451171875,
0.0810546875,
-0.011383056640625,
0.16796875,
-1.1875,
0.736328125,
0.274169921875,
0.66650390625,
-0.7080078125,
0.52099609375,
0.11767578125,
-0.85546875,
0.2271728515625,
-0.921875,
-0.54345703125,
0.99169921875,
-0.1553955078125,
1.0146484375,
-0.1783447265625,
0.474609375,
-0.578125,
-0.036041259765625,
0.468994140625,
-0.18896484375,
0.50927734375,
-0.2010498046875,
-0.159423828125,
-0.69091796875,
-0.235107421875,
0.045379638671875,
-0.2386474609375,
0.196044921875,
-0.263916015625,
-0.34521484375,
-0.8828125,
0.97998046875,
0.568359375,
-0.00726318359375,
-0.256103515625,
0.176513671875,
0.2156982421875,
0.5322265625,
0.57373046875,
-0.246826171875,
0.23779296875,
-0.6689453125,
0.96728515625,
0.007404327392578125,
-0.09503173828125,
-0.5830078125,
-0.4248046875,
-0.302734375,
0.281005859375,
0.10174560546875,
0.06817626953125,
-1.04296875,
0.357421875,
-0.1082763671875,
0.525390625,
-0.59814453125,
-0.34814453125,
-0.45703125,
0.76904296875,
0.497802734375,
-0.78759765625,
0.264892578125,
-0.2293701171875,
0.28076171875,
0.344970703125,
-0.2978515625,
-0.414306640625,
-0.71875,
-0.53662109375,
-0.77783203125,
0.81787109375,
0.6318359375,
-0.21728515625,
0.491943359375,
-0.9560546875,
0.599609375,
0.043792724609375,
-0.0341796875,
0.04254150390625,
0.1312255859375,
0.412841796875,
0.1573486328125,
0.89306640625,
-0.3095703125,
-0.6767578125,
0.2529296875,
-1.1494140625,
0.740234375,
-0.39306640625,
0.86865234375,
0.08917236328125,
-0.0589599609375,
-0.278076171875,
0.4443359375,
-0.55810546875,
0.1851806640625,
-0.1512451171875,
0.297607421875,
-0.91064453125,
-0.818359375,
0.7626953125,
-0.443359375,
-0.2181396484375,
0.95654296875,
-0.0692138671875,
-0.74365234375,
0.2841796875,
0.482177734375,
-0.54931640625,
0.3134765625,
-0.7060546875,
0.27001953125,
-0.37744140625,
-0.2095947265625,
-0.111083984375,
-0.78564453125,
0.50390625,
0.07391357421875,
-0.59814453125,
-0.2144775390625,
-1.134765625,
-0.08843994140625,
0.05108642578125,
-0.64013671875,
0.333984375,
-0.13232421875,
-0.45849609375,
-0.310791015625,
-0.200439453125,
-0.7509765625,
-0.56787109375,
-0.57275390625,
-0.3291015625,
0.0970458984375,
0.178955078125,
0.63818359375,
0.004856109619140625,
-0.6103515625,
0.1385498046875,
-0.037200927734375,
-0.298828125,
-0.267822265625,
-0.2227783203125,
0.02484130859375,
-0.044464111328125,
-0.1773681640625,
-0.034332275390625,
0.21728515625,
0.578125,
0.334228515625,
0.440185546875,
0.353515625,
0.51953125,
-0.533203125,
0.728515625,
0.146728515625,
-0.66259765625,
0.1661376953125,
0.67529296875,
0.0018749237060546875,
0.54931640625,
0.4267578125,
-0.80224609375,
-0.6318359375,
-1.0478515625,
-0.17041015625,
-0.37060546875,
-0.097900390625,
-1.056640625,
-0.662109375,
-0.16064453125,
0.5498046875,
0.162841796875,
-0.360595703125,
0.07928466796875,
-1.166015625,
0.199951171875,
-0.6796875,
-0.18359375,
-1.02734375,
-0.671875,
-0.1251220703125,
0.6474609375,
-0.0791015625,
0.343505859375,
-0.54052734375,
-0.272705078125,
0.61962890625,
-0.53173828125,
-1.0498046875,
-0.47900390625,
-0.193115234375,
0.2088623046875,
-0.052032470703125,
0.302001953125,
-0.489501953125,
0.2401123046875,
-0.669921875,
0.255859375,
-0.72705078125,
-0.270751953125,
-0.423828125,
0.0306396484375,
0.904296875,
-0.1632080078125,
-0.36328125,
-0.0007505416870117188,
0.72265625,
0.5498046875,
-0.2457275390625,
-0.1673583984375,
-0.88818359375,
-0.496826171875,
-0.798828125,
0.358154296875,
-0.615234375,
0.0758056640625,
-0.369873046875,
0.09136962890625,
1.375,
-0.189697265625,
0.7421875,
1.056640625,
0.2276611328125,
0.2568359375,
-0.9794921875,
0.7822265625,
0.79345703125,
-0.56494140625,
0.1279296875,
0.0643310546875,
-0.4990234375,
0.1556396484375,
-0.142822265625,
-1.216796875,
-0.3701171875,
0.48095703125,
1.2509765625,
0.1092529296875,
0.5615234375,
-0.067626953125,
-1.232421875,
-0.01454925537109375,
0.65673828125,
0.283447265625,
0.046844482421875,
0.82080078125,
0.1270751953125,
0.012176513671875,
-0.2066650390625,
-0.181884765625,
0.11309814453125,
-0.3544921875,
1.302734375,
-0.49365234375,
-0.92919921875,
1.0751953125,
1.0126953125,
-0.6884765625,
-1.2099609375,
-0.10552978515625,
0.369873046875,
-0.2412109375,
-0.69091796875,
0.36279296875,
0.3837890625,
-0.62451171875,
0.0887451171875,
0.2822265625,
-0.049072265625,
0.1712646484375,
0.081787109375,
-0.0238037109375,
-0.301513671875,
0.0243377685546875,
0.64208984375,
-0.380859375,
-0.455078125,
-1.060546875,
-0.08184814453125,
-0.261962890625,
0.165283203125,
0.7021484375,
-0.248046875,
0.04425048828125,
0.370849609375,
0.277587890625,
0.810546875,
-0.362548828125,
-0.209228515625,
0.235595703125,
-0.50244140625,
-0.8271484375,
-0.0916748046875,
0.84130859375,
-0.08441162109375,
0.1905517578125,
-1.1494140625,
0.185302734375,
0.4140625,
0.026763916015625,
-0.54541015625,
-0.96630859375,
-0.329833984375,
-0.93408203125,
-0.4892578125,
-0.25048828125,
-0.488525390625,
-0.3515625,
-0.2010498046875,
-0.1358642578125,
-0.1319580078125,
-0.034027099609375,
0.4853515625,
-0.62451171875,
0.411376953125,
-0.5712890625,
0.81396484375,
-0.51171875,
-0.14501953125,
-0.61376953125,
0.073486328125,
-0.2120361328125,
0.0092620849609375,
-0.75634765625,
0.22705078125,
0.491943359375,
0.0217437744140625,
-0.1827392578125,
0.3955078125,
-0.658203125,
-0.396484375,
0.040283203125,
0.1844482421875,
-0.316162109375,
0.9453125,
0.5244140625,
-0.2003173828125,
0.5283203125,
0.0162811279296875,
-0.52099609375,
-0.344482421875,
0.326171875,
0.6865234375,
-0.2119140625,
-0.030181884765625,
-0.281982421875,
0.1441650390625,
-0.94775390625,
-0.0005431175231933594,
-0.320556640625,
0.221435546875,
0.2061767578125,
-0.130126953125,
0.55078125,
1.318359375,
-0.0989990234375,
0.13330078125,
-0.06549072265625,
0.087890625,
0.466796875,
-0.1082763671875,
-0.10589599609375,
0.24658203125,
0.51025390625,
-0.057159423828125,
-0.2337646484375,
0.515625,
-0.059967041015625,
0.250732421875,
0.0184173583984375,
-0.658203125,
-1.015625,
-0.04888916015625,
-0.08392333984375,
0.35009765625,
0.407958984375,
-0.2239990234375,
0.00472259521484375,
-0.1953125,
-0.75830078125,
0.350341796875,
-1.2099609375,
-1.021484375,
-0.175537109375,
-0.1312255859375,
-0.818359375,
-0.09490966796875,
-0.6982421875,
-0.3203125,
0.235107421875,
0.371337890625,
-0.50390625,
0.50244140625,
0.2210693359375,
0.335205078125,
0.1875,
-0.04193115234375,
0.2215576171875,
0.51806640625,
-0.708984375,
-0.43798828125,
0.288330078125,
0.7841796875,
0.6328125,
-0.127197265625,
-0.88427734375,
0.1258544921875,
0.41455078125,
-0.1724853515625,
-0.70263671875,
0.2607421875,
-0.1448974609375,
0.87548828125,
-0.74658203125,
-0.033233642578125,
0.006439208984375,
0.640625,
0.10919189453125,
0.0016012191772460938,
-0.224365234375,
0.66650390625,
1.1787109375,
-0.44384765625,
0.88037109375,
0.415283203125,
0.03778076171875,
-0.1676025390625,
-0.303955078125,
-0.486572265625,
0.72607421875,
0.8408203125,
0.57080078125,
-0.11224365234375,
0.3583984375,
0.69677734375,
-0.050140380859375,
-0.06671142578125,
0.384521484375,
-0.003597259521484375,
0.0653076171875,
-0.154052734375,
0.1805419921875,
-0.3935546875,
-0.01309967041015625,
-0.6767578125,
0.2401123046875,
-0.603515625,
-0.2060546875,
-0.50341796875,
-0.61865234375,
1.1796875,
-0.330322265625,
-0.0732421875,
-0.127685546875,
-0.58544921875,
0.3310546875,
0.693359375,
0.0765380859375,
-0.347412109375,
0.59033203125,
0.223388671875,
0.09075927734375,
0.734375,
0.452880859375,
0.541015625,
-0.609375,
0.0386962890625,
-0.2841796875,
-0.1300048828125,
-0.322021484375,
-0.34228515625,
-0.87353515625,
0.5126953125,
0.07098388671875,
-0.58984375,
0.8603515625,
-0.748046875,
-0.05157470703125,
-0.1300048828125,
0.56884765625,
-0.498291015625,
0.6298828125,
0.318359375,
-0.1260986328125,
-0.9296875,
0.71044921875,
-0.1956787109375,
0.46435546875,
0.1939697265625,
1.1259765625,
-0.1614990234375,
1.2490234375,
0.33935546875,
-0.310791015625,
-0.11163330078125,
0.379150390625,
-0.54052734375,
-0.88330078125,
-0.335205078125,
-0.5927734375,
0.01371002197265625,
-0.3525390625,
-0.291015625,
-0.01424407958984375,
0.59765625,
0.16064453125,
-0.96826171875,
-0.5771484375,
0.244873046875,
-0.6025390625,
0.34912109375,
0.46142578125,
0.028961181640625,
0.1070556640625,
-0.43017578125,
-0.384033203125,
-0.5244140625,
0.2286376953125,
-0.6357421875,
0.39208984375,
-0.386962890625,
-0.3701171875,
-0.494384765625,
-0.6015625,
-0.1070556640625,
0.161376953125,
-0.30615234375,
-0.77001953125,
0.09820556640625,
0.402587890625,
0.30712890625,
0.376220703125,
-0.0279388427734375,
0.1580810546875,
1.2158203125,
1.0400390625,
0.312255859375,
0.40576171875,
0.376220703125,
-0.06561279296875,
0.11663818359375,
-0.27734375,
0.5390625,
-0.41162109375,
0.278076171875,
-0.2607421875,
0.7939453125,
-0.80810546875,
-1.193359375,
0.1240234375,
0.454833984375,
0.381591796875,
-0.56005859375,
-0.81201171875,
-0.40234375,
-1.1513671875,
0.005527496337890625,
-0.51513671875,
0.71044921875,
0.007144927978515625,
-0.0948486328125,
-0.2176513671875,
-0.85546875,
4.4609375,
1.4111328125,
0.671875,
0.491455078125,
-0.0210418701171875,
1.1376953125,
0.56103515625,
-0.350341796875,
0.006504058837890625,
-0.302978515625,
0.363525390625,
-0.0751953125,
-0.1392822265625,
0.84814453125,
0.384521484375,
0.433837890625,
-0.81201171875,
0.253662109375,
-0.2274169921875,
-0.8486328125,
-0.70068359375,
0.298095703125,
-0.33544921875,
0.4833984375,
-0.2158203125,
0.74951171875,
0.54638671875,
-0.89990234375,
-0.421142578125,
-0.347412109375,
0.059112548828125,
-0.469970703125,
1.0234375,
0.0408935546875,
-0.495849609375,
0.268310546875,
-0.30078125,
-0.705078125,
-0.58203125,
0.373046875,
-0.04180908203125,
0.10595703125,
0.81396484375,
-0.38916015625,
0.337646484375,
0.50146484375,
-0.724609375,
0.228515625,
-0.0638427734375,
-0.83154296875,
0.58935546875,
-0.430908203125,
-0.057708740234375,
-0.251953125,
-1.0234375,
-0.450927734375,
0.79443359375,
-0.1470947265625,
-0.057891845703125,
0.406982421875,
0.45703125,
-0.174072265625,
0.1434326171875,
0.57763671875,
-1.1650390625,
0.73583984375,
0.0204620361328125,
0.357421875,
-0.488037109375,
-0.384521484375,
-0.2578125,
-0.1751708984375,
-0.40576171875,
-0.3046875,
0.69921875,
0.31201171875,
-0.2283935546875,
0.25146484375,
0.477783203125,
-0.8916015625,
0.58984375,
0.045806884765625,
-0.7880859375,
-0.5693359375,
0.84228515625,
1.1025390625,
-0.63720703125,
-0.4970703125,
-0.2430419921875,
0.62060546875,
0.5810546875,
0.56689453125,
-0.052032470703125,
-0.5078125,
-0.125732421875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Tags: implementation
Correct Solution:
```
a=input()
b=int(input())
c=[]
d=0
f=[]
for i in range(b):
e=input()
c.append(e)
for i in c:
if(a in i[0:len(a)]):
d+=1
f.append(i)
else:
pass
if(d>=1):
print(min(f))
else:
print(a)
```
| 46,644
|
[
-0.05120849609375,
-0.308349609375,
0.56005859375,
0.349609375,
-0.291015625,
-0.1702880859375,
-0.1790771484375,
0.09246826171875,
0.25048828125,
0.339599609375,
0.412109375,
-0.165771484375,
-0.019378662109375,
-0.69970703125,
-0.71875,
0.042938232421875,
-0.859375,
-0.53662109375,
-0.69921875,
-0.060577392578125,
0.1612548828125,
-0.017120361328125,
-1.2548828125,
-0.439208984375,
-0.2841796875,
0.77392578125,
0.308837890625,
0.09564208984375,
0.587890625,
1.19140625,
-0.047393798828125,
-0.4326171875,
0.344970703125,
-1.0087890625,
-0.51416015625,
-0.459716796875,
0.46435546875,
-0.9599609375,
-0.353271484375,
-0.60498046875,
0.330322265625,
-0.2454833984375,
0.36083984375,
-0.62353515625,
-1.0126953125,
0.11651611328125,
-0.68115234375,
-0.58203125,
-0.3125,
-0.73486328125,
0.03131103515625,
-0.309814453125,
0.30126953125,
-0.1268310546875,
-0.26806640625,
-0.327392578125,
-0.0175323486328125,
-0.0728759765625,
-0.55126953125,
0.390869140625,
0.58447265625,
0.372314453125,
-0.30712890625,
-0.2403564453125,
-0.32421875,
0.368408203125,
0.1307373046875,
-0.33056640625,
0.1826171875,
-0.54150390625,
-0.44677734375,
0.11541748046875,
-0.430908203125,
-0.70751953125,
-0.08392333984375,
0.05059814453125,
0.1259765625,
-0.2105712890625,
-0.1788330078125,
0.72998046875,
0.333740234375,
0.7197265625,
0.5322265625,
0.444091796875,
-0.2315673828125,
-0.76318359375,
-0.1949462890625,
0.09619140625,
0.1937255859375,
0.07147216796875,
-0.08819580078125,
0.4091796875,
-0.1627197265625,
0.03125,
0.92529296875,
0.88818359375,
-0.026824951171875,
0.392578125,
0.4462890625,
0.1009521484375,
0.66357421875,
0.896484375,
-0.3037109375,
1.0595703125,
-0.83349609375,
0.3427734375,
0.03753662109375,
-0.33935546875,
-0.146240234375,
-0.55322265625,
-0.305908203125,
-0.2137451171875,
0.30029296875,
0.55029296875,
-0.241943359375,
0.9677734375,
-0.0293121337890625,
-0.029144287109375,
-0.67822265625,
0.350830078125,
0.1824951171875,
0.37646484375,
-0.08074951171875,
-0.18701171875,
0.152587890625,
-0.60205078125,
-0.455078125,
0.673828125,
-0.8505859375,
-0.18359375,
0.21875,
-0.11669921875,
-0.0826416015625,
0.552734375,
-0.09259033203125,
0.6337890625,
-0.11883544921875,
0.51171875,
0.71142578125,
-0.779296875,
0.7998046875,
-0.384033203125,
0.1627197265625,
1.4775390625,
0.40087890625,
0.10107421875,
0.65380859375,
0.32958984375,
-0.86376953125,
0.39990234375,
-0.420166015625,
0.6904296875,
0.397216796875,
-0.228515625,
0.25537109375,
0.1390380859375,
-0.0335693359375,
0.084228515625,
0.2119140625,
0.33251953125,
-0.453369140625,
0.1129150390625,
-0.2283935546875,
0.8740234375,
-0.3388671875,
1.1171875,
-0.689453125,
-0.1292724609375,
0.1461181640625,
-0.265380859375,
0.013671875,
-0.259765625,
-0.40673828125,
0.55712890625,
0.67578125,
0.75048828125,
0.8759765625,
-0.1351318359375,
0.3603515625,
-0.08831787109375,
-0.380615234375,
-0.032470703125,
0.3271484375,
0.75537109375,
0.3427734375,
0.255859375,
0.0309600830078125,
-0.650390625,
-0.51123046875,
-0.888671875,
0.3525390625,
0.509765625,
-0.53173828125,
0.1563720703125,
0.10772705078125,
0.41357421875,
-0.75634765625,
-0.2069091796875,
0.1859130859375,
-1.0146484375,
-0.4814453125,
0.6220703125,
-0.457275390625,
0.1640625,
-0.5478515625,
-0.01482391357421875,
0.330078125,
1.2978515625,
-0.380126953125,
0.0294647216796875,
0.69482421875,
0.099853515625,
-0.58154296875,
0.00067138671875,
0.331298828125,
0.09423828125,
-0.57470703125,
0.59228515625,
-0.286376953125,
-0.08685302734375,
0.158935546875,
1.21484375,
0.580078125,
0.35302734375,
-0.263671875,
0.060455322265625,
0.1964111328125,
0.94384765625,
-0.214599609375,
0.61181640625,
-0.1214599609375,
1.0224609375,
0.26123046875,
0.473388671875,
0.366943359375,
0.2098388671875,
0.7314453125,
0.6171875,
-0.08935546875,
0.258544921875,
0.19091796875,
0.65869140625,
0.576171875,
0.56787109375,
-0.1798095703125,
0.58056640625,
-0.03155517578125,
0.0538330078125,
-0.458740234375,
0.339599609375,
0.2188720703125,
0.89990234375,
-0.106689453125,
0.4453125,
-0.3935546875,
-1.029296875,
0.40869140625,
0.64501953125,
-0.99072265625,
-0.6171875,
-0.2423095703125,
-0.1043701171875,
0.491455078125,
-0.2242431640625,
0.2978515625,
0.3447265625,
0.466552734375,
0.457275390625,
-0.339111328125,
-0.61962890625,
-0.927734375,
-0.98681640625,
-0.85546875,
-0.056304931640625,
-0.658203125,
-0.12493896484375,
0.378173828125,
-0.515625,
0.14111328125,
-0.329833984375,
-0.304931640625,
0.07037353515625,
-0.316162109375,
0.480712890625,
0.132568359375,
0.6005859375,
-0.3994140625,
0.6826171875,
0.0267791748046875,
1.1591796875,
-0.57421875,
-0.47802734375,
0.0007023811340332031,
-0.337646484375,
0.341796875,
0.1649169921875,
0.6865234375,
0.1768798828125,
-0.951171875,
-0.6220703125,
-0.469970703125,
-0.103515625,
-0.1473388671875,
0.269775390625,
-0.487548828125,
0.95703125,
0.0401611328125,
-0.6484375,
0.48095703125,
0.560546875,
-0.98486328125,
0.64306640625,
0.260009765625,
-0.059814453125,
-0.80517578125,
1.453125,
0.2958984375,
0.295166015625,
-0.2685546875,
-0.488037109375,
-0.403564453125,
0.2529296875,
0.13916015625,
-0.76953125,
-0.06500244140625,
0.544921875,
-0.005878448486328125,
-1.14453125,
0.387451171875,
-1.1650390625,
-0.5703125,
-0.373291015625,
-0.08807373046875,
1.0146484375,
0.708984375,
0.1640625,
-0.147216796875,
0.448974609375,
-0.2432861328125,
0.7958984375,
0.318359375,
-0.5361328125,
-0.262939453125,
0.40087890625,
0.14697265625,
-0.307373046875,
0.251953125,
-0.3505859375,
0.1968994140625,
-0.2239990234375,
-0.14208984375,
0.77490234375,
0.294677734375,
-0.052154541015625,
-0.1593017578125,
0.52294921875,
-0.85595703125,
-0.086181640625,
0.0030765533447265625,
0.72509765625,
0.6162109375,
0.87353515625,
0.01323699951171875,
-0.0501708984375,
0.1434326171875,
-1.1328125,
0.72900390625,
0.249755859375,
0.71142578125,
-0.787109375,
0.451416015625,
0.11639404296875,
-0.69189453125,
0.2408447265625,
-0.81494140625,
-0.59619140625,
1.029296875,
-0.2276611328125,
0.90380859375,
-0.23193359375,
0.38720703125,
-0.51171875,
0.10504150390625,
0.459228515625,
-0.1221923828125,
0.5673828125,
-0.21484375,
-0.184326171875,
-0.5791015625,
-0.166259765625,
0.0180816650390625,
-0.337890625,
0.166259765625,
-0.16650390625,
-0.332763671875,
-0.92041015625,
0.89501953125,
0.6669921875,
0.06671142578125,
-0.287353515625,
0.1629638671875,
0.203125,
0.56396484375,
0.501953125,
-0.3330078125,
0.182373046875,
-0.6845703125,
0.8056640625,
-0.004909515380859375,
-0.154296875,
-0.599609375,
-0.356201171875,
-0.257568359375,
0.383056640625,
0.107666015625,
-0.045196533203125,
-1.01953125,
0.37890625,
-0.2294921875,
0.497802734375,
-0.63330078125,
-0.280029296875,
-0.54052734375,
0.68896484375,
0.4931640625,
-0.81396484375,
0.406982421875,
-0.292724609375,
0.243896484375,
0.353515625,
-0.264404296875,
-0.376220703125,
-0.7451171875,
-0.509765625,
-0.74169921875,
0.712890625,
0.6669921875,
-0.2130126953125,
0.482666015625,
-0.93017578125,
0.486572265625,
-0.0201873779296875,
-0.036590576171875,
0.07110595703125,
0.189697265625,
0.3779296875,
0.1375732421875,
0.91162109375,
-0.28173828125,
-0.67333984375,
0.2091064453125,
-1.1884765625,
0.87109375,
-0.30810546875,
0.8828125,
0.13720703125,
-0.148193359375,
-0.2283935546875,
0.50341796875,
-0.60693359375,
0.0645751953125,
-0.224853515625,
0.37890625,
-0.91259765625,
-0.8349609375,
0.78955078125,
-0.39501953125,
-0.1641845703125,
0.8505859375,
-0.034637451171875,
-0.6787109375,
0.2158203125,
0.5537109375,
-0.52734375,
0.21630859375,
-0.67333984375,
0.28125,
-0.407958984375,
-0.3046875,
-0.0927734375,
-0.7822265625,
0.48828125,
0.173095703125,
-0.52783203125,
-0.144775390625,
-1.017578125,
0.0042724609375,
0.0902099609375,
-0.44189453125,
0.3876953125,
-0.1419677734375,
-0.403564453125,
-0.3115234375,
-0.262939453125,
-0.8046875,
-0.5400390625,
-0.625,
-0.284912109375,
0.2232666015625,
0.2298583984375,
0.7119140625,
-0.1593017578125,
-0.68212890625,
0.1236572265625,
0.1064453125,
-0.3154296875,
-0.188720703125,
-0.11627197265625,
-0.033782958984375,
-0.059539794921875,
-0.1627197265625,
0.08056640625,
0.1187744140625,
0.47900390625,
0.43310546875,
0.52734375,
0.278564453125,
0.49462890625,
-0.4580078125,
0.62353515625,
0.1395263671875,
-0.65380859375,
0.103759765625,
0.63525390625,
-0.07977294921875,
0.57421875,
0.495849609375,
-0.80859375,
-0.56640625,
-0.970703125,
-0.2069091796875,
-0.3359375,
-0.1041259765625,
-1.1376953125,
-0.68408203125,
-0.259033203125,
0.50048828125,
0.167724609375,
-0.376220703125,
0.03912353515625,
-1.09765625,
0.09033203125,
-0.703125,
-0.1939697265625,
-0.96337890625,
-0.7451171875,
-0.1319580078125,
0.654296875,
-0.14892578125,
0.28369140625,
-0.61328125,
-0.1214599609375,
0.61767578125,
-0.5078125,
-1.017578125,
-0.50634765625,
-0.1260986328125,
0.1650390625,
0.06463623046875,
0.32470703125,
-0.462646484375,
0.33154296875,
-0.63720703125,
0.318359375,
-0.76953125,
-0.324951171875,
-0.392333984375,
0.103515625,
0.8916015625,
-0.1512451171875,
-0.3388671875,
0.044464111328125,
0.640625,
0.5595703125,
-0.27001953125,
-0.2073974609375,
-0.97900390625,
-0.427978515625,
-0.80078125,
0.351806640625,
-0.66455078125,
0.080810546875,
-0.358642578125,
0.10931396484375,
1.3525390625,
-0.1456298828125,
0.73681640625,
0.94287109375,
0.25927734375,
0.1947021484375,
-0.853515625,
0.74365234375,
0.677734375,
-0.60888671875,
0.08148193359375,
0.11358642578125,
-0.50927734375,
0.197509765625,
-0.1256103515625,
-1.1513671875,
-0.4248046875,
0.466552734375,
1.28515625,
0.037506103515625,
0.427734375,
-0.1929931640625,
-1.205078125,
0.013397216796875,
0.73193359375,
0.27392578125,
0.05914306640625,
0.7744140625,
0.1728515625,
0.0648193359375,
-0.252685546875,
-0.230712890625,
0.03466796875,
-0.37744140625,
1.212890625,
-0.367431640625,
-0.7412109375,
1.0693359375,
1.099609375,
-0.78662109375,
-1.224609375,
0.039398193359375,
0.2890625,
-0.2197265625,
-0.70068359375,
0.40869140625,
0.302734375,
-0.58544921875,
0.138916015625,
0.2529296875,
-0.0260009765625,
-0.0003783702850341797,
0.1337890625,
-0.0295257568359375,
-0.46630859375,
0.08441162109375,
0.76904296875,
-0.309326171875,
-0.50048828125,
-1.017578125,
-0.02142333984375,
-0.2958984375,
0.07568359375,
0.74658203125,
-0.1131591796875,
-0.0249176025390625,
0.416748046875,
0.21630859375,
0.88330078125,
-0.44970703125,
-0.1527099609375,
0.2247314453125,
-0.4892578125,
-0.73095703125,
-0.0770263671875,
0.85791015625,
-0.09783935546875,
0.1524658203125,
-1.0732421875,
0.1375732421875,
0.34228515625,
0.07415771484375,
-0.6005859375,
-0.91162109375,
-0.2230224609375,
-0.9091796875,
-0.423583984375,
-0.305419921875,
-0.5087890625,
-0.309326171875,
-0.200927734375,
-0.0123291015625,
-0.11212158203125,
-0.0100250244140625,
0.41748046875,
-0.52294921875,
0.3798828125,
-0.47314453125,
0.75537109375,
-0.482666015625,
-0.11907958984375,
-0.5693359375,
0.1448974609375,
-0.268798828125,
0.01494598388671875,
-0.94775390625,
0.22412109375,
0.6396484375,
0.08697509765625,
-0.1939697265625,
0.371826171875,
-0.7607421875,
-0.50439453125,
0.09326171875,
0.13818359375,
-0.2734375,
0.8603515625,
0.474365234375,
-0.1717529296875,
0.5712890625,
-0.004730224609375,
-0.4375,
-0.339599609375,
0.353515625,
0.69091796875,
-0.1907958984375,
0.137939453125,
-0.2467041015625,
0.23779296875,
-0.9404296875,
0.014190673828125,
-0.25048828125,
0.1396484375,
0.22705078125,
-0.2481689453125,
0.60791015625,
1.11328125,
-0.10308837890625,
0.06707763671875,
-0.1141357421875,
0.1610107421875,
0.45556640625,
-0.09478759765625,
-0.2061767578125,
0.2406005859375,
0.46923828125,
-0.1431884765625,
-0.1951904296875,
0.495849609375,
-0.066650390625,
0.2421875,
0.0552978515625,
-0.64599609375,
-1.009765625,
-0.00447845458984375,
-0.045928955078125,
0.385498046875,
0.412109375,
-0.152099609375,
-0.06134033203125,
-0.2279052734375,
-0.7763671875,
0.3779296875,
-1.119140625,
-0.93896484375,
-0.118896484375,
-0.1551513671875,
-0.7998046875,
-0.1678466796875,
-0.6806640625,
-0.251708984375,
0.19384765625,
0.54833984375,
-0.60498046875,
0.494384765625,
0.1842041015625,
0.324951171875,
0.034820556640625,
0.027801513671875,
0.260009765625,
0.56103515625,
-0.71728515625,
-0.490234375,
0.402587890625,
0.87255859375,
0.5888671875,
-0.150634765625,
-0.955078125,
0.083984375,
0.3623046875,
-0.040985107421875,
-0.63720703125,
0.10406494140625,
-0.2086181640625,
0.8291015625,
-0.806640625,
-0.07843017578125,
-0.049896240234375,
0.623046875,
0.037567138671875,
-0.062347412109375,
-0.1875,
0.494140625,
1.2080078125,
-0.427490234375,
0.74609375,
0.32470703125,
0.07269287109375,
-0.1378173828125,
-0.26416015625,
-0.51708984375,
0.81298828125,
0.8349609375,
0.5625,
0.0010023117065429688,
0.318359375,
0.78076171875,
-0.07403564453125,
-0.09259033203125,
0.46875,
-0.046905517578125,
0.024078369140625,
-0.11456298828125,
0.2313232421875,
-0.37744140625,
-0.0654296875,
-0.6611328125,
0.2298583984375,
-0.50830078125,
-0.241943359375,
-0.448486328125,
-0.64599609375,
1.150390625,
-0.3203125,
0.0187225341796875,
-0.045318603515625,
-0.48291015625,
0.42626953125,
0.74072265625,
-0.023468017578125,
-0.42236328125,
0.6630859375,
0.177001953125,
0.26318359375,
0.69384765625,
0.400390625,
0.46875,
-0.490966796875,
0.140380859375,
-0.2340087890625,
-0.0650634765625,
-0.287109375,
-0.3740234375,
-0.8408203125,
0.52392578125,
0.05084228515625,
-0.52099609375,
0.9287109375,
-0.703125,
0.01346588134765625,
-0.235595703125,
0.69775390625,
-0.54638671875,
0.65087890625,
0.25146484375,
-0.246337890625,
-0.92822265625,
0.74755859375,
-0.1475830078125,
0.405517578125,
0.1494140625,
1.064453125,
-0.138427734375,
1.263671875,
0.29443359375,
-0.201416015625,
-0.23388671875,
0.427978515625,
-0.5556640625,
-0.94775390625,
-0.343994140625,
-0.52880859375,
0.04412841796875,
-0.42822265625,
-0.265869140625,
-0.037384033203125,
0.61328125,
0.1488037109375,
-0.9697265625,
-0.6162109375,
0.287353515625,
-0.5517578125,
0.253662109375,
0.56494140625,
0.07513427734375,
0.0830078125,
-0.389892578125,
-0.416259765625,
-0.52880859375,
0.255859375,
-0.69287109375,
0.53564453125,
-0.433349609375,
-0.1990966796875,
-0.466796875,
-0.492919921875,
-0.161865234375,
0.10650634765625,
-0.336669921875,
-0.806640625,
0.10626220703125,
0.3271484375,
0.392822265625,
0.484375,
-0.160400390625,
0.142578125,
1.2080078125,
0.94580078125,
0.26806640625,
0.611328125,
0.359130859375,
-0.084716796875,
0.154052734375,
-0.26220703125,
0.453125,
-0.51416015625,
0.350341796875,
-0.1859130859375,
0.59716796875,
-0.658203125,
-1.22265625,
0.22021484375,
0.40185546875,
0.38525390625,
-0.47216796875,
-0.7919921875,
-0.410888671875,
-1.1318359375,
-0.04705810546875,
-0.56298828125,
0.89404296875,
-0.0013418197631835938,
-0.11907958984375,
-0.261962890625,
-0.7998046875,
4.52734375,
1.3935546875,
0.62744140625,
0.52880859375,
0.038299560546875,
0.9873046875,
0.580078125,
-0.3564453125,
-0.0191497802734375,
-0.24365234375,
0.35693359375,
-0.2120361328125,
-0.08697509765625,
0.8525390625,
0.47265625,
0.4423828125,
-0.7666015625,
0.2147216796875,
-0.266357421875,
-0.94873046875,
-0.7353515625,
0.2340087890625,
-0.2288818359375,
0.48193359375,
-0.14208984375,
0.67529296875,
0.490478515625,
-0.79150390625,
-0.343017578125,
-0.490478515625,
0.08984375,
-0.469482421875,
0.91357421875,
0.063232421875,
-0.48681640625,
0.263916015625,
-0.245849609375,
-0.57421875,
-0.51025390625,
0.32421875,
-0.04425048828125,
0.121826171875,
0.83349609375,
-0.440673828125,
0.456298828125,
0.54248046875,
-0.7255859375,
0.207275390625,
-0.07830810546875,
-0.91357421875,
0.55224609375,
-0.481689453125,
-0.0404052734375,
-0.27197265625,
-0.98046875,
-0.45654296875,
0.67138671875,
-0.1185302734375,
-0.03033447265625,
0.383056640625,
0.51806640625,
-0.07806396484375,
0.108154296875,
0.57177734375,
-1.123046875,
0.70751953125,
-0.04998779296875,
0.45263671875,
-0.37890625,
-0.265869140625,
-0.2352294921875,
-0.2410888671875,
-0.461181640625,
-0.320068359375,
0.5654296875,
0.34228515625,
-0.204833984375,
0.293701171875,
0.491455078125,
-0.921875,
0.436279296875,
-0.0184783935546875,
-0.7431640625,
-0.6337890625,
0.8896484375,
1.0849609375,
-0.64990234375,
-0.459228515625,
-0.2313232421875,
0.54150390625,
0.494384765625,
0.63720703125,
-0.036651611328125,
-0.477783203125,
-0.13671875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Tags: implementation
Correct Solution:
```
n=input()
k=len(n)
ta=[]
p=int(input())
for x in range(p):
ol=input()
if ol[0:k]==n:
ta.append(ol[k:])
else:
pass
if ta==list():
print(n)
else:
ta.sort()
print(n+ta[0])
```
| 46,645
|
[
-0.047607421875,
-0.30029296875,
0.53076171875,
0.34423828125,
-0.3134765625,
-0.1876220703125,
-0.196044921875,
0.1317138671875,
0.25732421875,
0.3330078125,
0.41455078125,
-0.161865234375,
-0.03125,
-0.70751953125,
-0.712890625,
0.0673828125,
-0.86572265625,
-0.54443359375,
-0.685546875,
-0.07574462890625,
0.1549072265625,
-0.0255126953125,
-1.2470703125,
-0.418212890625,
-0.2509765625,
0.763671875,
0.293701171875,
0.076904296875,
0.60009765625,
1.1748046875,
-0.0252838134765625,
-0.419677734375,
0.36376953125,
-0.98291015625,
-0.50732421875,
-0.4208984375,
0.47412109375,
-0.94482421875,
-0.34326171875,
-0.63525390625,
0.35498046875,
-0.290771484375,
0.374755859375,
-0.6162109375,
-1.01171875,
0.14208984375,
-0.66064453125,
-0.58251953125,
-0.29052734375,
-0.78369140625,
0.031494140625,
-0.310791015625,
0.3310546875,
-0.123046875,
-0.267333984375,
-0.351806640625,
-0.01300048828125,
-0.08538818359375,
-0.5341796875,
0.38232421875,
0.55517578125,
0.413818359375,
-0.2841796875,
-0.252197265625,
-0.305419921875,
0.383544921875,
0.15625,
-0.371337890625,
0.171142578125,
-0.580078125,
-0.4853515625,
0.109375,
-0.45166015625,
-0.69384765625,
-0.0675048828125,
0.067138671875,
0.116943359375,
-0.2030029296875,
-0.183349609375,
0.73974609375,
0.33056640625,
0.69775390625,
0.5556640625,
0.431396484375,
-0.1973876953125,
-0.775390625,
-0.1820068359375,
0.1243896484375,
0.167724609375,
0.061614990234375,
-0.084716796875,
0.407958984375,
-0.1685791015625,
0.03387451171875,
0.93408203125,
0.88671875,
-0.0150146484375,
0.424072265625,
0.4677734375,
0.07122802734375,
0.66552734375,
0.86279296875,
-0.297607421875,
1.0439453125,
-0.81982421875,
0.35400390625,
0.024261474609375,
-0.351318359375,
-0.1573486328125,
-0.5849609375,
-0.32177734375,
-0.2078857421875,
0.291259765625,
0.54833984375,
-0.217529296875,
0.9716796875,
-0.021331787109375,
-0.0396728515625,
-0.68994140625,
0.36767578125,
0.207763671875,
0.3896484375,
-0.08197021484375,
-0.1998291015625,
0.179931640625,
-0.60888671875,
-0.462646484375,
0.68603515625,
-0.86181640625,
-0.188232421875,
0.1817626953125,
-0.11456298828125,
-0.11383056640625,
0.5498046875,
-0.097900390625,
0.6240234375,
-0.1329345703125,
0.49462890625,
0.7021484375,
-0.78564453125,
0.806640625,
-0.382080078125,
0.1422119140625,
1.4970703125,
0.36328125,
0.10784912109375,
0.6416015625,
0.323486328125,
-0.87255859375,
0.3818359375,
-0.44189453125,
0.72021484375,
0.374267578125,
-0.2493896484375,
0.227294921875,
0.130859375,
-0.046844482421875,
0.0765380859375,
0.2099609375,
0.33837890625,
-0.44580078125,
0.10357666015625,
-0.2607421875,
0.85498046875,
-0.3408203125,
1.1103515625,
-0.7216796875,
-0.113037109375,
0.179931640625,
-0.2379150390625,
0.0136566162109375,
-0.24853515625,
-0.41650390625,
0.55517578125,
0.6923828125,
0.7421875,
0.88037109375,
-0.1605224609375,
0.3603515625,
-0.077880859375,
-0.366455078125,
-0.0411376953125,
0.280517578125,
0.76318359375,
0.33642578125,
0.250244140625,
0.035491943359375,
-0.689453125,
-0.49609375,
-0.904296875,
0.34228515625,
0.51123046875,
-0.53466796875,
0.145751953125,
0.10894775390625,
0.3896484375,
-0.720703125,
-0.190673828125,
0.152587890625,
-1.0146484375,
-0.4560546875,
0.6123046875,
-0.45166015625,
0.17822265625,
-0.56494140625,
-0.0172576904296875,
0.354736328125,
1.310546875,
-0.381103515625,
0.0160064697265625,
0.744140625,
0.1112060546875,
-0.55419921875,
-0.0034313201904296875,
0.337158203125,
0.10906982421875,
-0.5732421875,
0.58935546875,
-0.30224609375,
-0.07928466796875,
0.161376953125,
1.2265625,
0.5537109375,
0.330322265625,
-0.27587890625,
0.08447265625,
0.2166748046875,
0.9658203125,
-0.231689453125,
0.6201171875,
-0.119140625,
1.037109375,
0.3046875,
0.47119140625,
0.38427734375,
0.2130126953125,
0.73876953125,
0.59033203125,
-0.07403564453125,
0.2493896484375,
0.1826171875,
0.6806640625,
0.55615234375,
0.5927734375,
-0.1505126953125,
0.5869140625,
-0.032440185546875,
0.0528564453125,
-0.49609375,
0.325439453125,
0.251953125,
0.9033203125,
-0.10137939453125,
0.4375,
-0.389892578125,
-1.0087890625,
0.43212890625,
0.64990234375,
-0.9521484375,
-0.64453125,
-0.2296142578125,
-0.11456298828125,
0.525390625,
-0.2447509765625,
0.31103515625,
0.35205078125,
0.454345703125,
0.451904296875,
-0.357177734375,
-0.63818359375,
-0.96826171875,
-0.97021484375,
-0.837890625,
-0.0677490234375,
-0.6435546875,
-0.089111328125,
0.40966796875,
-0.52880859375,
0.156982421875,
-0.32275390625,
-0.288818359375,
0.054290771484375,
-0.302978515625,
0.5166015625,
0.10333251953125,
0.62841796875,
-0.385986328125,
0.6962890625,
0.0240478515625,
1.177734375,
-0.63232421875,
-0.4833984375,
-0.008941650390625,
-0.28564453125,
0.334228515625,
0.1773681640625,
0.68359375,
0.158935546875,
-0.91455078125,
-0.693359375,
-0.44189453125,
-0.10919189453125,
-0.135986328125,
0.285400390625,
-0.475341796875,
0.984375,
0.0830078125,
-0.65087890625,
0.495361328125,
0.568359375,
-0.9599609375,
0.60986328125,
0.251953125,
-0.01776123046875,
-0.806640625,
1.474609375,
0.313232421875,
0.293212890625,
-0.300537109375,
-0.505859375,
-0.410888671875,
0.25146484375,
0.13623046875,
-0.7783203125,
-0.05535888671875,
0.51953125,
0.005664825439453125,
-1.1396484375,
0.40771484375,
-1.1767578125,
-0.57177734375,
-0.3916015625,
-0.1097412109375,
1.0146484375,
0.7265625,
0.16357421875,
-0.110595703125,
0.44970703125,
-0.2763671875,
0.771484375,
0.332763671875,
-0.55126953125,
-0.2724609375,
0.414794921875,
0.1824951171875,
-0.302490234375,
0.2308349609375,
-0.355712890625,
0.21435546875,
-0.1951904296875,
-0.1614990234375,
0.79931640625,
0.30810546875,
-0.055938720703125,
-0.16552734375,
0.5068359375,
-0.81298828125,
-0.0684814453125,
-0.016357421875,
0.7412109375,
0.59619140625,
0.86767578125,
0.002323150634765625,
-0.07379150390625,
0.1434326171875,
-1.13671875,
0.7646484375,
0.25439453125,
0.73095703125,
-0.8037109375,
0.46484375,
0.1395263671875,
-0.685546875,
0.2342529296875,
-0.8193359375,
-0.59423828125,
0.99365234375,
-0.2315673828125,
0.90087890625,
-0.249267578125,
0.373779296875,
-0.498779296875,
0.1285400390625,
0.4736328125,
-0.11456298828125,
0.54296875,
-0.1982421875,
-0.2027587890625,
-0.56005859375,
-0.135498046875,
0.0155029296875,
-0.329345703125,
0.1578369140625,
-0.1458740234375,
-0.3427734375,
-0.9072265625,
0.89013671875,
0.6826171875,
0.054595947265625,
-0.2705078125,
0.14990234375,
0.2198486328125,
0.552734375,
0.50341796875,
-0.33984375,
0.19384765625,
-0.66748046875,
0.81103515625,
-0.005218505859375,
-0.1527099609375,
-0.56005859375,
-0.395751953125,
-0.277099609375,
0.4033203125,
0.1051025390625,
-0.0291748046875,
-1.0234375,
0.382080078125,
-0.2330322265625,
0.498046875,
-0.60546875,
-0.268798828125,
-0.521484375,
0.68505859375,
0.483642578125,
-0.79443359375,
0.427978515625,
-0.300537109375,
0.2335205078125,
0.325927734375,
-0.23681640625,
-0.3583984375,
-0.7607421875,
-0.51904296875,
-0.76025390625,
0.74951171875,
0.66748046875,
-0.18701171875,
0.466796875,
-0.9560546875,
0.483642578125,
-0.049591064453125,
-0.04150390625,
0.07611083984375,
0.172607421875,
0.3818359375,
0.1331787109375,
0.890625,
-0.27001953125,
-0.677734375,
0.2030029296875,
-1.1748046875,
0.861328125,
-0.284912109375,
0.916015625,
0.123779296875,
-0.1597900390625,
-0.1954345703125,
0.494873046875,
-0.57373046875,
0.0743408203125,
-0.225830078125,
0.362060546875,
-0.91748046875,
-0.8466796875,
0.75341796875,
-0.408203125,
-0.1341552734375,
0.853515625,
-0.049896240234375,
-0.7099609375,
0.2044677734375,
0.53955078125,
-0.55126953125,
0.2490234375,
-0.63232421875,
0.2861328125,
-0.4267578125,
-0.28955078125,
-0.08062744140625,
-0.77392578125,
0.484375,
0.1953125,
-0.5205078125,
-0.12445068359375,
-1.02734375,
0.0113983154296875,
0.11077880859375,
-0.478759765625,
0.40380859375,
-0.1575927734375,
-0.394287109375,
-0.316162109375,
-0.30078125,
-0.75439453125,
-0.56201171875,
-0.61328125,
-0.29150390625,
0.259765625,
0.2208251953125,
0.72216796875,
-0.1446533203125,
-0.6962890625,
0.1502685546875,
0.039398193359375,
-0.32177734375,
-0.1705322265625,
-0.1165771484375,
-0.067626953125,
-0.07281494140625,
-0.1688232421875,
0.0750732421875,
0.1298828125,
0.48095703125,
0.431884765625,
0.5029296875,
0.2958984375,
0.54541015625,
-0.444091796875,
0.6240234375,
0.1800537109375,
-0.65283203125,
0.0869140625,
0.642578125,
-0.059112548828125,
0.58935546875,
0.49462890625,
-0.82275390625,
-0.58251953125,
-1.0341796875,
-0.2186279296875,
-0.322021484375,
-0.100341796875,
-1.12890625,
-0.677734375,
-0.2264404296875,
0.484130859375,
0.13525390625,
-0.3505859375,
0.044097900390625,
-1.1083984375,
0.09625244140625,
-0.71240234375,
-0.24951171875,
-0.96142578125,
-0.7294921875,
-0.1204833984375,
0.6630859375,
-0.11590576171875,
0.2452392578125,
-0.599609375,
-0.1337890625,
0.61181640625,
-0.5400390625,
-0.984375,
-0.505859375,
-0.1495361328125,
0.179931640625,
0.060638427734375,
0.32177734375,
-0.451904296875,
0.3115234375,
-0.626953125,
0.318359375,
-0.76416015625,
-0.3369140625,
-0.39306640625,
0.07305908203125,
0.90478515625,
-0.168701171875,
-0.34814453125,
0.0576171875,
0.603515625,
0.58447265625,
-0.285400390625,
-0.213623046875,
-0.98193359375,
-0.42138671875,
-0.79931640625,
0.339111328125,
-0.677734375,
0.07867431640625,
-0.376220703125,
0.093017578125,
1.3369140625,
-0.1767578125,
0.75927734375,
0.9501953125,
0.2144775390625,
0.200927734375,
-0.85791015625,
0.7177734375,
0.67724609375,
-0.6396484375,
0.071533203125,
0.062255859375,
-0.5302734375,
0.1998291015625,
-0.11419677734375,
-1.1767578125,
-0.414794921875,
0.445556640625,
1.2939453125,
0.050445556640625,
0.433349609375,
-0.2105712890625,
-1.20703125,
-0.01175689697265625,
0.6904296875,
0.267333984375,
0.07891845703125,
0.76171875,
0.13330078125,
0.058074951171875,
-0.234375,
-0.234619140625,
0.044952392578125,
-0.350341796875,
1.2314453125,
-0.412353515625,
-0.76171875,
1.0908203125,
1.0966796875,
-0.76416015625,
-1.201171875,
-0.004467010498046875,
0.32470703125,
-0.2213134765625,
-0.71630859375,
0.414794921875,
0.31201171875,
-0.57470703125,
0.171875,
0.2481689453125,
-0.022491455078125,
-0.022918701171875,
0.14794921875,
0.0074920654296875,
-0.451171875,
0.0482177734375,
0.79443359375,
-0.35009765625,
-0.53515625,
-1.013671875,
-0.0364990234375,
-0.31005859375,
0.09039306640625,
0.74658203125,
-0.1268310546875,
0.0167999267578125,
0.360595703125,
0.2261962890625,
0.87890625,
-0.455078125,
-0.149169921875,
0.192138671875,
-0.46435546875,
-0.732421875,
-0.061981201171875,
0.849609375,
-0.11676025390625,
0.15380859375,
-1.0869140625,
0.1734619140625,
0.365966796875,
0.07275390625,
-0.60791015625,
-0.92724609375,
-0.2098388671875,
-0.89892578125,
-0.42822265625,
-0.301025390625,
-0.52783203125,
-0.312744140625,
-0.2027587890625,
-0.0010423660278320312,
-0.1380615234375,
-0.00514984130859375,
0.391845703125,
-0.54296875,
0.3896484375,
-0.4765625,
0.77197265625,
-0.481689453125,
-0.126220703125,
-0.57666015625,
0.1324462890625,
-0.257568359375,
0.048797607421875,
-0.99560546875,
0.2353515625,
0.63232421875,
0.1038818359375,
-0.18212890625,
0.384521484375,
-0.73974609375,
-0.50146484375,
0.08489990234375,
0.1275634765625,
-0.2919921875,
0.8427734375,
0.46484375,
-0.1776123046875,
0.6015625,
0.0027294158935546875,
-0.44189453125,
-0.333740234375,
0.3408203125,
0.685546875,
-0.2054443359375,
0.1483154296875,
-0.229248046875,
0.23779296875,
-0.93994140625,
0.01611328125,
-0.272216796875,
0.1463623046875,
0.25146484375,
-0.253173828125,
0.61669921875,
1.1435546875,
-0.10186767578125,
0.07489013671875,
-0.12200927734375,
0.1719970703125,
0.474609375,
-0.08953857421875,
-0.201171875,
0.2373046875,
0.468017578125,
-0.1302490234375,
-0.1864013671875,
0.496826171875,
-0.0789794921875,
0.255859375,
0.0548095703125,
-0.6611328125,
-1.0400390625,
0.00650787353515625,
-0.047515869140625,
0.405517578125,
0.40966796875,
-0.13671875,
-0.08978271484375,
-0.1751708984375,
-0.7431640625,
0.396484375,
-1.1416015625,
-0.958984375,
-0.10821533203125,
-0.1455078125,
-0.7890625,
-0.138427734375,
-0.677734375,
-0.2587890625,
0.1849365234375,
0.52734375,
-0.62158203125,
0.49755859375,
0.17529296875,
0.34228515625,
0.04132080078125,
0.03106689453125,
0.2432861328125,
0.5703125,
-0.71142578125,
-0.4619140625,
0.375,
0.83642578125,
0.626953125,
-0.113525390625,
-0.96435546875,
0.06256103515625,
0.379150390625,
-0.016326904296875,
-0.64501953125,
0.07940673828125,
-0.18359375,
0.86474609375,
-0.81640625,
-0.0712890625,
-0.00530242919921875,
0.6220703125,
0.03265380859375,
-0.0457763671875,
-0.1959228515625,
0.5166015625,
1.193359375,
-0.402587890625,
0.7783203125,
0.303955078125,
0.061737060546875,
-0.131591796875,
-0.2462158203125,
-0.54443359375,
0.84521484375,
0.83447265625,
0.57470703125,
-0.0127716064453125,
0.297607421875,
0.7763671875,
-0.08380126953125,
-0.10821533203125,
0.478271484375,
-0.057281494140625,
0.018463134765625,
-0.07415771484375,
0.2156982421875,
-0.39599609375,
-0.049591064453125,
-0.6171875,
0.24658203125,
-0.5283203125,
-0.22900390625,
-0.423828125,
-0.666015625,
1.203125,
-0.33544921875,
-0.0029354095458984375,
-0.03802490234375,
-0.4716796875,
0.3984375,
0.76953125,
-0.022186279296875,
-0.4560546875,
0.67919921875,
0.1953125,
0.296142578125,
0.724609375,
0.406982421875,
0.436767578125,
-0.5361328125,
0.146728515625,
-0.26708984375,
-0.04150390625,
-0.2406005859375,
-0.354736328125,
-0.84326171875,
0.5234375,
0.06048583984375,
-0.546875,
0.91259765625,
-0.73046875,
0.00220489501953125,
-0.2264404296875,
0.685546875,
-0.5595703125,
0.66259765625,
0.247802734375,
-0.2374267578125,
-0.890625,
0.71435546875,
-0.1732177734375,
0.388671875,
0.138916015625,
1.0263671875,
-0.12408447265625,
1.2841796875,
0.291748046875,
-0.2078857421875,
-0.232177734375,
0.432373046875,
-0.55517578125,
-0.93798828125,
-0.39990234375,
-0.587890625,
0.04949951171875,
-0.40234375,
-0.236572265625,
-0.0401611328125,
0.6123046875,
0.1649169921875,
-0.9892578125,
-0.6357421875,
0.308837890625,
-0.57080078125,
0.2509765625,
0.548828125,
0.08380126953125,
0.0838623046875,
-0.414306640625,
-0.4228515625,
-0.54736328125,
0.2666015625,
-0.6591796875,
0.55419921875,
-0.455078125,
-0.216796875,
-0.45849609375,
-0.5107421875,
-0.1712646484375,
0.11163330078125,
-0.343017578125,
-0.82080078125,
0.11895751953125,
0.349609375,
0.403076171875,
0.4599609375,
-0.1405029296875,
0.11083984375,
1.2265625,
0.94091796875,
0.298583984375,
0.60302734375,
0.36279296875,
-0.08502197265625,
0.1380615234375,
-0.255126953125,
0.44287109375,
-0.4951171875,
0.358642578125,
-0.21728515625,
0.5986328125,
-0.67529296875,
-1.2197265625,
0.20263671875,
0.3623046875,
0.380615234375,
-0.501953125,
-0.7900390625,
-0.45458984375,
-1.115234375,
-0.0628662109375,
-0.56103515625,
0.90625,
-0.027252197265625,
-0.11114501953125,
-0.2232666015625,
-0.78662109375,
4.51171875,
1.3974609375,
0.6279296875,
0.54736328125,
0.046630859375,
1.005859375,
0.6015625,
-0.363037109375,
-0.0114288330078125,
-0.265625,
0.36962890625,
-0.2432861328125,
-0.0577392578125,
0.841796875,
0.4765625,
0.441650390625,
-0.80224609375,
0.2012939453125,
-0.2685546875,
-0.9169921875,
-0.7431640625,
0.2347412109375,
-0.2156982421875,
0.457275390625,
-0.1357421875,
0.66650390625,
0.492919921875,
-0.810546875,
-0.34912109375,
-0.509765625,
0.103271484375,
-0.469970703125,
0.90771484375,
0.06573486328125,
-0.464111328125,
0.291015625,
-0.26171875,
-0.5908203125,
-0.487060546875,
0.345458984375,
-0.068115234375,
0.08929443359375,
0.84521484375,
-0.45947265625,
0.447265625,
0.51123046875,
-0.70166015625,
0.209228515625,
-0.0693359375,
-0.89892578125,
0.55517578125,
-0.50048828125,
-0.040679931640625,
-0.2216796875,
-0.9873046875,
-0.45166015625,
0.64892578125,
-0.1278076171875,
-0.0182037353515625,
0.381103515625,
0.5263671875,
-0.1063232421875,
0.09539794921875,
0.59814453125,
-1.173828125,
0.705078125,
-0.046539306640625,
0.463134765625,
-0.383056640625,
-0.295166015625,
-0.214111328125,
-0.2313232421875,
-0.48779296875,
-0.3134765625,
0.568359375,
0.33837890625,
-0.1949462890625,
0.31884765625,
0.457275390625,
-0.9404296875,
0.445556640625,
-0.01812744140625,
-0.734375,
-0.6083984375,
0.900390625,
1.0537109375,
-0.68017578125,
-0.440185546875,
-0.25048828125,
0.54443359375,
0.5244140625,
0.65087890625,
-0.0185699462890625,
-0.478271484375,
-0.1494140625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Tags: implementation
Correct Solution:
```
import math
def ans(l,s,x):
f=l
y=l[0:x]
if(s==y):
return True
else:
return False
s=str(input())
x=len(s)
t=int(input())
m=100000
f=0
k=''
l=[]
while(t>0):
a=str(input())
l.append(a)
t-=1
l.sort()
for i in l:
if(ans(i,s,x)==True):
k=i
break
if(k):
print(k)
else:
print(s)
```
| 46,646
|
[
-0.04705810546875,
-0.307373046875,
0.5498046875,
0.35498046875,
-0.333984375,
-0.1497802734375,
-0.1732177734375,
0.1336669921875,
0.270751953125,
0.347412109375,
0.40380859375,
-0.1759033203125,
-0.0221405029296875,
-0.67919921875,
-0.7177734375,
0.087646484375,
-0.853515625,
-0.56201171875,
-0.69482421875,
-0.0601806640625,
0.189697265625,
-0.0194854736328125,
-1.2626953125,
-0.439453125,
-0.30908203125,
0.771484375,
0.3291015625,
0.1373291015625,
0.59814453125,
1.1943359375,
-0.023712158203125,
-0.419921875,
0.369140625,
-0.98779296875,
-0.55517578125,
-0.454833984375,
0.484130859375,
-0.95361328125,
-0.33056640625,
-0.6171875,
0.337158203125,
-0.2705078125,
0.35400390625,
-0.64013671875,
-1.0478515625,
0.1328125,
-0.70654296875,
-0.5537109375,
-0.300537109375,
-0.73291015625,
0.0270538330078125,
-0.30029296875,
0.321533203125,
-0.1429443359375,
-0.2401123046875,
-0.305419921875,
0.00536346435546875,
-0.06512451171875,
-0.568359375,
0.4013671875,
0.54296875,
0.36181640625,
-0.29736328125,
-0.240234375,
-0.29638671875,
0.350830078125,
0.12548828125,
-0.334716796875,
0.168701171875,
-0.603515625,
-0.482177734375,
0.1263427734375,
-0.46923828125,
-0.6611328125,
-0.068115234375,
0.0460205078125,
0.07525634765625,
-0.2001953125,
-0.179931640625,
0.759765625,
0.32763671875,
0.69287109375,
0.55908203125,
0.439208984375,
-0.2481689453125,
-0.76318359375,
-0.219970703125,
0.0938720703125,
0.185546875,
0.07611083984375,
-0.035736083984375,
0.41650390625,
-0.1568603515625,
0.05859375,
0.92724609375,
0.90234375,
0.0216064453125,
0.448974609375,
0.467529296875,
0.06842041015625,
0.669921875,
0.88623046875,
-0.296630859375,
1.041015625,
-0.8603515625,
0.365966796875,
0.025634765625,
-0.32861328125,
-0.1815185546875,
-0.55322265625,
-0.2998046875,
-0.2127685546875,
0.310546875,
0.501953125,
-0.21875,
0.95751953125,
-0.0501708984375,
-0.044219970703125,
-0.66552734375,
0.353271484375,
0.224609375,
0.36376953125,
-0.0645751953125,
-0.1595458984375,
0.110107421875,
-0.5888671875,
-0.431396484375,
0.7138671875,
-0.8525390625,
-0.2139892578125,
0.2198486328125,
-0.103271484375,
-0.1214599609375,
0.56884765625,
-0.091064453125,
0.61669921875,
-0.08819580078125,
0.509765625,
0.705078125,
-0.7841796875,
0.8095703125,
-0.4248046875,
0.1502685546875,
1.4560546875,
0.375732421875,
0.0625,
0.66748046875,
0.343505859375,
-0.84228515625,
0.41064453125,
-0.440185546875,
0.67724609375,
0.396728515625,
-0.21728515625,
0.2271728515625,
0.1473388671875,
-0.06982421875,
0.0894775390625,
0.196044921875,
0.326416015625,
-0.4306640625,
0.10650634765625,
-0.261474609375,
0.85498046875,
-0.357421875,
1.07421875,
-0.70556640625,
-0.106201171875,
0.164794921875,
-0.24755859375,
0.007602691650390625,
-0.2406005859375,
-0.446044921875,
0.54833984375,
0.70068359375,
0.77783203125,
0.85791015625,
-0.1605224609375,
0.3466796875,
-0.06744384765625,
-0.39208984375,
-0.06939697265625,
0.3173828125,
0.74658203125,
0.322021484375,
0.2279052734375,
0.02752685546875,
-0.6376953125,
-0.53515625,
-0.87548828125,
0.337646484375,
0.53466796875,
-0.54931640625,
0.1627197265625,
0.1048583984375,
0.416259765625,
-0.75390625,
-0.20654296875,
0.136474609375,
-1.00390625,
-0.473388671875,
0.595703125,
-0.4521484375,
0.1597900390625,
-0.51904296875,
0.00421905517578125,
0.344970703125,
1.306640625,
-0.42431640625,
0.0347900390625,
0.69091796875,
0.054351806640625,
-0.57080078125,
-0.005268096923828125,
0.389404296875,
0.09552001953125,
-0.60546875,
0.58349609375,
-0.2509765625,
-0.0740966796875,
0.1644287109375,
1.234375,
0.5234375,
0.36865234375,
-0.2325439453125,
0.053619384765625,
0.222412109375,
0.9697265625,
-0.20751953125,
0.60546875,
-0.11175537109375,
1.041015625,
0.2744140625,
0.437255859375,
0.37646484375,
0.2239990234375,
0.73779296875,
0.62060546875,
-0.09759521484375,
0.26513671875,
0.1715087890625,
0.70263671875,
0.57373046875,
0.56396484375,
-0.150390625,
0.5947265625,
-0.099609375,
0.049468994140625,
-0.4658203125,
0.33154296875,
0.21240234375,
0.90576171875,
-0.14111328125,
0.444580078125,
-0.410888671875,
-0.99951171875,
0.382080078125,
0.658203125,
-0.96875,
-0.6513671875,
-0.260986328125,
-0.10498046875,
0.427001953125,
-0.2362060546875,
0.301513671875,
0.359619140625,
0.4462890625,
0.420654296875,
-0.357421875,
-0.61181640625,
-0.9287109375,
-0.974609375,
-0.83837890625,
-0.07879638671875,
-0.6357421875,
-0.0467529296875,
0.35693359375,
-0.52001953125,
0.1968994140625,
-0.2626953125,
-0.29931640625,
0.08575439453125,
-0.30810546875,
0.48828125,
0.1397705078125,
0.60107421875,
-0.386474609375,
0.685546875,
0.002086639404296875,
1.15234375,
-0.580078125,
-0.460693359375,
0.0224151611328125,
-0.297119140625,
0.378662109375,
0.1689453125,
0.677734375,
0.2034912109375,
-0.91748046875,
-0.630859375,
-0.429931640625,
-0.140625,
-0.1326904296875,
0.288330078125,
-0.458984375,
0.935546875,
0.044677734375,
-0.64501953125,
0.4765625,
0.53173828125,
-1.00390625,
0.6328125,
0.26171875,
0.006744384765625,
-0.7822265625,
1.392578125,
0.28564453125,
0.258544921875,
-0.2763671875,
-0.51171875,
-0.374755859375,
0.2471923828125,
0.1114501953125,
-0.779296875,
-0.110595703125,
0.49267578125,
-0.0130767822265625,
-1.1220703125,
0.409423828125,
-1.1728515625,
-0.58203125,
-0.36767578125,
-0.103515625,
1.0087890625,
0.716796875,
0.145263671875,
-0.1209716796875,
0.474365234375,
-0.2412109375,
0.75634765625,
0.332275390625,
-0.54296875,
-0.29736328125,
0.3984375,
0.1993408203125,
-0.330322265625,
0.252197265625,
-0.33837890625,
0.200439453125,
-0.2568359375,
-0.11798095703125,
0.791015625,
0.31640625,
-0.043426513671875,
-0.1446533203125,
0.5654296875,
-0.875,
-0.0684814453125,
-0.0290374755859375,
0.69677734375,
0.58349609375,
0.82763671875,
-0.0017061233520507812,
-0.0638427734375,
0.1348876953125,
-1.12109375,
0.74169921875,
0.27685546875,
0.72021484375,
-0.8212890625,
0.461181640625,
0.086181640625,
-0.66748046875,
0.245849609375,
-0.82763671875,
-0.591796875,
1.005859375,
-0.237548828125,
0.8857421875,
-0.26611328125,
0.3994140625,
-0.51953125,
0.12841796875,
0.490234375,
-0.1414794921875,
0.55029296875,
-0.228271484375,
-0.1624755859375,
-0.57177734375,
-0.1387939453125,
-0.005859375,
-0.325927734375,
0.1549072265625,
-0.146484375,
-0.3359375,
-0.908203125,
0.8837890625,
0.68115234375,
0.09375,
-0.2822265625,
0.154296875,
0.17724609375,
0.5712890625,
0.50537109375,
-0.32373046875,
0.1982421875,
-0.6689453125,
0.7822265625,
-0.01314544677734375,
-0.142578125,
-0.5947265625,
-0.39111328125,
-0.26953125,
0.3408203125,
0.08599853515625,
-0.056182861328125,
-1.0078125,
0.377685546875,
-0.220703125,
0.50341796875,
-0.64208984375,
-0.277587890625,
-0.54443359375,
0.70263671875,
0.4990234375,
-0.810546875,
0.36572265625,
-0.316650390625,
0.238037109375,
0.331298828125,
-0.2044677734375,
-0.38232421875,
-0.74853515625,
-0.51171875,
-0.763671875,
0.67724609375,
0.64404296875,
-0.2176513671875,
0.47314453125,
-0.97998046875,
0.46337890625,
-0.00450897216796875,
-0.0217132568359375,
0.049041748046875,
0.2529296875,
0.3955078125,
0.1314697265625,
0.87109375,
-0.27197265625,
-0.66064453125,
0.225341796875,
-1.1689453125,
0.876953125,
-0.302490234375,
0.85205078125,
0.150390625,
-0.1536865234375,
-0.2275390625,
0.529296875,
-0.59912109375,
0.0921630859375,
-0.2286376953125,
0.372314453125,
-0.8828125,
-0.826171875,
0.7763671875,
-0.44384765625,
-0.1378173828125,
0.88427734375,
-0.05316162109375,
-0.7275390625,
0.216796875,
0.5380859375,
-0.513671875,
0.2548828125,
-0.6279296875,
0.30712890625,
-0.416748046875,
-0.27294921875,
-0.11785888671875,
-0.8037109375,
0.48046875,
0.1865234375,
-0.50146484375,
-0.11175537109375,
-0.998046875,
-0.00473785400390625,
0.09228515625,
-0.482666015625,
0.41015625,
-0.135009765625,
-0.415771484375,
-0.310302734375,
-0.28173828125,
-0.79345703125,
-0.54443359375,
-0.59521484375,
-0.283203125,
0.214111328125,
0.257568359375,
0.6669921875,
-0.1572265625,
-0.61572265625,
0.188232421875,
0.0902099609375,
-0.34423828125,
-0.1943359375,
-0.1190185546875,
-0.1063232421875,
-0.06884765625,
-0.1842041015625,
0.07305908203125,
0.16796875,
0.488525390625,
0.43701171875,
0.50341796875,
0.2705078125,
0.482421875,
-0.43603515625,
0.63623046875,
0.1959228515625,
-0.6533203125,
0.06842041015625,
0.6181640625,
-0.09246826171875,
0.576171875,
0.45556640625,
-0.81884765625,
-0.57861328125,
-0.99365234375,
-0.1968994140625,
-0.305419921875,
-0.10772705078125,
-1.1474609375,
-0.65185546875,
-0.302978515625,
0.53857421875,
0.180908203125,
-0.357177734375,
0.0196380615234375,
-1.08984375,
0.08905029296875,
-0.705078125,
-0.18017578125,
-0.95263671875,
-0.75927734375,
-0.09796142578125,
0.66015625,
-0.11517333984375,
0.248779296875,
-0.5810546875,
-0.1278076171875,
0.62060546875,
-0.50341796875,
-0.98681640625,
-0.515625,
-0.0946044921875,
0.1502685546875,
0.06707763671875,
0.374267578125,
-0.458740234375,
0.340576171875,
-0.6552734375,
0.2939453125,
-0.72412109375,
-0.345947265625,
-0.362060546875,
0.094970703125,
0.87890625,
-0.1595458984375,
-0.34521484375,
0.056640625,
0.58056640625,
0.5576171875,
-0.29150390625,
-0.217041015625,
-0.94677734375,
-0.43505859375,
-0.81494140625,
0.356201171875,
-0.65283203125,
0.1265869140625,
-0.389892578125,
0.058746337890625,
1.349609375,
-0.1575927734375,
0.69970703125,
0.96240234375,
0.3046875,
0.20703125,
-0.8203125,
0.7109375,
0.65966796875,
-0.6171875,
0.08624267578125,
0.0938720703125,
-0.4912109375,
0.1536865234375,
-0.13623046875,
-1.14453125,
-0.419189453125,
0.469482421875,
1.2470703125,
0.0029144287109375,
0.40283203125,
-0.2088623046875,
-1.212890625,
0.032379150390625,
0.70703125,
0.267578125,
0.07965087890625,
0.77880859375,
0.18896484375,
0.0537109375,
-0.2203369140625,
-0.206298828125,
0.0205078125,
-0.393310546875,
1.1904296875,
-0.37646484375,
-0.7236328125,
1.046875,
1.0869140625,
-0.7578125,
-1.1953125,
0.060302734375,
0.26806640625,
-0.2091064453125,
-0.7138671875,
0.44580078125,
0.298828125,
-0.58740234375,
0.1834716796875,
0.255615234375,
-0.03289794921875,
-0.0271148681640625,
0.122314453125,
0.019195556640625,
-0.4326171875,
0.06353759765625,
0.7705078125,
-0.2998046875,
-0.5107421875,
-1.0205078125,
-0.068603515625,
-0.287841796875,
0.07708740234375,
0.74462890625,
-0.1715087890625,
0.01454925537109375,
0.413818359375,
0.2147216796875,
0.86328125,
-0.44921875,
-0.1455078125,
0.25244140625,
-0.50439453125,
-0.748046875,
-0.09112548828125,
0.83203125,
-0.0858154296875,
0.166748046875,
-1.0693359375,
0.21240234375,
0.341064453125,
0.032745361328125,
-0.5751953125,
-0.90625,
-0.26123046875,
-0.9287109375,
-0.4423828125,
-0.284912109375,
-0.5595703125,
-0.32861328125,
-0.2056884765625,
-0.0020809173583984375,
-0.1497802734375,
-0.0086517333984375,
0.40966796875,
-0.55078125,
0.33642578125,
-0.435791015625,
0.728515625,
-0.4501953125,
-0.134521484375,
-0.60693359375,
0.1246337890625,
-0.257568359375,
0.05914306640625,
-0.97119140625,
0.2061767578125,
0.646484375,
0.0849609375,
-0.1783447265625,
0.3291015625,
-0.7666015625,
-0.49169921875,
0.06610107421875,
0.123291015625,
-0.26220703125,
0.83203125,
0.475830078125,
-0.1968994140625,
0.5546875,
0.0162200927734375,
-0.4345703125,
-0.302490234375,
0.34716796875,
0.68994140625,
-0.2137451171875,
0.12548828125,
-0.1915283203125,
0.251708984375,
-0.97021484375,
0.034912109375,
-0.2529296875,
0.169189453125,
0.2822265625,
-0.260009765625,
0.6318359375,
1.1220703125,
-0.11883544921875,
0.077880859375,
-0.10906982421875,
0.1688232421875,
0.42431640625,
-0.10662841796875,
-0.1842041015625,
0.185791015625,
0.499267578125,
-0.1517333984375,
-0.1873779296875,
0.465087890625,
-0.03094482421875,
0.23974609375,
0.09130859375,
-0.63623046875,
-1.021484375,
-0.035614013671875,
-0.0855712890625,
0.389404296875,
0.3916015625,
-0.1165771484375,
-0.104736328125,
-0.1856689453125,
-0.7607421875,
0.393798828125,
-1.107421875,
-0.90380859375,
-0.09307861328125,
-0.1732177734375,
-0.80224609375,
-0.1138916015625,
-0.6572265625,
-0.270263671875,
0.20068359375,
0.52880859375,
-0.60498046875,
0.483154296875,
0.2080078125,
0.29296875,
0.058502197265625,
-0.01459503173828125,
0.2315673828125,
0.603515625,
-0.71337890625,
-0.52197265625,
0.380615234375,
0.87548828125,
0.583984375,
-0.1861572265625,
-0.95263671875,
0.0950927734375,
0.3798828125,
-0.01690673828125,
-0.63525390625,
0.08349609375,
-0.2120361328125,
0.849609375,
-0.7978515625,
-0.0592041015625,
0.00868988037109375,
0.5693359375,
0.043365478515625,
-0.03900146484375,
-0.22265625,
0.513671875,
1.201171875,
-0.415771484375,
0.75390625,
0.353759765625,
0.06878662109375,
-0.0908203125,
-0.26220703125,
-0.51416015625,
0.8447265625,
0.85595703125,
0.54833984375,
0.015533447265625,
0.2393798828125,
0.8212890625,
-0.0452880859375,
-0.1160888671875,
0.431884765625,
-0.055572509765625,
0.0084381103515625,
-0.11083984375,
0.2313232421875,
-0.39453125,
-0.06475830078125,
-0.6923828125,
0.244140625,
-0.50830078125,
-0.20751953125,
-0.404541015625,
-0.66845703125,
1.1416015625,
-0.325439453125,
-0.0071258544921875,
-0.05810546875,
-0.48876953125,
0.429931640625,
0.7177734375,
-0.039642333984375,
-0.4599609375,
0.6923828125,
0.1832275390625,
0.298095703125,
0.66162109375,
0.39892578125,
0.469482421875,
-0.5126953125,
0.1297607421875,
-0.260009765625,
-0.06591796875,
-0.247802734375,
-0.350341796875,
-0.84423828125,
0.50927734375,
0.0455322265625,
-0.49365234375,
0.93017578125,
-0.6953125,
-0.0189971923828125,
-0.2021484375,
0.6962890625,
-0.58447265625,
0.6318359375,
0.270751953125,
-0.25048828125,
-0.8994140625,
0.7373046875,
-0.1549072265625,
0.370361328125,
0.1346435546875,
1.0537109375,
-0.1270751953125,
1.3125,
0.2900390625,
-0.1844482421875,
-0.2255859375,
0.388916015625,
-0.59814453125,
-0.88525390625,
-0.3623046875,
-0.5224609375,
0.049896240234375,
-0.387939453125,
-0.27099609375,
-0.008697509765625,
0.5830078125,
0.1552734375,
-0.9912109375,
-0.5869140625,
0.319580078125,
-0.55908203125,
0.2318115234375,
0.5810546875,
0.08538818359375,
0.0653076171875,
-0.408935546875,
-0.3916015625,
-0.51904296875,
0.2529296875,
-0.6513671875,
0.47900390625,
-0.416748046875,
-0.1900634765625,
-0.4677734375,
-0.5166015625,
-0.207275390625,
0.06884765625,
-0.332275390625,
-0.81005859375,
0.147216796875,
0.3623046875,
0.40625,
0.46875,
-0.142822265625,
0.123046875,
1.2138671875,
0.9501953125,
0.267333984375,
0.56591796875,
0.3818359375,
-0.08123779296875,
0.11285400390625,
-0.215087890625,
0.419189453125,
-0.472412109375,
0.310302734375,
-0.2047119140625,
0.57861328125,
-0.6796875,
-1.19140625,
0.2322998046875,
0.397216796875,
0.406494140625,
-0.4931640625,
-0.83642578125,
-0.441650390625,
-1.134765625,
-0.0222930908203125,
-0.5556640625,
0.8837890625,
0.0033168792724609375,
-0.12384033203125,
-0.24609375,
-0.78759765625,
4.546875,
1.408203125,
0.61328125,
0.548828125,
0.03607177734375,
0.9755859375,
0.61279296875,
-0.373046875,
0.016998291015625,
-0.2705078125,
0.385986328125,
-0.1766357421875,
-0.0634765625,
0.81396484375,
0.487548828125,
0.37744140625,
-0.72265625,
0.2412109375,
-0.2254638671875,
-0.9267578125,
-0.7470703125,
0.253662109375,
-0.2393798828125,
0.491455078125,
-0.1260986328125,
0.6572265625,
0.4892578125,
-0.7890625,
-0.392822265625,
-0.493408203125,
0.116455078125,
-0.45947265625,
0.8916015625,
0.06927490234375,
-0.481201171875,
0.28271484375,
-0.2325439453125,
-0.5625,
-0.51904296875,
0.30615234375,
-0.018096923828125,
0.13623046875,
0.79736328125,
-0.459716796875,
0.432373046875,
0.55615234375,
-0.70263671875,
0.207275390625,
-0.09442138671875,
-0.9111328125,
0.53955078125,
-0.473876953125,
-0.04815673828125,
-0.212890625,
-0.955078125,
-0.450927734375,
0.6650390625,
-0.1265869140625,
-0.0260162353515625,
0.3701171875,
0.50390625,
-0.0867919921875,
0.08966064453125,
0.6005859375,
-1.1484375,
0.6865234375,
-0.0867919921875,
0.4775390625,
-0.38134765625,
-0.280029296875,
-0.217529296875,
-0.2222900390625,
-0.45947265625,
-0.30810546875,
0.5673828125,
0.3486328125,
-0.1956787109375,
0.333984375,
0.44091796875,
-0.896484375,
0.443359375,
-0.034912109375,
-0.73193359375,
-0.5947265625,
0.89013671875,
1.0712890625,
-0.66748046875,
-0.446044921875,
-0.2362060546875,
0.5244140625,
0.498779296875,
0.62939453125,
-0.026763916015625,
-0.546875,
-0.11199951171875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Tags: implementation
Correct Solution:
```
s = input()
i = int(input())
c = []
for x in range(i):
t = input()
if len(t) < len(s):
pass
else:
if t[:len(s)] == s:
c.append(t)
if len(c) == 0:
print(s)
else:
res = min(sub for sub in c if isinstance(sub, str))
print(res)
```
| 46,647
|
[
-0.08734130859375,
-0.337890625,
0.5859375,
0.351318359375,
-0.299072265625,
-0.163330078125,
-0.1658935546875,
0.0765380859375,
0.2314453125,
0.3359375,
0.40087890625,
-0.159423828125,
-0.0248870849609375,
-0.73974609375,
-0.740234375,
0.02508544921875,
-0.88330078125,
-0.53369140625,
-0.71533203125,
-0.060699462890625,
0.14501953125,
-0.0267486572265625,
-1.255859375,
-0.44873046875,
-0.281982421875,
0.7529296875,
0.340576171875,
0.09881591796875,
0.58935546875,
1.1806640625,
-0.0703125,
-0.40625,
0.314697265625,
-0.99951171875,
-0.5009765625,
-0.451904296875,
0.466552734375,
-0.98583984375,
-0.35302734375,
-0.56396484375,
0.306640625,
-0.23583984375,
0.369140625,
-0.63916015625,
-0.9951171875,
0.09136962890625,
-0.6806640625,
-0.5947265625,
-0.2783203125,
-0.7080078125,
0.037750244140625,
-0.304443359375,
0.27197265625,
-0.164306640625,
-0.272216796875,
-0.304931640625,
-0.032745361328125,
-0.0830078125,
-0.544921875,
0.38720703125,
0.5322265625,
0.326904296875,
-0.31640625,
-0.248291015625,
-0.31201171875,
0.365478515625,
0.1060791015625,
-0.33544921875,
0.2071533203125,
-0.52392578125,
-0.451904296875,
0.0997314453125,
-0.44384765625,
-0.708984375,
-0.052581787109375,
0.0557861328125,
0.117431640625,
-0.2017822265625,
-0.1912841796875,
0.734375,
0.322265625,
0.76416015625,
0.53564453125,
0.4560546875,
-0.2264404296875,
-0.81201171875,
-0.20361328125,
0.09130859375,
0.144775390625,
0.05255126953125,
-0.123291015625,
0.389404296875,
-0.1387939453125,
-0.00876617431640625,
0.90380859375,
0.88671875,
-0.047393798828125,
0.363037109375,
0.47509765625,
0.10260009765625,
0.65625,
0.8740234375,
-0.25732421875,
1.060546875,
-0.8173828125,
0.37109375,
0.05474853515625,
-0.336181640625,
-0.1925048828125,
-0.54931640625,
-0.294189453125,
-0.209228515625,
0.30078125,
0.5546875,
-0.2435302734375,
0.982421875,
-0.05615234375,
-0.04541015625,
-0.68896484375,
0.339111328125,
0.157470703125,
0.39794921875,
-0.053009033203125,
-0.23046875,
0.145263671875,
-0.58349609375,
-0.439697265625,
0.7138671875,
-0.8701171875,
-0.189697265625,
0.199951171875,
-0.11077880859375,
-0.1007080078125,
0.541015625,
-0.07830810546875,
0.6474609375,
-0.1253662109375,
0.5048828125,
0.68603515625,
-0.767578125,
0.81787109375,
-0.3857421875,
0.1578369140625,
1.509765625,
0.397216796875,
0.1072998046875,
0.6298828125,
0.386474609375,
-0.86572265625,
0.413818359375,
-0.430908203125,
0.7001953125,
0.3857421875,
-0.256103515625,
0.2626953125,
0.165283203125,
-0.07611083984375,
0.06524658203125,
0.205810546875,
0.314208984375,
-0.456787109375,
0.12347412109375,
-0.23388671875,
0.85302734375,
-0.32666015625,
1.140625,
-0.73095703125,
-0.12127685546875,
0.1041259765625,
-0.25830078125,
0.017059326171875,
-0.2568359375,
-0.4013671875,
0.55859375,
0.7041015625,
0.80712890625,
0.8740234375,
-0.125244140625,
0.359619140625,
-0.070068359375,
-0.38427734375,
-0.02716064453125,
0.303466796875,
0.74560546875,
0.330078125,
0.284423828125,
0.0245361328125,
-0.63916015625,
-0.50439453125,
-0.8603515625,
0.327880859375,
0.509765625,
-0.5009765625,
0.170654296875,
0.10662841796875,
0.393798828125,
-0.7724609375,
-0.1927490234375,
0.170166015625,
-1.00390625,
-0.4736328125,
0.63134765625,
-0.471923828125,
0.1497802734375,
-0.529296875,
-0.0419921875,
0.345458984375,
1.34765625,
-0.36376953125,
0.012908935546875,
0.66650390625,
0.1058349609375,
-0.58251953125,
-0.01000213623046875,
0.3349609375,
0.0989990234375,
-0.5625,
0.57568359375,
-0.25244140625,
-0.07281494140625,
0.1417236328125,
1.24609375,
0.5517578125,
0.362060546875,
-0.2449951171875,
0.05419921875,
0.208251953125,
0.96484375,
-0.19580078125,
0.6015625,
-0.1287841796875,
1.04296875,
0.2271728515625,
0.486572265625,
0.37548828125,
0.199462890625,
0.7197265625,
0.619140625,
-0.08245849609375,
0.242431640625,
0.18017578125,
0.67822265625,
0.57958984375,
0.55419921875,
-0.1829833984375,
0.5693359375,
-0.0121612548828125,
0.035491943359375,
-0.464599609375,
0.3408203125,
0.235107421875,
0.91650390625,
-0.09735107421875,
0.447265625,
-0.3837890625,
-1.0390625,
0.421875,
0.6005859375,
-1.005859375,
-0.63330078125,
-0.238525390625,
-0.1171875,
0.487548828125,
-0.229736328125,
0.30078125,
0.34375,
0.51318359375,
0.49560546875,
-0.3369140625,
-0.63037109375,
-0.91845703125,
-0.97314453125,
-0.8681640625,
-0.05462646484375,
-0.64892578125,
-0.1336669921875,
0.347412109375,
-0.515625,
0.11871337890625,
-0.353271484375,
-0.310546875,
0.112060546875,
-0.3359375,
0.465087890625,
0.122314453125,
0.56298828125,
-0.42724609375,
0.69873046875,
0.0211334228515625,
1.177734375,
-0.564453125,
-0.419921875,
-0.003086090087890625,
-0.325439453125,
0.35302734375,
0.135986328125,
0.7158203125,
0.1650390625,
-0.93359375,
-0.6181640625,
-0.50537109375,
-0.1318359375,
-0.138671875,
0.263916015625,
-0.473388671875,
0.96240234375,
0.029693603515625,
-0.65869140625,
0.477294921875,
0.55126953125,
-0.98974609375,
0.6376953125,
0.2412109375,
-0.044525146484375,
-0.81640625,
1.4501953125,
0.2744140625,
0.304443359375,
-0.237548828125,
-0.48876953125,
-0.38623046875,
0.26904296875,
0.12744140625,
-0.751953125,
-0.0765380859375,
0.55908203125,
0.04443359375,
-1.1240234375,
0.394775390625,
-1.1591796875,
-0.56201171875,
-0.381591796875,
-0.1007080078125,
1.0244140625,
0.71875,
0.179443359375,
-0.13427734375,
0.451171875,
-0.2462158203125,
0.7978515625,
0.310791015625,
-0.53955078125,
-0.279296875,
0.41015625,
0.1737060546875,
-0.30419921875,
0.2208251953125,
-0.35400390625,
0.2191162109375,
-0.252197265625,
-0.1470947265625,
0.7578125,
0.294677734375,
-0.06256103515625,
-0.146240234375,
0.53125,
-0.8623046875,
-0.09112548828125,
-0.00882720947265625,
0.7314453125,
0.62158203125,
0.8427734375,
0.0244293212890625,
-0.02337646484375,
0.149658203125,
-1.1337890625,
0.71435546875,
0.253662109375,
0.72314453125,
-0.75439453125,
0.46826171875,
0.10052490234375,
-0.6884765625,
0.2314453125,
-0.826171875,
-0.6015625,
1.037109375,
-0.231689453125,
0.88623046875,
-0.24267578125,
0.3984375,
-0.53076171875,
0.078857421875,
0.484375,
-0.10528564453125,
0.56787109375,
-0.2371826171875,
-0.196533203125,
-0.58447265625,
-0.12249755859375,
0.018890380859375,
-0.309814453125,
0.1640625,
-0.195068359375,
-0.35498046875,
-0.91650390625,
0.91845703125,
0.68408203125,
0.0478515625,
-0.283447265625,
0.1519775390625,
0.1866455078125,
0.56982421875,
0.49365234375,
-0.34912109375,
0.207763671875,
-0.70556640625,
0.8251953125,
-0.012359619140625,
-0.1583251953125,
-0.61376953125,
-0.33642578125,
-0.2464599609375,
0.376708984375,
0.094482421875,
-0.017059326171875,
-0.99169921875,
0.373046875,
-0.252197265625,
0.5048828125,
-0.671875,
-0.293212890625,
-0.53759765625,
0.7392578125,
0.48583984375,
-0.82421875,
0.419677734375,
-0.268310546875,
0.274658203125,
0.33544921875,
-0.238037109375,
-0.388671875,
-0.72802734375,
-0.52490234375,
-0.76220703125,
0.72802734375,
0.681640625,
-0.22216796875,
0.493408203125,
-0.9755859375,
0.48388671875,
-0.02728271484375,
-0.059600830078125,
0.054595947265625,
0.212890625,
0.406982421875,
0.1680908203125,
0.90673828125,
-0.25537109375,
-0.67578125,
0.204833984375,
-1.2041015625,
0.8779296875,
-0.29833984375,
0.87255859375,
0.1607666015625,
-0.1597900390625,
-0.21533203125,
0.477783203125,
-0.6298828125,
0.08465576171875,
-0.2041015625,
0.39990234375,
-0.904296875,
-0.85009765625,
0.79736328125,
-0.40380859375,
-0.1746826171875,
0.8544921875,
-0.06475830078125,
-0.67724609375,
0.220458984375,
0.57373046875,
-0.5126953125,
0.23388671875,
-0.67724609375,
0.265380859375,
-0.427978515625,
-0.27001953125,
-0.1220703125,
-0.79443359375,
0.50048828125,
0.1353759765625,
-0.50927734375,
-0.1556396484375,
-1.0302734375,
-0.00623321533203125,
0.060516357421875,
-0.419189453125,
0.401123046875,
-0.1444091796875,
-0.4013671875,
-0.293701171875,
-0.2666015625,
-0.80615234375,
-0.52880859375,
-0.61962890625,
-0.304443359375,
0.220458984375,
0.203857421875,
0.70703125,
-0.175048828125,
-0.67236328125,
0.06927490234375,
0.09716796875,
-0.3388671875,
-0.20947265625,
-0.101318359375,
-0.01505279541015625,
-0.0445556640625,
-0.183349609375,
0.058990478515625,
0.1182861328125,
0.48974609375,
0.429931640625,
0.5205078125,
0.276611328125,
0.50390625,
-0.432373046875,
0.625,
0.1502685546875,
-0.65576171875,
0.12841796875,
0.654296875,
-0.08001708984375,
0.580078125,
0.48388671875,
-0.806640625,
-0.53662109375,
-0.95751953125,
-0.176025390625,
-0.343994140625,
-0.11810302734375,
-1.166015625,
-0.7080078125,
-0.205078125,
0.517578125,
0.15234375,
-0.352294921875,
0.06414794921875,
-1.0810546875,
0.11407470703125,
-0.71337890625,
-0.183837890625,
-0.9892578125,
-0.72216796875,
-0.1624755859375,
0.6767578125,
-0.1485595703125,
0.316162109375,
-0.6240234375,
-0.0889892578125,
0.642578125,
-0.50390625,
-0.994140625,
-0.46875,
-0.11834716796875,
0.1751708984375,
0.047637939453125,
0.357421875,
-0.495849609375,
0.3134765625,
-0.60009765625,
0.3310546875,
-0.7529296875,
-0.32421875,
-0.373046875,
0.1192626953125,
0.9013671875,
-0.185546875,
-0.305419921875,
0.06500244140625,
0.63330078125,
0.572265625,
-0.257568359375,
-0.19873046875,
-0.9814453125,
-0.451171875,
-0.8349609375,
0.380859375,
-0.6396484375,
0.0963134765625,
-0.356201171875,
0.11907958984375,
1.3388671875,
-0.1572265625,
0.7607421875,
0.94921875,
0.25830078125,
0.1793212890625,
-0.82861328125,
0.77734375,
0.71533203125,
-0.626953125,
0.096435546875,
0.117919921875,
-0.52001953125,
0.17578125,
-0.1453857421875,
-1.17578125,
-0.4169921875,
0.4775390625,
1.263671875,
0.07745361328125,
0.421875,
-0.1644287109375,
-1.2333984375,
0.0254364013671875,
0.7275390625,
0.24951171875,
0.09429931640625,
0.7841796875,
0.16748046875,
0.0716552734375,
-0.2144775390625,
-0.263671875,
0.0777587890625,
-0.373779296875,
1.212890625,
-0.41748046875,
-0.76318359375,
1.0771484375,
1.08203125,
-0.7900390625,
-1.2158203125,
0.0218658447265625,
0.28076171875,
-0.20947265625,
-0.72021484375,
0.39453125,
0.30126953125,
-0.55859375,
0.12371826171875,
0.2479248046875,
0.003322601318359375,
0.0022754669189453125,
0.1353759765625,
-0.0211029052734375,
-0.48583984375,
0.0950927734375,
0.75244140625,
-0.29150390625,
-0.50439453125,
-1.052734375,
0.004062652587890625,
-0.298828125,
0.0791015625,
0.75830078125,
-0.11480712890625,
-0.007598876953125,
0.434814453125,
0.189697265625,
0.873046875,
-0.456298828125,
-0.1436767578125,
0.2447509765625,
-0.4921875,
-0.7509765625,
-0.07586669921875,
0.88037109375,
-0.060333251953125,
0.1707763671875,
-1.0908203125,
0.13232421875,
0.36279296875,
0.103271484375,
-0.60595703125,
-0.8662109375,
-0.1861572265625,
-0.9111328125,
-0.449951171875,
-0.2783203125,
-0.5185546875,
-0.30078125,
-0.2042236328125,
-0.03558349609375,
-0.09991455078125,
-0.02459716796875,
0.399169921875,
-0.51025390625,
0.417236328125,
-0.473388671875,
0.7734375,
-0.490234375,
-0.10870361328125,
-0.5947265625,
0.1624755859375,
-0.28466796875,
0.00861358642578125,
-0.94580078125,
0.220703125,
0.642578125,
0.0885009765625,
-0.2127685546875,
0.34521484375,
-0.73974609375,
-0.499755859375,
0.12017822265625,
0.1671142578125,
-0.23876953125,
0.90087890625,
0.5126953125,
-0.1466064453125,
0.6162109375,
0.006023406982421875,
-0.4580078125,
-0.378662109375,
0.37255859375,
0.66650390625,
-0.1689453125,
0.1273193359375,
-0.2490234375,
0.2037353515625,
-0.935546875,
-0.0038299560546875,
-0.24072265625,
0.1546630859375,
0.233642578125,
-0.234619140625,
0.60009765625,
1.1279296875,
-0.1387939453125,
0.1004638671875,
-0.09564208984375,
0.1324462890625,
0.449951171875,
-0.0760498046875,
-0.1822509765625,
0.24951171875,
0.47607421875,
-0.133056640625,
-0.1903076171875,
0.50390625,
-0.056060791015625,
0.2587890625,
0.012603759765625,
-0.63427734375,
-1.03125,
0.0187835693359375,
-0.04736328125,
0.349853515625,
0.446533203125,
-0.1988525390625,
-0.0943603515625,
-0.2105712890625,
-0.80859375,
0.3583984375,
-1.0888671875,
-0.96044921875,
-0.11956787109375,
-0.1546630859375,
-0.828125,
-0.1678466796875,
-0.6337890625,
-0.25,
0.1729736328125,
0.5009765625,
-0.57763671875,
0.480712890625,
0.182373046875,
0.304931640625,
0.0433349609375,
0.07232666015625,
0.2481689453125,
0.5556640625,
-0.72119140625,
-0.483642578125,
0.40576171875,
0.8984375,
0.60595703125,
-0.1524658203125,
-0.9736328125,
0.1102294921875,
0.359375,
-0.0528564453125,
-0.63134765625,
0.105224609375,
-0.1702880859375,
0.85400390625,
-0.822265625,
-0.06982421875,
-0.052398681640625,
0.64111328125,
0.00789642333984375,
-0.10931396484375,
-0.2093505859375,
0.51220703125,
1.20703125,
-0.4169921875,
0.7646484375,
0.367919921875,
0.0582275390625,
-0.13916015625,
-0.239990234375,
-0.50390625,
0.78857421875,
0.841796875,
0.57666015625,
0.0047454833984375,
0.344970703125,
0.75048828125,
-0.078369140625,
-0.08819580078125,
0.474609375,
-0.0528564453125,
0.0582275390625,
-0.0936279296875,
0.1689453125,
-0.368408203125,
-0.0513916015625,
-0.6982421875,
0.228515625,
-0.5283203125,
-0.22998046875,
-0.46630859375,
-0.6884765625,
1.115234375,
-0.328369140625,
-0.00292205810546875,
-0.02337646484375,
-0.48388671875,
0.420654296875,
0.75732421875,
-0.018310546875,
-0.401123046875,
0.669921875,
0.19677734375,
0.296142578125,
0.67041015625,
0.3935546875,
0.46240234375,
-0.509765625,
0.1240234375,
-0.2081298828125,
-0.06524658203125,
-0.254638671875,
-0.400390625,
-0.8583984375,
0.51708984375,
0.05047607421875,
-0.52734375,
0.9326171875,
-0.671875,
0.0180206298828125,
-0.2440185546875,
0.73876953125,
-0.5791015625,
0.64453125,
0.260009765625,
-0.23291015625,
-0.9150390625,
0.75146484375,
-0.1729736328125,
0.371337890625,
0.1641845703125,
1.087890625,
-0.12939453125,
1.2646484375,
0.30908203125,
-0.188720703125,
-0.23388671875,
0.39111328125,
-0.57568359375,
-0.96044921875,
-0.3408203125,
-0.491455078125,
0.0792236328125,
-0.4013671875,
-0.296142578125,
0.00466156005859375,
0.6142578125,
0.166748046875,
-0.95703125,
-0.638671875,
0.281494140625,
-0.5478515625,
0.255126953125,
0.56005859375,
0.06878662109375,
0.09075927734375,
-0.3984375,
-0.43701171875,
-0.56689453125,
0.278076171875,
-0.6875,
0.55029296875,
-0.425048828125,
-0.2392578125,
-0.451171875,
-0.5068359375,
-0.155517578125,
0.1080322265625,
-0.325439453125,
-0.81591796875,
0.1162109375,
0.298095703125,
0.376953125,
0.489013671875,
-0.1761474609375,
0.1488037109375,
1.1767578125,
0.9560546875,
0.2464599609375,
0.61279296875,
0.37060546875,
-0.0626220703125,
0.147705078125,
-0.2841796875,
0.435546875,
-0.50390625,
0.341552734375,
-0.176025390625,
0.60693359375,
-0.65185546875,
-1.240234375,
0.211181640625,
0.39697265625,
0.42041015625,
-0.47802734375,
-0.822265625,
-0.404052734375,
-1.16015625,
-0.0439453125,
-0.55517578125,
0.90673828125,
-0.047821044921875,
-0.1016845703125,
-0.267822265625,
-0.79638671875,
4.5078125,
1.375,
0.60791015625,
0.5283203125,
0.03204345703125,
0.9755859375,
0.580078125,
-0.377685546875,
-0.016510009765625,
-0.21435546875,
0.354736328125,
-0.2105712890625,
-0.10137939453125,
0.8662109375,
0.478759765625,
0.4609375,
-0.80224609375,
0.1695556640625,
-0.251953125,
-0.962890625,
-0.72412109375,
0.2359619140625,
-0.2264404296875,
0.491455078125,
-0.16455078125,
0.66357421875,
0.492919921875,
-0.81591796875,
-0.34375,
-0.51708984375,
0.0748291015625,
-0.51220703125,
0.9013671875,
0.06396484375,
-0.484619140625,
0.26416015625,
-0.2183837890625,
-0.580078125,
-0.53955078125,
0.326416015625,
-0.033416748046875,
0.16748046875,
0.8076171875,
-0.43115234375,
0.45654296875,
0.55810546875,
-0.71484375,
0.2193603515625,
-0.082275390625,
-0.94140625,
0.5458984375,
-0.50146484375,
-0.04681396484375,
-0.263671875,
-0.990234375,
-0.489501953125,
0.67431640625,
-0.09893798828125,
-0.040069580078125,
0.400634765625,
0.487060546875,
-0.06005859375,
0.11328125,
0.6015625,
-1.1513671875,
0.6806640625,
-0.06304931640625,
0.466552734375,
-0.3916015625,
-0.26708984375,
-0.2474365234375,
-0.276123046875,
-0.46435546875,
-0.30712890625,
0.587890625,
0.364990234375,
-0.2010498046875,
0.31982421875,
0.52490234375,
-0.92626953125,
0.42236328125,
-0.02984619140625,
-0.7392578125,
-0.6669921875,
0.87744140625,
1.1142578125,
-0.669921875,
-0.417724609375,
-0.268798828125,
0.50927734375,
0.49755859375,
0.61279296875,
-0.044464111328125,
-0.479248046875,
-0.1573486328125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Tags: implementation
Correct Solution:
```
#l,r = map(int, input().strip().split(' '))
#lst = list(map(int, input().strip().split(' ')))
s=input()
n=int(input())
p='z'*100
f=0
#should be a prefix
for i in range(n):
t=input()
if s == t[:len(s)] and t<p:
p=t
f=1
if f==0:
print(s)
else:
print(p)
```
| 46,648
|
[
-0.08160400390625,
-0.29296875,
0.5341796875,
0.3486328125,
-0.3173828125,
-0.14892578125,
-0.22412109375,
0.11541748046875,
0.245361328125,
0.34765625,
0.38330078125,
-0.1536865234375,
0.0297088623046875,
-0.716796875,
-0.7041015625,
0.0694580078125,
-0.87451171875,
-0.5712890625,
-0.7041015625,
-0.051971435546875,
0.1434326171875,
-0.034698486328125,
-1.2607421875,
-0.464111328125,
-0.2734375,
0.75927734375,
0.312744140625,
0.091796875,
0.5576171875,
1.1962890625,
-0.036468505859375,
-0.45849609375,
0.371826171875,
-1.013671875,
-0.499267578125,
-0.438232421875,
0.4921875,
-0.9541015625,
-0.354248046875,
-0.62939453125,
0.313720703125,
-0.26708984375,
0.3330078125,
-0.646484375,
-1.0068359375,
0.1220703125,
-0.71337890625,
-0.58984375,
-0.322509765625,
-0.7099609375,
0.053985595703125,
-0.296875,
0.337890625,
-0.1439208984375,
-0.2425537109375,
-0.300537109375,
-0.00804901123046875,
-0.0792236328125,
-0.56494140625,
0.38720703125,
0.5615234375,
0.37451171875,
-0.311279296875,
-0.25341796875,
-0.3212890625,
0.386962890625,
0.1519775390625,
-0.320068359375,
0.164794921875,
-0.57666015625,
-0.474853515625,
0.1004638671875,
-0.48779296875,
-0.6923828125,
-0.0701904296875,
0.08905029296875,
0.12249755859375,
-0.2159423828125,
-0.202880859375,
0.724609375,
0.323974609375,
0.72900390625,
0.59326171875,
0.425537109375,
-0.2216796875,
-0.79443359375,
-0.17333984375,
0.1002197265625,
0.1695556640625,
0.07025146484375,
-0.0897216796875,
0.425048828125,
-0.1563720703125,
-0.00507354736328125,
0.8681640625,
0.90478515625,
-0.043853759765625,
0.443115234375,
0.452880859375,
0.111083984375,
0.65673828125,
0.865234375,
-0.30322265625,
1.080078125,
-0.837890625,
0.315673828125,
0.0634765625,
-0.343017578125,
-0.1824951171875,
-0.52587890625,
-0.313232421875,
-0.21240234375,
0.305908203125,
0.55615234375,
-0.2374267578125,
0.947265625,
-0.02459716796875,
-0.036376953125,
-0.71142578125,
0.3828125,
0.20263671875,
0.376953125,
-0.054534912109375,
-0.2413330078125,
0.15087890625,
-0.58056640625,
-0.431884765625,
0.69873046875,
-0.8740234375,
-0.22509765625,
0.212158203125,
-0.08538818359375,
-0.11053466796875,
0.56005859375,
-0.111572265625,
0.6484375,
-0.10589599609375,
0.478759765625,
0.728515625,
-0.771484375,
0.79541015625,
-0.357421875,
0.1640625,
1.5048828125,
0.396728515625,
0.07379150390625,
0.6494140625,
0.37841796875,
-0.87744140625,
0.413330078125,
-0.480224609375,
0.689453125,
0.40478515625,
-0.2154541015625,
0.2437744140625,
0.1326904296875,
-0.07305908203125,
0.08795166015625,
0.206787109375,
0.2900390625,
-0.44091796875,
0.1168212890625,
-0.259765625,
0.876953125,
-0.376953125,
1.1142578125,
-0.71728515625,
-0.12890625,
0.1715087890625,
-0.271728515625,
0.03350830078125,
-0.26953125,
-0.4189453125,
0.57177734375,
0.6787109375,
0.783203125,
0.8681640625,
-0.1455078125,
0.36572265625,
-0.07073974609375,
-0.39404296875,
-0.03826904296875,
0.35791015625,
0.74072265625,
0.33935546875,
0.247314453125,
0.0221099853515625,
-0.6591796875,
-0.509765625,
-0.892578125,
0.343505859375,
0.53515625,
-0.495849609375,
0.1422119140625,
0.1094970703125,
0.358154296875,
-0.78173828125,
-0.1817626953125,
0.1600341796875,
-1.015625,
-0.50390625,
0.6025390625,
-0.465087890625,
0.20361328125,
-0.5,
-0.0621337890625,
0.34912109375,
1.3310546875,
-0.357421875,
0.040618896484375,
0.716796875,
0.125244140625,
-0.5830078125,
-0.039337158203125,
0.3564453125,
0.06884765625,
-0.56689453125,
0.55078125,
-0.278564453125,
-0.053619384765625,
0.10833740234375,
1.2353515625,
0.544921875,
0.328857421875,
-0.27294921875,
0.066650390625,
0.20556640625,
0.998046875,
-0.2371826171875,
0.595703125,
-0.10980224609375,
1.0224609375,
0.291259765625,
0.52490234375,
0.368896484375,
0.2261962890625,
0.75537109375,
0.60595703125,
-0.087158203125,
0.2421875,
0.1932373046875,
0.69677734375,
0.5859375,
0.60791015625,
-0.1534423828125,
0.56884765625,
-0.06866455078125,
0.051971435546875,
-0.47607421875,
0.353271484375,
0.204833984375,
0.90625,
-0.11907958984375,
0.48779296875,
-0.396484375,
-0.99267578125,
0.392822265625,
0.646484375,
-0.99658203125,
-0.638671875,
-0.2183837890625,
-0.10791015625,
0.481201171875,
-0.220703125,
0.272216796875,
0.365966796875,
0.4716796875,
0.40283203125,
-0.32275390625,
-0.62646484375,
-0.9462890625,
-0.9990234375,
-0.90380859375,
-0.0714111328125,
-0.64697265625,
-0.0936279296875,
0.367431640625,
-0.5546875,
0.1287841796875,
-0.333984375,
-0.3056640625,
0.09918212890625,
-0.270263671875,
0.52587890625,
0.1436767578125,
0.578125,
-0.410400390625,
0.6962890625,
0.0283203125,
1.1513671875,
-0.5888671875,
-0.47265625,
0.01319122314453125,
-0.29638671875,
0.387939453125,
0.149169921875,
0.6748046875,
0.1883544921875,
-0.93408203125,
-0.63037109375,
-0.47509765625,
-0.1123046875,
-0.1514892578125,
0.260009765625,
-0.4892578125,
0.97216796875,
0.058746337890625,
-0.66357421875,
0.489990234375,
0.560546875,
-0.99853515625,
0.66796875,
0.241455078125,
-0.062286376953125,
-0.78662109375,
1.4580078125,
0.26611328125,
0.27392578125,
-0.262939453125,
-0.483154296875,
-0.395751953125,
0.259521484375,
0.126953125,
-0.74853515625,
-0.06903076171875,
0.5517578125,
0.01068878173828125,
-1.1318359375,
0.447509765625,
-1.1943359375,
-0.53759765625,
-0.39306640625,
-0.12237548828125,
1.017578125,
0.7138671875,
0.1729736328125,
-0.1943359375,
0.412841796875,
-0.233154296875,
0.763671875,
0.29345703125,
-0.55810546875,
-0.2498779296875,
0.4228515625,
0.1585693359375,
-0.27978515625,
0.237548828125,
-0.362060546875,
0.2132568359375,
-0.2261962890625,
-0.13232421875,
0.7861328125,
0.2900390625,
-0.036712646484375,
-0.1688232421875,
0.56298828125,
-0.90087890625,
-0.07366943359375,
-0.03857421875,
0.732421875,
0.60693359375,
0.85791015625,
0.039093017578125,
-0.062408447265625,
0.1148681640625,
-1.1337890625,
0.72314453125,
0.25537109375,
0.7509765625,
-0.82373046875,
0.481689453125,
0.08746337890625,
-0.70068359375,
0.257568359375,
-0.8271484375,
-0.611328125,
1.0390625,
-0.28076171875,
0.88671875,
-0.2861328125,
0.411376953125,
-0.529296875,
0.07177734375,
0.469482421875,
-0.1324462890625,
0.58642578125,
-0.22900390625,
-0.165771484375,
-0.56494140625,
-0.14599609375,
-0.0039005279541015625,
-0.345703125,
0.1651611328125,
-0.157958984375,
-0.36328125,
-0.927734375,
0.88037109375,
0.71044921875,
0.09698486328125,
-0.25927734375,
0.1705322265625,
0.1837158203125,
0.53662109375,
0.48974609375,
-0.324951171875,
0.170654296875,
-0.75732421875,
0.8349609375,
0.014984130859375,
-0.1297607421875,
-0.59326171875,
-0.397705078125,
-0.2294921875,
0.400390625,
0.10009765625,
-0.065673828125,
-1.064453125,
0.36474609375,
-0.2452392578125,
0.51806640625,
-0.6611328125,
-0.3125,
-0.53759765625,
0.73193359375,
0.5400390625,
-0.8046875,
0.3759765625,
-0.290771484375,
0.232666015625,
0.32568359375,
-0.240478515625,
-0.398681640625,
-0.74365234375,
-0.5234375,
-0.7861328125,
0.73095703125,
0.68017578125,
-0.204833984375,
0.484375,
-0.94970703125,
0.509765625,
0.01152801513671875,
-0.07745361328125,
0.05926513671875,
0.18603515625,
0.3935546875,
0.1307373046875,
0.90673828125,
-0.255126953125,
-0.70263671875,
0.22607421875,
-1.17578125,
0.86669921875,
-0.293212890625,
0.90234375,
0.11297607421875,
-0.1903076171875,
-0.240234375,
0.5,
-0.61474609375,
0.09185791015625,
-0.2117919921875,
0.38720703125,
-0.89599609375,
-0.8603515625,
0.7861328125,
-0.37744140625,
-0.16259765625,
0.85693359375,
-0.0382080078125,
-0.67236328125,
0.238037109375,
0.58642578125,
-0.5341796875,
0.205078125,
-0.673828125,
0.2568359375,
-0.427001953125,
-0.277099609375,
-0.0992431640625,
-0.81591796875,
0.5341796875,
0.1798095703125,
-0.50390625,
-0.1463623046875,
-1.001953125,
0.0254364013671875,
0.059051513671875,
-0.465576171875,
0.412841796875,
-0.12841796875,
-0.382080078125,
-0.29931640625,
-0.27001953125,
-0.7841796875,
-0.55224609375,
-0.599609375,
-0.291015625,
0.26416015625,
0.2379150390625,
0.75,
-0.2042236328125,
-0.6787109375,
0.10955810546875,
0.09027099609375,
-0.328369140625,
-0.1883544921875,
-0.08941650390625,
-0.05889892578125,
-0.042205810546875,
-0.1632080078125,
0.057891845703125,
0.1199951171875,
0.492431640625,
0.4560546875,
0.51953125,
0.309814453125,
0.489990234375,
-0.467529296875,
0.65966796875,
0.1890869140625,
-0.64697265625,
0.1258544921875,
0.638671875,
-0.09246826171875,
0.62255859375,
0.47607421875,
-0.80029296875,
-0.54248046875,
-0.9892578125,
-0.210205078125,
-0.351318359375,
-0.0791015625,
-1.1767578125,
-0.701171875,
-0.240478515625,
0.5146484375,
0.1490478515625,
-0.34814453125,
0.036224365234375,
-1.1376953125,
0.137451171875,
-0.72509765625,
-0.199462890625,
-1.0009765625,
-0.7548828125,
-0.150634765625,
0.68115234375,
-0.12548828125,
0.272216796875,
-0.61279296875,
-0.10638427734375,
0.5888671875,
-0.484130859375,
-1.001953125,
-0.49658203125,
-0.11468505859375,
0.162841796875,
0.057586669921875,
0.346435546875,
-0.453369140625,
0.3505859375,
-0.666015625,
0.30517578125,
-0.74951171875,
-0.316162109375,
-0.39501953125,
0.103759765625,
0.88671875,
-0.1983642578125,
-0.31591796875,
0.0258636474609375,
0.64306640625,
0.560546875,
-0.26025390625,
-0.200927734375,
-0.97900390625,
-0.4521484375,
-0.83740234375,
0.355224609375,
-0.666015625,
0.09228515625,
-0.387451171875,
0.0545654296875,
1.3330078125,
-0.14697265625,
0.7724609375,
0.96337890625,
0.288330078125,
0.171875,
-0.90087890625,
0.76904296875,
0.6767578125,
-0.64794921875,
0.1103515625,
0.111328125,
-0.54736328125,
0.1864013671875,
-0.155517578125,
-1.1611328125,
-0.439697265625,
0.465576171875,
1.27734375,
0.06805419921875,
0.42138671875,
-0.1944580078125,
-1.2265625,
0.009552001953125,
0.74853515625,
0.269775390625,
0.06396484375,
0.765625,
0.1768798828125,
0.0638427734375,
-0.2333984375,
-0.229248046875,
0.05731201171875,
-0.367919921875,
1.25390625,
-0.40185546875,
-0.72265625,
1.0556640625,
1.0869140625,
-0.81103515625,
-1.228515625,
0.053680419921875,
0.310546875,
-0.2342529296875,
-0.76708984375,
0.41259765625,
0.320068359375,
-0.56982421875,
0.1558837890625,
0.275634765625,
0.008392333984375,
-0.01380157470703125,
0.138916015625,
-0.007289886474609375,
-0.435791015625,
0.058868408203125,
0.79052734375,
-0.301513671875,
-0.53662109375,
-1.03515625,
-0.02825927734375,
-0.273681640625,
0.1004638671875,
0.7490234375,
-0.12127685546875,
0.0032329559326171875,
0.42333984375,
0.1951904296875,
0.9091796875,
-0.4814453125,
-0.1414794921875,
0.264404296875,
-0.5107421875,
-0.744140625,
-0.10174560546875,
0.873046875,
-0.07269287109375,
0.2088623046875,
-1.1103515625,
0.150390625,
0.363525390625,
0.035003662109375,
-0.5966796875,
-0.92822265625,
-0.194091796875,
-0.9423828125,
-0.426513671875,
-0.307861328125,
-0.51220703125,
-0.3173828125,
-0.1986083984375,
0.0231781005859375,
-0.1209716796875,
-0.01312255859375,
0.424560546875,
-0.53955078125,
0.40380859375,
-0.474853515625,
0.78173828125,
-0.49609375,
-0.107666015625,
-0.61767578125,
0.146728515625,
-0.283447265625,
0.016204833984375,
-0.9111328125,
0.2152099609375,
0.64453125,
0.09576416015625,
-0.1834716796875,
0.33642578125,
-0.75537109375,
-0.458251953125,
0.11248779296875,
0.1361083984375,
-0.25146484375,
0.869140625,
0.47998046875,
-0.195068359375,
0.583984375,
0.00983428955078125,
-0.42529296875,
-0.354736328125,
0.3427734375,
0.70556640625,
-0.199951171875,
0.134521484375,
-0.2215576171875,
0.237060546875,
-0.94482421875,
0.00567626953125,
-0.23583984375,
0.1309814453125,
0.2476806640625,
-0.2178955078125,
0.64208984375,
1.1357421875,
-0.09796142578125,
0.0736083984375,
-0.124755859375,
0.18994140625,
0.440185546875,
-0.10198974609375,
-0.23779296875,
0.25048828125,
0.46923828125,
-0.1446533203125,
-0.172119140625,
0.47802734375,
-0.037628173828125,
0.254150390625,
0.0164794921875,
-0.6484375,
-1.037109375,
-0.02655029296875,
-0.01629638671875,
0.399658203125,
0.42529296875,
-0.1920166015625,
-0.05389404296875,
-0.2060546875,
-0.7626953125,
0.401123046875,
-1.103515625,
-0.94287109375,
-0.11932373046875,
-0.1337890625,
-0.8212890625,
-0.1414794921875,
-0.61083984375,
-0.204833984375,
0.19482421875,
0.5126953125,
-0.61376953125,
0.489990234375,
0.2039794921875,
0.33203125,
0.0469970703125,
0.025787353515625,
0.226806640625,
0.5625,
-0.73388671875,
-0.483154296875,
0.396484375,
0.876953125,
0.57177734375,
-0.1365966796875,
-0.951171875,
0.067138671875,
0.341064453125,
-0.04010009765625,
-0.64013671875,
0.09100341796875,
-0.1866455078125,
0.8408203125,
-0.787109375,
-0.057403564453125,
-0.039825439453125,
0.61181640625,
0.01053619384765625,
-0.0859375,
-0.2196044921875,
0.521484375,
1.2216796875,
-0.38818359375,
0.7666015625,
0.32080078125,
0.0810546875,
-0.1490478515625,
-0.2313232421875,
-0.5224609375,
0.82421875,
0.880859375,
0.59765625,
0.0189056396484375,
0.3232421875,
0.7958984375,
-0.08209228515625,
-0.095458984375,
0.4677734375,
-0.074462890625,
0.0399169921875,
-0.0897216796875,
0.1895751953125,
-0.3759765625,
-0.0255584716796875,
-0.69287109375,
0.2427978515625,
-0.54052734375,
-0.194091796875,
-0.454833984375,
-0.67236328125,
1.1728515625,
-0.32861328125,
0.0200958251953125,
-0.0487060546875,
-0.490234375,
0.4814453125,
0.75390625,
-0.0193634033203125,
-0.397216796875,
0.69677734375,
0.2196044921875,
0.29248046875,
0.67431640625,
0.364990234375,
0.460205078125,
-0.52099609375,
0.1768798828125,
-0.2159423828125,
-0.06329345703125,
-0.25927734375,
-0.358154296875,
-0.88916015625,
0.5380859375,
0.04534912109375,
-0.470947265625,
0.912109375,
-0.689453125,
-0.020660400390625,
-0.2408447265625,
0.71728515625,
-0.5439453125,
0.63720703125,
0.275146484375,
-0.280029296875,
-0.90625,
0.75244140625,
-0.131591796875,
0.38330078125,
0.1378173828125,
1.0546875,
-0.149658203125,
1.3134765625,
0.318603515625,
-0.1998291015625,
-0.2310791015625,
0.453857421875,
-0.6025390625,
-0.94970703125,
-0.35986328125,
-0.509765625,
0.053955078125,
-0.393798828125,
-0.2724609375,
-0.034881591796875,
0.64794921875,
0.1458740234375,
-0.95947265625,
-0.65087890625,
0.31396484375,
-0.5615234375,
0.26611328125,
0.52001953125,
0.085693359375,
0.06610107421875,
-0.419921875,
-0.455322265625,
-0.53564453125,
0.248046875,
-0.70849609375,
0.52099609375,
-0.445068359375,
-0.1929931640625,
-0.49951171875,
-0.5087890625,
-0.212646484375,
0.1097412109375,
-0.3095703125,
-0.81103515625,
0.10272216796875,
0.319580078125,
0.399169921875,
0.47314453125,
-0.1507568359375,
0.1649169921875,
1.2021484375,
0.94287109375,
0.2398681640625,
0.603515625,
0.35400390625,
-0.0985107421875,
0.1475830078125,
-0.2578125,
0.48583984375,
-0.492919921875,
0.330078125,
-0.1923828125,
0.58984375,
-0.73388671875,
-1.2236328125,
0.221435546875,
0.366455078125,
0.38623046875,
-0.465087890625,
-0.82177734375,
-0.428466796875,
-1.130859375,
-0.033477783203125,
-0.59814453125,
0.88330078125,
-0.0014085769653320312,
-0.11138916015625,
-0.28125,
-0.7490234375,
4.484375,
1.43359375,
0.619140625,
0.48193359375,
0.06634521484375,
1.005859375,
0.5751953125,
-0.365966796875,
0.00811004638671875,
-0.292236328125,
0.402587890625,
-0.2169189453125,
-0.073486328125,
0.85009765625,
0.47265625,
0.4716796875,
-0.74462890625,
0.2293701171875,
-0.262451171875,
-0.98388671875,
-0.701171875,
0.2296142578125,
-0.2333984375,
0.450439453125,
-0.1573486328125,
0.666015625,
0.51220703125,
-0.78564453125,
-0.369873046875,
-0.51220703125,
0.09332275390625,
-0.525390625,
0.89404296875,
0.08941650390625,
-0.435302734375,
0.264404296875,
-0.25830078125,
-0.5888671875,
-0.552734375,
0.3193359375,
-0.05731201171875,
0.148193359375,
0.8330078125,
-0.458984375,
0.42822265625,
0.59619140625,
-0.6787109375,
0.189453125,
-0.025177001953125,
-0.93212890625,
0.56396484375,
-0.46826171875,
-0.0548095703125,
-0.265869140625,
-0.98681640625,
-0.468017578125,
0.7119140625,
-0.0931396484375,
0.0011510848999023438,
0.3583984375,
0.482177734375,
-0.040618896484375,
0.1080322265625,
0.63330078125,
-1.1689453125,
0.69091796875,
-0.032806396484375,
0.421875,
-0.38427734375,
-0.286865234375,
-0.24365234375,
-0.2384033203125,
-0.48779296875,
-0.31591796875,
0.5693359375,
0.360107421875,
-0.223876953125,
0.31005859375,
0.52685546875,
-0.9228515625,
0.427490234375,
-0.056854248046875,
-0.75439453125,
-0.61767578125,
0.8759765625,
1.095703125,
-0.67236328125,
-0.446044921875,
-0.281982421875,
0.5576171875,
0.4990234375,
0.64794921875,
-0.04595947265625,
-0.51904296875,
-0.153076171875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Submitted Solution:
```
s=input()
n=int(input())
l=[]
for i in range(n):
d=input()
if(d.find(s)==0):
l.append(d)
if(len(l)>0):
m=l[0]
for i in range(1,len(l)):
m=min(m,l[i])
print(m)
else:
print(s)
```
Yes
| 46,649
|
[
-0.00366973876953125,
-0.2403564453125,
0.44775390625,
0.26513671875,
-0.4169921875,
-0.0677490234375,
-0.2939453125,
0.26416015625,
0.24072265625,
0.23486328125,
0.393798828125,
-0.16357421875,
-0.042510986328125,
-0.7314453125,
-0.7421875,
0.0239105224609375,
-0.7978515625,
-0.57080078125,
-0.6728515625,
-0.157470703125,
0.09765625,
-0.036529541015625,
-1.125,
-0.37939453125,
-0.207763671875,
0.611328125,
0.34912109375,
0.036376953125,
0.58154296875,
1.056640625,
-0.0270538330078125,
-0.4580078125,
0.34814453125,
-0.76806640625,
-0.435302734375,
-0.482666015625,
0.484619140625,
-0.95166015625,
-0.400390625,
-0.78173828125,
0.198486328125,
-0.2783203125,
0.306396484375,
-0.48974609375,
-1.021484375,
0.08892822265625,
-0.623046875,
-0.564453125,
-0.351318359375,
-0.78564453125,
0.03338623046875,
-0.3017578125,
0.22021484375,
-0.272705078125,
-0.08367919921875,
-0.2001953125,
0.034423828125,
-0.03338623046875,
-0.60400390625,
0.30908203125,
0.5478515625,
0.465576171875,
-0.33984375,
-0.31298828125,
-0.3447265625,
0.57958984375,
0.12176513671875,
-0.360595703125,
0.259521484375,
-0.3505859375,
-0.46044921875,
0.00841522216796875,
-0.3955078125,
-0.6240234375,
-0.07647705078125,
0.10345458984375,
0.14892578125,
0.0078582763671875,
-0.411865234375,
0.79345703125,
0.227294921875,
0.81640625,
0.7041015625,
0.447021484375,
-0.229736328125,
-0.75732421875,
-0.01239776611328125,
0.057403564453125,
0.151123046875,
0.0679931640625,
-0.046417236328125,
0.27197265625,
-0.134521484375,
-0.1451416015625,
0.9345703125,
0.87353515625,
-0.09783935546875,
0.443115234375,
0.446044921875,
0.04351806640625,
0.6689453125,
0.734375,
-0.32470703125,
1.1259765625,
-0.80419921875,
0.2166748046875,
0.097900390625,
-0.487548828125,
-0.11810302734375,
-0.638671875,
-0.2607421875,
-0.18310546875,
0.18994140625,
0.56201171875,
-0.275390625,
0.8359375,
-0.10101318359375,
0.0269317626953125,
-0.5498046875,
0.292236328125,
0.2005615234375,
0.22216796875,
0.01468658447265625,
-0.22509765625,
0.24755859375,
-0.52783203125,
-0.66259765625,
0.67626953125,
-0.8212890625,
-0.310302734375,
0.192626953125,
-0.068603515625,
-0.2236328125,
0.50732421875,
-0.163330078125,
0.5908203125,
-0.1551513671875,
0.4287109375,
0.74755859375,
-0.7734375,
0.83154296875,
-0.322021484375,
0.237060546875,
1.6171875,
0.361083984375,
0.09820556640625,
0.46923828125,
0.330078125,
-0.8193359375,
0.60302734375,
-0.489013671875,
0.56591796875,
0.263916015625,
-0.30615234375,
0.189697265625,
0.1839599609375,
-0.0726318359375,
0.09832763671875,
0.2763671875,
0.2410888671875,
-0.415771484375,
0.2327880859375,
-0.324462890625,
0.8642578125,
-0.356689453125,
0.9794921875,
-0.64892578125,
-0.09442138671875,
0.1865234375,
-0.2030029296875,
-0.09765625,
-0.2548828125,
-0.2178955078125,
0.65087890625,
0.71240234375,
0.85546875,
0.71728515625,
-0.12078857421875,
0.350341796875,
-0.0275726318359375,
-0.483642578125,
-0.0498046875,
0.405029296875,
0.79052734375,
0.2822265625,
0.314697265625,
0.03302001953125,
-0.53271484375,
-0.459228515625,
-0.8564453125,
0.387451171875,
0.6484375,
-0.5869140625,
0.2008056640625,
0.02490234375,
0.37939453125,
-0.689453125,
-0.28125,
0.181884765625,
-1.0380859375,
-0.55859375,
0.5625,
-0.344970703125,
0.23193359375,
-0.50634765625,
-0.2457275390625,
0.3359375,
1.3291015625,
-0.281982421875,
0.1927490234375,
0.78271484375,
0.177001953125,
-0.55078125,
-0.1629638671875,
0.340087890625,
0.0860595703125,
-0.53662109375,
0.407470703125,
-0.316650390625,
-0.133544921875,
0.13671875,
1.234375,
0.4296875,
0.351806640625,
-0.42431640625,
0.09130859375,
0.1378173828125,
1.037109375,
-0.31103515625,
0.6640625,
-0.056060791015625,
1.0703125,
0.1951904296875,
0.58251953125,
0.359619140625,
0.23583984375,
0.88525390625,
0.609375,
-0.292236328125,
0.2259521484375,
0.1405029296875,
0.7451171875,
0.57763671875,
0.72802734375,
-0.06036376953125,
0.607421875,
-0.087890625,
0.0504150390625,
-0.53271484375,
0.389404296875,
0.1337890625,
0.8662109375,
-0.188232421875,
0.46923828125,
-0.37109375,
-1.015625,
0.541015625,
0.57275390625,
-1.046875,
-0.77001953125,
-0.193359375,
-0.09490966796875,
0.468017578125,
-0.1800537109375,
0.2386474609375,
0.354248046875,
0.36962890625,
0.435302734375,
-0.272216796875,
-0.634765625,
-0.86865234375,
-1.0693359375,
-1.0341796875,
-0.09661865234375,
-0.76611328125,
-0.1466064453125,
0.3662109375,
-0.53125,
0.05743408203125,
-0.382568359375,
-0.22705078125,
0.00734710693359375,
-0.1640625,
0.62548828125,
0.051788330078125,
0.65673828125,
-0.332275390625,
0.6240234375,
-0.00980377197265625,
1.11328125,
-0.56103515625,
-0.4599609375,
-0.044891357421875,
-0.286865234375,
0.352783203125,
0.1669921875,
0.74169921875,
0.2445068359375,
-0.82470703125,
-0.65380859375,
-0.52880859375,
0.022186279296875,
-0.1351318359375,
0.181884765625,
-0.480224609375,
1.0126953125,
-0.0029735565185546875,
-0.78759765625,
0.509765625,
0.57080078125,
-0.90380859375,
0.70751953125,
0.310302734375,
0.08258056640625,
-0.74609375,
1.47265625,
0.2320556640625,
0.397705078125,
-0.2210693359375,
-0.53759765625,
-0.431396484375,
0.2109375,
0.1107177734375,
-0.69091796875,
-0.11285400390625,
0.4775390625,
0.007190704345703125,
-1.1240234375,
0.485595703125,
-1.181640625,
-0.55859375,
-0.38818359375,
-0.26220703125,
0.98486328125,
0.740234375,
0.251708984375,
-0.1739501953125,
0.26025390625,
-0.317138671875,
0.75244140625,
0.31884765625,
-0.6435546875,
-0.200439453125,
0.51025390625,
0.1546630859375,
-0.2049560546875,
0.331787109375,
-0.4052734375,
0.1873779296875,
-0.271728515625,
-0.2110595703125,
0.8671875,
0.2325439453125,
-0.0172882080078125,
-0.217041015625,
0.434326171875,
-0.97216796875,
-0.09271240234375,
-0.1297607421875,
0.654296875,
0.56494140625,
0.859375,
0.20556640625,
0.09454345703125,
0.04296875,
-1.107421875,
0.71826171875,
0.13916015625,
0.73583984375,
-0.7158203125,
0.5380859375,
0.05584716796875,
-0.78515625,
0.375732421875,
-0.84228515625,
-0.462646484375,
0.99462890625,
-0.25341796875,
0.88671875,
-0.322265625,
0.3564453125,
-0.56640625,
-0.03863525390625,
0.48046875,
-0.14599609375,
0.71728515625,
-0.2498779296875,
-0.17041015625,
-0.537109375,
-0.0836181640625,
-0.01397705078125,
-0.356689453125,
0.11505126953125,
-0.2437744140625,
-0.456298828125,
-0.97216796875,
1.0380859375,
0.6337890625,
0.09521484375,
-0.259521484375,
0.1900634765625,
0.11785888671875,
0.400634765625,
0.529296875,
-0.255859375,
0.2177734375,
-0.70703125,
0.94140625,
0.1636962890625,
-0.1600341796875,
-0.51904296875,
-0.36083984375,
-0.299560546875,
0.45166015625,
0.07830810546875,
0.043670654296875,
-1.201171875,
0.459716796875,
-0.2296142578125,
0.4736328125,
-0.7197265625,
-0.188720703125,
-0.5625,
0.63232421875,
0.54638671875,
-0.83740234375,
0.292236328125,
-0.32763671875,
0.1591796875,
0.423828125,
-0.2489013671875,
-0.470703125,
-0.6259765625,
-0.6982421875,
-0.9853515625,
0.71484375,
0.70703125,
-0.281494140625,
0.41552734375,
-1.029296875,
0.5078125,
0.108154296875,
-0.26123046875,
0.2215576171875,
0.07275390625,
0.31689453125,
0.11383056640625,
0.81201171875,
-0.2296142578125,
-0.64599609375,
0.21435546875,
-1.103515625,
0.7919921875,
-0.267578125,
0.93408203125,
0.12493896484375,
-0.1854248046875,
-0.1834716796875,
0.57568359375,
-0.5751953125,
0.10540771484375,
-0.1463623046875,
0.50146484375,
-1.09375,
-0.81201171875,
0.73876953125,
-0.311767578125,
-0.2271728515625,
0.875,
0.0140228271484375,
-0.775390625,
0.14892578125,
0.52587890625,
-0.5380859375,
0.30908203125,
-0.59521484375,
0.236572265625,
-0.306640625,
-0.1617431640625,
-0.1199951171875,
-0.8037109375,
0.580078125,
0.07049560546875,
-0.467529296875,
-0.1876220703125,
-1.0087890625,
-0.0253448486328125,
0.024017333984375,
-0.51904296875,
0.381591796875,
-0.0004448890686035156,
-0.39892578125,
-0.275634765625,
-0.364013671875,
-0.7607421875,
-0.517578125,
-0.57763671875,
-0.266845703125,
0.2005615234375,
0.221923828125,
0.72900390625,
-0.07568359375,
-0.677734375,
0.038360595703125,
-0.1322021484375,
-0.26806640625,
-0.267822265625,
-0.0853271484375,
0.0426025390625,
-0.231689453125,
-0.17626953125,
0.2076416015625,
0.14697265625,
0.56591796875,
0.427490234375,
0.515625,
0.4091796875,
0.44189453125,
-0.496826171875,
0.75390625,
0.064697265625,
-0.81982421875,
0.1990966796875,
0.68359375,
-0.0214080810546875,
0.708984375,
0.31396484375,
-0.75,
-0.556640625,
-1.05078125,
-0.09930419921875,
-0.56103515625,
-0.2376708984375,
-1.2021484375,
-0.7177734375,
-0.2327880859375,
0.525390625,
0.13427734375,
-0.31298828125,
0.244873046875,
-1.1591796875,
0.19873046875,
-0.79443359375,
-0.266357421875,
-1.037109375,
-0.6591796875,
-0.1800537109375,
0.87109375,
-0.1177978515625,
0.2493896484375,
-0.5654296875,
0.039215087890625,
0.428955078125,
-0.4228515625,
-0.95751953125,
-0.454833984375,
-0.0845947265625,
0.1021728515625,
0.049407958984375,
0.326171875,
-0.418701171875,
0.249267578125,
-0.63671875,
0.3525390625,
-0.68896484375,
-0.2408447265625,
-0.352783203125,
0.1002197265625,
0.97021484375,
-0.200927734375,
-0.2666015625,
-0.039764404296875,
0.458984375,
0.66064453125,
-0.188232421875,
-0.1331787109375,
-0.875,
-0.351806640625,
-0.888671875,
0.350341796875,
-0.6142578125,
0.132568359375,
-0.47265625,
0.1422119140625,
1.306640625,
-0.2607421875,
0.82275390625,
0.90771484375,
0.3251953125,
0.1722412109375,
-0.9921875,
0.75830078125,
0.794921875,
-0.662109375,
0.0762939453125,
0.04071044921875,
-0.5625,
0.1754150390625,
-0.280517578125,
-1.1767578125,
-0.5107421875,
0.46533203125,
1.19140625,
0.110595703125,
0.62451171875,
-0.22216796875,
-1.3193359375,
0.118408203125,
0.72021484375,
0.2236328125,
0.00920867919921875,
0.70751953125,
0.195068359375,
-0.0399169921875,
-0.062286376953125,
-0.32373046875,
-0.00044083595275878906,
-0.314453125,
1.2958984375,
-0.50244140625,
-0.72802734375,
1.1474609375,
0.986328125,
-0.92529296875,
-1.2568359375,
-0.0377197265625,
0.359619140625,
-0.0845947265625,
-0.7880859375,
0.417236328125,
0.33984375,
-0.5654296875,
0.1785888671875,
0.1787109375,
-0.16064453125,
-0.0022983551025390625,
0.135498046875,
0.0748291015625,
-0.58154296875,
0.047088623046875,
0.818359375,
-0.283447265625,
-0.634765625,
-1.041015625,
0.0305938720703125,
-0.1654052734375,
0.09393310546875,
0.75048828125,
-0.060546875,
0.1446533203125,
0.5068359375,
0.1949462890625,
0.978515625,
-0.57080078125,
0.0550537109375,
0.19287109375,
-0.4853515625,
-0.6689453125,
-0.23046875,
0.814453125,
-0.019683837890625,
0.251708984375,
-1.0703125,
0.07830810546875,
0.477294921875,
0.173583984375,
-0.57568359375,
-0.82568359375,
-0.232177734375,
-0.8515625,
-0.55615234375,
-0.282958984375,
-0.5888671875,
-0.097900390625,
-0.054290771484375,
0.11669921875,
-0.10089111328125,
-0.0261688232421875,
0.517578125,
-0.53271484375,
0.34033203125,
-0.46728515625,
0.69189453125,
-0.423583984375,
-0.0236663818359375,
-0.6103515625,
0.1298828125,
-0.454345703125,
-0.24462890625,
-0.6796875,
0.22314453125,
0.619140625,
0.043304443359375,
-0.2257080078125,
0.373046875,
-0.5654296875,
-0.313232421875,
0.12322998046875,
0.2412109375,
-0.4345703125,
0.982421875,
0.41064453125,
-0.042999267578125,
0.57275390625,
-0.06304931640625,
-0.386962890625,
-0.19287109375,
0.453369140625,
0.658203125,
-0.186767578125,
0.0283203125,
-0.2171630859375,
0.1571044921875,
-0.947265625,
0.00826263427734375,
-0.255615234375,
0.13232421875,
0.1658935546875,
-0.12451171875,
0.54150390625,
1.1279296875,
-0.2001953125,
0.09039306640625,
-0.07830810546875,
0.2191162109375,
0.4873046875,
-0.0296630859375,
-0.1624755859375,
0.315673828125,
0.36279296875,
-0.2186279296875,
-0.175537109375,
0.48193359375,
0.06829833984375,
0.271240234375,
-0.11468505859375,
-0.7265625,
-1.1875,
0.0738525390625,
-0.048828125,
0.433837890625,
0.5556640625,
-0.239013671875,
-0.12176513671875,
-0.162841796875,
-0.8408203125,
0.499755859375,
-1.208984375,
-0.9658203125,
0.01367950439453125,
-0.145751953125,
-0.81689453125,
-0.035736083984375,
-0.595703125,
-0.0924072265625,
0.2042236328125,
0.468017578125,
-0.56591796875,
0.302001953125,
0.290771484375,
0.3525390625,
0.1026611328125,
0.058929443359375,
0.2279052734375,
0.57470703125,
-0.82177734375,
-0.5048828125,
0.347900390625,
0.8203125,
0.47216796875,
-0.21337890625,
-0.8623046875,
0.0018644332885742188,
0.25244140625,
-0.147216796875,
-0.55126953125,
0.0966796875,
-0.0899658203125,
0.9287109375,
-0.70263671875,
-0.12286376953125,
-0.1268310546875,
0.56640625,
-0.1551513671875,
-0.07464599609375,
-0.251953125,
0.591796875,
1.2333984375,
-0.276611328125,
0.68798828125,
0.34716796875,
0.1934814453125,
-0.15576171875,
-0.152587890625,
-0.49755859375,
0.8046875,
0.96337890625,
0.6552734375,
0.0300445556640625,
0.482666015625,
0.8662109375,
-0.0228424072265625,
0.04815673828125,
0.53955078125,
-0.09930419921875,
0.0165252685546875,
-0.052764892578125,
0.1630859375,
-0.40283203125,
0.06353759765625,
-0.5966796875,
0.1519775390625,
-0.48388671875,
-0.218994140625,
-0.4072265625,
-0.53173828125,
1.26171875,
-0.427490234375,
0.07427978515625,
-0.08123779296875,
-0.59326171875,
0.56982421875,
0.7060546875,
0.06524658203125,
-0.37646484375,
0.7490234375,
0.2734375,
0.30224609375,
0.67578125,
0.3974609375,
0.4140625,
-0.58251953125,
0.08392333984375,
-0.0927734375,
-0.018890380859375,
-0.2066650390625,
-0.36962890625,
-1.0029296875,
0.60009765625,
0.0869140625,
-0.39404296875,
0.71435546875,
-0.78955078125,
-0.059722900390625,
-0.282958984375,
0.81787109375,
-0.68505859375,
0.58154296875,
0.251220703125,
-0.250244140625,
-0.87890625,
0.76513671875,
-0.0830078125,
0.310791015625,
0.14208984375,
1.078125,
-0.044830322265625,
1.244140625,
0.5166015625,
-0.234130859375,
-0.1466064453125,
0.52783203125,
-0.51513671875,
-0.7890625,
-0.285400390625,
-0.55126953125,
-0.09539794921875,
-0.384765625,
-0.331787109375,
-0.159423828125,
0.62255859375,
0.240966796875,
-0.90087890625,
-0.77587890625,
0.2452392578125,
-0.51220703125,
0.378173828125,
0.42236328125,
0.2459716796875,
0.143798828125,
-0.45068359375,
-0.50634765625,
-0.5439453125,
0.237548828125,
-0.53564453125,
0.57421875,
-0.459716796875,
-0.1444091796875,
-0.52734375,
-0.374755859375,
-0.1654052734375,
0.123046875,
-0.34326171875,
-0.77294921875,
0.19287109375,
0.33642578125,
0.1845703125,
0.47509765625,
-0.2490234375,
0.09619140625,
1.2294921875,
0.96728515625,
0.1744384765625,
0.64306640625,
0.43359375,
-0.0279541015625,
0.043853759765625,
-0.1810302734375,
0.50634765625,
-0.361572265625,
0.2359619140625,
-0.295654296875,
0.48681640625,
-0.75048828125,
-1.17578125,
0.1851806640625,
0.38818359375,
0.24658203125,
-0.55078125,
-0.89111328125,
-0.5986328125,
-1.115234375,
0.05889892578125,
-0.64453125,
0.86962890625,
0.0287322998046875,
-0.229736328125,
-0.291748046875,
-0.6845703125,
4.47265625,
1.3271484375,
0.476318359375,
0.31884765625,
0.125244140625,
1.009765625,
0.5458984375,
-0.408935546875,
0.057525634765625,
-0.4248046875,
0.37451171875,
-0.1839599609375,
0.050628662109375,
0.88037109375,
0.51123046875,
0.5322265625,
-0.83935546875,
-0.00937652587890625,
-0.09832763671875,
-1.046875,
-0.818359375,
0.19873046875,
-0.1597900390625,
0.37060546875,
-0.1981201171875,
0.775390625,
0.63232421875,
-0.92333984375,
-0.433349609375,
-0.45263671875,
0.08154296875,
-0.478271484375,
0.94091796875,
0.137451171875,
-0.42236328125,
0.330322265625,
-0.2432861328125,
-0.61279296875,
-0.49951171875,
0.373291015625,
-0.1441650390625,
0.31689453125,
0.8662109375,
-0.400390625,
0.3740234375,
0.6064453125,
-0.6533203125,
0.25732421875,
0.0006499290466308594,
-0.9619140625,
0.6064453125,
-0.331298828125,
-0.039154052734375,
-0.1507568359375,
-0.95654296875,
-0.41796875,
0.662109375,
-0.05963134765625,
0.0399169921875,
0.358154296875,
0.360595703125,
-0.0390625,
-0.0213775634765625,
0.8271484375,
-1.234375,
0.59814453125,
0.0792236328125,
0.39453125,
-0.396484375,
-0.30078125,
-0.34375,
-0.339599609375,
-0.48681640625,
-0.42236328125,
0.57177734375,
0.3818359375,
-0.2200927734375,
0.1790771484375,
0.58642578125,
-0.8857421875,
0.451416015625,
-0.15185546875,
-0.677734375,
-0.78955078125,
0.82421875,
1.00390625,
-0.7099609375,
-0.515625,
-0.22265625,
0.56982421875,
0.58349609375,
0.67919921875,
-0.01200103759765625,
-0.61669921875,
-0.28759765625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Submitted Solution:
```
s=input()
n=int(input());b=[];m=""
for i in range(n) :
x=input()
b.append(x)
if n==2 :
print(min(b))
else :
for i in range(n) :
if b[i][0:len(s)]==s :
m=b[i]
break
if m!="" :
for i in range(1,n) :
if b[i][0:len(s)]==s :
m=min(m,b[i])
print(m)
else :
print(s)
```
Yes
| 46,650
|
[
-0.0286102294921875,
-0.267333984375,
0.4931640625,
0.278076171875,
-0.414794921875,
-0.060150146484375,
-0.268310546875,
0.23876953125,
0.220947265625,
0.260498046875,
0.395263671875,
-0.15185546875,
-0.033905029296875,
-0.73828125,
-0.74267578125,
0.0228424072265625,
-0.7939453125,
-0.53564453125,
-0.65283203125,
-0.164306640625,
0.10430908203125,
-0.0401611328125,
-1.1484375,
-0.378662109375,
-0.2135009765625,
0.61083984375,
0.3466796875,
0.0745849609375,
0.60009765625,
1.0791015625,
-0.038360595703125,
-0.46533203125,
0.367431640625,
-0.75830078125,
-0.443603515625,
-0.489990234375,
0.486328125,
-0.93408203125,
-0.393310546875,
-0.7607421875,
0.19482421875,
-0.2392578125,
0.30322265625,
-0.5146484375,
-1.021484375,
0.07110595703125,
-0.64208984375,
-0.54150390625,
-0.372314453125,
-0.7822265625,
0.0220947265625,
-0.290283203125,
0.2255859375,
-0.263916015625,
-0.102783203125,
-0.194091796875,
0.04046630859375,
-0.0626220703125,
-0.6142578125,
0.343017578125,
0.5146484375,
0.47705078125,
-0.318359375,
-0.302734375,
-0.32568359375,
0.55126953125,
0.12225341796875,
-0.35400390625,
0.26318359375,
-0.35791015625,
-0.430419921875,
0.0162200927734375,
-0.370361328125,
-0.61767578125,
-0.09173583984375,
0.11151123046875,
0.1483154296875,
0.0068511962890625,
-0.396728515625,
0.802734375,
0.2159423828125,
0.8154296875,
0.70263671875,
0.447998046875,
-0.237548828125,
-0.7548828125,
0.00262451171875,
0.054290771484375,
0.1727294921875,
0.067138671875,
-0.017822265625,
0.274169921875,
-0.1632080078125,
-0.2001953125,
0.91796875,
0.8828125,
-0.0792236328125,
0.447509765625,
0.449462890625,
0.038299560546875,
0.65185546875,
0.73291015625,
-0.284423828125,
1.1123046875,
-0.81689453125,
0.2314453125,
0.094970703125,
-0.49560546875,
-0.1312255859375,
-0.640625,
-0.254638671875,
-0.1951904296875,
0.220458984375,
0.5283203125,
-0.2509765625,
0.8291015625,
-0.07965087890625,
0.049041748046875,
-0.55419921875,
0.2978515625,
0.2127685546875,
0.2078857421875,
0.0029163360595703125,
-0.197265625,
0.251708984375,
-0.50537109375,
-0.63525390625,
0.6826171875,
-0.82470703125,
-0.28955078125,
0.2066650390625,
-0.083740234375,
-0.2216796875,
0.483642578125,
-0.1689453125,
0.60546875,
-0.1298828125,
0.434814453125,
0.73828125,
-0.77685546875,
0.83154296875,
-0.318359375,
0.2359619140625,
1.6005859375,
0.335693359375,
0.06707763671875,
0.476806640625,
0.322265625,
-0.81005859375,
0.57470703125,
-0.4814453125,
0.56884765625,
0.273681640625,
-0.313720703125,
0.192626953125,
0.1961669921875,
-0.061431884765625,
0.0828857421875,
0.2100830078125,
0.243408203125,
-0.412109375,
0.21142578125,
-0.29736328125,
0.85986328125,
-0.340087890625,
0.955078125,
-0.63232421875,
-0.0924072265625,
0.173095703125,
-0.181884765625,
-0.09149169921875,
-0.2236328125,
-0.2384033203125,
0.65966796875,
0.72314453125,
0.85302734375,
0.74169921875,
-0.09619140625,
0.352783203125,
-0.005680084228515625,
-0.47265625,
-0.0047454833984375,
0.4296875,
0.806640625,
0.298828125,
0.3125,
0.0242462158203125,
-0.51708984375,
-0.439208984375,
-0.8369140625,
0.400634765625,
0.6337890625,
-0.54443359375,
0.2425537109375,
0.0101318359375,
0.366943359375,
-0.7099609375,
-0.281494140625,
0.17431640625,
-1.05078125,
-0.5703125,
0.53662109375,
-0.353759765625,
0.24951171875,
-0.5185546875,
-0.259521484375,
0.34814453125,
1.326171875,
-0.293212890625,
0.2042236328125,
0.724609375,
0.1661376953125,
-0.53662109375,
-0.135009765625,
0.338134765625,
0.09033203125,
-0.52783203125,
0.422119140625,
-0.32275390625,
-0.1356201171875,
0.112060546875,
1.244140625,
0.42578125,
0.375732421875,
-0.396728515625,
0.07305908203125,
0.129150390625,
1.044921875,
-0.33056640625,
0.65771484375,
-0.0384521484375,
1.0732421875,
0.2200927734375,
0.5859375,
0.351806640625,
0.223388671875,
0.91455078125,
0.61328125,
-0.30712890625,
0.23681640625,
0.1297607421875,
0.74462890625,
0.5966796875,
0.70654296875,
-0.04278564453125,
0.62451171875,
-0.068115234375,
0.01212310791015625,
-0.515625,
0.351318359375,
0.11578369140625,
0.876953125,
-0.1781005859375,
0.483154296875,
-0.361083984375,
-0.99853515625,
0.51904296875,
0.56298828125,
-1.0634765625,
-0.75634765625,
-0.19384765625,
-0.1221923828125,
0.46142578125,
-0.1552734375,
0.218994140625,
0.332763671875,
0.39208984375,
0.391845703125,
-0.27783203125,
-0.63134765625,
-0.87548828125,
-1.0556640625,
-1.0302734375,
-0.0694580078125,
-0.77978515625,
-0.1219482421875,
0.364501953125,
-0.55859375,
0.06756591796875,
-0.42822265625,
-0.2047119140625,
0.01030731201171875,
-0.157958984375,
0.62744140625,
0.052581787109375,
0.6337890625,
-0.33935546875,
0.62744140625,
-0.009857177734375,
1.095703125,
-0.5859375,
-0.463623046875,
-0.050872802734375,
-0.317138671875,
0.364013671875,
0.15185546875,
0.75732421875,
0.24267578125,
-0.81103515625,
-0.65478515625,
-0.52197265625,
-0.004138946533203125,
-0.10931396484375,
0.2138671875,
-0.4580078125,
0.98974609375,
-0.0159912109375,
-0.81787109375,
0.48291015625,
0.56298828125,
-0.87353515625,
0.6875,
0.319091796875,
0.06390380859375,
-0.73486328125,
1.4375,
0.2330322265625,
0.413330078125,
-0.2315673828125,
-0.5703125,
-0.431884765625,
0.2025146484375,
0.11895751953125,
-0.67578125,
-0.113525390625,
0.47607421875,
0.0279693603515625,
-1.11328125,
0.478515625,
-1.1630859375,
-0.53759765625,
-0.382080078125,
-0.273193359375,
0.986328125,
0.7412109375,
0.268798828125,
-0.13330078125,
0.25146484375,
-0.307861328125,
0.7353515625,
0.29296875,
-0.64697265625,
-0.2069091796875,
0.4970703125,
0.18115234375,
-0.1907958984375,
0.34814453125,
-0.384765625,
0.15869140625,
-0.29052734375,
-0.2218017578125,
0.84716796875,
0.220458984375,
-0.0140228271484375,
-0.2069091796875,
0.43603515625,
-0.97119140625,
-0.0928955078125,
-0.1524658203125,
0.67236328125,
0.5400390625,
0.8486328125,
0.168212890625,
0.0977783203125,
0.0280609130859375,
-1.1064453125,
0.70751953125,
0.1339111328125,
0.71435546875,
-0.67822265625,
0.53759765625,
0.040374755859375,
-0.79296875,
0.359375,
-0.83740234375,
-0.4443359375,
0.984375,
-0.1937255859375,
0.89697265625,
-0.314453125,
0.314697265625,
-0.546875,
-0.0400390625,
0.4443359375,
-0.17138671875,
0.70654296875,
-0.262451171875,
-0.1884765625,
-0.49365234375,
-0.12005615234375,
-0.04144287109375,
-0.3857421875,
0.1094970703125,
-0.24169921875,
-0.488525390625,
-0.9599609375,
1.0107421875,
0.6171875,
0.12078857421875,
-0.2347412109375,
0.1956787109375,
0.1016845703125,
0.43212890625,
0.51708984375,
-0.244873046875,
0.2177734375,
-0.67724609375,
0.94775390625,
0.13720703125,
-0.13916015625,
-0.51806640625,
-0.355712890625,
-0.28759765625,
0.4443359375,
0.07562255859375,
0.0159912109375,
-1.2158203125,
0.454833984375,
-0.23779296875,
0.473388671875,
-0.7275390625,
-0.1968994140625,
-0.5546875,
0.63037109375,
0.55615234375,
-0.8388671875,
0.271240234375,
-0.34375,
0.158447265625,
0.373291015625,
-0.2288818359375,
-0.443603515625,
-0.62451171875,
-0.70703125,
-1.005859375,
0.71435546875,
0.6953125,
-0.283203125,
0.39697265625,
-1.005859375,
0.484375,
0.1163330078125,
-0.282470703125,
0.216064453125,
0.06365966796875,
0.319580078125,
0.11981201171875,
0.80029296875,
-0.2418212890625,
-0.64208984375,
0.2259521484375,
-1.1162109375,
0.74365234375,
-0.280517578125,
0.90625,
0.131103515625,
-0.2088623046875,
-0.2008056640625,
0.57470703125,
-0.58935546875,
0.10595703125,
-0.152587890625,
0.491943359375,
-1.1220703125,
-0.77587890625,
0.73193359375,
-0.291015625,
-0.1954345703125,
0.87841796875,
-0.01058197021484375,
-0.77001953125,
0.1600341796875,
0.50927734375,
-0.4990234375,
0.293701171875,
-0.58349609375,
0.2305908203125,
-0.305419921875,
-0.145263671875,
-0.11944580078125,
-0.8251953125,
0.5693359375,
0.008941650390625,
-0.469970703125,
-0.193603515625,
-1.0068359375,
-0.03411865234375,
0.035430908203125,
-0.53466796875,
0.395751953125,
0.040618896484375,
-0.40576171875,
-0.287353515625,
-0.339111328125,
-0.70556640625,
-0.5302734375,
-0.57421875,
-0.292724609375,
0.1697998046875,
0.260986328125,
0.73046875,
-0.05023193359375,
-0.64892578125,
0.045440673828125,
-0.140380859375,
-0.279052734375,
-0.265380859375,
-0.10186767578125,
0.0482177734375,
-0.2379150390625,
-0.167724609375,
0.1859130859375,
0.138671875,
0.56884765625,
0.417236328125,
0.51611328125,
0.392333984375,
0.4189453125,
-0.46923828125,
0.751953125,
0.0697021484375,
-0.7626953125,
0.177734375,
0.65966796875,
-0.0259552001953125,
0.7021484375,
0.276123046875,
-0.76416015625,
-0.56298828125,
-1.0537109375,
-0.10394287109375,
-0.560546875,
-0.236083984375,
-1.1748046875,
-0.7041015625,
-0.2244873046875,
0.54248046875,
0.11962890625,
-0.306396484375,
0.275146484375,
-1.1552734375,
0.201171875,
-0.802734375,
-0.2257080078125,
-1.017578125,
-0.65869140625,
-0.189453125,
0.8515625,
-0.131591796875,
0.2391357421875,
-0.57568359375,
0.0289306640625,
0.425537109375,
-0.44384765625,
-0.9189453125,
-0.447265625,
-0.08544921875,
0.11138916015625,
0.0306243896484375,
0.339599609375,
-0.41552734375,
0.26611328125,
-0.6171875,
0.373291015625,
-0.685546875,
-0.2265625,
-0.358154296875,
0.1202392578125,
0.92822265625,
-0.206298828125,
-0.274169921875,
-0.059051513671875,
0.462158203125,
0.6396484375,
-0.200439453125,
-0.0947265625,
-0.83642578125,
-0.34912109375,
-0.89892578125,
0.350830078125,
-0.61328125,
0.12139892578125,
-0.48779296875,
0.1337890625,
1.3193359375,
-0.268798828125,
0.80224609375,
0.912109375,
0.328125,
0.188232421875,
-1.001953125,
0.76611328125,
0.79248046875,
-0.64013671875,
0.06988525390625,
0.052703857421875,
-0.54833984375,
0.19189453125,
-0.257568359375,
-1.1572265625,
-0.5048828125,
0.479248046875,
1.177734375,
0.1064453125,
0.615234375,
-0.24609375,
-1.32421875,
0.111328125,
0.712890625,
0.20068359375,
-0.0013790130615234375,
0.71435546875,
0.1888427734375,
-0.007503509521484375,
-0.0743408203125,
-0.33251953125,
-0.0079193115234375,
-0.33349609375,
1.25390625,
-0.481201171875,
-0.72412109375,
1.1591796875,
0.96630859375,
-0.92578125,
-1.248046875,
-0.016021728515625,
0.352783203125,
-0.10784912109375,
-0.77197265625,
0.422607421875,
0.3349609375,
-0.5634765625,
0.1739501953125,
0.182373046875,
-0.1485595703125,
0.002689361572265625,
0.1265869140625,
0.078125,
-0.56884765625,
-0.0032749176025390625,
0.798828125,
-0.270263671875,
-0.6328125,
-1.052734375,
0.0062103271484375,
-0.156494140625,
0.1268310546875,
0.767578125,
-0.01244354248046875,
0.15869140625,
0.5361328125,
0.1995849609375,
0.97900390625,
-0.5537109375,
0.06976318359375,
0.188232421875,
-0.49462890625,
-0.67578125,
-0.2445068359375,
0.8173828125,
-0.0243682861328125,
0.2156982421875,
-1.0849609375,
0.03759765625,
0.453857421875,
0.18017578125,
-0.54638671875,
-0.814453125,
-0.2568359375,
-0.81494140625,
-0.5498046875,
-0.289306640625,
-0.59130859375,
-0.11474609375,
-0.0694580078125,
0.08282470703125,
-0.11981201171875,
-0.047149658203125,
0.54345703125,
-0.5126953125,
0.340087890625,
-0.458251953125,
0.669921875,
-0.40625,
-0.0172271728515625,
-0.62060546875,
0.09912109375,
-0.468017578125,
-0.2177734375,
-0.6728515625,
0.1978759765625,
0.63037109375,
0.005695343017578125,
-0.2359619140625,
0.38037109375,
-0.5517578125,
-0.346435546875,
0.150146484375,
0.267822265625,
-0.43798828125,
0.99072265625,
0.4052734375,
-0.030914306640625,
0.5625,
-0.058837890625,
-0.385498046875,
-0.1688232421875,
0.4482421875,
0.67578125,
-0.1846923828125,
0.0186767578125,
-0.2088623046875,
0.135009765625,
-0.955078125,
-0.003566741943359375,
-0.2462158203125,
0.2003173828125,
0.1822509765625,
-0.1375732421875,
0.51708984375,
1.0908203125,
-0.1876220703125,
0.091064453125,
-0.09747314453125,
0.2457275390625,
0.482177734375,
-0.032928466796875,
-0.1580810546875,
0.334228515625,
0.388671875,
-0.248046875,
-0.156982421875,
0.472412109375,
0.08087158203125,
0.29248046875,
-0.120849609375,
-0.71142578125,
-1.1875,
0.0751953125,
-0.0445556640625,
0.41552734375,
0.5517578125,
-0.275146484375,
-0.06671142578125,
-0.1597900390625,
-0.822265625,
0.488037109375,
-1.2001953125,
-0.9453125,
-0.00943756103515625,
-0.146728515625,
-0.7802734375,
-0.01788330078125,
-0.61083984375,
-0.11383056640625,
0.1815185546875,
0.482421875,
-0.58935546875,
0.30029296875,
0.298583984375,
0.35205078125,
0.07373046875,
0.03143310546875,
0.240966796875,
0.56005859375,
-0.81298828125,
-0.52783203125,
0.359130859375,
0.810546875,
0.459716796875,
-0.1983642578125,
-0.86083984375,
0.00864410400390625,
0.27587890625,
-0.1334228515625,
-0.5341796875,
0.09246826171875,
-0.1251220703125,
0.94775390625,
-0.71533203125,
-0.1229248046875,
-0.118408203125,
0.55029296875,
-0.140869140625,
-0.0667724609375,
-0.2646484375,
0.57470703125,
1.2685546875,
-0.305419921875,
0.67236328125,
0.334228515625,
0.20166015625,
-0.1358642578125,
-0.1688232421875,
-0.50439453125,
0.77587890625,
0.97265625,
0.65625,
0.060546875,
0.5078125,
0.83642578125,
-0.0391845703125,
0.054534912109375,
0.51806640625,
-0.0966796875,
0.00991058349609375,
-0.044403076171875,
0.158447265625,
-0.3818359375,
0.06304931640625,
-0.5888671875,
0.166259765625,
-0.48388671875,
-0.20947265625,
-0.4248046875,
-0.5068359375,
1.2509765625,
-0.422119140625,
0.058837890625,
-0.076904296875,
-0.6162109375,
0.5546875,
0.70361328125,
0.0435791015625,
-0.35107421875,
0.74560546875,
0.283203125,
0.2705078125,
0.6875,
0.4228515625,
0.443603515625,
-0.5791015625,
0.08245849609375,
-0.10089111328125,
0.01042938232421875,
-0.1976318359375,
-0.36474609375,
-0.9716796875,
0.59716796875,
0.095947265625,
-0.402587890625,
0.68701171875,
-0.76171875,
-0.0709228515625,
-0.274658203125,
0.80712890625,
-0.67333984375,
0.57666015625,
0.24169921875,
-0.2437744140625,
-0.8828125,
0.783203125,
-0.04388427734375,
0.29931640625,
0.1754150390625,
1.0859375,
-0.060760498046875,
1.2197265625,
0.493408203125,
-0.2386474609375,
-0.11505126953125,
0.53125,
-0.54345703125,
-0.75537109375,
-0.291748046875,
-0.58251953125,
-0.10845947265625,
-0.383056640625,
-0.306884765625,
-0.1917724609375,
0.5859375,
0.2269287109375,
-0.88720703125,
-0.76513671875,
0.2408447265625,
-0.483642578125,
0.381103515625,
0.40380859375,
0.2427978515625,
0.1392822265625,
-0.454345703125,
-0.50537109375,
-0.52685546875,
0.25341796875,
-0.5244140625,
0.5341796875,
-0.46728515625,
-0.130126953125,
-0.497802734375,
-0.370849609375,
-0.1727294921875,
0.10760498046875,
-0.342529296875,
-0.740234375,
0.181884765625,
0.3408203125,
0.2005615234375,
0.473388671875,
-0.2420654296875,
0.08905029296875,
1.19140625,
0.99169921875,
0.1961669921875,
0.6103515625,
0.456298828125,
-0.027984619140625,
0.014251708984375,
-0.1737060546875,
0.492919921875,
-0.34326171875,
0.23974609375,
-0.283935546875,
0.5107421875,
-0.74365234375,
-1.1552734375,
0.176513671875,
0.38134765625,
0.208740234375,
-0.5458984375,
-0.9189453125,
-0.6083984375,
-1.0966796875,
0.03668212890625,
-0.640625,
0.87255859375,
0.035369873046875,
-0.243408203125,
-0.279296875,
-0.69580078125,
4.49609375,
1.326171875,
0.4501953125,
0.32568359375,
0.135986328125,
0.99169921875,
0.5361328125,
-0.41455078125,
0.06793212890625,
-0.4091796875,
0.388916015625,
-0.170654296875,
0.03363037109375,
0.9052734375,
0.51123046875,
0.509765625,
-0.8515625,
-0.0273284912109375,
-0.08892822265625,
-1.0302734375,
-0.7978515625,
0.207275390625,
-0.1746826171875,
0.396728515625,
-0.191650390625,
0.76513671875,
0.6240234375,
-0.92578125,
-0.4501953125,
-0.456298828125,
0.0816650390625,
-0.492431640625,
0.94970703125,
0.1300048828125,
-0.433837890625,
0.325927734375,
-0.252685546875,
-0.61279296875,
-0.50146484375,
0.36865234375,
-0.11407470703125,
0.300537109375,
0.86328125,
-0.416748046875,
0.35595703125,
0.58349609375,
-0.646484375,
0.285400390625,
-0.0208892822265625,
-0.96728515625,
0.59814453125,
-0.331787109375,
-0.042755126953125,
-0.157958984375,
-0.9677734375,
-0.412109375,
0.6845703125,
-0.04547119140625,
0.08221435546875,
0.35595703125,
0.3525390625,
-0.027679443359375,
-0.04876708984375,
0.82958984375,
-1.228515625,
0.595703125,
0.06610107421875,
0.41015625,
-0.40576171875,
-0.31103515625,
-0.379150390625,
-0.31982421875,
-0.487548828125,
-0.390625,
0.57861328125,
0.38037109375,
-0.2120361328125,
0.166748046875,
0.55810546875,
-0.88330078125,
0.468994140625,
-0.1773681640625,
-0.673828125,
-0.7900390625,
0.8193359375,
1.0419921875,
-0.712890625,
-0.515625,
-0.202392578125,
0.572265625,
0.58740234375,
0.67236328125,
-0.0125885009765625,
-0.63232421875,
-0.315185546875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Submitted Solution:
```
# Taking the input from ther user
s = input();l=[]
for i in range(int(input())):
l.append(input())
l = sorted(l)
# If there is a prefect match print(s)
for i in range(len(l)):
if l[i] == s:
print(s)
exit()
# Check for the best match if existed
for i in range(len(l)):
if l[i][:len(s)] == s:
print(l[i])
exit()
# If there is no match , print the original word
print(s)
```
Yes
| 46,651
|
[
0.005992889404296875,
-0.274169921875,
0.48583984375,
0.30712890625,
-0.3798828125,
-0.08673095703125,
-0.2685546875,
0.253662109375,
0.241943359375,
0.208984375,
0.39501953125,
-0.1602783203125,
-0.06561279296875,
-0.755859375,
-0.73486328125,
-0.0390625,
-0.81640625,
-0.517578125,
-0.669921875,
-0.1689453125,
0.1439208984375,
-0.059112548828125,
-1.130859375,
-0.350341796875,
-0.2205810546875,
0.62890625,
0.35009765625,
0.09619140625,
0.58154296875,
1.052734375,
-0.052490234375,
-0.435791015625,
0.3583984375,
-0.76318359375,
-0.4609375,
-0.53955078125,
0.50732421875,
-0.92236328125,
-0.366943359375,
-0.79248046875,
0.1572265625,
-0.252197265625,
0.281982421875,
-0.5498046875,
-1.03515625,
0.018951416015625,
-0.666015625,
-0.5576171875,
-0.426025390625,
-0.79736328125,
0.00954437255859375,
-0.2958984375,
0.2066650390625,
-0.239013671875,
-0.09442138671875,
-0.21875,
0.0030612945556640625,
-0.0171661376953125,
-0.59765625,
0.320556640625,
0.529296875,
0.4638671875,
-0.340576171875,
-0.291259765625,
-0.3349609375,
0.54052734375,
0.181640625,
-0.315185546875,
0.27099609375,
-0.33544921875,
-0.461669921875,
0.0242767333984375,
-0.375,
-0.623046875,
-0.06524658203125,
0.08428955078125,
0.135498046875,
0.0263824462890625,
-0.38330078125,
0.8466796875,
0.22998046875,
0.83984375,
0.75048828125,
0.407470703125,
-0.2171630859375,
-0.74169921875,
0.02301025390625,
0.10589599609375,
0.155517578125,
0.033843994140625,
-0.033355712890625,
0.282470703125,
-0.17724609375,
-0.210205078125,
0.89697265625,
0.85400390625,
-0.0482177734375,
0.388427734375,
0.482421875,
0.07403564453125,
0.61474609375,
0.7451171875,
-0.2384033203125,
1.142578125,
-0.85546875,
0.25341796875,
0.084228515625,
-0.51904296875,
-0.14404296875,
-0.6513671875,
-0.29052734375,
-0.1978759765625,
0.20703125,
0.552734375,
-0.2127685546875,
0.87548828125,
-0.10443115234375,
0.006046295166015625,
-0.5419921875,
0.264892578125,
0.219482421875,
0.2236328125,
-0.0290374755859375,
-0.1981201171875,
0.259033203125,
-0.5107421875,
-0.6455078125,
0.65380859375,
-0.84765625,
-0.33349609375,
0.214111328125,
-0.075927734375,
-0.19189453125,
0.513671875,
-0.1729736328125,
0.6259765625,
-0.134033203125,
0.45458984375,
0.66015625,
-0.78662109375,
0.90576171875,
-0.3046875,
0.2147216796875,
1.5810546875,
0.32177734375,
0.0129547119140625,
0.494140625,
0.37939453125,
-0.85888671875,
0.5576171875,
-0.529296875,
0.59912109375,
0.31103515625,
-0.292236328125,
0.18994140625,
0.219970703125,
-0.08447265625,
0.06268310546875,
0.29345703125,
0.248291015625,
-0.429443359375,
0.208984375,
-0.357177734375,
0.84326171875,
-0.33642578125,
0.97314453125,
-0.626953125,
-0.052459716796875,
0.1824951171875,
-0.14013671875,
-0.08306884765625,
-0.26318359375,
-0.239990234375,
0.66162109375,
0.75,
0.89892578125,
0.76904296875,
-0.1396484375,
0.293212890625,
-0.043487548828125,
-0.455810546875,
-0.039764404296875,
0.37841796875,
0.791015625,
0.2398681640625,
0.31982421875,
0.0254669189453125,
-0.50439453125,
-0.414306640625,
-0.79638671875,
0.338134765625,
0.62548828125,
-0.5546875,
0.269775390625,
0.0175933837890625,
0.413330078125,
-0.66357421875,
-0.2841796875,
0.191162109375,
-1.0419921875,
-0.52099609375,
0.60546875,
-0.34375,
0.206787109375,
-0.48974609375,
-0.27783203125,
0.308349609375,
1.25,
-0.33642578125,
0.215576171875,
0.716796875,
0.15576171875,
-0.5205078125,
-0.143798828125,
0.35986328125,
0.113037109375,
-0.55224609375,
0.4091796875,
-0.321044921875,
-0.11846923828125,
0.15283203125,
1.2216796875,
0.442626953125,
0.382568359375,
-0.3720703125,
0.039947509765625,
0.162353515625,
1.029296875,
-0.3046875,
0.62109375,
-0.0224761962890625,
1.0986328125,
0.1851806640625,
0.56640625,
0.381103515625,
0.193603515625,
0.88623046875,
0.591796875,
-0.273193359375,
0.21044921875,
0.16162109375,
0.8017578125,
0.587890625,
0.767578125,
-0.1219482421875,
0.61328125,
-0.0997314453125,
0.038421630859375,
-0.49365234375,
0.35498046875,
0.09503173828125,
0.88916015625,
-0.1856689453125,
0.5048828125,
-0.37353515625,
-0.99462890625,
0.498291015625,
0.55712890625,
-1.0107421875,
-0.78564453125,
-0.183349609375,
-0.1099853515625,
0.406494140625,
-0.13916015625,
0.21142578125,
0.331787109375,
0.38427734375,
0.41650390625,
-0.266845703125,
-0.6494140625,
-0.8779296875,
-1.0205078125,
-1.0107421875,
-0.07476806640625,
-0.75439453125,
-0.10614013671875,
0.327392578125,
-0.56298828125,
0.047515869140625,
-0.38916015625,
-0.1866455078125,
0.05859375,
-0.1668701171875,
0.61376953125,
0.07989501953125,
0.6171875,
-0.312744140625,
0.58154296875,
-0.0088043212890625,
1.1298828125,
-0.51953125,
-0.466552734375,
-0.07989501953125,
-0.338623046875,
0.38525390625,
0.1585693359375,
0.71142578125,
0.268310546875,
-0.80224609375,
-0.587890625,
-0.5146484375,
0.030975341796875,
-0.0758056640625,
0.1962890625,
-0.46435546875,
0.99462890625,
0.01103973388671875,
-0.8486328125,
0.4658203125,
0.58544921875,
-0.91455078125,
0.72021484375,
0.33447265625,
0.12359619140625,
-0.73291015625,
1.412109375,
0.2159423828125,
0.362060546875,
-0.286865234375,
-0.56640625,
-0.453857421875,
0.19140625,
0.1298828125,
-0.68798828125,
-0.1556396484375,
0.51123046875,
-0.016082763671875,
-1.1025390625,
0.4638671875,
-1.1796875,
-0.5791015625,
-0.3662109375,
-0.27783203125,
0.9658203125,
0.7529296875,
0.23876953125,
-0.1134033203125,
0.30224609375,
-0.265380859375,
0.76904296875,
0.274658203125,
-0.6416015625,
-0.194580078125,
0.5068359375,
0.2315673828125,
-0.2203369140625,
0.33837890625,
-0.367431640625,
0.1695556640625,
-0.327392578125,
-0.273193359375,
0.87060546875,
0.1727294921875,
-0.0013208389282226562,
-0.2210693359375,
0.448486328125,
-0.904296875,
-0.069091796875,
-0.1322021484375,
0.658203125,
0.5478515625,
0.8798828125,
0.1693115234375,
0.09710693359375,
0.0758056640625,
-1.1337890625,
0.71630859375,
0.213623046875,
0.71533203125,
-0.70947265625,
0.517578125,
0.0535888671875,
-0.7900390625,
0.340576171875,
-0.83935546875,
-0.467529296875,
0.9814453125,
-0.181884765625,
0.869140625,
-0.257080078125,
0.35791015625,
-0.56884765625,
-0.07904052734375,
0.4248046875,
-0.1719970703125,
0.6826171875,
-0.265625,
-0.1094970703125,
-0.51416015625,
-0.142822265625,
-0.0221099853515625,
-0.346923828125,
0.11236572265625,
-0.2393798828125,
-0.49609375,
-0.9326171875,
0.9638671875,
0.63134765625,
0.0914306640625,
-0.249267578125,
0.255859375,
0.11163330078125,
0.40673828125,
0.509765625,
-0.269775390625,
0.21435546875,
-0.70458984375,
0.8388671875,
0.10284423828125,
-0.16943359375,
-0.4970703125,
-0.362548828125,
-0.302978515625,
0.414794921875,
0.0797119140625,
0.00958251953125,
-1.150390625,
0.51318359375,
-0.2205810546875,
0.47900390625,
-0.73486328125,
-0.216064453125,
-0.56005859375,
0.6337890625,
0.521484375,
-0.82421875,
0.28564453125,
-0.336181640625,
0.1436767578125,
0.362060546875,
-0.2239990234375,
-0.45654296875,
-0.5859375,
-0.66455078125,
-1.001953125,
0.7216796875,
0.65478515625,
-0.2939453125,
0.4130859375,
-0.98486328125,
0.474609375,
0.07525634765625,
-0.292724609375,
0.212646484375,
0.08966064453125,
0.344970703125,
0.146240234375,
0.83544921875,
-0.286376953125,
-0.640625,
0.2476806640625,
-1.1533203125,
0.77392578125,
-0.260009765625,
0.88427734375,
0.0968017578125,
-0.203369140625,
-0.2015380859375,
0.58447265625,
-0.57373046875,
0.08294677734375,
-0.1484375,
0.4951171875,
-1.0908203125,
-0.8251953125,
0.7255859375,
-0.328125,
-0.1793212890625,
0.88232421875,
-0.059051513671875,
-0.759765625,
0.15283203125,
0.467041015625,
-0.4873046875,
0.305908203125,
-0.6123046875,
0.2257080078125,
-0.315673828125,
-0.161865234375,
-0.11737060546875,
-0.796875,
0.56640625,
0.040191650390625,
-0.455810546875,
-0.243896484375,
-1.0126953125,
-0.0155792236328125,
0.03338623046875,
-0.52001953125,
0.40380859375,
0.0259552001953125,
-0.361083984375,
-0.33984375,
-0.322021484375,
-0.7392578125,
-0.54736328125,
-0.544921875,
-0.294189453125,
0.1077880859375,
0.25732421875,
0.6474609375,
-0.035858154296875,
-0.60009765625,
0.0804443359375,
-0.1357421875,
-0.318115234375,
-0.282470703125,
-0.160400390625,
0.03753662109375,
-0.166259765625,
-0.19287109375,
0.185546875,
0.15673828125,
0.59326171875,
0.4521484375,
0.51220703125,
0.333984375,
0.45703125,
-0.484375,
0.759765625,
0.058868408203125,
-0.78857421875,
0.1910400390625,
0.693359375,
0.0089569091796875,
0.751953125,
0.307861328125,
-0.76171875,
-0.60302734375,
-1.0703125,
-0.1053466796875,
-0.5126953125,
-0.22705078125,
-1.21875,
-0.66162109375,
-0.2392578125,
0.5341796875,
0.11236572265625,
-0.269287109375,
0.2333984375,
-1.224609375,
0.2320556640625,
-0.767578125,
-0.25537109375,
-1.0146484375,
-0.6376953125,
-0.178955078125,
0.80078125,
-0.1278076171875,
0.297119140625,
-0.58447265625,
0.055145263671875,
0.403564453125,
-0.46337890625,
-0.927734375,
-0.4560546875,
-0.0880126953125,
0.1060791015625,
0.04486083984375,
0.36962890625,
-0.414794921875,
0.263427734375,
-0.6728515625,
0.383056640625,
-0.646484375,
-0.217529296875,
-0.339111328125,
0.1409912109375,
0.92138671875,
-0.166015625,
-0.281005859375,
-0.06707763671875,
0.474853515625,
0.60498046875,
-0.12396240234375,
-0.1533203125,
-0.833984375,
-0.352783203125,
-0.88330078125,
0.337890625,
-0.625,
0.1395263671875,
-0.49267578125,
0.117919921875,
1.349609375,
-0.25146484375,
0.81298828125,
0.87353515625,
0.32763671875,
0.188720703125,
-0.9677734375,
0.77099609375,
0.80078125,
-0.681640625,
0.0101776123046875,
0.07867431640625,
-0.56005859375,
0.23046875,
-0.266845703125,
-1.1552734375,
-0.47021484375,
0.493408203125,
1.16796875,
0.1005859375,
0.603515625,
-0.2469482421875,
-1.25390625,
0.130126953125,
0.7158203125,
0.2177734375,
-0.04022216796875,
0.7255859375,
0.227783203125,
-0.035430908203125,
-0.09893798828125,
-0.32958984375,
-0.0004000663757324219,
-0.3203125,
1.2412109375,
-0.482177734375,
-0.7275390625,
1.1884765625,
0.9384765625,
-0.888671875,
-1.287109375,
-0.007373809814453125,
0.3486328125,
-0.10198974609375,
-0.73388671875,
0.413818359375,
0.32666015625,
-0.52392578125,
0.165283203125,
0.1756591796875,
-0.1678466796875,
-0.0208740234375,
0.0965576171875,
0.0926513671875,
-0.63623046875,
0.029388427734375,
0.83251953125,
-0.275390625,
-0.64404296875,
-1.0615234375,
-0.010772705078125,
-0.1500244140625,
0.11016845703125,
0.7666015625,
0.0073089599609375,
0.1224365234375,
0.537109375,
0.1971435546875,
0.958984375,
-0.5263671875,
0.059539794921875,
0.1634521484375,
-0.473388671875,
-0.70263671875,
-0.2181396484375,
0.84912109375,
-0.07781982421875,
0.177490234375,
-1.06640625,
0.0262451171875,
0.454345703125,
0.1864013671875,
-0.52880859375,
-0.8193359375,
-0.297119140625,
-0.80419921875,
-0.53759765625,
-0.26318359375,
-0.57666015625,
-0.137939453125,
-0.058197021484375,
0.09539794921875,
-0.1326904296875,
-0.0472412109375,
0.55322265625,
-0.53955078125,
0.334228515625,
-0.4306640625,
0.66650390625,
-0.40771484375,
0.02081298828125,
-0.59423828125,
0.09759521484375,
-0.471923828125,
-0.1903076171875,
-0.63037109375,
0.181884765625,
0.64697265625,
0.00010204315185546875,
-0.2464599609375,
0.412841796875,
-0.57861328125,
-0.324462890625,
0.07550048828125,
0.2122802734375,
-0.4130859375,
1.0146484375,
0.42919921875,
-0.03692626953125,
0.59619140625,
-0.0645751953125,
-0.391845703125,
-0.178466796875,
0.4208984375,
0.6806640625,
-0.2073974609375,
0.06329345703125,
-0.2076416015625,
0.111328125,
-0.970703125,
-0.0247802734375,
-0.1953125,
0.2337646484375,
0.1334228515625,
-0.1119384765625,
0.5439453125,
1.083984375,
-0.1717529296875,
0.12286376953125,
-0.065185546875,
0.2393798828125,
0.481201171875,
-0.06378173828125,
-0.194580078125,
0.313720703125,
0.404296875,
-0.2318115234375,
-0.1781005859375,
0.492431640625,
0.07745361328125,
0.2890625,
-0.1531982421875,
-0.70849609375,
-1.1904296875,
0.062042236328125,
-0.01203155517578125,
0.4140625,
0.6044921875,
-0.2032470703125,
-0.036529541015625,
-0.1666259765625,
-0.86962890625,
0.49560546875,
-1.203125,
-0.94287109375,
-0.0176239013671875,
-0.159912109375,
-0.85009765625,
-0.0537109375,
-0.64990234375,
-0.128662109375,
0.2177734375,
0.472900390625,
-0.5634765625,
0.29248046875,
0.327880859375,
0.325927734375,
0.14306640625,
0.01983642578125,
0.2281494140625,
0.544921875,
-0.82568359375,
-0.481201171875,
0.349853515625,
0.82421875,
0.418701171875,
-0.1549072265625,
-0.873046875,
0.06964111328125,
0.25732421875,
-0.12066650390625,
-0.57470703125,
0.1478271484375,
-0.1671142578125,
0.93798828125,
-0.71923828125,
-0.07958984375,
-0.09405517578125,
0.5791015625,
-0.1104736328125,
-0.076416015625,
-0.26025390625,
0.55859375,
1.2314453125,
-0.318359375,
0.6845703125,
0.361572265625,
0.1778564453125,
-0.1351318359375,
-0.146484375,
-0.53125,
0.78857421875,
0.92333984375,
0.64892578125,
0.032196044921875,
0.5380859375,
0.84033203125,
-0.0227813720703125,
0.08978271484375,
0.5361328125,
-0.135009765625,
0.03240966796875,
-0.04754638671875,
0.175537109375,
-0.37060546875,
0.058441162109375,
-0.59423828125,
0.1708984375,
-0.470458984375,
-0.2135009765625,
-0.402099609375,
-0.5283203125,
1.220703125,
-0.406494140625,
0.0098876953125,
-0.10595703125,
-0.6123046875,
0.595703125,
0.69189453125,
0.049285888671875,
-0.345703125,
0.7353515625,
0.293212890625,
0.25048828125,
0.681640625,
0.441162109375,
0.39453125,
-0.61083984375,
0.127685546875,
-0.109619140625,
-0.0201263427734375,
-0.20556640625,
-0.319091796875,
-0.9755859375,
0.595703125,
0.109130859375,
-0.443603515625,
0.70458984375,
-0.744140625,
-0.055694580078125,
-0.226318359375,
0.8017578125,
-0.68896484375,
0.5537109375,
0.2607421875,
-0.22216796875,
-0.8916015625,
0.7236328125,
-0.03790283203125,
0.30126953125,
0.18115234375,
1.087890625,
-0.08978271484375,
1.158203125,
0.484619140625,
-0.261474609375,
-0.11016845703125,
0.4970703125,
-0.537109375,
-0.80078125,
-0.297607421875,
-0.580078125,
-0.084228515625,
-0.358642578125,
-0.343994140625,
-0.18505859375,
0.58349609375,
0.2286376953125,
-0.9453125,
-0.74072265625,
0.236083984375,
-0.466064453125,
0.43310546875,
0.444580078125,
0.2247314453125,
0.1256103515625,
-0.45654296875,
-0.51708984375,
-0.5322265625,
0.24658203125,
-0.54345703125,
0.53759765625,
-0.476318359375,
-0.1658935546875,
-0.4970703125,
-0.343994140625,
-0.17919921875,
0.1444091796875,
-0.321044921875,
-0.72216796875,
0.188720703125,
0.3330078125,
0.1844482421875,
0.47314453125,
-0.261474609375,
0.11907958984375,
1.15234375,
0.9609375,
0.206787109375,
0.62451171875,
0.423583984375,
-0.0382080078125,
0.0406494140625,
-0.1519775390625,
0.5078125,
-0.361572265625,
0.2169189453125,
-0.287353515625,
0.54833984375,
-0.7197265625,
-1.134765625,
0.1826171875,
0.390869140625,
0.1953125,
-0.552734375,
-0.9462890625,
-0.62158203125,
-1.0703125,
0.05633544921875,
-0.62255859375,
0.85888671875,
0.048126220703125,
-0.25048828125,
-0.311767578125,
-0.69091796875,
4.5078125,
1.28125,
0.471923828125,
0.282470703125,
0.1148681640625,
1.0009765625,
0.55712890625,
-0.427001953125,
0.11053466796875,
-0.361328125,
0.4091796875,
-0.21044921875,
0.0220489501953125,
0.84326171875,
0.48193359375,
0.489990234375,
-0.8447265625,
-0.022216796875,
-0.07244873046875,
-1.02734375,
-0.76171875,
0.2291259765625,
-0.1485595703125,
0.355224609375,
-0.2191162109375,
0.72998046875,
0.62646484375,
-0.9208984375,
-0.45751953125,
-0.458251953125,
0.06719970703125,
-0.486572265625,
0.9345703125,
0.10516357421875,
-0.427978515625,
0.390869140625,
-0.2218017578125,
-0.63916015625,
-0.490478515625,
0.423095703125,
-0.11883544921875,
0.321044921875,
0.80908203125,
-0.37841796875,
0.345703125,
0.54638671875,
-0.66357421875,
0.229248046875,
-0.0193328857421875,
-0.95458984375,
0.60888671875,
-0.3466796875,
0.0066375732421875,
-0.177490234375,
-0.9208984375,
-0.43505859375,
0.61962890625,
-0.0924072265625,
0.05316162109375,
0.374267578125,
0.369873046875,
-0.08050537109375,
-0.051300048828125,
0.8134765625,
-1.2451171875,
0.62353515625,
0.104736328125,
0.40185546875,
-0.419189453125,
-0.312744140625,
-0.34326171875,
-0.2626953125,
-0.480224609375,
-0.37158203125,
0.54052734375,
0.37890625,
-0.1883544921875,
0.1844482421875,
0.5576171875,
-0.87939453125,
0.450439453125,
-0.1190185546875,
-0.67041015625,
-0.8095703125,
0.81201171875,
1.021484375,
-0.7001953125,
-0.476318359375,
-0.21435546875,
0.58154296875,
0.60693359375,
0.65771484375,
0.005107879638671875,
-0.59912109375,
-0.31298828125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Submitted Solution:
```
###################
# @ June-22th-2019.
###################
######################################################
# Getting Problem-Data from Codeforces.
source,count = input(),int(input())
history = []
for i in range(count):
history.append(input())
# Algorithm.
found,index,target = False,0,""
history.sort();
while not found and index<count:
if history[index].find(source) == 0:
target = history[index]
found = not found
else: index = index + 1
# Solution.
print(target) if found else print(source)
######################################################
#########################################
# Programming-Credits atifcppprogrammer.
#########################################
```
Yes
| 46,652
|
[
0.004802703857421875,
-0.275146484375,
0.489013671875,
0.35595703125,
-0.38623046875,
-0.11968994140625,
-0.3330078125,
0.2086181640625,
0.2374267578125,
0.20654296875,
0.37548828125,
-0.1932373046875,
-0.035491943359375,
-0.71923828125,
-0.7392578125,
-0.005615234375,
-0.7958984375,
-0.51318359375,
-0.66748046875,
-0.148193359375,
0.1717529296875,
-0.0567626953125,
-1.12890625,
-0.404541015625,
-0.295166015625,
0.7021484375,
0.294677734375,
0.10723876953125,
0.62744140625,
1.078125,
-0.022125244140625,
-0.52978515625,
0.34033203125,
-0.78125,
-0.4794921875,
-0.445556640625,
0.476806640625,
-0.8935546875,
-0.369873046875,
-0.77978515625,
0.1416015625,
-0.29345703125,
0.363037109375,
-0.52978515625,
-1.0712890625,
0.05108642578125,
-0.6826171875,
-0.517578125,
-0.436279296875,
-0.720703125,
0.02947998046875,
-0.30908203125,
0.168212890625,
-0.31396484375,
-0.072998046875,
-0.268798828125,
0.054901123046875,
0.0184478759765625,
-0.623046875,
0.280029296875,
0.5234375,
0.50244140625,
-0.28955078125,
-0.35498046875,
-0.296875,
0.53564453125,
-0.00335693359375,
-0.328857421875,
0.2496337890625,
-0.327880859375,
-0.5341796875,
-0.0156402587890625,
-0.4306640625,
-0.61376953125,
-0.1331787109375,
0.041900634765625,
0.1263427734375,
0.060455322265625,
-0.406005859375,
0.7763671875,
0.1982421875,
0.81396484375,
0.72216796875,
0.482666015625,
-0.2259521484375,
-0.7080078125,
0.0041961669921875,
0.0614013671875,
0.1329345703125,
0.1231689453125,
-0.0457763671875,
0.24462890625,
-0.155517578125,
-0.163330078125,
0.91259765625,
0.9228515625,
-0.1201171875,
0.393798828125,
0.40576171875,
0.0195465087890625,
0.70654296875,
0.69189453125,
-0.381591796875,
1.1337890625,
-0.80224609375,
0.24951171875,
0.10980224609375,
-0.445556640625,
-0.07720947265625,
-0.630859375,
-0.32470703125,
-0.1492919921875,
0.1622314453125,
0.52392578125,
-0.2548828125,
0.82177734375,
-0.15771484375,
0.0156707763671875,
-0.56201171875,
0.24267578125,
0.185791015625,
0.2012939453125,
0.0144500732421875,
-0.2391357421875,
0.19921875,
-0.55810546875,
-0.59423828125,
0.67333984375,
-0.81103515625,
-0.268310546875,
0.2783203125,
-0.036773681640625,
-0.2017822265625,
0.439208984375,
-0.14306640625,
0.6005859375,
-0.0780029296875,
0.4501953125,
0.7001953125,
-0.748046875,
0.85400390625,
-0.33154296875,
0.2200927734375,
1.609375,
0.3291015625,
0.06353759765625,
0.46533203125,
0.27978515625,
-0.75537109375,
0.57177734375,
-0.51904296875,
0.5498046875,
0.294189453125,
-0.305419921875,
0.2091064453125,
0.2227783203125,
-0.10382080078125,
0.182861328125,
0.29443359375,
0.28076171875,
-0.463134765625,
0.2271728515625,
-0.353515625,
0.82275390625,
-0.374267578125,
0.947265625,
-0.57666015625,
-0.1396484375,
0.226318359375,
-0.226806640625,
-0.036102294921875,
-0.23046875,
-0.256103515625,
0.607421875,
0.72509765625,
0.8173828125,
0.7001953125,
-0.10015869140625,
0.4189453125,
-0.0645751953125,
-0.430908203125,
-0.07183837890625,
0.4794921875,
0.76611328125,
0.25,
0.307373046875,
0.048736572265625,
-0.564453125,
-0.457275390625,
-0.82861328125,
0.39892578125,
0.63037109375,
-0.5732421875,
0.2919921875,
0.064697265625,
0.3935546875,
-0.79150390625,
-0.25390625,
0.30908203125,
-1.0302734375,
-0.54638671875,
0.595703125,
-0.314453125,
0.2298583984375,
-0.5234375,
-0.256103515625,
0.318115234375,
1.2724609375,
-0.292236328125,
0.229736328125,
0.71875,
0.09613037109375,
-0.468505859375,
-0.1883544921875,
0.414306640625,
0.048614501953125,
-0.4697265625,
0.4541015625,
-0.3125,
-0.1285400390625,
0.0877685546875,
1.205078125,
0.452392578125,
0.404541015625,
-0.311279296875,
0.0792236328125,
0.1558837890625,
1.0283203125,
-0.323974609375,
0.591796875,
-0.0006527900695800781,
0.9990234375,
0.188232421875,
0.54052734375,
0.354736328125,
0.224365234375,
0.84423828125,
0.6201171875,
-0.282958984375,
0.2176513671875,
0.1119384765625,
0.77001953125,
0.5458984375,
0.689453125,
-0.04644775390625,
0.54736328125,
-0.15380859375,
-0.00856781005859375,
-0.462890625,
0.324462890625,
0.06964111328125,
0.89599609375,
-0.212158203125,
0.46240234375,
-0.33056640625,
-1.033203125,
0.486572265625,
0.58349609375,
-1.0439453125,
-0.74951171875,
-0.20849609375,
-0.10076904296875,
0.399169921875,
-0.1695556640625,
0.25927734375,
0.3662109375,
0.5078125,
0.41259765625,
-0.316650390625,
-0.6279296875,
-0.81884765625,
-1.1064453125,
-0.9990234375,
-0.10821533203125,
-0.74755859375,
-0.08660888671875,
0.337646484375,
-0.5615234375,
0.0850830078125,
-0.382568359375,
-0.1640625,
0.01041412353515625,
-0.08001708984375,
0.60205078125,
0.0440673828125,
0.64404296875,
-0.3466796875,
0.67529296875,
-0.07098388671875,
1.0712890625,
-0.52978515625,
-0.4697265625,
-0.0235443115234375,
-0.34521484375,
0.33984375,
0.16162109375,
0.66064453125,
0.254150390625,
-0.7763671875,
-0.64697265625,
-0.5048828125,
-0.08514404296875,
-0.11724853515625,
0.1431884765625,
-0.447998046875,
1.0185546875,
0.0009675025939941406,
-0.82568359375,
0.59423828125,
0.5634765625,
-0.876953125,
0.7158203125,
0.328125,
0.12646484375,
-0.78125,
1.5556640625,
0.2509765625,
0.390625,
-0.31396484375,
-0.51318359375,
-0.52783203125,
0.2998046875,
0.0360107421875,
-0.74365234375,
-0.1202392578125,
0.493896484375,
-0.036834716796875,
-1.0986328125,
0.48388671875,
-1.259765625,
-0.69384765625,
-0.388916015625,
-0.27099609375,
0.98828125,
0.7529296875,
0.251220703125,
-0.1429443359375,
0.298583984375,
-0.268798828125,
0.75439453125,
0.29248046875,
-0.6044921875,
-0.26416015625,
0.5205078125,
0.201416015625,
-0.1881103515625,
0.347412109375,
-0.394287109375,
0.260986328125,
-0.30712890625,
-0.26806640625,
0.89013671875,
0.201171875,
0.01436614990234375,
-0.2431640625,
0.50537109375,
-1.0302734375,
-0.08233642578125,
-0.1171875,
0.671875,
0.6025390625,
0.7900390625,
0.173828125,
0.045562744140625,
0.03515625,
-1.1376953125,
0.669921875,
0.09332275390625,
0.7314453125,
-0.7021484375,
0.476806640625,
0.02362060546875,
-0.779296875,
0.369384765625,
-0.8193359375,
-0.481201171875,
0.97802734375,
-0.255126953125,
0.86376953125,
-0.293701171875,
0.294921875,
-0.51318359375,
-0.0201873779296875,
0.494140625,
-0.1038818359375,
0.6767578125,
-0.292724609375,
-0.14453125,
-0.56689453125,
-0.07855224609375,
0.01073455810546875,
-0.282470703125,
0.1192626953125,
-0.242919921875,
-0.40380859375,
-1.044921875,
1.025390625,
0.67236328125,
0.1392822265625,
-0.258056640625,
0.1693115234375,
0.0799560546875,
0.4482421875,
0.61181640625,
-0.213134765625,
0.2093505859375,
-0.71142578125,
0.98095703125,
0.247802734375,
-0.204345703125,
-0.440673828125,
-0.3134765625,
-0.302001953125,
0.400390625,
0.052703857421875,
0.0484619140625,
-1.2109375,
0.3837890625,
-0.1380615234375,
0.568359375,
-0.70361328125,
-0.21630859375,
-0.5888671875,
0.734375,
0.51708984375,
-0.8466796875,
0.302978515625,
-0.319580078125,
0.205322265625,
0.4716796875,
-0.174560546875,
-0.451171875,
-0.62939453125,
-0.74853515625,
-0.97802734375,
0.61572265625,
0.64599609375,
-0.22998046875,
0.41357421875,
-1.046875,
0.52392578125,
0.094482421875,
-0.309326171875,
0.1724853515625,
0.11541748046875,
0.290283203125,
0.134033203125,
0.7802734375,
-0.2032470703125,
-0.5810546875,
0.1796875,
-1.0595703125,
0.751953125,
-0.315185546875,
0.8671875,
0.10870361328125,
-0.060516357421875,
-0.2108154296875,
0.59375,
-0.49658203125,
0.141357421875,
-0.15771484375,
0.4853515625,
-1.099609375,
-0.8828125,
0.75537109375,
-0.265625,
-0.26806640625,
0.8330078125,
0.04400634765625,
-0.82861328125,
0.1578369140625,
0.50146484375,
-0.494140625,
0.33740234375,
-0.53515625,
0.2568359375,
-0.279541015625,
-0.1478271484375,
-0.15576171875,
-0.81591796875,
0.6015625,
-0.01180267333984375,
-0.51171875,
-0.1734619140625,
-1.0068359375,
-0.062744140625,
-0.0020046234130859375,
-0.576171875,
0.370849609375,
-0.0419921875,
-0.423095703125,
-0.248291015625,
-0.254638671875,
-0.85546875,
-0.50537109375,
-0.60546875,
-0.335205078125,
0.2119140625,
0.1744384765625,
0.71923828125,
-0.05010986328125,
-0.6376953125,
0.0701904296875,
-0.08087158203125,
-0.31787109375,
-0.26123046875,
-0.021759033203125,
0.07598876953125,
-0.2000732421875,
-0.2119140625,
0.1590576171875,
0.1405029296875,
0.60986328125,
0.430419921875,
0.4970703125,
0.41259765625,
0.454833984375,
-0.568359375,
0.7548828125,
0.08612060546875,
-0.83203125,
0.25537109375,
0.70458984375,
0.035736083984375,
0.72412109375,
0.3583984375,
-0.7802734375,
-0.57421875,
-1.015625,
-0.14453125,
-0.54541015625,
-0.2359619140625,
-1.1806640625,
-0.66357421875,
-0.2197265625,
0.537109375,
0.1650390625,
-0.28955078125,
0.2425537109375,
-1.10546875,
0.135009765625,
-0.75048828125,
-0.23681640625,
-0.962890625,
-0.603515625,
-0.197509765625,
0.876953125,
-0.10662841796875,
0.2208251953125,
-0.5166015625,
0.068359375,
0.453125,
-0.385498046875,
-1.001953125,
-0.50244140625,
-0.09228515625,
0.07989501953125,
0.0184783935546875,
0.370849609375,
-0.4443359375,
0.258544921875,
-0.6630859375,
0.2479248046875,
-0.60498046875,
-0.232421875,
-0.3193359375,
0.0965576171875,
0.9990234375,
-0.263671875,
-0.1329345703125,
0.0204620361328125,
0.38330078125,
0.6162109375,
-0.11749267578125,
-0.11175537109375,
-0.83740234375,
-0.35302734375,
-0.88037109375,
0.366455078125,
-0.580078125,
0.236572265625,
-0.39208984375,
0.0704345703125,
1.2822265625,
-0.26513671875,
0.7880859375,
0.9326171875,
0.33056640625,
0.250732421875,
-0.8994140625,
0.72509765625,
0.8017578125,
-0.67626953125,
0.0296630859375,
0.08758544921875,
-0.5693359375,
0.1552734375,
-0.216064453125,
-1.1708984375,
-0.4638671875,
0.4462890625,
1.1982421875,
0.130859375,
0.5888671875,
-0.225341796875,
-1.337890625,
0.12481689453125,
0.7080078125,
0.24462890625,
0.0726318359375,
0.68994140625,
0.11163330078125,
-0.036468505859375,
-0.042572021484375,
-0.2188720703125,
0.03131103515625,
-0.357177734375,
1.2666015625,
-0.57470703125,
-0.72607421875,
1.1259765625,
1.00390625,
-0.85009765625,
-1.23046875,
-0.049224853515625,
0.30615234375,
-0.1890869140625,
-0.77734375,
0.422119140625,
0.338623046875,
-0.63134765625,
0.123046875,
0.1849365234375,
-0.08197021484375,
0.01267242431640625,
0.180908203125,
0.06903076171875,
-0.54248046875,
0.09539794921875,
0.8173828125,
-0.33154296875,
-0.60791015625,
-1.025390625,
0.08782958984375,
-0.15234375,
0.1092529296875,
0.77685546875,
-0.05999755859375,
0.1123046875,
0.55517578125,
0.1981201171875,
0.9931640625,
-0.5283203125,
0.05010986328125,
0.224609375,
-0.443359375,
-0.6513671875,
-0.21728515625,
0.8173828125,
-0.0963134765625,
0.31103515625,
-1.0361328125,
0.1800537109375,
0.455078125,
0.137939453125,
-0.5439453125,
-0.8525390625,
-0.21435546875,
-0.8642578125,
-0.52880859375,
-0.21826171875,
-0.56689453125,
-0.182861328125,
-0.03131103515625,
0.087158203125,
-0.12005615234375,
-0.042755126953125,
0.5869140625,
-0.5087890625,
0.359375,
-0.434814453125,
0.740234375,
-0.44287109375,
-0.00414276123046875,
-0.6279296875,
0.12646484375,
-0.422119140625,
-0.240966796875,
-0.69873046875,
0.2027587890625,
0.6494140625,
0.0908203125,
-0.1968994140625,
0.35302734375,
-0.5927734375,
-0.33251953125,
0.034912109375,
0.2392578125,
-0.4140625,
0.88916015625,
0.41943359375,
-0.035858154296875,
0.54931640625,
-0.054443359375,
-0.446044921875,
-0.2113037109375,
0.46240234375,
0.6953125,
-0.1370849609375,
0.0227508544921875,
-0.2315673828125,
0.1302490234375,
-0.9365234375,
0.0223846435546875,
-0.2413330078125,
0.1240234375,
0.15771484375,
-0.122314453125,
0.52978515625,
1.044921875,
-0.25146484375,
0.09979248046875,
-0.0204315185546875,
0.2154541015625,
0.4345703125,
-0.0638427734375,
-0.131591796875,
0.32470703125,
0.36865234375,
-0.27490234375,
-0.1544189453125,
0.46630859375,
0.04473876953125,
0.285888671875,
-0.06982421875,
-0.701171875,
-1.1865234375,
0.0277557373046875,
-0.10693359375,
0.489501953125,
0.55859375,
-0.2176513671875,
-0.088134765625,
-0.1087646484375,
-0.91259765625,
0.46923828125,
-1.2509765625,
-0.94921875,
0.0498046875,
-0.13232421875,
-0.7578125,
-0.140380859375,
-0.5478515625,
-0.1038818359375,
0.2344970703125,
0.3974609375,
-0.505859375,
0.299072265625,
0.2442626953125,
0.274169921875,
0.07391357421875,
0.053619384765625,
0.2890625,
0.4677734375,
-0.787109375,
-0.51513671875,
0.2685546875,
0.89453125,
0.399169921875,
-0.18798828125,
-0.8701171875,
0.05755615234375,
0.234130859375,
-0.1925048828125,
-0.5244140625,
0.1268310546875,
-0.06207275390625,
0.916015625,
-0.7421875,
-0.0924072265625,
-0.1295166015625,
0.48193359375,
-0.062042236328125,
-0.0968017578125,
-0.28759765625,
0.59130859375,
1.28515625,
-0.2919921875,
0.681640625,
0.393798828125,
0.148193359375,
-0.155517578125,
-0.1759033203125,
-0.5517578125,
0.78271484375,
0.94921875,
0.5869140625,
0.05462646484375,
0.499755859375,
0.81103515625,
-0.0635986328125,
0.08905029296875,
0.54833984375,
-0.055938720703125,
-0.0168914794921875,
-0.05865478515625,
0.100830078125,
-0.394775390625,
0.045654296875,
-0.58056640625,
0.210693359375,
-0.5595703125,
-0.2462158203125,
-0.35888671875,
-0.5888671875,
1.2021484375,
-0.4365234375,
0.0161895751953125,
-0.15576171875,
-0.61865234375,
0.55908203125,
0.73291015625,
0.173828125,
-0.438232421875,
0.73974609375,
0.2958984375,
0.3466796875,
0.619140625,
0.4287109375,
0.404541015625,
-0.55419921875,
0.03741455078125,
-0.0655517578125,
-0.04150390625,
-0.241943359375,
-0.370849609375,
-0.9287109375,
0.541015625,
0.117919921875,
-0.366455078125,
0.7216796875,
-0.7080078125,
-0.01503753662109375,
-0.2198486328125,
0.80712890625,
-0.7373046875,
0.521484375,
0.294189453125,
-0.268310546875,
-0.841796875,
0.76708984375,
-0.1038818359375,
0.274169921875,
0.08673095703125,
1.048828125,
-0.047576904296875,
1.2060546875,
0.469482421875,
-0.19677734375,
-0.171142578125,
0.49365234375,
-0.55859375,
-0.76904296875,
-0.294677734375,
-0.58154296875,
-0.032257080078125,
-0.4130859375,
-0.33837890625,
-0.079345703125,
0.6142578125,
0.245849609375,
-0.93505859375,
-0.72607421875,
0.271484375,
-0.51025390625,
0.385986328125,
0.411376953125,
0.2293701171875,
0.1439208984375,
-0.484619140625,
-0.43798828125,
-0.5498046875,
0.219970703125,
-0.497802734375,
0.55810546875,
-0.38720703125,
-0.1844482421875,
-0.52685546875,
-0.406494140625,
-0.1844482421875,
0.02264404296875,
-0.343017578125,
-0.7109375,
0.1285400390625,
0.2939453125,
0.2132568359375,
0.51611328125,
-0.25390625,
0.141845703125,
1.2509765625,
0.95263671875,
0.1904296875,
0.58447265625,
0.29931640625,
-0.019622802734375,
0.061981201171875,
-0.185791015625,
0.40625,
-0.316650390625,
0.197265625,
-0.27783203125,
0.46875,
-0.77490234375,
-1.2060546875,
0.20361328125,
0.3798828125,
0.35400390625,
-0.623046875,
-0.859375,
-0.5888671875,
-1.1064453125,
0.07489013671875,
-0.6181640625,
0.86767578125,
0.058624267578125,
-0.224609375,
-0.25830078125,
-0.595703125,
4.5078125,
1.31640625,
0.48779296875,
0.258056640625,
0.1129150390625,
0.982421875,
0.5517578125,
-0.3525390625,
0.063232421875,
-0.376708984375,
0.341796875,
-0.10443115234375,
0.0579833984375,
0.876953125,
0.5009765625,
0.423095703125,
-0.8193359375,
0.040313720703125,
-0.10284423828125,
-1.03515625,
-0.7421875,
0.283447265625,
-0.2127685546875,
0.348876953125,
-0.13720703125,
0.74267578125,
0.70361328125,
-0.88330078125,
-0.413818359375,
-0.472412109375,
0.08123779296875,
-0.455810546875,
0.9208984375,
0.09735107421875,
-0.3662109375,
0.3046875,
-0.1796875,
-0.62158203125,
-0.44580078125,
0.400146484375,
-0.03466796875,
0.269775390625,
0.857421875,
-0.38525390625,
0.352783203125,
0.490966796875,
-0.6240234375,
0.1463623046875,
-0.04296875,
-0.9208984375,
0.552734375,
-0.355224609375,
-0.0322265625,
-0.2420654296875,
-0.875,
-0.478271484375,
0.6708984375,
-0.08868408203125,
0.025482177734375,
0.3154296875,
0.33447265625,
-0.049163818359375,
-0.02294921875,
0.8408203125,
-1.2265625,
0.6728515625,
0.08648681640625,
0.285888671875,
-0.44580078125,
-0.29833984375,
-0.3330078125,
-0.26318359375,
-0.485107421875,
-0.40966796875,
0.54296875,
0.3701171875,
-0.2100830078125,
0.2188720703125,
0.51123046875,
-0.91259765625,
0.43310546875,
-0.1298828125,
-0.65087890625,
-0.81982421875,
0.81103515625,
1.0576171875,
-0.73779296875,
-0.5029296875,
-0.2059326171875,
0.611328125,
0.5654296875,
0.6962890625,
-0.0438232421875,
-0.638671875,
-0.327392578125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Submitted Solution:
```
s = input()
n = int(input())
words = input().split()
words.sort()
flag = True
for i in words:
if s == i[:len(s)]:
print(i)
flag = False
break
if flag == True:
print(s)
```
No
| 46,653
|
[
-0.0188751220703125,
-0.2998046875,
0.45068359375,
0.323974609375,
-0.35107421875,
-0.0814208984375,
-0.292236328125,
0.251953125,
0.2493896484375,
0.240966796875,
0.416015625,
-0.1700439453125,
-0.0369873046875,
-0.78076171875,
-0.70654296875,
-0.0109405517578125,
-0.82861328125,
-0.56396484375,
-0.65283203125,
-0.157470703125,
0.1219482421875,
-0.0284881591796875,
-1.2177734375,
-0.345458984375,
-0.283935546875,
0.68603515625,
0.374755859375,
0.05120849609375,
0.60205078125,
1.0859375,
-0.003505706787109375,
-0.471923828125,
0.341796875,
-0.75146484375,
-0.434326171875,
-0.50439453125,
0.499755859375,
-0.91552734375,
-0.390380859375,
-0.802734375,
0.1705322265625,
-0.27099609375,
0.326171875,
-0.55712890625,
-1.0322265625,
0.03167724609375,
-0.63916015625,
-0.60986328125,
-0.383056640625,
-0.7607421875,
0.0714111328125,
-0.31005859375,
0.26708984375,
-0.30078125,
-0.08551025390625,
-0.196533203125,
-0.0411376953125,
-0.027496337890625,
-0.59765625,
0.29638671875,
0.56005859375,
0.51904296875,
-0.343017578125,
-0.321044921875,
-0.363525390625,
0.58740234375,
0.1737060546875,
-0.377197265625,
0.220947265625,
-0.369140625,
-0.469482421875,
0.0018215179443359375,
-0.399658203125,
-0.58544921875,
-0.12481689453125,
0.049163818359375,
0.122802734375,
0.029327392578125,
-0.430908203125,
0.7880859375,
0.233642578125,
0.8154296875,
0.7138671875,
0.409912109375,
-0.24609375,
-0.73095703125,
-0.0357666015625,
0.06512451171875,
0.1529541015625,
0.0082244873046875,
-0.07611083984375,
0.25146484375,
-0.135986328125,
-0.2041015625,
0.9169921875,
0.8515625,
-0.066650390625,
0.40625,
0.447998046875,
0.1204833984375,
0.70849609375,
0.71044921875,
-0.29052734375,
1.1298828125,
-0.818359375,
0.23486328125,
0.1512451171875,
-0.470703125,
-0.1383056640625,
-0.65673828125,
-0.28466796875,
-0.19091796875,
0.1739501953125,
0.51953125,
-0.302001953125,
0.84228515625,
-0.1251220703125,
-0.040924072265625,
-0.50439453125,
0.3251953125,
0.19189453125,
0.25048828125,
-0.0183258056640625,
-0.2105712890625,
0.283935546875,
-0.54296875,
-0.609375,
0.6904296875,
-0.84765625,
-0.30615234375,
0.21826171875,
-0.08184814453125,
-0.220947265625,
0.478759765625,
-0.1995849609375,
0.65185546875,
-0.118896484375,
0.424560546875,
0.724609375,
-0.779296875,
0.86572265625,
-0.320556640625,
0.247314453125,
1.615234375,
0.33447265625,
0.08123779296875,
0.49462890625,
0.367919921875,
-0.8212890625,
0.60791015625,
-0.560546875,
0.61279296875,
0.31298828125,
-0.309814453125,
0.1365966796875,
0.205078125,
-0.0594482421875,
0.1202392578125,
0.29052734375,
0.236328125,
-0.4306640625,
0.26513671875,
-0.35791015625,
0.89990234375,
-0.36376953125,
1.01953125,
-0.65234375,
-0.08709716796875,
0.151123046875,
-0.169921875,
-0.06036376953125,
-0.259765625,
-0.2476806640625,
0.6298828125,
0.77392578125,
0.86181640625,
0.7001953125,
-0.126220703125,
0.385986328125,
-0.06829833984375,
-0.45849609375,
-0.03765869140625,
0.387939453125,
0.82958984375,
0.2484130859375,
0.302734375,
0.0284423828125,
-0.51416015625,
-0.4658203125,
-0.85107421875,
0.372314453125,
0.65625,
-0.595703125,
0.2177734375,
0.043670654296875,
0.40478515625,
-0.71923828125,
-0.24658203125,
0.2049560546875,
-1.0234375,
-0.54736328125,
0.5556640625,
-0.3232421875,
0.254638671875,
-0.544921875,
-0.259521484375,
0.32763671875,
1.2646484375,
-0.316162109375,
0.190673828125,
0.7841796875,
0.218994140625,
-0.5302734375,
-0.1907958984375,
0.350830078125,
0.066650390625,
-0.58935546875,
0.427978515625,
-0.320556640625,
-0.1436767578125,
0.170166015625,
1.21875,
0.481689453125,
0.41650390625,
-0.373779296875,
0.0760498046875,
0.159423828125,
1.0751953125,
-0.30078125,
0.63720703125,
-0.061737060546875,
1.1240234375,
0.1668701171875,
0.60009765625,
0.3427734375,
0.224853515625,
0.845703125,
0.62548828125,
-0.26220703125,
0.22119140625,
0.1385498046875,
0.77099609375,
0.61572265625,
0.78369140625,
-0.1165771484375,
0.5537109375,
-0.11016845703125,
0.036102294921875,
-0.47509765625,
0.389404296875,
0.112060546875,
0.88037109375,
-0.16162109375,
0.51416015625,
-0.36865234375,
-1.0185546875,
0.5283203125,
0.5732421875,
-1.0126953125,
-0.78466796875,
-0.177001953125,
-0.10577392578125,
0.498291015625,
-0.1927490234375,
0.2047119140625,
0.33984375,
0.34326171875,
0.45166015625,
-0.364013671875,
-0.68115234375,
-0.85400390625,
-1.0810546875,
-1.048828125,
-0.07708740234375,
-0.751953125,
-0.10247802734375,
0.33544921875,
-0.541015625,
0.0163726806640625,
-0.37060546875,
-0.255615234375,
-0.00724029541015625,
-0.12237548828125,
0.60986328125,
0.005260467529296875,
0.61767578125,
-0.299560546875,
0.62353515625,
0.03558349609375,
1.0703125,
-0.55126953125,
-0.41845703125,
-0.07318115234375,
-0.302978515625,
0.40576171875,
0.1827392578125,
0.67822265625,
0.26123046875,
-0.833984375,
-0.6611328125,
-0.52978515625,
0.0030002593994140625,
-0.1387939453125,
0.204345703125,
-0.484130859375,
1.0341796875,
0.041168212890625,
-0.77978515625,
0.5283203125,
0.6533203125,
-0.93310546875,
0.6953125,
0.33837890625,
0.10052490234375,
-0.78564453125,
1.4833984375,
0.2454833984375,
0.4140625,
-0.264892578125,
-0.53076171875,
-0.484619140625,
0.2425537109375,
0.07891845703125,
-0.6953125,
-0.14501953125,
0.47412109375,
0.02294921875,
-1.111328125,
0.51025390625,
-1.2041015625,
-0.56396484375,
-0.359619140625,
-0.287841796875,
0.9619140625,
0.78955078125,
0.25439453125,
-0.180908203125,
0.2406005859375,
-0.270751953125,
0.79736328125,
0.26611328125,
-0.6767578125,
-0.1884765625,
0.50927734375,
0.1727294921875,
-0.18017578125,
0.377685546875,
-0.406982421875,
0.2088623046875,
-0.3173828125,
-0.267822265625,
0.91015625,
0.22802734375,
-0.0506591796875,
-0.251953125,
0.43603515625,
-1.0244140625,
-0.054412841796875,
-0.13427734375,
0.65087890625,
0.56005859375,
0.830078125,
0.218505859375,
0.128173828125,
0.023040771484375,
-1.0830078125,
0.70654296875,
0.126708984375,
0.72412109375,
-0.67431640625,
0.475341796875,
0.06475830078125,
-0.83056640625,
0.393798828125,
-0.83544921875,
-0.5361328125,
0.9599609375,
-0.265625,
0.8857421875,
-0.33154296875,
0.33447265625,
-0.58642578125,
-0.00925445556640625,
0.49755859375,
-0.16357421875,
0.64208984375,
-0.266357421875,
-0.1912841796875,
-0.5673828125,
-0.08642578125,
-0.0118255615234375,
-0.3525390625,
0.053619384765625,
-0.2015380859375,
-0.489501953125,
-0.9462890625,
1.033203125,
0.61572265625,
0.11151123046875,
-0.23779296875,
0.2315673828125,
0.1109619140625,
0.399169921875,
0.55126953125,
-0.2496337890625,
0.245849609375,
-0.69091796875,
0.92041015625,
0.1861572265625,
-0.1568603515625,
-0.521484375,
-0.35693359375,
-0.3271484375,
0.461181640625,
0.10614013671875,
0.07061767578125,
-1.1767578125,
0.488525390625,
-0.147216796875,
0.48681640625,
-0.69970703125,
-0.1568603515625,
-0.5703125,
0.66845703125,
0.54833984375,
-0.853515625,
0.3291015625,
-0.343505859375,
0.16943359375,
0.410888671875,
-0.25244140625,
-0.465087890625,
-0.6015625,
-0.7099609375,
-0.97216796875,
0.7177734375,
0.70849609375,
-0.281494140625,
0.4326171875,
-0.99169921875,
0.470947265625,
0.1295166015625,
-0.2354736328125,
0.2330322265625,
0.056488037109375,
0.284912109375,
0.089111328125,
0.78955078125,
-0.274169921875,
-0.5908203125,
0.2049560546875,
-1.1337890625,
0.7607421875,
-0.320556640625,
0.93212890625,
0.05596923828125,
-0.11065673828125,
-0.1485595703125,
0.57568359375,
-0.52734375,
0.041717529296875,
-0.0933837890625,
0.5234375,
-1.08984375,
-0.83251953125,
0.72216796875,
-0.266357421875,
-0.2578125,
0.923828125,
-0.00986480712890625,
-0.74560546875,
0.10906982421875,
0.477783203125,
-0.5595703125,
0.37353515625,
-0.66015625,
0.230224609375,
-0.322509765625,
-0.2178955078125,
-0.1439208984375,
-0.7939453125,
0.5791015625,
0.036956787109375,
-0.480712890625,
-0.2437744140625,
-1.0166015625,
-0.037078857421875,
-0.01192474365234375,
-0.50927734375,
0.388916015625,
-0.01983642578125,
-0.357177734375,
-0.274169921875,
-0.320068359375,
-0.736328125,
-0.4990234375,
-0.62109375,
-0.25537109375,
0.170166015625,
0.225830078125,
0.73828125,
-0.1094970703125,
-0.68505859375,
0.058990478515625,
-0.12115478515625,
-0.328369140625,
-0.25537109375,
-0.1361083984375,
0.041717529296875,
-0.2218017578125,
-0.1519775390625,
0.21142578125,
0.14697265625,
0.556640625,
0.51123046875,
0.4931640625,
0.37744140625,
0.44140625,
-0.493408203125,
0.71826171875,
0.0645751953125,
-0.82275390625,
0.1981201171875,
0.68408203125,
-0.0247344970703125,
0.73095703125,
0.289306640625,
-0.7841796875,
-0.5849609375,
-1.044921875,
-0.12353515625,
-0.53271484375,
-0.211181640625,
-1.2255859375,
-0.67529296875,
-0.1923828125,
0.53955078125,
0.1156005859375,
-0.279296875,
0.2301025390625,
-1.1728515625,
0.148681640625,
-0.76513671875,
-0.299072265625,
-1.0390625,
-0.6416015625,
-0.179443359375,
0.85302734375,
-0.0855712890625,
0.2783203125,
-0.5478515625,
0.059814453125,
0.4306640625,
-0.4140625,
-1.01171875,
-0.5185546875,
-0.09564208984375,
0.10247802734375,
0.055511474609375,
0.318115234375,
-0.430908203125,
0.225341796875,
-0.7197265625,
0.355224609375,
-0.7138671875,
-0.265869140625,
-0.345703125,
0.1058349609375,
0.97607421875,
-0.2161865234375,
-0.2327880859375,
-0.0114593505859375,
0.499267578125,
0.7001953125,
-0.152587890625,
-0.169921875,
-0.88232421875,
-0.3369140625,
-0.89697265625,
0.329833984375,
-0.6103515625,
0.1861572265625,
-0.46728515625,
0.1405029296875,
1.3115234375,
-0.2235107421875,
0.841796875,
0.912109375,
0.3251953125,
0.1009521484375,
-0.9755859375,
0.767578125,
0.8193359375,
-0.69482421875,
0.0304107666015625,
0.0092620849609375,
-0.62744140625,
0.196044921875,
-0.2391357421875,
-1.1982421875,
-0.4951171875,
0.46484375,
1.2080078125,
0.11114501953125,
0.560546875,
-0.219970703125,
-1.2470703125,
0.14208984375,
0.74072265625,
0.231689453125,
-0.021820068359375,
0.740234375,
0.1295166015625,
-0.031829833984375,
-0.089111328125,
-0.3134765625,
-0.0011968612670898438,
-0.3076171875,
1.3623046875,
-0.496337890625,
-0.7626953125,
1.1337890625,
0.9130859375,
-0.88818359375,
-1.2431640625,
-0.0189971923828125,
0.329833984375,
-0.066162109375,
-0.78662109375,
0.47314453125,
0.318115234375,
-0.521484375,
0.1490478515625,
0.186279296875,
-0.142822265625,
0.016876220703125,
0.08770751953125,
0.06256103515625,
-0.537109375,
0.075439453125,
0.80712890625,
-0.27490234375,
-0.58544921875,
-1.0771484375,
0.08843994140625,
-0.1571044921875,
0.1357421875,
0.79443359375,
-0.0218048095703125,
0.1842041015625,
0.50048828125,
0.192626953125,
0.9482421875,
-0.58642578125,
0.016448974609375,
0.1480712890625,
-0.5185546875,
-0.6513671875,
-0.2095947265625,
0.86083984375,
-0.07110595703125,
0.24072265625,
-1.1171875,
0.037933349609375,
0.466064453125,
0.1263427734375,
-0.55078125,
-0.794921875,
-0.20947265625,
-0.826171875,
-0.546875,
-0.278564453125,
-0.62646484375,
-0.09332275390625,
-0.058685302734375,
0.0849609375,
-0.06060791015625,
-0.04510498046875,
0.476318359375,
-0.53076171875,
0.400146484375,
-0.434814453125,
0.71142578125,
-0.415283203125,
0.0251007080078125,
-0.5966796875,
0.1558837890625,
-0.4326171875,
-0.2457275390625,
-0.6904296875,
0.25537109375,
0.65771484375,
0.042449951171875,
-0.2276611328125,
0.3681640625,
-0.56005859375,
-0.3095703125,
0.1492919921875,
0.25927734375,
-0.424072265625,
0.9873046875,
0.40869140625,
-0.0968017578125,
0.5634765625,
-0.0867919921875,
-0.430419921875,
-0.1851806640625,
0.4365234375,
0.6875,
-0.1671142578125,
0.0155029296875,
-0.2398681640625,
0.1533203125,
-0.8603515625,
-0.019317626953125,
-0.25927734375,
0.1348876953125,
0.1590576171875,
-0.152099609375,
0.5185546875,
1.0888671875,
-0.1917724609375,
0.105712890625,
-0.0272216796875,
0.21484375,
0.466796875,
-0.058837890625,
-0.1348876953125,
0.330322265625,
0.405517578125,
-0.1915283203125,
-0.164306640625,
0.48486328125,
0.09124755859375,
0.29443359375,
-0.1046142578125,
-0.78955078125,
-1.21875,
0.055084228515625,
-0.050689697265625,
0.4658203125,
0.56689453125,
-0.1968994140625,
-0.0810546875,
-0.134033203125,
-0.7890625,
0.51904296875,
-1.1787109375,
-0.9541015625,
-0.02001953125,
-0.0947265625,
-0.8369140625,
-0.0828857421875,
-0.62255859375,
-0.1290283203125,
0.273193359375,
0.396240234375,
-0.53271484375,
0.2763671875,
0.3271484375,
0.357177734375,
0.11553955078125,
0.0748291015625,
0.26318359375,
0.505859375,
-0.85205078125,
-0.49169921875,
0.349609375,
0.85400390625,
0.436767578125,
-0.263427734375,
-0.86376953125,
0.07025146484375,
0.243896484375,
-0.06866455078125,
-0.5751953125,
0.11199951171875,
-0.0948486328125,
0.9306640625,
-0.7333984375,
-0.11444091796875,
-0.114501953125,
0.54638671875,
-0.12091064453125,
-0.10113525390625,
-0.261474609375,
0.57470703125,
1.265625,
-0.3232421875,
0.6630859375,
0.313720703125,
0.194580078125,
-0.1734619140625,
-0.115234375,
-0.4609375,
0.86279296875,
0.95263671875,
0.65625,
-0.0005192756652832031,
0.52197265625,
0.80419921875,
-0.032257080078125,
0.0819091796875,
0.517578125,
-0.12139892578125,
0.053558349609375,
-0.035552978515625,
0.181640625,
-0.369140625,
0.0152435302734375,
-0.62158203125,
0.1396484375,
-0.49267578125,
-0.2081298828125,
-0.434326171875,
-0.55810546875,
1.2265625,
-0.408447265625,
-0.00008296966552734375,
-0.09808349609375,
-0.568359375,
0.56689453125,
0.80224609375,
0.04498291015625,
-0.370361328125,
0.69970703125,
0.368408203125,
0.273193359375,
0.673828125,
0.413330078125,
0.39013671875,
-0.57373046875,
0.10858154296875,
-0.1275634765625,
-0.0176239013671875,
-0.209716796875,
-0.335205078125,
-1.076171875,
0.6201171875,
0.11474609375,
-0.44677734375,
0.6982421875,
-0.783203125,
-0.005542755126953125,
-0.275634765625,
0.8203125,
-0.68896484375,
0.57080078125,
0.267822265625,
-0.2467041015625,
-0.8408203125,
0.72705078125,
-0.07421875,
0.294921875,
0.1114501953125,
1.0693359375,
-0.062225341796875,
1.2138671875,
0.5185546875,
-0.2447509765625,
-0.1903076171875,
0.48681640625,
-0.4794921875,
-0.79638671875,
-0.2841796875,
-0.5927734375,
-0.11590576171875,
-0.364013671875,
-0.35107421875,
-0.163818359375,
0.70263671875,
0.23486328125,
-0.93798828125,
-0.783203125,
0.258544921875,
-0.50048828125,
0.41650390625,
0.417236328125,
0.2254638671875,
0.141357421875,
-0.456787109375,
-0.4921875,
-0.5380859375,
0.234130859375,
-0.55712890625,
0.58935546875,
-0.5029296875,
-0.2325439453125,
-0.525390625,
-0.362548828125,
-0.1875,
0.158935546875,
-0.327392578125,
-0.7705078125,
0.2076416015625,
0.36328125,
0.1771240234375,
0.46435546875,
-0.2218017578125,
0.129150390625,
1.2490234375,
0.98876953125,
0.18359375,
0.63037109375,
0.44140625,
-0.0960693359375,
0.03717041015625,
-0.2083740234375,
0.5390625,
-0.320556640625,
0.1859130859375,
-0.29296875,
0.5263671875,
-0.7607421875,
-1.1640625,
0.1544189453125,
0.39697265625,
0.21875,
-0.59619140625,
-0.916015625,
-0.603515625,
-1.087890625,
0.011810302734375,
-0.64453125,
0.869140625,
0.0924072265625,
-0.2091064453125,
-0.3193359375,
-0.70458984375,
4.44921875,
1.3193359375,
0.484619140625,
0.3056640625,
0.140380859375,
1.044921875,
0.541015625,
-0.388427734375,
0.040740966796875,
-0.4130859375,
0.429931640625,
-0.252685546875,
-0.00017976760864257812,
0.85986328125,
0.54248046875,
0.52392578125,
-0.80712890625,
-0.040283203125,
-0.09246826171875,
-1.0478515625,
-0.80908203125,
0.180419921875,
-0.1566162109375,
0.341796875,
-0.2105712890625,
0.763671875,
0.6494140625,
-0.89013671875,
-0.4267578125,
-0.424072265625,
0.08367919921875,
-0.454833984375,
0.919921875,
0.12078857421875,
-0.41650390625,
0.331787109375,
-0.2108154296875,
-0.6923828125,
-0.50146484375,
0.404541015625,
-0.12164306640625,
0.324951171875,
0.876953125,
-0.386962890625,
0.335205078125,
0.63134765625,
-0.69091796875,
0.2479248046875,
0.01377105712890625,
-0.94140625,
0.6572265625,
-0.3076171875,
-0.01464080810546875,
-0.2080078125,
-0.92236328125,
-0.465087890625,
0.6396484375,
-0.05877685546875,
0.045867919921875,
0.415283203125,
0.375,
-0.026519775390625,
-0.047576904296875,
0.81884765625,
-1.2294921875,
0.64990234375,
0.0938720703125,
0.367919921875,
-0.410888671875,
-0.35595703125,
-0.30859375,
-0.296142578125,
-0.484375,
-0.39453125,
0.5439453125,
0.392822265625,
-0.257080078125,
0.217529296875,
0.61083984375,
-0.92919921875,
0.4306640625,
-0.102294921875,
-0.68359375,
-0.79345703125,
0.85693359375,
1.0478515625,
-0.6875,
-0.5009765625,
-0.2275390625,
0.59765625,
0.583984375,
0.64404296875,
0.00032639503479003906,
-0.5888671875,
-0.30224609375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Submitted Solution:
```
arr=[]
s=input()
n=int(input())
for i in range(n):
a=input()
arr.append(a)
def isPrefixe(word,str):
for i in range(0,len(word)):
if (word[i]!=str[i]):
return False
return True
min=s
c=0
for x in arr:
if isPrefixe(s,x):
if c==0:
min=x
else:
if len(x)<len(min):
min=x
if len(min)==0:
print(s)
else:
print(min)
```
No
| 46,654
|
[
0.02252197265625,
-0.260498046875,
0.485595703125,
0.30078125,
-0.413330078125,
-0.0904541015625,
-0.2459716796875,
0.208740234375,
0.1763916015625,
0.2286376953125,
0.4248046875,
-0.1705322265625,
-0.034759521484375,
-0.74853515625,
-0.75244140625,
0.0016422271728515625,
-0.837890625,
-0.51318359375,
-0.6904296875,
-0.1688232421875,
0.07891845703125,
-0.041595458984375,
-1.150390625,
-0.4228515625,
-0.2208251953125,
0.654296875,
0.318359375,
0.10223388671875,
0.607421875,
1.095703125,
-0.050140380859375,
-0.421875,
0.338623046875,
-0.74169921875,
-0.458251953125,
-0.53466796875,
0.484619140625,
-0.9189453125,
-0.355712890625,
-0.74951171875,
0.1990966796875,
-0.2122802734375,
0.318603515625,
-0.50390625,
-1.0400390625,
0.07977294921875,
-0.6142578125,
-0.5537109375,
-0.39501953125,
-0.763671875,
0.007640838623046875,
-0.288330078125,
0.2047119140625,
-0.2861328125,
-0.10638427734375,
-0.2320556640625,
0.04937744140625,
-0.05450439453125,
-0.61181640625,
0.320068359375,
0.513671875,
0.493408203125,
-0.32373046875,
-0.279541015625,
-0.3271484375,
0.5458984375,
0.128662109375,
-0.35986328125,
0.2529296875,
-0.358642578125,
-0.4453125,
-0.00926971435546875,
-0.37060546875,
-0.60693359375,
-0.0792236328125,
0.07208251953125,
0.15283203125,
-0.019989013671875,
-0.344970703125,
0.83935546875,
0.2342529296875,
0.80615234375,
0.7216796875,
0.463623046875,
-0.225830078125,
-0.74267578125,
-0.03704833984375,
0.069091796875,
0.1270751953125,
0.034393310546875,
-0.057464599609375,
0.2744140625,
-0.191650390625,
-0.2095947265625,
0.90771484375,
0.8505859375,
-0.0655517578125,
0.47021484375,
0.471435546875,
0.0435791015625,
0.6298828125,
0.72607421875,
-0.2415771484375,
1.1318359375,
-0.83447265625,
0.25390625,
0.073486328125,
-0.479248046875,
-0.156005859375,
-0.6318359375,
-0.264404296875,
-0.1820068359375,
0.209228515625,
0.53564453125,
-0.2022705078125,
0.83935546875,
-0.13671875,
0.0313720703125,
-0.57861328125,
0.297119140625,
0.205322265625,
0.218505859375,
0.0061492919921875,
-0.2130126953125,
0.2095947265625,
-0.53369140625,
-0.6357421875,
0.6845703125,
-0.8388671875,
-0.32421875,
0.2435302734375,
-0.0445556640625,
-0.21826171875,
0.52587890625,
-0.10107421875,
0.59326171875,
-0.1348876953125,
0.468994140625,
0.6767578125,
-0.74560546875,
0.845703125,
-0.2900390625,
0.1708984375,
1.587890625,
0.379638671875,
0.0311126708984375,
0.445068359375,
0.305908203125,
-0.7724609375,
0.59375,
-0.47705078125,
0.60107421875,
0.29345703125,
-0.3408203125,
0.17431640625,
0.18115234375,
-0.1051025390625,
0.10797119140625,
0.222412109375,
0.2420654296875,
-0.412353515625,
0.19287109375,
-0.318359375,
0.8212890625,
-0.348388671875,
0.95458984375,
-0.65087890625,
-0.08050537109375,
0.144287109375,
-0.1480712890625,
-0.094970703125,
-0.2449951171875,
-0.2386474609375,
0.6689453125,
0.701171875,
0.83203125,
0.7490234375,
-0.1259765625,
0.327880859375,
-0.036895751953125,
-0.492431640625,
-0.0748291015625,
0.396728515625,
0.80712890625,
0.2724609375,
0.319580078125,
-0.0076751708984375,
-0.48291015625,
-0.419189453125,
-0.87353515625,
0.365478515625,
0.63720703125,
-0.5087890625,
0.25,
0.0267791748046875,
0.340087890625,
-0.7099609375,
-0.258544921875,
0.15185546875,
-1.009765625,
-0.54931640625,
0.57421875,
-0.39697265625,
0.275146484375,
-0.467041015625,
-0.26318359375,
0.318359375,
1.337890625,
-0.2958984375,
0.2462158203125,
0.712890625,
0.1429443359375,
-0.52783203125,
-0.167236328125,
0.32470703125,
0.072509765625,
-0.52880859375,
0.426025390625,
-0.316650390625,
-0.1009521484375,
0.1304931640625,
1.2197265625,
0.419677734375,
0.341796875,
-0.3427734375,
0.05377197265625,
0.16259765625,
1.01953125,
-0.274658203125,
0.64208984375,
-0.055999755859375,
1.0654296875,
0.19091796875,
0.61474609375,
0.37646484375,
0.200439453125,
0.92529296875,
0.6162109375,
-0.27587890625,
0.228515625,
0.147705078125,
0.78759765625,
0.591796875,
0.67236328125,
-0.0709228515625,
0.6259765625,
-0.06787109375,
0.0020160675048828125,
-0.51513671875,
0.361572265625,
0.097900390625,
0.884765625,
-0.1561279296875,
0.529296875,
-0.388916015625,
-1.013671875,
0.525390625,
0.5234375,
-1.07421875,
-0.78662109375,
-0.188232421875,
-0.12744140625,
0.446533203125,
-0.177001953125,
0.271240234375,
0.351318359375,
0.435546875,
0.419921875,
-0.277099609375,
-0.61572265625,
-0.85888671875,
-1.0634765625,
-0.95947265625,
-0.0982666015625,
-0.80224609375,
-0.0888671875,
0.343994140625,
-0.5625,
0.0791015625,
-0.371826171875,
-0.2137451171875,
0.01430511474609375,
-0.191162109375,
0.599609375,
0.048431396484375,
0.6279296875,
-0.36572265625,
0.619140625,
-0.0111236572265625,
1.1279296875,
-0.54541015625,
-0.51806640625,
-0.04461669921875,
-0.30224609375,
0.37060546875,
0.1744384765625,
0.734375,
0.28515625,
-0.82373046875,
-0.62109375,
-0.487060546875,
0.00865936279296875,
-0.09881591796875,
0.26123046875,
-0.42724609375,
1.0029296875,
-0.02435302734375,
-0.81005859375,
0.489013671875,
0.55419921875,
-0.9443359375,
0.67333984375,
0.292236328125,
0.07672119140625,
-0.7080078125,
1.4599609375,
0.272216796875,
0.3994140625,
-0.1915283203125,
-0.5576171875,
-0.42333984375,
0.2216796875,
0.10943603515625,
-0.71484375,
-0.12213134765625,
0.45751953125,
-0.028167724609375,
-1.1240234375,
0.517578125,
-1.162109375,
-0.591796875,
-0.426513671875,
-0.289794921875,
0.95751953125,
0.677734375,
0.259033203125,
-0.09722900390625,
0.277099609375,
-0.306640625,
0.74072265625,
0.31591796875,
-0.64892578125,
-0.2220458984375,
0.482666015625,
0.2301025390625,
-0.139892578125,
0.370849609375,
-0.407470703125,
0.2008056640625,
-0.33740234375,
-0.2166748046875,
0.85888671875,
0.2120361328125,
-0.01096343994140625,
-0.24755859375,
0.3818359375,
-0.9794921875,
-0.06378173828125,
-0.11932373046875,
0.63134765625,
0.5498046875,
0.830078125,
0.1512451171875,
0.09844970703125,
0.048309326171875,
-1.0693359375,
0.7099609375,
0.1295166015625,
0.69384765625,
-0.68017578125,
0.57568359375,
0.049163818359375,
-0.76318359375,
0.358154296875,
-0.84716796875,
-0.44140625,
0.97509765625,
-0.2242431640625,
0.8896484375,
-0.340576171875,
0.3251953125,
-0.6025390625,
-0.033111572265625,
0.412109375,
-0.1221923828125,
0.6865234375,
-0.248291015625,
-0.1295166015625,
-0.52587890625,
-0.126953125,
-0.06866455078125,
-0.35986328125,
0.08203125,
-0.240478515625,
-0.492919921875,
-0.92919921875,
1.00390625,
0.6533203125,
0.1407470703125,
-0.286376953125,
0.2242431640625,
0.1363525390625,
0.43994140625,
0.5078125,
-0.22314453125,
0.1976318359375,
-0.69482421875,
0.95458984375,
0.11065673828125,
-0.15625,
-0.4765625,
-0.390625,
-0.2958984375,
0.427490234375,
0.0567626953125,
0.04083251953125,
-1.2158203125,
0.416015625,
-0.216796875,
0.505859375,
-0.7197265625,
-0.2308349609375,
-0.59423828125,
0.64453125,
0.53515625,
-0.861328125,
0.30615234375,
-0.376220703125,
0.192138671875,
0.339111328125,
-0.259521484375,
-0.4365234375,
-0.62646484375,
-0.6923828125,
-0.97607421875,
0.73095703125,
0.72509765625,
-0.293701171875,
0.392333984375,
-1.044921875,
0.49951171875,
0.1181640625,
-0.30615234375,
0.185791015625,
0.058502197265625,
0.32763671875,
0.1131591796875,
0.8125,
-0.2314453125,
-0.642578125,
0.2440185546875,
-1.1552734375,
0.76123046875,
-0.279052734375,
0.91455078125,
0.1055908203125,
-0.22998046875,
-0.1917724609375,
0.61181640625,
-0.55078125,
0.08489990234375,
-0.165771484375,
0.49951171875,
-1.111328125,
-0.77490234375,
0.703125,
-0.279296875,
-0.19189453125,
0.85791015625,
0.037139892578125,
-0.78076171875,
0.1893310546875,
0.5029296875,
-0.487060546875,
0.3330078125,
-0.54345703125,
0.2281494140625,
-0.3056640625,
-0.1614990234375,
-0.12890625,
-0.83203125,
0.56396484375,
-0.005252838134765625,
-0.467041015625,
-0.2286376953125,
-1.0263671875,
-0.034454345703125,
0.00870513916015625,
-0.533203125,
0.393310546875,
0.01849365234375,
-0.384765625,
-0.2998046875,
-0.3310546875,
-0.71728515625,
-0.55224609375,
-0.52197265625,
-0.296630859375,
0.1595458984375,
0.28271484375,
0.71728515625,
-0.038360595703125,
-0.63623046875,
0.02880859375,
-0.11199951171875,
-0.310302734375,
-0.26123046875,
-0.150390625,
0.044952392578125,
-0.249755859375,
-0.1688232421875,
0.182861328125,
0.1658935546875,
0.5966796875,
0.440673828125,
0.51123046875,
0.35400390625,
0.451416015625,
-0.448974609375,
0.73681640625,
0.06951904296875,
-0.806640625,
0.188232421875,
0.6728515625,
-0.056488037109375,
0.72265625,
0.268310546875,
-0.80224609375,
-0.58154296875,
-1.0400390625,
-0.0587158203125,
-0.546875,
-0.266845703125,
-1.232421875,
-0.7275390625,
-0.2237548828125,
0.556640625,
0.11346435546875,
-0.270751953125,
0.28515625,
-1.1533203125,
0.2142333984375,
-0.7783203125,
-0.25341796875,
-1.0458984375,
-0.68017578125,
-0.1524658203125,
0.83544921875,
-0.0877685546875,
0.24853515625,
-0.59228515625,
0.06085205078125,
0.45751953125,
-0.43701171875,
-0.94873046875,
-0.403564453125,
-0.0848388671875,
0.06341552734375,
0.053009033203125,
0.349609375,
-0.42822265625,
0.26708984375,
-0.625,
0.332763671875,
-0.7255859375,
-0.2333984375,
-0.36083984375,
0.1044921875,
0.939453125,
-0.1876220703125,
-0.257080078125,
-0.0188446044921875,
0.5048828125,
0.69287109375,
-0.145751953125,
-0.07769775390625,
-0.85595703125,
-0.363037109375,
-0.921875,
0.378662109375,
-0.623046875,
0.1376953125,
-0.4990234375,
0.11328125,
1.3408203125,
-0.2213134765625,
0.81982421875,
0.90771484375,
0.317138671875,
0.177490234375,
-0.9599609375,
0.81982421875,
0.78515625,
-0.66943359375,
0.054595947265625,
0.060150146484375,
-0.54833984375,
0.187255859375,
-0.2685546875,
-1.2109375,
-0.47607421875,
0.5068359375,
1.1728515625,
0.1002197265625,
0.61669921875,
-0.18505859375,
-1.3173828125,
0.10870361328125,
0.6796875,
0.2110595703125,
-0.024627685546875,
0.71240234375,
0.1854248046875,
0.00228118896484375,
-0.07611083984375,
-0.3232421875,
-0.035247802734375,
-0.313232421875,
1.2607421875,
-0.490966796875,
-0.76806640625,
1.1826171875,
0.9599609375,
-0.9462890625,
-1.2529296875,
-0.03387451171875,
0.369873046875,
-0.119873046875,
-0.78564453125,
0.43359375,
0.323486328125,
-0.54345703125,
0.16845703125,
0.1732177734375,
-0.1649169921875,
-0.0068359375,
0.1395263671875,
0.0626220703125,
-0.5693359375,
-0.0135955810546875,
0.76904296875,
-0.313720703125,
-0.66357421875,
-1.0400390625,
0.038970947265625,
-0.1334228515625,
0.1129150390625,
0.77685546875,
0.003582000732421875,
0.174560546875,
0.53662109375,
0.223388671875,
0.97900390625,
-0.58544921875,
0.08184814453125,
0.1856689453125,
-0.50830078125,
-0.69677734375,
-0.253173828125,
0.83251953125,
-0.026092529296875,
0.193359375,
-1.0654296875,
0.0679931640625,
0.447021484375,
0.20556640625,
-0.497802734375,
-0.8154296875,
-0.244384765625,
-0.8544921875,
-0.52294921875,
-0.261474609375,
-0.60009765625,
-0.12646484375,
-0.050140380859375,
0.0750732421875,
-0.1546630859375,
0.01421356201171875,
0.572265625,
-0.52099609375,
0.35693359375,
-0.437744140625,
0.70703125,
-0.426025390625,
-0.044830322265625,
-0.630859375,
0.1041259765625,
-0.48583984375,
-0.154296875,
-0.6884765625,
0.2305908203125,
0.63818359375,
-0.0171661376953125,
-0.2393798828125,
0.403076171875,
-0.55419921875,
-0.357666015625,
0.17041015625,
0.1971435546875,
-0.4169921875,
1.0029296875,
0.427001953125,
-0.02044677734375,
0.529296875,
-0.0019664764404296875,
-0.391845703125,
-0.209228515625,
0.391357421875,
0.71337890625,
-0.218505859375,
0.0677490234375,
-0.2467041015625,
0.10028076171875,
-0.93310546875,
-0.043792724609375,
-0.2392578125,
0.2039794921875,
0.1807861328125,
-0.12744140625,
0.5302734375,
1.0517578125,
-0.1884765625,
0.08404541015625,
-0.06298828125,
0.2344970703125,
0.47607421875,
-0.0662841796875,
-0.166748046875,
0.337646484375,
0.399658203125,
-0.2384033203125,
-0.1641845703125,
0.5029296875,
0.1114501953125,
0.319091796875,
-0.15673828125,
-0.71630859375,
-1.1806640625,
0.1136474609375,
0.01538848876953125,
0.405517578125,
0.5859375,
-0.270263671875,
-0.04998779296875,
-0.2059326171875,
-0.869140625,
0.47607421875,
-1.146484375,
-0.9150390625,
-0.039306640625,
-0.130615234375,
-0.78955078125,
-0.01201629638671875,
-0.6376953125,
-0.092041015625,
0.209716796875,
0.458251953125,
-0.56298828125,
0.312744140625,
0.2998046875,
0.339111328125,
0.121337890625,
0.02410888671875,
0.25390625,
0.5400390625,
-0.83935546875,
-0.49462890625,
0.332275390625,
0.7939453125,
0.46826171875,
-0.1832275390625,
-0.9033203125,
0.0189361572265625,
0.330322265625,
-0.11785888671875,
-0.595703125,
0.0640869140625,
-0.1324462890625,
0.95849609375,
-0.7333984375,
-0.11016845703125,
-0.0919189453125,
0.56298828125,
-0.1361083984375,
-0.060699462890625,
-0.253173828125,
0.58740234375,
1.2509765625,
-0.26806640625,
0.6435546875,
0.363525390625,
0.1790771484375,
-0.1790771484375,
-0.155517578125,
-0.47021484375,
0.7685546875,
0.9697265625,
0.6650390625,
0.1033935546875,
0.51220703125,
0.814453125,
-0.058013916015625,
0.07080078125,
0.5390625,
-0.114501953125,
-0.00904083251953125,
-0.047943115234375,
0.161865234375,
-0.35791015625,
0.05462646484375,
-0.62060546875,
0.132080078125,
-0.517578125,
-0.2398681640625,
-0.3681640625,
-0.52197265625,
1.2578125,
-0.402587890625,
0.038787841796875,
-0.1212158203125,
-0.59033203125,
0.59326171875,
0.7255859375,
0.03265380859375,
-0.35888671875,
0.783203125,
0.325927734375,
0.228271484375,
0.6748046875,
0.4765625,
0.463623046875,
-0.58837890625,
0.1092529296875,
-0.1021728515625,
-0.01215362548828125,
-0.19384765625,
-0.35546875,
-0.97216796875,
0.619140625,
0.1455078125,
-0.370361328125,
0.65283203125,
-0.75390625,
-0.05810546875,
-0.27099609375,
0.822265625,
-0.705078125,
0.60009765625,
0.27734375,
-0.2259521484375,
-0.8271484375,
0.7353515625,
-0.0271148681640625,
0.300048828125,
0.177001953125,
1.056640625,
-0.0316162109375,
1.2412109375,
0.467529296875,
-0.204833984375,
-0.09405517578125,
0.53857421875,
-0.57080078125,
-0.81103515625,
-0.33447265625,
-0.5703125,
-0.0787353515625,
-0.346435546875,
-0.32861328125,
-0.2010498046875,
0.60400390625,
0.2095947265625,
-0.888671875,
-0.74365234375,
0.263671875,
-0.4638671875,
0.400146484375,
0.4326171875,
0.2076416015625,
0.149658203125,
-0.495361328125,
-0.491455078125,
-0.54248046875,
0.2398681640625,
-0.51904296875,
0.57275390625,
-0.5126953125,
-0.1490478515625,
-0.52099609375,
-0.38232421875,
-0.181396484375,
0.12091064453125,
-0.333251953125,
-0.77490234375,
0.1533203125,
0.32470703125,
0.1800537109375,
0.4658203125,
-0.266357421875,
0.069091796875,
1.1396484375,
1.00390625,
0.1944580078125,
0.5859375,
0.45849609375,
-0.0638427734375,
0.01197052001953125,
-0.1556396484375,
0.49462890625,
-0.329833984375,
0.179443359375,
-0.2626953125,
0.5322265625,
-0.77978515625,
-1.203125,
0.226318359375,
0.353271484375,
0.21240234375,
-0.59814453125,
-0.935546875,
-0.6220703125,
-1.0810546875,
0.02850341796875,
-0.6171875,
0.81201171875,
0.05523681640625,
-0.2197265625,
-0.250244140625,
-0.7216796875,
4.484375,
1.328125,
0.419677734375,
0.355224609375,
0.140380859375,
1.01953125,
0.5732421875,
-0.4208984375,
0.1422119140625,
-0.379150390625,
0.40380859375,
-0.190185546875,
0.0379638671875,
0.8671875,
0.468017578125,
0.49755859375,
-0.84619140625,
0.007244110107421875,
-0.0948486328125,
-1.013671875,
-0.77490234375,
0.1956787109375,
-0.190673828125,
0.39697265625,
-0.20166015625,
0.7685546875,
0.61962890625,
-0.91748046875,
-0.45263671875,
-0.451171875,
0.08416748046875,
-0.5107421875,
0.9306640625,
0.152099609375,
-0.401123046875,
0.355712890625,
-0.2147216796875,
-0.6123046875,
-0.5146484375,
0.42431640625,
-0.11309814453125,
0.285888671875,
0.85302734375,
-0.41845703125,
0.37109375,
0.5673828125,
-0.640625,
0.229248046875,
-0.0179290771484375,
-0.9453125,
0.61962890625,
-0.357421875,
-0.0232391357421875,
-0.1295166015625,
-0.921875,
-0.440673828125,
0.70556640625,
-0.031402587890625,
0.07476806640625,
0.362060546875,
0.322021484375,
-0.048553466796875,
-0.001049041748046875,
0.80126953125,
-1.22265625,
0.615234375,
0.07196044921875,
0.4052734375,
-0.38671875,
-0.281494140625,
-0.35498046875,
-0.2724609375,
-0.4580078125,
-0.400390625,
0.5048828125,
0.357421875,
-0.1978759765625,
0.1654052734375,
0.55615234375,
-0.89306640625,
0.487548828125,
-0.1943359375,
-0.67919921875,
-0.82275390625,
0.8271484375,
1.0478515625,
-0.6640625,
-0.513671875,
-0.2386474609375,
0.54296875,
0.578125,
0.64208984375,
-0.0109100341796875,
-0.67041015625,
-0.32470703125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Submitted Solution:
```
a='z'*101
z=input()
for i in range(int(input())):
x=input()
if z==x[0:len(z)]:
if len(x)<=len(a) and sum(map(ord,x))<sum(map(ord,a)):
a=x
print([z,a][z==a[0:len(z)]])
```
No
| 46,655
|
[
-0.01531219482421875,
-0.26904296875,
0.484375,
0.27880859375,
-0.408447265625,
-0.1029052734375,
-0.280029296875,
0.26806640625,
0.2034912109375,
0.2496337890625,
0.432373046875,
-0.1368408203125,
-0.059051513671875,
-0.7158203125,
-0.740234375,
0.043792724609375,
-0.76953125,
-0.55322265625,
-0.62548828125,
-0.12890625,
0.10137939453125,
-0.0491943359375,
-1.1748046875,
-0.35693359375,
-0.2252197265625,
0.63427734375,
0.326904296875,
0.06170654296875,
0.59521484375,
1.091796875,
-0.06103515625,
-0.480224609375,
0.352783203125,
-0.74951171875,
-0.45166015625,
-0.467041015625,
0.46875,
-0.93798828125,
-0.371826171875,
-0.77587890625,
0.220458984375,
-0.27734375,
0.3154296875,
-0.483154296875,
-1.0341796875,
0.06805419921875,
-0.62744140625,
-0.58984375,
-0.362060546875,
-0.7626953125,
0.032470703125,
-0.287109375,
0.24658203125,
-0.27685546875,
-0.080322265625,
-0.2093505859375,
0.058074951171875,
-0.0223236083984375,
-0.60693359375,
0.337890625,
0.50732421875,
0.435302734375,
-0.328369140625,
-0.332763671875,
-0.312744140625,
0.5458984375,
0.10009765625,
-0.34130859375,
0.2373046875,
-0.33251953125,
-0.4609375,
0.00704193115234375,
-0.424560546875,
-0.59375,
-0.0731201171875,
0.07513427734375,
0.12493896484375,
0.00624847412109375,
-0.40673828125,
0.78173828125,
0.1905517578125,
0.7666015625,
0.6640625,
0.449462890625,
-0.210205078125,
-0.73388671875,
0.018402099609375,
0.03009033203125,
0.137451171875,
0.08544921875,
-0.05181884765625,
0.300537109375,
-0.13427734375,
-0.1524658203125,
0.916015625,
0.86962890625,
-0.09912109375,
0.450927734375,
0.4541015625,
0.05609130859375,
0.6923828125,
0.72998046875,
-0.279052734375,
1.154296875,
-0.7919921875,
0.2393798828125,
0.08514404296875,
-0.446044921875,
-0.11669921875,
-0.63671875,
-0.23779296875,
-0.1993408203125,
0.1541748046875,
0.572265625,
-0.273193359375,
0.83203125,
-0.1319580078125,
0.0280609130859375,
-0.56201171875,
0.265625,
0.204345703125,
0.2308349609375,
0.0572509765625,
-0.1937255859375,
0.250732421875,
-0.5537109375,
-0.65625,
0.66455078125,
-0.84423828125,
-0.3515625,
0.201904296875,
-0.055084228515625,
-0.248046875,
0.49853515625,
-0.207275390625,
0.62646484375,
-0.1497802734375,
0.42333984375,
0.7392578125,
-0.77783203125,
0.8369140625,
-0.3349609375,
0.244384765625,
1.6015625,
0.3837890625,
0.06707763671875,
0.487548828125,
0.33251953125,
-0.8017578125,
0.62255859375,
-0.50341796875,
0.58447265625,
0.2470703125,
-0.321533203125,
0.1651611328125,
0.19189453125,
-0.07452392578125,
0.10272216796875,
0.2451171875,
0.2308349609375,
-0.400146484375,
0.19091796875,
-0.3212890625,
0.86083984375,
-0.37060546875,
1.0048828125,
-0.6875,
-0.063232421875,
0.1597900390625,
-0.1778564453125,
-0.049346923828125,
-0.25537109375,
-0.187255859375,
0.64208984375,
0.75341796875,
0.8818359375,
0.72119140625,
-0.15283203125,
0.373779296875,
-0.01238250732421875,
-0.501953125,
-0.0535888671875,
0.392333984375,
0.82861328125,
0.310546875,
0.27392578125,
0.00897216796875,
-0.52197265625,
-0.420166015625,
-0.8359375,
0.40576171875,
0.63232421875,
-0.5625,
0.2271728515625,
0.050506591796875,
0.39013671875,
-0.70556640625,
-0.252685546875,
0.1495361328125,
-1.02734375,
-0.53955078125,
0.54443359375,
-0.3359375,
0.257080078125,
-0.59716796875,
-0.232421875,
0.35205078125,
1.30859375,
-0.292724609375,
0.2061767578125,
0.77978515625,
0.2125244140625,
-0.51025390625,
-0.1650390625,
0.335205078125,
0.104248046875,
-0.5302734375,
0.386474609375,
-0.321533203125,
-0.11724853515625,
0.11761474609375,
1.2529296875,
0.442626953125,
0.3876953125,
-0.375732421875,
0.07769775390625,
0.1236572265625,
1.0634765625,
-0.313232421875,
0.681640625,
-0.07916259765625,
1.06640625,
0.177490234375,
0.59228515625,
0.375,
0.2353515625,
0.9130859375,
0.5849609375,
-0.268310546875,
0.196533203125,
0.1461181640625,
0.75927734375,
0.583984375,
0.71435546875,
-0.049774169921875,
0.6337890625,
-0.10186767578125,
0.0494384765625,
-0.5205078125,
0.37451171875,
0.1629638671875,
0.880859375,
-0.17919921875,
0.494140625,
-0.37255859375,
-1.0185546875,
0.529296875,
0.58740234375,
-1.0546875,
-0.787109375,
-0.174072265625,
-0.120849609375,
0.48486328125,
-0.193115234375,
0.2509765625,
0.35107421875,
0.390625,
0.43017578125,
-0.30224609375,
-0.619140625,
-0.87109375,
-1.06640625,
-0.99658203125,
-0.1297607421875,
-0.78515625,
-0.113037109375,
0.35986328125,
-0.5576171875,
0.06414794921875,
-0.41162109375,
-0.2490234375,
-0.02117919921875,
-0.1756591796875,
0.62548828125,
0.092529296875,
0.630859375,
-0.35595703125,
0.634765625,
-0.005157470703125,
1.1015625,
-0.5732421875,
-0.408447265625,
-0.032012939453125,
-0.293701171875,
0.355712890625,
0.1810302734375,
0.6884765625,
0.267822265625,
-0.79296875,
-0.6181640625,
-0.5546875,
0.007640838623046875,
-0.126220703125,
0.1690673828125,
-0.470458984375,
1.05078125,
-0.00994873046875,
-0.8310546875,
0.50244140625,
0.58349609375,
-0.9111328125,
0.71240234375,
0.328857421875,
0.11871337890625,
-0.7470703125,
1.494140625,
0.24609375,
0.39990234375,
-0.2200927734375,
-0.50341796875,
-0.43701171875,
0.216064453125,
0.08343505859375,
-0.6796875,
-0.12841796875,
0.464599609375,
-0.01259613037109375,
-1.1181640625,
0.4716796875,
-1.16796875,
-0.57666015625,
-0.388916015625,
-0.27685546875,
0.99853515625,
0.78466796875,
0.221435546875,
-0.158935546875,
0.283203125,
-0.3046875,
0.73681640625,
0.2841796875,
-0.64306640625,
-0.197509765625,
0.52099609375,
0.2216796875,
-0.202392578125,
0.333984375,
-0.37939453125,
0.1827392578125,
-0.289306640625,
-0.239013671875,
0.8798828125,
0.21435546875,
0.00420379638671875,
-0.203125,
0.44384765625,
-0.990234375,
-0.0816650390625,
-0.1690673828125,
0.65869140625,
0.56884765625,
0.8369140625,
0.20263671875,
0.0679931640625,
0.0418701171875,
-1.11328125,
0.70849609375,
0.1187744140625,
0.7509765625,
-0.72265625,
0.54833984375,
0.060028076171875,
-0.76220703125,
0.3759765625,
-0.84375,
-0.45068359375,
0.98388671875,
-0.281005859375,
0.8720703125,
-0.33740234375,
0.3583984375,
-0.51611328125,
-0.04205322265625,
0.46533203125,
-0.1512451171875,
0.70166015625,
-0.221435546875,
-0.162109375,
-0.5380859375,
-0.076904296875,
-0.0200042724609375,
-0.342529296875,
0.09295654296875,
-0.2440185546875,
-0.5068359375,
-0.9912109375,
1.048828125,
0.626953125,
0.10693359375,
-0.27294921875,
0.1878662109375,
0.08953857421875,
0.399169921875,
0.54248046875,
-0.2315673828125,
0.2054443359375,
-0.71435546875,
0.95751953125,
0.1533203125,
-0.18359375,
-0.52880859375,
-0.390380859375,
-0.283935546875,
0.41455078125,
0.095947265625,
0.073974609375,
-1.1396484375,
0.42822265625,
-0.232666015625,
0.492919921875,
-0.68505859375,
-0.2144775390625,
-0.5537109375,
0.6171875,
0.5576171875,
-0.86669921875,
0.256591796875,
-0.323974609375,
0.132568359375,
0.40966796875,
-0.2548828125,
-0.46826171875,
-0.65625,
-0.685546875,
-1.0048828125,
0.71142578125,
0.70751953125,
-0.290771484375,
0.378173828125,
-0.99658203125,
0.498291015625,
0.11456298828125,
-0.309814453125,
0.2198486328125,
0.101806640625,
0.3291015625,
0.12890625,
0.83544921875,
-0.2152099609375,
-0.59814453125,
0.2254638671875,
-1.1279296875,
0.77587890625,
-0.288330078125,
0.93701171875,
0.12347412109375,
-0.1602783203125,
-0.2044677734375,
0.56591796875,
-0.5498046875,
0.11456298828125,
-0.161376953125,
0.48828125,
-1.087890625,
-0.83251953125,
0.7431640625,
-0.28125,
-0.196044921875,
0.8896484375,
0.0246124267578125,
-0.75537109375,
0.142578125,
0.50830078125,
-0.54248046875,
0.30419921875,
-0.6064453125,
0.257080078125,
-0.31640625,
-0.1434326171875,
-0.130859375,
-0.7763671875,
0.546875,
0.0589599609375,
-0.484375,
-0.22021484375,
-1.0107421875,
-0.00400543212890625,
0.036041259765625,
-0.56396484375,
0.3857421875,
-0.0031833648681640625,
-0.406494140625,
-0.27783203125,
-0.343994140625,
-0.73291015625,
-0.52734375,
-0.5908203125,
-0.258544921875,
0.1883544921875,
0.2310791015625,
0.7265625,
-0.053955078125,
-0.67919921875,
0.04205322265625,
-0.1116943359375,
-0.273681640625,
-0.254150390625,
-0.06817626953125,
0.056121826171875,
-0.2235107421875,
-0.18505859375,
0.175048828125,
0.1416015625,
0.58544921875,
0.461669921875,
0.517578125,
0.386474609375,
0.466796875,
-0.453369140625,
0.7646484375,
0.06982421875,
-0.8173828125,
0.2086181640625,
0.67431640625,
-0.0235595703125,
0.71875,
0.29736328125,
-0.77587890625,
-0.5986328125,
-1.013671875,
-0.0994873046875,
-0.57666015625,
-0.2244873046875,
-1.216796875,
-0.6982421875,
-0.214111328125,
0.54541015625,
0.1522216796875,
-0.291259765625,
0.21630859375,
-1.1640625,
0.179443359375,
-0.81982421875,
-0.2264404296875,
-0.97900390625,
-0.646484375,
-0.1966552734375,
0.873046875,
-0.1324462890625,
0.235595703125,
-0.56494140625,
0.03802490234375,
0.4658203125,
-0.40234375,
-0.9462890625,
-0.462158203125,
-0.08917236328125,
0.08258056640625,
0.0631103515625,
0.300048828125,
-0.41796875,
0.27001953125,
-0.662109375,
0.3447265625,
-0.68017578125,
-0.232666015625,
-0.38232421875,
0.0921630859375,
0.962890625,
-0.1927490234375,
-0.285888671875,
-0.02435302734375,
0.414794921875,
0.6376953125,
-0.18310546875,
-0.177490234375,
-0.88916015625,
-0.334228515625,
-0.884765625,
0.33349609375,
-0.59033203125,
0.11395263671875,
-0.469970703125,
0.11407470703125,
1.2900390625,
-0.2481689453125,
0.82861328125,
0.865234375,
0.3173828125,
0.1748046875,
-0.921875,
0.775390625,
0.7998046875,
-0.66552734375,
0.08428955078125,
0.055938720703125,
-0.583984375,
0.20166015625,
-0.2734375,
-1.189453125,
-0.5029296875,
0.47705078125,
1.1904296875,
0.13525390625,
0.57373046875,
-0.239013671875,
-1.3173828125,
0.1514892578125,
0.6884765625,
0.206298828125,
0.01666259765625,
0.70849609375,
0.16845703125,
-0.0545654296875,
-0.08880615234375,
-0.32568359375,
-0.017059326171875,
-0.34130859375,
1.294921875,
-0.4951171875,
-0.73583984375,
1.1845703125,
0.98583984375,
-0.8896484375,
-1.26953125,
-0.0283660888671875,
0.371337890625,
-0.108154296875,
-0.814453125,
0.40576171875,
0.342041015625,
-0.5244140625,
0.1492919921875,
0.1849365234375,
-0.1317138671875,
0.0236968994140625,
0.1431884765625,
0.08843994140625,
-0.5576171875,
0.061187744140625,
0.84814453125,
-0.249755859375,
-0.64404296875,
-0.98876953125,
0.06787109375,
-0.1810302734375,
0.08880615234375,
0.75,
-0.0753173828125,
0.1444091796875,
0.51416015625,
0.1944580078125,
0.994140625,
-0.55859375,
0.029144287109375,
0.216552734375,
-0.492431640625,
-0.69873046875,
-0.1805419921875,
0.798828125,
-0.022857666015625,
0.264892578125,
-1.099609375,
0.040557861328125,
0.4609375,
0.1795654296875,
-0.595703125,
-0.84814453125,
-0.243408203125,
-0.86328125,
-0.544921875,
-0.29150390625,
-0.64599609375,
-0.08355712890625,
-0.01560211181640625,
0.0970458984375,
-0.10955810546875,
-0.0213165283203125,
0.4580078125,
-0.56884765625,
0.360595703125,
-0.4658203125,
0.7275390625,
-0.396728515625,
-0.032928466796875,
-0.595703125,
0.12188720703125,
-0.4677734375,
-0.2337646484375,
-0.728515625,
0.21826171875,
0.63134765625,
0.0210418701171875,
-0.2100830078125,
0.3486328125,
-0.58154296875,
-0.327392578125,
0.10784912109375,
0.2479248046875,
-0.438720703125,
1.005859375,
0.409912109375,
-0.002716064453125,
0.591796875,
-0.07855224609375,
-0.39794921875,
-0.194091796875,
0.464599609375,
0.67578125,
-0.21142578125,
0.028106689453125,
-0.230224609375,
0.1173095703125,
-0.97900390625,
-0.0243377685546875,
-0.267333984375,
0.1497802734375,
0.142822265625,
-0.1610107421875,
0.54931640625,
1.1142578125,
-0.17919921875,
0.10296630859375,
-0.061279296875,
0.218017578125,
0.439697265625,
-0.02178955078125,
-0.1640625,
0.31640625,
0.3994140625,
-0.2744140625,
-0.1513671875,
0.467041015625,
0.07489013671875,
0.249755859375,
-0.137939453125,
-0.7421875,
-1.177734375,
0.026458740234375,
-0.046844482421875,
0.41845703125,
0.56494140625,
-0.2568359375,
-0.11102294921875,
-0.197265625,
-0.81884765625,
0.47705078125,
-1.212890625,
-0.94189453125,
0.01549530029296875,
-0.1361083984375,
-0.80859375,
-0.02532958984375,
-0.5693359375,
-0.103271484375,
0.21435546875,
0.4365234375,
-0.5546875,
0.299072265625,
0.30078125,
0.3349609375,
0.12548828125,
0.0300750732421875,
0.254638671875,
0.55859375,
-0.8447265625,
-0.5263671875,
0.30712890625,
0.81591796875,
0.4365234375,
-0.236572265625,
-0.8408203125,
-0.0082550048828125,
0.260009765625,
-0.149658203125,
-0.5791015625,
0.086669921875,
-0.1094970703125,
0.92041015625,
-0.74365234375,
-0.11688232421875,
-0.11492919921875,
0.54833984375,
-0.1485595703125,
-0.0560302734375,
-0.2578125,
0.60986328125,
1.2705078125,
-0.2734375,
0.66455078125,
0.347900390625,
0.1905517578125,
-0.1605224609375,
-0.1807861328125,
-0.51806640625,
0.8173828125,
0.96728515625,
0.65185546875,
0.026763916015625,
0.4873046875,
0.82958984375,
0.003772735595703125,
0.0592041015625,
0.54931640625,
-0.07305908203125,
0.0234222412109375,
-0.07196044921875,
0.15087890625,
-0.38232421875,
0.059417724609375,
-0.58984375,
0.1556396484375,
-0.486572265625,
-0.2181396484375,
-0.39892578125,
-0.55615234375,
1.244140625,
-0.44970703125,
0.02783203125,
-0.0804443359375,
-0.5869140625,
0.56982421875,
0.73974609375,
0.0704345703125,
-0.39013671875,
0.763671875,
0.271240234375,
0.316162109375,
0.64990234375,
0.4150390625,
0.432861328125,
-0.6015625,
0.06951904296875,
-0.09100341796875,
-0.020416259765625,
-0.209716796875,
-0.383544921875,
-0.98876953125,
0.5654296875,
0.068603515625,
-0.401611328125,
0.66259765625,
-0.7490234375,
-0.048553466796875,
-0.294677734375,
0.837890625,
-0.7021484375,
0.57958984375,
0.2197265625,
-0.256103515625,
-0.88818359375,
0.75390625,
-0.08001708984375,
0.26318359375,
0.175537109375,
1.056640625,
-0.038330078125,
1.2294921875,
0.447998046875,
-0.2373046875,
-0.158447265625,
0.50927734375,
-0.51171875,
-0.7724609375,
-0.2958984375,
-0.57666015625,
-0.1043701171875,
-0.359619140625,
-0.322021484375,
-0.1580810546875,
0.6513671875,
0.217529296875,
-0.86767578125,
-0.76318359375,
0.260986328125,
-0.488525390625,
0.388427734375,
0.3994140625,
0.252197265625,
0.1527099609375,
-0.44091796875,
-0.491943359375,
-0.578125,
0.2427978515625,
-0.57666015625,
0.54248046875,
-0.449951171875,
-0.178466796875,
-0.5185546875,
-0.38525390625,
-0.18896484375,
0.1444091796875,
-0.3291015625,
-0.77490234375,
0.207275390625,
0.321044921875,
0.1644287109375,
0.46923828125,
-0.275146484375,
0.0894775390625,
1.23828125,
0.9716796875,
0.15771484375,
0.65966796875,
0.43505859375,
0.0239105224609375,
0.051727294921875,
-0.204345703125,
0.5185546875,
-0.329833984375,
0.266845703125,
-0.268310546875,
0.5068359375,
-0.74658203125,
-1.201171875,
0.189208984375,
0.389404296875,
0.2294921875,
-0.5654296875,
-0.8974609375,
-0.572265625,
-1.07421875,
0.0219879150390625,
-0.673828125,
0.86083984375,
0.045623779296875,
-0.2073974609375,
-0.296142578125,
-0.6533203125,
4.47265625,
1.287109375,
0.443603515625,
0.291015625,
0.1431884765625,
1.04296875,
0.509765625,
-0.389404296875,
0.048187255859375,
-0.435302734375,
0.393798828125,
-0.1671142578125,
0.035919189453125,
0.900390625,
0.54736328125,
0.55126953125,
-0.82861328125,
-0.0283660888671875,
-0.08648681640625,
-1.064453125,
-0.79638671875,
0.19384765625,
-0.12451171875,
0.380615234375,
-0.1878662109375,
0.75537109375,
0.671875,
-0.92529296875,
-0.403564453125,
-0.4658203125,
0.07232666015625,
-0.468505859375,
0.9423828125,
0.09881591796875,
-0.427001953125,
0.31689453125,
-0.245361328125,
-0.64306640625,
-0.515625,
0.3916015625,
-0.119140625,
0.3193359375,
0.830078125,
-0.408935546875,
0.3564453125,
0.619140625,
-0.6787109375,
0.2578125,
-0.029449462890625,
-0.974609375,
0.6142578125,
-0.307861328125,
-0.0240478515625,
-0.1361083984375,
-0.927734375,
-0.415771484375,
0.66943359375,
-0.06500244140625,
0.03546142578125,
0.35400390625,
0.401123046875,
-0.0118560791015625,
-0.0123748779296875,
0.85107421875,
-1.203125,
0.60498046875,
0.05810546875,
0.384033203125,
-0.42333984375,
-0.269775390625,
-0.33984375,
-0.3359375,
-0.51025390625,
-0.41552734375,
0.59130859375,
0.3798828125,
-0.218994140625,
0.2127685546875,
0.591796875,
-0.86669921875,
0.455322265625,
-0.15771484375,
-0.671875,
-0.798828125,
0.8359375,
1.0166015625,
-0.69580078125,
-0.48291015625,
-0.1923828125,
0.57763671875,
0.57568359375,
0.689453125,
-0.0265350341796875,
-0.640625,
-0.27880859375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Autocomplete is a program function that enables inputting the text (in editors, command line shells, browsers etc.) completing the text by its inputted part. Vasya is busy working on a new browser called 'BERowser'. He happens to be working on the autocomplete function in the address line at this very moment. A list consisting of n last visited by the user pages and the inputted part s are known. Your task is to complete s to make it an address of one of the pages from the list. You have to find the lexicographically smallest address having a prefix s.
Input
The first line contains the s line which is the inputted part. The second line contains an integer n (1 ≤ n ≤ 100) which is the number of visited pages. Then follow n lines which are the visited pages, one on each line. All the lines have lengths of from 1 to 100 symbols inclusively and consist of lowercase Latin letters only.
Output
If s is not the beginning of any of n addresses of the visited pages, print s. Otherwise, print the lexicographically minimal address of one of the visited pages starting from s.
The lexicographical order is the order of words in a dictionary. The lexicographical comparison of lines is realized by the '<' operator in the modern programming languages.
Examples
Input
next
2
nextpermutation
nextelement
Output
nextelement
Input
find
4
find
findfirstof
findit
fand
Output
find
Input
find
4
fondfind
fondfirstof
fondit
fand
Output
find
Submitted Solution:
```
a='z'*101
z=input()
for i in range(int(input())):
x=input()
if z==x[0:len(z)]:
if sum(map(ord,x))<sum(map(ord,a)):
a=x
print([z,a][z==a[0:len(z)]])
```
No
| 46,656
|
[
-0.015869140625,
-0.2763671875,
0.47900390625,
0.28369140625,
-0.41064453125,
-0.11334228515625,
-0.274169921875,
0.262451171875,
0.20654296875,
0.229736328125,
0.4365234375,
-0.153076171875,
-0.046417236328125,
-0.7314453125,
-0.74462890625,
0.0455322265625,
-0.7646484375,
-0.54345703125,
-0.6162109375,
-0.1326904296875,
0.0806884765625,
-0.0633544921875,
-1.1796875,
-0.33740234375,
-0.2191162109375,
0.60791015625,
0.3193359375,
0.045623779296875,
0.58642578125,
1.0908203125,
-0.0648193359375,
-0.48583984375,
0.334228515625,
-0.736328125,
-0.4619140625,
-0.47412109375,
0.47705078125,
-0.93994140625,
-0.390869140625,
-0.78857421875,
0.215087890625,
-0.28466796875,
0.3056640625,
-0.479736328125,
-1.0341796875,
0.08197021484375,
-0.63671875,
-0.6123046875,
-0.34228515625,
-0.75537109375,
0.0280914306640625,
-0.29345703125,
0.254150390625,
-0.2724609375,
-0.0714111328125,
-0.2166748046875,
0.06768798828125,
-0.0124664306640625,
-0.59814453125,
0.331787109375,
0.5126953125,
0.431884765625,
-0.337890625,
-0.3349609375,
-0.30908203125,
0.53857421875,
0.09747314453125,
-0.350830078125,
0.220458984375,
-0.32373046875,
-0.446533203125,
0.00437164306640625,
-0.426513671875,
-0.60400390625,
-0.0533447265625,
0.061126708984375,
0.1202392578125,
0.02313232421875,
-0.415771484375,
0.7822265625,
0.1949462890625,
0.75634765625,
0.66064453125,
0.439453125,
-0.209228515625,
-0.7412109375,
0.00858306884765625,
0.032501220703125,
0.1297607421875,
0.0938720703125,
-0.06158447265625,
0.303955078125,
-0.119384765625,
-0.1326904296875,
0.92041015625,
0.86474609375,
-0.090087890625,
0.459716796875,
0.464599609375,
0.04449462890625,
0.669921875,
0.70361328125,
-0.294677734375,
1.1416015625,
-0.787109375,
0.24609375,
0.09619140625,
-0.442626953125,
-0.1080322265625,
-0.63818359375,
-0.241455078125,
-0.19921875,
0.1636962890625,
0.5791015625,
-0.2861328125,
0.83447265625,
-0.1268310546875,
0.03515625,
-0.5546875,
0.2705078125,
0.2066650390625,
0.236328125,
0.053802490234375,
-0.20849609375,
0.250732421875,
-0.55078125,
-0.66650390625,
0.6689453125,
-0.84765625,
-0.363037109375,
0.2220458984375,
-0.0537109375,
-0.25146484375,
0.50439453125,
-0.1961669921875,
0.63134765625,
-0.13916015625,
0.413818359375,
0.73974609375,
-0.796875,
0.8232421875,
-0.33203125,
0.238037109375,
1.6015625,
0.37939453125,
0.08502197265625,
0.486328125,
0.337646484375,
-0.8056640625,
0.6201171875,
-0.51416015625,
0.57958984375,
0.242431640625,
-0.325927734375,
0.1676025390625,
0.1846923828125,
-0.0916748046875,
0.10821533203125,
0.26513671875,
0.2054443359375,
-0.38671875,
0.211669921875,
-0.332763671875,
0.8564453125,
-0.385986328125,
0.998046875,
-0.68115234375,
-0.04949951171875,
0.1646728515625,
-0.1859130859375,
-0.052093505859375,
-0.262451171875,
-0.196044921875,
0.6474609375,
0.76416015625,
0.880859375,
0.7275390625,
-0.1474609375,
0.376708984375,
-0.0171051025390625,
-0.5087890625,
-0.054046630859375,
0.3916015625,
0.833984375,
0.32177734375,
0.270263671875,
0.0066680908203125,
-0.51025390625,
-0.425537109375,
-0.85888671875,
0.3876953125,
0.6259765625,
-0.5537109375,
0.2100830078125,
0.051544189453125,
0.380615234375,
-0.673828125,
-0.25244140625,
0.1676025390625,
-1.0390625,
-0.5361328125,
0.5439453125,
-0.33642578125,
0.272216796875,
-0.60888671875,
-0.2462158203125,
0.3544921875,
1.2998046875,
-0.32958984375,
0.1983642578125,
0.78466796875,
0.221923828125,
-0.505859375,
-0.1539306640625,
0.349365234375,
0.10858154296875,
-0.5380859375,
0.392578125,
-0.322265625,
-0.11077880859375,
0.11981201171875,
1.251953125,
0.44677734375,
0.380615234375,
-0.40380859375,
0.06927490234375,
0.12353515625,
1.0498046875,
-0.3154296875,
0.68017578125,
-0.08770751953125,
1.0771484375,
0.177490234375,
0.59130859375,
0.381103515625,
0.2452392578125,
0.91748046875,
0.58935546875,
-0.2822265625,
0.2034912109375,
0.152099609375,
0.75634765625,
0.57763671875,
0.74755859375,
-0.0560302734375,
0.62939453125,
-0.10308837890625,
0.046722412109375,
-0.51953125,
0.383544921875,
0.1690673828125,
0.8720703125,
-0.1676025390625,
0.50390625,
-0.36865234375,
-1.0234375,
0.53125,
0.5859375,
-1.0361328125,
-0.810546875,
-0.1763916015625,
-0.12744140625,
0.48388671875,
-0.20654296875,
0.27197265625,
0.351806640625,
0.3740234375,
0.439697265625,
-0.31689453125,
-0.625,
-0.857421875,
-1.072265625,
-0.98388671875,
-0.1439208984375,
-0.783203125,
-0.1270751953125,
0.349365234375,
-0.5537109375,
0.057159423828125,
-0.407470703125,
-0.26953125,
0.0010814666748046875,
-0.1776123046875,
0.64208984375,
0.09698486328125,
0.63134765625,
-0.336669921875,
0.634765625,
0.01123046875,
1.1103515625,
-0.5888671875,
-0.40478515625,
-0.022735595703125,
-0.27197265625,
0.368408203125,
0.189697265625,
0.6796875,
0.27880859375,
-0.8037109375,
-0.60595703125,
-0.55859375,
0.019195556640625,
-0.1292724609375,
0.1497802734375,
-0.45703125,
1.0517578125,
0.01082611083984375,
-0.84814453125,
0.49951171875,
0.59423828125,
-0.90185546875,
0.7314453125,
0.3125,
0.1148681640625,
-0.73486328125,
1.4775390625,
0.2415771484375,
0.3935546875,
-0.2154541015625,
-0.4990234375,
-0.42724609375,
0.209716796875,
0.0804443359375,
-0.6943359375,
-0.1357421875,
0.465576171875,
-0.03302001953125,
-1.138671875,
0.48388671875,
-1.169921875,
-0.58203125,
-0.3896484375,
-0.263427734375,
0.994140625,
0.78271484375,
0.2115478515625,
-0.16015625,
0.281982421875,
-0.31591796875,
0.7265625,
0.280029296875,
-0.6220703125,
-0.1761474609375,
0.5068359375,
0.2191162109375,
-0.1744384765625,
0.32666015625,
-0.379150390625,
0.2039794921875,
-0.308349609375,
-0.23828125,
0.89599609375,
0.204345703125,
0.0114288330078125,
-0.2064208984375,
0.443115234375,
-0.99169921875,
-0.0677490234375,
-0.1749267578125,
0.654296875,
0.5634765625,
0.84814453125,
0.190185546875,
0.06256103515625,
0.0308380126953125,
-1.107421875,
0.697265625,
0.12054443359375,
0.75048828125,
-0.724609375,
0.5673828125,
0.0516357421875,
-0.748046875,
0.378173828125,
-0.82470703125,
-0.437744140625,
0.982421875,
-0.29931640625,
0.85888671875,
-0.349609375,
0.37060546875,
-0.513671875,
-0.038330078125,
0.467041015625,
-0.1451416015625,
0.71435546875,
-0.2203369140625,
-0.166015625,
-0.55322265625,
-0.074462890625,
-0.003692626953125,
-0.3359375,
0.1165771484375,
-0.237548828125,
-0.5,
-0.99267578125,
1.0732421875,
0.634765625,
0.0966796875,
-0.280029296875,
0.173095703125,
0.09954833984375,
0.3994140625,
0.54052734375,
-0.2322998046875,
0.2218017578125,
-0.720703125,
0.94775390625,
0.158203125,
-0.20361328125,
-0.52099609375,
-0.411376953125,
-0.275634765625,
0.427734375,
0.07666015625,
0.08245849609375,
-1.150390625,
0.44287109375,
-0.21826171875,
0.5009765625,
-0.6767578125,
-0.216064453125,
-0.56201171875,
0.61474609375,
0.552734375,
-0.87548828125,
0.266357421875,
-0.342529296875,
0.128662109375,
0.412353515625,
-0.267578125,
-0.46533203125,
-0.66357421875,
-0.6630859375,
-1.0107421875,
0.7314453125,
0.72607421875,
-0.281005859375,
0.389404296875,
-0.9921875,
0.505859375,
0.1177978515625,
-0.30810546875,
0.2178955078125,
0.0867919921875,
0.335205078125,
0.11773681640625,
0.82470703125,
-0.22900390625,
-0.6123046875,
0.2281494140625,
-1.1123046875,
0.791015625,
-0.271728515625,
0.955078125,
0.125,
-0.1546630859375,
-0.2056884765625,
0.57470703125,
-0.55615234375,
0.11639404296875,
-0.1746826171875,
0.49853515625,
-1.1005859375,
-0.8330078125,
0.7421875,
-0.294189453125,
-0.2103271484375,
0.91796875,
0.0294036865234375,
-0.767578125,
0.1383056640625,
0.49267578125,
-0.5615234375,
0.32763671875,
-0.6103515625,
0.274169921875,
-0.33251953125,
-0.153076171875,
-0.1285400390625,
-0.779296875,
0.56005859375,
0.0743408203125,
-0.47216796875,
-0.237548828125,
-1.0068359375,
0.022430419921875,
0.053741455078125,
-0.57568359375,
0.388671875,
-0.0258636474609375,
-0.385498046875,
-0.281005859375,
-0.344482421875,
-0.7373046875,
-0.5205078125,
-0.591796875,
-0.2529296875,
0.19677734375,
0.22802734375,
0.73388671875,
-0.047760009765625,
-0.68505859375,
0.0234375,
-0.10888671875,
-0.27880859375,
-0.265625,
-0.0670166015625,
0.051788330078125,
-0.21337890625,
-0.17529296875,
0.1693115234375,
0.1246337890625,
0.59765625,
0.476318359375,
0.51220703125,
0.39990234375,
0.4697265625,
-0.46826171875,
0.76806640625,
0.06982421875,
-0.810546875,
0.205322265625,
0.677734375,
-0.0159912109375,
0.72509765625,
0.28125,
-0.7578125,
-0.61181640625,
-0.99609375,
-0.09197998046875,
-0.58642578125,
-0.2313232421875,
-1.236328125,
-0.69580078125,
-0.2197265625,
0.5498046875,
0.1488037109375,
-0.29736328125,
0.21923828125,
-1.1533203125,
0.165771484375,
-0.826171875,
-0.234619140625,
-1.00390625,
-0.640625,
-0.1934814453125,
0.85888671875,
-0.1429443359375,
0.234130859375,
-0.58984375,
0.0322265625,
0.467041015625,
-0.38330078125,
-0.9599609375,
-0.4580078125,
-0.08966064453125,
0.0732421875,
0.072998046875,
0.285400390625,
-0.428955078125,
0.252685546875,
-0.669921875,
0.328369140625,
-0.70361328125,
-0.240966796875,
-0.387939453125,
0.07958984375,
0.96142578125,
-0.19970703125,
-0.291015625,
-0.0259552001953125,
0.431884765625,
0.64453125,
-0.197021484375,
-0.169677734375,
-0.9013671875,
-0.346435546875,
-0.87451171875,
0.33642578125,
-0.59375,
0.11395263671875,
-0.456298828125,
0.104736328125,
1.2783203125,
-0.2396240234375,
0.8203125,
0.85107421875,
0.30322265625,
0.1412353515625,
-0.9150390625,
0.798828125,
0.80224609375,
-0.6533203125,
0.08642578125,
0.035369873046875,
-0.6015625,
0.1968994140625,
-0.3046875,
-1.1806640625,
-0.50927734375,
0.458740234375,
1.1904296875,
0.1259765625,
0.56982421875,
-0.24951171875,
-1.3232421875,
0.1474609375,
0.6884765625,
0.1859130859375,
0.0210418701171875,
0.71923828125,
0.1956787109375,
-0.05963134765625,
-0.08807373046875,
-0.3212890625,
0.0024852752685546875,
-0.318115234375,
1.31640625,
-0.50830078125,
-0.72119140625,
1.1953125,
0.97509765625,
-0.89501953125,
-1.2646484375,
-0.04071044921875,
0.383056640625,
-0.1082763671875,
-0.82470703125,
0.412353515625,
0.321044921875,
-0.5380859375,
0.1396484375,
0.19677734375,
-0.130615234375,
0.0157623291015625,
0.1309814453125,
0.09954833984375,
-0.54150390625,
0.054962158203125,
0.865234375,
-0.246337890625,
-0.6611328125,
-0.9560546875,
0.07305908203125,
-0.16845703125,
0.1019287109375,
0.744140625,
-0.0902099609375,
0.1461181640625,
0.5107421875,
0.2020263671875,
1.00390625,
-0.5810546875,
0.0372314453125,
0.2149658203125,
-0.482666015625,
-0.70166015625,
-0.1884765625,
0.79541015625,
-0.0131988525390625,
0.267333984375,
-1.1103515625,
0.0372314453125,
0.467041015625,
0.1650390625,
-0.57861328125,
-0.84814453125,
-0.224609375,
-0.85546875,
-0.54248046875,
-0.287109375,
-0.646484375,
-0.07586669921875,
-0.004489898681640625,
0.10858154296875,
-0.1019287109375,
-0.028350830078125,
0.452880859375,
-0.57275390625,
0.360595703125,
-0.4677734375,
0.72021484375,
-0.408935546875,
-0.043670654296875,
-0.60107421875,
0.10186767578125,
-0.478759765625,
-0.229736328125,
-0.73876953125,
0.2265625,
0.634765625,
0.0350341796875,
-0.23095703125,
0.3447265625,
-0.58740234375,
-0.337890625,
0.1031494140625,
0.251220703125,
-0.42822265625,
1.0078125,
0.415771484375,
0.004749298095703125,
0.609375,
-0.09088134765625,
-0.39111328125,
-0.1727294921875,
0.46142578125,
0.6650390625,
-0.2071533203125,
0.044769287109375,
-0.24072265625,
0.11669921875,
-0.97509765625,
-0.024078369140625,
-0.272216796875,
0.13427734375,
0.1549072265625,
-0.17529296875,
0.54931640625,
1.140625,
-0.1805419921875,
0.10479736328125,
-0.0838623046875,
0.217529296875,
0.44482421875,
-0.007541656494140625,
-0.169677734375,
0.3291015625,
0.40625,
-0.27880859375,
-0.13623046875,
0.464111328125,
0.0911865234375,
0.247314453125,
-0.1409912109375,
-0.73974609375,
-1.181640625,
0.02679443359375,
-0.055511474609375,
0.417236328125,
0.57275390625,
-0.231689453125,
-0.099365234375,
-0.2015380859375,
-0.83203125,
0.469970703125,
-1.2197265625,
-0.95458984375,
0.016937255859375,
-0.137939453125,
-0.82080078125,
-0.034332275390625,
-0.57421875,
-0.10760498046875,
0.2105712890625,
0.41357421875,
-0.55322265625,
0.3134765625,
0.310791015625,
0.353759765625,
0.1279296875,
0.045257568359375,
0.2294921875,
0.546875,
-0.8369140625,
-0.5224609375,
0.309814453125,
0.806640625,
0.4541015625,
-0.2301025390625,
-0.8330078125,
-0.00980377197265625,
0.267822265625,
-0.1136474609375,
-0.59130859375,
0.065185546875,
-0.0977783203125,
0.9404296875,
-0.72705078125,
-0.10992431640625,
-0.1044921875,
0.552734375,
-0.1597900390625,
-0.06878662109375,
-0.25732421875,
0.60986328125,
1.2548828125,
-0.250244140625,
0.68994140625,
0.333984375,
0.18212890625,
-0.1702880859375,
-0.1907958984375,
-0.5419921875,
0.8310546875,
0.95654296875,
0.66845703125,
0.042236328125,
0.48486328125,
0.83544921875,
0.01611328125,
0.056854248046875,
0.55712890625,
-0.072265625,
0.040069580078125,
-0.0755615234375,
0.1629638671875,
-0.382568359375,
0.049652099609375,
-0.57861328125,
0.159423828125,
-0.481201171875,
-0.20361328125,
-0.417724609375,
-0.54736328125,
1.2626953125,
-0.451904296875,
0.041107177734375,
-0.0716552734375,
-0.583984375,
0.580078125,
0.73828125,
0.08599853515625,
-0.371337890625,
0.759765625,
0.259765625,
0.325439453125,
0.65673828125,
0.40185546875,
0.4306640625,
-0.63232421875,
0.08953857421875,
-0.08575439453125,
-0.0239715576171875,
-0.19677734375,
-0.391357421875,
-0.98876953125,
0.55859375,
0.09637451171875,
-0.40673828125,
0.650390625,
-0.755859375,
-0.042572021484375,
-0.30029296875,
0.8310546875,
-0.69677734375,
0.5859375,
0.21728515625,
-0.2469482421875,
-0.87451171875,
0.74462890625,
-0.08050537109375,
0.262939453125,
0.1759033203125,
1.046875,
-0.051055908203125,
1.228515625,
0.44775390625,
-0.22900390625,
-0.1561279296875,
0.5302734375,
-0.51513671875,
-0.7783203125,
-0.30810546875,
-0.57861328125,
-0.1260986328125,
-0.355224609375,
-0.324462890625,
-0.1651611328125,
0.6640625,
0.19677734375,
-0.86279296875,
-0.77880859375,
0.267578125,
-0.491455078125,
0.392333984375,
0.416748046875,
0.255859375,
0.153564453125,
-0.4580078125,
-0.487060546875,
-0.587890625,
0.221923828125,
-0.56884765625,
0.54345703125,
-0.428466796875,
-0.1942138671875,
-0.517578125,
-0.384765625,
-0.1700439453125,
0.1536865234375,
-0.32763671875,
-0.7978515625,
0.20361328125,
0.332763671875,
0.161376953125,
0.44384765625,
-0.275146484375,
0.09112548828125,
1.2265625,
0.97119140625,
0.156982421875,
0.6513671875,
0.43505859375,
0.02337646484375,
0.0643310546875,
-0.2099609375,
0.52685546875,
-0.333740234375,
0.27001953125,
-0.285888671875,
0.513671875,
-0.76611328125,
-1.2001953125,
0.1966552734375,
0.38330078125,
0.2301025390625,
-0.57861328125,
-0.89794921875,
-0.5732421875,
-1.0390625,
0.0204010009765625,
-0.6748046875,
0.86328125,
0.045745849609375,
-0.2325439453125,
-0.2900390625,
-0.64697265625,
4.46484375,
1.2783203125,
0.456298828125,
0.27734375,
0.1568603515625,
1.0673828125,
0.50927734375,
-0.38623046875,
0.061553955078125,
-0.439453125,
0.412353515625,
-0.16552734375,
0.0265655517578125,
0.9150390625,
0.53759765625,
0.58837890625,
-0.82568359375,
-0.0282135009765625,
-0.09698486328125,
-1.060546875,
-0.80029296875,
0.1905517578125,
-0.1016845703125,
0.37548828125,
-0.1920166015625,
0.75537109375,
0.666015625,
-0.9208984375,
-0.417724609375,
-0.45556640625,
0.0931396484375,
-0.47119140625,
0.93798828125,
0.09100341796875,
-0.434326171875,
0.329345703125,
-0.232177734375,
-0.65087890625,
-0.5029296875,
0.401611328125,
-0.11358642578125,
0.30126953125,
0.837890625,
-0.40380859375,
0.352294921875,
0.63037109375,
-0.67822265625,
0.269287109375,
-0.0167999267578125,
-0.98779296875,
0.60205078125,
-0.287109375,
-0.0256500244140625,
-0.119873046875,
-0.900390625,
-0.43017578125,
0.66845703125,
-0.06121826171875,
0.0430908203125,
0.34423828125,
0.421630859375,
-0.0240020751953125,
-0.004638671875,
0.84912109375,
-1.203125,
0.60400390625,
0.07122802734375,
0.3837890625,
-0.416259765625,
-0.279296875,
-0.341064453125,
-0.3408203125,
-0.5107421875,
-0.42822265625,
0.60546875,
0.369873046875,
-0.2186279296875,
0.2127685546875,
0.5888671875,
-0.8720703125,
0.47314453125,
-0.142822265625,
-0.66748046875,
-0.80859375,
0.82763671875,
1.0048828125,
-0.7060546875,
-0.482666015625,
-0.2010498046875,
0.58447265625,
0.60009765625,
0.6943359375,
-0.037750244140625,
-0.64990234375,
-0.287109375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them presented to him a string si having the same length n. We denote the beauty of the i-th string by ai. It can happen that ai is negative — that means that Santa doesn't find this string beautiful at all.
Santa Claus is crazy about palindromes. He is thinking about the following question: what is the maximum possible total beauty of a palindrome which can be obtained by concatenating some (possibly all) of the strings he has? Each present can be used at most once. Note that all strings have the same length n.
Recall that a palindrome is a string that doesn't change after one reverses it.
Since the empty string is a palindrome too, the answer can't be negative. Even if all ai's are negative, Santa can obtain the empty string.
Input
The first line contains two positive integers k and n divided by space and denoting the number of Santa friends and the length of every string they've presented, respectively (1 ≤ k, n ≤ 100 000; n·k ≤ 100 000).
k lines follow. The i-th of them contains the string si and its beauty ai ( - 10 000 ≤ ai ≤ 10 000). The string consists of n lowercase English letters, and its beauty is integer. Some of strings may coincide. Also, equal strings can have different beauties.
Output
In the only line print the required maximum possible beauty.
Examples
Input
7 3
abb 2
aaa -3
bba -1
zyz -4
abb 5
aaa 7
xyx 4
Output
12
Input
3 1
a 1
a 2
a 3
Output
6
Input
2 5
abcde 10000
abcde 10000
Output
0
Note
In the first example Santa can obtain abbaaaxyxaaabba by concatenating strings 5, 2, 7, 6 and 3 (in this order).
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
n, k = map(int, input().split())
p = {}
np = {}
pair = []
used = {}
rev_d = {}
def push(d, s, v):
if s not in d:
d[s] = []
d[s].append(v)
def is_pal(s):
n = len(s)
flg=True
for i in range(n//2):
if s[i] != s[n-1-i]:
flg = False
break
return flg
def rev(s):
return s[::-1]
for _ in range(n):
s, val = input().split()
val = int(val)
if is_pal(s):
push(p, s, val)
else:
push(np, s, val)
if s not in rev_d:
rev_d[s] = rev(s)
for k, v in p.items():
p[k] = sorted(v, reverse=True)
for k, v in np.items():
np[k] = sorted(v, reverse=True)
for s in np:
if s not in used and rev_d[s] in np:
pair.append([s, rev_d[s]])
used[s] = True
used[rev_d[s]] = True
max_remain = 0
minus = 0
max_S = 0
for v_arr in p.values():
n = len(v_arr)
for i in range(0, n, 2):
if i+1==n:
if v_arr[i] > 0:
max_remain = max(max_remain, v_arr[i])
else:
if v_arr[i] + v_arr[i+1] >= 0:
max_S += v_arr[i] + v_arr[i+1]
if v_arr[i+1] < 0:
minus = min(minus, v_arr[i+1])
else:
if v_arr[i] > 0:
max_remain = max(max_remain, v_arr[i])
for [u, v] in pair:
n = min(len(np[u]), len(np[v]))
for x, y in zip(np[u][:n], np[v][:n]):
if x+y > 0:
max_S += x+y
print(max(max_S+max_remain, max_S-minus))
#7 3
#abb 2
#aaa -3
#bba -1
#zyz -4
#abb 5
#aaa 7
#xyx 4
```
| 46,741
|
[
0.1636962890625,
-0.06878662109375,
0.036773681640625,
0.0341796875,
-0.370361328125,
-0.689453125,
0.1820068359375,
0.297607421875,
0.0198974609375,
0.72314453125,
0.89599609375,
-0.07110595703125,
0.053253173828125,
-0.8583984375,
-0.65869140625,
-0.377685546875,
-0.5595703125,
-0.7421875,
-0.53515625,
-0.23681640625,
-0.008697509765625,
-0.055419921875,
-1.4873046875,
-0.2054443359375,
-0.27001953125,
1.2119140625,
0.451416015625,
0.4560546875,
1.2060546875,
1.318359375,
-0.327880859375,
-0.405029296875,
0.72021484375,
-1.0908203125,
-0.09979248046875,
-0.27197265625,
0.3408203125,
-0.544921875,
-0.31884765625,
-0.39990234375,
0.1429443359375,
-0.34228515625,
0.30908203125,
-0.9111328125,
-1.1943359375,
-0.071533203125,
-0.453369140625,
-0.58642578125,
-0.474609375,
-0.95263671875,
0.1917724609375,
-0.34228515625,
0.427734375,
0.035308837890625,
0.3837890625,
-0.050750732421875,
-0.0347900390625,
-0.3291015625,
-0.58740234375,
0.44482421875,
0.269287109375,
0.201904296875,
-0.1468505859375,
-0.58984375,
-0.320556640625,
0.37060546875,
0.031585693359375,
-0.35107421875,
0.041961669921875,
-0.85205078125,
-0.298095703125,
0.303955078125,
-0.255126953125,
-0.391357421875,
-0.07354736328125,
0.0179290771484375,
0.2274169921875,
0.25927734375,
-0.45166015625,
0.64013671875,
0.092041015625,
0.734375,
-0.186767578125,
0.544921875,
-0.3310546875,
-0.90185546875,
0.08428955078125,
0.1881103515625,
0.023101806640625,
-0.06292724609375,
-0.53759765625,
0.357666015625,
-0.6005859375,
0.397216796875,
0.311767578125,
0.72509765625,
-0.226318359375,
0.280517578125,
-0.1566162109375,
0.330810546875,
0.7490234375,
0.8671875,
-0.501953125,
0.99462890625,
-0.56787109375,
-0.11590576171875,
-0.1370849609375,
0.413330078125,
-0.0152435302734375,
-0.49072265625,
-0.061309814453125,
-0.33349609375,
0.8017578125,
0.36962890625,
0.006771087646484375,
0.77490234375,
-0.0755615234375,
0.42578125,
-0.8984375,
0.0732421875,
0.293212890625,
0.10919189453125,
0.61376953125,
-0.12286376953125,
0.28564453125,
-0.1593017578125,
-0.34814453125,
1.23046875,
-0.5791015625,
-0.1966552734375,
0.4697265625,
0.04046630859375,
0.0887451171875,
0.35595703125,
0.07513427734375,
0.10040283203125,
-0.397705078125,
0.450927734375,
0.783203125,
-0.5439453125,
0.615234375,
-0.2060546875,
-0.2666015625,
1.6328125,
0.449951171875,
0.2626953125,
0.900390625,
0.353515625,
-0.77734375,
0.2393798828125,
-0.62841796875,
0.65771484375,
0.1597900390625,
0.08056640625,
0.136474609375,
0.625,
-0.25,
0.07659912109375,
-0.0114898681640625,
0.07830810546875,
-0.49658203125,
0.410400390625,
-0.31005859375,
0.80908203125,
-0.16748046875,
0.66845703125,
-0.397705078125,
-0.47314453125,
0.00284576416015625,
-0.38232421875,
-0.102783203125,
-0.140869140625,
-0.319580078125,
0.80078125,
0.705078125,
1.158203125,
0.97509765625,
-0.5322265625,
0.317138671875,
0.006954193115234375,
-0.465087890625,
0.67626953125,
0.65087890625,
0.81201171875,
0.1953125,
-0.055206298828125,
0.0171356201171875,
-0.2939453125,
-0.755859375,
-0.77783203125,
-0.224609375,
0.311767578125,
-0.37255859375,
0.06842041015625,
-0.00984954833984375,
0.1859130859375,
-0.875,
-0.38720703125,
-0.110595703125,
-1.0302734375,
-0.67919921875,
0.67236328125,
-0.332275390625,
0.6435546875,
-0.38916015625,
-0.57666015625,
0.37890625,
1.328125,
-0.0146636962890625,
0.1705322265625,
0.399169921875,
0.0223236083984375,
-0.14697265625,
0.0107574462890625,
-0.1165771484375,
-0.114013671875,
-0.426025390625,
0.8076171875,
0.0087738037109375,
0.08123779296875,
-0.00012034177780151367,
1.02734375,
0.07568359375,
0.2430419921875,
-0.439697265625,
0.061431884765625,
0.430419921875,
0.6474609375,
-0.1273193359375,
0.1539306640625,
-0.1949462890625,
1.033203125,
0.33544921875,
0.292724609375,
0.2421875,
-0.04217529296875,
0.287841796875,
0.450927734375,
0.07965087890625,
0.230712890625,
0.28173828125,
0.1793212890625,
0.287109375,
-0.032440185546875,
0.282958984375,
0.74267578125,
-0.054351806640625,
0.0521240234375,
-0.456298828125,
0.8310546875,
-0.321044921875,
0.94189453125,
0.56201171875,
0.198974609375,
-0.57568359375,
0.07220458984375,
0.51220703125,
0.59521484375,
-0.373779296875,
-0.62939453125,
-0.410400390625,
0.20654296875,
0.1844482421875,
-0.05438232421875,
-0.1572265625,
0.615234375,
0.431640625,
0.32666015625,
-0.1978759765625,
-0.49560546875,
-0.92919921875,
-0.90380859375,
-0.794921875,
-0.5087890625,
-0.37353515625,
-0.2093505859375,
0.54248046875,
-0.73779296875,
0.388427734375,
-0.32373046875,
-0.281005859375,
0.0565185546875,
-0.7333984375,
0.1378173828125,
-0.202880859375,
0.72900390625,
-0.96435546875,
0.494140625,
0.16845703125,
1.0322265625,
-0.1893310546875,
-0.027313232421875,
0.013763427734375,
-0.473388671875,
0.24072265625,
-0.1123046875,
0.1292724609375,
-0.2216796875,
-0.50732421875,
-1.0693359375,
-0.2509765625,
-0.273681640625,
-0.190673828125,
0.2015380859375,
-0.3447265625,
0.52099609375,
0.484375,
-0.385009765625,
0.73974609375,
0.8671875,
-0.86279296875,
0.174072265625,
0.4970703125,
0.300048828125,
-0.630859375,
1.2353515625,
0.56201171875,
0.53173828125,
-0.591796875,
-0.335693359375,
-0.5751953125,
0.380126953125,
-0.18359375,
-0.57568359375,
-0.34423828125,
0.845703125,
0.002132415771484375,
-0.9033203125,
0.330322265625,
-0.59521484375,
-0.58837890625,
-0.2056884765625,
-0.443603515625,
0.95361328125,
0.85546875,
0.327392578125,
-0.2025146484375,
-0.322021484375,
-0.1837158203125,
0.5302734375,
0.279052734375,
-0.1241455078125,
-0.44287109375,
0.53564453125,
-0.3037109375,
0.059173583984375,
0.451171875,
-0.2509765625,
0.08917236328125,
0.3837890625,
0.06787109375,
0.53564453125,
0.62646484375,
0.003536224365234375,
0.1478271484375,
1.015625,
-0.91796875,
-0.473388671875,
-0.06658935546875,
0.50732421875,
-0.0361328125,
0.256591796875,
0.433349609375,
-0.1939697265625,
-0.265380859375,
-1.06640625,
0.40185546875,
0.2763671875,
0.72216796875,
-0.59619140625,
0.72998046875,
0.356201171875,
-0.697265625,
0.89599609375,
-0.734375,
-0.25244140625,
1.05859375,
-0.148193359375,
0.278564453125,
-0.6435546875,
0.3740234375,
-0.251708984375,
0.0175323486328125,
0.54736328125,
0.23193359375,
0.8173828125,
-0.576171875,
-0.85595703125,
-0.271484375,
-0.141845703125,
-0.033660888671875,
-0.5107421875,
-0.0638427734375,
-0.53857421875,
-0.382080078125,
-0.72998046875,
0.358154296875,
0.020599365234375,
0.2822265625,
0.153076171875,
0.09429931640625,
0.404296875,
0.57861328125,
0.490478515625,
-0.360595703125,
0.204345703125,
-0.5966796875,
0.8505859375,
0.059478759765625,
-0.54052734375,
-0.57958984375,
-0.06396484375,
-0.411376953125,
-0.23486328125,
0.4111328125,
-0.38232421875,
-1.05859375,
0.037445068359375,
-0.2783203125,
0.68994140625,
-0.0230712890625,
-0.047515869140625,
-0.373291015625,
0.5556640625,
0.2352294921875,
-1.1064453125,
-0.287109375,
-0.462890625,
0.63671875,
0.275634765625,
-0.04840087890625,
-0.36962890625,
-0.413818359375,
-1.1279296875,
-0.84228515625,
-0.0118408203125,
1.3154296875,
-0.11737060546875,
0.2440185546875,
-1.2626953125,
0.7900390625,
0.650390625,
-0.2001953125,
0.05078125,
0.1790771484375,
0.307861328125,
-0.0127105712890625,
0.71044921875,
-0.404052734375,
-0.91552734375,
-0.01329803466796875,
-1.2236328125,
0.40966796875,
-0.353759765625,
0.335205078125,
-0.040802001953125,
-0.302490234375,
-0.212158203125,
0.60888671875,
-0.06512451171875,
0.451416015625,
-0.01849365234375,
0.505859375,
-1.05859375,
-0.69189453125,
0.237060546875,
-0.2110595703125,
-0.174072265625,
1.16796875,
-0.279296875,
-0.455322265625,
-0.02581787109375,
0.65771484375,
-0.62744140625,
0.384521484375,
-0.436767578125,
0.52392578125,
-0.1029052734375,
-0.50732421875,
-0.36962890625,
-0.34130859375,
0.7744140625,
0.0389404296875,
-1.2392578125,
-0.00628662109375,
-1.15625,
-0.275634765625,
-0.1861572265625,
-0.68017578125,
-0.05706787109375,
0.2919921875,
-0.1942138671875,
-0.07525634765625,
-0.323974609375,
-0.282470703125,
-0.38720703125,
-0.54638671875,
-0.4521484375,
0.84716796875,
-0.061431884765625,
0.681640625,
0.259765625,
-0.41748046875,
0.0689697265625,
-0.092529296875,
-0.1937255859375,
-0.5693359375,
-0.033416748046875,
-0.364990234375,
-0.57177734375,
-0.207275390625,
0.20654296875,
0.1226806640625,
0.1673583984375,
0.748046875,
-0.094482421875,
0.363525390625,
0.26318359375,
-0.2152099609375,
1.111328125,
0.3818359375,
-1.255859375,
-0.0220794677734375,
0.599609375,
-0.27001953125,
0.61669921875,
0.0902099609375,
-0.82470703125,
-0.60498046875,
-1.0380859375,
0.08673095703125,
-0.6767578125,
-0.11981201171875,
-1.2021484375,
0.0272979736328125,
-0.2437744140625,
0.8525390625,
-0.21435546875,
-0.50048828125,
0.274169921875,
-1.177734375,
0.0090789794921875,
-1.0576171875,
-0.251953125,
-0.68310546875,
-0.116455078125,
-0.283935546875,
1.0029296875,
-0.2181396484375,
0.35595703125,
0.4072265625,
-0.3125,
0.2763671875,
0.17529296875,
-0.57373046875,
-0.10052490234375,
-0.325439453125,
0.0655517578125,
0.2470703125,
0.10748291015625,
-0.63232421875,
0.599609375,
-0.9521484375,
0.27783203125,
-0.233154296875,
-0.646484375,
-0.364013671875,
-0.1629638671875,
0.98291015625,
-0.69677734375,
-0.1666259765625,
-0.75390625,
0.1888427734375,
1.1865234375,
0.0131988525390625,
-0.358642578125,
-0.48681640625,
-0.4912109375,
-1.0849609375,
0.52880859375,
-0.417236328125,
0.1181640625,
-1.0263671875,
-0.4228515625,
1.0341796875,
-0.1507568359375,
0.2354736328125,
1.1591796875,
0.322265625,
0.4404296875,
-0.68310546875,
0.66845703125,
0.634765625,
-0.1348876953125,
-0.215576171875,
0.295654296875,
-0.9228515625,
0.1748046875,
0.046356201171875,
-1.091796875,
-0.73095703125,
0.1949462890625,
1.2255859375,
-0.3798828125,
0.55029296875,
-0.10882568359375,
-1.32421875,
-0.50927734375,
1.2197265625,
0.1871337890625,
-0.281005859375,
1.1181640625,
-0.051849365234375,
-0.2113037109375,
-0.1297607421875,
-0.052886962890625,
-0.341796875,
-0.246826171875,
1.142578125,
-0.11810302734375,
-0.76953125,
1.12890625,
0.7958984375,
-1.0712890625,
-0.95166015625,
-0.131591796875,
0.036651611328125,
0.049224853515625,
-0.45068359375,
0.0274505615234375,
0.658203125,
-0.56689453125,
-0.151611328125,
0.44677734375,
0.193115234375,
0.626953125,
0.3369140625,
0.341064453125,
-0.56689453125,
0.66943359375,
0.8798828125,
-0.5712890625,
-0.61083984375,
-1.2314453125,
-0.410400390625,
-0.29296875,
0.042938232421875,
1.025390625,
-0.37939453125,
0.59912109375,
0.458984375,
0.125244140625,
0.70654296875,
-0.41552734375,
-0.5556640625,
0.6005859375,
-0.5966796875,
-0.449462890625,
-0.06744384765625,
0.4833984375,
-0.462646484375,
0.6015625,
-0.6708984375,
-0.1654052734375,
0.1885986328125,
0.1295166015625,
-0.481689453125,
-0.330078125,
-0.300537109375,
-0.99462890625,
-0.607421875,
-0.7451171875,
-0.86083984375,
0.0004935264587402344,
0.038848876953125,
-0.0182037353515625,
-0.70068359375,
0.300537109375,
0.67041015625,
-0.67724609375,
0.876953125,
-0.81005859375,
0.32666015625,
-0.360595703125,
-0.274169921875,
-0.256591796875,
-0.14453125,
-0.38671875,
-0.024169921875,
-0.732421875,
0.056488037109375,
-0.054107666015625,
0.654296875,
0.043609619140625,
0.332275390625,
-0.37890625,
-0.07110595703125,
0.1549072265625,
0.09002685546875,
0.347900390625,
0.669921875,
0.830078125,
-0.221923828125,
0.2095947265625,
0.04931640625,
-0.249267578125,
-0.25,
0.3466796875,
0.474365234375,
-0.35595703125,
0.140380859375,
-0.45751953125,
0.400390625,
-1.3447265625,
0.24072265625,
-0.1243896484375,
0.5927734375,
0.505859375,
-0.0281982421875,
0.345947265625,
0.7548828125,
-0.332763671875,
0.231689453125,
0.0206451416015625,
0.0982666015625,
0.18359375,
-0.04376220703125,
0.07012939453125,
0.7666015625,
0.401611328125,
-0.75390625,
0.07373046875,
0.004268646240234375,
0.1947021484375,
0.294189453125,
-0.1807861328125,
-0.81591796875,
-1.078125,
-0.47802734375,
0.08892822265625,
0.46337890625,
0.5234375,
-0.54443359375,
0.133544921875,
0.11602783203125,
-0.56640625,
0.1602783203125,
-0.9091796875,
-1.0654296875,
0.0104217529296875,
-0.0780029296875,
-0.31494140625,
-0.30615234375,
-0.306640625,
-0.071044921875,
0.152099609375,
0.5244140625,
-0.54833984375,
0.35498046875,
-0.564453125,
0.552734375,
-0.02008056640625,
0.034759521484375,
0.03369140625,
0.595703125,
-0.443603515625,
-0.51513671875,
-0.069091796875,
0.99267578125,
0.329345703125,
0.00830841064453125,
-0.42724609375,
0.258056640625,
-0.0218505859375,
0.26123046875,
-0.83984375,
0.2119140625,
-0.26123046875,
0.6884765625,
-0.64208984375,
-0.02923583984375,
0.156005859375,
0.483154296875,
0.3544921875,
-0.412353515625,
-0.5732421875,
0.73681640625,
0.53759765625,
-0.07110595703125,
0.751953125,
0.465087890625,
0.83740234375,
-0.06512451171875,
-0.33740234375,
-0.50390625,
0.615234375,
0.8408203125,
0.394287109375,
-0.0285491943359375,
0.1500244140625,
0.955078125,
-0.14990234375,
-0.351806640625,
0.172119140625,
0.036865234375,
-0.36083984375,
0.12298583984375,
-0.1943359375,
0.1041259765625,
0.2001953125,
-0.24755859375,
0.449462890625,
-0.34912109375,
-0.06689453125,
-0.29833984375,
-0.66259765625,
0.59326171875,
-0.265869140625,
-0.185791015625,
-0.1343994140625,
-0.123291015625,
0.71826171875,
0.3466796875,
0.1802978515625,
0.22998046875,
1.1923828125,
0.90771484375,
0.3818359375,
0.5712890625,
0.1859130859375,
0.123291015625,
-0.4150390625,
0.280029296875,
0.1690673828125,
-0.10345458984375,
-0.42236328125,
-0.5478515625,
-1.056640625,
0.779296875,
-0.16552734375,
-0.63671875,
0.390869140625,
-0.45263671875,
0.2236328125,
-0.432861328125,
1.013671875,
-0.27978515625,
0.03985595703125,
0.41162109375,
-0.27490234375,
-0.374267578125,
0.880859375,
-0.443115234375,
0.039154052734375,
0.18896484375,
0.9501953125,
0.00768280029296875,
1.4658203125,
0.939453125,
-0.1544189453125,
0.0169830322265625,
0.11474609375,
-0.162353515625,
-0.46630859375,
-0.3037109375,
-0.07659912109375,
0.1495361328125,
-0.69677734375,
-0.29736328125,
-0.58935546875,
0.6689453125,
0.10272216796875,
-0.84033203125,
-0.3115234375,
0.1507568359375,
-0.60546875,
0.133056640625,
-0.0654296875,
0.064697265625,
-0.1097412109375,
0.35400390625,
-0.3515625,
-0.374755859375,
0.46044921875,
-0.476318359375,
0.287841796875,
-0.4140625,
-0.59130859375,
-0.461181640625,
-0.74853515625,
-0.40869140625,
-0.3447265625,
-0.13720703125,
-0.8798828125,
0.54248046875,
0.541015625,
0.465576171875,
0.79248046875,
-0.294677734375,
0.1876220703125,
0.5361328125,
1.013671875,
0.10736083984375,
0.63818359375,
0.22900390625,
-0.5224609375,
0.031280517578125,
-0.270263671875,
0.56591796875,
0.1651611328125,
0.190673828125,
-0.7060546875,
0.332763671875,
-0.583984375,
-1.2294921875,
-0.0298004150390625,
0.71240234375,
0.68701171875,
-0.77587890625,
-1.1708984375,
-0.2900390625,
-1.22265625,
-0.1392822265625,
-0.7138671875,
0.6796875,
-0.0987548828125,
0.1951904296875,
-0.189208984375,
-1.2998046875,
4.38671875,
0.95166015625,
0.98681640625,
0.356201171875,
0.681640625,
1.1787109375,
0.34619140625,
-0.625,
-0.25537109375,
-0.266845703125,
0.78076171875,
-0.52880859375,
0.26416015625,
0.89306640625,
0.609375,
0.66748046875,
-0.73095703125,
0.09710693359375,
0.09161376953125,
-0.9365234375,
-0.79736328125,
0.1865234375,
0.18310546875,
0.2254638671875,
0.0155181884765625,
0.1953125,
0.50927734375,
-0.57421875,
-0.673828125,
-0.5693359375,
-0.02545166015625,
-0.70166015625,
0.481689453125,
-0.083251953125,
-0.205810546875,
0.86572265625,
0.076416015625,
-0.392578125,
-0.2371826171875,
0.2069091796875,
0.2119140625,
-0.22119140625,
0.361328125,
-0.93798828125,
-0.3662109375,
-0.06817626953125,
-0.705078125,
0.429443359375,
-0.39990234375,
-0.77001953125,
1.080078125,
-0.06402587890625,
0.32373046875,
-0.34326171875,
-0.97265625,
0.337646484375,
-0.0869140625,
-0.1318359375,
-0.174560546875,
0.5693359375,
0.048919677734375,
0.625,
-0.06048583984375,
0.55322265625,
-1.025390625,
1.09375,
-0.5380859375,
0.61865234375,
-0.869140625,
-0.07403564453125,
-0.045440673828125,
-0.006404876708984375,
-0.321044921875,
-0.270751953125,
0.466796875,
0.568359375,
-0.136962890625,
0.8525390625,
0.476806640625,
-0.494384765625,
0.04974365234375,
0.047027587890625,
-0.4931640625,
-0.36376953125,
0.83544921875,
1.14453125,
-0.59716796875,
-0.201904296875,
-0.2310791015625,
0.67041015625,
0.270751953125,
0.57763671875,
-0.00850677490234375,
-0.66552734375,
-0.381591796875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them presented to him a string si having the same length n. We denote the beauty of the i-th string by ai. It can happen that ai is negative — that means that Santa doesn't find this string beautiful at all.
Santa Claus is crazy about palindromes. He is thinking about the following question: what is the maximum possible total beauty of a palindrome which can be obtained by concatenating some (possibly all) of the strings he has? Each present can be used at most once. Note that all strings have the same length n.
Recall that a palindrome is a string that doesn't change after one reverses it.
Since the empty string is a palindrome too, the answer can't be negative. Even if all ai's are negative, Santa can obtain the empty string.
Input
The first line contains two positive integers k and n divided by space and denoting the number of Santa friends and the length of every string they've presented, respectively (1 ≤ k, n ≤ 100 000; n·k ≤ 100 000).
k lines follow. The i-th of them contains the string si and its beauty ai ( - 10 000 ≤ ai ≤ 10 000). The string consists of n lowercase English letters, and its beauty is integer. Some of strings may coincide. Also, equal strings can have different beauties.
Output
In the only line print the required maximum possible beauty.
Examples
Input
7 3
abb 2
aaa -3
bba -1
zyz -4
abb 5
aaa 7
xyx 4
Output
12
Input
3 1
a 1
a 2
a 3
Output
6
Input
2 5
abcde 10000
abcde 10000
Output
0
Note
In the first example Santa can obtain abbaaaxyxaaabba by concatenating strings 5, 2, 7, 6 and 3 (in this order).
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
import sys
import math
def solve():
k, n = map(int, input().split())
D = {}
for line in sys.stdin:
s, a = line.split()
if s in D:
D[s].append(int(a))
else:
D[s] = [int(a)]
res = 0
center = 0
for s in D:
revs = s[::-1]
if not revs in D: continue
D[revs].sort()
D[s].sort()
if s == revs:
while len(D[s]) > 1 and D[s][-2] + D[s][-1] > 0:
center = max(center, -D[s][-2])
res += D[s].pop()
res += D[s].pop()
if len(D[s]) > 0:
center = max(center, D[s][-1])
else:
while (len(D[s]) > 0 and len(D[revs]) > 0 and
D[s][-1] + D[revs][-1] > 0):
res += D[s].pop()
res += D[revs].pop()
return res + center
print(solve())
```
| 46,742
|
[
0.1514892578125,
-0.058624267578125,
0.0550537109375,
0.0255889892578125,
-0.375,
-0.66748046875,
0.1575927734375,
0.2939453125,
-0.0003199577331542969,
0.6962890625,
0.86669921875,
-0.0692138671875,
0.037750244140625,
-0.88232421875,
-0.65087890625,
-0.379638671875,
-0.55810546875,
-0.73876953125,
-0.56494140625,
-0.2373046875,
-0.00916290283203125,
-0.0535888671875,
-1.482421875,
-0.1845703125,
-0.2445068359375,
1.19140625,
0.483154296875,
0.4482421875,
1.1923828125,
1.3271484375,
-0.326171875,
-0.381103515625,
0.70166015625,
-1.09765625,
-0.07666015625,
-0.283203125,
0.365234375,
-0.58154296875,
-0.337646484375,
-0.413330078125,
0.09954833984375,
-0.347412109375,
0.286376953125,
-0.94384765625,
-1.2236328125,
-0.080322265625,
-0.434814453125,
-0.56396484375,
-0.470458984375,
-0.9150390625,
0.181640625,
-0.31982421875,
0.41650390625,
0.040374755859375,
0.352783203125,
-0.055450439453125,
-0.04058837890625,
-0.311279296875,
-0.60400390625,
0.411376953125,
0.274169921875,
0.1934814453125,
-0.1529541015625,
-0.54052734375,
-0.283203125,
0.385498046875,
0.0237274169921875,
-0.34716796875,
0.03741455078125,
-0.79833984375,
-0.28955078125,
0.327880859375,
-0.219482421875,
-0.392578125,
-0.048797607421875,
0.01192474365234375,
0.2396240234375,
0.27197265625,
-0.438232421875,
0.623046875,
0.07220458984375,
0.736328125,
-0.211669921875,
0.53271484375,
-0.33154296875,
-0.91748046875,
0.06658935546875,
0.180908203125,
-0.01458740234375,
-0.068603515625,
-0.5087890625,
0.359375,
-0.59033203125,
0.409912109375,
0.313232421875,
0.73291015625,
-0.22705078125,
0.27685546875,
-0.156982421875,
0.338134765625,
0.72021484375,
0.8994140625,
-0.52197265625,
1.021484375,
-0.56982421875,
-0.1195068359375,
-0.1556396484375,
0.40234375,
0.0014791488647460938,
-0.4638671875,
-0.0350341796875,
-0.3515625,
0.8125,
0.369140625,
0.00978851318359375,
0.771484375,
-0.0816650390625,
0.436279296875,
-0.9208984375,
0.07373046875,
0.310546875,
0.1041259765625,
0.6201171875,
-0.1572265625,
0.26416015625,
-0.15234375,
-0.36083984375,
1.2265625,
-0.59130859375,
-0.214599609375,
0.439453125,
0.029754638671875,
0.07177734375,
0.361572265625,
0.08648681640625,
0.09130859375,
-0.390380859375,
0.41357421875,
0.78369140625,
-0.49560546875,
0.61181640625,
-0.2191162109375,
-0.240478515625,
1.6494140625,
0.457275390625,
0.256103515625,
0.8955078125,
0.3857421875,
-0.75048828125,
0.25048828125,
-0.6123046875,
0.62158203125,
0.142333984375,
0.1029052734375,
0.181884765625,
0.59521484375,
-0.2734375,
0.0703125,
-0.0115966796875,
0.10784912109375,
-0.5224609375,
0.430908203125,
-0.28564453125,
0.7919921875,
-0.1719970703125,
0.658203125,
-0.37109375,
-0.480224609375,
0.004291534423828125,
-0.33740234375,
-0.0975341796875,
-0.15380859375,
-0.307861328125,
0.79296875,
0.72705078125,
1.1630859375,
1,
-0.53466796875,
0.28759765625,
0.0216217041015625,
-0.5400390625,
0.66748046875,
0.6748046875,
0.80908203125,
0.211181640625,
-0.0275115966796875,
0.026702880859375,
-0.275390625,
-0.7607421875,
-0.79443359375,
-0.1746826171875,
0.32080078125,
-0.3525390625,
0.06365966796875,
-0.063720703125,
0.17236328125,
-0.86572265625,
-0.3955078125,
-0.0855712890625,
-1.0361328125,
-0.67578125,
0.66015625,
-0.302978515625,
0.63037109375,
-0.391845703125,
-0.58837890625,
0.374267578125,
1.3515625,
0.002964019775390625,
0.158447265625,
0.4111328125,
-0.037689208984375,
-0.14404296875,
0.03326416015625,
-0.0968017578125,
-0.1304931640625,
-0.4248046875,
0.75537109375,
0.038909912109375,
0.1016845703125,
0.0020751953125,
1.04296875,
0.027801513671875,
0.253173828125,
-0.437255859375,
0.08258056640625,
0.44140625,
0.6337890625,
-0.1295166015625,
0.14111328125,
-0.1856689453125,
1.0029296875,
0.32958984375,
0.257080078125,
0.209228515625,
-0.054534912109375,
0.2783203125,
0.44384765625,
0.044677734375,
0.25341796875,
0.267822265625,
0.1939697265625,
0.2685546875,
-0.0304718017578125,
0.30419921875,
0.76416015625,
-0.046234130859375,
0.053802490234375,
-0.44970703125,
0.80810546875,
-0.33984375,
0.98486328125,
0.564453125,
0.150390625,
-0.56396484375,
0.088623046875,
0.51171875,
0.60546875,
-0.381103515625,
-0.6484375,
-0.406982421875,
0.2105712890625,
0.191650390625,
-0.0272674560546875,
-0.183837890625,
0.5947265625,
0.405517578125,
0.29345703125,
-0.1915283203125,
-0.46630859375,
-0.91650390625,
-0.90185546875,
-0.79296875,
-0.5146484375,
-0.376220703125,
-0.226318359375,
0.52197265625,
-0.71728515625,
0.357666015625,
-0.357177734375,
-0.273681640625,
0.07586669921875,
-0.7216796875,
0.12005615234375,
-0.2132568359375,
0.72021484375,
-0.97216796875,
0.480712890625,
0.1329345703125,
1.0419921875,
-0.2191162109375,
-0.009063720703125,
-0.00977325439453125,
-0.472900390625,
0.2218017578125,
-0.12274169921875,
0.1229248046875,
-0.1856689453125,
-0.476318359375,
-1.099609375,
-0.251708984375,
-0.28564453125,
-0.1939697265625,
0.1822509765625,
-0.311767578125,
0.488525390625,
0.466064453125,
-0.388916015625,
0.74755859375,
0.849609375,
-0.86328125,
0.1649169921875,
0.47900390625,
0.305419921875,
-0.6279296875,
1.2158203125,
0.55224609375,
0.51171875,
-0.5478515625,
-0.342529296875,
-0.53857421875,
0.429443359375,
-0.222412109375,
-0.5576171875,
-0.32958984375,
0.84033203125,
0.0272216796875,
-0.88525390625,
0.349853515625,
-0.61767578125,
-0.58642578125,
-0.2099609375,
-0.44189453125,
0.96826171875,
0.85595703125,
0.34619140625,
-0.2288818359375,
-0.2978515625,
-0.2127685546875,
0.499267578125,
0.280517578125,
-0.1634521484375,
-0.421630859375,
0.5537109375,
-0.302001953125,
0.0482177734375,
0.45703125,
-0.2176513671875,
0.09954833984375,
0.36474609375,
0.0567626953125,
0.5224609375,
0.62939453125,
0.0270233154296875,
0.163330078125,
0.9931640625,
-0.951171875,
-0.471923828125,
-0.0689697265625,
0.47705078125,
-0.0174102783203125,
0.254150390625,
0.450927734375,
-0.1546630859375,
-0.26708984375,
-1.0654296875,
0.36328125,
0.2900390625,
0.728515625,
-0.564453125,
0.7451171875,
0.341796875,
-0.69091796875,
0.9130859375,
-0.73046875,
-0.2137451171875,
1.0595703125,
-0.125732421875,
0.277099609375,
-0.6259765625,
0.37255859375,
-0.2412109375,
-0.01497650146484375,
0.54345703125,
0.21923828125,
0.79931640625,
-0.548828125,
-0.88916015625,
-0.297607421875,
-0.1546630859375,
-0.044830322265625,
-0.5263671875,
-0.058197021484375,
-0.5517578125,
-0.4091796875,
-0.740234375,
0.3623046875,
0.017730712890625,
0.27880859375,
0.163330078125,
0.080322265625,
0.36767578125,
0.57568359375,
0.50830078125,
-0.365478515625,
0.23291015625,
-0.5927734375,
0.8896484375,
0.03814697265625,
-0.53076171875,
-0.6005859375,
-0.08013916015625,
-0.38671875,
-0.2291259765625,
0.400634765625,
-0.364013671875,
-1.0322265625,
0.0291748046875,
-0.252685546875,
0.68115234375,
-0.0670166015625,
0.007480621337890625,
-0.3681640625,
0.55419921875,
0.2445068359375,
-1.11328125,
-0.322998046875,
-0.47802734375,
0.650390625,
0.2364501953125,
-0.038726806640625,
-0.355224609375,
-0.423828125,
-1.1005859375,
-0.8662109375,
-0.0047149658203125,
1.3056640625,
-0.09124755859375,
0.2457275390625,
-1.26171875,
0.79248046875,
0.68017578125,
-0.1907958984375,
0.037628173828125,
0.1998291015625,
0.29833984375,
-0.0133819580078125,
0.7021484375,
-0.351806640625,
-0.90380859375,
-0.0172119140625,
-1.25,
0.412353515625,
-0.358642578125,
0.343994140625,
-0.0257110595703125,
-0.29736328125,
-0.23095703125,
0.6376953125,
-0.054656982421875,
0.432861328125,
-0.01381683349609375,
0.488037109375,
-1.046875,
-0.7099609375,
0.245361328125,
-0.2490234375,
-0.1361083984375,
1.2099609375,
-0.275146484375,
-0.45703125,
-0.0194854736328125,
0.65673828125,
-0.59912109375,
0.4111328125,
-0.47119140625,
0.49951171875,
-0.10650634765625,
-0.51416015625,
-0.42529296875,
-0.319580078125,
0.76904296875,
0.03448486328125,
-1.23828125,
0.0281982421875,
-1.1513671875,
-0.25830078125,
-0.1866455078125,
-0.67578125,
-0.053680419921875,
0.274658203125,
-0.1968994140625,
-0.0736083984375,
-0.33056640625,
-0.260986328125,
-0.381591796875,
-0.52587890625,
-0.47119140625,
0.8359375,
-0.07904052734375,
0.67626953125,
0.2413330078125,
-0.388427734375,
0.050628662109375,
-0.101806640625,
-0.2122802734375,
-0.58251953125,
-0.02679443359375,
-0.376708984375,
-0.5830078125,
-0.220703125,
0.19873046875,
0.1431884765625,
0.19873046875,
0.74169921875,
-0.073974609375,
0.353759765625,
0.289794921875,
-0.194091796875,
1.12109375,
0.3740234375,
-1.2578125,
0.0071258544921875,
0.5966796875,
-0.31298828125,
0.60888671875,
0.040771484375,
-0.85595703125,
-0.57666015625,
-1.0361328125,
0.1170654296875,
-0.68212890625,
-0.151611328125,
-1.2021484375,
0.007625579833984375,
-0.260986328125,
0.86474609375,
-0.22265625,
-0.478271484375,
0.2413330078125,
-1.1591796875,
-0.0228271484375,
-1.056640625,
-0.234130859375,
-0.69677734375,
-0.1373291015625,
-0.258544921875,
1.0322265625,
-0.24267578125,
0.3583984375,
0.40234375,
-0.28564453125,
0.273681640625,
0.159912109375,
-0.5595703125,
-0.10333251953125,
-0.35205078125,
0.0609130859375,
0.23974609375,
0.1285400390625,
-0.64404296875,
0.56396484375,
-0.927734375,
0.2939453125,
-0.218017578125,
-0.62646484375,
-0.337158203125,
-0.1378173828125,
0.95947265625,
-0.72216796875,
-0.1556396484375,
-0.74365234375,
0.1962890625,
1.2265625,
0.028106689453125,
-0.351806640625,
-0.48388671875,
-0.47314453125,
-1.076171875,
0.5126953125,
-0.413818359375,
0.1256103515625,
-1.05078125,
-0.39306640625,
1.0224609375,
-0.1690673828125,
0.2332763671875,
1.1357421875,
0.3505859375,
0.423583984375,
-0.65087890625,
0.66455078125,
0.64306640625,
-0.144775390625,
-0.19677734375,
0.307861328125,
-0.89697265625,
0.1956787109375,
0.057861328125,
-1.09765625,
-0.71533203125,
0.171875,
1.23046875,
-0.3896484375,
0.5478515625,
-0.1068115234375,
-1.3505859375,
-0.477294921875,
1.2314453125,
0.141845703125,
-0.271240234375,
1.107421875,
-0.0552978515625,
-0.209228515625,
-0.11151123046875,
-0.05194091796875,
-0.32421875,
-0.2342529296875,
1.1328125,
-0.1531982421875,
-0.771484375,
1.1240234375,
0.8046875,
-1.0859375,
-0.95703125,
-0.11895751953125,
0.0465087890625,
0.05841064453125,
-0.459228515625,
0.04278564453125,
0.63818359375,
-0.5654296875,
-0.1630859375,
0.44091796875,
0.1961669921875,
0.6396484375,
0.34423828125,
0.327392578125,
-0.55078125,
0.70068359375,
0.873046875,
-0.55908203125,
-0.59716796875,
-1.2255859375,
-0.405029296875,
-0.31640625,
0.061859130859375,
1.03515625,
-0.38134765625,
0.64404296875,
0.4560546875,
0.1341552734375,
0.69970703125,
-0.4208984375,
-0.5400390625,
0.59326171875,
-0.6171875,
-0.449462890625,
-0.062103271484375,
0.474609375,
-0.44580078125,
0.62841796875,
-0.6806640625,
-0.15576171875,
0.1861572265625,
0.1656494140625,
-0.445068359375,
-0.298095703125,
-0.30029296875,
-0.99951171875,
-0.607421875,
-0.74072265625,
-0.8671875,
0.0025768280029296875,
0.029052734375,
0.0066680908203125,
-0.69921875,
0.3134765625,
0.6689453125,
-0.6640625,
0.85400390625,
-0.8125,
0.316650390625,
-0.340576171875,
-0.267333984375,
-0.270263671875,
-0.1475830078125,
-0.402099609375,
-0.045806884765625,
-0.75244140625,
0.017608642578125,
-0.06695556640625,
0.6748046875,
0.045318603515625,
0.31396484375,
-0.385986328125,
-0.07843017578125,
0.209228515625,
0.10186767578125,
0.306396484375,
0.7080078125,
0.81103515625,
-0.1781005859375,
0.1859130859375,
0.04034423828125,
-0.238525390625,
-0.222900390625,
0.35400390625,
0.488525390625,
-0.3701171875,
0.1414794921875,
-0.47412109375,
0.374755859375,
-1.32421875,
0.27001953125,
-0.1259765625,
0.57958984375,
0.52783203125,
-0.0237579345703125,
0.359375,
0.75341796875,
-0.33837890625,
0.22412109375,
0.0208587646484375,
0.09649658203125,
0.13330078125,
-0.0675048828125,
0.050933837890625,
0.76904296875,
0.404296875,
-0.734375,
0.07293701171875,
0.0023479461669921875,
0.2015380859375,
0.2568359375,
-0.17822265625,
-0.8173828125,
-1.09375,
-0.484130859375,
0.07489013671875,
0.473876953125,
0.54736328125,
-0.56884765625,
0.0985107421875,
0.12176513671875,
-0.56494140625,
0.1824951171875,
-0.88330078125,
-1.09375,
-0.020050048828125,
-0.0880126953125,
-0.3173828125,
-0.28076171875,
-0.316162109375,
-0.06744384765625,
0.1295166015625,
0.50390625,
-0.51953125,
0.363037109375,
-0.5517578125,
0.51708984375,
0.000028848648071289062,
0.0523681640625,
0.04266357421875,
0.57958984375,
-0.42822265625,
-0.52001953125,
-0.048675537109375,
0.98046875,
0.360595703125,
-0.011627197265625,
-0.443359375,
0.257080078125,
-0.04827880859375,
0.27294921875,
-0.82763671875,
0.2059326171875,
-0.25390625,
0.67431640625,
-0.640625,
-0.017608642578125,
0.174560546875,
0.45556640625,
0.30615234375,
-0.4072265625,
-0.58544921875,
0.7158203125,
0.56201171875,
-0.028472900390625,
0.74365234375,
0.481201171875,
0.82421875,
-0.0286865234375,
-0.349365234375,
-0.51513671875,
0.5888671875,
0.85791015625,
0.4150390625,
-0.043304443359375,
0.1719970703125,
0.99169921875,
-0.15283203125,
-0.374267578125,
0.11822509765625,
0.0501708984375,
-0.365966796875,
0.1114501953125,
-0.176025390625,
0.08343505859375,
0.1822509765625,
-0.2548828125,
0.490234375,
-0.3408203125,
-0.08111572265625,
-0.306396484375,
-0.6669921875,
0.5859375,
-0.289306640625,
-0.193115234375,
-0.1456298828125,
-0.1390380859375,
0.7294921875,
0.34814453125,
0.1890869140625,
0.2215576171875,
1.18359375,
0.89453125,
0.407470703125,
0.537109375,
0.2034912109375,
0.11663818359375,
-0.405029296875,
0.283203125,
0.1939697265625,
-0.08428955078125,
-0.3916015625,
-0.51513671875,
-1.0537109375,
0.77294921875,
-0.1629638671875,
-0.6201171875,
0.38232421875,
-0.453369140625,
0.2257080078125,
-0.435791015625,
1.0146484375,
-0.300048828125,
0.01212310791015625,
0.40283203125,
-0.299560546875,
-0.40625,
0.8740234375,
-0.438720703125,
-0.023193359375,
0.219482421875,
0.943359375,
0.0179595947265625,
1.484375,
0.93408203125,
-0.1444091796875,
-0.0063018798828125,
0.125,
-0.2010498046875,
-0.46337890625,
-0.30810546875,
-0.047637939453125,
0.144287109375,
-0.6748046875,
-0.30322265625,
-0.5517578125,
0.6611328125,
0.09930419921875,
-0.7880859375,
-0.355712890625,
0.1533203125,
-0.58154296875,
0.1356201171875,
-0.08209228515625,
0.10418701171875,
-0.1092529296875,
0.353515625,
-0.35205078125,
-0.373779296875,
0.475830078125,
-0.49609375,
0.286376953125,
-0.4130859375,
-0.60302734375,
-0.464111328125,
-0.73486328125,
-0.42919921875,
-0.35595703125,
-0.11627197265625,
-0.87060546875,
0.56005859375,
0.5185546875,
0.445068359375,
0.771484375,
-0.268310546875,
0.213134765625,
0.51953125,
1.009765625,
0.11444091796875,
0.66357421875,
0.249755859375,
-0.5205078125,
0.0248870849609375,
-0.2462158203125,
0.552734375,
0.1744384765625,
0.1668701171875,
-0.70263671875,
0.31201171875,
-0.6123046875,
-1.208984375,
-0.04852294921875,
0.7294921875,
0.6982421875,
-0.78125,
-1.1533203125,
-0.2802734375,
-1.263671875,
-0.14208984375,
-0.7080078125,
0.6748046875,
-0.0970458984375,
0.216796875,
-0.190673828125,
-1.275390625,
4.39453125,
0.9482421875,
0.99951171875,
0.330322265625,
0.7021484375,
1.1728515625,
0.323974609375,
-0.66357421875,
-0.24169921875,
-0.308837890625,
0.78564453125,
-0.5263671875,
0.281982421875,
0.92822265625,
0.60791015625,
0.69091796875,
-0.72265625,
0.091796875,
0.10430908203125,
-0.95751953125,
-0.81201171875,
0.1781005859375,
0.1466064453125,
0.2032470703125,
0.031494140625,
0.2421875,
0.5185546875,
-0.58447265625,
-0.666015625,
-0.58154296875,
-0.02557373046875,
-0.658203125,
0.4580078125,
-0.131103515625,
-0.207763671875,
0.8642578125,
0.0445556640625,
-0.382080078125,
-0.225830078125,
0.1898193359375,
0.2230224609375,
-0.2364501953125,
0.324462890625,
-0.9541015625,
-0.34912109375,
-0.055511474609375,
-0.69482421875,
0.425537109375,
-0.390380859375,
-0.79345703125,
1.056640625,
-0.0538330078125,
0.278564453125,
-0.31982421875,
-0.9384765625,
0.35302734375,
-0.105712890625,
-0.10888671875,
-0.166259765625,
0.5849609375,
0.069091796875,
0.625,
-0.049957275390625,
0.55712890625,
-1.0263671875,
1.0849609375,
-0.53173828125,
0.669921875,
-0.87451171875,
-0.0626220703125,
-0.0546875,
-0.032989501953125,
-0.3408203125,
-0.2354736328125,
0.4638671875,
0.57958984375,
-0.1510009765625,
0.8212890625,
0.468994140625,
-0.477294921875,
0.08154296875,
0.0626220703125,
-0.497314453125,
-0.357421875,
0.8203125,
1.1484375,
-0.60986328125,
-0.1884765625,
-0.2384033203125,
0.669921875,
0.272705078125,
0.57470703125,
0.0066986083984375,
-0.67431640625,
-0.38134765625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Santa Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them presented to him a string si having the same length n. We denote the beauty of the i-th string by ai. It can happen that ai is negative — that means that Santa doesn't find this string beautiful at all.
Santa Claus is crazy about palindromes. He is thinking about the following question: what is the maximum possible total beauty of a palindrome which can be obtained by concatenating some (possibly all) of the strings he has? Each present can be used at most once. Note that all strings have the same length n.
Recall that a palindrome is a string that doesn't change after one reverses it.
Since the empty string is a palindrome too, the answer can't be negative. Even if all ai's are negative, Santa can obtain the empty string.
Input
The first line contains two positive integers k and n divided by space and denoting the number of Santa friends and the length of every string they've presented, respectively (1 ≤ k, n ≤ 100 000; n·k ≤ 100 000).
k lines follow. The i-th of them contains the string si and its beauty ai ( - 10 000 ≤ ai ≤ 10 000). The string consists of n lowercase English letters, and its beauty is integer. Some of strings may coincide. Also, equal strings can have different beauties.
Output
In the only line print the required maximum possible beauty.
Examples
Input
7 3
abb 2
aaa -3
bba -1
zyz -4
abb 5
aaa 7
xyx 4
Output
12
Input
3 1
a 1
a 2
a 3
Output
6
Input
2 5
abcde 10000
abcde 10000
Output
0
Note
In the first example Santa can obtain abbaaaxyxaaabba by concatenating strings 5, 2, 7, 6 and 3 (in this order).
Tags: constructive algorithms, data structures, greedy
Correct Solution:
```
# ---------------------------iye ha aam zindegi---------------------------------------------
import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
#import threading
from collections import defaultdict
#threading.stack_size(10**8)
mod = 10 ** 9 + 7
mod1 = 998244353
# ------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase
#sys.setrecursionlimit(300000)
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.writable else None
def read(self):
while True:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
if not b:
break
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines = 0
return self.buffer.read()
def readline(self):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.newlines = b.count(b"\n") + (not b)
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines -= 1
return self.buffer.readline()
def flush(self):
if self.writable:
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# -------------------game starts now----------------------------------------------------import math
class TreeNode:
def __init__(self, k, v):
self.key = k
self.value = v
self.left = None
self.right = None
self.parent = None
self.height = 1
self.num_left = 1
self.num_total = 1
class AvlTree:
def __init__(self):
self._tree = None
def add(self, k, v):
if not self._tree:
self._tree = TreeNode(k, v)
return
node = self._add(k, v)
if node:
self._rebalance(node)
def _add(self, k, v):
node = self._tree
while node:
if k < node.key:
if node.left:
node = node.left
else:
node.left = TreeNode(k, v)
node.left.parent = node
return node.left
elif node.key < k:
if node.right:
node = node.right
else:
node.right = TreeNode(k, v)
node.right.parent = node
return node.right
else:
node.value = v
return
@staticmethod
def get_height(x):
return x.height if x else 0
@staticmethod
def get_num_total(x):
return x.num_total if x else 0
def _rebalance(self, node):
n = node
while n:
lh = self.get_height(n.left)
rh = self.get_height(n.right)
n.height = max(lh, rh) + 1
balance_factor = lh - rh
n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
n.num_left = 1 + self.get_num_total(n.left)
if balance_factor > 1:
if self.get_height(n.left.left) < self.get_height(n.left.right):
self._rotate_left(n.left)
self._rotate_right(n)
elif balance_factor < -1:
if self.get_height(n.right.right) < self.get_height(n.right.left):
self._rotate_right(n.right)
self._rotate_left(n)
else:
n = n.parent
def _remove_one(self, node):
"""
Side effect!!! Changes node. Node should have exactly one child
"""
replacement = node.left or node.right
if node.parent:
if AvlTree._is_left(node):
node.parent.left = replacement
else:
node.parent.right = replacement
replacement.parent = node.parent
node.parent = None
else:
self._tree = replacement
replacement.parent = None
node.left = None
node.right = None
node.parent = None
self._rebalance(replacement)
def _remove_leaf(self, node):
if node.parent:
if AvlTree._is_left(node):
node.parent.left = None
else:
node.parent.right = None
self._rebalance(node.parent)
else:
self._tree = None
node.parent = None
node.left = None
node.right = None
def remove(self, k):
node = self._get_node(k)
if not node:
return
if AvlTree._is_leaf(node):
self._remove_leaf(node)
return
if node.left and node.right:
nxt = AvlTree._get_next(node)
node.key = nxt.key
node.value = nxt.value
if self._is_leaf(nxt):
self._remove_leaf(nxt)
else:
self._remove_one(nxt)
self._rebalance(node)
else:
self._remove_one(node)
def get(self, k):
node = self._get_node(k)
return node.value if node else -1
def _get_node(self, k):
if not self._tree:
return None
node = self._tree
while node:
if k < node.key:
node = node.left
elif node.key < k:
node = node.right
else:
return node
return None
def get_at(self, pos):
x = pos + 1
node = self._tree
while node:
if x < node.num_left:
node = node.left
elif node.num_left < x:
x -= node.num_left
node = node.right
else:
return (node.key, node.value)
raise IndexError("Out of ranges")
@staticmethod
def _is_left(node):
return node.parent.left and node.parent.left == node
@staticmethod
def _is_leaf(node):
return node.left is None and node.right is None
def _rotate_right(self, node):
if not node.parent:
self._tree = node.left
node.left.parent = None
elif AvlTree._is_left(node):
node.parent.left = node.left
node.left.parent = node.parent
else:
node.parent.right = node.left
node.left.parent = node.parent
bk = node.left.right
node.left.right = node
node.parent = node.left
node.left = bk
if bk:
bk.parent = node
node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
node.num_left = 1 + self.get_num_total(node.left)
def _rotate_left(self, node):
if not node.parent:
self._tree = node.right
node.right.parent = None
elif AvlTree._is_left(node):
node.parent.left = node.right
node.right.parent = node.parent
else:
node.parent.right = node.right
node.right.parent = node.parent
bk = node.right.left
node.right.left = node
node.parent = node.right
node.right = bk
if bk:
bk.parent = node
node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
node.num_left = 1 + self.get_num_total(node.left)
@staticmethod
def _get_next(node):
if not node.right:
return node.parent
n = node.right
while n.left:
n = n.left
return n
class SegmentTree2:
def __init__(self, data, default=3000006, func=lambda a, b: min(a,b)):
"""initialize the segment tree with data"""
self._default = default
self._func = func
self._len = len(data)
self._size = _size = 1 << (self._len - 1).bit_length()
self.data = [default] * (2 * _size)
self.data[_size:_size + self._len] = data
for i in reversed(range(_size)):
self.data[i] = func(self.data[i + i], self.data[i + i + 1])
def __delitem__(self, idx):
self[idx] = self._default
def __getitem__(self, idx):
return self.data[idx + self._size]
def __setitem__(self, idx, value):
idx += self._size
self.data[idx] = value
idx >>= 1
while idx:
self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
idx >>= 1
def __len__(self):
return self._len
def query(self, start, stop):
if start == stop:
return self.__getitem__(start)
stop += 1
start += self._size
stop += self._size
res = self._default
while start < stop:
if start & 1:
res = self._func(res, self.data[start])
start += 1
if stop & 1:
stop -= 1
res = self._func(res, self.data[stop])
start >>= 1
stop >>= 1
return res
def __repr__(self):
return "SegmentTree({0})".format(self.data)
# -----------------------------------------------binary seacrh tree---------------------------------------
class SegmentTree1:
def __init__(self, data, default=-1, func=lambda a, b: max(a , b)):
"""initialize the segment tree with data"""
self._default = default
self._func = func
self._len = len(data)
self._size = _size = 1 << (self._len - 1).bit_length()
self.data = [default] * (2 * _size)
self.data[_size:_size + self._len] = data
for i in reversed(range(_size)):
self.data[i] = func(self.data[i + i], self.data[i + i + 1])
def __delitem__(self, idx):
self[idx] = self._default
def __getitem__(self, idx):
return self.data[idx + self._size]
def __setitem__(self, idx, value):
idx += self._size
self.data[idx] = value
idx >>= 1
while idx:
self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
idx >>= 1
def __len__(self):
return self._len
def query(self, start, stop):
if start == stop:
return self.__getitem__(start)
stop += 1
start += self._size
stop += self._size
res = self._default
while start < stop:
if start & 1:
res = self._func(res, self.data[start])
start += 1
if stop & 1:
stop -= 1
res = self._func(res, self.data[stop])
start >>= 1
stop >>= 1
return res
def __repr__(self):
return "SegmentTree({0})".format(self.data)
# -------------------game starts now----------------------------------------------------import math
class SegmentTree:
def __init__(self, data, default=0, func=lambda a, b:math.gcd(a , b)):
"""initialize the segment tree with data"""
self._default = default
self._func = func
self._len = len(data)
self._size = _size = 1 << (self._len - 1).bit_length()
self.data = [default] * (2 * _size)
self.data[_size:_size + self._len] = data
for i in reversed(range(_size)):
self.data[i] = func(self.data[i + i], self.data[i + i + 1])
def __delitem__(self, idx):
self[idx] = self._default
def __getitem__(self, idx):
return self.data[idx + self._size]
def __setitem__(self, idx, value):
idx += self._size
self.data[idx] = value
idx >>= 1
while idx:
self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
idx >>= 1
def __len__(self):
return self._len
def query(self, start, stop):
if start == stop:
return self.__getitem__(start)
stop += 1
start += self._size
stop += self._size
res = self._default
while start < stop:
if start & 1:
res = self._func(res, self.data[start])
start += 1
if stop & 1:
stop -= 1
res = self._func(res, self.data[stop])
start >>= 1
stop >>= 1
return res
def __repr__(self):
return "SegmentTree({0})".format(self.data)
# -------------------------------iye ha chutiya zindegi-------------------------------------
class Factorial:
def __init__(self, MOD):
self.MOD = MOD
self.factorials = [1, 1]
self.invModulos = [0, 1]
self.invFactorial_ = [1, 1]
def calc(self, n):
if n <= -1:
print("Invalid argument to calculate n!")
print("n must be non-negative value. But the argument was " + str(n))
exit()
if n < len(self.factorials):
return self.factorials[n]
nextArr = [0] * (n + 1 - len(self.factorials))
initialI = len(self.factorials)
prev = self.factorials[-1]
m = self.MOD
for i in range(initialI, n + 1):
prev = nextArr[i - initialI] = prev * i % m
self.factorials += nextArr
return self.factorials[n]
def inv(self, n):
if n <= -1:
print("Invalid argument to calculate n^(-1)")
print("n must be non-negative value. But the argument was " + str(n))
exit()
p = self.MOD
pi = n % p
if pi < len(self.invModulos):
return self.invModulos[pi]
nextArr = [0] * (n + 1 - len(self.invModulos))
initialI = len(self.invModulos)
for i in range(initialI, min(p, n + 1)):
next = -self.invModulos[p % i] * (p // i) % p
self.invModulos.append(next)
return self.invModulos[pi]
def invFactorial(self, n):
if n <= -1:
print("Invalid argument to calculate (n^(-1))!")
print("n must be non-negative value. But the argument was " + str(n))
exit()
if n < len(self.invFactorial_):
return self.invFactorial_[n]
self.inv(n) # To make sure already calculated n^-1
nextArr = [0] * (n + 1 - len(self.invFactorial_))
initialI = len(self.invFactorial_)
prev = self.invFactorial_[-1]
p = self.MOD
for i in range(initialI, n + 1):
prev = nextArr[i - initialI] = (prev * self.invModulos[i % p]) % p
self.invFactorial_ += nextArr
return self.invFactorial_[n]
class Combination:
def __init__(self, MOD):
self.MOD = MOD
self.factorial = Factorial(MOD)
def ncr(self, n, k):
if k < 0 or n < k:
return 0
k = min(k, n - k)
f = self.factorial
return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
# --------------------------------------iye ha combinations ka zindegi---------------------------------
def powm(a, n, m):
if a == 1 or n == 0:
return 1
if n % 2 == 0:
s = powm(a, n // 2, m)
return s * s % m
else:
return a * powm(a, n - 1, m) % m
# --------------------------------------iye ha power ka zindegi---------------------------------
def sort_list(list1, list2):
zipped_pairs = zip(list2, list1)
z = [x for _, x in sorted(zipped_pairs)]
return z
# --------------------------------------------------product----------------------------------------
def product(l):
por = 1
for i in range(len(l)):
por *= l[i]
return por
# --------------------------------------------------binary----------------------------------------
def binarySearchCount(arr, n, key):
left = 0
right = n - 1
count = 0
while (left <= right):
mid = int((right + left) / 2)
# Check if middle element is
# less than or equal to key
if (arr[mid] <key):
count = mid + 1
left = mid + 1
# If key is smaller, ignore right half
else:
right = mid - 1
return count
# --------------------------------------------------binary----------------------------------------
def countdig(n):
c = 0
while (n > 0):
n //= 10
c += 1
return c
def binary(x, length):
y = bin(x)[2:]
return y if len(y) >= length else "0" * (length - len(y)) + y
def countGreater(arr, n, k):
l = 0
r = n - 1
# Stores the index of the left most element
# from the array which is greater than k
leftGreater = n
# Finds number of elements greater than k
while (l <= r):
m = int(l + (r - l) / 2)
if (arr[m] > k):
leftGreater = m
r = m - 1
# If mid element is less than
# or equal to k update l
else:
l = m + 1
# Return the count of elements
# greater than k
return (n - leftGreater)
# --------------------------------------------------binary------------------------------------
class TrieNode:
def __init__(self):
self.children = [None] * 26
self.isEndOfWord = False
class Trie:
def __init__(self):
self.root = self.getNode()
def getNode(self):
return TrieNode()
def _charToIndex(self, ch):
return ord(ch) - ord('a')
def insert(self, key):
pCrawl = self.root
length = len(key)
for level in range(length):
index = self._charToIndex(key[level])
if not pCrawl.children[index]:
pCrawl.children[index] = self.getNode()
pCrawl = pCrawl.children[index]
pCrawl.isEndOfWord = True
def search(self, key):
pCrawl = self.root
length = len(key)
for level in range(length):
index = self._charToIndex(key[level])
if not pCrawl.children[index]:
return False
pCrawl = pCrawl.children[index]
return pCrawl != None and pCrawl.isEndOfWord
#-----------------------------------------trie---------------------------------
class Node:
def __init__(self, data):
self.data = data
self.count=0
self.left = None # left node for 0
self.right = None # right node for 1
class BinaryTrie:
def __init__(self):
self.root = Node(0)
def insert(self, pre_xor):
self.temp = self.root
for i in range(31, -1, -1):
val = pre_xor & (1 << i)
if val:
if not self.temp.right:
self.temp.right = Node(0)
self.temp = self.temp.right
self.temp.count+=1
if not val:
if not self.temp.left:
self.temp.left = Node(0)
self.temp = self.temp.left
self.temp.count += 1
self.temp.data = pre_xor
def query(self, xor):
self.temp = self.root
for i in range(31, -1, -1):
val = xor & (1 << i)
if not val:
if self.temp.left and self.temp.left.count>0:
self.temp = self.temp.left
elif self.temp.right:
self.temp = self.temp.right
else:
if self.temp.right and self.temp.right.count>0:
self.temp = self.temp.right
elif self.temp.left:
self.temp = self.temp.left
self.temp.count-=1
return xor ^ self.temp.data
#-------------------------bin trie-------------------------------------------
n,k=map(int,input().split())
palin=defaultdict(list)
st=defaultdict(list)
end=defaultdict(list)
for i in range(n):
a,b=map(str,input().split())
b=int(b)
a=tuple(a)
rev=a[::-1]
if rev==a:
palin[a].append(b)
else:
st[a].append(b)
end[rev].append(b)
erq=0
for i in st:
st[i].sort(reverse=True)
end[i].sort(reverse=True)
tot=0
fi=0
for j in range(min(len(st[i]),len(end[i]))):
tot+=st[i][j]+end[i][j]
fi=max(fi,tot)
erq+=fi
erq//=2
we=0
ert=defaultdict(int)
ert1=defaultdict(int)
for i in palin:
palin[i].sort(reverse=True)
er=0
for j in range(0,len(palin[i])-1,2):
er+=palin[i][j]+palin[i][j+1]
ert[i]=max(ert[i],er)
er=0
for j in range(1,len(palin[i])-1,2):
er+=palin[i][j]+palin[i][j+1]
ert1[i]=max(ert1[i],er)
we+=ert[i]
ans=erq
ans=max(ans,erq+we)
for i in ert:
ans=max(erq+we-ert[i]+ert1[i]+palin[i][0],ans)
print(ans)
```
| 46,743
|
[
0.2135009765625,
-0.04345703125,
0.030670166015625,
0.09521484375,
-0.37060546875,
-0.70263671875,
0.144775390625,
0.349365234375,
0.007656097412109375,
0.75634765625,
0.9130859375,
-0.038482666015625,
0.055389404296875,
-0.87939453125,
-0.6318359375,
-0.36083984375,
-0.5322265625,
-0.8173828125,
-0.5126953125,
-0.2127685546875,
-0.037567138671875,
-0.083984375,
-1.50390625,
-0.11761474609375,
-0.2437744140625,
1.185546875,
0.44873046875,
0.4189453125,
1.1474609375,
1.376953125,
-0.315673828125,
-0.385498046875,
0.7421875,
-1.0859375,
-0.1995849609375,
-0.26953125,
0.385498046875,
-0.57275390625,
-0.3134765625,
-0.371826171875,
0.1146240234375,
-0.423583984375,
0.325927734375,
-0.9345703125,
-1.1923828125,
-0.06439208984375,
-0.437255859375,
-0.56201171875,
-0.458740234375,
-0.93798828125,
0.216796875,
-0.388427734375,
0.401611328125,
0.0213165283203125,
0.429931640625,
0.0020847320556640625,
-0.0177764892578125,
-0.32763671875,
-0.61962890625,
0.48681640625,
0.287109375,
0.2230224609375,
-0.11456298828125,
-0.67431640625,
-0.254638671875,
0.45556640625,
-0.0229949951171875,
-0.33740234375,
0.024658203125,
-0.8095703125,
-0.373291015625,
0.2366943359375,
-0.243408203125,
-0.3779296875,
-0.05810546875,
-0.01265716552734375,
0.1759033203125,
0.2666015625,
-0.48681640625,
0.673828125,
0.0369873046875,
0.72509765625,
-0.212158203125,
0.53271484375,
-0.29638671875,
-0.90771484375,
0.140380859375,
0.25244140625,
0.043243408203125,
-0.01280975341796875,
-0.57568359375,
0.357666015625,
-0.58056640625,
0.33740234375,
0.352783203125,
0.7763671875,
-0.2421875,
0.35302734375,
-0.09814453125,
0.366943359375,
0.74365234375,
0.84716796875,
-0.57177734375,
1.0146484375,
-0.6103515625,
-0.13330078125,
-0.1793212890625,
0.36328125,
0.0022830963134765625,
-0.468505859375,
-0.07568359375,
-0.34521484375,
0.759765625,
0.406005859375,
-0.0352783203125,
0.77392578125,
-0.09326171875,
0.466552734375,
-0.92529296875,
0.0615234375,
0.3359375,
0.1341552734375,
0.63623046875,
-0.1571044921875,
0.30712890625,
-0.227294921875,
-0.35791015625,
1.27734375,
-0.61572265625,
-0.2252197265625,
0.465087890625,
0.065673828125,
0.1187744140625,
0.34814453125,
0.043609619140625,
0.16259765625,
-0.35498046875,
0.48095703125,
0.7880859375,
-0.56787109375,
0.68115234375,
-0.221923828125,
-0.1915283203125,
1.6796875,
0.445068359375,
0.252685546875,
0.91162109375,
0.348388671875,
-0.80078125,
0.265625,
-0.61572265625,
0.66259765625,
0.139404296875,
0.10369873046875,
0.12030029296875,
0.60595703125,
-0.22412109375,
0.045989990234375,
-0.017425537109375,
0.0253143310546875,
-0.483642578125,
0.380859375,
-0.399169921875,
0.82568359375,
-0.217041015625,
0.69482421875,
-0.3935546875,
-0.38671875,
-0.0400390625,
-0.4443359375,
-0.1947021484375,
-0.1436767578125,
-0.305419921875,
0.798828125,
0.68115234375,
1.2099609375,
0.95166015625,
-0.51123046875,
0.304443359375,
0.002918243408203125,
-0.44677734375,
0.63671875,
0.6318359375,
0.8740234375,
0.1812744140625,
-0.050537109375,
0.0235137939453125,
-0.26611328125,
-0.69189453125,
-0.80810546875,
-0.1966552734375,
0.332275390625,
-0.37890625,
0.11492919921875,
0.0161895751953125,
0.1649169921875,
-0.89208984375,
-0.40380859375,
-0.11798095703125,
-1.0146484375,
-0.7001953125,
0.6748046875,
-0.300537109375,
0.71240234375,
-0.427490234375,
-0.62451171875,
0.30126953125,
1.3154296875,
-0.035858154296875,
0.11627197265625,
0.37548828125,
0.060791015625,
-0.1405029296875,
-0.0015392303466796875,
-0.1387939453125,
-0.13525390625,
-0.44580078125,
0.7998046875,
0.050018310546875,
0.062164306640625,
0.0160675048828125,
0.99951171875,
0.0823974609375,
0.26611328125,
-0.44873046875,
0.1256103515625,
0.40966796875,
0.66796875,
-0.1407470703125,
0.183349609375,
-0.182373046875,
1.0126953125,
0.40625,
0.410888671875,
0.313232421875,
-0.01149749755859375,
0.37841796875,
0.47802734375,
0.11138916015625,
0.2369384765625,
0.2308349609375,
0.1981201171875,
0.294677734375,
0.016357421875,
0.26318359375,
0.7451171875,
-0.042205810546875,
0.0309295654296875,
-0.44140625,
0.76025390625,
-0.308349609375,
0.95751953125,
0.499267578125,
0.245849609375,
-0.58203125,
0.063232421875,
0.53515625,
0.65380859375,
-0.388671875,
-0.63134765625,
-0.388671875,
0.209716796875,
0.134521484375,
-0.037139892578125,
-0.1429443359375,
0.62939453125,
0.415283203125,
0.336181640625,
-0.1884765625,
-0.485107421875,
-0.9609375,
-0.986328125,
-0.87158203125,
-0.50634765625,
-0.346923828125,
-0.1884765625,
0.56591796875,
-0.76171875,
0.313232421875,
-0.3466796875,
-0.2470703125,
0.06195068359375,
-0.6982421875,
0.1502685546875,
-0.2137451171875,
0.71484375,
-0.9638671875,
0.53369140625,
0.196533203125,
1.0166015625,
-0.2406005859375,
-0.006954193115234375,
-0.0208740234375,
-0.47216796875,
0.2061767578125,
-0.09527587890625,
0.12298583984375,
-0.234375,
-0.5224609375,
-1.1005859375,
-0.30029296875,
-0.259521484375,
-0.1640625,
0.1541748046875,
-0.364990234375,
0.53955078125,
0.54150390625,
-0.392822265625,
0.7646484375,
0.90625,
-0.8173828125,
0.2257080078125,
0.52099609375,
0.3173828125,
-0.67041015625,
1.26171875,
0.54931640625,
0.595703125,
-0.6259765625,
-0.32568359375,
-0.55029296875,
0.401611328125,
-0.2457275390625,
-0.5556640625,
-0.337646484375,
0.85693359375,
0.006023406982421875,
-0.92041015625,
0.33740234375,
-0.62109375,
-0.67724609375,
-0.259765625,
-0.4873046875,
0.95703125,
0.90087890625,
0.30029296875,
-0.1898193359375,
-0.354248046875,
-0.2242431640625,
0.52685546875,
0.337158203125,
-0.10052490234375,
-0.394287109375,
0.59716796875,
-0.2415771484375,
0.07794189453125,
0.463623046875,
-0.246826171875,
0.0872802734375,
0.38525390625,
0.0650634765625,
0.6162109375,
0.5771484375,
0.006664276123046875,
0.1558837890625,
1.0869140625,
-0.9951171875,
-0.48291015625,
-0.028350830078125,
0.51611328125,
-0.07183837890625,
0.339111328125,
0.501953125,
-0.267822265625,
-0.3212890625,
-1.1279296875,
0.49658203125,
0.21044921875,
0.802734375,
-0.64501953125,
0.73779296875,
0.333740234375,
-0.69775390625,
0.8876953125,
-0.71630859375,
-0.255615234375,
1.03125,
-0.23583984375,
0.324951171875,
-0.62939453125,
0.375,
-0.240478515625,
-0.0213165283203125,
0.64453125,
0.257080078125,
0.86572265625,
-0.56201171875,
-0.86865234375,
-0.29931640625,
-0.1275634765625,
-0.03521728515625,
-0.49169921875,
-0.0743408203125,
-0.56591796875,
-0.41015625,
-0.830078125,
0.401611328125,
-0.00846099853515625,
0.2841796875,
0.12176513671875,
0.03826904296875,
0.311279296875,
0.6103515625,
0.48828125,
-0.286865234375,
0.211181640625,
-0.66357421875,
0.8466796875,
0.095703125,
-0.488525390625,
-0.61572265625,
-0.038848876953125,
-0.439697265625,
-0.187744140625,
0.4140625,
-0.388916015625,
-1.1591796875,
0.1573486328125,
-0.3525390625,
0.68798828125,
-0.08807373046875,
-0.060272216796875,
-0.31884765625,
0.56005859375,
0.305419921875,
-1.1640625,
-0.252197265625,
-0.4794921875,
0.66259765625,
0.33154296875,
-0.048736572265625,
-0.39892578125,
-0.387451171875,
-1.1630859375,
-0.8671875,
-0.0445556640625,
1.3310546875,
-0.10577392578125,
0.267333984375,
-1.26171875,
0.7890625,
0.6640625,
-0.269287109375,
0.03485107421875,
0.18408203125,
0.305419921875,
-0.06256103515625,
0.771484375,
-0.393310546875,
-0.875,
-0.05645751953125,
-1.2138671875,
0.353759765625,
-0.33837890625,
0.2822265625,
-0.11309814453125,
-0.224365234375,
-0.192626953125,
0.626953125,
-0.09283447265625,
0.3984375,
-0.04400634765625,
0.54345703125,
-1.0517578125,
-0.7158203125,
0.2337646484375,
-0.2169189453125,
-0.2080078125,
1.19140625,
-0.268798828125,
-0.493408203125,
-0.050140380859375,
0.7177734375,
-0.65478515625,
0.397705078125,
-0.4462890625,
0.51806640625,
-0.1253662109375,
-0.45751953125,
-0.369873046875,
-0.31103515625,
0.76806640625,
0.05511474609375,
-1.2001953125,
-0.04864501953125,
-1.1435546875,
-0.27685546875,
-0.166259765625,
-0.71142578125,
0.018341064453125,
0.27978515625,
-0.1597900390625,
-0.08709716796875,
-0.3896484375,
-0.347900390625,
-0.399658203125,
-0.5498046875,
-0.380126953125,
0.8623046875,
0.0018520355224609375,
0.72509765625,
0.2396240234375,
-0.388916015625,
0.0156402587890625,
-0.0166473388671875,
-0.1845703125,
-0.6279296875,
-0.0036296844482421875,
-0.366943359375,
-0.58935546875,
-0.221435546875,
0.152587890625,
0.1820068359375,
0.1771240234375,
0.79931640625,
-0.052093505859375,
0.406494140625,
0.246337890625,
-0.27978515625,
1.1416015625,
0.376708984375,
-1.26953125,
-0.049774169921875,
0.60107421875,
-0.2308349609375,
0.72216796875,
0.1390380859375,
-0.80224609375,
-0.65869140625,
-0.97900390625,
0.03338623046875,
-0.71044921875,
-0.1783447265625,
-1.2177734375,
-0.0543212890625,
-0.274169921875,
0.884765625,
-0.1519775390625,
-0.50927734375,
0.28466796875,
-1.2392578125,
-0.032135009765625,
-1.1591796875,
-0.24072265625,
-0.74462890625,
-0.07940673828125,
-0.26904296875,
1.0205078125,
-0.1842041015625,
0.3583984375,
0.379150390625,
-0.28271484375,
0.2457275390625,
0.203369140625,
-0.5439453125,
-0.11895751953125,
-0.288818359375,
0.077880859375,
0.219970703125,
0.054443359375,
-0.67724609375,
0.5732421875,
-0.9833984375,
0.283935546875,
-0.23046875,
-0.5888671875,
-0.387939453125,
-0.207763671875,
0.9912109375,
-0.7060546875,
-0.1168212890625,
-0.74755859375,
0.160888671875,
1.2041015625,
0.008026123046875,
-0.414306640625,
-0.47314453125,
-0.52783203125,
-1.056640625,
0.51904296875,
-0.431396484375,
0.10687255859375,
-1.0546875,
-0.413818359375,
1.00390625,
-0.1441650390625,
0.282958984375,
1.1279296875,
0.30712890625,
0.46044921875,
-0.7001953125,
0.67919921875,
0.603515625,
-0.1494140625,
-0.188232421875,
0.2734375,
-0.94580078125,
0.1207275390625,
0.0537109375,
-1.1025390625,
-0.73193359375,
0.1968994140625,
1.2626953125,
-0.38671875,
0.5966796875,
-0.0909423828125,
-1.3759765625,
-0.52978515625,
1.19140625,
0.16162109375,
-0.2548828125,
1.1318359375,
-0.01366424560546875,
-0.1929931640625,
-0.1383056640625,
-0.06585693359375,
-0.330322265625,
-0.280029296875,
1.1962890625,
-0.1563720703125,
-0.79052734375,
1.0537109375,
0.81640625,
-1.0849609375,
-1.0234375,
-0.1480712890625,
0.0291290283203125,
-0.021697998046875,
-0.480712890625,
0.1180419921875,
0.67138671875,
-0.58642578125,
-0.09820556640625,
0.43603515625,
0.16162109375,
0.560546875,
0.3916015625,
0.3564453125,
-0.6220703125,
0.68701171875,
0.94189453125,
-0.55322265625,
-0.63720703125,
-1.2021484375,
-0.375,
-0.284423828125,
0.061187744140625,
1,
-0.35888671875,
0.63330078125,
0.43603515625,
0.155517578125,
0.70458984375,
-0.411376953125,
-0.5546875,
0.5966796875,
-0.6357421875,
-0.46533203125,
-0.075927734375,
0.481201171875,
-0.479736328125,
0.654296875,
-0.68408203125,
-0.057464599609375,
0.169921875,
0.1326904296875,
-0.52587890625,
-0.37060546875,
-0.307373046875,
-1.05078125,
-0.6748046875,
-0.79296875,
-0.9140625,
-0.0121307373046875,
0.104736328125,
0.048980712890625,
-0.7255859375,
0.294921875,
0.68994140625,
-0.66015625,
0.85888671875,
-0.80078125,
0.333251953125,
-0.3720703125,
-0.2939453125,
-0.282958984375,
-0.11712646484375,
-0.421875,
-0.017425537109375,
-0.7421875,
0.052337646484375,
-0.0687255859375,
0.72265625,
0.09832763671875,
0.322265625,
-0.438232421875,
-0.0865478515625,
0.1541748046875,
0.11297607421875,
0.316162109375,
0.71435546875,
0.8427734375,
-0.2147216796875,
0.2242431640625,
0.0194854736328125,
-0.24658203125,
-0.288818359375,
0.4404296875,
0.4599609375,
-0.3388671875,
0.1083984375,
-0.416015625,
0.34326171875,
-1.3984375,
0.267578125,
-0.1383056640625,
0.52587890625,
0.42333984375,
-0.0863037109375,
0.391845703125,
0.83349609375,
-0.32568359375,
0.27099609375,
0.00492095947265625,
0.170654296875,
0.223388671875,
-0.033355712890625,
0.016021728515625,
0.8583984375,
0.365234375,
-0.74658203125,
0.09814453125,
0.006801605224609375,
0.1649169921875,
0.257568359375,
-0.237060546875,
-0.822265625,
-1.0908203125,
-0.4658203125,
0.07568359375,
0.4873046875,
0.55078125,
-0.55810546875,
0.09722900390625,
0.11053466796875,
-0.52734375,
0.1990966796875,
-1.0068359375,
-1.166015625,
0.04534912109375,
-0.0211639404296875,
-0.2958984375,
-0.2484130859375,
-0.30078125,
-0.063720703125,
0.162841796875,
0.54736328125,
-0.59619140625,
0.400390625,
-0.54345703125,
0.55859375,
0.0048828125,
0.04638671875,
0.0528564453125,
0.6064453125,
-0.473876953125,
-0.60107421875,
-0.12261962890625,
0.92041015625,
0.29736328125,
-0.008941650390625,
-0.397216796875,
0.338623046875,
-0.05914306640625,
0.2724609375,
-0.85009765625,
0.228759765625,
-0.20166015625,
0.708984375,
-0.60986328125,
-0.03826904296875,
0.11883544921875,
0.431396484375,
0.341552734375,
-0.430908203125,
-0.57373046875,
0.80126953125,
0.5693359375,
-0.10498046875,
0.79443359375,
0.416748046875,
0.779296875,
-0.026275634765625,
-0.340576171875,
-0.43115234375,
0.66162109375,
0.80078125,
0.51171875,
-0.0231475830078125,
0.2252197265625,
0.97607421875,
-0.04364013671875,
-0.302978515625,
0.1998291015625,
0.061737060546875,
-0.31591796875,
0.1556396484375,
-0.2021484375,
0.10040283203125,
0.195068359375,
-0.245849609375,
0.450439453125,
-0.385498046875,
-0.05670166015625,
-0.29443359375,
-0.70654296875,
0.6376953125,
-0.234130859375,
-0.236572265625,
-0.1456298828125,
-0.120849609375,
0.67138671875,
0.391357421875,
0.1771240234375,
0.1971435546875,
1.1787109375,
0.95166015625,
0.427001953125,
0.61279296875,
0.192626953125,
0.130615234375,
-0.465087890625,
0.2012939453125,
0.2144775390625,
-0.1611328125,
-0.43505859375,
-0.55029296875,
-1.0869140625,
0.7587890625,
-0.164794921875,
-0.6611328125,
0.400390625,
-0.5029296875,
0.1695556640625,
-0.457275390625,
0.9912109375,
-0.302978515625,
0.07818603515625,
0.45068359375,
-0.2470703125,
-0.47021484375,
0.9580078125,
-0.427978515625,
0.04071044921875,
0.1917724609375,
0.91943359375,
0.037933349609375,
1.4560546875,
0.9736328125,
-0.098876953125,
0.00525665283203125,
0.1724853515625,
-0.197021484375,
-0.462890625,
-0.2890625,
-0.1297607421875,
0.046875,
-0.697265625,
-0.328857421875,
-0.48828125,
0.71630859375,
0.07244873046875,
-0.81640625,
-0.361328125,
0.205078125,
-0.6845703125,
0.1705322265625,
-0.046051025390625,
0.06451416015625,
-0.1295166015625,
0.323486328125,
-0.335205078125,
-0.396728515625,
0.55078125,
-0.487060546875,
0.295654296875,
-0.451171875,
-0.59375,
-0.56103515625,
-0.74609375,
-0.404052734375,
-0.31787109375,
-0.144775390625,
-0.89892578125,
0.55224609375,
0.53955078125,
0.385986328125,
0.77587890625,
-0.31396484375,
0.217041015625,
0.56005859375,
1.0546875,
0.1351318359375,
0.71826171875,
0.20556640625,
-0.450439453125,
0.01316070556640625,
-0.30126953125,
0.54443359375,
0.178955078125,
0.2177734375,
-0.681640625,
0.3603515625,
-0.61962890625,
-1.2119140625,
-0.0831298828125,
0.73828125,
0.73828125,
-0.83203125,
-1.2080078125,
-0.315185546875,
-1.2392578125,
-0.200439453125,
-0.7392578125,
0.7421875,
-0.0772705078125,
0.1903076171875,
-0.2330322265625,
-1.19140625,
4.30859375,
0.9560546875,
0.99951171875,
0.374755859375,
0.7001953125,
1.1669921875,
0.389892578125,
-0.5888671875,
-0.219970703125,
-0.279541015625,
0.763671875,
-0.57470703125,
0.224365234375,
0.90869140625,
0.6025390625,
0.69580078125,
-0.72607421875,
0.0838623046875,
0.110595703125,
-0.99267578125,
-0.775390625,
0.194580078125,
0.2047119140625,
0.2015380859375,
0.044464111328125,
0.2059326171875,
0.5419921875,
-0.6279296875,
-0.64404296875,
-0.56494140625,
0.0300445556640625,
-0.6962890625,
0.525390625,
-0.04736328125,
-0.2149658203125,
0.86083984375,
0.0276336669921875,
-0.43017578125,
-0.236083984375,
0.1920166015625,
0.161376953125,
-0.1744384765625,
0.3662109375,
-0.892578125,
-0.367431640625,
0.00897216796875,
-0.705078125,
0.42529296875,
-0.394287109375,
-0.84326171875,
1.0673828125,
-0.0548095703125,
0.344970703125,
-0.34619140625,
-0.9921875,
0.2479248046875,
-0.061859130859375,
-0.1519775390625,
-0.18505859375,
0.544921875,
0.065185546875,
0.6904296875,
-0.05059814453125,
0.638671875,
-1.1083984375,
1.0009765625,
-0.5078125,
0.5263671875,
-0.880859375,
-0.03466796875,
-0.076416015625,
-0.052734375,
-0.3505859375,
-0.310791015625,
0.474609375,
0.61767578125,
-0.2078857421875,
0.8408203125,
0.49658203125,
-0.5166015625,
0.058807373046875,
0.021331787109375,
-0.427978515625,
-0.368896484375,
0.8173828125,
1.166015625,
-0.6611328125,
-0.1846923828125,
-0.233642578125,
0.7666015625,
0.259765625,
0.56591796875,
0.01197052001953125,
-0.662109375,
-0.407470703125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Santa Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them presented to him a string si having the same length n. We denote the beauty of the i-th string by ai. It can happen that ai is negative — that means that Santa doesn't find this string beautiful at all.
Santa Claus is crazy about palindromes. He is thinking about the following question: what is the maximum possible total beauty of a palindrome which can be obtained by concatenating some (possibly all) of the strings he has? Each present can be used at most once. Note that all strings have the same length n.
Recall that a palindrome is a string that doesn't change after one reverses it.
Since the empty string is a palindrome too, the answer can't be negative. Even if all ai's are negative, Santa can obtain the empty string.
Input
The first line contains two positive integers k and n divided by space and denoting the number of Santa friends and the length of every string they've presented, respectively (1 ≤ k, n ≤ 100 000; n·k ≤ 100 000).
k lines follow. The i-th of them contains the string si and its beauty ai ( - 10 000 ≤ ai ≤ 10 000). The string consists of n lowercase English letters, and its beauty is integer. Some of strings may coincide. Also, equal strings can have different beauties.
Output
In the only line print the required maximum possible beauty.
Examples
Input
7 3
abb 2
aaa -3
bba -1
zyz -4
abb 5
aaa 7
xyx 4
Output
12
Input
3 1
a 1
a 2
a 3
Output
6
Input
2 5
abcde 10000
abcde 10000
Output
0
Note
In the first example Santa can obtain abbaaaxyxaaabba by concatenating strings 5, 2, 7, 6 and 3 (in this order).
Submitted Solution:
```
k, n = map(int, input().split())
nice_of_center = 0
res = 0
nice = dict()
for i in range(k):
s, r = input().split()
if s in nice:
nice[s].append(int(r))
else:
nice[s] = [int(r)]
for s in nice.keys():
nice[s].sort()
i = 0
strings = list(nice.keys())
l = len(strings)
s = strings[i]
_s = s[::-1]
while i < l:
if s not in nice or not nice[s]:
i += 1
if i < l:
s = strings[i]
_s = s[::-1]
continue
if _s not in nice:
if s == _s:
nice_of_center = max(nice_of_center, nice[s].pop())
if not nice[s]:
del nice[s]
else:
del nice[s]
else:
if s == _s:
if len(nice[s]) == 1:
nice_of_center = max(nice_of_center, nice[s].pop())
del nice[s]
else:
nn = nice[s][-1] + nice[s][-2]
if nn > 0:
if nn > nice[s][-1] - nice_of_center:
res += nice[s].pop()
res += nice[s].pop()
if not nice[s]:
del nice[s]
else:
nice_of_center = max(nice_of_center, nice[s].pop())
else:
nice_of_center = max(nice_of_center, nice[s].pop())
del nice[s]
else:
nn = nice[s][-1] + nice[_s][-1]
if nn >= 0:
res += nice[s].pop()
res += nice[_s].pop()
if not nice[s]:
del nice[s]
if not nice[_s]:
del nice[_s]
else:
del nice[s]
del nice[_s]
print(res + nice_of_center)
```
No
| 46,746
|
[
0.251220703125,
-0.0189208984375,
0.0062103271484375,
0.021209716796875,
-0.443359375,
-0.6083984375,
0.1666259765625,
0.3603515625,
0.021636962890625,
0.73291015625,
0.8388671875,
-0.0189056396484375,
0.0019817352294921875,
-0.904296875,
-0.56494140625,
-0.404296875,
-0.53759765625,
-0.78515625,
-0.49169921875,
-0.298828125,
-0.1234130859375,
-0.1427001953125,
-1.4853515625,
-0.09112548828125,
-0.2496337890625,
1.0927734375,
0.388427734375,
0.37060546875,
1.123046875,
1.27734375,
-0.31884765625,
-0.474609375,
0.73779296875,
-1.013671875,
-0.068115234375,
-0.218505859375,
0.419921875,
-0.609375,
-0.3056640625,
-0.48486328125,
0.056304931640625,
-0.285888671875,
0.344482421875,
-0.8447265625,
-1.1875,
-0.08251953125,
-0.435546875,
-0.57568359375,
-0.40380859375,
-0.921875,
0.2298583984375,
-0.39111328125,
0.407470703125,
-0.07781982421875,
0.486328125,
0.1009521484375,
-0.04931640625,
-0.27587890625,
-0.638671875,
0.387939453125,
0.353759765625,
0.31640625,
-0.1751708984375,
-0.63427734375,
-0.35791015625,
0.51025390625,
0.06982421875,
-0.34912109375,
-0.001605987548828125,
-0.66162109375,
-0.285888671875,
0.2484130859375,
-0.321044921875,
-0.2763671875,
-0.09130859375,
-0.0628662109375,
0.1307373046875,
0.235595703125,
-0.5830078125,
0.7138671875,
0.00969696044921875,
0.783203125,
-0.11688232421875,
0.572265625,
-0.29345703125,
-0.86572265625,
0.174560546875,
0.205078125,
0.1488037109375,
-0.061187744140625,
-0.419921875,
0.349853515625,
-0.57861328125,
0.319091796875,
0.388671875,
0.67431640625,
-0.222900390625,
0.241943359375,
-0.06939697265625,
0.4111328125,
0.8203125,
0.77587890625,
-0.54736328125,
1.08203125,
-0.58740234375,
-0.1453857421875,
-0.1632080078125,
0.2318115234375,
-0.0452880859375,
-0.493896484375,
-0.0682373046875,
-0.3603515625,
0.7802734375,
0.4052734375,
-0.08477783203125,
0.70947265625,
-0.0213775634765625,
0.48974609375,
-0.8564453125,
0.0284271240234375,
0.3212890625,
0.096435546875,
0.61279296875,
-0.137939453125,
0.335205078125,
-0.1273193359375,
-0.44384765625,
1.2177734375,
-0.55322265625,
-0.1964111328125,
0.5244140625,
0.0226287841796875,
0.06787109375,
0.317138671875,
-0.0284271240234375,
0.1851806640625,
-0.309326171875,
0.44091796875,
0.814453125,
-0.66552734375,
0.6630859375,
-0.197021484375,
-0.1800537109375,
1.69921875,
0.427978515625,
0.1456298828125,
0.8173828125,
0.436279296875,
-0.81494140625,
0.267578125,
-0.60888671875,
0.67138671875,
0.07220458984375,
0.0572509765625,
-0.0458984375,
0.5419921875,
-0.16845703125,
0.05499267578125,
0.07843017578125,
0.0140380859375,
-0.464599609375,
0.474609375,
-0.423095703125,
0.7431640625,
-0.2305908203125,
0.59619140625,
-0.380615234375,
-0.46240234375,
-0.031524658203125,
-0.39990234375,
-0.188232421875,
-0.11322021484375,
-0.1529541015625,
0.8408203125,
0.7431640625,
1.1689453125,
1.0087890625,
-0.484375,
0.23974609375,
0.05877685546875,
-0.49462890625,
0.6015625,
0.6298828125,
0.9111328125,
0.240478515625,
0.002872467041015625,
0.002872467041015625,
-0.1492919921875,
-0.5986328125,
-0.796875,
-0.20263671875,
0.485107421875,
-0.400146484375,
0.1083984375,
-0.1444091796875,
0.2264404296875,
-0.74267578125,
-0.41455078125,
-0.10076904296875,
-1.0908203125,
-0.74267578125,
0.6318359375,
-0.296142578125,
0.70947265625,
-0.44921875,
-0.69384765625,
0.40478515625,
1.296875,
0.01213836669921875,
0.1907958984375,
0.46923828125,
0.109375,
-0.261962890625,
-0.055328369140625,
-0.064453125,
-0.13525390625,
-0.474853515625,
0.75341796875,
0.057403564453125,
0.08526611328125,
-0.0242919921875,
0.94970703125,
0.0928955078125,
0.28369140625,
-0.51708984375,
0.06781005859375,
0.350830078125,
0.7109375,
-0.1595458984375,
0.2281494140625,
-0.1480712890625,
1.01171875,
0.387939453125,
0.451416015625,
0.32421875,
-0.00848388671875,
0.431640625,
0.40869140625,
0.01898193359375,
0.2401123046875,
0.2127685546875,
0.28125,
0.2333984375,
0.10809326171875,
0.279296875,
0.75927734375,
-0.12042236328125,
0.0290374755859375,
-0.448974609375,
0.75341796875,
-0.324462890625,
0.85205078125,
0.51416015625,
0.36279296875,
-0.58642578125,
0.00376129150390625,
0.54345703125,
0.65380859375,
-0.5126953125,
-0.66650390625,
-0.36181640625,
0.2105712890625,
0.0841064453125,
-0.0211639404296875,
-0.220947265625,
0.54248046875,
0.346923828125,
0.374267578125,
-0.22802734375,
-0.4794921875,
-0.92138671875,
-0.92236328125,
-0.9296875,
-0.4619140625,
-0.461181640625,
-0.213623046875,
0.5234375,
-0.78662109375,
0.428955078125,
-0.42431640625,
-0.1676025390625,
0.028106689453125,
-0.6572265625,
0.3115234375,
-0.2403564453125,
0.748046875,
-0.853515625,
0.48583984375,
0.329833984375,
0.99365234375,
-0.356689453125,
0.0008587837219238281,
-0.030792236328125,
-0.427490234375,
0.223876953125,
-0.14697265625,
0.180908203125,
-0.144775390625,
-0.53564453125,
-1.080078125,
-0.261474609375,
-0.1641845703125,
-0.2010498046875,
0.173583984375,
-0.348388671875,
0.56005859375,
0.4404296875,
-0.5048828125,
0.68115234375,
0.84423828125,
-0.83740234375,
0.2490234375,
0.5068359375,
0.32470703125,
-0.669921875,
1.291015625,
0.57080078125,
0.64111328125,
-0.58740234375,
-0.286865234375,
-0.517578125,
0.30859375,
-0.2291259765625,
-0.59130859375,
-0.462890625,
0.802734375,
-0.0311431884765625,
-0.89892578125,
0.392333984375,
-0.689453125,
-0.54345703125,
-0.244873046875,
-0.60009765625,
0.9814453125,
0.927734375,
0.305419921875,
-0.11517333984375,
-0.40625,
-0.1890869140625,
0.5888671875,
0.39208984375,
-0.182373046875,
-0.385986328125,
0.5810546875,
-0.2459716796875,
0.09844970703125,
0.403076171875,
-0.316162109375,
0.037628173828125,
0.30908203125,
-0.029266357421875,
0.61474609375,
0.5537109375,
0.0567626953125,
0.10064697265625,
1.0908203125,
-0.99560546875,
-0.467041015625,
-0.0943603515625,
0.51513671875,
-0.0633544921875,
0.31298828125,
0.57421875,
-0.13720703125,
-0.3779296875,
-1.0029296875,
0.525390625,
0.13671875,
0.7021484375,
-0.607421875,
0.69775390625,
0.291748046875,
-0.7265625,
0.92578125,
-0.7314453125,
-0.162353515625,
1.0654296875,
-0.1680908203125,
0.33837890625,
-0.63232421875,
0.379150390625,
-0.3310546875,
-0.1666259765625,
0.53759765625,
0.163818359375,
0.83740234375,
-0.53076171875,
-0.75634765625,
-0.2349853515625,
-0.180908203125,
-0.06463623046875,
-0.5068359375,
-0.108642578125,
-0.5126953125,
-0.4990234375,
-0.81982421875,
0.484375,
0.01206207275390625,
0.35107421875,
0.16259765625,
0.045928955078125,
0.352783203125,
0.57080078125,
0.481689453125,
-0.3671875,
0.1851806640625,
-0.642578125,
0.8662109375,
0.1253662109375,
-0.517578125,
-0.59130859375,
-0.05322265625,
-0.387939453125,
-0.1494140625,
0.44384765625,
-0.292236328125,
-1.193359375,
0.1962890625,
-0.242431640625,
0.6953125,
-0.16357421875,
-0.062042236328125,
-0.281005859375,
0.52099609375,
0.2587890625,
-1.1953125,
-0.18896484375,
-0.464111328125,
0.50048828125,
0.313232421875,
-0.09503173828125,
-0.3564453125,
-0.323486328125,
-1.1279296875,
-0.91943359375,
-0.07708740234375,
1.4013671875,
-0.094970703125,
0.24658203125,
-1.3466796875,
0.74951171875,
0.75146484375,
-0.29150390625,
0.11029052734375,
0.034454345703125,
0.33154296875,
-0.07373046875,
0.79345703125,
-0.39013671875,
-0.91455078125,
0.0279388427734375,
-1.177734375,
0.34619140625,
-0.35107421875,
0.28759765625,
-0.1102294921875,
-0.256591796875,
-0.17431640625,
0.64111328125,
-0.0186004638671875,
0.353759765625,
0.002227783203125,
0.54150390625,
-1.0869140625,
-0.7470703125,
0.2452392578125,
-0.1529541015625,
-0.24609375,
1.0947265625,
-0.260986328125,
-0.54931640625,
0.0302734375,
0.60205078125,
-0.6025390625,
0.427001953125,
-0.3955078125,
0.53857421875,
-0.10546875,
-0.459716796875,
-0.369384765625,
-0.37939453125,
0.7841796875,
-0.01251983642578125,
-1.1513671875,
-0.11749267578125,
-1.19140625,
-0.2105712890625,
-0.1630859375,
-0.72119140625,
0.004833221435546875,
0.343017578125,
-0.088134765625,
-0.132080078125,
-0.433349609375,
-0.392578125,
-0.35107421875,
-0.57373046875,
-0.42529296875,
0.802734375,
-0.03033447265625,
0.669921875,
0.2296142578125,
-0.44091796875,
-0.015869140625,
-0.078369140625,
-0.09429931640625,
-0.615234375,
-0.03863525390625,
-0.31982421875,
-0.6171875,
-0.257080078125,
0.28662109375,
0.120849609375,
0.11358642578125,
0.77392578125,
-0.10711669921875,
0.46435546875,
0.282958984375,
-0.39306640625,
1.1494140625,
0.345458984375,
-1.3671875,
0.009124755859375,
0.609375,
-0.18017578125,
0.73388671875,
0.056793212890625,
-0.7568359375,
-0.69970703125,
-1.0380859375,
0.1182861328125,
-0.7294921875,
-0.209716796875,
-1.203125,
-0.03564453125,
-0.2998046875,
0.869140625,
-0.2161865234375,
-0.54443359375,
0.239013671875,
-1.171875,
0.02862548828125,
-1.1611328125,
-0.1734619140625,
-0.734375,
-0.0704345703125,
-0.313720703125,
1.03515625,
-0.150634765625,
0.439208984375,
0.288330078125,
-0.31201171875,
0.2125244140625,
0.228271484375,
-0.505859375,
-0.21533203125,
-0.28955078125,
-0.0335693359375,
0.1434326171875,
0.08441162109375,
-0.62939453125,
0.53955078125,
-0.96875,
0.300537109375,
-0.26708984375,
-0.52685546875,
-0.365234375,
-0.1732177734375,
0.9365234375,
-0.6787109375,
-0.11920166015625,
-0.77978515625,
0.2890625,
1.2333984375,
0.016571044921875,
-0.374267578125,
-0.53271484375,
-0.454345703125,
-1.0732421875,
0.463134765625,
-0.41796875,
0.0772705078125,
-1.0068359375,
-0.358154296875,
1.056640625,
-0.1937255859375,
0.340087890625,
1.1435546875,
0.31640625,
0.37939453125,
-0.67529296875,
0.7919921875,
0.693359375,
-0.2109375,
-0.183349609375,
0.259765625,
-0.9365234375,
0.15869140625,
-0.0516357421875,
-1.037109375,
-0.79150390625,
0.2041015625,
1.197265625,
-0.3681640625,
0.64306640625,
-0.0287017822265625,
-1.412109375,
-0.44580078125,
1.142578125,
0.22119140625,
-0.2025146484375,
1.1494140625,
0.0662841796875,
-0.255615234375,
-0.11907958984375,
-0.0216522216796875,
-0.340087890625,
-0.244140625,
1.1953125,
-0.19189453125,
-0.73193359375,
1.1025390625,
0.83203125,
-1.185546875,
-0.984375,
-0.1043701171875,
-0.0025997161865234375,
0.0830078125,
-0.51806640625,
0.1353759765625,
0.560546875,
-0.5859375,
-0.057464599609375,
0.451171875,
0.1676025390625,
0.59033203125,
0.283935546875,
0.37158203125,
-0.638671875,
0.55859375,
0.96826171875,
-0.59521484375,
-0.685546875,
-1.203125,
-0.28662109375,
-0.270263671875,
0.1181640625,
0.96728515625,
-0.307861328125,
0.64404296875,
0.54638671875,
0.087890625,
0.771484375,
-0.446044921875,
-0.45166015625,
0.55078125,
-0.64111328125,
-0.48583984375,
-0.095947265625,
0.49755859375,
-0.338134765625,
0.63720703125,
-0.669921875,
-0.22705078125,
0.215576171875,
0.12384033203125,
-0.473388671875,
-0.308349609375,
-0.38330078125,
-0.96337890625,
-0.66064453125,
-0.7099609375,
-0.86181640625,
-0.00704193115234375,
0.1495361328125,
0.05059814453125,
-0.70947265625,
0.253173828125,
0.72216796875,
-0.64404296875,
0.8330078125,
-0.80517578125,
0.267333984375,
-0.419677734375,
-0.259033203125,
-0.276611328125,
-0.145263671875,
-0.46435546875,
-0.052093505859375,
-0.65966796875,
0.06988525390625,
-0.0767822265625,
0.70361328125,
0.0036163330078125,
0.28662109375,
-0.28271484375,
-0.0037479400634765625,
0.26806640625,
0.148193359375,
0.1888427734375,
0.728515625,
0.7548828125,
-0.1732177734375,
0.21240234375,
-0.10699462890625,
-0.1591796875,
-0.1407470703125,
0.53857421875,
0.521484375,
-0.2548828125,
0.04913330078125,
-0.296142578125,
0.32861328125,
-1.2060546875,
0.253173828125,
-0.1275634765625,
0.55419921875,
0.44970703125,
-0.08758544921875,
0.35302734375,
0.830078125,
-0.37353515625,
0.265380859375,
-0.01236724853515625,
0.0987548828125,
0.239501953125,
-0.00640106201171875,
0.073974609375,
0.75927734375,
0.322265625,
-0.658203125,
0.10589599609375,
0.0816650390625,
0.235107421875,
0.266845703125,
-0.327880859375,
-0.8701171875,
-1.1787109375,
-0.377685546875,
0.04791259765625,
0.473876953125,
0.529296875,
-0.576171875,
0.1614990234375,
0.13720703125,
-0.49267578125,
0.2301025390625,
-1.0302734375,
-1.1376953125,
0.0740966796875,
-0.0740966796875,
-0.39306640625,
-0.170654296875,
-0.378662109375,
-0.0733642578125,
0.1339111328125,
0.470703125,
-0.5439453125,
0.2744140625,
-0.51416015625,
0.55419921875,
-0.061279296875,
0.035797119140625,
-0.01107025146484375,
0.53369140625,
-0.595703125,
-0.55908203125,
-0.1153564453125,
0.91162109375,
0.3212890625,
-0.105224609375,
-0.444091796875,
0.324951171875,
-0.1282958984375,
0.2197265625,
-0.76220703125,
0.1448974609375,
-0.198974609375,
0.7158203125,
-0.5654296875,
0.0245513916015625,
0.015716552734375,
0.463134765625,
0.19091796875,
-0.3984375,
-0.52197265625,
0.751953125,
0.54833984375,
-0.0728759765625,
0.701171875,
0.392333984375,
0.8203125,
0.05877685546875,
-0.380615234375,
-0.53564453125,
0.6708984375,
0.84716796875,
0.51513671875,
-0.01617431640625,
0.2056884765625,
1.02734375,
-0.054656982421875,
-0.2291259765625,
0.2744140625,
0.050933837890625,
-0.34228515625,
0.1793212890625,
-0.2342529296875,
0.059600830078125,
0.2337646484375,
-0.3134765625,
0.36083984375,
-0.343505859375,
-0.050750732421875,
-0.35986328125,
-0.6728515625,
0.658203125,
-0.313232421875,
-0.1978759765625,
-0.126708984375,
-0.1802978515625,
0.666015625,
0.443359375,
0.230224609375,
0.2091064453125,
1.1787109375,
1.0673828125,
0.4814453125,
0.63134765625,
0.167236328125,
0.12396240234375,
-0.5244140625,
0.1666259765625,
0.27490234375,
-0.188232421875,
-0.4169921875,
-0.533203125,
-1.197265625,
0.8046875,
-0.11663818359375,
-0.51708984375,
0.363525390625,
-0.54052734375,
0.1845703125,
-0.48291015625,
0.9833984375,
-0.370361328125,
0.035919189453125,
0.399169921875,
-0.296630859375,
-0.467041015625,
0.8447265625,
-0.325439453125,
0.049285888671875,
0.146484375,
0.943359375,
0.019927978515625,
1.47265625,
1,
-0.1171875,
-0.094482421875,
0.300537109375,
-0.13037109375,
-0.470458984375,
-0.1922607421875,
-0.106689453125,
0.079833984375,
-0.658203125,
-0.381103515625,
-0.587890625,
0.78759765625,
0.1585693359375,
-0.794921875,
-0.414306640625,
0.172119140625,
-0.70068359375,
0.217529296875,
-0.07879638671875,
0.1312255859375,
-0.0731201171875,
0.318359375,
-0.3994140625,
-0.422607421875,
0.4404296875,
-0.381591796875,
0.261474609375,
-0.48828125,
-0.5556640625,
-0.5859375,
-0.68701171875,
-0.376708984375,
-0.32568359375,
-0.2005615234375,
-0.8427734375,
0.5068359375,
0.6064453125,
0.371826171875,
0.66552734375,
-0.312744140625,
0.1856689453125,
0.5966796875,
1.0458984375,
0.08099365234375,
0.67431640625,
0.26171875,
-0.52197265625,
-0.01287841796875,
-0.33984375,
0.63525390625,
0.1744384765625,
0.2457275390625,
-0.69287109375,
0.35595703125,
-0.62451171875,
-1.1396484375,
-0.09521484375,
0.70263671875,
0.60107421875,
-0.79345703125,
-1.255859375,
-0.439453125,
-1.1689453125,
-0.1617431640625,
-0.7265625,
0.7822265625,
0.007251739501953125,
0.11627197265625,
-0.19970703125,
-1.26953125,
4.34375,
0.86474609375,
0.97021484375,
0.372802734375,
0.6884765625,
1.0771484375,
0.478515625,
-0.69677734375,
-0.2265625,
-0.362548828125,
0.69189453125,
-0.546875,
0.266845703125,
0.990234375,
0.61474609375,
0.67236328125,
-0.68701171875,
0.006725311279296875,
0.1146240234375,
-0.9658203125,
-0.849609375,
0.25537109375,
0.284423828125,
0.279541015625,
-0.0003743171691894531,
0.2357177734375,
0.66748046875,
-0.56103515625,
-0.67724609375,
-0.64794921875,
0.178466796875,
-0.58984375,
0.6083984375,
-0.03668212890625,
-0.13037109375,
0.8466796875,
0.09649658203125,
-0.483642578125,
-0.281494140625,
0.17822265625,
0.06658935546875,
-0.188720703125,
0.398193359375,
-0.8525390625,
-0.43701171875,
0.11065673828125,
-0.7421875,
0.477294921875,
-0.29150390625,
-0.8720703125,
1.0263671875,
0.0111846923828125,
0.312744140625,
-0.316650390625,
-0.8759765625,
0.319091796875,
0.00525665283203125,
-0.116455078125,
-0.1756591796875,
0.55517578125,
0.028533935546875,
0.681640625,
-0.10235595703125,
0.7412109375,
-1.21484375,
0.95703125,
-0.5205078125,
0.59326171875,
-0.8818359375,
-0.1268310546875,
-0.16357421875,
0.028839111328125,
-0.33056640625,
-0.408203125,
0.4443359375,
0.61767578125,
-0.2352294921875,
0.7822265625,
0.47412109375,
-0.548828125,
0.08929443359375,
-0.008544921875,
-0.47509765625,
-0.455078125,
0.8359375,
1.1884765625,
-0.65283203125,
-0.23876953125,
-0.172607421875,
0.74169921875,
0.344970703125,
0.6611328125,
-0.0032253265380859375,
-0.68017578125,
-0.480712890625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrings s1, s2, ..., sn. All those strings consist of uppercase and lowercase Latin letters. String w has the length of |w|, its characters are numbered from 1 to |w|.
First Petya should find all the occurrences of forbidden substrings in the w string. During the search of substrings the case of letter shouldn't be taken into consideration. That is, strings "aBC" and "ABc" are considered equal.
After that Petya should perform the replacement of all letters covered by the occurrences. More formally: a letter in the position i should be replaced by any other one if for position i in string w there exist pair of indices l, r (1 ≤ l ≤ i ≤ r ≤ |w|) such that substring w[l ... r] is contained in the collection s1, s2, ..., sn, when using case insensitive comparison. During the replacement the letter's case should remain the same. Petya is not allowed to replace the letters that aren't covered by any forbidden substring.
Letter letter (uppercase or lowercase) is considered lucky for the hockey players. That's why Petya should perform the changes so that the letter occurred in the resulting string as many times as possible. Help Petya to find such resulting string. If there are several such strings, find the one that comes first lexicographically.
Note that the process of replacements is not repeated, it occurs only once. That is, if after Petya's replacements the string started to contain new occurrences of bad substrings, Petya pays no attention to them.
Input
The first line contains the only integer n (1 ≤ n ≤ 100) — the number of forbidden substrings in the collection. Next n lines contain these substrings. The next line contains string w. All those n + 1 lines are non-empty strings consisting of uppercase and lowercase Latin letters whose length does not exceed 100. The last line contains a lowercase letter letter.
Output
Output the only line — Petya's resulting string with the maximum number of letters letter. If there are several answers then output the one that comes first lexicographically.
The lexicographical comparison is performed by the standard < operator in modern programming languages. The line a is lexicographically smaller than the line b, if a is a prefix of b, or there exists such an i (1 ≤ i ≤ |a|), that ai < bi, and for any j (1 ≤ j < i) aj = bj. |a| stands for the length of string a.
Examples
Input
3
bers
ucky
elu
PetrLoveLuckyNumbers
t
Output
PetrLovtTttttNumtttt
Input
4
hello
party
abefglghjdhfgj
IVan
petrsmatchwin
a
Output
petrsmatchwin
Input
2
aCa
cba
abAcaba
c
Output
abCacba
Tags: implementation, strings
Correct Solution:
```
n=int(input())
a=[input() for i in range(n)]
w=input()
b=[False for i in range(len(w))]
c=input()
for i in range(len(w)):
z=0
for s in a:
if w[i:].lower().startswith(s.lower()):
z=max(z,len(s))
for j in range(i,i+z): b[j]=True
s=''
for i in range(len(w)):
if b[i]:
if w[i].lower()==c:
if c!='a':
d='a'
else:
d='b'
if w[i].lower()==w[i]:
s+=d.lower()
else:
s+=d.upper()
else:
if w[i].lower()==w[i]:
s+=c
else:
s+=c.upper()
else:
s+=w[i]
print(s)
```
| 46,808
|
[
0.0982666015625,
-0.0005583763122558594,
0.1502685546875,
0.3740234375,
-0.68408203125,
-0.51708984375,
-0.2744140625,
0.054473876953125,
-0.0865478515625,
0.6259765625,
0.93798828125,
-0.138916015625,
0.399169921875,
-0.82080078125,
-0.67236328125,
0.19775390625,
-0.66064453125,
-0.66357421875,
-0.436279296875,
0.07611083984375,
-0.0726318359375,
0.24267578125,
-1.583984375,
-0.4150390625,
-0.54296875,
1.005859375,
0.36083984375,
0.052825927734375,
0.79833984375,
0.80322265625,
-0.019683837890625,
-0.52294921875,
0.6640625,
-1.064453125,
-0.58740234375,
-0.5146484375,
0.6630859375,
-0.18115234375,
0.06341552734375,
-0.51904296875,
0.366943359375,
-0.576171875,
0.435791015625,
-0.6708984375,
-0.99365234375,
-0.0347900390625,
-0.35986328125,
0.153564453125,
-0.03265380859375,
-0.62841796875,
0.5048828125,
-0.51904296875,
0.4150390625,
-0.11651611328125,
0.08819580078125,
0.03204345703125,
0.1973876953125,
-0.2978515625,
-0.830078125,
0.505859375,
0.03204345703125,
0.09393310546875,
0.1881103515625,
-0.53076171875,
-0.017608642578125,
-0.0902099609375,
-0.058685302734375,
-0.422119140625,
-0.046234130859375,
-0.52978515625,
-0.00450897216796875,
0.56591796875,
-0.73291015625,
-0.418212890625,
-0.419677734375,
0.37060546875,
0.08624267578125,
-0.0193023681640625,
-0.78759765625,
0.73193359375,
-0.08074951171875,
1.03125,
0.445556640625,
0.08489990234375,
-0.70263671875,
-0.58203125,
0.16845703125,
0.413818359375,
0.282958984375,
0.08349609375,
-0.07330322265625,
0.314208984375,
-0.59619140625,
-0.0701904296875,
0.334716796875,
0.71875,
-0.39599609375,
0.22314453125,
0.089599609375,
-0.0687255859375,
0.57568359375,
0.744140625,
-0.222900390625,
0.794921875,
-0.69580078125,
0.15771484375,
0.53564453125,
0.1690673828125,
-0.277587890625,
-0.1500244140625,
-0.38525390625,
-0.169189453125,
0.4609375,
0.376708984375,
-0.154052734375,
0.865234375,
0.1163330078125,
0.39111328125,
-0.5966796875,
0.058135986328125,
0.8955078125,
0.071044921875,
0.5498046875,
-0.2303466796875,
0.046875,
-0.541015625,
-0.783203125,
1.0009765625,
-0.66796875,
-0.2274169921875,
0.368408203125,
0.037811279296875,
-0.07525634765625,
0.328125,
-0.1282958984375,
0.7822265625,
0.036102294921875,
0.377685546875,
0.9541015625,
-0.5380859375,
0.68798828125,
0.10638427734375,
-0.10504150390625,
1.296875,
0.22705078125,
-0.11956787109375,
0.779296875,
0.421630859375,
-1.02734375,
0.258544921875,
-1.138671875,
0.70654296875,
0.6513671875,
0.0418701171875,
-0.1998291015625,
0.27587890625,
0.0263519287109375,
0.340087890625,
0.28076171875,
-0.0587158203125,
-0.66845703125,
0.018768310546875,
-0.5849609375,
0.716796875,
-0.1474609375,
0.5966796875,
-0.285400390625,
-0.420654296875,
-0.1676025390625,
-0.256591796875,
0.335693359375,
-0.560546875,
-0.1527099609375,
1.1337890625,
0.357177734375,
0.9833984375,
0.4873046875,
-0.1998291015625,
0.2052001953125,
0.1490478515625,
-0.32275390625,
0.27294921875,
0.548828125,
0.323486328125,
0.267822265625,
0.020263671875,
-0.1500244140625,
-0.452880859375,
-0.8916015625,
-0.52099609375,
0.5576171875,
0.06927490234375,
-0.1654052734375,
0.2493896484375,
0.1407470703125,
0.200927734375,
-0.986328125,
0.031646728515625,
0.1195068359375,
-0.86962890625,
-0.297607421875,
0.650390625,
-0.56103515625,
0.27197265625,
-0.146240234375,
-0.63427734375,
0.0894775390625,
0.8896484375,
-0.32666015625,
0.313720703125,
0.744140625,
0.057373046875,
-0.38818359375,
-0.142822265625,
-0.07574462890625,
-0.017303466796875,
-0.599609375,
0.79443359375,
-0.53564453125,
-0.32861328125,
0.479736328125,
0.7470703125,
0.236328125,
0.81591796875,
-0.185302734375,
-0.4365234375,
0.71923828125,
1.00390625,
0.1097412109375,
0.490478515625,
0.271484375,
0.99951171875,
0.6748046875,
1.087890625,
0.69970703125,
0.265625,
0.6435546875,
1.1396484375,
-0.035797119140625,
0.1571044921875,
0.08990478515625,
0.640625,
0.2386474609375,
0.81982421875,
0.0462646484375,
0.343994140625,
-0.350830078125,
0.4853515625,
-0.353271484375,
0.2071533203125,
-0.439697265625,
0.452392578125,
0.1319580078125,
0.61083984375,
-0.52294921875,
-0.21875,
0.292724609375,
0.57958984375,
-0.94384765625,
-0.452392578125,
-0.255126953125,
0.162841796875,
0.250244140625,
0.046875,
0.471923828125,
0.09295654296875,
0.6025390625,
0.583984375,
-0.187255859375,
-0.869140625,
-0.496826171875,
-0.91845703125,
-0.5546875,
-0.43701171875,
-0.87548828125,
-0.29541015625,
0.54833984375,
-1.3095703125,
0.313232421875,
0.004405975341796875,
-0.202392578125,
0.283203125,
-0.304931640625,
0.7900390625,
-0.188720703125,
0.72412109375,
-0.79638671875,
0.268798828125,
-0.12078857421875,
0.7783203125,
-0.61962890625,
0.0751953125,
0.0211639404296875,
-0.58837890625,
0.5986328125,
-0.039825439453125,
0.379150390625,
-0.34814453125,
-0.8134765625,
-0.84814453125,
-0.31787109375,
0.0185546875,
-0.44677734375,
0.287353515625,
-0.990234375,
0.93994140625,
0.572265625,
-0.45947265625,
0.64453125,
1.1328125,
-1.08984375,
0.62158203125,
0.258056640625,
0.0977783203125,
-0.740234375,
0.7373046875,
0.544921875,
0.333251953125,
-0.7861328125,
-0.73486328125,
-0.51416015625,
-0.0640869140625,
0.2293701171875,
-0.65869140625,
-0.4521484375,
0.30517578125,
-0.1640625,
-1.0556640625,
0.888671875,
-0.8583984375,
-0.73486328125,
-0.54345703125,
-0.55029296875,
0.79150390625,
0.9228515625,
0.292724609375,
-0.08087158203125,
-0.2861328125,
-0.021484375,
0.86767578125,
0.422607421875,
-0.91796875,
-0.06573486328125,
0.432861328125,
-0.07220458984375,
0.2347412109375,
0.3388671875,
-0.229248046875,
-0.2484130859375,
0.08404541015625,
0.20703125,
0.6220703125,
0.2425537109375,
0.29296875,
0.295654296875,
0.343017578125,
-0.7890625,
0.0041656494140625,
-0.047821044921875,
0.64599609375,
0.45556640625,
0.43701171875,
0.1710205078125,
-0.342041015625,
-0.63427734375,
-1.212890625,
0.294677734375,
0.0275726318359375,
0.58740234375,
-0.59326171875,
0.697265625,
0.1278076171875,
-0.59375,
0.487060546875,
-0.383544921875,
0.279052734375,
1.1884765625,
-0.3330078125,
0.341796875,
-0.34521484375,
0.409912109375,
-0.256103515625,
0.06048583984375,
0.6171875,
0.19921875,
0.486083984375,
-0.1539306640625,
-0.322998046875,
-0.5009765625,
-0.1744384765625,
-0.12109375,
-0.429931640625,
0.2135009765625,
-0.186279296875,
-0.333251953125,
-0.732421875,
0.68310546875,
0.94140625,
0.4921875,
0.38623046875,
0.7587890625,
0.2705078125,
0.65478515625,
0.6953125,
-0.4091796875,
-0.057586669921875,
-0.79638671875,
1.0546875,
0.1910400390625,
-0.1053466796875,
-0.50390625,
-0.3759765625,
-0.384521484375,
-0.060028076171875,
-0.11016845703125,
-0.134033203125,
-1.0107421875,
-0.002124786376953125,
-0.09576416015625,
0.611328125,
-0.91015625,
0.11883544921875,
-0.2027587890625,
0.486328125,
0.5595703125,
-0.89501953125,
0.0301513671875,
-0.8681640625,
0.7392578125,
0.640625,
0.0309600830078125,
-0.830078125,
-0.1658935546875,
-0.62353515625,
-0.86181640625,
0.1531982421875,
0.87890625,
0.39013671875,
0.267333984375,
-1.1767578125,
0.70654296875,
0.174072265625,
-0.473388671875,
0.0557861328125,
-0.01611328125,
0.445556640625,
-0.029083251953125,
0.193359375,
-0.77001953125,
-0.9931640625,
0.265625,
-1.1279296875,
0.36328125,
-0.487548828125,
0.62109375,
0.079345703125,
0.1837158203125,
-0.0946044921875,
0.336181640625,
-0.2191162109375,
0.1610107421875,
-0.07135009765625,
0.385986328125,
-0.99462890625,
-0.58203125,
0.433837890625,
0.06103515625,
-0.337890625,
0.7705078125,
-0.115234375,
-0.360595703125,
0.2037353515625,
0.36279296875,
-0.125244140625,
0.32421875,
-0.63720703125,
0.25,
-0.201171875,
-0.479248046875,
0.050079345703125,
-0.55615234375,
0.50927734375,
-0.173583984375,
-0.73291015625,
-0.1463623046875,
-1.2099609375,
-0.485595703125,
0.193603515625,
-0.57080078125,
0.61767578125,
0.09527587890625,
-0.055877685546875,
0.2073974609375,
-0.580078125,
-0.53173828125,
-0.232666015625,
-0.31201171875,
-0.3564453125,
0.243896484375,
0.282958984375,
0.66650390625,
0.00004690885543823242,
-0.58984375,
0.3466796875,
0.10662841796875,
0.021209716796875,
-0.67822265625,
-0.2227783203125,
-0.0804443359375,
-0.49365234375,
-0.1705322265625,
0.33544921875,
0.008453369140625,
0.4541015625,
0.6005859375,
0.273193359375,
0.486328125,
0.21337890625,
-0.56005859375,
1.0302734375,
0.055572509765625,
-0.95849609375,
-0.37451171875,
0.39501953125,
0.05450439453125,
0.42529296875,
0.252685546875,
-0.986328125,
-1.0703125,
-1.154296875,
0.164794921875,
-0.8115234375,
-0.0684814453125,
-0.93017578125,
-0.232177734375,
-0.5546875,
0.8779296875,
-0.207275390625,
-0.6923828125,
0.42529296875,
-1.251953125,
-0.0714111328125,
-0.74072265625,
-0.33203125,
-0.39111328125,
-0.6552734375,
0.042205810546875,
1.1484375,
0.277587890625,
0.411865234375,
-0.0625,
-0.323974609375,
0.1416015625,
-0.0253448486328125,
-0.6787109375,
-0.525390625,
-0.08734130859375,
-0.03875732421875,
-0.1278076171875,
-0.1219482421875,
-0.6865234375,
0.79248046875,
-0.783203125,
0.1951904296875,
0.03564453125,
-0.1883544921875,
-0.0711669921875,
-0.46533203125,
1.337890625,
-0.56201171875,
0.0209503173828125,
-0.361328125,
0.5712890625,
0.494384765625,
-0.192138671875,
0.0201263427734375,
-0.67041015625,
-0.79833984375,
-1.2763671875,
0.79443359375,
-0.31640625,
0.09576416015625,
-0.591796875,
-0.1597900390625,
1.1103515625,
-0.1798095703125,
0.2178955078125,
0.76220703125,
0.0836181640625,
0.1531982421875,
-0.66650390625,
0.62109375,
0.56591796875,
-0.70166015625,
-0.0240936279296875,
0.31298828125,
-0.74462890625,
0.041534423828125,
-0.57373046875,
-0.8662109375,
-0.75732421875,
-0.014495849609375,
1.5166015625,
-0.453857421875,
0.67822265625,
-0.093505859375,
-0.9404296875,
-0.483154296875,
0.78271484375,
0.292236328125,
-0.181396484375,
0.9072265625,
-0.2359619140625,
-0.1849365234375,
0.13330078125,
-0.029083251953125,
-0.50390625,
-0.62548828125,
0.986328125,
-0.70556640625,
-0.30126953125,
0.9345703125,
0.77978515625,
-0.8642578125,
-0.8154296875,
-0.0845947265625,
-0.068603515625,
-0.48095703125,
-0.87939453125,
0.015625,
0.7705078125,
-0.6455078125,
-0.1767578125,
0.460693359375,
0.1719970703125,
0.4111328125,
-0.144775390625,
0.283447265625,
-0.211181640625,
0.6328125,
-0.0110321044921875,
-0.68798828125,
-0.294677734375,
-0.81396484375,
-0.193115234375,
-0.317626953125,
-0.03387451171875,
1.1171875,
-0.427734375,
0.28857421875,
0.60107421875,
-0.0655517578125,
0.364013671875,
-0.246826171875,
-0.279296875,
0.0650634765625,
-0.454345703125,
-0.191162109375,
-0.07080078125,
0.17236328125,
-0.25830078125,
0.43603515625,
-0.79052734375,
-0.061737060546875,
0.297119140625,
0.689453125,
0.0257415771484375,
-0.89013671875,
-0.55517578125,
-1.2607421875,
-0.474365234375,
-0.274658203125,
-0.50048828125,
-0.412109375,
0.462890625,
-0.091064453125,
-0.2119140625,
0.0096282958984375,
0.28271484375,
-0.9560546875,
0.822265625,
-0.46728515625,
0.56982421875,
-0.5673828125,
-0.2259521484375,
-0.75537109375,
0.0156707763671875,
-0.2293701171875,
-0.191650390625,
-0.285888671875,
0.3369140625,
-0.2244873046875,
0.54052734375,
-0.455078125,
0.328369140625,
-0.3466796875,
-0.5595703125,
-0.415771484375,
0.1357421875,
-0.464599609375,
0.52197265625,
0.9228515625,
0.1446533203125,
0.374267578125,
-0.416748046875,
-0.282470703125,
0.036956787109375,
0.1844482421875,
0.447509765625,
0.00982666015625,
0.06378173828125,
-0.39013671875,
0.002140045166015625,
-0.91845703125,
0.301025390625,
0.01149749755859375,
0.153564453125,
0.20361328125,
-0.2220458984375,
0.11474609375,
1.01171875,
-0.2352294921875,
0.41796875,
-0.239501953125,
0.2763671875,
0.623046875,
0.1368408203125,
-0.046295166015625,
0.6767578125,
0.462646484375,
-0.11798095703125,
0.09173583984375,
0.36962890625,
0.2135009765625,
0.382568359375,
-0.1324462890625,
-1.0146484375,
-0.99072265625,
-0.2435302734375,
0.1590576171875,
0.5810546875,
0.5712890625,
-0.5283203125,
-0.01361846923828125,
-0.366943359375,
-0.751953125,
0.087890625,
-1.4970703125,
-0.58056640625,
0.464111328125,
-0.407958984375,
-0.5634765625,
-0.49462890625,
-0.5361328125,
-0.2056884765625,
0.07891845703125,
0.0219879150390625,
-0.390380859375,
0.418212890625,
0.027923583984375,
0.2491455078125,
-0.318115234375,
0.037628173828125,
0.2115478515625,
0.53076171875,
-0.251220703125,
-0.55615234375,
0.1134033203125,
0.90966796875,
0.0775146484375,
0.293701171875,
-0.61083984375,
0.5048828125,
-0.08831787109375,
-0.1123046875,
-0.124267578125,
0.111572265625,
-0.137939453125,
0.58447265625,
-1.08984375,
-0.5869140625,
-0.357177734375,
0.3408203125,
0.389892578125,
-0.45751953125,
-0.55078125,
0.849609375,
0.59423828125,
-0.255126953125,
0.44677734375,
0.189453125,
0.6123046875,
-0.236083984375,
-0.1993408203125,
-0.2015380859375,
0.28369140625,
0.6455078125,
0.51123046875,
0.0013952255249023438,
0.402099609375,
0.77392578125,
-0.005542755126953125,
-0.265380859375,
0.3662109375,
0.30810546875,
-0.185791015625,
0.32861328125,
-0.10888671875,
-0.450927734375,
0.0621337890625,
-0.767578125,
0.662109375,
-0.23193359375,
0.2154541015625,
-0.1864013671875,
-0.74658203125,
0.81201171875,
-0.329833984375,
0.078369140625,
0.2900390625,
-0.51513671875,
0.30859375,
0.64013671875,
0.322265625,
0.033599853515625,
0.44091796875,
0.76025390625,
0.56640625,
0.6396484375,
0.233154296875,
0.480712890625,
-0.60791015625,
-0.205078125,
0.349365234375,
-0.1036376953125,
-0.603515625,
-0.412109375,
-0.68408203125,
0.378662109375,
-0.227294921875,
-0.260986328125,
0.5859375,
-0.70458984375,
0.2427978515625,
-0.0623779296875,
0.68701171875,
-0.2030029296875,
0.478759765625,
0.55419921875,
-0.422119140625,
-0.5400390625,
1.333984375,
-0.0161285400390625,
0.57958984375,
0.319091796875,
0.9814453125,
-0.11773681640625,
1.396484375,
0.826171875,
-0.17822265625,
0.1002197265625,
0.289306640625,
-0.411376953125,
-0.74365234375,
-0.40087890625,
-0.1370849609375,
-0.1455078125,
-0.61767578125,
-0.29833984375,
-0.030059814453125,
0.8974609375,
0.11083984375,
-0.798828125,
-0.433349609375,
0.2353515625,
-0.89501953125,
0.397705078125,
0.328125,
0.06658935546875,
-0.0044097900390625,
0.2176513671875,
0.0047149658203125,
-0.765625,
0.356201171875,
-0.4775390625,
0.71484375,
-0.6611328125,
-0.078125,
-0.62353515625,
-0.828125,
-0.26806640625,
0.034454345703125,
-0.36572265625,
-1.1171875,
0.364501953125,
0.5322265625,
0.1077880859375,
0.58056640625,
-0.66748046875,
0.4501953125,
0.89599609375,
1.017578125,
0.251220703125,
0.7392578125,
0.188720703125,
-0.2705078125,
0.12890625,
-0.3291015625,
0.50390625,
-0.1005859375,
0.2470703125,
-0.671875,
0.2430419921875,
-0.17919921875,
-1.435546875,
-0.2509765625,
0.485107421875,
0.385498046875,
-0.67236328125,
-0.982421875,
-0.267578125,
-0.35498046875,
-0.1768798828125,
-0.5380859375,
0.6962890625,
-0.025482177734375,
0.3291015625,
-0.4169921875,
-1.16015625,
4.453125,
0.91357421875,
0.99658203125,
0.1136474609375,
0.71826171875,
0.87353515625,
0.31689453125,
-0.2332763671875,
-0.53173828125,
-0.57421875,
0.1478271484375,
-0.28466796875,
0.0022449493408203125,
0.86376953125,
0.242919921875,
0.712890625,
-0.52685546875,
0.32861328125,
-0.29296875,
-0.99560546875,
-0.673828125,
0.289306640625,
-0.179931640625,
0.222900390625,
0.0174713134765625,
0.1629638671875,
0.54248046875,
-1.0595703125,
0.22265625,
-0.416015625,
0.1231689453125,
-0.394287109375,
1.0009765625,
0.06378173828125,
-0.0028896331787109375,
0.402099609375,
-0.312255859375,
-0.388427734375,
-0.1434326171875,
0.1798095703125,
-0.231201171875,
-0.1859130859375,
0.69580078125,
-0.483642578125,
-0.132568359375,
0.24609375,
-0.69580078125,
0.43603515625,
0.56689453125,
-0.72900390625,
0.7314453125,
-0.1881103515625,
0.64599609375,
-0.6826171875,
-0.55615234375,
0.15771484375,
-0.05694580078125,
0.0034732818603515625,
-0.5908203125,
0.287841796875,
0.07147216796875,
0.2998046875,
-0.00841522216796875,
0.552734375,
-0.8828125,
1.1884765625,
-0.120361328125,
0.173095703125,
-0.826171875,
-0.21337890625,
-0.1468505859375,
-0.2169189453125,
-0.299560546875,
-0.6044921875,
0.68310546875,
-0.031280517578125,
0.00037860870361328125,
0.77685546875,
0.42822265625,
-0.70458984375,
0.082763671875,
-0.04449462890625,
-0.410400390625,
-0.472412109375,
0.50341796875,
1.0302734375,
-0.439208984375,
-0.215087890625,
-0.322265625,
0.27001953125,
0.66748046875,
0.515625,
0.1822509765625,
-0.35986328125,
-0.248046875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrings s1, s2, ..., sn. All those strings consist of uppercase and lowercase Latin letters. String w has the length of |w|, its characters are numbered from 1 to |w|.
First Petya should find all the occurrences of forbidden substrings in the w string. During the search of substrings the case of letter shouldn't be taken into consideration. That is, strings "aBC" and "ABc" are considered equal.
After that Petya should perform the replacement of all letters covered by the occurrences. More formally: a letter in the position i should be replaced by any other one if for position i in string w there exist pair of indices l, r (1 ≤ l ≤ i ≤ r ≤ |w|) such that substring w[l ... r] is contained in the collection s1, s2, ..., sn, when using case insensitive comparison. During the replacement the letter's case should remain the same. Petya is not allowed to replace the letters that aren't covered by any forbidden substring.
Letter letter (uppercase or lowercase) is considered lucky for the hockey players. That's why Petya should perform the changes so that the letter occurred in the resulting string as many times as possible. Help Petya to find such resulting string. If there are several such strings, find the one that comes first lexicographically.
Note that the process of replacements is not repeated, it occurs only once. That is, if after Petya's replacements the string started to contain new occurrences of bad substrings, Petya pays no attention to them.
Input
The first line contains the only integer n (1 ≤ n ≤ 100) — the number of forbidden substrings in the collection. Next n lines contain these substrings. The next line contains string w. All those n + 1 lines are non-empty strings consisting of uppercase and lowercase Latin letters whose length does not exceed 100. The last line contains a lowercase letter letter.
Output
Output the only line — Petya's resulting string with the maximum number of letters letter. If there are several answers then output the one that comes first lexicographically.
The lexicographical comparison is performed by the standard < operator in modern programming languages. The line a is lexicographically smaller than the line b, if a is a prefix of b, or there exists such an i (1 ≤ i ≤ |a|), that ai < bi, and for any j (1 ≤ j < i) aj = bj. |a| stands for the length of string a.
Examples
Input
3
bers
ucky
elu
PetrLoveLuckyNumbers
t
Output
PetrLovtTttttNumtttt
Input
4
hello
party
abefglghjdhfgj
IVan
petrsmatchwin
a
Output
petrsmatchwin
Input
2
aCa
cba
abAcaba
c
Output
abCacba
Tags: implementation, strings
Correct Solution:
```
#------------------------template--------------------------#
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import*
from io import BytesIO, IOBase
def vsInput():
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or "r" not in file.mode
self.write = self.buffer.write if self.writable else None
def read(self):
while True:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
if not b:
break
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines = 0
return self.buffer.read()
def readline(self):
while self.newlines == 0:
b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
self.newlines = b.count(b"\n") + (not b)
ptr = self.buffer.tell()
self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
self.newlines -= 1
return self.buffer.readline()
def flush(self):
if self.writable:
os.write(self._fd, self.buffer.getvalue())
self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
def __init__(self, file):
self.buffer = FastIO(file)
self.flush = self.buffer.flush
self.writable = self.buffer.writable
self.write = lambda s: self.buffer.write(s.encode("ascii"))
self.read = lambda: self.buffer.read().decode("ascii")
self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
ALPHA='abcdefghijklmnopqrstuvwxyz'
M=10**9+7
EPS=1e-6
def value():return tuple(map(int,input().split()))
def array():return [int(i) for i in input().split()]
def Int():return int(input())
def Str():return input()
def arrayS():return [i for i in input().split()]
#-------------------------code---------------------------#
# vsInput()
n=Int()
strings=[]
for i in range(n): strings.append(input().lower())
w=input()
letter=input().lower()
n=len(w)
smallest='a'
if(letter=='a'): smallest='b'
Count=[0]*(n+1)
for s in strings:
l=len(s)
for j in range(n):
if(w[j:j+l].lower()==s):
# print(w[j:j+l],s)
Count[j]+=1
Count[j+l]-=1
# print(Count)
count=[Count[0]]
cur=Count[0]
for i in range(1,n):
cur+=Count[i]
count.append(cur)
ans=[]
# print(count)
for i in range(n):
if(count[i]>0):
if(w[i].lower()==letter):
ans.append(smallest)
else:
ans.append(letter)
else: ans.append(w[i])
for i in range(n):
if(w[i].islower()):
print(ans[i].lower(),end="")
else:
print(ans[i].upper(),end="")
```
| 46,809
|
[
0.0982666015625,
-0.0005583763122558594,
0.1502685546875,
0.3740234375,
-0.68408203125,
-0.51708984375,
-0.2744140625,
0.054473876953125,
-0.0865478515625,
0.6259765625,
0.93798828125,
-0.138916015625,
0.399169921875,
-0.82080078125,
-0.67236328125,
0.19775390625,
-0.66064453125,
-0.66357421875,
-0.436279296875,
0.07611083984375,
-0.0726318359375,
0.24267578125,
-1.583984375,
-0.4150390625,
-0.54296875,
1.005859375,
0.36083984375,
0.052825927734375,
0.79833984375,
0.80322265625,
-0.019683837890625,
-0.52294921875,
0.6640625,
-1.064453125,
-0.58740234375,
-0.5146484375,
0.6630859375,
-0.18115234375,
0.06341552734375,
-0.51904296875,
0.366943359375,
-0.576171875,
0.435791015625,
-0.6708984375,
-0.99365234375,
-0.0347900390625,
-0.35986328125,
0.153564453125,
-0.03265380859375,
-0.62841796875,
0.5048828125,
-0.51904296875,
0.4150390625,
-0.11651611328125,
0.08819580078125,
0.03204345703125,
0.1973876953125,
-0.2978515625,
-0.830078125,
0.505859375,
0.03204345703125,
0.09393310546875,
0.1881103515625,
-0.53076171875,
-0.017608642578125,
-0.0902099609375,
-0.058685302734375,
-0.422119140625,
-0.046234130859375,
-0.52978515625,
-0.00450897216796875,
0.56591796875,
-0.73291015625,
-0.418212890625,
-0.419677734375,
0.37060546875,
0.08624267578125,
-0.0193023681640625,
-0.78759765625,
0.73193359375,
-0.08074951171875,
1.03125,
0.445556640625,
0.08489990234375,
-0.70263671875,
-0.58203125,
0.16845703125,
0.413818359375,
0.282958984375,
0.08349609375,
-0.07330322265625,
0.314208984375,
-0.59619140625,
-0.0701904296875,
0.334716796875,
0.71875,
-0.39599609375,
0.22314453125,
0.089599609375,
-0.0687255859375,
0.57568359375,
0.744140625,
-0.222900390625,
0.794921875,
-0.69580078125,
0.15771484375,
0.53564453125,
0.1690673828125,
-0.277587890625,
-0.1500244140625,
-0.38525390625,
-0.169189453125,
0.4609375,
0.376708984375,
-0.154052734375,
0.865234375,
0.1163330078125,
0.39111328125,
-0.5966796875,
0.058135986328125,
0.8955078125,
0.071044921875,
0.5498046875,
-0.2303466796875,
0.046875,
-0.541015625,
-0.783203125,
1.0009765625,
-0.66796875,
-0.2274169921875,
0.368408203125,
0.037811279296875,
-0.07525634765625,
0.328125,
-0.1282958984375,
0.7822265625,
0.036102294921875,
0.377685546875,
0.9541015625,
-0.5380859375,
0.68798828125,
0.10638427734375,
-0.10504150390625,
1.296875,
0.22705078125,
-0.11956787109375,
0.779296875,
0.421630859375,
-1.02734375,
0.258544921875,
-1.138671875,
0.70654296875,
0.6513671875,
0.0418701171875,
-0.1998291015625,
0.27587890625,
0.0263519287109375,
0.340087890625,
0.28076171875,
-0.0587158203125,
-0.66845703125,
0.018768310546875,
-0.5849609375,
0.716796875,
-0.1474609375,
0.5966796875,
-0.285400390625,
-0.420654296875,
-0.1676025390625,
-0.256591796875,
0.335693359375,
-0.560546875,
-0.1527099609375,
1.1337890625,
0.357177734375,
0.9833984375,
0.4873046875,
-0.1998291015625,
0.2052001953125,
0.1490478515625,
-0.32275390625,
0.27294921875,
0.548828125,
0.323486328125,
0.267822265625,
0.020263671875,
-0.1500244140625,
-0.452880859375,
-0.8916015625,
-0.52099609375,
0.5576171875,
0.06927490234375,
-0.1654052734375,
0.2493896484375,
0.1407470703125,
0.200927734375,
-0.986328125,
0.031646728515625,
0.1195068359375,
-0.86962890625,
-0.297607421875,
0.650390625,
-0.56103515625,
0.27197265625,
-0.146240234375,
-0.63427734375,
0.0894775390625,
0.8896484375,
-0.32666015625,
0.313720703125,
0.744140625,
0.057373046875,
-0.38818359375,
-0.142822265625,
-0.07574462890625,
-0.017303466796875,
-0.599609375,
0.79443359375,
-0.53564453125,
-0.32861328125,
0.479736328125,
0.7470703125,
0.236328125,
0.81591796875,
-0.185302734375,
-0.4365234375,
0.71923828125,
1.00390625,
0.1097412109375,
0.490478515625,
0.271484375,
0.99951171875,
0.6748046875,
1.087890625,
0.69970703125,
0.265625,
0.6435546875,
1.1396484375,
-0.035797119140625,
0.1571044921875,
0.08990478515625,
0.640625,
0.2386474609375,
0.81982421875,
0.0462646484375,
0.343994140625,
-0.350830078125,
0.4853515625,
-0.353271484375,
0.2071533203125,
-0.439697265625,
0.452392578125,
0.1319580078125,
0.61083984375,
-0.52294921875,
-0.21875,
0.292724609375,
0.57958984375,
-0.94384765625,
-0.452392578125,
-0.255126953125,
0.162841796875,
0.250244140625,
0.046875,
0.471923828125,
0.09295654296875,
0.6025390625,
0.583984375,
-0.187255859375,
-0.869140625,
-0.496826171875,
-0.91845703125,
-0.5546875,
-0.43701171875,
-0.87548828125,
-0.29541015625,
0.54833984375,
-1.3095703125,
0.313232421875,
0.004405975341796875,
-0.202392578125,
0.283203125,
-0.304931640625,
0.7900390625,
-0.188720703125,
0.72412109375,
-0.79638671875,
0.268798828125,
-0.12078857421875,
0.7783203125,
-0.61962890625,
0.0751953125,
0.0211639404296875,
-0.58837890625,
0.5986328125,
-0.039825439453125,
0.379150390625,
-0.34814453125,
-0.8134765625,
-0.84814453125,
-0.31787109375,
0.0185546875,
-0.44677734375,
0.287353515625,
-0.990234375,
0.93994140625,
0.572265625,
-0.45947265625,
0.64453125,
1.1328125,
-1.08984375,
0.62158203125,
0.258056640625,
0.0977783203125,
-0.740234375,
0.7373046875,
0.544921875,
0.333251953125,
-0.7861328125,
-0.73486328125,
-0.51416015625,
-0.0640869140625,
0.2293701171875,
-0.65869140625,
-0.4521484375,
0.30517578125,
-0.1640625,
-1.0556640625,
0.888671875,
-0.8583984375,
-0.73486328125,
-0.54345703125,
-0.55029296875,
0.79150390625,
0.9228515625,
0.292724609375,
-0.08087158203125,
-0.2861328125,
-0.021484375,
0.86767578125,
0.422607421875,
-0.91796875,
-0.06573486328125,
0.432861328125,
-0.07220458984375,
0.2347412109375,
0.3388671875,
-0.229248046875,
-0.2484130859375,
0.08404541015625,
0.20703125,
0.6220703125,
0.2425537109375,
0.29296875,
0.295654296875,
0.343017578125,
-0.7890625,
0.0041656494140625,
-0.047821044921875,
0.64599609375,
0.45556640625,
0.43701171875,
0.1710205078125,
-0.342041015625,
-0.63427734375,
-1.212890625,
0.294677734375,
0.0275726318359375,
0.58740234375,
-0.59326171875,
0.697265625,
0.1278076171875,
-0.59375,
0.487060546875,
-0.383544921875,
0.279052734375,
1.1884765625,
-0.3330078125,
0.341796875,
-0.34521484375,
0.409912109375,
-0.256103515625,
0.06048583984375,
0.6171875,
0.19921875,
0.486083984375,
-0.1539306640625,
-0.322998046875,
-0.5009765625,
-0.1744384765625,
-0.12109375,
-0.429931640625,
0.2135009765625,
-0.186279296875,
-0.333251953125,
-0.732421875,
0.68310546875,
0.94140625,
0.4921875,
0.38623046875,
0.7587890625,
0.2705078125,
0.65478515625,
0.6953125,
-0.4091796875,
-0.057586669921875,
-0.79638671875,
1.0546875,
0.1910400390625,
-0.1053466796875,
-0.50390625,
-0.3759765625,
-0.384521484375,
-0.060028076171875,
-0.11016845703125,
-0.134033203125,
-1.0107421875,
-0.002124786376953125,
-0.09576416015625,
0.611328125,
-0.91015625,
0.11883544921875,
-0.2027587890625,
0.486328125,
0.5595703125,
-0.89501953125,
0.0301513671875,
-0.8681640625,
0.7392578125,
0.640625,
0.0309600830078125,
-0.830078125,
-0.1658935546875,
-0.62353515625,
-0.86181640625,
0.1531982421875,
0.87890625,
0.39013671875,
0.267333984375,
-1.1767578125,
0.70654296875,
0.174072265625,
-0.473388671875,
0.0557861328125,
-0.01611328125,
0.445556640625,
-0.029083251953125,
0.193359375,
-0.77001953125,
-0.9931640625,
0.265625,
-1.1279296875,
0.36328125,
-0.487548828125,
0.62109375,
0.079345703125,
0.1837158203125,
-0.0946044921875,
0.336181640625,
-0.2191162109375,
0.1610107421875,
-0.07135009765625,
0.385986328125,
-0.99462890625,
-0.58203125,
0.433837890625,
0.06103515625,
-0.337890625,
0.7705078125,
-0.115234375,
-0.360595703125,
0.2037353515625,
0.36279296875,
-0.125244140625,
0.32421875,
-0.63720703125,
0.25,
-0.201171875,
-0.479248046875,
0.050079345703125,
-0.55615234375,
0.50927734375,
-0.173583984375,
-0.73291015625,
-0.1463623046875,
-1.2099609375,
-0.485595703125,
0.193603515625,
-0.57080078125,
0.61767578125,
0.09527587890625,
-0.055877685546875,
0.2073974609375,
-0.580078125,
-0.53173828125,
-0.232666015625,
-0.31201171875,
-0.3564453125,
0.243896484375,
0.282958984375,
0.66650390625,
0.00004690885543823242,
-0.58984375,
0.3466796875,
0.10662841796875,
0.021209716796875,
-0.67822265625,
-0.2227783203125,
-0.0804443359375,
-0.49365234375,
-0.1705322265625,
0.33544921875,
0.008453369140625,
0.4541015625,
0.6005859375,
0.273193359375,
0.486328125,
0.21337890625,
-0.56005859375,
1.0302734375,
0.055572509765625,
-0.95849609375,
-0.37451171875,
0.39501953125,
0.05450439453125,
0.42529296875,
0.252685546875,
-0.986328125,
-1.0703125,
-1.154296875,
0.164794921875,
-0.8115234375,
-0.0684814453125,
-0.93017578125,
-0.232177734375,
-0.5546875,
0.8779296875,
-0.207275390625,
-0.6923828125,
0.42529296875,
-1.251953125,
-0.0714111328125,
-0.74072265625,
-0.33203125,
-0.39111328125,
-0.6552734375,
0.042205810546875,
1.1484375,
0.277587890625,
0.411865234375,
-0.0625,
-0.323974609375,
0.1416015625,
-0.0253448486328125,
-0.6787109375,
-0.525390625,
-0.08734130859375,
-0.03875732421875,
-0.1278076171875,
-0.1219482421875,
-0.6865234375,
0.79248046875,
-0.783203125,
0.1951904296875,
0.03564453125,
-0.1883544921875,
-0.0711669921875,
-0.46533203125,
1.337890625,
-0.56201171875,
0.0209503173828125,
-0.361328125,
0.5712890625,
0.494384765625,
-0.192138671875,
0.0201263427734375,
-0.67041015625,
-0.79833984375,
-1.2763671875,
0.79443359375,
-0.31640625,
0.09576416015625,
-0.591796875,
-0.1597900390625,
1.1103515625,
-0.1798095703125,
0.2178955078125,
0.76220703125,
0.0836181640625,
0.1531982421875,
-0.66650390625,
0.62109375,
0.56591796875,
-0.70166015625,
-0.0240936279296875,
0.31298828125,
-0.74462890625,
0.041534423828125,
-0.57373046875,
-0.8662109375,
-0.75732421875,
-0.014495849609375,
1.5166015625,
-0.453857421875,
0.67822265625,
-0.093505859375,
-0.9404296875,
-0.483154296875,
0.78271484375,
0.292236328125,
-0.181396484375,
0.9072265625,
-0.2359619140625,
-0.1849365234375,
0.13330078125,
-0.029083251953125,
-0.50390625,
-0.62548828125,
0.986328125,
-0.70556640625,
-0.30126953125,
0.9345703125,
0.77978515625,
-0.8642578125,
-0.8154296875,
-0.0845947265625,
-0.068603515625,
-0.48095703125,
-0.87939453125,
0.015625,
0.7705078125,
-0.6455078125,
-0.1767578125,
0.460693359375,
0.1719970703125,
0.4111328125,
-0.144775390625,
0.283447265625,
-0.211181640625,
0.6328125,
-0.0110321044921875,
-0.68798828125,
-0.294677734375,
-0.81396484375,
-0.193115234375,
-0.317626953125,
-0.03387451171875,
1.1171875,
-0.427734375,
0.28857421875,
0.60107421875,
-0.0655517578125,
0.364013671875,
-0.246826171875,
-0.279296875,
0.0650634765625,
-0.454345703125,
-0.191162109375,
-0.07080078125,
0.17236328125,
-0.25830078125,
0.43603515625,
-0.79052734375,
-0.061737060546875,
0.297119140625,
0.689453125,
0.0257415771484375,
-0.89013671875,
-0.55517578125,
-1.2607421875,
-0.474365234375,
-0.274658203125,
-0.50048828125,
-0.412109375,
0.462890625,
-0.091064453125,
-0.2119140625,
0.0096282958984375,
0.28271484375,
-0.9560546875,
0.822265625,
-0.46728515625,
0.56982421875,
-0.5673828125,
-0.2259521484375,
-0.75537109375,
0.0156707763671875,
-0.2293701171875,
-0.191650390625,
-0.285888671875,
0.3369140625,
-0.2244873046875,
0.54052734375,
-0.455078125,
0.328369140625,
-0.3466796875,
-0.5595703125,
-0.415771484375,
0.1357421875,
-0.464599609375,
0.52197265625,
0.9228515625,
0.1446533203125,
0.374267578125,
-0.416748046875,
-0.282470703125,
0.036956787109375,
0.1844482421875,
0.447509765625,
0.00982666015625,
0.06378173828125,
-0.39013671875,
0.002140045166015625,
-0.91845703125,
0.301025390625,
0.01149749755859375,
0.153564453125,
0.20361328125,
-0.2220458984375,
0.11474609375,
1.01171875,
-0.2352294921875,
0.41796875,
-0.239501953125,
0.2763671875,
0.623046875,
0.1368408203125,
-0.046295166015625,
0.6767578125,
0.462646484375,
-0.11798095703125,
0.09173583984375,
0.36962890625,
0.2135009765625,
0.382568359375,
-0.1324462890625,
-1.0146484375,
-0.99072265625,
-0.2435302734375,
0.1590576171875,
0.5810546875,
0.5712890625,
-0.5283203125,
-0.01361846923828125,
-0.366943359375,
-0.751953125,
0.087890625,
-1.4970703125,
-0.58056640625,
0.464111328125,
-0.407958984375,
-0.5634765625,
-0.49462890625,
-0.5361328125,
-0.2056884765625,
0.07891845703125,
0.0219879150390625,
-0.390380859375,
0.418212890625,
0.027923583984375,
0.2491455078125,
-0.318115234375,
0.037628173828125,
0.2115478515625,
0.53076171875,
-0.251220703125,
-0.55615234375,
0.1134033203125,
0.90966796875,
0.0775146484375,
0.293701171875,
-0.61083984375,
0.5048828125,
-0.08831787109375,
-0.1123046875,
-0.124267578125,
0.111572265625,
-0.137939453125,
0.58447265625,
-1.08984375,
-0.5869140625,
-0.357177734375,
0.3408203125,
0.389892578125,
-0.45751953125,
-0.55078125,
0.849609375,
0.59423828125,
-0.255126953125,
0.44677734375,
0.189453125,
0.6123046875,
-0.236083984375,
-0.1993408203125,
-0.2015380859375,
0.28369140625,
0.6455078125,
0.51123046875,
0.0013952255249023438,
0.402099609375,
0.77392578125,
-0.005542755126953125,
-0.265380859375,
0.3662109375,
0.30810546875,
-0.185791015625,
0.32861328125,
-0.10888671875,
-0.450927734375,
0.0621337890625,
-0.767578125,
0.662109375,
-0.23193359375,
0.2154541015625,
-0.1864013671875,
-0.74658203125,
0.81201171875,
-0.329833984375,
0.078369140625,
0.2900390625,
-0.51513671875,
0.30859375,
0.64013671875,
0.322265625,
0.033599853515625,
0.44091796875,
0.76025390625,
0.56640625,
0.6396484375,
0.233154296875,
0.480712890625,
-0.60791015625,
-0.205078125,
0.349365234375,
-0.1036376953125,
-0.603515625,
-0.412109375,
-0.68408203125,
0.378662109375,
-0.227294921875,
-0.260986328125,
0.5859375,
-0.70458984375,
0.2427978515625,
-0.0623779296875,
0.68701171875,
-0.2030029296875,
0.478759765625,
0.55419921875,
-0.422119140625,
-0.5400390625,
1.333984375,
-0.0161285400390625,
0.57958984375,
0.319091796875,
0.9814453125,
-0.11773681640625,
1.396484375,
0.826171875,
-0.17822265625,
0.1002197265625,
0.289306640625,
-0.411376953125,
-0.74365234375,
-0.40087890625,
-0.1370849609375,
-0.1455078125,
-0.61767578125,
-0.29833984375,
-0.030059814453125,
0.8974609375,
0.11083984375,
-0.798828125,
-0.433349609375,
0.2353515625,
-0.89501953125,
0.397705078125,
0.328125,
0.06658935546875,
-0.0044097900390625,
0.2176513671875,
0.0047149658203125,
-0.765625,
0.356201171875,
-0.4775390625,
0.71484375,
-0.6611328125,
-0.078125,
-0.62353515625,
-0.828125,
-0.26806640625,
0.034454345703125,
-0.36572265625,
-1.1171875,
0.364501953125,
0.5322265625,
0.1077880859375,
0.58056640625,
-0.66748046875,
0.4501953125,
0.89599609375,
1.017578125,
0.251220703125,
0.7392578125,
0.188720703125,
-0.2705078125,
0.12890625,
-0.3291015625,
0.50390625,
-0.1005859375,
0.2470703125,
-0.671875,
0.2430419921875,
-0.17919921875,
-1.435546875,
-0.2509765625,
0.485107421875,
0.385498046875,
-0.67236328125,
-0.982421875,
-0.267578125,
-0.35498046875,
-0.1768798828125,
-0.5380859375,
0.6962890625,
-0.025482177734375,
0.3291015625,
-0.4169921875,
-1.16015625,
4.453125,
0.91357421875,
0.99658203125,
0.1136474609375,
0.71826171875,
0.87353515625,
0.31689453125,
-0.2332763671875,
-0.53173828125,
-0.57421875,
0.1478271484375,
-0.28466796875,
0.0022449493408203125,
0.86376953125,
0.242919921875,
0.712890625,
-0.52685546875,
0.32861328125,
-0.29296875,
-0.99560546875,
-0.673828125,
0.289306640625,
-0.179931640625,
0.222900390625,
0.0174713134765625,
0.1629638671875,
0.54248046875,
-1.0595703125,
0.22265625,
-0.416015625,
0.1231689453125,
-0.394287109375,
1.0009765625,
0.06378173828125,
-0.0028896331787109375,
0.402099609375,
-0.312255859375,
-0.388427734375,
-0.1434326171875,
0.1798095703125,
-0.231201171875,
-0.1859130859375,
0.69580078125,
-0.483642578125,
-0.132568359375,
0.24609375,
-0.69580078125,
0.43603515625,
0.56689453125,
-0.72900390625,
0.7314453125,
-0.1881103515625,
0.64599609375,
-0.6826171875,
-0.55615234375,
0.15771484375,
-0.05694580078125,
0.0034732818603515625,
-0.5908203125,
0.287841796875,
0.07147216796875,
0.2998046875,
-0.00841522216796875,
0.552734375,
-0.8828125,
1.1884765625,
-0.120361328125,
0.173095703125,
-0.826171875,
-0.21337890625,
-0.1468505859375,
-0.2169189453125,
-0.299560546875,
-0.6044921875,
0.68310546875,
-0.031280517578125,
0.00037860870361328125,
0.77685546875,
0.42822265625,
-0.70458984375,
0.082763671875,
-0.04449462890625,
-0.410400390625,
-0.472412109375,
0.50341796875,
1.0302734375,
-0.439208984375,
-0.215087890625,
-0.322265625,
0.27001953125,
0.66748046875,
0.515625,
0.1822509765625,
-0.35986328125,
-0.248046875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrings s1, s2, ..., sn. All those strings consist of uppercase and lowercase Latin letters. String w has the length of |w|, its characters are numbered from 1 to |w|.
First Petya should find all the occurrences of forbidden substrings in the w string. During the search of substrings the case of letter shouldn't be taken into consideration. That is, strings "aBC" and "ABc" are considered equal.
After that Petya should perform the replacement of all letters covered by the occurrences. More formally: a letter in the position i should be replaced by any other one if for position i in string w there exist pair of indices l, r (1 ≤ l ≤ i ≤ r ≤ |w|) such that substring w[l ... r] is contained in the collection s1, s2, ..., sn, when using case insensitive comparison. During the replacement the letter's case should remain the same. Petya is not allowed to replace the letters that aren't covered by any forbidden substring.
Letter letter (uppercase or lowercase) is considered lucky for the hockey players. That's why Petya should perform the changes so that the letter occurred in the resulting string as many times as possible. Help Petya to find such resulting string. If there are several such strings, find the one that comes first lexicographically.
Note that the process of replacements is not repeated, it occurs only once. That is, if after Petya's replacements the string started to contain new occurrences of bad substrings, Petya pays no attention to them.
Input
The first line contains the only integer n (1 ≤ n ≤ 100) — the number of forbidden substrings in the collection. Next n lines contain these substrings. The next line contains string w. All those n + 1 lines are non-empty strings consisting of uppercase and lowercase Latin letters whose length does not exceed 100. The last line contains a lowercase letter letter.
Output
Output the only line — Petya's resulting string with the maximum number of letters letter. If there are several answers then output the one that comes first lexicographically.
The lexicographical comparison is performed by the standard < operator in modern programming languages. The line a is lexicographically smaller than the line b, if a is a prefix of b, or there exists such an i (1 ≤ i ≤ |a|), that ai < bi, and for any j (1 ≤ j < i) aj = bj. |a| stands for the length of string a.
Examples
Input
3
bers
ucky
elu
PetrLoveLuckyNumbers
t
Output
PetrLovtTttttNumtttt
Input
4
hello
party
abefglghjdhfgj
IVan
petrsmatchwin
a
Output
petrsmatchwin
Input
2
aCa
cba
abAcaba
c
Output
abCacba
Tags: implementation, strings
Correct Solution:
```
n=int(input())
a=[input().lower() for i in range(n)]
b=input()
c=input()
b1=b.lower()
d=[0]*len(b)
e=''
b2=len(b)
for i in range(n):
for j in range(b2-len(a[i])+1):
for k in range(len(a[i])):
if a[i][k]!=b1[j+k]:
break
else:
for k in range(len(a[i])):
d[j+k]=1
for i in range(len(b)):
if d[i]:
if b[i].lower()==c:
if b[i]==b[i].lower():
if b[i]=='a':
e+='b'
else:
e+='a'
else:
if b[i]=='A':
e+='B'
else:
e+='A'
else:
if b[i]==b[i].lower():
e+=c
else:
e+=c.upper()
else:
e+=b[i]
print(e)
```
| 46,810
|
[
0.0982666015625,
-0.0005583763122558594,
0.1502685546875,
0.3740234375,
-0.68408203125,
-0.51708984375,
-0.2744140625,
0.054473876953125,
-0.0865478515625,
0.6259765625,
0.93798828125,
-0.138916015625,
0.399169921875,
-0.82080078125,
-0.67236328125,
0.19775390625,
-0.66064453125,
-0.66357421875,
-0.436279296875,
0.07611083984375,
-0.0726318359375,
0.24267578125,
-1.583984375,
-0.4150390625,
-0.54296875,
1.005859375,
0.36083984375,
0.052825927734375,
0.79833984375,
0.80322265625,
-0.019683837890625,
-0.52294921875,
0.6640625,
-1.064453125,
-0.58740234375,
-0.5146484375,
0.6630859375,
-0.18115234375,
0.06341552734375,
-0.51904296875,
0.366943359375,
-0.576171875,
0.435791015625,
-0.6708984375,
-0.99365234375,
-0.0347900390625,
-0.35986328125,
0.153564453125,
-0.03265380859375,
-0.62841796875,
0.5048828125,
-0.51904296875,
0.4150390625,
-0.11651611328125,
0.08819580078125,
0.03204345703125,
0.1973876953125,
-0.2978515625,
-0.830078125,
0.505859375,
0.03204345703125,
0.09393310546875,
0.1881103515625,
-0.53076171875,
-0.017608642578125,
-0.0902099609375,
-0.058685302734375,
-0.422119140625,
-0.046234130859375,
-0.52978515625,
-0.00450897216796875,
0.56591796875,
-0.73291015625,
-0.418212890625,
-0.419677734375,
0.37060546875,
0.08624267578125,
-0.0193023681640625,
-0.78759765625,
0.73193359375,
-0.08074951171875,
1.03125,
0.445556640625,
0.08489990234375,
-0.70263671875,
-0.58203125,
0.16845703125,
0.413818359375,
0.282958984375,
0.08349609375,
-0.07330322265625,
0.314208984375,
-0.59619140625,
-0.0701904296875,
0.334716796875,
0.71875,
-0.39599609375,
0.22314453125,
0.089599609375,
-0.0687255859375,
0.57568359375,
0.744140625,
-0.222900390625,
0.794921875,
-0.69580078125,
0.15771484375,
0.53564453125,
0.1690673828125,
-0.277587890625,
-0.1500244140625,
-0.38525390625,
-0.169189453125,
0.4609375,
0.376708984375,
-0.154052734375,
0.865234375,
0.1163330078125,
0.39111328125,
-0.5966796875,
0.058135986328125,
0.8955078125,
0.071044921875,
0.5498046875,
-0.2303466796875,
0.046875,
-0.541015625,
-0.783203125,
1.0009765625,
-0.66796875,
-0.2274169921875,
0.368408203125,
0.037811279296875,
-0.07525634765625,
0.328125,
-0.1282958984375,
0.7822265625,
0.036102294921875,
0.377685546875,
0.9541015625,
-0.5380859375,
0.68798828125,
0.10638427734375,
-0.10504150390625,
1.296875,
0.22705078125,
-0.11956787109375,
0.779296875,
0.421630859375,
-1.02734375,
0.258544921875,
-1.138671875,
0.70654296875,
0.6513671875,
0.0418701171875,
-0.1998291015625,
0.27587890625,
0.0263519287109375,
0.340087890625,
0.28076171875,
-0.0587158203125,
-0.66845703125,
0.018768310546875,
-0.5849609375,
0.716796875,
-0.1474609375,
0.5966796875,
-0.285400390625,
-0.420654296875,
-0.1676025390625,
-0.256591796875,
0.335693359375,
-0.560546875,
-0.1527099609375,
1.1337890625,
0.357177734375,
0.9833984375,
0.4873046875,
-0.1998291015625,
0.2052001953125,
0.1490478515625,
-0.32275390625,
0.27294921875,
0.548828125,
0.323486328125,
0.267822265625,
0.020263671875,
-0.1500244140625,
-0.452880859375,
-0.8916015625,
-0.52099609375,
0.5576171875,
0.06927490234375,
-0.1654052734375,
0.2493896484375,
0.1407470703125,
0.200927734375,
-0.986328125,
0.031646728515625,
0.1195068359375,
-0.86962890625,
-0.297607421875,
0.650390625,
-0.56103515625,
0.27197265625,
-0.146240234375,
-0.63427734375,
0.0894775390625,
0.8896484375,
-0.32666015625,
0.313720703125,
0.744140625,
0.057373046875,
-0.38818359375,
-0.142822265625,
-0.07574462890625,
-0.017303466796875,
-0.599609375,
0.79443359375,
-0.53564453125,
-0.32861328125,
0.479736328125,
0.7470703125,
0.236328125,
0.81591796875,
-0.185302734375,
-0.4365234375,
0.71923828125,
1.00390625,
0.1097412109375,
0.490478515625,
0.271484375,
0.99951171875,
0.6748046875,
1.087890625,
0.69970703125,
0.265625,
0.6435546875,
1.1396484375,
-0.035797119140625,
0.1571044921875,
0.08990478515625,
0.640625,
0.2386474609375,
0.81982421875,
0.0462646484375,
0.343994140625,
-0.350830078125,
0.4853515625,
-0.353271484375,
0.2071533203125,
-0.439697265625,
0.452392578125,
0.1319580078125,
0.61083984375,
-0.52294921875,
-0.21875,
0.292724609375,
0.57958984375,
-0.94384765625,
-0.452392578125,
-0.255126953125,
0.162841796875,
0.250244140625,
0.046875,
0.471923828125,
0.09295654296875,
0.6025390625,
0.583984375,
-0.187255859375,
-0.869140625,
-0.496826171875,
-0.91845703125,
-0.5546875,
-0.43701171875,
-0.87548828125,
-0.29541015625,
0.54833984375,
-1.3095703125,
0.313232421875,
0.004405975341796875,
-0.202392578125,
0.283203125,
-0.304931640625,
0.7900390625,
-0.188720703125,
0.72412109375,
-0.79638671875,
0.268798828125,
-0.12078857421875,
0.7783203125,
-0.61962890625,
0.0751953125,
0.0211639404296875,
-0.58837890625,
0.5986328125,
-0.039825439453125,
0.379150390625,
-0.34814453125,
-0.8134765625,
-0.84814453125,
-0.31787109375,
0.0185546875,
-0.44677734375,
0.287353515625,
-0.990234375,
0.93994140625,
0.572265625,
-0.45947265625,
0.64453125,
1.1328125,
-1.08984375,
0.62158203125,
0.258056640625,
0.0977783203125,
-0.740234375,
0.7373046875,
0.544921875,
0.333251953125,
-0.7861328125,
-0.73486328125,
-0.51416015625,
-0.0640869140625,
0.2293701171875,
-0.65869140625,
-0.4521484375,
0.30517578125,
-0.1640625,
-1.0556640625,
0.888671875,
-0.8583984375,
-0.73486328125,
-0.54345703125,
-0.55029296875,
0.79150390625,
0.9228515625,
0.292724609375,
-0.08087158203125,
-0.2861328125,
-0.021484375,
0.86767578125,
0.422607421875,
-0.91796875,
-0.06573486328125,
0.432861328125,
-0.07220458984375,
0.2347412109375,
0.3388671875,
-0.229248046875,
-0.2484130859375,
0.08404541015625,
0.20703125,
0.6220703125,
0.2425537109375,
0.29296875,
0.295654296875,
0.343017578125,
-0.7890625,
0.0041656494140625,
-0.047821044921875,
0.64599609375,
0.45556640625,
0.43701171875,
0.1710205078125,
-0.342041015625,
-0.63427734375,
-1.212890625,
0.294677734375,
0.0275726318359375,
0.58740234375,
-0.59326171875,
0.697265625,
0.1278076171875,
-0.59375,
0.487060546875,
-0.383544921875,
0.279052734375,
1.1884765625,
-0.3330078125,
0.341796875,
-0.34521484375,
0.409912109375,
-0.256103515625,
0.06048583984375,
0.6171875,
0.19921875,
0.486083984375,
-0.1539306640625,
-0.322998046875,
-0.5009765625,
-0.1744384765625,
-0.12109375,
-0.429931640625,
0.2135009765625,
-0.186279296875,
-0.333251953125,
-0.732421875,
0.68310546875,
0.94140625,
0.4921875,
0.38623046875,
0.7587890625,
0.2705078125,
0.65478515625,
0.6953125,
-0.4091796875,
-0.057586669921875,
-0.79638671875,
1.0546875,
0.1910400390625,
-0.1053466796875,
-0.50390625,
-0.3759765625,
-0.384521484375,
-0.060028076171875,
-0.11016845703125,
-0.134033203125,
-1.0107421875,
-0.002124786376953125,
-0.09576416015625,
0.611328125,
-0.91015625,
0.11883544921875,
-0.2027587890625,
0.486328125,
0.5595703125,
-0.89501953125,
0.0301513671875,
-0.8681640625,
0.7392578125,
0.640625,
0.0309600830078125,
-0.830078125,
-0.1658935546875,
-0.62353515625,
-0.86181640625,
0.1531982421875,
0.87890625,
0.39013671875,
0.267333984375,
-1.1767578125,
0.70654296875,
0.174072265625,
-0.473388671875,
0.0557861328125,
-0.01611328125,
0.445556640625,
-0.029083251953125,
0.193359375,
-0.77001953125,
-0.9931640625,
0.265625,
-1.1279296875,
0.36328125,
-0.487548828125,
0.62109375,
0.079345703125,
0.1837158203125,
-0.0946044921875,
0.336181640625,
-0.2191162109375,
0.1610107421875,
-0.07135009765625,
0.385986328125,
-0.99462890625,
-0.58203125,
0.433837890625,
0.06103515625,
-0.337890625,
0.7705078125,
-0.115234375,
-0.360595703125,
0.2037353515625,
0.36279296875,
-0.125244140625,
0.32421875,
-0.63720703125,
0.25,
-0.201171875,
-0.479248046875,
0.050079345703125,
-0.55615234375,
0.50927734375,
-0.173583984375,
-0.73291015625,
-0.1463623046875,
-1.2099609375,
-0.485595703125,
0.193603515625,
-0.57080078125,
0.61767578125,
0.09527587890625,
-0.055877685546875,
0.2073974609375,
-0.580078125,
-0.53173828125,
-0.232666015625,
-0.31201171875,
-0.3564453125,
0.243896484375,
0.282958984375,
0.66650390625,
0.00004690885543823242,
-0.58984375,
0.3466796875,
0.10662841796875,
0.021209716796875,
-0.67822265625,
-0.2227783203125,
-0.0804443359375,
-0.49365234375,
-0.1705322265625,
0.33544921875,
0.008453369140625,
0.4541015625,
0.6005859375,
0.273193359375,
0.486328125,
0.21337890625,
-0.56005859375,
1.0302734375,
0.055572509765625,
-0.95849609375,
-0.37451171875,
0.39501953125,
0.05450439453125,
0.42529296875,
0.252685546875,
-0.986328125,
-1.0703125,
-1.154296875,
0.164794921875,
-0.8115234375,
-0.0684814453125,
-0.93017578125,
-0.232177734375,
-0.5546875,
0.8779296875,
-0.207275390625,
-0.6923828125,
0.42529296875,
-1.251953125,
-0.0714111328125,
-0.74072265625,
-0.33203125,
-0.39111328125,
-0.6552734375,
0.042205810546875,
1.1484375,
0.277587890625,
0.411865234375,
-0.0625,
-0.323974609375,
0.1416015625,
-0.0253448486328125,
-0.6787109375,
-0.525390625,
-0.08734130859375,
-0.03875732421875,
-0.1278076171875,
-0.1219482421875,
-0.6865234375,
0.79248046875,
-0.783203125,
0.1951904296875,
0.03564453125,
-0.1883544921875,
-0.0711669921875,
-0.46533203125,
1.337890625,
-0.56201171875,
0.0209503173828125,
-0.361328125,
0.5712890625,
0.494384765625,
-0.192138671875,
0.0201263427734375,
-0.67041015625,
-0.79833984375,
-1.2763671875,
0.79443359375,
-0.31640625,
0.09576416015625,
-0.591796875,
-0.1597900390625,
1.1103515625,
-0.1798095703125,
0.2178955078125,
0.76220703125,
0.0836181640625,
0.1531982421875,
-0.66650390625,
0.62109375,
0.56591796875,
-0.70166015625,
-0.0240936279296875,
0.31298828125,
-0.74462890625,
0.041534423828125,
-0.57373046875,
-0.8662109375,
-0.75732421875,
-0.014495849609375,
1.5166015625,
-0.453857421875,
0.67822265625,
-0.093505859375,
-0.9404296875,
-0.483154296875,
0.78271484375,
0.292236328125,
-0.181396484375,
0.9072265625,
-0.2359619140625,
-0.1849365234375,
0.13330078125,
-0.029083251953125,
-0.50390625,
-0.62548828125,
0.986328125,
-0.70556640625,
-0.30126953125,
0.9345703125,
0.77978515625,
-0.8642578125,
-0.8154296875,
-0.0845947265625,
-0.068603515625,
-0.48095703125,
-0.87939453125,
0.015625,
0.7705078125,
-0.6455078125,
-0.1767578125,
0.460693359375,
0.1719970703125,
0.4111328125,
-0.144775390625,
0.283447265625,
-0.211181640625,
0.6328125,
-0.0110321044921875,
-0.68798828125,
-0.294677734375,
-0.81396484375,
-0.193115234375,
-0.317626953125,
-0.03387451171875,
1.1171875,
-0.427734375,
0.28857421875,
0.60107421875,
-0.0655517578125,
0.364013671875,
-0.246826171875,
-0.279296875,
0.0650634765625,
-0.454345703125,
-0.191162109375,
-0.07080078125,
0.17236328125,
-0.25830078125,
0.43603515625,
-0.79052734375,
-0.061737060546875,
0.297119140625,
0.689453125,
0.0257415771484375,
-0.89013671875,
-0.55517578125,
-1.2607421875,
-0.474365234375,
-0.274658203125,
-0.50048828125,
-0.412109375,
0.462890625,
-0.091064453125,
-0.2119140625,
0.0096282958984375,
0.28271484375,
-0.9560546875,
0.822265625,
-0.46728515625,
0.56982421875,
-0.5673828125,
-0.2259521484375,
-0.75537109375,
0.0156707763671875,
-0.2293701171875,
-0.191650390625,
-0.285888671875,
0.3369140625,
-0.2244873046875,
0.54052734375,
-0.455078125,
0.328369140625,
-0.3466796875,
-0.5595703125,
-0.415771484375,
0.1357421875,
-0.464599609375,
0.52197265625,
0.9228515625,
0.1446533203125,
0.374267578125,
-0.416748046875,
-0.282470703125,
0.036956787109375,
0.1844482421875,
0.447509765625,
0.00982666015625,
0.06378173828125,
-0.39013671875,
0.002140045166015625,
-0.91845703125,
0.301025390625,
0.01149749755859375,
0.153564453125,
0.20361328125,
-0.2220458984375,
0.11474609375,
1.01171875,
-0.2352294921875,
0.41796875,
-0.239501953125,
0.2763671875,
0.623046875,
0.1368408203125,
-0.046295166015625,
0.6767578125,
0.462646484375,
-0.11798095703125,
0.09173583984375,
0.36962890625,
0.2135009765625,
0.382568359375,
-0.1324462890625,
-1.0146484375,
-0.99072265625,
-0.2435302734375,
0.1590576171875,
0.5810546875,
0.5712890625,
-0.5283203125,
-0.01361846923828125,
-0.366943359375,
-0.751953125,
0.087890625,
-1.4970703125,
-0.58056640625,
0.464111328125,
-0.407958984375,
-0.5634765625,
-0.49462890625,
-0.5361328125,
-0.2056884765625,
0.07891845703125,
0.0219879150390625,
-0.390380859375,
0.418212890625,
0.027923583984375,
0.2491455078125,
-0.318115234375,
0.037628173828125,
0.2115478515625,
0.53076171875,
-0.251220703125,
-0.55615234375,
0.1134033203125,
0.90966796875,
0.0775146484375,
0.293701171875,
-0.61083984375,
0.5048828125,
-0.08831787109375,
-0.1123046875,
-0.124267578125,
0.111572265625,
-0.137939453125,
0.58447265625,
-1.08984375,
-0.5869140625,
-0.357177734375,
0.3408203125,
0.389892578125,
-0.45751953125,
-0.55078125,
0.849609375,
0.59423828125,
-0.255126953125,
0.44677734375,
0.189453125,
0.6123046875,
-0.236083984375,
-0.1993408203125,
-0.2015380859375,
0.28369140625,
0.6455078125,
0.51123046875,
0.0013952255249023438,
0.402099609375,
0.77392578125,
-0.005542755126953125,
-0.265380859375,
0.3662109375,
0.30810546875,
-0.185791015625,
0.32861328125,
-0.10888671875,
-0.450927734375,
0.0621337890625,
-0.767578125,
0.662109375,
-0.23193359375,
0.2154541015625,
-0.1864013671875,
-0.74658203125,
0.81201171875,
-0.329833984375,
0.078369140625,
0.2900390625,
-0.51513671875,
0.30859375,
0.64013671875,
0.322265625,
0.033599853515625,
0.44091796875,
0.76025390625,
0.56640625,
0.6396484375,
0.233154296875,
0.480712890625,
-0.60791015625,
-0.205078125,
0.349365234375,
-0.1036376953125,
-0.603515625,
-0.412109375,
-0.68408203125,
0.378662109375,
-0.227294921875,
-0.260986328125,
0.5859375,
-0.70458984375,
0.2427978515625,
-0.0623779296875,
0.68701171875,
-0.2030029296875,
0.478759765625,
0.55419921875,
-0.422119140625,
-0.5400390625,
1.333984375,
-0.0161285400390625,
0.57958984375,
0.319091796875,
0.9814453125,
-0.11773681640625,
1.396484375,
0.826171875,
-0.17822265625,
0.1002197265625,
0.289306640625,
-0.411376953125,
-0.74365234375,
-0.40087890625,
-0.1370849609375,
-0.1455078125,
-0.61767578125,
-0.29833984375,
-0.030059814453125,
0.8974609375,
0.11083984375,
-0.798828125,
-0.433349609375,
0.2353515625,
-0.89501953125,
0.397705078125,
0.328125,
0.06658935546875,
-0.0044097900390625,
0.2176513671875,
0.0047149658203125,
-0.765625,
0.356201171875,
-0.4775390625,
0.71484375,
-0.6611328125,
-0.078125,
-0.62353515625,
-0.828125,
-0.26806640625,
0.034454345703125,
-0.36572265625,
-1.1171875,
0.364501953125,
0.5322265625,
0.1077880859375,
0.58056640625,
-0.66748046875,
0.4501953125,
0.89599609375,
1.017578125,
0.251220703125,
0.7392578125,
0.188720703125,
-0.2705078125,
0.12890625,
-0.3291015625,
0.50390625,
-0.1005859375,
0.2470703125,
-0.671875,
0.2430419921875,
-0.17919921875,
-1.435546875,
-0.2509765625,
0.485107421875,
0.385498046875,
-0.67236328125,
-0.982421875,
-0.267578125,
-0.35498046875,
-0.1768798828125,
-0.5380859375,
0.6962890625,
-0.025482177734375,
0.3291015625,
-0.4169921875,
-1.16015625,
4.453125,
0.91357421875,
0.99658203125,
0.1136474609375,
0.71826171875,
0.87353515625,
0.31689453125,
-0.2332763671875,
-0.53173828125,
-0.57421875,
0.1478271484375,
-0.28466796875,
0.0022449493408203125,
0.86376953125,
0.242919921875,
0.712890625,
-0.52685546875,
0.32861328125,
-0.29296875,
-0.99560546875,
-0.673828125,
0.289306640625,
-0.179931640625,
0.222900390625,
0.0174713134765625,
0.1629638671875,
0.54248046875,
-1.0595703125,
0.22265625,
-0.416015625,
0.1231689453125,
-0.394287109375,
1.0009765625,
0.06378173828125,
-0.0028896331787109375,
0.402099609375,
-0.312255859375,
-0.388427734375,
-0.1434326171875,
0.1798095703125,
-0.231201171875,
-0.1859130859375,
0.69580078125,
-0.483642578125,
-0.132568359375,
0.24609375,
-0.69580078125,
0.43603515625,
0.56689453125,
-0.72900390625,
0.7314453125,
-0.1881103515625,
0.64599609375,
-0.6826171875,
-0.55615234375,
0.15771484375,
-0.05694580078125,
0.0034732818603515625,
-0.5908203125,
0.287841796875,
0.07147216796875,
0.2998046875,
-0.00841522216796875,
0.552734375,
-0.8828125,
1.1884765625,
-0.120361328125,
0.173095703125,
-0.826171875,
-0.21337890625,
-0.1468505859375,
-0.2169189453125,
-0.299560546875,
-0.6044921875,
0.68310546875,
-0.031280517578125,
0.00037860870361328125,
0.77685546875,
0.42822265625,
-0.70458984375,
0.082763671875,
-0.04449462890625,
-0.410400390625,
-0.472412109375,
0.50341796875,
1.0302734375,
-0.439208984375,
-0.215087890625,
-0.322265625,
0.27001953125,
0.66748046875,
0.515625,
0.1822509765625,
-0.35986328125,
-0.248046875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrings s1, s2, ..., sn. All those strings consist of uppercase and lowercase Latin letters. String w has the length of |w|, its characters are numbered from 1 to |w|.
First Petya should find all the occurrences of forbidden substrings in the w string. During the search of substrings the case of letter shouldn't be taken into consideration. That is, strings "aBC" and "ABc" are considered equal.
After that Petya should perform the replacement of all letters covered by the occurrences. More formally: a letter in the position i should be replaced by any other one if for position i in string w there exist pair of indices l, r (1 ≤ l ≤ i ≤ r ≤ |w|) such that substring w[l ... r] is contained in the collection s1, s2, ..., sn, when using case insensitive comparison. During the replacement the letter's case should remain the same. Petya is not allowed to replace the letters that aren't covered by any forbidden substring.
Letter letter (uppercase or lowercase) is considered lucky for the hockey players. That's why Petya should perform the changes so that the letter occurred in the resulting string as many times as possible. Help Petya to find such resulting string. If there are several such strings, find the one that comes first lexicographically.
Note that the process of replacements is not repeated, it occurs only once. That is, if after Petya's replacements the string started to contain new occurrences of bad substrings, Petya pays no attention to them.
Input
The first line contains the only integer n (1 ≤ n ≤ 100) — the number of forbidden substrings in the collection. Next n lines contain these substrings. The next line contains string w. All those n + 1 lines are non-empty strings consisting of uppercase and lowercase Latin letters whose length does not exceed 100. The last line contains a lowercase letter letter.
Output
Output the only line — Petya's resulting string with the maximum number of letters letter. If there are several answers then output the one that comes first lexicographically.
The lexicographical comparison is performed by the standard < operator in modern programming languages. The line a is lexicographically smaller than the line b, if a is a prefix of b, or there exists such an i (1 ≤ i ≤ |a|), that ai < bi, and for any j (1 ≤ j < i) aj = bj. |a| stands for the length of string a.
Examples
Input
3
bers
ucky
elu
PetrLoveLuckyNumbers
t
Output
PetrLovtTttttNumtttt
Input
4
hello
party
abefglghjdhfgj
IVan
petrsmatchwin
a
Output
petrsmatchwin
Input
2
aCa
cba
abAcaba
c
Output
abCacba
Tags: implementation, strings
Correct Solution:
```
n = int(input())
a = []
for i in range(n):
a.append(input().rstrip())
w = list(input().rstrip())
c = input().rstrip()
m = len(w)
z = []
i = 0
while i < m:
for j in range(n):
if w[i].lower() == a[j][0].lower():
if i + len(a[j]) <= m:
f = 1
for k in range(i,i+len(a[j])):
if w[k].lower() != a[j][k-i].lower():
f=0
break
if f:
if len(z)!=0:
if z[-1][1]>=i:
z[-1][1]=max(i+len(a[j])-1,z[-1][1])
else:
z.append([i,i+len(a[j])-1])
else:
z.append([i,i+len(a[j])-1])
i += 1
for i in z:
for k in range(i[0],i[1]+1):
if w[k].isupper():
if w[k] != c.upper():
w[k] = c.upper()
else:
if w[k] != "A":
w[k] = "A"
else:
w[k] = "B"
else:
if w[k] != c.lower():
w[k] = c.lower()
else:
if w[k] != "a":
w[k] = "a"
else:
w[k] = "b"
print("".join(w))
```
| 46,811
|
[
0.0982666015625,
-0.0005583763122558594,
0.1502685546875,
0.3740234375,
-0.68408203125,
-0.51708984375,
-0.2744140625,
0.054473876953125,
-0.0865478515625,
0.6259765625,
0.93798828125,
-0.138916015625,
0.399169921875,
-0.82080078125,
-0.67236328125,
0.19775390625,
-0.66064453125,
-0.66357421875,
-0.436279296875,
0.07611083984375,
-0.0726318359375,
0.24267578125,
-1.583984375,
-0.4150390625,
-0.54296875,
1.005859375,
0.36083984375,
0.052825927734375,
0.79833984375,
0.80322265625,
-0.019683837890625,
-0.52294921875,
0.6640625,
-1.064453125,
-0.58740234375,
-0.5146484375,
0.6630859375,
-0.18115234375,
0.06341552734375,
-0.51904296875,
0.366943359375,
-0.576171875,
0.435791015625,
-0.6708984375,
-0.99365234375,
-0.0347900390625,
-0.35986328125,
0.153564453125,
-0.03265380859375,
-0.62841796875,
0.5048828125,
-0.51904296875,
0.4150390625,
-0.11651611328125,
0.08819580078125,
0.03204345703125,
0.1973876953125,
-0.2978515625,
-0.830078125,
0.505859375,
0.03204345703125,
0.09393310546875,
0.1881103515625,
-0.53076171875,
-0.017608642578125,
-0.0902099609375,
-0.058685302734375,
-0.422119140625,
-0.046234130859375,
-0.52978515625,
-0.00450897216796875,
0.56591796875,
-0.73291015625,
-0.418212890625,
-0.419677734375,
0.37060546875,
0.08624267578125,
-0.0193023681640625,
-0.78759765625,
0.73193359375,
-0.08074951171875,
1.03125,
0.445556640625,
0.08489990234375,
-0.70263671875,
-0.58203125,
0.16845703125,
0.413818359375,
0.282958984375,
0.08349609375,
-0.07330322265625,
0.314208984375,
-0.59619140625,
-0.0701904296875,
0.334716796875,
0.71875,
-0.39599609375,
0.22314453125,
0.089599609375,
-0.0687255859375,
0.57568359375,
0.744140625,
-0.222900390625,
0.794921875,
-0.69580078125,
0.15771484375,
0.53564453125,
0.1690673828125,
-0.277587890625,
-0.1500244140625,
-0.38525390625,
-0.169189453125,
0.4609375,
0.376708984375,
-0.154052734375,
0.865234375,
0.1163330078125,
0.39111328125,
-0.5966796875,
0.058135986328125,
0.8955078125,
0.071044921875,
0.5498046875,
-0.2303466796875,
0.046875,
-0.541015625,
-0.783203125,
1.0009765625,
-0.66796875,
-0.2274169921875,
0.368408203125,
0.037811279296875,
-0.07525634765625,
0.328125,
-0.1282958984375,
0.7822265625,
0.036102294921875,
0.377685546875,
0.9541015625,
-0.5380859375,
0.68798828125,
0.10638427734375,
-0.10504150390625,
1.296875,
0.22705078125,
-0.11956787109375,
0.779296875,
0.421630859375,
-1.02734375,
0.258544921875,
-1.138671875,
0.70654296875,
0.6513671875,
0.0418701171875,
-0.1998291015625,
0.27587890625,
0.0263519287109375,
0.340087890625,
0.28076171875,
-0.0587158203125,
-0.66845703125,
0.018768310546875,
-0.5849609375,
0.716796875,
-0.1474609375,
0.5966796875,
-0.285400390625,
-0.420654296875,
-0.1676025390625,
-0.256591796875,
0.335693359375,
-0.560546875,
-0.1527099609375,
1.1337890625,
0.357177734375,
0.9833984375,
0.4873046875,
-0.1998291015625,
0.2052001953125,
0.1490478515625,
-0.32275390625,
0.27294921875,
0.548828125,
0.323486328125,
0.267822265625,
0.020263671875,
-0.1500244140625,
-0.452880859375,
-0.8916015625,
-0.52099609375,
0.5576171875,
0.06927490234375,
-0.1654052734375,
0.2493896484375,
0.1407470703125,
0.200927734375,
-0.986328125,
0.031646728515625,
0.1195068359375,
-0.86962890625,
-0.297607421875,
0.650390625,
-0.56103515625,
0.27197265625,
-0.146240234375,
-0.63427734375,
0.0894775390625,
0.8896484375,
-0.32666015625,
0.313720703125,
0.744140625,
0.057373046875,
-0.38818359375,
-0.142822265625,
-0.07574462890625,
-0.017303466796875,
-0.599609375,
0.79443359375,
-0.53564453125,
-0.32861328125,
0.479736328125,
0.7470703125,
0.236328125,
0.81591796875,
-0.185302734375,
-0.4365234375,
0.71923828125,
1.00390625,
0.1097412109375,
0.490478515625,
0.271484375,
0.99951171875,
0.6748046875,
1.087890625,
0.69970703125,
0.265625,
0.6435546875,
1.1396484375,
-0.035797119140625,
0.1571044921875,
0.08990478515625,
0.640625,
0.2386474609375,
0.81982421875,
0.0462646484375,
0.343994140625,
-0.350830078125,
0.4853515625,
-0.353271484375,
0.2071533203125,
-0.439697265625,
0.452392578125,
0.1319580078125,
0.61083984375,
-0.52294921875,
-0.21875,
0.292724609375,
0.57958984375,
-0.94384765625,
-0.452392578125,
-0.255126953125,
0.162841796875,
0.250244140625,
0.046875,
0.471923828125,
0.09295654296875,
0.6025390625,
0.583984375,
-0.187255859375,
-0.869140625,
-0.496826171875,
-0.91845703125,
-0.5546875,
-0.43701171875,
-0.87548828125,
-0.29541015625,
0.54833984375,
-1.3095703125,
0.313232421875,
0.004405975341796875,
-0.202392578125,
0.283203125,
-0.304931640625,
0.7900390625,
-0.188720703125,
0.72412109375,
-0.79638671875,
0.268798828125,
-0.12078857421875,
0.7783203125,
-0.61962890625,
0.0751953125,
0.0211639404296875,
-0.58837890625,
0.5986328125,
-0.039825439453125,
0.379150390625,
-0.34814453125,
-0.8134765625,
-0.84814453125,
-0.31787109375,
0.0185546875,
-0.44677734375,
0.287353515625,
-0.990234375,
0.93994140625,
0.572265625,
-0.45947265625,
0.64453125,
1.1328125,
-1.08984375,
0.62158203125,
0.258056640625,
0.0977783203125,
-0.740234375,
0.7373046875,
0.544921875,
0.333251953125,
-0.7861328125,
-0.73486328125,
-0.51416015625,
-0.0640869140625,
0.2293701171875,
-0.65869140625,
-0.4521484375,
0.30517578125,
-0.1640625,
-1.0556640625,
0.888671875,
-0.8583984375,
-0.73486328125,
-0.54345703125,
-0.55029296875,
0.79150390625,
0.9228515625,
0.292724609375,
-0.08087158203125,
-0.2861328125,
-0.021484375,
0.86767578125,
0.422607421875,
-0.91796875,
-0.06573486328125,
0.432861328125,
-0.07220458984375,
0.2347412109375,
0.3388671875,
-0.229248046875,
-0.2484130859375,
0.08404541015625,
0.20703125,
0.6220703125,
0.2425537109375,
0.29296875,
0.295654296875,
0.343017578125,
-0.7890625,
0.0041656494140625,
-0.047821044921875,
0.64599609375,
0.45556640625,
0.43701171875,
0.1710205078125,
-0.342041015625,
-0.63427734375,
-1.212890625,
0.294677734375,
0.0275726318359375,
0.58740234375,
-0.59326171875,
0.697265625,
0.1278076171875,
-0.59375,
0.487060546875,
-0.383544921875,
0.279052734375,
1.1884765625,
-0.3330078125,
0.341796875,
-0.34521484375,
0.409912109375,
-0.256103515625,
0.06048583984375,
0.6171875,
0.19921875,
0.486083984375,
-0.1539306640625,
-0.322998046875,
-0.5009765625,
-0.1744384765625,
-0.12109375,
-0.429931640625,
0.2135009765625,
-0.186279296875,
-0.333251953125,
-0.732421875,
0.68310546875,
0.94140625,
0.4921875,
0.38623046875,
0.7587890625,
0.2705078125,
0.65478515625,
0.6953125,
-0.4091796875,
-0.057586669921875,
-0.79638671875,
1.0546875,
0.1910400390625,
-0.1053466796875,
-0.50390625,
-0.3759765625,
-0.384521484375,
-0.060028076171875,
-0.11016845703125,
-0.134033203125,
-1.0107421875,
-0.002124786376953125,
-0.09576416015625,
0.611328125,
-0.91015625,
0.11883544921875,
-0.2027587890625,
0.486328125,
0.5595703125,
-0.89501953125,
0.0301513671875,
-0.8681640625,
0.7392578125,
0.640625,
0.0309600830078125,
-0.830078125,
-0.1658935546875,
-0.62353515625,
-0.86181640625,
0.1531982421875,
0.87890625,
0.39013671875,
0.267333984375,
-1.1767578125,
0.70654296875,
0.174072265625,
-0.473388671875,
0.0557861328125,
-0.01611328125,
0.445556640625,
-0.029083251953125,
0.193359375,
-0.77001953125,
-0.9931640625,
0.265625,
-1.1279296875,
0.36328125,
-0.487548828125,
0.62109375,
0.079345703125,
0.1837158203125,
-0.0946044921875,
0.336181640625,
-0.2191162109375,
0.1610107421875,
-0.07135009765625,
0.385986328125,
-0.99462890625,
-0.58203125,
0.433837890625,
0.06103515625,
-0.337890625,
0.7705078125,
-0.115234375,
-0.360595703125,
0.2037353515625,
0.36279296875,
-0.125244140625,
0.32421875,
-0.63720703125,
0.25,
-0.201171875,
-0.479248046875,
0.050079345703125,
-0.55615234375,
0.50927734375,
-0.173583984375,
-0.73291015625,
-0.1463623046875,
-1.2099609375,
-0.485595703125,
0.193603515625,
-0.57080078125,
0.61767578125,
0.09527587890625,
-0.055877685546875,
0.2073974609375,
-0.580078125,
-0.53173828125,
-0.232666015625,
-0.31201171875,
-0.3564453125,
0.243896484375,
0.282958984375,
0.66650390625,
0.00004690885543823242,
-0.58984375,
0.3466796875,
0.10662841796875,
0.021209716796875,
-0.67822265625,
-0.2227783203125,
-0.0804443359375,
-0.49365234375,
-0.1705322265625,
0.33544921875,
0.008453369140625,
0.4541015625,
0.6005859375,
0.273193359375,
0.486328125,
0.21337890625,
-0.56005859375,
1.0302734375,
0.055572509765625,
-0.95849609375,
-0.37451171875,
0.39501953125,
0.05450439453125,
0.42529296875,
0.252685546875,
-0.986328125,
-1.0703125,
-1.154296875,
0.164794921875,
-0.8115234375,
-0.0684814453125,
-0.93017578125,
-0.232177734375,
-0.5546875,
0.8779296875,
-0.207275390625,
-0.6923828125,
0.42529296875,
-1.251953125,
-0.0714111328125,
-0.74072265625,
-0.33203125,
-0.39111328125,
-0.6552734375,
0.042205810546875,
1.1484375,
0.277587890625,
0.411865234375,
-0.0625,
-0.323974609375,
0.1416015625,
-0.0253448486328125,
-0.6787109375,
-0.525390625,
-0.08734130859375,
-0.03875732421875,
-0.1278076171875,
-0.1219482421875,
-0.6865234375,
0.79248046875,
-0.783203125,
0.1951904296875,
0.03564453125,
-0.1883544921875,
-0.0711669921875,
-0.46533203125,
1.337890625,
-0.56201171875,
0.0209503173828125,
-0.361328125,
0.5712890625,
0.494384765625,
-0.192138671875,
0.0201263427734375,
-0.67041015625,
-0.79833984375,
-1.2763671875,
0.79443359375,
-0.31640625,
0.09576416015625,
-0.591796875,
-0.1597900390625,
1.1103515625,
-0.1798095703125,
0.2178955078125,
0.76220703125,
0.0836181640625,
0.1531982421875,
-0.66650390625,
0.62109375,
0.56591796875,
-0.70166015625,
-0.0240936279296875,
0.31298828125,
-0.74462890625,
0.041534423828125,
-0.57373046875,
-0.8662109375,
-0.75732421875,
-0.014495849609375,
1.5166015625,
-0.453857421875,
0.67822265625,
-0.093505859375,
-0.9404296875,
-0.483154296875,
0.78271484375,
0.292236328125,
-0.181396484375,
0.9072265625,
-0.2359619140625,
-0.1849365234375,
0.13330078125,
-0.029083251953125,
-0.50390625,
-0.62548828125,
0.986328125,
-0.70556640625,
-0.30126953125,
0.9345703125,
0.77978515625,
-0.8642578125,
-0.8154296875,
-0.0845947265625,
-0.068603515625,
-0.48095703125,
-0.87939453125,
0.015625,
0.7705078125,
-0.6455078125,
-0.1767578125,
0.460693359375,
0.1719970703125,
0.4111328125,
-0.144775390625,
0.283447265625,
-0.211181640625,
0.6328125,
-0.0110321044921875,
-0.68798828125,
-0.294677734375,
-0.81396484375,
-0.193115234375,
-0.317626953125,
-0.03387451171875,
1.1171875,
-0.427734375,
0.28857421875,
0.60107421875,
-0.0655517578125,
0.364013671875,
-0.246826171875,
-0.279296875,
0.0650634765625,
-0.454345703125,
-0.191162109375,
-0.07080078125,
0.17236328125,
-0.25830078125,
0.43603515625,
-0.79052734375,
-0.061737060546875,
0.297119140625,
0.689453125,
0.0257415771484375,
-0.89013671875,
-0.55517578125,
-1.2607421875,
-0.474365234375,
-0.274658203125,
-0.50048828125,
-0.412109375,
0.462890625,
-0.091064453125,
-0.2119140625,
0.0096282958984375,
0.28271484375,
-0.9560546875,
0.822265625,
-0.46728515625,
0.56982421875,
-0.5673828125,
-0.2259521484375,
-0.75537109375,
0.0156707763671875,
-0.2293701171875,
-0.191650390625,
-0.285888671875,
0.3369140625,
-0.2244873046875,
0.54052734375,
-0.455078125,
0.328369140625,
-0.3466796875,
-0.5595703125,
-0.415771484375,
0.1357421875,
-0.464599609375,
0.52197265625,
0.9228515625,
0.1446533203125,
0.374267578125,
-0.416748046875,
-0.282470703125,
0.036956787109375,
0.1844482421875,
0.447509765625,
0.00982666015625,
0.06378173828125,
-0.39013671875,
0.002140045166015625,
-0.91845703125,
0.301025390625,
0.01149749755859375,
0.153564453125,
0.20361328125,
-0.2220458984375,
0.11474609375,
1.01171875,
-0.2352294921875,
0.41796875,
-0.239501953125,
0.2763671875,
0.623046875,
0.1368408203125,
-0.046295166015625,
0.6767578125,
0.462646484375,
-0.11798095703125,
0.09173583984375,
0.36962890625,
0.2135009765625,
0.382568359375,
-0.1324462890625,
-1.0146484375,
-0.99072265625,
-0.2435302734375,
0.1590576171875,
0.5810546875,
0.5712890625,
-0.5283203125,
-0.01361846923828125,
-0.366943359375,
-0.751953125,
0.087890625,
-1.4970703125,
-0.58056640625,
0.464111328125,
-0.407958984375,
-0.5634765625,
-0.49462890625,
-0.5361328125,
-0.2056884765625,
0.07891845703125,
0.0219879150390625,
-0.390380859375,
0.418212890625,
0.027923583984375,
0.2491455078125,
-0.318115234375,
0.037628173828125,
0.2115478515625,
0.53076171875,
-0.251220703125,
-0.55615234375,
0.1134033203125,
0.90966796875,
0.0775146484375,
0.293701171875,
-0.61083984375,
0.5048828125,
-0.08831787109375,
-0.1123046875,
-0.124267578125,
0.111572265625,
-0.137939453125,
0.58447265625,
-1.08984375,
-0.5869140625,
-0.357177734375,
0.3408203125,
0.389892578125,
-0.45751953125,
-0.55078125,
0.849609375,
0.59423828125,
-0.255126953125,
0.44677734375,
0.189453125,
0.6123046875,
-0.236083984375,
-0.1993408203125,
-0.2015380859375,
0.28369140625,
0.6455078125,
0.51123046875,
0.0013952255249023438,
0.402099609375,
0.77392578125,
-0.005542755126953125,
-0.265380859375,
0.3662109375,
0.30810546875,
-0.185791015625,
0.32861328125,
-0.10888671875,
-0.450927734375,
0.0621337890625,
-0.767578125,
0.662109375,
-0.23193359375,
0.2154541015625,
-0.1864013671875,
-0.74658203125,
0.81201171875,
-0.329833984375,
0.078369140625,
0.2900390625,
-0.51513671875,
0.30859375,
0.64013671875,
0.322265625,
0.033599853515625,
0.44091796875,
0.76025390625,
0.56640625,
0.6396484375,
0.233154296875,
0.480712890625,
-0.60791015625,
-0.205078125,
0.349365234375,
-0.1036376953125,
-0.603515625,
-0.412109375,
-0.68408203125,
0.378662109375,
-0.227294921875,
-0.260986328125,
0.5859375,
-0.70458984375,
0.2427978515625,
-0.0623779296875,
0.68701171875,
-0.2030029296875,
0.478759765625,
0.55419921875,
-0.422119140625,
-0.5400390625,
1.333984375,
-0.0161285400390625,
0.57958984375,
0.319091796875,
0.9814453125,
-0.11773681640625,
1.396484375,
0.826171875,
-0.17822265625,
0.1002197265625,
0.289306640625,
-0.411376953125,
-0.74365234375,
-0.40087890625,
-0.1370849609375,
-0.1455078125,
-0.61767578125,
-0.29833984375,
-0.030059814453125,
0.8974609375,
0.11083984375,
-0.798828125,
-0.433349609375,
0.2353515625,
-0.89501953125,
0.397705078125,
0.328125,
0.06658935546875,
-0.0044097900390625,
0.2176513671875,
0.0047149658203125,
-0.765625,
0.356201171875,
-0.4775390625,
0.71484375,
-0.6611328125,
-0.078125,
-0.62353515625,
-0.828125,
-0.26806640625,
0.034454345703125,
-0.36572265625,
-1.1171875,
0.364501953125,
0.5322265625,
0.1077880859375,
0.58056640625,
-0.66748046875,
0.4501953125,
0.89599609375,
1.017578125,
0.251220703125,
0.7392578125,
0.188720703125,
-0.2705078125,
0.12890625,
-0.3291015625,
0.50390625,
-0.1005859375,
0.2470703125,
-0.671875,
0.2430419921875,
-0.17919921875,
-1.435546875,
-0.2509765625,
0.485107421875,
0.385498046875,
-0.67236328125,
-0.982421875,
-0.267578125,
-0.35498046875,
-0.1768798828125,
-0.5380859375,
0.6962890625,
-0.025482177734375,
0.3291015625,
-0.4169921875,
-1.16015625,
4.453125,
0.91357421875,
0.99658203125,
0.1136474609375,
0.71826171875,
0.87353515625,
0.31689453125,
-0.2332763671875,
-0.53173828125,
-0.57421875,
0.1478271484375,
-0.28466796875,
0.0022449493408203125,
0.86376953125,
0.242919921875,
0.712890625,
-0.52685546875,
0.32861328125,
-0.29296875,
-0.99560546875,
-0.673828125,
0.289306640625,
-0.179931640625,
0.222900390625,
0.0174713134765625,
0.1629638671875,
0.54248046875,
-1.0595703125,
0.22265625,
-0.416015625,
0.1231689453125,
-0.394287109375,
1.0009765625,
0.06378173828125,
-0.0028896331787109375,
0.402099609375,
-0.312255859375,
-0.388427734375,
-0.1434326171875,
0.1798095703125,
-0.231201171875,
-0.1859130859375,
0.69580078125,
-0.483642578125,
-0.132568359375,
0.24609375,
-0.69580078125,
0.43603515625,
0.56689453125,
-0.72900390625,
0.7314453125,
-0.1881103515625,
0.64599609375,
-0.6826171875,
-0.55615234375,
0.15771484375,
-0.05694580078125,
0.0034732818603515625,
-0.5908203125,
0.287841796875,
0.07147216796875,
0.2998046875,
-0.00841522216796875,
0.552734375,
-0.8828125,
1.1884765625,
-0.120361328125,
0.173095703125,
-0.826171875,
-0.21337890625,
-0.1468505859375,
-0.2169189453125,
-0.299560546875,
-0.6044921875,
0.68310546875,
-0.031280517578125,
0.00037860870361328125,
0.77685546875,
0.42822265625,
-0.70458984375,
0.082763671875,
-0.04449462890625,
-0.410400390625,
-0.472412109375,
0.50341796875,
1.0302734375,
-0.439208984375,
-0.215087890625,
-0.322265625,
0.27001953125,
0.66748046875,
0.515625,
0.1822509765625,
-0.35986328125,
-0.248046875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya loves hockey very much. One day, as he was watching a hockey match, he fell asleep. Petya dreamt of being appointed to change a hockey team's name. Thus, Petya was given the original team name w and the collection of forbidden substrings s1, s2, ..., sn. All those strings consist of uppercase and lowercase Latin letters. String w has the length of |w|, its characters are numbered from 1 to |w|.
First Petya should find all the occurrences of forbidden substrings in the w string. During the search of substrings the case of letter shouldn't be taken into consideration. That is, strings "aBC" and "ABc" are considered equal.
After that Petya should perform the replacement of all letters covered by the occurrences. More formally: a letter in the position i should be replaced by any other one if for position i in string w there exist pair of indices l, r (1 ≤ l ≤ i ≤ r ≤ |w|) such that substring w[l ... r] is contained in the collection s1, s2, ..., sn, when using case insensitive comparison. During the replacement the letter's case should remain the same. Petya is not allowed to replace the letters that aren't covered by any forbidden substring.
Letter letter (uppercase or lowercase) is considered lucky for the hockey players. That's why Petya should perform the changes so that the letter occurred in the resulting string as many times as possible. Help Petya to find such resulting string. If there are several such strings, find the one that comes first lexicographically.
Note that the process of replacements is not repeated, it occurs only once. That is, if after Petya's replacements the string started to contain new occurrences of bad substrings, Petya pays no attention to them.
Input
The first line contains the only integer n (1 ≤ n ≤ 100) — the number of forbidden substrings in the collection. Next n lines contain these substrings. The next line contains string w. All those n + 1 lines are non-empty strings consisting of uppercase and lowercase Latin letters whose length does not exceed 100. The last line contains a lowercase letter letter.
Output
Output the only line — Petya's resulting string with the maximum number of letters letter. If there are several answers then output the one that comes first lexicographically.
The lexicographical comparison is performed by the standard < operator in modern programming languages. The line a is lexicographically smaller than the line b, if a is a prefix of b, or there exists such an i (1 ≤ i ≤ |a|), that ai < bi, and for any j (1 ≤ j < i) aj = bj. |a| stands for the length of string a.
Examples
Input
3
bers
ucky
elu
PetrLoveLuckyNumbers
t
Output
PetrLovtTttttNumtttt
Input
4
hello
party
abefglghjdhfgj
IVan
petrsmatchwin
a
Output
petrsmatchwin
Input
2
aCa
cba
abAcaba
c
Output
abCacba
Tags: implementation, strings
Correct Solution:
```
n= int(input())#how many word
b = []
for i in range(n):
b.append(input())# put the word in a list
w = input()#what we whant to change
let = input()#which we change in to
bad=[]
for i in range(len(w)):
bad.append(True)
for i in range(len(w)):
mx = 0
for j in range(n):
if w[i:].lower().startswith(b[j].lower()):
mx =max(mx,len(b[j]))
for j in range(mx):
bad[i + j] = False
ans = ''
for i in range(len(w)):
if bad[i]:
ans += w[i]
else:
if w[i].lower() == let:
newlet = 'a' if let != 'a' else 'b'
ans += newlet.lower() if w[i].lower() == w[i] else \
newlet.upper()
else:
if w[i].lower() == w[i]:
ans += let
else:
ans+=let.upper()
print(ans)
# Made By Mostafa_Khaled
```
| 46,812
|
[
0.0982666015625,
-0.0005583763122558594,
0.1502685546875,
0.3740234375,
-0.68408203125,
-0.51708984375,
-0.2744140625,
0.054473876953125,
-0.0865478515625,
0.6259765625,
0.93798828125,
-0.138916015625,
0.399169921875,
-0.82080078125,
-0.67236328125,
0.19775390625,
-0.66064453125,
-0.66357421875,
-0.436279296875,
0.07611083984375,
-0.0726318359375,
0.24267578125,
-1.583984375,
-0.4150390625,
-0.54296875,
1.005859375,
0.36083984375,
0.052825927734375,
0.79833984375,
0.80322265625,
-0.019683837890625,
-0.52294921875,
0.6640625,
-1.064453125,
-0.58740234375,
-0.5146484375,
0.6630859375,
-0.18115234375,
0.06341552734375,
-0.51904296875,
0.366943359375,
-0.576171875,
0.435791015625,
-0.6708984375,
-0.99365234375,
-0.0347900390625,
-0.35986328125,
0.153564453125,
-0.03265380859375,
-0.62841796875,
0.5048828125,
-0.51904296875,
0.4150390625,
-0.11651611328125,
0.08819580078125,
0.03204345703125,
0.1973876953125,
-0.2978515625,
-0.830078125,
0.505859375,
0.03204345703125,
0.09393310546875,
0.1881103515625,
-0.53076171875,
-0.017608642578125,
-0.0902099609375,
-0.058685302734375,
-0.422119140625,
-0.046234130859375,
-0.52978515625,
-0.00450897216796875,
0.56591796875,
-0.73291015625,
-0.418212890625,
-0.419677734375,
0.37060546875,
0.08624267578125,
-0.0193023681640625,
-0.78759765625,
0.73193359375,
-0.08074951171875,
1.03125,
0.445556640625,
0.08489990234375,
-0.70263671875,
-0.58203125,
0.16845703125,
0.413818359375,
0.282958984375,
0.08349609375,
-0.07330322265625,
0.314208984375,
-0.59619140625,
-0.0701904296875,
0.334716796875,
0.71875,
-0.39599609375,
0.22314453125,
0.089599609375,
-0.0687255859375,
0.57568359375,
0.744140625,
-0.222900390625,
0.794921875,
-0.69580078125,
0.15771484375,
0.53564453125,
0.1690673828125,
-0.277587890625,
-0.1500244140625,
-0.38525390625,
-0.169189453125,
0.4609375,
0.376708984375,
-0.154052734375,
0.865234375,
0.1163330078125,
0.39111328125,
-0.5966796875,
0.058135986328125,
0.8955078125,
0.071044921875,
0.5498046875,
-0.2303466796875,
0.046875,
-0.541015625,
-0.783203125,
1.0009765625,
-0.66796875,
-0.2274169921875,
0.368408203125,
0.037811279296875,
-0.07525634765625,
0.328125,
-0.1282958984375,
0.7822265625,
0.036102294921875,
0.377685546875,
0.9541015625,
-0.5380859375,
0.68798828125,
0.10638427734375,
-0.10504150390625,
1.296875,
0.22705078125,
-0.11956787109375,
0.779296875,
0.421630859375,
-1.02734375,
0.258544921875,
-1.138671875,
0.70654296875,
0.6513671875,
0.0418701171875,
-0.1998291015625,
0.27587890625,
0.0263519287109375,
0.340087890625,
0.28076171875,
-0.0587158203125,
-0.66845703125,
0.018768310546875,
-0.5849609375,
0.716796875,
-0.1474609375,
0.5966796875,
-0.285400390625,
-0.420654296875,
-0.1676025390625,
-0.256591796875,
0.335693359375,
-0.560546875,
-0.1527099609375,
1.1337890625,
0.357177734375,
0.9833984375,
0.4873046875,
-0.1998291015625,
0.2052001953125,
0.1490478515625,
-0.32275390625,
0.27294921875,
0.548828125,
0.323486328125,
0.267822265625,
0.020263671875,
-0.1500244140625,
-0.452880859375,
-0.8916015625,
-0.52099609375,
0.5576171875,
0.06927490234375,
-0.1654052734375,
0.2493896484375,
0.1407470703125,
0.200927734375,
-0.986328125,
0.031646728515625,
0.1195068359375,
-0.86962890625,
-0.297607421875,
0.650390625,
-0.56103515625,
0.27197265625,
-0.146240234375,
-0.63427734375,
0.0894775390625,
0.8896484375,
-0.32666015625,
0.313720703125,
0.744140625,
0.057373046875,
-0.38818359375,
-0.142822265625,
-0.07574462890625,
-0.017303466796875,
-0.599609375,
0.79443359375,
-0.53564453125,
-0.32861328125,
0.479736328125,
0.7470703125,
0.236328125,
0.81591796875,
-0.185302734375,
-0.4365234375,
0.71923828125,
1.00390625,
0.1097412109375,
0.490478515625,
0.271484375,
0.99951171875,
0.6748046875,
1.087890625,
0.69970703125,
0.265625,
0.6435546875,
1.1396484375,
-0.035797119140625,
0.1571044921875,
0.08990478515625,
0.640625,
0.2386474609375,
0.81982421875,
0.0462646484375,
0.343994140625,
-0.350830078125,
0.4853515625,
-0.353271484375,
0.2071533203125,
-0.439697265625,
0.452392578125,
0.1319580078125,
0.61083984375,
-0.52294921875,
-0.21875,
0.292724609375,
0.57958984375,
-0.94384765625,
-0.452392578125,
-0.255126953125,
0.162841796875,
0.250244140625,
0.046875,
0.471923828125,
0.09295654296875,
0.6025390625,
0.583984375,
-0.187255859375,
-0.869140625,
-0.496826171875,
-0.91845703125,
-0.5546875,
-0.43701171875,
-0.87548828125,
-0.29541015625,
0.54833984375,
-1.3095703125,
0.313232421875,
0.004405975341796875,
-0.202392578125,
0.283203125,
-0.304931640625,
0.7900390625,
-0.188720703125,
0.72412109375,
-0.79638671875,
0.268798828125,
-0.12078857421875,
0.7783203125,
-0.61962890625,
0.0751953125,
0.0211639404296875,
-0.58837890625,
0.5986328125,
-0.039825439453125,
0.379150390625,
-0.34814453125,
-0.8134765625,
-0.84814453125,
-0.31787109375,
0.0185546875,
-0.44677734375,
0.287353515625,
-0.990234375,
0.93994140625,
0.572265625,
-0.45947265625,
0.64453125,
1.1328125,
-1.08984375,
0.62158203125,
0.258056640625,
0.0977783203125,
-0.740234375,
0.7373046875,
0.544921875,
0.333251953125,
-0.7861328125,
-0.73486328125,
-0.51416015625,
-0.0640869140625,
0.2293701171875,
-0.65869140625,
-0.4521484375,
0.30517578125,
-0.1640625,
-1.0556640625,
0.888671875,
-0.8583984375,
-0.73486328125,
-0.54345703125,
-0.55029296875,
0.79150390625,
0.9228515625,
0.292724609375,
-0.08087158203125,
-0.2861328125,
-0.021484375,
0.86767578125,
0.422607421875,
-0.91796875,
-0.06573486328125,
0.432861328125,
-0.07220458984375,
0.2347412109375,
0.3388671875,
-0.229248046875,
-0.2484130859375,
0.08404541015625,
0.20703125,
0.6220703125,
0.2425537109375,
0.29296875,
0.295654296875,
0.343017578125,
-0.7890625,
0.0041656494140625,
-0.047821044921875,
0.64599609375,
0.45556640625,
0.43701171875,
0.1710205078125,
-0.342041015625,
-0.63427734375,
-1.212890625,
0.294677734375,
0.0275726318359375,
0.58740234375,
-0.59326171875,
0.697265625,
0.1278076171875,
-0.59375,
0.487060546875,
-0.383544921875,
0.279052734375,
1.1884765625,
-0.3330078125,
0.341796875,
-0.34521484375,
0.409912109375,
-0.256103515625,
0.06048583984375,
0.6171875,
0.19921875,
0.486083984375,
-0.1539306640625,
-0.322998046875,
-0.5009765625,
-0.1744384765625,
-0.12109375,
-0.429931640625,
0.2135009765625,
-0.186279296875,
-0.333251953125,
-0.732421875,
0.68310546875,
0.94140625,
0.4921875,
0.38623046875,
0.7587890625,
0.2705078125,
0.65478515625,
0.6953125,
-0.4091796875,
-0.057586669921875,
-0.79638671875,
1.0546875,
0.1910400390625,
-0.1053466796875,
-0.50390625,
-0.3759765625,
-0.384521484375,
-0.060028076171875,
-0.11016845703125,
-0.134033203125,
-1.0107421875,
-0.002124786376953125,
-0.09576416015625,
0.611328125,
-0.91015625,
0.11883544921875,
-0.2027587890625,
0.486328125,
0.5595703125,
-0.89501953125,
0.0301513671875,
-0.8681640625,
0.7392578125,
0.640625,
0.0309600830078125,
-0.830078125,
-0.1658935546875,
-0.62353515625,
-0.86181640625,
0.1531982421875,
0.87890625,
0.39013671875,
0.267333984375,
-1.1767578125,
0.70654296875,
0.174072265625,
-0.473388671875,
0.0557861328125,
-0.01611328125,
0.445556640625,
-0.029083251953125,
0.193359375,
-0.77001953125,
-0.9931640625,
0.265625,
-1.1279296875,
0.36328125,
-0.487548828125,
0.62109375,
0.079345703125,
0.1837158203125,
-0.0946044921875,
0.336181640625,
-0.2191162109375,
0.1610107421875,
-0.07135009765625,
0.385986328125,
-0.99462890625,
-0.58203125,
0.433837890625,
0.06103515625,
-0.337890625,
0.7705078125,
-0.115234375,
-0.360595703125,
0.2037353515625,
0.36279296875,
-0.125244140625,
0.32421875,
-0.63720703125,
0.25,
-0.201171875,
-0.479248046875,
0.050079345703125,
-0.55615234375,
0.50927734375,
-0.173583984375,
-0.73291015625,
-0.1463623046875,
-1.2099609375,
-0.485595703125,
0.193603515625,
-0.57080078125,
0.61767578125,
0.09527587890625,
-0.055877685546875,
0.2073974609375,
-0.580078125,
-0.53173828125,
-0.232666015625,
-0.31201171875,
-0.3564453125,
0.243896484375,
0.282958984375,
0.66650390625,
0.00004690885543823242,
-0.58984375,
0.3466796875,
0.10662841796875,
0.021209716796875,
-0.67822265625,
-0.2227783203125,
-0.0804443359375,
-0.49365234375,
-0.1705322265625,
0.33544921875,
0.008453369140625,
0.4541015625,
0.6005859375,
0.273193359375,
0.486328125,
0.21337890625,
-0.56005859375,
1.0302734375,
0.055572509765625,
-0.95849609375,
-0.37451171875,
0.39501953125,
0.05450439453125,
0.42529296875,
0.252685546875,
-0.986328125,
-1.0703125,
-1.154296875,
0.164794921875,
-0.8115234375,
-0.0684814453125,
-0.93017578125,
-0.232177734375,
-0.5546875,
0.8779296875,
-0.207275390625,
-0.6923828125,
0.42529296875,
-1.251953125,
-0.0714111328125,
-0.74072265625,
-0.33203125,
-0.39111328125,
-0.6552734375,
0.042205810546875,
1.1484375,
0.277587890625,
0.411865234375,
-0.0625,
-0.323974609375,
0.1416015625,
-0.0253448486328125,
-0.6787109375,
-0.525390625,
-0.08734130859375,
-0.03875732421875,
-0.1278076171875,
-0.1219482421875,
-0.6865234375,
0.79248046875,
-0.783203125,
0.1951904296875,
0.03564453125,
-0.1883544921875,
-0.0711669921875,
-0.46533203125,
1.337890625,
-0.56201171875,
0.0209503173828125,
-0.361328125,
0.5712890625,
0.494384765625,
-0.192138671875,
0.0201263427734375,
-0.67041015625,
-0.79833984375,
-1.2763671875,
0.79443359375,
-0.31640625,
0.09576416015625,
-0.591796875,
-0.1597900390625,
1.1103515625,
-0.1798095703125,
0.2178955078125,
0.76220703125,
0.0836181640625,
0.1531982421875,
-0.66650390625,
0.62109375,
0.56591796875,
-0.70166015625,
-0.0240936279296875,
0.31298828125,
-0.74462890625,
0.041534423828125,
-0.57373046875,
-0.8662109375,
-0.75732421875,
-0.014495849609375,
1.5166015625,
-0.453857421875,
0.67822265625,
-0.093505859375,
-0.9404296875,
-0.483154296875,
0.78271484375,
0.292236328125,
-0.181396484375,
0.9072265625,
-0.2359619140625,
-0.1849365234375,
0.13330078125,
-0.029083251953125,
-0.50390625,
-0.62548828125,
0.986328125,
-0.70556640625,
-0.30126953125,
0.9345703125,
0.77978515625,
-0.8642578125,
-0.8154296875,
-0.0845947265625,
-0.068603515625,
-0.48095703125,
-0.87939453125,
0.015625,
0.7705078125,
-0.6455078125,
-0.1767578125,
0.460693359375,
0.1719970703125,
0.4111328125,
-0.144775390625,
0.283447265625,
-0.211181640625,
0.6328125,
-0.0110321044921875,
-0.68798828125,
-0.294677734375,
-0.81396484375,
-0.193115234375,
-0.317626953125,
-0.03387451171875,
1.1171875,
-0.427734375,
0.28857421875,
0.60107421875,
-0.0655517578125,
0.364013671875,
-0.246826171875,
-0.279296875,
0.0650634765625,
-0.454345703125,
-0.191162109375,
-0.07080078125,
0.17236328125,
-0.25830078125,
0.43603515625,
-0.79052734375,
-0.061737060546875,
0.297119140625,
0.689453125,
0.0257415771484375,
-0.89013671875,
-0.55517578125,
-1.2607421875,
-0.474365234375,
-0.274658203125,
-0.50048828125,
-0.412109375,
0.462890625,
-0.091064453125,
-0.2119140625,
0.0096282958984375,
0.28271484375,
-0.9560546875,
0.822265625,
-0.46728515625,
0.56982421875,
-0.5673828125,
-0.2259521484375,
-0.75537109375,
0.0156707763671875,
-0.2293701171875,
-0.191650390625,
-0.285888671875,
0.3369140625,
-0.2244873046875,
0.54052734375,
-0.455078125,
0.328369140625,
-0.3466796875,
-0.5595703125,
-0.415771484375,
0.1357421875,
-0.464599609375,
0.52197265625,
0.9228515625,
0.1446533203125,
0.374267578125,
-0.416748046875,
-0.282470703125,
0.036956787109375,
0.1844482421875,
0.447509765625,
0.00982666015625,
0.06378173828125,
-0.39013671875,
0.002140045166015625,
-0.91845703125,
0.301025390625,
0.01149749755859375,
0.153564453125,
0.20361328125,
-0.2220458984375,
0.11474609375,
1.01171875,
-0.2352294921875,
0.41796875,
-0.239501953125,
0.2763671875,
0.623046875,
0.1368408203125,
-0.046295166015625,
0.6767578125,
0.462646484375,
-0.11798095703125,
0.09173583984375,
0.36962890625,
0.2135009765625,
0.382568359375,
-0.1324462890625,
-1.0146484375,
-0.99072265625,
-0.2435302734375,
0.1590576171875,
0.5810546875,
0.5712890625,
-0.5283203125,
-0.01361846923828125,
-0.366943359375,
-0.751953125,
0.087890625,
-1.4970703125,
-0.58056640625,
0.464111328125,
-0.407958984375,
-0.5634765625,
-0.49462890625,
-0.5361328125,
-0.2056884765625,
0.07891845703125,
0.0219879150390625,
-0.390380859375,
0.418212890625,
0.027923583984375,
0.2491455078125,
-0.318115234375,
0.037628173828125,
0.2115478515625,
0.53076171875,
-0.251220703125,
-0.55615234375,
0.1134033203125,
0.90966796875,
0.0775146484375,
0.293701171875,
-0.61083984375,
0.5048828125,
-0.08831787109375,
-0.1123046875,
-0.124267578125,
0.111572265625,
-0.137939453125,
0.58447265625,
-1.08984375,
-0.5869140625,
-0.357177734375,
0.3408203125,
0.389892578125,
-0.45751953125,
-0.55078125,
0.849609375,
0.59423828125,
-0.255126953125,
0.44677734375,
0.189453125,
0.6123046875,
-0.236083984375,
-0.1993408203125,
-0.2015380859375,
0.28369140625,
0.6455078125,
0.51123046875,
0.0013952255249023438,
0.402099609375,
0.77392578125,
-0.005542755126953125,
-0.265380859375,
0.3662109375,
0.30810546875,
-0.185791015625,
0.32861328125,
-0.10888671875,
-0.450927734375,
0.0621337890625,
-0.767578125,
0.662109375,
-0.23193359375,
0.2154541015625,
-0.1864013671875,
-0.74658203125,
0.81201171875,
-0.329833984375,
0.078369140625,
0.2900390625,
-0.51513671875,
0.30859375,
0.64013671875,
0.322265625,
0.033599853515625,
0.44091796875,
0.76025390625,
0.56640625,
0.6396484375,
0.233154296875,
0.480712890625,
-0.60791015625,
-0.205078125,
0.349365234375,
-0.1036376953125,
-0.603515625,
-0.412109375,
-0.68408203125,
0.378662109375,
-0.227294921875,
-0.260986328125,
0.5859375,
-0.70458984375,
0.2427978515625,
-0.0623779296875,
0.68701171875,
-0.2030029296875,
0.478759765625,
0.55419921875,
-0.422119140625,
-0.5400390625,
1.333984375,
-0.0161285400390625,
0.57958984375,
0.319091796875,
0.9814453125,
-0.11773681640625,
1.396484375,
0.826171875,
-0.17822265625,
0.1002197265625,
0.289306640625,
-0.411376953125,
-0.74365234375,
-0.40087890625,
-0.1370849609375,
-0.1455078125,
-0.61767578125,
-0.29833984375,
-0.030059814453125,
0.8974609375,
0.11083984375,
-0.798828125,
-0.433349609375,
0.2353515625,
-0.89501953125,
0.397705078125,
0.328125,
0.06658935546875,
-0.0044097900390625,
0.2176513671875,
0.0047149658203125,
-0.765625,
0.356201171875,
-0.4775390625,
0.71484375,
-0.6611328125,
-0.078125,
-0.62353515625,
-0.828125,
-0.26806640625,
0.034454345703125,
-0.36572265625,
-1.1171875,
0.364501953125,
0.5322265625,
0.1077880859375,
0.58056640625,
-0.66748046875,
0.4501953125,
0.89599609375,
1.017578125,
0.251220703125,
0.7392578125,
0.188720703125,
-0.2705078125,
0.12890625,
-0.3291015625,
0.50390625,
-0.1005859375,
0.2470703125,
-0.671875,
0.2430419921875,
-0.17919921875,
-1.435546875,
-0.2509765625,
0.485107421875,
0.385498046875,
-0.67236328125,
-0.982421875,
-0.267578125,
-0.35498046875,
-0.1768798828125,
-0.5380859375,
0.6962890625,
-0.025482177734375,
0.3291015625,
-0.4169921875,
-1.16015625,
4.453125,
0.91357421875,
0.99658203125,
0.1136474609375,
0.71826171875,
0.87353515625,
0.31689453125,
-0.2332763671875,
-0.53173828125,
-0.57421875,
0.1478271484375,
-0.28466796875,
0.0022449493408203125,
0.86376953125,
0.242919921875,
0.712890625,
-0.52685546875,
0.32861328125,
-0.29296875,
-0.99560546875,
-0.673828125,
0.289306640625,
-0.179931640625,
0.222900390625,
0.0174713134765625,
0.1629638671875,
0.54248046875,
-1.0595703125,
0.22265625,
-0.416015625,
0.1231689453125,
-0.394287109375,
1.0009765625,
0.06378173828125,
-0.0028896331787109375,
0.402099609375,
-0.312255859375,
-0.388427734375,
-0.1434326171875,
0.1798095703125,
-0.231201171875,
-0.1859130859375,
0.69580078125,
-0.483642578125,
-0.132568359375,
0.24609375,
-0.69580078125,
0.43603515625,
0.56689453125,
-0.72900390625,
0.7314453125,
-0.1881103515625,
0.64599609375,
-0.6826171875,
-0.55615234375,
0.15771484375,
-0.05694580078125,
0.0034732818603515625,
-0.5908203125,
0.287841796875,
0.07147216796875,
0.2998046875,
-0.00841522216796875,
0.552734375,
-0.8828125,
1.1884765625,
-0.120361328125,
0.173095703125,
-0.826171875,
-0.21337890625,
-0.1468505859375,
-0.2169189453125,
-0.299560546875,
-0.6044921875,
0.68310546875,
-0.031280517578125,
0.00037860870361328125,
0.77685546875,
0.42822265625,
-0.70458984375,
0.082763671875,
-0.04449462890625,
-0.410400390625,
-0.472412109375,
0.50341796875,
1.0302734375,
-0.439208984375,
-0.215087890625,
-0.322265625,
0.27001953125,
0.66748046875,
0.515625,
0.1822509765625,
-0.35986328125,
-0.248046875
] | 6
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.