text
stringlengths 525
23.5k
| conversation_id
int64 129
108k
| embedding
list | cluster
int64 6
6
|
|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day, liouzhou_101 got a chat record of Freda and Rainbow. Out of curiosity, he wanted to know which sentences were said by Freda, and which were said by Rainbow. According to his experience, he thought that Freda always said "lala." at the end of her sentences, while Rainbow always said "miao." at the beginning of his sentences. For each sentence in the chat record, help liouzhou_101 find whose sentence it is.
Input
The first line of the input contains an integer n (1 ≤ n ≤ 10), number of sentences in the chat record. Each of the next n lines contains a sentence. A sentence is a string that contains only Latin letters (A-Z, a-z), underline (_), comma (,), point (.) and space ( ). Its length doesn’t exceed 100.
Output
For each sentence, output "Freda's" if the sentence was said by Freda, "Rainbow's" if the sentence was said by Rainbow, or "OMG>.< I don't know!" if liouzhou_101 can’t recognize whose sentence it is. He can’t recognize a sentence if it begins with "miao." and ends with "lala.", or satisfies neither of the conditions.
Examples
Input
5
I will go to play with you lala.
wow, welcome.
miao.lala.
miao.
miao .
Output
Freda's
OMG>.< I don't know!
OMG>.< I don't know!
Rainbow's
OMG>.< I don't know!
Submitted Solution:
```
try:
n = int(input())
for i in range(n):
s = input().split()
if (s[len(s)-1] == "lala." and s[0] == "miao.") or (not s[len(s)-1] == "lala." and not s[0] == "miao."):
print("OMG>.< I don't know!" )
elif s[0] == "miao.":
print("Rainbow's")
else:
print("Freda's")
except:
pass
```
No
| 64,317
|
[
0.366455078125,
-0.188720703125,
-0.156005859375,
0.52734375,
-0.2353515625,
-0.564453125,
-0.0233917236328125,
0.55126953125,
0.276123046875,
0.61083984375,
0.61376953125,
0.236572265625,
0.038787841796875,
-0.65771484375,
-0.73583984375,
-0.1636962890625,
-0.466552734375,
-0.74072265625,
-0.412841796875,
-0.31103515625,
0.29443359375,
-0.11297607421875,
-1.1455078125,
0.2325439453125,
-0.47314453125,
0.97705078125,
0.5263671875,
0.03570556640625,
1.1337890625,
0.9345703125,
-0.32177734375,
-0.296875,
0.250244140625,
-1.0947265625,
-0.01480865478515625,
-0.3349609375,
0.95947265625,
-0.6181640625,
-0.60888671875,
-0.806640625,
-0.24560546875,
-0.1612548828125,
1.0146484375,
-1.0341796875,
-1.46484375,
-0.1956787109375,
-0.320556640625,
-0.62744140625,
0.06494140625,
-0.48291015625,
0.168212890625,
-0.40966796875,
0.7353515625,
-0.1083984375,
0.0888671875,
-0.393310546875,
-0.0762939453125,
0.2208251953125,
-1.05859375,
0.2841796875,
-0.237060546875,
0.3974609375,
-0.1435546875,
-0.990234375,
-0.137939453125,
0.333984375,
0.199462890625,
-0.39404296875,
-0.07464599609375,
-0.517578125,
0.01183319091796875,
0.45556640625,
-0.55810546875,
-0.65185546875,
-0.6650390625,
-0.37451171875,
0.11053466796875,
-0.205078125,
-0.445068359375,
0.7119140625,
0.1551513671875,
1.22265625,
0.30078125,
0.243408203125,
-0.0229949951171875,
-0.9228515625,
0.1597900390625,
0.5283203125,
0.0246734619140625,
-0.2064208984375,
-0.1630859375,
0.45654296875,
-0.475830078125,
-0.09539794921875,
0.84619140625,
0.46240234375,
0.13623046875,
0.55859375,
0.480224609375,
0.086669921875,
0.6376953125,
0.54248046875,
-0.2122802734375,
0.99365234375,
-0.3896484375,
-0.1619873046875,
0.258056640625,
0.294189453125,
-0.19970703125,
-0.26611328125,
-0.185791015625,
-0.260009765625,
0.38330078125,
0.270751953125,
-0.56689453125,
0.9267578125,
0.00981903076171875,
0.1893310546875,
-1.142578125,
-0.2001953125,
0.2685546875,
-0.1209716796875,
0.371826171875,
-0.278564453125,
0.58203125,
-0.268310546875,
-0.45751953125,
1.0302734375,
-0.6435546875,
-0.24072265625,
0.46923828125,
0.27099609375,
0.263427734375,
0.134521484375,
-0.58251953125,
0.495361328125,
-0.182861328125,
0.59423828125,
1.01171875,
-0.771484375,
0.89599609375,
-0.022674560546875,
0.09112548828125,
1.314453125,
0.1817626953125,
0.252685546875,
0.406982421875,
0.1785888671875,
-0.720703125,
0.312744140625,
-0.9638671875,
0.283447265625,
0.0775146484375,
0.1241455078125,
-0.3291015625,
-0.07891845703125,
0.0540771484375,
0.1949462890625,
0.0224456787109375,
-0.00934600830078125,
-0.226318359375,
0.25830078125,
-0.67041015625,
0.8466796875,
-0.0936279296875,
0.630859375,
-0.099365234375,
-0.305908203125,
0.0389404296875,
-0.75,
0.1715087890625,
-0.055877685546875,
0.06744384765625,
1.1279296875,
0.68603515625,
1.505859375,
0.71728515625,
-0.06573486328125,
0.3251953125,
0.228271484375,
-0.5263671875,
-0.00201416015625,
-0.09222412109375,
0.6240234375,
0.441650390625,
0.3369140625,
0.125732421875,
-0.64111328125,
-0.2763671875,
-0.33251953125,
-0.06292724609375,
1.033203125,
-0.69482421875,
0.62353515625,
-0.004123687744140625,
0.311767578125,
-0.77783203125,
-0.149658203125,
0.11859130859375,
-1.2451171875,
-0.662109375,
1.1171875,
-0.34765625,
0.470458984375,
-0.235595703125,
-0.77490234375,
0.07830810546875,
0.86083984375,
-0.3037109375,
0.1580810546875,
0.310546875,
0.36181640625,
-0.066162109375,
-0.2471923828125,
-0.03399658203125,
-0.4833984375,
-0.646484375,
0.81640625,
-0.52294921875,
0.401611328125,
0.08612060546875,
1.1298828125,
0.39794921875,
0.76171875,
-0.41162109375,
-0.33447265625,
0.3984375,
1.26953125,
0.2205810546875,
0.82861328125,
0.382080078125,
1,
0.740234375,
1.115234375,
0.8388671875,
0.447509765625,
1.171875,
0.88916015625,
0.279541015625,
-0.028717041015625,
-0.2222900390625,
0.57666015625,
0.52685546875,
0.6552734375,
0.058258056640625,
0.4052734375,
-0.07952880859375,
-0.02435302734375,
-0.270263671875,
0.34814453125,
-0.2381591796875,
0.88427734375,
0.47119140625,
0.79248046875,
-0.32373046875,
-0.46875,
0.365966796875,
0.67138671875,
-0.93017578125,
-0.9794921875,
-0.39794921875,
0.016754150390625,
0.354248046875,
-0.294677734375,
0.378173828125,
0.483154296875,
0.456298828125,
0.293701171875,
-0.3857421875,
-0.56396484375,
-0.6630859375,
-0.83642578125,
-1.216796875,
-0.156005859375,
-0.4873046875,
0.041656494140625,
0.23681640625,
-0.9169921875,
-0.12481689453125,
-0.0166168212890625,
-0.251708984375,
-0.061553955078125,
-0.57177734375,
0.85009765625,
-0.431396484375,
0.292236328125,
-0.79443359375,
0.69580078125,
0.318603515625,
1.2607421875,
-0.362060546875,
-0.37646484375,
-0.427001953125,
-0.6396484375,
0.1375732421875,
-0.14794921875,
0.344970703125,
0.162353515625,
-0.8779296875,
-0.394775390625,
-0.471435546875,
0.0157623291015625,
-0.1947021484375,
0.328125,
-0.65771484375,
0.8984375,
0.6064453125,
-0.72314453125,
0.324951171875,
1.2822265625,
-0.99169921875,
0.96630859375,
0.46240234375,
0.53369140625,
-0.62744140625,
0.9072265625,
0.3974609375,
0.34814453125,
-0.2705078125,
-0.194580078125,
-0.70458984375,
-0.2261962890625,
0.26904296875,
-0.20751953125,
-0.53564453125,
0.1964111328125,
0.091552734375,
-0.85400390625,
0.64013671875,
-1.4296875,
-0.5859375,
-0.1212158203125,
-0.406494140625,
1.001953125,
1.103515625,
0.2489013671875,
-0.60205078125,
-0.477783203125,
-0.413818359375,
0.51318359375,
0.472412109375,
-0.380615234375,
0.08856201171875,
0.70556640625,
-0.041656494140625,
0.374755859375,
0.22314453125,
-0.4287109375,
-0.143798828125,
0.1121826171875,
-0.2291259765625,
0.59716796875,
0.1396484375,
-0.03839111328125,
-0.087646484375,
0.80126953125,
-0.52978515625,
-0.37158203125,
-0.005329132080078125,
0.363525390625,
0.225341796875,
0.560546875,
0.8037109375,
-0.042083740234375,
-0.62548828125,
-0.66162109375,
0.3623046875,
0.1568603515625,
0.72509765625,
-0.54541015625,
0.65087890625,
0.1351318359375,
-0.90673828125,
0.2298583984375,
-0.9560546875,
-0.57275390625,
1.1474609375,
-0.4169921875,
0.76953125,
-0.68896484375,
0.4521484375,
-0.08795166015625,
-0.029296875,
0.71484375,
0.048858642578125,
0.51318359375,
-0.56494140625,
-0.7978515625,
-0.285888671875,
-0.063232421875,
0.1519775390625,
-0.8642578125,
-0.0753173828125,
-0.443359375,
-0.697265625,
-1.0380859375,
0.55224609375,
0.56201171875,
0.313720703125,
-0.27783203125,
0.7158203125,
0.307373046875,
0.62890625,
0.56689453125,
-0.040679931640625,
0.215087890625,
-0.572265625,
0.78759765625,
0.399658203125,
-0.0916748046875,
-0.354248046875,
-0.2259521484375,
-0.353515625,
0.01268768310546875,
0.1378173828125,
-0.240966796875,
-0.755859375,
0.65966796875,
0.399169921875,
0.36181640625,
-0.75390625,
-0.385498046875,
0.288330078125,
0.41455078125,
0.339111328125,
-0.48486328125,
0.158447265625,
-0.72412109375,
0.6611328125,
0.69482421875,
-0.406005859375,
-0.693359375,
-0.478759765625,
-1.1904296875,
-0.67578125,
0.07635498046875,
1.2763671875,
0.1556396484375,
0.36376953125,
-1.0458984375,
0.671875,
0.76806640625,
-0.267578125,
0.478515625,
0.215087890625,
0.2744140625,
0.07598876953125,
0.48779296875,
-0.215576171875,
-1.33203125,
0.1973876953125,
-1.013671875,
0.716796875,
-0.73681640625,
0.2454833984375,
-0.08953857421875,
-0.3544921875,
0.0694580078125,
0.4814453125,
0.09912109375,
0.1173095703125,
0.06890869140625,
0.58984375,
-0.8876953125,
-0.64111328125,
0.3203125,
0.1829833984375,
-0.42236328125,
0.544921875,
0.2100830078125,
-0.5302734375,
0.41943359375,
0.5244140625,
-0.7109375,
0.6435546875,
-0.544921875,
0.51416015625,
-0.4052734375,
-0.31396484375,
-0.0245819091796875,
-0.86474609375,
0.7109375,
0.303466796875,
-0.5908203125,
-0.301513671875,
-1.2626953125,
-0.17333984375,
-0.487548828125,
-0.1722412109375,
0.39453125,
0.04937744140625,
-0.2734375,
-0.375244140625,
-0.390869140625,
-0.52392578125,
-0.367431640625,
-0.2330322265625,
-0.171142578125,
0.370849609375,
0.2529296875,
0.67041015625,
-0.06573486328125,
-0.09881591796875,
0.10009765625,
-0.322509765625,
-0.0533447265625,
-0.285888671875,
0.08514404296875,
-0.041595458984375,
-0.383056640625,
-0.2227783203125,
0.560546875,
-0.109619140625,
0.0650634765625,
0.80517578125,
0.0216064453125,
0.7392578125,
0.0789794921875,
-0.8486328125,
1.1767578125,
0.127197265625,
-1.1630859375,
-0.07611083984375,
0.5625,
-0.0472412109375,
0.4853515625,
0.2469482421875,
-0.466796875,
-0.8349609375,
-1.34375,
0.215576171875,
-0.427978515625,
-0.07037353515625,
-1.169921875,
-0.31005859375,
-0.30615234375,
0.91015625,
-0.0206756591796875,
-0.5078125,
0.0673828125,
-1.33203125,
0.29638671875,
-0.9052734375,
-0.395751953125,
-0.97607421875,
-0.09832763671875,
-0.220458984375,
0.8330078125,
0.302490234375,
0.7099609375,
-0.1466064453125,
-0.275390625,
0.2010498046875,
-0.54052734375,
-0.55078125,
-0.395751953125,
-0.135986328125,
-0.06005859375,
-0.2467041015625,
0.06390380859375,
-0.5693359375,
0.732421875,
-0.87109375,
0.06634521484375,
-0.46923828125,
-0.2403564453125,
-0.2357177734375,
-0.08953857421875,
1.4990234375,
-0.277099609375,
-0.270751953125,
-0.447998046875,
0.6640625,
0.7939453125,
-0.485595703125,
-0.410888671875,
-0.68896484375,
-0.427490234375,
-1.1416015625,
0.81005859375,
-0.57568359375,
0.140869140625,
-0.4208984375,
0.05072021484375,
0.8671875,
-0.27099609375,
0.82666015625,
1.345703125,
0.1341552734375,
0.2083740234375,
-1.1708984375,
0.5068359375,
0.65087890625,
-0.5654296875,
-0.11859130859375,
0.0222625732421875,
-1.111328125,
0.0229949951171875,
-0.5107421875,
-1.0927734375,
-0.62255859375,
-0.08721923828125,
1.017578125,
-0.3779296875,
0.78173828125,
0.21630859375,
-1.15234375,
-0.86767578125,
0.9873046875,
0.1436767578125,
0.27880859375,
1.1044921875,
0.003292083740234375,
-0.26611328125,
0.1690673828125,
0.1783447265625,
-0.4453125,
-0.51318359375,
1.4482421875,
-0.12939453125,
-0.60888671875,
0.88134765625,
0.90185546875,
-1.001953125,
-1.15234375,
-0.437255859375,
-0.257568359375,
-0.1121826171875,
-0.99365234375,
-0.0947265625,
0.59228515625,
-0.89892578125,
0.53271484375,
0.67431640625,
-0.41162109375,
-0.0165557861328125,
0.288330078125,
0.2410888671875,
-0.61865234375,
0.364501953125,
1.2265625,
-0.6083984375,
-0.29638671875,
-1.099609375,
-0.28857421875,
-0.259033203125,
0.03204345703125,
0.79638671875,
-0.324462890625,
0.202392578125,
0.392822265625,
-0.2232666015625,
0.8095703125,
-0.34765625,
-0.4794921875,
0.26513671875,
-0.82763671875,
-0.62255859375,
-0.5263671875,
0.433349609375,
-0.032318115234375,
0.5927734375,
-0.76025390625,
-0.10540771484375,
0.40234375,
0.466064453125,
0.052947998046875,
-0.9794921875,
-0.419677734375,
-0.99365234375,
-0.57861328125,
-0.88232421875,
-0.43310546875,
-0.189697265625,
-0.05218505859375,
0.30224609375,
-0.78662109375,
0.4228515625,
0.51318359375,
-0.468994140625,
0.60205078125,
-0.6640625,
0.241943359375,
-0.853515625,
-0.2734375,
-0.2054443359375,
-0.11309814453125,
-0.2213134765625,
-0.227783203125,
-0.037017822265625,
0.2235107421875,
-0.4150390625,
0.62451171875,
-0.049072265625,
0.00464630126953125,
0.0296478271484375,
-0.451904296875,
0.358154296875,
0.484375,
-0.41259765625,
0.728515625,
0.3505859375,
0.0650634765625,
0.194091796875,
-0.50146484375,
-0.1407470703125,
-0.27490234375,
0.43994140625,
0.365478515625,
0.09661865234375,
0.19140625,
-0.333984375,
-0.27734375,
-0.833984375,
-0.0831298828125,
-0.07769775390625,
0.183837890625,
0.249267578125,
0.0421142578125,
0.393798828125,
1.0146484375,
-0.391357421875,
0.611328125,
-0.1239013671875,
0.345947265625,
0.49072265625,
0.0210113525390625,
0.11474609375,
0.83251953125,
0.290283203125,
0.050537109375,
0.313720703125,
0.68212890625,
-0.046051025390625,
0.27685546875,
-0.328125,
-1.021484375,
-0.72705078125,
-0.42919921875,
0.10015869140625,
0.0247650146484375,
0.70361328125,
-0.966796875,
-0.143310546875,
-0.30322265625,
-0.6591796875,
0.376708984375,
-1.2412109375,
-0.80810546875,
0.50927734375,
0.0044708251953125,
-0.63671875,
0.2489013671875,
-0.55615234375,
-0.20068359375,
0.016357421875,
0.5087890625,
-0.62744140625,
0.188720703125,
-0.38916015625,
0.232177734375,
-0.32275390625,
-0.0030193328857421875,
-0.1661376953125,
0.309326171875,
-0.61181640625,
-0.55126953125,
0.426513671875,
1.0185546875,
0.21826171875,
-0.3271484375,
-0.438232421875,
0.45849609375,
-0.1573486328125,
-0.2236328125,
-0.425048828125,
0.37451171875,
-0.03759765625,
0.306884765625,
-0.52587890625,
0.1729736328125,
-0.0252838134765625,
0.265380859375,
0.303955078125,
-0.22607421875,
-0.423828125,
0.86376953125,
0.45703125,
-0.1649169921875,
0.70166015625,
0.2135009765625,
0.58740234375,
-0.03948974609375,
0.005886077880859375,
-0.304931640625,
0.775390625,
1.0107421875,
0.5966796875,
-0.7138671875,
0.315185546875,
0.80322265625,
-0.17822265625,
0.004955291748046875,
0.80078125,
0.31396484375,
-0.0268707275390625,
-0.182373046875,
-0.1929931640625,
-0.322021484375,
0.023468017578125,
-0.50146484375,
0.1793212890625,
-0.397216796875,
-0.30078125,
-0.02764892578125,
-0.5322265625,
0.947265625,
-0.056854248046875,
0.202392578125,
-0.1455078125,
-0.517578125,
0.2208251953125,
0.82275390625,
0.1483154296875,
-0.0738525390625,
0.7421875,
0.685546875,
0.56201171875,
0.51953125,
0.2276611328125,
0.705078125,
-0.7861328125,
0.040618896484375,
0.2054443359375,
-0.234375,
-0.68603515625,
-0.321533203125,
-1.12109375,
0.469482421875,
-0.427490234375,
-0.33740234375,
0.51025390625,
-1.2509765625,
0.34619140625,
-0.03369140625,
0.45263671875,
-0.6005859375,
-0.01392364501953125,
0.10638427734375,
-0.09515380859375,
-0.51611328125,
0.77685546875,
-0.13037109375,
0.58251953125,
0.287109375,
1.33203125,
-0.2071533203125,
1.2412109375,
0.27001953125,
-0.58935546875,
-0.471435546875,
0.10760498046875,
-0.405517578125,
-0.79541015625,
-0.01120758056640625,
-0.2174072265625,
-0.00736236572265625,
-0.422607421875,
-0.74609375,
-0.27099609375,
0.7060546875,
0.2015380859375,
-1.4130859375,
-0.51806640625,
0.2203369140625,
-0.927734375,
0.62451171875,
0.282958984375,
0.36962890625,
0.458740234375,
0.21142578125,
-0.50830078125,
-0.78515625,
0.35546875,
-0.744140625,
0.353759765625,
-0.65576171875,
-0.6640625,
-0.6640625,
-0.69775390625,
-0.3330078125,
0.38916015625,
-0.1435546875,
-1.0322265625,
0.34130859375,
0.473876953125,
0.31982421875,
-0.038818359375,
-0.447509765625,
-0.248046875,
1.294921875,
1.1044921875,
-0.1900634765625,
0.9111328125,
0.2242431640625,
-0.127197265625,
0.367919921875,
-0.62646484375,
0.454833984375,
0.032073974609375,
0.1798095703125,
-0.21533203125,
0.41748046875,
-0.67626953125,
-1.1533203125,
0.267333984375,
0.70849609375,
0.07476806640625,
-0.75830078125,
-1.3056640625,
-0.78564453125,
-0.859375,
-0.058380126953125,
-0.5908203125,
0.9453125,
0.06561279296875,
-0.239501953125,
-0.219482421875,
-1.109375,
4.14453125,
0.94189453125,
1.0185546875,
0.5888671875,
0.296875,
0.7890625,
0.7880859375,
-0.88623046875,
-0.1466064453125,
-0.515625,
0.448486328125,
-0.50634765625,
0.244140625,
1.0419921875,
-0.10931396484375,
0.62646484375,
-0.794921875,
0.221435546875,
0.1529541015625,
-0.7333984375,
-0.865234375,
0.296142578125,
0.412841796875,
0.15673828125,
0.1636962890625,
0.5048828125,
0.646484375,
-0.79833984375,
0.01727294921875,
-0.80712890625,
0.126953125,
-0.81787109375,
0.8818359375,
0.05364990234375,
-0.38330078125,
0.434814453125,
0.011199951171875,
-0.78564453125,
-0.187255859375,
0.7373046875,
-0.05718994140625,
0.12127685546875,
0.541015625,
-0.3525390625,
-0.3115234375,
0.76025390625,
-0.59033203125,
0.8701171875,
0.374267578125,
-0.96484375,
0.97998046875,
-0.2587890625,
0.61572265625,
-0.61083984375,
-0.6689453125,
0.326171875,
0.038238525390625,
0.057037353515625,
-0.4140625,
0.57275390625,
0.0168304443359375,
0.490966796875,
-0.11956787109375,
0.5888671875,
-1.287109375,
0.7568359375,
-0.1357421875,
0.319580078125,
-0.681640625,
-0.016632080078125,
-0.08160400390625,
-0.24853515625,
-0.1373291015625,
-0.321044921875,
0.48779296875,
0.1788330078125,
-0.498291015625,
0.364990234375,
0.255859375,
-0.1441650390625,
0.1744384765625,
-0.380126953125,
-0.51806640625,
-0.64453125,
0.54931640625,
1.12109375,
-0.58349609375,
-0.4765625,
-0.5234375,
0.859375,
0.76953125,
0.1468505859375,
0.069580078125,
-0.68896484375,
-0.301513671875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Bash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Since he is too young to go out and catch Bulbasaur, he came up with his own way of catching a Bulbasaur.
Each day, he takes the front page of the newspaper. He cuts out the letters one at a time, from anywhere on the front page of the newspaper to form the word "Bulbasaur" (without quotes) and sticks it on his wall. Bash is very particular about case — the first letter of "Bulbasaur" must be upper case and the rest must be lower case. By doing this he thinks he has caught one Bulbasaur. He then repeats this step on the left over part of the newspaper. He keeps doing this until it is not possible to form the word "Bulbasaur" from the newspaper.
Given the text on the front page of the newspaper, can you tell how many Bulbasaurs he will catch today?
Note: uppercase and lowercase letters are considered different.
Input
Input contains a single line containing a string s (1 ≤ |s| ≤ 105) — the text on the front page of the newspaper without spaces and punctuation marks. |s| is the length of the string s.
The string s contains lowercase and uppercase English letters, i.e. <image>.
Output
Output a single integer, the answer to the problem.
Examples
Input
Bulbbasaur
Output
1
Input
F
Output
0
Input
aBddulbasaurrgndgbualdBdsagaurrgndbb
Output
2
Note
In the first case, you could pick: Bulbbasaur.
In the second case, there is no way to pick even a single Bulbasaur.
In the third case, you can rearrange the string to BulbasaurBulbasauraddrgndgddgargndbb to get two words "Bulbasaur".
Tags: implementation
Correct Solution:
```
s = input()
l = "Bulbasaur"
l1 = []
for i in l:
if i=="u":
l1.append(s.count("u")//2)
elif i=="a":
l1.append(s.count("a")//2)
else:
l1.append(s.count(i))
if 0 in l1:print(0)
else:print(min(l1))
```
| 64,482
|
[
0.07598876953125,
0.1663818359375,
0.1072998046875,
0.1026611328125,
-0.58447265625,
-0.60400390625,
0.11773681640625,
-0.1815185546875,
0.60009765625,
0.74755859375,
0.88720703125,
-0.244140625,
0.0712890625,
-0.41748046875,
-0.6357421875,
-0.2919921875,
-0.779296875,
-0.51025390625,
-0.01081085205078125,
-0.474365234375,
-0.07928466796875,
-0.1243896484375,
-1.0146484375,
-0.1661376953125,
-0.142822265625,
0.7373046875,
0.6318359375,
0.1488037109375,
0.86083984375,
0.88720703125,
0.07647705078125,
-0.287109375,
0.4326171875,
-0.849609375,
-0.291015625,
-0.5576171875,
0.650390625,
-1.1650390625,
-0.0904541015625,
-0.303955078125,
0.419189453125,
-0.27197265625,
0.88330078125,
-0.826171875,
-1.0546875,
-0.3193359375,
-0.74365234375,
-0.233642578125,
-0.26513671875,
-0.595703125,
0.154541015625,
0.00504302978515625,
0.11273193359375,
-0.2252197265625,
0.2132568359375,
-0.30322265625,
-0.1517333984375,
0.0595703125,
-0.399169921875,
0.5322265625,
0.050628662109375,
0.27490234375,
-0.157470703125,
-0.349609375,
0.03533935546875,
0.284912109375,
-0.033355712890625,
-0.4541015625,
0.2958984375,
-0.56201171875,
-0.471923828125,
0.44189453125,
-0.324462890625,
-0.53857421875,
-0.265869140625,
0.14892578125,
0.26806640625,
-0.1474609375,
-0.69482421875,
1.1923828125,
0.08966064453125,
0.861328125,
0.5439453125,
0.2039794921875,
-0.33154296875,
-0.5537109375,
0.2489013671875,
0.2342529296875,
0.078125,
-0.227783203125,
-0.306640625,
0.53125,
-0.51953125,
-0.2315673828125,
0.6728515625,
0.460693359375,
-0.6103515625,
0.51513671875,
0.271240234375,
0.090087890625,
0.54150390625,
0.82763671875,
-0.37890625,
1.087890625,
-0.140380859375,
0.3935546875,
0.1092529296875,
0.060821533203125,
-0.499267578125,
-0.3486328125,
-0.38134765625,
-0.1470947265625,
0.79345703125,
0.013519287109375,
-0.38916015625,
0.57080078125,
0.07403564453125,
0.66845703125,
-0.9423828125,
0.24560546875,
0.34912109375,
-0.06756591796875,
0.5986328125,
-0.46435546875,
-0.15771484375,
-0.289794921875,
-0.6767578125,
1.1923828125,
-0.478515625,
-0.05035400390625,
0.31640625,
0.219482421875,
0.02337646484375,
0.4541015625,
-0.302490234375,
0.70703125,
-0.5625,
0.66748046875,
0.5244140625,
-0.654296875,
0.8583984375,
-0.235107421875,
-0.0100555419921875,
1.349609375,
0.38916015625,
0.1959228515625,
0.375244140625,
0.1761474609375,
-0.83056640625,
0.64697265625,
-0.9951171875,
0.6123046875,
0.0928955078125,
0.2327880859375,
-0.341064453125,
0.74609375,
-0.364501953125,
0.332763671875,
0.27001953125,
0.1397705078125,
-0.22412109375,
0.55419921875,
-0.77490234375,
0.98876953125,
0.04803466796875,
0.96826171875,
-0.77294921875,
-0.32470703125,
-0.1864013671875,
-0.3203125,
-0.021636962890625,
-0.0894775390625,
-0.07373046875,
0.97314453125,
0.399169921875,
0.8330078125,
0.8583984375,
0.023468017578125,
0.140380859375,
0.126220703125,
0.0260162353515625,
0.244140625,
0.308349609375,
0.89599609375,
0.1572265625,
0.265869140625,
0.1102294921875,
-0.57275390625,
-0.96435546875,
-0.435546875,
0.110107421875,
0.50830078125,
-0.324951171875,
0.2281494140625,
0.068603515625,
0.2734375,
-0.521484375,
-0.2626953125,
-0.005855560302734375,
-0.818359375,
-0.43359375,
0.45849609375,
0.04705810546875,
0.66650390625,
0.08056640625,
-0.9169921875,
0.51171875,
1.1416015625,
-0.1763916015625,
0.0452880859375,
0.07733154296875,
0.1175537109375,
0.0064544677734375,
0.08343505859375,
0.1019287109375,
-0.280517578125,
-0.78662109375,
0.3603515625,
-0.10491943359375,
-0.029083251953125,
-0.2176513671875,
0.39013671875,
0.4208984375,
0.4931640625,
-0.25439453125,
-0.0242767333984375,
0.79736328125,
0.59912109375,
-0.046600341796875,
0.10516357421875,
0.08697509765625,
0.9599609375,
0.407470703125,
0.79052734375,
0.461181640625,
0.280029296875,
0.413818359375,
0.62353515625,
0.356689453125,
0.3759765625,
-0.07659912109375,
0.28466796875,
0.33837890625,
0.465576171875,
0.0179901123046875,
0.422119140625,
-0.236328125,
0.03900146484375,
-0.73876953125,
0.8681640625,
-0.22412109375,
0.65673828125,
0.2008056640625,
0.409912109375,
-0.283203125,
-0.71728515625,
0.31884765625,
0.64404296875,
-0.958984375,
-0.40771484375,
0.403564453125,
0.2386474609375,
0.393310546875,
0.300537109375,
0.004150390625,
0.322021484375,
0.281005859375,
0.450927734375,
0.027618408203125,
-0.6416015625,
-0.85498046875,
-0.626953125,
-1.064453125,
-0.424072265625,
-0.61376953125,
-0.1763916015625,
0.265869140625,
-1.23046875,
0.59521484375,
-0.69775390625,
-0.1533203125,
0.10986328125,
-0.5693359375,
0.654296875,
-0.10235595703125,
0.6611328125,
-0.38232421875,
0.54833984375,
-0.060150146484375,
0.6953125,
-0.372802734375,
-0.05657958984375,
-0.45068359375,
-0.7109375,
0.1456298828125,
0.0711669921875,
0.429443359375,
-0.1805419921875,
-0.3974609375,
-0.62646484375,
-0.266357421875,
-0.1754150390625,
-0.53076171875,
0.163818359375,
-0.546875,
0.66748046875,
0.467529296875,
-0.6201171875,
0.494140625,
1.0556640625,
-0.80810546875,
0.472412109375,
0.188232421875,
0.271240234375,
-0.70751953125,
1.33984375,
0.306396484375,
0.4384765625,
-0.431396484375,
-0.5859375,
-0.5029296875,
0.10040283203125,
-0.14892578125,
-0.257080078125,
-0.63671875,
0.8173828125,
0.07830810546875,
-0.92431640625,
0.587890625,
-0.859375,
-0.474365234375,
-0.53271484375,
-0.41455078125,
0.595703125,
0.67431640625,
0.08538818359375,
-0.215087890625,
-0.348876953125,
0.10394287109375,
0.67626953125,
0.5615234375,
-0.83154296875,
-0.1787109375,
0.46875,
0.09521484375,
0.49365234375,
0.09344482421875,
-0.09881591796875,
-0.165283203125,
-0.171875,
-0.08941650390625,
0.5185546875,
0.375244140625,
-0.0204010009765625,
0.65625,
0.443603515625,
-0.8681640625,
-0.20068359375,
-0.210693359375,
0.76220703125,
0.2093505859375,
0.83544921875,
0.7548828125,
-0.06884765625,
-0.5849609375,
-0.9365234375,
0.358154296875,
0.0111236572265625,
0.5888671875,
-0.9599609375,
0.56396484375,
0.28955078125,
-0.307861328125,
0.65966796875,
-0.70703125,
-0.29248046875,
1.4658203125,
-0.323486328125,
0.5078125,
-0.36083984375,
0.998046875,
-0.314453125,
-0.251708984375,
0.64013671875,
0.440185546875,
0.390869140625,
0.0684814453125,
0.073974609375,
-0.06744384765625,
-0.328857421875,
-0.264892578125,
-0.5634765625,
0.5,
-0.321044921875,
-0.455810546875,
-0.59326171875,
0.322509765625,
0.5615234375,
0.720703125,
0.28369140625,
0.89697265625,
-0.1378173828125,
0.459716796875,
-0.01561737060546875,
-0.42626953125,
0.0682373046875,
-0.71142578125,
0.7724609375,
0.040924072265625,
-0.1710205078125,
-0.51318359375,
0.0227813720703125,
-0.40966796875,
0.348876953125,
0.22119140625,
-0.28564453125,
-1.173828125,
0.27734375,
-0.191650390625,
0.8154296875,
-0.397705078125,
-0.1358642578125,
-0.2401123046875,
0.277587890625,
0.1787109375,
-0.7470703125,
0.340576171875,
-0.55322265625,
0.71875,
0.09820556640625,
0.06390380859375,
-0.494384765625,
-0.412841796875,
-0.6376953125,
-0.56396484375,
0.03369140625,
0.626953125,
0.105224609375,
0.2666015625,
-0.7890625,
0.331787109375,
0.348388671875,
-0.02099609375,
0.138427734375,
-0.001155853271484375,
0.2138671875,
0.312744140625,
0.43212890625,
-0.46826171875,
-0.42578125,
0.0911865234375,
-1.265625,
0.69091796875,
-0.386962890625,
-0.0187835693359375,
-0.32177734375,
0.09503173828125,
-0.02655029296875,
0.266357421875,
-0.295654296875,
-0.0288543701171875,
-0.060760498046875,
0.4755859375,
-1.03515625,
-0.9404296875,
0.31201171875,
-0.1976318359375,
-0.5654296875,
0.71142578125,
-0.1158447265625,
-0.43017578125,
0.213134765625,
0.2222900390625,
-0.7412109375,
0.35693359375,
-0.08697509765625,
0.6015625,
-0.190673828125,
-0.438232421875,
0.05242919921875,
-0.25732421875,
0.65673828125,
-0.2568359375,
-0.93310546875,
-0.419921875,
-1.138671875,
0.1810302734375,
0.1485595703125,
-0.48291015625,
0.42724609375,
-0.033966064453125,
-0.12384033203125,
0.123046875,
-0.273193359375,
-0.326904296875,
-0.1414794921875,
-0.53564453125,
-0.42138671875,
0.220703125,
0.2410888671875,
0.78515625,
-0.355224609375,
-0.303466796875,
-0.0738525390625,
0.41162109375,
0.25927734375,
-0.51611328125,
-0.2139892578125,
0.0036773681640625,
-0.0997314453125,
-0.1932373046875,
0.77392578125,
0.180908203125,
0.419189453125,
0.86865234375,
0.09515380859375,
0.76220703125,
0.76123046875,
-0.68505859375,
1.34375,
-0.009063720703125,
-1.11328125,
-0.49462890625,
0.5263671875,
-0.2626953125,
0.485107421875,
0.303466796875,
-0.7783203125,
-0.67431640625,
-1.1435546875,
0.10882568359375,
-0.72119140625,
-0.16552734375,
-1.3095703125,
-0.20703125,
-0.284912109375,
0.6171875,
-0.1563720703125,
-0.53662109375,
0.68994140625,
-0.998046875,
-0.0635986328125,
-0.5927734375,
-0.381591796875,
-0.51953125,
-0.57568359375,
-0.484619140625,
0.8671875,
0.16796875,
0.339111328125,
0.01427459716796875,
-0.1663818359375,
-0.045928955078125,
-0.10711669921875,
-0.6552734375,
-0.326416015625,
-0.398681640625,
0.232666015625,
0.04656982421875,
-0.199951171875,
-0.2144775390625,
0.484619140625,
-0.955078125,
0.10723876953125,
-0.2408447265625,
-0.446044921875,
-0.2802734375,
-0.004425048828125,
0.974609375,
-0.408935546875,
0.24267578125,
-0.84716796875,
0.8154296875,
0.58984375,
0.039306640625,
-0.8544921875,
-0.71435546875,
-0.74609375,
-0.685546875,
0.87939453125,
-0.6416015625,
0.394775390625,
-0.61474609375,
0.19384765625,
1.015625,
-0.6943359375,
0.258544921875,
0.673828125,
0.28955078125,
0.269775390625,
-0.71142578125,
0.69287109375,
0.53515625,
-0.34130859375,
-0.44482421875,
-0.049468994140625,
-0.591796875,
0.2161865234375,
-0.25634765625,
-0.9814453125,
-1.07421875,
0.396240234375,
1.318359375,
-0.333984375,
0.61083984375,
0.251708984375,
-0.91357421875,
-0.69677734375,
0.6650390625,
0.34912109375,
0.55322265625,
1.06640625,
-0.380126953125,
-0.2315673828125,
0.1490478515625,
0.0645751953125,
-0.2200927734375,
-0.8134765625,
0.8173828125,
-0.371826171875,
-0.230224609375,
0.58447265625,
0.8388671875,
-1.09375,
-0.525390625,
-0.57373046875,
-0.31494140625,
-0.1895751953125,
-0.479248046875,
-0.04327392578125,
0.222412109375,
-0.90771484375,
-0.29296875,
0.34033203125,
-0.174072265625,
0.459716796875,
-0.2548828125,
0.4462890625,
-0.410400390625,
0.67333984375,
0.3369140625,
-0.740234375,
-0.18212890625,
-0.7998046875,
0.1724853515625,
-0.139892578125,
0.2174072265625,
0.7373046875,
-0.44921875,
0.15380859375,
0.4375,
0.10784912109375,
0.45947265625,
-0.28515625,
-0.369873046875,
0.09722900390625,
-0.771484375,
-0.75927734375,
-0.141845703125,
0.16943359375,
-0.279052734375,
0.35107421875,
-0.457763671875,
-0.1663818359375,
0.248779296875,
0.357666015625,
-0.28564453125,
-0.87060546875,
-0.10394287109375,
-0.748046875,
-0.0439453125,
-0.83154296875,
-0.755859375,
0.37158203125,
0.658203125,
-0.54541015625,
-0.206787109375,
0.286865234375,
0.97412109375,
-0.638671875,
0.75244140625,
-0.465576171875,
0.6220703125,
-0.3408203125,
-0.291259765625,
-0.6123046875,
0.0528564453125,
-0.385498046875,
-0.11810302734375,
-0.358154296875,
0.289794921875,
-0.3896484375,
0.5419921875,
0.2568359375,
0.26123046875,
0.00952911376953125,
-0.432861328125,
-0.09478759765625,
-0.07745361328125,
-0.373291015625,
0.69580078125,
0.54296875,
-0.15087890625,
0.01200103759765625,
-0.40673828125,
-0.468505859375,
-0.2230224609375,
0.79345703125,
0.59375,
-0.1561279296875,
0.0286712646484375,
-0.3759765625,
0.1927490234375,
-0.923828125,
0.207275390625,
-0.50146484375,
0.366943359375,
0.304443359375,
-0.15673828125,
0.300048828125,
1.0283203125,
0.058929443359375,
0.38232421875,
0.2408447265625,
-0.0341796875,
0.5107421875,
0.1492919921875,
0.0085296630859375,
0.4033203125,
0.1319580078125,
-0.1563720703125,
-0.309814453125,
0.732421875,
-0.037750244140625,
0.251220703125,
-0.161376953125,
-0.69091796875,
-0.88232421875,
-0.0372314453125,
-0.273193359375,
0.277587890625,
0.08837890625,
-0.58837890625,
0.06390380859375,
-0.304443359375,
-0.26220703125,
0.39599609375,
-0.9638671875,
-0.89013671875,
0.29736328125,
-0.26611328125,
-0.482666015625,
-0.22021484375,
-0.5380859375,
-0.056915283203125,
0.09136962890625,
0.2548828125,
-0.45263671875,
0.314453125,
-0.285400390625,
0.62841796875,
-0.456298828125,
0.1556396484375,
-0.010467529296875,
0.2265625,
-0.498046875,
-0.31298828125,
-0.0628662109375,
0.92578125,
-0.006259918212890625,
-0.1148681640625,
-0.6259765625,
0.34521484375,
-0.081787109375,
0.1634521484375,
-0.21728515625,
0.19970703125,
-0.55322265625,
0.345703125,
-1.1533203125,
-0.123046875,
-0.164306640625,
0.24853515625,
0.362060546875,
-0.658203125,
-0.444091796875,
1.0224609375,
0.85498046875,
-0.2083740234375,
0.330810546875,
0.0928955078125,
0.1630859375,
-0.15283203125,
-0.186767578125,
-0.1373291015625,
1.01171875,
0.8271484375,
0.8447265625,
-0.04718017578125,
0.5615234375,
0.60791015625,
-0.109130859375,
-0.023773193359375,
0.6181640625,
0.192138671875,
-0.32958984375,
0.2744140625,
-0.320556640625,
0.1424560546875,
0.12408447265625,
-0.87109375,
0.11077880859375,
-0.4384765625,
-0.1455078125,
-0.215576171875,
-0.65185546875,
0.62890625,
-0.276611328125,
-0.0740966796875,
-0.1064453125,
-0.56640625,
0.16650390625,
0.61962890625,
0.277587890625,
-0.11834716796875,
0.9453125,
0.611328125,
0.292236328125,
0.71728515625,
0.09521484375,
0.1534423828125,
-0.252685546875,
0.061248779296875,
-0.101806640625,
-0.0238189697265625,
-0.2529296875,
-0.1810302734375,
-0.9150390625,
0.36279296875,
0.09832763671875,
-0.3837890625,
0.413818359375,
-0.88330078125,
-0.2232666015625,
-0.381591796875,
0.7861328125,
-0.338134765625,
-0.1641845703125,
0.39404296875,
-0.6435546875,
-0.7392578125,
0.7705078125,
-0.2320556640625,
0.2064208984375,
0.033203125,
1.3427734375,
0.2476806640625,
1.1240234375,
0.71435546875,
-0.103515625,
0.0201568603515625,
0.1925048828125,
-0.499267578125,
-0.416015625,
-0.2454833984375,
-0.4619140625,
0.1595458984375,
-0.91796875,
-0.488037109375,
-0.320068359375,
0.986328125,
-0.0927734375,
-1.05859375,
-0.184814453125,
-0.2208251953125,
-1.0830078125,
0.322021484375,
0.2861328125,
0.51708984375,
-0.372802734375,
-0.193603515625,
-0.1708984375,
-0.3017578125,
0.1256103515625,
-0.7099609375,
0.42138671875,
-0.262939453125,
-0.78955078125,
-0.25,
-0.67919921875,
-0.3271484375,
0.037384033203125,
-0.34375,
-0.86865234375,
0.439697265625,
0.58203125,
0.00734710693359375,
0.5009765625,
-0.55419921875,
0.23828125,
0.81201171875,
0.9306640625,
0.1905517578125,
0.595703125,
-0.10394287109375,
-0.359619140625,
0.485107421875,
-0.4267578125,
0.580078125,
-0.0826416015625,
0.1961669921875,
-0.313720703125,
0.6865234375,
-0.69189453125,
-1.3076171875,
0.08074951171875,
0.25537109375,
0.22607421875,
-0.413818359375,
-0.90234375,
-0.192626953125,
-0.998046875,
0.09637451171875,
-0.31689453125,
0.46484375,
-0.63134765625,
0.197021484375,
-0.1260986328125,
-1.205078125,
4.57421875,
0.650390625,
0.95068359375,
0.1475830078125,
0.11126708984375,
1.05078125,
0.471435546875,
-0.44580078125,
0.0021533966064453125,
0.0013189315795898438,
0.357666015625,
-0.62158203125,
0.168701171875,
0.80126953125,
0.1734619140625,
0.5869140625,
-0.72705078125,
0.38134765625,
0.141845703125,
-0.59130859375,
-0.978515625,
-0.08074951171875,
-0.163330078125,
0.332275390625,
0.047576904296875,
0.48828125,
0.26611328125,
-0.57666015625,
-0.123046875,
-0.669921875,
0.04486083984375,
-0.51416015625,
0.5400390625,
-0.2125244140625,
-0.1561279296875,
0.83544921875,
-0.1949462890625,
-0.2147216796875,
0.01139068603515625,
0.0892333984375,
-0.36328125,
-0.278564453125,
0.494384765625,
-0.65185546875,
-0.063720703125,
0.14697265625,
-0.93701171875,
0.11370849609375,
0.291015625,
-0.796875,
0.97412109375,
-0.357177734375,
0.452880859375,
-0.74658203125,
-0.75830078125,
0.209228515625,
0.27783203125,
-0.3232421875,
-0.52001953125,
0.410888671875,
0.53662109375,
0.237548828125,
0.2392578125,
0.4228515625,
-0.505859375,
1.185546875,
-0.034271240234375,
0.149658203125,
-0.4287109375,
-0.11651611328125,
-0.39453125,
-0.37548828125,
-0.1199951171875,
-0.41796875,
0.89453125,
0.2666015625,
-0.277099609375,
0.43359375,
0.6826171875,
-0.7412109375,
-0.016815185546875,
-0.373046875,
-0.4248046875,
-0.0160675048828125,
0.82177734375,
1.0810546875,
-0.68798828125,
-0.4189453125,
0.1446533203125,
0.53515625,
0.6787109375,
0.72509765625,
0.2373046875,
-0.62841796875,
-0.1591796875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Bash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Since he is too young to go out and catch Bulbasaur, he came up with his own way of catching a Bulbasaur.
Each day, he takes the front page of the newspaper. He cuts out the letters one at a time, from anywhere on the front page of the newspaper to form the word "Bulbasaur" (without quotes) and sticks it on his wall. Bash is very particular about case — the first letter of "Bulbasaur" must be upper case and the rest must be lower case. By doing this he thinks he has caught one Bulbasaur. He then repeats this step on the left over part of the newspaper. He keeps doing this until it is not possible to form the word "Bulbasaur" from the newspaper.
Given the text on the front page of the newspaper, can you tell how many Bulbasaurs he will catch today?
Note: uppercase and lowercase letters are considered different.
Input
Input contains a single line containing a string s (1 ≤ |s| ≤ 105) — the text on the front page of the newspaper without spaces and punctuation marks. |s| is the length of the string s.
The string s contains lowercase and uppercase English letters, i.e. <image>.
Output
Output a single integer, the answer to the problem.
Examples
Input
Bulbbasaur
Output
1
Input
F
Output
0
Input
aBddulbasaurrgndgbualdBdsagaurrgndbb
Output
2
Note
In the first case, you could pick: Bulbbasaur.
In the second case, there is no way to pick even a single Bulbasaur.
In the third case, you can rearrange the string to BulbasaurBulbasauraddrgndgddgargndbb to get two words "Bulbasaur".
Tags: implementation
Correct Solution:
```
s = input()
#l = ['B', 'u', 'l', 'b', 'a', 's', 'a', 'u', 'r']
l = [0, 0, 0, 0, 0, 0, 0]
for i in s:
if i == 'B':
l[0] += 1
elif i == 'u':
l[1] += 1
elif i == 'l':
l[2] += 1
elif i == 'b':
l[3] += 1
elif i == 'a':
l[4] += 1
elif i == 's':
l[5] += 1
elif i == 'r':
l[6] += 1
l[1] //= 2
l[4] //= 2
print(min(l))
```
| 64,483
|
[
0.03851318359375,
0.1485595703125,
0.105224609375,
0.08612060546875,
-0.5810546875,
-0.60009765625,
0.13134765625,
-0.1925048828125,
0.5654296875,
0.744140625,
0.89111328125,
-0.2398681640625,
0.07440185546875,
-0.444091796875,
-0.63427734375,
-0.29296875,
-0.78955078125,
-0.53369140625,
-0.0330810546875,
-0.461669921875,
-0.0679931640625,
-0.123779296875,
-1.0166015625,
-0.162109375,
-0.1646728515625,
0.7578125,
0.6171875,
0.146240234375,
0.86767578125,
0.88427734375,
0.06390380859375,
-0.2705078125,
0.454833984375,
-0.8505859375,
-0.2822265625,
-0.5537109375,
0.62841796875,
-1.125,
-0.10302734375,
-0.276611328125,
0.4130859375,
-0.266845703125,
0.8798828125,
-0.80078125,
-1.0576171875,
-0.30859375,
-0.70751953125,
-0.227294921875,
-0.277587890625,
-0.59326171875,
0.185791015625,
0.00909423828125,
0.1361083984375,
-0.2021484375,
0.19775390625,
-0.26708984375,
-0.1622314453125,
0.058685302734375,
-0.40380859375,
0.5302734375,
0.0313720703125,
0.25732421875,
-0.1351318359375,
-0.365478515625,
0.036865234375,
0.257568359375,
-0.0023632049560546875,
-0.426025390625,
0.285400390625,
-0.533203125,
-0.477783203125,
0.44970703125,
-0.336669921875,
-0.53369140625,
-0.282470703125,
0.1522216796875,
0.262939453125,
-0.1171875,
-0.68994140625,
1.1640625,
0.0933837890625,
0.85107421875,
0.51806640625,
0.17724609375,
-0.37060546875,
-0.57666015625,
0.2164306640625,
0.255126953125,
0.06634521484375,
-0.217041015625,
-0.31689453125,
0.53173828125,
-0.52197265625,
-0.1966552734375,
0.6787109375,
0.44189453125,
-0.61181640625,
0.533203125,
0.271484375,
0.1041259765625,
0.5234375,
0.85302734375,
-0.35791015625,
1.09375,
-0.1357421875,
0.39453125,
0.126708984375,
0.06536865234375,
-0.51611328125,
-0.329345703125,
-0.3642578125,
-0.13525390625,
0.787109375,
-0.00910186767578125,
-0.4052734375,
0.57861328125,
0.069580078125,
0.68603515625,
-0.89599609375,
0.25048828125,
0.32666015625,
-0.08245849609375,
0.5849609375,
-0.45849609375,
-0.1517333984375,
-0.287353515625,
-0.666015625,
1.177734375,
-0.45458984375,
-0.04058837890625,
0.32666015625,
0.2166748046875,
-0.0007824897766113281,
0.440185546875,
-0.305419921875,
0.71435546875,
-0.53564453125,
0.66845703125,
0.521484375,
-0.62353515625,
0.86376953125,
-0.222412109375,
-0.00016617774963378906,
1.3583984375,
0.397216796875,
0.1103515625,
0.392822265625,
0.1956787109375,
-0.83251953125,
0.642578125,
-0.9931640625,
0.60205078125,
0.091064453125,
0.233154296875,
-0.333740234375,
0.74365234375,
-0.39013671875,
0.34375,
0.26904296875,
0.1533203125,
-0.20263671875,
0.50634765625,
-0.7783203125,
0.9853515625,
0.04315185546875,
0.97900390625,
-0.78271484375,
-0.3173828125,
-0.1873779296875,
-0.301025390625,
-0.015899658203125,
-0.08062744140625,
-0.052520751953125,
0.96240234375,
0.37109375,
0.8447265625,
0.87548828125,
0.048126220703125,
0.1173095703125,
0.1513671875,
0.0206451416015625,
0.255126953125,
0.322265625,
0.89501953125,
0.1529541015625,
0.2479248046875,
0.1103515625,
-0.5537109375,
-0.9775390625,
-0.41015625,
0.08209228515625,
0.51513671875,
-0.313232421875,
0.215087890625,
0.07421875,
0.2296142578125,
-0.496337890625,
-0.260498046875,
-0.021514892578125,
-0.83984375,
-0.429931640625,
0.48046875,
0.05450439453125,
0.68603515625,
0.09576416015625,
-0.93701171875,
0.50830078125,
1.1650390625,
-0.1898193359375,
0.04534912109375,
0.06268310546875,
0.1220703125,
0.01172637939453125,
0.06439208984375,
0.1207275390625,
-0.27978515625,
-0.76953125,
0.388427734375,
-0.08905029296875,
-0.0003516674041748047,
-0.199951171875,
0.395751953125,
0.4091796875,
0.47900390625,
-0.270263671875,
-0.0030231475830078125,
0.78173828125,
0.62939453125,
-0.01044464111328125,
0.0789794921875,
0.10400390625,
0.9326171875,
0.41650390625,
0.775390625,
0.476318359375,
0.289306640625,
0.39697265625,
0.6396484375,
0.356201171875,
0.39501953125,
-0.037811279296875,
0.25146484375,
0.339111328125,
0.462158203125,
0.013946533203125,
0.447021484375,
-0.22607421875,
0.053619384765625,
-0.73193359375,
0.8505859375,
-0.22802734375,
0.66650390625,
0.184814453125,
0.419921875,
-0.2822265625,
-0.685546875,
0.31689453125,
0.64111328125,
-0.9755859375,
-0.397216796875,
0.397216796875,
0.241943359375,
0.3984375,
0.298828125,
0.01678466796875,
0.325927734375,
0.268310546875,
0.44873046875,
0.025390625,
-0.65771484375,
-0.8671875,
-0.62890625,
-1.0576171875,
-0.419677734375,
-0.5908203125,
-0.15673828125,
0.2607421875,
-1.23828125,
0.64501953125,
-0.708984375,
-0.1463623046875,
0.0992431640625,
-0.5458984375,
0.65673828125,
-0.09149169921875,
0.63720703125,
-0.430419921875,
0.55712890625,
-0.03839111328125,
0.7041015625,
-0.378173828125,
-0.058349609375,
-0.42236328125,
-0.703125,
0.155029296875,
0.050933837890625,
0.4033203125,
-0.1685791015625,
-0.425048828125,
-0.5986328125,
-0.27734375,
-0.169921875,
-0.5283203125,
0.148193359375,
-0.54736328125,
0.68798828125,
0.480712890625,
-0.59765625,
0.484130859375,
1.06640625,
-0.8056640625,
0.447265625,
0.18798828125,
0.2469482421875,
-0.724609375,
1.3173828125,
0.31689453125,
0.416015625,
-0.443603515625,
-0.5888671875,
-0.48388671875,
0.09747314453125,
-0.13134765625,
-0.247802734375,
-0.66845703125,
0.7978515625,
0.06304931640625,
-0.90771484375,
0.568359375,
-0.88818359375,
-0.4697265625,
-0.51220703125,
-0.411865234375,
0.6181640625,
0.673828125,
0.0872802734375,
-0.22314453125,
-0.341552734375,
0.1456298828125,
0.67333984375,
0.53564453125,
-0.8291015625,
-0.1842041015625,
0.457275390625,
0.09197998046875,
0.465576171875,
0.12469482421875,
-0.0882568359375,
-0.16259765625,
-0.156982421875,
-0.06463623046875,
0.486083984375,
0.382568359375,
-0.047698974609375,
0.64404296875,
0.440673828125,
-0.8564453125,
-0.2147216796875,
-0.2247314453125,
0.7470703125,
0.2464599609375,
0.8505859375,
0.7470703125,
-0.087158203125,
-0.58984375,
-0.89990234375,
0.33251953125,
0.038238525390625,
0.568359375,
-0.91357421875,
0.5791015625,
0.301025390625,
-0.36376953125,
0.6455078125,
-0.705078125,
-0.25048828125,
1.4814453125,
-0.31494140625,
0.5166015625,
-0.378173828125,
0.99365234375,
-0.288818359375,
-0.237060546875,
0.63427734375,
0.44873046875,
0.39599609375,
0.0706787109375,
0.069580078125,
-0.07183837890625,
-0.3154296875,
-0.251220703125,
-0.53759765625,
0.51025390625,
-0.313232421875,
-0.447021484375,
-0.61474609375,
0.31689453125,
0.5751953125,
0.71142578125,
0.26318359375,
0.92578125,
-0.14013671875,
0.45361328125,
0.00942230224609375,
-0.434326171875,
0.054412841796875,
-0.7138671875,
0.75537109375,
0.0309906005859375,
-0.1575927734375,
-0.51318359375,
-0.0328369140625,
-0.3994140625,
0.364501953125,
0.2181396484375,
-0.280029296875,
-1.16015625,
0.2357177734375,
-0.1800537109375,
0.8173828125,
-0.3974609375,
-0.1207275390625,
-0.246337890625,
0.3076171875,
0.1546630859375,
-0.76220703125,
0.34814453125,
-0.55859375,
0.70263671875,
0.06854248046875,
0.08782958984375,
-0.463134765625,
-0.400634765625,
-0.62939453125,
-0.55029296875,
0.04205322265625,
0.61767578125,
0.1082763671875,
0.263671875,
-0.80322265625,
0.338134765625,
0.36669921875,
-0.0243682861328125,
0.1611328125,
-0.0022373199462890625,
0.22900390625,
0.27978515625,
0.44921875,
-0.469482421875,
-0.4228515625,
0.09869384765625,
-1.2646484375,
0.67138671875,
-0.39990234375,
-0.0184783935546875,
-0.356201171875,
0.0662841796875,
-0.046600341796875,
0.2427978515625,
-0.3056640625,
-0.0030994415283203125,
-0.062744140625,
0.45166015625,
-1.03125,
-0.97314453125,
0.311279296875,
-0.200927734375,
-0.5634765625,
0.69140625,
-0.115234375,
-0.40869140625,
0.211181640625,
0.2401123046875,
-0.728515625,
0.3642578125,
-0.08770751953125,
0.60107421875,
-0.205810546875,
-0.452880859375,
0.0224456787109375,
-0.26708984375,
0.6455078125,
-0.267333984375,
-0.92724609375,
-0.430908203125,
-1.134765625,
0.158203125,
0.158935546875,
-0.461181640625,
0.421875,
-0.03271484375,
-0.1279296875,
0.10650634765625,
-0.269287109375,
-0.326416015625,
-0.136962890625,
-0.495849609375,
-0.421142578125,
0.24462890625,
0.2333984375,
0.76123046875,
-0.36328125,
-0.3115234375,
-0.052978515625,
0.417236328125,
0.2344970703125,
-0.5107421875,
-0.234130859375,
-0.004669189453125,
-0.11962890625,
-0.19189453125,
0.76904296875,
0.1546630859375,
0.43359375,
0.916015625,
0.0906982421875,
0.73095703125,
0.75439453125,
-0.71484375,
1.318359375,
0.00640869140625,
-1.1064453125,
-0.50390625,
0.517578125,
-0.259033203125,
0.47705078125,
0.2724609375,
-0.75244140625,
-0.66796875,
-1.1572265625,
0.1123046875,
-0.73095703125,
-0.1270751953125,
-1.34375,
-0.24169921875,
-0.285888671875,
0.59326171875,
-0.1575927734375,
-0.533203125,
0.64404296875,
-0.99755859375,
-0.051788330078125,
-0.59326171875,
-0.35888671875,
-0.525390625,
-0.56494140625,
-0.52197265625,
0.88671875,
0.162109375,
0.3564453125,
0.042694091796875,
-0.2158203125,
-0.08685302734375,
-0.08538818359375,
-0.67724609375,
-0.3076171875,
-0.39404296875,
0.2001953125,
0.055023193359375,
-0.220947265625,
-0.21923828125,
0.5146484375,
-0.96484375,
0.10394287109375,
-0.242919921875,
-0.446044921875,
-0.281005859375,
-0.0096282958984375,
0.9677734375,
-0.3896484375,
0.2486572265625,
-0.8671875,
0.80908203125,
0.61181640625,
0.00925445556640625,
-0.85791015625,
-0.71923828125,
-0.75634765625,
-0.70654296875,
0.83447265625,
-0.63232421875,
0.380615234375,
-0.61767578125,
0.162353515625,
0.99609375,
-0.6650390625,
0.255615234375,
0.72216796875,
0.293212890625,
0.279541015625,
-0.6884765625,
0.6787109375,
0.5625,
-0.336669921875,
-0.409423828125,
-0.0189208984375,
-0.58056640625,
0.17236328125,
-0.2626953125,
-0.96337890625,
-1.0693359375,
0.3759765625,
1.3154296875,
-0.31689453125,
0.6181640625,
0.2344970703125,
-0.90478515625,
-0.67333984375,
0.677734375,
0.358154296875,
0.533203125,
1.078125,
-0.404296875,
-0.228271484375,
0.124267578125,
0.07159423828125,
-0.2139892578125,
-0.79248046875,
0.83056640625,
-0.359375,
-0.2242431640625,
0.599609375,
0.8583984375,
-1.0888671875,
-0.54443359375,
-0.560546875,
-0.31396484375,
-0.166015625,
-0.49462890625,
-0.009735107421875,
0.2437744140625,
-0.8984375,
-0.296630859375,
0.343017578125,
-0.1585693359375,
0.472900390625,
-0.211181640625,
0.439208984375,
-0.409912109375,
0.70361328125,
0.327880859375,
-0.73291015625,
-0.17919921875,
-0.8125,
0.1671142578125,
-0.140625,
0.201904296875,
0.76611328125,
-0.457763671875,
0.148193359375,
0.436767578125,
0.09619140625,
0.453857421875,
-0.3193359375,
-0.367431640625,
0.1104736328125,
-0.77099609375,
-0.7451171875,
-0.1275634765625,
0.17578125,
-0.283447265625,
0.35205078125,
-0.471923828125,
-0.151123046875,
0.225830078125,
0.357666015625,
-0.305419921875,
-0.9013671875,
-0.09375,
-0.77197265625,
-0.055023193359375,
-0.78955078125,
-0.7822265625,
0.391845703125,
0.67626953125,
-0.54833984375,
-0.2181396484375,
0.265380859375,
0.96630859375,
-0.65185546875,
0.7255859375,
-0.45703125,
0.62255859375,
-0.352783203125,
-0.30517578125,
-0.62451171875,
0.05877685546875,
-0.377685546875,
-0.122802734375,
-0.337158203125,
0.296630859375,
-0.37646484375,
0.51904296875,
0.2418212890625,
0.276123046875,
0.0220947265625,
-0.428955078125,
-0.09881591796875,
-0.0938720703125,
-0.3876953125,
0.67822265625,
0.54931640625,
-0.1405029296875,
-0.01161956787109375,
-0.39013671875,
-0.466796875,
-0.239990234375,
0.75439453125,
0.5625,
-0.12152099609375,
-0.0006198883056640625,
-0.359130859375,
0.202880859375,
-0.93896484375,
0.2032470703125,
-0.47705078125,
0.369873046875,
0.326904296875,
-0.1778564453125,
0.31005859375,
1.0078125,
0.050384521484375,
0.377197265625,
0.246826171875,
-0.023834228515625,
0.50146484375,
0.1444091796875,
0.01383209228515625,
0.355712890625,
0.1541748046875,
-0.1749267578125,
-0.271728515625,
0.7333984375,
-0.01611328125,
0.25,
-0.1171875,
-0.73046875,
-0.89599609375,
-0.0362548828125,
-0.2357177734375,
0.2568359375,
0.07293701171875,
-0.58837890625,
0.060272216796875,
-0.295166015625,
-0.279541015625,
0.417724609375,
-0.93701171875,
-0.8515625,
0.302490234375,
-0.2705078125,
-0.48583984375,
-0.23681640625,
-0.5419921875,
-0.047882080078125,
0.04632568359375,
0.27880859375,
-0.466552734375,
0.3310546875,
-0.30029296875,
0.59423828125,
-0.4501953125,
0.136474609375,
-0.0251007080078125,
0.2271728515625,
-0.52783203125,
-0.298583984375,
-0.052642822265625,
0.96044921875,
-0.040557861328125,
-0.1309814453125,
-0.67236328125,
0.35205078125,
-0.06573486328125,
0.162109375,
-0.2318115234375,
0.209228515625,
-0.5322265625,
0.32177734375,
-1.1572265625,
-0.1290283203125,
-0.1705322265625,
0.251708984375,
0.366455078125,
-0.6337890625,
-0.435791015625,
0.98388671875,
0.837890625,
-0.191650390625,
0.299072265625,
0.067138671875,
0.168701171875,
-0.1776123046875,
-0.189697265625,
-0.1259765625,
0.99853515625,
0.84033203125,
0.85400390625,
-0.046356201171875,
0.5400390625,
0.6171875,
-0.1505126953125,
-0.058502197265625,
0.59814453125,
0.2177734375,
-0.330078125,
0.2548828125,
-0.343505859375,
0.1715087890625,
0.12127685546875,
-0.89111328125,
0.1060791015625,
-0.413330078125,
-0.1527099609375,
-0.232421875,
-0.66552734375,
0.61279296875,
-0.2705078125,
-0.059417724609375,
-0.1265869140625,
-0.5712890625,
0.1571044921875,
0.61279296875,
0.291748046875,
-0.148681640625,
0.91650390625,
0.5986328125,
0.30859375,
0.7431640625,
0.108154296875,
0.1292724609375,
-0.2200927734375,
0.1021728515625,
-0.09796142578125,
-0.0169830322265625,
-0.259521484375,
-0.196044921875,
-0.89453125,
0.389404296875,
0.0970458984375,
-0.375,
0.386474609375,
-0.86669921875,
-0.2027587890625,
-0.3681640625,
0.8017578125,
-0.340087890625,
-0.1815185546875,
0.391357421875,
-0.68603515625,
-0.74755859375,
0.74560546875,
-0.2459716796875,
0.23876953125,
0.040618896484375,
1.345703125,
0.199951171875,
1.134765625,
0.6884765625,
-0.08831787109375,
0.034423828125,
0.177490234375,
-0.494873046875,
-0.421875,
-0.23193359375,
-0.47607421875,
0.1751708984375,
-0.91015625,
-0.51025390625,
-0.30810546875,
0.94287109375,
-0.08001708984375,
-1.025390625,
-0.2083740234375,
-0.1922607421875,
-1.07421875,
0.326904296875,
0.270263671875,
0.5498046875,
-0.341064453125,
-0.1622314453125,
-0.1890869140625,
-0.31787109375,
0.11322021484375,
-0.712890625,
0.438720703125,
-0.2447509765625,
-0.76904296875,
-0.2413330078125,
-0.66064453125,
-0.349853515625,
0.059722900390625,
-0.358154296875,
-0.87109375,
0.453125,
0.59765625,
0.01309967041015625,
0.479736328125,
-0.56591796875,
0.2291259765625,
0.80419921875,
0.92529296875,
0.1636962890625,
0.59326171875,
-0.10595703125,
-0.373291015625,
0.462158203125,
-0.465576171875,
0.56103515625,
-0.0960693359375,
0.2052001953125,
-0.337158203125,
0.6650390625,
-0.6572265625,
-1.2939453125,
0.09490966796875,
0.2462158203125,
0.2255859375,
-0.40673828125,
-0.90478515625,
-0.1943359375,
-1.0009765625,
0.11236572265625,
-0.343017578125,
0.46630859375,
-0.6083984375,
0.1951904296875,
-0.1463623046875,
-1.232421875,
4.58984375,
0.68408203125,
0.96337890625,
0.147705078125,
0.10302734375,
1.0576171875,
0.453369140625,
-0.43896484375,
0.00043272972106933594,
-0.01389312744140625,
0.37841796875,
-0.6259765625,
0.1851806640625,
0.81005859375,
0.1480712890625,
0.57958984375,
-0.74658203125,
0.369140625,
0.1290283203125,
-0.57861328125,
-0.9658203125,
-0.03265380859375,
-0.1656494140625,
0.29638671875,
0.05364990234375,
0.466796875,
0.2484130859375,
-0.5947265625,
-0.1282958984375,
-0.6279296875,
0.034942626953125,
-0.51611328125,
0.54150390625,
-0.20361328125,
-0.150146484375,
0.830078125,
-0.1810302734375,
-0.18603515625,
-0.015838623046875,
0.1151123046875,
-0.3486328125,
-0.285888671875,
0.489501953125,
-0.66162109375,
-0.0450439453125,
0.1588134765625,
-0.93408203125,
0.10382080078125,
0.293701171875,
-0.80517578125,
0.97119140625,
-0.389892578125,
0.453125,
-0.7412109375,
-0.7607421875,
0.221435546875,
0.27392578125,
-0.304931640625,
-0.5146484375,
0.427978515625,
0.53857421875,
0.2305908203125,
0.2454833984375,
0.426025390625,
-0.4736328125,
1.21484375,
-0.0184326171875,
0.173828125,
-0.40966796875,
-0.0970458984375,
-0.419677734375,
-0.381103515625,
-0.0965576171875,
-0.411376953125,
0.89111328125,
0.228759765625,
-0.248046875,
0.4345703125,
0.68408203125,
-0.71435546875,
-0.033966064453125,
-0.337646484375,
-0.432861328125,
-0.0185699462890625,
0.810546875,
1.0966796875,
-0.681640625,
-0.4130859375,
0.14404296875,
0.5419921875,
0.66064453125,
0.72412109375,
0.2332763671875,
-0.61279296875,
-0.1292724609375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Bash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Since he is too young to go out and catch Bulbasaur, he came up with his own way of catching a Bulbasaur.
Each day, he takes the front page of the newspaper. He cuts out the letters one at a time, from anywhere on the front page of the newspaper to form the word "Bulbasaur" (without quotes) and sticks it on his wall. Bash is very particular about case — the first letter of "Bulbasaur" must be upper case and the rest must be lower case. By doing this he thinks he has caught one Bulbasaur. He then repeats this step on the left over part of the newspaper. He keeps doing this until it is not possible to form the word "Bulbasaur" from the newspaper.
Given the text on the front page of the newspaper, can you tell how many Bulbasaurs he will catch today?
Note: uppercase and lowercase letters are considered different.
Input
Input contains a single line containing a string s (1 ≤ |s| ≤ 105) — the text on the front page of the newspaper without spaces and punctuation marks. |s| is the length of the string s.
The string s contains lowercase and uppercase English letters, i.e. <image>.
Output
Output a single integer, the answer to the problem.
Examples
Input
Bulbbasaur
Output
1
Input
F
Output
0
Input
aBddulbasaurrgndgbualdBdsagaurrgndbb
Output
2
Note
In the first case, you could pick: Bulbbasaur.
In the second case, there is no way to pick even a single Bulbasaur.
In the third case, you can rearrange the string to BulbasaurBulbasauraddrgndgddgargndbb to get two words "Bulbasaur".
Tags: implementation
Correct Solution:
```
s = input()
B = s.count("B")
u = s.count("u")//2
l = s.count("l")
b = s.count("b")
a = s.count("a")//2
s1 = s.count("s")
r = s.count("r")
print(min(B, u, l, b, a, s1, r))
```
| 64,484
|
[
0.0745849609375,
0.1688232421875,
0.08514404296875,
0.1043701171875,
-0.5849609375,
-0.583984375,
0.11358642578125,
-0.1761474609375,
0.5908203125,
0.73291015625,
0.89990234375,
-0.2529296875,
0.06829833984375,
-0.41845703125,
-0.62548828125,
-0.298583984375,
-0.77685546875,
-0.509765625,
-0.0318603515625,
-0.458251953125,
-0.0750732421875,
-0.1124267578125,
-1.01171875,
-0.16259765625,
-0.146484375,
0.7412109375,
0.6220703125,
0.1378173828125,
0.83837890625,
0.8701171875,
0.0628662109375,
-0.296875,
0.454345703125,
-0.82373046875,
-0.291259765625,
-0.54833984375,
0.634765625,
-1.1572265625,
-0.09912109375,
-0.30712890625,
0.423828125,
-0.28759765625,
0.89208984375,
-0.80908203125,
-1.0595703125,
-0.34423828125,
-0.76025390625,
-0.2286376953125,
-0.28564453125,
-0.556640625,
0.1685791015625,
-0.01611328125,
0.143310546875,
-0.235595703125,
0.22802734375,
-0.292724609375,
-0.157470703125,
0.07318115234375,
-0.398193359375,
0.54150390625,
0.046966552734375,
0.2744140625,
-0.156005859375,
-0.371826171875,
0.050445556640625,
0.28076171875,
-0.0262451171875,
-0.4677734375,
0.298583984375,
-0.546875,
-0.462158203125,
0.4501953125,
-0.336181640625,
-0.521484375,
-0.260986328125,
0.1458740234375,
0.27197265625,
-0.145263671875,
-0.68505859375,
1.1953125,
0.0816650390625,
0.85791015625,
0.5380859375,
0.19580078125,
-0.344970703125,
-0.56298828125,
0.246337890625,
0.2218017578125,
0.08074951171875,
-0.2305908203125,
-0.280029296875,
0.53515625,
-0.51416015625,
-0.22216796875,
0.66943359375,
0.474853515625,
-0.6435546875,
0.51416015625,
0.265869140625,
0.0799560546875,
0.568359375,
0.8125,
-0.3896484375,
1.09375,
-0.16552734375,
0.369873046875,
0.12286376953125,
0.07269287109375,
-0.489990234375,
-0.376220703125,
-0.374755859375,
-0.1502685546875,
0.77978515625,
0.028411865234375,
-0.385498046875,
0.5771484375,
0.06341552734375,
0.6962890625,
-0.935546875,
0.241943359375,
0.3505859375,
-0.07293701171875,
0.61328125,
-0.474853515625,
-0.15771484375,
-0.296875,
-0.681640625,
1.1845703125,
-0.47021484375,
-0.047698974609375,
0.301513671875,
0.2174072265625,
0.01291656494140625,
0.4560546875,
-0.31640625,
0.71826171875,
-0.53662109375,
0.65087890625,
0.54150390625,
-0.65966796875,
0.853515625,
-0.216552734375,
-0.01129913330078125,
1.3486328125,
0.3876953125,
0.1707763671875,
0.352294921875,
0.205078125,
-0.86376953125,
0.65185546875,
-0.9912109375,
0.58837890625,
0.068115234375,
0.2391357421875,
-0.35009765625,
0.7431640625,
-0.3486328125,
0.343505859375,
0.280029296875,
0.1097412109375,
-0.2269287109375,
0.56298828125,
-0.7705078125,
0.98291015625,
0.0382080078125,
0.96630859375,
-0.77294921875,
-0.30615234375,
-0.1778564453125,
-0.326416015625,
-0.01032257080078125,
-0.11639404296875,
-0.066650390625,
0.98095703125,
0.40380859375,
0.84228515625,
0.8251953125,
0.019256591796875,
0.14453125,
0.126708984375,
0.032257080078125,
0.2061767578125,
0.34228515625,
0.8935546875,
0.147705078125,
0.27197265625,
0.10662841796875,
-0.59130859375,
-0.98388671875,
-0.40966796875,
0.09881591796875,
0.53173828125,
-0.317138671875,
0.2135009765625,
0.068603515625,
0.2457275390625,
-0.513671875,
-0.278076171875,
-0.00882720947265625,
-0.84423828125,
-0.423583984375,
0.486083984375,
0.06610107421875,
0.6943359375,
0.07989501953125,
-0.95166015625,
0.491455078125,
1.1337890625,
-0.172607421875,
0.044647216796875,
0.052520751953125,
0.10675048828125,
0.00836944580078125,
0.08514404296875,
0.1328125,
-0.26171875,
-0.78369140625,
0.36572265625,
-0.0980224609375,
-0.01617431640625,
-0.21923828125,
0.393798828125,
0.398681640625,
0.50048828125,
-0.255859375,
-0.0272979736328125,
0.8017578125,
0.59814453125,
-0.054718017578125,
0.11224365234375,
0.10321044921875,
0.94384765625,
0.411865234375,
0.77001953125,
0.466796875,
0.288330078125,
0.3818359375,
0.599609375,
0.355224609375,
0.36572265625,
-0.06597900390625,
0.282958984375,
0.33740234375,
0.46533203125,
0.0308380126953125,
0.4345703125,
-0.23095703125,
0.0323486328125,
-0.724609375,
0.89404296875,
-0.1812744140625,
0.63916015625,
0.1966552734375,
0.39794921875,
-0.279541015625,
-0.68505859375,
0.315185546875,
0.6171875,
-0.93701171875,
-0.4140625,
0.4140625,
0.245361328125,
0.3896484375,
0.264404296875,
0.0059051513671875,
0.31884765625,
0.295166015625,
0.45166015625,
0.010498046875,
-0.650390625,
-0.8515625,
-0.65234375,
-1.0986328125,
-0.443359375,
-0.60302734375,
-0.1812744140625,
0.28125,
-1.25390625,
0.6083984375,
-0.7099609375,
-0.153564453125,
0.091796875,
-0.53857421875,
0.671875,
-0.1014404296875,
0.671875,
-0.38232421875,
0.55029296875,
-0.0509033203125,
0.6689453125,
-0.368408203125,
-0.060821533203125,
-0.42578125,
-0.693359375,
0.1439208984375,
0.05792236328125,
0.432861328125,
-0.186767578125,
-0.3955078125,
-0.642578125,
-0.25927734375,
-0.1883544921875,
-0.52880859375,
0.152587890625,
-0.54638671875,
0.68505859375,
0.44677734375,
-0.6142578125,
0.513671875,
1.076171875,
-0.79638671875,
0.4755859375,
0.18017578125,
0.290771484375,
-0.7021484375,
1.32421875,
0.313232421875,
0.433837890625,
-0.434814453125,
-0.58447265625,
-0.496826171875,
0.09893798828125,
-0.144775390625,
-0.260986328125,
-0.6572265625,
0.81201171875,
0.07952880859375,
-0.92138671875,
0.57373046875,
-0.8740234375,
-0.4736328125,
-0.52685546875,
-0.42236328125,
0.58349609375,
0.67919921875,
0.0731201171875,
-0.22509765625,
-0.3623046875,
0.1259765625,
0.64208984375,
0.5478515625,
-0.82861328125,
-0.2000732421875,
0.495849609375,
0.08807373046875,
0.479248046875,
0.117919921875,
-0.08111572265625,
-0.1751708984375,
-0.150390625,
-0.108642578125,
0.51904296875,
0.378173828125,
-0.021392822265625,
0.63330078125,
0.4306640625,
-0.88623046875,
-0.2183837890625,
-0.22021484375,
0.7373046875,
0.2254638671875,
0.82177734375,
0.76171875,
-0.04876708984375,
-0.6171875,
-0.92529296875,
0.355712890625,
-0.0061492919921875,
0.572265625,
-0.95654296875,
0.5849609375,
0.28857421875,
-0.323974609375,
0.68701171875,
-0.6845703125,
-0.288330078125,
1.4853515625,
-0.350830078125,
0.487060546875,
-0.364501953125,
1.00390625,
-0.291748046875,
-0.25927734375,
0.62255859375,
0.4521484375,
0.388916015625,
0.067138671875,
0.054290771484375,
-0.079833984375,
-0.31103515625,
-0.26611328125,
-0.53759765625,
0.4931640625,
-0.325927734375,
-0.437744140625,
-0.6201171875,
0.31201171875,
0.5654296875,
0.73095703125,
0.293212890625,
0.908203125,
-0.1436767578125,
0.432373046875,
0.02508544921875,
-0.448486328125,
0.07220458984375,
-0.73095703125,
0.76611328125,
0.055877685546875,
-0.1884765625,
-0.52197265625,
0.01947021484375,
-0.4169921875,
0.338623046875,
0.213134765625,
-0.295166015625,
-1.19140625,
0.244873046875,
-0.1759033203125,
0.82275390625,
-0.393310546875,
-0.11248779296875,
-0.2470703125,
0.28125,
0.1595458984375,
-0.72705078125,
0.325439453125,
-0.57373046875,
0.6982421875,
0.1025390625,
0.0604248046875,
-0.49609375,
-0.423095703125,
-0.6494140625,
-0.5625,
0.008270263671875,
0.60693359375,
0.1231689453125,
0.269775390625,
-0.80615234375,
0.36376953125,
0.369384765625,
-0.03741455078125,
0.146484375,
0.0141754150390625,
0.227783203125,
0.3046875,
0.450439453125,
-0.47119140625,
-0.399169921875,
0.09051513671875,
-1.2587890625,
0.67822265625,
-0.4013671875,
-0.0005288124084472656,
-0.32568359375,
0.09393310546875,
-0.030548095703125,
0.273681640625,
-0.283447265625,
-0.0188751220703125,
-0.06488037109375,
0.458984375,
-1.0087890625,
-0.95068359375,
0.300537109375,
-0.2012939453125,
-0.5595703125,
0.7109375,
-0.126708984375,
-0.430908203125,
0.231201171875,
0.216552734375,
-0.748046875,
0.36669921875,
-0.08355712890625,
0.5947265625,
-0.1710205078125,
-0.442138671875,
0.045379638671875,
-0.263916015625,
0.64697265625,
-0.252197265625,
-0.93359375,
-0.423095703125,
-1.1298828125,
0.16845703125,
0.1622314453125,
-0.505859375,
0.4228515625,
-0.03472900390625,
-0.146484375,
0.13427734375,
-0.24169921875,
-0.325927734375,
-0.1373291015625,
-0.5244140625,
-0.42138671875,
0.222900390625,
0.23974609375,
0.78955078125,
-0.34619140625,
-0.30322265625,
-0.08135986328125,
0.411376953125,
0.2607421875,
-0.51171875,
-0.1873779296875,
-0.0249481201171875,
-0.1048583984375,
-0.1668701171875,
0.79443359375,
0.17529296875,
0.41943359375,
0.89892578125,
0.1082763671875,
0.76513671875,
0.74169921875,
-0.68212890625,
1.330078125,
-0.0018186569213867188,
-1.12109375,
-0.462646484375,
0.51953125,
-0.2291259765625,
0.47021484375,
0.278076171875,
-0.77978515625,
-0.68359375,
-1.1357421875,
0.11492919921875,
-0.71240234375,
-0.1715087890625,
-1.3056640625,
-0.2259521484375,
-0.28466796875,
0.60791015625,
-0.1793212890625,
-0.51220703125,
0.673828125,
-1.0029296875,
-0.059295654296875,
-0.58935546875,
-0.36474609375,
-0.52099609375,
-0.56298828125,
-0.46875,
0.87939453125,
0.1614990234375,
0.3564453125,
0.021209716796875,
-0.165771484375,
-0.0625,
-0.08880615234375,
-0.6435546875,
-0.341552734375,
-0.389404296875,
0.2252197265625,
0.04302978515625,
-0.1912841796875,
-0.221923828125,
0.47607421875,
-0.966796875,
0.09783935546875,
-0.2230224609375,
-0.452392578125,
-0.27294921875,
0.004703521728515625,
0.98583984375,
-0.4013671875,
0.24267578125,
-0.849609375,
0.76953125,
0.6025390625,
0.02880859375,
-0.8583984375,
-0.72607421875,
-0.75,
-0.67919921875,
0.87060546875,
-0.61181640625,
0.40087890625,
-0.619140625,
0.19677734375,
1.0185546875,
-0.68603515625,
0.271240234375,
0.66259765625,
0.3125,
0.284423828125,
-0.69287109375,
0.67626953125,
0.53125,
-0.340087890625,
-0.44287109375,
-0.05218505859375,
-0.58984375,
0.1951904296875,
-0.263427734375,
-0.98681640625,
-1.0791015625,
0.393310546875,
1.3095703125,
-0.3486328125,
0.6025390625,
0.2476806640625,
-0.91943359375,
-0.705078125,
0.66259765625,
0.34423828125,
0.56640625,
1.0546875,
-0.38427734375,
-0.245361328125,
0.150634765625,
0.0728759765625,
-0.2354736328125,
-0.82373046875,
0.849609375,
-0.406005859375,
-0.2291259765625,
0.59423828125,
0.8408203125,
-1.0849609375,
-0.50146484375,
-0.57568359375,
-0.30859375,
-0.1993408203125,
-0.50830078125,
-0.031341552734375,
0.2344970703125,
-0.919921875,
-0.320068359375,
0.3349609375,
-0.173828125,
0.467041015625,
-0.221923828125,
0.455810546875,
-0.40283203125,
0.7021484375,
0.332275390625,
-0.751953125,
-0.154541015625,
-0.79931640625,
0.157470703125,
-0.134765625,
0.2120361328125,
0.73291015625,
-0.489013671875,
0.1224365234375,
0.43212890625,
0.093505859375,
0.450439453125,
-0.317138671875,
-0.36279296875,
0.12646484375,
-0.755859375,
-0.75146484375,
-0.1331787109375,
0.172607421875,
-0.2841796875,
0.366455078125,
-0.460205078125,
-0.1593017578125,
0.262939453125,
0.36328125,
-0.297119140625,
-0.85302734375,
-0.10455322265625,
-0.7333984375,
-0.052703857421875,
-0.82861328125,
-0.771484375,
0.379638671875,
0.69140625,
-0.52587890625,
-0.177978515625,
0.287353515625,
0.98583984375,
-0.6396484375,
0.76025390625,
-0.450927734375,
0.62158203125,
-0.33544921875,
-0.30419921875,
-0.6044921875,
0.07403564453125,
-0.3984375,
-0.134521484375,
-0.37744140625,
0.287109375,
-0.37646484375,
0.53466796875,
0.262939453125,
0.28173828125,
0.00847625732421875,
-0.409912109375,
-0.082275390625,
-0.0987548828125,
-0.371337890625,
0.68212890625,
0.53076171875,
-0.1417236328125,
-0.00548553466796875,
-0.404541015625,
-0.463134765625,
-0.2041015625,
0.80712890625,
0.58203125,
-0.13427734375,
0.01495361328125,
-0.3876953125,
0.197021484375,
-0.89599609375,
0.232666015625,
-0.49951171875,
0.3447265625,
0.306884765625,
-0.1583251953125,
0.316650390625,
1.01171875,
0.0570068359375,
0.384765625,
0.2376708984375,
-0.030975341796875,
0.51513671875,
0.144775390625,
0.00547027587890625,
0.38916015625,
0.15478515625,
-0.1600341796875,
-0.324462890625,
0.7353515625,
-0.0322265625,
0.25341796875,
-0.1226806640625,
-0.69580078125,
-0.86767578125,
-0.04620361328125,
-0.267822265625,
0.2763671875,
0.083984375,
-0.572265625,
0.048553466796875,
-0.294677734375,
-0.275390625,
0.3955078125,
-0.9833984375,
-0.888671875,
0.306396484375,
-0.2467041015625,
-0.498291015625,
-0.1986083984375,
-0.54736328125,
-0.050018310546875,
0.08770751953125,
0.2529296875,
-0.4287109375,
0.32666015625,
-0.2802734375,
0.63623046875,
-0.45849609375,
0.139404296875,
-0.01898193359375,
0.2413330078125,
-0.5166015625,
-0.314453125,
-0.0771484375,
0.94482421875,
-0.0279541015625,
-0.11260986328125,
-0.64111328125,
0.333251953125,
-0.057464599609375,
0.1717529296875,
-0.2025146484375,
0.20947265625,
-0.55322265625,
0.345458984375,
-1.1513671875,
-0.12091064453125,
-0.1522216796875,
0.24609375,
0.369873046875,
-0.63037109375,
-0.436279296875,
1.0126953125,
0.85107421875,
-0.1973876953125,
0.326171875,
0.0699462890625,
0.169189453125,
-0.1724853515625,
-0.19189453125,
-0.11517333984375,
1.0107421875,
0.8388671875,
0.8330078125,
-0.059814453125,
0.55712890625,
0.62548828125,
-0.09942626953125,
-0.0047454833984375,
0.6337890625,
0.2005615234375,
-0.3349609375,
0.28515625,
-0.323974609375,
0.1358642578125,
0.1431884765625,
-0.88330078125,
0.12176513671875,
-0.446533203125,
-0.160400390625,
-0.2425537109375,
-0.6376953125,
0.6201171875,
-0.27587890625,
-0.07135009765625,
-0.1090087890625,
-0.56884765625,
0.1400146484375,
0.6298828125,
0.273193359375,
-0.12054443359375,
0.958984375,
0.6083984375,
0.315673828125,
0.70556640625,
0.0924072265625,
0.1455078125,
-0.22021484375,
0.048248291015625,
-0.0806884765625,
-0.037933349609375,
-0.262451171875,
-0.2008056640625,
-0.90625,
0.374755859375,
0.10748291015625,
-0.372802734375,
0.40673828125,
-0.88037109375,
-0.2474365234375,
-0.367431640625,
0.76220703125,
-0.33935546875,
-0.19287109375,
0.39306640625,
-0.6494140625,
-0.73876953125,
0.76123046875,
-0.2391357421875,
0.22802734375,
0.03363037109375,
1.3193359375,
0.2354736328125,
1.119140625,
0.73486328125,
-0.07623291015625,
-0.0115509033203125,
0.2015380859375,
-0.51708984375,
-0.394775390625,
-0.219482421875,
-0.464111328125,
0.142333984375,
-0.8984375,
-0.499755859375,
-0.32373046875,
0.9951171875,
-0.10052490234375,
-1.0595703125,
-0.19921875,
-0.2115478515625,
-1.068359375,
0.318359375,
0.25927734375,
0.52685546875,
-0.3603515625,
-0.1993408203125,
-0.1689453125,
-0.31591796875,
0.097412109375,
-0.70654296875,
0.437744140625,
-0.2322998046875,
-0.76708984375,
-0.257080078125,
-0.67626953125,
-0.351318359375,
0.0258026123046875,
-0.318359375,
-0.87841796875,
0.449951171875,
0.55908203125,
-0.0028553009033203125,
0.487548828125,
-0.52978515625,
0.2354736328125,
0.83349609375,
0.9443359375,
0.166015625,
0.60498046875,
-0.11578369140625,
-0.341796875,
0.4677734375,
-0.43505859375,
0.591796875,
-0.09259033203125,
0.223388671875,
-0.3251953125,
0.66748046875,
-0.69921875,
-1.287109375,
0.09478759765625,
0.25244140625,
0.2294921875,
-0.40771484375,
-0.89453125,
-0.206787109375,
-0.9755859375,
0.0986328125,
-0.34814453125,
0.466552734375,
-0.5908203125,
0.19677734375,
-0.1485595703125,
-1.1884765625,
4.578125,
0.66162109375,
0.95361328125,
0.1485595703125,
0.09027099609375,
1.068359375,
0.475341796875,
-0.45703125,
-0.007785797119140625,
-0.024810791015625,
0.342041015625,
-0.60498046875,
0.178955078125,
0.80859375,
0.1822509765625,
0.59423828125,
-0.70849609375,
0.381591796875,
0.177978515625,
-0.62353515625,
-1.001953125,
-0.08642578125,
-0.1715087890625,
0.29833984375,
0.04388427734375,
0.50048828125,
0.27197265625,
-0.5751953125,
-0.11712646484375,
-0.65185546875,
0.04644775390625,
-0.51123046875,
0.533203125,
-0.2076416015625,
-0.155517578125,
0.83544921875,
-0.1827392578125,
-0.2135009765625,
-0.0017442703247070312,
0.08941650390625,
-0.36083984375,
-0.25927734375,
0.48583984375,
-0.638671875,
-0.052734375,
0.1463623046875,
-0.92529296875,
0.08038330078125,
0.279052734375,
-0.7998046875,
0.97802734375,
-0.3623046875,
0.4501953125,
-0.75,
-0.7470703125,
0.2061767578125,
0.283935546875,
-0.320068359375,
-0.513671875,
0.371337890625,
0.537109375,
0.2401123046875,
0.2425537109375,
0.431640625,
-0.5126953125,
1.18359375,
-0.0396728515625,
0.1556396484375,
-0.415771484375,
-0.12432861328125,
-0.408935546875,
-0.373291015625,
-0.107177734375,
-0.42236328125,
0.92333984375,
0.24365234375,
-0.29296875,
0.435546875,
0.6845703125,
-0.7197265625,
-0.010894775390625,
-0.36279296875,
-0.41943359375,
-0.0235748291015625,
0.83544921875,
1.0908203125,
-0.701171875,
-0.40771484375,
0.158935546875,
0.5283203125,
0.6728515625,
0.744140625,
0.2269287109375,
-0.66650390625,
-0.1558837890625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Bash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Since he is too young to go out and catch Bulbasaur, he came up with his own way of catching a Bulbasaur.
Each day, he takes the front page of the newspaper. He cuts out the letters one at a time, from anywhere on the front page of the newspaper to form the word "Bulbasaur" (without quotes) and sticks it on his wall. Bash is very particular about case — the first letter of "Bulbasaur" must be upper case and the rest must be lower case. By doing this he thinks he has caught one Bulbasaur. He then repeats this step on the left over part of the newspaper. He keeps doing this until it is not possible to form the word "Bulbasaur" from the newspaper.
Given the text on the front page of the newspaper, can you tell how many Bulbasaurs he will catch today?
Note: uppercase and lowercase letters are considered different.
Input
Input contains a single line containing a string s (1 ≤ |s| ≤ 105) — the text on the front page of the newspaper without spaces and punctuation marks. |s| is the length of the string s.
The string s contains lowercase and uppercase English letters, i.e. <image>.
Output
Output a single integer, the answer to the problem.
Examples
Input
Bulbbasaur
Output
1
Input
F
Output
0
Input
aBddulbasaurrgndgbualdBdsagaurrgndbb
Output
2
Note
In the first case, you could pick: Bulbbasaur.
In the second case, there is no way to pick even a single Bulbasaur.
In the third case, you can rearrange the string to BulbasaurBulbasauraddrgndgddgargndbb to get two words "Bulbasaur".
Tags: implementation
Correct Solution:
```
texto=input()
s=len(texto)
contador={'B':0,'u':0,'l':0,'b':0,'a':0,'s':0,'a':0,'u':0,'r':0}
for i in range(s):
letra=texto[i]
if letra in contador:
contador[letra]+=1
minimo=contador['B']
for letra in contador:
if contador[letra]<minimo:
minimo=contador[letra]
cantidad_a=contador['a']
cantidad_u=contador['u']
if (cantidad_a/2>=minimo) and (cantidad_u/2>=minimo):
print(minimo)
else:
if cantidad_a<cantidad_u:
print(cantidad_a//2)
else:
print(cantidad_u//2)
```
| 64,485
|
[
0.03369140625,
0.1195068359375,
0.088623046875,
0.0958251953125,
-0.55029296875,
-0.60205078125,
0.1015625,
-0.1700439453125,
0.60986328125,
0.7392578125,
0.85498046875,
-0.2454833984375,
0.07440185546875,
-0.407470703125,
-0.59228515625,
-0.291015625,
-0.76708984375,
-0.5224609375,
-0.004791259765625,
-0.437744140625,
-0.080810546875,
-0.1337890625,
-1.05078125,
-0.198486328125,
-0.16259765625,
0.74560546875,
0.6533203125,
0.1441650390625,
0.8447265625,
0.85888671875,
0.08111572265625,
-0.257080078125,
0.457275390625,
-0.84521484375,
-0.2490234375,
-0.51513671875,
0.6318359375,
-1.1142578125,
-0.08599853515625,
-0.32958984375,
0.427978515625,
-0.2861328125,
0.87060546875,
-0.7744140625,
-1.068359375,
-0.314453125,
-0.72265625,
-0.247802734375,
-0.283935546875,
-0.59521484375,
0.1578369140625,
-0.0007958412170410156,
0.1475830078125,
-0.184326171875,
0.1767578125,
-0.2587890625,
-0.1463623046875,
0.07012939453125,
-0.358642578125,
0.52392578125,
0.046905517578125,
0.260009765625,
-0.1632080078125,
-0.353271484375,
0.0177459716796875,
0.268310546875,
0.02325439453125,
-0.42333984375,
0.2890625,
-0.5341796875,
-0.487060546875,
0.46484375,
-0.33203125,
-0.56591796875,
-0.261962890625,
0.1392822265625,
0.23681640625,
-0.160888671875,
-0.66015625,
1.177734375,
0.11395263671875,
0.8271484375,
0.5166015625,
0.2161865234375,
-0.41015625,
-0.5625,
0.229736328125,
0.244140625,
0.07916259765625,
-0.1888427734375,
-0.339111328125,
0.49755859375,
-0.494873046875,
-0.18505859375,
0.7119140625,
0.44482421875,
-0.61767578125,
0.55322265625,
0.2335205078125,
0.1357421875,
0.53125,
0.8564453125,
-0.344482421875,
1.1064453125,
-0.11181640625,
0.405517578125,
0.1571044921875,
0.04718017578125,
-0.498046875,
-0.3408203125,
-0.384521484375,
-0.154052734375,
0.81787109375,
0.003711700439453125,
-0.406982421875,
0.58154296875,
0.050140380859375,
0.63525390625,
-0.8779296875,
0.242431640625,
0.31689453125,
-0.0775146484375,
0.5615234375,
-0.474365234375,
-0.1395263671875,
-0.296875,
-0.68408203125,
1.189453125,
-0.46826171875,
-0.054534912109375,
0.313720703125,
0.183349609375,
0.0248565673828125,
0.46435546875,
-0.318115234375,
0.7109375,
-0.47509765625,
0.66015625,
0.51513671875,
-0.66845703125,
0.853515625,
-0.22314453125,
0.020538330078125,
1.345703125,
0.38818359375,
0.147216796875,
0.381103515625,
0.17822265625,
-0.8232421875,
0.6923828125,
-0.99658203125,
0.6171875,
0.12841796875,
0.2403564453125,
-0.371826171875,
0.759765625,
-0.377685546875,
0.372314453125,
0.277587890625,
0.1141357421875,
-0.2186279296875,
0.49755859375,
-0.81298828125,
0.9794921875,
0.0273590087890625,
0.978515625,
-0.7880859375,
-0.31591796875,
-0.195556640625,
-0.299072265625,
-0.03125,
-0.068603515625,
-0.068359375,
0.9599609375,
0.375244140625,
0.791015625,
0.85791015625,
0.00777435302734375,
0.11279296875,
0.1259765625,
0.00907135009765625,
0.21728515625,
0.292236328125,
0.88671875,
0.1492919921875,
0.209228515625,
0.122802734375,
-0.56103515625,
-0.9609375,
-0.401123046875,
0.1009521484375,
0.51123046875,
-0.335693359375,
0.200439453125,
0.109130859375,
0.2425537109375,
-0.473388671875,
-0.251708984375,
-0.0204925537109375,
-0.8203125,
-0.4365234375,
0.5146484375,
0.0625,
0.6728515625,
0.08636474609375,
-0.931640625,
0.51513671875,
1.1455078125,
-0.17919921875,
0.06585693359375,
0.1109619140625,
0.0657958984375,
-0.007598876953125,
0.092041015625,
0.149658203125,
-0.300048828125,
-0.75830078125,
0.3701171875,
-0.068115234375,
0.0017938613891601562,
-0.21142578125,
0.420654296875,
0.414306640625,
0.451416015625,
-0.21826171875,
0.034332275390625,
0.771484375,
0.60595703125,
0.005687713623046875,
0.10009765625,
0.11395263671875,
0.921875,
0.39453125,
0.7822265625,
0.465576171875,
0.27734375,
0.41015625,
0.625,
0.355224609375,
0.3759765625,
-0.07525634765625,
0.286865234375,
0.32275390625,
0.466552734375,
0.0204925537109375,
0.473388671875,
-0.2113037109375,
0.06890869140625,
-0.72314453125,
0.8876953125,
-0.2100830078125,
0.67724609375,
0.1783447265625,
0.401123046875,
-0.3046875,
-0.685546875,
0.2900390625,
0.6318359375,
-0.94580078125,
-0.428466796875,
0.432373046875,
0.24609375,
0.361328125,
0.301513671875,
0.02093505859375,
0.31396484375,
0.291015625,
0.453857421875,
0.045257568359375,
-0.67822265625,
-0.87060546875,
-0.63037109375,
-1.0576171875,
-0.45068359375,
-0.64111328125,
-0.1400146484375,
0.2666015625,
-1.2119140625,
0.65185546875,
-0.70654296875,
-0.11492919921875,
0.09222412109375,
-0.53662109375,
0.59814453125,
-0.1307373046875,
0.677734375,
-0.398193359375,
0.56201171875,
-0.056793212890625,
0.640625,
-0.350830078125,
-0.1104736328125,
-0.471435546875,
-0.71533203125,
0.1201171875,
0.095458984375,
0.429443359375,
-0.1484375,
-0.43994140625,
-0.60107421875,
-0.26708984375,
-0.201171875,
-0.53076171875,
0.1357421875,
-0.54833984375,
0.646484375,
0.451416015625,
-0.5927734375,
0.464599609375,
1.0615234375,
-0.79931640625,
0.44580078125,
0.224609375,
0.2880859375,
-0.73046875,
1.3046875,
0.2900390625,
0.400634765625,
-0.46240234375,
-0.58544921875,
-0.48486328125,
0.10888671875,
-0.1365966796875,
-0.250244140625,
-0.6865234375,
0.7705078125,
0.0706787109375,
-0.92431640625,
0.57080078125,
-0.87255859375,
-0.50537109375,
-0.5078125,
-0.411865234375,
0.58544921875,
0.68310546875,
0.11285400390625,
-0.28857421875,
-0.300048828125,
0.123046875,
0.66162109375,
0.54736328125,
-0.8466796875,
-0.2220458984375,
0.45556640625,
0.07611083984375,
0.484130859375,
0.099365234375,
-0.09307861328125,
-0.177978515625,
-0.144775390625,
-0.08306884765625,
0.5009765625,
0.37890625,
-0.0780029296875,
0.65087890625,
0.44482421875,
-0.88720703125,
-0.1947021484375,
-0.2142333984375,
0.71728515625,
0.247314453125,
0.83837890625,
0.744140625,
-0.0916748046875,
-0.5595703125,
-0.88818359375,
0.382568359375,
0.06805419921875,
0.5693359375,
-0.92578125,
0.56396484375,
0.325439453125,
-0.3720703125,
0.6435546875,
-0.75,
-0.250244140625,
1.4951171875,
-0.279052734375,
0.5068359375,
-0.365478515625,
1.0107421875,
-0.334228515625,
-0.233154296875,
0.6015625,
0.475341796875,
0.37939453125,
0.09173583984375,
0.12841796875,
-0.08343505859375,
-0.32958984375,
-0.264892578125,
-0.53369140625,
0.53515625,
-0.272216796875,
-0.4404296875,
-0.5771484375,
0.318603515625,
0.63037109375,
0.71484375,
0.2802734375,
0.91015625,
-0.10369873046875,
0.421630859375,
0.016937255859375,
-0.4482421875,
0.09564208984375,
-0.68896484375,
0.7734375,
-0.0089569091796875,
-0.1412353515625,
-0.49853515625,
-0.038818359375,
-0.402587890625,
0.355224609375,
0.2095947265625,
-0.25830078125,
-1.1513671875,
0.2415771484375,
-0.1817626953125,
0.81298828125,
-0.39013671875,
-0.138916015625,
-0.263916015625,
0.297607421875,
0.1754150390625,
-0.7177734375,
0.346435546875,
-0.5625,
0.67138671875,
0.07666015625,
0.06658935546875,
-0.476806640625,
-0.377685546875,
-0.63623046875,
-0.54736328125,
0.07208251953125,
0.59326171875,
0.1083984375,
0.245849609375,
-0.78564453125,
0.32421875,
0.396484375,
-0.06854248046875,
0.166259765625,
0.041290283203125,
0.2052001953125,
0.303955078125,
0.448974609375,
-0.4462890625,
-0.38916015625,
0.1339111328125,
-1.2451171875,
0.68798828125,
-0.39306640625,
-0.0267791748046875,
-0.36083984375,
0.045196533203125,
-0.040252685546875,
0.2138671875,
-0.29638671875,
0.01511383056640625,
-0.11083984375,
0.495361328125,
-1.033203125,
-0.97119140625,
0.287109375,
-0.205078125,
-0.54296875,
0.6572265625,
-0.08673095703125,
-0.42724609375,
0.2012939453125,
0.220947265625,
-0.728515625,
0.341064453125,
-0.0919189453125,
0.5966796875,
-0.257568359375,
-0.4677734375,
0.052276611328125,
-0.25341796875,
0.62841796875,
-0.2880859375,
-0.94775390625,
-0.4033203125,
-1.1474609375,
0.1533203125,
0.1409912109375,
-0.431640625,
0.396484375,
-0.056182861328125,
-0.133544921875,
0.1368408203125,
-0.28662109375,
-0.32666015625,
-0.1171875,
-0.47021484375,
-0.431396484375,
0.2205810546875,
0.213623046875,
0.75,
-0.3408203125,
-0.31640625,
-0.052001953125,
0.47607421875,
0.2198486328125,
-0.5126953125,
-0.239013671875,
-0.040863037109375,
-0.1373291015625,
-0.201904296875,
0.77685546875,
0.177978515625,
0.416748046875,
0.890625,
0.10479736328125,
0.7490234375,
0.76708984375,
-0.68505859375,
1.3486328125,
-0.007648468017578125,
-1.146484375,
-0.51904296875,
0.53466796875,
-0.2193603515625,
0.5,
0.23876953125,
-0.73583984375,
-0.68310546875,
-1.13671875,
0.09716796875,
-0.71240234375,
-0.0830078125,
-1.33203125,
-0.21728515625,
-0.2548828125,
0.57958984375,
-0.14208984375,
-0.53662109375,
0.66943359375,
-1.0009765625,
-0.06475830078125,
-0.56201171875,
-0.3623046875,
-0.50146484375,
-0.5751953125,
-0.5625,
0.90234375,
0.1724853515625,
0.356201171875,
0.0185394287109375,
-0.1827392578125,
-0.0906982421875,
-0.130126953125,
-0.68212890625,
-0.291015625,
-0.401123046875,
0.1781005859375,
0.08892822265625,
-0.2181396484375,
-0.1956787109375,
0.52587890625,
-0.97607421875,
0.1162109375,
-0.2318115234375,
-0.44482421875,
-0.266845703125,
0.0264129638671875,
0.98583984375,
-0.42138671875,
0.206787109375,
-0.8671875,
0.79443359375,
0.59423828125,
0.034576416015625,
-0.85302734375,
-0.72802734375,
-0.77294921875,
-0.736328125,
0.84130859375,
-0.62939453125,
0.385009765625,
-0.6025390625,
0.18359375,
0.9853515625,
-0.6943359375,
0.221435546875,
0.6865234375,
0.30029296875,
0.248291015625,
-0.7177734375,
0.7392578125,
0.5546875,
-0.318603515625,
-0.42138671875,
-0.03045654296875,
-0.56640625,
0.17578125,
-0.283203125,
-0.986328125,
-1.0673828125,
0.4208984375,
1.30859375,
-0.343505859375,
0.63818359375,
0.27783203125,
-0.89404296875,
-0.6865234375,
0.6416015625,
0.37646484375,
0.497314453125,
1.0732421875,
-0.409423828125,
-0.25390625,
0.127685546875,
0.10565185546875,
-0.2283935546875,
-0.787109375,
0.8408203125,
-0.38818359375,
-0.2320556640625,
0.60205078125,
0.8623046875,
-1.05859375,
-0.4990234375,
-0.5810546875,
-0.26318359375,
-0.1671142578125,
-0.501953125,
-0.005260467529296875,
0.23193359375,
-0.90576171875,
-0.300048828125,
0.33740234375,
-0.1661376953125,
0.45947265625,
-0.2410888671875,
0.4306640625,
-0.428955078125,
0.65771484375,
0.3173828125,
-0.7451171875,
-0.1512451171875,
-0.79248046875,
0.1580810546875,
-0.166015625,
0.2269287109375,
0.73974609375,
-0.453125,
0.13818359375,
0.437744140625,
0.08837890625,
0.41845703125,
-0.277099609375,
-0.37744140625,
0.11468505859375,
-0.7626953125,
-0.74853515625,
-0.136962890625,
0.189208984375,
-0.27099609375,
0.322021484375,
-0.467529296875,
-0.1429443359375,
0.2259521484375,
0.340087890625,
-0.281982421875,
-0.88330078125,
-0.11492919921875,
-0.77490234375,
-0.0374755859375,
-0.83251953125,
-0.796875,
0.380126953125,
0.7138671875,
-0.57568359375,
-0.2196044921875,
0.301513671875,
0.9951171875,
-0.666015625,
0.71826171875,
-0.420166015625,
0.61181640625,
-0.353759765625,
-0.27099609375,
-0.62548828125,
0.0648193359375,
-0.368408203125,
-0.1280517578125,
-0.32080078125,
0.27001953125,
-0.372314453125,
0.513671875,
0.266845703125,
0.271728515625,
0.024200439453125,
-0.41064453125,
-0.1258544921875,
-0.10504150390625,
-0.3544921875,
0.6640625,
0.57275390625,
-0.1231689453125,
-0.02081298828125,
-0.353759765625,
-0.447265625,
-0.2471923828125,
0.7783203125,
0.591796875,
-0.1544189453125,
0.006317138671875,
-0.318359375,
0.17138671875,
-0.96630859375,
0.1971435546875,
-0.470703125,
0.40380859375,
0.3095703125,
-0.187255859375,
0.298095703125,
0.9951171875,
0.0167236328125,
0.381591796875,
0.25341796875,
-0.0189971923828125,
0.50341796875,
0.10546875,
0.0528564453125,
0.353515625,
0.1671142578125,
-0.1668701171875,
-0.296142578125,
0.73876953125,
-0.0187225341796875,
0.292236328125,
-0.1387939453125,
-0.7177734375,
-0.880859375,
-0.0323486328125,
-0.23486328125,
0.259033203125,
0.048614501953125,
-0.56787109375,
0.07586669921875,
-0.30126953125,
-0.28125,
0.410888671875,
-0.91748046875,
-0.87158203125,
0.30908203125,
-0.271240234375,
-0.46826171875,
-0.2025146484375,
-0.5380859375,
-0.058349609375,
0.031280517578125,
0.296875,
-0.41357421875,
0.318115234375,
-0.31787109375,
0.59912109375,
-0.448486328125,
0.1407470703125,
0.0168304443359375,
0.21142578125,
-0.5390625,
-0.3017578125,
-0.0645751953125,
0.9697265625,
-0.01239776611328125,
-0.11492919921875,
-0.654296875,
0.3583984375,
-0.09527587890625,
0.174072265625,
-0.2171630859375,
0.2291259765625,
-0.5185546875,
0.34033203125,
-1.1591796875,
-0.1385498046875,
-0.134033203125,
0.271240234375,
0.3662109375,
-0.5830078125,
-0.4326171875,
0.98388671875,
0.82666015625,
-0.173583984375,
0.3056640625,
0.08074951171875,
0.12890625,
-0.1556396484375,
-0.21923828125,
-0.175537109375,
0.97509765625,
0.82861328125,
0.81298828125,
-0.058837890625,
0.52197265625,
0.64013671875,
-0.1287841796875,
-0.07049560546875,
0.6064453125,
0.24267578125,
-0.328857421875,
0.250732421875,
-0.39501953125,
0.146240234375,
0.112060546875,
-0.84326171875,
0.064697265625,
-0.376220703125,
-0.1287841796875,
-0.1993408203125,
-0.67578125,
0.5986328125,
-0.25439453125,
-0.09088134765625,
-0.126220703125,
-0.55810546875,
0.16015625,
0.63818359375,
0.313720703125,
-0.1527099609375,
0.9580078125,
0.5966796875,
0.284912109375,
0.73046875,
0.12030029296875,
0.1380615234375,
-0.2264404296875,
0.09228515625,
-0.11151123046875,
-0.0178680419921875,
-0.2548828125,
-0.175537109375,
-0.93212890625,
0.392333984375,
0.1256103515625,
-0.364990234375,
0.36767578125,
-0.8544921875,
-0.18505859375,
-0.36181640625,
0.7548828125,
-0.370849609375,
-0.158935546875,
0.375244140625,
-0.7080078125,
-0.7548828125,
0.71923828125,
-0.23095703125,
0.2476806640625,
0.049530029296875,
1.3642578125,
0.2100830078125,
1.095703125,
0.66455078125,
-0.1307373046875,
-0.01885986328125,
0.1905517578125,
-0.48974609375,
-0.421875,
-0.2325439453125,
-0.4755859375,
0.17236328125,
-0.9013671875,
-0.5244140625,
-0.28125,
0.931640625,
-0.09381103515625,
-0.9892578125,
-0.203125,
-0.2237548828125,
-1.0478515625,
0.3330078125,
0.28076171875,
0.59765625,
-0.34814453125,
-0.18115234375,
-0.17822265625,
-0.379638671875,
0.11114501953125,
-0.74267578125,
0.45751953125,
-0.299072265625,
-0.79296875,
-0.248046875,
-0.65087890625,
-0.3056640625,
0.034515380859375,
-0.36669921875,
-0.8779296875,
0.439208984375,
0.595703125,
0.0158538818359375,
0.470458984375,
-0.54541015625,
0.2232666015625,
0.8408203125,
0.9384765625,
0.165283203125,
0.58935546875,
-0.1197509765625,
-0.34423828125,
0.481201171875,
-0.4794921875,
0.55810546875,
-0.08935546875,
0.2064208984375,
-0.30517578125,
0.66064453125,
-0.66162109375,
-1.3125,
0.0701904296875,
0.2491455078125,
0.239013671875,
-0.425048828125,
-0.916015625,
-0.21484375,
-0.984375,
0.095458984375,
-0.30078125,
0.431884765625,
-0.6318359375,
0.21923828125,
-0.1280517578125,
-1.2509765625,
4.59765625,
0.66455078125,
0.95703125,
0.1656494140625,
0.12249755859375,
1.0361328125,
0.439697265625,
-0.403076171875,
-0.0203857421875,
0.02252197265625,
0.386962890625,
-0.62353515625,
0.162841796875,
0.8037109375,
0.16015625,
0.56103515625,
-0.71240234375,
0.35107421875,
0.14892578125,
-0.572265625,
-0.97119140625,
-0.053253173828125,
-0.1348876953125,
0.296142578125,
0.07232666015625,
0.451416015625,
0.267822265625,
-0.54541015625,
-0.1591796875,
-0.6611328125,
0.0207672119140625,
-0.541015625,
0.52685546875,
-0.1922607421875,
-0.1761474609375,
0.82080078125,
-0.2047119140625,
-0.2110595703125,
-0.0006203651428222656,
0.0989990234375,
-0.34912109375,
-0.277099609375,
0.474365234375,
-0.61865234375,
-0.0229034423828125,
0.1551513671875,
-0.93505859375,
0.15185546875,
0.31201171875,
-0.80322265625,
0.970703125,
-0.41552734375,
0.447021484375,
-0.71875,
-0.75390625,
0.2342529296875,
0.27294921875,
-0.33740234375,
-0.53369140625,
0.418701171875,
0.5263671875,
0.2060546875,
0.2374267578125,
0.412841796875,
-0.51513671875,
1.1962890625,
-0.007625579833984375,
0.1793212890625,
-0.43310546875,
-0.1048583984375,
-0.410400390625,
-0.366943359375,
-0.1064453125,
-0.402099609375,
0.89111328125,
0.26708984375,
-0.2330322265625,
0.442138671875,
0.64111328125,
-0.67138671875,
-0.021453857421875,
-0.3623046875,
-0.45556640625,
-0.020355224609375,
0.82275390625,
1.0986328125,
-0.68359375,
-0.3984375,
0.1258544921875,
0.548828125,
0.6875,
0.708984375,
0.291748046875,
-0.65966796875,
-0.1578369140625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Bash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Since he is too young to go out and catch Bulbasaur, he came up with his own way of catching a Bulbasaur.
Each day, he takes the front page of the newspaper. He cuts out the letters one at a time, from anywhere on the front page of the newspaper to form the word "Bulbasaur" (without quotes) and sticks it on his wall. Bash is very particular about case — the first letter of "Bulbasaur" must be upper case and the rest must be lower case. By doing this he thinks he has caught one Bulbasaur. He then repeats this step on the left over part of the newspaper. He keeps doing this until it is not possible to form the word "Bulbasaur" from the newspaper.
Given the text on the front page of the newspaper, can you tell how many Bulbasaurs he will catch today?
Note: uppercase and lowercase letters are considered different.
Input
Input contains a single line containing a string s (1 ≤ |s| ≤ 105) — the text on the front page of the newspaper without spaces and punctuation marks. |s| is the length of the string s.
The string s contains lowercase and uppercase English letters, i.e. <image>.
Output
Output a single integer, the answer to the problem.
Examples
Input
Bulbbasaur
Output
1
Input
F
Output
0
Input
aBddulbasaurrgndgbualdBdsagaurrgndbb
Output
2
Note
In the first case, you could pick: Bulbbasaur.
In the second case, there is no way to pick even a single Bulbasaur.
In the third case, you can rearrange the string to BulbasaurBulbasauraddrgndgddgargndbb to get two words "Bulbasaur".
Tags: implementation
Correct Solution:
```
w="Bulbasaur"
s=input()
ans=10**5+1
chk={}
for i in s:
if i in chk:
chk[i]+=1
else:
chk[i]=1
for i in w:
if i in chk:
ans=min(ans,chk[i]//[1,2][i=='a' or i=='u'])
else:
ans=0
print(ans)
```
| 64,486
|
[
0.0660400390625,
0.1815185546875,
0.07135009765625,
0.09893798828125,
-0.58642578125,
-0.59716796875,
0.107666015625,
-0.1741943359375,
0.59326171875,
0.7451171875,
0.900390625,
-0.2490234375,
0.06298828125,
-0.41064453125,
-0.61669921875,
-0.279052734375,
-0.76611328125,
-0.54248046875,
-0.0045928955078125,
-0.478271484375,
-0.08074951171875,
-0.1265869140625,
-1.0146484375,
-0.156982421875,
-0.1475830078125,
0.75732421875,
0.6142578125,
0.1376953125,
0.86962890625,
0.8623046875,
0.042205810546875,
-0.278564453125,
0.433349609375,
-0.85693359375,
-0.284912109375,
-0.55322265625,
0.64501953125,
-1.1357421875,
-0.09051513671875,
-0.296630859375,
0.413818359375,
-0.267578125,
0.88671875,
-0.794921875,
-1.0380859375,
-0.31982421875,
-0.740234375,
-0.217041015625,
-0.275390625,
-0.62353515625,
0.18408203125,
0.00435638427734375,
0.10736083984375,
-0.239501953125,
0.20703125,
-0.265380859375,
-0.1580810546875,
0.04327392578125,
-0.423583984375,
0.55859375,
0.05743408203125,
0.28857421875,
-0.1417236328125,
-0.41796875,
0.038177490234375,
0.2978515625,
-0.0217132568359375,
-0.447509765625,
0.298583984375,
-0.52734375,
-0.4658203125,
0.4658203125,
-0.322021484375,
-0.52880859375,
-0.255615234375,
0.145751953125,
0.27099609375,
-0.137939453125,
-0.6826171875,
1.1865234375,
0.09088134765625,
0.84814453125,
0.52001953125,
0.1932373046875,
-0.365234375,
-0.55517578125,
0.2188720703125,
0.2587890625,
0.0955810546875,
-0.2291259765625,
-0.323486328125,
0.54638671875,
-0.494873046875,
-0.230712890625,
0.69140625,
0.440185546875,
-0.5927734375,
0.53857421875,
0.2496337890625,
0.08837890625,
0.55322265625,
0.8271484375,
-0.36474609375,
1.076171875,
-0.152099609375,
0.37744140625,
0.10498046875,
0.049774169921875,
-0.499755859375,
-0.36474609375,
-0.364013671875,
-0.142822265625,
0.80322265625,
0.0138092041015625,
-0.36572265625,
0.5712890625,
0.070556640625,
0.6875,
-0.91796875,
0.259033203125,
0.341552734375,
-0.0650634765625,
0.556640625,
-0.4404296875,
-0.11419677734375,
-0.300537109375,
-0.65625,
1.1904296875,
-0.45849609375,
-0.04913330078125,
0.323486328125,
0.1944580078125,
0.007770538330078125,
0.450927734375,
-0.294189453125,
0.72705078125,
-0.537109375,
0.6552734375,
0.5185546875,
-0.66748046875,
0.8564453125,
-0.234375,
0.01136016845703125,
1.3564453125,
0.39404296875,
0.152099609375,
0.37109375,
0.182861328125,
-0.84033203125,
0.6552734375,
-0.9765625,
0.60595703125,
0.060699462890625,
0.2230224609375,
-0.343994140625,
0.72021484375,
-0.374267578125,
0.3603515625,
0.2744140625,
0.133544921875,
-0.2137451171875,
0.52734375,
-0.78759765625,
0.99609375,
0.01464080810546875,
0.962890625,
-0.75830078125,
-0.302490234375,
-0.195556640625,
-0.330322265625,
-0.03900146484375,
-0.08355712890625,
-0.060791015625,
0.9697265625,
0.375244140625,
0.849609375,
0.84814453125,
0.042388916015625,
0.1285400390625,
0.133544921875,
0.0250701904296875,
0.2086181640625,
0.352294921875,
0.90966796875,
0.14453125,
0.2254638671875,
0.09417724609375,
-0.541015625,
-0.9697265625,
-0.40576171875,
0.10455322265625,
0.50439453125,
-0.33251953125,
0.2030029296875,
0.06866455078125,
0.223876953125,
-0.484619140625,
-0.282958984375,
-0.00921630859375,
-0.82275390625,
-0.445068359375,
0.468994140625,
0.05084228515625,
0.70166015625,
0.0848388671875,
-0.958984375,
0.49853515625,
1.1376953125,
-0.1937255859375,
0.035491943359375,
0.04803466796875,
0.1412353515625,
0.00323486328125,
0.062744140625,
0.1357421875,
-0.267333984375,
-0.77783203125,
0.350830078125,
-0.0814208984375,
-0.0199737548828125,
-0.1700439453125,
0.384521484375,
0.417236328125,
0.49072265625,
-0.28662109375,
0.005939483642578125,
0.76904296875,
0.6123046875,
-0.0245513916015625,
0.0975341796875,
0.10089111328125,
0.94189453125,
0.414306640625,
0.7705078125,
0.48779296875,
0.284912109375,
0.390869140625,
0.62060546875,
0.380859375,
0.378173828125,
-0.0489501953125,
0.242431640625,
0.353271484375,
0.482421875,
0.0052947998046875,
0.456298828125,
-0.2093505859375,
0.051910400390625,
-0.73828125,
0.87548828125,
-0.2119140625,
0.65771484375,
0.19775390625,
0.413330078125,
-0.28466796875,
-0.67529296875,
0.322021484375,
0.63427734375,
-0.9619140625,
-0.42626953125,
0.369873046875,
0.245849609375,
0.374755859375,
0.292236328125,
0.02471923828125,
0.335205078125,
0.25830078125,
0.460693359375,
0.029022216796875,
-0.64990234375,
-0.87890625,
-0.6494140625,
-1.1005859375,
-0.41748046875,
-0.623046875,
-0.1832275390625,
0.25244140625,
-1.24609375,
0.615234375,
-0.71826171875,
-0.1580810546875,
0.0709228515625,
-0.5693359375,
0.6435546875,
-0.08837890625,
0.669921875,
-0.398193359375,
0.54833984375,
-0.034759521484375,
0.67138671875,
-0.369873046875,
-0.070068359375,
-0.4208984375,
-0.73388671875,
0.14599609375,
0.059326171875,
0.409423828125,
-0.1766357421875,
-0.43896484375,
-0.62646484375,
-0.256591796875,
-0.1807861328125,
-0.50244140625,
0.1513671875,
-0.55712890625,
0.66064453125,
0.4482421875,
-0.58642578125,
0.474853515625,
1.072265625,
-0.81103515625,
0.475341796875,
0.1767578125,
0.264892578125,
-0.71826171875,
1.33203125,
0.33056640625,
0.446533203125,
-0.428955078125,
-0.59033203125,
-0.498291015625,
0.094970703125,
-0.1505126953125,
-0.259521484375,
-0.685546875,
0.80029296875,
0.07098388671875,
-0.9375,
0.56884765625,
-0.87841796875,
-0.50537109375,
-0.5048828125,
-0.409423828125,
0.60693359375,
0.68115234375,
0.09820556640625,
-0.213134765625,
-0.344482421875,
0.1502685546875,
0.6708984375,
0.56591796875,
-0.81787109375,
-0.1761474609375,
0.443603515625,
0.07440185546875,
0.455078125,
0.11541748046875,
-0.08489990234375,
-0.179443359375,
-0.1630859375,
-0.08062744140625,
0.50830078125,
0.375,
-0.03155517578125,
0.65478515625,
0.43896484375,
-0.88427734375,
-0.19775390625,
-0.2188720703125,
0.7509765625,
0.2310791015625,
0.83984375,
0.76220703125,
-0.07183837890625,
-0.60205078125,
-0.91064453125,
0.380126953125,
0.0140533447265625,
0.5751953125,
-0.93359375,
0.57177734375,
0.292236328125,
-0.3369140625,
0.66259765625,
-0.689453125,
-0.2408447265625,
1.4912109375,
-0.30517578125,
0.472412109375,
-0.38916015625,
1.017578125,
-0.307861328125,
-0.2376708984375,
0.6591796875,
0.4365234375,
0.393310546875,
0.0902099609375,
0.06396484375,
-0.07073974609375,
-0.33349609375,
-0.259521484375,
-0.5830078125,
0.5078125,
-0.302490234375,
-0.45068359375,
-0.60546875,
0.316650390625,
0.54345703125,
0.7138671875,
0.25537109375,
0.9130859375,
-0.1337890625,
0.465087890625,
-0.01302337646484375,
-0.43505859375,
0.045440673828125,
-0.7060546875,
0.76953125,
0.032501220703125,
-0.150146484375,
-0.49755859375,
0.005706787109375,
-0.42724609375,
0.3740234375,
0.220703125,
-0.2978515625,
-1.2021484375,
0.254150390625,
-0.193603515625,
0.7958984375,
-0.380126953125,
-0.1239013671875,
-0.257080078125,
0.294921875,
0.17333984375,
-0.72802734375,
0.347412109375,
-0.5859375,
0.724609375,
0.08551025390625,
0.08514404296875,
-0.486328125,
-0.378662109375,
-0.63916015625,
-0.5615234375,
0.0545654296875,
0.630859375,
0.127197265625,
0.241943359375,
-0.78759765625,
0.3212890625,
0.363525390625,
-0.0238494873046875,
0.1448974609375,
-0.0028533935546875,
0.212890625,
0.282470703125,
0.43896484375,
-0.44384765625,
-0.407958984375,
0.0927734375,
-1.2294921875,
0.67626953125,
-0.379638671875,
-0.009033203125,
-0.354736328125,
0.075927734375,
-0.0194854736328125,
0.2470703125,
-0.28662109375,
-0.0235443115234375,
-0.050933837890625,
0.46435546875,
-1.05078125,
-0.95263671875,
0.30712890625,
-0.181884765625,
-0.55322265625,
0.7060546875,
-0.08868408203125,
-0.43310546875,
0.22900390625,
0.2138671875,
-0.76171875,
0.3486328125,
-0.07891845703125,
0.59619140625,
-0.1995849609375,
-0.427978515625,
0.05120849609375,
-0.2587890625,
0.64404296875,
-0.286376953125,
-0.92626953125,
-0.43408203125,
-1.1142578125,
0.1690673828125,
0.1558837890625,
-0.45849609375,
0.417236328125,
-0.033477783203125,
-0.136474609375,
0.12408447265625,
-0.286376953125,
-0.32958984375,
-0.1412353515625,
-0.492431640625,
-0.3916015625,
0.221923828125,
0.2283935546875,
0.759765625,
-0.35400390625,
-0.29052734375,
-0.063232421875,
0.443603515625,
0.2548828125,
-0.5400390625,
-0.22119140625,
0.01399993896484375,
-0.11273193359375,
-0.172607421875,
0.77734375,
0.1741943359375,
0.40869140625,
0.90380859375,
0.12030029296875,
0.7587890625,
0.751953125,
-0.69677734375,
1.3203125,
-0.0103759765625,
-1.130859375,
-0.50634765625,
0.52294921875,
-0.2471923828125,
0.52880859375,
0.27001953125,
-0.77099609375,
-0.6982421875,
-1.1533203125,
0.09161376953125,
-0.75341796875,
-0.1513671875,
-1.310546875,
-0.2476806640625,
-0.2841796875,
0.60693359375,
-0.1446533203125,
-0.52587890625,
0.65625,
-0.9931640625,
-0.0772705078125,
-0.603515625,
-0.34765625,
-0.552734375,
-0.55810546875,
-0.50537109375,
0.89013671875,
0.1607666015625,
0.339599609375,
0.0215606689453125,
-0.1754150390625,
-0.07513427734375,
-0.09234619140625,
-0.650390625,
-0.33203125,
-0.380615234375,
0.235107421875,
0.0628662109375,
-0.2122802734375,
-0.2044677734375,
0.50146484375,
-0.97705078125,
0.12408447265625,
-0.2509765625,
-0.424072265625,
-0.282470703125,
-0.0017757415771484375,
0.97314453125,
-0.344970703125,
0.2449951171875,
-0.87548828125,
0.7841796875,
0.63427734375,
0.007617950439453125,
-0.8662109375,
-0.70361328125,
-0.75927734375,
-0.703125,
0.88037109375,
-0.630859375,
0.406494140625,
-0.6220703125,
0.158203125,
0.9873046875,
-0.65673828125,
0.272705078125,
0.6904296875,
0.27783203125,
0.287841796875,
-0.69921875,
0.69384765625,
0.53125,
-0.316162109375,
-0.435791015625,
-0.0367431640625,
-0.54052734375,
0.16259765625,
-0.258056640625,
-0.96923828125,
-1.095703125,
0.393310546875,
1.283203125,
-0.31884765625,
0.6201171875,
0.232666015625,
-0.9169921875,
-0.6796875,
0.63134765625,
0.373779296875,
0.54150390625,
1.0703125,
-0.3759765625,
-0.277099609375,
0.11944580078125,
0.058685302734375,
-0.220703125,
-0.83349609375,
0.84619140625,
-0.3798828125,
-0.2117919921875,
0.5830078125,
0.8525390625,
-1.0947265625,
-0.52880859375,
-0.576171875,
-0.29052734375,
-0.166259765625,
-0.5078125,
0.00510406494140625,
0.228515625,
-0.89404296875,
-0.296875,
0.336669921875,
-0.1641845703125,
0.45068359375,
-0.2308349609375,
0.454833984375,
-0.4130859375,
0.66650390625,
0.30517578125,
-0.748046875,
-0.1881103515625,
-0.7958984375,
0.1663818359375,
-0.133544921875,
0.2215576171875,
0.7470703125,
-0.464111328125,
0.1297607421875,
0.4306640625,
0.09033203125,
0.45068359375,
-0.30810546875,
-0.345947265625,
0.10516357421875,
-0.771484375,
-0.76220703125,
-0.1474609375,
0.1573486328125,
-0.2763671875,
0.34033203125,
-0.46826171875,
-0.1566162109375,
0.231201171875,
0.3486328125,
-0.29736328125,
-0.87060546875,
-0.0999755859375,
-0.7724609375,
-0.0357666015625,
-0.81689453125,
-0.78271484375,
0.398681640625,
0.69482421875,
-0.5263671875,
-0.1966552734375,
0.284423828125,
0.9921875,
-0.61376953125,
0.7431640625,
-0.454345703125,
0.62744140625,
-0.33544921875,
-0.31689453125,
-0.59619140625,
0.05975341796875,
-0.40771484375,
-0.11834716796875,
-0.3564453125,
0.302978515625,
-0.378662109375,
0.52783203125,
0.250244140625,
0.26025390625,
0.0159912109375,
-0.414794921875,
-0.07464599609375,
-0.06256103515625,
-0.3896484375,
0.7041015625,
0.54931640625,
-0.12841796875,
-0.0067138671875,
-0.381591796875,
-0.456787109375,
-0.234619140625,
0.79541015625,
0.55322265625,
-0.10626220703125,
0.0016202926635742188,
-0.34619140625,
0.16845703125,
-0.95751953125,
0.2027587890625,
-0.50341796875,
0.398681640625,
0.338134765625,
-0.1900634765625,
0.284423828125,
1.0107421875,
0.0718994140625,
0.381591796875,
0.2462158203125,
-0.0121612548828125,
0.50634765625,
0.137451171875,
-0.0019521713256835938,
0.379638671875,
0.161376953125,
-0.1527099609375,
-0.28369140625,
0.74755859375,
-0.042572021484375,
0.2489013671875,
-0.1275634765625,
-0.728515625,
-0.87451171875,
-0.0311737060546875,
-0.24658203125,
0.27099609375,
0.10089111328125,
-0.587890625,
0.057708740234375,
-0.305419921875,
-0.271484375,
0.416259765625,
-0.958984375,
-0.8583984375,
0.299072265625,
-0.265380859375,
-0.492919921875,
-0.2005615234375,
-0.54443359375,
-0.061798095703125,
0.049774169921875,
0.26220703125,
-0.46875,
0.30712890625,
-0.297119140625,
0.615234375,
-0.45947265625,
0.152587890625,
-0.031951904296875,
0.227294921875,
-0.52587890625,
-0.315673828125,
-0.06866455078125,
0.93359375,
-0.0133056640625,
-0.11749267578125,
-0.671875,
0.365478515625,
-0.051727294921875,
0.178466796875,
-0.268310546875,
0.203857421875,
-0.53955078125,
0.3564453125,
-1.1337890625,
-0.14111328125,
-0.1630859375,
0.2454833984375,
0.3564453125,
-0.6171875,
-0.44873046875,
1.01171875,
0.84130859375,
-0.2108154296875,
0.31005859375,
0.056976318359375,
0.1536865234375,
-0.147216796875,
-0.204833984375,
-0.12646484375,
1.0146484375,
0.82958984375,
0.86328125,
-0.053558349609375,
0.521484375,
0.62890625,
-0.10760498046875,
-0.0380859375,
0.6025390625,
0.2080078125,
-0.33837890625,
0.287109375,
-0.30029296875,
0.167236328125,
0.1273193359375,
-0.8798828125,
0.0950927734375,
-0.44482421875,
-0.1708984375,
-0.2198486328125,
-0.66259765625,
0.625,
-0.2666015625,
-0.0849609375,
-0.11163330078125,
-0.56201171875,
0.1607666015625,
0.59228515625,
0.305419921875,
-0.12432861328125,
0.9443359375,
0.59912109375,
0.297119140625,
0.74853515625,
0.09173583984375,
0.130615234375,
-0.226806640625,
0.06689453125,
-0.0906982421875,
-0.027099609375,
-0.275390625,
-0.2001953125,
-0.90185546875,
0.400634765625,
0.093994140625,
-0.37548828125,
0.383056640625,
-0.89013671875,
-0.202880859375,
-0.38427734375,
0.7705078125,
-0.350341796875,
-0.19189453125,
0.388916015625,
-0.66162109375,
-0.75830078125,
0.767578125,
-0.2247314453125,
0.249755859375,
0.03717041015625,
1.3330078125,
0.194580078125,
1.1279296875,
0.7158203125,
-0.08544921875,
0.00433349609375,
0.2066650390625,
-0.5107421875,
-0.4208984375,
-0.2236328125,
-0.48779296875,
0.1357421875,
-0.9228515625,
-0.5146484375,
-0.344482421875,
0.95849609375,
-0.1005859375,
-1.0419921875,
-0.1966552734375,
-0.212890625,
-1.060546875,
0.333251953125,
0.2958984375,
0.55859375,
-0.3466796875,
-0.18408203125,
-0.17138671875,
-0.30322265625,
0.1461181640625,
-0.70947265625,
0.45751953125,
-0.251708984375,
-0.75439453125,
-0.2430419921875,
-0.638671875,
-0.337646484375,
0.03985595703125,
-0.33740234375,
-0.8662109375,
0.45068359375,
0.576171875,
-0.0197601318359375,
0.463623046875,
-0.54736328125,
0.218505859375,
0.81396484375,
0.92919921875,
0.1754150390625,
0.61328125,
-0.09869384765625,
-0.346435546875,
0.447021484375,
-0.4541015625,
0.5751953125,
-0.10198974609375,
0.205322265625,
-0.328857421875,
0.67822265625,
-0.6591796875,
-1.2626953125,
0.08740234375,
0.2607421875,
0.2220458984375,
-0.42626953125,
-0.9384765625,
-0.206298828125,
-0.99853515625,
0.10540771484375,
-0.318603515625,
0.46923828125,
-0.60400390625,
0.210693359375,
-0.1339111328125,
-1.24609375,
4.58203125,
0.65380859375,
0.94921875,
0.17919921875,
0.1270751953125,
1.0595703125,
0.47607421875,
-0.4580078125,
0.002040863037109375,
0.00540924072265625,
0.366455078125,
-0.638671875,
0.1796875,
0.796875,
0.1622314453125,
0.59375,
-0.75244140625,
0.3740234375,
0.14208984375,
-0.59814453125,
-0.9794921875,
-0.046142578125,
-0.16552734375,
0.295654296875,
0.07342529296875,
0.509765625,
0.261962890625,
-0.58056640625,
-0.1287841796875,
-0.6240234375,
0.043975830078125,
-0.51806640625,
0.54541015625,
-0.212890625,
-0.1456298828125,
0.8330078125,
-0.2069091796875,
-0.2015380859375,
0.0197601318359375,
0.09112548828125,
-0.356689453125,
-0.250732421875,
0.486083984375,
-0.640625,
-0.05072021484375,
0.1614990234375,
-0.93603515625,
0.098876953125,
0.290283203125,
-0.79736328125,
1.00390625,
-0.36865234375,
0.460205078125,
-0.71728515625,
-0.74072265625,
0.2052001953125,
0.2587890625,
-0.2998046875,
-0.485107421875,
0.41259765625,
0.53076171875,
0.218505859375,
0.24169921875,
0.434326171875,
-0.498046875,
1.205078125,
-0.03399658203125,
0.1463623046875,
-0.3994140625,
-0.09954833984375,
-0.4091796875,
-0.41455078125,
-0.110107421875,
-0.421875,
0.9208984375,
0.2359619140625,
-0.28466796875,
0.427978515625,
0.6953125,
-0.72509765625,
-0.0408935546875,
-0.3818359375,
-0.43701171875,
-0.0197601318359375,
0.83251953125,
1.078125,
-0.7021484375,
-0.42333984375,
0.1468505859375,
0.53173828125,
0.68408203125,
0.7373046875,
0.239013671875,
-0.654296875,
-0.1546630859375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Bash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Since he is too young to go out and catch Bulbasaur, he came up with his own way of catching a Bulbasaur.
Each day, he takes the front page of the newspaper. He cuts out the letters one at a time, from anywhere on the front page of the newspaper to form the word "Bulbasaur" (without quotes) and sticks it on his wall. Bash is very particular about case — the first letter of "Bulbasaur" must be upper case and the rest must be lower case. By doing this he thinks he has caught one Bulbasaur. He then repeats this step on the left over part of the newspaper. He keeps doing this until it is not possible to form the word "Bulbasaur" from the newspaper.
Given the text on the front page of the newspaper, can you tell how many Bulbasaurs he will catch today?
Note: uppercase and lowercase letters are considered different.
Input
Input contains a single line containing a string s (1 ≤ |s| ≤ 105) — the text on the front page of the newspaper without spaces and punctuation marks. |s| is the length of the string s.
The string s contains lowercase and uppercase English letters, i.e. <image>.
Output
Output a single integer, the answer to the problem.
Examples
Input
Bulbbasaur
Output
1
Input
F
Output
0
Input
aBddulbasaurrgndgbualdBdsagaurrgndbb
Output
2
Note
In the first case, you could pick: Bulbbasaur.
In the second case, there is no way to pick even a single Bulbasaur.
In the third case, you can rearrange the string to BulbasaurBulbasauraddrgndgddgargndbb to get two words "Bulbasaur".
Tags: implementation
Correct Solution:
```
ans = 0
used = [0] * 256
a = [0] * 256
q = 'Bulbasaur'
for elem in q:
a[ord(elem)] += 1
s = input()
for elem in s:
used[ord(elem)] += 1
ans = 98148914891413
for i in range(256):
if (a[i] != 0):
ans = min(ans, used[i] // a[i])
print(ans)
```
| 64,487
|
[
0.07354736328125,
0.185546875,
0.091796875,
0.11260986328125,
-0.6064453125,
-0.5947265625,
0.1119384765625,
-0.17919921875,
0.6005859375,
0.75146484375,
0.892578125,
-0.253173828125,
0.06402587890625,
-0.427734375,
-0.61962890625,
-0.282470703125,
-0.7451171875,
-0.5380859375,
0.024017333984375,
-0.47705078125,
-0.07159423828125,
-0.12261962890625,
-1.025390625,
-0.151611328125,
-0.1484375,
0.7265625,
0.61669921875,
0.120361328125,
0.8623046875,
0.857421875,
0.053009033203125,
-0.258544921875,
0.436279296875,
-0.84375,
-0.284423828125,
-0.55322265625,
0.64453125,
-1.134765625,
-0.08612060546875,
-0.29443359375,
0.409912109375,
-0.26953125,
0.875,
-0.8115234375,
-1.044921875,
-0.320556640625,
-0.7294921875,
-0.2080078125,
-0.291259765625,
-0.6181640625,
0.1822509765625,
0.0157318115234375,
0.11505126953125,
-0.2493896484375,
0.20068359375,
-0.27734375,
-0.1473388671875,
0.038848876953125,
-0.432373046875,
0.54638671875,
0.044708251953125,
0.276611328125,
-0.1527099609375,
-0.397216796875,
0.05517578125,
0.305419921875,
-0.027984619140625,
-0.432373046875,
0.298095703125,
-0.513671875,
-0.4892578125,
0.4560546875,
-0.340576171875,
-0.53125,
-0.2470703125,
0.1431884765625,
0.2646484375,
-0.1351318359375,
-0.68701171875,
1.171875,
0.09271240234375,
0.83740234375,
0.5185546875,
0.1629638671875,
-0.33642578125,
-0.55078125,
0.23828125,
0.234130859375,
0.09368896484375,
-0.2127685546875,
-0.3271484375,
0.5341796875,
-0.48193359375,
-0.2178955078125,
0.68408203125,
0.444091796875,
-0.615234375,
0.5458984375,
0.271240234375,
0.0709228515625,
0.546875,
0.84423828125,
-0.37646484375,
1.0751953125,
-0.130615234375,
0.3916015625,
0.11346435546875,
0.06536865234375,
-0.491943359375,
-0.364990234375,
-0.372802734375,
-0.156982421875,
0.7822265625,
0.006000518798828125,
-0.35986328125,
0.556640625,
0.054718017578125,
0.68017578125,
-0.9169921875,
0.23779296875,
0.327880859375,
-0.0809326171875,
0.56005859375,
-0.450439453125,
-0.099609375,
-0.311767578125,
-0.65185546875,
1.1796875,
-0.490478515625,
-0.0650634765625,
0.311767578125,
0.19482421875,
-0.0292510986328125,
0.465087890625,
-0.3095703125,
0.720703125,
-0.53271484375,
0.63232421875,
0.52490234375,
-0.65625,
0.85595703125,
-0.2364501953125,
0.02911376953125,
1.369140625,
0.382568359375,
0.144287109375,
0.376708984375,
0.1956787109375,
-0.8544921875,
0.6611328125,
-0.98974609375,
0.5869140625,
0.06744384765625,
0.25341796875,
-0.34716796875,
0.74560546875,
-0.362060546875,
0.36279296875,
0.272216796875,
0.14306640625,
-0.2119140625,
0.5419921875,
-0.79541015625,
0.9931640625,
0.01654052734375,
0.9736328125,
-0.7763671875,
-0.306884765625,
-0.1795654296875,
-0.3173828125,
-0.041900634765625,
-0.06878662109375,
-0.043914794921875,
0.96337890625,
0.381103515625,
0.8662109375,
0.84765625,
0.056884765625,
0.1239013671875,
0.1556396484375,
0.0367431640625,
0.1968994140625,
0.37451171875,
0.93115234375,
0.162109375,
0.2337646484375,
0.08184814453125,
-0.548828125,
-0.96435546875,
-0.39501953125,
0.11676025390625,
0.51953125,
-0.32666015625,
0.208984375,
0.0423583984375,
0.2271728515625,
-0.490478515625,
-0.2890625,
-0.0009260177612304688,
-0.81591796875,
-0.439697265625,
0.475341796875,
0.06640625,
0.7158203125,
0.0797119140625,
-0.94384765625,
0.4912109375,
1.1337890625,
-0.196044921875,
0.03900146484375,
0.060211181640625,
0.154296875,
0.005828857421875,
0.04705810546875,
0.12408447265625,
-0.258544921875,
-0.7724609375,
0.3701171875,
-0.08447265625,
-0.0139617919921875,
-0.2086181640625,
0.38330078125,
0.403564453125,
0.492919921875,
-0.295166015625,
-0.0027027130126953125,
0.7861328125,
0.62646484375,
-0.020751953125,
0.10833740234375,
0.08740234375,
0.94091796875,
0.3994140625,
0.7763671875,
0.4970703125,
0.267822265625,
0.386962890625,
0.6142578125,
0.356689453125,
0.385498046875,
-0.07586669921875,
0.263427734375,
0.337646484375,
0.463623046875,
-0.006031036376953125,
0.458984375,
-0.218505859375,
0.051513671875,
-0.74462890625,
0.8837890625,
-0.21240234375,
0.65771484375,
0.18359375,
0.41064453125,
-0.2900390625,
-0.6962890625,
0.33740234375,
0.63623046875,
-0.9453125,
-0.44189453125,
0.392822265625,
0.2431640625,
0.388671875,
0.302001953125,
0.0321044921875,
0.326904296875,
0.2666015625,
0.475341796875,
0.03271484375,
-0.63232421875,
-0.86767578125,
-0.65673828125,
-1.107421875,
-0.410888671875,
-0.599609375,
-0.181396484375,
0.2451171875,
-1.2255859375,
0.6083984375,
-0.71826171875,
-0.1517333984375,
0.083740234375,
-0.56103515625,
0.64208984375,
-0.07977294921875,
0.65576171875,
-0.421875,
0.5390625,
-0.047882080078125,
0.68359375,
-0.3896484375,
-0.050079345703125,
-0.395263671875,
-0.71435546875,
0.154052734375,
0.0723876953125,
0.392333984375,
-0.1685791015625,
-0.40283203125,
-0.62353515625,
-0.2578125,
-0.170654296875,
-0.489501953125,
0.1407470703125,
-0.55712890625,
0.69189453125,
0.466552734375,
-0.59130859375,
0.47998046875,
1.048828125,
-0.79052734375,
0.46240234375,
0.18896484375,
0.275146484375,
-0.7255859375,
1.328125,
0.32861328125,
0.43359375,
-0.424072265625,
-0.6005859375,
-0.5078125,
0.09234619140625,
-0.17529296875,
-0.2459716796875,
-0.69921875,
0.828125,
0.07122802734375,
-0.921875,
0.55322265625,
-0.88232421875,
-0.51416015625,
-0.50146484375,
-0.4326171875,
0.6123046875,
0.66845703125,
0.08282470703125,
-0.2412109375,
-0.3447265625,
0.144287109375,
0.634765625,
0.5751953125,
-0.8408203125,
-0.20751953125,
0.448974609375,
0.103515625,
0.463623046875,
0.1365966796875,
-0.11346435546875,
-0.1893310546875,
-0.1593017578125,
-0.10784912109375,
0.513671875,
0.37548828125,
-0.02911376953125,
0.64453125,
0.440185546875,
-0.86376953125,
-0.2144775390625,
-0.2236328125,
0.7451171875,
0.2294921875,
0.83544921875,
0.7568359375,
-0.076416015625,
-0.59814453125,
-0.90283203125,
0.3486328125,
0.02313232421875,
0.57470703125,
-0.9580078125,
0.556640625,
0.3232421875,
-0.34326171875,
0.67431640625,
-0.68359375,
-0.25048828125,
1.4814453125,
-0.317626953125,
0.478759765625,
-0.404296875,
0.99755859375,
-0.3134765625,
-0.235595703125,
0.6611328125,
0.4423828125,
0.41357421875,
0.09930419921875,
0.049468994140625,
-0.07659912109375,
-0.32470703125,
-0.25732421875,
-0.548828125,
0.494873046875,
-0.318115234375,
-0.46875,
-0.60986328125,
0.322998046875,
0.55078125,
0.73388671875,
0.26708984375,
0.927734375,
-0.14013671875,
0.456787109375,
-0.000392913818359375,
-0.43701171875,
0.04376220703125,
-0.724609375,
0.7734375,
0.047576904296875,
-0.1597900390625,
-0.4765625,
0.017364501953125,
-0.42724609375,
0.34814453125,
0.2225341796875,
-0.302734375,
-1.201171875,
0.2359619140625,
-0.1849365234375,
0.8037109375,
-0.351806640625,
-0.1280517578125,
-0.260498046875,
0.31689453125,
0.1710205078125,
-0.74609375,
0.3505859375,
-0.57958984375,
0.70703125,
0.09295654296875,
0.1068115234375,
-0.4736328125,
-0.37646484375,
-0.6435546875,
-0.5595703125,
0.0640869140625,
0.61181640625,
0.1324462890625,
0.2353515625,
-0.78564453125,
0.333740234375,
0.359375,
-0.037628173828125,
0.1575927734375,
0.03173828125,
0.2156982421875,
0.271484375,
0.44140625,
-0.4287109375,
-0.39501953125,
0.100830078125,
-1.22265625,
0.68359375,
-0.384033203125,
-0.0174560546875,
-0.3623046875,
0.07586669921875,
-0.030670166015625,
0.2498779296875,
-0.277587890625,
-0.0299835205078125,
-0.07220458984375,
0.473876953125,
-1.0419921875,
-0.95849609375,
0.304443359375,
-0.2076416015625,
-0.55322265625,
0.71533203125,
-0.107177734375,
-0.438232421875,
0.23681640625,
0.1953125,
-0.75146484375,
0.366455078125,
-0.071044921875,
0.6123046875,
-0.2015380859375,
-0.42626953125,
0.075439453125,
-0.2415771484375,
0.64111328125,
-0.264892578125,
-0.9228515625,
-0.416259765625,
-1.107421875,
0.164794921875,
0.1500244140625,
-0.476806640625,
0.4169921875,
-0.02764892578125,
-0.163818359375,
0.12432861328125,
-0.2802734375,
-0.343994140625,
-0.117431640625,
-0.4951171875,
-0.40625,
0.253662109375,
0.232421875,
0.7509765625,
-0.356201171875,
-0.29443359375,
-0.058563232421875,
0.43798828125,
0.2452392578125,
-0.5537109375,
-0.2177734375,
-0.007061004638671875,
-0.1102294921875,
-0.192138671875,
0.791015625,
0.190185546875,
0.414306640625,
0.90283203125,
0.09820556640625,
0.7685546875,
0.7490234375,
-0.70947265625,
1.326171875,
0.0007228851318359375,
-1.13671875,
-0.48583984375,
0.5107421875,
-0.241455078125,
0.51123046875,
0.278076171875,
-0.732421875,
-0.6904296875,
-1.1630859375,
0.1136474609375,
-0.73583984375,
-0.148681640625,
-1.3212890625,
-0.26025390625,
-0.28271484375,
0.60498046875,
-0.149658203125,
-0.5205078125,
0.64794921875,
-1.005859375,
-0.07537841796875,
-0.58740234375,
-0.33154296875,
-0.5498046875,
-0.56494140625,
-0.5078125,
0.876953125,
0.1376953125,
0.314697265625,
0.037139892578125,
-0.1534423828125,
-0.08807373046875,
-0.048004150390625,
-0.677734375,
-0.327392578125,
-0.371337890625,
0.2100830078125,
0.050872802734375,
-0.21044921875,
-0.2130126953125,
0.491455078125,
-0.97705078125,
0.12646484375,
-0.2325439453125,
-0.456787109375,
-0.279296875,
0.0200958251953125,
0.9873046875,
-0.361083984375,
0.265625,
-0.87255859375,
0.77490234375,
0.630859375,
0.037139892578125,
-0.8564453125,
-0.7119140625,
-0.75634765625,
-0.71875,
0.8603515625,
-0.61767578125,
0.410888671875,
-0.6083984375,
0.1641845703125,
0.98388671875,
-0.677734375,
0.25927734375,
0.69970703125,
0.303955078125,
0.3095703125,
-0.69482421875,
0.68798828125,
0.5380859375,
-0.337158203125,
-0.449462890625,
-0.043701171875,
-0.55419921875,
0.1573486328125,
-0.26025390625,
-0.98046875,
-1.0966796875,
0.4013671875,
1.287109375,
-0.304443359375,
0.62158203125,
0.2320556640625,
-0.91796875,
-0.6748046875,
0.63623046875,
0.349365234375,
0.54833984375,
1.07421875,
-0.401123046875,
-0.26611328125,
0.112548828125,
0.0709228515625,
-0.2127685546875,
-0.8349609375,
0.8544921875,
-0.391845703125,
-0.2257080078125,
0.5927734375,
0.83984375,
-1.1044921875,
-0.55029296875,
-0.59130859375,
-0.266357421875,
-0.16015625,
-0.5048828125,
0.0016832351684570312,
0.2403564453125,
-0.8974609375,
-0.303466796875,
0.3271484375,
-0.1475830078125,
0.446044921875,
-0.2352294921875,
0.454833984375,
-0.402099609375,
0.6728515625,
0.330078125,
-0.72412109375,
-0.2039794921875,
-0.80419921875,
0.1717529296875,
-0.1270751953125,
0.2237548828125,
0.7255859375,
-0.453369140625,
0.1256103515625,
0.43505859375,
0.114501953125,
0.474609375,
-0.308349609375,
-0.359375,
0.126708984375,
-0.7666015625,
-0.77197265625,
-0.1492919921875,
0.16357421875,
-0.294189453125,
0.3623046875,
-0.4697265625,
-0.13916015625,
0.2479248046875,
0.361328125,
-0.2861328125,
-0.876953125,
-0.10601806640625,
-0.783203125,
-0.05279541015625,
-0.81005859375,
-0.80029296875,
0.388427734375,
0.70654296875,
-0.5478515625,
-0.2061767578125,
0.2822265625,
0.98095703125,
-0.63427734375,
0.7216796875,
-0.469482421875,
0.6123046875,
-0.311279296875,
-0.294677734375,
-0.62255859375,
0.059356689453125,
-0.405029296875,
-0.120361328125,
-0.340087890625,
0.29541015625,
-0.370849609375,
0.517578125,
0.2626953125,
0.261962890625,
0.006275177001953125,
-0.410400390625,
-0.0941162109375,
-0.07470703125,
-0.379638671875,
0.6826171875,
0.55712890625,
-0.11962890625,
-0.0015096664428710938,
-0.384765625,
-0.430908203125,
-0.23291015625,
0.794921875,
0.56884765625,
-0.1070556640625,
-0.001171112060546875,
-0.362060546875,
0.197265625,
-0.96630859375,
0.21875,
-0.5166015625,
0.3984375,
0.35693359375,
-0.17578125,
0.284912109375,
1.0263671875,
0.06744384765625,
0.38427734375,
0.268310546875,
-0.017181396484375,
0.4970703125,
0.14111328125,
0.0032215118408203125,
0.374755859375,
0.170166015625,
-0.177734375,
-0.289794921875,
0.7294921875,
-0.049163818359375,
0.261962890625,
-0.1177978515625,
-0.705078125,
-0.87939453125,
-0.0308837890625,
-0.250244140625,
0.275146484375,
0.09912109375,
-0.58251953125,
0.0531005859375,
-0.302978515625,
-0.270263671875,
0.414306640625,
-0.97802734375,
-0.88330078125,
0.30322265625,
-0.277587890625,
-0.48974609375,
-0.2034912109375,
-0.546875,
-0.05316162109375,
0.049468994140625,
0.248779296875,
-0.45849609375,
0.2939453125,
-0.319580078125,
0.6142578125,
-0.4365234375,
0.1358642578125,
-0.0280303955078125,
0.245849609375,
-0.53955078125,
-0.312255859375,
-0.10186767578125,
0.947265625,
-0.0011644363403320312,
-0.1180419921875,
-0.66259765625,
0.35791015625,
-0.0628662109375,
0.18017578125,
-0.264404296875,
0.201416015625,
-0.5361328125,
0.364501953125,
-1.1435546875,
-0.12939453125,
-0.1510009765625,
0.254638671875,
0.365234375,
-0.59423828125,
-0.46240234375,
1.0107421875,
0.85546875,
-0.194091796875,
0.310302734375,
0.07098388671875,
0.1640625,
-0.158447265625,
-0.1986083984375,
-0.137939453125,
1.0234375,
0.83349609375,
0.85693359375,
-0.0528564453125,
0.52685546875,
0.6220703125,
-0.12359619140625,
-0.046875,
0.60888671875,
0.20361328125,
-0.3466796875,
0.293212890625,
-0.325439453125,
0.168212890625,
0.11029052734375,
-0.876953125,
0.1026611328125,
-0.439453125,
-0.1788330078125,
-0.2071533203125,
-0.66943359375,
0.61767578125,
-0.27783203125,
-0.06903076171875,
-0.1278076171875,
-0.56640625,
0.16259765625,
0.57568359375,
0.30712890625,
-0.1409912109375,
0.9677734375,
0.60009765625,
0.29541015625,
0.76513671875,
0.0897216796875,
0.12841796875,
-0.223388671875,
0.087890625,
-0.10064697265625,
-0.01514434814453125,
-0.256103515625,
-0.2197265625,
-0.921875,
0.388427734375,
0.09765625,
-0.39697265625,
0.371826171875,
-0.87060546875,
-0.2060546875,
-0.369873046875,
0.810546875,
-0.359375,
-0.1842041015625,
0.380126953125,
-0.65478515625,
-0.7666015625,
0.7451171875,
-0.25,
0.224365234375,
0.054229736328125,
1.3427734375,
0.2181396484375,
1.1162109375,
0.703125,
-0.0660400390625,
0.0219268798828125,
0.2059326171875,
-0.5224609375,
-0.4052734375,
-0.2154541015625,
-0.485595703125,
0.1466064453125,
-0.91650390625,
-0.5166015625,
-0.35400390625,
0.96240234375,
-0.10638427734375,
-1.0244140625,
-0.190185546875,
-0.2130126953125,
-1.0634765625,
0.33251953125,
0.296875,
0.56103515625,
-0.33935546875,
-0.1864013671875,
-0.187744140625,
-0.342041015625,
0.12420654296875,
-0.6953125,
0.451416015625,
-0.24658203125,
-0.759765625,
-0.25927734375,
-0.61767578125,
-0.360595703125,
0.038665771484375,
-0.345703125,
-0.84716796875,
0.448486328125,
0.58203125,
-0.01425933837890625,
0.4873046875,
-0.533203125,
0.220947265625,
0.80908203125,
0.9384765625,
0.16552734375,
0.611328125,
-0.11627197265625,
-0.330078125,
0.435302734375,
-0.460205078125,
0.56298828125,
-0.10467529296875,
0.215576171875,
-0.346435546875,
0.6708984375,
-0.67626953125,
-1.259765625,
0.070556640625,
0.2391357421875,
0.226806640625,
-0.429931640625,
-0.9150390625,
-0.2178955078125,
-1.0068359375,
0.09210205078125,
-0.323974609375,
0.46484375,
-0.6123046875,
0.2144775390625,
-0.1343994140625,
-1.2314453125,
4.578125,
0.65576171875,
0.955078125,
0.172119140625,
0.10675048828125,
1.0830078125,
0.476318359375,
-0.465576171875,
-0.0010509490966796875,
-0.01861572265625,
0.35693359375,
-0.611328125,
0.1666259765625,
0.8017578125,
0.16552734375,
0.59765625,
-0.73828125,
0.3759765625,
0.13330078125,
-0.59033203125,
-0.9609375,
-0.04229736328125,
-0.1605224609375,
0.279296875,
0.058074951171875,
0.513671875,
0.280517578125,
-0.58447265625,
-0.1429443359375,
-0.63427734375,
0.0247650146484375,
-0.50244140625,
0.53662109375,
-0.21533203125,
-0.141845703125,
0.8349609375,
-0.1939697265625,
-0.199951171875,
0.002696990966796875,
0.08636474609375,
-0.33984375,
-0.235595703125,
0.454345703125,
-0.64892578125,
-0.073486328125,
0.14599609375,
-0.93798828125,
0.1058349609375,
0.277587890625,
-0.8056640625,
1,
-0.383544921875,
0.445556640625,
-0.71533203125,
-0.7578125,
0.219970703125,
0.26708984375,
-0.313720703125,
-0.484130859375,
0.4111328125,
0.52880859375,
0.240234375,
0.2244873046875,
0.445068359375,
-0.482421875,
1.2177734375,
-0.0167694091796875,
0.12005615234375,
-0.4150390625,
-0.086669921875,
-0.41845703125,
-0.412841796875,
-0.11932373046875,
-0.419921875,
0.93896484375,
0.2471923828125,
-0.27783203125,
0.427978515625,
0.67919921875,
-0.71826171875,
-0.020782470703125,
-0.385009765625,
-0.440673828125,
-0.0231475830078125,
0.82080078125,
1.0888671875,
-0.67919921875,
-0.42724609375,
0.15380859375,
0.53173828125,
0.66357421875,
0.74853515625,
0.246826171875,
-0.65625,
-0.15283203125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Bash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Since he is too young to go out and catch Bulbasaur, he came up with his own way of catching a Bulbasaur.
Each day, he takes the front page of the newspaper. He cuts out the letters one at a time, from anywhere on the front page of the newspaper to form the word "Bulbasaur" (without quotes) and sticks it on his wall. Bash is very particular about case — the first letter of "Bulbasaur" must be upper case and the rest must be lower case. By doing this he thinks he has caught one Bulbasaur. He then repeats this step on the left over part of the newspaper. He keeps doing this until it is not possible to form the word "Bulbasaur" from the newspaper.
Given the text on the front page of the newspaper, can you tell how many Bulbasaurs he will catch today?
Note: uppercase and lowercase letters are considered different.
Input
Input contains a single line containing a string s (1 ≤ |s| ≤ 105) — the text on the front page of the newspaper without spaces and punctuation marks. |s| is the length of the string s.
The string s contains lowercase and uppercase English letters, i.e. <image>.
Output
Output a single integer, the answer to the problem.
Examples
Input
Bulbbasaur
Output
1
Input
F
Output
0
Input
aBddulbasaurrgndgbualdBdsagaurrgndbb
Output
2
Note
In the first case, you could pick: Bulbbasaur.
In the second case, there is no way to pick even a single Bulbasaur.
In the third case, you can rearrange the string to BulbasaurBulbasauraddrgndgddgargndbb to get two words "Bulbasaur".
Tags: implementation
Correct Solution:
```
letters = set('Bulbasaur')#
string = input()
counts = []
for i in letters:
if i in ['a', 'u']:
counts.append(string.count(i)//2)
else:
counts.append(string.count(i))
print(min(counts))
```
| 64,488
|
[
0.04541015625,
0.1610107421875,
0.093505859375,
0.11376953125,
-0.587890625,
-0.63037109375,
0.09747314453125,
-0.1859130859375,
0.58740234375,
0.76513671875,
0.87451171875,
-0.2330322265625,
0.0809326171875,
-0.38818359375,
-0.60595703125,
-0.28466796875,
-0.8076171875,
-0.54052734375,
-0.01486968994140625,
-0.4716796875,
-0.10614013671875,
-0.10870361328125,
-1.02734375,
-0.1802978515625,
-0.1514892578125,
0.759765625,
0.607421875,
0.12353515625,
0.8388671875,
0.8740234375,
0.09588623046875,
-0.280029296875,
0.431640625,
-0.86181640625,
-0.300048828125,
-0.57275390625,
0.6513671875,
-1.1533203125,
-0.07244873046875,
-0.32958984375,
0.4228515625,
-0.306884765625,
0.91650390625,
-0.83251953125,
-1.068359375,
-0.309326171875,
-0.697265625,
-0.251220703125,
-0.268310546875,
-0.5849609375,
0.1484375,
-0.03564453125,
0.12335205078125,
-0.2470703125,
0.202880859375,
-0.278076171875,
-0.1484375,
0.072265625,
-0.390869140625,
0.54638671875,
0.07940673828125,
0.297607421875,
-0.15478515625,
-0.36376953125,
0.03826904296875,
0.2958984375,
-0.0213775634765625,
-0.486328125,
0.287109375,
-0.54833984375,
-0.465087890625,
0.4072265625,
-0.303466796875,
-0.5361328125,
-0.279052734375,
0.16455078125,
0.284423828125,
-0.1761474609375,
-0.70654296875,
1.18359375,
0.08349609375,
0.87353515625,
0.517578125,
0.2548828125,
-0.353759765625,
-0.5380859375,
0.241455078125,
0.22119140625,
0.08251953125,
-0.226318359375,
-0.29638671875,
0.5263671875,
-0.54150390625,
-0.234375,
0.666015625,
0.486083984375,
-0.6357421875,
0.513671875,
0.306396484375,
0.09661865234375,
0.578125,
0.83935546875,
-0.41259765625,
1.099609375,
-0.1534423828125,
0.385498046875,
0.11834716796875,
0.0518798828125,
-0.49658203125,
-0.375732421875,
-0.36572265625,
-0.13134765625,
0.75830078125,
0.058380126953125,
-0.34619140625,
0.57373046875,
0.07257080078125,
0.666015625,
-0.9658203125,
0.25390625,
0.3212890625,
-0.0540771484375,
0.61181640625,
-0.462646484375,
-0.1439208984375,
-0.263916015625,
-0.68603515625,
1.21484375,
-0.469482421875,
-0.041595458984375,
0.323486328125,
0.2413330078125,
0.0281524658203125,
0.46484375,
-0.34814453125,
0.69091796875,
-0.55517578125,
0.65673828125,
0.5234375,
-0.68115234375,
0.8408203125,
-0.2010498046875,
-0.0322265625,
1.3916015625,
0.387451171875,
0.2115478515625,
0.3671875,
0.1754150390625,
-0.84033203125,
0.66796875,
-1.001953125,
0.61279296875,
0.074951171875,
0.2362060546875,
-0.35498046875,
0.724609375,
-0.336669921875,
0.363525390625,
0.263671875,
0.1041259765625,
-0.193359375,
0.56103515625,
-0.7587890625,
1.0068359375,
0.036865234375,
0.9951171875,
-0.8095703125,
-0.307373046875,
-0.17919921875,
-0.29931640625,
-0.032196044921875,
-0.1060791015625,
-0.06256103515625,
0.97998046875,
0.44287109375,
0.7978515625,
0.83544921875,
0.0044097900390625,
0.1474609375,
0.1275634765625,
0.032928466796875,
0.22412109375,
0.29931640625,
0.90771484375,
0.1695556640625,
0.26220703125,
0.1019287109375,
-0.61328125,
-0.95068359375,
-0.428466796875,
0.09991455078125,
0.50537109375,
-0.343994140625,
0.210693359375,
0.0751953125,
0.259765625,
-0.51904296875,
-0.26416015625,
-0.0107421875,
-0.83544921875,
-0.42919921875,
0.477294921875,
0.052215576171875,
0.68408203125,
0.06646728515625,
-0.916015625,
0.4931640625,
1.1064453125,
-0.2083740234375,
0.07855224609375,
0.0823974609375,
0.1064453125,
0.0041961669921875,
0.09368896484375,
0.102294921875,
-0.2421875,
-0.7783203125,
0.336669921875,
-0.100830078125,
-0.0205535888671875,
-0.2010498046875,
0.37451171875,
0.41552734375,
0.484375,
-0.27197265625,
-0.03515625,
0.76708984375,
0.57177734375,
-0.06280517578125,
0.12744140625,
0.0794677734375,
0.97607421875,
0.43017578125,
0.80810546875,
0.476318359375,
0.293212890625,
0.435546875,
0.58984375,
0.381591796875,
0.360595703125,
-0.08795166015625,
0.29638671875,
0.3583984375,
0.475830078125,
0.00995635986328125,
0.452880859375,
-0.279052734375,
0.0278778076171875,
-0.779296875,
0.916015625,
-0.213134765625,
0.65625,
0.222900390625,
0.39794921875,
-0.266845703125,
-0.70361328125,
0.335693359375,
0.65283203125,
-0.93896484375,
-0.412841796875,
0.39794921875,
0.248046875,
0.383056640625,
0.277099609375,
0.0126495361328125,
0.340087890625,
0.290283203125,
0.4423828125,
0.0195770263671875,
-0.6259765625,
-0.88916015625,
-0.658203125,
-1.0791015625,
-0.440673828125,
-0.6513671875,
-0.16943359375,
0.294677734375,
-1.2138671875,
0.5634765625,
-0.68798828125,
-0.1810302734375,
0.10845947265625,
-0.5595703125,
0.67236328125,
-0.10565185546875,
0.7099609375,
-0.35888671875,
0.51220703125,
-0.09283447265625,
0.67529296875,
-0.40673828125,
-0.0762939453125,
-0.45068359375,
-0.6845703125,
0.1619873046875,
0.1148681640625,
0.458740234375,
-0.2161865234375,
-0.40087890625,
-0.62744140625,
-0.295654296875,
-0.174072265625,
-0.53271484375,
0.151611328125,
-0.5556640625,
0.70703125,
0.4365234375,
-0.63525390625,
0.50244140625,
1.0888671875,
-0.802734375,
0.48681640625,
0.1767578125,
0.29345703125,
-0.70751953125,
1.3359375,
0.323974609375,
0.45751953125,
-0.42724609375,
-0.568359375,
-0.51416015625,
0.1138916015625,
-0.165283203125,
-0.267822265625,
-0.654296875,
0.8076171875,
0.053253173828125,
-0.97900390625,
0.58642578125,
-0.8642578125,
-0.491943359375,
-0.53515625,
-0.4453125,
0.57275390625,
0.6904296875,
0.06488037109375,
-0.1944580078125,
-0.35009765625,
0.0821533203125,
0.66845703125,
0.55859375,
-0.83203125,
-0.17578125,
0.485595703125,
0.07891845703125,
0.505859375,
0.11151123046875,
-0.0855712890625,
-0.18212890625,
-0.17236328125,
-0.1334228515625,
0.52001953125,
0.37646484375,
-0.0133819580078125,
0.63037109375,
0.416015625,
-0.87744140625,
-0.18115234375,
-0.206298828125,
0.75537109375,
0.2000732421875,
0.8095703125,
0.75537109375,
-0.04205322265625,
-0.64453125,
-0.96533203125,
0.389404296875,
-0.016845703125,
0.580078125,
-0.97412109375,
0.58154296875,
0.297119140625,
-0.284912109375,
0.669921875,
-0.70556640625,
-0.291748046875,
1.48046875,
-0.335693359375,
0.5107421875,
-0.348876953125,
0.9892578125,
-0.34130859375,
-0.25537109375,
0.650390625,
0.4638671875,
0.392578125,
0.0789794921875,
0.0955810546875,
-0.0885009765625,
-0.335693359375,
-0.2469482421875,
-0.556640625,
0.5009765625,
-0.330322265625,
-0.4658203125,
-0.603515625,
0.320556640625,
0.568359375,
0.734375,
0.27099609375,
0.8935546875,
-0.12066650390625,
0.402587890625,
0.01558685302734375,
-0.431640625,
0.07318115234375,
-0.7060546875,
0.7802734375,
0.06903076171875,
-0.20556640625,
-0.52197265625,
0.004985809326171875,
-0.43212890625,
0.320556640625,
0.263427734375,
-0.2313232421875,
-1.208984375,
0.298583984375,
-0.2037353515625,
0.8232421875,
-0.391845703125,
-0.11419677734375,
-0.2218017578125,
0.2666015625,
0.177978515625,
-0.7255859375,
0.326171875,
-0.556640625,
0.685546875,
0.1451416015625,
0.0738525390625,
-0.50927734375,
-0.44384765625,
-0.63720703125,
-0.5419921875,
-0.002048492431640625,
0.64990234375,
0.10723876953125,
0.2315673828125,
-0.77392578125,
0.345458984375,
0.328369140625,
-0.0297088623046875,
0.12115478515625,
-0.0101470947265625,
0.183837890625,
0.324462890625,
0.453125,
-0.455810546875,
-0.41162109375,
0.07830810546875,
-1.3037109375,
0.71484375,
-0.3681640625,
0.00638580322265625,
-0.350830078125,
0.10626220703125,
0.00685882568359375,
0.27294921875,
-0.30322265625,
-0.035491943359375,
-0.048828125,
0.51904296875,
-1.072265625,
-0.92822265625,
0.305908203125,
-0.200927734375,
-0.541015625,
0.7177734375,
-0.1220703125,
-0.474609375,
0.221435546875,
0.1717529296875,
-0.732421875,
0.345947265625,
-0.08477783203125,
0.62060546875,
-0.17333984375,
-0.442626953125,
0.07086181640625,
-0.30078125,
0.64794921875,
-0.249755859375,
-0.91015625,
-0.424072265625,
-1.1259765625,
0.1884765625,
0.16748046875,
-0.5302734375,
0.4365234375,
-0.0282440185546875,
-0.1468505859375,
0.12200927734375,
-0.2449951171875,
-0.3515625,
-0.09796142578125,
-0.529296875,
-0.41650390625,
0.2047119140625,
0.2431640625,
0.78173828125,
-0.34619140625,
-0.35888671875,
-0.0802001953125,
0.440673828125,
0.290283203125,
-0.55712890625,
-0.1973876953125,
-0.007030487060546875,
-0.0916748046875,
-0.21875,
0.73583984375,
0.1854248046875,
0.42724609375,
0.86181640625,
0.10870361328125,
0.78564453125,
0.76416015625,
-0.69873046875,
1.361328125,
-0.046661376953125,
-1.142578125,
-0.47802734375,
0.53466796875,
-0.250732421875,
0.488037109375,
0.290771484375,
-0.783203125,
-0.69189453125,
-1.111328125,
0.09356689453125,
-0.7041015625,
-0.184326171875,
-1.2470703125,
-0.236328125,
-0.286865234375,
0.6103515625,
-0.159423828125,
-0.5693359375,
0.7109375,
-0.9775390625,
-0.0635986328125,
-0.58447265625,
-0.365234375,
-0.47998046875,
-0.5810546875,
-0.480712890625,
0.8876953125,
0.1981201171875,
0.3427734375,
0.01111602783203125,
-0.1475830078125,
-0.08740234375,
-0.10595703125,
-0.673828125,
-0.340576171875,
-0.408203125,
0.225341796875,
0.039031982421875,
-0.189453125,
-0.2335205078125,
0.456787109375,
-0.9580078125,
0.12841796875,
-0.2271728515625,
-0.42578125,
-0.275390625,
-0.0258941650390625,
1.0029296875,
-0.427978515625,
0.2666015625,
-0.865234375,
0.81005859375,
0.609375,
0.06695556640625,
-0.861328125,
-0.72412109375,
-0.765625,
-0.70849609375,
0.89599609375,
-0.64599609375,
0.396728515625,
-0.6298828125,
0.2138671875,
1.05078125,
-0.71240234375,
0.287353515625,
0.65380859375,
0.296142578125,
0.277099609375,
-0.70068359375,
0.67529296875,
0.52392578125,
-0.330810546875,
-0.44384765625,
-0.0645751953125,
-0.58447265625,
0.2200927734375,
-0.263671875,
-1,
-1.099609375,
0.418212890625,
1.3095703125,
-0.33935546875,
0.63623046875,
0.228759765625,
-0.9404296875,
-0.7294921875,
0.6533203125,
0.360107421875,
0.5537109375,
1.0654296875,
-0.39013671875,
-0.2587890625,
0.1531982421875,
0.07244873046875,
-0.24658203125,
-0.83203125,
0.83642578125,
-0.384521484375,
-0.246826171875,
0.5751953125,
0.82861328125,
-1.0927734375,
-0.52099609375,
-0.59765625,
-0.3134765625,
-0.1695556640625,
-0.49365234375,
-0.038787841796875,
0.2220458984375,
-0.92431640625,
-0.302734375,
0.338623046875,
-0.196533203125,
0.438720703125,
-0.247314453125,
0.473388671875,
-0.406494140625,
0.6708984375,
0.32080078125,
-0.7353515625,
-0.2144775390625,
-0.8125,
0.17138671875,
-0.1236572265625,
0.218017578125,
0.74755859375,
-0.455078125,
0.12200927734375,
0.428466796875,
0.10760498046875,
0.46240234375,
-0.28466796875,
-0.343994140625,
0.07891845703125,
-0.78466796875,
-0.759765625,
-0.1788330078125,
0.138916015625,
-0.279296875,
0.338134765625,
-0.416015625,
-0.1497802734375,
0.235595703125,
0.3818359375,
-0.310791015625,
-0.8779296875,
-0.11712646484375,
-0.728515625,
-0.0782470703125,
-0.8212890625,
-0.76708984375,
0.36474609375,
0.703125,
-0.5400390625,
-0.1734619140625,
0.285888671875,
0.97998046875,
-0.6376953125,
0.744140625,
-0.46044921875,
0.619140625,
-0.360595703125,
-0.270263671875,
-0.646484375,
0.08929443359375,
-0.388427734375,
-0.124755859375,
-0.3330078125,
0.306884765625,
-0.38525390625,
0.5673828125,
0.285888671875,
0.27392578125,
-0.00804901123046875,
-0.459228515625,
-0.07373046875,
-0.1014404296875,
-0.353759765625,
0.697265625,
0.53662109375,
-0.17529296875,
0.00699615478515625,
-0.410888671875,
-0.51708984375,
-0.2264404296875,
0.80908203125,
0.6044921875,
-0.1368408203125,
0.036346435546875,
-0.361572265625,
0.186767578125,
-0.89599609375,
0.2047119140625,
-0.5029296875,
0.34912109375,
0.26416015625,
-0.1661376953125,
0.302734375,
1.013671875,
0.03692626953125,
0.4189453125,
0.2490234375,
-0.051300048828125,
0.482666015625,
0.1497802734375,
0.007526397705078125,
0.427490234375,
0.141357421875,
-0.168701171875,
-0.307373046875,
0.7314453125,
-0.0158538818359375,
0.263916015625,
-0.1998291015625,
-0.70751953125,
-0.85888671875,
-0.0289459228515625,
-0.276123046875,
0.2880859375,
0.0941162109375,
-0.6083984375,
0.041839599609375,
-0.30224609375,
-0.2587890625,
0.387451171875,
-0.98486328125,
-0.88671875,
0.29052734375,
-0.236328125,
-0.47705078125,
-0.188720703125,
-0.56591796875,
-0.07958984375,
0.09393310546875,
0.24560546875,
-0.46875,
0.3212890625,
-0.251708984375,
0.65771484375,
-0.474853515625,
0.1524658203125,
0.01267242431640625,
0.250732421875,
-0.46826171875,
-0.300048828125,
-0.07733154296875,
0.9326171875,
-0.0035457611083984375,
-0.0928955078125,
-0.6171875,
0.349853515625,
-0.0733642578125,
0.16259765625,
-0.193603515625,
0.2017822265625,
-0.5478515625,
0.35888671875,
-1.1650390625,
-0.1365966796875,
-0.1375732421875,
0.2454833984375,
0.3681640625,
-0.65673828125,
-0.41943359375,
1.0458984375,
0.8720703125,
-0.239013671875,
0.34423828125,
0.08416748046875,
0.1326904296875,
-0.1553955078125,
-0.19873046875,
-0.12445068359375,
0.994140625,
0.84619140625,
0.87646484375,
-0.0472412109375,
0.578125,
0.6318359375,
-0.084716796875,
-0.006641387939453125,
0.63671875,
0.1485595703125,
-0.29345703125,
0.29150390625,
-0.33203125,
0.1204833984375,
0.126953125,
-0.86083984375,
0.072998046875,
-0.464599609375,
-0.11260986328125,
-0.19873046875,
-0.662109375,
0.6328125,
-0.30712890625,
-0.102294921875,
-0.0733642578125,
-0.56103515625,
0.1578369140625,
0.62890625,
0.2919921875,
-0.08905029296875,
0.95654296875,
0.64013671875,
0.300537109375,
0.72705078125,
0.1124267578125,
0.170654296875,
-0.252197265625,
0.041015625,
-0.084228515625,
-0.062042236328125,
-0.2275390625,
-0.1966552734375,
-0.9248046875,
0.3408203125,
0.1043701171875,
-0.40087890625,
0.42138671875,
-0.9150390625,
-0.221923828125,
-0.412109375,
0.75537109375,
-0.297119140625,
-0.131103515625,
0.3935546875,
-0.6103515625,
-0.7373046875,
0.80126953125,
-0.2452392578125,
0.243896484375,
0.0318603515625,
1.3466796875,
0.27587890625,
1.09765625,
0.7138671875,
-0.0894775390625,
-0.0192108154296875,
0.2054443359375,
-0.48876953125,
-0.4169921875,
-0.234375,
-0.4521484375,
0.1416015625,
-0.89208984375,
-0.49755859375,
-0.34521484375,
0.98681640625,
-0.0985107421875,
-1.0693359375,
-0.183837890625,
-0.234375,
-1.076171875,
0.357177734375,
0.331298828125,
0.52294921875,
-0.363037109375,
-0.2181396484375,
-0.1707763671875,
-0.2705078125,
0.1300048828125,
-0.70947265625,
0.44482421875,
-0.250244140625,
-0.7705078125,
-0.239013671875,
-0.69921875,
-0.323486328125,
0.0304412841796875,
-0.322265625,
-0.88037109375,
0.447509765625,
0.5712890625,
0.0221405029296875,
0.5029296875,
-0.56640625,
0.2451171875,
0.8232421875,
0.9296875,
0.193603515625,
0.60107421875,
-0.10748291015625,
-0.376220703125,
0.480712890625,
-0.4404296875,
0.58935546875,
-0.07318115234375,
0.21435546875,
-0.27490234375,
0.658203125,
-0.69287109375,
-1.3427734375,
0.051025390625,
0.27001953125,
0.201904296875,
-0.393798828125,
-0.91650390625,
-0.2052001953125,
-1.0205078125,
0.1259765625,
-0.307861328125,
0.446044921875,
-0.59765625,
0.21875,
-0.11041259765625,
-1.1640625,
4.546875,
0.63525390625,
0.9619140625,
0.1259765625,
0.1373291015625,
1.0703125,
0.471923828125,
-0.453857421875,
0.002716064453125,
-0.0084991455078125,
0.360595703125,
-0.61962890625,
0.179443359375,
0.81298828125,
0.1591796875,
0.5703125,
-0.71630859375,
0.394775390625,
0.15576171875,
-0.611328125,
-1.02734375,
-0.08258056640625,
-0.14013671875,
0.337890625,
0.041961669921875,
0.496337890625,
0.2978515625,
-0.62353515625,
-0.123779296875,
-0.69140625,
0.07672119140625,
-0.537109375,
0.57177734375,
-0.2198486328125,
-0.1571044921875,
0.859375,
-0.2030029296875,
-0.21044921875,
0.02423095703125,
0.09954833984375,
-0.37451171875,
-0.24365234375,
0.517578125,
-0.6259765625,
-0.04345703125,
0.145263671875,
-0.93017578125,
0.09246826171875,
0.298583984375,
-0.771484375,
0.9931640625,
-0.34228515625,
0.44921875,
-0.7578125,
-0.75537109375,
0.175537109375,
0.304443359375,
-0.33984375,
-0.5517578125,
0.39990234375,
0.5419921875,
0.2408447265625,
0.288330078125,
0.412353515625,
-0.52587890625,
1.1650390625,
-0.04144287109375,
0.156494140625,
-0.440185546875,
-0.1107177734375,
-0.385498046875,
-0.3916015625,
-0.1348876953125,
-0.44580078125,
0.875,
0.27490234375,
-0.270263671875,
0.43115234375,
0.6845703125,
-0.75732421875,
-0.0077667236328125,
-0.382568359375,
-0.424072265625,
-0.00997161865234375,
0.8388671875,
1.1123046875,
-0.6767578125,
-0.44140625,
0.1732177734375,
0.5263671875,
0.6806640625,
0.7275390625,
0.2073974609375,
-0.62255859375,
-0.1455078125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Bash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turned into an obsession. Since he is too young to go out and catch Bulbasaur, he came up with his own way of catching a Bulbasaur.
Each day, he takes the front page of the newspaper. He cuts out the letters one at a time, from anywhere on the front page of the newspaper to form the word "Bulbasaur" (without quotes) and sticks it on his wall. Bash is very particular about case — the first letter of "Bulbasaur" must be upper case and the rest must be lower case. By doing this he thinks he has caught one Bulbasaur. He then repeats this step on the left over part of the newspaper. He keeps doing this until it is not possible to form the word "Bulbasaur" from the newspaper.
Given the text on the front page of the newspaper, can you tell how many Bulbasaurs he will catch today?
Note: uppercase and lowercase letters are considered different.
Input
Input contains a single line containing a string s (1 ≤ |s| ≤ 105) — the text on the front page of the newspaper without spaces and punctuation marks. |s| is the length of the string s.
The string s contains lowercase and uppercase English letters, i.e. <image>.
Output
Output a single integer, the answer to the problem.
Examples
Input
Bulbbasaur
Output
1
Input
F
Output
0
Input
aBddulbasaurrgndgbualdBdsagaurrgndbb
Output
2
Note
In the first case, you could pick: Bulbbasaur.
In the second case, there is no way to pick even a single Bulbasaur.
In the third case, you can rearrange the string to BulbasaurBulbasauraddrgndgddgargndbb to get two words "Bulbasaur".
Tags: implementation
Correct Solution:
```
s=input()
a=[]
q=s.count('B')
w=s.count('u')
e=s.count('l')
r=s.count('b')
t=s.count('a')
y=s.count('s')
u=s.count('r')
if q>=1 and w>=2 and e>=1 and r>=1 and t>=2 and y>=1 and u>=1:
w=w//2
t=t//2
a.append(q)
a.append(w)
a.append(e)
a.append(r)
a.append(t)
a.append(y)
a.append(u)
print(min(a))
else:
print(0)
```
| 64,489
|
[
0.058258056640625,
0.147216796875,
0.08294677734375,
0.0975341796875,
-0.5888671875,
-0.59326171875,
0.1102294921875,
-0.184814453125,
0.59228515625,
0.740234375,
0.8828125,
-0.254150390625,
0.07830810546875,
-0.403076171875,
-0.62158203125,
-0.324951171875,
-0.79443359375,
-0.50830078125,
-0.024688720703125,
-0.4609375,
-0.0762939453125,
-0.12335205078125,
-0.99560546875,
-0.1668701171875,
-0.152587890625,
0.74609375,
0.59814453125,
0.127197265625,
0.85693359375,
0.8720703125,
0.07208251953125,
-0.2939453125,
0.4482421875,
-0.82373046875,
-0.28564453125,
-0.55859375,
0.634765625,
-1.146484375,
-0.09271240234375,
-0.29833984375,
0.4208984375,
-0.287109375,
0.90087890625,
-0.8076171875,
-1.064453125,
-0.32275390625,
-0.7548828125,
-0.2318115234375,
-0.30029296875,
-0.572265625,
0.1563720703125,
-0.0105133056640625,
0.1392822265625,
-0.228515625,
0.22998046875,
-0.287353515625,
-0.164306640625,
0.0733642578125,
-0.4033203125,
0.544921875,
0.053619384765625,
0.29345703125,
-0.154296875,
-0.356689453125,
0.045013427734375,
0.2724609375,
-0.0100250244140625,
-0.46142578125,
0.304931640625,
-0.5390625,
-0.458740234375,
0.4541015625,
-0.330810546875,
-0.5205078125,
-0.27587890625,
0.1436767578125,
0.264892578125,
-0.138427734375,
-0.68212890625,
1.197265625,
0.0946044921875,
0.84912109375,
0.5224609375,
0.1922607421875,
-0.3486328125,
-0.56298828125,
0.248779296875,
0.2288818359375,
0.08843994140625,
-0.2176513671875,
-0.297607421875,
0.5400390625,
-0.509765625,
-0.2235107421875,
0.66796875,
0.462890625,
-0.6416015625,
0.5244140625,
0.28369140625,
0.0802001953125,
0.564453125,
0.8134765625,
-0.389404296875,
1.09765625,
-0.145751953125,
0.357421875,
0.129638671875,
0.0609130859375,
-0.50390625,
-0.3681640625,
-0.35888671875,
-0.1337890625,
0.7744140625,
0.03375244140625,
-0.384033203125,
0.5556640625,
0.07391357421875,
0.69287109375,
-0.9375,
0.250244140625,
0.330078125,
-0.08203125,
0.60107421875,
-0.4560546875,
-0.1536865234375,
-0.29541015625,
-0.68310546875,
1.1904296875,
-0.473876953125,
-0.04693603515625,
0.310546875,
0.2174072265625,
0.0175628662109375,
0.449951171875,
-0.322265625,
0.7109375,
-0.53857421875,
0.65087890625,
0.5263671875,
-0.64013671875,
0.86279296875,
-0.21875,
-0.0162811279296875,
1.345703125,
0.392578125,
0.1629638671875,
0.346923828125,
0.198486328125,
-0.85888671875,
0.650390625,
-0.99755859375,
0.59423828125,
0.0665283203125,
0.24072265625,
-0.346923828125,
0.73876953125,
-0.36181640625,
0.34130859375,
0.27880859375,
0.11761474609375,
-0.2178955078125,
0.560546875,
-0.77490234375,
1.0009765625,
0.046844482421875,
0.970703125,
-0.775390625,
-0.305419921875,
-0.1712646484375,
-0.323486328125,
-0.007808685302734375,
-0.09039306640625,
-0.0626220703125,
0.9775390625,
0.40185546875,
0.84033203125,
0.8369140625,
0.02703857421875,
0.1376953125,
0.1422119140625,
0.0300445556640625,
0.214599609375,
0.338623046875,
0.9033203125,
0.1563720703125,
0.261474609375,
0.10552978515625,
-0.58740234375,
-0.9609375,
-0.402099609375,
0.09478759765625,
0.509765625,
-0.3212890625,
0.21435546875,
0.06512451171875,
0.232666015625,
-0.486572265625,
-0.283935546875,
0.00946044921875,
-0.833984375,
-0.419189453125,
0.494873046875,
0.048583984375,
0.69287109375,
0.09381103515625,
-0.93115234375,
0.50634765625,
1.1396484375,
-0.1851806640625,
0.043731689453125,
0.049560546875,
0.1168212890625,
0.006702423095703125,
0.06781005859375,
0.132568359375,
-0.268798828125,
-0.77685546875,
0.352294921875,
-0.09710693359375,
-0.01666259765625,
-0.2144775390625,
0.3974609375,
0.40380859375,
0.4873046875,
-0.265625,
-0.015655517578125,
0.78076171875,
0.6083984375,
-0.0565185546875,
0.11248779296875,
0.11328125,
0.95361328125,
0.41748046875,
0.77587890625,
0.456298828125,
0.286865234375,
0.38330078125,
0.60595703125,
0.36474609375,
0.38232421875,
-0.05841064453125,
0.259765625,
0.35009765625,
0.468505859375,
0.02294921875,
0.46044921875,
-0.241455078125,
0.042938232421875,
-0.740234375,
0.89599609375,
-0.1900634765625,
0.6376953125,
0.1927490234375,
0.40625,
-0.272705078125,
-0.68359375,
0.30810546875,
0.6220703125,
-0.935546875,
-0.416748046875,
0.407958984375,
0.255859375,
0.392822265625,
0.269775390625,
0.00298309326171875,
0.311279296875,
0.282470703125,
0.454345703125,
0.0185089111328125,
-0.6455078125,
-0.85888671875,
-0.650390625,
-1.1005859375,
-0.438232421875,
-0.6103515625,
-0.176513671875,
0.277587890625,
-1.244140625,
0.61328125,
-0.71435546875,
-0.1534423828125,
0.0966796875,
-0.5185546875,
0.67529296875,
-0.08001708984375,
0.68359375,
-0.3740234375,
0.537109375,
-0.053070068359375,
0.68017578125,
-0.378662109375,
-0.058837890625,
-0.42333984375,
-0.69482421875,
0.1448974609375,
0.0726318359375,
0.4287109375,
-0.1834716796875,
-0.40673828125,
-0.62158203125,
-0.259765625,
-0.187255859375,
-0.50634765625,
0.1451416015625,
-0.548828125,
0.6865234375,
0.44970703125,
-0.60546875,
0.5048828125,
1.0830078125,
-0.80859375,
0.476318359375,
0.1761474609375,
0.281982421875,
-0.703125,
1.322265625,
0.31591796875,
0.43017578125,
-0.431396484375,
-0.57861328125,
-0.5126953125,
0.09234619140625,
-0.1402587890625,
-0.27001953125,
-0.66455078125,
0.796875,
0.067626953125,
-0.93017578125,
0.5673828125,
-0.8720703125,
-0.487548828125,
-0.5361328125,
-0.43603515625,
0.576171875,
0.6943359375,
0.06512451171875,
-0.2093505859375,
-0.35009765625,
0.136474609375,
0.65771484375,
0.5400390625,
-0.83447265625,
-0.201171875,
0.47119140625,
0.10125732421875,
0.490966796875,
0.130615234375,
-0.08233642578125,
-0.173828125,
-0.1617431640625,
-0.09063720703125,
0.5146484375,
0.3857421875,
-0.0211334228515625,
0.6435546875,
0.420166015625,
-0.8671875,
-0.2020263671875,
-0.2109375,
0.7421875,
0.228759765625,
0.826171875,
0.75146484375,
-0.044769287109375,
-0.6142578125,
-0.91162109375,
0.36376953125,
0.005779266357421875,
0.572265625,
-0.9423828125,
0.580078125,
0.287353515625,
-0.32080078125,
0.66650390625,
-0.68505859375,
-0.278076171875,
1.4892578125,
-0.31982421875,
0.490478515625,
-0.370361328125,
1.01171875,
-0.30419921875,
-0.2486572265625,
0.615234375,
0.44921875,
0.3837890625,
0.08013916015625,
0.07122802734375,
-0.06591796875,
-0.31591796875,
-0.253173828125,
-0.54052734375,
0.5048828125,
-0.299560546875,
-0.45263671875,
-0.603515625,
0.30810546875,
0.5595703125,
0.7373046875,
0.276611328125,
0.919921875,
-0.14501953125,
0.4287109375,
0.0181121826171875,
-0.43701171875,
0.059600830078125,
-0.73876953125,
0.76513671875,
0.043182373046875,
-0.180419921875,
-0.51953125,
0.004985809326171875,
-0.408203125,
0.341552734375,
0.2347412109375,
-0.28173828125,
-1.203125,
0.233154296875,
-0.1724853515625,
0.82861328125,
-0.392333984375,
-0.10406494140625,
-0.25048828125,
0.2841796875,
0.1500244140625,
-0.7255859375,
0.33056640625,
-0.583984375,
0.68994140625,
0.0908203125,
0.057708740234375,
-0.482666015625,
-0.41455078125,
-0.62255859375,
-0.56640625,
0.0257110595703125,
0.61328125,
0.1160888671875,
0.257080078125,
-0.79736328125,
0.346435546875,
0.3642578125,
-0.0151519775390625,
0.1373291015625,
0.0180816650390625,
0.2337646484375,
0.30615234375,
0.44189453125,
-0.468017578125,
-0.390380859375,
0.078857421875,
-1.2529296875,
0.6884765625,
-0.391845703125,
-0.0013256072998046875,
-0.3447265625,
0.08453369140625,
-0.035980224609375,
0.2462158203125,
-0.291015625,
-0.012237548828125,
-0.058837890625,
0.472900390625,
-1.03515625,
-0.95166015625,
0.298828125,
-0.193359375,
-0.5439453125,
0.693359375,
-0.12548828125,
-0.428466796875,
0.2314453125,
0.2237548828125,
-0.7470703125,
0.357177734375,
-0.0704345703125,
0.61083984375,
-0.1630859375,
-0.44775390625,
0.05963134765625,
-0.26611328125,
0.646484375,
-0.2548828125,
-0.931640625,
-0.428955078125,
-1.1328125,
0.1663818359375,
0.166748046875,
-0.498291015625,
0.416748046875,
-0.03350830078125,
-0.1441650390625,
0.12286376953125,
-0.2440185546875,
-0.33740234375,
-0.1446533203125,
-0.50146484375,
-0.419677734375,
0.2115478515625,
0.2373046875,
0.7734375,
-0.376220703125,
-0.314453125,
-0.0704345703125,
0.41845703125,
0.2578125,
-0.51806640625,
-0.215087890625,
0.0003120899200439453,
-0.10174560546875,
-0.1810302734375,
0.79296875,
0.1671142578125,
0.427490234375,
0.91064453125,
0.09942626953125,
0.7666015625,
0.7626953125,
-0.68603515625,
1.333984375,
-0.0174102783203125,
-1.1435546875,
-0.478515625,
0.51806640625,
-0.2384033203125,
0.48046875,
0.271484375,
-0.783203125,
-0.67626953125,
-1.154296875,
0.1075439453125,
-0.7236328125,
-0.1591796875,
-1.294921875,
-0.2174072265625,
-0.289306640625,
0.60107421875,
-0.1689453125,
-0.51806640625,
0.6787109375,
-0.99609375,
-0.05523681640625,
-0.59814453125,
-0.35986328125,
-0.5078125,
-0.59521484375,
-0.474609375,
0.8779296875,
0.1763916015625,
0.34326171875,
0.017913818359375,
-0.1807861328125,
-0.0831298828125,
-0.09185791015625,
-0.6591796875,
-0.3251953125,
-0.387451171875,
0.2093505859375,
0.04583740234375,
-0.1943359375,
-0.228271484375,
0.484619140625,
-0.96533203125,
0.11273193359375,
-0.2353515625,
-0.45458984375,
-0.279541015625,
0.004535675048828125,
0.9794921875,
-0.390869140625,
0.24658203125,
-0.8681640625,
0.77294921875,
0.60888671875,
0.032470703125,
-0.8642578125,
-0.70849609375,
-0.7568359375,
-0.68701171875,
0.8642578125,
-0.6337890625,
0.38623046875,
-0.61328125,
0.185302734375,
1.033203125,
-0.6767578125,
0.26220703125,
0.67578125,
0.30224609375,
0.274658203125,
-0.70654296875,
0.6650390625,
0.54443359375,
-0.33203125,
-0.45166015625,
-0.06268310546875,
-0.56982421875,
0.192626953125,
-0.257080078125,
-0.96826171875,
-1.07421875,
0.396240234375,
1.310546875,
-0.3427734375,
0.59765625,
0.239501953125,
-0.91796875,
-0.7177734375,
0.65625,
0.360595703125,
0.55615234375,
1.03515625,
-0.40185546875,
-0.2489013671875,
0.12646484375,
0.0958251953125,
-0.2362060546875,
-0.8310546875,
0.83984375,
-0.3994140625,
-0.240478515625,
0.60302734375,
0.853515625,
-1.076171875,
-0.521484375,
-0.56787109375,
-0.304443359375,
-0.181884765625,
-0.495361328125,
-0.0180206298828125,
0.241455078125,
-0.912109375,
-0.31298828125,
0.339111328125,
-0.17626953125,
0.450439453125,
-0.236328125,
0.4716796875,
-0.40234375,
0.6982421875,
0.32080078125,
-0.7626953125,
-0.1673583984375,
-0.81201171875,
0.166748046875,
-0.128662109375,
0.2044677734375,
0.7314453125,
-0.468017578125,
0.11590576171875,
0.42724609375,
0.09735107421875,
0.444091796875,
-0.3115234375,
-0.37744140625,
0.1173095703125,
-0.76416015625,
-0.74072265625,
-0.15625,
0.16064453125,
-0.28125,
0.345458984375,
-0.461669921875,
-0.158203125,
0.26953125,
0.36328125,
-0.2900390625,
-0.8701171875,
-0.1201171875,
-0.74072265625,
-0.04290771484375,
-0.8271484375,
-0.7685546875,
0.3818359375,
0.7041015625,
-0.5439453125,
-0.1832275390625,
0.2880859375,
0.98876953125,
-0.64111328125,
0.72802734375,
-0.454345703125,
0.6142578125,
-0.3525390625,
-0.312255859375,
-0.62353515625,
0.054290771484375,
-0.39111328125,
-0.11651611328125,
-0.356201171875,
0.291259765625,
-0.370849609375,
0.53955078125,
0.26513671875,
0.287841796875,
0.010986328125,
-0.415771484375,
-0.09112548828125,
-0.10430908203125,
-0.3818359375,
0.68408203125,
0.53515625,
-0.1492919921875,
-0.0142974853515625,
-0.4150390625,
-0.481689453125,
-0.2017822265625,
0.78759765625,
0.583984375,
-0.12127685546875,
0.0138397216796875,
-0.365234375,
0.1900634765625,
-0.9052734375,
0.216552734375,
-0.50830078125,
0.367431640625,
0.31591796875,
-0.1661376953125,
0.30859375,
1.0048828125,
0.06756591796875,
0.396484375,
0.259765625,
-0.0166473388671875,
0.51025390625,
0.136474609375,
0.0103759765625,
0.384033203125,
0.153564453125,
-0.1644287109375,
-0.305908203125,
0.7490234375,
-0.0186004638671875,
0.25244140625,
-0.11834716796875,
-0.705078125,
-0.8671875,
-0.03887939453125,
-0.24853515625,
0.268310546875,
0.0780029296875,
-0.57470703125,
0.061126708984375,
-0.296630859375,
-0.271728515625,
0.402587890625,
-0.9501953125,
-0.87158203125,
0.305419921875,
-0.26318359375,
-0.48828125,
-0.1964111328125,
-0.5625,
-0.0538330078125,
0.0870361328125,
0.265625,
-0.439453125,
0.335693359375,
-0.275146484375,
0.6171875,
-0.459228515625,
0.1441650390625,
-0.028900146484375,
0.2427978515625,
-0.5126953125,
-0.294921875,
-0.0633544921875,
0.95751953125,
-0.0283660888671875,
-0.114501953125,
-0.6572265625,
0.3466796875,
-0.06036376953125,
0.16845703125,
-0.20458984375,
0.21240234375,
-0.5625,
0.32958984375,
-1.1513671875,
-0.1248779296875,
-0.137451171875,
0.2442626953125,
0.3642578125,
-0.62890625,
-0.441162109375,
1.0087890625,
0.8388671875,
-0.205078125,
0.32421875,
0.0645751953125,
0.1552734375,
-0.175048828125,
-0.1993408203125,
-0.1104736328125,
1.0009765625,
0.8388671875,
0.84521484375,
-0.059417724609375,
0.546875,
0.62890625,
-0.1070556640625,
-0.0145416259765625,
0.62060546875,
0.1920166015625,
-0.341064453125,
0.280029296875,
-0.3310546875,
0.151123046875,
0.13037109375,
-0.8740234375,
0.1082763671875,
-0.433349609375,
-0.142578125,
-0.228759765625,
-0.650390625,
0.61572265625,
-0.2861328125,
-0.07537841796875,
-0.1226806640625,
-0.57568359375,
0.1414794921875,
0.62744140625,
0.28955078125,
-0.11810302734375,
0.9462890625,
0.61328125,
0.301513671875,
0.71533203125,
0.09710693359375,
0.13818359375,
-0.214599609375,
0.06768798828125,
-0.0916748046875,
-0.03973388671875,
-0.25830078125,
-0.196533203125,
-0.89990234375,
0.369873046875,
0.10113525390625,
-0.384521484375,
0.401123046875,
-0.8876953125,
-0.2275390625,
-0.373291015625,
0.76171875,
-0.33740234375,
-0.2021484375,
0.3857421875,
-0.65869140625,
-0.74853515625,
0.75390625,
-0.24951171875,
0.248779296875,
0.032562255859375,
1.3271484375,
0.221923828125,
1.0986328125,
0.71875,
-0.0802001953125,
-0.01403045654296875,
0.1954345703125,
-0.50732421875,
-0.392578125,
-0.2237548828125,
-0.47314453125,
0.152587890625,
-0.900390625,
-0.513671875,
-0.326416015625,
0.9736328125,
-0.10186767578125,
-1.044921875,
-0.196533203125,
-0.2099609375,
-1.0546875,
0.322021484375,
0.292724609375,
0.54931640625,
-0.363037109375,
-0.1920166015625,
-0.175537109375,
-0.3115234375,
0.10882568359375,
-0.71875,
0.442626953125,
-0.2288818359375,
-0.77099609375,
-0.2337646484375,
-0.68359375,
-0.337890625,
0.036224365234375,
-0.32666015625,
-0.87353515625,
0.443115234375,
0.56884765625,
0.00605010986328125,
0.47216796875,
-0.53759765625,
0.248779296875,
0.8251953125,
0.92578125,
0.169677734375,
0.59326171875,
-0.135986328125,
-0.3623046875,
0.473388671875,
-0.436279296875,
0.58154296875,
-0.09283447265625,
0.207275390625,
-0.326171875,
0.662109375,
-0.68505859375,
-1.2958984375,
0.08013916015625,
0.26416015625,
0.2156982421875,
-0.41015625,
-0.89306640625,
-0.2020263671875,
-0.98583984375,
0.10711669921875,
-0.339111328125,
0.45361328125,
-0.603515625,
0.2060546875,
-0.146484375,
-1.19140625,
4.58203125,
0.658203125,
0.9619140625,
0.1534423828125,
0.0955810546875,
1.0537109375,
0.475830078125,
-0.455078125,
0.0095977783203125,
-0.0121307373046875,
0.350830078125,
-0.62060546875,
0.1822509765625,
0.80517578125,
0.1512451171875,
0.578125,
-0.7216796875,
0.38134765625,
0.1715087890625,
-0.60009765625,
-0.98828125,
-0.07177734375,
-0.18212890625,
0.29931640625,
0.046905517578125,
0.4951171875,
0.268798828125,
-0.58056640625,
-0.1328125,
-0.63720703125,
0.0477294921875,
-0.51025390625,
0.54052734375,
-0.2100830078125,
-0.1455078125,
0.8466796875,
-0.1767578125,
-0.1949462890625,
-0.00815582275390625,
0.08563232421875,
-0.340576171875,
-0.2578125,
0.488037109375,
-0.64111328125,
-0.051971435546875,
0.1488037109375,
-0.93798828125,
0.0714111328125,
0.2890625,
-0.78759765625,
0.994140625,
-0.37060546875,
0.449462890625,
-0.75390625,
-0.736328125,
0.1939697265625,
0.28076171875,
-0.3212890625,
-0.51220703125,
0.38232421875,
0.54638671875,
0.2347412109375,
0.253173828125,
0.42822265625,
-0.4990234375,
1.1787109375,
-0.0233612060546875,
0.148681640625,
-0.41162109375,
-0.11767578125,
-0.406982421875,
-0.365478515625,
-0.11163330078125,
-0.427978515625,
0.90869140625,
0.23974609375,
-0.273193359375,
0.443359375,
0.68408203125,
-0.73486328125,
-0.031707763671875,
-0.362060546875,
-0.434326171875,
-0.015899658203125,
0.84326171875,
1.083984375,
-0.69580078125,
-0.41455078125,
0.15234375,
0.52001953125,
0.67529296875,
0.7451171875,
0.21875,
-0.64794921875,
-0.14208984375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Peterson loves to learn new languages, but his favorite hobby is making new ones. Language is a set of words, and word is a sequence of lowercase Latin letters.
Peterson makes new language every morning. It is difficult task to store the whole language, so Peterson have invented new data structure for storing his languages which is called broom. Broom is rooted tree with edges marked with letters. Initially broom is represented by the only vertex — the root of the broom. When Peterson wants to add new word to the language he stands at the root and processes the letters of new word one by one. Consider that Peterson stands at the vertex u. If there is an edge from u marked with current letter, Peterson goes through this edge. Otherwise Peterson adds new edge from u to the new vertex v, marks it with the current letter and goes through the new edge. Size of broom is the number of vertices in it.
In the evening after working day Peterson can't understand the language he made this morning. It is too difficult for bored Peterson and he tries to make it simpler. Simplification of the language is the process of erasing some letters from some words of this language. Formally, Peterson takes some positive integer p and erases p-th letter from all the words of this language having length at least p. Letters in words are indexed starting by 1. Peterson considers that simplification should change at least one word, i.e. there has to be at least one word of length at least p. Peterson tries to make his language as simple as possible, so he wants to choose p such that the size of the broom for his simplified language is as small as possible.
Peterson is pretty annoyed with this task so he asks you for help. Write a program to find the smallest possible size of the broom and integer p.
Input
The first line of input contains integer n (2 ≤ n ≤ 3·105) — the size of the broom.
Next n - 1 lines describe the broom: i-th of them contains integers ui, vi and letter xi — describing the edge from ui to vi marked with letter xi.
Vertices are numbered from 1 to n. All xi are lowercase latin letters. Vertex 1 is the root of the broom.
Edges describe correct broom which is made from Peterson's language.
Output
The first line of output should contain the minimum possible size of the broom after its simplification. The second line of output should contain integer p to choose. If there are several suitable p values, print the smallest one.
Examples
Input
5
1 2 c
2 3 a
3 4 t
2 5 t
Output
3
2
Input
16
1 2 o
2 3 f
1 4 p
4 5 i
5 6 e
6 7 c
7 8 e
4 9 r
9 10 e
10 11 t
11 12 t
12 13 y
10 14 f
14 15 i
15 16 x
Output
12
2
Note
<image>
Broom from the second sample test can be built using language "piece", "of", "pie", "pretty", "prefix". Its simplification with p = 2 obtains the language of words "pece", "o", "pe", "petty", "pefix". This language gives us the broom with minimum possible size.
Submitted Solution:
```
from collections import defaultdict
nodes = int(input())
levels = defaultdict(list)
broom = defaultdict(list)
relation = defaultdict(str)
for i in range(1, nodes):
a, b, L = [x for x in input().split()]
broom[a].append(b)
relation[a] = L
queue = ['flag','1']
flag = True
cont = 0
indice = 0
maximo = 0
maxindice = 0
lastlast = ''
while len(queue) > 0:
last = queue.pop()
# print(last)
if last != 'flag':
# print(cont)
levels[indice].append(last)
cont += 1
lista = broom[last]
for i in lista:
queue.insert(0, i)
else:
if lastlast == last:
break
queue.insert(0, 'flag')
indice += 1
# print(cont)
if cont > maximo:
maxindice = indice
maximo = cont
cont = 0
lastlast = last
a = []
for x in levels[maxindice - 1]:
a.append(relation[x])
diferencia = len(levels[maxindice]) - (len(set(a)) - 1)
# print(relation)
# print(levels)
print(nodes - maximo - diferencia)
print (maxindice - 1)
```
No
| 64,498
|
[
0.4375,
-0.2215576171875,
0.371337890625,
-0.218017578125,
-0.1591796875,
0.029754638671875,
0.234130859375,
0.07000732421875,
-0.263671875,
0.70947265625,
1.0537109375,
-0.21337890625,
0.05999755859375,
-0.73779296875,
-0.63427734375,
0.246337890625,
-0.76416015625,
-0.86669921875,
-0.91552734375,
-0.0511474609375,
0.1239013671875,
-0.092041015625,
-1.4208984375,
-0.303466796875,
-0.52880859375,
0.7490234375,
0.340576171875,
-0.05828857421875,
1.189453125,
0.79443359375,
-0.24072265625,
-0.049407958984375,
0.63037109375,
-1.0595703125,
-0.05963134765625,
-0.73974609375,
0.64208984375,
-0.478759765625,
-0.2020263671875,
-0.47265625,
0.260498046875,
-0.5849609375,
0.66015625,
-0.69775390625,
-0.986328125,
-0.064697265625,
-0.228271484375,
-0.49072265625,
-0.1212158203125,
-0.84228515625,
0.73876953125,
-0.160400390625,
0.45361328125,
-0.3515625,
0.477783203125,
0.19091796875,
0.1832275390625,
0.345458984375,
-0.92578125,
0.08380126953125,
0.2440185546875,
0.4013671875,
-0.03955078125,
-0.9892578125,
-0.325927734375,
0.354736328125,
-0.0164642333984375,
-0.288330078125,
0.191650390625,
-0.8505859375,
-0.58544921875,
0.301513671875,
-0.33740234375,
-0.6845703125,
-0.432373046875,
0.170166015625,
0.407958984375,
0.0213165283203125,
-1.291015625,
0.626953125,
0.054046630859375,
1.0693359375,
0.177734375,
0.489013671875,
-0.461669921875,
-0.255615234375,
0.415283203125,
0.3974609375,
0.32568359375,
-0.08514404296875,
0.10052490234375,
0.306884765625,
-0.2880859375,
0.1494140625,
0.5810546875,
0.48974609375,
-0.5869140625,
0.36376953125,
0.2352294921875,
0.167724609375,
0.86865234375,
0.75244140625,
-0.218994140625,
1.0400390625,
-0.52490234375,
0.0439453125,
-0.1226806640625,
0.326904296875,
-0.049407958984375,
-0.1881103515625,
-0.0885009765625,
-0.13134765625,
0.219970703125,
0.390380859375,
-0.26708984375,
0.5634765625,
-0.038116455078125,
0.17138671875,
-0.8515625,
0.07708740234375,
0.2086181640625,
0.046600341796875,
0.36328125,
-0.309326171875,
0.2047119140625,
-0.494140625,
-0.6708984375,
1.0205078125,
-0.52001953125,
-0.033782958984375,
0.309326171875,
-0.0343017578125,
-0.294921875,
0.29345703125,
0.443359375,
0.48193359375,
-0.2188720703125,
0.58154296875,
0.810546875,
-0.68408203125,
0.7294921875,
-0.3115234375,
-0.30322265625,
1.17578125,
0.01467132568359375,
0.27783203125,
0.40771484375,
0.279052734375,
-0.8642578125,
0.216064453125,
-0.9208984375,
0.390380859375,
0.031494140625,
0.155029296875,
-0.56396484375,
0.1199951171875,
-0.1728515625,
0.2880859375,
0.465087890625,
0.083740234375,
-0.63037109375,
0.2548828125,
-0.35205078125,
0.65478515625,
-0.30224609375,
0.7744140625,
-0.58056640625,
-0.1998291015625,
-0.462646484375,
-0.6767578125,
0.1746826171875,
-0.3291015625,
-0.288818359375,
0.78857421875,
0.7451171875,
1.0244140625,
1.0732421875,
-0.33349609375,
0.2724609375,
0.300537109375,
-0.29541015625,
0.007404327392578125,
0.22607421875,
0.79833984375,
0.0765380859375,
0.0169677734375,
0.2073974609375,
-0.353759765625,
-0.52392578125,
-0.54248046875,
-0.062744140625,
0.833984375,
-0.6396484375,
0.337158203125,
-0.01537322998046875,
0.130615234375,
-0.78125,
-0.255615234375,
0.220703125,
-1.2919921875,
-0.362548828125,
0.58544921875,
-0.180419921875,
0.7412109375,
-0.411865234375,
-0.26513671875,
0.65576171875,
0.97802734375,
-0.1639404296875,
-0.244384765625,
0.734375,
0.38916015625,
-0.515625,
-0.0005283355712890625,
-0.05584716796875,
-0.045623779296875,
-0.379150390625,
0.5625,
-0.26416015625,
-0.07293701171875,
0.28271484375,
0.59716796875,
0.049224853515625,
0.350341796875,
-0.1705322265625,
0.062469482421875,
0.433837890625,
1.0947265625,
-0.1658935546875,
0.73193359375,
-0.0435791015625,
1.181640625,
0.2337646484375,
0.923828125,
0.732421875,
0.237548828125,
0.69677734375,
1.0595703125,
-0.0153656005859375,
0.2294921875,
-0.0298614501953125,
0.330078125,
0.1884765625,
0.3486328125,
0.395263671875,
0.55615234375,
-0.39697265625,
0.1114501953125,
-0.396484375,
0.485107421875,
-0.52685546875,
0.859375,
-0.03460693359375,
0.50341796875,
-0.77294921875,
-0.324951171875,
0.11920166015625,
0.78173828125,
-1.01171875,
-0.720703125,
0.0232696533203125,
0.11920166015625,
0.429443359375,
0.11962890625,
0.217529296875,
0.302734375,
0.29638671875,
0.61279296875,
-0.264892578125,
-0.486328125,
-0.64404296875,
-0.5888671875,
-1.083984375,
-0.126220703125,
-0.623046875,
-0.16357421875,
0.091064453125,
-1.052734375,
0.403564453125,
-0.63720703125,
-0.0673828125,
-0.11651611328125,
-0.52392578125,
0.51171875,
0.005649566650390625,
0.52099609375,
-0.75,
-0.0231475830078125,
0.49365234375,
0.830078125,
-0.53173828125,
-0.062164306640625,
-0.1351318359375,
-0.398681640625,
0.445068359375,
0.0277099609375,
0.51904296875,
0.07421875,
-0.59814453125,
-1.013671875,
-0.3330078125,
0.034423828125,
-0.489501953125,
0.105712890625,
-0.398681640625,
1.150390625,
0.13525390625,
-0.76904296875,
0.92626953125,
0.7880859375,
-0.865234375,
0.591796875,
-0.06500244140625,
-0.1414794921875,
-0.9423828125,
1.392578125,
0.302978515625,
0.53125,
-0.70703125,
-0.53564453125,
-0.572265625,
-0.0182342529296875,
-0.12408447265625,
-0.5458984375,
-0.160400390625,
0.75390625,
0.0166015625,
-1.1201171875,
0.81982421875,
-1.27734375,
-0.81982421875,
-0.33740234375,
-0.94287109375,
0.64208984375,
0.75146484375,
0.1978759765625,
0.231201171875,
-0.371337890625,
-0.1414794921875,
0.40966796875,
0.705078125,
-0.74169921875,
-0.2578125,
0.84814453125,
0.22900390625,
0.3984375,
0.1505126953125,
-0.374755859375,
-0.271484375,
-0.312744140625,
0.210205078125,
0.8564453125,
0.52001953125,
0.081298828125,
0.30810546875,
0.494384765625,
-0.7607421875,
-0.60498046875,
-0.09051513671875,
0.73974609375,
0.50048828125,
0.2410888671875,
0.2164306640625,
-0.4658203125,
-0.74609375,
-0.94189453125,
0.59716796875,
-0.036834716796875,
0.82763671875,
-0.85498046875,
0.6884765625,
0.27392578125,
-0.6484375,
0.560546875,
-0.8505859375,
0.040496826171875,
0.783203125,
-0.240966796875,
0.8359375,
-0.68798828125,
0.58056640625,
-0.31591796875,
0.07177734375,
0.57275390625,
0.2255859375,
0.5556640625,
-0.412109375,
-0.2607421875,
-0.291259765625,
-0.023193359375,
-0.203125,
-0.6533203125,
0.30029296875,
-0.67919921875,
0.042877197265625,
-0.93994140625,
0.55029296875,
0.38232421875,
0.52978515625,
0.1611328125,
0.50732421875,
-0.1060791015625,
0.479248046875,
1.0380859375,
0.384521484375,
0.355712890625,
-0.63525390625,
0.82470703125,
0.4365234375,
-0.373779296875,
-0.377685546875,
-0.0721435546875,
0.0589599609375,
0.32373046875,
0.1251220703125,
0.12017822265625,
-0.669921875,
0.161865234375,
0.018524169921875,
0.45556640625,
-0.8017578125,
-0.313720703125,
0.0535888671875,
0.6748046875,
0.5361328125,
-1.0908203125,
0.053466796875,
-0.80224609375,
0.410400390625,
0.79638671875,
0.1494140625,
-0.51220703125,
-0.1981201171875,
-0.70263671875,
-0.60400390625,
0.19140625,
1.05859375,
-0.234375,
0.143798828125,
-1.3974609375,
0.461669921875,
0.483154296875,
-0.226318359375,
-0.09918212890625,
-0.05853271484375,
0.626953125,
0.1085205078125,
0.29736328125,
-0.030609130859375,
-0.6943359375,
0.1668701171875,
-1.048828125,
0.08209228515625,
-0.326416015625,
0.52587890625,
-0.1700439453125,
0.06964111328125,
0.040008544921875,
0.71337890625,
-0.2476806640625,
0.3896484375,
-0.08587646484375,
0.388671875,
-0.7001953125,
-0.61767578125,
0.53857421875,
0.435302734375,
-0.3056640625,
0.80224609375,
0.3251953125,
-0.6484375,
0.1973876953125,
0.40771484375,
-0.47509765625,
0.6630859375,
-0.65478515625,
0.303466796875,
-0.1590576171875,
-0.595703125,
-0.298095703125,
-0.493896484375,
0.81689453125,
-0.055572509765625,
-0.38818359375,
-0.36865234375,
-1.2841796875,
0.002086639404296875,
-0.005321502685546875,
-0.79345703125,
0.126220703125,
0.342041015625,
-0.170166015625,
0.02203369140625,
-0.13525390625,
-0.478515625,
-0.736328125,
-0.315673828125,
-0.381591796875,
0.260986328125,
0.5869140625,
0.7919921875,
0.2393798828125,
-0.293701171875,
-0.423095703125,
-0.152587890625,
0.05035400390625,
-0.4111328125,
0.259521484375,
0.028594970703125,
-0.279052734375,
-0.08880615234375,
0.4228515625,
0.08843994140625,
0.359619140625,
0.445556640625,
0.2198486328125,
0.25732421875,
0.0941162109375,
-0.429443359375,
1.0966796875,
-0.10223388671875,
-1.4150390625,
-0.414306640625,
0.471435546875,
-0.11859130859375,
0.55322265625,
0.319091796875,
-0.5322265625,
-0.64208984375,
-0.79150390625,
0.39013671875,
-0.82861328125,
-0.36669921875,
-0.74951171875,
-0.1763916015625,
-0.1573486328125,
0.45751953125,
0.280517578125,
-0.36962890625,
0.184814453125,
-1.083984375,
-0.07501220703125,
-0.9404296875,
-0.2147216796875,
-0.70556640625,
-0.50927734375,
-0.2452392578125,
0.822265625,
0.22998046875,
0.1500244140625,
-0.37939453125,
-0.06396484375,
0.139892578125,
0.00370025634765625,
-0.607421875,
-0.400146484375,
-0.1036376953125,
-0.04864501953125,
0.09344482421875,
0.0413818359375,
-0.41943359375,
0.7734375,
-0.6591796875,
0.09588623046875,
-0.333740234375,
-0.2091064453125,
-0.180419921875,
-0.423583984375,
0.98828125,
-0.328857421875,
0.0286865234375,
-0.29638671875,
0.303955078125,
0.8017578125,
-0.580078125,
-0.350830078125,
-0.68994140625,
-0.7724609375,
-1.04296875,
0.66552734375,
-0.61474609375,
0.10333251953125,
-0.7421875,
-0.158935546875,
0.90283203125,
-0.5498046875,
0.40283203125,
1.345703125,
0.08673095703125,
0.401611328125,
-0.82177734375,
0.60107421875,
0.1243896484375,
-0.54541015625,
-0.09259033203125,
-0.0966796875,
-0.9697265625,
0.0181884765625,
-0.5322265625,
-1.3447265625,
-0.787109375,
0.261474609375,
1.0693359375,
-0.3984375,
0.9716796875,
-0.1246337890625,
-0.94970703125,
-0.7236328125,
0.72021484375,
0.135498046875,
0.33447265625,
0.57861328125,
-0.058135986328125,
-0.2352294921875,
-0.0113677978515625,
0.02813720703125,
-0.455078125,
-0.302001953125,
1.1591796875,
-0.20703125,
-0.736328125,
0.53466796875,
1.193359375,
-1.126953125,
-0.60009765625,
-0.374755859375,
-0.37548828125,
-0.01934814453125,
-0.80810546875,
0.33349609375,
0.580078125,
-0.448974609375,
0.3056640625,
0.54345703125,
-0.347412109375,
0.277099609375,
0.56298828125,
0.515625,
-0.23681640625,
0.172607421875,
0.9033203125,
-0.78857421875,
-0.393798828125,
-0.7490234375,
-0.13037109375,
-0.236083984375,
0.207763671875,
0.65283203125,
-0.382080078125,
-0.01503753662109375,
0.6650390625,
-0.10302734375,
0.52001953125,
-0.79638671875,
-0.60009765625,
0.1827392578125,
-0.86572265625,
-0.267578125,
0.102783203125,
0.66015625,
-0.196533203125,
0.41162109375,
-0.970703125,
0.0906982421875,
0.002105712890625,
0.34765625,
-0.1890869140625,
-0.61962890625,
-0.421142578125,
-0.88818359375,
-0.56298828125,
-0.67578125,
-0.62939453125,
0.07403564453125,
0.380615234375,
0.1837158203125,
-0.794921875,
0.15673828125,
0.953125,
-1.0703125,
0.81689453125,
-0.6416015625,
0.52294921875,
-0.76318359375,
-0.1611328125,
-0.69287109375,
0.164306640625,
-0.53369140625,
0.2353515625,
-0.626953125,
0.496826171875,
0.25439453125,
0.5,
-0.1807861328125,
0.391357421875,
-0.671875,
-0.0806884765625,
-0.12060546875,
0.397705078125,
-0.43115234375,
0.55224609375,
0.58837890625,
0.314697265625,
0.060302734375,
-0.27197265625,
-0.50439453125,
-0.7470703125,
0.4150390625,
0.186767578125,
-0.294677734375,
-0.2822265625,
-0.31201171875,
-0.1494140625,
-1.0537109375,
-0.02392578125,
0.02923583984375,
0.5400390625,
-0.0335693359375,
-0.28515625,
0.6298828125,
0.94970703125,
-0.50830078125,
0.54638671875,
0.305908203125,
-0.132080078125,
0.2491455078125,
0.5615234375,
0.241943359375,
0.437255859375,
-0.1690673828125,
-0.0816650390625,
-0.041778564453125,
0.46875,
0.256103515625,
0.287353515625,
-0.344970703125,
-0.46044921875,
-1.03125,
-0.1903076171875,
0.453369140625,
0.55322265625,
0.56396484375,
-0.546875,
-0.1573486328125,
-0.287841796875,
-0.7294921875,
0.400146484375,
-1.326171875,
-1.1630859375,
0.4189453125,
-0.10858154296875,
-0.5859375,
0.05712890625,
-0.6083984375,
-0.5068359375,
0.3515625,
0.422607421875,
-0.1666259765625,
-0.06524658203125,
-0.1702880859375,
0.47021484375,
-0.006160736083984375,
0.0005135536193847656,
-0.12261962890625,
0.60107421875,
-0.51806640625,
-0.71240234375,
-0.44384765625,
0.78564453125,
-0.01387786865234375,
-0.2919921875,
-0.7333984375,
0.438720703125,
-0.057159423828125,
0.04730224609375,
-0.385498046875,
0.416015625,
-0.1873779296875,
0.71630859375,
-0.79150390625,
0.09295654296875,
-0.07122802734375,
0.45849609375,
0.3046875,
-0.317138671875,
-0.1968994140625,
1.15234375,
0.5361328125,
-0.1319580078125,
0.55224609375,
-0.036590576171875,
0.362060546875,
-0.2203369140625,
-0.05987548828125,
-0.01511383056640625,
0.477783203125,
0.491943359375,
0.314697265625,
0.0689697265625,
0.226318359375,
0.64697265625,
0.09698486328125,
-0.21630859375,
0.399169921875,
0.39990234375,
0.02032470703125,
0.1805419921875,
-0.0289459228515625,
-0.2452392578125,
0.230224609375,
-0.212158203125,
0.51611328125,
-0.278564453125,
-0.08251953125,
-0.324951171875,
-0.5458984375,
1.0810546875,
-0.162109375,
-0.352783203125,
-0.114501953125,
-0.43994140625,
0.2646484375,
0.69921875,
-0.01099395751953125,
-0.0423583984375,
0.72607421875,
0.5654296875,
0.236083984375,
0.72265625,
0.615234375,
0.1435546875,
-0.483642578125,
-0.173095703125,
0.34765625,
0.11004638671875,
-0.403564453125,
-0.389892578125,
-0.90234375,
0.8505859375,
-0.309326171875,
-0.28271484375,
0.308837890625,
-1.0869140625,
-0.40576171875,
-0.444091796875,
0.99951171875,
-0.62451171875,
0.5986328125,
0.43212890625,
-0.4697265625,
-0.5322265625,
0.7392578125,
-0.12005615234375,
0.408203125,
0.2222900390625,
0.783203125,
0.398681640625,
1.375,
0.859375,
-0.171875,
0.224853515625,
0.391845703125,
-0.47021484375,
-0.203125,
-0.2322998046875,
-0.576171875,
-0.033233642578125,
-0.55712890625,
-0.7177734375,
0.04052734375,
0.76513671875,
0.049896240234375,
-0.71142578125,
-0.12396240234375,
0.595703125,
-0.521484375,
0.54052734375,
0.056396484375,
0.431884765625,
0.13525390625,
-0.1527099609375,
0.15869140625,
-0.62158203125,
0.078857421875,
-0.3681640625,
0.336669921875,
-0.53515625,
-0.462890625,
-0.60302734375,
-0.54541015625,
-0.26708984375,
-0.214111328125,
-0.0909423828125,
-0.8125,
0.6669921875,
0.55419921875,
0.451904296875,
0.473876953125,
-0.393798828125,
0.212646484375,
0.876953125,
0.99609375,
0.1405029296875,
1.00390625,
0.2021484375,
-0.342041015625,
-0.03778076171875,
-0.263427734375,
0.5068359375,
-0.12005615234375,
-0.336669921875,
-0.79052734375,
0.451171875,
-0.658203125,
-1.2490234375,
0.0180511474609375,
0.436767578125,
0.3974609375,
-0.63232421875,
-1.111328125,
-0.43701171875,
-0.492919921875,
-0.01947021484375,
-0.732421875,
0.693359375,
-0.0067596435546875,
-0.207763671875,
-0.08013916015625,
-1.2177734375,
4.38671875,
1.083984375,
0.67236328125,
0.293701171875,
0.420166015625,
1.234375,
0.580078125,
-0.51220703125,
0.0010652542114257812,
-0.55908203125,
0.322021484375,
-0.46826171875,
-0.224365234375,
0.80224609375,
0.46630859375,
0.5380859375,
-0.6689453125,
-0.05938720703125,
-0.0057373046875,
-1.0732421875,
-0.556640625,
0.06585693359375,
-0.0126953125,
0.33251953125,
0.30126953125,
0.0201568603515625,
0.783203125,
-1.1494140625,
-0.2193603515625,
-0.29248046875,
-0.07659912109375,
-0.65673828125,
0.64892578125,
-0.0032958984375,
-0.248046875,
0.6650390625,
-0.2335205078125,
-0.63134765625,
-0.29296875,
0.29443359375,
-0.2108154296875,
0.2464599609375,
0.39599609375,
-0.623046875,
0.11944580078125,
0.485595703125,
-0.7744140625,
0.55126953125,
0.12420654296875,
-1.0986328125,
1.1376953125,
-0.129638671875,
0.966796875,
-0.3876953125,
-0.419189453125,
-0.221435546875,
0.250732421875,
0.0670166015625,
0.055267333984375,
0.80322265625,
0.2425537109375,
0.240234375,
0.1629638671875,
0.779296875,
-1.080078125,
0.33642578125,
-0.1793212890625,
0.10333251953125,
-0.8935546875,
0.033050537109375,
-0.1746826171875,
-0.30126953125,
-0.2132568359375,
-0.236572265625,
0.9677734375,
0.25048828125,
-0.276123046875,
0.398193359375,
0.435546875,
-1.12109375,
0.1201171875,
-0.301025390625,
-0.1907958984375,
-0.51220703125,
0.57763671875,
1.240234375,
-0.841796875,
-0.2430419921875,
-0.371826171875,
0.67041015625,
0.458740234375,
0.787109375,
0.020782470703125,
-0.779296875,
-0.328125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
After the Search Ultimate program that searched for strings in a text failed, Igor K. got to think: "Why on Earth does my program work so slowly?" As he double-checked his code, he said: "My code contains no errors, yet I know how we will improve Search Ultimate!" and took a large book from the shelves. The book read "Azembler. Principally New Approach".
Having carefully thumbed through the book, Igor K. realised that, as it turns out, you can multiply the numbers dozens of times faster. "Search Ultimate will be faster than it has ever been!" — the fellow shouted happily and set to work.
Let us now clarify what Igor's idea was. The thing is that the code that was generated by a compiler was far from perfect. Standard multiplying does work slower than with the trick the book mentioned.
The Azembler language operates with 26 registers (eax, ebx, ..., ezx) and two commands:
* [x] — returns the value located in the address x. For example, [eax] returns the value that was located in the address, equal to the value in the register eax.
* lea x, y — assigns to the register x, indicated as the first operand, the second operand's address. Thus, for example, the "lea ebx, [eax]" command will write in the ebx register the content of the eax register: first the [eax] operation will be fulfilled, the result of it will be some value that lies in the address written in eax. But we do not need the value — the next operation will be lea, that will take the [eax] address, i.e., the value in the eax register, and will write it in ebx.
On the first thought the second operation seems meaningless, but as it turns out, it is acceptable to write the operation as
lea ecx, [eax + ebx],
lea ecx, [k*eax]
or even
lea ecx, [ebx + k*eax],
where k = 1, 2, 4 or 8.
As a result, the register ecx will be equal to the numbers eax + ebx, k*eax and ebx + k*eax correspondingly. However, such operation is fulfilled many times, dozens of times faster that the usual multiplying of numbers. And using several such operations, one can very quickly multiply some number by some other one. Of course, instead of eax, ebx and ecx you are allowed to use any registers.
For example, let the eax register contain some number that we should multiply by 41. It takes us 2 lines:
lea ebx, [eax + 4*eax] // now ebx = 5*eax
lea eax, [eax + 8*ebx] // now eax = eax + 8*ebx = 41*eax
Igor K. got interested in the following question: what is the minimum number of lea operations needed to multiply by the given number n and how to do it? Your task is to help him.
Consider that at the initial moment of time eax contains a number that Igor K. was about to multiply by n, and the registers from ebx to ezx contain number 0. At the final moment of time the result can be located in any register.
Input
The input data contain the only integer n (1 ≤ n ≤ 255), which Igor K. is about to multiply.
Output
On the first line print number p, which represents the minimum number of lea operations, needed to do that. Then print the program consisting of p commands, performing the operations. It is guaranteed that such program exists for any n from 1 to 255.
Use precisely the following format of commands (here k is equal to 1, 2, 4 or 8, and x, y and z are any, even coinciding registers):
lea x, [y]
lea x, [y + z]
lea x, [k*y]
lea x, [y + k*z]
Please note that extra spaces at the end of a command are unacceptable.
Examples
Input
41
Output
2
lea ebx, [eax + 4*eax]
lea ecx, [eax + 8*ebx]
Input
2
Output
1
lea ebx, [eax + eax]
Input
4
Output
1
lea ebx, [4*eax]
Tags: brute force, implementation
Correct Solution:
```
n=int(input())
mn=[float('inf')]*256
ans=""
done=set()
def gen(vals,st):
global mn,ans
if('|'.join([str(x) for x in vals]) in done):
return
done.add('|'.join([str(x) for x in vals]))
if(vals[-1]==n):
if(len(vals)<mn[n]):
mn[n]=len(vals)
ans=st
return
if(len(vals)>5):
return
md=set()
for i in range(len(vals)):
for z in [8,4,2,1]:
e=vals[i]*z
if(e>n):
continue
if(e in md):
continue
if(e>vals[-1]):
nw='e'+chr(ord('a')+len(vals))+'x'
I='e'+chr(ord('a')+i)+'x'
gen(vals+[e],st+"lea "+nw+", ["+str(z)+"*"+I+"]\n")
md.add(e)
for j in range(len(vals)):
for z in [8,4,2,1]:
e=vals[i]+z*vals[j]
if(e>n):
continue
if(e in md):
continue
if(e>vals[-1]):
nw='e'+chr(ord('a')+len(vals))+'x'
I='e'+chr(ord('a')+i)+'x'
J='e'+chr(ord('a')+j)+'x'
gen(vals+[e],st+"lea "+nw+", ["+I+" + "+str(z)+"*"+J+"]\n")
md.add(e)
gen([1],"")
print(ans.count("\n"))
print(ans,end="")
```
| 64,546
|
[
0.28955078125,
-0.3271484375,
-0.3662109375,
0.194580078125,
-0.383544921875,
-0.49755859375,
-0.02813720703125,
0.12249755859375,
-0.08355712890625,
0.71142578125,
0.65576171875,
-0.0810546875,
0.2486572265625,
-1.076171875,
-0.07879638671875,
-0.0235595703125,
-0.10003662109375,
-0.71484375,
-0.377685546875,
0.236572265625,
0.06024169921875,
-0.328125,
-1.26171875,
-0.15966796875,
-0.310791015625,
0.625,
0.461669921875,
-0.2177734375,
0.8896484375,
1.341796875,
-0.4521484375,
-0.395751953125,
0.333740234375,
-0.931640625,
-0.58837890625,
-0.6591796875,
0.12109375,
-0.818359375,
-0.47265625,
-0.50537109375,
0.1629638671875,
-0.69873046875,
0.36767578125,
-0.60009765625,
-1.3349609375,
-0.280517578125,
0.05303955078125,
-0.7685546875,
0.287353515625,
-0.346435546875,
0.2464599609375,
-0.505859375,
0.340087890625,
-0.10772705078125,
0.361328125,
0.36376953125,
0.005626678466796875,
0.1376953125,
-0.6484375,
0.2802734375,
0.4736328125,
0.187744140625,
0.037017822265625,
-0.9423828125,
0.197021484375,
0.1881103515625,
-0.45361328125,
-0.329345703125,
-0.170166015625,
-1.0244140625,
-0.11968994140625,
0.221435546875,
-0.6005859375,
-0.3369140625,
-0.497802734375,
0.258056640625,
0.1129150390625,
0.080322265625,
-0.591796875,
0.50390625,
0.453125,
0.70849609375,
0.2459716796875,
0.1319580078125,
-0.4033203125,
-0.72705078125,
-0.307861328125,
0.12286376953125,
0.0860595703125,
0.015655517578125,
-0.123779296875,
0.55078125,
-0.04229736328125,
0.193115234375,
1.0234375,
0.697265625,
-0.4189453125,
0.2919921875,
0.458740234375,
-0.1875,
0.556640625,
0.7001953125,
-0.3583984375,
0.80419921875,
-0.6513671875,
0.06341552734375,
0.1912841796875,
-0.20166015625,
-0.0408935546875,
-0.91064453125,
-0.341796875,
0.182861328125,
0.3271484375,
0.3486328125,
-0.157470703125,
0.6005859375,
-0.10577392578125,
0.10858154296875,
-0.7255859375,
0.2489013671875,
0.2305908203125,
0.08770751953125,
0.19580078125,
-0.183349609375,
0.1298828125,
-0.52734375,
-0.54443359375,
1.1689453125,
-0.8046875,
-0.07244873046875,
0.31005859375,
-0.004467010498046875,
-0.30419921875,
0.372314453125,
-0.1700439453125,
0.77294921875,
-0.067626953125,
0.364013671875,
0.8212890625,
-1.091796875,
0.87646484375,
-0.28466796875,
0.5537109375,
1.46875,
0.14111328125,
0.021240234375,
0.63427734375,
-0.1827392578125,
-0.97314453125,
0.1859130859375,
-0.63232421875,
0.488037109375,
-0.003185272216796875,
-0.1270751953125,
-0.35791015625,
0.365478515625,
-0.045166015625,
0.372802734375,
0.2291259765625,
-0.1593017578125,
-0.18798828125,
0.85205078125,
-0.42431640625,
0.7705078125,
-0.10064697265625,
0.4306640625,
-0.70703125,
-0.152587890625,
-0.03765869140625,
-0.61181640625,
0.11541748046875,
-0.10955810546875,
-0.09893798828125,
0.61279296875,
0.67431640625,
0.892578125,
1.072265625,
0.10675048828125,
0.54052734375,
0.51416015625,
-0.43359375,
0.11981201171875,
-0.0011453628540039062,
1.0703125,
0.340087890625,
-0.0211944580078125,
0.10333251953125,
-0.482177734375,
-0.306396484375,
-0.300537109375,
-0.007434844970703125,
0.58544921875,
-0.325927734375,
0.60107421875,
0.11395263671875,
0.51611328125,
-0.826171875,
0.05029296875,
0.00818634033203125,
-1.265625,
-0.390380859375,
0.69677734375,
-0.050445556640625,
0.62890625,
-0.04205322265625,
-0.61474609375,
0.10955810546875,
1.0107421875,
-0.2286376953125,
0.544921875,
0.86376953125,
0.1031494140625,
-0.1568603515625,
0.256591796875,
0.35400390625,
0.1380615234375,
-0.39453125,
0.58349609375,
-0.04425048828125,
0.036163330078125,
0.152099609375,
0.69384765625,
0.39453125,
0.1689453125,
-0.2069091796875,
-0.181884765625,
0.46484375,
1.203125,
0.2025146484375,
0.272216796875,
-0.051300048828125,
0.626953125,
0.21533203125,
0.86083984375,
0.447265625,
0.11553955078125,
0.82177734375,
0.51513671875,
-0.21923828125,
0.29345703125,
-0.07666015625,
0.619140625,
0.55419921875,
0.73681640625,
-0.20556640625,
0.059906005859375,
-0.1641845703125,
-0.16357421875,
-0.43505859375,
0.5732421875,
0.1796875,
0.76611328125,
0.0491943359375,
0.1025390625,
-0.64794921875,
-0.256591796875,
0.54296875,
0.54443359375,
-1.0712890625,
-0.5615234375,
0.099853515625,
0.058929443359375,
0.51806640625,
-0.23583984375,
0.322998046875,
0.5712890625,
0.27685546875,
0.671875,
-0.521484375,
-0.70556640625,
-0.51513671875,
-0.8408203125,
-0.80712890625,
-0.58984375,
-0.59765625,
-0.1639404296875,
0.11993408203125,
-0.44091796875,
0.46337890625,
-0.401611328125,
0.326171875,
-0.2105712890625,
-0.59814453125,
0.7900390625,
-0.05694580078125,
0.83251953125,
-0.57568359375,
1.068359375,
0.060455322265625,
0.779296875,
-0.38818359375,
0.01067352294921875,
-0.431640625,
-0.55419921875,
0.417236328125,
0.033447265625,
0.78369140625,
0.41064453125,
-0.86865234375,
-0.421875,
-0.74609375,
-0.232666015625,
-0.48046875,
0.0163116455078125,
-0.461669921875,
1.111328125,
0.021453857421875,
-0.99267578125,
0.57080078125,
0.89892578125,
-1.185546875,
0.69189453125,
-0.0599365234375,
0.1068115234375,
-0.8037109375,
1.0712890625,
0.48779296875,
0.20947265625,
-0.4033203125,
-0.2252197265625,
0.1556396484375,
-0.2008056640625,
0.0233917236328125,
-0.483154296875,
-0.79248046875,
0.40380859375,
0.365966796875,
-0.9453125,
0.6708984375,
-0.875,
-0.5693359375,
-0.2447509765625,
-0.71630859375,
0.77685546875,
0.327392578125,
-0.40771484375,
-0.07080078125,
-0.0098419189453125,
0.05645751953125,
0.2196044921875,
0.331787109375,
-0.5859375,
0.07818603515625,
0.4990234375,
0.1234130859375,
0.251953125,
0.0038623809814453125,
-0.53955078125,
-0.059661865234375,
-0.4716796875,
-0.0225677490234375,
0.63134765625,
0.240234375,
0.1015625,
0.245849609375,
0.6103515625,
-0.912109375,
-0.56689453125,
-0.04095458984375,
0.67041015625,
0.427978515625,
0.42529296875,
0.271240234375,
-0.328857421875,
-0.263916015625,
-0.515625,
0.49853515625,
0.17529296875,
0.50927734375,
-0.4736328125,
0.5341796875,
0.115478515625,
-0.75732421875,
0.8330078125,
-0.386474609375,
-0.048553466796875,
0.9248046875,
-0.1988525390625,
0.64892578125,
-0.57763671875,
0.37158203125,
-0.2861328125,
0.0831298828125,
0.64794921875,
0.1788330078125,
0.448486328125,
-0.44970703125,
-0.70166015625,
-0.09661865234375,
0.197021484375,
0.05419921875,
-0.239501953125,
0.169921875,
-0.57421875,
-0.063232421875,
-1.13671875,
0.88134765625,
0.3583984375,
0.41796875,
0.106201171875,
0.55859375,
-0.003116607666015625,
0.4150390625,
0.315185546875,
-0.1358642578125,
0.10260009765625,
-0.61083984375,
0.3291015625,
0.07562255859375,
-0.27685546875,
-0.306396484375,
-0.34716796875,
-0.529296875,
0.3935546875,
-0.093994140625,
0.2249755859375,
-0.72705078125,
-0.1827392578125,
-0.09979248046875,
0.68017578125,
-0.38232421875,
-0.66259765625,
-0.422607421875,
0.625,
0.265625,
-1.0361328125,
-0.104736328125,
-0.68115234375,
0.1983642578125,
0.43798828125,
-0.09228515625,
-0.0270538330078125,
-0.63134765625,
-1.01953125,
-0.6904296875,
0.29052734375,
0.69189453125,
0.140625,
0.05242919921875,
-1.1943359375,
0.353271484375,
0.1295166015625,
-0.414794921875,
0.233154296875,
-0.145263671875,
0.0596923828125,
0.034576416015625,
0.78369140625,
-0.2418212890625,
-0.370361328125,
0.439208984375,
-1.255859375,
0.8740234375,
-0.2154541015625,
0.35986328125,
-0.1224365234375,
-0.2310791015625,
0.1322021484375,
0.1343994140625,
-0.2425537109375,
-0.153076171875,
-0.2037353515625,
0.50927734375,
-0.626953125,
-0.7919921875,
0.2841796875,
0.057281494140625,
-0.1580810546875,
0.7900390625,
-0.09326171875,
-0.25048828125,
0.181884765625,
0.326416015625,
-0.724609375,
0.677734375,
-0.446533203125,
0.056060791015625,
-0.029937744140625,
-0.1719970703125,
-0.1900634765625,
-0.51025390625,
0.63818359375,
0.296142578125,
-0.873046875,
-0.708984375,
-0.8603515625,
-0.1597900390625,
0.1312255859375,
-0.48095703125,
0.39013671875,
-0.09576416015625,
-0.0416259765625,
0.68310546875,
-0.3134765625,
-0.56103515625,
-0.304443359375,
-0.537109375,
-0.1070556640625,
0.6669921875,
0.27978515625,
0.77392578125,
-0.2467041015625,
-0.124267578125,
-0.2391357421875,
-0.1614990234375,
0.120849609375,
-0.61865234375,
0.0219879150390625,
-0.054595947265625,
-0.041839599609375,
-0.3857421875,
0.1983642578125,
-0.09515380859375,
0.4365234375,
0.77294921875,
0.33740234375,
0.52880859375,
0.45458984375,
-0.65869140625,
0.90966796875,
0.06048583984375,
-0.97216796875,
-0.65625,
0.67578125,
-0.1517333984375,
0.57373046875,
0.339111328125,
-0.6044921875,
-0.56884765625,
-1.2255859375,
0.1239013671875,
-0.61572265625,
-0.473876953125,
-0.72607421875,
-0.619140625,
-0.3662109375,
0.5234375,
0.2744140625,
-0.97802734375,
-0.179931640625,
-0.9072265625,
-0.0850830078125,
-0.76953125,
-0.2283935546875,
-0.324462890625,
-0.455810546875,
-0.1707763671875,
0.9287109375,
-0.20654296875,
0.36767578125,
-0.2125244140625,
0.2177734375,
0.64599609375,
-0.212646484375,
-0.85595703125,
-0.533203125,
-0.06695556640625,
-0.025146484375,
-0.150146484375,
0.41015625,
-0.499267578125,
0.56884765625,
-0.97021484375,
0.338623046875,
-0.09124755859375,
0.2303466796875,
-0.327392578125,
-0.4638671875,
0.990234375,
-0.2183837890625,
0.383056640625,
-0.31201171875,
0.78076171875,
0.82080078125,
-0.06463623046875,
-0.8837890625,
-0.256103515625,
-0.72119140625,
-0.92822265625,
0.4580078125,
-0.48046875,
-0.028106689453125,
-0.57763671875,
-0.0137481689453125,
0.66162109375,
-0.2313232421875,
0.323486328125,
0.93310546875,
0.364990234375,
0.4638671875,
-0.83203125,
0.386962890625,
0.623046875,
-0.236083984375,
0.1334228515625,
0.33056640625,
-0.55859375,
-0.127197265625,
-0.436767578125,
-0.77294921875,
-0.634765625,
0.046112060546875,
1.0078125,
-0.218505859375,
1.275390625,
-0.043975830078125,
-0.99755859375,
-0.34228515625,
0.82861328125,
-0.310546875,
-0.07940673828125,
0.63671875,
0.299072265625,
0.321044921875,
0.06396484375,
-0.1361083984375,
-0.244873046875,
-0.53369140625,
0.94580078125,
-0.39892578125,
-0.402099609375,
1.171875,
0.92822265625,
-1.005859375,
-0.97802734375,
-0.0587158203125,
0.006374359130859375,
0.0821533203125,
-0.642578125,
0.5009765625,
0.19873046875,
-0.451416015625,
0.240966796875,
0.3828125,
-0.12335205078125,
0.3662109375,
0.2476806640625,
0.1376953125,
-0.82421875,
-0.040191650390625,
0.64697265625,
-0.233154296875,
-0.63134765625,
-0.418701171875,
-0.085693359375,
-0.12432861328125,
-0.11370849609375,
0.8759765625,
-0.1959228515625,
0.364013671875,
0.304931640625,
-0.046539306640625,
0.48974609375,
-0.49072265625,
-0.59814453125,
0.13818359375,
-0.46630859375,
-0.75439453125,
-0.28076171875,
0.1435546875,
-0.0247802734375,
0.443359375,
-0.61572265625,
0.24267578125,
0.59423828125,
0.19287109375,
-0.51953125,
-0.7275390625,
-0.41845703125,
-0.9384765625,
-0.5498046875,
-0.1339111328125,
-0.47119140625,
-0.146484375,
0.207763671875,
0.051025390625,
-0.80322265625,
-0.050323486328125,
0.615234375,
-0.666015625,
0.0090484619140625,
-0.6416015625,
0.53662109375,
-0.51953125,
-0.2137451171875,
-0.3837890625,
0.006694793701171875,
-0.150146484375,
-0.54052734375,
-0.763671875,
0.313232421875,
-0.1004638671875,
0.152587890625,
-0.31787109375,
-0.26318359375,
-0.153076171875,
-0.416748046875,
-0.002925872802734375,
0.138916015625,
-0.52197265625,
0.85009765625,
0.51025390625,
-0.42041015625,
0.4189453125,
-0.338623046875,
-0.452880859375,
-0.217529296875,
0.5458984375,
0.374267578125,
-0.3037109375,
-0.448486328125,
-0.444580078125,
0.26025390625,
-1.140625,
0.78564453125,
-0.2427978515625,
0.31591796875,
-0.0933837890625,
-0.20654296875,
0.625,
0.953125,
0.01074981689453125,
0.47216796875,
0.335693359375,
0.05633544921875,
0.427978515625,
0.354736328125,
-0.3662109375,
0.45068359375,
-0.203125,
-0.5849609375,
-0.01374053955078125,
0.54248046875,
-0.441650390625,
0.2138671875,
-0.0186920166015625,
-0.73095703125,
-0.8720703125,
-0.479736328125,
-0.05645751953125,
0.53076171875,
0.6904296875,
-0.358642578125,
-0.1602783203125,
0.1307373046875,
-0.9150390625,
0.1671142578125,
-0.97265625,
-0.84619140625,
0.32177734375,
-0.172119140625,
-0.348876953125,
-0.007740020751953125,
-0.51806640625,
-0.00417327880859375,
0.31982421875,
0.222412109375,
-0.39501953125,
0.0919189453125,
0.2230224609375,
0.3525390625,
-0.0985107421875,
-0.08099365234375,
-0.27685546875,
0.497314453125,
-0.69580078125,
-0.8876953125,
-0.2509765625,
0.95751953125,
0.08404541015625,
0.23828125,
-0.587890625,
0.2452392578125,
0.343505859375,
0.10260009765625,
-0.57958984375,
0.2459716796875,
-0.42822265625,
0.8408203125,
-0.9267578125,
0.08526611328125,
-0.052764892578125,
0.1923828125,
-0.189697265625,
-0.09619140625,
-0.75146484375,
0.86279296875,
0.97265625,
0.0175018310546875,
0.441650390625,
0.34033203125,
0.67236328125,
0.020751953125,
-0.27001953125,
-0.56787109375,
0.873046875,
0.5625,
0.459716796875,
-0.129638671875,
0.34912109375,
0.814453125,
-0.282958984375,
-0.00579833984375,
0.58251953125,
0.482666015625,
-0.63720703125,
0.1900634765625,
-0.160400390625,
0.335205078125,
0.07965087890625,
-0.43359375,
0.07391357421875,
-0.256591796875,
0.031524658203125,
-0.08880615234375,
-0.8037109375,
0.58642578125,
-0.30712890625,
-0.443359375,
0.1297607421875,
-0.184814453125,
0.55615234375,
0.4794921875,
0.08648681640625,
-0.280517578125,
0.81982421875,
0.85009765625,
0.60693359375,
0.364990234375,
0.2288818359375,
0.49365234375,
-0.180908203125,
0.1666259765625,
0.30712890625,
0.251220703125,
-0.25146484375,
-0.345703125,
-0.93408203125,
0.53369140625,
-0.44873046875,
-0.55859375,
0.2493896484375,
-0.47119140625,
0.0361328125,
-0.7412109375,
0.8818359375,
-0.88818359375,
0.075927734375,
0.416259765625,
-0.206298828125,
-0.270263671875,
0.58544921875,
-0.07684326171875,
0.51513671875,
0.356689453125,
0.95068359375,
-0.2137451171875,
1.5751953125,
0.61376953125,
-0.2890625,
-0.186279296875,
0.2357177734375,
-0.047882080078125,
-0.64111328125,
-0.06866455078125,
-0.63720703125,
0.0902099609375,
-0.1064453125,
-0.765625,
0.0110015869140625,
0.55224609375,
0.11212158203125,
-1.197265625,
-0.416015625,
0.224853515625,
-0.71435546875,
0.401611328125,
0.50048828125,
0.57373046875,
0.5537109375,
-0.583984375,
-0.391357421875,
-0.73193359375,
-0.1234130859375,
-0.1568603515625,
0.697265625,
-0.591796875,
-0.434326171875,
-0.480224609375,
-0.363037109375,
-0.6025390625,
0.1558837890625,
-0.453857421875,
-0.4287109375,
0.6826171875,
0.47802734375,
0.1973876953125,
0.53125,
-0.1390380859375,
0.452880859375,
1.14453125,
1.005859375,
-0.287841796875,
0.9599609375,
0.3388671875,
0.03289794921875,
0.03167724609375,
-0.47607421875,
0.6484375,
-0.29052734375,
-0.022430419921875,
-0.1949462890625,
0.35791015625,
-0.325439453125,
-1.3486328125,
0.2027587890625,
0.59619140625,
0.279541015625,
-0.63818359375,
-1.138671875,
-0.31689453125,
-0.85546875,
-0.29736328125,
-0.46337890625,
0.94921875,
0.1375732421875,
-0.083984375,
-0.069091796875,
-0.69970703125,
4.5703125,
0.8974609375,
0.73974609375,
0.55810546875,
0.357666015625,
1.072265625,
0.87060546875,
-0.42724609375,
-0.0877685546875,
-0.755859375,
0.1505126953125,
-0.0159912109375,
0.2587890625,
0.904296875,
0.499267578125,
0.391357421875,
-0.5166015625,
-0.0531005859375,
-0.0203094482421875,
-0.80322265625,
-0.67724609375,
0.057159423828125,
0.1363525390625,
0.4658203125,
-0.033935546875,
0.32275390625,
0.456298828125,
-0.98046875,
-0.5400390625,
-0.8505859375,
0.28857421875,
-0.236083984375,
0.818359375,
-0.1070556640625,
-0.609375,
0.7197265625,
-0.17626953125,
-0.30517578125,
-0.453857421875,
0.109619140625,
-0.2464599609375,
0.040130615234375,
0.14599609375,
-0.76708984375,
0.051513671875,
0.603515625,
-0.70263671875,
0.167724609375,
0.2171630859375,
-0.759765625,
0.69921875,
-0.2978515625,
0.5986328125,
-0.21240234375,
-0.80859375,
0.242919921875,
0.488525390625,
-0.353271484375,
-0.5546875,
0.6943359375,
0.51904296875,
0.03936767578125,
0.1436767578125,
0.8427734375,
-0.76220703125,
0.325927734375,
-0.5732421875,
0.84375,
-0.62451171875,
0.250244140625,
-0.32421875,
-0.2744140625,
-0.1103515625,
-0.26171875,
0.787109375,
0.07147216796875,
-0.467529296875,
0.449951171875,
0.201171875,
-0.58251953125,
0.056640625,
-0.262939453125,
-0.180419921875,
-0.48583984375,
0.86376953125,
0.443115234375,
-0.7412109375,
-0.53662109375,
-0.16162109375,
0.7529296875,
0.7109375,
0.427978515625,
0.0169219970703125,
-0.90869140625,
-0.1866455078125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
After the Search Ultimate program that searched for strings in a text failed, Igor K. got to think: "Why on Earth does my program work so slowly?" As he double-checked his code, he said: "My code contains no errors, yet I know how we will improve Search Ultimate!" and took a large book from the shelves. The book read "Azembler. Principally New Approach".
Having carefully thumbed through the book, Igor K. realised that, as it turns out, you can multiply the numbers dozens of times faster. "Search Ultimate will be faster than it has ever been!" — the fellow shouted happily and set to work.
Let us now clarify what Igor's idea was. The thing is that the code that was generated by a compiler was far from perfect. Standard multiplying does work slower than with the trick the book mentioned.
The Azembler language operates with 26 registers (eax, ebx, ..., ezx) and two commands:
* [x] — returns the value located in the address x. For example, [eax] returns the value that was located in the address, equal to the value in the register eax.
* lea x, y — assigns to the register x, indicated as the first operand, the second operand's address. Thus, for example, the "lea ebx, [eax]" command will write in the ebx register the content of the eax register: first the [eax] operation will be fulfilled, the result of it will be some value that lies in the address written in eax. But we do not need the value — the next operation will be lea, that will take the [eax] address, i.e., the value in the eax register, and will write it in ebx.
On the first thought the second operation seems meaningless, but as it turns out, it is acceptable to write the operation as
lea ecx, [eax + ebx],
lea ecx, [k*eax]
or even
lea ecx, [ebx + k*eax],
where k = 1, 2, 4 or 8.
As a result, the register ecx will be equal to the numbers eax + ebx, k*eax and ebx + k*eax correspondingly. However, such operation is fulfilled many times, dozens of times faster that the usual multiplying of numbers. And using several such operations, one can very quickly multiply some number by some other one. Of course, instead of eax, ebx and ecx you are allowed to use any registers.
For example, let the eax register contain some number that we should multiply by 41. It takes us 2 lines:
lea ebx, [eax + 4*eax] // now ebx = 5*eax
lea eax, [eax + 8*ebx] // now eax = eax + 8*ebx = 41*eax
Igor K. got interested in the following question: what is the minimum number of lea operations needed to multiply by the given number n and how to do it? Your task is to help him.
Consider that at the initial moment of time eax contains a number that Igor K. was about to multiply by n, and the registers from ebx to ezx contain number 0. At the final moment of time the result can be located in any register.
Input
The input data contain the only integer n (1 ≤ n ≤ 255), which Igor K. is about to multiply.
Output
On the first line print number p, which represents the minimum number of lea operations, needed to do that. Then print the program consisting of p commands, performing the operations. It is guaranteed that such program exists for any n from 1 to 255.
Use precisely the following format of commands (here k is equal to 1, 2, 4 or 8, and x, y and z are any, even coinciding registers):
lea x, [y]
lea x, [y + z]
lea x, [k*y]
lea x, [y + k*z]
Please note that extra spaces at the end of a command are unacceptable.
Examples
Input
41
Output
2
lea ebx, [eax + 4*eax]
lea ecx, [eax + 8*ebx]
Input
2
Output
1
lea ebx, [eax + eax]
Input
4
Output
1
lea ebx, [4*eax]
Tags: brute force, implementation
Correct Solution:
```
n=int(input())
mn=[float('inf')]*256
ans=""
done=set()
def gen(vals,st):
global mn,ans
#print(*vals)
if('|'.join([str(x) for x in vals]) in done):
return
done.add('|'.join([str(x) for x in vals]))
if(vals[-1]==n):
if(len(vals)<mn[n]):
mn[n]=len(vals)
ans=st
return
if(len(vals)>5):
return
"""if(len(vals)-2>mn[vals[-1]]):
return
mn[vals[-1]]=len(vals)"""
for i in range(len(vals)):
for z in [8,4,2,1]:
e=vals[i]*z
if(e>n):
continue
if(e>vals[-1]):
nw='e'+chr(ord('a')+len(vals))+'x'
I='e'+chr(ord('a')+i)+'x'
gen(vals+[e],st+"lea "+nw+", ["+str(z)+"*"+I+"]\n")
for j in range(len(vals)):
for z in [8,4,2,1]:
e=vals[i]+z*vals[j]
if(e>n):
continue
if(e>vals[-1]):
nw='e'+chr(ord('a')+len(vals))+'x'
I='e'+chr(ord('a')+i)+'x'
J='e'+chr(ord('a')+j)+'x'
gen(vals+[e],st+"lea "+nw+", ["+I+" + "+str(z)+"*"+J+"]\n")
gen([1],"")
print(ans.count("\n"))
print(ans,end="")
```
| 64,547
|
[
0.28955078125,
-0.3271484375,
-0.3662109375,
0.194580078125,
-0.383544921875,
-0.49755859375,
-0.02813720703125,
0.12249755859375,
-0.08355712890625,
0.71142578125,
0.65576171875,
-0.0810546875,
0.2486572265625,
-1.076171875,
-0.07879638671875,
-0.0235595703125,
-0.10003662109375,
-0.71484375,
-0.377685546875,
0.236572265625,
0.06024169921875,
-0.328125,
-1.26171875,
-0.15966796875,
-0.310791015625,
0.625,
0.461669921875,
-0.2177734375,
0.8896484375,
1.341796875,
-0.4521484375,
-0.395751953125,
0.333740234375,
-0.931640625,
-0.58837890625,
-0.6591796875,
0.12109375,
-0.818359375,
-0.47265625,
-0.50537109375,
0.1629638671875,
-0.69873046875,
0.36767578125,
-0.60009765625,
-1.3349609375,
-0.280517578125,
0.05303955078125,
-0.7685546875,
0.287353515625,
-0.346435546875,
0.2464599609375,
-0.505859375,
0.340087890625,
-0.10772705078125,
0.361328125,
0.36376953125,
0.005626678466796875,
0.1376953125,
-0.6484375,
0.2802734375,
0.4736328125,
0.187744140625,
0.037017822265625,
-0.9423828125,
0.197021484375,
0.1881103515625,
-0.45361328125,
-0.329345703125,
-0.170166015625,
-1.0244140625,
-0.11968994140625,
0.221435546875,
-0.6005859375,
-0.3369140625,
-0.497802734375,
0.258056640625,
0.1129150390625,
0.080322265625,
-0.591796875,
0.50390625,
0.453125,
0.70849609375,
0.2459716796875,
0.1319580078125,
-0.4033203125,
-0.72705078125,
-0.307861328125,
0.12286376953125,
0.0860595703125,
0.015655517578125,
-0.123779296875,
0.55078125,
-0.04229736328125,
0.193115234375,
1.0234375,
0.697265625,
-0.4189453125,
0.2919921875,
0.458740234375,
-0.1875,
0.556640625,
0.7001953125,
-0.3583984375,
0.80419921875,
-0.6513671875,
0.06341552734375,
0.1912841796875,
-0.20166015625,
-0.0408935546875,
-0.91064453125,
-0.341796875,
0.182861328125,
0.3271484375,
0.3486328125,
-0.157470703125,
0.6005859375,
-0.10577392578125,
0.10858154296875,
-0.7255859375,
0.2489013671875,
0.2305908203125,
0.08770751953125,
0.19580078125,
-0.183349609375,
0.1298828125,
-0.52734375,
-0.54443359375,
1.1689453125,
-0.8046875,
-0.07244873046875,
0.31005859375,
-0.004467010498046875,
-0.30419921875,
0.372314453125,
-0.1700439453125,
0.77294921875,
-0.067626953125,
0.364013671875,
0.8212890625,
-1.091796875,
0.87646484375,
-0.28466796875,
0.5537109375,
1.46875,
0.14111328125,
0.021240234375,
0.63427734375,
-0.1827392578125,
-0.97314453125,
0.1859130859375,
-0.63232421875,
0.488037109375,
-0.003185272216796875,
-0.1270751953125,
-0.35791015625,
0.365478515625,
-0.045166015625,
0.372802734375,
0.2291259765625,
-0.1593017578125,
-0.18798828125,
0.85205078125,
-0.42431640625,
0.7705078125,
-0.10064697265625,
0.4306640625,
-0.70703125,
-0.152587890625,
-0.03765869140625,
-0.61181640625,
0.11541748046875,
-0.10955810546875,
-0.09893798828125,
0.61279296875,
0.67431640625,
0.892578125,
1.072265625,
0.10675048828125,
0.54052734375,
0.51416015625,
-0.43359375,
0.11981201171875,
-0.0011453628540039062,
1.0703125,
0.340087890625,
-0.0211944580078125,
0.10333251953125,
-0.482177734375,
-0.306396484375,
-0.300537109375,
-0.007434844970703125,
0.58544921875,
-0.325927734375,
0.60107421875,
0.11395263671875,
0.51611328125,
-0.826171875,
0.05029296875,
0.00818634033203125,
-1.265625,
-0.390380859375,
0.69677734375,
-0.050445556640625,
0.62890625,
-0.04205322265625,
-0.61474609375,
0.10955810546875,
1.0107421875,
-0.2286376953125,
0.544921875,
0.86376953125,
0.1031494140625,
-0.1568603515625,
0.256591796875,
0.35400390625,
0.1380615234375,
-0.39453125,
0.58349609375,
-0.04425048828125,
0.036163330078125,
0.152099609375,
0.69384765625,
0.39453125,
0.1689453125,
-0.2069091796875,
-0.181884765625,
0.46484375,
1.203125,
0.2025146484375,
0.272216796875,
-0.051300048828125,
0.626953125,
0.21533203125,
0.86083984375,
0.447265625,
0.11553955078125,
0.82177734375,
0.51513671875,
-0.21923828125,
0.29345703125,
-0.07666015625,
0.619140625,
0.55419921875,
0.73681640625,
-0.20556640625,
0.059906005859375,
-0.1641845703125,
-0.16357421875,
-0.43505859375,
0.5732421875,
0.1796875,
0.76611328125,
0.0491943359375,
0.1025390625,
-0.64794921875,
-0.256591796875,
0.54296875,
0.54443359375,
-1.0712890625,
-0.5615234375,
0.099853515625,
0.058929443359375,
0.51806640625,
-0.23583984375,
0.322998046875,
0.5712890625,
0.27685546875,
0.671875,
-0.521484375,
-0.70556640625,
-0.51513671875,
-0.8408203125,
-0.80712890625,
-0.58984375,
-0.59765625,
-0.1639404296875,
0.11993408203125,
-0.44091796875,
0.46337890625,
-0.401611328125,
0.326171875,
-0.2105712890625,
-0.59814453125,
0.7900390625,
-0.05694580078125,
0.83251953125,
-0.57568359375,
1.068359375,
0.060455322265625,
0.779296875,
-0.38818359375,
0.01067352294921875,
-0.431640625,
-0.55419921875,
0.417236328125,
0.033447265625,
0.78369140625,
0.41064453125,
-0.86865234375,
-0.421875,
-0.74609375,
-0.232666015625,
-0.48046875,
0.0163116455078125,
-0.461669921875,
1.111328125,
0.021453857421875,
-0.99267578125,
0.57080078125,
0.89892578125,
-1.185546875,
0.69189453125,
-0.0599365234375,
0.1068115234375,
-0.8037109375,
1.0712890625,
0.48779296875,
0.20947265625,
-0.4033203125,
-0.2252197265625,
0.1556396484375,
-0.2008056640625,
0.0233917236328125,
-0.483154296875,
-0.79248046875,
0.40380859375,
0.365966796875,
-0.9453125,
0.6708984375,
-0.875,
-0.5693359375,
-0.2447509765625,
-0.71630859375,
0.77685546875,
0.327392578125,
-0.40771484375,
-0.07080078125,
-0.0098419189453125,
0.05645751953125,
0.2196044921875,
0.331787109375,
-0.5859375,
0.07818603515625,
0.4990234375,
0.1234130859375,
0.251953125,
0.0038623809814453125,
-0.53955078125,
-0.059661865234375,
-0.4716796875,
-0.0225677490234375,
0.63134765625,
0.240234375,
0.1015625,
0.245849609375,
0.6103515625,
-0.912109375,
-0.56689453125,
-0.04095458984375,
0.67041015625,
0.427978515625,
0.42529296875,
0.271240234375,
-0.328857421875,
-0.263916015625,
-0.515625,
0.49853515625,
0.17529296875,
0.50927734375,
-0.4736328125,
0.5341796875,
0.115478515625,
-0.75732421875,
0.8330078125,
-0.386474609375,
-0.048553466796875,
0.9248046875,
-0.1988525390625,
0.64892578125,
-0.57763671875,
0.37158203125,
-0.2861328125,
0.0831298828125,
0.64794921875,
0.1788330078125,
0.448486328125,
-0.44970703125,
-0.70166015625,
-0.09661865234375,
0.197021484375,
0.05419921875,
-0.239501953125,
0.169921875,
-0.57421875,
-0.063232421875,
-1.13671875,
0.88134765625,
0.3583984375,
0.41796875,
0.106201171875,
0.55859375,
-0.003116607666015625,
0.4150390625,
0.315185546875,
-0.1358642578125,
0.10260009765625,
-0.61083984375,
0.3291015625,
0.07562255859375,
-0.27685546875,
-0.306396484375,
-0.34716796875,
-0.529296875,
0.3935546875,
-0.093994140625,
0.2249755859375,
-0.72705078125,
-0.1827392578125,
-0.09979248046875,
0.68017578125,
-0.38232421875,
-0.66259765625,
-0.422607421875,
0.625,
0.265625,
-1.0361328125,
-0.104736328125,
-0.68115234375,
0.1983642578125,
0.43798828125,
-0.09228515625,
-0.0270538330078125,
-0.63134765625,
-1.01953125,
-0.6904296875,
0.29052734375,
0.69189453125,
0.140625,
0.05242919921875,
-1.1943359375,
0.353271484375,
0.1295166015625,
-0.414794921875,
0.233154296875,
-0.145263671875,
0.0596923828125,
0.034576416015625,
0.78369140625,
-0.2418212890625,
-0.370361328125,
0.439208984375,
-1.255859375,
0.8740234375,
-0.2154541015625,
0.35986328125,
-0.1224365234375,
-0.2310791015625,
0.1322021484375,
0.1343994140625,
-0.2425537109375,
-0.153076171875,
-0.2037353515625,
0.50927734375,
-0.626953125,
-0.7919921875,
0.2841796875,
0.057281494140625,
-0.1580810546875,
0.7900390625,
-0.09326171875,
-0.25048828125,
0.181884765625,
0.326416015625,
-0.724609375,
0.677734375,
-0.446533203125,
0.056060791015625,
-0.029937744140625,
-0.1719970703125,
-0.1900634765625,
-0.51025390625,
0.63818359375,
0.296142578125,
-0.873046875,
-0.708984375,
-0.8603515625,
-0.1597900390625,
0.1312255859375,
-0.48095703125,
0.39013671875,
-0.09576416015625,
-0.0416259765625,
0.68310546875,
-0.3134765625,
-0.56103515625,
-0.304443359375,
-0.537109375,
-0.1070556640625,
0.6669921875,
0.27978515625,
0.77392578125,
-0.2467041015625,
-0.124267578125,
-0.2391357421875,
-0.1614990234375,
0.120849609375,
-0.61865234375,
0.0219879150390625,
-0.054595947265625,
-0.041839599609375,
-0.3857421875,
0.1983642578125,
-0.09515380859375,
0.4365234375,
0.77294921875,
0.33740234375,
0.52880859375,
0.45458984375,
-0.65869140625,
0.90966796875,
0.06048583984375,
-0.97216796875,
-0.65625,
0.67578125,
-0.1517333984375,
0.57373046875,
0.339111328125,
-0.6044921875,
-0.56884765625,
-1.2255859375,
0.1239013671875,
-0.61572265625,
-0.473876953125,
-0.72607421875,
-0.619140625,
-0.3662109375,
0.5234375,
0.2744140625,
-0.97802734375,
-0.179931640625,
-0.9072265625,
-0.0850830078125,
-0.76953125,
-0.2283935546875,
-0.324462890625,
-0.455810546875,
-0.1707763671875,
0.9287109375,
-0.20654296875,
0.36767578125,
-0.2125244140625,
0.2177734375,
0.64599609375,
-0.212646484375,
-0.85595703125,
-0.533203125,
-0.06695556640625,
-0.025146484375,
-0.150146484375,
0.41015625,
-0.499267578125,
0.56884765625,
-0.97021484375,
0.338623046875,
-0.09124755859375,
0.2303466796875,
-0.327392578125,
-0.4638671875,
0.990234375,
-0.2183837890625,
0.383056640625,
-0.31201171875,
0.78076171875,
0.82080078125,
-0.06463623046875,
-0.8837890625,
-0.256103515625,
-0.72119140625,
-0.92822265625,
0.4580078125,
-0.48046875,
-0.028106689453125,
-0.57763671875,
-0.0137481689453125,
0.66162109375,
-0.2313232421875,
0.323486328125,
0.93310546875,
0.364990234375,
0.4638671875,
-0.83203125,
0.386962890625,
0.623046875,
-0.236083984375,
0.1334228515625,
0.33056640625,
-0.55859375,
-0.127197265625,
-0.436767578125,
-0.77294921875,
-0.634765625,
0.046112060546875,
1.0078125,
-0.218505859375,
1.275390625,
-0.043975830078125,
-0.99755859375,
-0.34228515625,
0.82861328125,
-0.310546875,
-0.07940673828125,
0.63671875,
0.299072265625,
0.321044921875,
0.06396484375,
-0.1361083984375,
-0.244873046875,
-0.53369140625,
0.94580078125,
-0.39892578125,
-0.402099609375,
1.171875,
0.92822265625,
-1.005859375,
-0.97802734375,
-0.0587158203125,
0.006374359130859375,
0.0821533203125,
-0.642578125,
0.5009765625,
0.19873046875,
-0.451416015625,
0.240966796875,
0.3828125,
-0.12335205078125,
0.3662109375,
0.2476806640625,
0.1376953125,
-0.82421875,
-0.040191650390625,
0.64697265625,
-0.233154296875,
-0.63134765625,
-0.418701171875,
-0.085693359375,
-0.12432861328125,
-0.11370849609375,
0.8759765625,
-0.1959228515625,
0.364013671875,
0.304931640625,
-0.046539306640625,
0.48974609375,
-0.49072265625,
-0.59814453125,
0.13818359375,
-0.46630859375,
-0.75439453125,
-0.28076171875,
0.1435546875,
-0.0247802734375,
0.443359375,
-0.61572265625,
0.24267578125,
0.59423828125,
0.19287109375,
-0.51953125,
-0.7275390625,
-0.41845703125,
-0.9384765625,
-0.5498046875,
-0.1339111328125,
-0.47119140625,
-0.146484375,
0.207763671875,
0.051025390625,
-0.80322265625,
-0.050323486328125,
0.615234375,
-0.666015625,
0.0090484619140625,
-0.6416015625,
0.53662109375,
-0.51953125,
-0.2137451171875,
-0.3837890625,
0.006694793701171875,
-0.150146484375,
-0.54052734375,
-0.763671875,
0.313232421875,
-0.1004638671875,
0.152587890625,
-0.31787109375,
-0.26318359375,
-0.153076171875,
-0.416748046875,
-0.002925872802734375,
0.138916015625,
-0.52197265625,
0.85009765625,
0.51025390625,
-0.42041015625,
0.4189453125,
-0.338623046875,
-0.452880859375,
-0.217529296875,
0.5458984375,
0.374267578125,
-0.3037109375,
-0.448486328125,
-0.444580078125,
0.26025390625,
-1.140625,
0.78564453125,
-0.2427978515625,
0.31591796875,
-0.0933837890625,
-0.20654296875,
0.625,
0.953125,
0.01074981689453125,
0.47216796875,
0.335693359375,
0.05633544921875,
0.427978515625,
0.354736328125,
-0.3662109375,
0.45068359375,
-0.203125,
-0.5849609375,
-0.01374053955078125,
0.54248046875,
-0.441650390625,
0.2138671875,
-0.0186920166015625,
-0.73095703125,
-0.8720703125,
-0.479736328125,
-0.05645751953125,
0.53076171875,
0.6904296875,
-0.358642578125,
-0.1602783203125,
0.1307373046875,
-0.9150390625,
0.1671142578125,
-0.97265625,
-0.84619140625,
0.32177734375,
-0.172119140625,
-0.348876953125,
-0.007740020751953125,
-0.51806640625,
-0.00417327880859375,
0.31982421875,
0.222412109375,
-0.39501953125,
0.0919189453125,
0.2230224609375,
0.3525390625,
-0.0985107421875,
-0.08099365234375,
-0.27685546875,
0.497314453125,
-0.69580078125,
-0.8876953125,
-0.2509765625,
0.95751953125,
0.08404541015625,
0.23828125,
-0.587890625,
0.2452392578125,
0.343505859375,
0.10260009765625,
-0.57958984375,
0.2459716796875,
-0.42822265625,
0.8408203125,
-0.9267578125,
0.08526611328125,
-0.052764892578125,
0.1923828125,
-0.189697265625,
-0.09619140625,
-0.75146484375,
0.86279296875,
0.97265625,
0.0175018310546875,
0.441650390625,
0.34033203125,
0.67236328125,
0.020751953125,
-0.27001953125,
-0.56787109375,
0.873046875,
0.5625,
0.459716796875,
-0.129638671875,
0.34912109375,
0.814453125,
-0.282958984375,
-0.00579833984375,
0.58251953125,
0.482666015625,
-0.63720703125,
0.1900634765625,
-0.160400390625,
0.335205078125,
0.07965087890625,
-0.43359375,
0.07391357421875,
-0.256591796875,
0.031524658203125,
-0.08880615234375,
-0.8037109375,
0.58642578125,
-0.30712890625,
-0.443359375,
0.1297607421875,
-0.184814453125,
0.55615234375,
0.4794921875,
0.08648681640625,
-0.280517578125,
0.81982421875,
0.85009765625,
0.60693359375,
0.364990234375,
0.2288818359375,
0.49365234375,
-0.180908203125,
0.1666259765625,
0.30712890625,
0.251220703125,
-0.25146484375,
-0.345703125,
-0.93408203125,
0.53369140625,
-0.44873046875,
-0.55859375,
0.2493896484375,
-0.47119140625,
0.0361328125,
-0.7412109375,
0.8818359375,
-0.88818359375,
0.075927734375,
0.416259765625,
-0.206298828125,
-0.270263671875,
0.58544921875,
-0.07684326171875,
0.51513671875,
0.356689453125,
0.95068359375,
-0.2137451171875,
1.5751953125,
0.61376953125,
-0.2890625,
-0.186279296875,
0.2357177734375,
-0.047882080078125,
-0.64111328125,
-0.06866455078125,
-0.63720703125,
0.0902099609375,
-0.1064453125,
-0.765625,
0.0110015869140625,
0.55224609375,
0.11212158203125,
-1.197265625,
-0.416015625,
0.224853515625,
-0.71435546875,
0.401611328125,
0.50048828125,
0.57373046875,
0.5537109375,
-0.583984375,
-0.391357421875,
-0.73193359375,
-0.1234130859375,
-0.1568603515625,
0.697265625,
-0.591796875,
-0.434326171875,
-0.480224609375,
-0.363037109375,
-0.6025390625,
0.1558837890625,
-0.453857421875,
-0.4287109375,
0.6826171875,
0.47802734375,
0.1973876953125,
0.53125,
-0.1390380859375,
0.452880859375,
1.14453125,
1.005859375,
-0.287841796875,
0.9599609375,
0.3388671875,
0.03289794921875,
0.03167724609375,
-0.47607421875,
0.6484375,
-0.29052734375,
-0.022430419921875,
-0.1949462890625,
0.35791015625,
-0.325439453125,
-1.3486328125,
0.2027587890625,
0.59619140625,
0.279541015625,
-0.63818359375,
-1.138671875,
-0.31689453125,
-0.85546875,
-0.29736328125,
-0.46337890625,
0.94921875,
0.1375732421875,
-0.083984375,
-0.069091796875,
-0.69970703125,
4.5703125,
0.8974609375,
0.73974609375,
0.55810546875,
0.357666015625,
1.072265625,
0.87060546875,
-0.42724609375,
-0.0877685546875,
-0.755859375,
0.1505126953125,
-0.0159912109375,
0.2587890625,
0.904296875,
0.499267578125,
0.391357421875,
-0.5166015625,
-0.0531005859375,
-0.0203094482421875,
-0.80322265625,
-0.67724609375,
0.057159423828125,
0.1363525390625,
0.4658203125,
-0.033935546875,
0.32275390625,
0.456298828125,
-0.98046875,
-0.5400390625,
-0.8505859375,
0.28857421875,
-0.236083984375,
0.818359375,
-0.1070556640625,
-0.609375,
0.7197265625,
-0.17626953125,
-0.30517578125,
-0.453857421875,
0.109619140625,
-0.2464599609375,
0.040130615234375,
0.14599609375,
-0.76708984375,
0.051513671875,
0.603515625,
-0.70263671875,
0.167724609375,
0.2171630859375,
-0.759765625,
0.69921875,
-0.2978515625,
0.5986328125,
-0.21240234375,
-0.80859375,
0.242919921875,
0.488525390625,
-0.353271484375,
-0.5546875,
0.6943359375,
0.51904296875,
0.03936767578125,
0.1436767578125,
0.8427734375,
-0.76220703125,
0.325927734375,
-0.5732421875,
0.84375,
-0.62451171875,
0.250244140625,
-0.32421875,
-0.2744140625,
-0.1103515625,
-0.26171875,
0.787109375,
0.07147216796875,
-0.467529296875,
0.449951171875,
0.201171875,
-0.58251953125,
0.056640625,
-0.262939453125,
-0.180419921875,
-0.48583984375,
0.86376953125,
0.443115234375,
-0.7412109375,
-0.53662109375,
-0.16162109375,
0.7529296875,
0.7109375,
0.427978515625,
0.0169219970703125,
-0.90869140625,
-0.1866455078125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After the Search Ultimate program that searched for strings in a text failed, Igor K. got to think: "Why on Earth does my program work so slowly?" As he double-checked his code, he said: "My code contains no errors, yet I know how we will improve Search Ultimate!" and took a large book from the shelves. The book read "Azembler. Principally New Approach".
Having carefully thumbed through the book, Igor K. realised that, as it turns out, you can multiply the numbers dozens of times faster. "Search Ultimate will be faster than it has ever been!" — the fellow shouted happily and set to work.
Let us now clarify what Igor's idea was. The thing is that the code that was generated by a compiler was far from perfect. Standard multiplying does work slower than with the trick the book mentioned.
The Azembler language operates with 26 registers (eax, ebx, ..., ezx) and two commands:
* [x] — returns the value located in the address x. For example, [eax] returns the value that was located in the address, equal to the value in the register eax.
* lea x, y — assigns to the register x, indicated as the first operand, the second operand's address. Thus, for example, the "lea ebx, [eax]" command will write in the ebx register the content of the eax register: first the [eax] operation will be fulfilled, the result of it will be some value that lies in the address written in eax. But we do not need the value — the next operation will be lea, that will take the [eax] address, i.e., the value in the eax register, and will write it in ebx.
On the first thought the second operation seems meaningless, but as it turns out, it is acceptable to write the operation as
lea ecx, [eax + ebx],
lea ecx, [k*eax]
or even
lea ecx, [ebx + k*eax],
where k = 1, 2, 4 or 8.
As a result, the register ecx will be equal to the numbers eax + ebx, k*eax and ebx + k*eax correspondingly. However, such operation is fulfilled many times, dozens of times faster that the usual multiplying of numbers. And using several such operations, one can very quickly multiply some number by some other one. Of course, instead of eax, ebx and ecx you are allowed to use any registers.
For example, let the eax register contain some number that we should multiply by 41. It takes us 2 lines:
lea ebx, [eax + 4*eax] // now ebx = 5*eax
lea eax, [eax + 8*ebx] // now eax = eax + 8*ebx = 41*eax
Igor K. got interested in the following question: what is the minimum number of lea operations needed to multiply by the given number n and how to do it? Your task is to help him.
Consider that at the initial moment of time eax contains a number that Igor K. was about to multiply by n, and the registers from ebx to ezx contain number 0. At the final moment of time the result can be located in any register.
Input
The input data contain the only integer n (1 ≤ n ≤ 255), which Igor K. is about to multiply.
Output
On the first line print number p, which represents the minimum number of lea operations, needed to do that. Then print the program consisting of p commands, performing the operations. It is guaranteed that such program exists for any n from 1 to 255.
Use precisely the following format of commands (here k is equal to 1, 2, 4 or 8, and x, y and z are any, even coinciding registers):
lea x, [y]
lea x, [y + z]
lea x, [k*y]
lea x, [y + k*z]
Please note that extra spaces at the end of a command are unacceptable.
Examples
Input
41
Output
2
lea ebx, [eax + 4*eax]
lea ecx, [eax + 8*ebx]
Input
2
Output
1
lea ebx, [eax + eax]
Input
4
Output
1
lea ebx, [4*eax]
Submitted Solution:
```
import sys
from array import array # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
n = int(input())
if n == 1:
print(0)
exit()
inf = 10**9
dp = [inf] * (n + 1)
dp[1] = 0
prev = [[-1, -1, -1, -1] for _ in range(n + 1)]
def ok():
path = []
used_num = {n}
stack = [n]
while stack:
z = stack.pop()
if z == 1:
continue
x, mx, y, my = prev[z]
path.append([x, mx, y, my, z])
if x not in used_num:
used_num.add(x)
stack.append(x)
if y != -1 and y not in used_num:
used_num.add(y)
stack.append(y)
register_name = {x: f'e{chr(97+i)}x' for i, x in enumerate(sorted(used_num))}
ans = []
used = [0] * len(path)
for ub in sorted(used_num):
for i, (x, mx, y, my, z) in enumerate(path):
if not used[i] and max(x, y, z) <= ub:
if y == -1:
ans.append(f'lea {register_name[z]}, [{str(mx)+"*" if mx > 1 else ""}{register_name[x]}]')
else:
ans.append(f'lea {register_name[z]}, [{str(mx)+"*" if mx > 1 else ""}{register_name[x]} + {str(my)+"*" if my > 1 else ""}{register_name[y]}]')
used[i] = 1
print(len(ans))
print('\n'.join(ans))
exit()
def calc(x, y):
visited = set()
stack = [x, y]
res = 0
while stack:
num = stack.pop()
if num == 1:
continue
res += 1
if prev[num][0] != -1 and prev[num][0] not in visited:
visited.add(prev[num][0])
stack.append(prev[num][0])
if prev[num][2] != -1 and prev[num][2] not in visited:
visited.add(prev[num][2])
stack.append(prev[num][2])
return res
while True:
flag = 0
next_dp = dp[:]
for x in range(1, n):
if dp[x] == inf:
continue
for m in (2, 4, 8):
if x * m <= n and next_dp[x * m] > dp[x] + 1:
flag = 1
next_dp[x * m] = dp[x] + 1
prev[x * m] = [x, m, -1, -1]
for y in range(1, n):
if dp[y] == inf:
continue
for my in (1, 2, 4, 8):
if x + y * my <= n and next_dp[x + y * my] > calc(x, y) + 1:
flag = 1
next_dp[x + y * my] = calc(x, y) + 1
prev[x + y * my] = [x, 1, y, my]
dp = next_dp
if not flag:
ok()
```
No
| 64,548
|
[
0.328369140625,
-0.2734375,
-0.378173828125,
0.1890869140625,
-0.413330078125,
-0.41357421875,
-0.07501220703125,
0.1524658203125,
-0.13134765625,
0.65283203125,
0.5927734375,
-0.0771484375,
0.156005859375,
-1.033203125,
-0.06640625,
-0.0743408203125,
-0.1275634765625,
-0.75732421875,
-0.35302734375,
0.169189453125,
-0.051239013671875,
-0.3408203125,
-1.228515625,
-0.0855712890625,
-0.265869140625,
0.5244140625,
0.455810546875,
-0.2464599609375,
0.8955078125,
1.1904296875,
-0.41845703125,
-0.37890625,
0.347412109375,
-0.85595703125,
-0.54541015625,
-0.66455078125,
0.1868896484375,
-0.8193359375,
-0.5380859375,
-0.53173828125,
0.030029296875,
-0.5634765625,
0.34912109375,
-0.52001953125,
-1.30859375,
-0.294189453125,
0.1351318359375,
-0.744140625,
0.27001953125,
-0.287353515625,
0.261962890625,
-0.5458984375,
0.322998046875,
-0.1522216796875,
0.382568359375,
0.427001953125,
0.0478515625,
0.2294921875,
-0.72607421875,
0.26025390625,
0.498291015625,
0.283447265625,
0.0214996337890625,
-0.98486328125,
0.1591796875,
0.18505859375,
-0.44580078125,
-0.2266845703125,
-0.1412353515625,
-0.82177734375,
-0.07513427734375,
0.1627197265625,
-0.56982421875,
-0.1873779296875,
-0.5869140625,
0.298583984375,
0.1177978515625,
0.057647705078125,
-0.67041015625,
0.4521484375,
0.4306640625,
0.73828125,
0.27587890625,
0.184814453125,
-0.4072265625,
-0.56298828125,
-0.233642578125,
0.10345458984375,
0.08056640625,
0.010406494140625,
-0.08489990234375,
0.495361328125,
-0.07354736328125,
0.1522216796875,
1.037109375,
0.6318359375,
-0.52099609375,
0.272705078125,
0.449462890625,
-0.1436767578125,
0.5654296875,
0.6611328125,
-0.31787109375,
0.83154296875,
-0.67236328125,
0.00879669189453125,
0.1529541015625,
-0.34228515625,
0.03216552734375,
-0.9130859375,
-0.283447265625,
0.10687255859375,
0.32275390625,
0.3857421875,
-0.1728515625,
0.5654296875,
-0.10540771484375,
0.127685546875,
-0.74462890625,
0.1724853515625,
0.2420654296875,
0.041839599609375,
0.228515625,
-0.15380859375,
0.202880859375,
-0.5107421875,
-0.60302734375,
1.1064453125,
-0.7998046875,
-0.042755126953125,
0.316162109375,
-0.05816650390625,
-0.31982421875,
0.35498046875,
-0.2457275390625,
0.7314453125,
-0.054290771484375,
0.342041015625,
0.84814453125,
-1.0546875,
0.85693359375,
-0.2431640625,
0.61767578125,
1.482421875,
0.116455078125,
-0.08197021484375,
0.5234375,
-0.2261962890625,
-0.9501953125,
0.265625,
-0.650390625,
0.458251953125,
-0.088134765625,
-0.1241455078125,
-0.46728515625,
0.254150390625,
-0.01776123046875,
0.307373046875,
0.2330322265625,
-0.1756591796875,
-0.2003173828125,
0.8642578125,
-0.484619140625,
0.70751953125,
-0.0523681640625,
0.328125,
-0.681640625,
-0.1365966796875,
-0.0709228515625,
-0.609375,
0.04022216796875,
-0.125244140625,
0.01922607421875,
0.69287109375,
0.65966796875,
0.9326171875,
1.0771484375,
0.09686279296875,
0.49169921875,
0.52099609375,
-0.48583984375,
0.1202392578125,
-0.003147125244140625,
1.09375,
0.353515625,
-0.01049041748046875,
0.1260986328125,
-0.389404296875,
-0.26171875,
-0.2958984375,
0.014739990234375,
0.71337890625,
-0.34228515625,
0.64990234375,
0.0187225341796875,
0.53369140625,
-0.82421875,
-0.034332275390625,
0.02435302734375,
-1.240234375,
-0.4931640625,
0.61376953125,
-0.058441162109375,
0.6171875,
-0.0933837890625,
-0.58642578125,
0.10687255859375,
1.04296875,
-0.19384765625,
0.60693359375,
0.875,
0.052490234375,
-0.21923828125,
0.1815185546875,
0.3916015625,
0.22998046875,
-0.41943359375,
0.54638671875,
0.010467529296875,
-0.0032329559326171875,
0.165283203125,
0.560546875,
0.343994140625,
0.201416015625,
-0.254150390625,
-0.263671875,
0.36328125,
1.2763671875,
0.1986083984375,
0.257080078125,
0.04150390625,
0.6171875,
0.234375,
0.93701171875,
0.54638671875,
0.146240234375,
0.87646484375,
0.468505859375,
-0.288818359375,
0.267822265625,
-0.126220703125,
0.58056640625,
0.56884765625,
0.78515625,
-0.20947265625,
0.1302490234375,
-0.1170654296875,
-0.1873779296875,
-0.363525390625,
0.634765625,
0.1510009765625,
0.72119140625,
0.0026721954345703125,
0.1488037109375,
-0.6201171875,
-0.203125,
0.578125,
0.615234375,
-1.0322265625,
-0.69189453125,
0.060699462890625,
0.07073974609375,
0.51123046875,
-0.08233642578125,
0.3173828125,
0.46728515625,
0.251708984375,
0.67919921875,
-0.55322265625,
-0.64208984375,
-0.4697265625,
-0.900390625,
-0.8515625,
-0.580078125,
-0.67236328125,
-0.185546875,
0.12841796875,
-0.480712890625,
0.420166015625,
-0.46142578125,
0.34716796875,
-0.288330078125,
-0.6171875,
0.8720703125,
-0.0621337890625,
0.8349609375,
-0.5419921875,
0.9638671875,
0.1571044921875,
0.689453125,
-0.44189453125,
0.07598876953125,
-0.38134765625,
-0.471923828125,
0.411376953125,
-0.0384521484375,
0.7265625,
0.4736328125,
-0.85009765625,
-0.51123046875,
-0.70068359375,
-0.1968994140625,
-0.5576171875,
-0.021820068359375,
-0.5029296875,
1.119140625,
-0.0596923828125,
-0.98974609375,
0.57080078125,
0.7841796875,
-1.185546875,
0.7373046875,
-0.01385498046875,
0.198486328125,
-0.72412109375,
1.0048828125,
0.416748046875,
0.24755859375,
-0.438232421875,
-0.2225341796875,
0.1424560546875,
-0.1834716796875,
0.08013916015625,
-0.53076171875,
-0.8447265625,
0.437255859375,
0.377685546875,
-0.884765625,
0.65625,
-0.89013671875,
-0.5859375,
-0.1395263671875,
-0.85009765625,
0.77392578125,
0.37841796875,
-0.2958984375,
-0.0775146484375,
-0.09295654296875,
-0.058258056640625,
0.153564453125,
0.3896484375,
-0.724609375,
0.038970947265625,
0.58349609375,
0.0714111328125,
0.336669921875,
0.03765869140625,
-0.5390625,
-0.1326904296875,
-0.497802734375,
-0.02850341796875,
0.59814453125,
0.2154541015625,
0.1512451171875,
0.1837158203125,
0.65087890625,
-0.87353515625,
-0.50732421875,
-0.050567626953125,
0.6650390625,
0.38623046875,
0.4365234375,
0.37353515625,
-0.251708984375,
-0.372314453125,
-0.53662109375,
0.5078125,
0.09454345703125,
0.5458984375,
-0.427001953125,
0.59619140625,
0.02923583984375,
-0.82177734375,
0.849609375,
-0.408935546875,
0.0252838134765625,
0.97216796875,
-0.1502685546875,
0.6015625,
-0.6005859375,
0.3515625,
-0.349853515625,
0.062286376953125,
0.6640625,
0.057647705078125,
0.49755859375,
-0.48974609375,
-0.7099609375,
-0.06396484375,
0.2327880859375,
-0.00592041015625,
-0.21142578125,
0.09393310546875,
-0.56591796875,
-0.1278076171875,
-1.154296875,
0.8984375,
0.26708984375,
0.410888671875,
0.111083984375,
0.55322265625,
-0.039337158203125,
0.37841796875,
0.3115234375,
-0.0924072265625,
0.08746337890625,
-0.64453125,
0.3359375,
0.1632080078125,
-0.297607421875,
-0.2423095703125,
-0.344970703125,
-0.51318359375,
0.390380859375,
-0.10076904296875,
0.1993408203125,
-0.74560546875,
-0.0213623046875,
-0.1090087890625,
0.64306640625,
-0.491943359375,
-0.5634765625,
-0.321044921875,
0.595703125,
0.312255859375,
-1.00390625,
0.0194244384765625,
-0.765625,
0.1915283203125,
0.51953125,
-0.135498046875,
-0.1380615234375,
-0.58935546875,
-1.103515625,
-0.734375,
0.2509765625,
0.75146484375,
0.1522216796875,
0.0201568603515625,
-1.333984375,
0.330810546875,
0.2373046875,
-0.451904296875,
0.266357421875,
-0.1954345703125,
0.01259613037109375,
0.003360748291015625,
0.74560546875,
-0.20068359375,
-0.3798828125,
0.462890625,
-1.2265625,
0.80224609375,
-0.1873779296875,
0.32421875,
-0.186279296875,
-0.2320556640625,
0.149169921875,
0.15283203125,
-0.232666015625,
-0.1776123046875,
-0.2435302734375,
0.5185546875,
-0.59912109375,
-0.755859375,
0.281494140625,
0.090576171875,
-0.1348876953125,
0.78857421875,
-0.090087890625,
-0.28564453125,
0.2261962890625,
0.2841796875,
-0.70068359375,
0.67724609375,
-0.323974609375,
0.0506591796875,
-0.00524139404296875,
-0.14111328125,
-0.14697265625,
-0.494873046875,
0.5966796875,
0.2027587890625,
-0.8291015625,
-0.67919921875,
-0.87841796875,
-0.116943359375,
0.0877685546875,
-0.5869140625,
0.369140625,
0.062408447265625,
-0.0307464599609375,
0.59521484375,
-0.382080078125,
-0.60009765625,
-0.3408203125,
-0.5068359375,
-0.2061767578125,
0.66259765625,
0.345947265625,
0.791015625,
-0.234130859375,
-0.064208984375,
-0.307373046875,
-0.2861328125,
0.078857421875,
-0.650390625,
0.06341552734375,
0.00736236572265625,
-0.08038330078125,
-0.3525390625,
0.19384765625,
-0.1026611328125,
0.459716796875,
0.79931640625,
0.296875,
0.47509765625,
0.455322265625,
-0.623046875,
0.99658203125,
0.019317626953125,
-1.0654296875,
-0.57373046875,
0.66796875,
-0.15869140625,
0.6259765625,
0.192626953125,
-0.51220703125,
-0.56005859375,
-1.3740234375,
0.172119140625,
-0.611328125,
-0.53564453125,
-0.76220703125,
-0.650390625,
-0.361083984375,
0.5126953125,
0.2296142578125,
-1.015625,
-0.118896484375,
-0.9951171875,
-0.031585693359375,
-0.8671875,
-0.2279052734375,
-0.343505859375,
-0.411865234375,
-0.279052734375,
0.9443359375,
-0.21142578125,
0.410400390625,
-0.1962890625,
0.245361328125,
0.607421875,
-0.197509765625,
-0.7958984375,
-0.6240234375,
-0.03912353515625,
-0.0755615234375,
-0.07855224609375,
0.44482421875,
-0.442138671875,
0.61572265625,
-0.93408203125,
0.34423828125,
-0.03216552734375,
0.2122802734375,
-0.240234375,
-0.461669921875,
0.984375,
-0.2744140625,
0.390869140625,
-0.32177734375,
0.76513671875,
0.974609375,
-0.087890625,
-0.857421875,
-0.21240234375,
-0.7587890625,
-0.96875,
0.448486328125,
-0.477783203125,
0.01016998291015625,
-0.67333984375,
0.0155029296875,
0.70703125,
-0.301513671875,
0.308837890625,
0.9873046875,
0.37353515625,
0.397216796875,
-0.880859375,
0.368408203125,
0.61767578125,
-0.185791015625,
0.09442138671875,
0.254150390625,
-0.57568359375,
-0.1214599609375,
-0.464111328125,
-0.80859375,
-0.66064453125,
0.02728271484375,
0.99853515625,
-0.2457275390625,
1.36328125,
-0.0014657974243164062,
-1.0146484375,
-0.337158203125,
0.80859375,
-0.288330078125,
-0.03643798828125,
0.65283203125,
0.332763671875,
0.30078125,
0.09393310546875,
-0.1939697265625,
-0.28955078125,
-0.463134765625,
1.04296875,
-0.405029296875,
-0.4013671875,
1.1318359375,
0.955078125,
-1.041015625,
-0.91943359375,
-0.0899658203125,
-0.01202392578125,
0.1954345703125,
-0.6796875,
0.564453125,
0.23486328125,
-0.381103515625,
0.25830078125,
0.361328125,
-0.164794921875,
0.475830078125,
0.256591796875,
0.2237548828125,
-0.8984375,
-0.058349609375,
0.73876953125,
-0.274658203125,
-0.642578125,
-0.46337890625,
0.024688720703125,
-0.1142578125,
-0.08050537109375,
0.89013671875,
-0.2271728515625,
0.33251953125,
0.453125,
-0.1114501953125,
0.50439453125,
-0.4970703125,
-0.54052734375,
0.1553955078125,
-0.42529296875,
-0.7138671875,
-0.342041015625,
0.225341796875,
0.0755615234375,
0.456298828125,
-0.5966796875,
0.226806640625,
0.6611328125,
0.223388671875,
-0.44482421875,
-0.623046875,
-0.56689453125,
-0.85107421875,
-0.640625,
-0.148681640625,
-0.36181640625,
-0.08526611328125,
0.27685546875,
0.06097412109375,
-0.767578125,
0.0201263427734375,
0.6142578125,
-0.68603515625,
0.032470703125,
-0.66748046875,
0.42578125,
-0.5205078125,
-0.2939453125,
-0.4013671875,
-0.060089111328125,
-0.21044921875,
-0.489013671875,
-0.6572265625,
0.33984375,
-0.12744140625,
0.183837890625,
-0.298583984375,
-0.33984375,
-0.082275390625,
-0.3232421875,
0.058746337890625,
0.251708984375,
-0.52783203125,
0.8466796875,
0.458251953125,
-0.46044921875,
0.363525390625,
-0.34765625,
-0.267333984375,
-0.09747314453125,
0.59326171875,
0.372802734375,
-0.26953125,
-0.464111328125,
-0.398193359375,
0.09942626953125,
-1.0712890625,
0.740234375,
-0.2587890625,
0.37353515625,
-0.07965087890625,
-0.203369140625,
0.6123046875,
0.94921875,
-0.065673828125,
0.493896484375,
0.369384765625,
0.07928466796875,
0.479248046875,
0.2939453125,
-0.34521484375,
0.371337890625,
-0.1612548828125,
-0.63330078125,
0.055267333984375,
0.5517578125,
-0.333740234375,
0.17626953125,
-0.1455078125,
-0.77685546875,
-0.982421875,
-0.42724609375,
-0.0943603515625,
0.5537109375,
0.69140625,
-0.393310546875,
-0.0831298828125,
0.139892578125,
-0.9814453125,
0.1590576171875,
-1.078125,
-0.83984375,
0.351318359375,
-0.1953125,
-0.35400390625,
0.1217041015625,
-0.5791015625,
0.0255279541015625,
0.33056640625,
0.1717529296875,
-0.48046875,
-0.038726806640625,
0.263916015625,
0.350830078125,
-0.1016845703125,
-0.1519775390625,
-0.30908203125,
0.462890625,
-0.857421875,
-0.91455078125,
-0.28173828125,
0.8740234375,
0.07525634765625,
0.078125,
-0.5537109375,
0.203125,
0.191650390625,
0.034149169921875,
-0.54345703125,
0.229736328125,
-0.298095703125,
0.865234375,
-0.7841796875,
0.08978271484375,
-0.047821044921875,
0.06707763671875,
-0.246826171875,
-0.0235748291015625,
-0.7763671875,
0.7822265625,
0.92626953125,
0.067626953125,
0.43603515625,
0.30224609375,
0.740234375,
0.096923828125,
-0.2459716796875,
-0.53955078125,
0.93115234375,
0.65478515625,
0.499755859375,
-0.072998046875,
0.427490234375,
0.7890625,
-0.22216796875,
0.09027099609375,
0.53662109375,
0.47705078125,
-0.6533203125,
0.07952880859375,
-0.2437744140625,
0.344970703125,
0.10369873046875,
-0.365966796875,
0.084716796875,
-0.314208984375,
-0.0298919677734375,
-0.09356689453125,
-0.79833984375,
0.650390625,
-0.34814453125,
-0.413818359375,
0.17822265625,
-0.2349853515625,
0.63330078125,
0.4580078125,
0.1268310546875,
-0.21630859375,
0.85205078125,
0.90625,
0.6318359375,
0.43212890625,
0.19384765625,
0.44970703125,
-0.2626953125,
0.07525634765625,
0.406982421875,
0.219970703125,
-0.180908203125,
-0.28466796875,
-1.0791015625,
0.60888671875,
-0.4248046875,
-0.483154296875,
0.248291015625,
-0.448974609375,
0.01024627685546875,
-0.66552734375,
0.845703125,
-0.91357421875,
0.091552734375,
0.42626953125,
-0.220458984375,
-0.305419921875,
0.59765625,
0.041595458984375,
0.5537109375,
0.36474609375,
1.0087890625,
-0.19580078125,
1.4892578125,
0.66552734375,
-0.2457275390625,
-0.217529296875,
0.27490234375,
-0.014434814453125,
-0.62353515625,
-0.060302734375,
-0.666015625,
0.07122802734375,
-0.145751953125,
-0.7060546875,
-0.0168914794921875,
0.473876953125,
0.2032470703125,
-1.2041015625,
-0.443359375,
0.1922607421875,
-0.5908203125,
0.491455078125,
0.341796875,
0.6640625,
0.54833984375,
-0.525390625,
-0.420654296875,
-0.72314453125,
-0.06903076171875,
-0.08453369140625,
0.77490234375,
-0.54638671875,
-0.374267578125,
-0.4794921875,
-0.31103515625,
-0.52880859375,
0.1693115234375,
-0.4892578125,
-0.3701171875,
0.67578125,
0.5048828125,
0.1448974609375,
0.469482421875,
-0.177734375,
0.325439453125,
1.154296875,
0.9326171875,
-0.3369140625,
1.0458984375,
0.412109375,
-0.0006814002990722656,
-0.052093505859375,
-0.486083984375,
0.68212890625,
-0.2335205078125,
-0.034912109375,
-0.2117919921875,
0.34765625,
-0.350830078125,
-1.3271484375,
0.1734619140625,
0.62060546875,
0.236328125,
-0.564453125,
-1.1767578125,
-0.447265625,
-0.85107421875,
-0.25634765625,
-0.44970703125,
0.96728515625,
0.148193359375,
-0.169677734375,
-0.0670166015625,
-0.625,
4.5546875,
0.875,
0.6689453125,
0.468017578125,
0.376220703125,
1.0126953125,
0.84375,
-0.51025390625,
-0.035797119140625,
-0.82763671875,
0.1724853515625,
-0.0709228515625,
0.3056640625,
0.837890625,
0.5,
0.4267578125,
-0.4990234375,
-0.12249755859375,
0.04266357421875,
-0.83056640625,
-0.740234375,
0.1307373046875,
0.2088623046875,
0.3583984375,
0.03631591796875,
0.37255859375,
0.62744140625,
-0.96240234375,
-0.615234375,
-0.83203125,
0.324951171875,
-0.265869140625,
0.8779296875,
-0.07403564453125,
-0.57958984375,
0.748046875,
-0.1090087890625,
-0.369873046875,
-0.52783203125,
0.15087890625,
-0.29931640625,
0.1279296875,
0.1676025390625,
-0.74609375,
0.034332275390625,
0.6787109375,
-0.724609375,
0.26904296875,
0.2296142578125,
-0.80810546875,
0.71923828125,
-0.2142333984375,
0.56640625,
-0.1727294921875,
-0.744140625,
0.31982421875,
0.447998046875,
-0.2353515625,
-0.54443359375,
0.76953125,
0.460205078125,
0.020233154296875,
0.07025146484375,
0.923828125,
-0.8359375,
0.3173828125,
-0.4765625,
0.7294921875,
-0.75244140625,
0.2041015625,
-0.455810546875,
-0.31689453125,
-0.09576416015625,
-0.296875,
0.70263671875,
0.1798095703125,
-0.47607421875,
0.4072265625,
0.1669921875,
-0.568359375,
0.15283203125,
-0.3154296875,
-0.158935546875,
-0.437255859375,
0.81787109375,
0.463623046875,
-0.71240234375,
-0.48974609375,
-0.2420654296875,
0.814453125,
0.7373046875,
0.4677734375,
0.09527587890625,
-0.95458984375,
-0.28466796875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After the Search Ultimate program that searched for strings in a text failed, Igor K. got to think: "Why on Earth does my program work so slowly?" As he double-checked his code, he said: "My code contains no errors, yet I know how we will improve Search Ultimate!" and took a large book from the shelves. The book read "Azembler. Principally New Approach".
Having carefully thumbed through the book, Igor K. realised that, as it turns out, you can multiply the numbers dozens of times faster. "Search Ultimate will be faster than it has ever been!" — the fellow shouted happily and set to work.
Let us now clarify what Igor's idea was. The thing is that the code that was generated by a compiler was far from perfect. Standard multiplying does work slower than with the trick the book mentioned.
The Azembler language operates with 26 registers (eax, ebx, ..., ezx) and two commands:
* [x] — returns the value located in the address x. For example, [eax] returns the value that was located in the address, equal to the value in the register eax.
* lea x, y — assigns to the register x, indicated as the first operand, the second operand's address. Thus, for example, the "lea ebx, [eax]" command will write in the ebx register the content of the eax register: first the [eax] operation will be fulfilled, the result of it will be some value that lies in the address written in eax. But we do not need the value — the next operation will be lea, that will take the [eax] address, i.e., the value in the eax register, and will write it in ebx.
On the first thought the second operation seems meaningless, but as it turns out, it is acceptable to write the operation as
lea ecx, [eax + ebx],
lea ecx, [k*eax]
or even
lea ecx, [ebx + k*eax],
where k = 1, 2, 4 or 8.
As a result, the register ecx will be equal to the numbers eax + ebx, k*eax and ebx + k*eax correspondingly. However, such operation is fulfilled many times, dozens of times faster that the usual multiplying of numbers. And using several such operations, one can very quickly multiply some number by some other one. Of course, instead of eax, ebx and ecx you are allowed to use any registers.
For example, let the eax register contain some number that we should multiply by 41. It takes us 2 lines:
lea ebx, [eax + 4*eax] // now ebx = 5*eax
lea eax, [eax + 8*ebx] // now eax = eax + 8*ebx = 41*eax
Igor K. got interested in the following question: what is the minimum number of lea operations needed to multiply by the given number n and how to do it? Your task is to help him.
Consider that at the initial moment of time eax contains a number that Igor K. was about to multiply by n, and the registers from ebx to ezx contain number 0. At the final moment of time the result can be located in any register.
Input
The input data contain the only integer n (1 ≤ n ≤ 255), which Igor K. is about to multiply.
Output
On the first line print number p, which represents the minimum number of lea operations, needed to do that. Then print the program consisting of p commands, performing the operations. It is guaranteed that such program exists for any n from 1 to 255.
Use precisely the following format of commands (here k is equal to 1, 2, 4 or 8, and x, y and z are any, even coinciding registers):
lea x, [y]
lea x, [y + z]
lea x, [k*y]
lea x, [y + k*z]
Please note that extra spaces at the end of a command are unacceptable.
Examples
Input
41
Output
2
lea ebx, [eax + 4*eax]
lea ecx, [eax + 8*ebx]
Input
2
Output
1
lea ebx, [eax + eax]
Input
4
Output
1
lea ebx, [4*eax]
Submitted Solution:
```
import sys
from array import array # noqa: F401
from itertools import product
def input():
return sys.stdin.buffer.readline().decode('utf-8')
n = int(input())
if n == 1:
print(0)
exit()
inf = 10**9
dp = [inf] * (n + 1)
dp[1] = 0
prev = [[-1, -1, -1, -1] for _ in range(n + 1)]
def ok():
path = []
used_num = {n}
stack = [n]
while stack:
z = stack.pop()
if z == 1:
continue
x, mx, y, my = prev[z]
path.append([x, mx, y, my, z])
if x not in used_num:
used_num.add(x)
stack.append(x)
if y != -1 and y not in used_num:
used_num.add(y)
stack.append(y)
register_name = {x: f'e{chr(97+i)}x' for i, x in enumerate(sorted(used_num))}
ans = []
used = [0] * len(path)
for ub in sorted(used_num):
for i, (x, mx, y, my, z) in enumerate(path):
if not used[i] and max(x, y, z) <= ub:
if y == -1:
ans.append(f'lea {register_name[z]}, [{str(mx)+"*" if mx > 1 else ""}{register_name[x]}]')
else:
ans.append(f'lea {register_name[z]}, [{str(mx)+"*" if mx > 1 else ""}{register_name[x]} + {str(my)+"*" if my > 1 else ""}{register_name[y]}]')
used[i] = 1
print(len(ans))
print('\n'.join(ans))
exit()
while True:
next_dp = dp[:]
for x in range(1, n):
if dp[x] == inf:
continue
for m in (2, 4, 8):
if x * m <= n and next_dp[x * m] > dp[x] + 1:
next_dp[x * m] = dp[x] + 1
prev[x * m] = [x, m, -1, -1]
for y in range(1, n):
if dp[y] == inf:
continue
for mx, my in product((1, 2, 4, 8), repeat=2):
if x * mx + y * my <= n and next_dp[x * mx + y * my] > dp[x] + dp[y] + 1:
next_dp[x * mx + y * my] = dp[x] + dp[y] + 1
prev[x * mx + y * my] = [x, mx, y, my]
dp = next_dp
if dp[n] != inf:
ok()
```
No
| 64,549
|
[
0.328369140625,
-0.2734375,
-0.378173828125,
0.1890869140625,
-0.413330078125,
-0.41357421875,
-0.07501220703125,
0.1524658203125,
-0.13134765625,
0.65283203125,
0.5927734375,
-0.0771484375,
0.156005859375,
-1.033203125,
-0.06640625,
-0.0743408203125,
-0.1275634765625,
-0.75732421875,
-0.35302734375,
0.169189453125,
-0.051239013671875,
-0.3408203125,
-1.228515625,
-0.0855712890625,
-0.265869140625,
0.5244140625,
0.455810546875,
-0.2464599609375,
0.8955078125,
1.1904296875,
-0.41845703125,
-0.37890625,
0.347412109375,
-0.85595703125,
-0.54541015625,
-0.66455078125,
0.1868896484375,
-0.8193359375,
-0.5380859375,
-0.53173828125,
0.030029296875,
-0.5634765625,
0.34912109375,
-0.52001953125,
-1.30859375,
-0.294189453125,
0.1351318359375,
-0.744140625,
0.27001953125,
-0.287353515625,
0.261962890625,
-0.5458984375,
0.322998046875,
-0.1522216796875,
0.382568359375,
0.427001953125,
0.0478515625,
0.2294921875,
-0.72607421875,
0.26025390625,
0.498291015625,
0.283447265625,
0.0214996337890625,
-0.98486328125,
0.1591796875,
0.18505859375,
-0.44580078125,
-0.2266845703125,
-0.1412353515625,
-0.82177734375,
-0.07513427734375,
0.1627197265625,
-0.56982421875,
-0.1873779296875,
-0.5869140625,
0.298583984375,
0.1177978515625,
0.057647705078125,
-0.67041015625,
0.4521484375,
0.4306640625,
0.73828125,
0.27587890625,
0.184814453125,
-0.4072265625,
-0.56298828125,
-0.233642578125,
0.10345458984375,
0.08056640625,
0.010406494140625,
-0.08489990234375,
0.495361328125,
-0.07354736328125,
0.1522216796875,
1.037109375,
0.6318359375,
-0.52099609375,
0.272705078125,
0.449462890625,
-0.1436767578125,
0.5654296875,
0.6611328125,
-0.31787109375,
0.83154296875,
-0.67236328125,
0.00879669189453125,
0.1529541015625,
-0.34228515625,
0.03216552734375,
-0.9130859375,
-0.283447265625,
0.10687255859375,
0.32275390625,
0.3857421875,
-0.1728515625,
0.5654296875,
-0.10540771484375,
0.127685546875,
-0.74462890625,
0.1724853515625,
0.2420654296875,
0.041839599609375,
0.228515625,
-0.15380859375,
0.202880859375,
-0.5107421875,
-0.60302734375,
1.1064453125,
-0.7998046875,
-0.042755126953125,
0.316162109375,
-0.05816650390625,
-0.31982421875,
0.35498046875,
-0.2457275390625,
0.7314453125,
-0.054290771484375,
0.342041015625,
0.84814453125,
-1.0546875,
0.85693359375,
-0.2431640625,
0.61767578125,
1.482421875,
0.116455078125,
-0.08197021484375,
0.5234375,
-0.2261962890625,
-0.9501953125,
0.265625,
-0.650390625,
0.458251953125,
-0.088134765625,
-0.1241455078125,
-0.46728515625,
0.254150390625,
-0.01776123046875,
0.307373046875,
0.2330322265625,
-0.1756591796875,
-0.2003173828125,
0.8642578125,
-0.484619140625,
0.70751953125,
-0.0523681640625,
0.328125,
-0.681640625,
-0.1365966796875,
-0.0709228515625,
-0.609375,
0.04022216796875,
-0.125244140625,
0.01922607421875,
0.69287109375,
0.65966796875,
0.9326171875,
1.0771484375,
0.09686279296875,
0.49169921875,
0.52099609375,
-0.48583984375,
0.1202392578125,
-0.003147125244140625,
1.09375,
0.353515625,
-0.01049041748046875,
0.1260986328125,
-0.389404296875,
-0.26171875,
-0.2958984375,
0.014739990234375,
0.71337890625,
-0.34228515625,
0.64990234375,
0.0187225341796875,
0.53369140625,
-0.82421875,
-0.034332275390625,
0.02435302734375,
-1.240234375,
-0.4931640625,
0.61376953125,
-0.058441162109375,
0.6171875,
-0.0933837890625,
-0.58642578125,
0.10687255859375,
1.04296875,
-0.19384765625,
0.60693359375,
0.875,
0.052490234375,
-0.21923828125,
0.1815185546875,
0.3916015625,
0.22998046875,
-0.41943359375,
0.54638671875,
0.010467529296875,
-0.0032329559326171875,
0.165283203125,
0.560546875,
0.343994140625,
0.201416015625,
-0.254150390625,
-0.263671875,
0.36328125,
1.2763671875,
0.1986083984375,
0.257080078125,
0.04150390625,
0.6171875,
0.234375,
0.93701171875,
0.54638671875,
0.146240234375,
0.87646484375,
0.468505859375,
-0.288818359375,
0.267822265625,
-0.126220703125,
0.58056640625,
0.56884765625,
0.78515625,
-0.20947265625,
0.1302490234375,
-0.1170654296875,
-0.1873779296875,
-0.363525390625,
0.634765625,
0.1510009765625,
0.72119140625,
0.0026721954345703125,
0.1488037109375,
-0.6201171875,
-0.203125,
0.578125,
0.615234375,
-1.0322265625,
-0.69189453125,
0.060699462890625,
0.07073974609375,
0.51123046875,
-0.08233642578125,
0.3173828125,
0.46728515625,
0.251708984375,
0.67919921875,
-0.55322265625,
-0.64208984375,
-0.4697265625,
-0.900390625,
-0.8515625,
-0.580078125,
-0.67236328125,
-0.185546875,
0.12841796875,
-0.480712890625,
0.420166015625,
-0.46142578125,
0.34716796875,
-0.288330078125,
-0.6171875,
0.8720703125,
-0.0621337890625,
0.8349609375,
-0.5419921875,
0.9638671875,
0.1571044921875,
0.689453125,
-0.44189453125,
0.07598876953125,
-0.38134765625,
-0.471923828125,
0.411376953125,
-0.0384521484375,
0.7265625,
0.4736328125,
-0.85009765625,
-0.51123046875,
-0.70068359375,
-0.1968994140625,
-0.5576171875,
-0.021820068359375,
-0.5029296875,
1.119140625,
-0.0596923828125,
-0.98974609375,
0.57080078125,
0.7841796875,
-1.185546875,
0.7373046875,
-0.01385498046875,
0.198486328125,
-0.72412109375,
1.0048828125,
0.416748046875,
0.24755859375,
-0.438232421875,
-0.2225341796875,
0.1424560546875,
-0.1834716796875,
0.08013916015625,
-0.53076171875,
-0.8447265625,
0.437255859375,
0.377685546875,
-0.884765625,
0.65625,
-0.89013671875,
-0.5859375,
-0.1395263671875,
-0.85009765625,
0.77392578125,
0.37841796875,
-0.2958984375,
-0.0775146484375,
-0.09295654296875,
-0.058258056640625,
0.153564453125,
0.3896484375,
-0.724609375,
0.038970947265625,
0.58349609375,
0.0714111328125,
0.336669921875,
0.03765869140625,
-0.5390625,
-0.1326904296875,
-0.497802734375,
-0.02850341796875,
0.59814453125,
0.2154541015625,
0.1512451171875,
0.1837158203125,
0.65087890625,
-0.87353515625,
-0.50732421875,
-0.050567626953125,
0.6650390625,
0.38623046875,
0.4365234375,
0.37353515625,
-0.251708984375,
-0.372314453125,
-0.53662109375,
0.5078125,
0.09454345703125,
0.5458984375,
-0.427001953125,
0.59619140625,
0.02923583984375,
-0.82177734375,
0.849609375,
-0.408935546875,
0.0252838134765625,
0.97216796875,
-0.1502685546875,
0.6015625,
-0.6005859375,
0.3515625,
-0.349853515625,
0.062286376953125,
0.6640625,
0.057647705078125,
0.49755859375,
-0.48974609375,
-0.7099609375,
-0.06396484375,
0.2327880859375,
-0.00592041015625,
-0.21142578125,
0.09393310546875,
-0.56591796875,
-0.1278076171875,
-1.154296875,
0.8984375,
0.26708984375,
0.410888671875,
0.111083984375,
0.55322265625,
-0.039337158203125,
0.37841796875,
0.3115234375,
-0.0924072265625,
0.08746337890625,
-0.64453125,
0.3359375,
0.1632080078125,
-0.297607421875,
-0.2423095703125,
-0.344970703125,
-0.51318359375,
0.390380859375,
-0.10076904296875,
0.1993408203125,
-0.74560546875,
-0.0213623046875,
-0.1090087890625,
0.64306640625,
-0.491943359375,
-0.5634765625,
-0.321044921875,
0.595703125,
0.312255859375,
-1.00390625,
0.0194244384765625,
-0.765625,
0.1915283203125,
0.51953125,
-0.135498046875,
-0.1380615234375,
-0.58935546875,
-1.103515625,
-0.734375,
0.2509765625,
0.75146484375,
0.1522216796875,
0.0201568603515625,
-1.333984375,
0.330810546875,
0.2373046875,
-0.451904296875,
0.266357421875,
-0.1954345703125,
0.01259613037109375,
0.003360748291015625,
0.74560546875,
-0.20068359375,
-0.3798828125,
0.462890625,
-1.2265625,
0.80224609375,
-0.1873779296875,
0.32421875,
-0.186279296875,
-0.2320556640625,
0.149169921875,
0.15283203125,
-0.232666015625,
-0.1776123046875,
-0.2435302734375,
0.5185546875,
-0.59912109375,
-0.755859375,
0.281494140625,
0.090576171875,
-0.1348876953125,
0.78857421875,
-0.090087890625,
-0.28564453125,
0.2261962890625,
0.2841796875,
-0.70068359375,
0.67724609375,
-0.323974609375,
0.0506591796875,
-0.00524139404296875,
-0.14111328125,
-0.14697265625,
-0.494873046875,
0.5966796875,
0.2027587890625,
-0.8291015625,
-0.67919921875,
-0.87841796875,
-0.116943359375,
0.0877685546875,
-0.5869140625,
0.369140625,
0.062408447265625,
-0.0307464599609375,
0.59521484375,
-0.382080078125,
-0.60009765625,
-0.3408203125,
-0.5068359375,
-0.2061767578125,
0.66259765625,
0.345947265625,
0.791015625,
-0.234130859375,
-0.064208984375,
-0.307373046875,
-0.2861328125,
0.078857421875,
-0.650390625,
0.06341552734375,
0.00736236572265625,
-0.08038330078125,
-0.3525390625,
0.19384765625,
-0.1026611328125,
0.459716796875,
0.79931640625,
0.296875,
0.47509765625,
0.455322265625,
-0.623046875,
0.99658203125,
0.019317626953125,
-1.0654296875,
-0.57373046875,
0.66796875,
-0.15869140625,
0.6259765625,
0.192626953125,
-0.51220703125,
-0.56005859375,
-1.3740234375,
0.172119140625,
-0.611328125,
-0.53564453125,
-0.76220703125,
-0.650390625,
-0.361083984375,
0.5126953125,
0.2296142578125,
-1.015625,
-0.118896484375,
-0.9951171875,
-0.031585693359375,
-0.8671875,
-0.2279052734375,
-0.343505859375,
-0.411865234375,
-0.279052734375,
0.9443359375,
-0.21142578125,
0.410400390625,
-0.1962890625,
0.245361328125,
0.607421875,
-0.197509765625,
-0.7958984375,
-0.6240234375,
-0.03912353515625,
-0.0755615234375,
-0.07855224609375,
0.44482421875,
-0.442138671875,
0.61572265625,
-0.93408203125,
0.34423828125,
-0.03216552734375,
0.2122802734375,
-0.240234375,
-0.461669921875,
0.984375,
-0.2744140625,
0.390869140625,
-0.32177734375,
0.76513671875,
0.974609375,
-0.087890625,
-0.857421875,
-0.21240234375,
-0.7587890625,
-0.96875,
0.448486328125,
-0.477783203125,
0.01016998291015625,
-0.67333984375,
0.0155029296875,
0.70703125,
-0.301513671875,
0.308837890625,
0.9873046875,
0.37353515625,
0.397216796875,
-0.880859375,
0.368408203125,
0.61767578125,
-0.185791015625,
0.09442138671875,
0.254150390625,
-0.57568359375,
-0.1214599609375,
-0.464111328125,
-0.80859375,
-0.66064453125,
0.02728271484375,
0.99853515625,
-0.2457275390625,
1.36328125,
-0.0014657974243164062,
-1.0146484375,
-0.337158203125,
0.80859375,
-0.288330078125,
-0.03643798828125,
0.65283203125,
0.332763671875,
0.30078125,
0.09393310546875,
-0.1939697265625,
-0.28955078125,
-0.463134765625,
1.04296875,
-0.405029296875,
-0.4013671875,
1.1318359375,
0.955078125,
-1.041015625,
-0.91943359375,
-0.0899658203125,
-0.01202392578125,
0.1954345703125,
-0.6796875,
0.564453125,
0.23486328125,
-0.381103515625,
0.25830078125,
0.361328125,
-0.164794921875,
0.475830078125,
0.256591796875,
0.2237548828125,
-0.8984375,
-0.058349609375,
0.73876953125,
-0.274658203125,
-0.642578125,
-0.46337890625,
0.024688720703125,
-0.1142578125,
-0.08050537109375,
0.89013671875,
-0.2271728515625,
0.33251953125,
0.453125,
-0.1114501953125,
0.50439453125,
-0.4970703125,
-0.54052734375,
0.1553955078125,
-0.42529296875,
-0.7138671875,
-0.342041015625,
0.225341796875,
0.0755615234375,
0.456298828125,
-0.5966796875,
0.226806640625,
0.6611328125,
0.223388671875,
-0.44482421875,
-0.623046875,
-0.56689453125,
-0.85107421875,
-0.640625,
-0.148681640625,
-0.36181640625,
-0.08526611328125,
0.27685546875,
0.06097412109375,
-0.767578125,
0.0201263427734375,
0.6142578125,
-0.68603515625,
0.032470703125,
-0.66748046875,
0.42578125,
-0.5205078125,
-0.2939453125,
-0.4013671875,
-0.060089111328125,
-0.21044921875,
-0.489013671875,
-0.6572265625,
0.33984375,
-0.12744140625,
0.183837890625,
-0.298583984375,
-0.33984375,
-0.082275390625,
-0.3232421875,
0.058746337890625,
0.251708984375,
-0.52783203125,
0.8466796875,
0.458251953125,
-0.46044921875,
0.363525390625,
-0.34765625,
-0.267333984375,
-0.09747314453125,
0.59326171875,
0.372802734375,
-0.26953125,
-0.464111328125,
-0.398193359375,
0.09942626953125,
-1.0712890625,
0.740234375,
-0.2587890625,
0.37353515625,
-0.07965087890625,
-0.203369140625,
0.6123046875,
0.94921875,
-0.065673828125,
0.493896484375,
0.369384765625,
0.07928466796875,
0.479248046875,
0.2939453125,
-0.34521484375,
0.371337890625,
-0.1612548828125,
-0.63330078125,
0.055267333984375,
0.5517578125,
-0.333740234375,
0.17626953125,
-0.1455078125,
-0.77685546875,
-0.982421875,
-0.42724609375,
-0.0943603515625,
0.5537109375,
0.69140625,
-0.393310546875,
-0.0831298828125,
0.139892578125,
-0.9814453125,
0.1590576171875,
-1.078125,
-0.83984375,
0.351318359375,
-0.1953125,
-0.35400390625,
0.1217041015625,
-0.5791015625,
0.0255279541015625,
0.33056640625,
0.1717529296875,
-0.48046875,
-0.038726806640625,
0.263916015625,
0.350830078125,
-0.1016845703125,
-0.1519775390625,
-0.30908203125,
0.462890625,
-0.857421875,
-0.91455078125,
-0.28173828125,
0.8740234375,
0.07525634765625,
0.078125,
-0.5537109375,
0.203125,
0.191650390625,
0.034149169921875,
-0.54345703125,
0.229736328125,
-0.298095703125,
0.865234375,
-0.7841796875,
0.08978271484375,
-0.047821044921875,
0.06707763671875,
-0.246826171875,
-0.0235748291015625,
-0.7763671875,
0.7822265625,
0.92626953125,
0.067626953125,
0.43603515625,
0.30224609375,
0.740234375,
0.096923828125,
-0.2459716796875,
-0.53955078125,
0.93115234375,
0.65478515625,
0.499755859375,
-0.072998046875,
0.427490234375,
0.7890625,
-0.22216796875,
0.09027099609375,
0.53662109375,
0.47705078125,
-0.6533203125,
0.07952880859375,
-0.2437744140625,
0.344970703125,
0.10369873046875,
-0.365966796875,
0.084716796875,
-0.314208984375,
-0.0298919677734375,
-0.09356689453125,
-0.79833984375,
0.650390625,
-0.34814453125,
-0.413818359375,
0.17822265625,
-0.2349853515625,
0.63330078125,
0.4580078125,
0.1268310546875,
-0.21630859375,
0.85205078125,
0.90625,
0.6318359375,
0.43212890625,
0.19384765625,
0.44970703125,
-0.2626953125,
0.07525634765625,
0.406982421875,
0.219970703125,
-0.180908203125,
-0.28466796875,
-1.0791015625,
0.60888671875,
-0.4248046875,
-0.483154296875,
0.248291015625,
-0.448974609375,
0.01024627685546875,
-0.66552734375,
0.845703125,
-0.91357421875,
0.091552734375,
0.42626953125,
-0.220458984375,
-0.305419921875,
0.59765625,
0.041595458984375,
0.5537109375,
0.36474609375,
1.0087890625,
-0.19580078125,
1.4892578125,
0.66552734375,
-0.2457275390625,
-0.217529296875,
0.27490234375,
-0.014434814453125,
-0.62353515625,
-0.060302734375,
-0.666015625,
0.07122802734375,
-0.145751953125,
-0.7060546875,
-0.0168914794921875,
0.473876953125,
0.2032470703125,
-1.2041015625,
-0.443359375,
0.1922607421875,
-0.5908203125,
0.491455078125,
0.341796875,
0.6640625,
0.54833984375,
-0.525390625,
-0.420654296875,
-0.72314453125,
-0.06903076171875,
-0.08453369140625,
0.77490234375,
-0.54638671875,
-0.374267578125,
-0.4794921875,
-0.31103515625,
-0.52880859375,
0.1693115234375,
-0.4892578125,
-0.3701171875,
0.67578125,
0.5048828125,
0.1448974609375,
0.469482421875,
-0.177734375,
0.325439453125,
1.154296875,
0.9326171875,
-0.3369140625,
1.0458984375,
0.412109375,
-0.0006814002990722656,
-0.052093505859375,
-0.486083984375,
0.68212890625,
-0.2335205078125,
-0.034912109375,
-0.2117919921875,
0.34765625,
-0.350830078125,
-1.3271484375,
0.1734619140625,
0.62060546875,
0.236328125,
-0.564453125,
-1.1767578125,
-0.447265625,
-0.85107421875,
-0.25634765625,
-0.44970703125,
0.96728515625,
0.148193359375,
-0.169677734375,
-0.0670166015625,
-0.625,
4.5546875,
0.875,
0.6689453125,
0.468017578125,
0.376220703125,
1.0126953125,
0.84375,
-0.51025390625,
-0.035797119140625,
-0.82763671875,
0.1724853515625,
-0.0709228515625,
0.3056640625,
0.837890625,
0.5,
0.4267578125,
-0.4990234375,
-0.12249755859375,
0.04266357421875,
-0.83056640625,
-0.740234375,
0.1307373046875,
0.2088623046875,
0.3583984375,
0.03631591796875,
0.37255859375,
0.62744140625,
-0.96240234375,
-0.615234375,
-0.83203125,
0.324951171875,
-0.265869140625,
0.8779296875,
-0.07403564453125,
-0.57958984375,
0.748046875,
-0.1090087890625,
-0.369873046875,
-0.52783203125,
0.15087890625,
-0.29931640625,
0.1279296875,
0.1676025390625,
-0.74609375,
0.034332275390625,
0.6787109375,
-0.724609375,
0.26904296875,
0.2296142578125,
-0.80810546875,
0.71923828125,
-0.2142333984375,
0.56640625,
-0.1727294921875,
-0.744140625,
0.31982421875,
0.447998046875,
-0.2353515625,
-0.54443359375,
0.76953125,
0.460205078125,
0.020233154296875,
0.07025146484375,
0.923828125,
-0.8359375,
0.3173828125,
-0.4765625,
0.7294921875,
-0.75244140625,
0.2041015625,
-0.455810546875,
-0.31689453125,
-0.09576416015625,
-0.296875,
0.70263671875,
0.1798095703125,
-0.47607421875,
0.4072265625,
0.1669921875,
-0.568359375,
0.15283203125,
-0.3154296875,
-0.158935546875,
-0.437255859375,
0.81787109375,
0.463623046875,
-0.71240234375,
-0.48974609375,
-0.2420654296875,
0.814453125,
0.7373046875,
0.4677734375,
0.09527587890625,
-0.95458984375,
-0.28466796875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After the Search Ultimate program that searched for strings in a text failed, Igor K. got to think: "Why on Earth does my program work so slowly?" As he double-checked his code, he said: "My code contains no errors, yet I know how we will improve Search Ultimate!" and took a large book from the shelves. The book read "Azembler. Principally New Approach".
Having carefully thumbed through the book, Igor K. realised that, as it turns out, you can multiply the numbers dozens of times faster. "Search Ultimate will be faster than it has ever been!" — the fellow shouted happily and set to work.
Let us now clarify what Igor's idea was. The thing is that the code that was generated by a compiler was far from perfect. Standard multiplying does work slower than with the trick the book mentioned.
The Azembler language operates with 26 registers (eax, ebx, ..., ezx) and two commands:
* [x] — returns the value located in the address x. For example, [eax] returns the value that was located in the address, equal to the value in the register eax.
* lea x, y — assigns to the register x, indicated as the first operand, the second operand's address. Thus, for example, the "lea ebx, [eax]" command will write in the ebx register the content of the eax register: first the [eax] operation will be fulfilled, the result of it will be some value that lies in the address written in eax. But we do not need the value — the next operation will be lea, that will take the [eax] address, i.e., the value in the eax register, and will write it in ebx.
On the first thought the second operation seems meaningless, but as it turns out, it is acceptable to write the operation as
lea ecx, [eax + ebx],
lea ecx, [k*eax]
or even
lea ecx, [ebx + k*eax],
where k = 1, 2, 4 or 8.
As a result, the register ecx will be equal to the numbers eax + ebx, k*eax and ebx + k*eax correspondingly. However, such operation is fulfilled many times, dozens of times faster that the usual multiplying of numbers. And using several such operations, one can very quickly multiply some number by some other one. Of course, instead of eax, ebx and ecx you are allowed to use any registers.
For example, let the eax register contain some number that we should multiply by 41. It takes us 2 lines:
lea ebx, [eax + 4*eax] // now ebx = 5*eax
lea eax, [eax + 8*ebx] // now eax = eax + 8*ebx = 41*eax
Igor K. got interested in the following question: what is the minimum number of lea operations needed to multiply by the given number n and how to do it? Your task is to help him.
Consider that at the initial moment of time eax contains a number that Igor K. was about to multiply by n, and the registers from ebx to ezx contain number 0. At the final moment of time the result can be located in any register.
Input
The input data contain the only integer n (1 ≤ n ≤ 255), which Igor K. is about to multiply.
Output
On the first line print number p, which represents the minimum number of lea operations, needed to do that. Then print the program consisting of p commands, performing the operations. It is guaranteed that such program exists for any n from 1 to 255.
Use precisely the following format of commands (here k is equal to 1, 2, 4 or 8, and x, y and z are any, even coinciding registers):
lea x, [y]
lea x, [y + z]
lea x, [k*y]
lea x, [y + k*z]
Please note that extra spaces at the end of a command are unacceptable.
Examples
Input
41
Output
2
lea ebx, [eax + 4*eax]
lea ecx, [eax + 8*ebx]
Input
2
Output
1
lea ebx, [eax + eax]
Input
4
Output
1
lea ebx, [4*eax]
Submitted Solution:
```
import sys
from array import array # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
n = int(input())
if n == 1:
print(0)
exit()
inf = 10**9
dp = [inf] * (n + 1)
dp[1] = 0
prev = [[-1, -1, -1, -1] for _ in range(n + 1)]
def ok():
path = []
used_num = {n}
stack = [n]
while stack:
z = stack.pop()
if z == 1:
continue
x, mx, y, my = prev[z]
path.append([x, mx, y, my, z])
if x not in used_num:
used_num.add(x)
stack.append(x)
if y != -1 and y not in used_num:
used_num.add(y)
stack.append(y)
register_name = {x: f'e{chr(97+i)}x' for i, x in enumerate(sorted(used_num))}
ans = []
flag = [0] * (n + 1)
used = [0] * len(path)
for ub in sorted(used_num):
flag[ub] = 1
for i, (x, mx, y, my, z) in enumerate(path):
if not used[i] and (flag[x] and (y == -1 or flag[y]) and flag[z]):
if y == -1:
ans.append(f'lea {register_name[z]}, [{str(mx)+"*" if mx > 1 else ""}{register_name[x]}]')
else:
ans.append(f'lea {register_name[z]}, [{str(mx)+"*" if mx > 1 else ""}{register_name[x]} + {str(my)+"*" if my > 1 else ""}{register_name[y]}]')
used[i] = 1
print(len(ans))
print('\n'.join(ans))
exit()
while True:
flag = 0
next_dp = dp[:]
for x in range(1, n):
if dp[x] == inf:
continue
for m in (2, 4, 8):
if x * m <= n and next_dp[x * m] > dp[x] + 1:
flag = 1
next_dp[x * m] = dp[x] + 1
prev[x * m] = [x, m, -1, -1]
for y in range(1, n):
if dp[y] == inf:
continue
for my in (1, 2, 4, 8):
if x + y * my <= n and next_dp[x + y * my] > dp[x] + dp[y] + 1:
flag = 1
next_dp[x + y * my] = dp[x] + dp[y] + 1
prev[x + y * my] = [x, 1, y, my]
dp = next_dp
if not flag:
ok()
```
No
| 64,550
|
[
0.328369140625,
-0.2734375,
-0.378173828125,
0.1890869140625,
-0.413330078125,
-0.41357421875,
-0.07501220703125,
0.1524658203125,
-0.13134765625,
0.65283203125,
0.5927734375,
-0.0771484375,
0.156005859375,
-1.033203125,
-0.06640625,
-0.0743408203125,
-0.1275634765625,
-0.75732421875,
-0.35302734375,
0.169189453125,
-0.051239013671875,
-0.3408203125,
-1.228515625,
-0.0855712890625,
-0.265869140625,
0.5244140625,
0.455810546875,
-0.2464599609375,
0.8955078125,
1.1904296875,
-0.41845703125,
-0.37890625,
0.347412109375,
-0.85595703125,
-0.54541015625,
-0.66455078125,
0.1868896484375,
-0.8193359375,
-0.5380859375,
-0.53173828125,
0.030029296875,
-0.5634765625,
0.34912109375,
-0.52001953125,
-1.30859375,
-0.294189453125,
0.1351318359375,
-0.744140625,
0.27001953125,
-0.287353515625,
0.261962890625,
-0.5458984375,
0.322998046875,
-0.1522216796875,
0.382568359375,
0.427001953125,
0.0478515625,
0.2294921875,
-0.72607421875,
0.26025390625,
0.498291015625,
0.283447265625,
0.0214996337890625,
-0.98486328125,
0.1591796875,
0.18505859375,
-0.44580078125,
-0.2266845703125,
-0.1412353515625,
-0.82177734375,
-0.07513427734375,
0.1627197265625,
-0.56982421875,
-0.1873779296875,
-0.5869140625,
0.298583984375,
0.1177978515625,
0.057647705078125,
-0.67041015625,
0.4521484375,
0.4306640625,
0.73828125,
0.27587890625,
0.184814453125,
-0.4072265625,
-0.56298828125,
-0.233642578125,
0.10345458984375,
0.08056640625,
0.010406494140625,
-0.08489990234375,
0.495361328125,
-0.07354736328125,
0.1522216796875,
1.037109375,
0.6318359375,
-0.52099609375,
0.272705078125,
0.449462890625,
-0.1436767578125,
0.5654296875,
0.6611328125,
-0.31787109375,
0.83154296875,
-0.67236328125,
0.00879669189453125,
0.1529541015625,
-0.34228515625,
0.03216552734375,
-0.9130859375,
-0.283447265625,
0.10687255859375,
0.32275390625,
0.3857421875,
-0.1728515625,
0.5654296875,
-0.10540771484375,
0.127685546875,
-0.74462890625,
0.1724853515625,
0.2420654296875,
0.041839599609375,
0.228515625,
-0.15380859375,
0.202880859375,
-0.5107421875,
-0.60302734375,
1.1064453125,
-0.7998046875,
-0.042755126953125,
0.316162109375,
-0.05816650390625,
-0.31982421875,
0.35498046875,
-0.2457275390625,
0.7314453125,
-0.054290771484375,
0.342041015625,
0.84814453125,
-1.0546875,
0.85693359375,
-0.2431640625,
0.61767578125,
1.482421875,
0.116455078125,
-0.08197021484375,
0.5234375,
-0.2261962890625,
-0.9501953125,
0.265625,
-0.650390625,
0.458251953125,
-0.088134765625,
-0.1241455078125,
-0.46728515625,
0.254150390625,
-0.01776123046875,
0.307373046875,
0.2330322265625,
-0.1756591796875,
-0.2003173828125,
0.8642578125,
-0.484619140625,
0.70751953125,
-0.0523681640625,
0.328125,
-0.681640625,
-0.1365966796875,
-0.0709228515625,
-0.609375,
0.04022216796875,
-0.125244140625,
0.01922607421875,
0.69287109375,
0.65966796875,
0.9326171875,
1.0771484375,
0.09686279296875,
0.49169921875,
0.52099609375,
-0.48583984375,
0.1202392578125,
-0.003147125244140625,
1.09375,
0.353515625,
-0.01049041748046875,
0.1260986328125,
-0.389404296875,
-0.26171875,
-0.2958984375,
0.014739990234375,
0.71337890625,
-0.34228515625,
0.64990234375,
0.0187225341796875,
0.53369140625,
-0.82421875,
-0.034332275390625,
0.02435302734375,
-1.240234375,
-0.4931640625,
0.61376953125,
-0.058441162109375,
0.6171875,
-0.0933837890625,
-0.58642578125,
0.10687255859375,
1.04296875,
-0.19384765625,
0.60693359375,
0.875,
0.052490234375,
-0.21923828125,
0.1815185546875,
0.3916015625,
0.22998046875,
-0.41943359375,
0.54638671875,
0.010467529296875,
-0.0032329559326171875,
0.165283203125,
0.560546875,
0.343994140625,
0.201416015625,
-0.254150390625,
-0.263671875,
0.36328125,
1.2763671875,
0.1986083984375,
0.257080078125,
0.04150390625,
0.6171875,
0.234375,
0.93701171875,
0.54638671875,
0.146240234375,
0.87646484375,
0.468505859375,
-0.288818359375,
0.267822265625,
-0.126220703125,
0.58056640625,
0.56884765625,
0.78515625,
-0.20947265625,
0.1302490234375,
-0.1170654296875,
-0.1873779296875,
-0.363525390625,
0.634765625,
0.1510009765625,
0.72119140625,
0.0026721954345703125,
0.1488037109375,
-0.6201171875,
-0.203125,
0.578125,
0.615234375,
-1.0322265625,
-0.69189453125,
0.060699462890625,
0.07073974609375,
0.51123046875,
-0.08233642578125,
0.3173828125,
0.46728515625,
0.251708984375,
0.67919921875,
-0.55322265625,
-0.64208984375,
-0.4697265625,
-0.900390625,
-0.8515625,
-0.580078125,
-0.67236328125,
-0.185546875,
0.12841796875,
-0.480712890625,
0.420166015625,
-0.46142578125,
0.34716796875,
-0.288330078125,
-0.6171875,
0.8720703125,
-0.0621337890625,
0.8349609375,
-0.5419921875,
0.9638671875,
0.1571044921875,
0.689453125,
-0.44189453125,
0.07598876953125,
-0.38134765625,
-0.471923828125,
0.411376953125,
-0.0384521484375,
0.7265625,
0.4736328125,
-0.85009765625,
-0.51123046875,
-0.70068359375,
-0.1968994140625,
-0.5576171875,
-0.021820068359375,
-0.5029296875,
1.119140625,
-0.0596923828125,
-0.98974609375,
0.57080078125,
0.7841796875,
-1.185546875,
0.7373046875,
-0.01385498046875,
0.198486328125,
-0.72412109375,
1.0048828125,
0.416748046875,
0.24755859375,
-0.438232421875,
-0.2225341796875,
0.1424560546875,
-0.1834716796875,
0.08013916015625,
-0.53076171875,
-0.8447265625,
0.437255859375,
0.377685546875,
-0.884765625,
0.65625,
-0.89013671875,
-0.5859375,
-0.1395263671875,
-0.85009765625,
0.77392578125,
0.37841796875,
-0.2958984375,
-0.0775146484375,
-0.09295654296875,
-0.058258056640625,
0.153564453125,
0.3896484375,
-0.724609375,
0.038970947265625,
0.58349609375,
0.0714111328125,
0.336669921875,
0.03765869140625,
-0.5390625,
-0.1326904296875,
-0.497802734375,
-0.02850341796875,
0.59814453125,
0.2154541015625,
0.1512451171875,
0.1837158203125,
0.65087890625,
-0.87353515625,
-0.50732421875,
-0.050567626953125,
0.6650390625,
0.38623046875,
0.4365234375,
0.37353515625,
-0.251708984375,
-0.372314453125,
-0.53662109375,
0.5078125,
0.09454345703125,
0.5458984375,
-0.427001953125,
0.59619140625,
0.02923583984375,
-0.82177734375,
0.849609375,
-0.408935546875,
0.0252838134765625,
0.97216796875,
-0.1502685546875,
0.6015625,
-0.6005859375,
0.3515625,
-0.349853515625,
0.062286376953125,
0.6640625,
0.057647705078125,
0.49755859375,
-0.48974609375,
-0.7099609375,
-0.06396484375,
0.2327880859375,
-0.00592041015625,
-0.21142578125,
0.09393310546875,
-0.56591796875,
-0.1278076171875,
-1.154296875,
0.8984375,
0.26708984375,
0.410888671875,
0.111083984375,
0.55322265625,
-0.039337158203125,
0.37841796875,
0.3115234375,
-0.0924072265625,
0.08746337890625,
-0.64453125,
0.3359375,
0.1632080078125,
-0.297607421875,
-0.2423095703125,
-0.344970703125,
-0.51318359375,
0.390380859375,
-0.10076904296875,
0.1993408203125,
-0.74560546875,
-0.0213623046875,
-0.1090087890625,
0.64306640625,
-0.491943359375,
-0.5634765625,
-0.321044921875,
0.595703125,
0.312255859375,
-1.00390625,
0.0194244384765625,
-0.765625,
0.1915283203125,
0.51953125,
-0.135498046875,
-0.1380615234375,
-0.58935546875,
-1.103515625,
-0.734375,
0.2509765625,
0.75146484375,
0.1522216796875,
0.0201568603515625,
-1.333984375,
0.330810546875,
0.2373046875,
-0.451904296875,
0.266357421875,
-0.1954345703125,
0.01259613037109375,
0.003360748291015625,
0.74560546875,
-0.20068359375,
-0.3798828125,
0.462890625,
-1.2265625,
0.80224609375,
-0.1873779296875,
0.32421875,
-0.186279296875,
-0.2320556640625,
0.149169921875,
0.15283203125,
-0.232666015625,
-0.1776123046875,
-0.2435302734375,
0.5185546875,
-0.59912109375,
-0.755859375,
0.281494140625,
0.090576171875,
-0.1348876953125,
0.78857421875,
-0.090087890625,
-0.28564453125,
0.2261962890625,
0.2841796875,
-0.70068359375,
0.67724609375,
-0.323974609375,
0.0506591796875,
-0.00524139404296875,
-0.14111328125,
-0.14697265625,
-0.494873046875,
0.5966796875,
0.2027587890625,
-0.8291015625,
-0.67919921875,
-0.87841796875,
-0.116943359375,
0.0877685546875,
-0.5869140625,
0.369140625,
0.062408447265625,
-0.0307464599609375,
0.59521484375,
-0.382080078125,
-0.60009765625,
-0.3408203125,
-0.5068359375,
-0.2061767578125,
0.66259765625,
0.345947265625,
0.791015625,
-0.234130859375,
-0.064208984375,
-0.307373046875,
-0.2861328125,
0.078857421875,
-0.650390625,
0.06341552734375,
0.00736236572265625,
-0.08038330078125,
-0.3525390625,
0.19384765625,
-0.1026611328125,
0.459716796875,
0.79931640625,
0.296875,
0.47509765625,
0.455322265625,
-0.623046875,
0.99658203125,
0.019317626953125,
-1.0654296875,
-0.57373046875,
0.66796875,
-0.15869140625,
0.6259765625,
0.192626953125,
-0.51220703125,
-0.56005859375,
-1.3740234375,
0.172119140625,
-0.611328125,
-0.53564453125,
-0.76220703125,
-0.650390625,
-0.361083984375,
0.5126953125,
0.2296142578125,
-1.015625,
-0.118896484375,
-0.9951171875,
-0.031585693359375,
-0.8671875,
-0.2279052734375,
-0.343505859375,
-0.411865234375,
-0.279052734375,
0.9443359375,
-0.21142578125,
0.410400390625,
-0.1962890625,
0.245361328125,
0.607421875,
-0.197509765625,
-0.7958984375,
-0.6240234375,
-0.03912353515625,
-0.0755615234375,
-0.07855224609375,
0.44482421875,
-0.442138671875,
0.61572265625,
-0.93408203125,
0.34423828125,
-0.03216552734375,
0.2122802734375,
-0.240234375,
-0.461669921875,
0.984375,
-0.2744140625,
0.390869140625,
-0.32177734375,
0.76513671875,
0.974609375,
-0.087890625,
-0.857421875,
-0.21240234375,
-0.7587890625,
-0.96875,
0.448486328125,
-0.477783203125,
0.01016998291015625,
-0.67333984375,
0.0155029296875,
0.70703125,
-0.301513671875,
0.308837890625,
0.9873046875,
0.37353515625,
0.397216796875,
-0.880859375,
0.368408203125,
0.61767578125,
-0.185791015625,
0.09442138671875,
0.254150390625,
-0.57568359375,
-0.1214599609375,
-0.464111328125,
-0.80859375,
-0.66064453125,
0.02728271484375,
0.99853515625,
-0.2457275390625,
1.36328125,
-0.0014657974243164062,
-1.0146484375,
-0.337158203125,
0.80859375,
-0.288330078125,
-0.03643798828125,
0.65283203125,
0.332763671875,
0.30078125,
0.09393310546875,
-0.1939697265625,
-0.28955078125,
-0.463134765625,
1.04296875,
-0.405029296875,
-0.4013671875,
1.1318359375,
0.955078125,
-1.041015625,
-0.91943359375,
-0.0899658203125,
-0.01202392578125,
0.1954345703125,
-0.6796875,
0.564453125,
0.23486328125,
-0.381103515625,
0.25830078125,
0.361328125,
-0.164794921875,
0.475830078125,
0.256591796875,
0.2237548828125,
-0.8984375,
-0.058349609375,
0.73876953125,
-0.274658203125,
-0.642578125,
-0.46337890625,
0.024688720703125,
-0.1142578125,
-0.08050537109375,
0.89013671875,
-0.2271728515625,
0.33251953125,
0.453125,
-0.1114501953125,
0.50439453125,
-0.4970703125,
-0.54052734375,
0.1553955078125,
-0.42529296875,
-0.7138671875,
-0.342041015625,
0.225341796875,
0.0755615234375,
0.456298828125,
-0.5966796875,
0.226806640625,
0.6611328125,
0.223388671875,
-0.44482421875,
-0.623046875,
-0.56689453125,
-0.85107421875,
-0.640625,
-0.148681640625,
-0.36181640625,
-0.08526611328125,
0.27685546875,
0.06097412109375,
-0.767578125,
0.0201263427734375,
0.6142578125,
-0.68603515625,
0.032470703125,
-0.66748046875,
0.42578125,
-0.5205078125,
-0.2939453125,
-0.4013671875,
-0.060089111328125,
-0.21044921875,
-0.489013671875,
-0.6572265625,
0.33984375,
-0.12744140625,
0.183837890625,
-0.298583984375,
-0.33984375,
-0.082275390625,
-0.3232421875,
0.058746337890625,
0.251708984375,
-0.52783203125,
0.8466796875,
0.458251953125,
-0.46044921875,
0.363525390625,
-0.34765625,
-0.267333984375,
-0.09747314453125,
0.59326171875,
0.372802734375,
-0.26953125,
-0.464111328125,
-0.398193359375,
0.09942626953125,
-1.0712890625,
0.740234375,
-0.2587890625,
0.37353515625,
-0.07965087890625,
-0.203369140625,
0.6123046875,
0.94921875,
-0.065673828125,
0.493896484375,
0.369384765625,
0.07928466796875,
0.479248046875,
0.2939453125,
-0.34521484375,
0.371337890625,
-0.1612548828125,
-0.63330078125,
0.055267333984375,
0.5517578125,
-0.333740234375,
0.17626953125,
-0.1455078125,
-0.77685546875,
-0.982421875,
-0.42724609375,
-0.0943603515625,
0.5537109375,
0.69140625,
-0.393310546875,
-0.0831298828125,
0.139892578125,
-0.9814453125,
0.1590576171875,
-1.078125,
-0.83984375,
0.351318359375,
-0.1953125,
-0.35400390625,
0.1217041015625,
-0.5791015625,
0.0255279541015625,
0.33056640625,
0.1717529296875,
-0.48046875,
-0.038726806640625,
0.263916015625,
0.350830078125,
-0.1016845703125,
-0.1519775390625,
-0.30908203125,
0.462890625,
-0.857421875,
-0.91455078125,
-0.28173828125,
0.8740234375,
0.07525634765625,
0.078125,
-0.5537109375,
0.203125,
0.191650390625,
0.034149169921875,
-0.54345703125,
0.229736328125,
-0.298095703125,
0.865234375,
-0.7841796875,
0.08978271484375,
-0.047821044921875,
0.06707763671875,
-0.246826171875,
-0.0235748291015625,
-0.7763671875,
0.7822265625,
0.92626953125,
0.067626953125,
0.43603515625,
0.30224609375,
0.740234375,
0.096923828125,
-0.2459716796875,
-0.53955078125,
0.93115234375,
0.65478515625,
0.499755859375,
-0.072998046875,
0.427490234375,
0.7890625,
-0.22216796875,
0.09027099609375,
0.53662109375,
0.47705078125,
-0.6533203125,
0.07952880859375,
-0.2437744140625,
0.344970703125,
0.10369873046875,
-0.365966796875,
0.084716796875,
-0.314208984375,
-0.0298919677734375,
-0.09356689453125,
-0.79833984375,
0.650390625,
-0.34814453125,
-0.413818359375,
0.17822265625,
-0.2349853515625,
0.63330078125,
0.4580078125,
0.1268310546875,
-0.21630859375,
0.85205078125,
0.90625,
0.6318359375,
0.43212890625,
0.19384765625,
0.44970703125,
-0.2626953125,
0.07525634765625,
0.406982421875,
0.219970703125,
-0.180908203125,
-0.28466796875,
-1.0791015625,
0.60888671875,
-0.4248046875,
-0.483154296875,
0.248291015625,
-0.448974609375,
0.01024627685546875,
-0.66552734375,
0.845703125,
-0.91357421875,
0.091552734375,
0.42626953125,
-0.220458984375,
-0.305419921875,
0.59765625,
0.041595458984375,
0.5537109375,
0.36474609375,
1.0087890625,
-0.19580078125,
1.4892578125,
0.66552734375,
-0.2457275390625,
-0.217529296875,
0.27490234375,
-0.014434814453125,
-0.62353515625,
-0.060302734375,
-0.666015625,
0.07122802734375,
-0.145751953125,
-0.7060546875,
-0.0168914794921875,
0.473876953125,
0.2032470703125,
-1.2041015625,
-0.443359375,
0.1922607421875,
-0.5908203125,
0.491455078125,
0.341796875,
0.6640625,
0.54833984375,
-0.525390625,
-0.420654296875,
-0.72314453125,
-0.06903076171875,
-0.08453369140625,
0.77490234375,
-0.54638671875,
-0.374267578125,
-0.4794921875,
-0.31103515625,
-0.52880859375,
0.1693115234375,
-0.4892578125,
-0.3701171875,
0.67578125,
0.5048828125,
0.1448974609375,
0.469482421875,
-0.177734375,
0.325439453125,
1.154296875,
0.9326171875,
-0.3369140625,
1.0458984375,
0.412109375,
-0.0006814002990722656,
-0.052093505859375,
-0.486083984375,
0.68212890625,
-0.2335205078125,
-0.034912109375,
-0.2117919921875,
0.34765625,
-0.350830078125,
-1.3271484375,
0.1734619140625,
0.62060546875,
0.236328125,
-0.564453125,
-1.1767578125,
-0.447265625,
-0.85107421875,
-0.25634765625,
-0.44970703125,
0.96728515625,
0.148193359375,
-0.169677734375,
-0.0670166015625,
-0.625,
4.5546875,
0.875,
0.6689453125,
0.468017578125,
0.376220703125,
1.0126953125,
0.84375,
-0.51025390625,
-0.035797119140625,
-0.82763671875,
0.1724853515625,
-0.0709228515625,
0.3056640625,
0.837890625,
0.5,
0.4267578125,
-0.4990234375,
-0.12249755859375,
0.04266357421875,
-0.83056640625,
-0.740234375,
0.1307373046875,
0.2088623046875,
0.3583984375,
0.03631591796875,
0.37255859375,
0.62744140625,
-0.96240234375,
-0.615234375,
-0.83203125,
0.324951171875,
-0.265869140625,
0.8779296875,
-0.07403564453125,
-0.57958984375,
0.748046875,
-0.1090087890625,
-0.369873046875,
-0.52783203125,
0.15087890625,
-0.29931640625,
0.1279296875,
0.1676025390625,
-0.74609375,
0.034332275390625,
0.6787109375,
-0.724609375,
0.26904296875,
0.2296142578125,
-0.80810546875,
0.71923828125,
-0.2142333984375,
0.56640625,
-0.1727294921875,
-0.744140625,
0.31982421875,
0.447998046875,
-0.2353515625,
-0.54443359375,
0.76953125,
0.460205078125,
0.020233154296875,
0.07025146484375,
0.923828125,
-0.8359375,
0.3173828125,
-0.4765625,
0.7294921875,
-0.75244140625,
0.2041015625,
-0.455810546875,
-0.31689453125,
-0.09576416015625,
-0.296875,
0.70263671875,
0.1798095703125,
-0.47607421875,
0.4072265625,
0.1669921875,
-0.568359375,
0.15283203125,
-0.3154296875,
-0.158935546875,
-0.437255859375,
0.81787109375,
0.463623046875,
-0.71240234375,
-0.48974609375,
-0.2420654296875,
0.814453125,
0.7373046875,
0.4677734375,
0.09527587890625,
-0.95458984375,
-0.28466796875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
After the Search Ultimate program that searched for strings in a text failed, Igor K. got to think: "Why on Earth does my program work so slowly?" As he double-checked his code, he said: "My code contains no errors, yet I know how we will improve Search Ultimate!" and took a large book from the shelves. The book read "Azembler. Principally New Approach".
Having carefully thumbed through the book, Igor K. realised that, as it turns out, you can multiply the numbers dozens of times faster. "Search Ultimate will be faster than it has ever been!" — the fellow shouted happily and set to work.
Let us now clarify what Igor's idea was. The thing is that the code that was generated by a compiler was far from perfect. Standard multiplying does work slower than with the trick the book mentioned.
The Azembler language operates with 26 registers (eax, ebx, ..., ezx) and two commands:
* [x] — returns the value located in the address x. For example, [eax] returns the value that was located in the address, equal to the value in the register eax.
* lea x, y — assigns to the register x, indicated as the first operand, the second operand's address. Thus, for example, the "lea ebx, [eax]" command will write in the ebx register the content of the eax register: first the [eax] operation will be fulfilled, the result of it will be some value that lies in the address written in eax. But we do not need the value — the next operation will be lea, that will take the [eax] address, i.e., the value in the eax register, and will write it in ebx.
On the first thought the second operation seems meaningless, but as it turns out, it is acceptable to write the operation as
lea ecx, [eax + ebx],
lea ecx, [k*eax]
or even
lea ecx, [ebx + k*eax],
where k = 1, 2, 4 or 8.
As a result, the register ecx will be equal to the numbers eax + ebx, k*eax and ebx + k*eax correspondingly. However, such operation is fulfilled many times, dozens of times faster that the usual multiplying of numbers. And using several such operations, one can very quickly multiply some number by some other one. Of course, instead of eax, ebx and ecx you are allowed to use any registers.
For example, let the eax register contain some number that we should multiply by 41. It takes us 2 lines:
lea ebx, [eax + 4*eax] // now ebx = 5*eax
lea eax, [eax + 8*ebx] // now eax = eax + 8*ebx = 41*eax
Igor K. got interested in the following question: what is the minimum number of lea operations needed to multiply by the given number n and how to do it? Your task is to help him.
Consider that at the initial moment of time eax contains a number that Igor K. was about to multiply by n, and the registers from ebx to ezx contain number 0. At the final moment of time the result can be located in any register.
Input
The input data contain the only integer n (1 ≤ n ≤ 255), which Igor K. is about to multiply.
Output
On the first line print number p, which represents the minimum number of lea operations, needed to do that. Then print the program consisting of p commands, performing the operations. It is guaranteed that such program exists for any n from 1 to 255.
Use precisely the following format of commands (here k is equal to 1, 2, 4 or 8, and x, y and z are any, even coinciding registers):
lea x, [y]
lea x, [y + z]
lea x, [k*y]
lea x, [y + k*z]
Please note that extra spaces at the end of a command are unacceptable.
Examples
Input
41
Output
2
lea ebx, [eax + 4*eax]
lea ecx, [eax + 8*ebx]
Input
2
Output
1
lea ebx, [eax + eax]
Input
4
Output
1
lea ebx, [4*eax]
Submitted Solution:
```
import sys
from array import array # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
n = int(input())
if n == 1:
print(0)
exit()
inf = 10**9
dp = [inf] * (n + 1)
dp[1] = 0
prev = [[-1, -1, -1, -1] for _ in range(n + 1)]
def ok():
path = []
used_num = {n}
stack = [n]
while stack:
z = stack.pop()
if z == 1:
continue
x, mx, y, my = prev[z]
path.append([x, mx, y, my, z])
if x not in used_num:
used_num.add(x)
stack.append(x)
if y != -1 and y not in used_num:
used_num.add(y)
stack.append(y)
register_name = {x: f'e{chr(97+i)}x' for i, x in enumerate(sorted(used_num))}
ans = []
used = [0] * len(path)
for ub in sorted(used_num):
for i, (x, mx, y, my, z) in enumerate(path):
if not used[i] and max(x, y, z) <= ub:
if y == -1:
ans.append(f'lea {register_name[z]}, [{str(mx)+"*" if mx > 1 else ""}{register_name[x]}]')
else:
ans.append(f'lea {register_name[z]}, [{str(mx)+"*" if mx > 1 else ""}{register_name[x]} + {str(my)+"*" if my > 1 else ""}{register_name[y]}]')
used[i] = 1
print(len(ans))
print('\n'.join(ans))
exit()
def calc(x, y):
visited = {x, y, 1}
stack = [x, y]
res = 0
while stack:
num = stack.pop()
if num == 1:
continue
res += 1
if prev[num][0] != -1 and prev[num][0] not in visited:
visited.add(prev[num][0])
stack.append(prev[num][0])
if prev[num][2] != -1 and prev[num][2] not in visited:
visited.add(prev[num][2])
stack.append(prev[num][2])
return res
while True:
flag = 0
next_dp = dp[:]
for x in range(1, n):
if dp[x] == inf:
continue
for m in (2, 4, 8):
if x * m <= n and next_dp[x * m] > dp[x] + 1:
flag = 1
next_dp[x * m] = dp[x] + 1
prev[x * m] = [x, m, -1, -1]
for y in range(1, n):
if dp[y] == inf:
continue
for my in (1, 2, 4, 8):
if x + y * my <= n and next_dp[x + y * my] > calc(x, y) + 1:
flag = 1
next_dp[x + y * my] = calc(x, y) + 1
prev[x + y * my] = [x, 1, y, my]
dp = next_dp
if not flag:
for i in range(0, n + 1, 10):
print(f'{i:3d}:', *dp[i:i + 10], file=sys.stderr)
ok()
```
No
| 64,551
|
[
0.328369140625,
-0.2734375,
-0.378173828125,
0.1890869140625,
-0.413330078125,
-0.41357421875,
-0.07501220703125,
0.1524658203125,
-0.13134765625,
0.65283203125,
0.5927734375,
-0.0771484375,
0.156005859375,
-1.033203125,
-0.06640625,
-0.0743408203125,
-0.1275634765625,
-0.75732421875,
-0.35302734375,
0.169189453125,
-0.051239013671875,
-0.3408203125,
-1.228515625,
-0.0855712890625,
-0.265869140625,
0.5244140625,
0.455810546875,
-0.2464599609375,
0.8955078125,
1.1904296875,
-0.41845703125,
-0.37890625,
0.347412109375,
-0.85595703125,
-0.54541015625,
-0.66455078125,
0.1868896484375,
-0.8193359375,
-0.5380859375,
-0.53173828125,
0.030029296875,
-0.5634765625,
0.34912109375,
-0.52001953125,
-1.30859375,
-0.294189453125,
0.1351318359375,
-0.744140625,
0.27001953125,
-0.287353515625,
0.261962890625,
-0.5458984375,
0.322998046875,
-0.1522216796875,
0.382568359375,
0.427001953125,
0.0478515625,
0.2294921875,
-0.72607421875,
0.26025390625,
0.498291015625,
0.283447265625,
0.0214996337890625,
-0.98486328125,
0.1591796875,
0.18505859375,
-0.44580078125,
-0.2266845703125,
-0.1412353515625,
-0.82177734375,
-0.07513427734375,
0.1627197265625,
-0.56982421875,
-0.1873779296875,
-0.5869140625,
0.298583984375,
0.1177978515625,
0.057647705078125,
-0.67041015625,
0.4521484375,
0.4306640625,
0.73828125,
0.27587890625,
0.184814453125,
-0.4072265625,
-0.56298828125,
-0.233642578125,
0.10345458984375,
0.08056640625,
0.010406494140625,
-0.08489990234375,
0.495361328125,
-0.07354736328125,
0.1522216796875,
1.037109375,
0.6318359375,
-0.52099609375,
0.272705078125,
0.449462890625,
-0.1436767578125,
0.5654296875,
0.6611328125,
-0.31787109375,
0.83154296875,
-0.67236328125,
0.00879669189453125,
0.1529541015625,
-0.34228515625,
0.03216552734375,
-0.9130859375,
-0.283447265625,
0.10687255859375,
0.32275390625,
0.3857421875,
-0.1728515625,
0.5654296875,
-0.10540771484375,
0.127685546875,
-0.74462890625,
0.1724853515625,
0.2420654296875,
0.041839599609375,
0.228515625,
-0.15380859375,
0.202880859375,
-0.5107421875,
-0.60302734375,
1.1064453125,
-0.7998046875,
-0.042755126953125,
0.316162109375,
-0.05816650390625,
-0.31982421875,
0.35498046875,
-0.2457275390625,
0.7314453125,
-0.054290771484375,
0.342041015625,
0.84814453125,
-1.0546875,
0.85693359375,
-0.2431640625,
0.61767578125,
1.482421875,
0.116455078125,
-0.08197021484375,
0.5234375,
-0.2261962890625,
-0.9501953125,
0.265625,
-0.650390625,
0.458251953125,
-0.088134765625,
-0.1241455078125,
-0.46728515625,
0.254150390625,
-0.01776123046875,
0.307373046875,
0.2330322265625,
-0.1756591796875,
-0.2003173828125,
0.8642578125,
-0.484619140625,
0.70751953125,
-0.0523681640625,
0.328125,
-0.681640625,
-0.1365966796875,
-0.0709228515625,
-0.609375,
0.04022216796875,
-0.125244140625,
0.01922607421875,
0.69287109375,
0.65966796875,
0.9326171875,
1.0771484375,
0.09686279296875,
0.49169921875,
0.52099609375,
-0.48583984375,
0.1202392578125,
-0.003147125244140625,
1.09375,
0.353515625,
-0.01049041748046875,
0.1260986328125,
-0.389404296875,
-0.26171875,
-0.2958984375,
0.014739990234375,
0.71337890625,
-0.34228515625,
0.64990234375,
0.0187225341796875,
0.53369140625,
-0.82421875,
-0.034332275390625,
0.02435302734375,
-1.240234375,
-0.4931640625,
0.61376953125,
-0.058441162109375,
0.6171875,
-0.0933837890625,
-0.58642578125,
0.10687255859375,
1.04296875,
-0.19384765625,
0.60693359375,
0.875,
0.052490234375,
-0.21923828125,
0.1815185546875,
0.3916015625,
0.22998046875,
-0.41943359375,
0.54638671875,
0.010467529296875,
-0.0032329559326171875,
0.165283203125,
0.560546875,
0.343994140625,
0.201416015625,
-0.254150390625,
-0.263671875,
0.36328125,
1.2763671875,
0.1986083984375,
0.257080078125,
0.04150390625,
0.6171875,
0.234375,
0.93701171875,
0.54638671875,
0.146240234375,
0.87646484375,
0.468505859375,
-0.288818359375,
0.267822265625,
-0.126220703125,
0.58056640625,
0.56884765625,
0.78515625,
-0.20947265625,
0.1302490234375,
-0.1170654296875,
-0.1873779296875,
-0.363525390625,
0.634765625,
0.1510009765625,
0.72119140625,
0.0026721954345703125,
0.1488037109375,
-0.6201171875,
-0.203125,
0.578125,
0.615234375,
-1.0322265625,
-0.69189453125,
0.060699462890625,
0.07073974609375,
0.51123046875,
-0.08233642578125,
0.3173828125,
0.46728515625,
0.251708984375,
0.67919921875,
-0.55322265625,
-0.64208984375,
-0.4697265625,
-0.900390625,
-0.8515625,
-0.580078125,
-0.67236328125,
-0.185546875,
0.12841796875,
-0.480712890625,
0.420166015625,
-0.46142578125,
0.34716796875,
-0.288330078125,
-0.6171875,
0.8720703125,
-0.0621337890625,
0.8349609375,
-0.5419921875,
0.9638671875,
0.1571044921875,
0.689453125,
-0.44189453125,
0.07598876953125,
-0.38134765625,
-0.471923828125,
0.411376953125,
-0.0384521484375,
0.7265625,
0.4736328125,
-0.85009765625,
-0.51123046875,
-0.70068359375,
-0.1968994140625,
-0.5576171875,
-0.021820068359375,
-0.5029296875,
1.119140625,
-0.0596923828125,
-0.98974609375,
0.57080078125,
0.7841796875,
-1.185546875,
0.7373046875,
-0.01385498046875,
0.198486328125,
-0.72412109375,
1.0048828125,
0.416748046875,
0.24755859375,
-0.438232421875,
-0.2225341796875,
0.1424560546875,
-0.1834716796875,
0.08013916015625,
-0.53076171875,
-0.8447265625,
0.437255859375,
0.377685546875,
-0.884765625,
0.65625,
-0.89013671875,
-0.5859375,
-0.1395263671875,
-0.85009765625,
0.77392578125,
0.37841796875,
-0.2958984375,
-0.0775146484375,
-0.09295654296875,
-0.058258056640625,
0.153564453125,
0.3896484375,
-0.724609375,
0.038970947265625,
0.58349609375,
0.0714111328125,
0.336669921875,
0.03765869140625,
-0.5390625,
-0.1326904296875,
-0.497802734375,
-0.02850341796875,
0.59814453125,
0.2154541015625,
0.1512451171875,
0.1837158203125,
0.65087890625,
-0.87353515625,
-0.50732421875,
-0.050567626953125,
0.6650390625,
0.38623046875,
0.4365234375,
0.37353515625,
-0.251708984375,
-0.372314453125,
-0.53662109375,
0.5078125,
0.09454345703125,
0.5458984375,
-0.427001953125,
0.59619140625,
0.02923583984375,
-0.82177734375,
0.849609375,
-0.408935546875,
0.0252838134765625,
0.97216796875,
-0.1502685546875,
0.6015625,
-0.6005859375,
0.3515625,
-0.349853515625,
0.062286376953125,
0.6640625,
0.057647705078125,
0.49755859375,
-0.48974609375,
-0.7099609375,
-0.06396484375,
0.2327880859375,
-0.00592041015625,
-0.21142578125,
0.09393310546875,
-0.56591796875,
-0.1278076171875,
-1.154296875,
0.8984375,
0.26708984375,
0.410888671875,
0.111083984375,
0.55322265625,
-0.039337158203125,
0.37841796875,
0.3115234375,
-0.0924072265625,
0.08746337890625,
-0.64453125,
0.3359375,
0.1632080078125,
-0.297607421875,
-0.2423095703125,
-0.344970703125,
-0.51318359375,
0.390380859375,
-0.10076904296875,
0.1993408203125,
-0.74560546875,
-0.0213623046875,
-0.1090087890625,
0.64306640625,
-0.491943359375,
-0.5634765625,
-0.321044921875,
0.595703125,
0.312255859375,
-1.00390625,
0.0194244384765625,
-0.765625,
0.1915283203125,
0.51953125,
-0.135498046875,
-0.1380615234375,
-0.58935546875,
-1.103515625,
-0.734375,
0.2509765625,
0.75146484375,
0.1522216796875,
0.0201568603515625,
-1.333984375,
0.330810546875,
0.2373046875,
-0.451904296875,
0.266357421875,
-0.1954345703125,
0.01259613037109375,
0.003360748291015625,
0.74560546875,
-0.20068359375,
-0.3798828125,
0.462890625,
-1.2265625,
0.80224609375,
-0.1873779296875,
0.32421875,
-0.186279296875,
-0.2320556640625,
0.149169921875,
0.15283203125,
-0.232666015625,
-0.1776123046875,
-0.2435302734375,
0.5185546875,
-0.59912109375,
-0.755859375,
0.281494140625,
0.090576171875,
-0.1348876953125,
0.78857421875,
-0.090087890625,
-0.28564453125,
0.2261962890625,
0.2841796875,
-0.70068359375,
0.67724609375,
-0.323974609375,
0.0506591796875,
-0.00524139404296875,
-0.14111328125,
-0.14697265625,
-0.494873046875,
0.5966796875,
0.2027587890625,
-0.8291015625,
-0.67919921875,
-0.87841796875,
-0.116943359375,
0.0877685546875,
-0.5869140625,
0.369140625,
0.062408447265625,
-0.0307464599609375,
0.59521484375,
-0.382080078125,
-0.60009765625,
-0.3408203125,
-0.5068359375,
-0.2061767578125,
0.66259765625,
0.345947265625,
0.791015625,
-0.234130859375,
-0.064208984375,
-0.307373046875,
-0.2861328125,
0.078857421875,
-0.650390625,
0.06341552734375,
0.00736236572265625,
-0.08038330078125,
-0.3525390625,
0.19384765625,
-0.1026611328125,
0.459716796875,
0.79931640625,
0.296875,
0.47509765625,
0.455322265625,
-0.623046875,
0.99658203125,
0.019317626953125,
-1.0654296875,
-0.57373046875,
0.66796875,
-0.15869140625,
0.6259765625,
0.192626953125,
-0.51220703125,
-0.56005859375,
-1.3740234375,
0.172119140625,
-0.611328125,
-0.53564453125,
-0.76220703125,
-0.650390625,
-0.361083984375,
0.5126953125,
0.2296142578125,
-1.015625,
-0.118896484375,
-0.9951171875,
-0.031585693359375,
-0.8671875,
-0.2279052734375,
-0.343505859375,
-0.411865234375,
-0.279052734375,
0.9443359375,
-0.21142578125,
0.410400390625,
-0.1962890625,
0.245361328125,
0.607421875,
-0.197509765625,
-0.7958984375,
-0.6240234375,
-0.03912353515625,
-0.0755615234375,
-0.07855224609375,
0.44482421875,
-0.442138671875,
0.61572265625,
-0.93408203125,
0.34423828125,
-0.03216552734375,
0.2122802734375,
-0.240234375,
-0.461669921875,
0.984375,
-0.2744140625,
0.390869140625,
-0.32177734375,
0.76513671875,
0.974609375,
-0.087890625,
-0.857421875,
-0.21240234375,
-0.7587890625,
-0.96875,
0.448486328125,
-0.477783203125,
0.01016998291015625,
-0.67333984375,
0.0155029296875,
0.70703125,
-0.301513671875,
0.308837890625,
0.9873046875,
0.37353515625,
0.397216796875,
-0.880859375,
0.368408203125,
0.61767578125,
-0.185791015625,
0.09442138671875,
0.254150390625,
-0.57568359375,
-0.1214599609375,
-0.464111328125,
-0.80859375,
-0.66064453125,
0.02728271484375,
0.99853515625,
-0.2457275390625,
1.36328125,
-0.0014657974243164062,
-1.0146484375,
-0.337158203125,
0.80859375,
-0.288330078125,
-0.03643798828125,
0.65283203125,
0.332763671875,
0.30078125,
0.09393310546875,
-0.1939697265625,
-0.28955078125,
-0.463134765625,
1.04296875,
-0.405029296875,
-0.4013671875,
1.1318359375,
0.955078125,
-1.041015625,
-0.91943359375,
-0.0899658203125,
-0.01202392578125,
0.1954345703125,
-0.6796875,
0.564453125,
0.23486328125,
-0.381103515625,
0.25830078125,
0.361328125,
-0.164794921875,
0.475830078125,
0.256591796875,
0.2237548828125,
-0.8984375,
-0.058349609375,
0.73876953125,
-0.274658203125,
-0.642578125,
-0.46337890625,
0.024688720703125,
-0.1142578125,
-0.08050537109375,
0.89013671875,
-0.2271728515625,
0.33251953125,
0.453125,
-0.1114501953125,
0.50439453125,
-0.4970703125,
-0.54052734375,
0.1553955078125,
-0.42529296875,
-0.7138671875,
-0.342041015625,
0.225341796875,
0.0755615234375,
0.456298828125,
-0.5966796875,
0.226806640625,
0.6611328125,
0.223388671875,
-0.44482421875,
-0.623046875,
-0.56689453125,
-0.85107421875,
-0.640625,
-0.148681640625,
-0.36181640625,
-0.08526611328125,
0.27685546875,
0.06097412109375,
-0.767578125,
0.0201263427734375,
0.6142578125,
-0.68603515625,
0.032470703125,
-0.66748046875,
0.42578125,
-0.5205078125,
-0.2939453125,
-0.4013671875,
-0.060089111328125,
-0.21044921875,
-0.489013671875,
-0.6572265625,
0.33984375,
-0.12744140625,
0.183837890625,
-0.298583984375,
-0.33984375,
-0.082275390625,
-0.3232421875,
0.058746337890625,
0.251708984375,
-0.52783203125,
0.8466796875,
0.458251953125,
-0.46044921875,
0.363525390625,
-0.34765625,
-0.267333984375,
-0.09747314453125,
0.59326171875,
0.372802734375,
-0.26953125,
-0.464111328125,
-0.398193359375,
0.09942626953125,
-1.0712890625,
0.740234375,
-0.2587890625,
0.37353515625,
-0.07965087890625,
-0.203369140625,
0.6123046875,
0.94921875,
-0.065673828125,
0.493896484375,
0.369384765625,
0.07928466796875,
0.479248046875,
0.2939453125,
-0.34521484375,
0.371337890625,
-0.1612548828125,
-0.63330078125,
0.055267333984375,
0.5517578125,
-0.333740234375,
0.17626953125,
-0.1455078125,
-0.77685546875,
-0.982421875,
-0.42724609375,
-0.0943603515625,
0.5537109375,
0.69140625,
-0.393310546875,
-0.0831298828125,
0.139892578125,
-0.9814453125,
0.1590576171875,
-1.078125,
-0.83984375,
0.351318359375,
-0.1953125,
-0.35400390625,
0.1217041015625,
-0.5791015625,
0.0255279541015625,
0.33056640625,
0.1717529296875,
-0.48046875,
-0.038726806640625,
0.263916015625,
0.350830078125,
-0.1016845703125,
-0.1519775390625,
-0.30908203125,
0.462890625,
-0.857421875,
-0.91455078125,
-0.28173828125,
0.8740234375,
0.07525634765625,
0.078125,
-0.5537109375,
0.203125,
0.191650390625,
0.034149169921875,
-0.54345703125,
0.229736328125,
-0.298095703125,
0.865234375,
-0.7841796875,
0.08978271484375,
-0.047821044921875,
0.06707763671875,
-0.246826171875,
-0.0235748291015625,
-0.7763671875,
0.7822265625,
0.92626953125,
0.067626953125,
0.43603515625,
0.30224609375,
0.740234375,
0.096923828125,
-0.2459716796875,
-0.53955078125,
0.93115234375,
0.65478515625,
0.499755859375,
-0.072998046875,
0.427490234375,
0.7890625,
-0.22216796875,
0.09027099609375,
0.53662109375,
0.47705078125,
-0.6533203125,
0.07952880859375,
-0.2437744140625,
0.344970703125,
0.10369873046875,
-0.365966796875,
0.084716796875,
-0.314208984375,
-0.0298919677734375,
-0.09356689453125,
-0.79833984375,
0.650390625,
-0.34814453125,
-0.413818359375,
0.17822265625,
-0.2349853515625,
0.63330078125,
0.4580078125,
0.1268310546875,
-0.21630859375,
0.85205078125,
0.90625,
0.6318359375,
0.43212890625,
0.19384765625,
0.44970703125,
-0.2626953125,
0.07525634765625,
0.406982421875,
0.219970703125,
-0.180908203125,
-0.28466796875,
-1.0791015625,
0.60888671875,
-0.4248046875,
-0.483154296875,
0.248291015625,
-0.448974609375,
0.01024627685546875,
-0.66552734375,
0.845703125,
-0.91357421875,
0.091552734375,
0.42626953125,
-0.220458984375,
-0.305419921875,
0.59765625,
0.041595458984375,
0.5537109375,
0.36474609375,
1.0087890625,
-0.19580078125,
1.4892578125,
0.66552734375,
-0.2457275390625,
-0.217529296875,
0.27490234375,
-0.014434814453125,
-0.62353515625,
-0.060302734375,
-0.666015625,
0.07122802734375,
-0.145751953125,
-0.7060546875,
-0.0168914794921875,
0.473876953125,
0.2032470703125,
-1.2041015625,
-0.443359375,
0.1922607421875,
-0.5908203125,
0.491455078125,
0.341796875,
0.6640625,
0.54833984375,
-0.525390625,
-0.420654296875,
-0.72314453125,
-0.06903076171875,
-0.08453369140625,
0.77490234375,
-0.54638671875,
-0.374267578125,
-0.4794921875,
-0.31103515625,
-0.52880859375,
0.1693115234375,
-0.4892578125,
-0.3701171875,
0.67578125,
0.5048828125,
0.1448974609375,
0.469482421875,
-0.177734375,
0.325439453125,
1.154296875,
0.9326171875,
-0.3369140625,
1.0458984375,
0.412109375,
-0.0006814002990722656,
-0.052093505859375,
-0.486083984375,
0.68212890625,
-0.2335205078125,
-0.034912109375,
-0.2117919921875,
0.34765625,
-0.350830078125,
-1.3271484375,
0.1734619140625,
0.62060546875,
0.236328125,
-0.564453125,
-1.1767578125,
-0.447265625,
-0.85107421875,
-0.25634765625,
-0.44970703125,
0.96728515625,
0.148193359375,
-0.169677734375,
-0.0670166015625,
-0.625,
4.5546875,
0.875,
0.6689453125,
0.468017578125,
0.376220703125,
1.0126953125,
0.84375,
-0.51025390625,
-0.035797119140625,
-0.82763671875,
0.1724853515625,
-0.0709228515625,
0.3056640625,
0.837890625,
0.5,
0.4267578125,
-0.4990234375,
-0.12249755859375,
0.04266357421875,
-0.83056640625,
-0.740234375,
0.1307373046875,
0.2088623046875,
0.3583984375,
0.03631591796875,
0.37255859375,
0.62744140625,
-0.96240234375,
-0.615234375,
-0.83203125,
0.324951171875,
-0.265869140625,
0.8779296875,
-0.07403564453125,
-0.57958984375,
0.748046875,
-0.1090087890625,
-0.369873046875,
-0.52783203125,
0.15087890625,
-0.29931640625,
0.1279296875,
0.1676025390625,
-0.74609375,
0.034332275390625,
0.6787109375,
-0.724609375,
0.26904296875,
0.2296142578125,
-0.80810546875,
0.71923828125,
-0.2142333984375,
0.56640625,
-0.1727294921875,
-0.744140625,
0.31982421875,
0.447998046875,
-0.2353515625,
-0.54443359375,
0.76953125,
0.460205078125,
0.020233154296875,
0.07025146484375,
0.923828125,
-0.8359375,
0.3173828125,
-0.4765625,
0.7294921875,
-0.75244140625,
0.2041015625,
-0.455810546875,
-0.31689453125,
-0.09576416015625,
-0.296875,
0.70263671875,
0.1798095703125,
-0.47607421875,
0.4072265625,
0.1669921875,
-0.568359375,
0.15283203125,
-0.3154296875,
-0.158935546875,
-0.437255859375,
0.81787109375,
0.463623046875,
-0.71240234375,
-0.48974609375,
-0.2420654296875,
0.814453125,
0.7373046875,
0.4677734375,
0.09527587890625,
-0.95458984375,
-0.28466796875
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Digits Are Not Just Characters
Mr. Manuel Majorana Minore made a number of files with numbers in their names. He wants to have a list of the files, but the file listing command commonly used lists them in an order different from what he prefers, interpreting digit sequences in them as ASCII code sequences, not as numbers. For example, the files file10, file20 and file3 are listed in this order.
Write a program which decides the orders of file names interpreting digit sequences as numeric values.
Each file name consists of uppercase letters (from 'A' to 'Z'), lowercase letters (from 'a' to 'z'), and digits (from '0' to '9').
A file name is looked upon as a sequence of items, each being either a letter or a number. Each single uppercase or lowercase letter forms a letter item. Each consecutive sequence of digits forms a number item.
Two item are ordered as follows.
* Number items come before letter items.
* Two letter items are ordered by their ASCII codes.
* Two number items are ordered by their values when interpreted as decimal numbers.
Two file names are compared item by item, starting from the top, and the order of the first different corresponding items decides the order of the file names. If one of them, say $A$, has more items than the other, $B$, and all the items of $B$ are the same as the corresponding items of $A$, $B$ should come before.
For example, three file names in Sample Input 1, file10, file20, and file3 all start with the same sequence of four letter items f, i, l, and e, followed by a number item, 10, 20, and 3, respectively. Comparing numeric values of these number items, they are ordered as file3 $<$ file10 $<$ file20.
Input
The input consists of a single test case of the following format.
$n$
$s_0$
$s_1$
:
$s_n$
The integer $n$ in the first line gives the number of file names ($s_1$ through $s_n$) to be compared with the file name given in the next line ($s_0$). Here, $n$ satisfies $1 \leq n \leq 1000$.
The following $n + 1$ lines are file names, $s_0$ through $s_n$, one in each line. They have at least one and no more than nine characters. Each of the characters is either an uppercase letter, a lowercase letter, or a digit.
Sequences of digits in the file names never start with a digit zero (0).
Output
For each of the file names, $s_1$ through $s_n$, output one line with a character indicating whether it should come before $s_0$ or not. The character should be "-" if it is to be listed before $s_0$; otherwise, it should be "+", including cases where two names are identical.
Sample Input 1
2
file10
file20
file3
Sample Output 1
+
-
Sample Input 2
11
X52Y
X
X5
X52
X52Y
X52Y6
32
ABC
XYZ
x51y
X8Y
X222
Sample Output 2
-
-
-
+
+
-
-
+
+
-
+
Example
Input
2
file10
file20
file3
Output
+
-
"Correct Solution:
```
N = int(input())
S = [input() for _ in range(N + 1)]
def convert(s):
l = []
for i in range(len(s)):
if s[i].isdigit():
if len(l) != 0 and isinstance(l[-1], list):
l[-1].append(s[i])
else:
l.append([s[i]])
else:
l.append(s[i])
return [int(''.join(e)) if isinstance(e, list) else e for e in l]
S = [convert(e) for e in S]
t = S[0]
def compare(s):
for i in range(min([len(s), len(t)])):
if type(s[i]) == type(t[i]):
if s[i] < t[i]:
return '-'
elif s[i] > t[i]:
return '+'
else:
if type(s[i]) == int:
return '-'
else:
return '+'
if len(t) <= len(s):
return '+'
else:
return '-'
for s in S[1:]:
print(compare(s))
```
| 64,777
|
[
0.4072265625,
0.00583648681640625,
0.52197265625,
-0.016876220703125,
-0.06732177734375,
-0.23046875,
-0.2275390625,
0.09503173828125,
-0.1092529296875,
1.1748046875,
0.49951171875,
0.0159912109375,
0.287353515625,
-0.734375,
-0.77783203125,
0.1534423828125,
-0.26318359375,
-0.615234375,
-0.2398681640625,
-0.207275390625,
0.2042236328125,
0.398193359375,
-1.298828125,
-0.6123046875,
-0.60986328125,
0.6767578125,
0.44921875,
-0.00901031494140625,
0.81201171875,
0.86767578125,
0.049530029296875,
-0.463134765625,
0.9560546875,
-0.72021484375,
-0.1412353515625,
-0.36962890625,
0.7744140625,
-0.68310546875,
-0.2437744140625,
-0.64794921875,
0.2198486328125,
-0.365966796875,
0.78076171875,
-0.96533203125,
-1.2919921875,
-0.01291656494140625,
-0.0859375,
-0.27978515625,
-0.307861328125,
-0.5869140625,
0.38232421875,
0.0430908203125,
0.3232421875,
-0.085693359375,
-0.30859375,
-0.29736328125,
0.1331787109375,
-0.217529296875,
-0.407470703125,
-0.2100830078125,
-0.343505859375,
0.058990478515625,
0.10662841796875,
-0.38427734375,
-0.0019779205322265625,
0.481689453125,
-0.266845703125,
-0.52392578125,
0.00934600830078125,
-0.9580078125,
-0.316162109375,
0.425537109375,
-0.35791015625,
0.0992431640625,
-0.7822265625,
-0.04400634765625,
0.036590576171875,
-0.047637939453125,
-0.207763671875,
0.669921875,
0.2020263671875,
0.984375,
-0.00009238719940185547,
0.5361328125,
-0.611328125,
-0.416015625,
0.150390625,
-0.14501953125,
0.425048828125,
0.05523681640625,
-0.1929931640625,
0.413818359375,
-0.68701171875,
0.0272674560546875,
0.76123046875,
0.76708984375,
-0.12469482421875,
0.6484375,
0.50048828125,
0.51806640625,
0.70166015625,
1.392578125,
-0.1197509765625,
0.9912109375,
-0.56005859375,
-0.0689697265625,
0.4541015625,
-0.11004638671875,
-0.182373046875,
-0.493896484375,
0.09246826171875,
-0.429931640625,
0.0302276611328125,
-0.2310791015625,
-0.7578125,
0.99951171875,
0.24755859375,
0.27001953125,
-0.9267578125,
0.1314697265625,
0.231201171875,
-0.041534423828125,
0.60693359375,
-0.444580078125,
-0.11553955078125,
-0.33447265625,
-0.689453125,
0.8681640625,
-0.2471923828125,
-0.33740234375,
0.217041015625,
-0.040557861328125,
-0.052459716796875,
0.05804443359375,
-0.2493896484375,
0.87939453125,
-0.1864013671875,
0.54150390625,
0.489501953125,
-0.603515625,
0.623046875,
-0.2305908203125,
-0.1510009765625,
1.748046875,
0.01519012451171875,
0.411865234375,
0.273193359375,
0.18701171875,
-0.6728515625,
0.1572265625,
-0.424072265625,
0.728515625,
0.1170654296875,
0.121337890625,
-0.4951171875,
0.2254638671875,
0.134033203125,
0.37060546875,
0.36962890625,
0.311279296875,
-0.5517578125,
0.08697509765625,
0.04376220703125,
0.32080078125,
-0.005401611328125,
1.1064453125,
-0.66748046875,
0.0528564453125,
-0.2607421875,
-0.275634765625,
0.3828125,
0.148681640625,
-0.027313232421875,
0.73876953125,
0.73095703125,
0.7548828125,
0.56005859375,
-0.191650390625,
0.2489013671875,
0.206787109375,
-0.33251953125,
0.0809326171875,
0.13134765625,
0.422607421875,
0.1444091796875,
0.32861328125,
0.304443359375,
-0.352783203125,
-0.88330078125,
-0.955078125,
0.100341796875,
0.9013671875,
-0.478271484375,
0.58447265625,
0.224365234375,
-0.08978271484375,
-0.95458984375,
-0.29296875,
0.2237548828125,
-1.181640625,
-0.58935546875,
0.65185546875,
-0.270751953125,
0.1456298828125,
-0.338623046875,
-0.125,
0.541015625,
1.3193359375,
-0.290283203125,
0.01898193359375,
0.376708984375,
0.09112548828125,
0.0545654296875,
0.041839599609375,
0.164794921875,
-0.01739501953125,
-0.45361328125,
0.390869140625,
-0.87255859375,
0.1495361328125,
0.0794677734375,
1.1240234375,
0.088623046875,
0.48681640625,
0.0234222412109375,
-0.440185546875,
0.64599609375,
0.85791015625,
-0.0966796875,
0.466064453125,
0.154052734375,
0.9130859375,
0.43505859375,
0.53515625,
0.7177734375,
0.333740234375,
0.89404296875,
0.7451171875,
-0.33544921875,
0.465087890625,
-0.2093505859375,
0.020477294921875,
0.222900390625,
0.434814453125,
0.3046875,
0.38720703125,
-0.07513427734375,
0.0276947021484375,
-0.37060546875,
0.452392578125,
-0.1768798828125,
0.77685546875,
0.039794921875,
0.366455078125,
-0.20263671875,
-0.414794921875,
0.10406494140625,
0.83203125,
-1.005859375,
-0.6982421875,
0.146484375,
-0.11334228515625,
0.35546875,
0.016082763671875,
0.321044921875,
0.76416015625,
0.2266845703125,
0.8291015625,
-0.1463623046875,
-0.5400390625,
-0.78369140625,
-0.58544921875,
-0.81201171875,
0.037261962890625,
-0.7138671875,
-0.247314453125,
0.2607421875,
-0.75927734375,
0.32421875,
-0.168701171875,
-0.134765625,
-0.09893798828125,
-0.408203125,
0.49365234375,
-0.292236328125,
0.294189453125,
-0.78125,
0.58935546875,
-0.09967041015625,
0.78125,
-0.63037109375,
-0.2467041015625,
-0.4287109375,
-0.56689453125,
0.4521484375,
0.31005859375,
0.56689453125,
-0.209716796875,
-0.29541015625,
-1.0263671875,
-0.82421875,
-0.448974609375,
-0.5185546875,
0.09454345703125,
-0.458740234375,
0.67919921875,
0.6123046875,
-0.71728515625,
0.68408203125,
0.9921875,
-1.138671875,
0.24462890625,
0.61083984375,
0.234375,
-0.69921875,
1.56640625,
0.214111328125,
0.49658203125,
-0.23046875,
-0.28369140625,
-0.6728515625,
0.2200927734375,
0.212646484375,
-0.7421875,
-0.57421875,
0.56640625,
0.0465087890625,
-0.91357421875,
0.363525390625,
-1.064453125,
-0.419189453125,
-0.08233642578125,
-0.60791015625,
0.845703125,
0.45166015625,
0.479736328125,
-0.57470703125,
-0.11810302734375,
-0.15576171875,
0.63134765625,
-0.181640625,
-0.5947265625,
-0.061981201171875,
0.74658203125,
0.28662109375,
0.1199951171875,
0.325927734375,
-0.6123046875,
0.08734130859375,
-0.295654296875,
0.3232421875,
0.6357421875,
0.1365966796875,
0.141357421875,
0.173583984375,
0.6416015625,
-1.037109375,
-0.26953125,
-0.80615234375,
0.73046875,
0.352294921875,
0.6064453125,
0.0994873046875,
-0.53759765625,
-0.11962890625,
-0.85400390625,
0.260009765625,
-0.347900390625,
0.93603515625,
-0.77587890625,
0.81103515625,
0.071533203125,
-0.463623046875,
0.84130859375,
-0.61328125,
0.026702880859375,
1.23828125,
-0.0030841827392578125,
0.86279296875,
-0.64453125,
0.412353515625,
-0.364013671875,
0.1129150390625,
0.12158203125,
-0.0869140625,
0.68115234375,
-0.048828125,
-0.348388671875,
-0.61181640625,
-0.13916015625,
-0.145751953125,
-0.7158203125,
-0.033843994140625,
0.041046142578125,
-0.497802734375,
-0.92431640625,
0.59814453125,
0.998046875,
0.4990234375,
-0.08795166015625,
0.6923828125,
0.0352783203125,
0.296875,
0.5498046875,
-0.29833984375,
0.03411865234375,
-0.69873046875,
0.7216796875,
0.052398681640625,
-0.332275390625,
-0.568359375,
-0.6494140625,
-0.18115234375,
0.1749267578125,
-0.02520751953125,
0.2159423828125,
-0.892578125,
0.269775390625,
-0.0267333984375,
0.382080078125,
-0.60791015625,
-0.334716796875,
-0.5263671875,
0.767578125,
0.56689453125,
-0.564453125,
0.0484619140625,
-0.5,
0.367431640625,
0.39208984375,
-0.247802734375,
-0.235107421875,
-0.59375,
-0.84423828125,
-0.52734375,
0.492431640625,
0.7626953125,
-0.0198211669921875,
0.5498046875,
-0.98876953125,
0.419189453125,
0.0772705078125,
-0.1444091796875,
0.341796875,
0.027313232421875,
0.12322998046875,
0.4677734375,
0.66552734375,
0.034820556640625,
-0.48095703125,
0.21875,
-1.099609375,
0.52685546875,
-0.479248046875,
0.779296875,
0.331298828125,
-0.024688720703125,
-0.55078125,
0.4169921875,
-0.59912109375,
0.042266845703125,
-0.1319580078125,
0.330322265625,
-0.9453125,
-0.94140625,
0.67236328125,
-0.407958984375,
-0.31005859375,
0.64892578125,
-0.08050537109375,
-0.3046875,
0.2529296875,
0.51416015625,
-0.445068359375,
0.58349609375,
-0.06072998046875,
0.392333984375,
-0.4169921875,
-0.0958251953125,
-0.348388671875,
-0.49462890625,
0.91455078125,
0.33154296875,
-0.880859375,
0.0909423828125,
-1.2138671875,
-0.611328125,
-0.1597900390625,
-0.490966796875,
0.2437744140625,
0.042938232421875,
-0.326904296875,
-0.0305633544921875,
-0.654296875,
-0.34326171875,
-0.26806640625,
-1.001953125,
-0.384521484375,
0.37353515625,
0.1890869140625,
0.57861328125,
-0.162109375,
-0.06414794921875,
0.424072265625,
-0.0819091796875,
-0.08233642578125,
-0.50927734375,
0.3095703125,
-0.072509765625,
-0.27197265625,
-0.4619140625,
0.23046875,
0.52978515625,
0.384521484375,
0.66015625,
0.38330078125,
0.60205078125,
0.2176513671875,
-0.465087890625,
1.046875,
-0.04620361328125,
-1.0927734375,
-0.61962890625,
0.525390625,
-0.1446533203125,
0.83837890625,
0.2451171875,
-1.0439453125,
-0.8701171875,
-1.763671875,
0.2481689453125,
-0.63623046875,
-0.2978515625,
-0.875,
-0.5927734375,
-0.1802978515625,
0.6259765625,
-0.2314453125,
-0.46240234375,
0.056732177734375,
-0.9970703125,
0.04376220703125,
-0.734375,
-0.60009765625,
-0.54638671875,
-0.2470703125,
-0.29345703125,
1.130859375,
-0.0198211669921875,
-0.078857421875,
0.5029296875,
0.374267578125,
0.31201171875,
-0.30078125,
-0.86962890625,
-0.258544921875,
-0.058990478515625,
0.10845947265625,
-0.1802978515625,
0.2198486328125,
-0.71240234375,
0.822265625,
-1.1044921875,
-0.241943359375,
0.00672149658203125,
-0.5166015625,
-0.252197265625,
-0.3701171875,
1.0380859375,
-0.521484375,
-0.40380859375,
-0.390869140625,
0.497314453125,
0.56640625,
-0.396728515625,
0.0204315185546875,
-0.392822265625,
-0.10498046875,
-0.6962890625,
0.51513671875,
-0.75,
-0.282470703125,
-0.58447265625,
0.035980224609375,
1.3818359375,
-0.8935546875,
0.6220703125,
1.109375,
0.07470703125,
-0.03826904296875,
-0.53564453125,
0.1971435546875,
0.255615234375,
-0.63623046875,
-0.12371826171875,
-0.1702880859375,
-0.720703125,
-0.03814697265625,
-0.4599609375,
-1.2041015625,
-0.55322265625,
0.24072265625,
1.404296875,
-0.301025390625,
0.828125,
0.055908203125,
-0.74072265625,
-0.35888671875,
1.05078125,
-0.433349609375,
0.39794921875,
1.0732421875,
-0.09368896484375,
-0.12225341796875,
0.2568359375,
-0.35693359375,
-0.411865234375,
-0.06597900390625,
1.4111328125,
-0.40576171875,
-0.44140625,
0.7509765625,
0.9423828125,
-0.9287109375,
-0.73876953125,
-0.1046142578125,
0.318115234375,
0.0007939338684082031,
-0.52685546875,
-0.1593017578125,
0.68017578125,
-0.6669921875,
0.349609375,
0.349853515625,
0.004825592041015625,
0.34375,
-0.1126708984375,
0.43701171875,
-0.59765625,
0.28759765625,
0.85888671875,
-0.70947265625,
-0.496826171875,
-0.8134765625,
-0.1236572265625,
-0.204833984375,
-0.2147216796875,
0.76513671875,
-0.3623046875,
0.1702880859375,
0.7470703125,
0.1295166015625,
0.65087890625,
-0.443115234375,
0.029052734375,
-0.08172607421875,
-0.4423828125,
-0.354248046875,
-0.1632080078125,
0.415283203125,
-0.17529296875,
0.30908203125,
-0.849609375,
0.0278167724609375,
0.517578125,
0.54296875,
-0.279052734375,
-1.2705078125,
-0.30029296875,
-0.94384765625,
-0.258056640625,
-0.482421875,
-0.81689453125,
-0.359619140625,
-0.11248779296875,
0.1416015625,
-0.6708984375,
0.2152099609375,
0.327880859375,
-0.82275390625,
0.71435546875,
-0.984375,
0.2265625,
-0.525390625,
-0.343017578125,
-0.9921875,
0.2467041015625,
0.129638671875,
-0.312744140625,
-0.55078125,
-0.2213134765625,
-0.048309326171875,
0.2196044921875,
-0.07171630859375,
0.337890625,
-0.0235595703125,
-0.5947265625,
-0.06658935546875,
0.04791259765625,
-0.07586669921875,
0.9775390625,
0.58837890625,
0.46240234375,
0.708984375,
-0.157958984375,
-0.424072265625,
-0.396484375,
0.6572265625,
0.68310546875,
-0.47802734375,
-0.173095703125,
-0.0762939453125,
0.357177734375,
-1.05859375,
0.1781005859375,
-0.1182861328125,
0.298095703125,
0.10101318359375,
-0.27880859375,
0.4501953125,
1.21484375,
-0.330322265625,
0.53173828125,
0.10638427734375,
0.361572265625,
0.492919921875,
-0.376953125,
0.259521484375,
0.62890625,
0.3037109375,
-0.10357666015625,
0.137451171875,
0.182861328125,
-0.0965576171875,
0.426025390625,
-0.389404296875,
-0.454833984375,
-0.89111328125,
-0.31689453125,
-0.15966796875,
0.24951171875,
0.53076171875,
-0.517578125,
-0.480712890625,
-0.0313720703125,
-0.5302734375,
0.05010986328125,
-1.474609375,
-1.0908203125,
0.60107421875,
-0.427001953125,
-0.72509765625,
-0.59619140625,
-0.60546875,
0.31787109375,
0.464111328125,
0.58447265625,
-0.634765625,
0.41064453125,
-0.048919677734375,
0.6318359375,
-0.1396484375,
-0.457275390625,
0.0673828125,
0.3720703125,
-0.3955078125,
-0.475830078125,
0.267822265625,
0.595703125,
0.11395263671875,
-0.41796875,
-0.57666015625,
-0.0128631591796875,
0.2230224609375,
-0.2095947265625,
-0.51025390625,
0.12054443359375,
-0.11376953125,
0.853515625,
-0.6796875,
0.06927490234375,
-0.181884765625,
0.2042236328125,
0.283203125,
-0.486328125,
-0.65576171875,
0.89990234375,
0.798828125,
-0.180419921875,
0.416015625,
0.267822265625,
0.66796875,
-0.494384765625,
-0.0019969940185546875,
0.248291015625,
0.3740234375,
0.58544921875,
0.66943359375,
-0.478515625,
0.5478515625,
0.7353515625,
-0.0277099609375,
0.04547119140625,
0.1827392578125,
0.02532958984375,
-0.0289459228515625,
0.006923675537109375,
-0.2213134765625,
-0.30615234375,
0.38916015625,
-0.32080078125,
0.249755859375,
-0.1400146484375,
-0.28759765625,
-0.34814453125,
-0.712890625,
0.6025390625,
-0.41015625,
-0.31494140625,
-0.35107421875,
-0.60693359375,
0.419189453125,
0.438720703125,
-0.0158843994140625,
0.267333984375,
0.81787109375,
0.94970703125,
-0.134033203125,
0.69873046875,
0.446044921875,
0.6728515625,
-0.81298828125,
-0.1826171875,
0.017181396484375,
-0.09478759765625,
-0.1717529296875,
-0.26416015625,
-0.8701171875,
0.1878662109375,
-0.2626953125,
-0.2861328125,
0.69384765625,
-0.7724609375,
-0.05584716796875,
-0.299560546875,
0.98828125,
-0.83251953125,
0.49072265625,
0.69677734375,
-0.1488037109375,
-0.297607421875,
0.85546875,
-0.2125244140625,
0.28125,
0.248046875,
0.83935546875,
0.004711151123046875,
1.646484375,
0.441650390625,
-0.47802734375,
0.38427734375,
0.58203125,
-0.4912109375,
-0.552734375,
-0.22021484375,
-0.196044921875,
-0.1727294921875,
-0.35546875,
-0.1180419921875,
-0.0036144256591796875,
0.66796875,
0.311279296875,
-0.50537109375,
-0.0484619140625,
0.2353515625,
-0.7724609375,
0.329833984375,
0.2646484375,
0.350341796875,
0.2261962890625,
0.2080078125,
-0.237548828125,
-0.74072265625,
0.06707763671875,
-0.7373046875,
0.7763671875,
-0.36865234375,
-0.29248046875,
-0.908203125,
-0.82470703125,
-0.411865234375,
0.234619140625,
-0.25244140625,
-0.73046875,
0.50732421875,
0.66259765625,
0.2152099609375,
0.1951904296875,
-0.40673828125,
0.11883544921875,
0.92431640625,
1.4404296875,
-0.026458740234375,
0.247802734375,
0.71044921875,
-0.074951171875,
0.2445068359375,
-0.21923828125,
0.041412353515625,
0.27880859375,
0.0213623046875,
-0.22607421875,
0.1309814453125,
-0.4755859375,
-1.1787109375,
0.0682373046875,
0.4423828125,
-0.0027217864990234375,
-0.378173828125,
-1.099609375,
-0.421630859375,
-0.9111328125,
0.243896484375,
-0.9052734375,
0.919921875,
-0.264892578125,
-0.192138671875,
0.0015926361083984375,
-0.927734375,
4.35546875,
0.9091796875,
0.9580078125,
0.414306640625,
0.08050537109375,
0.7587890625,
0.403564453125,
-0.317138671875,
-0.3974609375,
-0.953125,
0.75634765625,
-1.1181640625,
-0.1566162109375,
0.763671875,
0.10638427734375,
0.5029296875,
-0.78466796875,
-0.1024169921875,
0.406494140625,
-1.1025390625,
-0.876953125,
-0.267578125,
-0.62548828125,
0.41064453125,
-0.471435546875,
0.46435546875,
0.666015625,
-0.94189453125,
-0.2685546875,
-0.505859375,
-0.258544921875,
-0.81298828125,
0.62841796875,
0.11968994140625,
-0.1976318359375,
0.630859375,
-0.0634765625,
-0.1566162109375,
-0.3916015625,
0.366455078125,
-0.145263671875,
0.56591796875,
0.75244140625,
-0.966796875,
-0.307861328125,
0.537109375,
-0.335693359375,
-0.044464111328125,
0.44921875,
-1.015625,
1.162109375,
-0.03680419921875,
0.55908203125,
-0.6630859375,
-1.060546875,
0.7900390625,
0.82080078125,
0.3056640625,
-0.1572265625,
0.26513671875,
0.39404296875,
0.54931640625,
0.2210693359375,
0.419677734375,
-0.9384765625,
0.83837890625,
0.053436279296875,
0.306396484375,
0.0830078125,
-0.05853271484375,
-0.00113677978515625,
-0.56982421875,
-0.0479736328125,
-0.30712890625,
0.37060546875,
-0.03326416015625,
0.1585693359375,
0.53955078125,
0.4189453125,
-0.66455078125,
-0.10382080078125,
-0.338623046875,
-0.56982421875,
-0.441162109375,
0.9482421875,
0.83935546875,
-0.50390625,
-0.2301025390625,
-0.35888671875,
0.5283203125,
0.6123046875,
0.489501953125,
0.197998046875,
-0.344482421875,
-0.09320068359375
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Digits Are Not Just Characters
Mr. Manuel Majorana Minore made a number of files with numbers in their names. He wants to have a list of the files, but the file listing command commonly used lists them in an order different from what he prefers, interpreting digit sequences in them as ASCII code sequences, not as numbers. For example, the files file10, file20 and file3 are listed in this order.
Write a program which decides the orders of file names interpreting digit sequences as numeric values.
Each file name consists of uppercase letters (from 'A' to 'Z'), lowercase letters (from 'a' to 'z'), and digits (from '0' to '9').
A file name is looked upon as a sequence of items, each being either a letter or a number. Each single uppercase or lowercase letter forms a letter item. Each consecutive sequence of digits forms a number item.
Two item are ordered as follows.
* Number items come before letter items.
* Two letter items are ordered by their ASCII codes.
* Two number items are ordered by their values when interpreted as decimal numbers.
Two file names are compared item by item, starting from the top, and the order of the first different corresponding items decides the order of the file names. If one of them, say $A$, has more items than the other, $B$, and all the items of $B$ are the same as the corresponding items of $A$, $B$ should come before.
For example, three file names in Sample Input 1, file10, file20, and file3 all start with the same sequence of four letter items f, i, l, and e, followed by a number item, 10, 20, and 3, respectively. Comparing numeric values of these number items, they are ordered as file3 $<$ file10 $<$ file20.
Input
The input consists of a single test case of the following format.
$n$
$s_0$
$s_1$
:
$s_n$
The integer $n$ in the first line gives the number of file names ($s_1$ through $s_n$) to be compared with the file name given in the next line ($s_0$). Here, $n$ satisfies $1 \leq n \leq 1000$.
The following $n + 1$ lines are file names, $s_0$ through $s_n$, one in each line. They have at least one and no more than nine characters. Each of the characters is either an uppercase letter, a lowercase letter, or a digit.
Sequences of digits in the file names never start with a digit zero (0).
Output
For each of the file names, $s_1$ through $s_n$, output one line with a character indicating whether it should come before $s_0$ or not. The character should be "-" if it is to be listed before $s_0$; otherwise, it should be "+", including cases where two names are identical.
Sample Input 1
2
file10
file20
file3
Sample Output 1
+
-
Sample Input 2
11
X52Y
X
X5
X52
X52Y
X52Y6
32
ABC
XYZ
x51y
X8Y
X222
Sample Output 2
-
-
-
+
+
-
-
+
+
-
+
Example
Input
2
file10
file20
file3
Output
+
-
"Correct Solution:
```
import re
n=int(input())
s=[ ''.join(map(lambda x : '{0:09d}'.format(int(x)) if '0' <= x[0] <= '9' else x, re.sub(r'\d+', r' \g<0> ',input()).split()))for _ in range(n+1) ]
for i in range(1,n+1):
print('-' if s[i] < s[0] else '+')
```
| 64,778
|
[
0.4072265625,
0.00583648681640625,
0.52197265625,
-0.016876220703125,
-0.06732177734375,
-0.23046875,
-0.2275390625,
0.09503173828125,
-0.1092529296875,
1.1748046875,
0.49951171875,
0.0159912109375,
0.287353515625,
-0.734375,
-0.77783203125,
0.1534423828125,
-0.26318359375,
-0.615234375,
-0.2398681640625,
-0.207275390625,
0.2042236328125,
0.398193359375,
-1.298828125,
-0.6123046875,
-0.60986328125,
0.6767578125,
0.44921875,
-0.00901031494140625,
0.81201171875,
0.86767578125,
0.049530029296875,
-0.463134765625,
0.9560546875,
-0.72021484375,
-0.1412353515625,
-0.36962890625,
0.7744140625,
-0.68310546875,
-0.2437744140625,
-0.64794921875,
0.2198486328125,
-0.365966796875,
0.78076171875,
-0.96533203125,
-1.2919921875,
-0.01291656494140625,
-0.0859375,
-0.27978515625,
-0.307861328125,
-0.5869140625,
0.38232421875,
0.0430908203125,
0.3232421875,
-0.085693359375,
-0.30859375,
-0.29736328125,
0.1331787109375,
-0.217529296875,
-0.407470703125,
-0.2100830078125,
-0.343505859375,
0.058990478515625,
0.10662841796875,
-0.38427734375,
-0.0019779205322265625,
0.481689453125,
-0.266845703125,
-0.52392578125,
0.00934600830078125,
-0.9580078125,
-0.316162109375,
0.425537109375,
-0.35791015625,
0.0992431640625,
-0.7822265625,
-0.04400634765625,
0.036590576171875,
-0.047637939453125,
-0.207763671875,
0.669921875,
0.2020263671875,
0.984375,
-0.00009238719940185547,
0.5361328125,
-0.611328125,
-0.416015625,
0.150390625,
-0.14501953125,
0.425048828125,
0.05523681640625,
-0.1929931640625,
0.413818359375,
-0.68701171875,
0.0272674560546875,
0.76123046875,
0.76708984375,
-0.12469482421875,
0.6484375,
0.50048828125,
0.51806640625,
0.70166015625,
1.392578125,
-0.1197509765625,
0.9912109375,
-0.56005859375,
-0.0689697265625,
0.4541015625,
-0.11004638671875,
-0.182373046875,
-0.493896484375,
0.09246826171875,
-0.429931640625,
0.0302276611328125,
-0.2310791015625,
-0.7578125,
0.99951171875,
0.24755859375,
0.27001953125,
-0.9267578125,
0.1314697265625,
0.231201171875,
-0.041534423828125,
0.60693359375,
-0.444580078125,
-0.11553955078125,
-0.33447265625,
-0.689453125,
0.8681640625,
-0.2471923828125,
-0.33740234375,
0.217041015625,
-0.040557861328125,
-0.052459716796875,
0.05804443359375,
-0.2493896484375,
0.87939453125,
-0.1864013671875,
0.54150390625,
0.489501953125,
-0.603515625,
0.623046875,
-0.2305908203125,
-0.1510009765625,
1.748046875,
0.01519012451171875,
0.411865234375,
0.273193359375,
0.18701171875,
-0.6728515625,
0.1572265625,
-0.424072265625,
0.728515625,
0.1170654296875,
0.121337890625,
-0.4951171875,
0.2254638671875,
0.134033203125,
0.37060546875,
0.36962890625,
0.311279296875,
-0.5517578125,
0.08697509765625,
0.04376220703125,
0.32080078125,
-0.005401611328125,
1.1064453125,
-0.66748046875,
0.0528564453125,
-0.2607421875,
-0.275634765625,
0.3828125,
0.148681640625,
-0.027313232421875,
0.73876953125,
0.73095703125,
0.7548828125,
0.56005859375,
-0.191650390625,
0.2489013671875,
0.206787109375,
-0.33251953125,
0.0809326171875,
0.13134765625,
0.422607421875,
0.1444091796875,
0.32861328125,
0.304443359375,
-0.352783203125,
-0.88330078125,
-0.955078125,
0.100341796875,
0.9013671875,
-0.478271484375,
0.58447265625,
0.224365234375,
-0.08978271484375,
-0.95458984375,
-0.29296875,
0.2237548828125,
-1.181640625,
-0.58935546875,
0.65185546875,
-0.270751953125,
0.1456298828125,
-0.338623046875,
-0.125,
0.541015625,
1.3193359375,
-0.290283203125,
0.01898193359375,
0.376708984375,
0.09112548828125,
0.0545654296875,
0.041839599609375,
0.164794921875,
-0.01739501953125,
-0.45361328125,
0.390869140625,
-0.87255859375,
0.1495361328125,
0.0794677734375,
1.1240234375,
0.088623046875,
0.48681640625,
0.0234222412109375,
-0.440185546875,
0.64599609375,
0.85791015625,
-0.0966796875,
0.466064453125,
0.154052734375,
0.9130859375,
0.43505859375,
0.53515625,
0.7177734375,
0.333740234375,
0.89404296875,
0.7451171875,
-0.33544921875,
0.465087890625,
-0.2093505859375,
0.020477294921875,
0.222900390625,
0.434814453125,
0.3046875,
0.38720703125,
-0.07513427734375,
0.0276947021484375,
-0.37060546875,
0.452392578125,
-0.1768798828125,
0.77685546875,
0.039794921875,
0.366455078125,
-0.20263671875,
-0.414794921875,
0.10406494140625,
0.83203125,
-1.005859375,
-0.6982421875,
0.146484375,
-0.11334228515625,
0.35546875,
0.016082763671875,
0.321044921875,
0.76416015625,
0.2266845703125,
0.8291015625,
-0.1463623046875,
-0.5400390625,
-0.78369140625,
-0.58544921875,
-0.81201171875,
0.037261962890625,
-0.7138671875,
-0.247314453125,
0.2607421875,
-0.75927734375,
0.32421875,
-0.168701171875,
-0.134765625,
-0.09893798828125,
-0.408203125,
0.49365234375,
-0.292236328125,
0.294189453125,
-0.78125,
0.58935546875,
-0.09967041015625,
0.78125,
-0.63037109375,
-0.2467041015625,
-0.4287109375,
-0.56689453125,
0.4521484375,
0.31005859375,
0.56689453125,
-0.209716796875,
-0.29541015625,
-1.0263671875,
-0.82421875,
-0.448974609375,
-0.5185546875,
0.09454345703125,
-0.458740234375,
0.67919921875,
0.6123046875,
-0.71728515625,
0.68408203125,
0.9921875,
-1.138671875,
0.24462890625,
0.61083984375,
0.234375,
-0.69921875,
1.56640625,
0.214111328125,
0.49658203125,
-0.23046875,
-0.28369140625,
-0.6728515625,
0.2200927734375,
0.212646484375,
-0.7421875,
-0.57421875,
0.56640625,
0.0465087890625,
-0.91357421875,
0.363525390625,
-1.064453125,
-0.419189453125,
-0.08233642578125,
-0.60791015625,
0.845703125,
0.45166015625,
0.479736328125,
-0.57470703125,
-0.11810302734375,
-0.15576171875,
0.63134765625,
-0.181640625,
-0.5947265625,
-0.061981201171875,
0.74658203125,
0.28662109375,
0.1199951171875,
0.325927734375,
-0.6123046875,
0.08734130859375,
-0.295654296875,
0.3232421875,
0.6357421875,
0.1365966796875,
0.141357421875,
0.173583984375,
0.6416015625,
-1.037109375,
-0.26953125,
-0.80615234375,
0.73046875,
0.352294921875,
0.6064453125,
0.0994873046875,
-0.53759765625,
-0.11962890625,
-0.85400390625,
0.260009765625,
-0.347900390625,
0.93603515625,
-0.77587890625,
0.81103515625,
0.071533203125,
-0.463623046875,
0.84130859375,
-0.61328125,
0.026702880859375,
1.23828125,
-0.0030841827392578125,
0.86279296875,
-0.64453125,
0.412353515625,
-0.364013671875,
0.1129150390625,
0.12158203125,
-0.0869140625,
0.68115234375,
-0.048828125,
-0.348388671875,
-0.61181640625,
-0.13916015625,
-0.145751953125,
-0.7158203125,
-0.033843994140625,
0.041046142578125,
-0.497802734375,
-0.92431640625,
0.59814453125,
0.998046875,
0.4990234375,
-0.08795166015625,
0.6923828125,
0.0352783203125,
0.296875,
0.5498046875,
-0.29833984375,
0.03411865234375,
-0.69873046875,
0.7216796875,
0.052398681640625,
-0.332275390625,
-0.568359375,
-0.6494140625,
-0.18115234375,
0.1749267578125,
-0.02520751953125,
0.2159423828125,
-0.892578125,
0.269775390625,
-0.0267333984375,
0.382080078125,
-0.60791015625,
-0.334716796875,
-0.5263671875,
0.767578125,
0.56689453125,
-0.564453125,
0.0484619140625,
-0.5,
0.367431640625,
0.39208984375,
-0.247802734375,
-0.235107421875,
-0.59375,
-0.84423828125,
-0.52734375,
0.492431640625,
0.7626953125,
-0.0198211669921875,
0.5498046875,
-0.98876953125,
0.419189453125,
0.0772705078125,
-0.1444091796875,
0.341796875,
0.027313232421875,
0.12322998046875,
0.4677734375,
0.66552734375,
0.034820556640625,
-0.48095703125,
0.21875,
-1.099609375,
0.52685546875,
-0.479248046875,
0.779296875,
0.331298828125,
-0.024688720703125,
-0.55078125,
0.4169921875,
-0.59912109375,
0.042266845703125,
-0.1319580078125,
0.330322265625,
-0.9453125,
-0.94140625,
0.67236328125,
-0.407958984375,
-0.31005859375,
0.64892578125,
-0.08050537109375,
-0.3046875,
0.2529296875,
0.51416015625,
-0.445068359375,
0.58349609375,
-0.06072998046875,
0.392333984375,
-0.4169921875,
-0.0958251953125,
-0.348388671875,
-0.49462890625,
0.91455078125,
0.33154296875,
-0.880859375,
0.0909423828125,
-1.2138671875,
-0.611328125,
-0.1597900390625,
-0.490966796875,
0.2437744140625,
0.042938232421875,
-0.326904296875,
-0.0305633544921875,
-0.654296875,
-0.34326171875,
-0.26806640625,
-1.001953125,
-0.384521484375,
0.37353515625,
0.1890869140625,
0.57861328125,
-0.162109375,
-0.06414794921875,
0.424072265625,
-0.0819091796875,
-0.08233642578125,
-0.50927734375,
0.3095703125,
-0.072509765625,
-0.27197265625,
-0.4619140625,
0.23046875,
0.52978515625,
0.384521484375,
0.66015625,
0.38330078125,
0.60205078125,
0.2176513671875,
-0.465087890625,
1.046875,
-0.04620361328125,
-1.0927734375,
-0.61962890625,
0.525390625,
-0.1446533203125,
0.83837890625,
0.2451171875,
-1.0439453125,
-0.8701171875,
-1.763671875,
0.2481689453125,
-0.63623046875,
-0.2978515625,
-0.875,
-0.5927734375,
-0.1802978515625,
0.6259765625,
-0.2314453125,
-0.46240234375,
0.056732177734375,
-0.9970703125,
0.04376220703125,
-0.734375,
-0.60009765625,
-0.54638671875,
-0.2470703125,
-0.29345703125,
1.130859375,
-0.0198211669921875,
-0.078857421875,
0.5029296875,
0.374267578125,
0.31201171875,
-0.30078125,
-0.86962890625,
-0.258544921875,
-0.058990478515625,
0.10845947265625,
-0.1802978515625,
0.2198486328125,
-0.71240234375,
0.822265625,
-1.1044921875,
-0.241943359375,
0.00672149658203125,
-0.5166015625,
-0.252197265625,
-0.3701171875,
1.0380859375,
-0.521484375,
-0.40380859375,
-0.390869140625,
0.497314453125,
0.56640625,
-0.396728515625,
0.0204315185546875,
-0.392822265625,
-0.10498046875,
-0.6962890625,
0.51513671875,
-0.75,
-0.282470703125,
-0.58447265625,
0.035980224609375,
1.3818359375,
-0.8935546875,
0.6220703125,
1.109375,
0.07470703125,
-0.03826904296875,
-0.53564453125,
0.1971435546875,
0.255615234375,
-0.63623046875,
-0.12371826171875,
-0.1702880859375,
-0.720703125,
-0.03814697265625,
-0.4599609375,
-1.2041015625,
-0.55322265625,
0.24072265625,
1.404296875,
-0.301025390625,
0.828125,
0.055908203125,
-0.74072265625,
-0.35888671875,
1.05078125,
-0.433349609375,
0.39794921875,
1.0732421875,
-0.09368896484375,
-0.12225341796875,
0.2568359375,
-0.35693359375,
-0.411865234375,
-0.06597900390625,
1.4111328125,
-0.40576171875,
-0.44140625,
0.7509765625,
0.9423828125,
-0.9287109375,
-0.73876953125,
-0.1046142578125,
0.318115234375,
0.0007939338684082031,
-0.52685546875,
-0.1593017578125,
0.68017578125,
-0.6669921875,
0.349609375,
0.349853515625,
0.004825592041015625,
0.34375,
-0.1126708984375,
0.43701171875,
-0.59765625,
0.28759765625,
0.85888671875,
-0.70947265625,
-0.496826171875,
-0.8134765625,
-0.1236572265625,
-0.204833984375,
-0.2147216796875,
0.76513671875,
-0.3623046875,
0.1702880859375,
0.7470703125,
0.1295166015625,
0.65087890625,
-0.443115234375,
0.029052734375,
-0.08172607421875,
-0.4423828125,
-0.354248046875,
-0.1632080078125,
0.415283203125,
-0.17529296875,
0.30908203125,
-0.849609375,
0.0278167724609375,
0.517578125,
0.54296875,
-0.279052734375,
-1.2705078125,
-0.30029296875,
-0.94384765625,
-0.258056640625,
-0.482421875,
-0.81689453125,
-0.359619140625,
-0.11248779296875,
0.1416015625,
-0.6708984375,
0.2152099609375,
0.327880859375,
-0.82275390625,
0.71435546875,
-0.984375,
0.2265625,
-0.525390625,
-0.343017578125,
-0.9921875,
0.2467041015625,
0.129638671875,
-0.312744140625,
-0.55078125,
-0.2213134765625,
-0.048309326171875,
0.2196044921875,
-0.07171630859375,
0.337890625,
-0.0235595703125,
-0.5947265625,
-0.06658935546875,
0.04791259765625,
-0.07586669921875,
0.9775390625,
0.58837890625,
0.46240234375,
0.708984375,
-0.157958984375,
-0.424072265625,
-0.396484375,
0.6572265625,
0.68310546875,
-0.47802734375,
-0.173095703125,
-0.0762939453125,
0.357177734375,
-1.05859375,
0.1781005859375,
-0.1182861328125,
0.298095703125,
0.10101318359375,
-0.27880859375,
0.4501953125,
1.21484375,
-0.330322265625,
0.53173828125,
0.10638427734375,
0.361572265625,
0.492919921875,
-0.376953125,
0.259521484375,
0.62890625,
0.3037109375,
-0.10357666015625,
0.137451171875,
0.182861328125,
-0.0965576171875,
0.426025390625,
-0.389404296875,
-0.454833984375,
-0.89111328125,
-0.31689453125,
-0.15966796875,
0.24951171875,
0.53076171875,
-0.517578125,
-0.480712890625,
-0.0313720703125,
-0.5302734375,
0.05010986328125,
-1.474609375,
-1.0908203125,
0.60107421875,
-0.427001953125,
-0.72509765625,
-0.59619140625,
-0.60546875,
0.31787109375,
0.464111328125,
0.58447265625,
-0.634765625,
0.41064453125,
-0.048919677734375,
0.6318359375,
-0.1396484375,
-0.457275390625,
0.0673828125,
0.3720703125,
-0.3955078125,
-0.475830078125,
0.267822265625,
0.595703125,
0.11395263671875,
-0.41796875,
-0.57666015625,
-0.0128631591796875,
0.2230224609375,
-0.2095947265625,
-0.51025390625,
0.12054443359375,
-0.11376953125,
0.853515625,
-0.6796875,
0.06927490234375,
-0.181884765625,
0.2042236328125,
0.283203125,
-0.486328125,
-0.65576171875,
0.89990234375,
0.798828125,
-0.180419921875,
0.416015625,
0.267822265625,
0.66796875,
-0.494384765625,
-0.0019969940185546875,
0.248291015625,
0.3740234375,
0.58544921875,
0.66943359375,
-0.478515625,
0.5478515625,
0.7353515625,
-0.0277099609375,
0.04547119140625,
0.1827392578125,
0.02532958984375,
-0.0289459228515625,
0.006923675537109375,
-0.2213134765625,
-0.30615234375,
0.38916015625,
-0.32080078125,
0.249755859375,
-0.1400146484375,
-0.28759765625,
-0.34814453125,
-0.712890625,
0.6025390625,
-0.41015625,
-0.31494140625,
-0.35107421875,
-0.60693359375,
0.419189453125,
0.438720703125,
-0.0158843994140625,
0.267333984375,
0.81787109375,
0.94970703125,
-0.134033203125,
0.69873046875,
0.446044921875,
0.6728515625,
-0.81298828125,
-0.1826171875,
0.017181396484375,
-0.09478759765625,
-0.1717529296875,
-0.26416015625,
-0.8701171875,
0.1878662109375,
-0.2626953125,
-0.2861328125,
0.69384765625,
-0.7724609375,
-0.05584716796875,
-0.299560546875,
0.98828125,
-0.83251953125,
0.49072265625,
0.69677734375,
-0.1488037109375,
-0.297607421875,
0.85546875,
-0.2125244140625,
0.28125,
0.248046875,
0.83935546875,
0.004711151123046875,
1.646484375,
0.441650390625,
-0.47802734375,
0.38427734375,
0.58203125,
-0.4912109375,
-0.552734375,
-0.22021484375,
-0.196044921875,
-0.1727294921875,
-0.35546875,
-0.1180419921875,
-0.0036144256591796875,
0.66796875,
0.311279296875,
-0.50537109375,
-0.0484619140625,
0.2353515625,
-0.7724609375,
0.329833984375,
0.2646484375,
0.350341796875,
0.2261962890625,
0.2080078125,
-0.237548828125,
-0.74072265625,
0.06707763671875,
-0.7373046875,
0.7763671875,
-0.36865234375,
-0.29248046875,
-0.908203125,
-0.82470703125,
-0.411865234375,
0.234619140625,
-0.25244140625,
-0.73046875,
0.50732421875,
0.66259765625,
0.2152099609375,
0.1951904296875,
-0.40673828125,
0.11883544921875,
0.92431640625,
1.4404296875,
-0.026458740234375,
0.247802734375,
0.71044921875,
-0.074951171875,
0.2445068359375,
-0.21923828125,
0.041412353515625,
0.27880859375,
0.0213623046875,
-0.22607421875,
0.1309814453125,
-0.4755859375,
-1.1787109375,
0.0682373046875,
0.4423828125,
-0.0027217864990234375,
-0.378173828125,
-1.099609375,
-0.421630859375,
-0.9111328125,
0.243896484375,
-0.9052734375,
0.919921875,
-0.264892578125,
-0.192138671875,
0.0015926361083984375,
-0.927734375,
4.35546875,
0.9091796875,
0.9580078125,
0.414306640625,
0.08050537109375,
0.7587890625,
0.403564453125,
-0.317138671875,
-0.3974609375,
-0.953125,
0.75634765625,
-1.1181640625,
-0.1566162109375,
0.763671875,
0.10638427734375,
0.5029296875,
-0.78466796875,
-0.1024169921875,
0.406494140625,
-1.1025390625,
-0.876953125,
-0.267578125,
-0.62548828125,
0.41064453125,
-0.471435546875,
0.46435546875,
0.666015625,
-0.94189453125,
-0.2685546875,
-0.505859375,
-0.258544921875,
-0.81298828125,
0.62841796875,
0.11968994140625,
-0.1976318359375,
0.630859375,
-0.0634765625,
-0.1566162109375,
-0.3916015625,
0.366455078125,
-0.145263671875,
0.56591796875,
0.75244140625,
-0.966796875,
-0.307861328125,
0.537109375,
-0.335693359375,
-0.044464111328125,
0.44921875,
-1.015625,
1.162109375,
-0.03680419921875,
0.55908203125,
-0.6630859375,
-1.060546875,
0.7900390625,
0.82080078125,
0.3056640625,
-0.1572265625,
0.26513671875,
0.39404296875,
0.54931640625,
0.2210693359375,
0.419677734375,
-0.9384765625,
0.83837890625,
0.053436279296875,
0.306396484375,
0.0830078125,
-0.05853271484375,
-0.00113677978515625,
-0.56982421875,
-0.0479736328125,
-0.30712890625,
0.37060546875,
-0.03326416015625,
0.1585693359375,
0.53955078125,
0.4189453125,
-0.66455078125,
-0.10382080078125,
-0.338623046875,
-0.56982421875,
-0.441162109375,
0.9482421875,
0.83935546875,
-0.50390625,
-0.2301025390625,
-0.35888671875,
0.5283203125,
0.6123046875,
0.489501953125,
0.197998046875,
-0.344482421875,
-0.09320068359375
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Digits Are Not Just Characters
Mr. Manuel Majorana Minore made a number of files with numbers in their names. He wants to have a list of the files, but the file listing command commonly used lists them in an order different from what he prefers, interpreting digit sequences in them as ASCII code sequences, not as numbers. For example, the files file10, file20 and file3 are listed in this order.
Write a program which decides the orders of file names interpreting digit sequences as numeric values.
Each file name consists of uppercase letters (from 'A' to 'Z'), lowercase letters (from 'a' to 'z'), and digits (from '0' to '9').
A file name is looked upon as a sequence of items, each being either a letter or a number. Each single uppercase or lowercase letter forms a letter item. Each consecutive sequence of digits forms a number item.
Two item are ordered as follows.
* Number items come before letter items.
* Two letter items are ordered by their ASCII codes.
* Two number items are ordered by their values when interpreted as decimal numbers.
Two file names are compared item by item, starting from the top, and the order of the first different corresponding items decides the order of the file names. If one of them, say $A$, has more items than the other, $B$, and all the items of $B$ are the same as the corresponding items of $A$, $B$ should come before.
For example, three file names in Sample Input 1, file10, file20, and file3 all start with the same sequence of four letter items f, i, l, and e, followed by a number item, 10, 20, and 3, respectively. Comparing numeric values of these number items, they are ordered as file3 $<$ file10 $<$ file20.
Input
The input consists of a single test case of the following format.
$n$
$s_0$
$s_1$
:
$s_n$
The integer $n$ in the first line gives the number of file names ($s_1$ through $s_n$) to be compared with the file name given in the next line ($s_0$). Here, $n$ satisfies $1 \leq n \leq 1000$.
The following $n + 1$ lines are file names, $s_0$ through $s_n$, one in each line. They have at least one and no more than nine characters. Each of the characters is either an uppercase letter, a lowercase letter, or a digit.
Sequences of digits in the file names never start with a digit zero (0).
Output
For each of the file names, $s_1$ through $s_n$, output one line with a character indicating whether it should come before $s_0$ or not. The character should be "-" if it is to be listed before $s_0$; otherwise, it should be "+", including cases where two names are identical.
Sample Input 1
2
file10
file20
file3
Sample Output 1
+
-
Sample Input 2
11
X52Y
X
X5
X52
X52Y
X52Y6
32
ABC
XYZ
x51y
X8Y
X222
Sample Output 2
-
-
-
+
+
-
-
+
+
-
+
Example
Input
2
file10
file20
file3
Output
+
-
"Correct Solution:
```
n = int(input())
ss = [input() for _ in range(n + 1)]
sp = [[s[0]] for s in ss]
for i, s in enumerate(ss):
for j in range(1, len(s)):
if s[j - 1].isdigit() != s[j].isdigit():
sp[i].append('')
sp[i][-1] += s[j]
s0 = sp[0]
for s in sp[1:]:
p = 0
m = min(len(s0), len(s))
while p < m and s0[p] == s[p]:
p += 1
if p == m:
print('-+'[len(s0) <= len(s)])
continue
a = s0[p].isdigit()
b = s[p].isdigit()
if a and b:
print('-+'[int(s0[p]) <= int(s[p])])
elif a or b:
print('-+'[a])
else:
print('-+'[s0[p] <= s[p]])
```
| 64,779
|
[
0.4072265625,
0.00583648681640625,
0.52197265625,
-0.016876220703125,
-0.06732177734375,
-0.23046875,
-0.2275390625,
0.09503173828125,
-0.1092529296875,
1.1748046875,
0.49951171875,
0.0159912109375,
0.287353515625,
-0.734375,
-0.77783203125,
0.1534423828125,
-0.26318359375,
-0.615234375,
-0.2398681640625,
-0.207275390625,
0.2042236328125,
0.398193359375,
-1.298828125,
-0.6123046875,
-0.60986328125,
0.6767578125,
0.44921875,
-0.00901031494140625,
0.81201171875,
0.86767578125,
0.049530029296875,
-0.463134765625,
0.9560546875,
-0.72021484375,
-0.1412353515625,
-0.36962890625,
0.7744140625,
-0.68310546875,
-0.2437744140625,
-0.64794921875,
0.2198486328125,
-0.365966796875,
0.78076171875,
-0.96533203125,
-1.2919921875,
-0.01291656494140625,
-0.0859375,
-0.27978515625,
-0.307861328125,
-0.5869140625,
0.38232421875,
0.0430908203125,
0.3232421875,
-0.085693359375,
-0.30859375,
-0.29736328125,
0.1331787109375,
-0.217529296875,
-0.407470703125,
-0.2100830078125,
-0.343505859375,
0.058990478515625,
0.10662841796875,
-0.38427734375,
-0.0019779205322265625,
0.481689453125,
-0.266845703125,
-0.52392578125,
0.00934600830078125,
-0.9580078125,
-0.316162109375,
0.425537109375,
-0.35791015625,
0.0992431640625,
-0.7822265625,
-0.04400634765625,
0.036590576171875,
-0.047637939453125,
-0.207763671875,
0.669921875,
0.2020263671875,
0.984375,
-0.00009238719940185547,
0.5361328125,
-0.611328125,
-0.416015625,
0.150390625,
-0.14501953125,
0.425048828125,
0.05523681640625,
-0.1929931640625,
0.413818359375,
-0.68701171875,
0.0272674560546875,
0.76123046875,
0.76708984375,
-0.12469482421875,
0.6484375,
0.50048828125,
0.51806640625,
0.70166015625,
1.392578125,
-0.1197509765625,
0.9912109375,
-0.56005859375,
-0.0689697265625,
0.4541015625,
-0.11004638671875,
-0.182373046875,
-0.493896484375,
0.09246826171875,
-0.429931640625,
0.0302276611328125,
-0.2310791015625,
-0.7578125,
0.99951171875,
0.24755859375,
0.27001953125,
-0.9267578125,
0.1314697265625,
0.231201171875,
-0.041534423828125,
0.60693359375,
-0.444580078125,
-0.11553955078125,
-0.33447265625,
-0.689453125,
0.8681640625,
-0.2471923828125,
-0.33740234375,
0.217041015625,
-0.040557861328125,
-0.052459716796875,
0.05804443359375,
-0.2493896484375,
0.87939453125,
-0.1864013671875,
0.54150390625,
0.489501953125,
-0.603515625,
0.623046875,
-0.2305908203125,
-0.1510009765625,
1.748046875,
0.01519012451171875,
0.411865234375,
0.273193359375,
0.18701171875,
-0.6728515625,
0.1572265625,
-0.424072265625,
0.728515625,
0.1170654296875,
0.121337890625,
-0.4951171875,
0.2254638671875,
0.134033203125,
0.37060546875,
0.36962890625,
0.311279296875,
-0.5517578125,
0.08697509765625,
0.04376220703125,
0.32080078125,
-0.005401611328125,
1.1064453125,
-0.66748046875,
0.0528564453125,
-0.2607421875,
-0.275634765625,
0.3828125,
0.148681640625,
-0.027313232421875,
0.73876953125,
0.73095703125,
0.7548828125,
0.56005859375,
-0.191650390625,
0.2489013671875,
0.206787109375,
-0.33251953125,
0.0809326171875,
0.13134765625,
0.422607421875,
0.1444091796875,
0.32861328125,
0.304443359375,
-0.352783203125,
-0.88330078125,
-0.955078125,
0.100341796875,
0.9013671875,
-0.478271484375,
0.58447265625,
0.224365234375,
-0.08978271484375,
-0.95458984375,
-0.29296875,
0.2237548828125,
-1.181640625,
-0.58935546875,
0.65185546875,
-0.270751953125,
0.1456298828125,
-0.338623046875,
-0.125,
0.541015625,
1.3193359375,
-0.290283203125,
0.01898193359375,
0.376708984375,
0.09112548828125,
0.0545654296875,
0.041839599609375,
0.164794921875,
-0.01739501953125,
-0.45361328125,
0.390869140625,
-0.87255859375,
0.1495361328125,
0.0794677734375,
1.1240234375,
0.088623046875,
0.48681640625,
0.0234222412109375,
-0.440185546875,
0.64599609375,
0.85791015625,
-0.0966796875,
0.466064453125,
0.154052734375,
0.9130859375,
0.43505859375,
0.53515625,
0.7177734375,
0.333740234375,
0.89404296875,
0.7451171875,
-0.33544921875,
0.465087890625,
-0.2093505859375,
0.020477294921875,
0.222900390625,
0.434814453125,
0.3046875,
0.38720703125,
-0.07513427734375,
0.0276947021484375,
-0.37060546875,
0.452392578125,
-0.1768798828125,
0.77685546875,
0.039794921875,
0.366455078125,
-0.20263671875,
-0.414794921875,
0.10406494140625,
0.83203125,
-1.005859375,
-0.6982421875,
0.146484375,
-0.11334228515625,
0.35546875,
0.016082763671875,
0.321044921875,
0.76416015625,
0.2266845703125,
0.8291015625,
-0.1463623046875,
-0.5400390625,
-0.78369140625,
-0.58544921875,
-0.81201171875,
0.037261962890625,
-0.7138671875,
-0.247314453125,
0.2607421875,
-0.75927734375,
0.32421875,
-0.168701171875,
-0.134765625,
-0.09893798828125,
-0.408203125,
0.49365234375,
-0.292236328125,
0.294189453125,
-0.78125,
0.58935546875,
-0.09967041015625,
0.78125,
-0.63037109375,
-0.2467041015625,
-0.4287109375,
-0.56689453125,
0.4521484375,
0.31005859375,
0.56689453125,
-0.209716796875,
-0.29541015625,
-1.0263671875,
-0.82421875,
-0.448974609375,
-0.5185546875,
0.09454345703125,
-0.458740234375,
0.67919921875,
0.6123046875,
-0.71728515625,
0.68408203125,
0.9921875,
-1.138671875,
0.24462890625,
0.61083984375,
0.234375,
-0.69921875,
1.56640625,
0.214111328125,
0.49658203125,
-0.23046875,
-0.28369140625,
-0.6728515625,
0.2200927734375,
0.212646484375,
-0.7421875,
-0.57421875,
0.56640625,
0.0465087890625,
-0.91357421875,
0.363525390625,
-1.064453125,
-0.419189453125,
-0.08233642578125,
-0.60791015625,
0.845703125,
0.45166015625,
0.479736328125,
-0.57470703125,
-0.11810302734375,
-0.15576171875,
0.63134765625,
-0.181640625,
-0.5947265625,
-0.061981201171875,
0.74658203125,
0.28662109375,
0.1199951171875,
0.325927734375,
-0.6123046875,
0.08734130859375,
-0.295654296875,
0.3232421875,
0.6357421875,
0.1365966796875,
0.141357421875,
0.173583984375,
0.6416015625,
-1.037109375,
-0.26953125,
-0.80615234375,
0.73046875,
0.352294921875,
0.6064453125,
0.0994873046875,
-0.53759765625,
-0.11962890625,
-0.85400390625,
0.260009765625,
-0.347900390625,
0.93603515625,
-0.77587890625,
0.81103515625,
0.071533203125,
-0.463623046875,
0.84130859375,
-0.61328125,
0.026702880859375,
1.23828125,
-0.0030841827392578125,
0.86279296875,
-0.64453125,
0.412353515625,
-0.364013671875,
0.1129150390625,
0.12158203125,
-0.0869140625,
0.68115234375,
-0.048828125,
-0.348388671875,
-0.61181640625,
-0.13916015625,
-0.145751953125,
-0.7158203125,
-0.033843994140625,
0.041046142578125,
-0.497802734375,
-0.92431640625,
0.59814453125,
0.998046875,
0.4990234375,
-0.08795166015625,
0.6923828125,
0.0352783203125,
0.296875,
0.5498046875,
-0.29833984375,
0.03411865234375,
-0.69873046875,
0.7216796875,
0.052398681640625,
-0.332275390625,
-0.568359375,
-0.6494140625,
-0.18115234375,
0.1749267578125,
-0.02520751953125,
0.2159423828125,
-0.892578125,
0.269775390625,
-0.0267333984375,
0.382080078125,
-0.60791015625,
-0.334716796875,
-0.5263671875,
0.767578125,
0.56689453125,
-0.564453125,
0.0484619140625,
-0.5,
0.367431640625,
0.39208984375,
-0.247802734375,
-0.235107421875,
-0.59375,
-0.84423828125,
-0.52734375,
0.492431640625,
0.7626953125,
-0.0198211669921875,
0.5498046875,
-0.98876953125,
0.419189453125,
0.0772705078125,
-0.1444091796875,
0.341796875,
0.027313232421875,
0.12322998046875,
0.4677734375,
0.66552734375,
0.034820556640625,
-0.48095703125,
0.21875,
-1.099609375,
0.52685546875,
-0.479248046875,
0.779296875,
0.331298828125,
-0.024688720703125,
-0.55078125,
0.4169921875,
-0.59912109375,
0.042266845703125,
-0.1319580078125,
0.330322265625,
-0.9453125,
-0.94140625,
0.67236328125,
-0.407958984375,
-0.31005859375,
0.64892578125,
-0.08050537109375,
-0.3046875,
0.2529296875,
0.51416015625,
-0.445068359375,
0.58349609375,
-0.06072998046875,
0.392333984375,
-0.4169921875,
-0.0958251953125,
-0.348388671875,
-0.49462890625,
0.91455078125,
0.33154296875,
-0.880859375,
0.0909423828125,
-1.2138671875,
-0.611328125,
-0.1597900390625,
-0.490966796875,
0.2437744140625,
0.042938232421875,
-0.326904296875,
-0.0305633544921875,
-0.654296875,
-0.34326171875,
-0.26806640625,
-1.001953125,
-0.384521484375,
0.37353515625,
0.1890869140625,
0.57861328125,
-0.162109375,
-0.06414794921875,
0.424072265625,
-0.0819091796875,
-0.08233642578125,
-0.50927734375,
0.3095703125,
-0.072509765625,
-0.27197265625,
-0.4619140625,
0.23046875,
0.52978515625,
0.384521484375,
0.66015625,
0.38330078125,
0.60205078125,
0.2176513671875,
-0.465087890625,
1.046875,
-0.04620361328125,
-1.0927734375,
-0.61962890625,
0.525390625,
-0.1446533203125,
0.83837890625,
0.2451171875,
-1.0439453125,
-0.8701171875,
-1.763671875,
0.2481689453125,
-0.63623046875,
-0.2978515625,
-0.875,
-0.5927734375,
-0.1802978515625,
0.6259765625,
-0.2314453125,
-0.46240234375,
0.056732177734375,
-0.9970703125,
0.04376220703125,
-0.734375,
-0.60009765625,
-0.54638671875,
-0.2470703125,
-0.29345703125,
1.130859375,
-0.0198211669921875,
-0.078857421875,
0.5029296875,
0.374267578125,
0.31201171875,
-0.30078125,
-0.86962890625,
-0.258544921875,
-0.058990478515625,
0.10845947265625,
-0.1802978515625,
0.2198486328125,
-0.71240234375,
0.822265625,
-1.1044921875,
-0.241943359375,
0.00672149658203125,
-0.5166015625,
-0.252197265625,
-0.3701171875,
1.0380859375,
-0.521484375,
-0.40380859375,
-0.390869140625,
0.497314453125,
0.56640625,
-0.396728515625,
0.0204315185546875,
-0.392822265625,
-0.10498046875,
-0.6962890625,
0.51513671875,
-0.75,
-0.282470703125,
-0.58447265625,
0.035980224609375,
1.3818359375,
-0.8935546875,
0.6220703125,
1.109375,
0.07470703125,
-0.03826904296875,
-0.53564453125,
0.1971435546875,
0.255615234375,
-0.63623046875,
-0.12371826171875,
-0.1702880859375,
-0.720703125,
-0.03814697265625,
-0.4599609375,
-1.2041015625,
-0.55322265625,
0.24072265625,
1.404296875,
-0.301025390625,
0.828125,
0.055908203125,
-0.74072265625,
-0.35888671875,
1.05078125,
-0.433349609375,
0.39794921875,
1.0732421875,
-0.09368896484375,
-0.12225341796875,
0.2568359375,
-0.35693359375,
-0.411865234375,
-0.06597900390625,
1.4111328125,
-0.40576171875,
-0.44140625,
0.7509765625,
0.9423828125,
-0.9287109375,
-0.73876953125,
-0.1046142578125,
0.318115234375,
0.0007939338684082031,
-0.52685546875,
-0.1593017578125,
0.68017578125,
-0.6669921875,
0.349609375,
0.349853515625,
0.004825592041015625,
0.34375,
-0.1126708984375,
0.43701171875,
-0.59765625,
0.28759765625,
0.85888671875,
-0.70947265625,
-0.496826171875,
-0.8134765625,
-0.1236572265625,
-0.204833984375,
-0.2147216796875,
0.76513671875,
-0.3623046875,
0.1702880859375,
0.7470703125,
0.1295166015625,
0.65087890625,
-0.443115234375,
0.029052734375,
-0.08172607421875,
-0.4423828125,
-0.354248046875,
-0.1632080078125,
0.415283203125,
-0.17529296875,
0.30908203125,
-0.849609375,
0.0278167724609375,
0.517578125,
0.54296875,
-0.279052734375,
-1.2705078125,
-0.30029296875,
-0.94384765625,
-0.258056640625,
-0.482421875,
-0.81689453125,
-0.359619140625,
-0.11248779296875,
0.1416015625,
-0.6708984375,
0.2152099609375,
0.327880859375,
-0.82275390625,
0.71435546875,
-0.984375,
0.2265625,
-0.525390625,
-0.343017578125,
-0.9921875,
0.2467041015625,
0.129638671875,
-0.312744140625,
-0.55078125,
-0.2213134765625,
-0.048309326171875,
0.2196044921875,
-0.07171630859375,
0.337890625,
-0.0235595703125,
-0.5947265625,
-0.06658935546875,
0.04791259765625,
-0.07586669921875,
0.9775390625,
0.58837890625,
0.46240234375,
0.708984375,
-0.157958984375,
-0.424072265625,
-0.396484375,
0.6572265625,
0.68310546875,
-0.47802734375,
-0.173095703125,
-0.0762939453125,
0.357177734375,
-1.05859375,
0.1781005859375,
-0.1182861328125,
0.298095703125,
0.10101318359375,
-0.27880859375,
0.4501953125,
1.21484375,
-0.330322265625,
0.53173828125,
0.10638427734375,
0.361572265625,
0.492919921875,
-0.376953125,
0.259521484375,
0.62890625,
0.3037109375,
-0.10357666015625,
0.137451171875,
0.182861328125,
-0.0965576171875,
0.426025390625,
-0.389404296875,
-0.454833984375,
-0.89111328125,
-0.31689453125,
-0.15966796875,
0.24951171875,
0.53076171875,
-0.517578125,
-0.480712890625,
-0.0313720703125,
-0.5302734375,
0.05010986328125,
-1.474609375,
-1.0908203125,
0.60107421875,
-0.427001953125,
-0.72509765625,
-0.59619140625,
-0.60546875,
0.31787109375,
0.464111328125,
0.58447265625,
-0.634765625,
0.41064453125,
-0.048919677734375,
0.6318359375,
-0.1396484375,
-0.457275390625,
0.0673828125,
0.3720703125,
-0.3955078125,
-0.475830078125,
0.267822265625,
0.595703125,
0.11395263671875,
-0.41796875,
-0.57666015625,
-0.0128631591796875,
0.2230224609375,
-0.2095947265625,
-0.51025390625,
0.12054443359375,
-0.11376953125,
0.853515625,
-0.6796875,
0.06927490234375,
-0.181884765625,
0.2042236328125,
0.283203125,
-0.486328125,
-0.65576171875,
0.89990234375,
0.798828125,
-0.180419921875,
0.416015625,
0.267822265625,
0.66796875,
-0.494384765625,
-0.0019969940185546875,
0.248291015625,
0.3740234375,
0.58544921875,
0.66943359375,
-0.478515625,
0.5478515625,
0.7353515625,
-0.0277099609375,
0.04547119140625,
0.1827392578125,
0.02532958984375,
-0.0289459228515625,
0.006923675537109375,
-0.2213134765625,
-0.30615234375,
0.38916015625,
-0.32080078125,
0.249755859375,
-0.1400146484375,
-0.28759765625,
-0.34814453125,
-0.712890625,
0.6025390625,
-0.41015625,
-0.31494140625,
-0.35107421875,
-0.60693359375,
0.419189453125,
0.438720703125,
-0.0158843994140625,
0.267333984375,
0.81787109375,
0.94970703125,
-0.134033203125,
0.69873046875,
0.446044921875,
0.6728515625,
-0.81298828125,
-0.1826171875,
0.017181396484375,
-0.09478759765625,
-0.1717529296875,
-0.26416015625,
-0.8701171875,
0.1878662109375,
-0.2626953125,
-0.2861328125,
0.69384765625,
-0.7724609375,
-0.05584716796875,
-0.299560546875,
0.98828125,
-0.83251953125,
0.49072265625,
0.69677734375,
-0.1488037109375,
-0.297607421875,
0.85546875,
-0.2125244140625,
0.28125,
0.248046875,
0.83935546875,
0.004711151123046875,
1.646484375,
0.441650390625,
-0.47802734375,
0.38427734375,
0.58203125,
-0.4912109375,
-0.552734375,
-0.22021484375,
-0.196044921875,
-0.1727294921875,
-0.35546875,
-0.1180419921875,
-0.0036144256591796875,
0.66796875,
0.311279296875,
-0.50537109375,
-0.0484619140625,
0.2353515625,
-0.7724609375,
0.329833984375,
0.2646484375,
0.350341796875,
0.2261962890625,
0.2080078125,
-0.237548828125,
-0.74072265625,
0.06707763671875,
-0.7373046875,
0.7763671875,
-0.36865234375,
-0.29248046875,
-0.908203125,
-0.82470703125,
-0.411865234375,
0.234619140625,
-0.25244140625,
-0.73046875,
0.50732421875,
0.66259765625,
0.2152099609375,
0.1951904296875,
-0.40673828125,
0.11883544921875,
0.92431640625,
1.4404296875,
-0.026458740234375,
0.247802734375,
0.71044921875,
-0.074951171875,
0.2445068359375,
-0.21923828125,
0.041412353515625,
0.27880859375,
0.0213623046875,
-0.22607421875,
0.1309814453125,
-0.4755859375,
-1.1787109375,
0.0682373046875,
0.4423828125,
-0.0027217864990234375,
-0.378173828125,
-1.099609375,
-0.421630859375,
-0.9111328125,
0.243896484375,
-0.9052734375,
0.919921875,
-0.264892578125,
-0.192138671875,
0.0015926361083984375,
-0.927734375,
4.35546875,
0.9091796875,
0.9580078125,
0.414306640625,
0.08050537109375,
0.7587890625,
0.403564453125,
-0.317138671875,
-0.3974609375,
-0.953125,
0.75634765625,
-1.1181640625,
-0.1566162109375,
0.763671875,
0.10638427734375,
0.5029296875,
-0.78466796875,
-0.1024169921875,
0.406494140625,
-1.1025390625,
-0.876953125,
-0.267578125,
-0.62548828125,
0.41064453125,
-0.471435546875,
0.46435546875,
0.666015625,
-0.94189453125,
-0.2685546875,
-0.505859375,
-0.258544921875,
-0.81298828125,
0.62841796875,
0.11968994140625,
-0.1976318359375,
0.630859375,
-0.0634765625,
-0.1566162109375,
-0.3916015625,
0.366455078125,
-0.145263671875,
0.56591796875,
0.75244140625,
-0.966796875,
-0.307861328125,
0.537109375,
-0.335693359375,
-0.044464111328125,
0.44921875,
-1.015625,
1.162109375,
-0.03680419921875,
0.55908203125,
-0.6630859375,
-1.060546875,
0.7900390625,
0.82080078125,
0.3056640625,
-0.1572265625,
0.26513671875,
0.39404296875,
0.54931640625,
0.2210693359375,
0.419677734375,
-0.9384765625,
0.83837890625,
0.053436279296875,
0.306396484375,
0.0830078125,
-0.05853271484375,
-0.00113677978515625,
-0.56982421875,
-0.0479736328125,
-0.30712890625,
0.37060546875,
-0.03326416015625,
0.1585693359375,
0.53955078125,
0.4189453125,
-0.66455078125,
-0.10382080078125,
-0.338623046875,
-0.56982421875,
-0.441162109375,
0.9482421875,
0.83935546875,
-0.50390625,
-0.2301025390625,
-0.35888671875,
0.5283203125,
0.6123046875,
0.489501953125,
0.197998046875,
-0.344482421875,
-0.09320068359375
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Digits Are Not Just Characters
Mr. Manuel Majorana Minore made a number of files with numbers in their names. He wants to have a list of the files, but the file listing command commonly used lists them in an order different from what he prefers, interpreting digit sequences in them as ASCII code sequences, not as numbers. For example, the files file10, file20 and file3 are listed in this order.
Write a program which decides the orders of file names interpreting digit sequences as numeric values.
Each file name consists of uppercase letters (from 'A' to 'Z'), lowercase letters (from 'a' to 'z'), and digits (from '0' to '9').
A file name is looked upon as a sequence of items, each being either a letter or a number. Each single uppercase or lowercase letter forms a letter item. Each consecutive sequence of digits forms a number item.
Two item are ordered as follows.
* Number items come before letter items.
* Two letter items are ordered by their ASCII codes.
* Two number items are ordered by their values when interpreted as decimal numbers.
Two file names are compared item by item, starting from the top, and the order of the first different corresponding items decides the order of the file names. If one of them, say $A$, has more items than the other, $B$, and all the items of $B$ are the same as the corresponding items of $A$, $B$ should come before.
For example, three file names in Sample Input 1, file10, file20, and file3 all start with the same sequence of four letter items f, i, l, and e, followed by a number item, 10, 20, and 3, respectively. Comparing numeric values of these number items, they are ordered as file3 $<$ file10 $<$ file20.
Input
The input consists of a single test case of the following format.
$n$
$s_0$
$s_1$
:
$s_n$
The integer $n$ in the first line gives the number of file names ($s_1$ through $s_n$) to be compared with the file name given in the next line ($s_0$). Here, $n$ satisfies $1 \leq n \leq 1000$.
The following $n + 1$ lines are file names, $s_0$ through $s_n$, one in each line. They have at least one and no more than nine characters. Each of the characters is either an uppercase letter, a lowercase letter, or a digit.
Sequences of digits in the file names never start with a digit zero (0).
Output
For each of the file names, $s_1$ through $s_n$, output one line with a character indicating whether it should come before $s_0$ or not. The character should be "-" if it is to be listed before $s_0$; otherwise, it should be "+", including cases where two names are identical.
Sample Input 1
2
file10
file20
file3
Sample Output 1
+
-
Sample Input 2
11
X52Y
X
X5
X52
X52Y
X52Y6
32
ABC
XYZ
x51y
X8Y
X222
Sample Output 2
-
-
-
+
+
-
-
+
+
-
+
Example
Input
2
file10
file20
file3
Output
+
-
"Correct Solution:
```
# coding: utf-8
# Your code here!
def ssplit(s):
tp=0
tmp=""
ret=[]
for c in s:
if c.isdigit():
tmp+=c
else:
if tmp!="":
ret.append((0,int(tmp)))
tmp=""
ret.append((1,ord(c)))
if tmp!="":
ret.append((0,int(tmp)))
return ret
n=int(input())
s=ssplit(input())
for i in range(n):
z=ssplit(input())
if z>=s:
print('+')
else:
print('-')
```
| 64,780
|
[
0.4072265625,
0.00583648681640625,
0.52197265625,
-0.016876220703125,
-0.06732177734375,
-0.23046875,
-0.2275390625,
0.09503173828125,
-0.1092529296875,
1.1748046875,
0.49951171875,
0.0159912109375,
0.287353515625,
-0.734375,
-0.77783203125,
0.1534423828125,
-0.26318359375,
-0.615234375,
-0.2398681640625,
-0.207275390625,
0.2042236328125,
0.398193359375,
-1.298828125,
-0.6123046875,
-0.60986328125,
0.6767578125,
0.44921875,
-0.00901031494140625,
0.81201171875,
0.86767578125,
0.049530029296875,
-0.463134765625,
0.9560546875,
-0.72021484375,
-0.1412353515625,
-0.36962890625,
0.7744140625,
-0.68310546875,
-0.2437744140625,
-0.64794921875,
0.2198486328125,
-0.365966796875,
0.78076171875,
-0.96533203125,
-1.2919921875,
-0.01291656494140625,
-0.0859375,
-0.27978515625,
-0.307861328125,
-0.5869140625,
0.38232421875,
0.0430908203125,
0.3232421875,
-0.085693359375,
-0.30859375,
-0.29736328125,
0.1331787109375,
-0.217529296875,
-0.407470703125,
-0.2100830078125,
-0.343505859375,
0.058990478515625,
0.10662841796875,
-0.38427734375,
-0.0019779205322265625,
0.481689453125,
-0.266845703125,
-0.52392578125,
0.00934600830078125,
-0.9580078125,
-0.316162109375,
0.425537109375,
-0.35791015625,
0.0992431640625,
-0.7822265625,
-0.04400634765625,
0.036590576171875,
-0.047637939453125,
-0.207763671875,
0.669921875,
0.2020263671875,
0.984375,
-0.00009238719940185547,
0.5361328125,
-0.611328125,
-0.416015625,
0.150390625,
-0.14501953125,
0.425048828125,
0.05523681640625,
-0.1929931640625,
0.413818359375,
-0.68701171875,
0.0272674560546875,
0.76123046875,
0.76708984375,
-0.12469482421875,
0.6484375,
0.50048828125,
0.51806640625,
0.70166015625,
1.392578125,
-0.1197509765625,
0.9912109375,
-0.56005859375,
-0.0689697265625,
0.4541015625,
-0.11004638671875,
-0.182373046875,
-0.493896484375,
0.09246826171875,
-0.429931640625,
0.0302276611328125,
-0.2310791015625,
-0.7578125,
0.99951171875,
0.24755859375,
0.27001953125,
-0.9267578125,
0.1314697265625,
0.231201171875,
-0.041534423828125,
0.60693359375,
-0.444580078125,
-0.11553955078125,
-0.33447265625,
-0.689453125,
0.8681640625,
-0.2471923828125,
-0.33740234375,
0.217041015625,
-0.040557861328125,
-0.052459716796875,
0.05804443359375,
-0.2493896484375,
0.87939453125,
-0.1864013671875,
0.54150390625,
0.489501953125,
-0.603515625,
0.623046875,
-0.2305908203125,
-0.1510009765625,
1.748046875,
0.01519012451171875,
0.411865234375,
0.273193359375,
0.18701171875,
-0.6728515625,
0.1572265625,
-0.424072265625,
0.728515625,
0.1170654296875,
0.121337890625,
-0.4951171875,
0.2254638671875,
0.134033203125,
0.37060546875,
0.36962890625,
0.311279296875,
-0.5517578125,
0.08697509765625,
0.04376220703125,
0.32080078125,
-0.005401611328125,
1.1064453125,
-0.66748046875,
0.0528564453125,
-0.2607421875,
-0.275634765625,
0.3828125,
0.148681640625,
-0.027313232421875,
0.73876953125,
0.73095703125,
0.7548828125,
0.56005859375,
-0.191650390625,
0.2489013671875,
0.206787109375,
-0.33251953125,
0.0809326171875,
0.13134765625,
0.422607421875,
0.1444091796875,
0.32861328125,
0.304443359375,
-0.352783203125,
-0.88330078125,
-0.955078125,
0.100341796875,
0.9013671875,
-0.478271484375,
0.58447265625,
0.224365234375,
-0.08978271484375,
-0.95458984375,
-0.29296875,
0.2237548828125,
-1.181640625,
-0.58935546875,
0.65185546875,
-0.270751953125,
0.1456298828125,
-0.338623046875,
-0.125,
0.541015625,
1.3193359375,
-0.290283203125,
0.01898193359375,
0.376708984375,
0.09112548828125,
0.0545654296875,
0.041839599609375,
0.164794921875,
-0.01739501953125,
-0.45361328125,
0.390869140625,
-0.87255859375,
0.1495361328125,
0.0794677734375,
1.1240234375,
0.088623046875,
0.48681640625,
0.0234222412109375,
-0.440185546875,
0.64599609375,
0.85791015625,
-0.0966796875,
0.466064453125,
0.154052734375,
0.9130859375,
0.43505859375,
0.53515625,
0.7177734375,
0.333740234375,
0.89404296875,
0.7451171875,
-0.33544921875,
0.465087890625,
-0.2093505859375,
0.020477294921875,
0.222900390625,
0.434814453125,
0.3046875,
0.38720703125,
-0.07513427734375,
0.0276947021484375,
-0.37060546875,
0.452392578125,
-0.1768798828125,
0.77685546875,
0.039794921875,
0.366455078125,
-0.20263671875,
-0.414794921875,
0.10406494140625,
0.83203125,
-1.005859375,
-0.6982421875,
0.146484375,
-0.11334228515625,
0.35546875,
0.016082763671875,
0.321044921875,
0.76416015625,
0.2266845703125,
0.8291015625,
-0.1463623046875,
-0.5400390625,
-0.78369140625,
-0.58544921875,
-0.81201171875,
0.037261962890625,
-0.7138671875,
-0.247314453125,
0.2607421875,
-0.75927734375,
0.32421875,
-0.168701171875,
-0.134765625,
-0.09893798828125,
-0.408203125,
0.49365234375,
-0.292236328125,
0.294189453125,
-0.78125,
0.58935546875,
-0.09967041015625,
0.78125,
-0.63037109375,
-0.2467041015625,
-0.4287109375,
-0.56689453125,
0.4521484375,
0.31005859375,
0.56689453125,
-0.209716796875,
-0.29541015625,
-1.0263671875,
-0.82421875,
-0.448974609375,
-0.5185546875,
0.09454345703125,
-0.458740234375,
0.67919921875,
0.6123046875,
-0.71728515625,
0.68408203125,
0.9921875,
-1.138671875,
0.24462890625,
0.61083984375,
0.234375,
-0.69921875,
1.56640625,
0.214111328125,
0.49658203125,
-0.23046875,
-0.28369140625,
-0.6728515625,
0.2200927734375,
0.212646484375,
-0.7421875,
-0.57421875,
0.56640625,
0.0465087890625,
-0.91357421875,
0.363525390625,
-1.064453125,
-0.419189453125,
-0.08233642578125,
-0.60791015625,
0.845703125,
0.45166015625,
0.479736328125,
-0.57470703125,
-0.11810302734375,
-0.15576171875,
0.63134765625,
-0.181640625,
-0.5947265625,
-0.061981201171875,
0.74658203125,
0.28662109375,
0.1199951171875,
0.325927734375,
-0.6123046875,
0.08734130859375,
-0.295654296875,
0.3232421875,
0.6357421875,
0.1365966796875,
0.141357421875,
0.173583984375,
0.6416015625,
-1.037109375,
-0.26953125,
-0.80615234375,
0.73046875,
0.352294921875,
0.6064453125,
0.0994873046875,
-0.53759765625,
-0.11962890625,
-0.85400390625,
0.260009765625,
-0.347900390625,
0.93603515625,
-0.77587890625,
0.81103515625,
0.071533203125,
-0.463623046875,
0.84130859375,
-0.61328125,
0.026702880859375,
1.23828125,
-0.0030841827392578125,
0.86279296875,
-0.64453125,
0.412353515625,
-0.364013671875,
0.1129150390625,
0.12158203125,
-0.0869140625,
0.68115234375,
-0.048828125,
-0.348388671875,
-0.61181640625,
-0.13916015625,
-0.145751953125,
-0.7158203125,
-0.033843994140625,
0.041046142578125,
-0.497802734375,
-0.92431640625,
0.59814453125,
0.998046875,
0.4990234375,
-0.08795166015625,
0.6923828125,
0.0352783203125,
0.296875,
0.5498046875,
-0.29833984375,
0.03411865234375,
-0.69873046875,
0.7216796875,
0.052398681640625,
-0.332275390625,
-0.568359375,
-0.6494140625,
-0.18115234375,
0.1749267578125,
-0.02520751953125,
0.2159423828125,
-0.892578125,
0.269775390625,
-0.0267333984375,
0.382080078125,
-0.60791015625,
-0.334716796875,
-0.5263671875,
0.767578125,
0.56689453125,
-0.564453125,
0.0484619140625,
-0.5,
0.367431640625,
0.39208984375,
-0.247802734375,
-0.235107421875,
-0.59375,
-0.84423828125,
-0.52734375,
0.492431640625,
0.7626953125,
-0.0198211669921875,
0.5498046875,
-0.98876953125,
0.419189453125,
0.0772705078125,
-0.1444091796875,
0.341796875,
0.027313232421875,
0.12322998046875,
0.4677734375,
0.66552734375,
0.034820556640625,
-0.48095703125,
0.21875,
-1.099609375,
0.52685546875,
-0.479248046875,
0.779296875,
0.331298828125,
-0.024688720703125,
-0.55078125,
0.4169921875,
-0.59912109375,
0.042266845703125,
-0.1319580078125,
0.330322265625,
-0.9453125,
-0.94140625,
0.67236328125,
-0.407958984375,
-0.31005859375,
0.64892578125,
-0.08050537109375,
-0.3046875,
0.2529296875,
0.51416015625,
-0.445068359375,
0.58349609375,
-0.06072998046875,
0.392333984375,
-0.4169921875,
-0.0958251953125,
-0.348388671875,
-0.49462890625,
0.91455078125,
0.33154296875,
-0.880859375,
0.0909423828125,
-1.2138671875,
-0.611328125,
-0.1597900390625,
-0.490966796875,
0.2437744140625,
0.042938232421875,
-0.326904296875,
-0.0305633544921875,
-0.654296875,
-0.34326171875,
-0.26806640625,
-1.001953125,
-0.384521484375,
0.37353515625,
0.1890869140625,
0.57861328125,
-0.162109375,
-0.06414794921875,
0.424072265625,
-0.0819091796875,
-0.08233642578125,
-0.50927734375,
0.3095703125,
-0.072509765625,
-0.27197265625,
-0.4619140625,
0.23046875,
0.52978515625,
0.384521484375,
0.66015625,
0.38330078125,
0.60205078125,
0.2176513671875,
-0.465087890625,
1.046875,
-0.04620361328125,
-1.0927734375,
-0.61962890625,
0.525390625,
-0.1446533203125,
0.83837890625,
0.2451171875,
-1.0439453125,
-0.8701171875,
-1.763671875,
0.2481689453125,
-0.63623046875,
-0.2978515625,
-0.875,
-0.5927734375,
-0.1802978515625,
0.6259765625,
-0.2314453125,
-0.46240234375,
0.056732177734375,
-0.9970703125,
0.04376220703125,
-0.734375,
-0.60009765625,
-0.54638671875,
-0.2470703125,
-0.29345703125,
1.130859375,
-0.0198211669921875,
-0.078857421875,
0.5029296875,
0.374267578125,
0.31201171875,
-0.30078125,
-0.86962890625,
-0.258544921875,
-0.058990478515625,
0.10845947265625,
-0.1802978515625,
0.2198486328125,
-0.71240234375,
0.822265625,
-1.1044921875,
-0.241943359375,
0.00672149658203125,
-0.5166015625,
-0.252197265625,
-0.3701171875,
1.0380859375,
-0.521484375,
-0.40380859375,
-0.390869140625,
0.497314453125,
0.56640625,
-0.396728515625,
0.0204315185546875,
-0.392822265625,
-0.10498046875,
-0.6962890625,
0.51513671875,
-0.75,
-0.282470703125,
-0.58447265625,
0.035980224609375,
1.3818359375,
-0.8935546875,
0.6220703125,
1.109375,
0.07470703125,
-0.03826904296875,
-0.53564453125,
0.1971435546875,
0.255615234375,
-0.63623046875,
-0.12371826171875,
-0.1702880859375,
-0.720703125,
-0.03814697265625,
-0.4599609375,
-1.2041015625,
-0.55322265625,
0.24072265625,
1.404296875,
-0.301025390625,
0.828125,
0.055908203125,
-0.74072265625,
-0.35888671875,
1.05078125,
-0.433349609375,
0.39794921875,
1.0732421875,
-0.09368896484375,
-0.12225341796875,
0.2568359375,
-0.35693359375,
-0.411865234375,
-0.06597900390625,
1.4111328125,
-0.40576171875,
-0.44140625,
0.7509765625,
0.9423828125,
-0.9287109375,
-0.73876953125,
-0.1046142578125,
0.318115234375,
0.0007939338684082031,
-0.52685546875,
-0.1593017578125,
0.68017578125,
-0.6669921875,
0.349609375,
0.349853515625,
0.004825592041015625,
0.34375,
-0.1126708984375,
0.43701171875,
-0.59765625,
0.28759765625,
0.85888671875,
-0.70947265625,
-0.496826171875,
-0.8134765625,
-0.1236572265625,
-0.204833984375,
-0.2147216796875,
0.76513671875,
-0.3623046875,
0.1702880859375,
0.7470703125,
0.1295166015625,
0.65087890625,
-0.443115234375,
0.029052734375,
-0.08172607421875,
-0.4423828125,
-0.354248046875,
-0.1632080078125,
0.415283203125,
-0.17529296875,
0.30908203125,
-0.849609375,
0.0278167724609375,
0.517578125,
0.54296875,
-0.279052734375,
-1.2705078125,
-0.30029296875,
-0.94384765625,
-0.258056640625,
-0.482421875,
-0.81689453125,
-0.359619140625,
-0.11248779296875,
0.1416015625,
-0.6708984375,
0.2152099609375,
0.327880859375,
-0.82275390625,
0.71435546875,
-0.984375,
0.2265625,
-0.525390625,
-0.343017578125,
-0.9921875,
0.2467041015625,
0.129638671875,
-0.312744140625,
-0.55078125,
-0.2213134765625,
-0.048309326171875,
0.2196044921875,
-0.07171630859375,
0.337890625,
-0.0235595703125,
-0.5947265625,
-0.06658935546875,
0.04791259765625,
-0.07586669921875,
0.9775390625,
0.58837890625,
0.46240234375,
0.708984375,
-0.157958984375,
-0.424072265625,
-0.396484375,
0.6572265625,
0.68310546875,
-0.47802734375,
-0.173095703125,
-0.0762939453125,
0.357177734375,
-1.05859375,
0.1781005859375,
-0.1182861328125,
0.298095703125,
0.10101318359375,
-0.27880859375,
0.4501953125,
1.21484375,
-0.330322265625,
0.53173828125,
0.10638427734375,
0.361572265625,
0.492919921875,
-0.376953125,
0.259521484375,
0.62890625,
0.3037109375,
-0.10357666015625,
0.137451171875,
0.182861328125,
-0.0965576171875,
0.426025390625,
-0.389404296875,
-0.454833984375,
-0.89111328125,
-0.31689453125,
-0.15966796875,
0.24951171875,
0.53076171875,
-0.517578125,
-0.480712890625,
-0.0313720703125,
-0.5302734375,
0.05010986328125,
-1.474609375,
-1.0908203125,
0.60107421875,
-0.427001953125,
-0.72509765625,
-0.59619140625,
-0.60546875,
0.31787109375,
0.464111328125,
0.58447265625,
-0.634765625,
0.41064453125,
-0.048919677734375,
0.6318359375,
-0.1396484375,
-0.457275390625,
0.0673828125,
0.3720703125,
-0.3955078125,
-0.475830078125,
0.267822265625,
0.595703125,
0.11395263671875,
-0.41796875,
-0.57666015625,
-0.0128631591796875,
0.2230224609375,
-0.2095947265625,
-0.51025390625,
0.12054443359375,
-0.11376953125,
0.853515625,
-0.6796875,
0.06927490234375,
-0.181884765625,
0.2042236328125,
0.283203125,
-0.486328125,
-0.65576171875,
0.89990234375,
0.798828125,
-0.180419921875,
0.416015625,
0.267822265625,
0.66796875,
-0.494384765625,
-0.0019969940185546875,
0.248291015625,
0.3740234375,
0.58544921875,
0.66943359375,
-0.478515625,
0.5478515625,
0.7353515625,
-0.0277099609375,
0.04547119140625,
0.1827392578125,
0.02532958984375,
-0.0289459228515625,
0.006923675537109375,
-0.2213134765625,
-0.30615234375,
0.38916015625,
-0.32080078125,
0.249755859375,
-0.1400146484375,
-0.28759765625,
-0.34814453125,
-0.712890625,
0.6025390625,
-0.41015625,
-0.31494140625,
-0.35107421875,
-0.60693359375,
0.419189453125,
0.438720703125,
-0.0158843994140625,
0.267333984375,
0.81787109375,
0.94970703125,
-0.134033203125,
0.69873046875,
0.446044921875,
0.6728515625,
-0.81298828125,
-0.1826171875,
0.017181396484375,
-0.09478759765625,
-0.1717529296875,
-0.26416015625,
-0.8701171875,
0.1878662109375,
-0.2626953125,
-0.2861328125,
0.69384765625,
-0.7724609375,
-0.05584716796875,
-0.299560546875,
0.98828125,
-0.83251953125,
0.49072265625,
0.69677734375,
-0.1488037109375,
-0.297607421875,
0.85546875,
-0.2125244140625,
0.28125,
0.248046875,
0.83935546875,
0.004711151123046875,
1.646484375,
0.441650390625,
-0.47802734375,
0.38427734375,
0.58203125,
-0.4912109375,
-0.552734375,
-0.22021484375,
-0.196044921875,
-0.1727294921875,
-0.35546875,
-0.1180419921875,
-0.0036144256591796875,
0.66796875,
0.311279296875,
-0.50537109375,
-0.0484619140625,
0.2353515625,
-0.7724609375,
0.329833984375,
0.2646484375,
0.350341796875,
0.2261962890625,
0.2080078125,
-0.237548828125,
-0.74072265625,
0.06707763671875,
-0.7373046875,
0.7763671875,
-0.36865234375,
-0.29248046875,
-0.908203125,
-0.82470703125,
-0.411865234375,
0.234619140625,
-0.25244140625,
-0.73046875,
0.50732421875,
0.66259765625,
0.2152099609375,
0.1951904296875,
-0.40673828125,
0.11883544921875,
0.92431640625,
1.4404296875,
-0.026458740234375,
0.247802734375,
0.71044921875,
-0.074951171875,
0.2445068359375,
-0.21923828125,
0.041412353515625,
0.27880859375,
0.0213623046875,
-0.22607421875,
0.1309814453125,
-0.4755859375,
-1.1787109375,
0.0682373046875,
0.4423828125,
-0.0027217864990234375,
-0.378173828125,
-1.099609375,
-0.421630859375,
-0.9111328125,
0.243896484375,
-0.9052734375,
0.919921875,
-0.264892578125,
-0.192138671875,
0.0015926361083984375,
-0.927734375,
4.35546875,
0.9091796875,
0.9580078125,
0.414306640625,
0.08050537109375,
0.7587890625,
0.403564453125,
-0.317138671875,
-0.3974609375,
-0.953125,
0.75634765625,
-1.1181640625,
-0.1566162109375,
0.763671875,
0.10638427734375,
0.5029296875,
-0.78466796875,
-0.1024169921875,
0.406494140625,
-1.1025390625,
-0.876953125,
-0.267578125,
-0.62548828125,
0.41064453125,
-0.471435546875,
0.46435546875,
0.666015625,
-0.94189453125,
-0.2685546875,
-0.505859375,
-0.258544921875,
-0.81298828125,
0.62841796875,
0.11968994140625,
-0.1976318359375,
0.630859375,
-0.0634765625,
-0.1566162109375,
-0.3916015625,
0.366455078125,
-0.145263671875,
0.56591796875,
0.75244140625,
-0.966796875,
-0.307861328125,
0.537109375,
-0.335693359375,
-0.044464111328125,
0.44921875,
-1.015625,
1.162109375,
-0.03680419921875,
0.55908203125,
-0.6630859375,
-1.060546875,
0.7900390625,
0.82080078125,
0.3056640625,
-0.1572265625,
0.26513671875,
0.39404296875,
0.54931640625,
0.2210693359375,
0.419677734375,
-0.9384765625,
0.83837890625,
0.053436279296875,
0.306396484375,
0.0830078125,
-0.05853271484375,
-0.00113677978515625,
-0.56982421875,
-0.0479736328125,
-0.30712890625,
0.37060546875,
-0.03326416015625,
0.1585693359375,
0.53955078125,
0.4189453125,
-0.66455078125,
-0.10382080078125,
-0.338623046875,
-0.56982421875,
-0.441162109375,
0.9482421875,
0.83935546875,
-0.50390625,
-0.2301025390625,
-0.35888671875,
0.5283203125,
0.6123046875,
0.489501953125,
0.197998046875,
-0.344482421875,
-0.09320068359375
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Digits Are Not Just Characters
Mr. Manuel Majorana Minore made a number of files with numbers in their names. He wants to have a list of the files, but the file listing command commonly used lists them in an order different from what he prefers, interpreting digit sequences in them as ASCII code sequences, not as numbers. For example, the files file10, file20 and file3 are listed in this order.
Write a program which decides the orders of file names interpreting digit sequences as numeric values.
Each file name consists of uppercase letters (from 'A' to 'Z'), lowercase letters (from 'a' to 'z'), and digits (from '0' to '9').
A file name is looked upon as a sequence of items, each being either a letter or a number. Each single uppercase or lowercase letter forms a letter item. Each consecutive sequence of digits forms a number item.
Two item are ordered as follows.
* Number items come before letter items.
* Two letter items are ordered by their ASCII codes.
* Two number items are ordered by their values when interpreted as decimal numbers.
Two file names are compared item by item, starting from the top, and the order of the first different corresponding items decides the order of the file names. If one of them, say $A$, has more items than the other, $B$, and all the items of $B$ are the same as the corresponding items of $A$, $B$ should come before.
For example, three file names in Sample Input 1, file10, file20, and file3 all start with the same sequence of four letter items f, i, l, and e, followed by a number item, 10, 20, and 3, respectively. Comparing numeric values of these number items, they are ordered as file3 $<$ file10 $<$ file20.
Input
The input consists of a single test case of the following format.
$n$
$s_0$
$s_1$
:
$s_n$
The integer $n$ in the first line gives the number of file names ($s_1$ through $s_n$) to be compared with the file name given in the next line ($s_0$). Here, $n$ satisfies $1 \leq n \leq 1000$.
The following $n + 1$ lines are file names, $s_0$ through $s_n$, one in each line. They have at least one and no more than nine characters. Each of the characters is either an uppercase letter, a lowercase letter, or a digit.
Sequences of digits in the file names never start with a digit zero (0).
Output
For each of the file names, $s_1$ through $s_n$, output one line with a character indicating whether it should come before $s_0$ or not. The character should be "-" if it is to be listed before $s_0$; otherwise, it should be "+", including cases where two names are identical.
Sample Input 1
2
file10
file20
file3
Sample Output 1
+
-
Sample Input 2
11
X52Y
X
X5
X52
X52Y
X52Y6
32
ABC
XYZ
x51y
X8Y
X222
Sample Output 2
-
-
-
+
+
-
-
+
+
-
+
Example
Input
2
file10
file20
file3
Output
+
-
"Correct Solution:
```
import sys
sys.setrecursionlimit(10**6)
def tl(s):
pre = False
ref = []
for i in s:
if ord(i) < 58:
if pre:
ref[-1] = [True, ref[-1][1]*10 + int(i)]
else:
pre = True
ref += [[True, int(i)]]
else:
ref += [[False, i]]
pre=False
return ref
def main():
n = int(input())
pibot = tl(input())
for _ in range(n):
temp = tl(input())
ans = "-"
for i in range(len(temp)):
if i >= len(pibot):
ans = "+"
break
if pibot[i] == temp[i]:
if pibot == temp:
ans = "+"
break
continue
if pibot[i][0] and not(temp[i][0]):
ans = "+"
elif not(pibot[i][0]) and temp[i][0]:
ans = "-"
elif pibot[i][0]:
if pibot[i][1] < temp[i][1]:
ans = "+"
else:
ans = "-"
else:
if ord(pibot[i][1]) < ord(temp[i][1]):
ans = "+"
else:
ans = "-"
break
print(ans)
return
main()
```
| 64,781
|
[
0.4072265625,
0.00583648681640625,
0.52197265625,
-0.016876220703125,
-0.06732177734375,
-0.23046875,
-0.2275390625,
0.09503173828125,
-0.1092529296875,
1.1748046875,
0.49951171875,
0.0159912109375,
0.287353515625,
-0.734375,
-0.77783203125,
0.1534423828125,
-0.26318359375,
-0.615234375,
-0.2398681640625,
-0.207275390625,
0.2042236328125,
0.398193359375,
-1.298828125,
-0.6123046875,
-0.60986328125,
0.6767578125,
0.44921875,
-0.00901031494140625,
0.81201171875,
0.86767578125,
0.049530029296875,
-0.463134765625,
0.9560546875,
-0.72021484375,
-0.1412353515625,
-0.36962890625,
0.7744140625,
-0.68310546875,
-0.2437744140625,
-0.64794921875,
0.2198486328125,
-0.365966796875,
0.78076171875,
-0.96533203125,
-1.2919921875,
-0.01291656494140625,
-0.0859375,
-0.27978515625,
-0.307861328125,
-0.5869140625,
0.38232421875,
0.0430908203125,
0.3232421875,
-0.085693359375,
-0.30859375,
-0.29736328125,
0.1331787109375,
-0.217529296875,
-0.407470703125,
-0.2100830078125,
-0.343505859375,
0.058990478515625,
0.10662841796875,
-0.38427734375,
-0.0019779205322265625,
0.481689453125,
-0.266845703125,
-0.52392578125,
0.00934600830078125,
-0.9580078125,
-0.316162109375,
0.425537109375,
-0.35791015625,
0.0992431640625,
-0.7822265625,
-0.04400634765625,
0.036590576171875,
-0.047637939453125,
-0.207763671875,
0.669921875,
0.2020263671875,
0.984375,
-0.00009238719940185547,
0.5361328125,
-0.611328125,
-0.416015625,
0.150390625,
-0.14501953125,
0.425048828125,
0.05523681640625,
-0.1929931640625,
0.413818359375,
-0.68701171875,
0.0272674560546875,
0.76123046875,
0.76708984375,
-0.12469482421875,
0.6484375,
0.50048828125,
0.51806640625,
0.70166015625,
1.392578125,
-0.1197509765625,
0.9912109375,
-0.56005859375,
-0.0689697265625,
0.4541015625,
-0.11004638671875,
-0.182373046875,
-0.493896484375,
0.09246826171875,
-0.429931640625,
0.0302276611328125,
-0.2310791015625,
-0.7578125,
0.99951171875,
0.24755859375,
0.27001953125,
-0.9267578125,
0.1314697265625,
0.231201171875,
-0.041534423828125,
0.60693359375,
-0.444580078125,
-0.11553955078125,
-0.33447265625,
-0.689453125,
0.8681640625,
-0.2471923828125,
-0.33740234375,
0.217041015625,
-0.040557861328125,
-0.052459716796875,
0.05804443359375,
-0.2493896484375,
0.87939453125,
-0.1864013671875,
0.54150390625,
0.489501953125,
-0.603515625,
0.623046875,
-0.2305908203125,
-0.1510009765625,
1.748046875,
0.01519012451171875,
0.411865234375,
0.273193359375,
0.18701171875,
-0.6728515625,
0.1572265625,
-0.424072265625,
0.728515625,
0.1170654296875,
0.121337890625,
-0.4951171875,
0.2254638671875,
0.134033203125,
0.37060546875,
0.36962890625,
0.311279296875,
-0.5517578125,
0.08697509765625,
0.04376220703125,
0.32080078125,
-0.005401611328125,
1.1064453125,
-0.66748046875,
0.0528564453125,
-0.2607421875,
-0.275634765625,
0.3828125,
0.148681640625,
-0.027313232421875,
0.73876953125,
0.73095703125,
0.7548828125,
0.56005859375,
-0.191650390625,
0.2489013671875,
0.206787109375,
-0.33251953125,
0.0809326171875,
0.13134765625,
0.422607421875,
0.1444091796875,
0.32861328125,
0.304443359375,
-0.352783203125,
-0.88330078125,
-0.955078125,
0.100341796875,
0.9013671875,
-0.478271484375,
0.58447265625,
0.224365234375,
-0.08978271484375,
-0.95458984375,
-0.29296875,
0.2237548828125,
-1.181640625,
-0.58935546875,
0.65185546875,
-0.270751953125,
0.1456298828125,
-0.338623046875,
-0.125,
0.541015625,
1.3193359375,
-0.290283203125,
0.01898193359375,
0.376708984375,
0.09112548828125,
0.0545654296875,
0.041839599609375,
0.164794921875,
-0.01739501953125,
-0.45361328125,
0.390869140625,
-0.87255859375,
0.1495361328125,
0.0794677734375,
1.1240234375,
0.088623046875,
0.48681640625,
0.0234222412109375,
-0.440185546875,
0.64599609375,
0.85791015625,
-0.0966796875,
0.466064453125,
0.154052734375,
0.9130859375,
0.43505859375,
0.53515625,
0.7177734375,
0.333740234375,
0.89404296875,
0.7451171875,
-0.33544921875,
0.465087890625,
-0.2093505859375,
0.020477294921875,
0.222900390625,
0.434814453125,
0.3046875,
0.38720703125,
-0.07513427734375,
0.0276947021484375,
-0.37060546875,
0.452392578125,
-0.1768798828125,
0.77685546875,
0.039794921875,
0.366455078125,
-0.20263671875,
-0.414794921875,
0.10406494140625,
0.83203125,
-1.005859375,
-0.6982421875,
0.146484375,
-0.11334228515625,
0.35546875,
0.016082763671875,
0.321044921875,
0.76416015625,
0.2266845703125,
0.8291015625,
-0.1463623046875,
-0.5400390625,
-0.78369140625,
-0.58544921875,
-0.81201171875,
0.037261962890625,
-0.7138671875,
-0.247314453125,
0.2607421875,
-0.75927734375,
0.32421875,
-0.168701171875,
-0.134765625,
-0.09893798828125,
-0.408203125,
0.49365234375,
-0.292236328125,
0.294189453125,
-0.78125,
0.58935546875,
-0.09967041015625,
0.78125,
-0.63037109375,
-0.2467041015625,
-0.4287109375,
-0.56689453125,
0.4521484375,
0.31005859375,
0.56689453125,
-0.209716796875,
-0.29541015625,
-1.0263671875,
-0.82421875,
-0.448974609375,
-0.5185546875,
0.09454345703125,
-0.458740234375,
0.67919921875,
0.6123046875,
-0.71728515625,
0.68408203125,
0.9921875,
-1.138671875,
0.24462890625,
0.61083984375,
0.234375,
-0.69921875,
1.56640625,
0.214111328125,
0.49658203125,
-0.23046875,
-0.28369140625,
-0.6728515625,
0.2200927734375,
0.212646484375,
-0.7421875,
-0.57421875,
0.56640625,
0.0465087890625,
-0.91357421875,
0.363525390625,
-1.064453125,
-0.419189453125,
-0.08233642578125,
-0.60791015625,
0.845703125,
0.45166015625,
0.479736328125,
-0.57470703125,
-0.11810302734375,
-0.15576171875,
0.63134765625,
-0.181640625,
-0.5947265625,
-0.061981201171875,
0.74658203125,
0.28662109375,
0.1199951171875,
0.325927734375,
-0.6123046875,
0.08734130859375,
-0.295654296875,
0.3232421875,
0.6357421875,
0.1365966796875,
0.141357421875,
0.173583984375,
0.6416015625,
-1.037109375,
-0.26953125,
-0.80615234375,
0.73046875,
0.352294921875,
0.6064453125,
0.0994873046875,
-0.53759765625,
-0.11962890625,
-0.85400390625,
0.260009765625,
-0.347900390625,
0.93603515625,
-0.77587890625,
0.81103515625,
0.071533203125,
-0.463623046875,
0.84130859375,
-0.61328125,
0.026702880859375,
1.23828125,
-0.0030841827392578125,
0.86279296875,
-0.64453125,
0.412353515625,
-0.364013671875,
0.1129150390625,
0.12158203125,
-0.0869140625,
0.68115234375,
-0.048828125,
-0.348388671875,
-0.61181640625,
-0.13916015625,
-0.145751953125,
-0.7158203125,
-0.033843994140625,
0.041046142578125,
-0.497802734375,
-0.92431640625,
0.59814453125,
0.998046875,
0.4990234375,
-0.08795166015625,
0.6923828125,
0.0352783203125,
0.296875,
0.5498046875,
-0.29833984375,
0.03411865234375,
-0.69873046875,
0.7216796875,
0.052398681640625,
-0.332275390625,
-0.568359375,
-0.6494140625,
-0.18115234375,
0.1749267578125,
-0.02520751953125,
0.2159423828125,
-0.892578125,
0.269775390625,
-0.0267333984375,
0.382080078125,
-0.60791015625,
-0.334716796875,
-0.5263671875,
0.767578125,
0.56689453125,
-0.564453125,
0.0484619140625,
-0.5,
0.367431640625,
0.39208984375,
-0.247802734375,
-0.235107421875,
-0.59375,
-0.84423828125,
-0.52734375,
0.492431640625,
0.7626953125,
-0.0198211669921875,
0.5498046875,
-0.98876953125,
0.419189453125,
0.0772705078125,
-0.1444091796875,
0.341796875,
0.027313232421875,
0.12322998046875,
0.4677734375,
0.66552734375,
0.034820556640625,
-0.48095703125,
0.21875,
-1.099609375,
0.52685546875,
-0.479248046875,
0.779296875,
0.331298828125,
-0.024688720703125,
-0.55078125,
0.4169921875,
-0.59912109375,
0.042266845703125,
-0.1319580078125,
0.330322265625,
-0.9453125,
-0.94140625,
0.67236328125,
-0.407958984375,
-0.31005859375,
0.64892578125,
-0.08050537109375,
-0.3046875,
0.2529296875,
0.51416015625,
-0.445068359375,
0.58349609375,
-0.06072998046875,
0.392333984375,
-0.4169921875,
-0.0958251953125,
-0.348388671875,
-0.49462890625,
0.91455078125,
0.33154296875,
-0.880859375,
0.0909423828125,
-1.2138671875,
-0.611328125,
-0.1597900390625,
-0.490966796875,
0.2437744140625,
0.042938232421875,
-0.326904296875,
-0.0305633544921875,
-0.654296875,
-0.34326171875,
-0.26806640625,
-1.001953125,
-0.384521484375,
0.37353515625,
0.1890869140625,
0.57861328125,
-0.162109375,
-0.06414794921875,
0.424072265625,
-0.0819091796875,
-0.08233642578125,
-0.50927734375,
0.3095703125,
-0.072509765625,
-0.27197265625,
-0.4619140625,
0.23046875,
0.52978515625,
0.384521484375,
0.66015625,
0.38330078125,
0.60205078125,
0.2176513671875,
-0.465087890625,
1.046875,
-0.04620361328125,
-1.0927734375,
-0.61962890625,
0.525390625,
-0.1446533203125,
0.83837890625,
0.2451171875,
-1.0439453125,
-0.8701171875,
-1.763671875,
0.2481689453125,
-0.63623046875,
-0.2978515625,
-0.875,
-0.5927734375,
-0.1802978515625,
0.6259765625,
-0.2314453125,
-0.46240234375,
0.056732177734375,
-0.9970703125,
0.04376220703125,
-0.734375,
-0.60009765625,
-0.54638671875,
-0.2470703125,
-0.29345703125,
1.130859375,
-0.0198211669921875,
-0.078857421875,
0.5029296875,
0.374267578125,
0.31201171875,
-0.30078125,
-0.86962890625,
-0.258544921875,
-0.058990478515625,
0.10845947265625,
-0.1802978515625,
0.2198486328125,
-0.71240234375,
0.822265625,
-1.1044921875,
-0.241943359375,
0.00672149658203125,
-0.5166015625,
-0.252197265625,
-0.3701171875,
1.0380859375,
-0.521484375,
-0.40380859375,
-0.390869140625,
0.497314453125,
0.56640625,
-0.396728515625,
0.0204315185546875,
-0.392822265625,
-0.10498046875,
-0.6962890625,
0.51513671875,
-0.75,
-0.282470703125,
-0.58447265625,
0.035980224609375,
1.3818359375,
-0.8935546875,
0.6220703125,
1.109375,
0.07470703125,
-0.03826904296875,
-0.53564453125,
0.1971435546875,
0.255615234375,
-0.63623046875,
-0.12371826171875,
-0.1702880859375,
-0.720703125,
-0.03814697265625,
-0.4599609375,
-1.2041015625,
-0.55322265625,
0.24072265625,
1.404296875,
-0.301025390625,
0.828125,
0.055908203125,
-0.74072265625,
-0.35888671875,
1.05078125,
-0.433349609375,
0.39794921875,
1.0732421875,
-0.09368896484375,
-0.12225341796875,
0.2568359375,
-0.35693359375,
-0.411865234375,
-0.06597900390625,
1.4111328125,
-0.40576171875,
-0.44140625,
0.7509765625,
0.9423828125,
-0.9287109375,
-0.73876953125,
-0.1046142578125,
0.318115234375,
0.0007939338684082031,
-0.52685546875,
-0.1593017578125,
0.68017578125,
-0.6669921875,
0.349609375,
0.349853515625,
0.004825592041015625,
0.34375,
-0.1126708984375,
0.43701171875,
-0.59765625,
0.28759765625,
0.85888671875,
-0.70947265625,
-0.496826171875,
-0.8134765625,
-0.1236572265625,
-0.204833984375,
-0.2147216796875,
0.76513671875,
-0.3623046875,
0.1702880859375,
0.7470703125,
0.1295166015625,
0.65087890625,
-0.443115234375,
0.029052734375,
-0.08172607421875,
-0.4423828125,
-0.354248046875,
-0.1632080078125,
0.415283203125,
-0.17529296875,
0.30908203125,
-0.849609375,
0.0278167724609375,
0.517578125,
0.54296875,
-0.279052734375,
-1.2705078125,
-0.30029296875,
-0.94384765625,
-0.258056640625,
-0.482421875,
-0.81689453125,
-0.359619140625,
-0.11248779296875,
0.1416015625,
-0.6708984375,
0.2152099609375,
0.327880859375,
-0.82275390625,
0.71435546875,
-0.984375,
0.2265625,
-0.525390625,
-0.343017578125,
-0.9921875,
0.2467041015625,
0.129638671875,
-0.312744140625,
-0.55078125,
-0.2213134765625,
-0.048309326171875,
0.2196044921875,
-0.07171630859375,
0.337890625,
-0.0235595703125,
-0.5947265625,
-0.06658935546875,
0.04791259765625,
-0.07586669921875,
0.9775390625,
0.58837890625,
0.46240234375,
0.708984375,
-0.157958984375,
-0.424072265625,
-0.396484375,
0.6572265625,
0.68310546875,
-0.47802734375,
-0.173095703125,
-0.0762939453125,
0.357177734375,
-1.05859375,
0.1781005859375,
-0.1182861328125,
0.298095703125,
0.10101318359375,
-0.27880859375,
0.4501953125,
1.21484375,
-0.330322265625,
0.53173828125,
0.10638427734375,
0.361572265625,
0.492919921875,
-0.376953125,
0.259521484375,
0.62890625,
0.3037109375,
-0.10357666015625,
0.137451171875,
0.182861328125,
-0.0965576171875,
0.426025390625,
-0.389404296875,
-0.454833984375,
-0.89111328125,
-0.31689453125,
-0.15966796875,
0.24951171875,
0.53076171875,
-0.517578125,
-0.480712890625,
-0.0313720703125,
-0.5302734375,
0.05010986328125,
-1.474609375,
-1.0908203125,
0.60107421875,
-0.427001953125,
-0.72509765625,
-0.59619140625,
-0.60546875,
0.31787109375,
0.464111328125,
0.58447265625,
-0.634765625,
0.41064453125,
-0.048919677734375,
0.6318359375,
-0.1396484375,
-0.457275390625,
0.0673828125,
0.3720703125,
-0.3955078125,
-0.475830078125,
0.267822265625,
0.595703125,
0.11395263671875,
-0.41796875,
-0.57666015625,
-0.0128631591796875,
0.2230224609375,
-0.2095947265625,
-0.51025390625,
0.12054443359375,
-0.11376953125,
0.853515625,
-0.6796875,
0.06927490234375,
-0.181884765625,
0.2042236328125,
0.283203125,
-0.486328125,
-0.65576171875,
0.89990234375,
0.798828125,
-0.180419921875,
0.416015625,
0.267822265625,
0.66796875,
-0.494384765625,
-0.0019969940185546875,
0.248291015625,
0.3740234375,
0.58544921875,
0.66943359375,
-0.478515625,
0.5478515625,
0.7353515625,
-0.0277099609375,
0.04547119140625,
0.1827392578125,
0.02532958984375,
-0.0289459228515625,
0.006923675537109375,
-0.2213134765625,
-0.30615234375,
0.38916015625,
-0.32080078125,
0.249755859375,
-0.1400146484375,
-0.28759765625,
-0.34814453125,
-0.712890625,
0.6025390625,
-0.41015625,
-0.31494140625,
-0.35107421875,
-0.60693359375,
0.419189453125,
0.438720703125,
-0.0158843994140625,
0.267333984375,
0.81787109375,
0.94970703125,
-0.134033203125,
0.69873046875,
0.446044921875,
0.6728515625,
-0.81298828125,
-0.1826171875,
0.017181396484375,
-0.09478759765625,
-0.1717529296875,
-0.26416015625,
-0.8701171875,
0.1878662109375,
-0.2626953125,
-0.2861328125,
0.69384765625,
-0.7724609375,
-0.05584716796875,
-0.299560546875,
0.98828125,
-0.83251953125,
0.49072265625,
0.69677734375,
-0.1488037109375,
-0.297607421875,
0.85546875,
-0.2125244140625,
0.28125,
0.248046875,
0.83935546875,
0.004711151123046875,
1.646484375,
0.441650390625,
-0.47802734375,
0.38427734375,
0.58203125,
-0.4912109375,
-0.552734375,
-0.22021484375,
-0.196044921875,
-0.1727294921875,
-0.35546875,
-0.1180419921875,
-0.0036144256591796875,
0.66796875,
0.311279296875,
-0.50537109375,
-0.0484619140625,
0.2353515625,
-0.7724609375,
0.329833984375,
0.2646484375,
0.350341796875,
0.2261962890625,
0.2080078125,
-0.237548828125,
-0.74072265625,
0.06707763671875,
-0.7373046875,
0.7763671875,
-0.36865234375,
-0.29248046875,
-0.908203125,
-0.82470703125,
-0.411865234375,
0.234619140625,
-0.25244140625,
-0.73046875,
0.50732421875,
0.66259765625,
0.2152099609375,
0.1951904296875,
-0.40673828125,
0.11883544921875,
0.92431640625,
1.4404296875,
-0.026458740234375,
0.247802734375,
0.71044921875,
-0.074951171875,
0.2445068359375,
-0.21923828125,
0.041412353515625,
0.27880859375,
0.0213623046875,
-0.22607421875,
0.1309814453125,
-0.4755859375,
-1.1787109375,
0.0682373046875,
0.4423828125,
-0.0027217864990234375,
-0.378173828125,
-1.099609375,
-0.421630859375,
-0.9111328125,
0.243896484375,
-0.9052734375,
0.919921875,
-0.264892578125,
-0.192138671875,
0.0015926361083984375,
-0.927734375,
4.35546875,
0.9091796875,
0.9580078125,
0.414306640625,
0.08050537109375,
0.7587890625,
0.403564453125,
-0.317138671875,
-0.3974609375,
-0.953125,
0.75634765625,
-1.1181640625,
-0.1566162109375,
0.763671875,
0.10638427734375,
0.5029296875,
-0.78466796875,
-0.1024169921875,
0.406494140625,
-1.1025390625,
-0.876953125,
-0.267578125,
-0.62548828125,
0.41064453125,
-0.471435546875,
0.46435546875,
0.666015625,
-0.94189453125,
-0.2685546875,
-0.505859375,
-0.258544921875,
-0.81298828125,
0.62841796875,
0.11968994140625,
-0.1976318359375,
0.630859375,
-0.0634765625,
-0.1566162109375,
-0.3916015625,
0.366455078125,
-0.145263671875,
0.56591796875,
0.75244140625,
-0.966796875,
-0.307861328125,
0.537109375,
-0.335693359375,
-0.044464111328125,
0.44921875,
-1.015625,
1.162109375,
-0.03680419921875,
0.55908203125,
-0.6630859375,
-1.060546875,
0.7900390625,
0.82080078125,
0.3056640625,
-0.1572265625,
0.26513671875,
0.39404296875,
0.54931640625,
0.2210693359375,
0.419677734375,
-0.9384765625,
0.83837890625,
0.053436279296875,
0.306396484375,
0.0830078125,
-0.05853271484375,
-0.00113677978515625,
-0.56982421875,
-0.0479736328125,
-0.30712890625,
0.37060546875,
-0.03326416015625,
0.1585693359375,
0.53955078125,
0.4189453125,
-0.66455078125,
-0.10382080078125,
-0.338623046875,
-0.56982421875,
-0.441162109375,
0.9482421875,
0.83935546875,
-0.50390625,
-0.2301025390625,
-0.35888671875,
0.5283203125,
0.6123046875,
0.489501953125,
0.197998046875,
-0.344482421875,
-0.09320068359375
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Digits Are Not Just Characters
Mr. Manuel Majorana Minore made a number of files with numbers in their names. He wants to have a list of the files, but the file listing command commonly used lists them in an order different from what he prefers, interpreting digit sequences in them as ASCII code sequences, not as numbers. For example, the files file10, file20 and file3 are listed in this order.
Write a program which decides the orders of file names interpreting digit sequences as numeric values.
Each file name consists of uppercase letters (from 'A' to 'Z'), lowercase letters (from 'a' to 'z'), and digits (from '0' to '9').
A file name is looked upon as a sequence of items, each being either a letter or a number. Each single uppercase or lowercase letter forms a letter item. Each consecutive sequence of digits forms a number item.
Two item are ordered as follows.
* Number items come before letter items.
* Two letter items are ordered by their ASCII codes.
* Two number items are ordered by their values when interpreted as decimal numbers.
Two file names are compared item by item, starting from the top, and the order of the first different corresponding items decides the order of the file names. If one of them, say $A$, has more items than the other, $B$, and all the items of $B$ are the same as the corresponding items of $A$, $B$ should come before.
For example, three file names in Sample Input 1, file10, file20, and file3 all start with the same sequence of four letter items f, i, l, and e, followed by a number item, 10, 20, and 3, respectively. Comparing numeric values of these number items, they are ordered as file3 $<$ file10 $<$ file20.
Input
The input consists of a single test case of the following format.
$n$
$s_0$
$s_1$
:
$s_n$
The integer $n$ in the first line gives the number of file names ($s_1$ through $s_n$) to be compared with the file name given in the next line ($s_0$). Here, $n$ satisfies $1 \leq n \leq 1000$.
The following $n + 1$ lines are file names, $s_0$ through $s_n$, one in each line. They have at least one and no more than nine characters. Each of the characters is either an uppercase letter, a lowercase letter, or a digit.
Sequences of digits in the file names never start with a digit zero (0).
Output
For each of the file names, $s_1$ through $s_n$, output one line with a character indicating whether it should come before $s_0$ or not. The character should be "-" if it is to be listed before $s_0$; otherwise, it should be "+", including cases where two names are identical.
Sample Input 1
2
file10
file20
file3
Sample Output 1
+
-
Sample Input 2
11
X52Y
X
X5
X52
X52Y
X52Y6
32
ABC
XYZ
x51y
X8Y
X222
Sample Output 2
-
-
-
+
+
-
-
+
+
-
+
Example
Input
2
file10
file20
file3
Output
+
-
"Correct Solution:
```
#!/usr/bin/python3
import array
from fractions import Fraction
import functools
import itertools
import math
import os
import sys
def main():
N = read_int()
A = inp()
for _ in range(N):
print('-' if solve(inp(), A) < 0 else '+')
def solve(A, B):
i = 0
j = 0
N = len(A)
M = len(B)
while i < N and j < M:
c = A[i]
d = B[i]
if '0' <= c <= '9':
if '0' <= d <= '9':
ii = i + 1
while ii < N and '0' <= A[ii] <= '9':
ii += 1
jj = j + 1
while jj < M and '0' <= B[jj] <= '9':
jj += 1
a = int(A[i : ii])
b = int(B[j : jj])
if a != b:
return a - b
i = ii
j = jj
else:
return -1
else:
if '0' <= d <= '9':
return 1
if c != d:
return ord(c) - ord(d)
i += 1
j += 1
if i < N:
return 1
if j < M:
return -1
return 0
###############################################################################
# AUXILIARY FUNCTIONS
DEBUG = 'DEBUG' in os.environ
def inp():
return sys.stdin.readline().rstrip()
def read_int():
return int(inp())
def read_ints():
return [int(e) for e in inp().split()]
def dprint(*value, sep=' ', end='\n'):
if DEBUG:
print(*value, sep=sep, end=end)
if __name__ == '__main__':
main()
```
| 64,782
|
[
0.4072265625,
0.00583648681640625,
0.52197265625,
-0.016876220703125,
-0.06732177734375,
-0.23046875,
-0.2275390625,
0.09503173828125,
-0.1092529296875,
1.1748046875,
0.49951171875,
0.0159912109375,
0.287353515625,
-0.734375,
-0.77783203125,
0.1534423828125,
-0.26318359375,
-0.615234375,
-0.2398681640625,
-0.207275390625,
0.2042236328125,
0.398193359375,
-1.298828125,
-0.6123046875,
-0.60986328125,
0.6767578125,
0.44921875,
-0.00901031494140625,
0.81201171875,
0.86767578125,
0.049530029296875,
-0.463134765625,
0.9560546875,
-0.72021484375,
-0.1412353515625,
-0.36962890625,
0.7744140625,
-0.68310546875,
-0.2437744140625,
-0.64794921875,
0.2198486328125,
-0.365966796875,
0.78076171875,
-0.96533203125,
-1.2919921875,
-0.01291656494140625,
-0.0859375,
-0.27978515625,
-0.307861328125,
-0.5869140625,
0.38232421875,
0.0430908203125,
0.3232421875,
-0.085693359375,
-0.30859375,
-0.29736328125,
0.1331787109375,
-0.217529296875,
-0.407470703125,
-0.2100830078125,
-0.343505859375,
0.058990478515625,
0.10662841796875,
-0.38427734375,
-0.0019779205322265625,
0.481689453125,
-0.266845703125,
-0.52392578125,
0.00934600830078125,
-0.9580078125,
-0.316162109375,
0.425537109375,
-0.35791015625,
0.0992431640625,
-0.7822265625,
-0.04400634765625,
0.036590576171875,
-0.047637939453125,
-0.207763671875,
0.669921875,
0.2020263671875,
0.984375,
-0.00009238719940185547,
0.5361328125,
-0.611328125,
-0.416015625,
0.150390625,
-0.14501953125,
0.425048828125,
0.05523681640625,
-0.1929931640625,
0.413818359375,
-0.68701171875,
0.0272674560546875,
0.76123046875,
0.76708984375,
-0.12469482421875,
0.6484375,
0.50048828125,
0.51806640625,
0.70166015625,
1.392578125,
-0.1197509765625,
0.9912109375,
-0.56005859375,
-0.0689697265625,
0.4541015625,
-0.11004638671875,
-0.182373046875,
-0.493896484375,
0.09246826171875,
-0.429931640625,
0.0302276611328125,
-0.2310791015625,
-0.7578125,
0.99951171875,
0.24755859375,
0.27001953125,
-0.9267578125,
0.1314697265625,
0.231201171875,
-0.041534423828125,
0.60693359375,
-0.444580078125,
-0.11553955078125,
-0.33447265625,
-0.689453125,
0.8681640625,
-0.2471923828125,
-0.33740234375,
0.217041015625,
-0.040557861328125,
-0.052459716796875,
0.05804443359375,
-0.2493896484375,
0.87939453125,
-0.1864013671875,
0.54150390625,
0.489501953125,
-0.603515625,
0.623046875,
-0.2305908203125,
-0.1510009765625,
1.748046875,
0.01519012451171875,
0.411865234375,
0.273193359375,
0.18701171875,
-0.6728515625,
0.1572265625,
-0.424072265625,
0.728515625,
0.1170654296875,
0.121337890625,
-0.4951171875,
0.2254638671875,
0.134033203125,
0.37060546875,
0.36962890625,
0.311279296875,
-0.5517578125,
0.08697509765625,
0.04376220703125,
0.32080078125,
-0.005401611328125,
1.1064453125,
-0.66748046875,
0.0528564453125,
-0.2607421875,
-0.275634765625,
0.3828125,
0.148681640625,
-0.027313232421875,
0.73876953125,
0.73095703125,
0.7548828125,
0.56005859375,
-0.191650390625,
0.2489013671875,
0.206787109375,
-0.33251953125,
0.0809326171875,
0.13134765625,
0.422607421875,
0.1444091796875,
0.32861328125,
0.304443359375,
-0.352783203125,
-0.88330078125,
-0.955078125,
0.100341796875,
0.9013671875,
-0.478271484375,
0.58447265625,
0.224365234375,
-0.08978271484375,
-0.95458984375,
-0.29296875,
0.2237548828125,
-1.181640625,
-0.58935546875,
0.65185546875,
-0.270751953125,
0.1456298828125,
-0.338623046875,
-0.125,
0.541015625,
1.3193359375,
-0.290283203125,
0.01898193359375,
0.376708984375,
0.09112548828125,
0.0545654296875,
0.041839599609375,
0.164794921875,
-0.01739501953125,
-0.45361328125,
0.390869140625,
-0.87255859375,
0.1495361328125,
0.0794677734375,
1.1240234375,
0.088623046875,
0.48681640625,
0.0234222412109375,
-0.440185546875,
0.64599609375,
0.85791015625,
-0.0966796875,
0.466064453125,
0.154052734375,
0.9130859375,
0.43505859375,
0.53515625,
0.7177734375,
0.333740234375,
0.89404296875,
0.7451171875,
-0.33544921875,
0.465087890625,
-0.2093505859375,
0.020477294921875,
0.222900390625,
0.434814453125,
0.3046875,
0.38720703125,
-0.07513427734375,
0.0276947021484375,
-0.37060546875,
0.452392578125,
-0.1768798828125,
0.77685546875,
0.039794921875,
0.366455078125,
-0.20263671875,
-0.414794921875,
0.10406494140625,
0.83203125,
-1.005859375,
-0.6982421875,
0.146484375,
-0.11334228515625,
0.35546875,
0.016082763671875,
0.321044921875,
0.76416015625,
0.2266845703125,
0.8291015625,
-0.1463623046875,
-0.5400390625,
-0.78369140625,
-0.58544921875,
-0.81201171875,
0.037261962890625,
-0.7138671875,
-0.247314453125,
0.2607421875,
-0.75927734375,
0.32421875,
-0.168701171875,
-0.134765625,
-0.09893798828125,
-0.408203125,
0.49365234375,
-0.292236328125,
0.294189453125,
-0.78125,
0.58935546875,
-0.09967041015625,
0.78125,
-0.63037109375,
-0.2467041015625,
-0.4287109375,
-0.56689453125,
0.4521484375,
0.31005859375,
0.56689453125,
-0.209716796875,
-0.29541015625,
-1.0263671875,
-0.82421875,
-0.448974609375,
-0.5185546875,
0.09454345703125,
-0.458740234375,
0.67919921875,
0.6123046875,
-0.71728515625,
0.68408203125,
0.9921875,
-1.138671875,
0.24462890625,
0.61083984375,
0.234375,
-0.69921875,
1.56640625,
0.214111328125,
0.49658203125,
-0.23046875,
-0.28369140625,
-0.6728515625,
0.2200927734375,
0.212646484375,
-0.7421875,
-0.57421875,
0.56640625,
0.0465087890625,
-0.91357421875,
0.363525390625,
-1.064453125,
-0.419189453125,
-0.08233642578125,
-0.60791015625,
0.845703125,
0.45166015625,
0.479736328125,
-0.57470703125,
-0.11810302734375,
-0.15576171875,
0.63134765625,
-0.181640625,
-0.5947265625,
-0.061981201171875,
0.74658203125,
0.28662109375,
0.1199951171875,
0.325927734375,
-0.6123046875,
0.08734130859375,
-0.295654296875,
0.3232421875,
0.6357421875,
0.1365966796875,
0.141357421875,
0.173583984375,
0.6416015625,
-1.037109375,
-0.26953125,
-0.80615234375,
0.73046875,
0.352294921875,
0.6064453125,
0.0994873046875,
-0.53759765625,
-0.11962890625,
-0.85400390625,
0.260009765625,
-0.347900390625,
0.93603515625,
-0.77587890625,
0.81103515625,
0.071533203125,
-0.463623046875,
0.84130859375,
-0.61328125,
0.026702880859375,
1.23828125,
-0.0030841827392578125,
0.86279296875,
-0.64453125,
0.412353515625,
-0.364013671875,
0.1129150390625,
0.12158203125,
-0.0869140625,
0.68115234375,
-0.048828125,
-0.348388671875,
-0.61181640625,
-0.13916015625,
-0.145751953125,
-0.7158203125,
-0.033843994140625,
0.041046142578125,
-0.497802734375,
-0.92431640625,
0.59814453125,
0.998046875,
0.4990234375,
-0.08795166015625,
0.6923828125,
0.0352783203125,
0.296875,
0.5498046875,
-0.29833984375,
0.03411865234375,
-0.69873046875,
0.7216796875,
0.052398681640625,
-0.332275390625,
-0.568359375,
-0.6494140625,
-0.18115234375,
0.1749267578125,
-0.02520751953125,
0.2159423828125,
-0.892578125,
0.269775390625,
-0.0267333984375,
0.382080078125,
-0.60791015625,
-0.334716796875,
-0.5263671875,
0.767578125,
0.56689453125,
-0.564453125,
0.0484619140625,
-0.5,
0.367431640625,
0.39208984375,
-0.247802734375,
-0.235107421875,
-0.59375,
-0.84423828125,
-0.52734375,
0.492431640625,
0.7626953125,
-0.0198211669921875,
0.5498046875,
-0.98876953125,
0.419189453125,
0.0772705078125,
-0.1444091796875,
0.341796875,
0.027313232421875,
0.12322998046875,
0.4677734375,
0.66552734375,
0.034820556640625,
-0.48095703125,
0.21875,
-1.099609375,
0.52685546875,
-0.479248046875,
0.779296875,
0.331298828125,
-0.024688720703125,
-0.55078125,
0.4169921875,
-0.59912109375,
0.042266845703125,
-0.1319580078125,
0.330322265625,
-0.9453125,
-0.94140625,
0.67236328125,
-0.407958984375,
-0.31005859375,
0.64892578125,
-0.08050537109375,
-0.3046875,
0.2529296875,
0.51416015625,
-0.445068359375,
0.58349609375,
-0.06072998046875,
0.392333984375,
-0.4169921875,
-0.0958251953125,
-0.348388671875,
-0.49462890625,
0.91455078125,
0.33154296875,
-0.880859375,
0.0909423828125,
-1.2138671875,
-0.611328125,
-0.1597900390625,
-0.490966796875,
0.2437744140625,
0.042938232421875,
-0.326904296875,
-0.0305633544921875,
-0.654296875,
-0.34326171875,
-0.26806640625,
-1.001953125,
-0.384521484375,
0.37353515625,
0.1890869140625,
0.57861328125,
-0.162109375,
-0.06414794921875,
0.424072265625,
-0.0819091796875,
-0.08233642578125,
-0.50927734375,
0.3095703125,
-0.072509765625,
-0.27197265625,
-0.4619140625,
0.23046875,
0.52978515625,
0.384521484375,
0.66015625,
0.38330078125,
0.60205078125,
0.2176513671875,
-0.465087890625,
1.046875,
-0.04620361328125,
-1.0927734375,
-0.61962890625,
0.525390625,
-0.1446533203125,
0.83837890625,
0.2451171875,
-1.0439453125,
-0.8701171875,
-1.763671875,
0.2481689453125,
-0.63623046875,
-0.2978515625,
-0.875,
-0.5927734375,
-0.1802978515625,
0.6259765625,
-0.2314453125,
-0.46240234375,
0.056732177734375,
-0.9970703125,
0.04376220703125,
-0.734375,
-0.60009765625,
-0.54638671875,
-0.2470703125,
-0.29345703125,
1.130859375,
-0.0198211669921875,
-0.078857421875,
0.5029296875,
0.374267578125,
0.31201171875,
-0.30078125,
-0.86962890625,
-0.258544921875,
-0.058990478515625,
0.10845947265625,
-0.1802978515625,
0.2198486328125,
-0.71240234375,
0.822265625,
-1.1044921875,
-0.241943359375,
0.00672149658203125,
-0.5166015625,
-0.252197265625,
-0.3701171875,
1.0380859375,
-0.521484375,
-0.40380859375,
-0.390869140625,
0.497314453125,
0.56640625,
-0.396728515625,
0.0204315185546875,
-0.392822265625,
-0.10498046875,
-0.6962890625,
0.51513671875,
-0.75,
-0.282470703125,
-0.58447265625,
0.035980224609375,
1.3818359375,
-0.8935546875,
0.6220703125,
1.109375,
0.07470703125,
-0.03826904296875,
-0.53564453125,
0.1971435546875,
0.255615234375,
-0.63623046875,
-0.12371826171875,
-0.1702880859375,
-0.720703125,
-0.03814697265625,
-0.4599609375,
-1.2041015625,
-0.55322265625,
0.24072265625,
1.404296875,
-0.301025390625,
0.828125,
0.055908203125,
-0.74072265625,
-0.35888671875,
1.05078125,
-0.433349609375,
0.39794921875,
1.0732421875,
-0.09368896484375,
-0.12225341796875,
0.2568359375,
-0.35693359375,
-0.411865234375,
-0.06597900390625,
1.4111328125,
-0.40576171875,
-0.44140625,
0.7509765625,
0.9423828125,
-0.9287109375,
-0.73876953125,
-0.1046142578125,
0.318115234375,
0.0007939338684082031,
-0.52685546875,
-0.1593017578125,
0.68017578125,
-0.6669921875,
0.349609375,
0.349853515625,
0.004825592041015625,
0.34375,
-0.1126708984375,
0.43701171875,
-0.59765625,
0.28759765625,
0.85888671875,
-0.70947265625,
-0.496826171875,
-0.8134765625,
-0.1236572265625,
-0.204833984375,
-0.2147216796875,
0.76513671875,
-0.3623046875,
0.1702880859375,
0.7470703125,
0.1295166015625,
0.65087890625,
-0.443115234375,
0.029052734375,
-0.08172607421875,
-0.4423828125,
-0.354248046875,
-0.1632080078125,
0.415283203125,
-0.17529296875,
0.30908203125,
-0.849609375,
0.0278167724609375,
0.517578125,
0.54296875,
-0.279052734375,
-1.2705078125,
-0.30029296875,
-0.94384765625,
-0.258056640625,
-0.482421875,
-0.81689453125,
-0.359619140625,
-0.11248779296875,
0.1416015625,
-0.6708984375,
0.2152099609375,
0.327880859375,
-0.82275390625,
0.71435546875,
-0.984375,
0.2265625,
-0.525390625,
-0.343017578125,
-0.9921875,
0.2467041015625,
0.129638671875,
-0.312744140625,
-0.55078125,
-0.2213134765625,
-0.048309326171875,
0.2196044921875,
-0.07171630859375,
0.337890625,
-0.0235595703125,
-0.5947265625,
-0.06658935546875,
0.04791259765625,
-0.07586669921875,
0.9775390625,
0.58837890625,
0.46240234375,
0.708984375,
-0.157958984375,
-0.424072265625,
-0.396484375,
0.6572265625,
0.68310546875,
-0.47802734375,
-0.173095703125,
-0.0762939453125,
0.357177734375,
-1.05859375,
0.1781005859375,
-0.1182861328125,
0.298095703125,
0.10101318359375,
-0.27880859375,
0.4501953125,
1.21484375,
-0.330322265625,
0.53173828125,
0.10638427734375,
0.361572265625,
0.492919921875,
-0.376953125,
0.259521484375,
0.62890625,
0.3037109375,
-0.10357666015625,
0.137451171875,
0.182861328125,
-0.0965576171875,
0.426025390625,
-0.389404296875,
-0.454833984375,
-0.89111328125,
-0.31689453125,
-0.15966796875,
0.24951171875,
0.53076171875,
-0.517578125,
-0.480712890625,
-0.0313720703125,
-0.5302734375,
0.05010986328125,
-1.474609375,
-1.0908203125,
0.60107421875,
-0.427001953125,
-0.72509765625,
-0.59619140625,
-0.60546875,
0.31787109375,
0.464111328125,
0.58447265625,
-0.634765625,
0.41064453125,
-0.048919677734375,
0.6318359375,
-0.1396484375,
-0.457275390625,
0.0673828125,
0.3720703125,
-0.3955078125,
-0.475830078125,
0.267822265625,
0.595703125,
0.11395263671875,
-0.41796875,
-0.57666015625,
-0.0128631591796875,
0.2230224609375,
-0.2095947265625,
-0.51025390625,
0.12054443359375,
-0.11376953125,
0.853515625,
-0.6796875,
0.06927490234375,
-0.181884765625,
0.2042236328125,
0.283203125,
-0.486328125,
-0.65576171875,
0.89990234375,
0.798828125,
-0.180419921875,
0.416015625,
0.267822265625,
0.66796875,
-0.494384765625,
-0.0019969940185546875,
0.248291015625,
0.3740234375,
0.58544921875,
0.66943359375,
-0.478515625,
0.5478515625,
0.7353515625,
-0.0277099609375,
0.04547119140625,
0.1827392578125,
0.02532958984375,
-0.0289459228515625,
0.006923675537109375,
-0.2213134765625,
-0.30615234375,
0.38916015625,
-0.32080078125,
0.249755859375,
-0.1400146484375,
-0.28759765625,
-0.34814453125,
-0.712890625,
0.6025390625,
-0.41015625,
-0.31494140625,
-0.35107421875,
-0.60693359375,
0.419189453125,
0.438720703125,
-0.0158843994140625,
0.267333984375,
0.81787109375,
0.94970703125,
-0.134033203125,
0.69873046875,
0.446044921875,
0.6728515625,
-0.81298828125,
-0.1826171875,
0.017181396484375,
-0.09478759765625,
-0.1717529296875,
-0.26416015625,
-0.8701171875,
0.1878662109375,
-0.2626953125,
-0.2861328125,
0.69384765625,
-0.7724609375,
-0.05584716796875,
-0.299560546875,
0.98828125,
-0.83251953125,
0.49072265625,
0.69677734375,
-0.1488037109375,
-0.297607421875,
0.85546875,
-0.2125244140625,
0.28125,
0.248046875,
0.83935546875,
0.004711151123046875,
1.646484375,
0.441650390625,
-0.47802734375,
0.38427734375,
0.58203125,
-0.4912109375,
-0.552734375,
-0.22021484375,
-0.196044921875,
-0.1727294921875,
-0.35546875,
-0.1180419921875,
-0.0036144256591796875,
0.66796875,
0.311279296875,
-0.50537109375,
-0.0484619140625,
0.2353515625,
-0.7724609375,
0.329833984375,
0.2646484375,
0.350341796875,
0.2261962890625,
0.2080078125,
-0.237548828125,
-0.74072265625,
0.06707763671875,
-0.7373046875,
0.7763671875,
-0.36865234375,
-0.29248046875,
-0.908203125,
-0.82470703125,
-0.411865234375,
0.234619140625,
-0.25244140625,
-0.73046875,
0.50732421875,
0.66259765625,
0.2152099609375,
0.1951904296875,
-0.40673828125,
0.11883544921875,
0.92431640625,
1.4404296875,
-0.026458740234375,
0.247802734375,
0.71044921875,
-0.074951171875,
0.2445068359375,
-0.21923828125,
0.041412353515625,
0.27880859375,
0.0213623046875,
-0.22607421875,
0.1309814453125,
-0.4755859375,
-1.1787109375,
0.0682373046875,
0.4423828125,
-0.0027217864990234375,
-0.378173828125,
-1.099609375,
-0.421630859375,
-0.9111328125,
0.243896484375,
-0.9052734375,
0.919921875,
-0.264892578125,
-0.192138671875,
0.0015926361083984375,
-0.927734375,
4.35546875,
0.9091796875,
0.9580078125,
0.414306640625,
0.08050537109375,
0.7587890625,
0.403564453125,
-0.317138671875,
-0.3974609375,
-0.953125,
0.75634765625,
-1.1181640625,
-0.1566162109375,
0.763671875,
0.10638427734375,
0.5029296875,
-0.78466796875,
-0.1024169921875,
0.406494140625,
-1.1025390625,
-0.876953125,
-0.267578125,
-0.62548828125,
0.41064453125,
-0.471435546875,
0.46435546875,
0.666015625,
-0.94189453125,
-0.2685546875,
-0.505859375,
-0.258544921875,
-0.81298828125,
0.62841796875,
0.11968994140625,
-0.1976318359375,
0.630859375,
-0.0634765625,
-0.1566162109375,
-0.3916015625,
0.366455078125,
-0.145263671875,
0.56591796875,
0.75244140625,
-0.966796875,
-0.307861328125,
0.537109375,
-0.335693359375,
-0.044464111328125,
0.44921875,
-1.015625,
1.162109375,
-0.03680419921875,
0.55908203125,
-0.6630859375,
-1.060546875,
0.7900390625,
0.82080078125,
0.3056640625,
-0.1572265625,
0.26513671875,
0.39404296875,
0.54931640625,
0.2210693359375,
0.419677734375,
-0.9384765625,
0.83837890625,
0.053436279296875,
0.306396484375,
0.0830078125,
-0.05853271484375,
-0.00113677978515625,
-0.56982421875,
-0.0479736328125,
-0.30712890625,
0.37060546875,
-0.03326416015625,
0.1585693359375,
0.53955078125,
0.4189453125,
-0.66455078125,
-0.10382080078125,
-0.338623046875,
-0.56982421875,
-0.441162109375,
0.9482421875,
0.83935546875,
-0.50390625,
-0.2301025390625,
-0.35888671875,
0.5283203125,
0.6123046875,
0.489501953125,
0.197998046875,
-0.344482421875,
-0.09320068359375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Tags: brute force, implementation
Correct Solution:
```
from string import ascii_lowercase
n = int(input())
hashed_words = {}
word_buffer = []
for i in range(n):
data = [i for i in input().strip()]
if len(set(data)) <= 2:
if ''.join(set(data)) in hashed_words.keys():
hashed_words[''.join(set(data))] += len(data)
else:
hashed_words[''.join(set(data))] = len(data)
if len(hashed_words) > 0:
my_max = 0
for i in ascii_lowercase:
for j in ascii_lowercase:
if i != j:
current = 0
if i in hashed_words:
current += hashed_words[i]
if j in hashed_words:
current += hashed_words[j]
if i+j in hashed_words:
current += hashed_words[i+j]
if j+i in hashed_words:
current += hashed_words[j+i]
if my_max < current:
my_max = current
print(my_max)
else:
print(0)
```
| 65,207
|
[
0.01308441162109375,
0.120361328125,
0.33642578125,
0.587890625,
-0.705078125,
-0.29150390625,
0.24755859375,
-0.1802978515625,
0.1915283203125,
0.67724609375,
0.728515625,
-0.068603515625,
-0.1236572265625,
-0.4482421875,
-0.62646484375,
0.047943115234375,
-0.61669921875,
-0.6953125,
-0.6435546875,
0.04351806640625,
0.1387939453125,
-0.3359375,
-1.5107421875,
0.048797607421875,
-0.556640625,
1.046875,
0.125,
-0.061614990234375,
1.3134765625,
1.3671875,
-0.16064453125,
-0.352783203125,
0.2318115234375,
-0.64990234375,
-0.54833984375,
-0.1060791015625,
0.5966796875,
-1.02734375,
-0.279541015625,
-0.235595703125,
0.090576171875,
-0.4384765625,
0.43896484375,
-0.489501953125,
-1.0458984375,
-0.0276336669921875,
-0.3330078125,
-0.2919921875,
-0.1650390625,
-0.607421875,
0.30126953125,
-0.287353515625,
0.54248046875,
-0.07763671875,
-0.057098388671875,
-0.0966796875,
-0.2015380859375,
-0.01947021484375,
-0.292724609375,
0.242919921875,
0.32421875,
0.310791015625,
0.028106689453125,
-0.6572265625,
-0.076904296875,
0.1693115234375,
0.05181884765625,
0.028656005859375,
0.2122802734375,
-0.27490234375,
0.0146331787109375,
0.0408935546875,
-0.3603515625,
-0.368408203125,
-0.3603515625,
-0.023773193359375,
0.308349609375,
-0.35595703125,
-0.7490234375,
1.029296875,
-0.056732177734375,
0.6044921875,
0.1875,
-0.2017822265625,
-0.382568359375,
-0.325439453125,
0.29345703125,
0.371337890625,
0.5341796875,
-0.323974609375,
-0.34716796875,
0.39892578125,
-0.54931640625,
0.155517578125,
0.685546875,
0.50244140625,
-0.36767578125,
0.290283203125,
0.2418212890625,
0.18994140625,
0.75537109375,
1.03515625,
-0.164306640625,
1.2822265625,
-0.43701171875,
0.1934814453125,
0.400390625,
-0.0736083984375,
-0.28857421875,
-0.0146636962890625,
-0.0689697265625,
-0.38623046875,
0.38525390625,
0.043914794921875,
-0.41357421875,
0.806640625,
-0.10821533203125,
0.6513671875,
-0.814453125,
0.35888671875,
0.494384765625,
0.1236572265625,
0.09228515625,
0.1925048828125,
0.1614990234375,
-0.6552734375,
-0.3974609375,
0.859375,
-0.5048828125,
-0.156982421875,
0.431396484375,
0.1361083984375,
-0.269775390625,
0.5078125,
-0.10565185546875,
0.360107421875,
-0.283447265625,
0.29833984375,
0.6708984375,
-0.51611328125,
0.78076171875,
-0.10333251953125,
-0.025115966796875,
1.1630859375,
0.50439453125,
0.388916015625,
0.74072265625,
0.08514404296875,
-0.71923828125,
0.62939453125,
-0.93310546875,
0.630859375,
0.1376953125,
0.4091796875,
-0.607421875,
0.34130859375,
-0.12841796875,
0.2174072265625,
0.296630859375,
0.166015625,
-0.21484375,
0.425048828125,
-0.381591796875,
1.0693359375,
-0.400634765625,
1.015625,
-0.53515625,
-0.1824951171875,
-0.37353515625,
-0.444091796875,
0.28466796875,
-0.47705078125,
-0.1280517578125,
0.8173828125,
0.2012939453125,
1.283203125,
1.0732421875,
-0.103271484375,
0.376220703125,
0.1922607421875,
-0.318603515625,
0.3837890625,
0.2181396484375,
0.98779296875,
0.1588134765625,
0.305419921875,
-0.09613037109375,
-0.390380859375,
-0.7568359375,
-0.525390625,
0.232666015625,
0.498291015625,
-0.84765625,
0.005016326904296875,
0.144775390625,
0.1785888671875,
-1.1572265625,
0.064208984375,
0.169189453125,
-0.8427734375,
-0.43896484375,
0.43212890625,
-0.1383056640625,
0.515625,
-0.37841796875,
-0.2418212890625,
0.552734375,
1.2236328125,
-0.32177734375,
-0.020233154296875,
0.6279296875,
0.251953125,
0.033203125,
0.0457763671875,
0.1727294921875,
-0.281005859375,
-1.0107421875,
0.53271484375,
-0.263916015625,
-0.121826171875,
0.217041015625,
0.2159423828125,
0.46875,
0.224365234375,
-0.441162109375,
-0.0726318359375,
0.8359375,
1.15625,
-0.03680419921875,
0.52197265625,
0.02911376953125,
0.876953125,
0.267333984375,
0.53125,
0.396484375,
0.01096343994140625,
0.437744140625,
0.71923828125,
0.1004638671875,
0.56103515625,
0.1431884765625,
0.1875,
0.378662109375,
0.837890625,
0.31494140625,
0.43896484375,
-0.048828125,
-0.07684326171875,
-0.358154296875,
0.57177734375,
-0.38427734375,
0.31787109375,
0.050994873046875,
0.35205078125,
-0.67138671875,
-0.483154296875,
0.392822265625,
0.84423828125,
-0.7861328125,
-0.59521484375,
-0.4189453125,
0.515625,
0.10455322265625,
0.09613037109375,
0.294921875,
0.2359619140625,
0.1695556640625,
0.272216796875,
-0.1396484375,
0.0836181640625,
-1.1279296875,
-0.59521484375,
-1.0068359375,
-0.301025390625,
-0.52490234375,
-0.344970703125,
0.1702880859375,
-0.80859375,
0.418701171875,
-0.1319580078125,
-0.27880859375,
0.036346435546875,
-0.68310546875,
0.273193359375,
-0.44873046875,
0.751953125,
-0.8876953125,
0.59814453125,
0.130615234375,
1.052734375,
-0.07611083984375,
-0.31005859375,
-0.226806640625,
-0.60546875,
0.377685546875,
-0.171630859375,
0.4111328125,
0.054107666015625,
-0.91357421875,
-0.86083984375,
-0.1290283203125,
-0.44189453125,
-0.31298828125,
0.259765625,
-0.54443359375,
0.755859375,
0.239990234375,
-0.48974609375,
0.8203125,
0.646484375,
-0.9443359375,
0.186279296875,
0.202880859375,
-0.0693359375,
-0.98388671875,
1.2890625,
0.5625,
0.57763671875,
-0.568359375,
-0.38037109375,
-0.36962890625,
0.10321044921875,
0.241455078125,
-0.6220703125,
-0.32421875,
0.44189453125,
0.1112060546875,
-1.291015625,
0.34912109375,
-1.021484375,
-0.78369140625,
-0.6484375,
-0.459228515625,
0.94140625,
0.81591796875,
-0.037506103515625,
-0.33935546875,
-0.533203125,
-0.269775390625,
0.7255859375,
0.41015625,
-0.74755859375,
-0.1746826171875,
0.7548828125,
-0.05853271484375,
-0.093017578125,
0.06396484375,
-0.669921875,
-0.37548828125,
0.0230712890625,
0.52294921875,
0.67724609375,
0.2015380859375,
0.19189453125,
0.392578125,
0.501953125,
-0.755859375,
-0.286865234375,
-0.2178955078125,
0.69189453125,
0.43603515625,
0.732421875,
0.483642578125,
-0.67236328125,
-0.677734375,
-1.037109375,
0.58349609375,
0.505859375,
0.83544921875,
-0.67431640625,
0.63525390625,
0.3720703125,
-0.6259765625,
0.5751953125,
-0.55712890625,
0.000009894371032714844,
1.228515625,
-0.0254058837890625,
1.0048828125,
-0.58740234375,
0.236572265625,
-0.252197265625,
0.1998291015625,
1.044921875,
0.65625,
0.273681640625,
-0.294189453125,
-0.681640625,
-0.1878662109375,
-0.27490234375,
-0.446044921875,
-0.59912109375,
0.2388916015625,
-0.2364501953125,
-0.12432861328125,
-0.87841796875,
0.1204833984375,
0.413818359375,
0.6494140625,
0.01290130615234375,
1.0263671875,
0.271484375,
0.4453125,
0.482177734375,
-0.29296875,
0.20751953125,
-0.54931640625,
1.20703125,
-0.33984375,
-0.1480712890625,
-0.8359375,
-0.1539306640625,
-0.328857421875,
-0.187744140625,
-0.019317626953125,
0.2327880859375,
-0.6552734375,
0.11126708984375,
0.00974273681640625,
0.40771484375,
-0.841796875,
0.1470947265625,
-0.28662109375,
0.474609375,
0.46875,
-0.734375,
0.268798828125,
-0.83447265625,
0.50439453125,
0.2296142578125,
-0.01462554931640625,
-0.65966796875,
-0.422119140625,
-0.95166015625,
-0.77392578125,
-0.0831298828125,
0.60107421875,
-0.134521484375,
0.1519775390625,
-0.53271484375,
0.27294921875,
0.308349609375,
-0.252197265625,
0.06927490234375,
-0.10772705078125,
0.6875,
0.08966064453125,
0.81201171875,
-0.450439453125,
-0.411376953125,
0.30859375,
-1.01953125,
0.58740234375,
-0.4296875,
0.124267578125,
-0.0196533203125,
-0.0400390625,
0.02423095703125,
0.290283203125,
0.0765380859375,
0.2763671875,
-0.2318115234375,
0.465576171875,
-0.6376953125,
-0.62451171875,
0.59765625,
-0.35302734375,
-0.322021484375,
0.90380859375,
-0.53564453125,
0.10870361328125,
0.370361328125,
0.259033203125,
-0.734375,
0.226318359375,
-0.57275390625,
0.6435546875,
-0.1507568359375,
-0.791015625,
0.07330322265625,
-0.57177734375,
0.6435546875,
-0.1416015625,
-0.318603515625,
-0.1846923828125,
-1.484375,
-0.0809326171875,
0.00007224082946777344,
-0.6220703125,
0.41015625,
0.35009765625,
-0.484619140625,
-0.305908203125,
-0.2489013671875,
-0.578125,
-0.2132568359375,
-0.296630859375,
-0.248291015625,
0.09600830078125,
0.4853515625,
1.0361328125,
-0.037322998046875,
-0.2421875,
0.1597900390625,
0.2476806640625,
-0.31103515625,
-0.53271484375,
-0.5654296875,
-0.0401611328125,
-0.388671875,
-0.003765106201171875,
0.56494140625,
-0.07843017578125,
-0.03875732421875,
0.93017578125,
-0.1904296875,
0.29248046875,
0.34619140625,
-0.421142578125,
1.154296875,
0.333984375,
-1.205078125,
-0.62353515625,
0.642578125,
-0.11285400390625,
0.392822265625,
0.2152099609375,
-1.0947265625,
-0.91162109375,
-0.47705078125,
0.09417724609375,
-0.5556640625,
-0.1395263671875,
-0.9873046875,
-0.3623046875,
-0.252685546875,
0.74560546875,
-0.162353515625,
-0.2159423828125,
0.1068115234375,
-1.1650390625,
0.03375244140625,
-0.76416015625,
0.1148681640625,
-0.67822265625,
-0.6728515625,
-0.3359375,
1.0029296875,
0.263427734375,
0.2802734375,
-0.1326904296875,
-0.0980224609375,
0.4765625,
-0.37109375,
-0.3857421875,
-0.487060546875,
0.016815185546875,
0.1348876953125,
0.16796875,
-0.2418212890625,
-0.7578125,
0.91162109375,
-0.6845703125,
0.2425537109375,
-0.44970703125,
-0.50244140625,
-0.07159423828125,
-0.457275390625,
1.029296875,
-0.41943359375,
0.14794921875,
-0.494384765625,
0.3994140625,
0.73876953125,
-0.0155029296875,
-0.6484375,
-0.443359375,
-0.47900390625,
-1.0791015625,
0.5380859375,
-0.40380859375,
0.395263671875,
-0.390380859375,
0.003345489501953125,
1.0341796875,
-0.671875,
0.51220703125,
1.3974609375,
-0.00017714500427246094,
0.6298828125,
-0.525390625,
0.486083984375,
0.3896484375,
-0.54736328125,
-0.1866455078125,
0.111328125,
-0.8779296875,
0.455322265625,
-0.333251953125,
-0.96484375,
-0.77685546875,
0.26904296875,
1.2421875,
-0.385498046875,
0.556640625,
-0.08013916015625,
-1.076171875,
-0.77490234375,
0.84521484375,
0.2177734375,
0.25830078125,
0.83544921875,
-0.52783203125,
-0.169189453125,
-0.2198486328125,
-0.19287109375,
-0.23779296875,
-0.67138671875,
0.87744140625,
-0.151123046875,
-0.59521484375,
0.669921875,
0.9462890625,
-0.70458984375,
-0.88134765625,
0.07049560546875,
-0.01702880859375,
-0.1697998046875,
-0.53125,
0.309814453125,
0.52294921875,
-0.5654296875,
0.11798095703125,
0.4423828125,
-0.41259765625,
0.444091796875,
-0.1749267578125,
0.266845703125,
-0.4365234375,
0.546875,
0.638671875,
-0.288330078125,
-0.01995849609375,
-0.5615234375,
0.1307373046875,
-0.1104736328125,
0.185302734375,
0.71826171875,
-0.37890625,
0.0009832382202148438,
0.169677734375,
-0.295166015625,
0.76171875,
-0.3583984375,
-0.410400390625,
0.261474609375,
-0.552734375,
-0.61376953125,
-0.314697265625,
0.446533203125,
-0.198486328125,
0.09405517578125,
-0.6044921875,
-0.05859375,
0.359130859375,
0.0106201171875,
-0.130126953125,
-0.61572265625,
-0.166748046875,
-0.54052734375,
-0.51953125,
-0.55517578125,
-0.409423828125,
-0.1396484375,
0.3583984375,
0.25634765625,
-0.421142578125,
-0.010406494140625,
0.79541015625,
-0.64013671875,
0.84912109375,
-0.53759765625,
0.3154296875,
-0.5732421875,
-0.69921875,
-0.490966796875,
-0.042083740234375,
-0.9130859375,
0.033935546875,
-0.60693359375,
0.35009765625,
-0.07769775390625,
0.38525390625,
0.0295257568359375,
0.445556640625,
-0.4599609375,
-0.451904296875,
0.413818359375,
-0.36962890625,
-0.291748046875,
0.495849609375,
0.5869140625,
-0.052947998046875,
0.10711669921875,
-0.04351806640625,
-0.37841796875,
-0.6240234375,
0.560546875,
0.63330078125,
-0.0682373046875,
-0.30322265625,
-0.08709716796875,
0.09613037109375,
-1.1513671875,
0.2144775390625,
-0.36669921875,
0.08935546875,
0.111328125,
-0.794921875,
0.498779296875,
1.212890625,
-0.360595703125,
0.4658203125,
0.373046875,
0.146240234375,
0.8935546875,
0.08721923828125,
0.3251953125,
0.478271484375,
0.07733154296875,
-0.401611328125,
-0.06005859375,
0.37890625,
-0.09637451171875,
0.271484375,
-0.1942138671875,
-0.362060546875,
-1.171875,
-0.130859375,
-0.035369873046875,
0.5205078125,
0.315185546875,
-0.25244140625,
0.19189453125,
-0.035186767578125,
-0.480712890625,
-0.1322021484375,
-0.83837890625,
-0.65576171875,
0.51806640625,
-0.044677734375,
-0.2349853515625,
-0.2364501953125,
-0.8662109375,
-0.05792236328125,
0.1029052734375,
0.19140625,
-0.10675048828125,
0.51025390625,
-0.671875,
0.62939453125,
-0.27001953125,
0.09051513671875,
0.08892822265625,
0.576171875,
-0.576171875,
-0.347900390625,
0.4052734375,
1.1337890625,
-0.25146484375,
-0.10394287109375,
-0.48583984375,
0.4736328125,
-0.34521484375,
0.0743408203125,
-0.489013671875,
0.09478759765625,
-0.294189453125,
0.289794921875,
-1.1171875,
0.3095703125,
-0.07623291015625,
0.5126953125,
0.279296875,
-0.46435546875,
-0.476318359375,
0.64697265625,
0.517578125,
-0.0205078125,
0.09381103515625,
0.339599609375,
0.434814453125,
-0.16259765625,
0.18798828125,
-0.391845703125,
0.384033203125,
0.495849609375,
0.544921875,
-0.2039794921875,
0.5029296875,
0.74951171875,
0.26904296875,
-0.131103515625,
0.3056640625,
0.1583251953125,
-0.1622314453125,
-0.01464080810546875,
-0.443603515625,
-0.290771484375,
-0.66552734375,
-0.8037109375,
0.343505859375,
-0.305419921875,
-0.003192901611328125,
-0.21435546875,
-0.70166015625,
0.94677734375,
-0.44287109375,
-0.453857421875,
0.285888671875,
-0.2320556640625,
-0.1961669921875,
0.47509765625,
0.2037353515625,
-0.212646484375,
0.75,
0.6396484375,
0.80615234375,
0.97021484375,
0.4140625,
0.0269317626953125,
-0.7060546875,
0.339111328125,
-0.0640869140625,
0.169189453125,
-0.258056640625,
-0.63623046875,
-0.8408203125,
0.4169921875,
-0.64599609375,
0.00811004638671875,
0.29248046875,
-0.69287109375,
0.210693359375,
-0.403076171875,
0.5537109375,
-0.7763671875,
0.1995849609375,
0.2056884765625,
-0.402099609375,
-0.982421875,
0.28076171875,
-0.195068359375,
0.0789794921875,
0.349365234375,
0.8076171875,
0.385009765625,
1.2841796875,
0.282470703125,
-0.2470703125,
0.140869140625,
0.46044921875,
-0.08465576171875,
-0.751953125,
-0.177734375,
-0.17041015625,
0.1962890625,
-0.264892578125,
-0.366943359375,
0.08544921875,
0.414794921875,
0.051116943359375,
-0.634765625,
-0.41259765625,
0.1220703125,
-0.5634765625,
0.372802734375,
0.1929931640625,
-0.00891876220703125,
-0.40966796875,
-0.09637451171875,
-0.1846923828125,
-0.556640625,
0.2359619140625,
-0.61376953125,
0.1163330078125,
-0.5986328125,
-0.54541015625,
-0.5595703125,
-0.62060546875,
-0.031768798828125,
-0.3349609375,
-0.72265625,
-1.015625,
0.50732421875,
0.42236328125,
0.5869140625,
0.6123046875,
-0.08306884765625,
0.1334228515625,
1.318359375,
0.6875,
0.306640625,
1.06640625,
0.329833984375,
-0.017425537109375,
0.4306640625,
-0.318359375,
0.5888671875,
-0.09014892578125,
-0.11163330078125,
-0.4541015625,
0.339599609375,
-0.426025390625,
-1.1318359375,
0.143798828125,
0.810546875,
0.494384765625,
-0.8759765625,
-1.080078125,
-0.003238677978515625,
-1.0068359375,
-0.218017578125,
-0.339599609375,
0.52294921875,
-0.088134765625,
0.182373046875,
-0.349365234375,
-1.25,
4.5,
0.9541015625,
0.8974609375,
0.1246337890625,
0.15380859375,
1.0380859375,
0.53466796875,
-0.408203125,
-0.398193359375,
-0.7763671875,
0.42822265625,
-0.85888671875,
-0.025146484375,
0.95068359375,
0.09130859375,
0.417724609375,
-0.83203125,
0.1829833984375,
-0.46923828125,
-0.86376953125,
-0.87548828125,
0.29443359375,
0.08056640625,
0.501953125,
0.129638671875,
0.4013671875,
0.42724609375,
-0.36474609375,
-0.13232421875,
-0.64404296875,
-0.047210693359375,
-0.40966796875,
0.92431640625,
-0.3251953125,
-0.515625,
0.77587890625,
-0.31103515625,
-0.4755859375,
-0.29638671875,
0.1256103515625,
-0.345703125,
-0.01250457763671875,
0.43505859375,
-0.64404296875,
0.0693359375,
0.53759765625,
-0.62939453125,
0.485107421875,
0.3203125,
-0.94091796875,
0.80224609375,
-0.28466796875,
0.339111328125,
-0.96826171875,
-0.82421875,
0.145263671875,
-0.05670166015625,
-0.305419921875,
-0.202392578125,
0.56298828125,
0.58447265625,
0.249755859375,
0.2095947265625,
0.434814453125,
-0.28564453125,
1.12109375,
-0.0209197998046875,
0.478759765625,
-0.352783203125,
0.12451171875,
-0.2366943359375,
-0.06591796875,
-0.1026611328125,
-0.11175537109375,
0.55126953125,
0.455078125,
0.0946044921875,
0.366943359375,
0.95751953125,
-0.77685546875,
0.04412841796875,
-0.2352294921875,
-0.347900390625,
-0.48583984375,
0.3125,
1.3720703125,
-0.4111328125,
-0.42529296875,
-0.331298828125,
0.59619140625,
0.20947265625,
0.6298828125,
0.0589599609375,
-0.8095703125,
-0.3955078125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Tags: brute force, implementation
Correct Solution:
```
def main():
n = int(input())
a = [input() for i in range(n)]
result = 0
for i in range(26):
for j in range(i + 1, 26):
t = 0
ci = chr(i + ord('a'))
cj = chr(j + ord('a'))
for s in a:
if s.count(ci) + s.count(cj) == len(s):
t += len(s)
result = max(result, t)
print(result)
main()
```
| 65,208
|
[
0.08001708984375,
0.1429443359375,
0.337158203125,
0.67041015625,
-0.71484375,
-0.29443359375,
0.27587890625,
-0.15771484375,
0.22119140625,
0.70654296875,
0.75537109375,
-0.00835418701171875,
-0.1666259765625,
-0.3251953125,
-0.62646484375,
0.078857421875,
-0.59912109375,
-0.6982421875,
-0.69384765625,
0.04290771484375,
0.15869140625,
-0.271240234375,
-1.541015625,
0.0027313232421875,
-0.6669921875,
1.0380859375,
0.1678466796875,
-0.003559112548828125,
1.2744140625,
1.2978515625,
-0.1668701171875,
-0.436279296875,
0.1494140625,
-0.67431640625,
-0.55419921875,
-0.056243896484375,
0.65576171875,
-0.99462890625,
-0.2734375,
-0.23876953125,
0.184326171875,
-0.5888671875,
0.490966796875,
-0.546875,
-1.0068359375,
-0.026947021484375,
-0.2325439453125,
-0.315673828125,
-0.1829833984375,
-0.5966796875,
0.322998046875,
-0.29443359375,
0.56787109375,
-0.05181884765625,
-0.0870361328125,
-0.1453857421875,
-0.20654296875,
-0.11126708984375,
-0.281494140625,
0.26953125,
0.2890625,
0.2890625,
0.02276611328125,
-0.69775390625,
-0.1910400390625,
0.1142578125,
0.03900146484375,
0.07989501953125,
0.2042236328125,
-0.31591796875,
0.1187744140625,
0.06964111328125,
-0.3857421875,
-0.26513671875,
-0.377197265625,
0.0255126953125,
0.30615234375,
-0.453857421875,
-0.75439453125,
1.021484375,
0.0017843246459960938,
0.5302734375,
0.0771484375,
-0.1505126953125,
-0.419189453125,
-0.314453125,
0.2587890625,
0.461181640625,
0.50439453125,
-0.315185546875,
-0.3154296875,
0.389404296875,
-0.60693359375,
0.05828857421875,
0.65625,
0.433837890625,
-0.34716796875,
0.210205078125,
0.25244140625,
0.14013671875,
0.83203125,
1.0341796875,
-0.163330078125,
1.2548828125,
-0.50634765625,
0.1629638671875,
0.411376953125,
-0.068603515625,
-0.326904296875,
-0.092041015625,
-0.08831787109375,
-0.35595703125,
0.49560546875,
0.0943603515625,
-0.37548828125,
0.82177734375,
-0.045501708984375,
0.6142578125,
-0.82958984375,
0.360107421875,
0.54150390625,
0.1915283203125,
0.061309814453125,
0.1842041015625,
0.2005615234375,
-0.708984375,
-0.386962890625,
0.84033203125,
-0.51904296875,
-0.0285797119140625,
0.443359375,
0.0047607421875,
-0.273681640625,
0.56103515625,
-0.059173583984375,
0.2978515625,
-0.304931640625,
0.319580078125,
0.7587890625,
-0.548828125,
0.86376953125,
-0.0670166015625,
-0.031768798828125,
1.1123046875,
0.5615234375,
0.365478515625,
0.74365234375,
0.123779296875,
-0.70654296875,
0.5947265625,
-0.94873046875,
0.74169921875,
0.1207275390625,
0.52734375,
-0.63916015625,
0.310546875,
-0.1578369140625,
0.2030029296875,
0.21875,
0.10784912109375,
-0.2252197265625,
0.380859375,
-0.40576171875,
1.0830078125,
-0.36962890625,
1.0498046875,
-0.556640625,
-0.20654296875,
-0.4189453125,
-0.454345703125,
0.17333984375,
-0.386474609375,
-0.174560546875,
0.78857421875,
0.24365234375,
1.30078125,
1.0927734375,
-0.18701171875,
0.34228515625,
0.197509765625,
-0.35205078125,
0.345458984375,
0.198486328125,
0.98681640625,
0.2276611328125,
0.3251953125,
-0.048370361328125,
-0.352783203125,
-0.7109375,
-0.5126953125,
0.260498046875,
0.50146484375,
-0.8671875,
0.0296783447265625,
0.164306640625,
0.2359619140625,
-1.1162109375,
0.07135009765625,
0.2281494140625,
-0.7744140625,
-0.40478515625,
0.40576171875,
-0.17919921875,
0.51123046875,
-0.421142578125,
-0.2244873046875,
0.53662109375,
1.283203125,
-0.44775390625,
-0.0169525146484375,
0.60791015625,
0.27783203125,
-0.040802001953125,
0.101318359375,
0.1513671875,
-0.271484375,
-0.99365234375,
0.572265625,
-0.2509765625,
-0.2054443359375,
0.271240234375,
0.2176513671875,
0.43115234375,
0.191650390625,
-0.425537109375,
-0.0977783203125,
0.85107421875,
1.2255859375,
-0.101318359375,
0.71142578125,
0.030426025390625,
0.8935546875,
0.308349609375,
0.56884765625,
0.415283203125,
-0.0731201171875,
0.4833984375,
0.68994140625,
0.1651611328125,
0.5263671875,
0.2042236328125,
0.277099609375,
0.376708984375,
0.7978515625,
0.273681640625,
0.4951171875,
-0.09912109375,
-0.151123046875,
-0.37451171875,
0.58740234375,
-0.287841796875,
0.343017578125,
0.0650634765625,
0.301513671875,
-0.64404296875,
-0.352294921875,
0.419189453125,
0.76171875,
-0.73828125,
-0.473876953125,
-0.3701171875,
0.4775390625,
0.054290771484375,
0.1007080078125,
0.262451171875,
0.2442626953125,
0.2255859375,
0.206298828125,
-0.0943603515625,
0.07794189453125,
-1.0791015625,
-0.52880859375,
-0.96533203125,
-0.40771484375,
-0.55078125,
-0.35205078125,
0.226806640625,
-0.86279296875,
0.428955078125,
-0.11004638671875,
-0.338623046875,
0.0165557861328125,
-0.73193359375,
0.3251953125,
-0.460693359375,
0.76025390625,
-0.8330078125,
0.4716796875,
0.1529541015625,
1.076171875,
-0.09124755859375,
-0.33251953125,
-0.259521484375,
-0.5869140625,
0.302734375,
-0.1329345703125,
0.409423828125,
0.023956298828125,
-0.94384765625,
-0.9052734375,
-0.0865478515625,
-0.402099609375,
-0.266357421875,
0.303466796875,
-0.5234375,
0.75927734375,
0.181884765625,
-0.485107421875,
0.71728515625,
0.591796875,
-0.97607421875,
0.1741943359375,
0.11810302734375,
-0.09716796875,
-0.96484375,
1.203125,
0.58447265625,
0.5595703125,
-0.541015625,
-0.3056640625,
-0.359619140625,
0.00234222412109375,
0.3056640625,
-0.63232421875,
-0.380859375,
0.411376953125,
0.060882568359375,
-1.3134765625,
0.302001953125,
-1.0380859375,
-0.79248046875,
-0.564453125,
-0.5439453125,
0.92919921875,
0.80712890625,
-0.044830322265625,
-0.259765625,
-0.60693359375,
-0.298583984375,
0.61767578125,
0.375,
-0.7880859375,
-0.289306640625,
0.81689453125,
-0.1275634765625,
-0.144287109375,
0.1768798828125,
-0.615234375,
-0.358642578125,
0.02435302734375,
0.51953125,
0.69091796875,
0.259765625,
0.25634765625,
0.318115234375,
0.5126953125,
-0.7744140625,
-0.3359375,
-0.215576171875,
0.744140625,
0.362548828125,
0.73681640625,
0.43896484375,
-0.7001953125,
-0.7158203125,
-0.962890625,
0.583984375,
0.453857421875,
0.8466796875,
-0.6640625,
0.69189453125,
0.357666015625,
-0.59130859375,
0.5205078125,
-0.57470703125,
0.085205078125,
1.2080078125,
0.06549072265625,
0.99755859375,
-0.626953125,
0.2266845703125,
-0.290771484375,
0.1683349609375,
1.1044921875,
0.5439453125,
0.1878662109375,
-0.2017822265625,
-0.7958984375,
-0.196044921875,
-0.219482421875,
-0.367919921875,
-0.63037109375,
0.1422119140625,
-0.2078857421875,
-0.06005859375,
-0.83740234375,
0.1766357421875,
0.375244140625,
0.55712890625,
-0.0004405975341796875,
1.125,
0.281982421875,
0.50927734375,
0.52001953125,
-0.3447265625,
0.27734375,
-0.477294921875,
1.251953125,
-0.2481689453125,
-0.115478515625,
-0.8544921875,
-0.186767578125,
-0.263427734375,
-0.16015625,
0.029449462890625,
0.18994140625,
-0.673828125,
0.015655517578125,
0.03729248046875,
0.339111328125,
-0.7841796875,
0.151123046875,
-0.17333984375,
0.496337890625,
0.4462890625,
-0.7158203125,
0.2421875,
-0.89501953125,
0.58544921875,
0.30078125,
-0.057342529296875,
-0.76318359375,
-0.426513671875,
-0.86474609375,
-0.810546875,
-0.12347412109375,
0.65771484375,
-0.217529296875,
0.103515625,
-0.54931640625,
0.237548828125,
0.29052734375,
-0.235595703125,
0.1026611328125,
-0.11279296875,
0.6923828125,
0.1358642578125,
0.89599609375,
-0.491455078125,
-0.376953125,
0.34130859375,
-0.982421875,
0.56689453125,
-0.43798828125,
0.1605224609375,
-0.044921875,
-0.1044921875,
-0.05987548828125,
0.26123046875,
0.07122802734375,
0.3046875,
-0.2138671875,
0.483154296875,
-0.6025390625,
-0.57763671875,
0.642578125,
-0.332763671875,
-0.290283203125,
0.84814453125,
-0.50341796875,
0.044464111328125,
0.4296875,
0.26513671875,
-0.748046875,
0.1549072265625,
-0.60986328125,
0.62744140625,
-0.1644287109375,
-0.7861328125,
0.11651611328125,
-0.6533203125,
0.52587890625,
-0.1077880859375,
-0.38916015625,
-0.261474609375,
-1.5029296875,
-0.11614990234375,
-0.035797119140625,
-0.64892578125,
0.402587890625,
0.37109375,
-0.389404296875,
-0.346435546875,
-0.274169921875,
-0.55322265625,
-0.248046875,
-0.1781005859375,
-0.2274169921875,
0.06329345703125,
0.456298828125,
1.072265625,
-0.054534912109375,
-0.21435546875,
0.2080078125,
0.212158203125,
-0.340576171875,
-0.49072265625,
-0.55322265625,
-0.048675537109375,
-0.4248046875,
0.05450439453125,
0.529296875,
-0.1253662109375,
-0.08331298828125,
0.87646484375,
-0.2607421875,
0.161865234375,
0.38525390625,
-0.34375,
1.1171875,
0.227783203125,
-1.203125,
-0.51220703125,
0.7314453125,
-0.1622314453125,
0.402587890625,
0.196533203125,
-1.1796875,
-0.8564453125,
-0.5048828125,
0.08074951171875,
-0.5498046875,
-0.11761474609375,
-0.98095703125,
-0.441162109375,
-0.256103515625,
0.71337890625,
-0.190673828125,
-0.30712890625,
0.09716796875,
-1.1162109375,
0.0806884765625,
-0.71240234375,
0.1356201171875,
-0.68798828125,
-0.69287109375,
-0.3515625,
0.9931640625,
0.274658203125,
0.275390625,
-0.150634765625,
-0.1490478515625,
0.5517578125,
-0.3466796875,
-0.38232421875,
-0.51806640625,
0.06719970703125,
0.16162109375,
0.108642578125,
-0.25048828125,
-0.6552734375,
0.9384765625,
-0.71337890625,
0.2476806640625,
-0.4619140625,
-0.5322265625,
-0.0298614501953125,
-0.452392578125,
1.0087890625,
-0.417724609375,
0.1397705078125,
-0.51416015625,
0.363037109375,
0.69189453125,
-0.091552734375,
-0.74365234375,
-0.459716796875,
-0.51318359375,
-1.0390625,
0.56640625,
-0.412841796875,
0.362060546875,
-0.415283203125,
0.054595947265625,
1.1162109375,
-0.65087890625,
0.47802734375,
1.4365234375,
0.01250457763671875,
0.6650390625,
-0.50830078125,
0.409423828125,
0.439697265625,
-0.5166015625,
-0.1715087890625,
0.130859375,
-0.81298828125,
0.5830078125,
-0.28515625,
-0.89306640625,
-0.81103515625,
0.28515625,
1.2412109375,
-0.314208984375,
0.59033203125,
0.006908416748046875,
-1.083984375,
-0.74658203125,
0.87060546875,
0.275634765625,
0.2320556640625,
0.8701171875,
-0.439697265625,
-0.1239013671875,
-0.2802734375,
-0.145751953125,
-0.2091064453125,
-0.71728515625,
0.87451171875,
-0.1329345703125,
-0.61328125,
0.6796875,
1.0068359375,
-0.7138671875,
-0.88818359375,
0.060638427734375,
-0.0119781494140625,
-0.1348876953125,
-0.51318359375,
0.2073974609375,
0.5732421875,
-0.599609375,
0.1102294921875,
0.49560546875,
-0.52490234375,
0.39794921875,
-0.10986328125,
0.309326171875,
-0.389404296875,
0.6416015625,
0.59814453125,
-0.40185546875,
0.038299560546875,
-0.64208984375,
-0.008636474609375,
-0.11712646484375,
0.120361328125,
0.7412109375,
-0.414306640625,
-0.01702880859375,
0.1588134765625,
-0.321533203125,
0.734375,
-0.361572265625,
-0.408447265625,
0.3095703125,
-0.53466796875,
-0.533203125,
-0.310302734375,
0.452880859375,
-0.0989990234375,
0.0977783203125,
-0.611328125,
-0.019683837890625,
0.4306640625,
0.08807373046875,
-0.09088134765625,
-0.68798828125,
-0.28662109375,
-0.52978515625,
-0.5595703125,
-0.57568359375,
-0.365966796875,
-0.1641845703125,
0.2861328125,
0.16064453125,
-0.43359375,
-0.0294189453125,
0.7685546875,
-0.658203125,
0.82958984375,
-0.556640625,
0.363037109375,
-0.66162109375,
-0.7626953125,
-0.50830078125,
-0.0977783203125,
-0.93798828125,
0.0579833984375,
-0.6630859375,
0.37744140625,
0.01244354248046875,
0.413330078125,
0.07061767578125,
0.3447265625,
-0.44384765625,
-0.541015625,
0.404541015625,
-0.328857421875,
-0.306640625,
0.55517578125,
0.5869140625,
-0.1483154296875,
0.1102294921875,
-0.10638427734375,
-0.35791015625,
-0.67578125,
0.5654296875,
0.5830078125,
-0.0297393798828125,
-0.338623046875,
0.0095062255859375,
0.101806640625,
-1.1123046875,
0.22607421875,
-0.3017578125,
0.2113037109375,
0.11309814453125,
-0.78662109375,
0.52392578125,
1.1826171875,
-0.31396484375,
0.3896484375,
0.407470703125,
0.158935546875,
0.8671875,
0.06463623046875,
0.31591796875,
0.448486328125,
0.099365234375,
-0.48828125,
-0.04974365234375,
0.50634765625,
-0.18896484375,
0.26318359375,
-0.10601806640625,
-0.401611328125,
-1.0908203125,
-0.1209716796875,
-0.047943115234375,
0.49609375,
0.28076171875,
-0.25048828125,
0.212158203125,
-0.0924072265625,
-0.38916015625,
-0.1353759765625,
-0.865234375,
-0.58154296875,
0.587890625,
-0.063720703125,
-0.2060546875,
-0.1876220703125,
-0.87255859375,
-0.1436767578125,
0.156982421875,
0.2100830078125,
-0.0689697265625,
0.50537109375,
-0.7822265625,
0.61962890625,
-0.344482421875,
0.06414794921875,
0.136962890625,
0.6181640625,
-0.57373046875,
-0.381591796875,
0.4453125,
1.1494140625,
-0.2393798828125,
-0.060577392578125,
-0.467041015625,
0.43798828125,
-0.343994140625,
0.05926513671875,
-0.384765625,
0.19580078125,
-0.327880859375,
0.25927734375,
-1.0888671875,
0.265380859375,
-0.10357666015625,
0.541015625,
0.330810546875,
-0.4736328125,
-0.46826171875,
0.6103515625,
0.546875,
-0.0186614990234375,
0.07708740234375,
0.34716796875,
0.448486328125,
-0.236572265625,
0.1512451171875,
-0.40869140625,
0.413818359375,
0.4287109375,
0.45947265625,
-0.167236328125,
0.50048828125,
0.70361328125,
0.27880859375,
-0.2042236328125,
0.3642578125,
0.09136962890625,
-0.1533203125,
-0.0330810546875,
-0.430419921875,
-0.2452392578125,
-0.66455078125,
-0.78662109375,
0.35107421875,
-0.320068359375,
-0.01042938232421875,
-0.177734375,
-0.6904296875,
1.0078125,
-0.402099609375,
-0.458251953125,
0.300537109375,
-0.189208984375,
-0.2037353515625,
0.470703125,
0.1866455078125,
-0.280517578125,
0.734375,
0.56591796875,
0.841796875,
1.0771484375,
0.477783203125,
0.0096282958984375,
-0.630859375,
0.25390625,
-0.0814208984375,
0.2119140625,
-0.327880859375,
-0.72509765625,
-0.875,
0.365966796875,
-0.5615234375,
-0.045562744140625,
0.32177734375,
-0.625,
0.1768798828125,
-0.392822265625,
0.53564453125,
-0.76513671875,
0.2783203125,
0.307861328125,
-0.40673828125,
-1.048828125,
0.33251953125,
-0.1885986328125,
0.1358642578125,
0.43603515625,
0.873046875,
0.396484375,
1.248046875,
0.3583984375,
-0.20947265625,
0.022735595703125,
0.449951171875,
-0.08282470703125,
-0.8349609375,
-0.1529541015625,
-0.24658203125,
0.2578125,
-0.1937255859375,
-0.30126953125,
0.045501708984375,
0.36181640625,
0.01406097412109375,
-0.6005859375,
-0.409423828125,
0.177978515625,
-0.48681640625,
0.310546875,
0.214599609375,
-0.021026611328125,
-0.403076171875,
-0.04144287109375,
-0.276123046875,
-0.5029296875,
0.22216796875,
-0.6416015625,
0.1346435546875,
-0.56298828125,
-0.521484375,
-0.498046875,
-0.623046875,
-0.005496978759765625,
-0.223876953125,
-0.77783203125,
-1.0185546875,
0.5556640625,
0.391845703125,
0.5693359375,
0.50830078125,
-0.034088134765625,
0.08258056640625,
1.345703125,
0.72265625,
0.358642578125,
1.0546875,
0.2802734375,
-0.060821533203125,
0.330078125,
-0.371337890625,
0.59521484375,
-0.07684326171875,
-0.09033203125,
-0.48388671875,
0.412109375,
-0.4716796875,
-1.125,
0.13134765625,
0.79345703125,
0.5517578125,
-0.88330078125,
-1.111328125,
0.01137542724609375,
-1.0517578125,
-0.181640625,
-0.31640625,
0.4619140625,
-0.045379638671875,
0.1759033203125,
-0.52587890625,
-1.265625,
4.48828125,
0.97509765625,
0.83056640625,
0.1331787109375,
0.197021484375,
0.9697265625,
0.541015625,
-0.40869140625,
-0.37109375,
-0.66552734375,
0.427734375,
-0.701171875,
-0.132080078125,
0.9423828125,
0.11285400390625,
0.405029296875,
-0.82373046875,
0.161865234375,
-0.47021484375,
-0.87744140625,
-0.8662109375,
0.299072265625,
0.060150146484375,
0.51708984375,
0.004955291748046875,
0.34912109375,
0.447998046875,
-0.345458984375,
-0.14599609375,
-0.64111328125,
-0.027618408203125,
-0.441162109375,
0.88134765625,
-0.270751953125,
-0.52978515625,
0.70556640625,
-0.3388671875,
-0.421630859375,
-0.361572265625,
0.09490966796875,
-0.3115234375,
-0.034088134765625,
0.459228515625,
-0.59765625,
0.104736328125,
0.51708984375,
-0.603515625,
0.5107421875,
0.371337890625,
-0.86865234375,
0.853515625,
-0.326171875,
0.40087890625,
-0.97119140625,
-0.83740234375,
0.14111328125,
-0.09173583984375,
-0.35498046875,
-0.2242431640625,
0.57470703125,
0.55615234375,
0.1806640625,
0.311279296875,
0.521484375,
-0.393798828125,
1.0703125,
-0.11029052734375,
0.47509765625,
-0.35302734375,
0.19677734375,
-0.189697265625,
-0.0196990966796875,
-0.076171875,
-0.09381103515625,
0.5185546875,
0.50146484375,
0.043670654296875,
0.40869140625,
0.9443359375,
-0.81201171875,
0.024871826171875,
-0.2041015625,
-0.2666015625,
-0.404052734375,
0.318359375,
1.3408203125,
-0.49609375,
-0.371337890625,
-0.408447265625,
0.6142578125,
0.1719970703125,
0.66162109375,
0.00847625732421875,
-0.8427734375,
-0.39111328125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Tags: brute force, implementation
Correct Solution:
```
import string
n = int(input())
a = []
for i in range(n):
a.append(input())
ans = 0
small = string.ascii_lowercase
for i in small:
for j in small:
tmp = 0
for s in a:
cnt = 0
for c in s:
if c == i or c == j:
cnt += 1
if cnt == len(s):
tmp += len(s)
ans = max(ans, tmp)
print(ans)
```
| 65,209
|
[
0.0391845703125,
0.1175537109375,
0.346923828125,
0.65234375,
-0.720703125,
-0.3466796875,
0.291748046875,
-0.1868896484375,
0.2147216796875,
0.68896484375,
0.7412109375,
-0.0247802734375,
-0.1817626953125,
-0.37890625,
-0.6181640625,
0.0894775390625,
-0.63671875,
-0.71142578125,
-0.68701171875,
0.041046142578125,
0.154541015625,
-0.300048828125,
-1.5615234375,
0.0440673828125,
-0.630859375,
1.0458984375,
0.160400390625,
-0.01055145263671875,
1.306640625,
1.2705078125,
-0.2139892578125,
-0.46533203125,
0.1805419921875,
-0.66064453125,
-0.59375,
-0.089599609375,
0.65087890625,
-1.0078125,
-0.2548828125,
-0.184814453125,
0.145263671875,
-0.6064453125,
0.5205078125,
-0.56298828125,
-1.04296875,
-0.054779052734375,
-0.223876953125,
-0.2978515625,
-0.166015625,
-0.6162109375,
0.309326171875,
-0.267333984375,
0.57275390625,
-0.0594482421875,
-0.0799560546875,
-0.12066650390625,
-0.201416015625,
-0.09161376953125,
-0.25634765625,
0.2496337890625,
0.25439453125,
0.284423828125,
0.060150146484375,
-0.71240234375,
-0.198974609375,
0.1175537109375,
0.0188751220703125,
0.08026123046875,
0.2080078125,
-0.307861328125,
0.0821533203125,
0.06451416015625,
-0.33935546875,
-0.29052734375,
-0.3349609375,
0.01387786865234375,
0.333740234375,
-0.430908203125,
-0.716796875,
1.0419921875,
-0.04241943359375,
0.54638671875,
0.1099853515625,
-0.1641845703125,
-0.44189453125,
-0.316162109375,
0.251953125,
0.442626953125,
0.48876953125,
-0.28662109375,
-0.33251953125,
0.402587890625,
-0.60107421875,
0.05413818359375,
0.671875,
0.403076171875,
-0.342529296875,
0.2005615234375,
0.24267578125,
0.1729736328125,
0.80712890625,
1.0390625,
-0.1314697265625,
1.2373046875,
-0.475830078125,
0.185302734375,
0.414794921875,
-0.09002685546875,
-0.342041015625,
-0.0850830078125,
-0.0863037109375,
-0.3515625,
0.50927734375,
0.07196044921875,
-0.3896484375,
0.82666015625,
-0.0546875,
0.607421875,
-0.8056640625,
0.358642578125,
0.52978515625,
0.1219482421875,
0.07598876953125,
0.15234375,
0.186279296875,
-0.6787109375,
-0.41357421875,
0.85595703125,
-0.4970703125,
-0.06195068359375,
0.4287109375,
0.0197601318359375,
-0.25341796875,
0.56005859375,
-0.032440185546875,
0.319091796875,
-0.322509765625,
0.302001953125,
0.70068359375,
-0.56103515625,
0.85791015625,
-0.03839111328125,
-0.033050537109375,
1.1630859375,
0.55908203125,
0.396240234375,
0.7236328125,
0.11907958984375,
-0.6611328125,
0.6103515625,
-0.974609375,
0.73486328125,
0.1533203125,
0.5009765625,
-0.65234375,
0.342529296875,
-0.1800537109375,
0.1868896484375,
0.266357421875,
0.1214599609375,
-0.1986083984375,
0.368896484375,
-0.4228515625,
1.0244140625,
-0.384521484375,
0.998046875,
-0.5693359375,
-0.1546630859375,
-0.37744140625,
-0.442626953125,
0.156982421875,
-0.399658203125,
-0.1820068359375,
0.798828125,
0.2344970703125,
1.3115234375,
1.1064453125,
-0.154052734375,
0.356201171875,
0.2127685546875,
-0.337890625,
0.3701171875,
0.1763916015625,
0.94775390625,
0.2099609375,
0.342529296875,
-0.056488037109375,
-0.3203125,
-0.72314453125,
-0.53466796875,
0.26220703125,
0.51171875,
-0.86572265625,
0.046478271484375,
0.12237548828125,
0.20849609375,
-1.1591796875,
0.11529541015625,
0.218994140625,
-0.78173828125,
-0.42431640625,
0.3798828125,
-0.1776123046875,
0.4755859375,
-0.4033203125,
-0.275634765625,
0.541015625,
1.2578125,
-0.396728515625,
0.037567138671875,
0.61474609375,
0.26513671875,
-0.0011777877807617188,
0.12744140625,
0.1728515625,
-0.308349609375,
-1.017578125,
0.56005859375,
-0.2376708984375,
-0.187255859375,
0.306640625,
0.2303466796875,
0.43994140625,
0.201171875,
-0.446044921875,
-0.08184814453125,
0.880859375,
1.22265625,
-0.086669921875,
0.67578125,
0.02008056640625,
0.9072265625,
0.31787109375,
0.5419921875,
0.410888671875,
-0.05859375,
0.5283203125,
0.70654296875,
0.11236572265625,
0.4921875,
0.15576171875,
0.27685546875,
0.37451171875,
0.81005859375,
0.275146484375,
0.445068359375,
-0.0882568359375,
-0.1558837890625,
-0.355712890625,
0.5458984375,
-0.328125,
0.365234375,
0.059295654296875,
0.292236328125,
-0.64404296875,
-0.394775390625,
0.4052734375,
0.7783203125,
-0.77001953125,
-0.5126953125,
-0.3720703125,
0.45263671875,
0.00647735595703125,
0.10699462890625,
0.26416015625,
0.2421875,
0.2261962890625,
0.23681640625,
-0.09326171875,
0.08599853515625,
-1.064453125,
-0.51171875,
-0.93603515625,
-0.3779296875,
-0.57666015625,
-0.36865234375,
0.228515625,
-0.8466796875,
0.427978515625,
-0.1175537109375,
-0.330078125,
-0.04449462890625,
-0.7294921875,
0.296142578125,
-0.47900390625,
0.759765625,
-0.89208984375,
0.49853515625,
0.1402587890625,
1.06640625,
-0.0809326171875,
-0.266845703125,
-0.28759765625,
-0.60546875,
0.305908203125,
-0.1724853515625,
0.43115234375,
0.0181732177734375,
-0.97119140625,
-0.92333984375,
-0.10479736328125,
-0.447021484375,
-0.2890625,
0.31201171875,
-0.51953125,
0.71728515625,
0.1839599609375,
-0.447998046875,
0.76171875,
0.6005859375,
-0.98388671875,
0.1322021484375,
0.169921875,
-0.0802001953125,
-0.98974609375,
1.193359375,
0.55126953125,
0.55029296875,
-0.54296875,
-0.319580078125,
-0.361083984375,
0.053924560546875,
0.271728515625,
-0.6025390625,
-0.381591796875,
0.434814453125,
0.08978271484375,
-1.3359375,
0.300537109375,
-1.0185546875,
-0.80712890625,
-0.5634765625,
-0.52001953125,
0.92626953125,
0.79248046875,
-0.044403076171875,
-0.266357421875,
-0.60791015625,
-0.287109375,
0.6025390625,
0.4052734375,
-0.7783203125,
-0.322265625,
0.80908203125,
-0.15283203125,
-0.1754150390625,
0.137939453125,
-0.60107421875,
-0.36083984375,
-0.004154205322265625,
0.486328125,
0.673828125,
0.265869140625,
0.2139892578125,
0.33740234375,
0.52734375,
-0.78076171875,
-0.38623046875,
-0.227783203125,
0.7275390625,
0.3896484375,
0.71826171875,
0.46337890625,
-0.6767578125,
-0.6611328125,
-0.998046875,
0.6201171875,
0.475830078125,
0.8701171875,
-0.64306640625,
0.65576171875,
0.349853515625,
-0.5673828125,
0.55419921875,
-0.58349609375,
0.0863037109375,
1.20703125,
0.08062744140625,
0.99609375,
-0.619140625,
0.21484375,
-0.292724609375,
0.149658203125,
1.1103515625,
0.58642578125,
0.2169189453125,
-0.2120361328125,
-0.79833984375,
-0.1807861328125,
-0.223876953125,
-0.38525390625,
-0.62109375,
0.177734375,
-0.2110595703125,
-0.036224365234375,
-0.81982421875,
0.141357421875,
0.413330078125,
0.5498046875,
0.018890380859375,
1.0888671875,
0.302001953125,
0.51806640625,
0.529296875,
-0.349853515625,
0.3017578125,
-0.463134765625,
1.255859375,
-0.28369140625,
-0.10150146484375,
-0.8427734375,
-0.1824951171875,
-0.28759765625,
-0.16162109375,
-0.0269012451171875,
0.2103271484375,
-0.64794921875,
0.07342529296875,
0.03485107421875,
0.357177734375,
-0.82177734375,
0.17236328125,
-0.2110595703125,
0.5,
0.460693359375,
-0.6845703125,
0.2607421875,
-0.84912109375,
0.6181640625,
0.2978515625,
-0.046142578125,
-0.7646484375,
-0.380126953125,
-0.92578125,
-0.82763671875,
-0.06884765625,
0.6591796875,
-0.2744140625,
0.09857177734375,
-0.5283203125,
0.2462158203125,
0.283203125,
-0.2396240234375,
0.0841064453125,
-0.11126708984375,
0.662109375,
0.14990234375,
0.8203125,
-0.5029296875,
-0.408935546875,
0.329345703125,
-0.98291015625,
0.53369140625,
-0.417724609375,
0.16455078125,
-0.0005702972412109375,
-0.1351318359375,
-0.03851318359375,
0.2314453125,
0.049285888671875,
0.306396484375,
-0.246826171875,
0.496337890625,
-0.62353515625,
-0.5859375,
0.65234375,
-0.353271484375,
-0.31640625,
0.89453125,
-0.480712890625,
0.06854248046875,
0.422119140625,
0.2476806640625,
-0.73388671875,
0.191162109375,
-0.58203125,
0.60107421875,
-0.189208984375,
-0.78125,
0.08251953125,
-0.62353515625,
0.58251953125,
-0.127197265625,
-0.374267578125,
-0.1983642578125,
-1.5009765625,
-0.1136474609375,
-0.0372314453125,
-0.6083984375,
0.401123046875,
0.36767578125,
-0.379150390625,
-0.298095703125,
-0.281005859375,
-0.54248046875,
-0.247314453125,
-0.1868896484375,
-0.2325439453125,
0.047576904296875,
0.41650390625,
1.0732421875,
-0.047821044921875,
-0.19189453125,
0.1943359375,
0.241943359375,
-0.3603515625,
-0.458984375,
-0.5693359375,
-0.088623046875,
-0.438232421875,
0.055877685546875,
0.56591796875,
-0.0672607421875,
-0.072509765625,
0.9072265625,
-0.187744140625,
0.2164306640625,
0.396240234375,
-0.3828125,
1.083984375,
0.23974609375,
-1.15625,
-0.5478515625,
0.7490234375,
-0.1280517578125,
0.412841796875,
0.176025390625,
-1.14453125,
-0.86328125,
-0.52197265625,
0.167236328125,
-0.49609375,
-0.112548828125,
-1.021484375,
-0.42578125,
-0.2164306640625,
0.71484375,
-0.2073974609375,
-0.304931640625,
0.11572265625,
-1.0908203125,
0.0743408203125,
-0.76220703125,
0.11285400390625,
-0.705078125,
-0.66845703125,
-0.36767578125,
1.001953125,
0.29345703125,
0.302490234375,
-0.16015625,
-0.138916015625,
0.5556640625,
-0.361083984375,
-0.389892578125,
-0.486572265625,
0.068115234375,
0.175537109375,
0.1273193359375,
-0.2235107421875,
-0.6787109375,
0.93505859375,
-0.68505859375,
0.227783203125,
-0.42236328125,
-0.51953125,
-0.03546142578125,
-0.472412109375,
0.9951171875,
-0.43212890625,
0.1265869140625,
-0.50048828125,
0.4228515625,
0.70068359375,
-0.10791015625,
-0.71923828125,
-0.474365234375,
-0.5224609375,
-1.0771484375,
0.5595703125,
-0.395263671875,
0.344482421875,
-0.36865234375,
0.0743408203125,
1.10546875,
-0.69970703125,
0.52587890625,
1.42578125,
-0.004486083984375,
0.66015625,
-0.50146484375,
0.40087890625,
0.44482421875,
-0.51416015625,
-0.17919921875,
0.135986328125,
-0.82080078125,
0.51171875,
-0.322265625,
-0.96630859375,
-0.81982421875,
0.298828125,
1.2626953125,
-0.316162109375,
0.61474609375,
0.02398681640625,
-1.0869140625,
-0.75439453125,
0.89599609375,
0.2000732421875,
0.1885986328125,
0.8935546875,
-0.445556640625,
-0.14990234375,
-0.220458984375,
-0.18359375,
-0.2003173828125,
-0.68701171875,
0.87744140625,
-0.11376953125,
-0.59521484375,
0.68115234375,
1.015625,
-0.7490234375,
-0.9052734375,
0.010894775390625,
-0.0118408203125,
-0.1790771484375,
-0.509765625,
0.248291015625,
0.57568359375,
-0.55712890625,
0.104736328125,
0.45703125,
-0.537109375,
0.436767578125,
-0.08294677734375,
0.282958984375,
-0.417236328125,
0.61474609375,
0.58544921875,
-0.37255859375,
0.0224151611328125,
-0.61669921875,
-0.035858154296875,
-0.13330078125,
0.125244140625,
0.72607421875,
-0.427490234375,
-0.01471710205078125,
0.1617431640625,
-0.308837890625,
0.7421875,
-0.35888671875,
-0.37744140625,
0.304931640625,
-0.541015625,
-0.52099609375,
-0.263671875,
0.445068359375,
-0.127197265625,
0.0986328125,
-0.5966796875,
-0.06573486328125,
0.37841796875,
0.059417724609375,
-0.08453369140625,
-0.64111328125,
-0.2401123046875,
-0.52734375,
-0.51171875,
-0.57373046875,
-0.395263671875,
-0.1473388671875,
0.2607421875,
0.205078125,
-0.450927734375,
-0.033905029296875,
0.79150390625,
-0.607421875,
0.82763671875,
-0.55126953125,
0.364501953125,
-0.68017578125,
-0.75439453125,
-0.485107421875,
-0.0311431884765625,
-0.97998046875,
0.034271240234375,
-0.658203125,
0.32958984375,
-0.05389404296875,
0.39501953125,
0.0293731689453125,
0.376708984375,
-0.447265625,
-0.52001953125,
0.408935546875,
-0.3486328125,
-0.269775390625,
0.58349609375,
0.60546875,
-0.1136474609375,
0.08245849609375,
-0.0830078125,
-0.35791015625,
-0.65576171875,
0.59033203125,
0.58544921875,
-0.06121826171875,
-0.34375,
0.0102996826171875,
0.11810302734375,
-1.111328125,
0.208984375,
-0.288818359375,
0.203857421875,
0.10906982421875,
-0.78564453125,
0.5009765625,
1.1552734375,
-0.368408203125,
0.40625,
0.385498046875,
0.1536865234375,
0.85986328125,
0.1226806640625,
0.305419921875,
0.443115234375,
0.09423828125,
-0.47119140625,
-0.0247955322265625,
0.484130859375,
-0.1651611328125,
0.265625,
-0.1368408203125,
-0.380859375,
-1.134765625,
-0.1260986328125,
-0.054473876953125,
0.460693359375,
0.2939453125,
-0.253662109375,
0.1904296875,
-0.054351806640625,
-0.43017578125,
-0.12445068359375,
-0.83154296875,
-0.64111328125,
0.5927734375,
-0.044677734375,
-0.2099609375,
-0.1834716796875,
-0.857421875,
-0.1312255859375,
0.12152099609375,
0.19287109375,
-0.0684814453125,
0.52978515625,
-0.7421875,
0.62646484375,
-0.324462890625,
0.083251953125,
0.13525390625,
0.6357421875,
-0.57958984375,
-0.388916015625,
0.427001953125,
1.13671875,
-0.2388916015625,
-0.0906982421875,
-0.496337890625,
0.40673828125,
-0.342041015625,
0.0732421875,
-0.3955078125,
0.18212890625,
-0.3134765625,
0.259765625,
-1.119140625,
0.2890625,
-0.1173095703125,
0.50732421875,
0.336181640625,
-0.464599609375,
-0.472900390625,
0.59375,
0.56201171875,
-0.0143280029296875,
0.0347900390625,
0.35888671875,
0.446533203125,
-0.1961669921875,
0.138916015625,
-0.38818359375,
0.356201171875,
0.470947265625,
0.4736328125,
-0.151123046875,
0.53076171875,
0.70166015625,
0.290283203125,
-0.1966552734375,
0.3779296875,
0.126220703125,
-0.1541748046875,
-0.04437255859375,
-0.42236328125,
-0.2386474609375,
-0.6337890625,
-0.78369140625,
0.330322265625,
-0.31640625,
-0.001018524169921875,
-0.1759033203125,
-0.69384765625,
0.9599609375,
-0.385498046875,
-0.4541015625,
0.319091796875,
-0.1678466796875,
-0.18359375,
0.4794921875,
0.1693115234375,
-0.304931640625,
0.7138671875,
0.5908203125,
0.8818359375,
1.056640625,
0.487548828125,
0.00701904296875,
-0.6484375,
0.2498779296875,
-0.06524658203125,
0.1964111328125,
-0.307373046875,
-0.65771484375,
-0.8701171875,
0.41943359375,
-0.56103515625,
-0.02227783203125,
0.293212890625,
-0.6484375,
0.2093505859375,
-0.38818359375,
0.5234375,
-0.740234375,
0.270751953125,
0.34619140625,
-0.42724609375,
-1.0166015625,
0.374267578125,
-0.1927490234375,
0.098388671875,
0.4462890625,
0.86181640625,
0.3857421875,
1.306640625,
0.349609375,
-0.2110595703125,
0.0443115234375,
0.47265625,
-0.093994140625,
-0.80615234375,
-0.16259765625,
-0.2352294921875,
0.26220703125,
-0.21923828125,
-0.326171875,
0.10687255859375,
0.3740234375,
0.046661376953125,
-0.59228515625,
-0.421630859375,
0.12890625,
-0.541015625,
0.35693359375,
0.2047119140625,
-0.017059326171875,
-0.3935546875,
-0.04541015625,
-0.2418212890625,
-0.53125,
0.189208984375,
-0.6015625,
0.1195068359375,
-0.6376953125,
-0.55126953125,
-0.48828125,
-0.6298828125,
-0.0116729736328125,
-0.27685546875,
-0.75,
-1.0341796875,
0.5810546875,
0.39013671875,
0.54296875,
0.52490234375,
-0.0323486328125,
0.0751953125,
1.31640625,
0.693359375,
0.34814453125,
1.04296875,
0.290283203125,
-0.1043701171875,
0.35498046875,
-0.303466796875,
0.5615234375,
-0.07391357421875,
-0.1163330078125,
-0.49853515625,
0.421875,
-0.478271484375,
-1.1416015625,
0.1358642578125,
0.7783203125,
0.56005859375,
-0.8701171875,
-1.095703125,
-0.00418853759765625,
-1.05078125,
-0.1639404296875,
-0.33154296875,
0.458740234375,
-0.07342529296875,
0.1605224609375,
-0.458984375,
-1.2568359375,
4.48828125,
0.9677734375,
0.86328125,
0.116455078125,
0.2054443359375,
0.97119140625,
0.54345703125,
-0.450927734375,
-0.377685546875,
-0.662109375,
0.448486328125,
-0.6669921875,
-0.10638427734375,
0.97314453125,
0.0843505859375,
0.391845703125,
-0.85107421875,
0.166015625,
-0.46484375,
-0.83642578125,
-0.89208984375,
0.331298828125,
0.06573486328125,
0.53857421875,
0.016082763671875,
0.3603515625,
0.411376953125,
-0.321533203125,
-0.2103271484375,
-0.66357421875,
0.005054473876953125,
-0.42041015625,
0.8955078125,
-0.282958984375,
-0.5146484375,
0.69287109375,
-0.327392578125,
-0.4013671875,
-0.30859375,
0.1644287109375,
-0.319580078125,
-0.03155517578125,
0.41552734375,
-0.62451171875,
0.10821533203125,
0.479736328125,
-0.6005859375,
0.52001953125,
0.35302734375,
-0.89306640625,
0.84375,
-0.2841796875,
0.399658203125,
-0.9423828125,
-0.85693359375,
0.1563720703125,
-0.10589599609375,
-0.3505859375,
-0.2432861328125,
0.59716796875,
0.54248046875,
0.1724853515625,
0.287841796875,
0.496826171875,
-0.399658203125,
1.0810546875,
-0.10443115234375,
0.50830078125,
-0.392822265625,
0.1962890625,
-0.2071533203125,
-0.039581298828125,
-0.1044921875,
-0.10125732421875,
0.52490234375,
0.49853515625,
0.054962158203125,
0.373046875,
0.9541015625,
-0.81787109375,
0.03997802734375,
-0.1761474609375,
-0.261474609375,
-0.42919921875,
0.33251953125,
1.369140625,
-0.5107421875,
-0.357421875,
-0.362060546875,
0.6025390625,
0.142333984375,
0.66455078125,
0.0548095703125,
-0.8583984375,
-0.41552734375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Tags: brute force, implementation
Correct Solution:
```
import itertools
n = int(input())
words = [input() for x in range(n)]
letterList = []
for i in words:
for character in i:
if character not in letterList:
letterList.append(character)
maxLength = 0
if len(letterList) == 1:
for word in words:
maxLength += len(word)
print(maxLength)
exit()
allCombinations = itertools.combinations(letterList,2)
for c in allCombinations:
a,b = list(c)[0],list(c)[1]
length = 0
for word in words:
j = 0
for character in word:
j += 1
if character != a and character != b:
break
if j == len(word):
length += len(word)
if length > maxLength:
maxLength = length
print(maxLength)
```
| 65,210
|
[
0.0281219482421875,
0.1319580078125,
0.403076171875,
0.66748046875,
-0.73681640625,
-0.3525390625,
0.270751953125,
-0.18212890625,
0.20849609375,
0.71337890625,
0.7275390625,
-0.006137847900390625,
-0.1392822265625,
-0.34619140625,
-0.66162109375,
0.1622314453125,
-0.60693359375,
-0.6630859375,
-0.64404296875,
0.047760009765625,
0.10614013671875,
-0.212646484375,
-1.5390625,
-0.03643798828125,
-0.67333984375,
1.0712890625,
0.1937255859375,
-0.05810546875,
1.3232421875,
1.2705078125,
-0.1556396484375,
-0.43359375,
0.199951171875,
-0.591796875,
-0.599609375,
-0.051483154296875,
0.666015625,
-0.90087890625,
-0.209228515625,
-0.2451171875,
0.1533203125,
-0.615234375,
0.45751953125,
-0.53125,
-0.978515625,
-0.007114410400390625,
-0.181884765625,
-0.2978515625,
-0.2442626953125,
-0.61376953125,
0.279296875,
-0.31005859375,
0.5908203125,
-0.04522705078125,
-0.12188720703125,
-0.1380615234375,
-0.247802734375,
-0.08740234375,
-0.285888671875,
0.246337890625,
0.2445068359375,
0.259765625,
0.1075439453125,
-0.7001953125,
-0.13916015625,
0.1649169921875,
0.08319091796875,
0.1024169921875,
0.19775390625,
-0.257568359375,
0.062744140625,
0.08978271484375,
-0.373046875,
-0.2958984375,
-0.38720703125,
0.0280914306640625,
0.3681640625,
-0.403076171875,
-0.75146484375,
1.0302734375,
-0.03338623046875,
0.509765625,
0.09490966796875,
-0.1563720703125,
-0.484375,
-0.2822265625,
0.313232421875,
0.4130859375,
0.5556640625,
-0.32080078125,
-0.353271484375,
0.34619140625,
-0.5888671875,
0.058258056640625,
0.6591796875,
0.42578125,
-0.411376953125,
0.21728515625,
0.301025390625,
0.2288818359375,
0.82861328125,
1.0546875,
-0.2213134765625,
1.2216796875,
-0.48291015625,
0.1527099609375,
0.421142578125,
-0.11810302734375,
-0.318603515625,
-0.116943359375,
-0.1685791015625,
-0.326416015625,
0.447509765625,
0.11419677734375,
-0.357421875,
0.86767578125,
-0.1195068359375,
0.5791015625,
-0.8212890625,
0.331298828125,
0.6123046875,
0.144775390625,
-0.0094146728515625,
0.1749267578125,
0.1834716796875,
-0.74267578125,
-0.47900390625,
0.82177734375,
-0.436767578125,
-0.004749298095703125,
0.42041015625,
-0.0028858184814453125,
-0.275146484375,
0.556640625,
-0.0290069580078125,
0.3525390625,
-0.32275390625,
0.34033203125,
0.7109375,
-0.52685546875,
0.8173828125,
-0.07220458984375,
-0.019775390625,
1.158203125,
0.56591796875,
0.374755859375,
0.73583984375,
0.1419677734375,
-0.78466796875,
0.58544921875,
-0.98681640625,
0.77099609375,
0.148681640625,
0.461181640625,
-0.62744140625,
0.284912109375,
-0.15673828125,
0.2509765625,
0.275146484375,
0.08184814453125,
-0.222900390625,
0.369140625,
-0.435791015625,
1,
-0.350830078125,
1.009765625,
-0.55322265625,
-0.1595458984375,
-0.3896484375,
-0.432373046875,
0.08447265625,
-0.408935546875,
-0.1636962890625,
0.75244140625,
0.1954345703125,
1.2548828125,
1.09375,
-0.1826171875,
0.35595703125,
0.2098388671875,
-0.36767578125,
0.34814453125,
0.1820068359375,
0.89599609375,
0.24658203125,
0.346923828125,
0.02471923828125,
-0.314697265625,
-0.72802734375,
-0.5625,
0.267822265625,
0.501953125,
-0.826171875,
0.043792724609375,
0.1866455078125,
0.2454833984375,
-1.2109375,
0.1319580078125,
0.2474365234375,
-0.712890625,
-0.441162109375,
0.396240234375,
-0.2066650390625,
0.5048828125,
-0.376220703125,
-0.28662109375,
0.493896484375,
1.265625,
-0.444091796875,
0.06951904296875,
0.6455078125,
0.319091796875,
0.0282440185546875,
0.1593017578125,
0.05694580078125,
-0.2763671875,
-0.9912109375,
0.5517578125,
-0.273193359375,
-0.1278076171875,
0.3271484375,
0.2279052734375,
0.4033203125,
0.1575927734375,
-0.453125,
-0.111572265625,
0.9013671875,
1.1884765625,
-0.0684814453125,
0.748046875,
-0.03350830078125,
0.91796875,
0.345703125,
0.587890625,
0.3779296875,
-0.03814697265625,
0.451171875,
0.685546875,
0.1397705078125,
0.459228515625,
0.197509765625,
0.2626953125,
0.394775390625,
0.896484375,
0.2705078125,
0.414306640625,
-0.162841796875,
-0.1402587890625,
-0.411376953125,
0.59814453125,
-0.37255859375,
0.383056640625,
0.055511474609375,
0.2008056640625,
-0.599609375,
-0.387939453125,
0.346435546875,
0.84765625,
-0.76171875,
-0.480712890625,
-0.3857421875,
0.50439453125,
0.035064697265625,
0.1585693359375,
0.2327880859375,
0.2373046875,
0.25244140625,
0.1937255859375,
-0.077880859375,
0.06829833984375,
-1.0634765625,
-0.564453125,
-0.9345703125,
-0.3623046875,
-0.56298828125,
-0.302978515625,
0.285400390625,
-0.87255859375,
0.413330078125,
-0.11016845703125,
-0.35205078125,
-0.10333251953125,
-0.703125,
0.266357421875,
-0.455810546875,
0.74169921875,
-0.919921875,
0.46533203125,
0.1278076171875,
1.107421875,
-0.10693359375,
-0.30029296875,
-0.297607421875,
-0.587890625,
0.322509765625,
-0.134033203125,
0.4052734375,
-0.005023956298828125,
-0.9150390625,
-0.88330078125,
-0.052398681640625,
-0.4931640625,
-0.251953125,
0.30224609375,
-0.53759765625,
0.720703125,
0.267822265625,
-0.5888671875,
0.66162109375,
0.59912109375,
-1.0185546875,
0.11407470703125,
0.1572265625,
-0.152099609375,
-0.9794921875,
1.2197265625,
0.5615234375,
0.59130859375,
-0.49365234375,
-0.25634765625,
-0.40185546875,
0.0731201171875,
0.3154296875,
-0.595703125,
-0.37158203125,
0.446044921875,
0.0177154541015625,
-1.380859375,
0.297607421875,
-1.05078125,
-0.70654296875,
-0.55517578125,
-0.5341796875,
0.927734375,
0.74462890625,
0.0210418701171875,
-0.27197265625,
-0.60888671875,
-0.337646484375,
0.6513671875,
0.34716796875,
-0.79833984375,
-0.27490234375,
0.81005859375,
-0.0516357421875,
-0.1842041015625,
0.2119140625,
-0.63623046875,
-0.37353515625,
0.00852203369140625,
0.49658203125,
0.640625,
0.273193359375,
0.2255859375,
0.33642578125,
0.407958984375,
-0.74609375,
-0.3076171875,
-0.25439453125,
0.78125,
0.307861328125,
0.765625,
0.451416015625,
-0.73681640625,
-0.71484375,
-1.064453125,
0.61865234375,
0.44140625,
0.88916015625,
-0.71435546875,
0.70361328125,
0.404052734375,
-0.58349609375,
0.5859375,
-0.537109375,
0.11761474609375,
1.23046875,
0.0015592575073242188,
0.9951171875,
-0.64697265625,
0.131591796875,
-0.32666015625,
0.1953125,
1.158203125,
0.57568359375,
0.287841796875,
-0.171142578125,
-0.74267578125,
-0.146240234375,
-0.1763916015625,
-0.386474609375,
-0.59521484375,
0.1552734375,
-0.194580078125,
-0.06646728515625,
-0.888671875,
0.12286376953125,
0.4833984375,
0.55908203125,
0.00791168212890625,
1.10546875,
0.319580078125,
0.470458984375,
0.55810546875,
-0.295654296875,
0.276123046875,
-0.51904296875,
1.3046875,
-0.2286376953125,
-0.1298828125,
-0.82373046875,
-0.263427734375,
-0.29296875,
-0.10205078125,
0.0184783935546875,
0.2161865234375,
-0.70556640625,
-0.00237274169921875,
0.049285888671875,
0.339111328125,
-0.83837890625,
0.2445068359375,
-0.1966552734375,
0.4599609375,
0.39208984375,
-0.6904296875,
0.256103515625,
-0.9306640625,
0.552734375,
0.26953125,
0.0162506103515625,
-0.8251953125,
-0.4052734375,
-0.865234375,
-0.93212890625,
-0.084716796875,
0.67626953125,
-0.1917724609375,
0.136962890625,
-0.59521484375,
0.271484375,
0.26513671875,
-0.2354736328125,
0.1331787109375,
-0.1337890625,
0.67919921875,
0.1688232421875,
0.78564453125,
-0.50927734375,
-0.39892578125,
0.3369140625,
-0.970703125,
0.548828125,
-0.441650390625,
0.1873779296875,
-0.026947021484375,
-0.1142578125,
-0.048370361328125,
0.28369140625,
-0.0002397298812866211,
0.314208984375,
-0.2303466796875,
0.52294921875,
-0.623046875,
-0.5830078125,
0.66162109375,
-0.372802734375,
-0.3896484375,
0.88818359375,
-0.5439453125,
0.01088714599609375,
0.403076171875,
0.209228515625,
-0.74853515625,
0.152587890625,
-0.6005859375,
0.603515625,
-0.1614990234375,
-0.82470703125,
0.1383056640625,
-0.6533203125,
0.5263671875,
-0.1375732421875,
-0.3486328125,
-0.19384765625,
-1.4580078125,
-0.0955810546875,
-0.057373046875,
-0.71142578125,
0.392822265625,
0.34375,
-0.429931640625,
-0.322021484375,
-0.32373046875,
-0.5654296875,
-0.25048828125,
-0.09893798828125,
-0.243408203125,
0.0361328125,
0.39892578125,
1.0791015625,
-0.0194549560546875,
-0.1929931640625,
0.2078857421875,
0.1763916015625,
-0.292724609375,
-0.5693359375,
-0.60302734375,
-0.053924560546875,
-0.44970703125,
0.0966796875,
0.576171875,
-0.0855712890625,
-0.06964111328125,
0.826171875,
-0.2257080078125,
0.153076171875,
0.488525390625,
-0.319091796875,
1.1591796875,
0.22216796875,
-1.2255859375,
-0.51904296875,
0.7734375,
-0.1988525390625,
0.4111328125,
0.1920166015625,
-1.185546875,
-0.88330078125,
-0.521484375,
0.10015869140625,
-0.51904296875,
-0.0963134765625,
-1.0537109375,
-0.416259765625,
-0.2061767578125,
0.68115234375,
-0.2362060546875,
-0.260498046875,
0.1680908203125,
-1.109375,
0.1259765625,
-0.66015625,
0.06585693359375,
-0.6845703125,
-0.662109375,
-0.380615234375,
1.015625,
0.266357421875,
0.3017578125,
-0.1551513671875,
-0.1610107421875,
0.54345703125,
-0.30908203125,
-0.385986328125,
-0.51708984375,
0.08782958984375,
0.158935546875,
0.11749267578125,
-0.1981201171875,
-0.65478515625,
0.888671875,
-0.7412109375,
0.340576171875,
-0.451416015625,
-0.484619140625,
-0.0762939453125,
-0.42529296875,
0.99169921875,
-0.4306640625,
0.1429443359375,
-0.49267578125,
0.39208984375,
0.68359375,
0.0014591217041015625,
-0.6904296875,
-0.5126953125,
-0.5263671875,
-1.0498046875,
0.53125,
-0.419677734375,
0.39453125,
-0.387451171875,
0.059478759765625,
1.146484375,
-0.66650390625,
0.517578125,
1.3994140625,
-0.0350341796875,
0.66162109375,
-0.45166015625,
0.36083984375,
0.382568359375,
-0.56298828125,
-0.213134765625,
0.14208984375,
-0.87890625,
0.5654296875,
-0.373291015625,
-0.93896484375,
-0.80712890625,
0.280517578125,
1.2802734375,
-0.354736328125,
0.58740234375,
-0.042999267578125,
-1.0849609375,
-0.7470703125,
0.86962890625,
0.2376708984375,
0.126953125,
0.94140625,
-0.54638671875,
-0.16650390625,
-0.26708984375,
-0.2132568359375,
-0.143310546875,
-0.66943359375,
0.88916015625,
-0.1251220703125,
-0.63671875,
0.73486328125,
0.95849609375,
-0.73974609375,
-0.9052734375,
0.032989501953125,
0.021209716796875,
-0.12091064453125,
-0.56884765625,
0.236328125,
0.51220703125,
-0.52978515625,
0.07623291015625,
0.455810546875,
-0.5615234375,
0.420166015625,
-0.1156005859375,
0.271484375,
-0.39453125,
0.59521484375,
0.54736328125,
-0.363525390625,
-0.0025005340576171875,
-0.68359375,
0.006618499755859375,
-0.09771728515625,
0.138427734375,
0.7841796875,
-0.40087890625,
-0.03509521484375,
0.15771484375,
-0.2890625,
0.80810546875,
-0.356201171875,
-0.3642578125,
0.3173828125,
-0.51318359375,
-0.52587890625,
-0.283203125,
0.486572265625,
-0.09063720703125,
0.0556640625,
-0.60595703125,
-0.05059814453125,
0.37646484375,
0.1180419921875,
-0.041259765625,
-0.7578125,
-0.259033203125,
-0.5791015625,
-0.48095703125,
-0.52880859375,
-0.37939453125,
-0.12213134765625,
0.358154296875,
0.19384765625,
-0.47802734375,
0.013946533203125,
0.76220703125,
-0.6767578125,
0.82763671875,
-0.52294921875,
0.378662109375,
-0.62109375,
-0.67919921875,
-0.5576171875,
-0.044525146484375,
-0.947265625,
0.043121337890625,
-0.5673828125,
0.402099609375,
-0.042572021484375,
0.409912109375,
0.04400634765625,
0.3818359375,
-0.368408203125,
-0.53662109375,
0.348876953125,
-0.3564453125,
-0.244140625,
0.60986328125,
0.64892578125,
-0.1346435546875,
0.1500244140625,
-0.053985595703125,
-0.358154296875,
-0.7119140625,
0.5810546875,
0.61962890625,
-0.03436279296875,
-0.351318359375,
0.033721923828125,
0.09490966796875,
-1.1123046875,
0.1568603515625,
-0.274169921875,
0.2607421875,
0.06317138671875,
-0.7626953125,
0.5615234375,
1.197265625,
-0.3837890625,
0.42578125,
0.417724609375,
0.11865234375,
0.8515625,
0.07330322265625,
0.27685546875,
0.451171875,
0.0675048828125,
-0.491943359375,
-0.050567626953125,
0.48291015625,
-0.12841796875,
0.29296875,
-0.1546630859375,
-0.401123046875,
-1.1279296875,
-0.07647705078125,
-0.0631103515625,
0.5107421875,
0.317138671875,
-0.273681640625,
0.2030029296875,
-0.14501953125,
-0.46435546875,
-0.10736083984375,
-0.95361328125,
-0.6337890625,
0.4921875,
-0.03009033203125,
-0.176025390625,
-0.1446533203125,
-0.82861328125,
-0.131591796875,
0.170654296875,
0.1854248046875,
-0.1417236328125,
0.51904296875,
-0.7529296875,
0.5966796875,
-0.34912109375,
0.0509033203125,
0.142333984375,
0.56396484375,
-0.56591796875,
-0.404541015625,
0.380859375,
1.1875,
-0.192626953125,
-0.026031494140625,
-0.38427734375,
0.433349609375,
-0.390625,
0.07843017578125,
-0.4072265625,
0.1751708984375,
-0.302490234375,
0.1932373046875,
-1.119140625,
0.1839599609375,
-0.120849609375,
0.5498046875,
0.347900390625,
-0.446533203125,
-0.447021484375,
0.6103515625,
0.5625,
0.0116729736328125,
0.030120849609375,
0.3447265625,
0.52392578125,
-0.219970703125,
0.1939697265625,
-0.42333984375,
0.353515625,
0.438232421875,
0.5205078125,
-0.1820068359375,
0.52783203125,
0.68310546875,
0.2364501953125,
-0.24951171875,
0.4345703125,
0.076171875,
-0.1708984375,
-0.0267181396484375,
-0.395751953125,
-0.275634765625,
-0.61279296875,
-0.69873046875,
0.397705078125,
-0.343505859375,
0.0296783447265625,
-0.222900390625,
-0.71484375,
0.96923828125,
-0.363525390625,
-0.410400390625,
0.286376953125,
-0.224365234375,
-0.1805419921875,
0.446044921875,
0.1900634765625,
-0.20361328125,
0.63427734375,
0.6025390625,
0.84912109375,
1.0751953125,
0.47705078125,
0.01532745361328125,
-0.7041015625,
0.27392578125,
-0.1168212890625,
0.212646484375,
-0.291015625,
-0.6416015625,
-0.90283203125,
0.372802734375,
-0.63623046875,
-0.0823974609375,
0.2958984375,
-0.64794921875,
0.155517578125,
-0.388427734375,
0.607421875,
-0.71484375,
0.27685546875,
0.44970703125,
-0.334228515625,
-1.0048828125,
0.311767578125,
-0.20654296875,
0.1746826171875,
0.442138671875,
0.83349609375,
0.427978515625,
1.263671875,
0.330078125,
-0.1785888671875,
0.041717529296875,
0.501953125,
-0.06024169921875,
-0.8759765625,
-0.0772705078125,
-0.1925048828125,
0.2496337890625,
-0.26806640625,
-0.239501953125,
0.0222320556640625,
0.3515625,
0.016815185546875,
-0.62744140625,
-0.467041015625,
0.12054443359375,
-0.53125,
0.322265625,
0.261474609375,
-0.04302978515625,
-0.460693359375,
-0.0906982421875,
-0.299072265625,
-0.417236328125,
0.1845703125,
-0.583984375,
0.1234130859375,
-0.595703125,
-0.4794921875,
-0.51513671875,
-0.63427734375,
-0.04461669921875,
-0.2978515625,
-0.78662109375,
-1.0205078125,
0.5390625,
0.3828125,
0.5830078125,
0.5185546875,
-0.0322265625,
0.09820556640625,
1.3408203125,
0.75537109375,
0.2900390625,
1.109375,
0.315673828125,
-0.043609619140625,
0.33056640625,
-0.3359375,
0.59033203125,
-0.08819580078125,
-0.121337890625,
-0.490234375,
0.352294921875,
-0.433349609375,
-1.1611328125,
0.005657196044921875,
0.658203125,
0.515625,
-0.8759765625,
-1.091796875,
-0.0211639404296875,
-1.0517578125,
-0.1629638671875,
-0.36279296875,
0.466552734375,
-0.033905029296875,
0.207275390625,
-0.454345703125,
-1.3408203125,
4.46484375,
0.9248046875,
0.83740234375,
0.0423583984375,
0.1614990234375,
1.107421875,
0.541015625,
-0.37451171875,
-0.40576171875,
-0.642578125,
0.47119140625,
-0.685546875,
-0.0284576416015625,
0.9345703125,
0.166748046875,
0.435791015625,
-0.833984375,
0.1441650390625,
-0.4755859375,
-0.91015625,
-0.865234375,
0.305908203125,
0.07568359375,
0.5009765625,
0.0005335807800292969,
0.3720703125,
0.52783203125,
-0.387451171875,
-0.1890869140625,
-0.669921875,
-0.1329345703125,
-0.474609375,
0.8486328125,
-0.29931640625,
-0.47119140625,
0.81396484375,
-0.302734375,
-0.446533203125,
-0.307861328125,
0.17431640625,
-0.3447265625,
-0.0293121337890625,
0.475830078125,
-0.57421875,
0.1297607421875,
0.45458984375,
-0.50927734375,
0.474365234375,
0.366455078125,
-0.88330078125,
0.810546875,
-0.291748046875,
0.428955078125,
-0.974609375,
-0.83251953125,
0.1719970703125,
-0.09375,
-0.390625,
-0.2117919921875,
0.63916015625,
0.52978515625,
0.2275390625,
0.260498046875,
0.54833984375,
-0.4716796875,
1.0888671875,
-0.08587646484375,
0.4541015625,
-0.36865234375,
0.203369140625,
-0.1632080078125,
-0.03070068359375,
-0.108154296875,
-0.10888671875,
0.50634765625,
0.46240234375,
0.1170654296875,
0.39501953125,
0.96826171875,
-0.73779296875,
0.06976318359375,
-0.1497802734375,
-0.2222900390625,
-0.298828125,
0.264404296875,
1.4404296875,
-0.50390625,
-0.330810546875,
-0.37451171875,
0.6328125,
0.160400390625,
0.68212890625,
0.01751708984375,
-0.80615234375,
-0.39111328125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Tags: brute force, implementation
Correct Solution:
```
words = [input() for _ in range(int(input()))]
alphabet = 'abcdefghijklmnopqrstuvwxyz'
Max = 0
for c in alphabet:
for cc in alphabet:
s = 0
for w in words:
if set([ i for i in w]) <= {c, cc}:
s += len(w)
Max = max(Max, s)
print(Max)
```
| 65,211
|
[
0.10797119140625,
0.1927490234375,
0.382568359375,
0.70654296875,
-0.7265625,
-0.328125,
0.261474609375,
-0.17724609375,
0.2144775390625,
0.6884765625,
0.70654296875,
-0.0141754150390625,
-0.2060546875,
-0.363037109375,
-0.61669921875,
0.1031494140625,
-0.63671875,
-0.658203125,
-0.64697265625,
0.045013427734375,
0.16845703125,
-0.23828125,
-1.5234375,
0.04888916015625,
-0.654296875,
1.05859375,
0.175537109375,
-0.0679931640625,
1.3193359375,
1.3017578125,
-0.2005615234375,
-0.4375,
0.1978759765625,
-0.6689453125,
-0.55419921875,
-0.072265625,
0.7265625,
-0.951171875,
-0.2568359375,
-0.284423828125,
0.1636962890625,
-0.5986328125,
0.4833984375,
-0.5166015625,
-1.0283203125,
-0.06817626953125,
-0.2198486328125,
-0.27978515625,
-0.24609375,
-0.6298828125,
0.299560546875,
-0.29296875,
0.5537109375,
-0.052825927734375,
-0.09326171875,
-0.1639404296875,
-0.1788330078125,
-0.1053466796875,
-0.277587890625,
0.239990234375,
0.26416015625,
0.289306640625,
0.060333251953125,
-0.7470703125,
-0.214599609375,
0.1334228515625,
0.04473876953125,
0.0792236328125,
0.2078857421875,
-0.2802734375,
0.0906982421875,
0.08416748046875,
-0.313232421875,
-0.266845703125,
-0.381591796875,
-0.005809783935546875,
0.29541015625,
-0.4150390625,
-0.7255859375,
1.0712890625,
-0.05078125,
0.51708984375,
0.09002685546875,
-0.18359375,
-0.40771484375,
-0.278564453125,
0.251708984375,
0.419921875,
0.48681640625,
-0.31787109375,
-0.337890625,
0.345703125,
-0.57470703125,
0.043365478515625,
0.669921875,
0.475830078125,
-0.359130859375,
0.2198486328125,
0.2734375,
0.1729736328125,
0.8369140625,
1.0087890625,
-0.1949462890625,
1.26171875,
-0.52392578125,
0.1683349609375,
0.42236328125,
-0.11029052734375,
-0.3037109375,
-0.036651611328125,
-0.1322021484375,
-0.33544921875,
0.505859375,
0.10211181640625,
-0.384033203125,
0.81005859375,
-0.077392578125,
0.57666015625,
-0.82275390625,
0.37158203125,
0.51904296875,
0.171875,
0.03045654296875,
0.197265625,
0.194091796875,
-0.76513671875,
-0.38818359375,
0.79833984375,
-0.53125,
-0.08441162109375,
0.40869140625,
0.0299224853515625,
-0.2919921875,
0.60791015625,
-0.0276031494140625,
0.328369140625,
-0.29541015625,
0.294189453125,
0.720703125,
-0.5419921875,
0.88427734375,
-0.09075927734375,
-0.02252197265625,
1.1318359375,
0.568359375,
0.358154296875,
0.705078125,
0.1541748046875,
-0.70556640625,
0.62158203125,
-0.98388671875,
0.7392578125,
0.142578125,
0.5029296875,
-0.65771484375,
0.3076171875,
-0.1947021484375,
0.2445068359375,
0.2225341796875,
0.1748046875,
-0.2296142578125,
0.359130859375,
-0.45849609375,
1.07421875,
-0.425048828125,
1.01953125,
-0.548828125,
-0.1953125,
-0.4091796875,
-0.4560546875,
0.1429443359375,
-0.4033203125,
-0.1573486328125,
0.75634765625,
0.1683349609375,
1.3017578125,
1.0732421875,
-0.135009765625,
0.371826171875,
0.1920166015625,
-0.315673828125,
0.33740234375,
0.150390625,
0.96484375,
0.2099609375,
0.322021484375,
-0.061279296875,
-0.286376953125,
-0.6689453125,
-0.53564453125,
0.2454833984375,
0.50634765625,
-0.8740234375,
0.0182342529296875,
0.1285400390625,
0.2269287109375,
-1.1982421875,
0.0853271484375,
0.234130859375,
-0.732421875,
-0.45263671875,
0.393310546875,
-0.1297607421875,
0.51513671875,
-0.42724609375,
-0.29736328125,
0.5244140625,
1.306640625,
-0.413330078125,
0.005161285400390625,
0.62744140625,
0.278076171875,
-0.0082244873046875,
0.1539306640625,
0.132080078125,
-0.303466796875,
-1.0556640625,
0.59912109375,
-0.2568359375,
-0.1949462890625,
0.291748046875,
0.237548828125,
0.48583984375,
0.219970703125,
-0.4638671875,
-0.06884765625,
0.91455078125,
1.2021484375,
-0.083984375,
0.71875,
0.0311431884765625,
0.87255859375,
0.28076171875,
0.56005859375,
0.3642578125,
-0.056304931640625,
0.497802734375,
0.7294921875,
0.1170654296875,
0.473876953125,
0.19287109375,
0.30615234375,
0.394775390625,
0.81689453125,
0.270751953125,
0.470703125,
-0.12841796875,
-0.1455078125,
-0.352294921875,
0.544921875,
-0.312744140625,
0.359375,
0.0254669189453125,
0.29443359375,
-0.6201171875,
-0.400146484375,
0.3857421875,
0.7841796875,
-0.78173828125,
-0.49609375,
-0.347412109375,
0.42578125,
0.053741455078125,
0.15576171875,
0.25927734375,
0.2476806640625,
0.225341796875,
0.1810302734375,
-0.06781005859375,
0.0931396484375,
-1.04296875,
-0.5498046875,
-0.93505859375,
-0.354736328125,
-0.53955078125,
-0.326904296875,
0.2083740234375,
-0.90380859375,
0.39599609375,
-0.10455322265625,
-0.30859375,
-0.026519775390625,
-0.69140625,
0.287353515625,
-0.48974609375,
0.74560546875,
-0.87646484375,
0.46435546875,
0.1466064453125,
1.1064453125,
-0.1278076171875,
-0.320068359375,
-0.27783203125,
-0.619140625,
0.2939453125,
-0.1778564453125,
0.40087890625,
0.0850830078125,
-0.91650390625,
-0.94384765625,
-0.09246826171875,
-0.401123046875,
-0.29443359375,
0.327392578125,
-0.509765625,
0.779296875,
0.1756591796875,
-0.489013671875,
0.7451171875,
0.57177734375,
-0.98779296875,
0.1927490234375,
0.1580810546875,
-0.06878662109375,
-0.96533203125,
1.2578125,
0.5625,
0.5947265625,
-0.55810546875,
-0.319580078125,
-0.361083984375,
0.034515380859375,
0.2958984375,
-0.6494140625,
-0.342041015625,
0.406494140625,
0.05316162109375,
-1.35546875,
0.30126953125,
-1.029296875,
-0.8447265625,
-0.57470703125,
-0.54931640625,
0.94140625,
0.74853515625,
-0.01812744140625,
-0.265380859375,
-0.63330078125,
-0.277099609375,
0.59033203125,
0.394775390625,
-0.7822265625,
-0.263671875,
0.8232421875,
-0.158935546875,
-0.12152099609375,
0.1531982421875,
-0.58642578125,
-0.3984375,
0.0176544189453125,
0.496826171875,
0.70751953125,
0.26513671875,
0.242431640625,
0.306640625,
0.5029296875,
-0.80712890625,
-0.326904296875,
-0.2435302734375,
0.7607421875,
0.332763671875,
0.68994140625,
0.464599609375,
-0.6708984375,
-0.70166015625,
-0.9833984375,
0.61376953125,
0.50390625,
0.86865234375,
-0.65478515625,
0.67236328125,
0.394287109375,
-0.607421875,
0.5546875,
-0.603515625,
0.154052734375,
1.2265625,
0.023529052734375,
1.01171875,
-0.6318359375,
0.23388671875,
-0.243896484375,
0.1812744140625,
1.1279296875,
0.53662109375,
0.2421875,
-0.16064453125,
-0.75537109375,
-0.1982421875,
-0.1771240234375,
-0.375,
-0.65283203125,
0.167236328125,
-0.2489013671875,
-0.1114501953125,
-0.87060546875,
0.1446533203125,
0.411376953125,
0.544921875,
-0.0280914306640625,
1.12890625,
0.270751953125,
0.48779296875,
0.54296875,
-0.336181640625,
0.327392578125,
-0.497802734375,
1.3251953125,
-0.2330322265625,
-0.1278076171875,
-0.7822265625,
-0.166259765625,
-0.28369140625,
-0.1292724609375,
-0.01201629638671875,
0.2447509765625,
-0.66357421875,
-0.0001499652862548828,
0.043487548828125,
0.35888671875,
-0.84912109375,
0.175048828125,
-0.2025146484375,
0.4990234375,
0.46630859375,
-0.705078125,
0.227294921875,
-0.90478515625,
0.568359375,
0.268310546875,
-0.01021575927734375,
-0.76708984375,
-0.385498046875,
-0.93603515625,
-0.87646484375,
-0.11383056640625,
0.65869140625,
-0.2374267578125,
0.135986328125,
-0.548828125,
0.258544921875,
0.32861328125,
-0.238525390625,
0.1009521484375,
-0.132568359375,
0.65380859375,
0.11767578125,
0.84814453125,
-0.5068359375,
-0.423828125,
0.34814453125,
-0.984375,
0.5517578125,
-0.408203125,
0.129638671875,
-0.032379150390625,
-0.0977783203125,
-0.0236053466796875,
0.2467041015625,
0.050445556640625,
0.333740234375,
-0.2178955078125,
0.495849609375,
-0.63330078125,
-0.583984375,
0.6484375,
-0.349853515625,
-0.353271484375,
0.8388671875,
-0.487060546875,
0.0802001953125,
0.44580078125,
0.219482421875,
-0.7685546875,
0.182861328125,
-0.5888671875,
0.60107421875,
-0.17578125,
-0.7666015625,
0.1572265625,
-0.62890625,
0.5361328125,
-0.14697265625,
-0.310791015625,
-0.253662109375,
-1.453125,
-0.0821533203125,
-0.055206298828125,
-0.64404296875,
0.422607421875,
0.37109375,
-0.360595703125,
-0.32421875,
-0.28271484375,
-0.52392578125,
-0.227783203125,
-0.20166015625,
-0.257568359375,
0.07196044921875,
0.397705078125,
1.052734375,
-0.031463623046875,
-0.2066650390625,
0.208740234375,
0.190673828125,
-0.3330078125,
-0.469482421875,
-0.5791015625,
-0.049163818359375,
-0.478515625,
0.04913330078125,
0.61376953125,
-0.0858154296875,
-0.10821533203125,
0.8896484375,
-0.2445068359375,
0.2213134765625,
0.39013671875,
-0.35791015625,
1.1123046875,
0.217529296875,
-1.1875,
-0.5166015625,
0.76318359375,
-0.1717529296875,
0.416748046875,
0.1783447265625,
-1.166015625,
-0.88037109375,
-0.47216796875,
0.0860595703125,
-0.5791015625,
-0.119873046875,
-0.99755859375,
-0.477783203125,
-0.2303466796875,
0.77490234375,
-0.2384033203125,
-0.24755859375,
0.1236572265625,
-1.1396484375,
0.074951171875,
-0.76171875,
0.11322021484375,
-0.73681640625,
-0.66552734375,
-0.3369140625,
0.97607421875,
0.27392578125,
0.259033203125,
-0.1190185546875,
-0.12420654296875,
0.52392578125,
-0.35107421875,
-0.38916015625,
-0.44775390625,
0.055023193359375,
0.2021484375,
0.117431640625,
-0.2454833984375,
-0.68359375,
0.95703125,
-0.6943359375,
0.2451171875,
-0.437744140625,
-0.499267578125,
-0.0858154296875,
-0.41748046875,
1.05078125,
-0.4296875,
0.13720703125,
-0.498779296875,
0.3720703125,
0.6689453125,
-0.043304443359375,
-0.74755859375,
-0.43603515625,
-0.5,
-1.060546875,
0.61865234375,
-0.41552734375,
0.391357421875,
-0.433837890625,
0.02960205078125,
1.107421875,
-0.658203125,
0.5166015625,
1.453125,
-0.024658203125,
0.669921875,
-0.468994140625,
0.4208984375,
0.4609375,
-0.50439453125,
-0.1878662109375,
0.12841796875,
-0.81298828125,
0.54150390625,
-0.342041015625,
-0.93505859375,
-0.83544921875,
0.279541015625,
1.251953125,
-0.3486328125,
0.623046875,
-0.0205535888671875,
-1.095703125,
-0.71875,
0.8896484375,
0.24951171875,
0.182861328125,
0.8955078125,
-0.493408203125,
-0.134033203125,
-0.2293701171875,
-0.1634521484375,
-0.2073974609375,
-0.71533203125,
0.83935546875,
-0.1505126953125,
-0.56396484375,
0.693359375,
1.02734375,
-0.74853515625,
-0.92626953125,
0.029754638671875,
0.0009226799011230469,
-0.1334228515625,
-0.5439453125,
0.25146484375,
0.59375,
-0.60546875,
0.12469482421875,
0.49755859375,
-0.5498046875,
0.425537109375,
-0.047027587890625,
0.297119140625,
-0.391845703125,
0.60595703125,
0.5966796875,
-0.3720703125,
-0.0081634521484375,
-0.6630859375,
0.011016845703125,
-0.1121826171875,
0.12078857421875,
0.7412109375,
-0.411865234375,
-0.0440673828125,
0.1412353515625,
-0.3564453125,
0.74560546875,
-0.3837890625,
-0.355712890625,
0.28515625,
-0.56396484375,
-0.54296875,
-0.28662109375,
0.442626953125,
-0.130615234375,
0.09912109375,
-0.67822265625,
-0.05029296875,
0.42626953125,
0.0291290283203125,
-0.0797119140625,
-0.6513671875,
-0.2509765625,
-0.55908203125,
-0.5498046875,
-0.58837890625,
-0.420166015625,
-0.1348876953125,
0.313232421875,
0.2027587890625,
-0.5009765625,
0.033233642578125,
0.77490234375,
-0.68359375,
0.8056640625,
-0.5576171875,
0.34619140625,
-0.62158203125,
-0.703125,
-0.52880859375,
-0.074951171875,
-0.9853515625,
0.04840087890625,
-0.62890625,
0.39599609375,
-0.0128021240234375,
0.3798828125,
0.054595947265625,
0.343505859375,
-0.433837890625,
-0.46630859375,
0.41357421875,
-0.321044921875,
-0.3017578125,
0.5810546875,
0.6201171875,
-0.1181640625,
0.10784912109375,
-0.061737060546875,
-0.317138671875,
-0.65869140625,
0.59375,
0.6123046875,
-0.034881591796875,
-0.33349609375,
0.03802490234375,
0.11651611328125,
-1.1357421875,
0.206787109375,
-0.30419921875,
0.237548828125,
0.1214599609375,
-0.7939453125,
0.489501953125,
1.197265625,
-0.373779296875,
0.401611328125,
0.420654296875,
0.15234375,
0.869140625,
0.07159423828125,
0.267333984375,
0.48681640625,
0.1033935546875,
-0.51806640625,
-0.098876953125,
0.455322265625,
-0.1492919921875,
0.220703125,
-0.1099853515625,
-0.43408203125,
-1.1181640625,
-0.10858154296875,
-0.0245819091796875,
0.481689453125,
0.32958984375,
-0.2432861328125,
0.2020263671875,
-0.083984375,
-0.450927734375,
-0.11663818359375,
-0.92431640625,
-0.603515625,
0.5947265625,
-0.0223236083984375,
-0.2039794921875,
-0.1705322265625,
-0.8330078125,
-0.141357421875,
0.1241455078125,
0.1981201171875,
-0.066650390625,
0.52392578125,
-0.75146484375,
0.60546875,
-0.322509765625,
0.06658935546875,
0.1412353515625,
0.619140625,
-0.58642578125,
-0.367431640625,
0.396240234375,
1.1259765625,
-0.2548828125,
-0.07550048828125,
-0.48828125,
0.41064453125,
-0.33935546875,
0.031982421875,
-0.41064453125,
0.1734619140625,
-0.319091796875,
0.2467041015625,
-1.109375,
0.284912109375,
-0.1248779296875,
0.525390625,
0.3505859375,
-0.462646484375,
-0.453857421875,
0.58837890625,
0.58154296875,
0.0001990795135498047,
0.055389404296875,
0.348876953125,
0.473388671875,
-0.2384033203125,
0.1932373046875,
-0.4609375,
0.366943359375,
0.427734375,
0.46923828125,
-0.1593017578125,
0.53759765625,
0.73095703125,
0.277587890625,
-0.1944580078125,
0.3974609375,
0.0887451171875,
-0.1768798828125,
-0.01483154296875,
-0.400634765625,
-0.219970703125,
-0.64453125,
-0.7578125,
0.333251953125,
-0.3271484375,
-0.016754150390625,
-0.137451171875,
-0.69140625,
1.02734375,
-0.428466796875,
-0.4853515625,
0.29931640625,
-0.2257080078125,
-0.1881103515625,
0.454833984375,
0.2061767578125,
-0.29345703125,
0.73486328125,
0.6064453125,
0.8759765625,
1.064453125,
0.50048828125,
0.0261993408203125,
-0.6328125,
0.23046875,
-0.09527587890625,
0.1871337890625,
-0.332275390625,
-0.6884765625,
-0.89013671875,
0.379638671875,
-0.5458984375,
-0.0406494140625,
0.29052734375,
-0.662109375,
0.1358642578125,
-0.40087890625,
0.60302734375,
-0.765625,
0.266357421875,
0.33837890625,
-0.4208984375,
-0.9755859375,
0.357177734375,
-0.164794921875,
0.08514404296875,
0.469482421875,
0.83349609375,
0.421142578125,
1.2783203125,
0.361572265625,
-0.191162109375,
0.060882568359375,
0.50390625,
-0.1396484375,
-0.8330078125,
-0.1650390625,
-0.229248046875,
0.228515625,
-0.2132568359375,
-0.31689453125,
0.056304931640625,
0.34521484375,
0.0594482421875,
-0.58984375,
-0.45263671875,
0.134033203125,
-0.47216796875,
0.341064453125,
0.173095703125,
-0.016265869140625,
-0.358154296875,
-0.06353759765625,
-0.2457275390625,
-0.496826171875,
0.2109375,
-0.57958984375,
0.1220703125,
-0.603515625,
-0.498779296875,
-0.469970703125,
-0.62255859375,
-0.0345458984375,
-0.222412109375,
-0.79248046875,
-1.0341796875,
0.52490234375,
0.396240234375,
0.537109375,
0.53076171875,
-0.039276123046875,
0.1038818359375,
1.294921875,
0.66943359375,
0.333740234375,
1.0498046875,
0.2861328125,
-0.06304931640625,
0.352783203125,
-0.349853515625,
0.61474609375,
-0.037353515625,
-0.13720703125,
-0.486083984375,
0.4169921875,
-0.478759765625,
-1.1435546875,
0.128662109375,
0.7158203125,
0.55322265625,
-0.931640625,
-1.140625,
-0.04803466796875,
-1.0517578125,
-0.1416015625,
-0.309326171875,
0.4794921875,
-0.0299530029296875,
0.1893310546875,
-0.47802734375,
-1.2841796875,
4.46875,
0.95556640625,
0.791015625,
0.128662109375,
0.2330322265625,
1.0048828125,
0.546875,
-0.40380859375,
-0.406005859375,
-0.673828125,
0.447509765625,
-0.6494140625,
-0.06768798828125,
0.96435546875,
0.1513671875,
0.454345703125,
-0.80029296875,
0.1275634765625,
-0.487060546875,
-0.8818359375,
-0.88134765625,
0.3310546875,
0.055328369140625,
0.5068359375,
0.052978515625,
0.37939453125,
0.491943359375,
-0.329833984375,
-0.141845703125,
-0.66650390625,
-0.03607177734375,
-0.419677734375,
0.8330078125,
-0.30322265625,
-0.5341796875,
0.7412109375,
-0.29736328125,
-0.394775390625,
-0.2861328125,
0.1397705078125,
-0.340087890625,
-0.050537109375,
0.405517578125,
-0.58935546875,
0.086669921875,
0.484619140625,
-0.59521484375,
0.475341796875,
0.3154296875,
-0.87451171875,
0.80419921875,
-0.33349609375,
0.37744140625,
-0.94775390625,
-0.814453125,
0.1409912109375,
-0.1014404296875,
-0.34423828125,
-0.2239990234375,
0.61669921875,
0.55419921875,
0.20263671875,
0.28271484375,
0.53466796875,
-0.411376953125,
1.0869140625,
-0.07470703125,
0.4765625,
-0.35009765625,
0.2454833984375,
-0.2109375,
-0.017822265625,
-0.1307373046875,
-0.10894775390625,
0.5224609375,
0.4658203125,
0.0782470703125,
0.37890625,
0.95458984375,
-0.80859375,
0.0265350341796875,
-0.1978759765625,
-0.2208251953125,
-0.39697265625,
0.2685546875,
1.3486328125,
-0.509765625,
-0.380126953125,
-0.342041015625,
0.64794921875,
0.171875,
0.65283203125,
0.0421142578125,
-0.86083984375,
-0.4189453125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Tags: brute force, implementation
Correct Solution:
```
d={}
for _ in range(int(input())):
s=input()
S=set(s)
if len(S)<=2:
k="".join(sorted(S))
if d.__contains__(k):
d[k]+=len(s)
else:
d[k]=len(s)
l=[[len(set(i)),set(i),d[i]] for i in d.keys()]
l1=[]
l=sorted(l,reverse=True)
for i in range(len(l)):
if l[i][0]==1:
l1=l[i:]
del l[i:]
break
if len(l)==0 and len(l1)==0:
print(0)
elif len(l)!=0 and len(l1)!=0:
for i in l:
for j in l1:
if len(i[1]|j[1])==2:
i[2]+=j[2]
d={}
for i in l1:
k=i[1].pop()
if d.__contains__(k):
d[k]+=i[2]
else:
d[k]=i[2]
if len(d)>1:
k=list(sorted(d.values(),reverse=True))
print(max(k[0]+k[1],max(i[2] for i in l)))
else:
print(max(max(d.values()),max(i[2] for i in l)))
elif len(l)==0 and len(l1)!=0:
d={}
for i in l1:
k=i[1].pop()
if d.__contains__(k):
d[k]+=i[2]
else:
d[k]=i[2]
if len(d)>1:
k=list(sorted(d.values(),reverse=True))
print(k[0]+k[1])
else:
print(max(d.values()))
else:
print(max(i[2] for i in l))
```
| 65,212
|
[
0.03924560546875,
0.1533203125,
0.326171875,
0.673828125,
-0.74169921875,
-0.271240234375,
0.261962890625,
-0.1168212890625,
0.2132568359375,
0.6884765625,
0.7529296875,
-0.05230712890625,
-0.1611328125,
-0.368896484375,
-0.61767578125,
0.079833984375,
-0.615234375,
-0.689453125,
-0.66943359375,
0.050201416015625,
0.1832275390625,
-0.268798828125,
-1.5166015625,
0.075927734375,
-0.634765625,
1.0234375,
0.1871337890625,
-0.0203094482421875,
1.3046875,
1.318359375,
-0.169189453125,
-0.41015625,
0.183349609375,
-0.65380859375,
-0.5390625,
-0.0787353515625,
0.68505859375,
-0.9775390625,
-0.288818359375,
-0.254150390625,
0.1861572265625,
-0.57958984375,
0.4658203125,
-0.5078125,
-1.005859375,
-0.0628662109375,
-0.226806640625,
-0.336669921875,
-0.187255859375,
-0.619140625,
0.30126953125,
-0.317626953125,
0.5712890625,
-0.02703857421875,
-0.07611083984375,
-0.1329345703125,
-0.2115478515625,
-0.0753173828125,
-0.2315673828125,
0.2431640625,
0.26611328125,
0.266845703125,
0.0301971435546875,
-0.72705078125,
-0.1871337890625,
0.12548828125,
0.058319091796875,
0.093994140625,
0.226806640625,
-0.29736328125,
0.07244873046875,
0.0531005859375,
-0.35107421875,
-0.327880859375,
-0.365234375,
0.022979736328125,
0.328369140625,
-0.424072265625,
-0.7275390625,
1.02734375,
-0.0201873779296875,
0.5341796875,
0.1246337890625,
-0.1431884765625,
-0.393798828125,
-0.304443359375,
0.30810546875,
0.44580078125,
0.485107421875,
-0.322998046875,
-0.3173828125,
0.358154296875,
-0.599609375,
0.029937744140625,
0.6455078125,
0.45947265625,
-0.35546875,
0.2286376953125,
0.245849609375,
0.176025390625,
0.79833984375,
0.99462890625,
-0.193603515625,
1.2890625,
-0.489990234375,
0.18359375,
0.416748046875,
-0.09527587890625,
-0.343017578125,
-0.09881591796875,
-0.136474609375,
-0.346435546875,
0.47900390625,
0.05047607421875,
-0.3818359375,
0.818359375,
-0.10302734375,
0.640625,
-0.82763671875,
0.34423828125,
0.56982421875,
0.171630859375,
0.0489501953125,
0.1483154296875,
0.1885986328125,
-0.72314453125,
-0.40087890625,
0.83203125,
-0.5693359375,
-0.047210693359375,
0.388671875,
0.026031494140625,
-0.289306640625,
0.5810546875,
-0.05511474609375,
0.30029296875,
-0.269287109375,
0.301513671875,
0.74951171875,
-0.51416015625,
0.892578125,
-0.031890869140625,
-0.039459228515625,
1.126953125,
0.529296875,
0.34716796875,
0.7509765625,
0.1392822265625,
-0.7333984375,
0.65478515625,
-0.97265625,
0.724609375,
0.15673828125,
0.51806640625,
-0.64453125,
0.332763671875,
-0.1473388671875,
0.209228515625,
0.199462890625,
0.106201171875,
-0.25634765625,
0.39111328125,
-0.469482421875,
1.0673828125,
-0.402099609375,
1.0185546875,
-0.56884765625,
-0.1817626953125,
-0.416748046875,
-0.477783203125,
0.152099609375,
-0.398681640625,
-0.16943359375,
0.81298828125,
0.2056884765625,
1.279296875,
1.087890625,
-0.1875,
0.377197265625,
0.1932373046875,
-0.33837890625,
0.343994140625,
0.2039794921875,
0.98388671875,
0.2154541015625,
0.322509765625,
-0.0787353515625,
-0.304443359375,
-0.705078125,
-0.51953125,
0.289794921875,
0.4833984375,
-0.83251953125,
0.0290374755859375,
0.139404296875,
0.221923828125,
-1.2001953125,
0.07415771484375,
0.2359619140625,
-0.75048828125,
-0.448486328125,
0.384765625,
-0.1158447265625,
0.5078125,
-0.3857421875,
-0.28515625,
0.52197265625,
1.255859375,
-0.41064453125,
0.001895904541015625,
0.61767578125,
0.275146484375,
-0.056121826171875,
0.1337890625,
0.117431640625,
-0.27001953125,
-0.98681640625,
0.5498046875,
-0.2039794921875,
-0.2117919921875,
0.22607421875,
0.23388671875,
0.43701171875,
0.216064453125,
-0.46923828125,
-0.0777587890625,
0.90771484375,
1.25390625,
-0.09991455078125,
0.71728515625,
0.037567138671875,
0.87353515625,
0.295654296875,
0.56982421875,
0.404296875,
-0.06640625,
0.50830078125,
0.69140625,
0.1368408203125,
0.515625,
0.216796875,
0.297607421875,
0.374755859375,
0.81201171875,
0.28857421875,
0.4599609375,
-0.0877685546875,
-0.1376953125,
-0.36962890625,
0.57568359375,
-0.322021484375,
0.345947265625,
0.01392364501953125,
0.30859375,
-0.6357421875,
-0.363037109375,
0.4345703125,
0.75146484375,
-0.7578125,
-0.485107421875,
-0.37890625,
0.47119140625,
0.04803466796875,
0.1539306640625,
0.278076171875,
0.2442626953125,
0.210693359375,
0.21826171875,
-0.05853271484375,
0.0994873046875,
-1.04296875,
-0.552734375,
-0.9326171875,
-0.34521484375,
-0.5048828125,
-0.357666015625,
0.1859130859375,
-0.892578125,
0.405517578125,
-0.12237548828125,
-0.308837890625,
0.034210205078125,
-0.7236328125,
0.28759765625,
-0.470703125,
0.74609375,
-0.8828125,
0.476318359375,
0.1412353515625,
1.0849609375,
-0.0870361328125,
-0.302490234375,
-0.2783203125,
-0.580078125,
0.29052734375,
-0.14697265625,
0.3955078125,
-0.01093292236328125,
-0.9150390625,
-0.9638671875,
-0.0694580078125,
-0.412841796875,
-0.24755859375,
0.260009765625,
-0.5478515625,
0.75927734375,
0.229248046875,
-0.489501953125,
0.720703125,
0.58349609375,
-0.97705078125,
0.151611328125,
0.149169921875,
-0.08453369140625,
-0.9619140625,
1.1982421875,
0.56982421875,
0.5654296875,
-0.544921875,
-0.319091796875,
-0.359375,
0.0022144317626953125,
0.30908203125,
-0.5615234375,
-0.370361328125,
0.40771484375,
0.10205078125,
-1.31640625,
0.322265625,
-1.0185546875,
-0.80078125,
-0.57763671875,
-0.5263671875,
0.93212890625,
0.81298828125,
-0.041107177734375,
-0.26220703125,
-0.6181640625,
-0.27587890625,
0.638671875,
0.3955078125,
-0.79248046875,
-0.283447265625,
0.818359375,
-0.126708984375,
-0.135986328125,
0.166748046875,
-0.6357421875,
-0.37939453125,
0.0261993408203125,
0.49560546875,
0.685546875,
0.2216796875,
0.2493896484375,
0.327880859375,
0.53515625,
-0.76953125,
-0.298583984375,
-0.2261962890625,
0.7685546875,
0.340576171875,
0.7333984375,
0.42724609375,
-0.70849609375,
-0.67041015625,
-1.015625,
0.60107421875,
0.49169921875,
0.8642578125,
-0.64794921875,
0.68115234375,
0.36083984375,
-0.6044921875,
0.55908203125,
-0.56201171875,
0.0806884765625,
1.18359375,
-0.004314422607421875,
0.9921875,
-0.60302734375,
0.2230224609375,
-0.277099609375,
0.187744140625,
1.1259765625,
0.5673828125,
0.243408203125,
-0.1981201171875,
-0.7724609375,
-0.2352294921875,
-0.18310546875,
-0.366943359375,
-0.60009765625,
0.1705322265625,
-0.244384765625,
-0.08929443359375,
-0.87548828125,
0.158935546875,
0.399658203125,
0.544921875,
0.01190948486328125,
1.126953125,
0.299072265625,
0.453369140625,
0.5400390625,
-0.35546875,
0.312255859375,
-0.50634765625,
1.3037109375,
-0.26025390625,
-0.10443115234375,
-0.81298828125,
-0.1739501953125,
-0.30419921875,
-0.1531982421875,
-0.044921875,
0.2203369140625,
-0.671875,
0.044586181640625,
0.023712158203125,
0.358154296875,
-0.79931640625,
0.1495361328125,
-0.18212890625,
0.498046875,
0.454345703125,
-0.71533203125,
0.2271728515625,
-0.86962890625,
0.55615234375,
0.267578125,
-0.015838623046875,
-0.7744140625,
-0.399169921875,
-0.92529296875,
-0.84375,
-0.0963134765625,
0.65234375,
-0.2353515625,
0.116943359375,
-0.517578125,
0.256103515625,
0.268310546875,
-0.284423828125,
0.10845947265625,
-0.10089111328125,
0.7255859375,
0.08746337890625,
0.8623046875,
-0.479736328125,
-0.375,
0.341796875,
-0.97314453125,
0.55078125,
-0.4228515625,
0.1346435546875,
-0.00554656982421875,
-0.10894775390625,
-0.040008544921875,
0.248046875,
0.03399658203125,
0.358642578125,
-0.2027587890625,
0.480224609375,
-0.6181640625,
-0.6005859375,
0.64208984375,
-0.350341796875,
-0.33203125,
0.84326171875,
-0.482666015625,
0.0634765625,
0.450927734375,
0.251220703125,
-0.74853515625,
0.1748046875,
-0.6357421875,
0.6005859375,
-0.1859130859375,
-0.7685546875,
0.1258544921875,
-0.6279296875,
0.5517578125,
-0.135498046875,
-0.34033203125,
-0.278564453125,
-1.4990234375,
-0.11334228515625,
-0.0833740234375,
-0.67431640625,
0.42236328125,
0.357177734375,
-0.394287109375,
-0.325439453125,
-0.26513671875,
-0.5830078125,
-0.229736328125,
-0.1773681640625,
-0.25390625,
0.061676025390625,
0.42626953125,
1.0830078125,
-0.06768798828125,
-0.217529296875,
0.19091796875,
0.198974609375,
-0.357177734375,
-0.48193359375,
-0.5703125,
-0.075439453125,
-0.4287109375,
-0.001186370849609375,
0.56640625,
-0.09820556640625,
-0.07525634765625,
0.87548828125,
-0.250732421875,
0.2010498046875,
0.395751953125,
-0.361328125,
1.1611328125,
0.2391357421875,
-1.1845703125,
-0.52734375,
0.7646484375,
-0.202880859375,
0.409912109375,
0.1995849609375,
-1.087890625,
-0.86474609375,
-0.5,
0.115234375,
-0.5205078125,
-0.11505126953125,
-1.005859375,
-0.433349609375,
-0.24658203125,
0.734375,
-0.206298828125,
-0.252685546875,
0.1527099609375,
-1.125,
0.090087890625,
-0.72265625,
0.115478515625,
-0.71337890625,
-0.67333984375,
-0.363525390625,
0.9990234375,
0.238037109375,
0.260986328125,
-0.1585693359375,
-0.1383056640625,
0.5400390625,
-0.34228515625,
-0.3740234375,
-0.5048828125,
0.06695556640625,
0.17138671875,
0.09765625,
-0.260498046875,
-0.6708984375,
0.9365234375,
-0.70703125,
0.269775390625,
-0.46044921875,
-0.5,
-0.0105438232421875,
-0.465087890625,
1.0234375,
-0.4814453125,
0.1324462890625,
-0.50927734375,
0.376953125,
0.69873046875,
-0.06756591796875,
-0.7587890625,
-0.444091796875,
-0.54638671875,
-1.0546875,
0.57763671875,
-0.4111328125,
0.420166015625,
-0.43212890625,
0.0014858245849609375,
1.1015625,
-0.61865234375,
0.487548828125,
1.4375,
-0.006290435791015625,
0.6259765625,
-0.50048828125,
0.398193359375,
0.442626953125,
-0.55517578125,
-0.1663818359375,
0.17529296875,
-0.83740234375,
0.57373046875,
-0.314208984375,
-0.896484375,
-0.8017578125,
0.271484375,
1.21484375,
-0.333984375,
0.6123046875,
-0.039886474609375,
-1.076171875,
-0.716796875,
0.857421875,
0.2371826171875,
0.201171875,
0.88671875,
-0.455322265625,
-0.1632080078125,
-0.234130859375,
-0.18115234375,
-0.167724609375,
-0.7138671875,
0.8466796875,
-0.152587890625,
-0.62451171875,
0.7099609375,
0.97998046875,
-0.74658203125,
-0.8935546875,
0.028076171875,
0.043792724609375,
-0.1351318359375,
-0.5302734375,
0.23779296875,
0.60009765625,
-0.62353515625,
0.1195068359375,
0.481201171875,
-0.49609375,
0.400390625,
-0.10626220703125,
0.310791015625,
-0.3955078125,
0.59375,
0.59814453125,
-0.369873046875,
0.016387939453125,
-0.64892578125,
0.01739501953125,
-0.11871337890625,
0.1529541015625,
0.74267578125,
-0.37890625,
-0.003093719482421875,
0.1490478515625,
-0.317626953125,
0.783203125,
-0.346923828125,
-0.389892578125,
0.298095703125,
-0.56884765625,
-0.5537109375,
-0.297607421875,
0.44189453125,
-0.138671875,
0.09637451171875,
-0.6298828125,
-0.044586181640625,
0.42626953125,
0.07916259765625,
-0.089111328125,
-0.63818359375,
-0.246826171875,
-0.544921875,
-0.5888671875,
-0.5888671875,
-0.390869140625,
-0.1478271484375,
0.311279296875,
0.2042236328125,
-0.470947265625,
-0.016265869140625,
0.7958984375,
-0.68310546875,
0.8369140625,
-0.54638671875,
0.296875,
-0.64111328125,
-0.72607421875,
-0.55224609375,
-0.06536865234375,
-0.94970703125,
0.02569580078125,
-0.60791015625,
0.390380859375,
-0.0208282470703125,
0.38671875,
0.0577392578125,
0.326904296875,
-0.44287109375,
-0.484375,
0.427978515625,
-0.37548828125,
-0.294921875,
0.58203125,
0.60546875,
-0.1270751953125,
0.114501953125,
-0.08843994140625,
-0.326171875,
-0.6689453125,
0.5556640625,
0.5693359375,
-0.011993408203125,
-0.3603515625,
-0.0152587890625,
0.08221435546875,
-1.109375,
0.256591796875,
-0.293212890625,
0.2010498046875,
0.11370849609375,
-0.7734375,
0.5146484375,
1.2119140625,
-0.334228515625,
0.40771484375,
0.447021484375,
0.1251220703125,
0.86572265625,
0.09222412109375,
0.279052734375,
0.46630859375,
0.060394287109375,
-0.4765625,
-0.0870361328125,
0.470703125,
-0.1661376953125,
0.262451171875,
-0.1322021484375,
-0.4248046875,
-1.1279296875,
-0.137451171875,
-0.0438232421875,
0.509765625,
0.320068359375,
-0.251220703125,
0.2310791015625,
-0.0980224609375,
-0.43994140625,
-0.1116943359375,
-0.82373046875,
-0.640625,
0.58447265625,
-0.051239013671875,
-0.2208251953125,
-0.1680908203125,
-0.8212890625,
-0.1690673828125,
0.1856689453125,
0.206298828125,
-0.093994140625,
0.57373046875,
-0.75048828125,
0.6162109375,
-0.2471923828125,
0.0491943359375,
0.125244140625,
0.63134765625,
-0.5908203125,
-0.375,
0.3896484375,
1.14453125,
-0.256103515625,
-0.042572021484375,
-0.4716796875,
0.427490234375,
-0.353271484375,
0.0513916015625,
-0.394287109375,
0.2073974609375,
-0.310546875,
0.268798828125,
-1.1181640625,
0.271240234375,
-0.10369873046875,
0.5439453125,
0.337646484375,
-0.45751953125,
-0.4736328125,
0.5986328125,
0.5439453125,
0.0027980804443359375,
0.0643310546875,
0.38427734375,
0.46044921875,
-0.225341796875,
0.19140625,
-0.435302734375,
0.376953125,
0.46533203125,
0.450927734375,
-0.16796875,
0.54296875,
0.70556640625,
0.291748046875,
-0.1920166015625,
0.4228515625,
0.0972900390625,
-0.1441650390625,
-0.0290985107421875,
-0.451904296875,
-0.21337890625,
-0.6943359375,
-0.7568359375,
0.339599609375,
-0.3349609375,
0.0190582275390625,
-0.13427734375,
-0.7099609375,
1.0263671875,
-0.42333984375,
-0.46630859375,
0.273193359375,
-0.193359375,
-0.1669921875,
0.444580078125,
0.17431640625,
-0.32080078125,
0.72998046875,
0.5927734375,
0.83984375,
1.0859375,
0.4873046875,
-0.029083251953125,
-0.67138671875,
0.242919921875,
-0.0745849609375,
0.2005615234375,
-0.305419921875,
-0.71435546875,
-0.87744140625,
0.406005859375,
-0.56103515625,
-0.052459716796875,
0.302001953125,
-0.64697265625,
0.16748046875,
-0.3916015625,
0.57666015625,
-0.75244140625,
0.2890625,
0.326904296875,
-0.39892578125,
-1.015625,
0.3447265625,
-0.2042236328125,
0.119873046875,
0.456787109375,
0.8662109375,
0.411376953125,
1.2783203125,
0.353759765625,
-0.249267578125,
0.033233642578125,
0.485595703125,
-0.1263427734375,
-0.8203125,
-0.1689453125,
-0.2275390625,
0.205078125,
-0.191650390625,
-0.31494140625,
0.07965087890625,
0.33984375,
0.01702880859375,
-0.58251953125,
-0.46875,
0.158203125,
-0.473876953125,
0.353271484375,
0.2081298828125,
-0.01285552978515625,
-0.42626953125,
-0.07196044921875,
-0.28125,
-0.51123046875,
0.2384033203125,
-0.6123046875,
0.111083984375,
-0.60888671875,
-0.50244140625,
-0.51513671875,
-0.59326171875,
-0.031005859375,
-0.2093505859375,
-0.771484375,
-1.0078125,
0.544921875,
0.379150390625,
0.51513671875,
0.51171875,
-0.052734375,
0.087158203125,
1.306640625,
0.67724609375,
0.351318359375,
1.0771484375,
0.283935546875,
-0.0175323486328125,
0.331787109375,
-0.339599609375,
0.61083984375,
-0.03515625,
-0.090087890625,
-0.50634765625,
0.42626953125,
-0.476318359375,
-1.1240234375,
0.09747314453125,
0.75830078125,
0.53857421875,
-0.9169921875,
-1.1337890625,
-0.048736572265625,
-1.0341796875,
-0.179443359375,
-0.3125,
0.47021484375,
-0.05517578125,
0.1904296875,
-0.4833984375,
-1.2451171875,
4.48046875,
0.9599609375,
0.837890625,
0.07177734375,
0.2218017578125,
0.98193359375,
0.521484375,
-0.427490234375,
-0.330810546875,
-0.6923828125,
0.44580078125,
-0.68310546875,
-0.0931396484375,
0.96435546875,
0.126708984375,
0.416748046875,
-0.8046875,
0.14501953125,
-0.4619140625,
-0.91064453125,
-0.85888671875,
0.2998046875,
0.08953857421875,
0.494140625,
0.0269775390625,
0.377197265625,
0.481689453125,
-0.371826171875,
-0.158447265625,
-0.646484375,
-0.04058837890625,
-0.426513671875,
0.8603515625,
-0.280029296875,
-0.53369140625,
0.7626953125,
-0.306396484375,
-0.418212890625,
-0.34716796875,
0.10791015625,
-0.306396484375,
-0.037139892578125,
0.421875,
-0.6103515625,
0.0986328125,
0.51708984375,
-0.61669921875,
0.52978515625,
0.3583984375,
-0.88916015625,
0.81298828125,
-0.3203125,
0.41357421875,
-0.9443359375,
-0.84326171875,
0.158203125,
-0.11907958984375,
-0.364501953125,
-0.2335205078125,
0.59130859375,
0.5361328125,
0.19873046875,
0.276123046875,
0.5341796875,
-0.384521484375,
1.0546875,
-0.060546875,
0.471435546875,
-0.37890625,
0.2083740234375,
-0.2188720703125,
-0.03668212890625,
-0.11083984375,
-0.0986328125,
0.52294921875,
0.521484375,
0.041107177734375,
0.383056640625,
0.96484375,
-0.78271484375,
0.0246734619140625,
-0.2274169921875,
-0.2406005859375,
-0.400146484375,
0.305419921875,
1.341796875,
-0.51806640625,
-0.371337890625,
-0.409912109375,
0.62841796875,
0.1585693359375,
0.6474609375,
0.049102783203125,
-0.8583984375,
-0.41748046875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Tags: brute force, implementation
Correct Solution:
```
n = int(input())
one = dict()
two = dict()
for i in range(n):
f = input()
q = set()
for j in f:
if j not in q:
q.add(j)
if len(q) < 3:
if len(q) == 1:
if ''.join(sorted(list(q))) in one:
one[''.join(sorted(list(q)))] += len(f)
else:
one[''.join(sorted(list(q)))] = len(f)
else:
if ''.join(sorted(list(q))) in two:
two[''.join(sorted(list(q)))] += len(f)
else:
two[''.join(sorted(list(q)))] = len(f)
ans = 0
for i in two:
if i[0] in one:
two[i] += one[i[0]]
if i[1] in one:
two[i] += one[i[1]]
if ans < two[i]:
ans = two[i]
for i in one:
if one[i] > ans:
ans = one[i]
for j in one:
if i != j and one[i] + one[j] > ans:
ans = one[i] + one[j]
print(ans)
```
| 65,213
|
[
0.03106689453125,
0.138671875,
0.2890625,
0.64501953125,
-0.74267578125,
-0.2486572265625,
0.2457275390625,
-0.133544921875,
0.221435546875,
0.7275390625,
0.6796875,
-0.05596923828125,
-0.176025390625,
-0.34423828125,
-0.65478515625,
0.0758056640625,
-0.65185546875,
-0.67822265625,
-0.65185546875,
0.045501708984375,
0.15625,
-0.2529296875,
-1.5400390625,
0.0560302734375,
-0.6337890625,
1.064453125,
0.1795654296875,
0.0030517578125,
1.353515625,
1.326171875,
-0.200927734375,
-0.410400390625,
0.1961669921875,
-0.63427734375,
-0.55078125,
-0.04736328125,
0.6767578125,
-1.0107421875,
-0.31884765625,
-0.277587890625,
0.1544189453125,
-0.595703125,
0.467529296875,
-0.495849609375,
-1.03515625,
-0.06103515625,
-0.22314453125,
-0.3037109375,
-0.1981201171875,
-0.66357421875,
0.30078125,
-0.29541015625,
0.57421875,
-0.07769775390625,
-0.138427734375,
-0.1356201171875,
-0.182861328125,
-0.050262451171875,
-0.256103515625,
0.3046875,
0.28466796875,
0.33984375,
0.06817626953125,
-0.68994140625,
-0.2259521484375,
0.16259765625,
0.03955078125,
0.049102783203125,
0.2022705078125,
-0.2998046875,
0.08514404296875,
0.05474853515625,
-0.33447265625,
-0.333984375,
-0.346923828125,
0.050048828125,
0.299072265625,
-0.447021484375,
-0.72998046875,
1.0322265625,
-0.002288818359375,
0.52685546875,
0.09954833984375,
-0.07464599609375,
-0.43310546875,
-0.277587890625,
0.2476806640625,
0.42822265625,
0.468017578125,
-0.30078125,
-0.341796875,
0.371337890625,
-0.57861328125,
0.003185272216796875,
0.64599609375,
0.453125,
-0.362548828125,
0.2181396484375,
0.251953125,
0.1893310546875,
0.8212890625,
1.025390625,
-0.147216796875,
1.294921875,
-0.46240234375,
0.17529296875,
0.386962890625,
-0.1087646484375,
-0.339111328125,
-0.10064697265625,
-0.0948486328125,
-0.364501953125,
0.50537109375,
0.0833740234375,
-0.406005859375,
0.84765625,
-0.10577392578125,
0.60595703125,
-0.85791015625,
0.33935546875,
0.53369140625,
0.1959228515625,
0.09515380859375,
0.151611328125,
0.1885986328125,
-0.7373046875,
-0.39306640625,
0.83203125,
-0.533203125,
-0.0743408203125,
0.401123046875,
-0.0023212432861328125,
-0.288818359375,
0.53759765625,
-0.0423583984375,
0.236083984375,
-0.268798828125,
0.31494140625,
0.72998046875,
-0.54296875,
0.904296875,
-0.0287017822265625,
0.0147705078125,
1.1455078125,
0.57177734375,
0.3564453125,
0.697265625,
0.1358642578125,
-0.70263671875,
0.595703125,
-0.9755859375,
0.748046875,
0.11810302734375,
0.473388671875,
-0.63623046875,
0.330322265625,
-0.1568603515625,
0.2171630859375,
0.2384033203125,
0.1253662109375,
-0.2135009765625,
0.361572265625,
-0.478759765625,
1.083984375,
-0.3916015625,
0.98583984375,
-0.5546875,
-0.233154296875,
-0.376953125,
-0.4375,
0.1436767578125,
-0.40185546875,
-0.1695556640625,
0.7451171875,
0.2196044921875,
1.2802734375,
1.0791015625,
-0.2432861328125,
0.371826171875,
0.205078125,
-0.306884765625,
0.35595703125,
0.1959228515625,
1.0185546875,
0.221923828125,
0.260986328125,
-0.09027099609375,
-0.32958984375,
-0.658203125,
-0.497802734375,
0.25244140625,
0.47607421875,
-0.83984375,
0.0012331008911132812,
0.122314453125,
0.2098388671875,
-1.162109375,
0.09222412109375,
0.2296142578125,
-0.77001953125,
-0.438232421875,
0.421630859375,
-0.1763916015625,
0.5166015625,
-0.4287109375,
-0.2467041015625,
0.53857421875,
1.27734375,
-0.4013671875,
-0.006702423095703125,
0.630859375,
0.31884765625,
-0.060089111328125,
0.123779296875,
0.142333984375,
-0.2451171875,
-0.9951171875,
0.560546875,
-0.242919921875,
-0.23583984375,
0.30322265625,
0.2763671875,
0.416259765625,
0.2069091796875,
-0.474365234375,
-0.01513671875,
0.8701171875,
1.267578125,
-0.0557861328125,
0.734375,
0.052520751953125,
0.890625,
0.28857421875,
0.54541015625,
0.389892578125,
-0.0750732421875,
0.51904296875,
0.701171875,
0.10595703125,
0.54248046875,
0.1888427734375,
0.2939453125,
0.38720703125,
0.83837890625,
0.267333984375,
0.47265625,
-0.09368896484375,
-0.106201171875,
-0.42626953125,
0.63623046875,
-0.327880859375,
0.32861328125,
0.0311279296875,
0.248291015625,
-0.642578125,
-0.376953125,
0.39892578125,
0.75439453125,
-0.75146484375,
-0.445556640625,
-0.39794921875,
0.4765625,
0.049835205078125,
0.12152099609375,
0.2607421875,
0.1822509765625,
0.228271484375,
0.26025390625,
-0.049041748046875,
0.06134033203125,
-1.0546875,
-0.50732421875,
-0.98193359375,
-0.352783203125,
-0.55224609375,
-0.357421875,
0.2271728515625,
-0.81201171875,
0.376708984375,
-0.130126953125,
-0.3251953125,
-0.054351806640625,
-0.705078125,
0.2568359375,
-0.47607421875,
0.748046875,
-0.86083984375,
0.493408203125,
0.10614013671875,
1.080078125,
-0.123291015625,
-0.290283203125,
-0.280517578125,
-0.626953125,
0.3232421875,
-0.1461181640625,
0.455810546875,
0.017364501953125,
-0.9462890625,
-0.89990234375,
-0.090576171875,
-0.443603515625,
-0.24951171875,
0.2890625,
-0.5908203125,
0.76318359375,
0.157470703125,
-0.484375,
0.7080078125,
0.60693359375,
-0.99365234375,
0.12744140625,
0.197998046875,
-0.059051513671875,
-0.9912109375,
1.2080078125,
0.578125,
0.59033203125,
-0.5361328125,
-0.30126953125,
-0.365966796875,
0.01390838623046875,
0.304443359375,
-0.61181640625,
-0.384521484375,
0.37255859375,
0.07867431640625,
-1.3447265625,
0.30078125,
-1.009765625,
-0.82861328125,
-0.568359375,
-0.51953125,
0.916015625,
0.8232421875,
-0.040374755859375,
-0.24951171875,
-0.68408203125,
-0.286865234375,
0.66748046875,
0.382568359375,
-0.77880859375,
-0.338134765625,
0.8076171875,
-0.10687255859375,
-0.1268310546875,
0.21142578125,
-0.62939453125,
-0.3916015625,
0.055267333984375,
0.51416015625,
0.71826171875,
0.251708984375,
0.269287109375,
0.294921875,
0.481689453125,
-0.8017578125,
-0.280517578125,
-0.1907958984375,
0.763671875,
0.365966796875,
0.71044921875,
0.460205078125,
-0.67138671875,
-0.6865234375,
-0.99951171875,
0.61474609375,
0.469970703125,
0.8466796875,
-0.6259765625,
0.71923828125,
0.345458984375,
-0.58984375,
0.55517578125,
-0.5517578125,
0.15478515625,
1.1796875,
0.07110595703125,
0.98583984375,
-0.6162109375,
0.1832275390625,
-0.302978515625,
0.18017578125,
1.0966796875,
0.5322265625,
0.2373046875,
-0.1722412109375,
-0.75634765625,
-0.220458984375,
-0.180419921875,
-0.355224609375,
-0.59765625,
0.16455078125,
-0.20947265625,
-0.1429443359375,
-0.81201171875,
0.1572265625,
0.4013671875,
0.5732421875,
-0.0311126708984375,
1.12109375,
0.312744140625,
0.43359375,
0.55517578125,
-0.30615234375,
0.287353515625,
-0.49169921875,
1.287109375,
-0.19775390625,
-0.10687255859375,
-0.79296875,
-0.18310546875,
-0.266845703125,
-0.1851806640625,
-0.03125,
0.2421875,
-0.67578125,
0.0296478271484375,
0.0202178955078125,
0.3447265625,
-0.7861328125,
0.1470947265625,
-0.18310546875,
0.466552734375,
0.414794921875,
-0.71044921875,
0.260498046875,
-0.853515625,
0.58251953125,
0.2349853515625,
-0.04180908203125,
-0.79541015625,
-0.385009765625,
-0.88671875,
-0.8330078125,
-0.058929443359375,
0.64404296875,
-0.251953125,
0.169921875,
-0.5361328125,
0.2401123046875,
0.306396484375,
-0.261962890625,
0.0902099609375,
-0.10784912109375,
0.740234375,
0.08978271484375,
0.8779296875,
-0.49755859375,
-0.37548828125,
0.348388671875,
-0.9169921875,
0.53662109375,
-0.4453125,
0.148193359375,
0.010986328125,
-0.12359619140625,
-0.05059814453125,
0.280517578125,
0.0684814453125,
0.32568359375,
-0.2283935546875,
0.4736328125,
-0.65966796875,
-0.59521484375,
0.6591796875,
-0.302001953125,
-0.29833984375,
0.83544921875,
-0.51416015625,
0.0604248046875,
0.4033203125,
0.211669921875,
-0.73193359375,
0.1954345703125,
-0.63671875,
0.58203125,
-0.204833984375,
-0.7314453125,
0.126953125,
-0.6259765625,
0.5947265625,
-0.10089111328125,
-0.348876953125,
-0.261474609375,
-1.5126953125,
-0.126220703125,
-0.0323486328125,
-0.6533203125,
0.392333984375,
0.350341796875,
-0.399169921875,
-0.36865234375,
-0.260009765625,
-0.5625,
-0.289306640625,
-0.174072265625,
-0.229736328125,
0.0556640625,
0.395263671875,
1.029296875,
-0.04791259765625,
-0.238037109375,
0.2322998046875,
0.182373046875,
-0.33837890625,
-0.49560546875,
-0.58544921875,
-0.060699462890625,
-0.438232421875,
0.042724609375,
0.60986328125,
-0.08734130859375,
-0.0911865234375,
0.8623046875,
-0.2200927734375,
0.205322265625,
0.393310546875,
-0.335693359375,
1.1142578125,
0.1839599609375,
-1.240234375,
-0.45849609375,
0.80322265625,
-0.2088623046875,
0.41455078125,
0.1434326171875,
-1.1279296875,
-0.8671875,
-0.494384765625,
0.12841796875,
-0.56591796875,
-0.1282958984375,
-0.9951171875,
-0.392822265625,
-0.239013671875,
0.712890625,
-0.2008056640625,
-0.3125,
0.1026611328125,
-1.150390625,
0.07183837890625,
-0.75390625,
0.135498046875,
-0.68017578125,
-0.69091796875,
-0.41015625,
0.96484375,
0.2176513671875,
0.281982421875,
-0.1512451171875,
-0.1732177734375,
0.484375,
-0.329345703125,
-0.387939453125,
-0.50830078125,
0.059539794921875,
0.1507568359375,
0.11614990234375,
-0.2607421875,
-0.65771484375,
0.9736328125,
-0.73583984375,
0.2333984375,
-0.49169921875,
-0.50732421875,
0.0062408447265625,
-0.445068359375,
1.0341796875,
-0.400390625,
0.085693359375,
-0.521484375,
0.357421875,
0.69482421875,
-0.06396484375,
-0.73876953125,
-0.47119140625,
-0.48583984375,
-1.08203125,
0.55126953125,
-0.37353515625,
0.383056640625,
-0.390380859375,
0.0306549072265625,
1.095703125,
-0.6455078125,
0.434326171875,
1.380859375,
-0.0396728515625,
0.66748046875,
-0.51611328125,
0.431884765625,
0.487548828125,
-0.52685546875,
-0.11041259765625,
0.1907958984375,
-0.8134765625,
0.53271484375,
-0.356689453125,
-0.88525390625,
-0.81787109375,
0.2509765625,
1.23046875,
-0.2802734375,
0.60693359375,
-0.007232666015625,
-1.1259765625,
-0.73583984375,
0.88623046875,
0.2445068359375,
0.169189453125,
0.81982421875,
-0.50244140625,
-0.14013671875,
-0.271240234375,
-0.1517333984375,
-0.2117919921875,
-0.6884765625,
0.873046875,
-0.175048828125,
-0.603515625,
0.7109375,
1.0283203125,
-0.724609375,
-0.9287109375,
0.036834716796875,
0.042266845703125,
-0.1370849609375,
-0.537109375,
0.258056640625,
0.6083984375,
-0.57958984375,
0.1041259765625,
0.47265625,
-0.476318359375,
0.4287109375,
-0.0733642578125,
0.28564453125,
-0.42236328125,
0.57568359375,
0.6171875,
-0.436279296875,
0.0045166015625,
-0.626953125,
0.0294952392578125,
-0.08203125,
0.12237548828125,
0.7177734375,
-0.42333984375,
-0.026611328125,
0.1507568359375,
-0.3505859375,
0.7734375,
-0.364501953125,
-0.3876953125,
0.299072265625,
-0.54931640625,
-0.5322265625,
-0.25927734375,
0.4853515625,
-0.1513671875,
0.07611083984375,
-0.6220703125,
-0.055267333984375,
0.39404296875,
0.039215087890625,
-0.10614013671875,
-0.65625,
-0.295654296875,
-0.501953125,
-0.54150390625,
-0.6044921875,
-0.346435546875,
-0.1229248046875,
0.33642578125,
0.1778564453125,
-0.42236328125,
-0.01540374755859375,
0.80419921875,
-0.71435546875,
0.83154296875,
-0.5888671875,
0.3564453125,
-0.65625,
-0.6845703125,
-0.5546875,
-0.06170654296875,
-0.9541015625,
0.00832366943359375,
-0.60595703125,
0.35546875,
0.0193634033203125,
0.37255859375,
0.0849609375,
0.3583984375,
-0.446533203125,
-0.476806640625,
0.38818359375,
-0.334716796875,
-0.330078125,
0.5859375,
0.609375,
-0.09930419921875,
0.061920166015625,
-0.0986328125,
-0.35986328125,
-0.63720703125,
0.572265625,
0.60888671875,
0.01517486572265625,
-0.340576171875,
-0.0017547607421875,
0.06170654296875,
-1.115234375,
0.2227783203125,
-0.346923828125,
0.1904296875,
0.128662109375,
-0.79931640625,
0.486328125,
1.1884765625,
-0.3466796875,
0.388916015625,
0.43701171875,
0.16796875,
0.8525390625,
0.058441162109375,
0.29345703125,
0.44970703125,
0.1253662109375,
-0.5126953125,
-0.0167999267578125,
0.466552734375,
-0.18408203125,
0.235595703125,
-0.114013671875,
-0.431640625,
-1.1484375,
-0.0850830078125,
-0.03729248046875,
0.5224609375,
0.312255859375,
-0.2293701171875,
0.2449951171875,
-0.12646484375,
-0.48193359375,
-0.135498046875,
-0.8134765625,
-0.62890625,
0.6064453125,
-0.098876953125,
-0.185546875,
-0.12115478515625,
-0.88623046875,
-0.1142578125,
0.1763916015625,
0.226318359375,
-0.0589599609375,
0.50634765625,
-0.75244140625,
0.6005859375,
-0.308837890625,
0.0872802734375,
0.1041259765625,
0.6181640625,
-0.55712890625,
-0.31201171875,
0.423583984375,
1.1494140625,
-0.21826171875,
-0.048736572265625,
-0.5,
0.394287109375,
-0.342529296875,
0.0252838134765625,
-0.409912109375,
0.1392822265625,
-0.303955078125,
0.2308349609375,
-1.07421875,
0.298828125,
-0.100830078125,
0.5185546875,
0.306884765625,
-0.4228515625,
-0.4775390625,
0.5830078125,
0.5791015625,
0.0291595458984375,
0.0181732177734375,
0.402099609375,
0.42919921875,
-0.2548828125,
0.137451171875,
-0.40087890625,
0.42236328125,
0.45263671875,
0.46337890625,
-0.179931640625,
0.4853515625,
0.7158203125,
0.30322265625,
-0.2073974609375,
0.399169921875,
0.10479736328125,
-0.171142578125,
-0.0242462158203125,
-0.42822265625,
-0.249267578125,
-0.6591796875,
-0.73828125,
0.381591796875,
-0.27880859375,
-0.01280975341796875,
-0.16015625,
-0.65771484375,
1.0068359375,
-0.396728515625,
-0.50244140625,
0.2568359375,
-0.16064453125,
-0.166748046875,
0.4150390625,
0.2403564453125,
-0.284912109375,
0.72705078125,
0.58056640625,
0.810546875,
1.09765625,
0.51708984375,
-0.0152740478515625,
-0.64892578125,
0.21923828125,
-0.0653076171875,
0.2060546875,
-0.314697265625,
-0.7294921875,
-0.91455078125,
0.414794921875,
-0.58642578125,
0.0228271484375,
0.235595703125,
-0.6484375,
0.2041015625,
-0.41259765625,
0.55224609375,
-0.76220703125,
0.268798828125,
0.284912109375,
-0.400390625,
-1.0263671875,
0.33056640625,
-0.179443359375,
0.095947265625,
0.476318359375,
0.8916015625,
0.433837890625,
1.232421875,
0.378173828125,
-0.2100830078125,
0.06103515625,
0.43505859375,
-0.1026611328125,
-0.80615234375,
-0.1475830078125,
-0.2178955078125,
0.2198486328125,
-0.1864013671875,
-0.3134765625,
0.056549072265625,
0.36669921875,
0.042633056640625,
-0.5947265625,
-0.440673828125,
0.12481689453125,
-0.465087890625,
0.380126953125,
0.2196044921875,
0.05328369140625,
-0.370361328125,
-0.0692138671875,
-0.2027587890625,
-0.50537109375,
0.2568359375,
-0.62353515625,
0.11248779296875,
-0.56201171875,
-0.57568359375,
-0.47509765625,
-0.63134765625,
0.03314208984375,
-0.2049560546875,
-0.83154296875,
-1.0615234375,
0.51806640625,
0.38330078125,
0.55029296875,
0.4638671875,
-0.09832763671875,
0.06591796875,
1.34765625,
0.66943359375,
0.388916015625,
1.0458984375,
0.30126953125,
-0.10028076171875,
0.359130859375,
-0.310302734375,
0.642578125,
-0.076171875,
-0.06817626953125,
-0.48193359375,
0.381591796875,
-0.46240234375,
-1.166015625,
0.0797119140625,
0.76220703125,
0.52587890625,
-0.91943359375,
-1.1328125,
-0.103515625,
-1.0400390625,
-0.1719970703125,
-0.322509765625,
0.464599609375,
-0.0770263671875,
0.18310546875,
-0.47021484375,
-1.2587890625,
4.484375,
1.0009765625,
0.8076171875,
0.09613037109375,
0.2210693359375,
0.94580078125,
0.5634765625,
-0.390380859375,
-0.338134765625,
-0.69580078125,
0.38671875,
-0.66162109375,
-0.10382080078125,
0.9970703125,
0.11712646484375,
0.383544921875,
-0.81298828125,
0.12646484375,
-0.451416015625,
-0.87060546875,
-0.87939453125,
0.273193359375,
0.0770263671875,
0.51171875,
0.034881591796875,
0.40576171875,
0.5107421875,
-0.370849609375,
-0.1595458984375,
-0.591796875,
-0.034576416015625,
-0.406982421875,
0.87109375,
-0.277587890625,
-0.54345703125,
0.72900390625,
-0.292236328125,
-0.430419921875,
-0.31591796875,
0.09088134765625,
-0.252685546875,
0.007762908935546875,
0.442626953125,
-0.59375,
0.0994873046875,
0.51611328125,
-0.6025390625,
0.56787109375,
0.31689453125,
-0.9091796875,
0.82763671875,
-0.314208984375,
0.361572265625,
-0.955078125,
-0.85009765625,
0.199951171875,
-0.06536865234375,
-0.347412109375,
-0.2139892578125,
0.57275390625,
0.53515625,
0.15234375,
0.304443359375,
0.548828125,
-0.4345703125,
1.03125,
-0.0545654296875,
0.47412109375,
-0.35498046875,
0.241455078125,
-0.19775390625,
-0.031280517578125,
-0.1243896484375,
-0.10595703125,
0.560546875,
0.483154296875,
0.05914306640625,
0.41796875,
0.97314453125,
-0.8046875,
0.036224365234375,
-0.20263671875,
-0.267578125,
-0.43994140625,
0.344482421875,
1.3017578125,
-0.481201171875,
-0.352783203125,
-0.3740234375,
0.57958984375,
0.1883544921875,
0.6572265625,
0.051605224609375,
-0.84423828125,
-0.393798828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Tags: brute force, implementation
Correct Solution:
```
import itertools
import functools
N = int(input())
words = [ input() for i in range(N) ]
words_bit = [[functools.reduce(lambda x, y : x | y, [0] + [ 1 << ord(ch) - ord('a') for ch in words[i]])][0] for i in range(N)]
print(max([sum([ len(words[k]) for k in range(N) if not words_bit[k] & ~(1 << i | 1 << j)]) for i in range(26) for j in range(26)]))
```
| 65,214
|
[
0.069580078125,
0.07977294921875,
0.312255859375,
0.65673828125,
-0.74951171875,
-0.369140625,
0.2471923828125,
-0.1632080078125,
0.1737060546875,
0.71240234375,
0.7158203125,
-0.052825927734375,
-0.206787109375,
-0.296630859375,
-0.6015625,
0.12451171875,
-0.5927734375,
-0.66552734375,
-0.609375,
0.0291900634765625,
0.1485595703125,
-0.30810546875,
-1.4814453125,
0.035003662109375,
-0.66162109375,
1.080078125,
0.215087890625,
-0.0185546875,
1.2978515625,
1.2880859375,
-0.1510009765625,
-0.47119140625,
0.1871337890625,
-0.625,
-0.56787109375,
-0.04168701171875,
0.7109375,
-0.93505859375,
-0.2381591796875,
-0.2259521484375,
0.1641845703125,
-0.53564453125,
0.52587890625,
-0.5322265625,
-1.0107421875,
-0.0175018310546875,
-0.191162109375,
-0.32373046875,
-0.2294921875,
-0.63427734375,
0.282470703125,
-0.283447265625,
0.54345703125,
-0.04913330078125,
-0.08856201171875,
-0.144287109375,
-0.2330322265625,
-0.1259765625,
-0.279296875,
0.268310546875,
0.2890625,
0.279541015625,
0.1282958984375,
-0.7197265625,
-0.088623046875,
0.1695556640625,
0.05810546875,
0.087646484375,
0.189208984375,
-0.313232421875,
0.1163330078125,
0.052886962890625,
-0.458740234375,
-0.28125,
-0.36669921875,
-0.0019130706787109375,
0.373046875,
-0.35302734375,
-0.7939453125,
1.005859375,
-0.045440673828125,
0.4794921875,
0.058074951171875,
-0.1912841796875,
-0.438232421875,
-0.337158203125,
0.286376953125,
0.40966796875,
0.493408203125,
-0.34765625,
-0.355224609375,
0.336669921875,
-0.56884765625,
0.0709228515625,
0.62646484375,
0.48193359375,
-0.422119140625,
0.1875,
0.26416015625,
0.15869140625,
0.78857421875,
1.0263671875,
-0.1986083984375,
1.24609375,
-0.4736328125,
0.12457275390625,
0.43115234375,
-0.0297088623046875,
-0.32373046875,
-0.08270263671875,
-0.12152099609375,
-0.3017578125,
0.5048828125,
0.08868408203125,
-0.39501953125,
0.83154296875,
-0.1114501953125,
0.54833984375,
-0.8115234375,
0.359130859375,
0.53662109375,
0.1324462890625,
0.0577392578125,
0.1763916015625,
0.164306640625,
-0.771484375,
-0.425537109375,
0.8388671875,
-0.51025390625,
-0.041412353515625,
0.409423828125,
0.042938232421875,
-0.287841796875,
0.5390625,
-0.0219268798828125,
0.35009765625,
-0.325927734375,
0.263916015625,
0.78173828125,
-0.55224609375,
0.84228515625,
-0.08587646484375,
-0.00021386146545410156,
1.1279296875,
0.58984375,
0.3447265625,
0.7373046875,
0.143310546875,
-0.68896484375,
0.62939453125,
-0.98193359375,
0.71240234375,
0.088134765625,
0.430908203125,
-0.623046875,
0.279541015625,
-0.2144775390625,
0.255126953125,
0.217529296875,
0.148681640625,
-0.1943359375,
0.428955078125,
-0.43798828125,
1.0400390625,
-0.347900390625,
1.0361328125,
-0.50634765625,
-0.18603515625,
-0.37451171875,
-0.461669921875,
0.205810546875,
-0.387451171875,
-0.146728515625,
0.7373046875,
0.2454833984375,
1.3369140625,
1.1015625,
-0.1905517578125,
0.371826171875,
0.21337890625,
-0.3603515625,
0.332763671875,
0.1715087890625,
0.9287109375,
0.177001953125,
0.324462890625,
0.007091522216796875,
-0.331787109375,
-0.6162109375,
-0.55859375,
0.201171875,
0.5458984375,
-0.896484375,
0.0103302001953125,
0.16357421875,
0.215087890625,
-1.185546875,
0.07159423828125,
0.213623046875,
-0.7802734375,
-0.4404296875,
0.390869140625,
-0.1357421875,
0.464111328125,
-0.4208984375,
-0.28125,
0.5,
1.3115234375,
-0.457763671875,
0.0810546875,
0.609375,
0.277587890625,
0.022918701171875,
0.1419677734375,
0.0765380859375,
-0.298828125,
-1.0029296875,
0.51513671875,
-0.226318359375,
-0.243408203125,
0.33056640625,
0.24609375,
0.39501953125,
0.1639404296875,
-0.44921875,
-0.1070556640625,
0.86474609375,
1.22265625,
-0.08056640625,
0.705078125,
0.0268096923828125,
0.857421875,
0.348388671875,
0.525390625,
0.378662109375,
-0.044219970703125,
0.48876953125,
0.67529296875,
0.169189453125,
0.49951171875,
0.216552734375,
0.283935546875,
0.409423828125,
0.822265625,
0.277099609375,
0.451416015625,
-0.1414794921875,
-0.12432861328125,
-0.39599609375,
0.62548828125,
-0.388916015625,
0.429443359375,
0.0256805419921875,
0.28955078125,
-0.57568359375,
-0.383544921875,
0.41259765625,
0.80126953125,
-0.69140625,
-0.53173828125,
-0.296142578125,
0.43701171875,
0.07330322265625,
0.1314697265625,
0.260009765625,
0.255126953125,
0.260009765625,
0.24853515625,
-0.099609375,
0.04718017578125,
-1.107421875,
-0.52880859375,
-0.9404296875,
-0.4326171875,
-0.5107421875,
-0.29296875,
0.2022705078125,
-0.84814453125,
0.442626953125,
-0.13525390625,
-0.34912109375,
-0.0203857421875,
-0.68603515625,
0.289794921875,
-0.470947265625,
0.73583984375,
-0.86767578125,
0.48486328125,
0.14306640625,
1.12890625,
-0.10394287109375,
-0.30419921875,
-0.296142578125,
-0.63818359375,
0.345458984375,
-0.06439208984375,
0.370361328125,
0.0248870849609375,
-0.91259765625,
-0.8779296875,
-0.09814453125,
-0.4404296875,
-0.220703125,
0.300537109375,
-0.53125,
0.74169921875,
0.287353515625,
-0.59912109375,
0.71728515625,
0.6083984375,
-0.9375,
0.132568359375,
0.1700439453125,
-0.1273193359375,
-1.03515625,
1.3125,
0.57080078125,
0.6328125,
-0.568359375,
-0.2646484375,
-0.392578125,
-0.0159454345703125,
0.246826171875,
-0.5615234375,
-0.37255859375,
0.420166015625,
0.04779052734375,
-1.3466796875,
0.339599609375,
-1.1123046875,
-0.75830078125,
-0.5859375,
-0.5107421875,
0.9287109375,
0.80029296875,
-0.08599853515625,
-0.325439453125,
-0.5849609375,
-0.338134765625,
0.654296875,
0.379150390625,
-0.82080078125,
-0.244384765625,
0.849609375,
-0.09259033203125,
-0.10784912109375,
0.201416015625,
-0.61376953125,
-0.387939453125,
0.046112060546875,
0.5537109375,
0.73046875,
0.261962890625,
0.276611328125,
0.332275390625,
0.48046875,
-0.78271484375,
-0.2939453125,
-0.2037353515625,
0.755859375,
0.388671875,
0.6689453125,
0.429443359375,
-0.72412109375,
-0.79248046875,
-0.9755859375,
0.58251953125,
0.404541015625,
0.89892578125,
-0.63671875,
0.74462890625,
0.363037109375,
-0.52880859375,
0.5712890625,
-0.546875,
0.10577392578125,
1.1708984375,
0.06317138671875,
1.0361328125,
-0.6630859375,
0.158935546875,
-0.28369140625,
0.1458740234375,
1.1064453125,
0.56884765625,
0.279296875,
-0.2003173828125,
-0.7275390625,
-0.21435546875,
-0.10101318359375,
-0.334228515625,
-0.59912109375,
0.1680908203125,
-0.266845703125,
-0.052398681640625,
-0.89111328125,
0.1339111328125,
0.397705078125,
0.56396484375,
-0.005954742431640625,
1.0712890625,
0.298095703125,
0.4599609375,
0.5830078125,
-0.2998046875,
0.2337646484375,
-0.486083984375,
1.2763671875,
-0.1864013671875,
-0.0966796875,
-0.8388671875,
-0.271484375,
-0.243896484375,
-0.107421875,
-0.039154052734375,
0.1951904296875,
-0.7177734375,
0.043670654296875,
0.04656982421875,
0.427734375,
-0.8125,
0.1763916015625,
-0.188232421875,
0.4736328125,
0.408203125,
-0.67138671875,
0.292236328125,
-0.8857421875,
0.51318359375,
0.285400390625,
0.025054931640625,
-0.83203125,
-0.369140625,
-0.88232421875,
-0.9404296875,
-0.052459716796875,
0.66796875,
-0.25830078125,
0.153076171875,
-0.6220703125,
0.229736328125,
0.311767578125,
-0.2376708984375,
0.07891845703125,
-0.123291015625,
0.71044921875,
0.160400390625,
0.82470703125,
-0.51513671875,
-0.376220703125,
0.34375,
-0.97314453125,
0.51806640625,
-0.484130859375,
0.11517333984375,
-0.0251312255859375,
-0.1058349609375,
-0.0836181640625,
0.306396484375,
0.03546142578125,
0.338623046875,
-0.2154541015625,
0.52880859375,
-0.62744140625,
-0.6005859375,
0.669921875,
-0.4052734375,
-0.372802734375,
0.85888671875,
-0.521484375,
0.07867431640625,
0.4228515625,
0.22900390625,
-0.77490234375,
0.1373291015625,
-0.61865234375,
0.6328125,
-0.158447265625,
-0.73876953125,
0.094970703125,
-0.61767578125,
0.5439453125,
-0.11334228515625,
-0.3330078125,
-0.2359619140625,
-1.4580078125,
-0.10137939453125,
-0.0285797119140625,
-0.673828125,
0.35302734375,
0.29150390625,
-0.3740234375,
-0.405517578125,
-0.309326171875,
-0.5,
-0.229248046875,
-0.119384765625,
-0.250732421875,
0.14404296875,
0.410888671875,
1.072265625,
-0.07843017578125,
-0.267578125,
0.2393798828125,
0.19677734375,
-0.3310546875,
-0.5185546875,
-0.57080078125,
-0.05181884765625,
-0.43115234375,
0.10931396484375,
0.55615234375,
-0.09747314453125,
-0.08062744140625,
0.9140625,
-0.2003173828125,
0.1700439453125,
0.430419921875,
-0.354248046875,
1.123046875,
0.2059326171875,
-1.2021484375,
-0.53857421875,
0.7890625,
-0.1864013671875,
0.3583984375,
0.1546630859375,
-1.150390625,
-0.88720703125,
-0.4873046875,
0.120361328125,
-0.6201171875,
-0.057281494140625,
-1.0439453125,
-0.419189453125,
-0.186767578125,
0.71484375,
-0.2188720703125,
-0.271728515625,
0.1519775390625,
-1.0830078125,
0.07635498046875,
-0.6650390625,
0.0662841796875,
-0.69921875,
-0.64111328125,
-0.378662109375,
0.96875,
0.259033203125,
0.297607421875,
-0.20361328125,
-0.07958984375,
0.5478515625,
-0.25537109375,
-0.452392578125,
-0.479736328125,
0.07659912109375,
0.10906982421875,
0.1259765625,
-0.2318115234375,
-0.65576171875,
0.91162109375,
-0.751953125,
0.2861328125,
-0.51953125,
-0.51513671875,
-0.11456298828125,
-0.4453125,
0.974609375,
-0.4033203125,
0.1279296875,
-0.51611328125,
0.39501953125,
0.62353515625,
-0.063720703125,
-0.68994140625,
-0.52978515625,
-0.485595703125,
-1.0908203125,
0.58154296875,
-0.419189453125,
0.381103515625,
-0.35888671875,
-0.03155517578125,
1.1044921875,
-0.669921875,
0.4716796875,
1.45703125,
0.07830810546875,
0.65234375,
-0.462158203125,
0.395263671875,
0.52978515625,
-0.56201171875,
-0.2177734375,
0.1414794921875,
-0.8056640625,
0.6083984375,
-0.343017578125,
-0.94482421875,
-0.81689453125,
0.274169921875,
1.189453125,
-0.313232421875,
0.546875,
-0.030548095703125,
-1.060546875,
-0.767578125,
0.88330078125,
0.21630859375,
0.214599609375,
0.849609375,
-0.48681640625,
-0.2119140625,
-0.2457275390625,
-0.174072265625,
-0.18798828125,
-0.677734375,
0.95361328125,
-0.2174072265625,
-0.64892578125,
0.71875,
0.98193359375,
-0.7568359375,
-0.91064453125,
0.0928955078125,
0.0523681640625,
-0.091552734375,
-0.5380859375,
0.2109375,
0.5703125,
-0.57568359375,
0.1290283203125,
0.51513671875,
-0.54150390625,
0.37353515625,
-0.08746337890625,
0.302978515625,
-0.318115234375,
0.634765625,
0.64697265625,
-0.390869140625,
0.01415252685546875,
-0.677734375,
0.03424072265625,
-0.08624267578125,
0.11724853515625,
0.7314453125,
-0.43310546875,
0.00238037109375,
0.1480712890625,
-0.3388671875,
0.77685546875,
-0.36181640625,
-0.34423828125,
0.3125,
-0.5166015625,
-0.47607421875,
-0.25341796875,
0.474365234375,
-0.142578125,
0.096923828125,
-0.591796875,
-0.07183837890625,
0.49853515625,
0.059112548828125,
-0.08612060546875,
-0.78271484375,
-0.207275390625,
-0.55126953125,
-0.446533203125,
-0.5654296875,
-0.391357421875,
-0.1680908203125,
0.25146484375,
0.2310791015625,
-0.56689453125,
0.0018739700317382812,
0.71484375,
-0.66552734375,
0.83642578125,
-0.5791015625,
0.3369140625,
-0.67041015625,
-0.69970703125,
-0.5400390625,
-0.0855712890625,
-0.9775390625,
0.0850830078125,
-0.6689453125,
0.37744140625,
0.01413726806640625,
0.484375,
-0.0163421630859375,
0.38623046875,
-0.435791015625,
-0.52294921875,
0.30615234375,
-0.36962890625,
-0.275390625,
0.5888671875,
0.6357421875,
-0.07025146484375,
0.10687255859375,
-0.0623779296875,
-0.374267578125,
-0.71533203125,
0.52978515625,
0.52734375,
-0.07940673828125,
-0.35595703125,
0.021240234375,
0.07464599609375,
-1.205078125,
0.2362060546875,
-0.341552734375,
0.275146484375,
0.1527099609375,
-0.7392578125,
0.552734375,
1.1708984375,
-0.37109375,
0.38818359375,
0.415771484375,
0.177978515625,
0.86865234375,
0.038909912109375,
0.294677734375,
0.476318359375,
0.07110595703125,
-0.53369140625,
-0.03631591796875,
0.473388671875,
-0.1707763671875,
0.2369384765625,
-0.12432861328125,
-0.381591796875,
-1.173828125,
-0.11456298828125,
-0.0723876953125,
0.482421875,
0.3603515625,
-0.300048828125,
0.1981201171875,
-0.125244140625,
-0.470703125,
-0.10546875,
-0.87109375,
-0.63671875,
0.6240234375,
-0.07012939453125,
-0.2127685546875,
-0.1429443359375,
-0.79345703125,
-0.10443115234375,
0.2039794921875,
0.1943359375,
-0.1251220703125,
0.5302734375,
-0.755859375,
0.609375,
-0.3408203125,
0.07684326171875,
0.1353759765625,
0.5966796875,
-0.6064453125,
-0.366943359375,
0.409912109375,
1.2509765625,
-0.2236328125,
-0.0031585693359375,
-0.458740234375,
0.42626953125,
-0.36767578125,
0.07525634765625,
-0.482666015625,
0.1917724609375,
-0.373779296875,
0.191650390625,
-1.1015625,
0.256591796875,
-0.12213134765625,
0.56982421875,
0.346923828125,
-0.45947265625,
-0.494873046875,
0.5908203125,
0.52734375,
0.07403564453125,
0.080810546875,
0.3857421875,
0.48779296875,
-0.2337646484375,
0.2001953125,
-0.44287109375,
0.385498046875,
0.472412109375,
0.459228515625,
-0.2271728515625,
0.48193359375,
0.70068359375,
0.27978515625,
-0.25146484375,
0.427734375,
0.07373046875,
-0.154052734375,
-0.0584716796875,
-0.4404296875,
-0.28369140625,
-0.66015625,
-0.7275390625,
0.404052734375,
-0.34423828125,
0.01264190673828125,
-0.184326171875,
-0.7119140625,
0.99560546875,
-0.37890625,
-0.46435546875,
0.302978515625,
-0.2222900390625,
-0.1749267578125,
0.46923828125,
0.219970703125,
-0.341064453125,
0.7080078125,
0.6171875,
0.8720703125,
1.083984375,
0.498046875,
0.0300140380859375,
-0.634765625,
0.29443359375,
-0.10980224609375,
0.21435546875,
-0.2467041015625,
-0.69482421875,
-0.83544921875,
0.36181640625,
-0.552734375,
-0.03924560546875,
0.25390625,
-0.56787109375,
0.1883544921875,
-0.463623046875,
0.64892578125,
-0.75390625,
0.3037109375,
0.38671875,
-0.366943359375,
-1.0341796875,
0.312255859375,
-0.2237548828125,
0.10333251953125,
0.379638671875,
0.84619140625,
0.44140625,
1.205078125,
0.354248046875,
-0.255615234375,
0.041046142578125,
0.480224609375,
-0.046295166015625,
-0.787109375,
-0.1197509765625,
-0.167724609375,
0.2666015625,
-0.2109375,
-0.32666015625,
0.0521240234375,
0.380859375,
0.00806427001953125,
-0.59521484375,
-0.437255859375,
0.18408203125,
-0.51611328125,
0.370361328125,
0.2386474609375,
-0.009674072265625,
-0.413818359375,
-0.041046142578125,
-0.302978515625,
-0.489501953125,
0.18017578125,
-0.5654296875,
0.1258544921875,
-0.6396484375,
-0.5546875,
-0.5029296875,
-0.625,
-0.04486083984375,
-0.255126953125,
-0.8134765625,
-1.0400390625,
0.51611328125,
0.407470703125,
0.59375,
0.4775390625,
-0.047821044921875,
0.115966796875,
1.3408203125,
0.720703125,
0.36669921875,
1.1103515625,
0.32080078125,
-0.051910400390625,
0.34375,
-0.349365234375,
0.615234375,
-0.08929443359375,
-0.0906982421875,
-0.53173828125,
0.39501953125,
-0.52978515625,
-1.16796875,
0.050811767578125,
0.6748046875,
0.55126953125,
-0.9140625,
-1.078125,
-0.037567138671875,
-1.0478515625,
-0.1683349609375,
-0.354248046875,
0.451171875,
-0.0849609375,
0.1361083984375,
-0.47021484375,
-1.322265625,
4.45703125,
1,
0.78515625,
0.11065673828125,
0.233642578125,
1.0478515625,
0.55615234375,
-0.363525390625,
-0.43359375,
-0.68896484375,
0.52783203125,
-0.64453125,
-0.10333251953125,
0.93896484375,
0.17041015625,
0.41748046875,
-0.8603515625,
0.09478759765625,
-0.487060546875,
-0.9208984375,
-0.89453125,
0.320068359375,
0.08856201171875,
0.50634765625,
0.0291595458984375,
0.353759765625,
0.5380859375,
-0.34423828125,
-0.2039794921875,
-0.64990234375,
-0.047698974609375,
-0.465576171875,
0.84326171875,
-0.2491455078125,
-0.50341796875,
0.7861328125,
-0.284912109375,
-0.3994140625,
-0.302001953125,
0.1778564453125,
-0.26318359375,
-0.0214080810546875,
0.46435546875,
-0.5830078125,
0.06085205078125,
0.47998046875,
-0.6025390625,
0.48046875,
0.3818359375,
-0.85986328125,
0.8212890625,
-0.31103515625,
0.433837890625,
-0.94384765625,
-0.826171875,
0.111328125,
-0.11663818359375,
-0.448486328125,
-0.1920166015625,
0.67578125,
0.5224609375,
0.26220703125,
0.306396484375,
0.53369140625,
-0.44921875,
1.0205078125,
-0.06854248046875,
0.488037109375,
-0.357421875,
0.288330078125,
-0.1751708984375,
0.021240234375,
-0.1536865234375,
-0.1558837890625,
0.46826171875,
0.42626953125,
0.075927734375,
0.457275390625,
0.98046875,
-0.74658203125,
0.0733642578125,
-0.181396484375,
-0.2366943359375,
-0.4091796875,
0.28955078125,
1.35546875,
-0.54833984375,
-0.322509765625,
-0.427978515625,
0.62890625,
0.1851806640625,
0.689453125,
0.00872039794921875,
-0.83984375,
-0.4052734375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Submitted Solution:
```
def f(c):
if type(c) == int:
return chr(c + 97)
if type(c) == str:
return ord(c) - 97
def g(s):
r = []
for i in s:
if i not in r:
r.append(i)
if len(r) > 2:
return r
return r
m = [[0] * 26 for i in range(26)]
n = int(input())
for i in range(n):
s = input()
a = g(s)
if len(a) == 1:
m[f(a[0])][f(a[0])] += len(s)
elif len(a) == 2:
m[f(a[0])][f(a[1])] += len(s)
m[f(a[1])][f(a[0])] += len(s)
cnt = 0
for i in range(26):
for j in range(26):
if i == j:
cnt = max(cnt, m[i][j])
else:
cnt = max(cnt, m[i][i] + m[i][j] + m[j][j])
print(cnt)
```
Yes
| 65,215
|
[
0.1658935546875,
0.10888671875,
0.235595703125,
0.5947265625,
-0.77392578125,
-0.1328125,
0.27392578125,
-0.0175628662109375,
0.0701904296875,
0.59423828125,
0.68603515625,
-0.1728515625,
-0.20654296875,
-0.341552734375,
-0.55810546875,
-0.01322174072265625,
-0.658203125,
-0.66552734375,
-0.748046875,
0.0021533966064453125,
0.1739501953125,
-0.3203125,
-1.4072265625,
0.0650634765625,
-0.60546875,
0.98828125,
0.25146484375,
-0.05560302734375,
1.3408203125,
1.2138671875,
-0.1773681640625,
-0.50732421875,
0.2264404296875,
-0.5634765625,
-0.33837890625,
-0.140869140625,
0.7353515625,
-0.9287109375,
-0.412841796875,
-0.28515625,
0.01255035400390625,
-0.56201171875,
0.439453125,
-0.4921875,
-1.1357421875,
-0.16650390625,
-0.219482421875,
-0.359130859375,
-0.2064208984375,
-0.60400390625,
0.38232421875,
-0.256591796875,
0.423583984375,
-0.269775390625,
0.0117034912109375,
-0.040008544921875,
-0.23876953125,
-0.0382080078125,
-0.26025390625,
0.10223388671875,
0.30078125,
0.294921875,
0.0264434814453125,
-0.8310546875,
-0.09063720703125,
0.348876953125,
0.0258331298828125,
0.1473388671875,
0.2235107421875,
-0.07684326171875,
0.03204345703125,
-0.007049560546875,
-0.4033203125,
-0.262451171875,
-0.306884765625,
-0.0174407958984375,
0.43359375,
-0.38330078125,
-0.93017578125,
1.03515625,
-0.06805419921875,
0.666015625,
0.2421875,
-0.06689453125,
-0.444580078125,
-0.279296875,
0.43115234375,
0.328369140625,
0.361328125,
-0.26416015625,
-0.32421875,
0.284912109375,
-0.486328125,
-0.135009765625,
0.77294921875,
0.35986328125,
-0.356689453125,
0.183349609375,
0.23828125,
0.2042236328125,
0.94140625,
0.9736328125,
-0.06756591796875,
1.3173828125,
-0.51171875,
0.21435546875,
0.3984375,
-0.197021484375,
-0.372802734375,
-0.1649169921875,
-0.1141357421875,
-0.369873046875,
0.406005859375,
0.10955810546875,
-0.3994140625,
0.81103515625,
-0.01447296142578125,
0.85400390625,
-0.76904296875,
0.14599609375,
0.47119140625,
0.189208984375,
0.047882080078125,
0.1424560546875,
0.2607421875,
-0.62158203125,
-0.6142578125,
0.830078125,
-0.5693359375,
-0.0594482421875,
0.287841796875,
-0.040435791015625,
-0.43310546875,
0.53857421875,
-0.057952880859375,
0.329833984375,
-0.239990234375,
0.25244140625,
0.76025390625,
-0.5712890625,
0.892578125,
0.042877197265625,
-0.022857666015625,
1.2958984375,
0.41943359375,
0.216064453125,
0.52880859375,
0.16650390625,
-0.66162109375,
0.67333984375,
-0.947265625,
0.66455078125,
0.0296173095703125,
0.381103515625,
-0.79931640625,
0.388916015625,
-0.11798095703125,
0.23095703125,
0.336181640625,
0.0750732421875,
-0.241943359375,
0.384521484375,
-0.5146484375,
0.95166015625,
-0.434814453125,
0.8974609375,
-0.424560546875,
-0.12451171875,
-0.3125,
-0.383544921875,
0.2099609375,
-0.367431640625,
-0.038330078125,
0.75048828125,
0.299072265625,
1.25,
1.068359375,
-0.080810546875,
0.3447265625,
0.1795654296875,
-0.399658203125,
0.271728515625,
0.3173828125,
0.99853515625,
0.1905517578125,
0.3486328125,
-0.1424560546875,
-0.2486572265625,
-0.64306640625,
-0.52587890625,
0.1573486328125,
0.60986328125,
-0.8408203125,
0.112060546875,
-0.09234619140625,
0.17431640625,
-1.162109375,
0.0245819091796875,
0.279541015625,
-0.77587890625,
-0.5703125,
0.364990234375,
-0.06939697265625,
0.6318359375,
-0.361328125,
-0.417236328125,
0.478515625,
1.2333984375,
-0.321533203125,
0.1727294921875,
0.654296875,
0.393310546875,
-0.11163330078125,
-0.06427001953125,
0.302978515625,
-0.263916015625,
-0.904296875,
0.3447265625,
-0.1593017578125,
-0.24462890625,
0.2724609375,
0.238525390625,
0.41015625,
0.1865234375,
-0.57470703125,
-0.0975341796875,
0.8203125,
1.3154296875,
-0.21533203125,
0.6240234375,
0.203369140625,
0.916015625,
0.3564453125,
0.60888671875,
0.36279296875,
-0.09814453125,
0.8251953125,
0.65380859375,
-0.07489013671875,
0.472900390625,
0.18017578125,
0.39892578125,
0.399658203125,
0.9306640625,
0.27490234375,
0.47265625,
-0.13330078125,
-0.269287109375,
-0.388671875,
0.65234375,
-0.27490234375,
0.27978515625,
0.0316162109375,
0.355224609375,
-0.68896484375,
-0.38818359375,
0.459228515625,
0.7080078125,
-0.740234375,
-0.55224609375,
-0.2890625,
0.3896484375,
-0.040252685546875,
0.196044921875,
0.195068359375,
0.238037109375,
0.210205078125,
0.32568359375,
0.054718017578125,
0.09906005859375,
-0.87744140625,
-0.5654296875,
-1.068359375,
-0.37060546875,
-0.6201171875,
-0.3671875,
0.1832275390625,
-0.830078125,
0.446533203125,
-0.2357177734375,
-0.20458984375,
-0.08642578125,
-0.6181640625,
0.356689453125,
-0.4892578125,
0.759765625,
-0.79052734375,
0.40087890625,
0.09881591796875,
1.02734375,
-0.004917144775390625,
-0.281982421875,
-0.323974609375,
-0.62060546875,
0.408447265625,
-0.30517578125,
0.429931640625,
0.0208740234375,
-0.94287109375,
-0.93017578125,
-0.055389404296875,
-0.2113037109375,
-0.236572265625,
0.084228515625,
-0.5419921875,
0.72216796875,
0.09747314453125,
-0.59375,
0.77490234375,
0.53759765625,
-1.0400390625,
0.247314453125,
0.2239990234375,
-0.0216827392578125,
-0.88330078125,
1.1435546875,
0.51904296875,
0.71337890625,
-0.51806640625,
-0.318115234375,
-0.42041015625,
0.0916748046875,
0.2386474609375,
-0.460205078125,
-0.5234375,
0.41552734375,
0.095458984375,
-1.3291015625,
0.393310546875,
-1.1298828125,
-0.84130859375,
-0.55078125,
-0.63671875,
0.87841796875,
0.82861328125,
0.001861572265625,
-0.208740234375,
-0.74560546875,
-0.319091796875,
0.498779296875,
0.404541015625,
-0.89599609375,
-0.2410888671875,
0.8408203125,
-0.1519775390625,
-0.0247955322265625,
0.09600830078125,
-0.65625,
-0.42724609375,
-0.0306854248046875,
0.355224609375,
0.71923828125,
0.129150390625,
0.33544921875,
0.2607421875,
0.5244140625,
-0.8837890625,
-0.314453125,
-0.306640625,
0.7314453125,
0.330322265625,
0.6923828125,
0.55029296875,
-0.46923828125,
-0.6953125,
-0.89794921875,
0.56494140625,
0.390869140625,
0.78369140625,
-0.484619140625,
0.732421875,
0.18505859375,
-0.68701171875,
0.72412109375,
-0.56201171875,
0.2138671875,
1.21484375,
0.07421875,
0.94677734375,
-0.68798828125,
0.15234375,
-0.287353515625,
-0.00777435302734375,
0.9951171875,
0.50244140625,
0.308837890625,
-0.263671875,
-0.576171875,
-0.2056884765625,
-0.2144775390625,
-0.3916015625,
-0.5947265625,
0.115966796875,
-0.2406005859375,
-0.11431884765625,
-0.89697265625,
0.24951171875,
0.336669921875,
0.572265625,
0.13525390625,
1.01953125,
0.284912109375,
0.349853515625,
0.48291015625,
-0.26513671875,
0.367431640625,
-0.459716796875,
1.2763671875,
-0.249267578125,
-0.256591796875,
-0.75537109375,
-0.13037109375,
-0.300537109375,
-0.05694580078125,
-0.07354736328125,
0.290771484375,
-0.78271484375,
0.12432861328125,
-0.023040771484375,
0.322509765625,
-0.86865234375,
0.158447265625,
-0.1439208984375,
0.3662109375,
0.43994140625,
-0.716796875,
0.23681640625,
-0.85400390625,
0.5009765625,
0.39208984375,
-0.10369873046875,
-0.7861328125,
-0.3232421875,
-1.0859375,
-0.92578125,
-0.08935546875,
0.65478515625,
-0.330810546875,
0.126953125,
-0.5947265625,
0.28466796875,
0.384765625,
-0.464111328125,
0.177001953125,
-0.1866455078125,
0.66064453125,
0.181884765625,
0.728515625,
-0.460205078125,
-0.366943359375,
0.36962890625,
-0.912109375,
0.494384765625,
-0.349853515625,
0.2919921875,
0.11114501953125,
-0.060211181640625,
-0.06353759765625,
0.1834716796875,
0.0966796875,
0.416259765625,
-0.125244140625,
0.642578125,
-0.7626953125,
-0.61083984375,
0.64599609375,
-0.273681640625,
-0.33203125,
0.93359375,
-0.4375,
-0.06500244140625,
0.3759765625,
0.2254638671875,
-0.630859375,
0.285400390625,
-0.564453125,
0.5361328125,
-0.040863037109375,
-0.75,
0.146728515625,
-0.57958984375,
0.51611328125,
-0.299072265625,
-0.33740234375,
-0.294677734375,
-1.453125,
-0.1463623046875,
-0.151123046875,
-0.7041015625,
0.338134765625,
0.333251953125,
-0.407470703125,
-0.377197265625,
-0.265380859375,
-0.5888671875,
-0.25830078125,
-0.2012939453125,
-0.279541015625,
-0.111328125,
0.330322265625,
1.01953125,
-0.007415771484375,
-0.186767578125,
0.08172607421875,
0.1114501953125,
-0.39990234375,
-0.50439453125,
-0.54296875,
0.04443359375,
-0.60498046875,
-0.02642822265625,
0.66796875,
-0.167236328125,
-0.036529541015625,
0.83935546875,
-0.1678466796875,
0.2398681640625,
0.343994140625,
-0.462158203125,
1.248046875,
0.115478515625,
-1.373046875,
-0.46826171875,
0.7666015625,
-0.09600830078125,
0.42724609375,
0.0172882080078125,
-1.015625,
-0.9638671875,
-0.603515625,
0.228759765625,
-0.638671875,
-0.1663818359375,
-1.0302734375,
-0.467529296875,
-0.1331787109375,
0.7119140625,
-0.1605224609375,
-0.1787109375,
0.302490234375,
-1.23046875,
0.22998046875,
-0.78369140625,
0.0467529296875,
-0.6611328125,
-0.474609375,
-0.438720703125,
1.07421875,
0.270263671875,
0.33642578125,
-0.20361328125,
0.0921630859375,
0.53076171875,
-0.341796875,
-0.28857421875,
-0.5341796875,
0.050689697265625,
0.123291015625,
0.046142578125,
-0.225830078125,
-0.6396484375,
0.9833984375,
-0.626953125,
0.26318359375,
-0.3447265625,
-0.51611328125,
0.0833740234375,
-0.422119140625,
1.0400390625,
-0.489990234375,
0.1904296875,
-0.55419921875,
0.375732421875,
0.80615234375,
-0.1451416015625,
-0.6572265625,
-0.3310546875,
-0.46923828125,
-1.158203125,
0.55126953125,
-0.35302734375,
0.393798828125,
-0.462890625,
0.015655517578125,
1.1650390625,
-0.6416015625,
0.51416015625,
1.33984375,
0.072265625,
0.58740234375,
-0.484130859375,
0.412353515625,
0.5380859375,
-0.50390625,
-0.184814453125,
0.1080322265625,
-0.78076171875,
0.57373046875,
-0.309326171875,
-0.9697265625,
-0.814453125,
0.286865234375,
1.0869140625,
-0.1903076171875,
0.78271484375,
-0.018402099609375,
-1.134765625,
-0.5546875,
0.75830078125,
0.1343994140625,
0.08709716796875,
0.82568359375,
-0.415283203125,
-0.223388671875,
-0.028472900390625,
-0.230712890625,
-0.225830078125,
-0.66357421875,
0.953125,
-0.269287109375,
-0.70849609375,
0.787109375,
1,
-0.88525390625,
-0.8681640625,
-0.0308837890625,
0.068603515625,
-0.06982421875,
-0.5517578125,
0.233642578125,
0.61669921875,
-0.61669921875,
0.121826171875,
0.39501953125,
-0.587890625,
0.453369140625,
-0.11846923828125,
0.329833984375,
-0.51220703125,
0.5078125,
0.68701171875,
-0.427490234375,
-0.143310546875,
-0.6025390625,
0.17919921875,
-0.15087890625,
0.18115234375,
0.78564453125,
-0.303466796875,
0.050537109375,
0.343994140625,
-0.369140625,
0.83251953125,
-0.375732421875,
-0.1546630859375,
0.28466796875,
-0.60302734375,
-0.50634765625,
-0.286865234375,
0.451171875,
-0.043609619140625,
0.12255859375,
-0.5693359375,
-0.25341796875,
0.450927734375,
0.0670166015625,
-0.1260986328125,
-0.541015625,
-0.282958984375,
-0.44921875,
-0.5498046875,
-0.417724609375,
-0.443115234375,
0.03466796875,
0.400390625,
0.343994140625,
-0.465576171875,
-0.025054931640625,
0.8896484375,
-0.59033203125,
0.798828125,
-0.60791015625,
0.3505859375,
-0.7431640625,
-0.63916015625,
-0.515625,
-0.044158935546875,
-1.0888671875,
-0.1494140625,
-0.443359375,
0.359375,
-0.083984375,
0.313232421875,
-0.04608154296875,
0.352294921875,
-0.31005859375,
-0.3349609375,
0.52978515625,
-0.228759765625,
-0.39794921875,
0.68408203125,
0.55419921875,
-0.01001739501953125,
0.189697265625,
-0.103271484375,
-0.270751953125,
-0.52880859375,
0.73046875,
0.5107421875,
0.037322998046875,
-0.392333984375,
0.173828125,
0.021697998046875,
-1.0068359375,
0.25244140625,
-0.292724609375,
0.314453125,
0.051055908203125,
-0.767578125,
0.445556640625,
1.115234375,
-0.484375,
0.42431640625,
0.5498046875,
0.08697509765625,
0.80859375,
0.1478271484375,
0.300537109375,
0.51513671875,
0.044097900390625,
-0.57470703125,
-0.1051025390625,
0.5908203125,
-0.09613037109375,
0.291259765625,
-0.262939453125,
-0.4482421875,
-1.2822265625,
-0.1361083984375,
-0.00850677490234375,
0.46923828125,
0.421630859375,
-0.290771484375,
0.227294921875,
-0.11639404296875,
-0.52978515625,
-0.0157470703125,
-0.9443359375,
-0.74267578125,
0.70361328125,
-0.08367919921875,
-0.34375,
-0.10162353515625,
-0.8134765625,
-0.07464599609375,
0.22802734375,
0.01467132568359375,
-0.0284423828125,
0.299072265625,
-0.65869140625,
0.5546875,
-0.26123046875,
0.1402587890625,
0.10150146484375,
0.57421875,
-0.69873046875,
-0.408935546875,
0.45361328125,
1.060546875,
-0.2445068359375,
-0.1212158203125,
-0.40234375,
0.406005859375,
-0.377197265625,
-0.0906982421875,
-0.334228515625,
0.25146484375,
-0.1541748046875,
0.33837890625,
-1.0634765625,
0.279541015625,
-0.1326904296875,
0.5146484375,
0.1822509765625,
-0.50146484375,
-0.45751953125,
0.66064453125,
0.65576171875,
0.0191802978515625,
0.01080322265625,
0.37158203125,
0.61962890625,
-0.19091796875,
0.09356689453125,
-0.44482421875,
0.3154296875,
0.5390625,
0.48388671875,
-0.128173828125,
0.67236328125,
0.66552734375,
0.283203125,
-0.0751953125,
0.48974609375,
0.1644287109375,
-0.2144775390625,
-0.09222412109375,
-0.357421875,
-0.22265625,
-0.53125,
-0.759765625,
0.37744140625,
-0.277099609375,
0.0248565673828125,
-0.07305908203125,
-0.5888671875,
1.037109375,
-0.471435546875,
-0.51318359375,
0.227294921875,
-0.2001953125,
-0.0989990234375,
0.42236328125,
0.23876953125,
-0.244384765625,
0.77001953125,
0.64208984375,
0.99951171875,
1.078125,
0.505859375,
-0.20849609375,
-0.75537109375,
0.1766357421875,
0.08990478515625,
0.183837890625,
-0.2578125,
-0.623046875,
-1.01953125,
0.5244140625,
-0.53564453125,
-0.0496826171875,
0.2020263671875,
-0.72265625,
0.1285400390625,
-0.48046875,
0.70849609375,
-0.853515625,
0.2205810546875,
0.244873046875,
-0.31884765625,
-1.0693359375,
0.413818359375,
-0.13720703125,
0.05157470703125,
0.58544921875,
0.8388671875,
0.357666015625,
1.2001953125,
0.468994140625,
-0.2191162109375,
0.01561737060546875,
0.61328125,
-0.064697265625,
-0.80615234375,
-0.05718994140625,
-0.232421875,
0.10858154296875,
-0.2332763671875,
-0.22314453125,
0.0034046173095703125,
0.3046875,
0.1292724609375,
-0.51953125,
-0.61669921875,
0.039642333984375,
-0.442138671875,
0.439208984375,
0.03900146484375,
0.1434326171875,
-0.301513671875,
-0.05523681640625,
-0.46044921875,
-0.517578125,
0.263916015625,
-0.3740234375,
0.12237548828125,
-0.59521484375,
-0.40087890625,
-0.56103515625,
-0.5703125,
0.087890625,
-0.11236572265625,
-0.83349609375,
-0.9970703125,
0.52392578125,
0.4150390625,
0.340087890625,
0.4716796875,
-0.128662109375,
0.1488037109375,
1.248046875,
0.7275390625,
0.15966796875,
1.013671875,
0.385009765625,
0.0177154541015625,
0.1949462890625,
-0.208251953125,
0.61279296875,
-0.07489013671875,
-0.1231689453125,
-0.5439453125,
0.39990234375,
-0.45947265625,
-1.06640625,
0.033355712890625,
0.78369140625,
0.392333984375,
-0.88525390625,
-1.1318359375,
-0.2265625,
-0.9677734375,
-0.0736083984375,
-0.37890625,
0.47607421875,
-0.043060302734375,
0.1751708984375,
-0.420166015625,
-1.2333984375,
4.4609375,
0.90478515625,
0.8017578125,
-0.1268310546875,
0.312255859375,
1.0400390625,
0.53662109375,
-0.69384765625,
-0.24072265625,
-0.82080078125,
0.35595703125,
-0.72021484375,
-0.047515869140625,
0.9169921875,
0.2144775390625,
0.50927734375,
-0.80615234375,
-0.12152099609375,
-0.345703125,
-0.962890625,
-0.95068359375,
0.3466796875,
0.120849609375,
0.447265625,
-0.00571441650390625,
0.4892578125,
0.66015625,
-0.425048828125,
-0.12261962890625,
-0.70654296875,
-0.0797119140625,
-0.45361328125,
0.83984375,
-0.2705078125,
-0.447998046875,
0.7890625,
-0.274658203125,
-0.428955078125,
-0.344482421875,
0.11480712890625,
-0.337890625,
0.003643035888671875,
0.43994140625,
-0.58984375,
0.10943603515625,
0.51220703125,
-0.64990234375,
0.55615234375,
0.305419921875,
-0.95751953125,
0.9013671875,
-0.256591796875,
0.41357421875,
-0.81884765625,
-0.80322265625,
0.116455078125,
-0.058685302734375,
-0.4150390625,
-0.2451171875,
0.52490234375,
0.455810546875,
0.10052490234375,
0.2484130859375,
0.732421875,
-0.544921875,
0.89794921875,
0.095703125,
0.426513671875,
-0.30126953125,
0.2105712890625,
-0.309326171875,
-0.06341552734375,
-0.1241455078125,
-0.1634521484375,
0.537109375,
0.52490234375,
-0.003238677978515625,
0.279296875,
1.005859375,
-0.71630859375,
0.17626953125,
-0.255615234375,
-0.1500244140625,
-0.611328125,
0.316162109375,
1.365234375,
-0.6181640625,
-0.45654296875,
-0.319091796875,
0.6318359375,
0.2496337890625,
0.669921875,
0.07415771484375,
-0.85986328125,
-0.5361328125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Submitted Solution:
```
n = int(input())
a = []
b = []
for i in range(n):
s = input()
a.append(sorted(list(set(s))))
b.append(len(s))
v = 0
for i in range(97,97+25):
for j in range(98,97+26):
u = 0
for k in range(n):
for c in a[k]:
if ord(c) != i and ord(c) != j:
break
else:
u += b[k]
v = max(u, v)
print(v)
```
Yes
| 65,216
|
[
0.156494140625,
0.1199951171875,
0.25,
0.59423828125,
-0.77880859375,
-0.1871337890625,
0.26806640625,
-0.01116180419921875,
0.09912109375,
0.65087890625,
0.68115234375,
-0.12493896484375,
-0.17431640625,
-0.35009765625,
-0.59423828125,
0.01568603515625,
-0.6240234375,
-0.67236328125,
-0.72021484375,
-0.024505615234375,
0.1575927734375,
-0.27294921875,
-1.4267578125,
0.04705810546875,
-0.599609375,
0.99755859375,
0.18408203125,
-0.07830810546875,
1.3427734375,
1.1904296875,
-0.17431640625,
-0.486328125,
0.236572265625,
-0.56689453125,
-0.3427734375,
-0.1474609375,
0.73828125,
-0.900390625,
-0.4091796875,
-0.32763671875,
0.06304931640625,
-0.6162109375,
0.487548828125,
-0.458251953125,
-1.13671875,
-0.1302490234375,
-0.1810302734375,
-0.399169921875,
-0.25830078125,
-0.6123046875,
0.35205078125,
-0.30419921875,
0.4697265625,
-0.232666015625,
0.006435394287109375,
-0.056243896484375,
-0.220947265625,
-0.03106689453125,
-0.277099609375,
0.1290283203125,
0.31005859375,
0.329345703125,
0.052093505859375,
-0.82763671875,
-0.1319580078125,
0.309814453125,
0.0433349609375,
0.17041015625,
0.253173828125,
-0.05096435546875,
-0.0149078369140625,
-0.0094146728515625,
-0.331298828125,
-0.2283935546875,
-0.313232421875,
0.015960693359375,
0.406982421875,
-0.38525390625,
-0.9287109375,
1.015625,
-0.1063232421875,
0.64892578125,
0.2509765625,
-0.11492919921875,
-0.468994140625,
-0.28515625,
0.43701171875,
0.360595703125,
0.4296875,
-0.248779296875,
-0.339599609375,
0.301025390625,
-0.496826171875,
-0.10113525390625,
0.7529296875,
0.39013671875,
-0.364990234375,
0.198974609375,
0.2083740234375,
0.23388671875,
0.908203125,
0.982421875,
-0.0908203125,
1.3359375,
-0.5341796875,
0.1827392578125,
0.35791015625,
-0.215087890625,
-0.33935546875,
-0.2171630859375,
-0.127197265625,
-0.327392578125,
0.400146484375,
0.10406494140625,
-0.43212890625,
0.78955078125,
0.0006184577941894531,
0.8232421875,
-0.79296875,
0.1978759765625,
0.5302734375,
0.155029296875,
0.0841064453125,
0.15625,
0.26220703125,
-0.63623046875,
-0.6162109375,
0.79931640625,
-0.591796875,
-0.075927734375,
0.30859375,
-0.0172271728515625,
-0.441650390625,
0.57080078125,
-0.0748291015625,
0.313232421875,
-0.189697265625,
0.23193359375,
0.7744140625,
-0.52734375,
0.88427734375,
0.0343017578125,
-0.049560546875,
1.2939453125,
0.409912109375,
0.2236328125,
0.5263671875,
0.19775390625,
-0.67529296875,
0.654296875,
-0.97119140625,
0.6787109375,
0.014923095703125,
0.409912109375,
-0.74853515625,
0.358642578125,
-0.135498046875,
0.1904296875,
0.327392578125,
0.03485107421875,
-0.2398681640625,
0.33154296875,
-0.51220703125,
0.974609375,
-0.432861328125,
0.8828125,
-0.47705078125,
-0.12408447265625,
-0.2783203125,
-0.402587890625,
0.1944580078125,
-0.362548828125,
-0.056549072265625,
0.765625,
0.266357421875,
1.28515625,
1.041015625,
-0.11962890625,
0.341796875,
0.136474609375,
-0.385498046875,
0.284912109375,
0.24755859375,
1.0283203125,
0.212890625,
0.362548828125,
-0.13427734375,
-0.240234375,
-0.642578125,
-0.53271484375,
0.193115234375,
0.61181640625,
-0.85009765625,
0.114013671875,
-0.115478515625,
0.1734619140625,
-1.142578125,
0.0516357421875,
0.309326171875,
-0.77880859375,
-0.54345703125,
0.382080078125,
-0.0308990478515625,
0.62109375,
-0.37841796875,
-0.389892578125,
0.4150390625,
1.2216796875,
-0.346923828125,
0.140625,
0.66796875,
0.3876953125,
-0.0618896484375,
-0.06109619140625,
0.29052734375,
-0.31689453125,
-0.95654296875,
0.342041015625,
-0.174072265625,
-0.2342529296875,
0.264404296875,
0.239013671875,
0.388916015625,
0.163330078125,
-0.56396484375,
-0.05999755859375,
0.857421875,
1.3212890625,
-0.2388916015625,
0.64501953125,
0.1529541015625,
0.89794921875,
0.343994140625,
0.60888671875,
0.389404296875,
-0.054443359375,
0.7822265625,
0.64453125,
-0.079833984375,
0.457275390625,
0.19287109375,
0.42578125,
0.389404296875,
0.9306640625,
0.256591796875,
0.490966796875,
-0.11651611328125,
-0.2239990234375,
-0.38916015625,
0.65966796875,
-0.328369140625,
0.3798828125,
0.04296875,
0.41357421875,
-0.65234375,
-0.33740234375,
0.4658203125,
0.7236328125,
-0.7392578125,
-0.58251953125,
-0.289794921875,
0.41943359375,
0.0024929046630859375,
0.1934814453125,
0.2030029296875,
0.219482421875,
0.2225341796875,
0.293701171875,
0.10418701171875,
0.0911865234375,
-0.8720703125,
-0.57763671875,
-1.0791015625,
-0.37744140625,
-0.5791015625,
-0.38037109375,
0.1708984375,
-0.8671875,
0.4130859375,
-0.236328125,
-0.2142333984375,
-0.11785888671875,
-0.57177734375,
0.403076171875,
-0.495361328125,
0.7587890625,
-0.75927734375,
0.428955078125,
0.10498046875,
1.025390625,
-0.056243896484375,
-0.306884765625,
-0.33984375,
-0.61376953125,
0.398193359375,
-0.26904296875,
0.467041015625,
0.088134765625,
-0.92724609375,
-0.94873046875,
-0.11798095703125,
-0.3037109375,
-0.1998291015625,
0.09722900390625,
-0.58203125,
0.80859375,
0.1622314453125,
-0.59912109375,
0.7197265625,
0.53662109375,
-0.9755859375,
0.269775390625,
0.2432861328125,
-0.0096435546875,
-0.90087890625,
1.1591796875,
0.50390625,
0.703125,
-0.53466796875,
-0.321533203125,
-0.386962890625,
0.07379150390625,
0.2388916015625,
-0.475830078125,
-0.463134765625,
0.393310546875,
0.0799560546875,
-1.3740234375,
0.38134765625,
-1.1181640625,
-0.853515625,
-0.58740234375,
-0.6220703125,
0.861328125,
0.841796875,
0.0230560302734375,
-0.22216796875,
-0.75537109375,
-0.302978515625,
0.50927734375,
0.420654296875,
-0.876953125,
-0.2401123046875,
0.873046875,
-0.1383056640625,
-0.0275421142578125,
0.14453125,
-0.64990234375,
-0.411865234375,
-0.01071929931640625,
0.3876953125,
0.736328125,
0.1865234375,
0.296630859375,
0.26806640625,
0.54638671875,
-0.87939453125,
-0.3154296875,
-0.309326171875,
0.75146484375,
0.3251953125,
0.712890625,
0.55322265625,
-0.466796875,
-0.70068359375,
-0.96337890625,
0.6240234375,
0.390625,
0.82470703125,
-0.533203125,
0.7509765625,
0.2132568359375,
-0.72314453125,
0.66650390625,
-0.572265625,
0.2083740234375,
1.201171875,
0.06201171875,
0.96826171875,
-0.68701171875,
0.144287109375,
-0.311279296875,
0.0029888153076171875,
1.01171875,
0.5400390625,
0.337646484375,
-0.2440185546875,
-0.58349609375,
-0.1832275390625,
-0.1981201171875,
-0.383056640625,
-0.6005859375,
0.118408203125,
-0.271484375,
-0.1297607421875,
-0.91357421875,
0.208740234375,
0.337646484375,
0.57080078125,
0.129638671875,
1.0244140625,
0.280029296875,
0.320068359375,
0.49560546875,
-0.28271484375,
0.3544921875,
-0.474365234375,
1.2919921875,
-0.21826171875,
-0.1865234375,
-0.76416015625,
-0.1934814453125,
-0.310791015625,
-0.08551025390625,
-0.07305908203125,
0.2802734375,
-0.78076171875,
0.09295654296875,
-0.00963592529296875,
0.363525390625,
-0.8681640625,
0.1475830078125,
-0.1806640625,
0.390869140625,
0.483642578125,
-0.72509765625,
0.2227783203125,
-0.87158203125,
0.49609375,
0.350341796875,
-0.11041259765625,
-0.8193359375,
-0.29638671875,
-1.0830078125,
-0.93603515625,
-0.0648193359375,
0.67431640625,
-0.35302734375,
0.0816650390625,
-0.57666015625,
0.269287109375,
0.400390625,
-0.46142578125,
0.1912841796875,
-0.188232421875,
0.650390625,
0.1402587890625,
0.740234375,
-0.442138671875,
-0.34521484375,
0.361328125,
-0.9111328125,
0.50927734375,
-0.351318359375,
0.2900390625,
0.07470703125,
-0.0254669189453125,
-0.05303955078125,
0.1849365234375,
0.11566162109375,
0.42822265625,
-0.1270751953125,
0.62548828125,
-0.748046875,
-0.6416015625,
0.67041015625,
-0.277099609375,
-0.35986328125,
0.93359375,
-0.434814453125,
-0.06317138671875,
0.354736328125,
0.218017578125,
-0.708984375,
0.262451171875,
-0.560546875,
0.515625,
-0.0697021484375,
-0.736328125,
0.1375732421875,
-0.5634765625,
0.5205078125,
-0.258544921875,
-0.3681640625,
-0.269775390625,
-1.4619140625,
-0.1119384765625,
-0.12091064453125,
-0.7392578125,
0.337890625,
0.3583984375,
-0.4169921875,
-0.405517578125,
-0.29052734375,
-0.60107421875,
-0.2919921875,
-0.1942138671875,
-0.263916015625,
-0.07275390625,
0.3203125,
1.01171875,
0.050201416015625,
-0.2078857421875,
0.129150390625,
0.038604736328125,
-0.352294921875,
-0.46533203125,
-0.53759765625,
0.06512451171875,
-0.5673828125,
-0.038543701171875,
0.65771484375,
-0.132080078125,
-0.04583740234375,
0.85986328125,
-0.167236328125,
0.2330322265625,
0.406005859375,
-0.4541015625,
1.216796875,
0.13232421875,
-1.3330078125,
-0.47509765625,
0.7451171875,
-0.114501953125,
0.449462890625,
0.037200927734375,
-1.0341796875,
-0.99169921875,
-0.6103515625,
0.2135009765625,
-0.60546875,
-0.15771484375,
-1.0146484375,
-0.483642578125,
-0.1802978515625,
0.71240234375,
-0.1904296875,
-0.1634521484375,
0.27880859375,
-1.2646484375,
0.242919921875,
-0.77490234375,
0.0911865234375,
-0.65869140625,
-0.50537109375,
-0.4208984375,
1.046875,
0.280517578125,
0.342529296875,
-0.142333984375,
0.040679931640625,
0.5126953125,
-0.33642578125,
-0.328125,
-0.495361328125,
0.05340576171875,
0.138916015625,
0.06719970703125,
-0.276123046875,
-0.6396484375,
0.97998046875,
-0.66943359375,
0.26220703125,
-0.35107421875,
-0.5146484375,
0.07757568359375,
-0.458740234375,
1.068359375,
-0.462890625,
0.172119140625,
-0.58349609375,
0.35546875,
0.806640625,
-0.115478515625,
-0.66259765625,
-0.3505859375,
-0.447998046875,
-1.1142578125,
0.54150390625,
-0.380615234375,
0.417724609375,
-0.47119140625,
0.0206298828125,
1.1728515625,
-0.6298828125,
0.55224609375,
1.40234375,
0.06976318359375,
0.61328125,
-0.48291015625,
0.365234375,
0.51416015625,
-0.52880859375,
-0.164306640625,
0.10443115234375,
-0.8212890625,
0.53466796875,
-0.30859375,
-0.96923828125,
-0.85791015625,
0.290283203125,
1.12109375,
-0.218017578125,
0.73291015625,
-0.060394287109375,
-1.1435546875,
-0.58349609375,
0.79248046875,
0.10760498046875,
0.0567626953125,
0.8115234375,
-0.413818359375,
-0.2310791015625,
-0.032562255859375,
-0.2115478515625,
-0.242431640625,
-0.6552734375,
0.94091796875,
-0.1961669921875,
-0.70068359375,
0.78955078125,
1.0087890625,
-0.89404296875,
-0.89111328125,
-0.0164642333984375,
0.1036376953125,
-0.0149993896484375,
-0.583984375,
0.2174072265625,
0.65576171875,
-0.62158203125,
0.1416015625,
0.386962890625,
-0.5810546875,
0.4619140625,
-0.0841064453125,
0.3681640625,
-0.50048828125,
0.50390625,
0.7041015625,
-0.429443359375,
-0.11224365234375,
-0.63427734375,
0.10626220703125,
-0.138427734375,
0.17333984375,
0.76220703125,
-0.26318359375,
0.05438232421875,
0.34619140625,
-0.36572265625,
0.8720703125,
-0.406982421875,
-0.1710205078125,
0.295654296875,
-0.62744140625,
-0.517578125,
-0.283935546875,
0.463623046875,
-0.0849609375,
0.10205078125,
-0.61083984375,
-0.2186279296875,
0.456298828125,
0.07666015625,
-0.132080078125,
-0.5732421875,
-0.311279296875,
-0.4970703125,
-0.53515625,
-0.475830078125,
-0.38232421875,
0.007343292236328125,
0.395263671875,
0.37646484375,
-0.4755859375,
-0.0126190185546875,
0.8896484375,
-0.6513671875,
0.76318359375,
-0.5791015625,
0.350830078125,
-0.75244140625,
-0.65966796875,
-0.50927734375,
-0.0228271484375,
-1.083984375,
-0.1580810546875,
-0.438720703125,
0.384033203125,
-0.0986328125,
0.277099609375,
-0.03875732421875,
0.38916015625,
-0.311767578125,
-0.31396484375,
0.53515625,
-0.255859375,
-0.421630859375,
0.7099609375,
0.57666015625,
-0.022430419921875,
0.1556396484375,
-0.07379150390625,
-0.244384765625,
-0.51513671875,
0.74609375,
0.5048828125,
0.04705810546875,
-0.397216796875,
0.17529296875,
0.034942626953125,
-1.0205078125,
0.2481689453125,
-0.28125,
0.311279296875,
0.06976318359375,
-0.79443359375,
0.443115234375,
1.1591796875,
-0.459716796875,
0.45849609375,
0.541015625,
0.145751953125,
0.8037109375,
0.1292724609375,
0.298095703125,
0.54248046875,
0.053802490234375,
-0.5830078125,
-0.08892822265625,
0.5751953125,
-0.06427001953125,
0.285400390625,
-0.26953125,
-0.47900390625,
-1.28125,
-0.1298828125,
-0.005474090576171875,
0.52783203125,
0.40966796875,
-0.297119140625,
0.2213134765625,
-0.08758544921875,
-0.52392578125,
-0.061370849609375,
-0.95068359375,
-0.7197265625,
0.6796875,
-0.06903076171875,
-0.307861328125,
-0.1138916015625,
-0.8408203125,
-0.086669921875,
0.1875,
0.046875,
-0.07855224609375,
0.325927734375,
-0.67431640625,
0.5712890625,
-0.2822265625,
0.1728515625,
0.12298583984375,
0.546875,
-0.69287109375,
-0.391357421875,
0.4130859375,
1.095703125,
-0.263427734375,
-0.105712890625,
-0.41259765625,
0.392578125,
-0.38330078125,
-0.06390380859375,
-0.274658203125,
0.229736328125,
-0.1900634765625,
0.301025390625,
-1.064453125,
0.28466796875,
-0.1373291015625,
0.52294921875,
0.168212890625,
-0.464111328125,
-0.5078125,
0.63525390625,
0.67724609375,
0.044403076171875,
0.0345458984375,
0.298095703125,
0.6162109375,
-0.1534423828125,
0.10687255859375,
-0.47265625,
0.33251953125,
0.5458984375,
0.5009765625,
-0.124755859375,
0.64453125,
0.7275390625,
0.313232421875,
-0.056243896484375,
0.5439453125,
0.19140625,
-0.210693359375,
-0.0791015625,
-0.395263671875,
-0.201904296875,
-0.59033203125,
-0.71826171875,
0.347412109375,
-0.31689453125,
-0.007389068603515625,
-0.08416748046875,
-0.60693359375,
1.0205078125,
-0.50390625,
-0.49658203125,
0.193359375,
-0.2379150390625,
-0.094482421875,
0.461669921875,
0.259033203125,
-0.2474365234375,
0.74658203125,
0.6328125,
0.9794921875,
1.060546875,
0.499755859375,
-0.185546875,
-0.7431640625,
0.1556396484375,
0.050140380859375,
0.1466064453125,
-0.2408447265625,
-0.59228515625,
-1.015625,
0.53955078125,
-0.53271484375,
-0.01387786865234375,
0.201171875,
-0.76806640625,
0.11328125,
-0.4931640625,
0.70703125,
-0.86376953125,
0.264892578125,
0.25048828125,
-0.3388671875,
-1.064453125,
0.43310546875,
-0.1287841796875,
0.07080078125,
0.556640625,
0.83642578125,
0.390869140625,
1.2216796875,
0.46630859375,
-0.252685546875,
0.026031494140625,
0.5732421875,
-0.08197021484375,
-0.7587890625,
-0.094482421875,
-0.225341796875,
0.0210723876953125,
-0.209228515625,
-0.23974609375,
-0.016326904296875,
0.3623046875,
0.128662109375,
-0.541015625,
-0.650390625,
0.058624267578125,
-0.43310546875,
0.4287109375,
0.039642333984375,
0.14111328125,
-0.32568359375,
-0.06402587890625,
-0.437255859375,
-0.52880859375,
0.263671875,
-0.390380859375,
0.10821533203125,
-0.560546875,
-0.420166015625,
-0.5390625,
-0.56201171875,
0.0482177734375,
-0.1324462890625,
-0.8125,
-0.98974609375,
0.505859375,
0.409423828125,
0.389404296875,
0.460693359375,
-0.157470703125,
0.1727294921875,
1.244140625,
0.71044921875,
0.1983642578125,
1.0322265625,
0.328125,
0.00984954833984375,
0.209228515625,
-0.2275390625,
0.623046875,
-0.061187744140625,
-0.0804443359375,
-0.52783203125,
0.387451171875,
-0.5048828125,
-1.0986328125,
0.0230255126953125,
0.76806640625,
0.37255859375,
-0.92236328125,
-1.1083984375,
-0.263427734375,
-0.9833984375,
-0.083740234375,
-0.389892578125,
0.51025390625,
-0.056304931640625,
0.16748046875,
-0.41943359375,
-1.171875,
4.44140625,
0.958984375,
0.763671875,
-0.1114501953125,
0.318115234375,
1.013671875,
0.513671875,
-0.63916015625,
-0.2265625,
-0.82373046875,
0.383056640625,
-0.70947265625,
-0.0170745849609375,
0.9541015625,
0.2008056640625,
0.499267578125,
-0.84375,
-0.146484375,
-0.35498046875,
-0.93798828125,
-0.98291015625,
0.369873046875,
0.133056640625,
0.42431640625,
0.0174560546875,
0.44775390625,
0.6513671875,
-0.474609375,
-0.12310791015625,
-0.669921875,
-0.03570556640625,
-0.431396484375,
0.85302734375,
-0.273681640625,
-0.45068359375,
0.77587890625,
-0.2332763671875,
-0.42333984375,
-0.31689453125,
0.156982421875,
-0.35400390625,
0.01467132568359375,
0.436279296875,
-0.6025390625,
0.061553955078125,
0.5224609375,
-0.63671875,
0.55322265625,
0.296142578125,
-0.92822265625,
0.92578125,
-0.26611328125,
0.4169921875,
-0.83935546875,
-0.85546875,
0.106689453125,
-0.050384521484375,
-0.412353515625,
-0.2459716796875,
0.54736328125,
0.48876953125,
0.11895751953125,
0.2379150390625,
0.68310546875,
-0.564453125,
0.908203125,
0.055206298828125,
0.42138671875,
-0.326904296875,
0.2193603515625,
-0.280029296875,
-0.054290771484375,
-0.10736083984375,
-0.182373046875,
0.5126953125,
0.55029296875,
-0.042938232421875,
0.28515625,
1.0419921875,
-0.7509765625,
0.14208984375,
-0.2349853515625,
-0.1505126953125,
-0.5654296875,
0.29150390625,
1.341796875,
-0.59912109375,
-0.45703125,
-0.34033203125,
0.62548828125,
0.24853515625,
0.72216796875,
0.043701171875,
-0.857421875,
-0.541015625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Submitted Solution:
```
n=int(input())
i=0
x=[]
while i<n:
x.append(str(input()))
i+=1
i=25
r=0
while i:
j=i
while j:
j-=1
t=0
k=n
while k:
k-=1
y=x[k]
z=len(y)
ok=1
while z:
z-=1
if ord(y[z])-ord('a')!=i:
if ord(y[z])-ord('a')!=j:ok=0
if ok:t+=len(y)
if r<t:r=t
i-=1
print(r)
```
Yes
| 65,217
|
[
0.1578369140625,
0.1300048828125,
0.23388671875,
0.59375,
-0.79736328125,
-0.2066650390625,
0.23779296875,
-0.01526641845703125,
0.103759765625,
0.642578125,
0.65673828125,
-0.1063232421875,
-0.1856689453125,
-0.335205078125,
-0.59033203125,
0.0325927734375,
-0.603515625,
-0.6767578125,
-0.71142578125,
-0.00658416748046875,
0.1373291015625,
-0.277099609375,
-1.42578125,
0.08056640625,
-0.62646484375,
0.99072265625,
0.1981201171875,
-0.06585693359375,
1.33203125,
1.16015625,
-0.209228515625,
-0.481689453125,
0.2142333984375,
-0.58740234375,
-0.35009765625,
-0.128173828125,
0.748046875,
-0.8984375,
-0.40380859375,
-0.325927734375,
0.06805419921875,
-0.5927734375,
0.475830078125,
-0.468994140625,
-1.1171875,
-0.11968994140625,
-0.19140625,
-0.401611328125,
-0.2509765625,
-0.59033203125,
0.375,
-0.304443359375,
0.453369140625,
-0.228271484375,
0.025543212890625,
-0.039581298828125,
-0.21484375,
-0.038299560546875,
-0.26904296875,
0.1259765625,
0.32666015625,
0.304443359375,
0.0626220703125,
-0.86474609375,
-0.1348876953125,
0.3134765625,
0.022918701171875,
0.1470947265625,
0.2366943359375,
-0.03448486328125,
-0.00897216796875,
-0.04144287109375,
-0.348388671875,
-0.2093505859375,
-0.30078125,
0.006114959716796875,
0.412109375,
-0.41796875,
-0.9384765625,
0.9951171875,
-0.12274169921875,
0.6455078125,
0.253662109375,
-0.10272216796875,
-0.45654296875,
-0.29541015625,
0.447509765625,
0.357666015625,
0.412841796875,
-0.2266845703125,
-0.331298828125,
0.317138671875,
-0.48291015625,
-0.107421875,
0.75390625,
0.396484375,
-0.35693359375,
0.2171630859375,
0.2066650390625,
0.20654296875,
0.91796875,
0.9765625,
-0.06964111328125,
1.337890625,
-0.53466796875,
0.1851806640625,
0.35400390625,
-0.2139892578125,
-0.336669921875,
-0.219970703125,
-0.09259033203125,
-0.324462890625,
0.400146484375,
0.1055908203125,
-0.47216796875,
0.8046875,
0.006381988525390625,
0.83251953125,
-0.79638671875,
0.1910400390625,
0.53955078125,
0.1474609375,
0.0833740234375,
0.166259765625,
0.254638671875,
-0.6552734375,
-0.6171875,
0.83544921875,
-0.599609375,
-0.10162353515625,
0.30712890625,
-0.03155517578125,
-0.444580078125,
0.5673828125,
-0.08050537109375,
0.32080078125,
-0.1968994140625,
0.2308349609375,
0.78955078125,
-0.53662109375,
0.8740234375,
0.01983642578125,
-0.03924560546875,
1.302734375,
0.444580078125,
0.2320556640625,
0.5068359375,
0.1905517578125,
-0.6484375,
0.64404296875,
-0.9560546875,
0.68115234375,
-0.0089569091796875,
0.40576171875,
-0.775390625,
0.350830078125,
-0.12939453125,
0.213623046875,
0.32958984375,
0.0150909423828125,
-0.2294921875,
0.339599609375,
-0.51611328125,
0.95703125,
-0.447998046875,
0.87158203125,
-0.45458984375,
-0.1336669921875,
-0.2900390625,
-0.400390625,
0.2333984375,
-0.356201171875,
-0.0202178955078125,
0.728515625,
0.277587890625,
1.2939453125,
1.0693359375,
-0.1126708984375,
0.377197265625,
0.1502685546875,
-0.41015625,
0.2509765625,
0.2459716796875,
1.03125,
0.2318115234375,
0.3515625,
-0.145751953125,
-0.23095703125,
-0.64892578125,
-0.56396484375,
0.1981201171875,
0.6298828125,
-0.87451171875,
0.10003662109375,
-0.112060546875,
0.177490234375,
-1.1279296875,
0.029632568359375,
0.318603515625,
-0.7705078125,
-0.55712890625,
0.39501953125,
-0.03436279296875,
0.62646484375,
-0.40869140625,
-0.365478515625,
0.40185546875,
1.2294921875,
-0.3447265625,
0.15869140625,
0.67724609375,
0.41796875,
-0.04864501953125,
-0.08111572265625,
0.302490234375,
-0.30712890625,
-0.94677734375,
0.32861328125,
-0.1866455078125,
-0.238525390625,
0.258544921875,
0.2423095703125,
0.37158203125,
0.162353515625,
-0.57080078125,
-0.08282470703125,
0.84521484375,
1.337890625,
-0.26806640625,
0.64599609375,
0.1658935546875,
0.87841796875,
0.355224609375,
0.63916015625,
0.375732421875,
-0.036895751953125,
0.82666015625,
0.63818359375,
-0.08172607421875,
0.44677734375,
0.1888427734375,
0.419189453125,
0.393798828125,
0.93212890625,
0.284912109375,
0.482177734375,
-0.12176513671875,
-0.242431640625,
-0.3935546875,
0.6416015625,
-0.304931640625,
0.37158203125,
0.057586669921875,
0.407470703125,
-0.6494140625,
-0.332275390625,
0.473876953125,
0.7216796875,
-0.73974609375,
-0.61865234375,
-0.29052734375,
0.41650390625,
-0.007312774658203125,
0.2003173828125,
0.2010498046875,
0.181396484375,
0.203369140625,
0.292724609375,
0.0977783203125,
0.1011962890625,
-0.8671875,
-0.61474609375,
-1.0712890625,
-0.383544921875,
-0.6044921875,
-0.3837890625,
0.1844482421875,
-0.85546875,
0.40185546875,
-0.2095947265625,
-0.224609375,
-0.1312255859375,
-0.56201171875,
0.405029296875,
-0.48291015625,
0.7783203125,
-0.77734375,
0.43994140625,
0.10906982421875,
1.025390625,
-0.07373046875,
-0.32275390625,
-0.330322265625,
-0.61767578125,
0.415283203125,
-0.30419921875,
0.42724609375,
0.06964111328125,
-0.93212890625,
-0.93310546875,
-0.11962890625,
-0.277099609375,
-0.2020263671875,
0.10455322265625,
-0.5751953125,
0.83544921875,
0.1494140625,
-0.61083984375,
0.7373046875,
0.5595703125,
-0.97509765625,
0.29443359375,
0.26318359375,
-0.010406494140625,
-0.89892578125,
1.1884765625,
0.52392578125,
0.6943359375,
-0.5224609375,
-0.322021484375,
-0.37890625,
0.08514404296875,
0.2158203125,
-0.50537109375,
-0.450439453125,
0.392822265625,
0.05517578125,
-1.357421875,
0.358642578125,
-1.1533203125,
-0.8564453125,
-0.57275390625,
-0.607421875,
0.88037109375,
0.83740234375,
0.0023403167724609375,
-0.2308349609375,
-0.76953125,
-0.302978515625,
0.5029296875,
0.4521484375,
-0.90087890625,
-0.230712890625,
0.8818359375,
-0.1246337890625,
-0.01708984375,
0.15234375,
-0.6796875,
-0.406005859375,
0.0079803466796875,
0.36865234375,
0.74755859375,
0.1766357421875,
0.2880859375,
0.2568359375,
0.54541015625,
-0.90673828125,
-0.330322265625,
-0.343505859375,
0.732421875,
0.320068359375,
0.7138671875,
0.55322265625,
-0.471435546875,
-0.74462890625,
-0.91650390625,
0.61279296875,
0.373046875,
0.8330078125,
-0.529296875,
0.76220703125,
0.2122802734375,
-0.708984375,
0.68115234375,
-0.568359375,
0.1890869140625,
1.205078125,
0.0633544921875,
0.91796875,
-0.7021484375,
0.1239013671875,
-0.310302734375,
0.005924224853515625,
1.029296875,
0.53759765625,
0.364013671875,
-0.243408203125,
-0.59130859375,
-0.180908203125,
-0.1588134765625,
-0.349365234375,
-0.60546875,
0.10760498046875,
-0.2724609375,
-0.1243896484375,
-0.927734375,
0.2158203125,
0.3173828125,
0.56787109375,
0.10784912109375,
1.013671875,
0.254150390625,
0.356201171875,
0.492919921875,
-0.2841796875,
0.325439453125,
-0.466796875,
1.263671875,
-0.1947021484375,
-0.183837890625,
-0.7783203125,
-0.2047119140625,
-0.3154296875,
-0.07470703125,
-0.0499267578125,
0.268310546875,
-0.7607421875,
0.08319091796875,
0.00010287761688232422,
0.362548828125,
-0.86669921875,
0.1395263671875,
-0.171142578125,
0.38623046875,
0.496826171875,
-0.73828125,
0.2401123046875,
-0.88623046875,
0.505859375,
0.39697265625,
-0.12176513671875,
-0.8173828125,
-0.29931640625,
-1.072265625,
-0.96533203125,
-0.0828857421875,
0.68505859375,
-0.333984375,
0.0643310546875,
-0.59423828125,
0.294921875,
0.455810546875,
-0.497802734375,
0.1925048828125,
-0.1943359375,
0.64599609375,
0.1588134765625,
0.74169921875,
-0.418701171875,
-0.34765625,
0.35205078125,
-0.89990234375,
0.50244140625,
-0.3486328125,
0.297119140625,
0.10931396484375,
-0.02099609375,
-0.056121826171875,
0.2030029296875,
0.12286376953125,
0.44482421875,
-0.1456298828125,
0.630859375,
-0.77001953125,
-0.6435546875,
0.7080078125,
-0.244384765625,
-0.36181640625,
0.9658203125,
-0.42333984375,
-0.06988525390625,
0.350830078125,
0.228515625,
-0.7177734375,
0.270751953125,
-0.54443359375,
0.52734375,
-0.06475830078125,
-0.74462890625,
0.1373291015625,
-0.5537109375,
0.51611328125,
-0.2388916015625,
-0.3974609375,
-0.27734375,
-1.455078125,
-0.09381103515625,
-0.10223388671875,
-0.74462890625,
0.323486328125,
0.362548828125,
-0.404052734375,
-0.368408203125,
-0.28173828125,
-0.6171875,
-0.282470703125,
-0.1856689453125,
-0.2310791015625,
-0.0791015625,
0.3251953125,
1.0048828125,
0.0367431640625,
-0.2213134765625,
0.1531982421875,
0.038726806640625,
-0.35498046875,
-0.47705078125,
-0.53369140625,
0.07244873046875,
-0.595703125,
-0.040283203125,
0.66845703125,
-0.12420654296875,
-0.0201263427734375,
0.86572265625,
-0.1451416015625,
0.2188720703125,
0.393798828125,
-0.427978515625,
1.2314453125,
0.1385498046875,
-1.345703125,
-0.474609375,
0.7578125,
-0.0838623046875,
0.464599609375,
0.0177459716796875,
-1.0546875,
-0.984375,
-0.6259765625,
0.2213134765625,
-0.609375,
-0.1484375,
-1.01953125,
-0.49951171875,
-0.1649169921875,
0.71728515625,
-0.1781005859375,
-0.178955078125,
0.274658203125,
-1.255859375,
0.2210693359375,
-0.79833984375,
0.10662841796875,
-0.6611328125,
-0.49853515625,
-0.421875,
1.04296875,
0.289306640625,
0.33447265625,
-0.1497802734375,
0.060577392578125,
0.5146484375,
-0.300048828125,
-0.32080078125,
-0.4931640625,
0.07476806640625,
0.1285400390625,
0.07733154296875,
-0.27197265625,
-0.6513671875,
0.9638671875,
-0.66943359375,
0.276611328125,
-0.3369140625,
-0.52783203125,
0.06304931640625,
-0.48291015625,
1.068359375,
-0.460693359375,
0.15380859375,
-0.59619140625,
0.325927734375,
0.8125,
-0.12213134765625,
-0.669921875,
-0.331298828125,
-0.45751953125,
-1.1259765625,
0.53857421875,
-0.375244140625,
0.379638671875,
-0.487060546875,
-0.008575439453125,
1.1455078125,
-0.65283203125,
0.552734375,
1.416015625,
0.08807373046875,
0.5966796875,
-0.478271484375,
0.402099609375,
0.51220703125,
-0.52294921875,
-0.1767578125,
0.11737060546875,
-0.8173828125,
0.51171875,
-0.331298828125,
-0.96484375,
-0.85595703125,
0.2705078125,
1.0830078125,
-0.2156982421875,
0.7353515625,
-0.058685302734375,
-1.1494140625,
-0.5732421875,
0.80859375,
0.10443115234375,
0.07843017578125,
0.80029296875,
-0.397705078125,
-0.24951171875,
-0.053863525390625,
-0.215576171875,
-0.257568359375,
-0.66015625,
0.958984375,
-0.20751953125,
-0.6982421875,
0.8046875,
1.009765625,
-0.89501953125,
-0.9091796875,
0.0028896331787109375,
0.0982666015625,
-0.04901123046875,
-0.58935546875,
0.227783203125,
0.65380859375,
-0.64501953125,
0.134033203125,
0.371337890625,
-0.572265625,
0.467041015625,
-0.083251953125,
0.366455078125,
-0.495849609375,
0.498779296875,
0.72509765625,
-0.43017578125,
-0.1231689453125,
-0.60888671875,
0.1260986328125,
-0.157958984375,
0.13330078125,
0.75048828125,
-0.2841796875,
0.04461669921875,
0.33544921875,
-0.37841796875,
0.8935546875,
-0.432861328125,
-0.1712646484375,
0.28466796875,
-0.599609375,
-0.51806640625,
-0.282470703125,
0.462890625,
-0.051483154296875,
0.1268310546875,
-0.626953125,
-0.2183837890625,
0.4677734375,
0.057281494140625,
-0.14306640625,
-0.57177734375,
-0.322998046875,
-0.5244140625,
-0.53857421875,
-0.5048828125,
-0.39404296875,
0.006870269775390625,
0.4111328125,
0.3798828125,
-0.45947265625,
-0.002285003662109375,
0.87158203125,
-0.6298828125,
0.78662109375,
-0.603515625,
0.362548828125,
-0.77392578125,
-0.67333984375,
-0.50537109375,
-0.025390625,
-1.1083984375,
-0.147705078125,
-0.44873046875,
0.37158203125,
-0.12548828125,
0.303955078125,
-0.06201171875,
0.36669921875,
-0.305908203125,
-0.322021484375,
0.53857421875,
-0.2315673828125,
-0.4326171875,
0.71142578125,
0.583984375,
0.006580352783203125,
0.1640625,
-0.061614990234375,
-0.25830078125,
-0.49853515625,
0.76171875,
0.469482421875,
0.03826904296875,
-0.369140625,
0.1844482421875,
0.03155517578125,
-1.0146484375,
0.2413330078125,
-0.2890625,
0.322021484375,
0.08624267578125,
-0.8115234375,
0.447998046875,
1.1455078125,
-0.477783203125,
0.47216796875,
0.5361328125,
0.1815185546875,
0.8115234375,
0.1341552734375,
0.28271484375,
0.5263671875,
0.041595458984375,
-0.59912109375,
-0.086181640625,
0.5966796875,
-0.06365966796875,
0.267333984375,
-0.25732421875,
-0.4814453125,
-1.287109375,
-0.14599609375,
-0.011505126953125,
0.50146484375,
0.39013671875,
-0.293701171875,
0.2249755859375,
-0.1124267578125,
-0.5439453125,
-0.072021484375,
-0.9482421875,
-0.712890625,
0.6826171875,
-0.059600830078125,
-0.30615234375,
-0.127685546875,
-0.8203125,
-0.06402587890625,
0.1956787109375,
0.046661376953125,
-0.0753173828125,
0.295654296875,
-0.65185546875,
0.56591796875,
-0.283935546875,
0.1739501953125,
0.129638671875,
0.537109375,
-0.69873046875,
-0.39794921875,
0.408447265625,
1.1162109375,
-0.2349853515625,
-0.1348876953125,
-0.388916015625,
0.4052734375,
-0.38671875,
-0.05194091796875,
-0.280517578125,
0.24853515625,
-0.1453857421875,
0.314208984375,
-1.0537109375,
0.301025390625,
-0.1429443359375,
0.5263671875,
0.1600341796875,
-0.461669921875,
-0.505859375,
0.630859375,
0.6796875,
0.01506805419921875,
0.0060882568359375,
0.29833984375,
0.6259765625,
-0.1429443359375,
0.0809326171875,
-0.4775390625,
0.343994140625,
0.55810546875,
0.5263671875,
-0.10748291015625,
0.62548828125,
0.7236328125,
0.343017578125,
-0.0303955078125,
0.54052734375,
0.19677734375,
-0.1942138671875,
-0.09576416015625,
-0.376708984375,
-0.201904296875,
-0.58056640625,
-0.71923828125,
0.353759765625,
-0.31787109375,
-0.01410675048828125,
-0.0926513671875,
-0.60498046875,
1.0439453125,
-0.483642578125,
-0.495361328125,
0.19482421875,
-0.218505859375,
-0.0806884765625,
0.49072265625,
0.2210693359375,
-0.22802734375,
0.75244140625,
0.64208984375,
1.02734375,
1.0625,
0.49853515625,
-0.1864013671875,
-0.74560546875,
0.1378173828125,
0.10308837890625,
0.1529541015625,
-0.2462158203125,
-0.599609375,
-1.0244140625,
0.52587890625,
-0.54833984375,
0.00962066650390625,
0.1905517578125,
-0.7802734375,
0.12310791015625,
-0.484375,
0.73046875,
-0.888671875,
0.2626953125,
0.2354736328125,
-0.330810546875,
-1.095703125,
0.436767578125,
-0.13427734375,
0.0626220703125,
0.537109375,
0.82373046875,
0.38427734375,
1.220703125,
0.482666015625,
-0.2457275390625,
0.041748046875,
0.5966796875,
-0.08758544921875,
-0.73291015625,
-0.0819091796875,
-0.22705078125,
0.027008056640625,
-0.25146484375,
-0.250244140625,
-0.0318603515625,
0.374267578125,
0.11163330078125,
-0.55810546875,
-0.64111328125,
0.08270263671875,
-0.44384765625,
0.41943359375,
0.052581787109375,
0.162109375,
-0.331787109375,
-0.03375244140625,
-0.443359375,
-0.4970703125,
0.26806640625,
-0.375244140625,
0.0931396484375,
-0.55126953125,
-0.417236328125,
-0.55810546875,
-0.5673828125,
0.057891845703125,
-0.1453857421875,
-0.8134765625,
-1.001953125,
0.51220703125,
0.377197265625,
0.37353515625,
0.447998046875,
-0.1419677734375,
0.185791015625,
1.23828125,
0.74072265625,
0.1739501953125,
1.0400390625,
0.350830078125,
0.011444091796875,
0.2039794921875,
-0.24462890625,
0.625,
-0.0787353515625,
-0.0928955078125,
-0.5478515625,
0.396484375,
-0.50048828125,
-1.08984375,
0.03460693359375,
0.77783203125,
0.367431640625,
-0.90673828125,
-1.126953125,
-0.27001953125,
-0.98876953125,
-0.0953369140625,
-0.420166015625,
0.50390625,
-0.053497314453125,
0.1387939453125,
-0.42041015625,
-1.177734375,
4.4296875,
0.955078125,
0.76953125,
-0.1417236328125,
0.324462890625,
1,
0.521484375,
-0.63330078125,
-0.2313232421875,
-0.8310546875,
0.390380859375,
-0.69970703125,
-0.03802490234375,
0.9228515625,
0.2098388671875,
0.495361328125,
-0.83837890625,
-0.1536865234375,
-0.33544921875,
-0.93408203125,
-0.98828125,
0.360595703125,
0.1373291015625,
0.434814453125,
0.0159759521484375,
0.473388671875,
0.6552734375,
-0.459228515625,
-0.1368408203125,
-0.67333984375,
-0.03143310546875,
-0.41650390625,
0.86181640625,
-0.290771484375,
-0.45703125,
0.7705078125,
-0.2215576171875,
-0.41015625,
-0.340087890625,
0.1513671875,
-0.348876953125,
0.0114898681640625,
0.4599609375,
-0.603515625,
0.054656982421875,
0.5234375,
-0.62646484375,
0.57861328125,
0.30078125,
-0.9541015625,
0.953125,
-0.24658203125,
0.437744140625,
-0.82470703125,
-0.81103515625,
0.0718994140625,
-0.044189453125,
-0.387939453125,
-0.232666015625,
0.52978515625,
0.49853515625,
0.12744140625,
0.2337646484375,
0.6865234375,
-0.578125,
0.9052734375,
0.068359375,
0.411865234375,
-0.32470703125,
0.230712890625,
-0.3046875,
-0.07879638671875,
-0.09161376953125,
-0.1754150390625,
0.53564453125,
0.5595703125,
-0.0789794921875,
0.299072265625,
1.0322265625,
-0.724609375,
0.1407470703125,
-0.2474365234375,
-0.1583251953125,
-0.57568359375,
0.30712890625,
1.3310546875,
-0.5986328125,
-0.461181640625,
-0.351318359375,
0.61474609375,
0.268798828125,
0.74169921875,
0.03375244140625,
-0.84716796875,
-0.54248046875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Submitted Solution:
```
n = int(input())
s = []
for i in range(n):
k = input()
s.append(k)
maxans = -1
for i in range(26):
for j in range(26):
ans = 0
for k in s:
for p in range(len(k)):
if k[p] != chr(ord('a') + i) and k[p] != chr(ord('a') + j):
break
if k[p] == chr(ord('a') + i) or k[p] == chr(ord('a') + j):
ans += len(k)
if ans > maxans:
maxans = ans
print(maxans)
```
Yes
| 65,218
|
[
0.171142578125,
0.1517333984375,
0.250244140625,
0.6181640625,
-0.7900390625,
-0.2049560546875,
0.267822265625,
-0.03125,
0.091552734375,
0.64697265625,
0.67138671875,
-0.104736328125,
-0.19921875,
-0.360107421875,
-0.59814453125,
0.04119873046875,
-0.60205078125,
-0.6796875,
-0.69384765625,
-0.0122833251953125,
0.17236328125,
-0.271728515625,
-1.4150390625,
0.054229736328125,
-0.5966796875,
0.99658203125,
0.193115234375,
-0.0888671875,
1.34765625,
1.1806640625,
-0.1983642578125,
-0.5009765625,
0.2210693359375,
-0.58447265625,
-0.34765625,
-0.1328125,
0.75927734375,
-0.89306640625,
-0.4130859375,
-0.325439453125,
0.062744140625,
-0.59716796875,
0.49560546875,
-0.455810546875,
-1.1123046875,
-0.10650634765625,
-0.205322265625,
-0.392578125,
-0.252197265625,
-0.6142578125,
0.342529296875,
-0.29541015625,
0.433349609375,
-0.2266845703125,
0.012542724609375,
-0.037200927734375,
-0.221435546875,
-0.051910400390625,
-0.293212890625,
0.119384765625,
0.298828125,
0.32421875,
0.050567626953125,
-0.85009765625,
-0.108154296875,
0.340087890625,
0.041534423828125,
0.1396484375,
0.265625,
-0.068359375,
-0.0179595947265625,
-0.026397705078125,
-0.3466796875,
-0.2095947265625,
-0.2890625,
0.0267791748046875,
0.423828125,
-0.3828125,
-0.9072265625,
1.025390625,
-0.0897216796875,
0.62744140625,
0.2188720703125,
-0.10626220703125,
-0.49072265625,
-0.281982421875,
0.408203125,
0.349609375,
0.44970703125,
-0.257080078125,
-0.327392578125,
0.30322265625,
-0.4912109375,
-0.11151123046875,
0.7705078125,
0.378662109375,
-0.353271484375,
0.2003173828125,
0.2086181640625,
0.196044921875,
0.92041015625,
0.9609375,
-0.10125732421875,
1.3251953125,
-0.5478515625,
0.179931640625,
0.3671875,
-0.2376708984375,
-0.334228515625,
-0.1986083984375,
-0.120849609375,
-0.322998046875,
0.409912109375,
0.106689453125,
-0.451171875,
0.80126953125,
0.00995635986328125,
0.80126953125,
-0.79296875,
0.22314453125,
0.53564453125,
0.1676025390625,
0.0960693359375,
0.1815185546875,
0.262939453125,
-0.666015625,
-0.6064453125,
0.79638671875,
-0.61279296875,
-0.07110595703125,
0.306396484375,
-0.03369140625,
-0.442138671875,
0.5859375,
-0.0926513671875,
0.30712890625,
-0.2098388671875,
0.2147216796875,
0.79833984375,
-0.5439453125,
0.88916015625,
0.019683837890625,
-0.020355224609375,
1.2880859375,
0.434814453125,
0.2445068359375,
0.5078125,
0.1754150390625,
-0.662109375,
0.64501953125,
-0.97314453125,
0.67919921875,
-0.01152801513671875,
0.39892578125,
-0.73486328125,
0.357421875,
-0.13134765625,
0.1915283203125,
0.332763671875,
0.0570068359375,
-0.22802734375,
0.35107421875,
-0.491455078125,
0.96923828125,
-0.411865234375,
0.88134765625,
-0.468505859375,
-0.1405029296875,
-0.31005859375,
-0.40869140625,
0.206787109375,
-0.384765625,
-0.05029296875,
0.744140625,
0.25341796875,
1.30078125,
1.0400390625,
-0.13720703125,
0.322998046875,
0.118896484375,
-0.3828125,
0.288330078125,
0.250244140625,
1.0361328125,
0.1981201171875,
0.362060546875,
-0.134765625,
-0.2078857421875,
-0.6474609375,
-0.53076171875,
0.1722412109375,
0.5771484375,
-0.876953125,
0.0972900390625,
-0.101318359375,
0.1668701171875,
-1.1455078125,
0.06060791015625,
0.290771484375,
-0.78125,
-0.556640625,
0.3935546875,
-0.045257568359375,
0.60595703125,
-0.36328125,
-0.379638671875,
0.434814453125,
1.248046875,
-0.34228515625,
0.159912109375,
0.66259765625,
0.382080078125,
-0.06024169921875,
-0.0689697265625,
0.292236328125,
-0.31689453125,
-0.95458984375,
0.34716796875,
-0.1923828125,
-0.2259521484375,
0.29931640625,
0.2357177734375,
0.382080078125,
0.165771484375,
-0.58251953125,
-0.076904296875,
0.8681640625,
1.31640625,
-0.2386474609375,
0.63916015625,
0.146240234375,
0.87939453125,
0.359375,
0.6142578125,
0.365478515625,
-0.05389404296875,
0.78271484375,
0.64404296875,
-0.06512451171875,
0.46875,
0.2030029296875,
0.42041015625,
0.383056640625,
0.94580078125,
0.300048828125,
0.489013671875,
-0.141357421875,
-0.258544921875,
-0.392333984375,
0.6435546875,
-0.311767578125,
0.368408203125,
0.031402587890625,
0.4111328125,
-0.6484375,
-0.3447265625,
0.4853515625,
0.71875,
-0.732421875,
-0.5869140625,
-0.28564453125,
0.4443359375,
-0.025360107421875,
0.19384765625,
0.1680908203125,
0.21435546875,
0.2095947265625,
0.2861328125,
0.11865234375,
0.10552978515625,
-0.89013671875,
-0.59765625,
-1.0810546875,
-0.412109375,
-0.58203125,
-0.39111328125,
0.18408203125,
-0.86962890625,
0.41064453125,
-0.2333984375,
-0.204833984375,
-0.12353515625,
-0.55615234375,
0.392822265625,
-0.479736328125,
0.77978515625,
-0.7578125,
0.4501953125,
0.08612060546875,
1.02734375,
-0.0533447265625,
-0.322021484375,
-0.314208984375,
-0.58837890625,
0.393310546875,
-0.30712890625,
0.466552734375,
0.08526611328125,
-0.9384765625,
-0.94580078125,
-0.098876953125,
-0.290283203125,
-0.205078125,
0.11773681640625,
-0.58349609375,
0.77685546875,
0.131591796875,
-0.58837890625,
0.716796875,
0.52978515625,
-0.96923828125,
0.267578125,
0.230712890625,
-0.0090789794921875,
-0.8994140625,
1.16015625,
0.50146484375,
0.703125,
-0.5263671875,
-0.31396484375,
-0.3837890625,
0.08416748046875,
0.2354736328125,
-0.5029296875,
-0.455810546875,
0.39404296875,
0.09283447265625,
-1.37890625,
0.373046875,
-1.1279296875,
-0.89013671875,
-0.5830078125,
-0.60888671875,
0.8720703125,
0.8115234375,
0.0110015869140625,
-0.2073974609375,
-0.755859375,
-0.298095703125,
0.5087890625,
0.415283203125,
-0.87060546875,
-0.26953125,
0.8671875,
-0.142822265625,
-0.026641845703125,
0.12890625,
-0.638671875,
-0.43701171875,
-0.01605224609375,
0.395751953125,
0.73583984375,
0.1756591796875,
0.30908203125,
0.279296875,
0.55615234375,
-0.8955078125,
-0.34228515625,
-0.301513671875,
0.76220703125,
0.303955078125,
0.71923828125,
0.55908203125,
-0.479248046875,
-0.7216796875,
-0.95751953125,
0.6318359375,
0.403076171875,
0.82958984375,
-0.517578125,
0.74609375,
0.214111328125,
-0.7158203125,
0.6865234375,
-0.5537109375,
0.236083984375,
1.2138671875,
0.10760498046875,
0.9443359375,
-0.68603515625,
0.1436767578125,
-0.299072265625,
-0.0229034423828125,
1.0087890625,
0.53662109375,
0.31201171875,
-0.2401123046875,
-0.61865234375,
-0.194091796875,
-0.17578125,
-0.361083984375,
-0.6171875,
0.10540771484375,
-0.280029296875,
-0.12890625,
-0.9140625,
0.190673828125,
0.317138671875,
0.54638671875,
0.120849609375,
1.0302734375,
0.2880859375,
0.3505859375,
0.50634765625,
-0.283203125,
0.3330078125,
-0.4638671875,
1.2939453125,
-0.205078125,
-0.1712646484375,
-0.75537109375,
-0.1990966796875,
-0.29736328125,
-0.09027099609375,
-0.059326171875,
0.291015625,
-0.77392578125,
0.0888671875,
0.0162200927734375,
0.362060546875,
-0.85791015625,
0.1529541015625,
-0.19775390625,
0.381591796875,
0.489990234375,
-0.73095703125,
0.227294921875,
-0.8564453125,
0.51318359375,
0.3515625,
-0.113525390625,
-0.81005859375,
-0.2890625,
-1.08984375,
-0.9443359375,
-0.077392578125,
0.677734375,
-0.328125,
0.07232666015625,
-0.5751953125,
0.25732421875,
0.42822265625,
-0.46728515625,
0.1968994140625,
-0.2098388671875,
0.6572265625,
0.13525390625,
0.74853515625,
-0.44287109375,
-0.359375,
0.3779296875,
-0.89208984375,
0.51806640625,
-0.341064453125,
0.264892578125,
0.09521484375,
-0.0177001953125,
-0.0421142578125,
0.178466796875,
0.134033203125,
0.4208984375,
-0.138916015625,
0.62939453125,
-0.72900390625,
-0.62939453125,
0.6640625,
-0.27783203125,
-0.36279296875,
0.92724609375,
-0.441650390625,
-0.05548095703125,
0.3515625,
0.2198486328125,
-0.7099609375,
0.271728515625,
-0.54736328125,
0.50439453125,
-0.07037353515625,
-0.72509765625,
0.135498046875,
-0.587890625,
0.50830078125,
-0.291748046875,
-0.386962890625,
-0.27294921875,
-1.44921875,
-0.1158447265625,
-0.11029052734375,
-0.74267578125,
0.355224609375,
0.361328125,
-0.41162109375,
-0.409912109375,
-0.2822265625,
-0.57861328125,
-0.281982421875,
-0.2039794921875,
-0.26708984375,
-0.075439453125,
0.318115234375,
1.013671875,
0.0273895263671875,
-0.19677734375,
0.156494140625,
0.007755279541015625,
-0.370361328125,
-0.4365234375,
-0.53857421875,
0.041595458984375,
-0.58544921875,
-0.0283966064453125,
0.6689453125,
-0.11395263671875,
-0.0533447265625,
0.869140625,
-0.157470703125,
0.23046875,
0.400146484375,
-0.456787109375,
1.216796875,
0.1317138671875,
-1.3291015625,
-0.485107421875,
0.75830078125,
-0.12054443359375,
0.46923828125,
0.07635498046875,
-1.080078125,
-0.98486328125,
-0.56494140625,
0.2003173828125,
-0.60205078125,
-0.1697998046875,
-1.0205078125,
-0.52197265625,
-0.2059326171875,
0.748046875,
-0.176513671875,
-0.1663818359375,
0.282470703125,
-1.251953125,
0.2342529296875,
-0.787109375,
0.087890625,
-0.671875,
-0.51025390625,
-0.419189453125,
1.0458984375,
0.265625,
0.34375,
-0.1444091796875,
0.02447509765625,
0.5029296875,
-0.328857421875,
-0.317138671875,
-0.521484375,
0.05279541015625,
0.15478515625,
0.06732177734375,
-0.26953125,
-0.63671875,
1.0009765625,
-0.66455078125,
0.27099609375,
-0.357177734375,
-0.50244140625,
0.059112548828125,
-0.4482421875,
1.064453125,
-0.47265625,
0.1839599609375,
-0.57275390625,
0.3046875,
0.77685546875,
-0.101806640625,
-0.64404296875,
-0.3310546875,
-0.437255859375,
-1.1025390625,
0.5400390625,
-0.37353515625,
0.4072265625,
-0.459228515625,
-0.00128936767578125,
1.16796875,
-0.64794921875,
0.55712890625,
1.4033203125,
0.0941162109375,
0.62841796875,
-0.5,
0.38037109375,
0.5234375,
-0.5087890625,
-0.154052734375,
0.07867431640625,
-0.79833984375,
0.52001953125,
-0.327880859375,
-0.95751953125,
-0.85693359375,
0.282470703125,
1.1044921875,
-0.241943359375,
0.73681640625,
-0.041961669921875,
-1.1357421875,
-0.5693359375,
0.79541015625,
0.11065673828125,
0.0750732421875,
0.82275390625,
-0.395263671875,
-0.208251953125,
-0.035125732421875,
-0.2100830078125,
-0.241943359375,
-0.697265625,
0.9287109375,
-0.2359619140625,
-0.68701171875,
0.78662109375,
1.0166015625,
-0.89453125,
-0.89990234375,
-0.028717041015625,
0.07421875,
-0.01134490966796875,
-0.57666015625,
0.2005615234375,
0.646484375,
-0.634765625,
0.1490478515625,
0.37744140625,
-0.5927734375,
0.472900390625,
-0.072998046875,
0.37939453125,
-0.53076171875,
0.50146484375,
0.6953125,
-0.448974609375,
-0.1446533203125,
-0.61572265625,
0.11444091796875,
-0.136474609375,
0.1724853515625,
0.73974609375,
-0.292236328125,
0.0218048095703125,
0.32373046875,
-0.3818359375,
0.86279296875,
-0.392822265625,
-0.1741943359375,
0.313232421875,
-0.61572265625,
-0.5224609375,
-0.286376953125,
0.472412109375,
-0.06201171875,
0.1123046875,
-0.61865234375,
-0.1986083984375,
0.46533203125,
0.0623779296875,
-0.102294921875,
-0.583984375,
-0.32275390625,
-0.467041015625,
-0.5390625,
-0.482421875,
-0.365478515625,
0.004436492919921875,
0.424560546875,
0.363037109375,
-0.4755859375,
-0.0136260986328125,
0.90771484375,
-0.64697265625,
0.7568359375,
-0.5849609375,
0.359375,
-0.72216796875,
-0.6728515625,
-0.50146484375,
-0.04510498046875,
-1.087890625,
-0.170166015625,
-0.452392578125,
0.377197265625,
-0.0975341796875,
0.273681640625,
-0.043548583984375,
0.37939453125,
-0.299072265625,
-0.330322265625,
0.5498046875,
-0.22509765625,
-0.436767578125,
0.69189453125,
0.5927734375,
-0.038665771484375,
0.1539306640625,
-0.058380126953125,
-0.235107421875,
-0.497802734375,
0.7763671875,
0.4990234375,
0.06182861328125,
-0.378662109375,
0.1671142578125,
0.04052734375,
-1.0283203125,
0.2529296875,
-0.289306640625,
0.33740234375,
0.08294677734375,
-0.798828125,
0.439208984375,
1.154296875,
-0.453369140625,
0.464111328125,
0.55126953125,
0.1661376953125,
0.8251953125,
0.1439208984375,
0.28857421875,
0.548828125,
0.06695556640625,
-0.61181640625,
-0.1009521484375,
0.5771484375,
-0.08544921875,
0.271728515625,
-0.23388671875,
-0.46533203125,
-1.2919921875,
-0.1400146484375,
-0.0164031982421875,
0.533203125,
0.4189453125,
-0.268798828125,
0.233642578125,
-0.07415771484375,
-0.53173828125,
-0.07177734375,
-0.9658203125,
-0.69384765625,
0.68701171875,
-0.07501220703125,
-0.30126953125,
-0.09393310546875,
-0.8349609375,
-0.059600830078125,
0.1912841796875,
0.0435791015625,
-0.06756591796875,
0.326416015625,
-0.67333984375,
0.5712890625,
-0.275390625,
0.161865234375,
0.12091064453125,
0.55859375,
-0.69970703125,
-0.406494140625,
0.404052734375,
1.0986328125,
-0.263916015625,
-0.12322998046875,
-0.412353515625,
0.383544921875,
-0.352783203125,
-0.05450439453125,
-0.292236328125,
0.2186279296875,
-0.1884765625,
0.273193359375,
-1.0546875,
0.277099609375,
-0.1549072265625,
0.51611328125,
0.1429443359375,
-0.460205078125,
-0.505859375,
0.63427734375,
0.6767578125,
0.025482177734375,
0.048583984375,
0.322265625,
0.61865234375,
-0.146728515625,
0.1072998046875,
-0.48291015625,
0.333984375,
0.5341796875,
0.50830078125,
-0.111572265625,
0.63232421875,
0.74853515625,
0.343505859375,
-0.059661865234375,
0.533203125,
0.177001953125,
-0.1966552734375,
-0.07635498046875,
-0.38330078125,
-0.17919921875,
-0.57177734375,
-0.7158203125,
0.321533203125,
-0.31103515625,
-0.00411224365234375,
-0.08343505859375,
-0.58935546875,
1.037109375,
-0.51806640625,
-0.52099609375,
0.217529296875,
-0.2464599609375,
-0.1209716796875,
0.46728515625,
0.244140625,
-0.22705078125,
0.77294921875,
0.61767578125,
0.99609375,
1.0439453125,
0.50244140625,
-0.1990966796875,
-0.7529296875,
0.1427001953125,
0.050048828125,
0.1588134765625,
-0.2447509765625,
-0.6064453125,
-1.005859375,
0.5302734375,
-0.5126953125,
-0.0043792724609375,
0.1715087890625,
-0.7529296875,
0.1129150390625,
-0.515625,
0.72607421875,
-0.86181640625,
0.2344970703125,
0.24755859375,
-0.356201171875,
-1.0771484375,
0.455078125,
-0.1260986328125,
0.078125,
0.568359375,
0.841796875,
0.390380859375,
1.2255859375,
0.497802734375,
-0.2303466796875,
0.061431884765625,
0.5869140625,
-0.08013916015625,
-0.77197265625,
-0.07696533203125,
-0.21728515625,
0.0400390625,
-0.206298828125,
-0.244873046875,
-0.03228759765625,
0.3623046875,
0.131591796875,
-0.54931640625,
-0.62451171875,
0.060272216796875,
-0.44091796875,
0.3984375,
0.0282440185546875,
0.1475830078125,
-0.319580078125,
-0.054595947265625,
-0.416015625,
-0.52685546875,
0.272705078125,
-0.366943359375,
0.10302734375,
-0.57177734375,
-0.41748046875,
-0.525390625,
-0.56689453125,
0.0531005859375,
-0.1226806640625,
-0.81396484375,
-0.97802734375,
0.509765625,
0.395263671875,
0.395751953125,
0.448974609375,
-0.1541748046875,
0.168212890625,
1.2412109375,
0.6845703125,
0.1910400390625,
1.0439453125,
0.33154296875,
0.0006184577941894531,
0.2030029296875,
-0.2286376953125,
0.61669921875,
-0.060089111328125,
-0.09124755859375,
-0.52978515625,
0.400146484375,
-0.5361328125,
-1.087890625,
0.032135009765625,
0.7607421875,
0.381591796875,
-0.92041015625,
-1.1181640625,
-0.25634765625,
-1.0009765625,
-0.06781005859375,
-0.36083984375,
0.51171875,
-0.062408447265625,
0.1624755859375,
-0.450927734375,
-1.181640625,
4.4375,
0.9580078125,
0.76708984375,
-0.111328125,
0.337890625,
0.99951171875,
0.5380859375,
-0.634765625,
-0.23779296875,
-0.8369140625,
0.3759765625,
-0.708984375,
-0.032958984375,
0.94873046875,
0.2052001953125,
0.4921875,
-0.85400390625,
-0.1480712890625,
-0.3642578125,
-0.9208984375,
-0.9873046875,
0.3564453125,
0.1396484375,
0.410400390625,
0.007442474365234375,
0.493408203125,
0.63623046875,
-0.468994140625,
-0.10858154296875,
-0.65673828125,
-0.032379150390625,
-0.43115234375,
0.83203125,
-0.287109375,
-0.45068359375,
0.7841796875,
-0.2471923828125,
-0.4326171875,
-0.322265625,
0.150634765625,
-0.353271484375,
0.0116424560546875,
0.413330078125,
-0.60009765625,
0.059295654296875,
0.51416015625,
-0.61474609375,
0.552734375,
0.291259765625,
-0.93896484375,
0.9326171875,
-0.278076171875,
0.393310546875,
-0.830078125,
-0.861328125,
0.0985107421875,
-0.0298004150390625,
-0.38671875,
-0.2314453125,
0.53662109375,
0.4970703125,
0.1419677734375,
0.2347412109375,
0.69921875,
-0.55908203125,
0.91943359375,
0.052764892578125,
0.399169921875,
-0.337646484375,
0.251953125,
-0.3056640625,
-0.064453125,
-0.11248779296875,
-0.1834716796875,
0.51171875,
0.55029296875,
-0.067138671875,
0.2890625,
1.03125,
-0.7412109375,
0.15185546875,
-0.2374267578125,
-0.1590576171875,
-0.552734375,
0.2900390625,
1.3349609375,
-0.60302734375,
-0.45849609375,
-0.314697265625,
0.60693359375,
0.2498779296875,
0.72802734375,
0.06683349609375,
-0.86474609375,
-0.560546875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Submitted Solution:
```
a='abcdefghijklmnopqrstuvwxyz'
n=int(input())
l=[]
ma=0
for i in range(n) :
l.append(input())
for i in range(len(a)) :
for j in range(len(a)) :
s=0
for x in l :
l1=set(x)
if len(l1)==2 :
if a[i] in l1 and a[j] in l1 :
s+=len(x)
if len(l1)==1 :
if a[i] in l1 or a[j] in l1 :
s+=len(x)
ma=max(ma,s)
print(ma)
```
No
| 65,219
|
[
0.1629638671875,
0.142822265625,
0.272705078125,
0.611328125,
-0.78173828125,
-0.181640625,
0.270751953125,
-0.0380859375,
0.12017822265625,
0.6376953125,
0.65771484375,
-0.111083984375,
-0.156494140625,
-0.34033203125,
-0.59765625,
0.01160430908203125,
-0.63720703125,
-0.6748046875,
-0.720703125,
-0.0222015380859375,
0.1634521484375,
-0.268310546875,
-1.3974609375,
0.047454833984375,
-0.59521484375,
1.0009765625,
0.199951171875,
-0.058349609375,
1.349609375,
1.1943359375,
-0.2054443359375,
-0.4853515625,
0.2464599609375,
-0.5791015625,
-0.36181640625,
-0.133056640625,
0.73876953125,
-0.89599609375,
-0.4189453125,
-0.336669921875,
0.06634521484375,
-0.60546875,
0.477294921875,
-0.4560546875,
-1.1162109375,
-0.1470947265625,
-0.1904296875,
-0.4111328125,
-0.2470703125,
-0.6181640625,
0.35986328125,
-0.283203125,
0.452880859375,
-0.2099609375,
0.0175018310546875,
-0.05328369140625,
-0.271240234375,
-0.027496337890625,
-0.291015625,
0.0986328125,
0.298095703125,
0.313720703125,
0.0233306884765625,
-0.8193359375,
-0.12646484375,
0.32470703125,
0.057098388671875,
0.1453857421875,
0.2476806640625,
-0.054931640625,
-0.0216827392578125,
-0.0250244140625,
-0.3525390625,
-0.25927734375,
-0.278564453125,
0.022552490234375,
0.426513671875,
-0.383056640625,
-0.94287109375,
1.02734375,
-0.09429931640625,
0.646484375,
0.2568359375,
-0.09747314453125,
-0.47314453125,
-0.29345703125,
0.428955078125,
0.343994140625,
0.41357421875,
-0.25048828125,
-0.360107421875,
0.293701171875,
-0.484130859375,
-0.12109375,
0.75537109375,
0.38525390625,
-0.352294921875,
0.1815185546875,
0.1983642578125,
0.2325439453125,
0.9033203125,
0.9833984375,
-0.0916748046875,
1.345703125,
-0.53173828125,
0.180419921875,
0.3603515625,
-0.2294921875,
-0.362060546875,
-0.214111328125,
-0.1441650390625,
-0.32666015625,
0.40380859375,
0.09271240234375,
-0.4189453125,
0.8125,
-0.0003151893615722656,
0.8134765625,
-0.78955078125,
0.18798828125,
0.517578125,
0.1485595703125,
0.10882568359375,
0.1583251953125,
0.2440185546875,
-0.634765625,
-0.6103515625,
0.802734375,
-0.599609375,
-0.0916748046875,
0.31787109375,
-0.0022602081298828125,
-0.429931640625,
0.58447265625,
-0.06402587890625,
0.305419921875,
-0.21337890625,
0.2451171875,
0.796875,
-0.5419921875,
0.904296875,
0.0413818359375,
-0.03790283203125,
1.302734375,
0.43359375,
0.250732421875,
0.50341796875,
0.1964111328125,
-0.6669921875,
0.64208984375,
-0.9609375,
0.68603515625,
0.028656005859375,
0.391845703125,
-0.74853515625,
0.365478515625,
-0.146240234375,
0.18115234375,
0.33154296875,
0.05975341796875,
-0.26806640625,
0.366455078125,
-0.5107421875,
0.97509765625,
-0.435546875,
0.8505859375,
-0.478759765625,
-0.155517578125,
-0.276123046875,
-0.39013671875,
0.18359375,
-0.388916015625,
-0.0582275390625,
0.78076171875,
0.2529296875,
1.275390625,
1.0302734375,
-0.117919921875,
0.3369140625,
0.1385498046875,
-0.3466796875,
0.3125,
0.233154296875,
1.013671875,
0.1766357421875,
0.35595703125,
-0.1407470703125,
-0.2216796875,
-0.6591796875,
-0.525390625,
0.1912841796875,
0.5771484375,
-0.87060546875,
0.1273193359375,
-0.09228515625,
0.1883544921875,
-1.1748046875,
0.06414794921875,
0.29248046875,
-0.78759765625,
-0.5703125,
0.383056640625,
-0.05120849609375,
0.59423828125,
-0.34716796875,
-0.37841796875,
0.425537109375,
1.2421875,
-0.291015625,
0.11865234375,
0.6787109375,
0.3955078125,
-0.071533203125,
-0.048431396484375,
0.30908203125,
-0.337890625,
-0.95556640625,
0.352783203125,
-0.170166015625,
-0.2156982421875,
0.26806640625,
0.239013671875,
0.4111328125,
0.1807861328125,
-0.5751953125,
-0.05377197265625,
0.84814453125,
1.310546875,
-0.248046875,
0.66357421875,
0.1593017578125,
0.904296875,
0.356201171875,
0.62255859375,
0.36572265625,
-0.041961669921875,
0.78955078125,
0.67529296875,
-0.10467529296875,
0.462158203125,
0.197265625,
0.410400390625,
0.404052734375,
0.91845703125,
0.27880859375,
0.476806640625,
-0.1414794921875,
-0.217529296875,
-0.406494140625,
0.62255859375,
-0.31689453125,
0.384033203125,
0.05584716796875,
0.40771484375,
-0.64599609375,
-0.36865234375,
0.455810546875,
0.72021484375,
-0.7353515625,
-0.58349609375,
-0.29833984375,
0.44677734375,
-0.008148193359375,
0.206787109375,
0.2005615234375,
0.1937255859375,
0.216552734375,
0.301513671875,
0.1009521484375,
0.0931396484375,
-0.85400390625,
-0.5888671875,
-1.076171875,
-0.36572265625,
-0.57275390625,
-0.38720703125,
0.172119140625,
-0.86474609375,
0.4384765625,
-0.2264404296875,
-0.2138671875,
-0.12158203125,
-0.5908203125,
0.37939453125,
-0.50244140625,
0.77880859375,
-0.76904296875,
0.414306640625,
0.10302734375,
1.033203125,
-0.03582763671875,
-0.29541015625,
-0.31640625,
-0.61083984375,
0.401123046875,
-0.291015625,
0.463134765625,
0.07550048828125,
-0.9599609375,
-0.93212890625,
-0.11163330078125,
-0.299560546875,
-0.258056640625,
0.123046875,
-0.6123046875,
0.79248046875,
0.1365966796875,
-0.57763671875,
0.734375,
0.541015625,
-0.98583984375,
0.289306640625,
0.2421875,
0.01351165771484375,
-0.8798828125,
1.162109375,
0.5048828125,
0.6953125,
-0.53759765625,
-0.302734375,
-0.39306640625,
0.095947265625,
0.247802734375,
-0.49267578125,
-0.442138671875,
0.397705078125,
0.09344482421875,
-1.3740234375,
0.38427734375,
-1.1201171875,
-0.865234375,
-0.6103515625,
-0.6044921875,
0.84716796875,
0.81787109375,
0.0223846435546875,
-0.229736328125,
-0.77978515625,
-0.315673828125,
0.51220703125,
0.42822265625,
-0.873046875,
-0.242431640625,
0.869140625,
-0.13720703125,
-0.046051025390625,
0.1097412109375,
-0.67578125,
-0.394775390625,
-0.012298583984375,
0.411376953125,
0.70751953125,
0.18603515625,
0.293701171875,
0.234375,
0.52978515625,
-0.87353515625,
-0.334228515625,
-0.280517578125,
0.7451171875,
0.2958984375,
0.7158203125,
0.578125,
-0.47119140625,
-0.69580078125,
-0.98876953125,
0.63818359375,
0.397705078125,
0.841796875,
-0.53173828125,
0.72119140625,
0.1995849609375,
-0.7080078125,
0.66015625,
-0.55322265625,
0.216064453125,
1.1904296875,
0.072998046875,
0.947265625,
-0.6494140625,
0.1396484375,
-0.2822265625,
-0.0179901123046875,
1.00390625,
0.53173828125,
0.33203125,
-0.2457275390625,
-0.60693359375,
-0.1556396484375,
-0.1517333984375,
-0.36669921875,
-0.63525390625,
0.09307861328125,
-0.2744140625,
-0.11419677734375,
-0.89453125,
0.20751953125,
0.34814453125,
0.5576171875,
0.10235595703125,
1.0166015625,
0.26708984375,
0.346923828125,
0.468017578125,
-0.294189453125,
0.350830078125,
-0.472900390625,
1.2841796875,
-0.2298583984375,
-0.182861328125,
-0.7509765625,
-0.1646728515625,
-0.303466796875,
-0.0919189453125,
-0.093017578125,
0.2802734375,
-0.76416015625,
0.079345703125,
0.017181396484375,
0.359619140625,
-0.89111328125,
0.162109375,
-0.1947021484375,
0.372802734375,
0.482666015625,
-0.689453125,
0.231689453125,
-0.859375,
0.52734375,
0.345703125,
-0.1121826171875,
-0.7958984375,
-0.30859375,
-1.103515625,
-0.94873046875,
-0.0521240234375,
0.6982421875,
-0.389404296875,
0.09588623046875,
-0.595703125,
0.251953125,
0.379150390625,
-0.438232421875,
0.1849365234375,
-0.1805419921875,
0.65283203125,
0.1353759765625,
0.7177734375,
-0.469482421875,
-0.366943359375,
0.331787109375,
-0.90576171875,
0.52880859375,
-0.3828125,
0.2476806640625,
0.096923828125,
-0.04705810546875,
-0.02532958984375,
0.194580078125,
0.09893798828125,
0.41650390625,
-0.1083984375,
0.6259765625,
-0.728515625,
-0.59521484375,
0.65869140625,
-0.256103515625,
-0.38623046875,
0.93017578125,
-0.44189453125,
-0.047943115234375,
0.36083984375,
0.2371826171875,
-0.70556640625,
0.2919921875,
-0.5400390625,
0.4814453125,
-0.0687255859375,
-0.736328125,
0.1446533203125,
-0.5712890625,
0.509765625,
-0.292724609375,
-0.359619140625,
-0.2607421875,
-1.458984375,
-0.1302490234375,
-0.1275634765625,
-0.71875,
0.34228515625,
0.35205078125,
-0.407470703125,
-0.36962890625,
-0.280517578125,
-0.60986328125,
-0.28271484375,
-0.1807861328125,
-0.279541015625,
-0.055999755859375,
0.2890625,
1.017578125,
0.0299072265625,
-0.1851806640625,
0.140869140625,
0.03021240234375,
-0.35107421875,
-0.451416015625,
-0.55615234375,
0.04510498046875,
-0.5751953125,
-0.03448486328125,
0.6640625,
-0.1220703125,
-0.0567626953125,
0.87255859375,
-0.1690673828125,
0.2353515625,
0.374755859375,
-0.4736328125,
1.2314453125,
0.1248779296875,
-1.3359375,
-0.47314453125,
0.79150390625,
-0.1331787109375,
0.466552734375,
0.07720947265625,
-1.0361328125,
-0.9765625,
-0.587890625,
0.22412109375,
-0.576171875,
-0.1474609375,
-0.99609375,
-0.47021484375,
-0.196044921875,
0.72509765625,
-0.1654052734375,
-0.1431884765625,
0.32177734375,
-1.2626953125,
0.25927734375,
-0.78759765625,
0.10821533203125,
-0.66259765625,
-0.51220703125,
-0.430908203125,
1.0771484375,
0.2822265625,
0.332275390625,
-0.1441650390625,
0.0216064453125,
0.51708984375,
-0.345947265625,
-0.334716796875,
-0.51708984375,
0.0499267578125,
0.14404296875,
0.0703125,
-0.255615234375,
-0.64453125,
0.9833984375,
-0.66015625,
0.2469482421875,
-0.32421875,
-0.50830078125,
0.07647705078125,
-0.436279296875,
1.0625,
-0.482666015625,
0.1683349609375,
-0.5703125,
0.34130859375,
0.80224609375,
-0.12115478515625,
-0.64208984375,
-0.3212890625,
-0.451416015625,
-1.1162109375,
0.5654296875,
-0.368408203125,
0.423828125,
-0.482421875,
0.01067352294921875,
1.1796875,
-0.63134765625,
0.56494140625,
1.4130859375,
0.06414794921875,
0.599609375,
-0.472900390625,
0.37060546875,
0.51513671875,
-0.529296875,
-0.1646728515625,
0.08782958984375,
-0.81591796875,
0.498779296875,
-0.339111328125,
-0.98193359375,
-0.85595703125,
0.28515625,
1.1201171875,
-0.228759765625,
0.744140625,
-0.07421875,
-1.1533203125,
-0.57275390625,
0.81787109375,
0.10614013671875,
0.07470703125,
0.80712890625,
-0.402099609375,
-0.2303466796875,
-0.0189361572265625,
-0.239990234375,
-0.2452392578125,
-0.6806640625,
0.91748046875,
-0.1800537109375,
-0.6650390625,
0.80517578125,
1.01953125,
-0.90869140625,
-0.93603515625,
-0.0099334716796875,
0.059814453125,
-0.0357666015625,
-0.5771484375,
0.2034912109375,
0.63232421875,
-0.63720703125,
0.156982421875,
0.375244140625,
-0.57666015625,
0.43408203125,
-0.07794189453125,
0.36083984375,
-0.5068359375,
0.487060546875,
0.7333984375,
-0.430908203125,
-0.11798095703125,
-0.66357421875,
0.09228515625,
-0.1468505859375,
0.1671142578125,
0.75390625,
-0.305419921875,
0.04632568359375,
0.329833984375,
-0.373291015625,
0.88720703125,
-0.375,
-0.1844482421875,
0.3212890625,
-0.63134765625,
-0.525390625,
-0.2861328125,
0.490478515625,
-0.06341552734375,
0.12310791015625,
-0.59765625,
-0.22705078125,
0.431640625,
0.05487060546875,
-0.132080078125,
-0.56884765625,
-0.322509765625,
-0.4921875,
-0.50537109375,
-0.482421875,
-0.36669921875,
0.01416778564453125,
0.400634765625,
0.377197265625,
-0.4658203125,
-0.031036376953125,
0.8994140625,
-0.6240234375,
0.77099609375,
-0.5771484375,
0.340087890625,
-0.74267578125,
-0.63037109375,
-0.50341796875,
-0.0265350341796875,
-1.103515625,
-0.15380859375,
-0.43017578125,
0.3662109375,
-0.1207275390625,
0.289794921875,
-0.0304412841796875,
0.3935546875,
-0.299560546875,
-0.303466796875,
0.5341796875,
-0.2474365234375,
-0.4111328125,
0.697265625,
0.591796875,
-0.051300048828125,
0.152099609375,
-0.1053466796875,
-0.275634765625,
-0.50732421875,
0.7431640625,
0.4951171875,
0.047821044921875,
-0.37939453125,
0.13818359375,
0.048736572265625,
-1.009765625,
0.24658203125,
-0.2978515625,
0.33447265625,
0.08099365234375,
-0.7294921875,
0.4384765625,
1.1572265625,
-0.489013671875,
0.48583984375,
0.53125,
0.138427734375,
0.849609375,
0.1341552734375,
0.275146484375,
0.53369140625,
0.050384521484375,
-0.59033203125,
-0.10693359375,
0.55078125,
-0.0836181640625,
0.306884765625,
-0.25,
-0.4453125,
-1.2822265625,
-0.11871337890625,
-0.040985107421875,
0.52294921875,
0.412353515625,
-0.26416015625,
0.2332763671875,
-0.09356689453125,
-0.529296875,
-0.0411376953125,
-0.93359375,
-0.708984375,
0.6630859375,
-0.053558349609375,
-0.332763671875,
-0.10504150390625,
-0.84033203125,
-0.0799560546875,
0.193603515625,
0.054931640625,
-0.0738525390625,
0.320556640625,
-0.681640625,
0.55419921875,
-0.3037109375,
0.16015625,
0.11962890625,
0.5517578125,
-0.6884765625,
-0.406005859375,
0.423583984375,
1.091796875,
-0.259033203125,
-0.11444091796875,
-0.408447265625,
0.39111328125,
-0.39892578125,
-0.0634765625,
-0.295166015625,
0.2264404296875,
-0.1663818359375,
0.27197265625,
-1.068359375,
0.280517578125,
-0.1328125,
0.50830078125,
0.1641845703125,
-0.474853515625,
-0.4990234375,
0.623046875,
0.65869140625,
0.040496826171875,
0.0258636474609375,
0.322998046875,
0.6103515625,
-0.155517578125,
0.13232421875,
-0.457763671875,
0.31689453125,
0.5595703125,
0.5107421875,
-0.09893798828125,
0.6396484375,
0.734375,
0.3203125,
-0.03021240234375,
0.5361328125,
0.1729736328125,
-0.2093505859375,
-0.0999755859375,
-0.386474609375,
-0.19287109375,
-0.58056640625,
-0.73046875,
0.32763671875,
-0.304443359375,
0.005214691162109375,
-0.08477783203125,
-0.6015625,
1.0234375,
-0.5078125,
-0.50048828125,
0.19921875,
-0.2421875,
-0.0821533203125,
0.46484375,
0.24853515625,
-0.2218017578125,
0.75048828125,
0.64111328125,
0.990234375,
1.0576171875,
0.47998046875,
-0.187744140625,
-0.73974609375,
0.1685791015625,
0.04510498046875,
0.178466796875,
-0.2489013671875,
-0.59375,
-1.00390625,
0.55224609375,
-0.5361328125,
0.016632080078125,
0.2093505859375,
-0.7734375,
0.10711669921875,
-0.52392578125,
0.6982421875,
-0.84619140625,
0.2354736328125,
0.2607421875,
-0.35009765625,
-1.048828125,
0.458740234375,
-0.140869140625,
0.0579833984375,
0.5341796875,
0.8271484375,
0.399658203125,
1.2265625,
0.461181640625,
-0.251953125,
0.0222930908203125,
0.57177734375,
-0.08123779296875,
-0.7841796875,
-0.08709716796875,
-0.2274169921875,
0.0477294921875,
-0.2156982421875,
-0.23974609375,
0.01470184326171875,
0.34912109375,
0.1361083984375,
-0.552734375,
-0.62451171875,
0.0631103515625,
-0.426513671875,
0.389404296875,
0.0677490234375,
0.11981201171875,
-0.333984375,
-0.045257568359375,
-0.46484375,
-0.517578125,
0.27685546875,
-0.39404296875,
0.1060791015625,
-0.58154296875,
-0.408203125,
-0.5107421875,
-0.55712890625,
0.050567626953125,
-0.1192626953125,
-0.8193359375,
-0.9814453125,
0.51318359375,
0.394775390625,
0.411865234375,
0.47216796875,
-0.1427001953125,
0.1488037109375,
1.251953125,
0.68212890625,
0.2088623046875,
1.021484375,
0.33642578125,
-0.0171661376953125,
0.2135009765625,
-0.1949462890625,
0.6171875,
-0.03631591796875,
-0.085205078125,
-0.53857421875,
0.375732421875,
-0.5166015625,
-1.0791015625,
0.057830810546875,
0.767578125,
0.378173828125,
-0.9072265625,
-1.1005859375,
-0.28857421875,
-0.9873046875,
-0.054840087890625,
-0.36572265625,
0.5126953125,
-0.0816650390625,
0.1658935546875,
-0.42041015625,
-1.1943359375,
4.44140625,
0.95458984375,
0.7783203125,
-0.1129150390625,
0.310546875,
0.994140625,
0.53759765625,
-0.64599609375,
-0.2227783203125,
-0.82421875,
0.364501953125,
-0.6708984375,
-0.0256195068359375,
0.95068359375,
0.205810546875,
0.50537109375,
-0.84228515625,
-0.1376953125,
-0.3798828125,
-0.91943359375,
-0.99072265625,
0.37841796875,
0.101806640625,
0.44580078125,
0.02105712890625,
0.4892578125,
0.6435546875,
-0.484130859375,
-0.1199951171875,
-0.69384765625,
-0.03948974609375,
-0.426025390625,
0.8525390625,
-0.266845703125,
-0.445068359375,
0.79541015625,
-0.2449951171875,
-0.4384765625,
-0.326904296875,
0.163818359375,
-0.35791015625,
0.01751708984375,
0.42431640625,
-0.59326171875,
0.050872802734375,
0.5224609375,
-0.61865234375,
0.55517578125,
0.273681640625,
-0.9560546875,
0.9404296875,
-0.239990234375,
0.40185546875,
-0.84033203125,
-0.87744140625,
0.121826171875,
-0.04571533203125,
-0.38330078125,
-0.25390625,
0.55810546875,
0.50341796875,
0.12939453125,
0.2315673828125,
0.67919921875,
-0.56884765625,
0.92333984375,
0.038787841796875,
0.429443359375,
-0.3466796875,
0.2147216796875,
-0.267822265625,
-0.049713134765625,
-0.1339111328125,
-0.1712646484375,
0.5107421875,
0.53076171875,
-0.04925537109375,
0.27978515625,
1.0439453125,
-0.7451171875,
0.1402587890625,
-0.25830078125,
-0.175537109375,
-0.57763671875,
0.30224609375,
1.33984375,
-0.61376953125,
-0.4814453125,
-0.3046875,
0.62353515625,
0.218994140625,
0.70068359375,
0.0712890625,
-0.865234375,
-0.53271484375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Submitted Solution:
```
N = int(input())
words = []
import string
for _ in range(N):
word = input()
o = { letter: False for letter in string.ascii_lowercase}
letters = []
count = 0
for letter in word:
if o[letter] == False:
o[letter] = True
letters.append(letter)
count += 1
if count < 3:
words.append([word, letters])
max_total = 0
for i in range(len(words)):
letters = words[i][1]
total_length = len(words[i][0])
for j in range(len(words)):
if i == j:
continue
if len(letters) == 1 and letters[0] in words[j][1]:
letters = words[j][1]
total_length += len(words[j][0])
else:
if letters == words[j][1]:
total_length += len(words[j][0])
elif len(words[j][1]) == 1 and words[j][1][0] in letters:
total_length += len(words[j][0])
if total_length > max_total:
max_total = total_length
print(max_total)
```
No
| 65,220
|
[
0.1556396484375,
0.1881103515625,
0.270263671875,
0.59765625,
-0.7763671875,
-0.227783203125,
0.274169921875,
-0.054718017578125,
0.1220703125,
0.65380859375,
0.6708984375,
-0.1534423828125,
-0.18603515625,
-0.386474609375,
-0.5751953125,
0.00897216796875,
-0.64599609375,
-0.66064453125,
-0.68017578125,
-0.0419921875,
0.1236572265625,
-0.26904296875,
-1.4052734375,
0.00568389892578125,
-0.59228515625,
1.021484375,
0.1898193359375,
-0.1259765625,
1.375,
1.2353515625,
-0.15576171875,
-0.5078125,
0.2469482421875,
-0.5908203125,
-0.364990234375,
-0.1663818359375,
0.75927734375,
-0.89990234375,
-0.385498046875,
-0.331298828125,
0.0249481201171875,
-0.5986328125,
0.4892578125,
-0.50439453125,
-1.1787109375,
-0.153076171875,
-0.1756591796875,
-0.342529296875,
-0.27685546875,
-0.5634765625,
0.33935546875,
-0.325927734375,
0.435791015625,
-0.228271484375,
0.00147247314453125,
-0.040252685546875,
-0.212158203125,
-0.07421875,
-0.258544921875,
0.1373291015625,
0.31884765625,
0.312744140625,
0.113037109375,
-0.80908203125,
-0.1220703125,
0.34765625,
0.041168212890625,
0.127685546875,
0.22314453125,
-0.043365478515625,
-0.01206207275390625,
-0.0279083251953125,
-0.339111328125,
-0.266845703125,
-0.3134765625,
0.015533447265625,
0.40185546875,
-0.407470703125,
-0.90771484375,
1.052734375,
-0.1475830078125,
0.64794921875,
0.27880859375,
-0.06011962890625,
-0.47216796875,
-0.269287109375,
0.416259765625,
0.337158203125,
0.424072265625,
-0.272216796875,
-0.3232421875,
0.2822265625,
-0.53564453125,
-0.08294677734375,
0.755859375,
0.40673828125,
-0.3583984375,
0.2132568359375,
0.2286376953125,
0.26611328125,
0.912109375,
0.98486328125,
-0.1177978515625,
1.3564453125,
-0.4951171875,
0.2113037109375,
0.375732421875,
-0.23974609375,
-0.353759765625,
-0.2254638671875,
-0.1424560546875,
-0.320556640625,
0.416748046875,
0.1397705078125,
-0.409912109375,
0.7939453125,
-0.0127105712890625,
0.7919921875,
-0.78759765625,
0.181884765625,
0.489501953125,
0.1683349609375,
0.1019287109375,
0.136474609375,
0.1795654296875,
-0.6103515625,
-0.6171875,
0.87158203125,
-0.56494140625,
-0.06640625,
0.3095703125,
0.05389404296875,
-0.4599609375,
0.59716796875,
-0.09747314453125,
0.3017578125,
-0.2099609375,
0.220458984375,
0.71826171875,
-0.55029296875,
0.87158203125,
0.0565185546875,
-0.032318115234375,
1.3486328125,
0.4033203125,
0.281494140625,
0.53955078125,
0.1954345703125,
-0.67626953125,
0.67724609375,
-0.98876953125,
0.65478515625,
0.023040771484375,
0.37744140625,
-0.78466796875,
0.35546875,
-0.1214599609375,
0.2432861328125,
0.322998046875,
0.034637451171875,
-0.268310546875,
0.400634765625,
-0.52734375,
0.93310546875,
-0.4384765625,
0.888671875,
-0.515625,
-0.135009765625,
-0.260009765625,
-0.41455078125,
0.1956787109375,
-0.3876953125,
-0.08917236328125,
0.76416015625,
0.29150390625,
1.21875,
1.0341796875,
-0.138916015625,
0.34326171875,
0.1380615234375,
-0.39453125,
0.28125,
0.25146484375,
1.02734375,
0.2042236328125,
0.4169921875,
-0.11676025390625,
-0.255126953125,
-0.64892578125,
-0.55712890625,
0.2154541015625,
0.6103515625,
-0.85400390625,
0.10736083984375,
-0.12249755859375,
0.1944580078125,
-1.228515625,
0.0501708984375,
0.2802734375,
-0.78515625,
-0.5595703125,
0.381591796875,
-0.022705078125,
0.6015625,
-0.362060546875,
-0.429931640625,
0.42578125,
1.2216796875,
-0.306396484375,
0.210693359375,
0.7138671875,
0.34814453125,
-0.0379638671875,
-0.0138397216796875,
0.292724609375,
-0.3173828125,
-1.0224609375,
0.365478515625,
-0.191650390625,
-0.1920166015625,
0.2666015625,
0.2054443359375,
0.3857421875,
0.1973876953125,
-0.5771484375,
-0.0703125,
0.890625,
1.24609375,
-0.2259521484375,
0.62060546875,
0.1644287109375,
0.939453125,
0.348388671875,
0.64306640625,
0.38330078125,
-0.06658935546875,
0.80224609375,
0.65576171875,
-0.09967041015625,
0.4453125,
0.1324462890625,
0.4150390625,
0.363525390625,
0.9833984375,
0.283203125,
0.43115234375,
-0.1737060546875,
-0.268798828125,
-0.402099609375,
0.609375,
-0.336181640625,
0.35595703125,
0.03326416015625,
0.417724609375,
-0.64453125,
-0.35791015625,
0.436279296875,
0.77099609375,
-0.7919921875,
-0.57373046875,
-0.331298828125,
0.397216796875,
-0.031951904296875,
0.209716796875,
0.1866455078125,
0.1885986328125,
0.2159423828125,
0.257080078125,
0.09576416015625,
0.102783203125,
-0.89208984375,
-0.5986328125,
-1.0419921875,
-0.358642578125,
-0.59228515625,
-0.3642578125,
0.2015380859375,
-0.82568359375,
0.387939453125,
-0.2071533203125,
-0.225830078125,
-0.13134765625,
-0.59716796875,
0.38916015625,
-0.495361328125,
0.78369140625,
-0.79638671875,
0.410888671875,
0.07330322265625,
1.05859375,
-0.059783935546875,
-0.294189453125,
-0.3701171875,
-0.59033203125,
0.405517578125,
-0.28564453125,
0.48828125,
0.03509521484375,
-0.939453125,
-0.9423828125,
-0.11077880859375,
-0.29736328125,
-0.26123046875,
0.1322021484375,
-0.580078125,
0.7763671875,
0.1597900390625,
-0.60400390625,
0.77685546875,
0.55322265625,
-1.0234375,
0.267578125,
0.224609375,
-0.0166473388671875,
-0.88427734375,
1.19140625,
0.52734375,
0.6796875,
-0.5087890625,
-0.336669921875,
-0.369384765625,
0.12646484375,
0.2132568359375,
-0.49365234375,
-0.438720703125,
0.442138671875,
0.0662841796875,
-1.404296875,
0.40576171875,
-1.12109375,
-0.8681640625,
-0.62060546875,
-0.619140625,
0.84619140625,
0.81396484375,
0.01165008544921875,
-0.20849609375,
-0.7666015625,
-0.31787109375,
0.53466796875,
0.40234375,
-0.87939453125,
-0.23388671875,
0.87646484375,
-0.1788330078125,
-0.001026153564453125,
0.10687255859375,
-0.64697265625,
-0.44384765625,
-0.021575927734375,
0.343017578125,
0.7216796875,
0.1517333984375,
0.28076171875,
0.275146484375,
0.5263671875,
-0.892578125,
-0.311279296875,
-0.318115234375,
0.73876953125,
0.277099609375,
0.748046875,
0.5693359375,
-0.4423828125,
-0.68310546875,
-1.0068359375,
0.5859375,
0.446044921875,
0.81884765625,
-0.533203125,
0.7041015625,
0.2220458984375,
-0.71630859375,
0.69921875,
-0.57861328125,
0.214599609375,
1.2138671875,
0.030181884765625,
0.95166015625,
-0.666015625,
0.11138916015625,
-0.29541015625,
0.0101165771484375,
1.033203125,
0.5556640625,
0.318603515625,
-0.2425537109375,
-0.5888671875,
-0.2130126953125,
-0.191650390625,
-0.390380859375,
-0.60595703125,
0.11181640625,
-0.251220703125,
-0.129150390625,
-0.9052734375,
0.1639404296875,
0.3896484375,
0.58740234375,
0.1419677734375,
0.958984375,
0.27001953125,
0.27685546875,
0.488037109375,
-0.3193359375,
0.373046875,
-0.44970703125,
1.2890625,
-0.2147216796875,
-0.2039794921875,
-0.734375,
-0.1705322265625,
-0.3427734375,
-0.06121826171875,
-0.09210205078125,
0.334716796875,
-0.7861328125,
0.12060546875,
0.011138916015625,
0.35498046875,
-0.92822265625,
0.16357421875,
-0.2098388671875,
0.362548828125,
0.462158203125,
-0.71435546875,
0.2147216796875,
-0.8486328125,
0.51123046875,
0.381103515625,
-0.09869384765625,
-0.79736328125,
-0.2763671875,
-1.109375,
-0.9228515625,
-0.06732177734375,
0.7041015625,
-0.36669921875,
0.1533203125,
-0.58251953125,
0.300048828125,
0.367919921875,
-0.43408203125,
0.1829833984375,
-0.1888427734375,
0.61865234375,
0.1650390625,
0.69970703125,
-0.487548828125,
-0.3828125,
0.34228515625,
-0.9755859375,
0.51123046875,
-0.35595703125,
0.2705078125,
0.06427001953125,
0.0012731552124023438,
-0.0215606689453125,
0.21728515625,
0.07672119140625,
0.42529296875,
-0.1207275390625,
0.6962890625,
-0.76904296875,
-0.6044921875,
0.64892578125,
-0.282470703125,
-0.385986328125,
0.96484375,
-0.461181640625,
-0.05902099609375,
0.3515625,
0.1309814453125,
-0.70703125,
0.275146484375,
-0.5908203125,
0.52783203125,
-0.04583740234375,
-0.77587890625,
0.1568603515625,
-0.58056640625,
0.56689453125,
-0.280517578125,
-0.3486328125,
-0.2373046875,
-1.45703125,
-0.0958251953125,
-0.1416015625,
-0.73291015625,
0.393310546875,
0.36669921875,
-0.4091796875,
-0.373291015625,
-0.254150390625,
-0.5947265625,
-0.2215576171875,
-0.2100830078125,
-0.26513671875,
-0.0916748046875,
0.337890625,
1.046875,
0.047088623046875,
-0.2261962890625,
0.0921630859375,
0.06524658203125,
-0.3505859375,
-0.49853515625,
-0.56298828125,
-0.02752685546875,
-0.60205078125,
-0.061798095703125,
0.68701171875,
-0.0946044921875,
-0.0328369140625,
0.86865234375,
-0.1361083984375,
0.305419921875,
0.405517578125,
-0.50732421875,
1.2890625,
0.142822265625,
-1.3349609375,
-0.517578125,
0.76220703125,
-0.11846923828125,
0.446044921875,
0.08074951171875,
-1.041015625,
-0.966796875,
-0.61279296875,
0.243408203125,
-0.560546875,
-0.19384765625,
-1.0283203125,
-0.494873046875,
-0.1640625,
0.7529296875,
-0.16943359375,
-0.162841796875,
0.3564453125,
-1.2314453125,
0.2274169921875,
-0.79541015625,
0.07666015625,
-0.6494140625,
-0.482666015625,
-0.40380859375,
1.0654296875,
0.285400390625,
0.30517578125,
-0.1630859375,
0.06109619140625,
0.51318359375,
-0.340576171875,
-0.327880859375,
-0.498779296875,
0.048858642578125,
0.1505126953125,
0.058807373046875,
-0.2138671875,
-0.66259765625,
0.9228515625,
-0.6318359375,
0.287109375,
-0.290771484375,
-0.4951171875,
0.0576171875,
-0.47265625,
1.099609375,
-0.52880859375,
0.22119140625,
-0.5947265625,
0.364501953125,
0.7724609375,
-0.07366943359375,
-0.6640625,
-0.369873046875,
-0.447509765625,
-1.1689453125,
0.564453125,
-0.404541015625,
0.41357421875,
-0.486083984375,
0.03460693359375,
1.181640625,
-0.6904296875,
0.57177734375,
1.3935546875,
0.06768798828125,
0.5751953125,
-0.505859375,
0.409423828125,
0.488525390625,
-0.515625,
-0.1632080078125,
0.0814208984375,
-0.841796875,
0.51123046875,
-0.345947265625,
-1.0234375,
-0.87841796875,
0.31201171875,
1.1494140625,
-0.25830078125,
0.73828125,
-0.059356689453125,
-1.1328125,
-0.5908203125,
0.79931640625,
0.10040283203125,
0.0528564453125,
0.84814453125,
-0.44091796875,
-0.2186279296875,
0.032379150390625,
-0.255615234375,
-0.27490234375,
-0.68701171875,
0.95166015625,
-0.224853515625,
-0.69287109375,
0.81591796875,
0.9833984375,
-0.91259765625,
-0.84521484375,
-0.055023193359375,
0.0821533203125,
-0.06060791015625,
-0.59130859375,
0.2200927734375,
0.591796875,
-0.6142578125,
0.1500244140625,
0.354248046875,
-0.61328125,
0.44921875,
-0.10882568359375,
0.34521484375,
-0.521484375,
0.48193359375,
0.673828125,
-0.430908203125,
-0.1492919921875,
-0.63916015625,
0.1312255859375,
-0.142333984375,
0.205810546875,
0.76416015625,
-0.296875,
0.04278564453125,
0.30615234375,
-0.332275390625,
0.865234375,
-0.365478515625,
-0.1475830078125,
0.26806640625,
-0.62890625,
-0.52099609375,
-0.2890625,
0.435791015625,
-0.07330322265625,
0.111572265625,
-0.61669921875,
-0.253662109375,
0.43994140625,
0.0947265625,
-0.123291015625,
-0.55517578125,
-0.29833984375,
-0.473876953125,
-0.51318359375,
-0.48095703125,
-0.450927734375,
0.0197906494140625,
0.435546875,
0.39208984375,
-0.439697265625,
0.0038204193115234375,
0.8916015625,
-0.62939453125,
0.77294921875,
-0.56494140625,
0.346435546875,
-0.72607421875,
-0.58740234375,
-0.53564453125,
0.034088134765625,
-1.0927734375,
-0.180908203125,
-0.409423828125,
0.391845703125,
-0.146484375,
0.26318359375,
-0.0222930908203125,
0.41357421875,
-0.290283203125,
-0.341064453125,
0.54541015625,
-0.2529296875,
-0.406005859375,
0.7255859375,
0.52880859375,
-0.026458740234375,
0.1217041015625,
-0.11090087890625,
-0.302734375,
-0.469970703125,
0.7744140625,
0.52099609375,
0.0270538330078125,
-0.400146484375,
0.1844482421875,
0.07269287109375,
-1.0009765625,
0.206787109375,
-0.2890625,
0.2958984375,
0.048675537109375,
-0.7705078125,
0.4072265625,
1.1650390625,
-0.5576171875,
0.460693359375,
0.53564453125,
0.09197998046875,
0.8056640625,
0.18896484375,
0.27294921875,
0.55322265625,
0.0447998046875,
-0.58154296875,
-0.09759521484375,
0.52490234375,
-0.055389404296875,
0.286376953125,
-0.299072265625,
-0.45703125,
-1.2685546875,
-0.09136962890625,
0.037933349609375,
0.53076171875,
0.37841796875,
-0.3125,
0.2060546875,
-0.049346923828125,
-0.489501953125,
-0.03863525390625,
-0.98974609375,
-0.763671875,
0.65771484375,
-0.0033893585205078125,
-0.319580078125,
-0.1070556640625,
-0.80908203125,
-0.08807373046875,
0.2193603515625,
0.0204925537109375,
-0.06976318359375,
0.322265625,
-0.6328125,
0.59521484375,
-0.27685546875,
0.1484375,
0.1529541015625,
0.5966796875,
-0.6240234375,
-0.427978515625,
0.435791015625,
1.0546875,
-0.2452392578125,
-0.13037109375,
-0.406005859375,
0.412109375,
-0.407958984375,
-0.0455322265625,
-0.28173828125,
0.227294921875,
-0.1922607421875,
0.353271484375,
-1.111328125,
0.3095703125,
-0.14111328125,
0.489013671875,
0.2293701171875,
-0.4892578125,
-0.476806640625,
0.6796875,
0.72021484375,
0.0157470703125,
0.01329803466796875,
0.309814453125,
0.61865234375,
-0.12371826171875,
0.132080078125,
-0.43310546875,
0.30029296875,
0.56494140625,
0.56005859375,
-0.146484375,
0.6806640625,
0.75244140625,
0.314697265625,
-0.046417236328125,
0.51708984375,
0.180419921875,
-0.221435546875,
-0.07568359375,
-0.372802734375,
-0.2476806640625,
-0.58544921875,
-0.74560546875,
0.319091796875,
-0.320556640625,
0.01528167724609375,
-0.09521484375,
-0.6103515625,
0.9921875,
-0.477783203125,
-0.5087890625,
0.259765625,
-0.227783203125,
-0.053131103515625,
0.454345703125,
0.23291015625,
-0.2271728515625,
0.75537109375,
0.68505859375,
0.98876953125,
1.0224609375,
0.48388671875,
-0.1256103515625,
-0.7392578125,
0.1375732421875,
0.052459716796875,
0.15185546875,
-0.2181396484375,
-0.5087890625,
-1.03515625,
0.55126953125,
-0.5712890625,
-0.0182342529296875,
0.222412109375,
-0.81640625,
0.11285400390625,
-0.47900390625,
0.71923828125,
-0.8193359375,
0.25048828125,
0.264404296875,
-0.35107421875,
-1.0537109375,
0.456298828125,
-0.109619140625,
0.08953857421875,
0.51611328125,
0.83740234375,
0.44189453125,
1.28515625,
0.470458984375,
-0.2108154296875,
0.055511474609375,
0.59423828125,
-0.08917236328125,
-0.79248046875,
-0.0728759765625,
-0.2281494140625,
0.04510498046875,
-0.2269287109375,
-0.25390625,
0.01128387451171875,
0.342041015625,
0.1329345703125,
-0.54638671875,
-0.61669921875,
0.052032470703125,
-0.5,
0.472900390625,
0.0445556640625,
0.090576171875,
-0.328857421875,
-0.11236572265625,
-0.395751953125,
-0.513671875,
0.292236328125,
-0.368896484375,
0.072998046875,
-0.5830078125,
-0.40673828125,
-0.5859375,
-0.57763671875,
0.032958984375,
-0.2027587890625,
-0.7548828125,
-1.0439453125,
0.52490234375,
0.441650390625,
0.38232421875,
0.52490234375,
-0.18017578125,
0.1610107421875,
1.2451171875,
0.6943359375,
0.18896484375,
1.0556640625,
0.363037109375,
-0.04638671875,
0.255126953125,
-0.2000732421875,
0.64306640625,
-0.019256591796875,
-0.11083984375,
-0.51513671875,
0.37890625,
-0.5009765625,
-1.12890625,
0.0305328369140625,
0.74267578125,
0.3369140625,
-0.9013671875,
-1.0947265625,
-0.276611328125,
-0.98583984375,
-0.07818603515625,
-0.392822265625,
0.51806640625,
-0.023406982421875,
0.188232421875,
-0.367431640625,
-1.173828125,
4.41015625,
0.912109375,
0.81103515625,
-0.1324462890625,
0.339599609375,
1.0625,
0.544921875,
-0.65234375,
-0.22802734375,
-0.81689453125,
0.401611328125,
-0.73095703125,
0.0214691162109375,
0.9716796875,
0.1878662109375,
0.48046875,
-0.83837890625,
-0.10723876953125,
-0.354248046875,
-0.9091796875,
-1.0234375,
0.353759765625,
0.11993408203125,
0.458740234375,
0.062042236328125,
0.486083984375,
0.62939453125,
-0.46533203125,
-0.10546875,
-0.69091796875,
-0.0290069580078125,
-0.409423828125,
0.85400390625,
-0.31298828125,
-0.40966796875,
0.82421875,
-0.230224609375,
-0.412353515625,
-0.299072265625,
0.1885986328125,
-0.36865234375,
-0.0229339599609375,
0.410888671875,
-0.615234375,
0.061004638671875,
0.49951171875,
-0.60986328125,
0.5341796875,
0.31103515625,
-0.97607421875,
0.9150390625,
-0.2056884765625,
0.40966796875,
-0.8515625,
-0.8232421875,
0.12060546875,
-0.056182861328125,
-0.421875,
-0.283447265625,
0.572265625,
0.51611328125,
0.1673583984375,
0.2105712890625,
0.6865234375,
-0.54638671875,
0.919921875,
0.023956298828125,
0.472412109375,
-0.33837890625,
0.2132568359375,
-0.32275390625,
-0.049530029296875,
-0.137939453125,
-0.188232421875,
0.48681640625,
0.53955078125,
-0.044952392578125,
0.2491455078125,
1.0712890625,
-0.71337890625,
0.177001953125,
-0.22509765625,
-0.1551513671875,
-0.5634765625,
0.29443359375,
1.365234375,
-0.59423828125,
-0.47412109375,
-0.29833984375,
0.6240234375,
0.2218017578125,
0.68359375,
0.06060791015625,
-0.8466796875,
-0.57763671875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Submitted Solution:
```
n = int(input())
words = []
letters = []
for i in range(n):
word = input()
if len(word) > 1:
a = word[0]
b = None
for j in word:
if j == a:
continue
else:
if b == None:
b = j
if j == b:
continue
break
else:
words.append(word)
if a not in letters:
letters.append(a)
if b not in letters:
letters.append(b)
else:
words.append(word)
if word not in letters:
letters.append(word)
len_let = len(letters)
maximum = 0
for i in range(len_let):
for j in range(i + 1, len_let):
a = letters[i]
b = letters[j]
counter = 0
for word in words:
for z in word:
if a != z and b != z:
break
else:
counter += len(word)
if counter > maximum:
maximum = counter
print(maximum)
```
No
| 65,221
|
[
0.1583251953125,
0.1697998046875,
0.2587890625,
0.58935546875,
-0.779296875,
-0.2130126953125,
0.251220703125,
-0.027801513671875,
0.0970458984375,
0.6640625,
0.6728515625,
-0.11181640625,
-0.1763916015625,
-0.361572265625,
-0.60400390625,
-0.0003829002380371094,
-0.66455078125,
-0.685546875,
-0.703125,
-0.0096282958984375,
0.129638671875,
-0.252685546875,
-1.4541015625,
0.032623291015625,
-0.580078125,
1.02734375,
0.1671142578125,
-0.0999755859375,
1.326171875,
1.203125,
-0.1982421875,
-0.476318359375,
0.2276611328125,
-0.5908203125,
-0.36865234375,
-0.1171875,
0.740234375,
-0.88720703125,
-0.412109375,
-0.33935546875,
0.052001953125,
-0.61572265625,
0.4775390625,
-0.475341796875,
-1.13671875,
-0.13232421875,
-0.184326171875,
-0.39599609375,
-0.260498046875,
-0.61474609375,
0.349853515625,
-0.337890625,
0.46240234375,
-0.22900390625,
-0.0034275054931640625,
-0.04693603515625,
-0.2164306640625,
-0.03118896484375,
-0.285400390625,
0.142333984375,
0.306640625,
0.330322265625,
0.061309814453125,
-0.83740234375,
-0.1480712890625,
0.33349609375,
0.0443115234375,
0.154296875,
0.2391357421875,
-0.023834228515625,
-0.0168304443359375,
-0.0223236083984375,
-0.326171875,
-0.215576171875,
-0.27880859375,
0.0155029296875,
0.4423828125,
-0.39892578125,
-0.9326171875,
1.0205078125,
-0.1434326171875,
0.66943359375,
0.251220703125,
-0.08941650390625,
-0.471435546875,
-0.25341796875,
0.417724609375,
0.36962890625,
0.421142578125,
-0.27294921875,
-0.337890625,
0.30078125,
-0.50927734375,
-0.1348876953125,
0.7744140625,
0.3876953125,
-0.355712890625,
0.1995849609375,
0.1932373046875,
0.269287109375,
0.89697265625,
0.9853515625,
-0.11187744140625,
1.3447265625,
-0.5302734375,
0.1734619140625,
0.37060546875,
-0.24072265625,
-0.357666015625,
-0.2078857421875,
-0.13720703125,
-0.336181640625,
0.41796875,
0.11181640625,
-0.4375,
0.82666015625,
-0.006938934326171875,
0.8212890625,
-0.81005859375,
0.186767578125,
0.54443359375,
0.128662109375,
0.06134033203125,
0.1505126953125,
0.2259521484375,
-0.619140625,
-0.6171875,
0.830078125,
-0.58056640625,
-0.07928466796875,
0.32275390625,
-0.0080413818359375,
-0.455810546875,
0.5810546875,
-0.08245849609375,
0.294921875,
-0.1888427734375,
0.22314453125,
0.78125,
-0.5322265625,
0.8828125,
0.07861328125,
-0.034088134765625,
1.3349609375,
0.4267578125,
0.2236328125,
0.5029296875,
0.184814453125,
-0.7041015625,
0.666015625,
-0.96923828125,
0.7119140625,
0.0369873046875,
0.410888671875,
-0.8017578125,
0.356201171875,
-0.12939453125,
0.183349609375,
0.355224609375,
0.060302734375,
-0.254638671875,
0.358154296875,
-0.5107421875,
0.9765625,
-0.445068359375,
0.8779296875,
-0.50048828125,
-0.1427001953125,
-0.3056640625,
-0.42578125,
0.1727294921875,
-0.392578125,
-0.07623291015625,
0.74951171875,
0.268310546875,
1.26953125,
1.0478515625,
-0.12548828125,
0.339111328125,
0.11181640625,
-0.400634765625,
0.287109375,
0.264404296875,
0.99267578125,
0.1998291015625,
0.385498046875,
-0.1370849609375,
-0.236572265625,
-0.65869140625,
-0.52587890625,
0.1910400390625,
0.6142578125,
-0.853515625,
0.08648681640625,
-0.11749267578125,
0.1513671875,
-1.1708984375,
0.04547119140625,
0.30224609375,
-0.77783203125,
-0.56298828125,
0.38330078125,
-0.058013916015625,
0.62353515625,
-0.36865234375,
-0.3984375,
0.4248046875,
1.2529296875,
-0.321533203125,
0.155029296875,
0.681640625,
0.398193359375,
-0.0697021484375,
-0.048370361328125,
0.2724609375,
-0.29150390625,
-0.9931640625,
0.35693359375,
-0.1920166015625,
-0.225830078125,
0.2724609375,
0.211181640625,
0.38818359375,
0.1614990234375,
-0.5859375,
-0.09149169921875,
0.876953125,
1.3330078125,
-0.208740234375,
0.65771484375,
0.1341552734375,
0.94140625,
0.3505859375,
0.63818359375,
0.3828125,
-0.070068359375,
0.77685546875,
0.66357421875,
-0.10009765625,
0.4453125,
0.1671142578125,
0.41357421875,
0.39013671875,
0.95849609375,
0.270751953125,
0.474853515625,
-0.144775390625,
-0.2362060546875,
-0.403564453125,
0.66162109375,
-0.33984375,
0.37109375,
0.055023193359375,
0.421875,
-0.630859375,
-0.3603515625,
0.4892578125,
0.7548828125,
-0.76171875,
-0.54248046875,
-0.32958984375,
0.43310546875,
0.01320648193359375,
0.2042236328125,
0.221923828125,
0.185546875,
0.2490234375,
0.273193359375,
0.104248046875,
0.11016845703125,
-0.85400390625,
-0.56982421875,
-1.0703125,
-0.355712890625,
-0.5986328125,
-0.38671875,
0.17626953125,
-0.822265625,
0.378662109375,
-0.2425537109375,
-0.22607421875,
-0.1142578125,
-0.58349609375,
0.387939453125,
-0.480224609375,
0.7998046875,
-0.7958984375,
0.4287109375,
0.10736083984375,
1.0419921875,
-0.05267333984375,
-0.30615234375,
-0.343994140625,
-0.60693359375,
0.412841796875,
-0.308349609375,
0.491455078125,
0.061767578125,
-0.95751953125,
-0.9384765625,
-0.1163330078125,
-0.294677734375,
-0.258056640625,
0.1309814453125,
-0.58740234375,
0.79736328125,
0.0989990234375,
-0.5810546875,
0.74560546875,
0.5439453125,
-1.0146484375,
0.277587890625,
0.2237548828125,
-0.0306854248046875,
-0.8984375,
1.181640625,
0.4921875,
0.685546875,
-0.529296875,
-0.301513671875,
-0.36474609375,
0.1248779296875,
0.21630859375,
-0.496826171875,
-0.41748046875,
0.41357421875,
0.07586669921875,
-1.4130859375,
0.35791015625,
-1.125,
-0.84716796875,
-0.60009765625,
-0.59423828125,
0.876953125,
0.8125,
0.043548583984375,
-0.1761474609375,
-0.78759765625,
-0.317626953125,
0.50634765625,
0.4306640625,
-0.8984375,
-0.2154541015625,
0.8876953125,
-0.1473388671875,
-0.0377197265625,
0.1717529296875,
-0.65283203125,
-0.432373046875,
-0.0191192626953125,
0.37158203125,
0.724609375,
0.19189453125,
0.28369140625,
0.264404296875,
0.525390625,
-0.89697265625,
-0.313232421875,
-0.29638671875,
0.7587890625,
0.299072265625,
0.73974609375,
0.58447265625,
-0.475341796875,
-0.73193359375,
-1.0087890625,
0.6298828125,
0.392822265625,
0.82275390625,
-0.5517578125,
0.7373046875,
0.2186279296875,
-0.7314453125,
0.6708984375,
-0.58203125,
0.2078857421875,
1.189453125,
0.0635986328125,
0.935546875,
-0.66845703125,
0.11932373046875,
-0.33349609375,
-0.01143646240234375,
1.029296875,
0.548828125,
0.33935546875,
-0.2362060546875,
-0.60595703125,
-0.1937255859375,
-0.2176513671875,
-0.39697265625,
-0.634765625,
0.11175537109375,
-0.2626953125,
-0.133056640625,
-0.89990234375,
0.208740234375,
0.3515625,
0.60546875,
0.1251220703125,
1.0078125,
0.2646484375,
0.322265625,
0.477294921875,
-0.26611328125,
0.359375,
-0.46728515625,
1.2978515625,
-0.2127685546875,
-0.176513671875,
-0.7587890625,
-0.1639404296875,
-0.31640625,
-0.0699462890625,
-0.06695556640625,
0.278564453125,
-0.7666015625,
0.0948486328125,
-0.0038318634033203125,
0.35498046875,
-0.9189453125,
0.1689453125,
-0.1605224609375,
0.382080078125,
0.4755859375,
-0.7333984375,
0.227294921875,
-0.85546875,
0.51220703125,
0.372314453125,
-0.12115478515625,
-0.81103515625,
-0.283447265625,
-1.0625,
-0.91259765625,
-0.08819580078125,
0.68359375,
-0.376220703125,
0.1334228515625,
-0.58544921875,
0.297119140625,
0.412353515625,
-0.47607421875,
0.1746826171875,
-0.1973876953125,
0.65234375,
0.156005859375,
0.728515625,
-0.475341796875,
-0.358154296875,
0.341552734375,
-0.93408203125,
0.50146484375,
-0.33984375,
0.2939453125,
0.085693359375,
-0.00238800048828125,
-0.044921875,
0.2130126953125,
0.1064453125,
0.416259765625,
-0.107421875,
0.673828125,
-0.7548828125,
-0.61328125,
0.6796875,
-0.2491455078125,
-0.38330078125,
0.9384765625,
-0.447998046875,
-0.04144287109375,
0.345947265625,
0.20654296875,
-0.7001953125,
0.291748046875,
-0.56396484375,
0.475830078125,
-0.046539306640625,
-0.77978515625,
0.143310546875,
-0.6025390625,
0.53271484375,
-0.289306640625,
-0.38134765625,
-0.266845703125,
-1.4541015625,
-0.09844970703125,
-0.1436767578125,
-0.73876953125,
0.34423828125,
0.370849609375,
-0.40185546875,
-0.38232421875,
-0.28466796875,
-0.611328125,
-0.2646484375,
-0.20654296875,
-0.2340087890625,
-0.109130859375,
0.300537109375,
1.0263671875,
0.0889892578125,
-0.221435546875,
0.1070556640625,
-0.0145263671875,
-0.337890625,
-0.47265625,
-0.54248046875,
0.0203857421875,
-0.59521484375,
-0.045623779296875,
0.6728515625,
-0.10205078125,
-0.0531005859375,
0.8779296875,
-0.154052734375,
0.2408447265625,
0.397216796875,
-0.4580078125,
1.2451171875,
0.1114501953125,
-1.3359375,
-0.471923828125,
0.79248046875,
-0.1363525390625,
0.487548828125,
0.0670166015625,
-1.052734375,
-0.97900390625,
-0.587890625,
0.2064208984375,
-0.5927734375,
-0.160888671875,
-0.9990234375,
-0.4873046875,
-0.1837158203125,
0.74609375,
-0.1707763671875,
-0.1685791015625,
0.292724609375,
-1.2626953125,
0.2310791015625,
-0.78076171875,
0.0914306640625,
-0.64208984375,
-0.5029296875,
-0.432373046875,
1.0791015625,
0.26318359375,
0.341552734375,
-0.1544189453125,
0.0643310546875,
0.51708984375,
-0.344970703125,
-0.32080078125,
-0.5078125,
0.048492431640625,
0.1424560546875,
0.0667724609375,
-0.260498046875,
-0.65625,
0.97314453125,
-0.62744140625,
0.25927734375,
-0.2890625,
-0.50927734375,
0.04754638671875,
-0.417236328125,
1.041015625,
-0.48681640625,
0.18408203125,
-0.5927734375,
0.361572265625,
0.8203125,
-0.0997314453125,
-0.673828125,
-0.355712890625,
-0.457763671875,
-1.1376953125,
0.55126953125,
-0.364990234375,
0.425048828125,
-0.472900390625,
0.01515960693359375,
1.1943359375,
-0.65185546875,
0.5390625,
1.40625,
0.07379150390625,
0.60205078125,
-0.499267578125,
0.387451171875,
0.52294921875,
-0.54296875,
-0.1383056640625,
0.10845947265625,
-0.83056640625,
0.5478515625,
-0.342529296875,
-0.99658203125,
-0.87353515625,
0.31689453125,
1.14453125,
-0.2420654296875,
0.75537109375,
-0.0755615234375,
-1.1484375,
-0.5986328125,
0.80029296875,
0.133544921875,
0.0291900634765625,
0.8486328125,
-0.396484375,
-0.213623046875,
-0.020721435546875,
-0.2169189453125,
-0.259033203125,
-0.673828125,
0.9423828125,
-0.175048828125,
-0.701171875,
0.8125,
0.986328125,
-0.9140625,
-0.89697265625,
-0.016632080078125,
0.0745849609375,
-0.025634765625,
-0.59912109375,
0.2181396484375,
0.64794921875,
-0.65673828125,
0.1527099609375,
0.36474609375,
-0.61083984375,
0.466796875,
-0.08074951171875,
0.359375,
-0.48681640625,
0.486083984375,
0.68994140625,
-0.445068359375,
-0.11676025390625,
-0.650390625,
0.1297607421875,
-0.1329345703125,
0.1728515625,
0.7333984375,
-0.238037109375,
0.0361328125,
0.347412109375,
-0.34765625,
0.888671875,
-0.394287109375,
-0.1656494140625,
0.31103515625,
-0.62109375,
-0.51953125,
-0.303955078125,
0.46826171875,
-0.07098388671875,
0.1082763671875,
-0.61572265625,
-0.2244873046875,
0.4365234375,
0.10528564453125,
-0.11474609375,
-0.55615234375,
-0.3291015625,
-0.4697265625,
-0.5458984375,
-0.5,
-0.387939453125,
-0.006885528564453125,
0.409423828125,
0.3916015625,
-0.42529296875,
-0.005146026611328125,
0.92919921875,
-0.67578125,
0.7880859375,
-0.5869140625,
0.3525390625,
-0.74560546875,
-0.62353515625,
-0.52978515625,
-0.004917144775390625,
-1.126953125,
-0.182373046875,
-0.41748046875,
0.397705078125,
-0.11614990234375,
0.271728515625,
-0.04290771484375,
0.384765625,
-0.295654296875,
-0.3046875,
0.5556640625,
-0.2349853515625,
-0.43212890625,
0.71142578125,
0.5732421875,
-0.047119140625,
0.1495361328125,
-0.09271240234375,
-0.281005859375,
-0.509765625,
0.77294921875,
0.50146484375,
0.05078125,
-0.373779296875,
0.1651611328125,
0.03558349609375,
-0.98876953125,
0.2069091796875,
-0.27734375,
0.28466796875,
0.053314208984375,
-0.796875,
0.435791015625,
1.1572265625,
-0.489990234375,
0.44140625,
0.52783203125,
0.1551513671875,
0.78857421875,
0.156005859375,
0.26708984375,
0.52197265625,
0.048614501953125,
-0.58447265625,
-0.12286376953125,
0.5361328125,
-0.044891357421875,
0.271484375,
-0.265869140625,
-0.47265625,
-1.2724609375,
-0.11077880859375,
0.004230499267578125,
0.52490234375,
0.38330078125,
-0.29736328125,
0.226318359375,
-0.0831298828125,
-0.513671875,
-0.0304412841796875,
-0.96142578125,
-0.703125,
0.6923828125,
-0.0347900390625,
-0.327392578125,
-0.10943603515625,
-0.841796875,
-0.08868408203125,
0.218994140625,
0.058807373046875,
-0.061126708984375,
0.33447265625,
-0.646484375,
0.56005859375,
-0.307373046875,
0.17822265625,
0.16552734375,
0.53857421875,
-0.67578125,
-0.409423828125,
0.444091796875,
1.07421875,
-0.258056640625,
-0.1273193359375,
-0.4072265625,
0.397705078125,
-0.407470703125,
-0.05364990234375,
-0.255859375,
0.220458984375,
-0.154296875,
0.30029296875,
-1.0791015625,
0.282958984375,
-0.1259765625,
0.51416015625,
0.19580078125,
-0.49462890625,
-0.505859375,
0.64208984375,
0.69189453125,
0.03302001953125,
0.047943115234375,
0.30029296875,
0.60302734375,
-0.1475830078125,
0.12249755859375,
-0.452392578125,
0.31591796875,
0.53662109375,
0.51904296875,
-0.11859130859375,
0.6787109375,
0.73486328125,
0.277099609375,
-0.073974609375,
0.50927734375,
0.1885986328125,
-0.1844482421875,
-0.096435546875,
-0.354736328125,
-0.19140625,
-0.6064453125,
-0.75537109375,
0.348876953125,
-0.31640625,
0.017822265625,
-0.08380126953125,
-0.5986328125,
1.037109375,
-0.494873046875,
-0.494873046875,
0.2047119140625,
-0.2138671875,
-0.10064697265625,
0.451171875,
0.25341796875,
-0.2027587890625,
0.74072265625,
0.6640625,
0.98046875,
1.0576171875,
0.481201171875,
-0.1800537109375,
-0.74365234375,
0.143798828125,
0.0755615234375,
0.162841796875,
-0.23779296875,
-0.587890625,
-1.0322265625,
0.54638671875,
-0.53955078125,
0.0021724700927734375,
0.221435546875,
-0.80078125,
0.1240234375,
-0.48486328125,
0.7197265625,
-0.8447265625,
0.274658203125,
0.259033203125,
-0.347900390625,
-1.0615234375,
0.4462890625,
-0.11492919921875,
0.08062744140625,
0.53369140625,
0.81689453125,
0.38623046875,
1.224609375,
0.4873046875,
-0.2381591796875,
0.05615234375,
0.59814453125,
-0.0555419921875,
-0.794921875,
-0.070068359375,
-0.2318115234375,
0.0175628662109375,
-0.2088623046875,
-0.244384765625,
-0.036773681640625,
0.352783203125,
0.1285400390625,
-0.57470703125,
-0.640625,
0.05694580078125,
-0.425537109375,
0.446533203125,
0.035430908203125,
0.1302490234375,
-0.300048828125,
-0.0645751953125,
-0.43212890625,
-0.464599609375,
0.29736328125,
-0.3857421875,
0.09027099609375,
-0.5732421875,
-0.4052734375,
-0.552734375,
-0.54931640625,
0.06298828125,
-0.1497802734375,
-0.83154296875,
-1.017578125,
0.52001953125,
0.401123046875,
0.382080078125,
0.498046875,
-0.1690673828125,
0.163818359375,
1.2490234375,
0.71826171875,
0.1634521484375,
1.0830078125,
0.376220703125,
-0.02459716796875,
0.2425537109375,
-0.234619140625,
0.64404296875,
-0.05975341796875,
-0.1075439453125,
-0.509765625,
0.37939453125,
-0.51025390625,
-1.12109375,
0.0145416259765625,
0.744140625,
0.385986328125,
-0.89404296875,
-1.130859375,
-0.254150390625,
-0.98095703125,
-0.09136962890625,
-0.374755859375,
0.498779296875,
-0.040191650390625,
0.1466064453125,
-0.391845703125,
-1.1748046875,
4.41015625,
0.939453125,
0.77734375,
-0.1328125,
0.310791015625,
1.0234375,
0.54296875,
-0.62939453125,
-0.21484375,
-0.81396484375,
0.375732421875,
-0.7109375,
-0.0404052734375,
0.951171875,
0.19580078125,
0.497314453125,
-0.82861328125,
-0.1383056640625,
-0.364013671875,
-0.9501953125,
-1.013671875,
0.375,
0.11529541015625,
0.420166015625,
0.021392822265625,
0.49755859375,
0.63525390625,
-0.48193359375,
-0.120849609375,
-0.6708984375,
-0.06390380859375,
-0.4345703125,
0.87841796875,
-0.27783203125,
-0.430419921875,
0.79052734375,
-0.2381591796875,
-0.406494140625,
-0.328369140625,
0.1370849609375,
-0.37353515625,
-0.001651763916015625,
0.441650390625,
-0.58544921875,
0.06024169921875,
0.52392578125,
-0.61572265625,
0.55029296875,
0.300537109375,
-0.9345703125,
0.93017578125,
-0.2396240234375,
0.412353515625,
-0.84814453125,
-0.85791015625,
0.1448974609375,
-0.0379638671875,
-0.366943359375,
-0.24267578125,
0.52294921875,
0.490234375,
0.111572265625,
0.251708984375,
0.6826171875,
-0.56201171875,
0.92919921875,
0.050537109375,
0.4248046875,
-0.374755859375,
0.2137451171875,
-0.291748046875,
-0.08441162109375,
-0.1221923828125,
-0.190673828125,
0.5263671875,
0.56396484375,
-0.048126220703125,
0.252197265625,
1.0634765625,
-0.77783203125,
0.1558837890625,
-0.2340087890625,
-0.1705322265625,
-0.54150390625,
0.26806640625,
1.3515625,
-0.57666015625,
-0.51220703125,
-0.3095703125,
0.6103515625,
0.234619140625,
0.74853515625,
0.04583740234375,
-0.82666015625,
-0.5634765625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written any article, he just decided to take a random one from magazine 26Char. However, before sending it to the magazine 2Char, he needs to adapt the text to the format of the journal. To do so, he removes some words from the chosen article, in such a way that the remaining text can be written using no more than two distinct letters.
Since the payment depends from the number of non-space characters in the article, Andrew wants to keep the words with the maximum total length.
Input
The first line of the input contains number n (1 ≤ n ≤ 100) — the number of words in the article chosen by Andrew. Following are n lines, each of them contains one word. All the words consist only of small English letters and their total length doesn't exceed 1000. The words are not guaranteed to be distinct, in this case you are allowed to use a word in the article as many times as it appears in the input.
Output
Print a single integer — the maximum possible total length of words in Andrew's article.
Examples
Input
4
abb
cacc
aaa
bbb
Output
9
Input
5
a
a
bcbcb
cdecdecdecdecdecde
aaaa
Output
6
Note
In the first sample the optimal way to choose words is {'abb', 'aaa', 'bbb'}.
In the second sample the word 'cdecdecdecdecdecde' consists of three distinct letters, and thus cannot be used in the article. The optimal answer is {'a', 'a', 'aaaa'}.
Submitted Solution:
```
import sys
stuff = sys.stdin.readlines()
maximum_length = int(stuff[0])
stuff.pop(0)
stuff = [n.rstrip('\n') for n in stuff]
result = [len(n) for n in stuff if len(n) < maximum_length]
print(sum(result))
```
No
| 65,222
|
[
0.2158203125,
0.049346923828125,
0.323486328125,
0.6806640625,
-0.7939453125,
-0.1685791015625,
0.264892578125,
-0.07012939453125,
0.1173095703125,
0.61962890625,
0.7099609375,
-0.092041015625,
-0.180419921875,
-0.52099609375,
-0.6025390625,
0.115966796875,
-0.5615234375,
-0.71875,
-0.6787109375,
0.0309600830078125,
0.15234375,
-0.282470703125,
-1.357421875,
0.02630615234375,
-0.60302734375,
1.0390625,
0.254150390625,
-0.0307464599609375,
1.357421875,
1.1689453125,
-0.27001953125,
-0.44091796875,
0.2252197265625,
-0.603515625,
-0.27978515625,
-0.15380859375,
0.74267578125,
-0.8671875,
-0.464599609375,
-0.329833984375,
0.0232696533203125,
-0.62255859375,
0.55712890625,
-0.51220703125,
-1.08203125,
-0.052093505859375,
-0.1864013671875,
-0.374267578125,
-0.1446533203125,
-0.6513671875,
0.35693359375,
-0.276123046875,
0.4521484375,
-0.2252197265625,
-0.00218963623046875,
-0.057281494140625,
-0.294677734375,
0.08477783203125,
-0.28271484375,
0.1396484375,
0.413818359375,
0.31494140625,
0.072021484375,
-0.83984375,
-0.047454833984375,
0.4130859375,
0.0396728515625,
0.1273193359375,
0.217041015625,
-0.07525634765625,
0.07550048828125,
0.070068359375,
-0.344970703125,
-0.290771484375,
-0.287109375,
-0.0241851806640625,
0.421630859375,
-0.23974609375,
-0.97119140625,
1.04296875,
0.04571533203125,
0.669921875,
0.236572265625,
-0.06329345703125,
-0.5009765625,
-0.339111328125,
0.371826171875,
0.320556640625,
0.393310546875,
-0.2802734375,
-0.36962890625,
0.266845703125,
-0.412841796875,
-0.1707763671875,
0.71142578125,
0.39013671875,
-0.405517578125,
0.23046875,
0.15673828125,
0.23828125,
0.923828125,
0.93408203125,
-0.069580078125,
1.3271484375,
-0.46826171875,
0.22998046875,
0.458251953125,
-0.2099609375,
-0.358642578125,
-0.1551513671875,
-0.1251220703125,
-0.311279296875,
0.45703125,
0.1845703125,
-0.374755859375,
0.77490234375,
0.000025987625122070312,
0.74462890625,
-0.85791015625,
0.252685546875,
0.525390625,
0.09521484375,
0.06048583984375,
0.10693359375,
0.156494140625,
-0.6591796875,
-0.6318359375,
0.865234375,
-0.5634765625,
-0.10589599609375,
0.1639404296875,
0.005634307861328125,
-0.449951171875,
0.583984375,
-0.0462646484375,
0.40673828125,
-0.2200927734375,
0.2376708984375,
0.7783203125,
-0.58056640625,
0.89013671875,
-0.0758056640625,
-0.0166015625,
1.29296875,
0.448486328125,
0.301025390625,
0.51318359375,
0.253662109375,
-0.634765625,
0.6025390625,
-1.00390625,
0.65234375,
-0.00876617431640625,
0.3359375,
-0.76025390625,
0.36669921875,
-0.1058349609375,
0.2578125,
0.341796875,
0.0243072509765625,
-0.260986328125,
0.4130859375,
-0.53271484375,
0.96484375,
-0.50439453125,
0.88916015625,
-0.425537109375,
-0.08575439453125,
-0.337890625,
-0.3359375,
0.1600341796875,
-0.4482421875,
-0.08154296875,
0.72119140625,
0.25048828125,
1.25390625,
1.0205078125,
-0.05645751953125,
0.35791015625,
0.1453857421875,
-0.37646484375,
0.34619140625,
0.1680908203125,
1.0458984375,
0.1990966796875,
0.371337890625,
-0.0806884765625,
-0.247314453125,
-0.650390625,
-0.6064453125,
0.2445068359375,
0.499755859375,
-0.85595703125,
0.1492919921875,
-0.0408935546875,
0.1280517578125,
-1.2158203125,
0.12060546875,
0.32958984375,
-0.76123046875,
-0.59814453125,
0.358642578125,
-0.07379150390625,
0.56640625,
-0.354736328125,
-0.447998046875,
0.51904296875,
1.28515625,
-0.344970703125,
0.12646484375,
0.72705078125,
0.390869140625,
-0.04693603515625,
0.006504058837890625,
0.2462158203125,
-0.350830078125,
-0.986328125,
0.390625,
-0.21630859375,
-0.30322265625,
0.2218017578125,
0.293212890625,
0.423095703125,
0.1075439453125,
-0.5166015625,
-0.07373046875,
0.76806640625,
1.337890625,
-0.25927734375,
0.7099609375,
0.08123779296875,
0.892578125,
0.298583984375,
0.646484375,
0.309326171875,
-0.0770263671875,
0.83154296875,
0.55029296875,
-0.114013671875,
0.4345703125,
0.1571044921875,
0.3720703125,
0.2352294921875,
0.8837890625,
0.32177734375,
0.427001953125,
-0.187744140625,
-0.253173828125,
-0.36376953125,
0.53173828125,
-0.376708984375,
0.4853515625,
-0.046966552734375,
0.41015625,
-0.7587890625,
-0.3955078125,
0.414306640625,
0.87353515625,
-0.7841796875,
-0.5458984375,
-0.339599609375,
0.403076171875,
0.0038089752197265625,
0.1922607421875,
0.1474609375,
0.1964111328125,
0.1512451171875,
0.26904296875,
0.0943603515625,
0.1832275390625,
-0.79638671875,
-0.5029296875,
-1.1123046875,
-0.44091796875,
-0.56689453125,
-0.340576171875,
0.1593017578125,
-0.83740234375,
0.40380859375,
-0.217529296875,
-0.2264404296875,
-0.1031494140625,
-0.497802734375,
0.349853515625,
-0.470703125,
0.60986328125,
-0.9072265625,
0.45947265625,
0.09649658203125,
1.1298828125,
-0.1134033203125,
-0.242919921875,
-0.3798828125,
-0.595703125,
0.354248046875,
-0.18017578125,
0.38134765625,
0.11187744140625,
-0.86572265625,
-0.9775390625,
-0.1822509765625,
-0.2880859375,
-0.258544921875,
0.06512451171875,
-0.60693359375,
0.69873046875,
0.282470703125,
-0.72216796875,
0.80029296875,
0.55224609375,
-1.0263671875,
0.220458984375,
0.2431640625,
0.01387786865234375,
-0.96044921875,
1.1591796875,
0.5048828125,
0.728515625,
-0.5732421875,
-0.201904296875,
-0.443603515625,
0.1875,
0.255859375,
-0.476318359375,
-0.478271484375,
0.4521484375,
0.10693359375,
-1.328125,
0.53076171875,
-1.205078125,
-0.845703125,
-0.61962890625,
-0.6767578125,
0.85888671875,
0.8154296875,
0.0872802734375,
-0.30712890625,
-0.79150390625,
-0.267578125,
0.5146484375,
0.45556640625,
-0.7724609375,
-0.12481689453125,
0.89111328125,
-0.12841796875,
0.00405120849609375,
0.1197509765625,
-0.7392578125,
-0.318603515625,
-0.01251983642578125,
0.351806640625,
0.7294921875,
0.2161865234375,
0.4140625,
0.2154541015625,
0.49462890625,
-0.9384765625,
-0.2196044921875,
-0.2919921875,
0.642578125,
0.29150390625,
0.68115234375,
0.62451171875,
-0.4814453125,
-0.73779296875,
-0.869140625,
0.53125,
0.284912109375,
0.849609375,
-0.56298828125,
0.6650390625,
0.158935546875,
-0.76171875,
0.767578125,
-0.55224609375,
0.2423095703125,
1.171875,
-0.06964111328125,
0.90087890625,
-0.7666015625,
0.1009521484375,
-0.2127685546875,
0.016082763671875,
1.076171875,
0.47509765625,
0.29931640625,
-0.274658203125,
-0.57568359375,
-0.281494140625,
-0.151611328125,
-0.3017578125,
-0.58837890625,
0.09844970703125,
-0.216552734375,
-0.1011962890625,
-0.9873046875,
0.2442626953125,
0.4697265625,
0.60693359375,
0.2216796875,
0.978515625,
0.2091064453125,
0.350341796875,
0.5,
-0.29052734375,
0.47607421875,
-0.51171875,
1.3095703125,
-0.2093505859375,
-0.17138671875,
-0.859375,
-0.1485595703125,
-0.309814453125,
-0.00644683837890625,
-0.1375732421875,
0.271484375,
-0.8115234375,
0.0892333984375,
0.07965087890625,
0.358642578125,
-0.900390625,
0.1729736328125,
-0.188232421875,
0.32080078125,
0.43408203125,
-0.7421875,
0.2222900390625,
-0.84228515625,
0.429443359375,
0.37255859375,
-0.059722900390625,
-0.83984375,
-0.314697265625,
-1.0849609375,
-1.0166015625,
-0.01953125,
0.79296875,
-0.305908203125,
0.19873046875,
-0.6240234375,
0.24365234375,
0.385498046875,
-0.505859375,
0.249267578125,
-0.1673583984375,
0.75244140625,
0.1439208984375,
0.65478515625,
-0.381103515625,
-0.455322265625,
0.276123046875,
-0.93896484375,
0.43359375,
-0.423095703125,
0.31591796875,
0.203857421875,
0.010589599609375,
-0.0008282661437988281,
0.25048828125,
0.08428955078125,
0.408447265625,
-0.170166015625,
0.70263671875,
-0.73681640625,
-0.58349609375,
0.6875,
-0.27197265625,
-0.427734375,
0.9541015625,
-0.38330078125,
-0.08343505859375,
0.340576171875,
0.31494140625,
-0.63134765625,
0.270751953125,
-0.56640625,
0.48828125,
-0.0975341796875,
-0.71337890625,
-0.0115203857421875,
-0.457275390625,
0.64453125,
-0.25244140625,
-0.316650390625,
-0.1697998046875,
-1.4697265625,
-0.1806640625,
-0.084228515625,
-0.7021484375,
0.425537109375,
0.283203125,
-0.5166015625,
-0.3232421875,
-0.341796875,
-0.55908203125,
-0.25146484375,
-0.21630859375,
-0.31298828125,
-0.00433349609375,
0.3369140625,
1.0615234375,
-0.02740478515625,
-0.1982421875,
0.09112548828125,
0.03948974609375,
-0.41357421875,
-0.46728515625,
-0.453369140625,
0.017852783203125,
-0.58642578125,
-0.06268310546875,
0.6669921875,
-0.1651611328125,
0.0517578125,
0.9716796875,
-0.0858154296875,
0.2353515625,
0.399169921875,
-0.450439453125,
1.2158203125,
0.182861328125,
-1.3330078125,
-0.41357421875,
0.78271484375,
-0.178466796875,
0.423583984375,
0.09954833984375,
-1.0390625,
-1.001953125,
-0.5771484375,
0.2130126953125,
-0.53662109375,
-0.1214599609375,
-1.0830078125,
-0.436767578125,
-0.161376953125,
0.8046875,
-0.22021484375,
-0.2169189453125,
0.262451171875,
-1.2197265625,
0.2374267578125,
-0.83349609375,
0.016265869140625,
-0.673828125,
-0.5439453125,
-0.36767578125,
1.0810546875,
0.1676025390625,
0.34521484375,
-0.1201171875,
0.119873046875,
0.44677734375,
-0.276611328125,
-0.354248046875,
-0.5625,
0.036224365234375,
0.1746826171875,
-0.0165557861328125,
-0.184814453125,
-0.60595703125,
0.96044921875,
-0.67529296875,
0.263427734375,
-0.462646484375,
-0.45361328125,
0.004573822021484375,
-0.409912109375,
1.146484375,
-0.55517578125,
0.1712646484375,
-0.52587890625,
0.365234375,
0.8134765625,
-0.06982421875,
-0.5908203125,
-0.313720703125,
-0.43603515625,
-1.0830078125,
0.59375,
-0.398681640625,
0.3935546875,
-0.494140625,
0.0408935546875,
1.146484375,
-0.705078125,
0.54443359375,
1.3564453125,
0.10162353515625,
0.5986328125,
-0.48291015625,
0.475341796875,
0.378173828125,
-0.521484375,
-0.1331787109375,
0.111328125,
-0.8251953125,
0.424072265625,
-0.411376953125,
-1.0126953125,
-0.87744140625,
0.189697265625,
1.1806640625,
-0.29541015625,
0.7802734375,
-0.11083984375,
-1.10546875,
-0.5283203125,
0.8642578125,
0.13916015625,
0.09588623046875,
0.8291015625,
-0.403076171875,
-0.199951171875,
-0.06005859375,
-0.25927734375,
-0.26611328125,
-0.623046875,
0.99755859375,
-0.315673828125,
-0.68115234375,
0.80810546875,
1.06640625,
-0.9033203125,
-0.92333984375,
-0.180908203125,
0.049591064453125,
0.04144287109375,
-0.63037109375,
0.1759033203125,
0.57080078125,
-0.58203125,
0.12469482421875,
0.3740234375,
-0.54931640625,
0.434326171875,
-0.06524658203125,
0.236083984375,
-0.494384765625,
0.40673828125,
0.73486328125,
-0.437744140625,
-0.1650390625,
-0.58056640625,
0.128662109375,
-0.2049560546875,
0.11529541015625,
0.8701171875,
-0.358642578125,
0.05523681640625,
0.330078125,
-0.32958984375,
0.84130859375,
-0.322509765625,
-0.06903076171875,
0.32080078125,
-0.662109375,
-0.52685546875,
-0.236083984375,
0.4248046875,
-0.11328125,
0.1612548828125,
-0.61669921875,
-0.26513671875,
0.409423828125,
0.09808349609375,
-0.07513427734375,
-0.57275390625,
-0.1795654296875,
-0.55517578125,
-0.50390625,
-0.49267578125,
-0.449951171875,
0.04071044921875,
0.361328125,
0.364013671875,
-0.489990234375,
-0.1165771484375,
0.89208984375,
-0.53369140625,
0.76220703125,
-0.61865234375,
0.302734375,
-0.69873046875,
-0.62451171875,
-0.51708984375,
-0.01172637939453125,
-1.0302734375,
-0.25146484375,
-0.41357421875,
0.360107421875,
-0.10516357421875,
0.331787109375,
-0.0218048095703125,
0.340087890625,
-0.364013671875,
-0.377197265625,
0.5400390625,
-0.2373046875,
-0.355712890625,
0.66845703125,
0.66455078125,
-0.025543212890625,
0.1224365234375,
-0.0275115966796875,
-0.2113037109375,
-0.52099609375,
0.71142578125,
0.5390625,
0.027679443359375,
-0.488525390625,
0.049713134765625,
-0.07464599609375,
-1.0166015625,
0.235595703125,
-0.331298828125,
0.305908203125,
0.10162353515625,
-0.794921875,
0.5224609375,
1.16015625,
-0.47802734375,
0.42431640625,
0.537109375,
0.1549072265625,
0.8779296875,
0.14404296875,
0.264404296875,
0.5703125,
-0.0013952255249023438,
-0.56494140625,
-0.12493896484375,
0.49169921875,
-0.10101318359375,
0.273681640625,
-0.2294921875,
-0.4794921875,
-1.318359375,
-0.079833984375,
0.01253509521484375,
0.484619140625,
0.396240234375,
-0.2308349609375,
0.1678466796875,
-0.11993408203125,
-0.487548828125,
0.0213775634765625,
-0.96728515625,
-0.7421875,
0.64013671875,
-0.0465087890625,
-0.379638671875,
-0.081298828125,
-0.779296875,
-0.01493072509765625,
0.10394287109375,
0.0259552001953125,
-0.056610107421875,
0.31689453125,
-0.6611328125,
0.5849609375,
-0.27587890625,
0.04583740234375,
0.038055419921875,
0.53857421875,
-0.65673828125,
-0.402587890625,
0.4072265625,
1.0185546875,
-0.249755859375,
-0.154541015625,
-0.43994140625,
0.396240234375,
-0.3984375,
-0.054046630859375,
-0.343994140625,
0.25830078125,
-0.2022705078125,
0.319091796875,
-1.0224609375,
0.295654296875,
-0.2139892578125,
0.437744140625,
0.28955078125,
-0.5302734375,
-0.48193359375,
0.74853515625,
0.673828125,
0.109619140625,
0.006855010986328125,
0.34814453125,
0.64892578125,
-0.1141357421875,
0.143310546875,
-0.470458984375,
0.26806640625,
0.50146484375,
0.5908203125,
-0.2197265625,
0.5634765625,
0.6943359375,
0.306396484375,
-0.06298828125,
0.478271484375,
0.16064453125,
-0.20556640625,
-0.040985107421875,
-0.318359375,
-0.319091796875,
-0.60302734375,
-0.74951171875,
0.433837890625,
-0.27392578125,
-0.033599853515625,
-0.1348876953125,
-0.63037109375,
1.0078125,
-0.48974609375,
-0.465576171875,
0.27001953125,
-0.2384033203125,
-0.048309326171875,
0.486572265625,
0.1619873046875,
-0.2213134765625,
0.6650390625,
0.65234375,
0.97412109375,
0.95751953125,
0.55517578125,
-0.12200927734375,
-0.80712890625,
0.1798095703125,
0.0222015380859375,
0.2073974609375,
-0.189208984375,
-0.4599609375,
-1.12109375,
0.52978515625,
-0.47119140625,
0.05194091796875,
0.1995849609375,
-0.783203125,
0.1307373046875,
-0.55078125,
0.73583984375,
-0.87548828125,
0.164306640625,
0.30615234375,
-0.30908203125,
-1.041015625,
0.409912109375,
-0.146728515625,
0.1488037109375,
0.5302734375,
0.80078125,
0.419189453125,
1.2548828125,
0.52294921875,
-0.27880859375,
0.124267578125,
0.55029296875,
-0.09710693359375,
-0.755859375,
-0.09088134765625,
-0.2186279296875,
0.07867431640625,
-0.2171630859375,
-0.2420654296875,
0.05810546875,
0.445068359375,
0.1568603515625,
-0.47314453125,
-0.63916015625,
0.10894775390625,
-0.53662109375,
0.37255859375,
0.11505126953125,
0.0765380859375,
-0.430908203125,
-0.12255859375,
-0.471923828125,
-0.41259765625,
0.318603515625,
-0.302001953125,
0.199462890625,
-0.6357421875,
-0.38623046875,
-0.60205078125,
-0.439208984375,
0.036376953125,
-0.2149658203125,
-0.75048828125,
-1.0341796875,
0.498291015625,
0.448974609375,
0.33251953125,
0.447021484375,
-0.2470703125,
0.07928466796875,
1.1826171875,
0.70556640625,
0.13330078125,
1.1376953125,
0.369384765625,
-0.03961181640625,
0.13916015625,
-0.2314453125,
0.6357421875,
-0.053009033203125,
-0.10821533203125,
-0.6142578125,
0.371826171875,
-0.495849609375,
-1.1669921875,
0.01218414306640625,
0.7294921875,
0.47509765625,
-1.01171875,
-1.0986328125,
-0.270263671875,
-1.080078125,
-0.020233154296875,
-0.48095703125,
0.59521484375,
-0.0654296875,
0.1768798828125,
-0.352783203125,
-1.1953125,
4.40625,
0.80859375,
0.87744140625,
-0.0684814453125,
0.422607421875,
1.0859375,
0.443115234375,
-0.57763671875,
-0.277099609375,
-0.810546875,
0.432861328125,
-0.68603515625,
-0.0229644775390625,
1.005859375,
0.281005859375,
0.5810546875,
-0.87353515625,
-0.146484375,
-0.330810546875,
-0.94189453125,
-0.99365234375,
0.265380859375,
0.11669921875,
0.46923828125,
0.11773681640625,
0.52978515625,
0.68212890625,
-0.3994140625,
-0.0872802734375,
-0.69091796875,
0.04669189453125,
-0.456787109375,
0.8271484375,
-0.2476806640625,
-0.474365234375,
0.8662109375,
-0.20947265625,
-0.400634765625,
-0.279541015625,
0.1126708984375,
-0.418701171875,
-0.00914764404296875,
0.4140625,
-0.54541015625,
0.08270263671875,
0.499755859375,
-0.5498046875,
0.54296875,
0.27197265625,
-1.060546875,
0.99462890625,
-0.1715087890625,
0.38671875,
-0.90478515625,
-0.77783203125,
0.13916015625,
-0.0289306640625,
-0.3857421875,
-0.239990234375,
0.5927734375,
0.484130859375,
0.1876220703125,
0.2139892578125,
0.6669921875,
-0.5419921875,
0.8740234375,
0.05767822265625,
0.5166015625,
-0.358154296875,
0.1727294921875,
-0.34716796875,
-0.032806396484375,
-0.1953125,
-0.1954345703125,
0.509765625,
0.51025390625,
-0.0628662109375,
0.262451171875,
1.125,
-0.658203125,
0.1512451171875,
-0.309814453125,
-0.1351318359375,
-0.64990234375,
0.314208984375,
1.38671875,
-0.61767578125,
-0.422607421875,
-0.2802734375,
0.6103515625,
0.266357421875,
0.69775390625,
0.01483917236328125,
-0.75341796875,
-0.5439453125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Tags: brute force, constructive algorithms, dp, implementation, strings
Correct Solution:
```
import sys
import re
def mentioned_usernames(line):
return {x for x in re.split(r'[^A-Za-z0-9]+', line)}
t = int(input())
for ti in range(t):
possible_users = []
messages = []
n = int(input())
usernames = set(input().split())
# print("usernames =", usernames, file=sys.stderr)
m = int(input())
for i in range(m):
user, text = input().split(':')
messages.append(text)
if user == '?':
mu = mentioned_usernames(text)
possible_users.append(usernames - mentioned_usernames(text))
else:
possible_users.append({user})
# print(possible_users, file=sys.stderr)
for i in range(m-1):
if len(possible_users[i]) == 1:
possible_users[i+1].difference_update(possible_users[i])
for i in range(m-1, 0, -1):
if len(possible_users[i]) == 1:
possible_users[i-1].difference_update(possible_users[i])
# print(possible_users, file=sys.stderr)
res = []
is_possible = True
prev_user = '$'
for i in range(m):
if possible_users[i]:
pusers = possible_users[i] - {prev_user}
resx = next(iter(pusers))
res.append(resx)
prev_user = resx
else:
is_possible = False
break
if is_possible:
for i in range(m):
print('{}:{}'.format(res[i], messages[i]))
else:
print("Impossible")
```
| 65,313
|
[
0.38134765625,
-0.276611328125,
-0.1856689453125,
0.5966796875,
-0.234130859375,
-0.861328125,
-0.62548828125,
-0.0675048828125,
0.1224365234375,
0.544921875,
0.30615234375,
0.014068603515625,
0.2308349609375,
-0.45654296875,
-1.0478515625,
0.043609619140625,
-0.3486328125,
-0.74462890625,
-0.06866455078125,
-0.07464599609375,
0.441650390625,
0.030242919921875,
-1.4130859375,
-0.55908203125,
-0.66748046875,
0.5595703125,
0.11834716796875,
-0.0274658203125,
0.9443359375,
1.0830078125,
-0.427490234375,
-0.416748046875,
0.1336669921875,
-1.4013671875,
-0.271728515625,
-0.06707763671875,
0.53271484375,
-0.580078125,
-0.70458984375,
-0.50927734375,
0.203369140625,
-0.41455078125,
0.70068359375,
-0.890625,
-1.3251953125,
0.249267578125,
-0.314453125,
-0.12066650390625,
-0.015289306640625,
-0.91064453125,
0.449951171875,
-0.09588623046875,
0.81103515625,
-0.2587890625,
-0.215087890625,
-0.83544921875,
-0.472900390625,
0.2005615234375,
-0.57275390625,
0.1353759765625,
-0.206298828125,
0.44970703125,
-0.09051513671875,
-0.61083984375,
-0.0762939453125,
-0.1595458984375,
-0.22998046875,
-0.2318115234375,
-0.02740478515625,
-0.64501953125,
-0.187744140625,
0.243896484375,
-0.72900390625,
-0.52294921875,
-0.425537109375,
0.393798828125,
0.1693115234375,
-0.150146484375,
-0.1378173828125,
0.5849609375,
0.0980224609375,
1.060546875,
0.259033203125,
0.318115234375,
-0.6123046875,
-0.9208984375,
0.484130859375,
0.412109375,
0.2841796875,
-0.236083984375,
-0.1585693359375,
0.1781005859375,
-0.59619140625,
0.0572509765625,
0.890625,
0.496337890625,
0.295166015625,
0.595703125,
-0.3076171875,
0.3056640625,
0.71337890625,
1.2705078125,
-0.302978515625,
1.2373046875,
-0.03472900390625,
0.197265625,
0.28076171875,
0.2269287109375,
-0.377197265625,
-0.048431396484375,
-0.460693359375,
-0.312744140625,
0.59423828125,
0.26708984375,
-0.169921875,
0.86083984375,
0.110107421875,
-0.22998046875,
-1.0966796875,
0.297119140625,
0.240966796875,
-0.310546875,
0.19677734375,
-0.24267578125,
0.044403076171875,
0.006519317626953125,
0.046051025390625,
0.9970703125,
-0.4931640625,
-0.28173828125,
0.282958984375,
-0.31005859375,
-0.060760498046875,
0.140380859375,
-0.11016845703125,
0.52197265625,
-0.439697265625,
0.634765625,
1.0068359375,
-0.64013671875,
0.623046875,
-0.1956787109375,
-0.1849365234375,
1.42578125,
0.54736328125,
0.04620361328125,
0.493896484375,
0.421142578125,
-0.5751953125,
0.1602783203125,
-0.728515625,
0.8271484375,
-0.0849609375,
0.250244140625,
-0.11517333984375,
-0.22509765625,
-0.147216796875,
0.546875,
0.2012939453125,
0.1744384765625,
-0.492919921875,
-0.201416015625,
-0.16943359375,
1.052734375,
-0.04052734375,
1.0087890625,
-0.67138671875,
-0.64697265625,
-0.128662109375,
-0.486083984375,
0.79296875,
-0.2098388671875,
-0.1409912109375,
1.080078125,
0.81103515625,
0.8681640625,
0.3486328125,
-0.407470703125,
0.2127685546875,
-0.016632080078125,
0.200439453125,
0.189208984375,
-0.009857177734375,
0.66259765625,
0.25,
-0.0111541748046875,
0.44384765625,
-0.8984375,
-0.89892578125,
-0.63232421875,
0.22412109375,
0.53759765625,
-0.54248046875,
0.25146484375,
0.30419921875,
-0.060150146484375,
-0.53515625,
0.0377197265625,
0.08843994140625,
-0.76904296875,
-0.363037109375,
0.79052734375,
-0.395263671875,
0.455078125,
-0.232666015625,
-0.2032470703125,
0.468994140625,
1.4951171875,
-0.137451171875,
-0.1826171875,
0.55908203125,
0.209228515625,
-0.098876953125,
-0.205810546875,
0.5146484375,
-0.67041015625,
-0.58935546875,
0.4765625,
-0.364990234375,
-0.22509765625,
0.060577392578125,
0.73974609375,
0.57080078125,
0.391357421875,
-0.56591796875,
-0.286376953125,
0.302978515625,
1.341796875,
-0.09564208984375,
0.54638671875,
0.21044921875,
0.671875,
0.254150390625,
1.080078125,
0.354736328125,
-0.0012559890747070312,
0.71484375,
0.7646484375,
0.1922607421875,
0.1905517578125,
0.0233612060546875,
0.307861328125,
0.173583984375,
0.427734375,
0.019134521484375,
0.63671875,
-0.28857421875,
-0.10009765625,
-0.99072265625,
0.309814453125,
-0.7939453125,
0.541015625,
0.474853515625,
0.2071533203125,
-0.86376953125,
-0.41015625,
0.6171875,
0.62451171875,
-0.71728515625,
-0.1600341796875,
-0.05865478515625,
0.034210205078125,
0.297119140625,
-0.165771484375,
0.10858154296875,
0.3798828125,
0.46630859375,
0.447998046875,
-0.252685546875,
-0.5693359375,
-0.92431640625,
-1.017578125,
-1.125,
-0.78515625,
-0.7236328125,
-0.25390625,
0.30322265625,
-0.6875,
0.332275390625,
-0.4482421875,
-0.06549072265625,
0.1060791015625,
-0.93603515625,
0.61474609375,
-0.05694580078125,
0.5341796875,
-0.966796875,
0.38671875,
-0.154541015625,
0.982421875,
-0.313232421875,
0.052337646484375,
-0.1600341796875,
-0.6875,
0.279296875,
-0.291259765625,
0.3720703125,
-0.142333984375,
-1.0625,
-0.406005859375,
-0.94189453125,
-0.03057861328125,
-0.350341796875,
0.061279296875,
-0.80126953125,
0.8330078125,
0.87158203125,
-0.72607421875,
0.5634765625,
0.72119140625,
-0.60693359375,
0.5361328125,
0.42529296875,
0.0210113525390625,
-0.6259765625,
0.88525390625,
0.583984375,
0.587890625,
-0.466064453125,
-0.32373046875,
-0.80126953125,
0.1429443359375,
0.058135986328125,
-0.5224609375,
-0.231201171875,
0.0670166015625,
0.10528564453125,
-1.16015625,
0.50244140625,
-1.65234375,
-0.93994140625,
-0.092041015625,
-0.53076171875,
1.1640625,
0.91455078125,
-0.0499267578125,
-0.315185546875,
-0.10919189453125,
-0.292724609375,
0.52001953125,
0.3681640625,
-0.411865234375,
0.1688232421875,
0.8623046875,
0.10845947265625,
-0.1793212890625,
0.5029296875,
-0.6767578125,
-0.215087890625,
-0.0926513671875,
0.347412109375,
0.52978515625,
0.548828125,
0.05169677734375,
0.05596923828125,
0.78857421875,
-0.76123046875,
-0.29736328125,
0.2197265625,
0.388916015625,
0.6611328125,
0.277587890625,
0.191162109375,
-0.260498046875,
-0.689453125,
-0.8134765625,
0.335205078125,
0.66943359375,
1.103515625,
-0.57421875,
0.5673828125,
0.0035953521728515625,
-0.86328125,
0.402587890625,
-0.76513671875,
-0.4873046875,
0.91650390625,
0.0203399658203125,
0.66650390625,
-1.0234375,
-0.10009765625,
0.1446533203125,
0.09173583984375,
0.484130859375,
0.7119140625,
0.53076171875,
-0.6005859375,
-0.27783203125,
-0.2509765625,
-0.269287109375,
0.09100341796875,
-0.44970703125,
-0.431884765625,
-0.21875,
-0.45849609375,
-0.99072265625,
0.45361328125,
0.6044921875,
0.7421875,
0.1177978515625,
0.8525390625,
0.1185302734375,
0.9560546875,
0.70361328125,
-0.509765625,
0.09796142578125,
-0.70458984375,
0.6416015625,
0.352294921875,
-0.32080078125,
-0.437744140625,
-0.319580078125,
-0.1461181640625,
-0.0689697265625,
0.259033203125,
-0.33642578125,
-0.5654296875,
0.031524658203125,
-0.02740478515625,
0.74169921875,
-0.265380859375,
-0.55859375,
-0.11212158203125,
0.253173828125,
0.396240234375,
-0.425537109375,
0.1427001953125,
-0.61865234375,
0.69140625,
0.7861328125,
-0.037841796875,
-0.552734375,
-0.59375,
-0.84619140625,
-0.646484375,
0.1693115234375,
0.798828125,
-0.548828125,
-0.0233612060546875,
-1.28515625,
0.478515625,
0.285400390625,
-0.322509765625,
0.089599609375,
-0.07537841796875,
0.3125,
0.1695556640625,
0.71923828125,
-0.048980712890625,
-0.444091796875,
0.275146484375,
-0.5634765625,
0.6494140625,
-0.7412109375,
0.1876220703125,
-0.11846923828125,
0.0205078125,
-0.01229095458984375,
0.7333984375,
-0.0582275390625,
0.34423828125,
-0.07904052734375,
0.041595458984375,
-0.94970703125,
-0.54736328125,
0.435302734375,
0.2037353515625,
-0.393798828125,
0.291748046875,
0.295166015625,
-0.453857421875,
0.1749267578125,
0.4375,
-0.349609375,
0.474365234375,
-0.7490234375,
0.60888671875,
-0.307861328125,
-0.5439453125,
-0.0240936279296875,
-0.5029296875,
0.448974609375,
0.0888671875,
-1.0390625,
-0.186767578125,
-0.98876953125,
-0.2705078125,
-0.133056640625,
-0.54052734375,
0.396240234375,
0.1162109375,
-0.0171966552734375,
-0.21826171875,
0.00409698486328125,
-0.9208984375,
-0.04205322265625,
-0.548828125,
-0.2000732421875,
0.440185546875,
0.1365966796875,
0.69482421875,
-0.11370849609375,
-0.63623046875,
0.462890625,
-0.1727294921875,
0.2010498046875,
-0.325439453125,
-0.39111328125,
0.1488037109375,
-0.1837158203125,
-0.358642578125,
0.31494140625,
-0.64111328125,
0.2374267578125,
0.9296875,
-0.041259765625,
0.2342529296875,
0.0271453857421875,
-0.45849609375,
0.76513671875,
0.1312255859375,
-1.142578125,
-0.33251953125,
0.64697265625,
-0.384765625,
0.44580078125,
0.8583984375,
-1.18359375,
-0.56396484375,
-0.8779296875,
0.19384765625,
-1.0390625,
-0.09368896484375,
-0.82763671875,
-0.1746826171875,
-0.41064453125,
0.98828125,
0.043426513671875,
-0.69140625,
-0.3134765625,
-0.90576171875,
0.41796875,
-0.71337890625,
-0.18408203125,
-0.128662109375,
-0.27197265625,
-0.240966796875,
1.189453125,
0.325927734375,
0.277099609375,
-0.12371826171875,
-0.056884765625,
0.454345703125,
-0.2021484375,
-0.401123046875,
-0.11090087890625,
0.1131591796875,
0.1455078125,
-0.4384765625,
0.32373046875,
-0.7900390625,
0.61376953125,
-0.5615234375,
-0.153076171875,
0.0758056640625,
-0.50537109375,
-0.0250396728515625,
-0.035888671875,
1.1064453125,
-0.52001953125,
-0.04144287109375,
-0.2919921875,
0.26318359375,
0.537109375,
-0.2113037109375,
-0.62060546875,
-0.814453125,
-0.8916015625,
-1.1767578125,
0.623046875,
-0.350830078125,
-0.1650390625,
-0.145751953125,
-0.1748046875,
0.89404296875,
-0.50244140625,
0.37353515625,
1.3857421875,
0.34814453125,
0.2103271484375,
-0.77880859375,
0.76513671875,
0.2008056640625,
-0.54541015625,
-0.2626953125,
0.1510009765625,
-0.8388671875,
0.1734619140625,
-0.338623046875,
-0.85302734375,
-0.58642578125,
-0.09716796875,
1.0478515625,
-0.39453125,
1.1064453125,
0.11724853515625,
-1.029296875,
-1.00390625,
0.60986328125,
0.201416015625,
0.10394287109375,
0.748046875,
0.07952880859375,
0.283203125,
-0.067138671875,
0.17529296875,
-0.09356689453125,
-0.634765625,
1.0986328125,
0.25830078125,
-0.395263671875,
0.78076171875,
1.015625,
-0.88671875,
-0.9375,
-0.057647705078125,
-0.043914794921875,
-0.375244140625,
-0.80859375,
-0.2322998046875,
0.62548828125,
-0.7763671875,
0.27197265625,
0.94140625,
0.013885498046875,
0.0885009765625,
0.053985595703125,
0.314697265625,
-0.69580078125,
0.94140625,
0.912109375,
-0.50244140625,
0.1507568359375,
-1.0322265625,
-0.0234527587890625,
-0.5126953125,
-0.1552734375,
1.0244140625,
-0.6982421875,
0.44580078125,
0.52587890625,
-0.1771240234375,
0.9873046875,
-0.273193359375,
-0.32568359375,
0.2271728515625,
-0.77294921875,
-0.67626953125,
-0.237548828125,
0.44970703125,
-0.32421875,
0.407470703125,
-0.61474609375,
0.272216796875,
0.6044921875,
0.3544921875,
-0.3837890625,
-1.134765625,
-0.428955078125,
-1.0986328125,
-0.56591796875,
-0.75,
0.0682373046875,
-0.52587890625,
0.038818359375,
0.416015625,
-0.9091796875,
0.11383056640625,
0.448486328125,
-0.2071533203125,
0.8310546875,
-0.8525390625,
0.63134765625,
-0.7890625,
-0.4462890625,
-0.71484375,
-0.282958984375,
-0.24853515625,
-0.0947265625,
-0.1273193359375,
0.333251953125,
-0.327880859375,
0.59765625,
0.1533203125,
0.28271484375,
-0.1832275390625,
-0.480224609375,
-0.0980224609375,
-0.1658935546875,
-0.429443359375,
0.275146484375,
0.5693359375,
-0.43994140625,
0.04248046875,
-0.1766357421875,
-0.334228515625,
-0.2174072265625,
0.6240234375,
0.6982421875,
0.045440673828125,
0.13916015625,
-0.225341796875,
0.10626220703125,
-0.89892578125,
0.11077880859375,
0.07122802734375,
0.12176513671875,
0.411376953125,
-0.235595703125,
0.36865234375,
0.923828125,
0.01629638671875,
0.56689453125,
-0.256103515625,
0.381591796875,
0.09912109375,
-0.07666015625,
0.00249481201171875,
-0.06915283203125,
0.0814208984375,
0.313232421875,
0.275390625,
0.3466796875,
-0.330322265625,
0.7294921875,
-0.0460205078125,
-0.7822265625,
-0.67138671875,
-0.327880859375,
0.2435302734375,
0.286376953125,
0.442626953125,
-0.127685546875,
0.12548828125,
-0.2078857421875,
-0.65576171875,
0.266845703125,
-1.2353515625,
-0.078369140625,
1.1376953125,
-0.314208984375,
-0.437744140625,
-0.451904296875,
-0.4091796875,
-0.201416015625,
0.403564453125,
0.436767578125,
-0.58544921875,
0.1005859375,
0.1378173828125,
0.671875,
-0.65283203125,
0.615234375,
-0.0849609375,
0.2802734375,
-0.38232421875,
-0.1971435546875,
0.1346435546875,
1.2275390625,
0.011199951171875,
-0.40576171875,
-1.056640625,
-0.1024169921875,
0.37451171875,
-0.3076171875,
-0.2459716796875,
0.07098388671875,
-0.216796875,
0.2587890625,
-0.87744140625,
0.10540771484375,
-0.03326416015625,
0.4072265625,
0.4599609375,
-0.2352294921875,
-0.65673828125,
0.70556640625,
0.72998046875,
-0.09783935546875,
0.94287109375,
-0.04107666015625,
0.315185546875,
0.194580078125,
0.224609375,
-0.32861328125,
0.9853515625,
0.755859375,
0.23681640625,
-0.4248046875,
0.41064453125,
0.77783203125,
0.09747314453125,
-0.2076416015625,
0.0731201171875,
0.0726318359375,
-0.297607421875,
0.3623046875,
-0.299560546875,
-0.06268310546875,
-0.004241943359375,
-0.114990234375,
0.3212890625,
-0.2379150390625,
-0.0538330078125,
-0.52978515625,
-0.80908203125,
0.533203125,
-0.27685546875,
-0.0006175041198730469,
0.379150390625,
-0.767578125,
-0.0186767578125,
0.9287109375,
-0.0088348388671875,
-0.267333984375,
0.8427734375,
0.1956787109375,
0.46337890625,
0.56591796875,
0.445068359375,
0.59814453125,
-0.8251953125,
0.5517578125,
0.13720703125,
-0.0240478515625,
-0.2227783203125,
-0.313720703125,
-0.7900390625,
0.4013671875,
-0.471923828125,
0.00696563720703125,
0.6884765625,
-1.0419921875,
0.15869140625,
-0.1700439453125,
0.498291015625,
-0.541015625,
0.29052734375,
0.14453125,
-0.68798828125,
-0.70361328125,
1.03515625,
-0.2347412109375,
0.50341796875,
0.0012416839599609375,
1.177734375,
0.0628662109375,
1.740234375,
0.379638671875,
-0.1544189453125,
-0.2041015625,
0.1456298828125,
-0.5029296875,
-0.57275390625,
-0.2015380859375,
-0.446044921875,
0.677734375,
-0.57666015625,
-0.322021484375,
-0.1915283203125,
0.78369140625,
0.337158203125,
-1.140625,
-0.393798828125,
0.45068359375,
-0.347900390625,
0.34521484375,
0.55517578125,
0.0252227783203125,
-0.027923583984375,
0.173583984375,
0.08734130859375,
-0.75927734375,
-0.09161376953125,
-0.93994140625,
0.456787109375,
-0.06805419921875,
-0.77685546875,
-0.412109375,
-0.87646484375,
-0.178955078125,
0.1832275390625,
-0.45703125,
-0.80126953125,
0.57763671875,
0.64453125,
0.7275390625,
0.2071533203125,
-0.1634521484375,
-0.23193359375,
1.126953125,
1.0205078125,
0.1895751953125,
1.05859375,
0.376708984375,
-0.26171875,
0.383544921875,
-0.419677734375,
0.59423828125,
0.1524658203125,
0.123779296875,
-0.2210693359375,
-0.368408203125,
-0.62548828125,
-1.3447265625,
0.021636962890625,
1.0791015625,
0.6796875,
-0.458740234375,
-1.02734375,
-0.580078125,
-1.052734375,
-0.0092620849609375,
-0.30712890625,
0.93701171875,
-0.175537109375,
-0.17578125,
0.183837890625,
-1.3720703125,
4.30078125,
1.2783203125,
0.98291015625,
0.091064453125,
0.075927734375,
1.0693359375,
0.8544921875,
-0.322265625,
-0.1605224609375,
-0.248779296875,
0.1953125,
-0.482666015625,
0.343994140625,
0.85498046875,
-0.026580810546875,
0.54052734375,
-0.61669921875,
-0.022735595703125,
0.17431640625,
-0.712890625,
-0.62548828125,
0.3173828125,
-0.02642822265625,
0.6787109375,
0.08612060546875,
0.51953125,
0.6396484375,
-0.673828125,
0.10821533203125,
-0.58349609375,
-0.00356292724609375,
-0.61669921875,
1.076171875,
0.2039794921875,
-0.41943359375,
0.359619140625,
-0.1165771484375,
-0.9912109375,
-0.1356201171875,
0.08746337890625,
0.02984619140625,
-0.1590576171875,
0.57373046875,
-0.90869140625,
-0.1282958984375,
0.466552734375,
-0.36572265625,
0.182861328125,
0.5185546875,
-0.94482421875,
0.6640625,
-0.74462890625,
0.59033203125,
-0.72509765625,
-0.268310546875,
0.325927734375,
0.578125,
-0.189208984375,
-0.24853515625,
0.5322265625,
0.401123046875,
0.3017578125,
0.07965087890625,
0.65625,
-0.8681640625,
0.4638671875,
-0.6591796875,
0.7294921875,
-0.1566162109375,
0.0718994140625,
-0.1922607421875,
-0.276611328125,
-0.63037109375,
-0.76416015625,
0.5419921875,
0.165771484375,
-0.1236572265625,
0.5517578125,
0.64208984375,
-0.2734375,
-0.206298828125,
-0.2218017578125,
-0.29345703125,
-0.4658203125,
0.11407470703125,
1.189453125,
-0.58935546875,
-0.3154296875,
-0.3857421875,
0.8798828125,
0.418701171875,
0.498291015625,
0.1875,
-0.22998046875,
-0.017242431640625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Tags: brute force, constructive algorithms, dp, implementation, strings
Correct Solution:
```
import sys
import re
def mentioned_usernames(line):
return {x for x in re.split(r'[^A-Za-z0-9]+', line)}
t = int(input())
for ti in range(t):
possible_users = []
messages = []
n = int(input())
usernames = set(input().split())
# print("usernames =", usernames, file=sys.stderr)
m = int(input())
for i in range(m):
user, text = input().split(':')
messages.append(text)
if user == '?':
mu = mentioned_usernames(text)
possible_users.append(usernames - mentioned_usernames(text))
else:
possible_users.append({user})
# print(possible_users, file=sys.stderr)
is_fixed = [False] * m
for i in range(m-1):
if len(possible_users[i]) == 1:
possible_users[i+1].difference_update(possible_users[i])
is_fixed = True
for i in range(m-1, 0, -1):
if len(possible_users[i]) == 1:
possible_users[i-1].difference_update(possible_users[i])
is_fixed = True
# print(possible_users, file=sys.stderr)
res = []
is_possible = True
prev_user = '$'
for i in range(m):
if possible_users[i]:
pusers = possible_users[i] - {prev_user}
resx = next(iter(pusers))
res.append(resx)
prev_user = resx
else:
is_possible = False
break
if is_possible:
for i in range(m):
print('{}:{}'.format(res[i], messages[i]))
else:
print("Impossible")
```
| 65,314
|
[
0.38134765625,
-0.276611328125,
-0.1856689453125,
0.5966796875,
-0.234130859375,
-0.861328125,
-0.62548828125,
-0.0675048828125,
0.1224365234375,
0.544921875,
0.30615234375,
0.014068603515625,
0.2308349609375,
-0.45654296875,
-1.0478515625,
0.043609619140625,
-0.3486328125,
-0.74462890625,
-0.06866455078125,
-0.07464599609375,
0.441650390625,
0.030242919921875,
-1.4130859375,
-0.55908203125,
-0.66748046875,
0.5595703125,
0.11834716796875,
-0.0274658203125,
0.9443359375,
1.0830078125,
-0.427490234375,
-0.416748046875,
0.1336669921875,
-1.4013671875,
-0.271728515625,
-0.06707763671875,
0.53271484375,
-0.580078125,
-0.70458984375,
-0.50927734375,
0.203369140625,
-0.41455078125,
0.70068359375,
-0.890625,
-1.3251953125,
0.249267578125,
-0.314453125,
-0.12066650390625,
-0.015289306640625,
-0.91064453125,
0.449951171875,
-0.09588623046875,
0.81103515625,
-0.2587890625,
-0.215087890625,
-0.83544921875,
-0.472900390625,
0.2005615234375,
-0.57275390625,
0.1353759765625,
-0.206298828125,
0.44970703125,
-0.09051513671875,
-0.61083984375,
-0.0762939453125,
-0.1595458984375,
-0.22998046875,
-0.2318115234375,
-0.02740478515625,
-0.64501953125,
-0.187744140625,
0.243896484375,
-0.72900390625,
-0.52294921875,
-0.425537109375,
0.393798828125,
0.1693115234375,
-0.150146484375,
-0.1378173828125,
0.5849609375,
0.0980224609375,
1.060546875,
0.259033203125,
0.318115234375,
-0.6123046875,
-0.9208984375,
0.484130859375,
0.412109375,
0.2841796875,
-0.236083984375,
-0.1585693359375,
0.1781005859375,
-0.59619140625,
0.0572509765625,
0.890625,
0.496337890625,
0.295166015625,
0.595703125,
-0.3076171875,
0.3056640625,
0.71337890625,
1.2705078125,
-0.302978515625,
1.2373046875,
-0.03472900390625,
0.197265625,
0.28076171875,
0.2269287109375,
-0.377197265625,
-0.048431396484375,
-0.460693359375,
-0.312744140625,
0.59423828125,
0.26708984375,
-0.169921875,
0.86083984375,
0.110107421875,
-0.22998046875,
-1.0966796875,
0.297119140625,
0.240966796875,
-0.310546875,
0.19677734375,
-0.24267578125,
0.044403076171875,
0.006519317626953125,
0.046051025390625,
0.9970703125,
-0.4931640625,
-0.28173828125,
0.282958984375,
-0.31005859375,
-0.060760498046875,
0.140380859375,
-0.11016845703125,
0.52197265625,
-0.439697265625,
0.634765625,
1.0068359375,
-0.64013671875,
0.623046875,
-0.1956787109375,
-0.1849365234375,
1.42578125,
0.54736328125,
0.04620361328125,
0.493896484375,
0.421142578125,
-0.5751953125,
0.1602783203125,
-0.728515625,
0.8271484375,
-0.0849609375,
0.250244140625,
-0.11517333984375,
-0.22509765625,
-0.147216796875,
0.546875,
0.2012939453125,
0.1744384765625,
-0.492919921875,
-0.201416015625,
-0.16943359375,
1.052734375,
-0.04052734375,
1.0087890625,
-0.67138671875,
-0.64697265625,
-0.128662109375,
-0.486083984375,
0.79296875,
-0.2098388671875,
-0.1409912109375,
1.080078125,
0.81103515625,
0.8681640625,
0.3486328125,
-0.407470703125,
0.2127685546875,
-0.016632080078125,
0.200439453125,
0.189208984375,
-0.009857177734375,
0.66259765625,
0.25,
-0.0111541748046875,
0.44384765625,
-0.8984375,
-0.89892578125,
-0.63232421875,
0.22412109375,
0.53759765625,
-0.54248046875,
0.25146484375,
0.30419921875,
-0.060150146484375,
-0.53515625,
0.0377197265625,
0.08843994140625,
-0.76904296875,
-0.363037109375,
0.79052734375,
-0.395263671875,
0.455078125,
-0.232666015625,
-0.2032470703125,
0.468994140625,
1.4951171875,
-0.137451171875,
-0.1826171875,
0.55908203125,
0.209228515625,
-0.098876953125,
-0.205810546875,
0.5146484375,
-0.67041015625,
-0.58935546875,
0.4765625,
-0.364990234375,
-0.22509765625,
0.060577392578125,
0.73974609375,
0.57080078125,
0.391357421875,
-0.56591796875,
-0.286376953125,
0.302978515625,
1.341796875,
-0.09564208984375,
0.54638671875,
0.21044921875,
0.671875,
0.254150390625,
1.080078125,
0.354736328125,
-0.0012559890747070312,
0.71484375,
0.7646484375,
0.1922607421875,
0.1905517578125,
0.0233612060546875,
0.307861328125,
0.173583984375,
0.427734375,
0.019134521484375,
0.63671875,
-0.28857421875,
-0.10009765625,
-0.99072265625,
0.309814453125,
-0.7939453125,
0.541015625,
0.474853515625,
0.2071533203125,
-0.86376953125,
-0.41015625,
0.6171875,
0.62451171875,
-0.71728515625,
-0.1600341796875,
-0.05865478515625,
0.034210205078125,
0.297119140625,
-0.165771484375,
0.10858154296875,
0.3798828125,
0.46630859375,
0.447998046875,
-0.252685546875,
-0.5693359375,
-0.92431640625,
-1.017578125,
-1.125,
-0.78515625,
-0.7236328125,
-0.25390625,
0.30322265625,
-0.6875,
0.332275390625,
-0.4482421875,
-0.06549072265625,
0.1060791015625,
-0.93603515625,
0.61474609375,
-0.05694580078125,
0.5341796875,
-0.966796875,
0.38671875,
-0.154541015625,
0.982421875,
-0.313232421875,
0.052337646484375,
-0.1600341796875,
-0.6875,
0.279296875,
-0.291259765625,
0.3720703125,
-0.142333984375,
-1.0625,
-0.406005859375,
-0.94189453125,
-0.03057861328125,
-0.350341796875,
0.061279296875,
-0.80126953125,
0.8330078125,
0.87158203125,
-0.72607421875,
0.5634765625,
0.72119140625,
-0.60693359375,
0.5361328125,
0.42529296875,
0.0210113525390625,
-0.6259765625,
0.88525390625,
0.583984375,
0.587890625,
-0.466064453125,
-0.32373046875,
-0.80126953125,
0.1429443359375,
0.058135986328125,
-0.5224609375,
-0.231201171875,
0.0670166015625,
0.10528564453125,
-1.16015625,
0.50244140625,
-1.65234375,
-0.93994140625,
-0.092041015625,
-0.53076171875,
1.1640625,
0.91455078125,
-0.0499267578125,
-0.315185546875,
-0.10919189453125,
-0.292724609375,
0.52001953125,
0.3681640625,
-0.411865234375,
0.1688232421875,
0.8623046875,
0.10845947265625,
-0.1793212890625,
0.5029296875,
-0.6767578125,
-0.215087890625,
-0.0926513671875,
0.347412109375,
0.52978515625,
0.548828125,
0.05169677734375,
0.05596923828125,
0.78857421875,
-0.76123046875,
-0.29736328125,
0.2197265625,
0.388916015625,
0.6611328125,
0.277587890625,
0.191162109375,
-0.260498046875,
-0.689453125,
-0.8134765625,
0.335205078125,
0.66943359375,
1.103515625,
-0.57421875,
0.5673828125,
0.0035953521728515625,
-0.86328125,
0.402587890625,
-0.76513671875,
-0.4873046875,
0.91650390625,
0.0203399658203125,
0.66650390625,
-1.0234375,
-0.10009765625,
0.1446533203125,
0.09173583984375,
0.484130859375,
0.7119140625,
0.53076171875,
-0.6005859375,
-0.27783203125,
-0.2509765625,
-0.269287109375,
0.09100341796875,
-0.44970703125,
-0.431884765625,
-0.21875,
-0.45849609375,
-0.99072265625,
0.45361328125,
0.6044921875,
0.7421875,
0.1177978515625,
0.8525390625,
0.1185302734375,
0.9560546875,
0.70361328125,
-0.509765625,
0.09796142578125,
-0.70458984375,
0.6416015625,
0.352294921875,
-0.32080078125,
-0.437744140625,
-0.319580078125,
-0.1461181640625,
-0.0689697265625,
0.259033203125,
-0.33642578125,
-0.5654296875,
0.031524658203125,
-0.02740478515625,
0.74169921875,
-0.265380859375,
-0.55859375,
-0.11212158203125,
0.253173828125,
0.396240234375,
-0.425537109375,
0.1427001953125,
-0.61865234375,
0.69140625,
0.7861328125,
-0.037841796875,
-0.552734375,
-0.59375,
-0.84619140625,
-0.646484375,
0.1693115234375,
0.798828125,
-0.548828125,
-0.0233612060546875,
-1.28515625,
0.478515625,
0.285400390625,
-0.322509765625,
0.089599609375,
-0.07537841796875,
0.3125,
0.1695556640625,
0.71923828125,
-0.048980712890625,
-0.444091796875,
0.275146484375,
-0.5634765625,
0.6494140625,
-0.7412109375,
0.1876220703125,
-0.11846923828125,
0.0205078125,
-0.01229095458984375,
0.7333984375,
-0.0582275390625,
0.34423828125,
-0.07904052734375,
0.041595458984375,
-0.94970703125,
-0.54736328125,
0.435302734375,
0.2037353515625,
-0.393798828125,
0.291748046875,
0.295166015625,
-0.453857421875,
0.1749267578125,
0.4375,
-0.349609375,
0.474365234375,
-0.7490234375,
0.60888671875,
-0.307861328125,
-0.5439453125,
-0.0240936279296875,
-0.5029296875,
0.448974609375,
0.0888671875,
-1.0390625,
-0.186767578125,
-0.98876953125,
-0.2705078125,
-0.133056640625,
-0.54052734375,
0.396240234375,
0.1162109375,
-0.0171966552734375,
-0.21826171875,
0.00409698486328125,
-0.9208984375,
-0.04205322265625,
-0.548828125,
-0.2000732421875,
0.440185546875,
0.1365966796875,
0.69482421875,
-0.11370849609375,
-0.63623046875,
0.462890625,
-0.1727294921875,
0.2010498046875,
-0.325439453125,
-0.39111328125,
0.1488037109375,
-0.1837158203125,
-0.358642578125,
0.31494140625,
-0.64111328125,
0.2374267578125,
0.9296875,
-0.041259765625,
0.2342529296875,
0.0271453857421875,
-0.45849609375,
0.76513671875,
0.1312255859375,
-1.142578125,
-0.33251953125,
0.64697265625,
-0.384765625,
0.44580078125,
0.8583984375,
-1.18359375,
-0.56396484375,
-0.8779296875,
0.19384765625,
-1.0390625,
-0.09368896484375,
-0.82763671875,
-0.1746826171875,
-0.41064453125,
0.98828125,
0.043426513671875,
-0.69140625,
-0.3134765625,
-0.90576171875,
0.41796875,
-0.71337890625,
-0.18408203125,
-0.128662109375,
-0.27197265625,
-0.240966796875,
1.189453125,
0.325927734375,
0.277099609375,
-0.12371826171875,
-0.056884765625,
0.454345703125,
-0.2021484375,
-0.401123046875,
-0.11090087890625,
0.1131591796875,
0.1455078125,
-0.4384765625,
0.32373046875,
-0.7900390625,
0.61376953125,
-0.5615234375,
-0.153076171875,
0.0758056640625,
-0.50537109375,
-0.0250396728515625,
-0.035888671875,
1.1064453125,
-0.52001953125,
-0.04144287109375,
-0.2919921875,
0.26318359375,
0.537109375,
-0.2113037109375,
-0.62060546875,
-0.814453125,
-0.8916015625,
-1.1767578125,
0.623046875,
-0.350830078125,
-0.1650390625,
-0.145751953125,
-0.1748046875,
0.89404296875,
-0.50244140625,
0.37353515625,
1.3857421875,
0.34814453125,
0.2103271484375,
-0.77880859375,
0.76513671875,
0.2008056640625,
-0.54541015625,
-0.2626953125,
0.1510009765625,
-0.8388671875,
0.1734619140625,
-0.338623046875,
-0.85302734375,
-0.58642578125,
-0.09716796875,
1.0478515625,
-0.39453125,
1.1064453125,
0.11724853515625,
-1.029296875,
-1.00390625,
0.60986328125,
0.201416015625,
0.10394287109375,
0.748046875,
0.07952880859375,
0.283203125,
-0.067138671875,
0.17529296875,
-0.09356689453125,
-0.634765625,
1.0986328125,
0.25830078125,
-0.395263671875,
0.78076171875,
1.015625,
-0.88671875,
-0.9375,
-0.057647705078125,
-0.043914794921875,
-0.375244140625,
-0.80859375,
-0.2322998046875,
0.62548828125,
-0.7763671875,
0.27197265625,
0.94140625,
0.013885498046875,
0.0885009765625,
0.053985595703125,
0.314697265625,
-0.69580078125,
0.94140625,
0.912109375,
-0.50244140625,
0.1507568359375,
-1.0322265625,
-0.0234527587890625,
-0.5126953125,
-0.1552734375,
1.0244140625,
-0.6982421875,
0.44580078125,
0.52587890625,
-0.1771240234375,
0.9873046875,
-0.273193359375,
-0.32568359375,
0.2271728515625,
-0.77294921875,
-0.67626953125,
-0.237548828125,
0.44970703125,
-0.32421875,
0.407470703125,
-0.61474609375,
0.272216796875,
0.6044921875,
0.3544921875,
-0.3837890625,
-1.134765625,
-0.428955078125,
-1.0986328125,
-0.56591796875,
-0.75,
0.0682373046875,
-0.52587890625,
0.038818359375,
0.416015625,
-0.9091796875,
0.11383056640625,
0.448486328125,
-0.2071533203125,
0.8310546875,
-0.8525390625,
0.63134765625,
-0.7890625,
-0.4462890625,
-0.71484375,
-0.282958984375,
-0.24853515625,
-0.0947265625,
-0.1273193359375,
0.333251953125,
-0.327880859375,
0.59765625,
0.1533203125,
0.28271484375,
-0.1832275390625,
-0.480224609375,
-0.0980224609375,
-0.1658935546875,
-0.429443359375,
0.275146484375,
0.5693359375,
-0.43994140625,
0.04248046875,
-0.1766357421875,
-0.334228515625,
-0.2174072265625,
0.6240234375,
0.6982421875,
0.045440673828125,
0.13916015625,
-0.225341796875,
0.10626220703125,
-0.89892578125,
0.11077880859375,
0.07122802734375,
0.12176513671875,
0.411376953125,
-0.235595703125,
0.36865234375,
0.923828125,
0.01629638671875,
0.56689453125,
-0.256103515625,
0.381591796875,
0.09912109375,
-0.07666015625,
0.00249481201171875,
-0.06915283203125,
0.0814208984375,
0.313232421875,
0.275390625,
0.3466796875,
-0.330322265625,
0.7294921875,
-0.0460205078125,
-0.7822265625,
-0.67138671875,
-0.327880859375,
0.2435302734375,
0.286376953125,
0.442626953125,
-0.127685546875,
0.12548828125,
-0.2078857421875,
-0.65576171875,
0.266845703125,
-1.2353515625,
-0.078369140625,
1.1376953125,
-0.314208984375,
-0.437744140625,
-0.451904296875,
-0.4091796875,
-0.201416015625,
0.403564453125,
0.436767578125,
-0.58544921875,
0.1005859375,
0.1378173828125,
0.671875,
-0.65283203125,
0.615234375,
-0.0849609375,
0.2802734375,
-0.38232421875,
-0.1971435546875,
0.1346435546875,
1.2275390625,
0.011199951171875,
-0.40576171875,
-1.056640625,
-0.1024169921875,
0.37451171875,
-0.3076171875,
-0.2459716796875,
0.07098388671875,
-0.216796875,
0.2587890625,
-0.87744140625,
0.10540771484375,
-0.03326416015625,
0.4072265625,
0.4599609375,
-0.2352294921875,
-0.65673828125,
0.70556640625,
0.72998046875,
-0.09783935546875,
0.94287109375,
-0.04107666015625,
0.315185546875,
0.194580078125,
0.224609375,
-0.32861328125,
0.9853515625,
0.755859375,
0.23681640625,
-0.4248046875,
0.41064453125,
0.77783203125,
0.09747314453125,
-0.2076416015625,
0.0731201171875,
0.0726318359375,
-0.297607421875,
0.3623046875,
-0.299560546875,
-0.06268310546875,
-0.004241943359375,
-0.114990234375,
0.3212890625,
-0.2379150390625,
-0.0538330078125,
-0.52978515625,
-0.80908203125,
0.533203125,
-0.27685546875,
-0.0006175041198730469,
0.379150390625,
-0.767578125,
-0.0186767578125,
0.9287109375,
-0.0088348388671875,
-0.267333984375,
0.8427734375,
0.1956787109375,
0.46337890625,
0.56591796875,
0.445068359375,
0.59814453125,
-0.8251953125,
0.5517578125,
0.13720703125,
-0.0240478515625,
-0.2227783203125,
-0.313720703125,
-0.7900390625,
0.4013671875,
-0.471923828125,
0.00696563720703125,
0.6884765625,
-1.0419921875,
0.15869140625,
-0.1700439453125,
0.498291015625,
-0.541015625,
0.29052734375,
0.14453125,
-0.68798828125,
-0.70361328125,
1.03515625,
-0.2347412109375,
0.50341796875,
0.0012416839599609375,
1.177734375,
0.0628662109375,
1.740234375,
0.379638671875,
-0.1544189453125,
-0.2041015625,
0.1456298828125,
-0.5029296875,
-0.57275390625,
-0.2015380859375,
-0.446044921875,
0.677734375,
-0.57666015625,
-0.322021484375,
-0.1915283203125,
0.78369140625,
0.337158203125,
-1.140625,
-0.393798828125,
0.45068359375,
-0.347900390625,
0.34521484375,
0.55517578125,
0.0252227783203125,
-0.027923583984375,
0.173583984375,
0.08734130859375,
-0.75927734375,
-0.09161376953125,
-0.93994140625,
0.456787109375,
-0.06805419921875,
-0.77685546875,
-0.412109375,
-0.87646484375,
-0.178955078125,
0.1832275390625,
-0.45703125,
-0.80126953125,
0.57763671875,
0.64453125,
0.7275390625,
0.2071533203125,
-0.1634521484375,
-0.23193359375,
1.126953125,
1.0205078125,
0.1895751953125,
1.05859375,
0.376708984375,
-0.26171875,
0.383544921875,
-0.419677734375,
0.59423828125,
0.1524658203125,
0.123779296875,
-0.2210693359375,
-0.368408203125,
-0.62548828125,
-1.3447265625,
0.021636962890625,
1.0791015625,
0.6796875,
-0.458740234375,
-1.02734375,
-0.580078125,
-1.052734375,
-0.0092620849609375,
-0.30712890625,
0.93701171875,
-0.175537109375,
-0.17578125,
0.183837890625,
-1.3720703125,
4.30078125,
1.2783203125,
0.98291015625,
0.091064453125,
0.075927734375,
1.0693359375,
0.8544921875,
-0.322265625,
-0.1605224609375,
-0.248779296875,
0.1953125,
-0.482666015625,
0.343994140625,
0.85498046875,
-0.026580810546875,
0.54052734375,
-0.61669921875,
-0.022735595703125,
0.17431640625,
-0.712890625,
-0.62548828125,
0.3173828125,
-0.02642822265625,
0.6787109375,
0.08612060546875,
0.51953125,
0.6396484375,
-0.673828125,
0.10821533203125,
-0.58349609375,
-0.00356292724609375,
-0.61669921875,
1.076171875,
0.2039794921875,
-0.41943359375,
0.359619140625,
-0.1165771484375,
-0.9912109375,
-0.1356201171875,
0.08746337890625,
0.02984619140625,
-0.1590576171875,
0.57373046875,
-0.90869140625,
-0.1282958984375,
0.466552734375,
-0.36572265625,
0.182861328125,
0.5185546875,
-0.94482421875,
0.6640625,
-0.74462890625,
0.59033203125,
-0.72509765625,
-0.268310546875,
0.325927734375,
0.578125,
-0.189208984375,
-0.24853515625,
0.5322265625,
0.401123046875,
0.3017578125,
0.07965087890625,
0.65625,
-0.8681640625,
0.4638671875,
-0.6591796875,
0.7294921875,
-0.1566162109375,
0.0718994140625,
-0.1922607421875,
-0.276611328125,
-0.63037109375,
-0.76416015625,
0.5419921875,
0.165771484375,
-0.1236572265625,
0.5517578125,
0.64208984375,
-0.2734375,
-0.206298828125,
-0.2218017578125,
-0.29345703125,
-0.4658203125,
0.11407470703125,
1.189453125,
-0.58935546875,
-0.3154296875,
-0.3857421875,
0.8798828125,
0.418701171875,
0.498291015625,
0.1875,
-0.22998046875,
-0.017242431640625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Tags: brute force, constructive algorithms, dp, implementation, strings
Correct Solution:
```
from math import *
from sys import *
from decimal import *
def gcd(a,b):
if b:
return gcd(b,a%b)
return a
t=int(stdin.readline())
for sssss in range(t):
n=int(stdin.readline())
names=stdin.readline().split()
dn=dict()
for i in range(len(names)):
dn[names[i]]=i
text=[]
ps=[]
m=int(stdin.readline())
for i in range(m):
nxt=stdin.readline()
getname=nxt.split(":")[0]
nxt=nxt.split(":")[1]
text.append(nxt)
if getname=="?":
pos=set([z for z in range(n)])
hell=""
shit=set([".",",","!","?"])
for y in nxt:
if y in shit:
hell+=" "
else:
hell+=y
nhere=hell.split()
for j in nhere:
pos.discard(dn.get(j))
if i and len(ps[-1])==1:
for dd in ps[-1]:
pos.discard(dd)
ps.append(pos)
else:
if i:
ps[-1].discard(dn[getname])
ps.append(set([dn[getname]]))
#print(ps)
dp=[[False]*n]
for i in ps[0]:
dp[0][i]=True
for i in range(1,m):
#print(dp)
dp.append([False]*n)
for j in ps[i]:
for k in range(n):
if k!=j and dp[-2][k]==True:
dp[-1][j]=True
break
if True not in dp[-1]:
stdout.write("Impossible\n")
continue
#print(dp)
yy=[0]*m
ban=-1
for i in range(m-1,-1,-1):
for j in range(n):
if j!=ban and dp[i][j]:
ban=j
yy[i]=j
break
#print(yy,names)
for i in range(m):
stdout.write(names[yy[i]]+":"+text[i])
```
| 65,315
|
[
0.38134765625,
-0.276611328125,
-0.1856689453125,
0.5966796875,
-0.234130859375,
-0.861328125,
-0.62548828125,
-0.0675048828125,
0.1224365234375,
0.544921875,
0.30615234375,
0.014068603515625,
0.2308349609375,
-0.45654296875,
-1.0478515625,
0.043609619140625,
-0.3486328125,
-0.74462890625,
-0.06866455078125,
-0.07464599609375,
0.441650390625,
0.030242919921875,
-1.4130859375,
-0.55908203125,
-0.66748046875,
0.5595703125,
0.11834716796875,
-0.0274658203125,
0.9443359375,
1.0830078125,
-0.427490234375,
-0.416748046875,
0.1336669921875,
-1.4013671875,
-0.271728515625,
-0.06707763671875,
0.53271484375,
-0.580078125,
-0.70458984375,
-0.50927734375,
0.203369140625,
-0.41455078125,
0.70068359375,
-0.890625,
-1.3251953125,
0.249267578125,
-0.314453125,
-0.12066650390625,
-0.015289306640625,
-0.91064453125,
0.449951171875,
-0.09588623046875,
0.81103515625,
-0.2587890625,
-0.215087890625,
-0.83544921875,
-0.472900390625,
0.2005615234375,
-0.57275390625,
0.1353759765625,
-0.206298828125,
0.44970703125,
-0.09051513671875,
-0.61083984375,
-0.0762939453125,
-0.1595458984375,
-0.22998046875,
-0.2318115234375,
-0.02740478515625,
-0.64501953125,
-0.187744140625,
0.243896484375,
-0.72900390625,
-0.52294921875,
-0.425537109375,
0.393798828125,
0.1693115234375,
-0.150146484375,
-0.1378173828125,
0.5849609375,
0.0980224609375,
1.060546875,
0.259033203125,
0.318115234375,
-0.6123046875,
-0.9208984375,
0.484130859375,
0.412109375,
0.2841796875,
-0.236083984375,
-0.1585693359375,
0.1781005859375,
-0.59619140625,
0.0572509765625,
0.890625,
0.496337890625,
0.295166015625,
0.595703125,
-0.3076171875,
0.3056640625,
0.71337890625,
1.2705078125,
-0.302978515625,
1.2373046875,
-0.03472900390625,
0.197265625,
0.28076171875,
0.2269287109375,
-0.377197265625,
-0.048431396484375,
-0.460693359375,
-0.312744140625,
0.59423828125,
0.26708984375,
-0.169921875,
0.86083984375,
0.110107421875,
-0.22998046875,
-1.0966796875,
0.297119140625,
0.240966796875,
-0.310546875,
0.19677734375,
-0.24267578125,
0.044403076171875,
0.006519317626953125,
0.046051025390625,
0.9970703125,
-0.4931640625,
-0.28173828125,
0.282958984375,
-0.31005859375,
-0.060760498046875,
0.140380859375,
-0.11016845703125,
0.52197265625,
-0.439697265625,
0.634765625,
1.0068359375,
-0.64013671875,
0.623046875,
-0.1956787109375,
-0.1849365234375,
1.42578125,
0.54736328125,
0.04620361328125,
0.493896484375,
0.421142578125,
-0.5751953125,
0.1602783203125,
-0.728515625,
0.8271484375,
-0.0849609375,
0.250244140625,
-0.11517333984375,
-0.22509765625,
-0.147216796875,
0.546875,
0.2012939453125,
0.1744384765625,
-0.492919921875,
-0.201416015625,
-0.16943359375,
1.052734375,
-0.04052734375,
1.0087890625,
-0.67138671875,
-0.64697265625,
-0.128662109375,
-0.486083984375,
0.79296875,
-0.2098388671875,
-0.1409912109375,
1.080078125,
0.81103515625,
0.8681640625,
0.3486328125,
-0.407470703125,
0.2127685546875,
-0.016632080078125,
0.200439453125,
0.189208984375,
-0.009857177734375,
0.66259765625,
0.25,
-0.0111541748046875,
0.44384765625,
-0.8984375,
-0.89892578125,
-0.63232421875,
0.22412109375,
0.53759765625,
-0.54248046875,
0.25146484375,
0.30419921875,
-0.060150146484375,
-0.53515625,
0.0377197265625,
0.08843994140625,
-0.76904296875,
-0.363037109375,
0.79052734375,
-0.395263671875,
0.455078125,
-0.232666015625,
-0.2032470703125,
0.468994140625,
1.4951171875,
-0.137451171875,
-0.1826171875,
0.55908203125,
0.209228515625,
-0.098876953125,
-0.205810546875,
0.5146484375,
-0.67041015625,
-0.58935546875,
0.4765625,
-0.364990234375,
-0.22509765625,
0.060577392578125,
0.73974609375,
0.57080078125,
0.391357421875,
-0.56591796875,
-0.286376953125,
0.302978515625,
1.341796875,
-0.09564208984375,
0.54638671875,
0.21044921875,
0.671875,
0.254150390625,
1.080078125,
0.354736328125,
-0.0012559890747070312,
0.71484375,
0.7646484375,
0.1922607421875,
0.1905517578125,
0.0233612060546875,
0.307861328125,
0.173583984375,
0.427734375,
0.019134521484375,
0.63671875,
-0.28857421875,
-0.10009765625,
-0.99072265625,
0.309814453125,
-0.7939453125,
0.541015625,
0.474853515625,
0.2071533203125,
-0.86376953125,
-0.41015625,
0.6171875,
0.62451171875,
-0.71728515625,
-0.1600341796875,
-0.05865478515625,
0.034210205078125,
0.297119140625,
-0.165771484375,
0.10858154296875,
0.3798828125,
0.46630859375,
0.447998046875,
-0.252685546875,
-0.5693359375,
-0.92431640625,
-1.017578125,
-1.125,
-0.78515625,
-0.7236328125,
-0.25390625,
0.30322265625,
-0.6875,
0.332275390625,
-0.4482421875,
-0.06549072265625,
0.1060791015625,
-0.93603515625,
0.61474609375,
-0.05694580078125,
0.5341796875,
-0.966796875,
0.38671875,
-0.154541015625,
0.982421875,
-0.313232421875,
0.052337646484375,
-0.1600341796875,
-0.6875,
0.279296875,
-0.291259765625,
0.3720703125,
-0.142333984375,
-1.0625,
-0.406005859375,
-0.94189453125,
-0.03057861328125,
-0.350341796875,
0.061279296875,
-0.80126953125,
0.8330078125,
0.87158203125,
-0.72607421875,
0.5634765625,
0.72119140625,
-0.60693359375,
0.5361328125,
0.42529296875,
0.0210113525390625,
-0.6259765625,
0.88525390625,
0.583984375,
0.587890625,
-0.466064453125,
-0.32373046875,
-0.80126953125,
0.1429443359375,
0.058135986328125,
-0.5224609375,
-0.231201171875,
0.0670166015625,
0.10528564453125,
-1.16015625,
0.50244140625,
-1.65234375,
-0.93994140625,
-0.092041015625,
-0.53076171875,
1.1640625,
0.91455078125,
-0.0499267578125,
-0.315185546875,
-0.10919189453125,
-0.292724609375,
0.52001953125,
0.3681640625,
-0.411865234375,
0.1688232421875,
0.8623046875,
0.10845947265625,
-0.1793212890625,
0.5029296875,
-0.6767578125,
-0.215087890625,
-0.0926513671875,
0.347412109375,
0.52978515625,
0.548828125,
0.05169677734375,
0.05596923828125,
0.78857421875,
-0.76123046875,
-0.29736328125,
0.2197265625,
0.388916015625,
0.6611328125,
0.277587890625,
0.191162109375,
-0.260498046875,
-0.689453125,
-0.8134765625,
0.335205078125,
0.66943359375,
1.103515625,
-0.57421875,
0.5673828125,
0.0035953521728515625,
-0.86328125,
0.402587890625,
-0.76513671875,
-0.4873046875,
0.91650390625,
0.0203399658203125,
0.66650390625,
-1.0234375,
-0.10009765625,
0.1446533203125,
0.09173583984375,
0.484130859375,
0.7119140625,
0.53076171875,
-0.6005859375,
-0.27783203125,
-0.2509765625,
-0.269287109375,
0.09100341796875,
-0.44970703125,
-0.431884765625,
-0.21875,
-0.45849609375,
-0.99072265625,
0.45361328125,
0.6044921875,
0.7421875,
0.1177978515625,
0.8525390625,
0.1185302734375,
0.9560546875,
0.70361328125,
-0.509765625,
0.09796142578125,
-0.70458984375,
0.6416015625,
0.352294921875,
-0.32080078125,
-0.437744140625,
-0.319580078125,
-0.1461181640625,
-0.0689697265625,
0.259033203125,
-0.33642578125,
-0.5654296875,
0.031524658203125,
-0.02740478515625,
0.74169921875,
-0.265380859375,
-0.55859375,
-0.11212158203125,
0.253173828125,
0.396240234375,
-0.425537109375,
0.1427001953125,
-0.61865234375,
0.69140625,
0.7861328125,
-0.037841796875,
-0.552734375,
-0.59375,
-0.84619140625,
-0.646484375,
0.1693115234375,
0.798828125,
-0.548828125,
-0.0233612060546875,
-1.28515625,
0.478515625,
0.285400390625,
-0.322509765625,
0.089599609375,
-0.07537841796875,
0.3125,
0.1695556640625,
0.71923828125,
-0.048980712890625,
-0.444091796875,
0.275146484375,
-0.5634765625,
0.6494140625,
-0.7412109375,
0.1876220703125,
-0.11846923828125,
0.0205078125,
-0.01229095458984375,
0.7333984375,
-0.0582275390625,
0.34423828125,
-0.07904052734375,
0.041595458984375,
-0.94970703125,
-0.54736328125,
0.435302734375,
0.2037353515625,
-0.393798828125,
0.291748046875,
0.295166015625,
-0.453857421875,
0.1749267578125,
0.4375,
-0.349609375,
0.474365234375,
-0.7490234375,
0.60888671875,
-0.307861328125,
-0.5439453125,
-0.0240936279296875,
-0.5029296875,
0.448974609375,
0.0888671875,
-1.0390625,
-0.186767578125,
-0.98876953125,
-0.2705078125,
-0.133056640625,
-0.54052734375,
0.396240234375,
0.1162109375,
-0.0171966552734375,
-0.21826171875,
0.00409698486328125,
-0.9208984375,
-0.04205322265625,
-0.548828125,
-0.2000732421875,
0.440185546875,
0.1365966796875,
0.69482421875,
-0.11370849609375,
-0.63623046875,
0.462890625,
-0.1727294921875,
0.2010498046875,
-0.325439453125,
-0.39111328125,
0.1488037109375,
-0.1837158203125,
-0.358642578125,
0.31494140625,
-0.64111328125,
0.2374267578125,
0.9296875,
-0.041259765625,
0.2342529296875,
0.0271453857421875,
-0.45849609375,
0.76513671875,
0.1312255859375,
-1.142578125,
-0.33251953125,
0.64697265625,
-0.384765625,
0.44580078125,
0.8583984375,
-1.18359375,
-0.56396484375,
-0.8779296875,
0.19384765625,
-1.0390625,
-0.09368896484375,
-0.82763671875,
-0.1746826171875,
-0.41064453125,
0.98828125,
0.043426513671875,
-0.69140625,
-0.3134765625,
-0.90576171875,
0.41796875,
-0.71337890625,
-0.18408203125,
-0.128662109375,
-0.27197265625,
-0.240966796875,
1.189453125,
0.325927734375,
0.277099609375,
-0.12371826171875,
-0.056884765625,
0.454345703125,
-0.2021484375,
-0.401123046875,
-0.11090087890625,
0.1131591796875,
0.1455078125,
-0.4384765625,
0.32373046875,
-0.7900390625,
0.61376953125,
-0.5615234375,
-0.153076171875,
0.0758056640625,
-0.50537109375,
-0.0250396728515625,
-0.035888671875,
1.1064453125,
-0.52001953125,
-0.04144287109375,
-0.2919921875,
0.26318359375,
0.537109375,
-0.2113037109375,
-0.62060546875,
-0.814453125,
-0.8916015625,
-1.1767578125,
0.623046875,
-0.350830078125,
-0.1650390625,
-0.145751953125,
-0.1748046875,
0.89404296875,
-0.50244140625,
0.37353515625,
1.3857421875,
0.34814453125,
0.2103271484375,
-0.77880859375,
0.76513671875,
0.2008056640625,
-0.54541015625,
-0.2626953125,
0.1510009765625,
-0.8388671875,
0.1734619140625,
-0.338623046875,
-0.85302734375,
-0.58642578125,
-0.09716796875,
1.0478515625,
-0.39453125,
1.1064453125,
0.11724853515625,
-1.029296875,
-1.00390625,
0.60986328125,
0.201416015625,
0.10394287109375,
0.748046875,
0.07952880859375,
0.283203125,
-0.067138671875,
0.17529296875,
-0.09356689453125,
-0.634765625,
1.0986328125,
0.25830078125,
-0.395263671875,
0.78076171875,
1.015625,
-0.88671875,
-0.9375,
-0.057647705078125,
-0.043914794921875,
-0.375244140625,
-0.80859375,
-0.2322998046875,
0.62548828125,
-0.7763671875,
0.27197265625,
0.94140625,
0.013885498046875,
0.0885009765625,
0.053985595703125,
0.314697265625,
-0.69580078125,
0.94140625,
0.912109375,
-0.50244140625,
0.1507568359375,
-1.0322265625,
-0.0234527587890625,
-0.5126953125,
-0.1552734375,
1.0244140625,
-0.6982421875,
0.44580078125,
0.52587890625,
-0.1771240234375,
0.9873046875,
-0.273193359375,
-0.32568359375,
0.2271728515625,
-0.77294921875,
-0.67626953125,
-0.237548828125,
0.44970703125,
-0.32421875,
0.407470703125,
-0.61474609375,
0.272216796875,
0.6044921875,
0.3544921875,
-0.3837890625,
-1.134765625,
-0.428955078125,
-1.0986328125,
-0.56591796875,
-0.75,
0.0682373046875,
-0.52587890625,
0.038818359375,
0.416015625,
-0.9091796875,
0.11383056640625,
0.448486328125,
-0.2071533203125,
0.8310546875,
-0.8525390625,
0.63134765625,
-0.7890625,
-0.4462890625,
-0.71484375,
-0.282958984375,
-0.24853515625,
-0.0947265625,
-0.1273193359375,
0.333251953125,
-0.327880859375,
0.59765625,
0.1533203125,
0.28271484375,
-0.1832275390625,
-0.480224609375,
-0.0980224609375,
-0.1658935546875,
-0.429443359375,
0.275146484375,
0.5693359375,
-0.43994140625,
0.04248046875,
-0.1766357421875,
-0.334228515625,
-0.2174072265625,
0.6240234375,
0.6982421875,
0.045440673828125,
0.13916015625,
-0.225341796875,
0.10626220703125,
-0.89892578125,
0.11077880859375,
0.07122802734375,
0.12176513671875,
0.411376953125,
-0.235595703125,
0.36865234375,
0.923828125,
0.01629638671875,
0.56689453125,
-0.256103515625,
0.381591796875,
0.09912109375,
-0.07666015625,
0.00249481201171875,
-0.06915283203125,
0.0814208984375,
0.313232421875,
0.275390625,
0.3466796875,
-0.330322265625,
0.7294921875,
-0.0460205078125,
-0.7822265625,
-0.67138671875,
-0.327880859375,
0.2435302734375,
0.286376953125,
0.442626953125,
-0.127685546875,
0.12548828125,
-0.2078857421875,
-0.65576171875,
0.266845703125,
-1.2353515625,
-0.078369140625,
1.1376953125,
-0.314208984375,
-0.437744140625,
-0.451904296875,
-0.4091796875,
-0.201416015625,
0.403564453125,
0.436767578125,
-0.58544921875,
0.1005859375,
0.1378173828125,
0.671875,
-0.65283203125,
0.615234375,
-0.0849609375,
0.2802734375,
-0.38232421875,
-0.1971435546875,
0.1346435546875,
1.2275390625,
0.011199951171875,
-0.40576171875,
-1.056640625,
-0.1024169921875,
0.37451171875,
-0.3076171875,
-0.2459716796875,
0.07098388671875,
-0.216796875,
0.2587890625,
-0.87744140625,
0.10540771484375,
-0.03326416015625,
0.4072265625,
0.4599609375,
-0.2352294921875,
-0.65673828125,
0.70556640625,
0.72998046875,
-0.09783935546875,
0.94287109375,
-0.04107666015625,
0.315185546875,
0.194580078125,
0.224609375,
-0.32861328125,
0.9853515625,
0.755859375,
0.23681640625,
-0.4248046875,
0.41064453125,
0.77783203125,
0.09747314453125,
-0.2076416015625,
0.0731201171875,
0.0726318359375,
-0.297607421875,
0.3623046875,
-0.299560546875,
-0.06268310546875,
-0.004241943359375,
-0.114990234375,
0.3212890625,
-0.2379150390625,
-0.0538330078125,
-0.52978515625,
-0.80908203125,
0.533203125,
-0.27685546875,
-0.0006175041198730469,
0.379150390625,
-0.767578125,
-0.0186767578125,
0.9287109375,
-0.0088348388671875,
-0.267333984375,
0.8427734375,
0.1956787109375,
0.46337890625,
0.56591796875,
0.445068359375,
0.59814453125,
-0.8251953125,
0.5517578125,
0.13720703125,
-0.0240478515625,
-0.2227783203125,
-0.313720703125,
-0.7900390625,
0.4013671875,
-0.471923828125,
0.00696563720703125,
0.6884765625,
-1.0419921875,
0.15869140625,
-0.1700439453125,
0.498291015625,
-0.541015625,
0.29052734375,
0.14453125,
-0.68798828125,
-0.70361328125,
1.03515625,
-0.2347412109375,
0.50341796875,
0.0012416839599609375,
1.177734375,
0.0628662109375,
1.740234375,
0.379638671875,
-0.1544189453125,
-0.2041015625,
0.1456298828125,
-0.5029296875,
-0.57275390625,
-0.2015380859375,
-0.446044921875,
0.677734375,
-0.57666015625,
-0.322021484375,
-0.1915283203125,
0.78369140625,
0.337158203125,
-1.140625,
-0.393798828125,
0.45068359375,
-0.347900390625,
0.34521484375,
0.55517578125,
0.0252227783203125,
-0.027923583984375,
0.173583984375,
0.08734130859375,
-0.75927734375,
-0.09161376953125,
-0.93994140625,
0.456787109375,
-0.06805419921875,
-0.77685546875,
-0.412109375,
-0.87646484375,
-0.178955078125,
0.1832275390625,
-0.45703125,
-0.80126953125,
0.57763671875,
0.64453125,
0.7275390625,
0.2071533203125,
-0.1634521484375,
-0.23193359375,
1.126953125,
1.0205078125,
0.1895751953125,
1.05859375,
0.376708984375,
-0.26171875,
0.383544921875,
-0.419677734375,
0.59423828125,
0.1524658203125,
0.123779296875,
-0.2210693359375,
-0.368408203125,
-0.62548828125,
-1.3447265625,
0.021636962890625,
1.0791015625,
0.6796875,
-0.458740234375,
-1.02734375,
-0.580078125,
-1.052734375,
-0.0092620849609375,
-0.30712890625,
0.93701171875,
-0.175537109375,
-0.17578125,
0.183837890625,
-1.3720703125,
4.30078125,
1.2783203125,
0.98291015625,
0.091064453125,
0.075927734375,
1.0693359375,
0.8544921875,
-0.322265625,
-0.1605224609375,
-0.248779296875,
0.1953125,
-0.482666015625,
0.343994140625,
0.85498046875,
-0.026580810546875,
0.54052734375,
-0.61669921875,
-0.022735595703125,
0.17431640625,
-0.712890625,
-0.62548828125,
0.3173828125,
-0.02642822265625,
0.6787109375,
0.08612060546875,
0.51953125,
0.6396484375,
-0.673828125,
0.10821533203125,
-0.58349609375,
-0.00356292724609375,
-0.61669921875,
1.076171875,
0.2039794921875,
-0.41943359375,
0.359619140625,
-0.1165771484375,
-0.9912109375,
-0.1356201171875,
0.08746337890625,
0.02984619140625,
-0.1590576171875,
0.57373046875,
-0.90869140625,
-0.1282958984375,
0.466552734375,
-0.36572265625,
0.182861328125,
0.5185546875,
-0.94482421875,
0.6640625,
-0.74462890625,
0.59033203125,
-0.72509765625,
-0.268310546875,
0.325927734375,
0.578125,
-0.189208984375,
-0.24853515625,
0.5322265625,
0.401123046875,
0.3017578125,
0.07965087890625,
0.65625,
-0.8681640625,
0.4638671875,
-0.6591796875,
0.7294921875,
-0.1566162109375,
0.0718994140625,
-0.1922607421875,
-0.276611328125,
-0.63037109375,
-0.76416015625,
0.5419921875,
0.165771484375,
-0.1236572265625,
0.5517578125,
0.64208984375,
-0.2734375,
-0.206298828125,
-0.2218017578125,
-0.29345703125,
-0.4658203125,
0.11407470703125,
1.189453125,
-0.58935546875,
-0.3154296875,
-0.3857421875,
0.8798828125,
0.418701171875,
0.498291015625,
0.1875,
-0.22998046875,
-0.017242431640625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Tags: brute force, constructive algorithms, dp, implementation, strings
Correct Solution:
```
#!/usr/bin/python3
# BEGIN template
import sys
import re
import pprint
def dbg(x,y=''):
if len(y) > 0: y += ' = '
sys.stderr.write('\n>>> '+y+pprint.pformat(x)+'\n')
oo = 0x3f3f3f3f3f3f3f3f
# END template
def main():
for t in range(int(input())):
impo = False
# input
n = int(input())
users = input().split()
users_set = set(users)
users.insert(0,'0')
m = int(input())
msg = [None]*(m+5)
for i in range(1,m+1):
user, text = input().split(':')
alts = set()
if user != '?': user = users.index(user)
else:
# this shit is pretty fucked up, dude
for alt in users_set - {x for x in re.split(r'[^A-Za-z0-9]+',text)}:
alts.add(users.index(alt))
msg[i] = dict(user=user, text=text, users=alts)
# remove before and after
for i in range(1,m+1):
if 1 <= i-1: msg[i]['users'].discard(msg[i-1]['user'])
if i+1 <= m: msg[i]['users'].discard(msg[i+1]['user'])
if msg[i]['user'] == '?' and len(msg[i]['users']) == 0:
impo = True
break
if impo:
print('Impossible')
continue
# compute answer
dp = [[0 for j in range(n+5)] for i in range(m+5)]
for i in range(n+5):
dp[m+1][i] = oo
for i in range(m,0,-1):
u = msg[i]['user']
for j in range(n+1):
if u != '?':
if u != j and dp[i+1][u]: dp[i][j] = u
else:
for alt in msg[i]['users']:
if alt != j and dp[i+1][alt]:
dp[i][j] = alt
break
# output
if not dp[1][0]:
print('Impossible')
continue
j = 0
for i in range(1,m+1):
print(users[dp[i][j]]+':'+msg[i]['text'])
j = dp[i][j]
main()
```
| 65,316
|
[
0.38134765625,
-0.276611328125,
-0.1856689453125,
0.5966796875,
-0.234130859375,
-0.861328125,
-0.62548828125,
-0.0675048828125,
0.1224365234375,
0.544921875,
0.30615234375,
0.014068603515625,
0.2308349609375,
-0.45654296875,
-1.0478515625,
0.043609619140625,
-0.3486328125,
-0.74462890625,
-0.06866455078125,
-0.07464599609375,
0.441650390625,
0.030242919921875,
-1.4130859375,
-0.55908203125,
-0.66748046875,
0.5595703125,
0.11834716796875,
-0.0274658203125,
0.9443359375,
1.0830078125,
-0.427490234375,
-0.416748046875,
0.1336669921875,
-1.4013671875,
-0.271728515625,
-0.06707763671875,
0.53271484375,
-0.580078125,
-0.70458984375,
-0.50927734375,
0.203369140625,
-0.41455078125,
0.70068359375,
-0.890625,
-1.3251953125,
0.249267578125,
-0.314453125,
-0.12066650390625,
-0.015289306640625,
-0.91064453125,
0.449951171875,
-0.09588623046875,
0.81103515625,
-0.2587890625,
-0.215087890625,
-0.83544921875,
-0.472900390625,
0.2005615234375,
-0.57275390625,
0.1353759765625,
-0.206298828125,
0.44970703125,
-0.09051513671875,
-0.61083984375,
-0.0762939453125,
-0.1595458984375,
-0.22998046875,
-0.2318115234375,
-0.02740478515625,
-0.64501953125,
-0.187744140625,
0.243896484375,
-0.72900390625,
-0.52294921875,
-0.425537109375,
0.393798828125,
0.1693115234375,
-0.150146484375,
-0.1378173828125,
0.5849609375,
0.0980224609375,
1.060546875,
0.259033203125,
0.318115234375,
-0.6123046875,
-0.9208984375,
0.484130859375,
0.412109375,
0.2841796875,
-0.236083984375,
-0.1585693359375,
0.1781005859375,
-0.59619140625,
0.0572509765625,
0.890625,
0.496337890625,
0.295166015625,
0.595703125,
-0.3076171875,
0.3056640625,
0.71337890625,
1.2705078125,
-0.302978515625,
1.2373046875,
-0.03472900390625,
0.197265625,
0.28076171875,
0.2269287109375,
-0.377197265625,
-0.048431396484375,
-0.460693359375,
-0.312744140625,
0.59423828125,
0.26708984375,
-0.169921875,
0.86083984375,
0.110107421875,
-0.22998046875,
-1.0966796875,
0.297119140625,
0.240966796875,
-0.310546875,
0.19677734375,
-0.24267578125,
0.044403076171875,
0.006519317626953125,
0.046051025390625,
0.9970703125,
-0.4931640625,
-0.28173828125,
0.282958984375,
-0.31005859375,
-0.060760498046875,
0.140380859375,
-0.11016845703125,
0.52197265625,
-0.439697265625,
0.634765625,
1.0068359375,
-0.64013671875,
0.623046875,
-0.1956787109375,
-0.1849365234375,
1.42578125,
0.54736328125,
0.04620361328125,
0.493896484375,
0.421142578125,
-0.5751953125,
0.1602783203125,
-0.728515625,
0.8271484375,
-0.0849609375,
0.250244140625,
-0.11517333984375,
-0.22509765625,
-0.147216796875,
0.546875,
0.2012939453125,
0.1744384765625,
-0.492919921875,
-0.201416015625,
-0.16943359375,
1.052734375,
-0.04052734375,
1.0087890625,
-0.67138671875,
-0.64697265625,
-0.128662109375,
-0.486083984375,
0.79296875,
-0.2098388671875,
-0.1409912109375,
1.080078125,
0.81103515625,
0.8681640625,
0.3486328125,
-0.407470703125,
0.2127685546875,
-0.016632080078125,
0.200439453125,
0.189208984375,
-0.009857177734375,
0.66259765625,
0.25,
-0.0111541748046875,
0.44384765625,
-0.8984375,
-0.89892578125,
-0.63232421875,
0.22412109375,
0.53759765625,
-0.54248046875,
0.25146484375,
0.30419921875,
-0.060150146484375,
-0.53515625,
0.0377197265625,
0.08843994140625,
-0.76904296875,
-0.363037109375,
0.79052734375,
-0.395263671875,
0.455078125,
-0.232666015625,
-0.2032470703125,
0.468994140625,
1.4951171875,
-0.137451171875,
-0.1826171875,
0.55908203125,
0.209228515625,
-0.098876953125,
-0.205810546875,
0.5146484375,
-0.67041015625,
-0.58935546875,
0.4765625,
-0.364990234375,
-0.22509765625,
0.060577392578125,
0.73974609375,
0.57080078125,
0.391357421875,
-0.56591796875,
-0.286376953125,
0.302978515625,
1.341796875,
-0.09564208984375,
0.54638671875,
0.21044921875,
0.671875,
0.254150390625,
1.080078125,
0.354736328125,
-0.0012559890747070312,
0.71484375,
0.7646484375,
0.1922607421875,
0.1905517578125,
0.0233612060546875,
0.307861328125,
0.173583984375,
0.427734375,
0.019134521484375,
0.63671875,
-0.28857421875,
-0.10009765625,
-0.99072265625,
0.309814453125,
-0.7939453125,
0.541015625,
0.474853515625,
0.2071533203125,
-0.86376953125,
-0.41015625,
0.6171875,
0.62451171875,
-0.71728515625,
-0.1600341796875,
-0.05865478515625,
0.034210205078125,
0.297119140625,
-0.165771484375,
0.10858154296875,
0.3798828125,
0.46630859375,
0.447998046875,
-0.252685546875,
-0.5693359375,
-0.92431640625,
-1.017578125,
-1.125,
-0.78515625,
-0.7236328125,
-0.25390625,
0.30322265625,
-0.6875,
0.332275390625,
-0.4482421875,
-0.06549072265625,
0.1060791015625,
-0.93603515625,
0.61474609375,
-0.05694580078125,
0.5341796875,
-0.966796875,
0.38671875,
-0.154541015625,
0.982421875,
-0.313232421875,
0.052337646484375,
-0.1600341796875,
-0.6875,
0.279296875,
-0.291259765625,
0.3720703125,
-0.142333984375,
-1.0625,
-0.406005859375,
-0.94189453125,
-0.03057861328125,
-0.350341796875,
0.061279296875,
-0.80126953125,
0.8330078125,
0.87158203125,
-0.72607421875,
0.5634765625,
0.72119140625,
-0.60693359375,
0.5361328125,
0.42529296875,
0.0210113525390625,
-0.6259765625,
0.88525390625,
0.583984375,
0.587890625,
-0.466064453125,
-0.32373046875,
-0.80126953125,
0.1429443359375,
0.058135986328125,
-0.5224609375,
-0.231201171875,
0.0670166015625,
0.10528564453125,
-1.16015625,
0.50244140625,
-1.65234375,
-0.93994140625,
-0.092041015625,
-0.53076171875,
1.1640625,
0.91455078125,
-0.0499267578125,
-0.315185546875,
-0.10919189453125,
-0.292724609375,
0.52001953125,
0.3681640625,
-0.411865234375,
0.1688232421875,
0.8623046875,
0.10845947265625,
-0.1793212890625,
0.5029296875,
-0.6767578125,
-0.215087890625,
-0.0926513671875,
0.347412109375,
0.52978515625,
0.548828125,
0.05169677734375,
0.05596923828125,
0.78857421875,
-0.76123046875,
-0.29736328125,
0.2197265625,
0.388916015625,
0.6611328125,
0.277587890625,
0.191162109375,
-0.260498046875,
-0.689453125,
-0.8134765625,
0.335205078125,
0.66943359375,
1.103515625,
-0.57421875,
0.5673828125,
0.0035953521728515625,
-0.86328125,
0.402587890625,
-0.76513671875,
-0.4873046875,
0.91650390625,
0.0203399658203125,
0.66650390625,
-1.0234375,
-0.10009765625,
0.1446533203125,
0.09173583984375,
0.484130859375,
0.7119140625,
0.53076171875,
-0.6005859375,
-0.27783203125,
-0.2509765625,
-0.269287109375,
0.09100341796875,
-0.44970703125,
-0.431884765625,
-0.21875,
-0.45849609375,
-0.99072265625,
0.45361328125,
0.6044921875,
0.7421875,
0.1177978515625,
0.8525390625,
0.1185302734375,
0.9560546875,
0.70361328125,
-0.509765625,
0.09796142578125,
-0.70458984375,
0.6416015625,
0.352294921875,
-0.32080078125,
-0.437744140625,
-0.319580078125,
-0.1461181640625,
-0.0689697265625,
0.259033203125,
-0.33642578125,
-0.5654296875,
0.031524658203125,
-0.02740478515625,
0.74169921875,
-0.265380859375,
-0.55859375,
-0.11212158203125,
0.253173828125,
0.396240234375,
-0.425537109375,
0.1427001953125,
-0.61865234375,
0.69140625,
0.7861328125,
-0.037841796875,
-0.552734375,
-0.59375,
-0.84619140625,
-0.646484375,
0.1693115234375,
0.798828125,
-0.548828125,
-0.0233612060546875,
-1.28515625,
0.478515625,
0.285400390625,
-0.322509765625,
0.089599609375,
-0.07537841796875,
0.3125,
0.1695556640625,
0.71923828125,
-0.048980712890625,
-0.444091796875,
0.275146484375,
-0.5634765625,
0.6494140625,
-0.7412109375,
0.1876220703125,
-0.11846923828125,
0.0205078125,
-0.01229095458984375,
0.7333984375,
-0.0582275390625,
0.34423828125,
-0.07904052734375,
0.041595458984375,
-0.94970703125,
-0.54736328125,
0.435302734375,
0.2037353515625,
-0.393798828125,
0.291748046875,
0.295166015625,
-0.453857421875,
0.1749267578125,
0.4375,
-0.349609375,
0.474365234375,
-0.7490234375,
0.60888671875,
-0.307861328125,
-0.5439453125,
-0.0240936279296875,
-0.5029296875,
0.448974609375,
0.0888671875,
-1.0390625,
-0.186767578125,
-0.98876953125,
-0.2705078125,
-0.133056640625,
-0.54052734375,
0.396240234375,
0.1162109375,
-0.0171966552734375,
-0.21826171875,
0.00409698486328125,
-0.9208984375,
-0.04205322265625,
-0.548828125,
-0.2000732421875,
0.440185546875,
0.1365966796875,
0.69482421875,
-0.11370849609375,
-0.63623046875,
0.462890625,
-0.1727294921875,
0.2010498046875,
-0.325439453125,
-0.39111328125,
0.1488037109375,
-0.1837158203125,
-0.358642578125,
0.31494140625,
-0.64111328125,
0.2374267578125,
0.9296875,
-0.041259765625,
0.2342529296875,
0.0271453857421875,
-0.45849609375,
0.76513671875,
0.1312255859375,
-1.142578125,
-0.33251953125,
0.64697265625,
-0.384765625,
0.44580078125,
0.8583984375,
-1.18359375,
-0.56396484375,
-0.8779296875,
0.19384765625,
-1.0390625,
-0.09368896484375,
-0.82763671875,
-0.1746826171875,
-0.41064453125,
0.98828125,
0.043426513671875,
-0.69140625,
-0.3134765625,
-0.90576171875,
0.41796875,
-0.71337890625,
-0.18408203125,
-0.128662109375,
-0.27197265625,
-0.240966796875,
1.189453125,
0.325927734375,
0.277099609375,
-0.12371826171875,
-0.056884765625,
0.454345703125,
-0.2021484375,
-0.401123046875,
-0.11090087890625,
0.1131591796875,
0.1455078125,
-0.4384765625,
0.32373046875,
-0.7900390625,
0.61376953125,
-0.5615234375,
-0.153076171875,
0.0758056640625,
-0.50537109375,
-0.0250396728515625,
-0.035888671875,
1.1064453125,
-0.52001953125,
-0.04144287109375,
-0.2919921875,
0.26318359375,
0.537109375,
-0.2113037109375,
-0.62060546875,
-0.814453125,
-0.8916015625,
-1.1767578125,
0.623046875,
-0.350830078125,
-0.1650390625,
-0.145751953125,
-0.1748046875,
0.89404296875,
-0.50244140625,
0.37353515625,
1.3857421875,
0.34814453125,
0.2103271484375,
-0.77880859375,
0.76513671875,
0.2008056640625,
-0.54541015625,
-0.2626953125,
0.1510009765625,
-0.8388671875,
0.1734619140625,
-0.338623046875,
-0.85302734375,
-0.58642578125,
-0.09716796875,
1.0478515625,
-0.39453125,
1.1064453125,
0.11724853515625,
-1.029296875,
-1.00390625,
0.60986328125,
0.201416015625,
0.10394287109375,
0.748046875,
0.07952880859375,
0.283203125,
-0.067138671875,
0.17529296875,
-0.09356689453125,
-0.634765625,
1.0986328125,
0.25830078125,
-0.395263671875,
0.78076171875,
1.015625,
-0.88671875,
-0.9375,
-0.057647705078125,
-0.043914794921875,
-0.375244140625,
-0.80859375,
-0.2322998046875,
0.62548828125,
-0.7763671875,
0.27197265625,
0.94140625,
0.013885498046875,
0.0885009765625,
0.053985595703125,
0.314697265625,
-0.69580078125,
0.94140625,
0.912109375,
-0.50244140625,
0.1507568359375,
-1.0322265625,
-0.0234527587890625,
-0.5126953125,
-0.1552734375,
1.0244140625,
-0.6982421875,
0.44580078125,
0.52587890625,
-0.1771240234375,
0.9873046875,
-0.273193359375,
-0.32568359375,
0.2271728515625,
-0.77294921875,
-0.67626953125,
-0.237548828125,
0.44970703125,
-0.32421875,
0.407470703125,
-0.61474609375,
0.272216796875,
0.6044921875,
0.3544921875,
-0.3837890625,
-1.134765625,
-0.428955078125,
-1.0986328125,
-0.56591796875,
-0.75,
0.0682373046875,
-0.52587890625,
0.038818359375,
0.416015625,
-0.9091796875,
0.11383056640625,
0.448486328125,
-0.2071533203125,
0.8310546875,
-0.8525390625,
0.63134765625,
-0.7890625,
-0.4462890625,
-0.71484375,
-0.282958984375,
-0.24853515625,
-0.0947265625,
-0.1273193359375,
0.333251953125,
-0.327880859375,
0.59765625,
0.1533203125,
0.28271484375,
-0.1832275390625,
-0.480224609375,
-0.0980224609375,
-0.1658935546875,
-0.429443359375,
0.275146484375,
0.5693359375,
-0.43994140625,
0.04248046875,
-0.1766357421875,
-0.334228515625,
-0.2174072265625,
0.6240234375,
0.6982421875,
0.045440673828125,
0.13916015625,
-0.225341796875,
0.10626220703125,
-0.89892578125,
0.11077880859375,
0.07122802734375,
0.12176513671875,
0.411376953125,
-0.235595703125,
0.36865234375,
0.923828125,
0.01629638671875,
0.56689453125,
-0.256103515625,
0.381591796875,
0.09912109375,
-0.07666015625,
0.00249481201171875,
-0.06915283203125,
0.0814208984375,
0.313232421875,
0.275390625,
0.3466796875,
-0.330322265625,
0.7294921875,
-0.0460205078125,
-0.7822265625,
-0.67138671875,
-0.327880859375,
0.2435302734375,
0.286376953125,
0.442626953125,
-0.127685546875,
0.12548828125,
-0.2078857421875,
-0.65576171875,
0.266845703125,
-1.2353515625,
-0.078369140625,
1.1376953125,
-0.314208984375,
-0.437744140625,
-0.451904296875,
-0.4091796875,
-0.201416015625,
0.403564453125,
0.436767578125,
-0.58544921875,
0.1005859375,
0.1378173828125,
0.671875,
-0.65283203125,
0.615234375,
-0.0849609375,
0.2802734375,
-0.38232421875,
-0.1971435546875,
0.1346435546875,
1.2275390625,
0.011199951171875,
-0.40576171875,
-1.056640625,
-0.1024169921875,
0.37451171875,
-0.3076171875,
-0.2459716796875,
0.07098388671875,
-0.216796875,
0.2587890625,
-0.87744140625,
0.10540771484375,
-0.03326416015625,
0.4072265625,
0.4599609375,
-0.2352294921875,
-0.65673828125,
0.70556640625,
0.72998046875,
-0.09783935546875,
0.94287109375,
-0.04107666015625,
0.315185546875,
0.194580078125,
0.224609375,
-0.32861328125,
0.9853515625,
0.755859375,
0.23681640625,
-0.4248046875,
0.41064453125,
0.77783203125,
0.09747314453125,
-0.2076416015625,
0.0731201171875,
0.0726318359375,
-0.297607421875,
0.3623046875,
-0.299560546875,
-0.06268310546875,
-0.004241943359375,
-0.114990234375,
0.3212890625,
-0.2379150390625,
-0.0538330078125,
-0.52978515625,
-0.80908203125,
0.533203125,
-0.27685546875,
-0.0006175041198730469,
0.379150390625,
-0.767578125,
-0.0186767578125,
0.9287109375,
-0.0088348388671875,
-0.267333984375,
0.8427734375,
0.1956787109375,
0.46337890625,
0.56591796875,
0.445068359375,
0.59814453125,
-0.8251953125,
0.5517578125,
0.13720703125,
-0.0240478515625,
-0.2227783203125,
-0.313720703125,
-0.7900390625,
0.4013671875,
-0.471923828125,
0.00696563720703125,
0.6884765625,
-1.0419921875,
0.15869140625,
-0.1700439453125,
0.498291015625,
-0.541015625,
0.29052734375,
0.14453125,
-0.68798828125,
-0.70361328125,
1.03515625,
-0.2347412109375,
0.50341796875,
0.0012416839599609375,
1.177734375,
0.0628662109375,
1.740234375,
0.379638671875,
-0.1544189453125,
-0.2041015625,
0.1456298828125,
-0.5029296875,
-0.57275390625,
-0.2015380859375,
-0.446044921875,
0.677734375,
-0.57666015625,
-0.322021484375,
-0.1915283203125,
0.78369140625,
0.337158203125,
-1.140625,
-0.393798828125,
0.45068359375,
-0.347900390625,
0.34521484375,
0.55517578125,
0.0252227783203125,
-0.027923583984375,
0.173583984375,
0.08734130859375,
-0.75927734375,
-0.09161376953125,
-0.93994140625,
0.456787109375,
-0.06805419921875,
-0.77685546875,
-0.412109375,
-0.87646484375,
-0.178955078125,
0.1832275390625,
-0.45703125,
-0.80126953125,
0.57763671875,
0.64453125,
0.7275390625,
0.2071533203125,
-0.1634521484375,
-0.23193359375,
1.126953125,
1.0205078125,
0.1895751953125,
1.05859375,
0.376708984375,
-0.26171875,
0.383544921875,
-0.419677734375,
0.59423828125,
0.1524658203125,
0.123779296875,
-0.2210693359375,
-0.368408203125,
-0.62548828125,
-1.3447265625,
0.021636962890625,
1.0791015625,
0.6796875,
-0.458740234375,
-1.02734375,
-0.580078125,
-1.052734375,
-0.0092620849609375,
-0.30712890625,
0.93701171875,
-0.175537109375,
-0.17578125,
0.183837890625,
-1.3720703125,
4.30078125,
1.2783203125,
0.98291015625,
0.091064453125,
0.075927734375,
1.0693359375,
0.8544921875,
-0.322265625,
-0.1605224609375,
-0.248779296875,
0.1953125,
-0.482666015625,
0.343994140625,
0.85498046875,
-0.026580810546875,
0.54052734375,
-0.61669921875,
-0.022735595703125,
0.17431640625,
-0.712890625,
-0.62548828125,
0.3173828125,
-0.02642822265625,
0.6787109375,
0.08612060546875,
0.51953125,
0.6396484375,
-0.673828125,
0.10821533203125,
-0.58349609375,
-0.00356292724609375,
-0.61669921875,
1.076171875,
0.2039794921875,
-0.41943359375,
0.359619140625,
-0.1165771484375,
-0.9912109375,
-0.1356201171875,
0.08746337890625,
0.02984619140625,
-0.1590576171875,
0.57373046875,
-0.90869140625,
-0.1282958984375,
0.466552734375,
-0.36572265625,
0.182861328125,
0.5185546875,
-0.94482421875,
0.6640625,
-0.74462890625,
0.59033203125,
-0.72509765625,
-0.268310546875,
0.325927734375,
0.578125,
-0.189208984375,
-0.24853515625,
0.5322265625,
0.401123046875,
0.3017578125,
0.07965087890625,
0.65625,
-0.8681640625,
0.4638671875,
-0.6591796875,
0.7294921875,
-0.1566162109375,
0.0718994140625,
-0.1922607421875,
-0.276611328125,
-0.63037109375,
-0.76416015625,
0.5419921875,
0.165771484375,
-0.1236572265625,
0.5517578125,
0.64208984375,
-0.2734375,
-0.206298828125,
-0.2218017578125,
-0.29345703125,
-0.4658203125,
0.11407470703125,
1.189453125,
-0.58935546875,
-0.3154296875,
-0.3857421875,
0.8798828125,
0.418701171875,
0.498291015625,
0.1875,
-0.22998046875,
-0.017242431640625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Tags: brute force, constructive algorithms, dp, implementation, strings
Correct Solution:
```
import re
t = int(input())
delimiters = "?", ".", " ", ",", "!", ":"
regexPattern = '|'.join(map(re.escape, delimiters))
for i in range(t):
n = int(input())
usernames = {x for x in str.split(input(), ' ')}
m = int(input())
possibilities = []
for j in range(m):
possibilities.append({x for x in usernames})
messages = []
for j in range(m):
messages.append(input())
for j in range(m):
if (messages[j][0] != '?'):
messageSplit = re.split(':', messages[j])
possibilities[j] = {messageSplit[0]}
else:
messageSplit = re.split(regexPattern, messages[j])
for token in messageSplit:
if token in usernames:
possibilities[j] = possibilities[j] - {token}
changed = True
while changed:
changed = False
for j in range(m):
if len(possibilities[j]) == 1:
(poss,) = possibilities[j]
if j < m-1 and poss in possibilities[j+1]:
changed = True
possibilities[j+1] = possibilities[j+1] - possibilities[j]
if j > 0 and poss in possibilities[j-1]:
changed = True
possibilities[j-1] = possibilities[j-1] - possibilities[j]
worked = True
for j in range(m):
if len(possibilities[j]) == 0:
worked = False
if not worked:
print("Impossible")
else :
for j in range(m):
poss = next(iter(possibilities[j]))
if (messages[j][0] == '?'):
print (poss + messages[j][1:])
else:
print(messages[j])
if (j < m-1):
possibilities[j+1] = possibilities[j+1] - {poss}
```
| 65,317
|
[
0.38134765625,
-0.276611328125,
-0.1856689453125,
0.5966796875,
-0.234130859375,
-0.861328125,
-0.62548828125,
-0.0675048828125,
0.1224365234375,
0.544921875,
0.30615234375,
0.014068603515625,
0.2308349609375,
-0.45654296875,
-1.0478515625,
0.043609619140625,
-0.3486328125,
-0.74462890625,
-0.06866455078125,
-0.07464599609375,
0.441650390625,
0.030242919921875,
-1.4130859375,
-0.55908203125,
-0.66748046875,
0.5595703125,
0.11834716796875,
-0.0274658203125,
0.9443359375,
1.0830078125,
-0.427490234375,
-0.416748046875,
0.1336669921875,
-1.4013671875,
-0.271728515625,
-0.06707763671875,
0.53271484375,
-0.580078125,
-0.70458984375,
-0.50927734375,
0.203369140625,
-0.41455078125,
0.70068359375,
-0.890625,
-1.3251953125,
0.249267578125,
-0.314453125,
-0.12066650390625,
-0.015289306640625,
-0.91064453125,
0.449951171875,
-0.09588623046875,
0.81103515625,
-0.2587890625,
-0.215087890625,
-0.83544921875,
-0.472900390625,
0.2005615234375,
-0.57275390625,
0.1353759765625,
-0.206298828125,
0.44970703125,
-0.09051513671875,
-0.61083984375,
-0.0762939453125,
-0.1595458984375,
-0.22998046875,
-0.2318115234375,
-0.02740478515625,
-0.64501953125,
-0.187744140625,
0.243896484375,
-0.72900390625,
-0.52294921875,
-0.425537109375,
0.393798828125,
0.1693115234375,
-0.150146484375,
-0.1378173828125,
0.5849609375,
0.0980224609375,
1.060546875,
0.259033203125,
0.318115234375,
-0.6123046875,
-0.9208984375,
0.484130859375,
0.412109375,
0.2841796875,
-0.236083984375,
-0.1585693359375,
0.1781005859375,
-0.59619140625,
0.0572509765625,
0.890625,
0.496337890625,
0.295166015625,
0.595703125,
-0.3076171875,
0.3056640625,
0.71337890625,
1.2705078125,
-0.302978515625,
1.2373046875,
-0.03472900390625,
0.197265625,
0.28076171875,
0.2269287109375,
-0.377197265625,
-0.048431396484375,
-0.460693359375,
-0.312744140625,
0.59423828125,
0.26708984375,
-0.169921875,
0.86083984375,
0.110107421875,
-0.22998046875,
-1.0966796875,
0.297119140625,
0.240966796875,
-0.310546875,
0.19677734375,
-0.24267578125,
0.044403076171875,
0.006519317626953125,
0.046051025390625,
0.9970703125,
-0.4931640625,
-0.28173828125,
0.282958984375,
-0.31005859375,
-0.060760498046875,
0.140380859375,
-0.11016845703125,
0.52197265625,
-0.439697265625,
0.634765625,
1.0068359375,
-0.64013671875,
0.623046875,
-0.1956787109375,
-0.1849365234375,
1.42578125,
0.54736328125,
0.04620361328125,
0.493896484375,
0.421142578125,
-0.5751953125,
0.1602783203125,
-0.728515625,
0.8271484375,
-0.0849609375,
0.250244140625,
-0.11517333984375,
-0.22509765625,
-0.147216796875,
0.546875,
0.2012939453125,
0.1744384765625,
-0.492919921875,
-0.201416015625,
-0.16943359375,
1.052734375,
-0.04052734375,
1.0087890625,
-0.67138671875,
-0.64697265625,
-0.128662109375,
-0.486083984375,
0.79296875,
-0.2098388671875,
-0.1409912109375,
1.080078125,
0.81103515625,
0.8681640625,
0.3486328125,
-0.407470703125,
0.2127685546875,
-0.016632080078125,
0.200439453125,
0.189208984375,
-0.009857177734375,
0.66259765625,
0.25,
-0.0111541748046875,
0.44384765625,
-0.8984375,
-0.89892578125,
-0.63232421875,
0.22412109375,
0.53759765625,
-0.54248046875,
0.25146484375,
0.30419921875,
-0.060150146484375,
-0.53515625,
0.0377197265625,
0.08843994140625,
-0.76904296875,
-0.363037109375,
0.79052734375,
-0.395263671875,
0.455078125,
-0.232666015625,
-0.2032470703125,
0.468994140625,
1.4951171875,
-0.137451171875,
-0.1826171875,
0.55908203125,
0.209228515625,
-0.098876953125,
-0.205810546875,
0.5146484375,
-0.67041015625,
-0.58935546875,
0.4765625,
-0.364990234375,
-0.22509765625,
0.060577392578125,
0.73974609375,
0.57080078125,
0.391357421875,
-0.56591796875,
-0.286376953125,
0.302978515625,
1.341796875,
-0.09564208984375,
0.54638671875,
0.21044921875,
0.671875,
0.254150390625,
1.080078125,
0.354736328125,
-0.0012559890747070312,
0.71484375,
0.7646484375,
0.1922607421875,
0.1905517578125,
0.0233612060546875,
0.307861328125,
0.173583984375,
0.427734375,
0.019134521484375,
0.63671875,
-0.28857421875,
-0.10009765625,
-0.99072265625,
0.309814453125,
-0.7939453125,
0.541015625,
0.474853515625,
0.2071533203125,
-0.86376953125,
-0.41015625,
0.6171875,
0.62451171875,
-0.71728515625,
-0.1600341796875,
-0.05865478515625,
0.034210205078125,
0.297119140625,
-0.165771484375,
0.10858154296875,
0.3798828125,
0.46630859375,
0.447998046875,
-0.252685546875,
-0.5693359375,
-0.92431640625,
-1.017578125,
-1.125,
-0.78515625,
-0.7236328125,
-0.25390625,
0.30322265625,
-0.6875,
0.332275390625,
-0.4482421875,
-0.06549072265625,
0.1060791015625,
-0.93603515625,
0.61474609375,
-0.05694580078125,
0.5341796875,
-0.966796875,
0.38671875,
-0.154541015625,
0.982421875,
-0.313232421875,
0.052337646484375,
-0.1600341796875,
-0.6875,
0.279296875,
-0.291259765625,
0.3720703125,
-0.142333984375,
-1.0625,
-0.406005859375,
-0.94189453125,
-0.03057861328125,
-0.350341796875,
0.061279296875,
-0.80126953125,
0.8330078125,
0.87158203125,
-0.72607421875,
0.5634765625,
0.72119140625,
-0.60693359375,
0.5361328125,
0.42529296875,
0.0210113525390625,
-0.6259765625,
0.88525390625,
0.583984375,
0.587890625,
-0.466064453125,
-0.32373046875,
-0.80126953125,
0.1429443359375,
0.058135986328125,
-0.5224609375,
-0.231201171875,
0.0670166015625,
0.10528564453125,
-1.16015625,
0.50244140625,
-1.65234375,
-0.93994140625,
-0.092041015625,
-0.53076171875,
1.1640625,
0.91455078125,
-0.0499267578125,
-0.315185546875,
-0.10919189453125,
-0.292724609375,
0.52001953125,
0.3681640625,
-0.411865234375,
0.1688232421875,
0.8623046875,
0.10845947265625,
-0.1793212890625,
0.5029296875,
-0.6767578125,
-0.215087890625,
-0.0926513671875,
0.347412109375,
0.52978515625,
0.548828125,
0.05169677734375,
0.05596923828125,
0.78857421875,
-0.76123046875,
-0.29736328125,
0.2197265625,
0.388916015625,
0.6611328125,
0.277587890625,
0.191162109375,
-0.260498046875,
-0.689453125,
-0.8134765625,
0.335205078125,
0.66943359375,
1.103515625,
-0.57421875,
0.5673828125,
0.0035953521728515625,
-0.86328125,
0.402587890625,
-0.76513671875,
-0.4873046875,
0.91650390625,
0.0203399658203125,
0.66650390625,
-1.0234375,
-0.10009765625,
0.1446533203125,
0.09173583984375,
0.484130859375,
0.7119140625,
0.53076171875,
-0.6005859375,
-0.27783203125,
-0.2509765625,
-0.269287109375,
0.09100341796875,
-0.44970703125,
-0.431884765625,
-0.21875,
-0.45849609375,
-0.99072265625,
0.45361328125,
0.6044921875,
0.7421875,
0.1177978515625,
0.8525390625,
0.1185302734375,
0.9560546875,
0.70361328125,
-0.509765625,
0.09796142578125,
-0.70458984375,
0.6416015625,
0.352294921875,
-0.32080078125,
-0.437744140625,
-0.319580078125,
-0.1461181640625,
-0.0689697265625,
0.259033203125,
-0.33642578125,
-0.5654296875,
0.031524658203125,
-0.02740478515625,
0.74169921875,
-0.265380859375,
-0.55859375,
-0.11212158203125,
0.253173828125,
0.396240234375,
-0.425537109375,
0.1427001953125,
-0.61865234375,
0.69140625,
0.7861328125,
-0.037841796875,
-0.552734375,
-0.59375,
-0.84619140625,
-0.646484375,
0.1693115234375,
0.798828125,
-0.548828125,
-0.0233612060546875,
-1.28515625,
0.478515625,
0.285400390625,
-0.322509765625,
0.089599609375,
-0.07537841796875,
0.3125,
0.1695556640625,
0.71923828125,
-0.048980712890625,
-0.444091796875,
0.275146484375,
-0.5634765625,
0.6494140625,
-0.7412109375,
0.1876220703125,
-0.11846923828125,
0.0205078125,
-0.01229095458984375,
0.7333984375,
-0.0582275390625,
0.34423828125,
-0.07904052734375,
0.041595458984375,
-0.94970703125,
-0.54736328125,
0.435302734375,
0.2037353515625,
-0.393798828125,
0.291748046875,
0.295166015625,
-0.453857421875,
0.1749267578125,
0.4375,
-0.349609375,
0.474365234375,
-0.7490234375,
0.60888671875,
-0.307861328125,
-0.5439453125,
-0.0240936279296875,
-0.5029296875,
0.448974609375,
0.0888671875,
-1.0390625,
-0.186767578125,
-0.98876953125,
-0.2705078125,
-0.133056640625,
-0.54052734375,
0.396240234375,
0.1162109375,
-0.0171966552734375,
-0.21826171875,
0.00409698486328125,
-0.9208984375,
-0.04205322265625,
-0.548828125,
-0.2000732421875,
0.440185546875,
0.1365966796875,
0.69482421875,
-0.11370849609375,
-0.63623046875,
0.462890625,
-0.1727294921875,
0.2010498046875,
-0.325439453125,
-0.39111328125,
0.1488037109375,
-0.1837158203125,
-0.358642578125,
0.31494140625,
-0.64111328125,
0.2374267578125,
0.9296875,
-0.041259765625,
0.2342529296875,
0.0271453857421875,
-0.45849609375,
0.76513671875,
0.1312255859375,
-1.142578125,
-0.33251953125,
0.64697265625,
-0.384765625,
0.44580078125,
0.8583984375,
-1.18359375,
-0.56396484375,
-0.8779296875,
0.19384765625,
-1.0390625,
-0.09368896484375,
-0.82763671875,
-0.1746826171875,
-0.41064453125,
0.98828125,
0.043426513671875,
-0.69140625,
-0.3134765625,
-0.90576171875,
0.41796875,
-0.71337890625,
-0.18408203125,
-0.128662109375,
-0.27197265625,
-0.240966796875,
1.189453125,
0.325927734375,
0.277099609375,
-0.12371826171875,
-0.056884765625,
0.454345703125,
-0.2021484375,
-0.401123046875,
-0.11090087890625,
0.1131591796875,
0.1455078125,
-0.4384765625,
0.32373046875,
-0.7900390625,
0.61376953125,
-0.5615234375,
-0.153076171875,
0.0758056640625,
-0.50537109375,
-0.0250396728515625,
-0.035888671875,
1.1064453125,
-0.52001953125,
-0.04144287109375,
-0.2919921875,
0.26318359375,
0.537109375,
-0.2113037109375,
-0.62060546875,
-0.814453125,
-0.8916015625,
-1.1767578125,
0.623046875,
-0.350830078125,
-0.1650390625,
-0.145751953125,
-0.1748046875,
0.89404296875,
-0.50244140625,
0.37353515625,
1.3857421875,
0.34814453125,
0.2103271484375,
-0.77880859375,
0.76513671875,
0.2008056640625,
-0.54541015625,
-0.2626953125,
0.1510009765625,
-0.8388671875,
0.1734619140625,
-0.338623046875,
-0.85302734375,
-0.58642578125,
-0.09716796875,
1.0478515625,
-0.39453125,
1.1064453125,
0.11724853515625,
-1.029296875,
-1.00390625,
0.60986328125,
0.201416015625,
0.10394287109375,
0.748046875,
0.07952880859375,
0.283203125,
-0.067138671875,
0.17529296875,
-0.09356689453125,
-0.634765625,
1.0986328125,
0.25830078125,
-0.395263671875,
0.78076171875,
1.015625,
-0.88671875,
-0.9375,
-0.057647705078125,
-0.043914794921875,
-0.375244140625,
-0.80859375,
-0.2322998046875,
0.62548828125,
-0.7763671875,
0.27197265625,
0.94140625,
0.013885498046875,
0.0885009765625,
0.053985595703125,
0.314697265625,
-0.69580078125,
0.94140625,
0.912109375,
-0.50244140625,
0.1507568359375,
-1.0322265625,
-0.0234527587890625,
-0.5126953125,
-0.1552734375,
1.0244140625,
-0.6982421875,
0.44580078125,
0.52587890625,
-0.1771240234375,
0.9873046875,
-0.273193359375,
-0.32568359375,
0.2271728515625,
-0.77294921875,
-0.67626953125,
-0.237548828125,
0.44970703125,
-0.32421875,
0.407470703125,
-0.61474609375,
0.272216796875,
0.6044921875,
0.3544921875,
-0.3837890625,
-1.134765625,
-0.428955078125,
-1.0986328125,
-0.56591796875,
-0.75,
0.0682373046875,
-0.52587890625,
0.038818359375,
0.416015625,
-0.9091796875,
0.11383056640625,
0.448486328125,
-0.2071533203125,
0.8310546875,
-0.8525390625,
0.63134765625,
-0.7890625,
-0.4462890625,
-0.71484375,
-0.282958984375,
-0.24853515625,
-0.0947265625,
-0.1273193359375,
0.333251953125,
-0.327880859375,
0.59765625,
0.1533203125,
0.28271484375,
-0.1832275390625,
-0.480224609375,
-0.0980224609375,
-0.1658935546875,
-0.429443359375,
0.275146484375,
0.5693359375,
-0.43994140625,
0.04248046875,
-0.1766357421875,
-0.334228515625,
-0.2174072265625,
0.6240234375,
0.6982421875,
0.045440673828125,
0.13916015625,
-0.225341796875,
0.10626220703125,
-0.89892578125,
0.11077880859375,
0.07122802734375,
0.12176513671875,
0.411376953125,
-0.235595703125,
0.36865234375,
0.923828125,
0.01629638671875,
0.56689453125,
-0.256103515625,
0.381591796875,
0.09912109375,
-0.07666015625,
0.00249481201171875,
-0.06915283203125,
0.0814208984375,
0.313232421875,
0.275390625,
0.3466796875,
-0.330322265625,
0.7294921875,
-0.0460205078125,
-0.7822265625,
-0.67138671875,
-0.327880859375,
0.2435302734375,
0.286376953125,
0.442626953125,
-0.127685546875,
0.12548828125,
-0.2078857421875,
-0.65576171875,
0.266845703125,
-1.2353515625,
-0.078369140625,
1.1376953125,
-0.314208984375,
-0.437744140625,
-0.451904296875,
-0.4091796875,
-0.201416015625,
0.403564453125,
0.436767578125,
-0.58544921875,
0.1005859375,
0.1378173828125,
0.671875,
-0.65283203125,
0.615234375,
-0.0849609375,
0.2802734375,
-0.38232421875,
-0.1971435546875,
0.1346435546875,
1.2275390625,
0.011199951171875,
-0.40576171875,
-1.056640625,
-0.1024169921875,
0.37451171875,
-0.3076171875,
-0.2459716796875,
0.07098388671875,
-0.216796875,
0.2587890625,
-0.87744140625,
0.10540771484375,
-0.03326416015625,
0.4072265625,
0.4599609375,
-0.2352294921875,
-0.65673828125,
0.70556640625,
0.72998046875,
-0.09783935546875,
0.94287109375,
-0.04107666015625,
0.315185546875,
0.194580078125,
0.224609375,
-0.32861328125,
0.9853515625,
0.755859375,
0.23681640625,
-0.4248046875,
0.41064453125,
0.77783203125,
0.09747314453125,
-0.2076416015625,
0.0731201171875,
0.0726318359375,
-0.297607421875,
0.3623046875,
-0.299560546875,
-0.06268310546875,
-0.004241943359375,
-0.114990234375,
0.3212890625,
-0.2379150390625,
-0.0538330078125,
-0.52978515625,
-0.80908203125,
0.533203125,
-0.27685546875,
-0.0006175041198730469,
0.379150390625,
-0.767578125,
-0.0186767578125,
0.9287109375,
-0.0088348388671875,
-0.267333984375,
0.8427734375,
0.1956787109375,
0.46337890625,
0.56591796875,
0.445068359375,
0.59814453125,
-0.8251953125,
0.5517578125,
0.13720703125,
-0.0240478515625,
-0.2227783203125,
-0.313720703125,
-0.7900390625,
0.4013671875,
-0.471923828125,
0.00696563720703125,
0.6884765625,
-1.0419921875,
0.15869140625,
-0.1700439453125,
0.498291015625,
-0.541015625,
0.29052734375,
0.14453125,
-0.68798828125,
-0.70361328125,
1.03515625,
-0.2347412109375,
0.50341796875,
0.0012416839599609375,
1.177734375,
0.0628662109375,
1.740234375,
0.379638671875,
-0.1544189453125,
-0.2041015625,
0.1456298828125,
-0.5029296875,
-0.57275390625,
-0.2015380859375,
-0.446044921875,
0.677734375,
-0.57666015625,
-0.322021484375,
-0.1915283203125,
0.78369140625,
0.337158203125,
-1.140625,
-0.393798828125,
0.45068359375,
-0.347900390625,
0.34521484375,
0.55517578125,
0.0252227783203125,
-0.027923583984375,
0.173583984375,
0.08734130859375,
-0.75927734375,
-0.09161376953125,
-0.93994140625,
0.456787109375,
-0.06805419921875,
-0.77685546875,
-0.412109375,
-0.87646484375,
-0.178955078125,
0.1832275390625,
-0.45703125,
-0.80126953125,
0.57763671875,
0.64453125,
0.7275390625,
0.2071533203125,
-0.1634521484375,
-0.23193359375,
1.126953125,
1.0205078125,
0.1895751953125,
1.05859375,
0.376708984375,
-0.26171875,
0.383544921875,
-0.419677734375,
0.59423828125,
0.1524658203125,
0.123779296875,
-0.2210693359375,
-0.368408203125,
-0.62548828125,
-1.3447265625,
0.021636962890625,
1.0791015625,
0.6796875,
-0.458740234375,
-1.02734375,
-0.580078125,
-1.052734375,
-0.0092620849609375,
-0.30712890625,
0.93701171875,
-0.175537109375,
-0.17578125,
0.183837890625,
-1.3720703125,
4.30078125,
1.2783203125,
0.98291015625,
0.091064453125,
0.075927734375,
1.0693359375,
0.8544921875,
-0.322265625,
-0.1605224609375,
-0.248779296875,
0.1953125,
-0.482666015625,
0.343994140625,
0.85498046875,
-0.026580810546875,
0.54052734375,
-0.61669921875,
-0.022735595703125,
0.17431640625,
-0.712890625,
-0.62548828125,
0.3173828125,
-0.02642822265625,
0.6787109375,
0.08612060546875,
0.51953125,
0.6396484375,
-0.673828125,
0.10821533203125,
-0.58349609375,
-0.00356292724609375,
-0.61669921875,
1.076171875,
0.2039794921875,
-0.41943359375,
0.359619140625,
-0.1165771484375,
-0.9912109375,
-0.1356201171875,
0.08746337890625,
0.02984619140625,
-0.1590576171875,
0.57373046875,
-0.90869140625,
-0.1282958984375,
0.466552734375,
-0.36572265625,
0.182861328125,
0.5185546875,
-0.94482421875,
0.6640625,
-0.74462890625,
0.59033203125,
-0.72509765625,
-0.268310546875,
0.325927734375,
0.578125,
-0.189208984375,
-0.24853515625,
0.5322265625,
0.401123046875,
0.3017578125,
0.07965087890625,
0.65625,
-0.8681640625,
0.4638671875,
-0.6591796875,
0.7294921875,
-0.1566162109375,
0.0718994140625,
-0.1922607421875,
-0.276611328125,
-0.63037109375,
-0.76416015625,
0.5419921875,
0.165771484375,
-0.1236572265625,
0.5517578125,
0.64208984375,
-0.2734375,
-0.206298828125,
-0.2218017578125,
-0.29345703125,
-0.4658203125,
0.11407470703125,
1.189453125,
-0.58935546875,
-0.3154296875,
-0.3857421875,
0.8798828125,
0.418701171875,
0.498291015625,
0.1875,
-0.22998046875,
-0.017242431640625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Tags: brute force, constructive algorithms, dp, implementation, strings
Correct Solution:
```
from sys import *
t=int(stdin.readline())
for sssss in range(t):
text,ps,dn,n,names,m=[],[],dict(),int(stdin.readline()),stdin.readline().split(),int(stdin.readline())
for i in range(len(names)):
dn[names[i]]=i
for i in range(m):
nxt=stdin.readline()
getname=nxt.split(":")[0]
nxt=nxt.split(":")[1]
text.append(nxt)
if getname=="?":
pos,hell,shit=set([z for z in range(n)]),"",set([".",",","!","?"])
for y in nxt:
if y in shit:
hell+=" "
else:
hell+=y
nhere=hell.split()
for j in nhere:
pos.discard(dn.get(j))
if i and len(ps[-1])==1:
for dd in ps[-1]:
pos.discard(dd)
ps.append(pos)
else:
if i:
ps[-1].discard(dn[getname])
ps.append(set([dn[getname]]))
dp,yy,ban=[[False]*n],[0]*m,-1
for i in ps[0]:
dp[0][i]=True
for i in range(1,m):
dp.append([False]*n)
for j in ps[i]:
for k in range(n):
if k!=j and dp[-2][k]==True:
dp[-1][j]=True
break
if True not in dp[-1]:
stdout.write("Impossible\n")
continue
for i in range(m-1,-1,-1):
for j in range(n):
if j!=ban and dp[i][j]:
ban=j
yy[i]=j
break
for i in range(m):
stdout.write(names[yy[i]]+":"+text[i])
```
| 65,318
|
[
0.38134765625,
-0.276611328125,
-0.1856689453125,
0.5966796875,
-0.234130859375,
-0.861328125,
-0.62548828125,
-0.0675048828125,
0.1224365234375,
0.544921875,
0.30615234375,
0.014068603515625,
0.2308349609375,
-0.45654296875,
-1.0478515625,
0.043609619140625,
-0.3486328125,
-0.74462890625,
-0.06866455078125,
-0.07464599609375,
0.441650390625,
0.030242919921875,
-1.4130859375,
-0.55908203125,
-0.66748046875,
0.5595703125,
0.11834716796875,
-0.0274658203125,
0.9443359375,
1.0830078125,
-0.427490234375,
-0.416748046875,
0.1336669921875,
-1.4013671875,
-0.271728515625,
-0.06707763671875,
0.53271484375,
-0.580078125,
-0.70458984375,
-0.50927734375,
0.203369140625,
-0.41455078125,
0.70068359375,
-0.890625,
-1.3251953125,
0.249267578125,
-0.314453125,
-0.12066650390625,
-0.015289306640625,
-0.91064453125,
0.449951171875,
-0.09588623046875,
0.81103515625,
-0.2587890625,
-0.215087890625,
-0.83544921875,
-0.472900390625,
0.2005615234375,
-0.57275390625,
0.1353759765625,
-0.206298828125,
0.44970703125,
-0.09051513671875,
-0.61083984375,
-0.0762939453125,
-0.1595458984375,
-0.22998046875,
-0.2318115234375,
-0.02740478515625,
-0.64501953125,
-0.187744140625,
0.243896484375,
-0.72900390625,
-0.52294921875,
-0.425537109375,
0.393798828125,
0.1693115234375,
-0.150146484375,
-0.1378173828125,
0.5849609375,
0.0980224609375,
1.060546875,
0.259033203125,
0.318115234375,
-0.6123046875,
-0.9208984375,
0.484130859375,
0.412109375,
0.2841796875,
-0.236083984375,
-0.1585693359375,
0.1781005859375,
-0.59619140625,
0.0572509765625,
0.890625,
0.496337890625,
0.295166015625,
0.595703125,
-0.3076171875,
0.3056640625,
0.71337890625,
1.2705078125,
-0.302978515625,
1.2373046875,
-0.03472900390625,
0.197265625,
0.28076171875,
0.2269287109375,
-0.377197265625,
-0.048431396484375,
-0.460693359375,
-0.312744140625,
0.59423828125,
0.26708984375,
-0.169921875,
0.86083984375,
0.110107421875,
-0.22998046875,
-1.0966796875,
0.297119140625,
0.240966796875,
-0.310546875,
0.19677734375,
-0.24267578125,
0.044403076171875,
0.006519317626953125,
0.046051025390625,
0.9970703125,
-0.4931640625,
-0.28173828125,
0.282958984375,
-0.31005859375,
-0.060760498046875,
0.140380859375,
-0.11016845703125,
0.52197265625,
-0.439697265625,
0.634765625,
1.0068359375,
-0.64013671875,
0.623046875,
-0.1956787109375,
-0.1849365234375,
1.42578125,
0.54736328125,
0.04620361328125,
0.493896484375,
0.421142578125,
-0.5751953125,
0.1602783203125,
-0.728515625,
0.8271484375,
-0.0849609375,
0.250244140625,
-0.11517333984375,
-0.22509765625,
-0.147216796875,
0.546875,
0.2012939453125,
0.1744384765625,
-0.492919921875,
-0.201416015625,
-0.16943359375,
1.052734375,
-0.04052734375,
1.0087890625,
-0.67138671875,
-0.64697265625,
-0.128662109375,
-0.486083984375,
0.79296875,
-0.2098388671875,
-0.1409912109375,
1.080078125,
0.81103515625,
0.8681640625,
0.3486328125,
-0.407470703125,
0.2127685546875,
-0.016632080078125,
0.200439453125,
0.189208984375,
-0.009857177734375,
0.66259765625,
0.25,
-0.0111541748046875,
0.44384765625,
-0.8984375,
-0.89892578125,
-0.63232421875,
0.22412109375,
0.53759765625,
-0.54248046875,
0.25146484375,
0.30419921875,
-0.060150146484375,
-0.53515625,
0.0377197265625,
0.08843994140625,
-0.76904296875,
-0.363037109375,
0.79052734375,
-0.395263671875,
0.455078125,
-0.232666015625,
-0.2032470703125,
0.468994140625,
1.4951171875,
-0.137451171875,
-0.1826171875,
0.55908203125,
0.209228515625,
-0.098876953125,
-0.205810546875,
0.5146484375,
-0.67041015625,
-0.58935546875,
0.4765625,
-0.364990234375,
-0.22509765625,
0.060577392578125,
0.73974609375,
0.57080078125,
0.391357421875,
-0.56591796875,
-0.286376953125,
0.302978515625,
1.341796875,
-0.09564208984375,
0.54638671875,
0.21044921875,
0.671875,
0.254150390625,
1.080078125,
0.354736328125,
-0.0012559890747070312,
0.71484375,
0.7646484375,
0.1922607421875,
0.1905517578125,
0.0233612060546875,
0.307861328125,
0.173583984375,
0.427734375,
0.019134521484375,
0.63671875,
-0.28857421875,
-0.10009765625,
-0.99072265625,
0.309814453125,
-0.7939453125,
0.541015625,
0.474853515625,
0.2071533203125,
-0.86376953125,
-0.41015625,
0.6171875,
0.62451171875,
-0.71728515625,
-0.1600341796875,
-0.05865478515625,
0.034210205078125,
0.297119140625,
-0.165771484375,
0.10858154296875,
0.3798828125,
0.46630859375,
0.447998046875,
-0.252685546875,
-0.5693359375,
-0.92431640625,
-1.017578125,
-1.125,
-0.78515625,
-0.7236328125,
-0.25390625,
0.30322265625,
-0.6875,
0.332275390625,
-0.4482421875,
-0.06549072265625,
0.1060791015625,
-0.93603515625,
0.61474609375,
-0.05694580078125,
0.5341796875,
-0.966796875,
0.38671875,
-0.154541015625,
0.982421875,
-0.313232421875,
0.052337646484375,
-0.1600341796875,
-0.6875,
0.279296875,
-0.291259765625,
0.3720703125,
-0.142333984375,
-1.0625,
-0.406005859375,
-0.94189453125,
-0.03057861328125,
-0.350341796875,
0.061279296875,
-0.80126953125,
0.8330078125,
0.87158203125,
-0.72607421875,
0.5634765625,
0.72119140625,
-0.60693359375,
0.5361328125,
0.42529296875,
0.0210113525390625,
-0.6259765625,
0.88525390625,
0.583984375,
0.587890625,
-0.466064453125,
-0.32373046875,
-0.80126953125,
0.1429443359375,
0.058135986328125,
-0.5224609375,
-0.231201171875,
0.0670166015625,
0.10528564453125,
-1.16015625,
0.50244140625,
-1.65234375,
-0.93994140625,
-0.092041015625,
-0.53076171875,
1.1640625,
0.91455078125,
-0.0499267578125,
-0.315185546875,
-0.10919189453125,
-0.292724609375,
0.52001953125,
0.3681640625,
-0.411865234375,
0.1688232421875,
0.8623046875,
0.10845947265625,
-0.1793212890625,
0.5029296875,
-0.6767578125,
-0.215087890625,
-0.0926513671875,
0.347412109375,
0.52978515625,
0.548828125,
0.05169677734375,
0.05596923828125,
0.78857421875,
-0.76123046875,
-0.29736328125,
0.2197265625,
0.388916015625,
0.6611328125,
0.277587890625,
0.191162109375,
-0.260498046875,
-0.689453125,
-0.8134765625,
0.335205078125,
0.66943359375,
1.103515625,
-0.57421875,
0.5673828125,
0.0035953521728515625,
-0.86328125,
0.402587890625,
-0.76513671875,
-0.4873046875,
0.91650390625,
0.0203399658203125,
0.66650390625,
-1.0234375,
-0.10009765625,
0.1446533203125,
0.09173583984375,
0.484130859375,
0.7119140625,
0.53076171875,
-0.6005859375,
-0.27783203125,
-0.2509765625,
-0.269287109375,
0.09100341796875,
-0.44970703125,
-0.431884765625,
-0.21875,
-0.45849609375,
-0.99072265625,
0.45361328125,
0.6044921875,
0.7421875,
0.1177978515625,
0.8525390625,
0.1185302734375,
0.9560546875,
0.70361328125,
-0.509765625,
0.09796142578125,
-0.70458984375,
0.6416015625,
0.352294921875,
-0.32080078125,
-0.437744140625,
-0.319580078125,
-0.1461181640625,
-0.0689697265625,
0.259033203125,
-0.33642578125,
-0.5654296875,
0.031524658203125,
-0.02740478515625,
0.74169921875,
-0.265380859375,
-0.55859375,
-0.11212158203125,
0.253173828125,
0.396240234375,
-0.425537109375,
0.1427001953125,
-0.61865234375,
0.69140625,
0.7861328125,
-0.037841796875,
-0.552734375,
-0.59375,
-0.84619140625,
-0.646484375,
0.1693115234375,
0.798828125,
-0.548828125,
-0.0233612060546875,
-1.28515625,
0.478515625,
0.285400390625,
-0.322509765625,
0.089599609375,
-0.07537841796875,
0.3125,
0.1695556640625,
0.71923828125,
-0.048980712890625,
-0.444091796875,
0.275146484375,
-0.5634765625,
0.6494140625,
-0.7412109375,
0.1876220703125,
-0.11846923828125,
0.0205078125,
-0.01229095458984375,
0.7333984375,
-0.0582275390625,
0.34423828125,
-0.07904052734375,
0.041595458984375,
-0.94970703125,
-0.54736328125,
0.435302734375,
0.2037353515625,
-0.393798828125,
0.291748046875,
0.295166015625,
-0.453857421875,
0.1749267578125,
0.4375,
-0.349609375,
0.474365234375,
-0.7490234375,
0.60888671875,
-0.307861328125,
-0.5439453125,
-0.0240936279296875,
-0.5029296875,
0.448974609375,
0.0888671875,
-1.0390625,
-0.186767578125,
-0.98876953125,
-0.2705078125,
-0.133056640625,
-0.54052734375,
0.396240234375,
0.1162109375,
-0.0171966552734375,
-0.21826171875,
0.00409698486328125,
-0.9208984375,
-0.04205322265625,
-0.548828125,
-0.2000732421875,
0.440185546875,
0.1365966796875,
0.69482421875,
-0.11370849609375,
-0.63623046875,
0.462890625,
-0.1727294921875,
0.2010498046875,
-0.325439453125,
-0.39111328125,
0.1488037109375,
-0.1837158203125,
-0.358642578125,
0.31494140625,
-0.64111328125,
0.2374267578125,
0.9296875,
-0.041259765625,
0.2342529296875,
0.0271453857421875,
-0.45849609375,
0.76513671875,
0.1312255859375,
-1.142578125,
-0.33251953125,
0.64697265625,
-0.384765625,
0.44580078125,
0.8583984375,
-1.18359375,
-0.56396484375,
-0.8779296875,
0.19384765625,
-1.0390625,
-0.09368896484375,
-0.82763671875,
-0.1746826171875,
-0.41064453125,
0.98828125,
0.043426513671875,
-0.69140625,
-0.3134765625,
-0.90576171875,
0.41796875,
-0.71337890625,
-0.18408203125,
-0.128662109375,
-0.27197265625,
-0.240966796875,
1.189453125,
0.325927734375,
0.277099609375,
-0.12371826171875,
-0.056884765625,
0.454345703125,
-0.2021484375,
-0.401123046875,
-0.11090087890625,
0.1131591796875,
0.1455078125,
-0.4384765625,
0.32373046875,
-0.7900390625,
0.61376953125,
-0.5615234375,
-0.153076171875,
0.0758056640625,
-0.50537109375,
-0.0250396728515625,
-0.035888671875,
1.1064453125,
-0.52001953125,
-0.04144287109375,
-0.2919921875,
0.26318359375,
0.537109375,
-0.2113037109375,
-0.62060546875,
-0.814453125,
-0.8916015625,
-1.1767578125,
0.623046875,
-0.350830078125,
-0.1650390625,
-0.145751953125,
-0.1748046875,
0.89404296875,
-0.50244140625,
0.37353515625,
1.3857421875,
0.34814453125,
0.2103271484375,
-0.77880859375,
0.76513671875,
0.2008056640625,
-0.54541015625,
-0.2626953125,
0.1510009765625,
-0.8388671875,
0.1734619140625,
-0.338623046875,
-0.85302734375,
-0.58642578125,
-0.09716796875,
1.0478515625,
-0.39453125,
1.1064453125,
0.11724853515625,
-1.029296875,
-1.00390625,
0.60986328125,
0.201416015625,
0.10394287109375,
0.748046875,
0.07952880859375,
0.283203125,
-0.067138671875,
0.17529296875,
-0.09356689453125,
-0.634765625,
1.0986328125,
0.25830078125,
-0.395263671875,
0.78076171875,
1.015625,
-0.88671875,
-0.9375,
-0.057647705078125,
-0.043914794921875,
-0.375244140625,
-0.80859375,
-0.2322998046875,
0.62548828125,
-0.7763671875,
0.27197265625,
0.94140625,
0.013885498046875,
0.0885009765625,
0.053985595703125,
0.314697265625,
-0.69580078125,
0.94140625,
0.912109375,
-0.50244140625,
0.1507568359375,
-1.0322265625,
-0.0234527587890625,
-0.5126953125,
-0.1552734375,
1.0244140625,
-0.6982421875,
0.44580078125,
0.52587890625,
-0.1771240234375,
0.9873046875,
-0.273193359375,
-0.32568359375,
0.2271728515625,
-0.77294921875,
-0.67626953125,
-0.237548828125,
0.44970703125,
-0.32421875,
0.407470703125,
-0.61474609375,
0.272216796875,
0.6044921875,
0.3544921875,
-0.3837890625,
-1.134765625,
-0.428955078125,
-1.0986328125,
-0.56591796875,
-0.75,
0.0682373046875,
-0.52587890625,
0.038818359375,
0.416015625,
-0.9091796875,
0.11383056640625,
0.448486328125,
-0.2071533203125,
0.8310546875,
-0.8525390625,
0.63134765625,
-0.7890625,
-0.4462890625,
-0.71484375,
-0.282958984375,
-0.24853515625,
-0.0947265625,
-0.1273193359375,
0.333251953125,
-0.327880859375,
0.59765625,
0.1533203125,
0.28271484375,
-0.1832275390625,
-0.480224609375,
-0.0980224609375,
-0.1658935546875,
-0.429443359375,
0.275146484375,
0.5693359375,
-0.43994140625,
0.04248046875,
-0.1766357421875,
-0.334228515625,
-0.2174072265625,
0.6240234375,
0.6982421875,
0.045440673828125,
0.13916015625,
-0.225341796875,
0.10626220703125,
-0.89892578125,
0.11077880859375,
0.07122802734375,
0.12176513671875,
0.411376953125,
-0.235595703125,
0.36865234375,
0.923828125,
0.01629638671875,
0.56689453125,
-0.256103515625,
0.381591796875,
0.09912109375,
-0.07666015625,
0.00249481201171875,
-0.06915283203125,
0.0814208984375,
0.313232421875,
0.275390625,
0.3466796875,
-0.330322265625,
0.7294921875,
-0.0460205078125,
-0.7822265625,
-0.67138671875,
-0.327880859375,
0.2435302734375,
0.286376953125,
0.442626953125,
-0.127685546875,
0.12548828125,
-0.2078857421875,
-0.65576171875,
0.266845703125,
-1.2353515625,
-0.078369140625,
1.1376953125,
-0.314208984375,
-0.437744140625,
-0.451904296875,
-0.4091796875,
-0.201416015625,
0.403564453125,
0.436767578125,
-0.58544921875,
0.1005859375,
0.1378173828125,
0.671875,
-0.65283203125,
0.615234375,
-0.0849609375,
0.2802734375,
-0.38232421875,
-0.1971435546875,
0.1346435546875,
1.2275390625,
0.011199951171875,
-0.40576171875,
-1.056640625,
-0.1024169921875,
0.37451171875,
-0.3076171875,
-0.2459716796875,
0.07098388671875,
-0.216796875,
0.2587890625,
-0.87744140625,
0.10540771484375,
-0.03326416015625,
0.4072265625,
0.4599609375,
-0.2352294921875,
-0.65673828125,
0.70556640625,
0.72998046875,
-0.09783935546875,
0.94287109375,
-0.04107666015625,
0.315185546875,
0.194580078125,
0.224609375,
-0.32861328125,
0.9853515625,
0.755859375,
0.23681640625,
-0.4248046875,
0.41064453125,
0.77783203125,
0.09747314453125,
-0.2076416015625,
0.0731201171875,
0.0726318359375,
-0.297607421875,
0.3623046875,
-0.299560546875,
-0.06268310546875,
-0.004241943359375,
-0.114990234375,
0.3212890625,
-0.2379150390625,
-0.0538330078125,
-0.52978515625,
-0.80908203125,
0.533203125,
-0.27685546875,
-0.0006175041198730469,
0.379150390625,
-0.767578125,
-0.0186767578125,
0.9287109375,
-0.0088348388671875,
-0.267333984375,
0.8427734375,
0.1956787109375,
0.46337890625,
0.56591796875,
0.445068359375,
0.59814453125,
-0.8251953125,
0.5517578125,
0.13720703125,
-0.0240478515625,
-0.2227783203125,
-0.313720703125,
-0.7900390625,
0.4013671875,
-0.471923828125,
0.00696563720703125,
0.6884765625,
-1.0419921875,
0.15869140625,
-0.1700439453125,
0.498291015625,
-0.541015625,
0.29052734375,
0.14453125,
-0.68798828125,
-0.70361328125,
1.03515625,
-0.2347412109375,
0.50341796875,
0.0012416839599609375,
1.177734375,
0.0628662109375,
1.740234375,
0.379638671875,
-0.1544189453125,
-0.2041015625,
0.1456298828125,
-0.5029296875,
-0.57275390625,
-0.2015380859375,
-0.446044921875,
0.677734375,
-0.57666015625,
-0.322021484375,
-0.1915283203125,
0.78369140625,
0.337158203125,
-1.140625,
-0.393798828125,
0.45068359375,
-0.347900390625,
0.34521484375,
0.55517578125,
0.0252227783203125,
-0.027923583984375,
0.173583984375,
0.08734130859375,
-0.75927734375,
-0.09161376953125,
-0.93994140625,
0.456787109375,
-0.06805419921875,
-0.77685546875,
-0.412109375,
-0.87646484375,
-0.178955078125,
0.1832275390625,
-0.45703125,
-0.80126953125,
0.57763671875,
0.64453125,
0.7275390625,
0.2071533203125,
-0.1634521484375,
-0.23193359375,
1.126953125,
1.0205078125,
0.1895751953125,
1.05859375,
0.376708984375,
-0.26171875,
0.383544921875,
-0.419677734375,
0.59423828125,
0.1524658203125,
0.123779296875,
-0.2210693359375,
-0.368408203125,
-0.62548828125,
-1.3447265625,
0.021636962890625,
1.0791015625,
0.6796875,
-0.458740234375,
-1.02734375,
-0.580078125,
-1.052734375,
-0.0092620849609375,
-0.30712890625,
0.93701171875,
-0.175537109375,
-0.17578125,
0.183837890625,
-1.3720703125,
4.30078125,
1.2783203125,
0.98291015625,
0.091064453125,
0.075927734375,
1.0693359375,
0.8544921875,
-0.322265625,
-0.1605224609375,
-0.248779296875,
0.1953125,
-0.482666015625,
0.343994140625,
0.85498046875,
-0.026580810546875,
0.54052734375,
-0.61669921875,
-0.022735595703125,
0.17431640625,
-0.712890625,
-0.62548828125,
0.3173828125,
-0.02642822265625,
0.6787109375,
0.08612060546875,
0.51953125,
0.6396484375,
-0.673828125,
0.10821533203125,
-0.58349609375,
-0.00356292724609375,
-0.61669921875,
1.076171875,
0.2039794921875,
-0.41943359375,
0.359619140625,
-0.1165771484375,
-0.9912109375,
-0.1356201171875,
0.08746337890625,
0.02984619140625,
-0.1590576171875,
0.57373046875,
-0.90869140625,
-0.1282958984375,
0.466552734375,
-0.36572265625,
0.182861328125,
0.5185546875,
-0.94482421875,
0.6640625,
-0.74462890625,
0.59033203125,
-0.72509765625,
-0.268310546875,
0.325927734375,
0.578125,
-0.189208984375,
-0.24853515625,
0.5322265625,
0.401123046875,
0.3017578125,
0.07965087890625,
0.65625,
-0.8681640625,
0.4638671875,
-0.6591796875,
0.7294921875,
-0.1566162109375,
0.0718994140625,
-0.1922607421875,
-0.276611328125,
-0.63037109375,
-0.76416015625,
0.5419921875,
0.165771484375,
-0.1236572265625,
0.5517578125,
0.64208984375,
-0.2734375,
-0.206298828125,
-0.2218017578125,
-0.29345703125,
-0.4658203125,
0.11407470703125,
1.189453125,
-0.58935546875,
-0.3154296875,
-0.3857421875,
0.8798828125,
0.418701171875,
0.498291015625,
0.1875,
-0.22998046875,
-0.017242431640625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Tags: brute force, constructive algorithms, dp, implementation, strings
Correct Solution:
```
import re
def proc(msgs):
chg = False
for i, msg in enumerate(msgs):
if msg[0] != '?': continue
ppn = msg[1]
if i > 0: ppn.discard(msgs[i-1][0])
if i != len(msgs)-1: ppn.discard(msgs[i+1][0])
if len(ppn) == 1:
msg[0] = ppn.pop()
chg = True
return chg
def is_valid(msgs):
for i, msg in enumerate(msgs):
if msg[0] == '?' or (i > 0 and msg[0] == msgs[i-1][0]) or (i != len(msgs)-1 and msg[0] == msgs[i+1][0]):
return False
return True
TC = int(input())
for tc in range(0, TC):
N = int(input())
persons = set(input().split())
M = int(input())
msgs = []
for m in range(M):
line = input()
m1 = re.match(r'(.*)\:(.*)', line)
ppn = set(persons)
for un in re.findall(r'[a-zA-Z0-9]+', m1.group(2)):
ppn.discard(un)
msgs.append([m1.group(1), ppn, m1.group(2)])
while True:
if proc(msgs): continue
chgt = False
for msg in msgs:
if msg[0] == '?' and len(msg[1]) > 0:
msg[0] = msg[1].pop()
chgt = True
break
if not chgt: break
if is_valid(msgs):
for msg in msgs:
print('%s:%s' % (msg[0], msg[2]))
else:
print('Impossible')
```
| 65,319
|
[
0.38134765625,
-0.276611328125,
-0.1856689453125,
0.5966796875,
-0.234130859375,
-0.861328125,
-0.62548828125,
-0.0675048828125,
0.1224365234375,
0.544921875,
0.30615234375,
0.014068603515625,
0.2308349609375,
-0.45654296875,
-1.0478515625,
0.043609619140625,
-0.3486328125,
-0.74462890625,
-0.06866455078125,
-0.07464599609375,
0.441650390625,
0.030242919921875,
-1.4130859375,
-0.55908203125,
-0.66748046875,
0.5595703125,
0.11834716796875,
-0.0274658203125,
0.9443359375,
1.0830078125,
-0.427490234375,
-0.416748046875,
0.1336669921875,
-1.4013671875,
-0.271728515625,
-0.06707763671875,
0.53271484375,
-0.580078125,
-0.70458984375,
-0.50927734375,
0.203369140625,
-0.41455078125,
0.70068359375,
-0.890625,
-1.3251953125,
0.249267578125,
-0.314453125,
-0.12066650390625,
-0.015289306640625,
-0.91064453125,
0.449951171875,
-0.09588623046875,
0.81103515625,
-0.2587890625,
-0.215087890625,
-0.83544921875,
-0.472900390625,
0.2005615234375,
-0.57275390625,
0.1353759765625,
-0.206298828125,
0.44970703125,
-0.09051513671875,
-0.61083984375,
-0.0762939453125,
-0.1595458984375,
-0.22998046875,
-0.2318115234375,
-0.02740478515625,
-0.64501953125,
-0.187744140625,
0.243896484375,
-0.72900390625,
-0.52294921875,
-0.425537109375,
0.393798828125,
0.1693115234375,
-0.150146484375,
-0.1378173828125,
0.5849609375,
0.0980224609375,
1.060546875,
0.259033203125,
0.318115234375,
-0.6123046875,
-0.9208984375,
0.484130859375,
0.412109375,
0.2841796875,
-0.236083984375,
-0.1585693359375,
0.1781005859375,
-0.59619140625,
0.0572509765625,
0.890625,
0.496337890625,
0.295166015625,
0.595703125,
-0.3076171875,
0.3056640625,
0.71337890625,
1.2705078125,
-0.302978515625,
1.2373046875,
-0.03472900390625,
0.197265625,
0.28076171875,
0.2269287109375,
-0.377197265625,
-0.048431396484375,
-0.460693359375,
-0.312744140625,
0.59423828125,
0.26708984375,
-0.169921875,
0.86083984375,
0.110107421875,
-0.22998046875,
-1.0966796875,
0.297119140625,
0.240966796875,
-0.310546875,
0.19677734375,
-0.24267578125,
0.044403076171875,
0.006519317626953125,
0.046051025390625,
0.9970703125,
-0.4931640625,
-0.28173828125,
0.282958984375,
-0.31005859375,
-0.060760498046875,
0.140380859375,
-0.11016845703125,
0.52197265625,
-0.439697265625,
0.634765625,
1.0068359375,
-0.64013671875,
0.623046875,
-0.1956787109375,
-0.1849365234375,
1.42578125,
0.54736328125,
0.04620361328125,
0.493896484375,
0.421142578125,
-0.5751953125,
0.1602783203125,
-0.728515625,
0.8271484375,
-0.0849609375,
0.250244140625,
-0.11517333984375,
-0.22509765625,
-0.147216796875,
0.546875,
0.2012939453125,
0.1744384765625,
-0.492919921875,
-0.201416015625,
-0.16943359375,
1.052734375,
-0.04052734375,
1.0087890625,
-0.67138671875,
-0.64697265625,
-0.128662109375,
-0.486083984375,
0.79296875,
-0.2098388671875,
-0.1409912109375,
1.080078125,
0.81103515625,
0.8681640625,
0.3486328125,
-0.407470703125,
0.2127685546875,
-0.016632080078125,
0.200439453125,
0.189208984375,
-0.009857177734375,
0.66259765625,
0.25,
-0.0111541748046875,
0.44384765625,
-0.8984375,
-0.89892578125,
-0.63232421875,
0.22412109375,
0.53759765625,
-0.54248046875,
0.25146484375,
0.30419921875,
-0.060150146484375,
-0.53515625,
0.0377197265625,
0.08843994140625,
-0.76904296875,
-0.363037109375,
0.79052734375,
-0.395263671875,
0.455078125,
-0.232666015625,
-0.2032470703125,
0.468994140625,
1.4951171875,
-0.137451171875,
-0.1826171875,
0.55908203125,
0.209228515625,
-0.098876953125,
-0.205810546875,
0.5146484375,
-0.67041015625,
-0.58935546875,
0.4765625,
-0.364990234375,
-0.22509765625,
0.060577392578125,
0.73974609375,
0.57080078125,
0.391357421875,
-0.56591796875,
-0.286376953125,
0.302978515625,
1.341796875,
-0.09564208984375,
0.54638671875,
0.21044921875,
0.671875,
0.254150390625,
1.080078125,
0.354736328125,
-0.0012559890747070312,
0.71484375,
0.7646484375,
0.1922607421875,
0.1905517578125,
0.0233612060546875,
0.307861328125,
0.173583984375,
0.427734375,
0.019134521484375,
0.63671875,
-0.28857421875,
-0.10009765625,
-0.99072265625,
0.309814453125,
-0.7939453125,
0.541015625,
0.474853515625,
0.2071533203125,
-0.86376953125,
-0.41015625,
0.6171875,
0.62451171875,
-0.71728515625,
-0.1600341796875,
-0.05865478515625,
0.034210205078125,
0.297119140625,
-0.165771484375,
0.10858154296875,
0.3798828125,
0.46630859375,
0.447998046875,
-0.252685546875,
-0.5693359375,
-0.92431640625,
-1.017578125,
-1.125,
-0.78515625,
-0.7236328125,
-0.25390625,
0.30322265625,
-0.6875,
0.332275390625,
-0.4482421875,
-0.06549072265625,
0.1060791015625,
-0.93603515625,
0.61474609375,
-0.05694580078125,
0.5341796875,
-0.966796875,
0.38671875,
-0.154541015625,
0.982421875,
-0.313232421875,
0.052337646484375,
-0.1600341796875,
-0.6875,
0.279296875,
-0.291259765625,
0.3720703125,
-0.142333984375,
-1.0625,
-0.406005859375,
-0.94189453125,
-0.03057861328125,
-0.350341796875,
0.061279296875,
-0.80126953125,
0.8330078125,
0.87158203125,
-0.72607421875,
0.5634765625,
0.72119140625,
-0.60693359375,
0.5361328125,
0.42529296875,
0.0210113525390625,
-0.6259765625,
0.88525390625,
0.583984375,
0.587890625,
-0.466064453125,
-0.32373046875,
-0.80126953125,
0.1429443359375,
0.058135986328125,
-0.5224609375,
-0.231201171875,
0.0670166015625,
0.10528564453125,
-1.16015625,
0.50244140625,
-1.65234375,
-0.93994140625,
-0.092041015625,
-0.53076171875,
1.1640625,
0.91455078125,
-0.0499267578125,
-0.315185546875,
-0.10919189453125,
-0.292724609375,
0.52001953125,
0.3681640625,
-0.411865234375,
0.1688232421875,
0.8623046875,
0.10845947265625,
-0.1793212890625,
0.5029296875,
-0.6767578125,
-0.215087890625,
-0.0926513671875,
0.347412109375,
0.52978515625,
0.548828125,
0.05169677734375,
0.05596923828125,
0.78857421875,
-0.76123046875,
-0.29736328125,
0.2197265625,
0.388916015625,
0.6611328125,
0.277587890625,
0.191162109375,
-0.260498046875,
-0.689453125,
-0.8134765625,
0.335205078125,
0.66943359375,
1.103515625,
-0.57421875,
0.5673828125,
0.0035953521728515625,
-0.86328125,
0.402587890625,
-0.76513671875,
-0.4873046875,
0.91650390625,
0.0203399658203125,
0.66650390625,
-1.0234375,
-0.10009765625,
0.1446533203125,
0.09173583984375,
0.484130859375,
0.7119140625,
0.53076171875,
-0.6005859375,
-0.27783203125,
-0.2509765625,
-0.269287109375,
0.09100341796875,
-0.44970703125,
-0.431884765625,
-0.21875,
-0.45849609375,
-0.99072265625,
0.45361328125,
0.6044921875,
0.7421875,
0.1177978515625,
0.8525390625,
0.1185302734375,
0.9560546875,
0.70361328125,
-0.509765625,
0.09796142578125,
-0.70458984375,
0.6416015625,
0.352294921875,
-0.32080078125,
-0.437744140625,
-0.319580078125,
-0.1461181640625,
-0.0689697265625,
0.259033203125,
-0.33642578125,
-0.5654296875,
0.031524658203125,
-0.02740478515625,
0.74169921875,
-0.265380859375,
-0.55859375,
-0.11212158203125,
0.253173828125,
0.396240234375,
-0.425537109375,
0.1427001953125,
-0.61865234375,
0.69140625,
0.7861328125,
-0.037841796875,
-0.552734375,
-0.59375,
-0.84619140625,
-0.646484375,
0.1693115234375,
0.798828125,
-0.548828125,
-0.0233612060546875,
-1.28515625,
0.478515625,
0.285400390625,
-0.322509765625,
0.089599609375,
-0.07537841796875,
0.3125,
0.1695556640625,
0.71923828125,
-0.048980712890625,
-0.444091796875,
0.275146484375,
-0.5634765625,
0.6494140625,
-0.7412109375,
0.1876220703125,
-0.11846923828125,
0.0205078125,
-0.01229095458984375,
0.7333984375,
-0.0582275390625,
0.34423828125,
-0.07904052734375,
0.041595458984375,
-0.94970703125,
-0.54736328125,
0.435302734375,
0.2037353515625,
-0.393798828125,
0.291748046875,
0.295166015625,
-0.453857421875,
0.1749267578125,
0.4375,
-0.349609375,
0.474365234375,
-0.7490234375,
0.60888671875,
-0.307861328125,
-0.5439453125,
-0.0240936279296875,
-0.5029296875,
0.448974609375,
0.0888671875,
-1.0390625,
-0.186767578125,
-0.98876953125,
-0.2705078125,
-0.133056640625,
-0.54052734375,
0.396240234375,
0.1162109375,
-0.0171966552734375,
-0.21826171875,
0.00409698486328125,
-0.9208984375,
-0.04205322265625,
-0.548828125,
-0.2000732421875,
0.440185546875,
0.1365966796875,
0.69482421875,
-0.11370849609375,
-0.63623046875,
0.462890625,
-0.1727294921875,
0.2010498046875,
-0.325439453125,
-0.39111328125,
0.1488037109375,
-0.1837158203125,
-0.358642578125,
0.31494140625,
-0.64111328125,
0.2374267578125,
0.9296875,
-0.041259765625,
0.2342529296875,
0.0271453857421875,
-0.45849609375,
0.76513671875,
0.1312255859375,
-1.142578125,
-0.33251953125,
0.64697265625,
-0.384765625,
0.44580078125,
0.8583984375,
-1.18359375,
-0.56396484375,
-0.8779296875,
0.19384765625,
-1.0390625,
-0.09368896484375,
-0.82763671875,
-0.1746826171875,
-0.41064453125,
0.98828125,
0.043426513671875,
-0.69140625,
-0.3134765625,
-0.90576171875,
0.41796875,
-0.71337890625,
-0.18408203125,
-0.128662109375,
-0.27197265625,
-0.240966796875,
1.189453125,
0.325927734375,
0.277099609375,
-0.12371826171875,
-0.056884765625,
0.454345703125,
-0.2021484375,
-0.401123046875,
-0.11090087890625,
0.1131591796875,
0.1455078125,
-0.4384765625,
0.32373046875,
-0.7900390625,
0.61376953125,
-0.5615234375,
-0.153076171875,
0.0758056640625,
-0.50537109375,
-0.0250396728515625,
-0.035888671875,
1.1064453125,
-0.52001953125,
-0.04144287109375,
-0.2919921875,
0.26318359375,
0.537109375,
-0.2113037109375,
-0.62060546875,
-0.814453125,
-0.8916015625,
-1.1767578125,
0.623046875,
-0.350830078125,
-0.1650390625,
-0.145751953125,
-0.1748046875,
0.89404296875,
-0.50244140625,
0.37353515625,
1.3857421875,
0.34814453125,
0.2103271484375,
-0.77880859375,
0.76513671875,
0.2008056640625,
-0.54541015625,
-0.2626953125,
0.1510009765625,
-0.8388671875,
0.1734619140625,
-0.338623046875,
-0.85302734375,
-0.58642578125,
-0.09716796875,
1.0478515625,
-0.39453125,
1.1064453125,
0.11724853515625,
-1.029296875,
-1.00390625,
0.60986328125,
0.201416015625,
0.10394287109375,
0.748046875,
0.07952880859375,
0.283203125,
-0.067138671875,
0.17529296875,
-0.09356689453125,
-0.634765625,
1.0986328125,
0.25830078125,
-0.395263671875,
0.78076171875,
1.015625,
-0.88671875,
-0.9375,
-0.057647705078125,
-0.043914794921875,
-0.375244140625,
-0.80859375,
-0.2322998046875,
0.62548828125,
-0.7763671875,
0.27197265625,
0.94140625,
0.013885498046875,
0.0885009765625,
0.053985595703125,
0.314697265625,
-0.69580078125,
0.94140625,
0.912109375,
-0.50244140625,
0.1507568359375,
-1.0322265625,
-0.0234527587890625,
-0.5126953125,
-0.1552734375,
1.0244140625,
-0.6982421875,
0.44580078125,
0.52587890625,
-0.1771240234375,
0.9873046875,
-0.273193359375,
-0.32568359375,
0.2271728515625,
-0.77294921875,
-0.67626953125,
-0.237548828125,
0.44970703125,
-0.32421875,
0.407470703125,
-0.61474609375,
0.272216796875,
0.6044921875,
0.3544921875,
-0.3837890625,
-1.134765625,
-0.428955078125,
-1.0986328125,
-0.56591796875,
-0.75,
0.0682373046875,
-0.52587890625,
0.038818359375,
0.416015625,
-0.9091796875,
0.11383056640625,
0.448486328125,
-0.2071533203125,
0.8310546875,
-0.8525390625,
0.63134765625,
-0.7890625,
-0.4462890625,
-0.71484375,
-0.282958984375,
-0.24853515625,
-0.0947265625,
-0.1273193359375,
0.333251953125,
-0.327880859375,
0.59765625,
0.1533203125,
0.28271484375,
-0.1832275390625,
-0.480224609375,
-0.0980224609375,
-0.1658935546875,
-0.429443359375,
0.275146484375,
0.5693359375,
-0.43994140625,
0.04248046875,
-0.1766357421875,
-0.334228515625,
-0.2174072265625,
0.6240234375,
0.6982421875,
0.045440673828125,
0.13916015625,
-0.225341796875,
0.10626220703125,
-0.89892578125,
0.11077880859375,
0.07122802734375,
0.12176513671875,
0.411376953125,
-0.235595703125,
0.36865234375,
0.923828125,
0.01629638671875,
0.56689453125,
-0.256103515625,
0.381591796875,
0.09912109375,
-0.07666015625,
0.00249481201171875,
-0.06915283203125,
0.0814208984375,
0.313232421875,
0.275390625,
0.3466796875,
-0.330322265625,
0.7294921875,
-0.0460205078125,
-0.7822265625,
-0.67138671875,
-0.327880859375,
0.2435302734375,
0.286376953125,
0.442626953125,
-0.127685546875,
0.12548828125,
-0.2078857421875,
-0.65576171875,
0.266845703125,
-1.2353515625,
-0.078369140625,
1.1376953125,
-0.314208984375,
-0.437744140625,
-0.451904296875,
-0.4091796875,
-0.201416015625,
0.403564453125,
0.436767578125,
-0.58544921875,
0.1005859375,
0.1378173828125,
0.671875,
-0.65283203125,
0.615234375,
-0.0849609375,
0.2802734375,
-0.38232421875,
-0.1971435546875,
0.1346435546875,
1.2275390625,
0.011199951171875,
-0.40576171875,
-1.056640625,
-0.1024169921875,
0.37451171875,
-0.3076171875,
-0.2459716796875,
0.07098388671875,
-0.216796875,
0.2587890625,
-0.87744140625,
0.10540771484375,
-0.03326416015625,
0.4072265625,
0.4599609375,
-0.2352294921875,
-0.65673828125,
0.70556640625,
0.72998046875,
-0.09783935546875,
0.94287109375,
-0.04107666015625,
0.315185546875,
0.194580078125,
0.224609375,
-0.32861328125,
0.9853515625,
0.755859375,
0.23681640625,
-0.4248046875,
0.41064453125,
0.77783203125,
0.09747314453125,
-0.2076416015625,
0.0731201171875,
0.0726318359375,
-0.297607421875,
0.3623046875,
-0.299560546875,
-0.06268310546875,
-0.004241943359375,
-0.114990234375,
0.3212890625,
-0.2379150390625,
-0.0538330078125,
-0.52978515625,
-0.80908203125,
0.533203125,
-0.27685546875,
-0.0006175041198730469,
0.379150390625,
-0.767578125,
-0.0186767578125,
0.9287109375,
-0.0088348388671875,
-0.267333984375,
0.8427734375,
0.1956787109375,
0.46337890625,
0.56591796875,
0.445068359375,
0.59814453125,
-0.8251953125,
0.5517578125,
0.13720703125,
-0.0240478515625,
-0.2227783203125,
-0.313720703125,
-0.7900390625,
0.4013671875,
-0.471923828125,
0.00696563720703125,
0.6884765625,
-1.0419921875,
0.15869140625,
-0.1700439453125,
0.498291015625,
-0.541015625,
0.29052734375,
0.14453125,
-0.68798828125,
-0.70361328125,
1.03515625,
-0.2347412109375,
0.50341796875,
0.0012416839599609375,
1.177734375,
0.0628662109375,
1.740234375,
0.379638671875,
-0.1544189453125,
-0.2041015625,
0.1456298828125,
-0.5029296875,
-0.57275390625,
-0.2015380859375,
-0.446044921875,
0.677734375,
-0.57666015625,
-0.322021484375,
-0.1915283203125,
0.78369140625,
0.337158203125,
-1.140625,
-0.393798828125,
0.45068359375,
-0.347900390625,
0.34521484375,
0.55517578125,
0.0252227783203125,
-0.027923583984375,
0.173583984375,
0.08734130859375,
-0.75927734375,
-0.09161376953125,
-0.93994140625,
0.456787109375,
-0.06805419921875,
-0.77685546875,
-0.412109375,
-0.87646484375,
-0.178955078125,
0.1832275390625,
-0.45703125,
-0.80126953125,
0.57763671875,
0.64453125,
0.7275390625,
0.2071533203125,
-0.1634521484375,
-0.23193359375,
1.126953125,
1.0205078125,
0.1895751953125,
1.05859375,
0.376708984375,
-0.26171875,
0.383544921875,
-0.419677734375,
0.59423828125,
0.1524658203125,
0.123779296875,
-0.2210693359375,
-0.368408203125,
-0.62548828125,
-1.3447265625,
0.021636962890625,
1.0791015625,
0.6796875,
-0.458740234375,
-1.02734375,
-0.580078125,
-1.052734375,
-0.0092620849609375,
-0.30712890625,
0.93701171875,
-0.175537109375,
-0.17578125,
0.183837890625,
-1.3720703125,
4.30078125,
1.2783203125,
0.98291015625,
0.091064453125,
0.075927734375,
1.0693359375,
0.8544921875,
-0.322265625,
-0.1605224609375,
-0.248779296875,
0.1953125,
-0.482666015625,
0.343994140625,
0.85498046875,
-0.026580810546875,
0.54052734375,
-0.61669921875,
-0.022735595703125,
0.17431640625,
-0.712890625,
-0.62548828125,
0.3173828125,
-0.02642822265625,
0.6787109375,
0.08612060546875,
0.51953125,
0.6396484375,
-0.673828125,
0.10821533203125,
-0.58349609375,
-0.00356292724609375,
-0.61669921875,
1.076171875,
0.2039794921875,
-0.41943359375,
0.359619140625,
-0.1165771484375,
-0.9912109375,
-0.1356201171875,
0.08746337890625,
0.02984619140625,
-0.1590576171875,
0.57373046875,
-0.90869140625,
-0.1282958984375,
0.466552734375,
-0.36572265625,
0.182861328125,
0.5185546875,
-0.94482421875,
0.6640625,
-0.74462890625,
0.59033203125,
-0.72509765625,
-0.268310546875,
0.325927734375,
0.578125,
-0.189208984375,
-0.24853515625,
0.5322265625,
0.401123046875,
0.3017578125,
0.07965087890625,
0.65625,
-0.8681640625,
0.4638671875,
-0.6591796875,
0.7294921875,
-0.1566162109375,
0.0718994140625,
-0.1922607421875,
-0.276611328125,
-0.63037109375,
-0.76416015625,
0.5419921875,
0.165771484375,
-0.1236572265625,
0.5517578125,
0.64208984375,
-0.2734375,
-0.206298828125,
-0.2218017578125,
-0.29345703125,
-0.4658203125,
0.11407470703125,
1.189453125,
-0.58935546875,
-0.3154296875,
-0.3857421875,
0.8798828125,
0.418701171875,
0.498291015625,
0.1875,
-0.22998046875,
-0.017242431640625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Tags: brute force, constructive algorithms, dp, implementation, strings
Correct Solution:
```
import re
def foo():
n = int(input())
who = input().split()
m = int(input())
msg = []
l = []
for num in range(m):
a, t = input().split(':')
msg.append(t)
st = set()
if a != '?':
st.add(a)
else:
names = re.split('\W+', t)
for w in who:
if not w in names:
st.add(w)
l.append(st)
d2 = []
for num in range(1, m):
d = {}
for w1 in l[num]:
for w2 in l[num - 1]:
if w1 != w2:
d[w1] = w2
break
l[num] = [x for x in d]
d2.append(d)
curr = None
for w in l[m - 1]:
curr = w
res = [curr]
for num in list(reversed(range(1, m))):
curr = d2[num - 1].get(curr, None) # d2[num - 1][curr]
res.append(curr)
res = list(reversed(res))
if None in res:
print("Impossible")
else:
for num in range(m):
print(res[num] + ':' + msg[num])
t = int(input())
for _ in range(t):
foo()
```
| 65,320
|
[
0.38134765625,
-0.276611328125,
-0.1856689453125,
0.5966796875,
-0.234130859375,
-0.861328125,
-0.62548828125,
-0.0675048828125,
0.1224365234375,
0.544921875,
0.30615234375,
0.014068603515625,
0.2308349609375,
-0.45654296875,
-1.0478515625,
0.043609619140625,
-0.3486328125,
-0.74462890625,
-0.06866455078125,
-0.07464599609375,
0.441650390625,
0.030242919921875,
-1.4130859375,
-0.55908203125,
-0.66748046875,
0.5595703125,
0.11834716796875,
-0.0274658203125,
0.9443359375,
1.0830078125,
-0.427490234375,
-0.416748046875,
0.1336669921875,
-1.4013671875,
-0.271728515625,
-0.06707763671875,
0.53271484375,
-0.580078125,
-0.70458984375,
-0.50927734375,
0.203369140625,
-0.41455078125,
0.70068359375,
-0.890625,
-1.3251953125,
0.249267578125,
-0.314453125,
-0.12066650390625,
-0.015289306640625,
-0.91064453125,
0.449951171875,
-0.09588623046875,
0.81103515625,
-0.2587890625,
-0.215087890625,
-0.83544921875,
-0.472900390625,
0.2005615234375,
-0.57275390625,
0.1353759765625,
-0.206298828125,
0.44970703125,
-0.09051513671875,
-0.61083984375,
-0.0762939453125,
-0.1595458984375,
-0.22998046875,
-0.2318115234375,
-0.02740478515625,
-0.64501953125,
-0.187744140625,
0.243896484375,
-0.72900390625,
-0.52294921875,
-0.425537109375,
0.393798828125,
0.1693115234375,
-0.150146484375,
-0.1378173828125,
0.5849609375,
0.0980224609375,
1.060546875,
0.259033203125,
0.318115234375,
-0.6123046875,
-0.9208984375,
0.484130859375,
0.412109375,
0.2841796875,
-0.236083984375,
-0.1585693359375,
0.1781005859375,
-0.59619140625,
0.0572509765625,
0.890625,
0.496337890625,
0.295166015625,
0.595703125,
-0.3076171875,
0.3056640625,
0.71337890625,
1.2705078125,
-0.302978515625,
1.2373046875,
-0.03472900390625,
0.197265625,
0.28076171875,
0.2269287109375,
-0.377197265625,
-0.048431396484375,
-0.460693359375,
-0.312744140625,
0.59423828125,
0.26708984375,
-0.169921875,
0.86083984375,
0.110107421875,
-0.22998046875,
-1.0966796875,
0.297119140625,
0.240966796875,
-0.310546875,
0.19677734375,
-0.24267578125,
0.044403076171875,
0.006519317626953125,
0.046051025390625,
0.9970703125,
-0.4931640625,
-0.28173828125,
0.282958984375,
-0.31005859375,
-0.060760498046875,
0.140380859375,
-0.11016845703125,
0.52197265625,
-0.439697265625,
0.634765625,
1.0068359375,
-0.64013671875,
0.623046875,
-0.1956787109375,
-0.1849365234375,
1.42578125,
0.54736328125,
0.04620361328125,
0.493896484375,
0.421142578125,
-0.5751953125,
0.1602783203125,
-0.728515625,
0.8271484375,
-0.0849609375,
0.250244140625,
-0.11517333984375,
-0.22509765625,
-0.147216796875,
0.546875,
0.2012939453125,
0.1744384765625,
-0.492919921875,
-0.201416015625,
-0.16943359375,
1.052734375,
-0.04052734375,
1.0087890625,
-0.67138671875,
-0.64697265625,
-0.128662109375,
-0.486083984375,
0.79296875,
-0.2098388671875,
-0.1409912109375,
1.080078125,
0.81103515625,
0.8681640625,
0.3486328125,
-0.407470703125,
0.2127685546875,
-0.016632080078125,
0.200439453125,
0.189208984375,
-0.009857177734375,
0.66259765625,
0.25,
-0.0111541748046875,
0.44384765625,
-0.8984375,
-0.89892578125,
-0.63232421875,
0.22412109375,
0.53759765625,
-0.54248046875,
0.25146484375,
0.30419921875,
-0.060150146484375,
-0.53515625,
0.0377197265625,
0.08843994140625,
-0.76904296875,
-0.363037109375,
0.79052734375,
-0.395263671875,
0.455078125,
-0.232666015625,
-0.2032470703125,
0.468994140625,
1.4951171875,
-0.137451171875,
-0.1826171875,
0.55908203125,
0.209228515625,
-0.098876953125,
-0.205810546875,
0.5146484375,
-0.67041015625,
-0.58935546875,
0.4765625,
-0.364990234375,
-0.22509765625,
0.060577392578125,
0.73974609375,
0.57080078125,
0.391357421875,
-0.56591796875,
-0.286376953125,
0.302978515625,
1.341796875,
-0.09564208984375,
0.54638671875,
0.21044921875,
0.671875,
0.254150390625,
1.080078125,
0.354736328125,
-0.0012559890747070312,
0.71484375,
0.7646484375,
0.1922607421875,
0.1905517578125,
0.0233612060546875,
0.307861328125,
0.173583984375,
0.427734375,
0.019134521484375,
0.63671875,
-0.28857421875,
-0.10009765625,
-0.99072265625,
0.309814453125,
-0.7939453125,
0.541015625,
0.474853515625,
0.2071533203125,
-0.86376953125,
-0.41015625,
0.6171875,
0.62451171875,
-0.71728515625,
-0.1600341796875,
-0.05865478515625,
0.034210205078125,
0.297119140625,
-0.165771484375,
0.10858154296875,
0.3798828125,
0.46630859375,
0.447998046875,
-0.252685546875,
-0.5693359375,
-0.92431640625,
-1.017578125,
-1.125,
-0.78515625,
-0.7236328125,
-0.25390625,
0.30322265625,
-0.6875,
0.332275390625,
-0.4482421875,
-0.06549072265625,
0.1060791015625,
-0.93603515625,
0.61474609375,
-0.05694580078125,
0.5341796875,
-0.966796875,
0.38671875,
-0.154541015625,
0.982421875,
-0.313232421875,
0.052337646484375,
-0.1600341796875,
-0.6875,
0.279296875,
-0.291259765625,
0.3720703125,
-0.142333984375,
-1.0625,
-0.406005859375,
-0.94189453125,
-0.03057861328125,
-0.350341796875,
0.061279296875,
-0.80126953125,
0.8330078125,
0.87158203125,
-0.72607421875,
0.5634765625,
0.72119140625,
-0.60693359375,
0.5361328125,
0.42529296875,
0.0210113525390625,
-0.6259765625,
0.88525390625,
0.583984375,
0.587890625,
-0.466064453125,
-0.32373046875,
-0.80126953125,
0.1429443359375,
0.058135986328125,
-0.5224609375,
-0.231201171875,
0.0670166015625,
0.10528564453125,
-1.16015625,
0.50244140625,
-1.65234375,
-0.93994140625,
-0.092041015625,
-0.53076171875,
1.1640625,
0.91455078125,
-0.0499267578125,
-0.315185546875,
-0.10919189453125,
-0.292724609375,
0.52001953125,
0.3681640625,
-0.411865234375,
0.1688232421875,
0.8623046875,
0.10845947265625,
-0.1793212890625,
0.5029296875,
-0.6767578125,
-0.215087890625,
-0.0926513671875,
0.347412109375,
0.52978515625,
0.548828125,
0.05169677734375,
0.05596923828125,
0.78857421875,
-0.76123046875,
-0.29736328125,
0.2197265625,
0.388916015625,
0.6611328125,
0.277587890625,
0.191162109375,
-0.260498046875,
-0.689453125,
-0.8134765625,
0.335205078125,
0.66943359375,
1.103515625,
-0.57421875,
0.5673828125,
0.0035953521728515625,
-0.86328125,
0.402587890625,
-0.76513671875,
-0.4873046875,
0.91650390625,
0.0203399658203125,
0.66650390625,
-1.0234375,
-0.10009765625,
0.1446533203125,
0.09173583984375,
0.484130859375,
0.7119140625,
0.53076171875,
-0.6005859375,
-0.27783203125,
-0.2509765625,
-0.269287109375,
0.09100341796875,
-0.44970703125,
-0.431884765625,
-0.21875,
-0.45849609375,
-0.99072265625,
0.45361328125,
0.6044921875,
0.7421875,
0.1177978515625,
0.8525390625,
0.1185302734375,
0.9560546875,
0.70361328125,
-0.509765625,
0.09796142578125,
-0.70458984375,
0.6416015625,
0.352294921875,
-0.32080078125,
-0.437744140625,
-0.319580078125,
-0.1461181640625,
-0.0689697265625,
0.259033203125,
-0.33642578125,
-0.5654296875,
0.031524658203125,
-0.02740478515625,
0.74169921875,
-0.265380859375,
-0.55859375,
-0.11212158203125,
0.253173828125,
0.396240234375,
-0.425537109375,
0.1427001953125,
-0.61865234375,
0.69140625,
0.7861328125,
-0.037841796875,
-0.552734375,
-0.59375,
-0.84619140625,
-0.646484375,
0.1693115234375,
0.798828125,
-0.548828125,
-0.0233612060546875,
-1.28515625,
0.478515625,
0.285400390625,
-0.322509765625,
0.089599609375,
-0.07537841796875,
0.3125,
0.1695556640625,
0.71923828125,
-0.048980712890625,
-0.444091796875,
0.275146484375,
-0.5634765625,
0.6494140625,
-0.7412109375,
0.1876220703125,
-0.11846923828125,
0.0205078125,
-0.01229095458984375,
0.7333984375,
-0.0582275390625,
0.34423828125,
-0.07904052734375,
0.041595458984375,
-0.94970703125,
-0.54736328125,
0.435302734375,
0.2037353515625,
-0.393798828125,
0.291748046875,
0.295166015625,
-0.453857421875,
0.1749267578125,
0.4375,
-0.349609375,
0.474365234375,
-0.7490234375,
0.60888671875,
-0.307861328125,
-0.5439453125,
-0.0240936279296875,
-0.5029296875,
0.448974609375,
0.0888671875,
-1.0390625,
-0.186767578125,
-0.98876953125,
-0.2705078125,
-0.133056640625,
-0.54052734375,
0.396240234375,
0.1162109375,
-0.0171966552734375,
-0.21826171875,
0.00409698486328125,
-0.9208984375,
-0.04205322265625,
-0.548828125,
-0.2000732421875,
0.440185546875,
0.1365966796875,
0.69482421875,
-0.11370849609375,
-0.63623046875,
0.462890625,
-0.1727294921875,
0.2010498046875,
-0.325439453125,
-0.39111328125,
0.1488037109375,
-0.1837158203125,
-0.358642578125,
0.31494140625,
-0.64111328125,
0.2374267578125,
0.9296875,
-0.041259765625,
0.2342529296875,
0.0271453857421875,
-0.45849609375,
0.76513671875,
0.1312255859375,
-1.142578125,
-0.33251953125,
0.64697265625,
-0.384765625,
0.44580078125,
0.8583984375,
-1.18359375,
-0.56396484375,
-0.8779296875,
0.19384765625,
-1.0390625,
-0.09368896484375,
-0.82763671875,
-0.1746826171875,
-0.41064453125,
0.98828125,
0.043426513671875,
-0.69140625,
-0.3134765625,
-0.90576171875,
0.41796875,
-0.71337890625,
-0.18408203125,
-0.128662109375,
-0.27197265625,
-0.240966796875,
1.189453125,
0.325927734375,
0.277099609375,
-0.12371826171875,
-0.056884765625,
0.454345703125,
-0.2021484375,
-0.401123046875,
-0.11090087890625,
0.1131591796875,
0.1455078125,
-0.4384765625,
0.32373046875,
-0.7900390625,
0.61376953125,
-0.5615234375,
-0.153076171875,
0.0758056640625,
-0.50537109375,
-0.0250396728515625,
-0.035888671875,
1.1064453125,
-0.52001953125,
-0.04144287109375,
-0.2919921875,
0.26318359375,
0.537109375,
-0.2113037109375,
-0.62060546875,
-0.814453125,
-0.8916015625,
-1.1767578125,
0.623046875,
-0.350830078125,
-0.1650390625,
-0.145751953125,
-0.1748046875,
0.89404296875,
-0.50244140625,
0.37353515625,
1.3857421875,
0.34814453125,
0.2103271484375,
-0.77880859375,
0.76513671875,
0.2008056640625,
-0.54541015625,
-0.2626953125,
0.1510009765625,
-0.8388671875,
0.1734619140625,
-0.338623046875,
-0.85302734375,
-0.58642578125,
-0.09716796875,
1.0478515625,
-0.39453125,
1.1064453125,
0.11724853515625,
-1.029296875,
-1.00390625,
0.60986328125,
0.201416015625,
0.10394287109375,
0.748046875,
0.07952880859375,
0.283203125,
-0.067138671875,
0.17529296875,
-0.09356689453125,
-0.634765625,
1.0986328125,
0.25830078125,
-0.395263671875,
0.78076171875,
1.015625,
-0.88671875,
-0.9375,
-0.057647705078125,
-0.043914794921875,
-0.375244140625,
-0.80859375,
-0.2322998046875,
0.62548828125,
-0.7763671875,
0.27197265625,
0.94140625,
0.013885498046875,
0.0885009765625,
0.053985595703125,
0.314697265625,
-0.69580078125,
0.94140625,
0.912109375,
-0.50244140625,
0.1507568359375,
-1.0322265625,
-0.0234527587890625,
-0.5126953125,
-0.1552734375,
1.0244140625,
-0.6982421875,
0.44580078125,
0.52587890625,
-0.1771240234375,
0.9873046875,
-0.273193359375,
-0.32568359375,
0.2271728515625,
-0.77294921875,
-0.67626953125,
-0.237548828125,
0.44970703125,
-0.32421875,
0.407470703125,
-0.61474609375,
0.272216796875,
0.6044921875,
0.3544921875,
-0.3837890625,
-1.134765625,
-0.428955078125,
-1.0986328125,
-0.56591796875,
-0.75,
0.0682373046875,
-0.52587890625,
0.038818359375,
0.416015625,
-0.9091796875,
0.11383056640625,
0.448486328125,
-0.2071533203125,
0.8310546875,
-0.8525390625,
0.63134765625,
-0.7890625,
-0.4462890625,
-0.71484375,
-0.282958984375,
-0.24853515625,
-0.0947265625,
-0.1273193359375,
0.333251953125,
-0.327880859375,
0.59765625,
0.1533203125,
0.28271484375,
-0.1832275390625,
-0.480224609375,
-0.0980224609375,
-0.1658935546875,
-0.429443359375,
0.275146484375,
0.5693359375,
-0.43994140625,
0.04248046875,
-0.1766357421875,
-0.334228515625,
-0.2174072265625,
0.6240234375,
0.6982421875,
0.045440673828125,
0.13916015625,
-0.225341796875,
0.10626220703125,
-0.89892578125,
0.11077880859375,
0.07122802734375,
0.12176513671875,
0.411376953125,
-0.235595703125,
0.36865234375,
0.923828125,
0.01629638671875,
0.56689453125,
-0.256103515625,
0.381591796875,
0.09912109375,
-0.07666015625,
0.00249481201171875,
-0.06915283203125,
0.0814208984375,
0.313232421875,
0.275390625,
0.3466796875,
-0.330322265625,
0.7294921875,
-0.0460205078125,
-0.7822265625,
-0.67138671875,
-0.327880859375,
0.2435302734375,
0.286376953125,
0.442626953125,
-0.127685546875,
0.12548828125,
-0.2078857421875,
-0.65576171875,
0.266845703125,
-1.2353515625,
-0.078369140625,
1.1376953125,
-0.314208984375,
-0.437744140625,
-0.451904296875,
-0.4091796875,
-0.201416015625,
0.403564453125,
0.436767578125,
-0.58544921875,
0.1005859375,
0.1378173828125,
0.671875,
-0.65283203125,
0.615234375,
-0.0849609375,
0.2802734375,
-0.38232421875,
-0.1971435546875,
0.1346435546875,
1.2275390625,
0.011199951171875,
-0.40576171875,
-1.056640625,
-0.1024169921875,
0.37451171875,
-0.3076171875,
-0.2459716796875,
0.07098388671875,
-0.216796875,
0.2587890625,
-0.87744140625,
0.10540771484375,
-0.03326416015625,
0.4072265625,
0.4599609375,
-0.2352294921875,
-0.65673828125,
0.70556640625,
0.72998046875,
-0.09783935546875,
0.94287109375,
-0.04107666015625,
0.315185546875,
0.194580078125,
0.224609375,
-0.32861328125,
0.9853515625,
0.755859375,
0.23681640625,
-0.4248046875,
0.41064453125,
0.77783203125,
0.09747314453125,
-0.2076416015625,
0.0731201171875,
0.0726318359375,
-0.297607421875,
0.3623046875,
-0.299560546875,
-0.06268310546875,
-0.004241943359375,
-0.114990234375,
0.3212890625,
-0.2379150390625,
-0.0538330078125,
-0.52978515625,
-0.80908203125,
0.533203125,
-0.27685546875,
-0.0006175041198730469,
0.379150390625,
-0.767578125,
-0.0186767578125,
0.9287109375,
-0.0088348388671875,
-0.267333984375,
0.8427734375,
0.1956787109375,
0.46337890625,
0.56591796875,
0.445068359375,
0.59814453125,
-0.8251953125,
0.5517578125,
0.13720703125,
-0.0240478515625,
-0.2227783203125,
-0.313720703125,
-0.7900390625,
0.4013671875,
-0.471923828125,
0.00696563720703125,
0.6884765625,
-1.0419921875,
0.15869140625,
-0.1700439453125,
0.498291015625,
-0.541015625,
0.29052734375,
0.14453125,
-0.68798828125,
-0.70361328125,
1.03515625,
-0.2347412109375,
0.50341796875,
0.0012416839599609375,
1.177734375,
0.0628662109375,
1.740234375,
0.379638671875,
-0.1544189453125,
-0.2041015625,
0.1456298828125,
-0.5029296875,
-0.57275390625,
-0.2015380859375,
-0.446044921875,
0.677734375,
-0.57666015625,
-0.322021484375,
-0.1915283203125,
0.78369140625,
0.337158203125,
-1.140625,
-0.393798828125,
0.45068359375,
-0.347900390625,
0.34521484375,
0.55517578125,
0.0252227783203125,
-0.027923583984375,
0.173583984375,
0.08734130859375,
-0.75927734375,
-0.09161376953125,
-0.93994140625,
0.456787109375,
-0.06805419921875,
-0.77685546875,
-0.412109375,
-0.87646484375,
-0.178955078125,
0.1832275390625,
-0.45703125,
-0.80126953125,
0.57763671875,
0.64453125,
0.7275390625,
0.2071533203125,
-0.1634521484375,
-0.23193359375,
1.126953125,
1.0205078125,
0.1895751953125,
1.05859375,
0.376708984375,
-0.26171875,
0.383544921875,
-0.419677734375,
0.59423828125,
0.1524658203125,
0.123779296875,
-0.2210693359375,
-0.368408203125,
-0.62548828125,
-1.3447265625,
0.021636962890625,
1.0791015625,
0.6796875,
-0.458740234375,
-1.02734375,
-0.580078125,
-1.052734375,
-0.0092620849609375,
-0.30712890625,
0.93701171875,
-0.175537109375,
-0.17578125,
0.183837890625,
-1.3720703125,
4.30078125,
1.2783203125,
0.98291015625,
0.091064453125,
0.075927734375,
1.0693359375,
0.8544921875,
-0.322265625,
-0.1605224609375,
-0.248779296875,
0.1953125,
-0.482666015625,
0.343994140625,
0.85498046875,
-0.026580810546875,
0.54052734375,
-0.61669921875,
-0.022735595703125,
0.17431640625,
-0.712890625,
-0.62548828125,
0.3173828125,
-0.02642822265625,
0.6787109375,
0.08612060546875,
0.51953125,
0.6396484375,
-0.673828125,
0.10821533203125,
-0.58349609375,
-0.00356292724609375,
-0.61669921875,
1.076171875,
0.2039794921875,
-0.41943359375,
0.359619140625,
-0.1165771484375,
-0.9912109375,
-0.1356201171875,
0.08746337890625,
0.02984619140625,
-0.1590576171875,
0.57373046875,
-0.90869140625,
-0.1282958984375,
0.466552734375,
-0.36572265625,
0.182861328125,
0.5185546875,
-0.94482421875,
0.6640625,
-0.74462890625,
0.59033203125,
-0.72509765625,
-0.268310546875,
0.325927734375,
0.578125,
-0.189208984375,
-0.24853515625,
0.5322265625,
0.401123046875,
0.3017578125,
0.07965087890625,
0.65625,
-0.8681640625,
0.4638671875,
-0.6591796875,
0.7294921875,
-0.1566162109375,
0.0718994140625,
-0.1922607421875,
-0.276611328125,
-0.63037109375,
-0.76416015625,
0.5419921875,
0.165771484375,
-0.1236572265625,
0.5517578125,
0.64208984375,
-0.2734375,
-0.206298828125,
-0.2218017578125,
-0.29345703125,
-0.4658203125,
0.11407470703125,
1.189453125,
-0.58935546875,
-0.3154296875,
-0.3857421875,
0.8798828125,
0.418701171875,
0.498291015625,
0.1875,
-0.22998046875,
-0.017242431640625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Submitted Solution:
```
import re
def add_used(id, s, used):
used[id-1].add(s)
used[id].add(s)
used[id+1].add(s)
tcase = int(input())
for cas in range(tcase):
n = int(input())
names = input().split()
m = int(input())
res = True
ans = [''] * (m+1)
msg = [''] * (m+1)
used = [set() for i in range(m+1)]
for i in range(m):
ans[i], msg[i] = input().split(':')
if ans[i] != '?':
add_used(i, ans[i], used)
mentioned = re.split('\W+', msg[i])
for s in mentioned:
if s in names:
used[i].add(s)
for i in range(m):
if ans[i] == '?' and len(used[i]) == n-1:
ans[i] = list(set(names) - used[i])[0]
add_used(i, ans[i], used)
for i in range(m):
if ans[i] == '?':
if len(used[i]) == n:
res = False
else:
ans[i] = list(set(names) - used[i])[0]
add_used(i, ans[i], used)
for i in range(m-1):
if ans[i] == ans[i+1]:
res = False
if res:
for i in range(m):
print(ans[i] + ':' + msg[i])
else:
print('Impossible')
```
Yes
| 65,321
|
[
0.475341796875,
-0.2286376953125,
-0.1912841796875,
0.5458984375,
-0.26953125,
-0.75146484375,
-0.5986328125,
0.0175628662109375,
0.12066650390625,
0.59130859375,
0.256103515625,
-0.005313873291015625,
0.2279052734375,
-0.452392578125,
-1.0263671875,
0.00272369384765625,
-0.391357421875,
-0.72705078125,
-0.07281494140625,
-0.059112548828125,
0.44580078125,
0.005245208740234375,
-1.3671875,
-0.501953125,
-0.75537109375,
0.492919921875,
0.1285400390625,
-0.0170135498046875,
0.9677734375,
0.9873046875,
-0.30615234375,
-0.43017578125,
0.151123046875,
-1.3583984375,
-0.2200927734375,
-0.1558837890625,
0.6142578125,
-0.63623046875,
-0.7646484375,
-0.57568359375,
0.11260986328125,
-0.427490234375,
0.77880859375,
-0.85595703125,
-1.3193359375,
0.1746826171875,
-0.282958984375,
-0.1512451171875,
-0.010772705078125,
-0.91259765625,
0.46533203125,
-0.13671875,
0.7626953125,
-0.338623046875,
-0.1329345703125,
-0.67138671875,
-0.43310546875,
0.2509765625,
-0.6533203125,
0.08428955078125,
-0.1590576171875,
0.47119140625,
-0.1168212890625,
-0.58984375,
-0.05694580078125,
-0.11578369140625,
-0.1383056640625,
-0.25732421875,
0.0804443359375,
-0.48876953125,
-0.2086181640625,
0.1656494140625,
-0.73681640625,
-0.369140625,
-0.450439453125,
0.461181640625,
0.12078857421875,
-0.1019287109375,
-0.27099609375,
0.55029296875,
0.0027599334716796875,
1.09375,
0.294677734375,
0.378173828125,
-0.63232421875,
-0.79736328125,
0.5634765625,
0.365478515625,
0.2188720703125,
-0.268310546875,
-0.07275390625,
0.1768798828125,
-0.55419921875,
0.038970947265625,
0.8935546875,
0.468505859375,
0.2012939453125,
0.580078125,
-0.30419921875,
0.3310546875,
0.71923828125,
1.115234375,
-0.25146484375,
1.2177734375,
-0.01258087158203125,
0.1588134765625,
0.2457275390625,
0.1590576171875,
-0.305419921875,
-0.0953369140625,
-0.427734375,
-0.29150390625,
0.529296875,
0.27490234375,
-0.290283203125,
0.74853515625,
0.061737060546875,
-0.2127685546875,
-1.0341796875,
0.180908203125,
0.3017578125,
-0.29736328125,
0.1785888671875,
-0.268310546875,
0.1383056640625,
-0.130126953125,
-0.0183868408203125,
0.9150390625,
-0.52734375,
-0.3544921875,
0.270751953125,
-0.2366943359375,
-0.1021728515625,
0.1690673828125,
-0.1451416015625,
0.485595703125,
-0.422119140625,
0.53759765625,
0.91552734375,
-0.62451171875,
0.64892578125,
-0.1292724609375,
-0.082275390625,
1.4853515625,
0.43408203125,
-0.07257080078125,
0.423583984375,
0.418701171875,
-0.5927734375,
0.2322998046875,
-0.716796875,
0.77880859375,
-0.204345703125,
0.141357421875,
-0.1011962890625,
-0.2646484375,
-0.198486328125,
0.467529296875,
0.24365234375,
0.1734619140625,
-0.448486328125,
-0.11639404296875,
-0.270751953125,
0.9892578125,
-0.044891357421875,
0.947265625,
-0.560546875,
-0.57958984375,
-0.03021240234375,
-0.44287109375,
0.7294921875,
-0.224853515625,
-0.041290283203125,
1.0927734375,
0.84375,
0.9501953125,
0.43603515625,
-0.41943359375,
0.14697265625,
0.051971435546875,
0.115234375,
0.2117919921875,
0.09368896484375,
0.716796875,
0.181884765625,
0.1572265625,
0.365478515625,
-0.8291015625,
-0.7763671875,
-0.6708984375,
0.17529296875,
0.58740234375,
-0.580078125,
0.28125,
0.1488037109375,
-0.08087158203125,
-0.50146484375,
-0.066162109375,
0.10223388671875,
-0.82568359375,
-0.43017578125,
0.73388671875,
-0.3564453125,
0.52001953125,
-0.2666015625,
-0.277587890625,
0.43212890625,
1.4755859375,
-0.06927490234375,
-0.1033935546875,
0.53076171875,
0.257080078125,
-0.104736328125,
-0.27734375,
0.435791015625,
-0.6162109375,
-0.64453125,
0.37939453125,
-0.342041015625,
-0.25634765625,
0.09466552734375,
0.712890625,
0.429931640625,
0.458740234375,
-0.61376953125,
-0.285888671875,
0.2626953125,
1.4033203125,
-0.187255859375,
0.494140625,
0.2227783203125,
0.70849609375,
0.3095703125,
1.060546875,
0.3115234375,
0.0665283203125,
0.7724609375,
0.77734375,
0.072998046875,
0.1820068359375,
-0.0966796875,
0.352783203125,
0.07958984375,
0.38916015625,
0.11767578125,
0.55712890625,
-0.318603515625,
-0.12225341796875,
-0.86669921875,
0.305419921875,
-0.83935546875,
0.5791015625,
0.3876953125,
0.28857421875,
-0.8212890625,
-0.4326171875,
0.548828125,
0.5859375,
-0.732421875,
-0.2342529296875,
-0.063232421875,
0.0099945068359375,
0.303466796875,
-0.04925537109375,
0.057830810546875,
0.3017578125,
0.458984375,
0.50146484375,
-0.2091064453125,
-0.48779296875,
-0.919921875,
-1.0625,
-1.1748046875,
-0.68603515625,
-0.70947265625,
-0.330810546875,
0.2471923828125,
-0.68310546875,
0.1422119140625,
-0.5615234375,
-0.0127716064453125,
0.07421875,
-0.80908203125,
0.591796875,
-0.06854248046875,
0.444580078125,
-0.92919921875,
0.320556640625,
-0.11279296875,
1.02734375,
-0.292724609375,
0.1392822265625,
-0.15869140625,
-0.7177734375,
0.293701171875,
-0.32958984375,
0.37939453125,
-0.08782958984375,
-0.93017578125,
-0.4404296875,
-0.90673828125,
0.030242919921875,
-0.282958984375,
-0.048614501953125,
-0.7373046875,
0.8203125,
0.72314453125,
-0.7568359375,
0.52783203125,
0.673828125,
-0.6044921875,
0.56494140625,
0.446533203125,
0.11163330078125,
-0.55810546875,
0.92529296875,
0.533203125,
0.64892578125,
-0.483154296875,
-0.3779296875,
-0.75439453125,
0.1036376953125,
0.0662841796875,
-0.5205078125,
-0.31640625,
0.08892822265625,
0.187255859375,
-1.1455078125,
0.5693359375,
-1.7109375,
-0.97607421875,
-0.10809326171875,
-0.66796875,
1.1728515625,
0.927734375,
0.047149658203125,
-0.302001953125,
-0.132568359375,
-0.279052734375,
0.462158203125,
0.44873046875,
-0.57763671875,
0.154052734375,
0.953125,
0.033843994140625,
-0.0570068359375,
0.5234375,
-0.6787109375,
-0.146728515625,
-0.1202392578125,
0.1993408203125,
0.64208984375,
0.525390625,
0.036376953125,
0.00847625732421875,
0.865234375,
-0.81298828125,
-0.311767578125,
0.193359375,
0.3623046875,
0.71630859375,
0.2685546875,
0.2283935546875,
-0.147216796875,
-0.72802734375,
-0.77294921875,
0.2242431640625,
0.55322265625,
1.1123046875,
-0.525390625,
0.64013671875,
-0.050262451171875,
-0.857421875,
0.47607421875,
-0.75,
-0.344970703125,
0.8876953125,
-0.01107025146484375,
0.6728515625,
-1.0859375,
-0.07928466796875,
0.127685546875,
0.07379150390625,
0.467041015625,
0.63818359375,
0.6357421875,
-0.58203125,
-0.253173828125,
-0.256591796875,
-0.1943359375,
0.0726318359375,
-0.45361328125,
-0.444091796875,
-0.270751953125,
-0.5126953125,
-1.080078125,
0.521484375,
0.5693359375,
0.75830078125,
0.1619873046875,
0.79541015625,
0.02484130859375,
0.89990234375,
0.68701171875,
-0.43505859375,
0.052276611328125,
-0.7216796875,
0.6923828125,
0.444580078125,
-0.338623046875,
-0.430419921875,
-0.29931640625,
-0.06585693359375,
-0.11260986328125,
0.195068359375,
-0.331298828125,
-0.5712890625,
0.0877685546875,
-0.04571533203125,
0.74169921875,
-0.39208984375,
-0.59375,
-0.077880859375,
0.318603515625,
0.4130859375,
-0.460693359375,
0.2047119140625,
-0.64599609375,
0.63818359375,
0.8525390625,
-0.03179931640625,
-0.57275390625,
-0.47412109375,
-0.94580078125,
-0.783203125,
0.1729736328125,
0.8125,
-0.5927734375,
-0.072021484375,
-1.3701171875,
0.50634765625,
0.306640625,
-0.386474609375,
0.10009765625,
-0.10064697265625,
0.292724609375,
0.1422119140625,
0.69580078125,
-0.08233642578125,
-0.42822265625,
0.2489013671875,
-0.6025390625,
0.57568359375,
-0.70947265625,
0.2138671875,
-0.07012939453125,
0.02850341796875,
0.03765869140625,
0.8056640625,
-0.0177001953125,
0.365478515625,
-0.10858154296875,
0.1080322265625,
-0.986328125,
-0.57470703125,
0.439697265625,
0.2340087890625,
-0.45947265625,
0.37255859375,
0.234619140625,
-0.50341796875,
0.25244140625,
0.428955078125,
-0.322021484375,
0.59716796875,
-0.67333984375,
0.619140625,
-0.29296875,
-0.398681640625,
-0.057281494140625,
-0.53271484375,
0.5146484375,
0.0843505859375,
-0.984375,
-0.1619873046875,
-0.9541015625,
-0.170166015625,
-0.2369384765625,
-0.54541015625,
0.432373046875,
0.1590576171875,
0.0283966064453125,
-0.1982421875,
0.00977325439453125,
-0.92041015625,
0.01119232177734375,
-0.5634765625,
-0.244140625,
0.40673828125,
0.11676025390625,
0.62890625,
-0.05255126953125,
-0.46044921875,
0.308837890625,
-0.2374267578125,
0.247802734375,
-0.342041015625,
-0.441650390625,
0.223876953125,
-0.17724609375,
-0.436279296875,
0.374267578125,
-0.6357421875,
0.28662109375,
0.8515625,
-0.035430908203125,
0.32275390625,
0.051605224609375,
-0.53173828125,
0.76904296875,
0.0687255859375,
-1.2099609375,
-0.235595703125,
0.63037109375,
-0.384765625,
0.548828125,
0.73486328125,
-1.126953125,
-0.5224609375,
-0.90087890625,
0.182373046875,
-1.08984375,
-0.16943359375,
-0.8916015625,
-0.160888671875,
-0.450927734375,
0.9501953125,
0.01358795166015625,
-0.6484375,
-0.31005859375,
-1.0537109375,
0.484130859375,
-0.74462890625,
-0.1492919921875,
-0.191650390625,
-0.158447265625,
-0.25341796875,
1.171875,
0.304931640625,
0.2230224609375,
-0.143310546875,
0.00823211669921875,
0.349609375,
-0.06298828125,
-0.421630859375,
-0.22119140625,
0.1849365234375,
0.07354736328125,
-0.454833984375,
0.3466796875,
-0.759765625,
0.578125,
-0.53125,
-0.09271240234375,
0.1268310546875,
-0.5859375,
0.007415771484375,
-0.06292724609375,
1.154296875,
-0.59619140625,
-0.044036865234375,
-0.3447265625,
0.250244140625,
0.61767578125,
-0.2734375,
-0.55712890625,
-0.69775390625,
-0.830078125,
-1.16796875,
0.6181640625,
-0.335693359375,
-0.06439208984375,
-0.2548828125,
-0.2021484375,
1.0263671875,
-0.5263671875,
0.31982421875,
1.4306640625,
0.402587890625,
0.2027587890625,
-0.7451171875,
0.73681640625,
0.32470703125,
-0.497802734375,
-0.273681640625,
0.11676025390625,
-0.83740234375,
0.1561279296875,
-0.397216796875,
-0.9169921875,
-0.5810546875,
-0.0243072509765625,
0.955078125,
-0.41650390625,
1.130859375,
0.144287109375,
-1.0703125,
-0.9111328125,
0.55078125,
0.13427734375,
0.113037109375,
0.728515625,
0.1214599609375,
0.169921875,
0.024322509765625,
0.1558837890625,
-0.08978271484375,
-0.623046875,
1.1875,
0.10418701171875,
-0.362060546875,
0.84765625,
0.97802734375,
-0.888671875,
-0.935546875,
-0.05364990234375,
-0.01110076904296875,
-0.2197265625,
-0.8740234375,
-0.14013671875,
0.66162109375,
-0.77490234375,
0.36279296875,
0.9052734375,
0.06744384765625,
0.11468505859375,
0.027008056640625,
0.3681640625,
-0.76171875,
0.8837890625,
0.990234375,
-0.486083984375,
0.132568359375,
-1.048828125,
0.0253143310546875,
-0.5107421875,
-0.12548828125,
0.98681640625,
-0.70166015625,
0.53662109375,
0.67529296875,
-0.2069091796875,
0.9951171875,
-0.38330078125,
-0.2314453125,
0.196533203125,
-0.7626953125,
-0.6044921875,
-0.203857421875,
0.4345703125,
-0.3662109375,
0.5078125,
-0.66748046875,
0.2783203125,
0.62841796875,
0.3837890625,
-0.372314453125,
-1.091796875,
-0.407470703125,
-1.0048828125,
-0.60498046875,
-0.724609375,
0.1768798828125,
-0.501953125,
0.0941162109375,
0.44384765625,
-0.8935546875,
0.0860595703125,
0.459716796875,
-0.20751953125,
0.76171875,
-0.8857421875,
0.55712890625,
-0.77978515625,
-0.431396484375,
-0.69921875,
-0.31494140625,
-0.293701171875,
-0.10076904296875,
-0.02752685546875,
0.357666015625,
-0.2342529296875,
0.57568359375,
0.0114898681640625,
0.271728515625,
-0.1741943359375,
-0.392822265625,
0.0226287841796875,
-0.0655517578125,
-0.51513671875,
0.333984375,
0.417724609375,
-0.39306640625,
-0.002941131591796875,
-0.1829833984375,
-0.28564453125,
-0.1292724609375,
0.69921875,
0.68798828125,
0.07733154296875,
0.07086181640625,
-0.134765625,
0.058380126953125,
-0.87255859375,
0.097900390625,
0.08447265625,
0.1146240234375,
0.405517578125,
-0.2900390625,
0.344970703125,
0.9208984375,
-0.1407470703125,
0.56787109375,
-0.1754150390625,
0.46435546875,
0.054656982421875,
-0.11077880859375,
0.042510986328125,
-0.01435089111328125,
0.11993408203125,
0.2462158203125,
0.2435302734375,
0.3720703125,
-0.31787109375,
0.67578125,
-0.146728515625,
-0.8486328125,
-0.77587890625,
-0.2734375,
0.1951904296875,
0.337890625,
0.517578125,
-0.06964111328125,
0.08758544921875,
-0.1776123046875,
-0.64306640625,
0.257568359375,
-1.328125,
-0.1890869140625,
1.171875,
-0.317138671875,
-0.495361328125,
-0.355712890625,
-0.350830078125,
-0.0760498046875,
0.525390625,
0.36328125,
-0.63037109375,
0.0012960433959960938,
0.18408203125,
0.65185546875,
-0.64013671875,
0.492431640625,
-0.0989990234375,
0.308349609375,
-0.46923828125,
-0.186279296875,
0.2044677734375,
1.169921875,
-0.088623046875,
-0.44287109375,
-1.0703125,
-0.07025146484375,
0.272705078125,
-0.35546875,
-0.2147216796875,
0.10748291015625,
-0.1268310546875,
0.338134765625,
-0.78076171875,
0.10601806640625,
-0.08587646484375,
0.379150390625,
0.34521484375,
-0.1864013671875,
-0.67138671875,
0.62109375,
0.751953125,
-0.13671875,
1.0576171875,
-0.042694091796875,
0.385498046875,
0.2388916015625,
0.23291015625,
-0.333984375,
0.91162109375,
0.79052734375,
0.253662109375,
-0.326416015625,
0.487548828125,
0.7529296875,
0.13134765625,
-0.07952880859375,
0.050689697265625,
0.07745361328125,
-0.2335205078125,
0.359375,
-0.30078125,
-0.13134765625,
-0.006511688232421875,
-0.07464599609375,
0.28369140625,
-0.236328125,
-0.04180908203125,
-0.52490234375,
-0.74267578125,
0.52587890625,
-0.3408203125,
0.00322723388671875,
0.279052734375,
-0.69580078125,
0.1109619140625,
0.892578125,
0.0307159423828125,
-0.289794921875,
0.89599609375,
0.2462158203125,
0.50341796875,
0.64501953125,
0.453369140625,
0.556640625,
-0.81201171875,
0.455322265625,
0.2344970703125,
-0.041778564453125,
-0.1734619140625,
-0.298095703125,
-0.8623046875,
0.455322265625,
-0.40478515625,
0.0335693359375,
0.68212890625,
-1.068359375,
0.1898193359375,
-0.137939453125,
0.529296875,
-0.56982421875,
0.2230224609375,
0.152099609375,
-0.62646484375,
-0.71923828125,
1.03515625,
-0.1622314453125,
0.414794921875,
0.0406494140625,
1.201171875,
0.1326904296875,
1.7939453125,
0.483642578125,
-0.1029052734375,
-0.1358642578125,
0.21826171875,
-0.51025390625,
-0.474365234375,
-0.2034912109375,
-0.410400390625,
0.5966796875,
-0.6474609375,
-0.325439453125,
-0.167724609375,
0.8017578125,
0.37744140625,
-1.1416015625,
-0.484375,
0.3603515625,
-0.291259765625,
0.313232421875,
0.406005859375,
0.078857421875,
0.005260467529296875,
0.1578369140625,
0.026397705078125,
-0.76171875,
-0.1376953125,
-0.82275390625,
0.418701171875,
-0.006900787353515625,
-0.7744140625,
-0.43505859375,
-0.8525390625,
-0.114013671875,
0.2176513671875,
-0.448486328125,
-0.7685546875,
0.615234375,
0.5947265625,
0.6572265625,
0.12005615234375,
-0.2359619140625,
-0.249267578125,
1.0556640625,
0.99609375,
0.14892578125,
1.1005859375,
0.42138671875,
-0.1409912109375,
0.256591796875,
-0.37646484375,
0.64208984375,
0.158447265625,
0.085693359375,
-0.30517578125,
-0.421875,
-0.68115234375,
-1.248046875,
0.006504058837890625,
1.0390625,
0.6142578125,
-0.4677734375,
-1.0712890625,
-0.74072265625,
-1.064453125,
-0.04595947265625,
-0.375,
1.021484375,
-0.214111328125,
-0.1588134765625,
0.09527587890625,
-1.3037109375,
4.3359375,
1.2099609375,
0.78564453125,
-0.01035308837890625,
0.0943603515625,
1.01171875,
0.88818359375,
-0.391845703125,
-0.080322265625,
-0.341796875,
0.2486572265625,
-0.485595703125,
0.305419921875,
0.89208984375,
0.03436279296875,
0.59521484375,
-0.6142578125,
-0.23583984375,
0.193115234375,
-0.783203125,
-0.7021484375,
0.367431640625,
0.06170654296875,
0.5556640625,
0.1361083984375,
0.5419921875,
0.67822265625,
-0.7041015625,
0.06689453125,
-0.60302734375,
0.011688232421875,
-0.56201171875,
1.0556640625,
0.1749267578125,
-0.35205078125,
0.369384765625,
-0.09381103515625,
-0.92578125,
-0.208251953125,
0.18701171875,
0.055023193359375,
-0.0330810546875,
0.51708984375,
-0.8154296875,
-0.1273193359375,
0.47412109375,
-0.373291015625,
0.2568359375,
0.48779296875,
-1.044921875,
0.583984375,
-0.6005859375,
0.59033203125,
-0.65576171875,
-0.297119140625,
0.266845703125,
0.60302734375,
-0.15625,
-0.18603515625,
0.5537109375,
0.358154296875,
0.302490234375,
0.0003230571746826172,
0.76904296875,
-0.95166015625,
0.420166015625,
-0.5712890625,
0.5595703125,
-0.11181640625,
0.0233306884765625,
-0.2548828125,
-0.2391357421875,
-0.58642578125,
-0.8095703125,
0.49560546875,
0.275634765625,
-0.2113037109375,
0.54736328125,
0.70751953125,
-0.2462158203125,
-0.2442626953125,
-0.2330322265625,
-0.248291015625,
-0.5771484375,
0.1341552734375,
1.1728515625,
-0.634765625,
-0.3583984375,
-0.372314453125,
0.8564453125,
0.4658203125,
0.4931640625,
0.225830078125,
-0.2724609375,
-0.190673828125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Submitted Solution:
```
import re
def proc(msgs):
chg = False
for i, msg in enumerate(msgs):
if msg[0] != '?': continue
ppn = msg[1]
if i > 0: ppn.discard(msgs[i-1][0])
if i != len(msgs)-1: ppn.discard(msgs[i+1][0])
if len(ppn) == 1:
msg[0] = ppn.pop()
chg = True
return chg
def is_valid(msgs):
for i, msg in enumerate(msgs):
if msg[0] == '?' or (i > 0 and msg[0] == msgs[i-1][0]) or (i != len(msgs)-1 and msg[0] == msgs[i+1][0]):
return False
return True
TC = int(input())
for tc in range(0, TC):
N = int(input())
persons = set(input().split())
M = int(input())
msgs = []
for m in range(M):
line = input()
m1 = re.match(r'(.*)\:(.*)', line)
ppn = set(persons)
for un in re.findall(r'[a-zA-Z0-9]+', m1.group(2)):
ppn.discard(un)
msgs.append([m1.group(1), ppn, m1.group(2)])
while True:
if proc(msgs): continue
chgt = False
for msg in msgs:
if msg[0] == '?' and len(msg[1]) > 0:
msg[0] = msg[1].pop()
chgt = True
break
if not chgt: break
if is_valid(msgs):
for msg in msgs:
print('%s:%s' % (msg[0], msg[2]))
else:
print('Impossible')
# Made By Mostafa_Khaled
```
Yes
| 65,322
|
[
0.475341796875,
-0.2286376953125,
-0.1912841796875,
0.5458984375,
-0.26953125,
-0.75146484375,
-0.5986328125,
0.0175628662109375,
0.12066650390625,
0.59130859375,
0.256103515625,
-0.005313873291015625,
0.2279052734375,
-0.452392578125,
-1.0263671875,
0.00272369384765625,
-0.391357421875,
-0.72705078125,
-0.07281494140625,
-0.059112548828125,
0.44580078125,
0.005245208740234375,
-1.3671875,
-0.501953125,
-0.75537109375,
0.492919921875,
0.1285400390625,
-0.0170135498046875,
0.9677734375,
0.9873046875,
-0.30615234375,
-0.43017578125,
0.151123046875,
-1.3583984375,
-0.2200927734375,
-0.1558837890625,
0.6142578125,
-0.63623046875,
-0.7646484375,
-0.57568359375,
0.11260986328125,
-0.427490234375,
0.77880859375,
-0.85595703125,
-1.3193359375,
0.1746826171875,
-0.282958984375,
-0.1512451171875,
-0.010772705078125,
-0.91259765625,
0.46533203125,
-0.13671875,
0.7626953125,
-0.338623046875,
-0.1329345703125,
-0.67138671875,
-0.43310546875,
0.2509765625,
-0.6533203125,
0.08428955078125,
-0.1590576171875,
0.47119140625,
-0.1168212890625,
-0.58984375,
-0.05694580078125,
-0.11578369140625,
-0.1383056640625,
-0.25732421875,
0.0804443359375,
-0.48876953125,
-0.2086181640625,
0.1656494140625,
-0.73681640625,
-0.369140625,
-0.450439453125,
0.461181640625,
0.12078857421875,
-0.1019287109375,
-0.27099609375,
0.55029296875,
0.0027599334716796875,
1.09375,
0.294677734375,
0.378173828125,
-0.63232421875,
-0.79736328125,
0.5634765625,
0.365478515625,
0.2188720703125,
-0.268310546875,
-0.07275390625,
0.1768798828125,
-0.55419921875,
0.038970947265625,
0.8935546875,
0.468505859375,
0.2012939453125,
0.580078125,
-0.30419921875,
0.3310546875,
0.71923828125,
1.115234375,
-0.25146484375,
1.2177734375,
-0.01258087158203125,
0.1588134765625,
0.2457275390625,
0.1590576171875,
-0.305419921875,
-0.0953369140625,
-0.427734375,
-0.29150390625,
0.529296875,
0.27490234375,
-0.290283203125,
0.74853515625,
0.061737060546875,
-0.2127685546875,
-1.0341796875,
0.180908203125,
0.3017578125,
-0.29736328125,
0.1785888671875,
-0.268310546875,
0.1383056640625,
-0.130126953125,
-0.0183868408203125,
0.9150390625,
-0.52734375,
-0.3544921875,
0.270751953125,
-0.2366943359375,
-0.1021728515625,
0.1690673828125,
-0.1451416015625,
0.485595703125,
-0.422119140625,
0.53759765625,
0.91552734375,
-0.62451171875,
0.64892578125,
-0.1292724609375,
-0.082275390625,
1.4853515625,
0.43408203125,
-0.07257080078125,
0.423583984375,
0.418701171875,
-0.5927734375,
0.2322998046875,
-0.716796875,
0.77880859375,
-0.204345703125,
0.141357421875,
-0.1011962890625,
-0.2646484375,
-0.198486328125,
0.467529296875,
0.24365234375,
0.1734619140625,
-0.448486328125,
-0.11639404296875,
-0.270751953125,
0.9892578125,
-0.044891357421875,
0.947265625,
-0.560546875,
-0.57958984375,
-0.03021240234375,
-0.44287109375,
0.7294921875,
-0.224853515625,
-0.041290283203125,
1.0927734375,
0.84375,
0.9501953125,
0.43603515625,
-0.41943359375,
0.14697265625,
0.051971435546875,
0.115234375,
0.2117919921875,
0.09368896484375,
0.716796875,
0.181884765625,
0.1572265625,
0.365478515625,
-0.8291015625,
-0.7763671875,
-0.6708984375,
0.17529296875,
0.58740234375,
-0.580078125,
0.28125,
0.1488037109375,
-0.08087158203125,
-0.50146484375,
-0.066162109375,
0.10223388671875,
-0.82568359375,
-0.43017578125,
0.73388671875,
-0.3564453125,
0.52001953125,
-0.2666015625,
-0.277587890625,
0.43212890625,
1.4755859375,
-0.06927490234375,
-0.1033935546875,
0.53076171875,
0.257080078125,
-0.104736328125,
-0.27734375,
0.435791015625,
-0.6162109375,
-0.64453125,
0.37939453125,
-0.342041015625,
-0.25634765625,
0.09466552734375,
0.712890625,
0.429931640625,
0.458740234375,
-0.61376953125,
-0.285888671875,
0.2626953125,
1.4033203125,
-0.187255859375,
0.494140625,
0.2227783203125,
0.70849609375,
0.3095703125,
1.060546875,
0.3115234375,
0.0665283203125,
0.7724609375,
0.77734375,
0.072998046875,
0.1820068359375,
-0.0966796875,
0.352783203125,
0.07958984375,
0.38916015625,
0.11767578125,
0.55712890625,
-0.318603515625,
-0.12225341796875,
-0.86669921875,
0.305419921875,
-0.83935546875,
0.5791015625,
0.3876953125,
0.28857421875,
-0.8212890625,
-0.4326171875,
0.548828125,
0.5859375,
-0.732421875,
-0.2342529296875,
-0.063232421875,
0.0099945068359375,
0.303466796875,
-0.04925537109375,
0.057830810546875,
0.3017578125,
0.458984375,
0.50146484375,
-0.2091064453125,
-0.48779296875,
-0.919921875,
-1.0625,
-1.1748046875,
-0.68603515625,
-0.70947265625,
-0.330810546875,
0.2471923828125,
-0.68310546875,
0.1422119140625,
-0.5615234375,
-0.0127716064453125,
0.07421875,
-0.80908203125,
0.591796875,
-0.06854248046875,
0.444580078125,
-0.92919921875,
0.320556640625,
-0.11279296875,
1.02734375,
-0.292724609375,
0.1392822265625,
-0.15869140625,
-0.7177734375,
0.293701171875,
-0.32958984375,
0.37939453125,
-0.08782958984375,
-0.93017578125,
-0.4404296875,
-0.90673828125,
0.030242919921875,
-0.282958984375,
-0.048614501953125,
-0.7373046875,
0.8203125,
0.72314453125,
-0.7568359375,
0.52783203125,
0.673828125,
-0.6044921875,
0.56494140625,
0.446533203125,
0.11163330078125,
-0.55810546875,
0.92529296875,
0.533203125,
0.64892578125,
-0.483154296875,
-0.3779296875,
-0.75439453125,
0.1036376953125,
0.0662841796875,
-0.5205078125,
-0.31640625,
0.08892822265625,
0.187255859375,
-1.1455078125,
0.5693359375,
-1.7109375,
-0.97607421875,
-0.10809326171875,
-0.66796875,
1.1728515625,
0.927734375,
0.047149658203125,
-0.302001953125,
-0.132568359375,
-0.279052734375,
0.462158203125,
0.44873046875,
-0.57763671875,
0.154052734375,
0.953125,
0.033843994140625,
-0.0570068359375,
0.5234375,
-0.6787109375,
-0.146728515625,
-0.1202392578125,
0.1993408203125,
0.64208984375,
0.525390625,
0.036376953125,
0.00847625732421875,
0.865234375,
-0.81298828125,
-0.311767578125,
0.193359375,
0.3623046875,
0.71630859375,
0.2685546875,
0.2283935546875,
-0.147216796875,
-0.72802734375,
-0.77294921875,
0.2242431640625,
0.55322265625,
1.1123046875,
-0.525390625,
0.64013671875,
-0.050262451171875,
-0.857421875,
0.47607421875,
-0.75,
-0.344970703125,
0.8876953125,
-0.01107025146484375,
0.6728515625,
-1.0859375,
-0.07928466796875,
0.127685546875,
0.07379150390625,
0.467041015625,
0.63818359375,
0.6357421875,
-0.58203125,
-0.253173828125,
-0.256591796875,
-0.1943359375,
0.0726318359375,
-0.45361328125,
-0.444091796875,
-0.270751953125,
-0.5126953125,
-1.080078125,
0.521484375,
0.5693359375,
0.75830078125,
0.1619873046875,
0.79541015625,
0.02484130859375,
0.89990234375,
0.68701171875,
-0.43505859375,
0.052276611328125,
-0.7216796875,
0.6923828125,
0.444580078125,
-0.338623046875,
-0.430419921875,
-0.29931640625,
-0.06585693359375,
-0.11260986328125,
0.195068359375,
-0.331298828125,
-0.5712890625,
0.0877685546875,
-0.04571533203125,
0.74169921875,
-0.39208984375,
-0.59375,
-0.077880859375,
0.318603515625,
0.4130859375,
-0.460693359375,
0.2047119140625,
-0.64599609375,
0.63818359375,
0.8525390625,
-0.03179931640625,
-0.57275390625,
-0.47412109375,
-0.94580078125,
-0.783203125,
0.1729736328125,
0.8125,
-0.5927734375,
-0.072021484375,
-1.3701171875,
0.50634765625,
0.306640625,
-0.386474609375,
0.10009765625,
-0.10064697265625,
0.292724609375,
0.1422119140625,
0.69580078125,
-0.08233642578125,
-0.42822265625,
0.2489013671875,
-0.6025390625,
0.57568359375,
-0.70947265625,
0.2138671875,
-0.07012939453125,
0.02850341796875,
0.03765869140625,
0.8056640625,
-0.0177001953125,
0.365478515625,
-0.10858154296875,
0.1080322265625,
-0.986328125,
-0.57470703125,
0.439697265625,
0.2340087890625,
-0.45947265625,
0.37255859375,
0.234619140625,
-0.50341796875,
0.25244140625,
0.428955078125,
-0.322021484375,
0.59716796875,
-0.67333984375,
0.619140625,
-0.29296875,
-0.398681640625,
-0.057281494140625,
-0.53271484375,
0.5146484375,
0.0843505859375,
-0.984375,
-0.1619873046875,
-0.9541015625,
-0.170166015625,
-0.2369384765625,
-0.54541015625,
0.432373046875,
0.1590576171875,
0.0283966064453125,
-0.1982421875,
0.00977325439453125,
-0.92041015625,
0.01119232177734375,
-0.5634765625,
-0.244140625,
0.40673828125,
0.11676025390625,
0.62890625,
-0.05255126953125,
-0.46044921875,
0.308837890625,
-0.2374267578125,
0.247802734375,
-0.342041015625,
-0.441650390625,
0.223876953125,
-0.17724609375,
-0.436279296875,
0.374267578125,
-0.6357421875,
0.28662109375,
0.8515625,
-0.035430908203125,
0.32275390625,
0.051605224609375,
-0.53173828125,
0.76904296875,
0.0687255859375,
-1.2099609375,
-0.235595703125,
0.63037109375,
-0.384765625,
0.548828125,
0.73486328125,
-1.126953125,
-0.5224609375,
-0.90087890625,
0.182373046875,
-1.08984375,
-0.16943359375,
-0.8916015625,
-0.160888671875,
-0.450927734375,
0.9501953125,
0.01358795166015625,
-0.6484375,
-0.31005859375,
-1.0537109375,
0.484130859375,
-0.74462890625,
-0.1492919921875,
-0.191650390625,
-0.158447265625,
-0.25341796875,
1.171875,
0.304931640625,
0.2230224609375,
-0.143310546875,
0.00823211669921875,
0.349609375,
-0.06298828125,
-0.421630859375,
-0.22119140625,
0.1849365234375,
0.07354736328125,
-0.454833984375,
0.3466796875,
-0.759765625,
0.578125,
-0.53125,
-0.09271240234375,
0.1268310546875,
-0.5859375,
0.007415771484375,
-0.06292724609375,
1.154296875,
-0.59619140625,
-0.044036865234375,
-0.3447265625,
0.250244140625,
0.61767578125,
-0.2734375,
-0.55712890625,
-0.69775390625,
-0.830078125,
-1.16796875,
0.6181640625,
-0.335693359375,
-0.06439208984375,
-0.2548828125,
-0.2021484375,
1.0263671875,
-0.5263671875,
0.31982421875,
1.4306640625,
0.402587890625,
0.2027587890625,
-0.7451171875,
0.73681640625,
0.32470703125,
-0.497802734375,
-0.273681640625,
0.11676025390625,
-0.83740234375,
0.1561279296875,
-0.397216796875,
-0.9169921875,
-0.5810546875,
-0.0243072509765625,
0.955078125,
-0.41650390625,
1.130859375,
0.144287109375,
-1.0703125,
-0.9111328125,
0.55078125,
0.13427734375,
0.113037109375,
0.728515625,
0.1214599609375,
0.169921875,
0.024322509765625,
0.1558837890625,
-0.08978271484375,
-0.623046875,
1.1875,
0.10418701171875,
-0.362060546875,
0.84765625,
0.97802734375,
-0.888671875,
-0.935546875,
-0.05364990234375,
-0.01110076904296875,
-0.2197265625,
-0.8740234375,
-0.14013671875,
0.66162109375,
-0.77490234375,
0.36279296875,
0.9052734375,
0.06744384765625,
0.11468505859375,
0.027008056640625,
0.3681640625,
-0.76171875,
0.8837890625,
0.990234375,
-0.486083984375,
0.132568359375,
-1.048828125,
0.0253143310546875,
-0.5107421875,
-0.12548828125,
0.98681640625,
-0.70166015625,
0.53662109375,
0.67529296875,
-0.2069091796875,
0.9951171875,
-0.38330078125,
-0.2314453125,
0.196533203125,
-0.7626953125,
-0.6044921875,
-0.203857421875,
0.4345703125,
-0.3662109375,
0.5078125,
-0.66748046875,
0.2783203125,
0.62841796875,
0.3837890625,
-0.372314453125,
-1.091796875,
-0.407470703125,
-1.0048828125,
-0.60498046875,
-0.724609375,
0.1768798828125,
-0.501953125,
0.0941162109375,
0.44384765625,
-0.8935546875,
0.0860595703125,
0.459716796875,
-0.20751953125,
0.76171875,
-0.8857421875,
0.55712890625,
-0.77978515625,
-0.431396484375,
-0.69921875,
-0.31494140625,
-0.293701171875,
-0.10076904296875,
-0.02752685546875,
0.357666015625,
-0.2342529296875,
0.57568359375,
0.0114898681640625,
0.271728515625,
-0.1741943359375,
-0.392822265625,
0.0226287841796875,
-0.0655517578125,
-0.51513671875,
0.333984375,
0.417724609375,
-0.39306640625,
-0.002941131591796875,
-0.1829833984375,
-0.28564453125,
-0.1292724609375,
0.69921875,
0.68798828125,
0.07733154296875,
0.07086181640625,
-0.134765625,
0.058380126953125,
-0.87255859375,
0.097900390625,
0.08447265625,
0.1146240234375,
0.405517578125,
-0.2900390625,
0.344970703125,
0.9208984375,
-0.1407470703125,
0.56787109375,
-0.1754150390625,
0.46435546875,
0.054656982421875,
-0.11077880859375,
0.042510986328125,
-0.01435089111328125,
0.11993408203125,
0.2462158203125,
0.2435302734375,
0.3720703125,
-0.31787109375,
0.67578125,
-0.146728515625,
-0.8486328125,
-0.77587890625,
-0.2734375,
0.1951904296875,
0.337890625,
0.517578125,
-0.06964111328125,
0.08758544921875,
-0.1776123046875,
-0.64306640625,
0.257568359375,
-1.328125,
-0.1890869140625,
1.171875,
-0.317138671875,
-0.495361328125,
-0.355712890625,
-0.350830078125,
-0.0760498046875,
0.525390625,
0.36328125,
-0.63037109375,
0.0012960433959960938,
0.18408203125,
0.65185546875,
-0.64013671875,
0.492431640625,
-0.0989990234375,
0.308349609375,
-0.46923828125,
-0.186279296875,
0.2044677734375,
1.169921875,
-0.088623046875,
-0.44287109375,
-1.0703125,
-0.07025146484375,
0.272705078125,
-0.35546875,
-0.2147216796875,
0.10748291015625,
-0.1268310546875,
0.338134765625,
-0.78076171875,
0.10601806640625,
-0.08587646484375,
0.379150390625,
0.34521484375,
-0.1864013671875,
-0.67138671875,
0.62109375,
0.751953125,
-0.13671875,
1.0576171875,
-0.042694091796875,
0.385498046875,
0.2388916015625,
0.23291015625,
-0.333984375,
0.91162109375,
0.79052734375,
0.253662109375,
-0.326416015625,
0.487548828125,
0.7529296875,
0.13134765625,
-0.07952880859375,
0.050689697265625,
0.07745361328125,
-0.2335205078125,
0.359375,
-0.30078125,
-0.13134765625,
-0.006511688232421875,
-0.07464599609375,
0.28369140625,
-0.236328125,
-0.04180908203125,
-0.52490234375,
-0.74267578125,
0.52587890625,
-0.3408203125,
0.00322723388671875,
0.279052734375,
-0.69580078125,
0.1109619140625,
0.892578125,
0.0307159423828125,
-0.289794921875,
0.89599609375,
0.2462158203125,
0.50341796875,
0.64501953125,
0.453369140625,
0.556640625,
-0.81201171875,
0.455322265625,
0.2344970703125,
-0.041778564453125,
-0.1734619140625,
-0.298095703125,
-0.8623046875,
0.455322265625,
-0.40478515625,
0.0335693359375,
0.68212890625,
-1.068359375,
0.1898193359375,
-0.137939453125,
0.529296875,
-0.56982421875,
0.2230224609375,
0.152099609375,
-0.62646484375,
-0.71923828125,
1.03515625,
-0.1622314453125,
0.414794921875,
0.0406494140625,
1.201171875,
0.1326904296875,
1.7939453125,
0.483642578125,
-0.1029052734375,
-0.1358642578125,
0.21826171875,
-0.51025390625,
-0.474365234375,
-0.2034912109375,
-0.410400390625,
0.5966796875,
-0.6474609375,
-0.325439453125,
-0.167724609375,
0.8017578125,
0.37744140625,
-1.1416015625,
-0.484375,
0.3603515625,
-0.291259765625,
0.313232421875,
0.406005859375,
0.078857421875,
0.005260467529296875,
0.1578369140625,
0.026397705078125,
-0.76171875,
-0.1376953125,
-0.82275390625,
0.418701171875,
-0.006900787353515625,
-0.7744140625,
-0.43505859375,
-0.8525390625,
-0.114013671875,
0.2176513671875,
-0.448486328125,
-0.7685546875,
0.615234375,
0.5947265625,
0.6572265625,
0.12005615234375,
-0.2359619140625,
-0.249267578125,
1.0556640625,
0.99609375,
0.14892578125,
1.1005859375,
0.42138671875,
-0.1409912109375,
0.256591796875,
-0.37646484375,
0.64208984375,
0.158447265625,
0.085693359375,
-0.30517578125,
-0.421875,
-0.68115234375,
-1.248046875,
0.006504058837890625,
1.0390625,
0.6142578125,
-0.4677734375,
-1.0712890625,
-0.74072265625,
-1.064453125,
-0.04595947265625,
-0.375,
1.021484375,
-0.214111328125,
-0.1588134765625,
0.09527587890625,
-1.3037109375,
4.3359375,
1.2099609375,
0.78564453125,
-0.01035308837890625,
0.0943603515625,
1.01171875,
0.88818359375,
-0.391845703125,
-0.080322265625,
-0.341796875,
0.2486572265625,
-0.485595703125,
0.305419921875,
0.89208984375,
0.03436279296875,
0.59521484375,
-0.6142578125,
-0.23583984375,
0.193115234375,
-0.783203125,
-0.7021484375,
0.367431640625,
0.06170654296875,
0.5556640625,
0.1361083984375,
0.5419921875,
0.67822265625,
-0.7041015625,
0.06689453125,
-0.60302734375,
0.011688232421875,
-0.56201171875,
1.0556640625,
0.1749267578125,
-0.35205078125,
0.369384765625,
-0.09381103515625,
-0.92578125,
-0.208251953125,
0.18701171875,
0.055023193359375,
-0.0330810546875,
0.51708984375,
-0.8154296875,
-0.1273193359375,
0.47412109375,
-0.373291015625,
0.2568359375,
0.48779296875,
-1.044921875,
0.583984375,
-0.6005859375,
0.59033203125,
-0.65576171875,
-0.297119140625,
0.266845703125,
0.60302734375,
-0.15625,
-0.18603515625,
0.5537109375,
0.358154296875,
0.302490234375,
0.0003230571746826172,
0.76904296875,
-0.95166015625,
0.420166015625,
-0.5712890625,
0.5595703125,
-0.11181640625,
0.0233306884765625,
-0.2548828125,
-0.2391357421875,
-0.58642578125,
-0.8095703125,
0.49560546875,
0.275634765625,
-0.2113037109375,
0.54736328125,
0.70751953125,
-0.2462158203125,
-0.2442626953125,
-0.2330322265625,
-0.248291015625,
-0.5771484375,
0.1341552734375,
1.1728515625,
-0.634765625,
-0.3583984375,
-0.372314453125,
0.8564453125,
0.4658203125,
0.4931640625,
0.225830078125,
-0.2724609375,
-0.190673828125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Submitted Solution:
```
#!/usr/bin/python3
# BEGIN template
import sys
import re
import pprint
def dbg(x,y=''):
if len(y) > 0: y += ' = '
sys.stderr.write('\n>>> '+y+pprint.pformat(x)+'\n')
oo = 0x3f3f3f3f3f3f3f3f
# END template
def main():
t = int(input())
for t in range(t):
# input
n = int(input())
users = set(input().split())
m = int(input())
msg = []
for i in range(m):
user, text = input().split(':')
alts = set()
if user != '?':
alts.add(user)
else:
# this shit is pretty fucked up, dude
alts = users - {x for x in re.split(r'[^A-Za-z0-9]+',text)}
msg.append(dict(user=user, text=text, users=alts))
# remove before and after
for i in range(m-1):
if len(msg[i]['users']) == 1:
msg[i+1]['users'].difference_update(msg[i]['users'])
for i in range(m-1,0,-1):
if len(msg[i]['users']) == 1:
msg[i-1]['users'].difference_update(msg[i]['users'])
# compute answer
last = ''
impo = False
for i in range(m):
msg[i]['users'].discard(last)
if len(msg[i]['users']) == 0:
impo = True
break
last = next(iter(msg[i]['users']))
msg[i]['user'] = last
if impo:
print('Impossible')
continue
for i in range(m):
print(msg[i]['user']+':'+msg[i]['text'])
'''
dp = [[0 for j in range(n+5)] for i in range(m+5)]
for i in range(1,n+5):
dp[m+1][i] = oo
for i in range(m,0,-1):
for j in range(n+1):
for k in msg[i]['users']:
if k != j and dp[i+1][k]:
dp[i][j] = k
break
# output
if not dp[1][0]:
print('Impossible')
continue
j = 0
for i in range(1,m+1):
print(users[dp[i][j]]+':'+msg[i]['text'])
j = dp[i][j]'''
main()
```
Yes
| 65,323
|
[
0.475341796875,
-0.2286376953125,
-0.1912841796875,
0.5458984375,
-0.26953125,
-0.75146484375,
-0.5986328125,
0.0175628662109375,
0.12066650390625,
0.59130859375,
0.256103515625,
-0.005313873291015625,
0.2279052734375,
-0.452392578125,
-1.0263671875,
0.00272369384765625,
-0.391357421875,
-0.72705078125,
-0.07281494140625,
-0.059112548828125,
0.44580078125,
0.005245208740234375,
-1.3671875,
-0.501953125,
-0.75537109375,
0.492919921875,
0.1285400390625,
-0.0170135498046875,
0.9677734375,
0.9873046875,
-0.30615234375,
-0.43017578125,
0.151123046875,
-1.3583984375,
-0.2200927734375,
-0.1558837890625,
0.6142578125,
-0.63623046875,
-0.7646484375,
-0.57568359375,
0.11260986328125,
-0.427490234375,
0.77880859375,
-0.85595703125,
-1.3193359375,
0.1746826171875,
-0.282958984375,
-0.1512451171875,
-0.010772705078125,
-0.91259765625,
0.46533203125,
-0.13671875,
0.7626953125,
-0.338623046875,
-0.1329345703125,
-0.67138671875,
-0.43310546875,
0.2509765625,
-0.6533203125,
0.08428955078125,
-0.1590576171875,
0.47119140625,
-0.1168212890625,
-0.58984375,
-0.05694580078125,
-0.11578369140625,
-0.1383056640625,
-0.25732421875,
0.0804443359375,
-0.48876953125,
-0.2086181640625,
0.1656494140625,
-0.73681640625,
-0.369140625,
-0.450439453125,
0.461181640625,
0.12078857421875,
-0.1019287109375,
-0.27099609375,
0.55029296875,
0.0027599334716796875,
1.09375,
0.294677734375,
0.378173828125,
-0.63232421875,
-0.79736328125,
0.5634765625,
0.365478515625,
0.2188720703125,
-0.268310546875,
-0.07275390625,
0.1768798828125,
-0.55419921875,
0.038970947265625,
0.8935546875,
0.468505859375,
0.2012939453125,
0.580078125,
-0.30419921875,
0.3310546875,
0.71923828125,
1.115234375,
-0.25146484375,
1.2177734375,
-0.01258087158203125,
0.1588134765625,
0.2457275390625,
0.1590576171875,
-0.305419921875,
-0.0953369140625,
-0.427734375,
-0.29150390625,
0.529296875,
0.27490234375,
-0.290283203125,
0.74853515625,
0.061737060546875,
-0.2127685546875,
-1.0341796875,
0.180908203125,
0.3017578125,
-0.29736328125,
0.1785888671875,
-0.268310546875,
0.1383056640625,
-0.130126953125,
-0.0183868408203125,
0.9150390625,
-0.52734375,
-0.3544921875,
0.270751953125,
-0.2366943359375,
-0.1021728515625,
0.1690673828125,
-0.1451416015625,
0.485595703125,
-0.422119140625,
0.53759765625,
0.91552734375,
-0.62451171875,
0.64892578125,
-0.1292724609375,
-0.082275390625,
1.4853515625,
0.43408203125,
-0.07257080078125,
0.423583984375,
0.418701171875,
-0.5927734375,
0.2322998046875,
-0.716796875,
0.77880859375,
-0.204345703125,
0.141357421875,
-0.1011962890625,
-0.2646484375,
-0.198486328125,
0.467529296875,
0.24365234375,
0.1734619140625,
-0.448486328125,
-0.11639404296875,
-0.270751953125,
0.9892578125,
-0.044891357421875,
0.947265625,
-0.560546875,
-0.57958984375,
-0.03021240234375,
-0.44287109375,
0.7294921875,
-0.224853515625,
-0.041290283203125,
1.0927734375,
0.84375,
0.9501953125,
0.43603515625,
-0.41943359375,
0.14697265625,
0.051971435546875,
0.115234375,
0.2117919921875,
0.09368896484375,
0.716796875,
0.181884765625,
0.1572265625,
0.365478515625,
-0.8291015625,
-0.7763671875,
-0.6708984375,
0.17529296875,
0.58740234375,
-0.580078125,
0.28125,
0.1488037109375,
-0.08087158203125,
-0.50146484375,
-0.066162109375,
0.10223388671875,
-0.82568359375,
-0.43017578125,
0.73388671875,
-0.3564453125,
0.52001953125,
-0.2666015625,
-0.277587890625,
0.43212890625,
1.4755859375,
-0.06927490234375,
-0.1033935546875,
0.53076171875,
0.257080078125,
-0.104736328125,
-0.27734375,
0.435791015625,
-0.6162109375,
-0.64453125,
0.37939453125,
-0.342041015625,
-0.25634765625,
0.09466552734375,
0.712890625,
0.429931640625,
0.458740234375,
-0.61376953125,
-0.285888671875,
0.2626953125,
1.4033203125,
-0.187255859375,
0.494140625,
0.2227783203125,
0.70849609375,
0.3095703125,
1.060546875,
0.3115234375,
0.0665283203125,
0.7724609375,
0.77734375,
0.072998046875,
0.1820068359375,
-0.0966796875,
0.352783203125,
0.07958984375,
0.38916015625,
0.11767578125,
0.55712890625,
-0.318603515625,
-0.12225341796875,
-0.86669921875,
0.305419921875,
-0.83935546875,
0.5791015625,
0.3876953125,
0.28857421875,
-0.8212890625,
-0.4326171875,
0.548828125,
0.5859375,
-0.732421875,
-0.2342529296875,
-0.063232421875,
0.0099945068359375,
0.303466796875,
-0.04925537109375,
0.057830810546875,
0.3017578125,
0.458984375,
0.50146484375,
-0.2091064453125,
-0.48779296875,
-0.919921875,
-1.0625,
-1.1748046875,
-0.68603515625,
-0.70947265625,
-0.330810546875,
0.2471923828125,
-0.68310546875,
0.1422119140625,
-0.5615234375,
-0.0127716064453125,
0.07421875,
-0.80908203125,
0.591796875,
-0.06854248046875,
0.444580078125,
-0.92919921875,
0.320556640625,
-0.11279296875,
1.02734375,
-0.292724609375,
0.1392822265625,
-0.15869140625,
-0.7177734375,
0.293701171875,
-0.32958984375,
0.37939453125,
-0.08782958984375,
-0.93017578125,
-0.4404296875,
-0.90673828125,
0.030242919921875,
-0.282958984375,
-0.048614501953125,
-0.7373046875,
0.8203125,
0.72314453125,
-0.7568359375,
0.52783203125,
0.673828125,
-0.6044921875,
0.56494140625,
0.446533203125,
0.11163330078125,
-0.55810546875,
0.92529296875,
0.533203125,
0.64892578125,
-0.483154296875,
-0.3779296875,
-0.75439453125,
0.1036376953125,
0.0662841796875,
-0.5205078125,
-0.31640625,
0.08892822265625,
0.187255859375,
-1.1455078125,
0.5693359375,
-1.7109375,
-0.97607421875,
-0.10809326171875,
-0.66796875,
1.1728515625,
0.927734375,
0.047149658203125,
-0.302001953125,
-0.132568359375,
-0.279052734375,
0.462158203125,
0.44873046875,
-0.57763671875,
0.154052734375,
0.953125,
0.033843994140625,
-0.0570068359375,
0.5234375,
-0.6787109375,
-0.146728515625,
-0.1202392578125,
0.1993408203125,
0.64208984375,
0.525390625,
0.036376953125,
0.00847625732421875,
0.865234375,
-0.81298828125,
-0.311767578125,
0.193359375,
0.3623046875,
0.71630859375,
0.2685546875,
0.2283935546875,
-0.147216796875,
-0.72802734375,
-0.77294921875,
0.2242431640625,
0.55322265625,
1.1123046875,
-0.525390625,
0.64013671875,
-0.050262451171875,
-0.857421875,
0.47607421875,
-0.75,
-0.344970703125,
0.8876953125,
-0.01107025146484375,
0.6728515625,
-1.0859375,
-0.07928466796875,
0.127685546875,
0.07379150390625,
0.467041015625,
0.63818359375,
0.6357421875,
-0.58203125,
-0.253173828125,
-0.256591796875,
-0.1943359375,
0.0726318359375,
-0.45361328125,
-0.444091796875,
-0.270751953125,
-0.5126953125,
-1.080078125,
0.521484375,
0.5693359375,
0.75830078125,
0.1619873046875,
0.79541015625,
0.02484130859375,
0.89990234375,
0.68701171875,
-0.43505859375,
0.052276611328125,
-0.7216796875,
0.6923828125,
0.444580078125,
-0.338623046875,
-0.430419921875,
-0.29931640625,
-0.06585693359375,
-0.11260986328125,
0.195068359375,
-0.331298828125,
-0.5712890625,
0.0877685546875,
-0.04571533203125,
0.74169921875,
-0.39208984375,
-0.59375,
-0.077880859375,
0.318603515625,
0.4130859375,
-0.460693359375,
0.2047119140625,
-0.64599609375,
0.63818359375,
0.8525390625,
-0.03179931640625,
-0.57275390625,
-0.47412109375,
-0.94580078125,
-0.783203125,
0.1729736328125,
0.8125,
-0.5927734375,
-0.072021484375,
-1.3701171875,
0.50634765625,
0.306640625,
-0.386474609375,
0.10009765625,
-0.10064697265625,
0.292724609375,
0.1422119140625,
0.69580078125,
-0.08233642578125,
-0.42822265625,
0.2489013671875,
-0.6025390625,
0.57568359375,
-0.70947265625,
0.2138671875,
-0.07012939453125,
0.02850341796875,
0.03765869140625,
0.8056640625,
-0.0177001953125,
0.365478515625,
-0.10858154296875,
0.1080322265625,
-0.986328125,
-0.57470703125,
0.439697265625,
0.2340087890625,
-0.45947265625,
0.37255859375,
0.234619140625,
-0.50341796875,
0.25244140625,
0.428955078125,
-0.322021484375,
0.59716796875,
-0.67333984375,
0.619140625,
-0.29296875,
-0.398681640625,
-0.057281494140625,
-0.53271484375,
0.5146484375,
0.0843505859375,
-0.984375,
-0.1619873046875,
-0.9541015625,
-0.170166015625,
-0.2369384765625,
-0.54541015625,
0.432373046875,
0.1590576171875,
0.0283966064453125,
-0.1982421875,
0.00977325439453125,
-0.92041015625,
0.01119232177734375,
-0.5634765625,
-0.244140625,
0.40673828125,
0.11676025390625,
0.62890625,
-0.05255126953125,
-0.46044921875,
0.308837890625,
-0.2374267578125,
0.247802734375,
-0.342041015625,
-0.441650390625,
0.223876953125,
-0.17724609375,
-0.436279296875,
0.374267578125,
-0.6357421875,
0.28662109375,
0.8515625,
-0.035430908203125,
0.32275390625,
0.051605224609375,
-0.53173828125,
0.76904296875,
0.0687255859375,
-1.2099609375,
-0.235595703125,
0.63037109375,
-0.384765625,
0.548828125,
0.73486328125,
-1.126953125,
-0.5224609375,
-0.90087890625,
0.182373046875,
-1.08984375,
-0.16943359375,
-0.8916015625,
-0.160888671875,
-0.450927734375,
0.9501953125,
0.01358795166015625,
-0.6484375,
-0.31005859375,
-1.0537109375,
0.484130859375,
-0.74462890625,
-0.1492919921875,
-0.191650390625,
-0.158447265625,
-0.25341796875,
1.171875,
0.304931640625,
0.2230224609375,
-0.143310546875,
0.00823211669921875,
0.349609375,
-0.06298828125,
-0.421630859375,
-0.22119140625,
0.1849365234375,
0.07354736328125,
-0.454833984375,
0.3466796875,
-0.759765625,
0.578125,
-0.53125,
-0.09271240234375,
0.1268310546875,
-0.5859375,
0.007415771484375,
-0.06292724609375,
1.154296875,
-0.59619140625,
-0.044036865234375,
-0.3447265625,
0.250244140625,
0.61767578125,
-0.2734375,
-0.55712890625,
-0.69775390625,
-0.830078125,
-1.16796875,
0.6181640625,
-0.335693359375,
-0.06439208984375,
-0.2548828125,
-0.2021484375,
1.0263671875,
-0.5263671875,
0.31982421875,
1.4306640625,
0.402587890625,
0.2027587890625,
-0.7451171875,
0.73681640625,
0.32470703125,
-0.497802734375,
-0.273681640625,
0.11676025390625,
-0.83740234375,
0.1561279296875,
-0.397216796875,
-0.9169921875,
-0.5810546875,
-0.0243072509765625,
0.955078125,
-0.41650390625,
1.130859375,
0.144287109375,
-1.0703125,
-0.9111328125,
0.55078125,
0.13427734375,
0.113037109375,
0.728515625,
0.1214599609375,
0.169921875,
0.024322509765625,
0.1558837890625,
-0.08978271484375,
-0.623046875,
1.1875,
0.10418701171875,
-0.362060546875,
0.84765625,
0.97802734375,
-0.888671875,
-0.935546875,
-0.05364990234375,
-0.01110076904296875,
-0.2197265625,
-0.8740234375,
-0.14013671875,
0.66162109375,
-0.77490234375,
0.36279296875,
0.9052734375,
0.06744384765625,
0.11468505859375,
0.027008056640625,
0.3681640625,
-0.76171875,
0.8837890625,
0.990234375,
-0.486083984375,
0.132568359375,
-1.048828125,
0.0253143310546875,
-0.5107421875,
-0.12548828125,
0.98681640625,
-0.70166015625,
0.53662109375,
0.67529296875,
-0.2069091796875,
0.9951171875,
-0.38330078125,
-0.2314453125,
0.196533203125,
-0.7626953125,
-0.6044921875,
-0.203857421875,
0.4345703125,
-0.3662109375,
0.5078125,
-0.66748046875,
0.2783203125,
0.62841796875,
0.3837890625,
-0.372314453125,
-1.091796875,
-0.407470703125,
-1.0048828125,
-0.60498046875,
-0.724609375,
0.1768798828125,
-0.501953125,
0.0941162109375,
0.44384765625,
-0.8935546875,
0.0860595703125,
0.459716796875,
-0.20751953125,
0.76171875,
-0.8857421875,
0.55712890625,
-0.77978515625,
-0.431396484375,
-0.69921875,
-0.31494140625,
-0.293701171875,
-0.10076904296875,
-0.02752685546875,
0.357666015625,
-0.2342529296875,
0.57568359375,
0.0114898681640625,
0.271728515625,
-0.1741943359375,
-0.392822265625,
0.0226287841796875,
-0.0655517578125,
-0.51513671875,
0.333984375,
0.417724609375,
-0.39306640625,
-0.002941131591796875,
-0.1829833984375,
-0.28564453125,
-0.1292724609375,
0.69921875,
0.68798828125,
0.07733154296875,
0.07086181640625,
-0.134765625,
0.058380126953125,
-0.87255859375,
0.097900390625,
0.08447265625,
0.1146240234375,
0.405517578125,
-0.2900390625,
0.344970703125,
0.9208984375,
-0.1407470703125,
0.56787109375,
-0.1754150390625,
0.46435546875,
0.054656982421875,
-0.11077880859375,
0.042510986328125,
-0.01435089111328125,
0.11993408203125,
0.2462158203125,
0.2435302734375,
0.3720703125,
-0.31787109375,
0.67578125,
-0.146728515625,
-0.8486328125,
-0.77587890625,
-0.2734375,
0.1951904296875,
0.337890625,
0.517578125,
-0.06964111328125,
0.08758544921875,
-0.1776123046875,
-0.64306640625,
0.257568359375,
-1.328125,
-0.1890869140625,
1.171875,
-0.317138671875,
-0.495361328125,
-0.355712890625,
-0.350830078125,
-0.0760498046875,
0.525390625,
0.36328125,
-0.63037109375,
0.0012960433959960938,
0.18408203125,
0.65185546875,
-0.64013671875,
0.492431640625,
-0.0989990234375,
0.308349609375,
-0.46923828125,
-0.186279296875,
0.2044677734375,
1.169921875,
-0.088623046875,
-0.44287109375,
-1.0703125,
-0.07025146484375,
0.272705078125,
-0.35546875,
-0.2147216796875,
0.10748291015625,
-0.1268310546875,
0.338134765625,
-0.78076171875,
0.10601806640625,
-0.08587646484375,
0.379150390625,
0.34521484375,
-0.1864013671875,
-0.67138671875,
0.62109375,
0.751953125,
-0.13671875,
1.0576171875,
-0.042694091796875,
0.385498046875,
0.2388916015625,
0.23291015625,
-0.333984375,
0.91162109375,
0.79052734375,
0.253662109375,
-0.326416015625,
0.487548828125,
0.7529296875,
0.13134765625,
-0.07952880859375,
0.050689697265625,
0.07745361328125,
-0.2335205078125,
0.359375,
-0.30078125,
-0.13134765625,
-0.006511688232421875,
-0.07464599609375,
0.28369140625,
-0.236328125,
-0.04180908203125,
-0.52490234375,
-0.74267578125,
0.52587890625,
-0.3408203125,
0.00322723388671875,
0.279052734375,
-0.69580078125,
0.1109619140625,
0.892578125,
0.0307159423828125,
-0.289794921875,
0.89599609375,
0.2462158203125,
0.50341796875,
0.64501953125,
0.453369140625,
0.556640625,
-0.81201171875,
0.455322265625,
0.2344970703125,
-0.041778564453125,
-0.1734619140625,
-0.298095703125,
-0.8623046875,
0.455322265625,
-0.40478515625,
0.0335693359375,
0.68212890625,
-1.068359375,
0.1898193359375,
-0.137939453125,
0.529296875,
-0.56982421875,
0.2230224609375,
0.152099609375,
-0.62646484375,
-0.71923828125,
1.03515625,
-0.1622314453125,
0.414794921875,
0.0406494140625,
1.201171875,
0.1326904296875,
1.7939453125,
0.483642578125,
-0.1029052734375,
-0.1358642578125,
0.21826171875,
-0.51025390625,
-0.474365234375,
-0.2034912109375,
-0.410400390625,
0.5966796875,
-0.6474609375,
-0.325439453125,
-0.167724609375,
0.8017578125,
0.37744140625,
-1.1416015625,
-0.484375,
0.3603515625,
-0.291259765625,
0.313232421875,
0.406005859375,
0.078857421875,
0.005260467529296875,
0.1578369140625,
0.026397705078125,
-0.76171875,
-0.1376953125,
-0.82275390625,
0.418701171875,
-0.006900787353515625,
-0.7744140625,
-0.43505859375,
-0.8525390625,
-0.114013671875,
0.2176513671875,
-0.448486328125,
-0.7685546875,
0.615234375,
0.5947265625,
0.6572265625,
0.12005615234375,
-0.2359619140625,
-0.249267578125,
1.0556640625,
0.99609375,
0.14892578125,
1.1005859375,
0.42138671875,
-0.1409912109375,
0.256591796875,
-0.37646484375,
0.64208984375,
0.158447265625,
0.085693359375,
-0.30517578125,
-0.421875,
-0.68115234375,
-1.248046875,
0.006504058837890625,
1.0390625,
0.6142578125,
-0.4677734375,
-1.0712890625,
-0.74072265625,
-1.064453125,
-0.04595947265625,
-0.375,
1.021484375,
-0.214111328125,
-0.1588134765625,
0.09527587890625,
-1.3037109375,
4.3359375,
1.2099609375,
0.78564453125,
-0.01035308837890625,
0.0943603515625,
1.01171875,
0.88818359375,
-0.391845703125,
-0.080322265625,
-0.341796875,
0.2486572265625,
-0.485595703125,
0.305419921875,
0.89208984375,
0.03436279296875,
0.59521484375,
-0.6142578125,
-0.23583984375,
0.193115234375,
-0.783203125,
-0.7021484375,
0.367431640625,
0.06170654296875,
0.5556640625,
0.1361083984375,
0.5419921875,
0.67822265625,
-0.7041015625,
0.06689453125,
-0.60302734375,
0.011688232421875,
-0.56201171875,
1.0556640625,
0.1749267578125,
-0.35205078125,
0.369384765625,
-0.09381103515625,
-0.92578125,
-0.208251953125,
0.18701171875,
0.055023193359375,
-0.0330810546875,
0.51708984375,
-0.8154296875,
-0.1273193359375,
0.47412109375,
-0.373291015625,
0.2568359375,
0.48779296875,
-1.044921875,
0.583984375,
-0.6005859375,
0.59033203125,
-0.65576171875,
-0.297119140625,
0.266845703125,
0.60302734375,
-0.15625,
-0.18603515625,
0.5537109375,
0.358154296875,
0.302490234375,
0.0003230571746826172,
0.76904296875,
-0.95166015625,
0.420166015625,
-0.5712890625,
0.5595703125,
-0.11181640625,
0.0233306884765625,
-0.2548828125,
-0.2391357421875,
-0.58642578125,
-0.8095703125,
0.49560546875,
0.275634765625,
-0.2113037109375,
0.54736328125,
0.70751953125,
-0.2462158203125,
-0.2442626953125,
-0.2330322265625,
-0.248291015625,
-0.5771484375,
0.1341552734375,
1.1728515625,
-0.634765625,
-0.3583984375,
-0.372314453125,
0.8564453125,
0.4658203125,
0.4931640625,
0.225830078125,
-0.2724609375,
-0.190673828125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Submitted Solution:
```
#!/usr/bin/python3
# BEGIN template
import sys
import re
import pprint
def dbg(x,y=''):
if len(y) > 0: y += ' = '
sys.stderr.write('\n>>> '+y+pprint.pformat(x)+'\n')
oo = 0x3f3f3f3f3f3f3f3f
# END template
def main():
for t in range(int(input())):
# input
n = int(input())
users = input().split()
users_set = set(users)
users.insert(0,'0')
m = int(input())
msg = [None]*(m+5)
for i in range(1,m+1):
user, text = input().split(':')
alts = set()
if user != '?':
user = users.index(user)
alts.add(user)
else:
# this shit is pretty fucked up, dude
for alt in users_set - set(re.split('[^A-Za-z0-9]+',text)):
alts.add(users.index(alt))
msg[i] = dict(user=user, text=text, users=alts)
# remove before and after
for i in range(1,m):
if len(msg[i]['users']) == 1:
msg[i+1]['users'].difference_update(msg[i]['users'])
for i in range(m,1,-1):
if len(msg[i]['users']) == 1:
msg[i-1]['users'].difference_update(msg[i]['users'])
'''removed = True
while removed:
removed = False
for i in range(1,m+1):
if 1 <= i-1:
bef = len(msg[i]['users'])
msg[i]['users'].discard(msg[i-1]['user'])
if len(msg[i]['users']) < bef: removed = True
if i+1 <= m:
bef = len(msg[i]['users'])
msg[i]['users'].discard(msg[i+1]['user'])
if len(msg[i]['users']) < bef: removed = True'''
# compute answer
impo = False
last = 0
for i in range(1,m+1):
msg[i]['users'].discard(last)
if len(msg[i]['users']) == 0:
impo = True
break
last = next(iter(msg[i]['users']))
msg[i]['user'] = last
# output
if impo:
print('Impossible')
continue
for i in range(1,m+1):
print(users[msg[i]['user']]+':'+msg[i]['text'])
main()
```
Yes
| 65,324
|
[
0.475341796875,
-0.2286376953125,
-0.1912841796875,
0.5458984375,
-0.26953125,
-0.75146484375,
-0.5986328125,
0.0175628662109375,
0.12066650390625,
0.59130859375,
0.256103515625,
-0.005313873291015625,
0.2279052734375,
-0.452392578125,
-1.0263671875,
0.00272369384765625,
-0.391357421875,
-0.72705078125,
-0.07281494140625,
-0.059112548828125,
0.44580078125,
0.005245208740234375,
-1.3671875,
-0.501953125,
-0.75537109375,
0.492919921875,
0.1285400390625,
-0.0170135498046875,
0.9677734375,
0.9873046875,
-0.30615234375,
-0.43017578125,
0.151123046875,
-1.3583984375,
-0.2200927734375,
-0.1558837890625,
0.6142578125,
-0.63623046875,
-0.7646484375,
-0.57568359375,
0.11260986328125,
-0.427490234375,
0.77880859375,
-0.85595703125,
-1.3193359375,
0.1746826171875,
-0.282958984375,
-0.1512451171875,
-0.010772705078125,
-0.91259765625,
0.46533203125,
-0.13671875,
0.7626953125,
-0.338623046875,
-0.1329345703125,
-0.67138671875,
-0.43310546875,
0.2509765625,
-0.6533203125,
0.08428955078125,
-0.1590576171875,
0.47119140625,
-0.1168212890625,
-0.58984375,
-0.05694580078125,
-0.11578369140625,
-0.1383056640625,
-0.25732421875,
0.0804443359375,
-0.48876953125,
-0.2086181640625,
0.1656494140625,
-0.73681640625,
-0.369140625,
-0.450439453125,
0.461181640625,
0.12078857421875,
-0.1019287109375,
-0.27099609375,
0.55029296875,
0.0027599334716796875,
1.09375,
0.294677734375,
0.378173828125,
-0.63232421875,
-0.79736328125,
0.5634765625,
0.365478515625,
0.2188720703125,
-0.268310546875,
-0.07275390625,
0.1768798828125,
-0.55419921875,
0.038970947265625,
0.8935546875,
0.468505859375,
0.2012939453125,
0.580078125,
-0.30419921875,
0.3310546875,
0.71923828125,
1.115234375,
-0.25146484375,
1.2177734375,
-0.01258087158203125,
0.1588134765625,
0.2457275390625,
0.1590576171875,
-0.305419921875,
-0.0953369140625,
-0.427734375,
-0.29150390625,
0.529296875,
0.27490234375,
-0.290283203125,
0.74853515625,
0.061737060546875,
-0.2127685546875,
-1.0341796875,
0.180908203125,
0.3017578125,
-0.29736328125,
0.1785888671875,
-0.268310546875,
0.1383056640625,
-0.130126953125,
-0.0183868408203125,
0.9150390625,
-0.52734375,
-0.3544921875,
0.270751953125,
-0.2366943359375,
-0.1021728515625,
0.1690673828125,
-0.1451416015625,
0.485595703125,
-0.422119140625,
0.53759765625,
0.91552734375,
-0.62451171875,
0.64892578125,
-0.1292724609375,
-0.082275390625,
1.4853515625,
0.43408203125,
-0.07257080078125,
0.423583984375,
0.418701171875,
-0.5927734375,
0.2322998046875,
-0.716796875,
0.77880859375,
-0.204345703125,
0.141357421875,
-0.1011962890625,
-0.2646484375,
-0.198486328125,
0.467529296875,
0.24365234375,
0.1734619140625,
-0.448486328125,
-0.11639404296875,
-0.270751953125,
0.9892578125,
-0.044891357421875,
0.947265625,
-0.560546875,
-0.57958984375,
-0.03021240234375,
-0.44287109375,
0.7294921875,
-0.224853515625,
-0.041290283203125,
1.0927734375,
0.84375,
0.9501953125,
0.43603515625,
-0.41943359375,
0.14697265625,
0.051971435546875,
0.115234375,
0.2117919921875,
0.09368896484375,
0.716796875,
0.181884765625,
0.1572265625,
0.365478515625,
-0.8291015625,
-0.7763671875,
-0.6708984375,
0.17529296875,
0.58740234375,
-0.580078125,
0.28125,
0.1488037109375,
-0.08087158203125,
-0.50146484375,
-0.066162109375,
0.10223388671875,
-0.82568359375,
-0.43017578125,
0.73388671875,
-0.3564453125,
0.52001953125,
-0.2666015625,
-0.277587890625,
0.43212890625,
1.4755859375,
-0.06927490234375,
-0.1033935546875,
0.53076171875,
0.257080078125,
-0.104736328125,
-0.27734375,
0.435791015625,
-0.6162109375,
-0.64453125,
0.37939453125,
-0.342041015625,
-0.25634765625,
0.09466552734375,
0.712890625,
0.429931640625,
0.458740234375,
-0.61376953125,
-0.285888671875,
0.2626953125,
1.4033203125,
-0.187255859375,
0.494140625,
0.2227783203125,
0.70849609375,
0.3095703125,
1.060546875,
0.3115234375,
0.0665283203125,
0.7724609375,
0.77734375,
0.072998046875,
0.1820068359375,
-0.0966796875,
0.352783203125,
0.07958984375,
0.38916015625,
0.11767578125,
0.55712890625,
-0.318603515625,
-0.12225341796875,
-0.86669921875,
0.305419921875,
-0.83935546875,
0.5791015625,
0.3876953125,
0.28857421875,
-0.8212890625,
-0.4326171875,
0.548828125,
0.5859375,
-0.732421875,
-0.2342529296875,
-0.063232421875,
0.0099945068359375,
0.303466796875,
-0.04925537109375,
0.057830810546875,
0.3017578125,
0.458984375,
0.50146484375,
-0.2091064453125,
-0.48779296875,
-0.919921875,
-1.0625,
-1.1748046875,
-0.68603515625,
-0.70947265625,
-0.330810546875,
0.2471923828125,
-0.68310546875,
0.1422119140625,
-0.5615234375,
-0.0127716064453125,
0.07421875,
-0.80908203125,
0.591796875,
-0.06854248046875,
0.444580078125,
-0.92919921875,
0.320556640625,
-0.11279296875,
1.02734375,
-0.292724609375,
0.1392822265625,
-0.15869140625,
-0.7177734375,
0.293701171875,
-0.32958984375,
0.37939453125,
-0.08782958984375,
-0.93017578125,
-0.4404296875,
-0.90673828125,
0.030242919921875,
-0.282958984375,
-0.048614501953125,
-0.7373046875,
0.8203125,
0.72314453125,
-0.7568359375,
0.52783203125,
0.673828125,
-0.6044921875,
0.56494140625,
0.446533203125,
0.11163330078125,
-0.55810546875,
0.92529296875,
0.533203125,
0.64892578125,
-0.483154296875,
-0.3779296875,
-0.75439453125,
0.1036376953125,
0.0662841796875,
-0.5205078125,
-0.31640625,
0.08892822265625,
0.187255859375,
-1.1455078125,
0.5693359375,
-1.7109375,
-0.97607421875,
-0.10809326171875,
-0.66796875,
1.1728515625,
0.927734375,
0.047149658203125,
-0.302001953125,
-0.132568359375,
-0.279052734375,
0.462158203125,
0.44873046875,
-0.57763671875,
0.154052734375,
0.953125,
0.033843994140625,
-0.0570068359375,
0.5234375,
-0.6787109375,
-0.146728515625,
-0.1202392578125,
0.1993408203125,
0.64208984375,
0.525390625,
0.036376953125,
0.00847625732421875,
0.865234375,
-0.81298828125,
-0.311767578125,
0.193359375,
0.3623046875,
0.71630859375,
0.2685546875,
0.2283935546875,
-0.147216796875,
-0.72802734375,
-0.77294921875,
0.2242431640625,
0.55322265625,
1.1123046875,
-0.525390625,
0.64013671875,
-0.050262451171875,
-0.857421875,
0.47607421875,
-0.75,
-0.344970703125,
0.8876953125,
-0.01107025146484375,
0.6728515625,
-1.0859375,
-0.07928466796875,
0.127685546875,
0.07379150390625,
0.467041015625,
0.63818359375,
0.6357421875,
-0.58203125,
-0.253173828125,
-0.256591796875,
-0.1943359375,
0.0726318359375,
-0.45361328125,
-0.444091796875,
-0.270751953125,
-0.5126953125,
-1.080078125,
0.521484375,
0.5693359375,
0.75830078125,
0.1619873046875,
0.79541015625,
0.02484130859375,
0.89990234375,
0.68701171875,
-0.43505859375,
0.052276611328125,
-0.7216796875,
0.6923828125,
0.444580078125,
-0.338623046875,
-0.430419921875,
-0.29931640625,
-0.06585693359375,
-0.11260986328125,
0.195068359375,
-0.331298828125,
-0.5712890625,
0.0877685546875,
-0.04571533203125,
0.74169921875,
-0.39208984375,
-0.59375,
-0.077880859375,
0.318603515625,
0.4130859375,
-0.460693359375,
0.2047119140625,
-0.64599609375,
0.63818359375,
0.8525390625,
-0.03179931640625,
-0.57275390625,
-0.47412109375,
-0.94580078125,
-0.783203125,
0.1729736328125,
0.8125,
-0.5927734375,
-0.072021484375,
-1.3701171875,
0.50634765625,
0.306640625,
-0.386474609375,
0.10009765625,
-0.10064697265625,
0.292724609375,
0.1422119140625,
0.69580078125,
-0.08233642578125,
-0.42822265625,
0.2489013671875,
-0.6025390625,
0.57568359375,
-0.70947265625,
0.2138671875,
-0.07012939453125,
0.02850341796875,
0.03765869140625,
0.8056640625,
-0.0177001953125,
0.365478515625,
-0.10858154296875,
0.1080322265625,
-0.986328125,
-0.57470703125,
0.439697265625,
0.2340087890625,
-0.45947265625,
0.37255859375,
0.234619140625,
-0.50341796875,
0.25244140625,
0.428955078125,
-0.322021484375,
0.59716796875,
-0.67333984375,
0.619140625,
-0.29296875,
-0.398681640625,
-0.057281494140625,
-0.53271484375,
0.5146484375,
0.0843505859375,
-0.984375,
-0.1619873046875,
-0.9541015625,
-0.170166015625,
-0.2369384765625,
-0.54541015625,
0.432373046875,
0.1590576171875,
0.0283966064453125,
-0.1982421875,
0.00977325439453125,
-0.92041015625,
0.01119232177734375,
-0.5634765625,
-0.244140625,
0.40673828125,
0.11676025390625,
0.62890625,
-0.05255126953125,
-0.46044921875,
0.308837890625,
-0.2374267578125,
0.247802734375,
-0.342041015625,
-0.441650390625,
0.223876953125,
-0.17724609375,
-0.436279296875,
0.374267578125,
-0.6357421875,
0.28662109375,
0.8515625,
-0.035430908203125,
0.32275390625,
0.051605224609375,
-0.53173828125,
0.76904296875,
0.0687255859375,
-1.2099609375,
-0.235595703125,
0.63037109375,
-0.384765625,
0.548828125,
0.73486328125,
-1.126953125,
-0.5224609375,
-0.90087890625,
0.182373046875,
-1.08984375,
-0.16943359375,
-0.8916015625,
-0.160888671875,
-0.450927734375,
0.9501953125,
0.01358795166015625,
-0.6484375,
-0.31005859375,
-1.0537109375,
0.484130859375,
-0.74462890625,
-0.1492919921875,
-0.191650390625,
-0.158447265625,
-0.25341796875,
1.171875,
0.304931640625,
0.2230224609375,
-0.143310546875,
0.00823211669921875,
0.349609375,
-0.06298828125,
-0.421630859375,
-0.22119140625,
0.1849365234375,
0.07354736328125,
-0.454833984375,
0.3466796875,
-0.759765625,
0.578125,
-0.53125,
-0.09271240234375,
0.1268310546875,
-0.5859375,
0.007415771484375,
-0.06292724609375,
1.154296875,
-0.59619140625,
-0.044036865234375,
-0.3447265625,
0.250244140625,
0.61767578125,
-0.2734375,
-0.55712890625,
-0.69775390625,
-0.830078125,
-1.16796875,
0.6181640625,
-0.335693359375,
-0.06439208984375,
-0.2548828125,
-0.2021484375,
1.0263671875,
-0.5263671875,
0.31982421875,
1.4306640625,
0.402587890625,
0.2027587890625,
-0.7451171875,
0.73681640625,
0.32470703125,
-0.497802734375,
-0.273681640625,
0.11676025390625,
-0.83740234375,
0.1561279296875,
-0.397216796875,
-0.9169921875,
-0.5810546875,
-0.0243072509765625,
0.955078125,
-0.41650390625,
1.130859375,
0.144287109375,
-1.0703125,
-0.9111328125,
0.55078125,
0.13427734375,
0.113037109375,
0.728515625,
0.1214599609375,
0.169921875,
0.024322509765625,
0.1558837890625,
-0.08978271484375,
-0.623046875,
1.1875,
0.10418701171875,
-0.362060546875,
0.84765625,
0.97802734375,
-0.888671875,
-0.935546875,
-0.05364990234375,
-0.01110076904296875,
-0.2197265625,
-0.8740234375,
-0.14013671875,
0.66162109375,
-0.77490234375,
0.36279296875,
0.9052734375,
0.06744384765625,
0.11468505859375,
0.027008056640625,
0.3681640625,
-0.76171875,
0.8837890625,
0.990234375,
-0.486083984375,
0.132568359375,
-1.048828125,
0.0253143310546875,
-0.5107421875,
-0.12548828125,
0.98681640625,
-0.70166015625,
0.53662109375,
0.67529296875,
-0.2069091796875,
0.9951171875,
-0.38330078125,
-0.2314453125,
0.196533203125,
-0.7626953125,
-0.6044921875,
-0.203857421875,
0.4345703125,
-0.3662109375,
0.5078125,
-0.66748046875,
0.2783203125,
0.62841796875,
0.3837890625,
-0.372314453125,
-1.091796875,
-0.407470703125,
-1.0048828125,
-0.60498046875,
-0.724609375,
0.1768798828125,
-0.501953125,
0.0941162109375,
0.44384765625,
-0.8935546875,
0.0860595703125,
0.459716796875,
-0.20751953125,
0.76171875,
-0.8857421875,
0.55712890625,
-0.77978515625,
-0.431396484375,
-0.69921875,
-0.31494140625,
-0.293701171875,
-0.10076904296875,
-0.02752685546875,
0.357666015625,
-0.2342529296875,
0.57568359375,
0.0114898681640625,
0.271728515625,
-0.1741943359375,
-0.392822265625,
0.0226287841796875,
-0.0655517578125,
-0.51513671875,
0.333984375,
0.417724609375,
-0.39306640625,
-0.002941131591796875,
-0.1829833984375,
-0.28564453125,
-0.1292724609375,
0.69921875,
0.68798828125,
0.07733154296875,
0.07086181640625,
-0.134765625,
0.058380126953125,
-0.87255859375,
0.097900390625,
0.08447265625,
0.1146240234375,
0.405517578125,
-0.2900390625,
0.344970703125,
0.9208984375,
-0.1407470703125,
0.56787109375,
-0.1754150390625,
0.46435546875,
0.054656982421875,
-0.11077880859375,
0.042510986328125,
-0.01435089111328125,
0.11993408203125,
0.2462158203125,
0.2435302734375,
0.3720703125,
-0.31787109375,
0.67578125,
-0.146728515625,
-0.8486328125,
-0.77587890625,
-0.2734375,
0.1951904296875,
0.337890625,
0.517578125,
-0.06964111328125,
0.08758544921875,
-0.1776123046875,
-0.64306640625,
0.257568359375,
-1.328125,
-0.1890869140625,
1.171875,
-0.317138671875,
-0.495361328125,
-0.355712890625,
-0.350830078125,
-0.0760498046875,
0.525390625,
0.36328125,
-0.63037109375,
0.0012960433959960938,
0.18408203125,
0.65185546875,
-0.64013671875,
0.492431640625,
-0.0989990234375,
0.308349609375,
-0.46923828125,
-0.186279296875,
0.2044677734375,
1.169921875,
-0.088623046875,
-0.44287109375,
-1.0703125,
-0.07025146484375,
0.272705078125,
-0.35546875,
-0.2147216796875,
0.10748291015625,
-0.1268310546875,
0.338134765625,
-0.78076171875,
0.10601806640625,
-0.08587646484375,
0.379150390625,
0.34521484375,
-0.1864013671875,
-0.67138671875,
0.62109375,
0.751953125,
-0.13671875,
1.0576171875,
-0.042694091796875,
0.385498046875,
0.2388916015625,
0.23291015625,
-0.333984375,
0.91162109375,
0.79052734375,
0.253662109375,
-0.326416015625,
0.487548828125,
0.7529296875,
0.13134765625,
-0.07952880859375,
0.050689697265625,
0.07745361328125,
-0.2335205078125,
0.359375,
-0.30078125,
-0.13134765625,
-0.006511688232421875,
-0.07464599609375,
0.28369140625,
-0.236328125,
-0.04180908203125,
-0.52490234375,
-0.74267578125,
0.52587890625,
-0.3408203125,
0.00322723388671875,
0.279052734375,
-0.69580078125,
0.1109619140625,
0.892578125,
0.0307159423828125,
-0.289794921875,
0.89599609375,
0.2462158203125,
0.50341796875,
0.64501953125,
0.453369140625,
0.556640625,
-0.81201171875,
0.455322265625,
0.2344970703125,
-0.041778564453125,
-0.1734619140625,
-0.298095703125,
-0.8623046875,
0.455322265625,
-0.40478515625,
0.0335693359375,
0.68212890625,
-1.068359375,
0.1898193359375,
-0.137939453125,
0.529296875,
-0.56982421875,
0.2230224609375,
0.152099609375,
-0.62646484375,
-0.71923828125,
1.03515625,
-0.1622314453125,
0.414794921875,
0.0406494140625,
1.201171875,
0.1326904296875,
1.7939453125,
0.483642578125,
-0.1029052734375,
-0.1358642578125,
0.21826171875,
-0.51025390625,
-0.474365234375,
-0.2034912109375,
-0.410400390625,
0.5966796875,
-0.6474609375,
-0.325439453125,
-0.167724609375,
0.8017578125,
0.37744140625,
-1.1416015625,
-0.484375,
0.3603515625,
-0.291259765625,
0.313232421875,
0.406005859375,
0.078857421875,
0.005260467529296875,
0.1578369140625,
0.026397705078125,
-0.76171875,
-0.1376953125,
-0.82275390625,
0.418701171875,
-0.006900787353515625,
-0.7744140625,
-0.43505859375,
-0.8525390625,
-0.114013671875,
0.2176513671875,
-0.448486328125,
-0.7685546875,
0.615234375,
0.5947265625,
0.6572265625,
0.12005615234375,
-0.2359619140625,
-0.249267578125,
1.0556640625,
0.99609375,
0.14892578125,
1.1005859375,
0.42138671875,
-0.1409912109375,
0.256591796875,
-0.37646484375,
0.64208984375,
0.158447265625,
0.085693359375,
-0.30517578125,
-0.421875,
-0.68115234375,
-1.248046875,
0.006504058837890625,
1.0390625,
0.6142578125,
-0.4677734375,
-1.0712890625,
-0.74072265625,
-1.064453125,
-0.04595947265625,
-0.375,
1.021484375,
-0.214111328125,
-0.1588134765625,
0.09527587890625,
-1.3037109375,
4.3359375,
1.2099609375,
0.78564453125,
-0.01035308837890625,
0.0943603515625,
1.01171875,
0.88818359375,
-0.391845703125,
-0.080322265625,
-0.341796875,
0.2486572265625,
-0.485595703125,
0.305419921875,
0.89208984375,
0.03436279296875,
0.59521484375,
-0.6142578125,
-0.23583984375,
0.193115234375,
-0.783203125,
-0.7021484375,
0.367431640625,
0.06170654296875,
0.5556640625,
0.1361083984375,
0.5419921875,
0.67822265625,
-0.7041015625,
0.06689453125,
-0.60302734375,
0.011688232421875,
-0.56201171875,
1.0556640625,
0.1749267578125,
-0.35205078125,
0.369384765625,
-0.09381103515625,
-0.92578125,
-0.208251953125,
0.18701171875,
0.055023193359375,
-0.0330810546875,
0.51708984375,
-0.8154296875,
-0.1273193359375,
0.47412109375,
-0.373291015625,
0.2568359375,
0.48779296875,
-1.044921875,
0.583984375,
-0.6005859375,
0.59033203125,
-0.65576171875,
-0.297119140625,
0.266845703125,
0.60302734375,
-0.15625,
-0.18603515625,
0.5537109375,
0.358154296875,
0.302490234375,
0.0003230571746826172,
0.76904296875,
-0.95166015625,
0.420166015625,
-0.5712890625,
0.5595703125,
-0.11181640625,
0.0233306884765625,
-0.2548828125,
-0.2391357421875,
-0.58642578125,
-0.8095703125,
0.49560546875,
0.275634765625,
-0.2113037109375,
0.54736328125,
0.70751953125,
-0.2462158203125,
-0.2442626953125,
-0.2330322265625,
-0.248291015625,
-0.5771484375,
0.1341552734375,
1.1728515625,
-0.634765625,
-0.3583984375,
-0.372314453125,
0.8564453125,
0.4658203125,
0.4931640625,
0.225830078125,
-0.2724609375,
-0.190673828125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Submitted Solution:
```
#!/usr/bin/python3
# BEGIN template
import sys
import re
import pprint
def dbg(x,y=''):
if len(y) > 0: y += ' = '
sys.stderr.write('\n>>> '+y+pprint.pformat(x)+'\n')
oo = 0x3f3f3f3f3f3f3f3f
# END template
def main():
t = int(input())
for t in range(t):
# input
n = int(input())
users = set(input().split())
m = int(input())
msg = []
for i in range(m):
user, text = input().split(':')
alts = set()
if user != '?':
alts.add(user)
else:
# this shit is pretty fucked up, dude
alts = users - set(re.findall('[a-zA-Z][a-zA-Z0-9]*',text))
msg.append(dict(user=user, text=text, users=alts))
# remove before and after
for i in range(m-1):
if len(msg[i]['users']) == 1:
msg[i+1]['users'].difference_update(msg[i]['users'])
for i in range(m-1,0,-1):
if len(msg[i]['users']) == 1:
msg[i-1]['users'].difference_update(msg[i]['users'])
# compute answer
last = ''
impo = False
for i in range(m):
msg[i]['users'].discard(last)
if len(msg[i]['users']) == 0:
impo = True
break
last = next(iter(msg[i]['users']))
msg[i]['user'] = last
if impo:
print('Impossible')
continue
for i in range(m):
print(msg[i]['user']+':'+msg[i]['text'])
'''
dp = [[0 for j in range(n+5)] for i in range(m+5)]
for i in range(1,n+5):
dp[m+1][i] = oo
for i in range(m,0,-1):
for j in range(n+1):
for k in msg[i]['users']:
if k != j and dp[i+1][k]:
dp[i][j] = k
break
# output
if not dp[1][0]:
print('Impossible')
continue
j = 0
for i in range(1,m+1):
print(users[dp[i][j]]+':'+msg[i]['text'])
j = dp[i][j]'''
main()
```
No
| 65,325
|
[
0.475341796875,
-0.2286376953125,
-0.1912841796875,
0.5458984375,
-0.26953125,
-0.75146484375,
-0.5986328125,
0.0175628662109375,
0.12066650390625,
0.59130859375,
0.256103515625,
-0.005313873291015625,
0.2279052734375,
-0.452392578125,
-1.0263671875,
0.00272369384765625,
-0.391357421875,
-0.72705078125,
-0.07281494140625,
-0.059112548828125,
0.44580078125,
0.005245208740234375,
-1.3671875,
-0.501953125,
-0.75537109375,
0.492919921875,
0.1285400390625,
-0.0170135498046875,
0.9677734375,
0.9873046875,
-0.30615234375,
-0.43017578125,
0.151123046875,
-1.3583984375,
-0.2200927734375,
-0.1558837890625,
0.6142578125,
-0.63623046875,
-0.7646484375,
-0.57568359375,
0.11260986328125,
-0.427490234375,
0.77880859375,
-0.85595703125,
-1.3193359375,
0.1746826171875,
-0.282958984375,
-0.1512451171875,
-0.010772705078125,
-0.91259765625,
0.46533203125,
-0.13671875,
0.7626953125,
-0.338623046875,
-0.1329345703125,
-0.67138671875,
-0.43310546875,
0.2509765625,
-0.6533203125,
0.08428955078125,
-0.1590576171875,
0.47119140625,
-0.1168212890625,
-0.58984375,
-0.05694580078125,
-0.11578369140625,
-0.1383056640625,
-0.25732421875,
0.0804443359375,
-0.48876953125,
-0.2086181640625,
0.1656494140625,
-0.73681640625,
-0.369140625,
-0.450439453125,
0.461181640625,
0.12078857421875,
-0.1019287109375,
-0.27099609375,
0.55029296875,
0.0027599334716796875,
1.09375,
0.294677734375,
0.378173828125,
-0.63232421875,
-0.79736328125,
0.5634765625,
0.365478515625,
0.2188720703125,
-0.268310546875,
-0.07275390625,
0.1768798828125,
-0.55419921875,
0.038970947265625,
0.8935546875,
0.468505859375,
0.2012939453125,
0.580078125,
-0.30419921875,
0.3310546875,
0.71923828125,
1.115234375,
-0.25146484375,
1.2177734375,
-0.01258087158203125,
0.1588134765625,
0.2457275390625,
0.1590576171875,
-0.305419921875,
-0.0953369140625,
-0.427734375,
-0.29150390625,
0.529296875,
0.27490234375,
-0.290283203125,
0.74853515625,
0.061737060546875,
-0.2127685546875,
-1.0341796875,
0.180908203125,
0.3017578125,
-0.29736328125,
0.1785888671875,
-0.268310546875,
0.1383056640625,
-0.130126953125,
-0.0183868408203125,
0.9150390625,
-0.52734375,
-0.3544921875,
0.270751953125,
-0.2366943359375,
-0.1021728515625,
0.1690673828125,
-0.1451416015625,
0.485595703125,
-0.422119140625,
0.53759765625,
0.91552734375,
-0.62451171875,
0.64892578125,
-0.1292724609375,
-0.082275390625,
1.4853515625,
0.43408203125,
-0.07257080078125,
0.423583984375,
0.418701171875,
-0.5927734375,
0.2322998046875,
-0.716796875,
0.77880859375,
-0.204345703125,
0.141357421875,
-0.1011962890625,
-0.2646484375,
-0.198486328125,
0.467529296875,
0.24365234375,
0.1734619140625,
-0.448486328125,
-0.11639404296875,
-0.270751953125,
0.9892578125,
-0.044891357421875,
0.947265625,
-0.560546875,
-0.57958984375,
-0.03021240234375,
-0.44287109375,
0.7294921875,
-0.224853515625,
-0.041290283203125,
1.0927734375,
0.84375,
0.9501953125,
0.43603515625,
-0.41943359375,
0.14697265625,
0.051971435546875,
0.115234375,
0.2117919921875,
0.09368896484375,
0.716796875,
0.181884765625,
0.1572265625,
0.365478515625,
-0.8291015625,
-0.7763671875,
-0.6708984375,
0.17529296875,
0.58740234375,
-0.580078125,
0.28125,
0.1488037109375,
-0.08087158203125,
-0.50146484375,
-0.066162109375,
0.10223388671875,
-0.82568359375,
-0.43017578125,
0.73388671875,
-0.3564453125,
0.52001953125,
-0.2666015625,
-0.277587890625,
0.43212890625,
1.4755859375,
-0.06927490234375,
-0.1033935546875,
0.53076171875,
0.257080078125,
-0.104736328125,
-0.27734375,
0.435791015625,
-0.6162109375,
-0.64453125,
0.37939453125,
-0.342041015625,
-0.25634765625,
0.09466552734375,
0.712890625,
0.429931640625,
0.458740234375,
-0.61376953125,
-0.285888671875,
0.2626953125,
1.4033203125,
-0.187255859375,
0.494140625,
0.2227783203125,
0.70849609375,
0.3095703125,
1.060546875,
0.3115234375,
0.0665283203125,
0.7724609375,
0.77734375,
0.072998046875,
0.1820068359375,
-0.0966796875,
0.352783203125,
0.07958984375,
0.38916015625,
0.11767578125,
0.55712890625,
-0.318603515625,
-0.12225341796875,
-0.86669921875,
0.305419921875,
-0.83935546875,
0.5791015625,
0.3876953125,
0.28857421875,
-0.8212890625,
-0.4326171875,
0.548828125,
0.5859375,
-0.732421875,
-0.2342529296875,
-0.063232421875,
0.0099945068359375,
0.303466796875,
-0.04925537109375,
0.057830810546875,
0.3017578125,
0.458984375,
0.50146484375,
-0.2091064453125,
-0.48779296875,
-0.919921875,
-1.0625,
-1.1748046875,
-0.68603515625,
-0.70947265625,
-0.330810546875,
0.2471923828125,
-0.68310546875,
0.1422119140625,
-0.5615234375,
-0.0127716064453125,
0.07421875,
-0.80908203125,
0.591796875,
-0.06854248046875,
0.444580078125,
-0.92919921875,
0.320556640625,
-0.11279296875,
1.02734375,
-0.292724609375,
0.1392822265625,
-0.15869140625,
-0.7177734375,
0.293701171875,
-0.32958984375,
0.37939453125,
-0.08782958984375,
-0.93017578125,
-0.4404296875,
-0.90673828125,
0.030242919921875,
-0.282958984375,
-0.048614501953125,
-0.7373046875,
0.8203125,
0.72314453125,
-0.7568359375,
0.52783203125,
0.673828125,
-0.6044921875,
0.56494140625,
0.446533203125,
0.11163330078125,
-0.55810546875,
0.92529296875,
0.533203125,
0.64892578125,
-0.483154296875,
-0.3779296875,
-0.75439453125,
0.1036376953125,
0.0662841796875,
-0.5205078125,
-0.31640625,
0.08892822265625,
0.187255859375,
-1.1455078125,
0.5693359375,
-1.7109375,
-0.97607421875,
-0.10809326171875,
-0.66796875,
1.1728515625,
0.927734375,
0.047149658203125,
-0.302001953125,
-0.132568359375,
-0.279052734375,
0.462158203125,
0.44873046875,
-0.57763671875,
0.154052734375,
0.953125,
0.033843994140625,
-0.0570068359375,
0.5234375,
-0.6787109375,
-0.146728515625,
-0.1202392578125,
0.1993408203125,
0.64208984375,
0.525390625,
0.036376953125,
0.00847625732421875,
0.865234375,
-0.81298828125,
-0.311767578125,
0.193359375,
0.3623046875,
0.71630859375,
0.2685546875,
0.2283935546875,
-0.147216796875,
-0.72802734375,
-0.77294921875,
0.2242431640625,
0.55322265625,
1.1123046875,
-0.525390625,
0.64013671875,
-0.050262451171875,
-0.857421875,
0.47607421875,
-0.75,
-0.344970703125,
0.8876953125,
-0.01107025146484375,
0.6728515625,
-1.0859375,
-0.07928466796875,
0.127685546875,
0.07379150390625,
0.467041015625,
0.63818359375,
0.6357421875,
-0.58203125,
-0.253173828125,
-0.256591796875,
-0.1943359375,
0.0726318359375,
-0.45361328125,
-0.444091796875,
-0.270751953125,
-0.5126953125,
-1.080078125,
0.521484375,
0.5693359375,
0.75830078125,
0.1619873046875,
0.79541015625,
0.02484130859375,
0.89990234375,
0.68701171875,
-0.43505859375,
0.052276611328125,
-0.7216796875,
0.6923828125,
0.444580078125,
-0.338623046875,
-0.430419921875,
-0.29931640625,
-0.06585693359375,
-0.11260986328125,
0.195068359375,
-0.331298828125,
-0.5712890625,
0.0877685546875,
-0.04571533203125,
0.74169921875,
-0.39208984375,
-0.59375,
-0.077880859375,
0.318603515625,
0.4130859375,
-0.460693359375,
0.2047119140625,
-0.64599609375,
0.63818359375,
0.8525390625,
-0.03179931640625,
-0.57275390625,
-0.47412109375,
-0.94580078125,
-0.783203125,
0.1729736328125,
0.8125,
-0.5927734375,
-0.072021484375,
-1.3701171875,
0.50634765625,
0.306640625,
-0.386474609375,
0.10009765625,
-0.10064697265625,
0.292724609375,
0.1422119140625,
0.69580078125,
-0.08233642578125,
-0.42822265625,
0.2489013671875,
-0.6025390625,
0.57568359375,
-0.70947265625,
0.2138671875,
-0.07012939453125,
0.02850341796875,
0.03765869140625,
0.8056640625,
-0.0177001953125,
0.365478515625,
-0.10858154296875,
0.1080322265625,
-0.986328125,
-0.57470703125,
0.439697265625,
0.2340087890625,
-0.45947265625,
0.37255859375,
0.234619140625,
-0.50341796875,
0.25244140625,
0.428955078125,
-0.322021484375,
0.59716796875,
-0.67333984375,
0.619140625,
-0.29296875,
-0.398681640625,
-0.057281494140625,
-0.53271484375,
0.5146484375,
0.0843505859375,
-0.984375,
-0.1619873046875,
-0.9541015625,
-0.170166015625,
-0.2369384765625,
-0.54541015625,
0.432373046875,
0.1590576171875,
0.0283966064453125,
-0.1982421875,
0.00977325439453125,
-0.92041015625,
0.01119232177734375,
-0.5634765625,
-0.244140625,
0.40673828125,
0.11676025390625,
0.62890625,
-0.05255126953125,
-0.46044921875,
0.308837890625,
-0.2374267578125,
0.247802734375,
-0.342041015625,
-0.441650390625,
0.223876953125,
-0.17724609375,
-0.436279296875,
0.374267578125,
-0.6357421875,
0.28662109375,
0.8515625,
-0.035430908203125,
0.32275390625,
0.051605224609375,
-0.53173828125,
0.76904296875,
0.0687255859375,
-1.2099609375,
-0.235595703125,
0.63037109375,
-0.384765625,
0.548828125,
0.73486328125,
-1.126953125,
-0.5224609375,
-0.90087890625,
0.182373046875,
-1.08984375,
-0.16943359375,
-0.8916015625,
-0.160888671875,
-0.450927734375,
0.9501953125,
0.01358795166015625,
-0.6484375,
-0.31005859375,
-1.0537109375,
0.484130859375,
-0.74462890625,
-0.1492919921875,
-0.191650390625,
-0.158447265625,
-0.25341796875,
1.171875,
0.304931640625,
0.2230224609375,
-0.143310546875,
0.00823211669921875,
0.349609375,
-0.06298828125,
-0.421630859375,
-0.22119140625,
0.1849365234375,
0.07354736328125,
-0.454833984375,
0.3466796875,
-0.759765625,
0.578125,
-0.53125,
-0.09271240234375,
0.1268310546875,
-0.5859375,
0.007415771484375,
-0.06292724609375,
1.154296875,
-0.59619140625,
-0.044036865234375,
-0.3447265625,
0.250244140625,
0.61767578125,
-0.2734375,
-0.55712890625,
-0.69775390625,
-0.830078125,
-1.16796875,
0.6181640625,
-0.335693359375,
-0.06439208984375,
-0.2548828125,
-0.2021484375,
1.0263671875,
-0.5263671875,
0.31982421875,
1.4306640625,
0.402587890625,
0.2027587890625,
-0.7451171875,
0.73681640625,
0.32470703125,
-0.497802734375,
-0.273681640625,
0.11676025390625,
-0.83740234375,
0.1561279296875,
-0.397216796875,
-0.9169921875,
-0.5810546875,
-0.0243072509765625,
0.955078125,
-0.41650390625,
1.130859375,
0.144287109375,
-1.0703125,
-0.9111328125,
0.55078125,
0.13427734375,
0.113037109375,
0.728515625,
0.1214599609375,
0.169921875,
0.024322509765625,
0.1558837890625,
-0.08978271484375,
-0.623046875,
1.1875,
0.10418701171875,
-0.362060546875,
0.84765625,
0.97802734375,
-0.888671875,
-0.935546875,
-0.05364990234375,
-0.01110076904296875,
-0.2197265625,
-0.8740234375,
-0.14013671875,
0.66162109375,
-0.77490234375,
0.36279296875,
0.9052734375,
0.06744384765625,
0.11468505859375,
0.027008056640625,
0.3681640625,
-0.76171875,
0.8837890625,
0.990234375,
-0.486083984375,
0.132568359375,
-1.048828125,
0.0253143310546875,
-0.5107421875,
-0.12548828125,
0.98681640625,
-0.70166015625,
0.53662109375,
0.67529296875,
-0.2069091796875,
0.9951171875,
-0.38330078125,
-0.2314453125,
0.196533203125,
-0.7626953125,
-0.6044921875,
-0.203857421875,
0.4345703125,
-0.3662109375,
0.5078125,
-0.66748046875,
0.2783203125,
0.62841796875,
0.3837890625,
-0.372314453125,
-1.091796875,
-0.407470703125,
-1.0048828125,
-0.60498046875,
-0.724609375,
0.1768798828125,
-0.501953125,
0.0941162109375,
0.44384765625,
-0.8935546875,
0.0860595703125,
0.459716796875,
-0.20751953125,
0.76171875,
-0.8857421875,
0.55712890625,
-0.77978515625,
-0.431396484375,
-0.69921875,
-0.31494140625,
-0.293701171875,
-0.10076904296875,
-0.02752685546875,
0.357666015625,
-0.2342529296875,
0.57568359375,
0.0114898681640625,
0.271728515625,
-0.1741943359375,
-0.392822265625,
0.0226287841796875,
-0.0655517578125,
-0.51513671875,
0.333984375,
0.417724609375,
-0.39306640625,
-0.002941131591796875,
-0.1829833984375,
-0.28564453125,
-0.1292724609375,
0.69921875,
0.68798828125,
0.07733154296875,
0.07086181640625,
-0.134765625,
0.058380126953125,
-0.87255859375,
0.097900390625,
0.08447265625,
0.1146240234375,
0.405517578125,
-0.2900390625,
0.344970703125,
0.9208984375,
-0.1407470703125,
0.56787109375,
-0.1754150390625,
0.46435546875,
0.054656982421875,
-0.11077880859375,
0.042510986328125,
-0.01435089111328125,
0.11993408203125,
0.2462158203125,
0.2435302734375,
0.3720703125,
-0.31787109375,
0.67578125,
-0.146728515625,
-0.8486328125,
-0.77587890625,
-0.2734375,
0.1951904296875,
0.337890625,
0.517578125,
-0.06964111328125,
0.08758544921875,
-0.1776123046875,
-0.64306640625,
0.257568359375,
-1.328125,
-0.1890869140625,
1.171875,
-0.317138671875,
-0.495361328125,
-0.355712890625,
-0.350830078125,
-0.0760498046875,
0.525390625,
0.36328125,
-0.63037109375,
0.0012960433959960938,
0.18408203125,
0.65185546875,
-0.64013671875,
0.492431640625,
-0.0989990234375,
0.308349609375,
-0.46923828125,
-0.186279296875,
0.2044677734375,
1.169921875,
-0.088623046875,
-0.44287109375,
-1.0703125,
-0.07025146484375,
0.272705078125,
-0.35546875,
-0.2147216796875,
0.10748291015625,
-0.1268310546875,
0.338134765625,
-0.78076171875,
0.10601806640625,
-0.08587646484375,
0.379150390625,
0.34521484375,
-0.1864013671875,
-0.67138671875,
0.62109375,
0.751953125,
-0.13671875,
1.0576171875,
-0.042694091796875,
0.385498046875,
0.2388916015625,
0.23291015625,
-0.333984375,
0.91162109375,
0.79052734375,
0.253662109375,
-0.326416015625,
0.487548828125,
0.7529296875,
0.13134765625,
-0.07952880859375,
0.050689697265625,
0.07745361328125,
-0.2335205078125,
0.359375,
-0.30078125,
-0.13134765625,
-0.006511688232421875,
-0.07464599609375,
0.28369140625,
-0.236328125,
-0.04180908203125,
-0.52490234375,
-0.74267578125,
0.52587890625,
-0.3408203125,
0.00322723388671875,
0.279052734375,
-0.69580078125,
0.1109619140625,
0.892578125,
0.0307159423828125,
-0.289794921875,
0.89599609375,
0.2462158203125,
0.50341796875,
0.64501953125,
0.453369140625,
0.556640625,
-0.81201171875,
0.455322265625,
0.2344970703125,
-0.041778564453125,
-0.1734619140625,
-0.298095703125,
-0.8623046875,
0.455322265625,
-0.40478515625,
0.0335693359375,
0.68212890625,
-1.068359375,
0.1898193359375,
-0.137939453125,
0.529296875,
-0.56982421875,
0.2230224609375,
0.152099609375,
-0.62646484375,
-0.71923828125,
1.03515625,
-0.1622314453125,
0.414794921875,
0.0406494140625,
1.201171875,
0.1326904296875,
1.7939453125,
0.483642578125,
-0.1029052734375,
-0.1358642578125,
0.21826171875,
-0.51025390625,
-0.474365234375,
-0.2034912109375,
-0.410400390625,
0.5966796875,
-0.6474609375,
-0.325439453125,
-0.167724609375,
0.8017578125,
0.37744140625,
-1.1416015625,
-0.484375,
0.3603515625,
-0.291259765625,
0.313232421875,
0.406005859375,
0.078857421875,
0.005260467529296875,
0.1578369140625,
0.026397705078125,
-0.76171875,
-0.1376953125,
-0.82275390625,
0.418701171875,
-0.006900787353515625,
-0.7744140625,
-0.43505859375,
-0.8525390625,
-0.114013671875,
0.2176513671875,
-0.448486328125,
-0.7685546875,
0.615234375,
0.5947265625,
0.6572265625,
0.12005615234375,
-0.2359619140625,
-0.249267578125,
1.0556640625,
0.99609375,
0.14892578125,
1.1005859375,
0.42138671875,
-0.1409912109375,
0.256591796875,
-0.37646484375,
0.64208984375,
0.158447265625,
0.085693359375,
-0.30517578125,
-0.421875,
-0.68115234375,
-1.248046875,
0.006504058837890625,
1.0390625,
0.6142578125,
-0.4677734375,
-1.0712890625,
-0.74072265625,
-1.064453125,
-0.04595947265625,
-0.375,
1.021484375,
-0.214111328125,
-0.1588134765625,
0.09527587890625,
-1.3037109375,
4.3359375,
1.2099609375,
0.78564453125,
-0.01035308837890625,
0.0943603515625,
1.01171875,
0.88818359375,
-0.391845703125,
-0.080322265625,
-0.341796875,
0.2486572265625,
-0.485595703125,
0.305419921875,
0.89208984375,
0.03436279296875,
0.59521484375,
-0.6142578125,
-0.23583984375,
0.193115234375,
-0.783203125,
-0.7021484375,
0.367431640625,
0.06170654296875,
0.5556640625,
0.1361083984375,
0.5419921875,
0.67822265625,
-0.7041015625,
0.06689453125,
-0.60302734375,
0.011688232421875,
-0.56201171875,
1.0556640625,
0.1749267578125,
-0.35205078125,
0.369384765625,
-0.09381103515625,
-0.92578125,
-0.208251953125,
0.18701171875,
0.055023193359375,
-0.0330810546875,
0.51708984375,
-0.8154296875,
-0.1273193359375,
0.47412109375,
-0.373291015625,
0.2568359375,
0.48779296875,
-1.044921875,
0.583984375,
-0.6005859375,
0.59033203125,
-0.65576171875,
-0.297119140625,
0.266845703125,
0.60302734375,
-0.15625,
-0.18603515625,
0.5537109375,
0.358154296875,
0.302490234375,
0.0003230571746826172,
0.76904296875,
-0.95166015625,
0.420166015625,
-0.5712890625,
0.5595703125,
-0.11181640625,
0.0233306884765625,
-0.2548828125,
-0.2391357421875,
-0.58642578125,
-0.8095703125,
0.49560546875,
0.275634765625,
-0.2113037109375,
0.54736328125,
0.70751953125,
-0.2462158203125,
-0.2442626953125,
-0.2330322265625,
-0.248291015625,
-0.5771484375,
0.1341552734375,
1.1728515625,
-0.634765625,
-0.3583984375,
-0.372314453125,
0.8564453125,
0.4658203125,
0.4931640625,
0.225830078125,
-0.2724609375,
-0.190673828125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Submitted Solution:
```
messages = []
users = []
class Message:
senders = []
def __init__(self, data):
self.text = data[1]
self.sender = None if data[0] == '?' else data[0]
if self.sender is None:
self.find_sender()
def find_sender(self):
users_found = set()
for user in users:
found = self.text.find(user)
if found != -1:
if self.text[found-1] == ' ' or not (self.text[found-1].isdigit() and self.text[found-1].isalpha()):
users_found.add(user)
self.senders = list(users ^ users_found)
if len(self.senders) == 1:
self.sender = self.senders[0]
def check(self, next=None, prev=None):
if len(self.senders) > 3:
return None
else:
if next is not None:
try:
self.senders.remove(messages[next].sender)
except ValueError:
pass
if prev is not None:
try:
self.senders.remove(messages[prev].sender)
except ValueError:
pass
if len(self.senders) != 1:
return None
else:
self.sender = self.senders[0]
return 1
def main():
global messages
tests = int(input())
for test in range(tests):
if current_test():
for msg in messages:
print(msg.sender, msg.text, sep=':')
else:
print("Impossible")
def current_test():
global messages
global users
messages = []
users = input()
users = set(input().split(' '))
message_count = int(input())
for message in range(message_count):
messages.append(Message(input().split(':')))
for message_id in range(len(messages)):
message = messages[message_id]
if message.sender is None:
if message_id != 0 and message_id != len(messages) - 1:
if message.check(message_id + 1, message_id - 1) is None:
return False
elif message_id == 0:
if message.check(next=message_id + 1) is None:
return False
else:
if message.check(prev=message_id - 1) is None:
return False
return True
main()
```
No
| 65,326
|
[
0.475341796875,
-0.2286376953125,
-0.1912841796875,
0.5458984375,
-0.26953125,
-0.75146484375,
-0.5986328125,
0.0175628662109375,
0.12066650390625,
0.59130859375,
0.256103515625,
-0.005313873291015625,
0.2279052734375,
-0.452392578125,
-1.0263671875,
0.00272369384765625,
-0.391357421875,
-0.72705078125,
-0.07281494140625,
-0.059112548828125,
0.44580078125,
0.005245208740234375,
-1.3671875,
-0.501953125,
-0.75537109375,
0.492919921875,
0.1285400390625,
-0.0170135498046875,
0.9677734375,
0.9873046875,
-0.30615234375,
-0.43017578125,
0.151123046875,
-1.3583984375,
-0.2200927734375,
-0.1558837890625,
0.6142578125,
-0.63623046875,
-0.7646484375,
-0.57568359375,
0.11260986328125,
-0.427490234375,
0.77880859375,
-0.85595703125,
-1.3193359375,
0.1746826171875,
-0.282958984375,
-0.1512451171875,
-0.010772705078125,
-0.91259765625,
0.46533203125,
-0.13671875,
0.7626953125,
-0.338623046875,
-0.1329345703125,
-0.67138671875,
-0.43310546875,
0.2509765625,
-0.6533203125,
0.08428955078125,
-0.1590576171875,
0.47119140625,
-0.1168212890625,
-0.58984375,
-0.05694580078125,
-0.11578369140625,
-0.1383056640625,
-0.25732421875,
0.0804443359375,
-0.48876953125,
-0.2086181640625,
0.1656494140625,
-0.73681640625,
-0.369140625,
-0.450439453125,
0.461181640625,
0.12078857421875,
-0.1019287109375,
-0.27099609375,
0.55029296875,
0.0027599334716796875,
1.09375,
0.294677734375,
0.378173828125,
-0.63232421875,
-0.79736328125,
0.5634765625,
0.365478515625,
0.2188720703125,
-0.268310546875,
-0.07275390625,
0.1768798828125,
-0.55419921875,
0.038970947265625,
0.8935546875,
0.468505859375,
0.2012939453125,
0.580078125,
-0.30419921875,
0.3310546875,
0.71923828125,
1.115234375,
-0.25146484375,
1.2177734375,
-0.01258087158203125,
0.1588134765625,
0.2457275390625,
0.1590576171875,
-0.305419921875,
-0.0953369140625,
-0.427734375,
-0.29150390625,
0.529296875,
0.27490234375,
-0.290283203125,
0.74853515625,
0.061737060546875,
-0.2127685546875,
-1.0341796875,
0.180908203125,
0.3017578125,
-0.29736328125,
0.1785888671875,
-0.268310546875,
0.1383056640625,
-0.130126953125,
-0.0183868408203125,
0.9150390625,
-0.52734375,
-0.3544921875,
0.270751953125,
-0.2366943359375,
-0.1021728515625,
0.1690673828125,
-0.1451416015625,
0.485595703125,
-0.422119140625,
0.53759765625,
0.91552734375,
-0.62451171875,
0.64892578125,
-0.1292724609375,
-0.082275390625,
1.4853515625,
0.43408203125,
-0.07257080078125,
0.423583984375,
0.418701171875,
-0.5927734375,
0.2322998046875,
-0.716796875,
0.77880859375,
-0.204345703125,
0.141357421875,
-0.1011962890625,
-0.2646484375,
-0.198486328125,
0.467529296875,
0.24365234375,
0.1734619140625,
-0.448486328125,
-0.11639404296875,
-0.270751953125,
0.9892578125,
-0.044891357421875,
0.947265625,
-0.560546875,
-0.57958984375,
-0.03021240234375,
-0.44287109375,
0.7294921875,
-0.224853515625,
-0.041290283203125,
1.0927734375,
0.84375,
0.9501953125,
0.43603515625,
-0.41943359375,
0.14697265625,
0.051971435546875,
0.115234375,
0.2117919921875,
0.09368896484375,
0.716796875,
0.181884765625,
0.1572265625,
0.365478515625,
-0.8291015625,
-0.7763671875,
-0.6708984375,
0.17529296875,
0.58740234375,
-0.580078125,
0.28125,
0.1488037109375,
-0.08087158203125,
-0.50146484375,
-0.066162109375,
0.10223388671875,
-0.82568359375,
-0.43017578125,
0.73388671875,
-0.3564453125,
0.52001953125,
-0.2666015625,
-0.277587890625,
0.43212890625,
1.4755859375,
-0.06927490234375,
-0.1033935546875,
0.53076171875,
0.257080078125,
-0.104736328125,
-0.27734375,
0.435791015625,
-0.6162109375,
-0.64453125,
0.37939453125,
-0.342041015625,
-0.25634765625,
0.09466552734375,
0.712890625,
0.429931640625,
0.458740234375,
-0.61376953125,
-0.285888671875,
0.2626953125,
1.4033203125,
-0.187255859375,
0.494140625,
0.2227783203125,
0.70849609375,
0.3095703125,
1.060546875,
0.3115234375,
0.0665283203125,
0.7724609375,
0.77734375,
0.072998046875,
0.1820068359375,
-0.0966796875,
0.352783203125,
0.07958984375,
0.38916015625,
0.11767578125,
0.55712890625,
-0.318603515625,
-0.12225341796875,
-0.86669921875,
0.305419921875,
-0.83935546875,
0.5791015625,
0.3876953125,
0.28857421875,
-0.8212890625,
-0.4326171875,
0.548828125,
0.5859375,
-0.732421875,
-0.2342529296875,
-0.063232421875,
0.0099945068359375,
0.303466796875,
-0.04925537109375,
0.057830810546875,
0.3017578125,
0.458984375,
0.50146484375,
-0.2091064453125,
-0.48779296875,
-0.919921875,
-1.0625,
-1.1748046875,
-0.68603515625,
-0.70947265625,
-0.330810546875,
0.2471923828125,
-0.68310546875,
0.1422119140625,
-0.5615234375,
-0.0127716064453125,
0.07421875,
-0.80908203125,
0.591796875,
-0.06854248046875,
0.444580078125,
-0.92919921875,
0.320556640625,
-0.11279296875,
1.02734375,
-0.292724609375,
0.1392822265625,
-0.15869140625,
-0.7177734375,
0.293701171875,
-0.32958984375,
0.37939453125,
-0.08782958984375,
-0.93017578125,
-0.4404296875,
-0.90673828125,
0.030242919921875,
-0.282958984375,
-0.048614501953125,
-0.7373046875,
0.8203125,
0.72314453125,
-0.7568359375,
0.52783203125,
0.673828125,
-0.6044921875,
0.56494140625,
0.446533203125,
0.11163330078125,
-0.55810546875,
0.92529296875,
0.533203125,
0.64892578125,
-0.483154296875,
-0.3779296875,
-0.75439453125,
0.1036376953125,
0.0662841796875,
-0.5205078125,
-0.31640625,
0.08892822265625,
0.187255859375,
-1.1455078125,
0.5693359375,
-1.7109375,
-0.97607421875,
-0.10809326171875,
-0.66796875,
1.1728515625,
0.927734375,
0.047149658203125,
-0.302001953125,
-0.132568359375,
-0.279052734375,
0.462158203125,
0.44873046875,
-0.57763671875,
0.154052734375,
0.953125,
0.033843994140625,
-0.0570068359375,
0.5234375,
-0.6787109375,
-0.146728515625,
-0.1202392578125,
0.1993408203125,
0.64208984375,
0.525390625,
0.036376953125,
0.00847625732421875,
0.865234375,
-0.81298828125,
-0.311767578125,
0.193359375,
0.3623046875,
0.71630859375,
0.2685546875,
0.2283935546875,
-0.147216796875,
-0.72802734375,
-0.77294921875,
0.2242431640625,
0.55322265625,
1.1123046875,
-0.525390625,
0.64013671875,
-0.050262451171875,
-0.857421875,
0.47607421875,
-0.75,
-0.344970703125,
0.8876953125,
-0.01107025146484375,
0.6728515625,
-1.0859375,
-0.07928466796875,
0.127685546875,
0.07379150390625,
0.467041015625,
0.63818359375,
0.6357421875,
-0.58203125,
-0.253173828125,
-0.256591796875,
-0.1943359375,
0.0726318359375,
-0.45361328125,
-0.444091796875,
-0.270751953125,
-0.5126953125,
-1.080078125,
0.521484375,
0.5693359375,
0.75830078125,
0.1619873046875,
0.79541015625,
0.02484130859375,
0.89990234375,
0.68701171875,
-0.43505859375,
0.052276611328125,
-0.7216796875,
0.6923828125,
0.444580078125,
-0.338623046875,
-0.430419921875,
-0.29931640625,
-0.06585693359375,
-0.11260986328125,
0.195068359375,
-0.331298828125,
-0.5712890625,
0.0877685546875,
-0.04571533203125,
0.74169921875,
-0.39208984375,
-0.59375,
-0.077880859375,
0.318603515625,
0.4130859375,
-0.460693359375,
0.2047119140625,
-0.64599609375,
0.63818359375,
0.8525390625,
-0.03179931640625,
-0.57275390625,
-0.47412109375,
-0.94580078125,
-0.783203125,
0.1729736328125,
0.8125,
-0.5927734375,
-0.072021484375,
-1.3701171875,
0.50634765625,
0.306640625,
-0.386474609375,
0.10009765625,
-0.10064697265625,
0.292724609375,
0.1422119140625,
0.69580078125,
-0.08233642578125,
-0.42822265625,
0.2489013671875,
-0.6025390625,
0.57568359375,
-0.70947265625,
0.2138671875,
-0.07012939453125,
0.02850341796875,
0.03765869140625,
0.8056640625,
-0.0177001953125,
0.365478515625,
-0.10858154296875,
0.1080322265625,
-0.986328125,
-0.57470703125,
0.439697265625,
0.2340087890625,
-0.45947265625,
0.37255859375,
0.234619140625,
-0.50341796875,
0.25244140625,
0.428955078125,
-0.322021484375,
0.59716796875,
-0.67333984375,
0.619140625,
-0.29296875,
-0.398681640625,
-0.057281494140625,
-0.53271484375,
0.5146484375,
0.0843505859375,
-0.984375,
-0.1619873046875,
-0.9541015625,
-0.170166015625,
-0.2369384765625,
-0.54541015625,
0.432373046875,
0.1590576171875,
0.0283966064453125,
-0.1982421875,
0.00977325439453125,
-0.92041015625,
0.01119232177734375,
-0.5634765625,
-0.244140625,
0.40673828125,
0.11676025390625,
0.62890625,
-0.05255126953125,
-0.46044921875,
0.308837890625,
-0.2374267578125,
0.247802734375,
-0.342041015625,
-0.441650390625,
0.223876953125,
-0.17724609375,
-0.436279296875,
0.374267578125,
-0.6357421875,
0.28662109375,
0.8515625,
-0.035430908203125,
0.32275390625,
0.051605224609375,
-0.53173828125,
0.76904296875,
0.0687255859375,
-1.2099609375,
-0.235595703125,
0.63037109375,
-0.384765625,
0.548828125,
0.73486328125,
-1.126953125,
-0.5224609375,
-0.90087890625,
0.182373046875,
-1.08984375,
-0.16943359375,
-0.8916015625,
-0.160888671875,
-0.450927734375,
0.9501953125,
0.01358795166015625,
-0.6484375,
-0.31005859375,
-1.0537109375,
0.484130859375,
-0.74462890625,
-0.1492919921875,
-0.191650390625,
-0.158447265625,
-0.25341796875,
1.171875,
0.304931640625,
0.2230224609375,
-0.143310546875,
0.00823211669921875,
0.349609375,
-0.06298828125,
-0.421630859375,
-0.22119140625,
0.1849365234375,
0.07354736328125,
-0.454833984375,
0.3466796875,
-0.759765625,
0.578125,
-0.53125,
-0.09271240234375,
0.1268310546875,
-0.5859375,
0.007415771484375,
-0.06292724609375,
1.154296875,
-0.59619140625,
-0.044036865234375,
-0.3447265625,
0.250244140625,
0.61767578125,
-0.2734375,
-0.55712890625,
-0.69775390625,
-0.830078125,
-1.16796875,
0.6181640625,
-0.335693359375,
-0.06439208984375,
-0.2548828125,
-0.2021484375,
1.0263671875,
-0.5263671875,
0.31982421875,
1.4306640625,
0.402587890625,
0.2027587890625,
-0.7451171875,
0.73681640625,
0.32470703125,
-0.497802734375,
-0.273681640625,
0.11676025390625,
-0.83740234375,
0.1561279296875,
-0.397216796875,
-0.9169921875,
-0.5810546875,
-0.0243072509765625,
0.955078125,
-0.41650390625,
1.130859375,
0.144287109375,
-1.0703125,
-0.9111328125,
0.55078125,
0.13427734375,
0.113037109375,
0.728515625,
0.1214599609375,
0.169921875,
0.024322509765625,
0.1558837890625,
-0.08978271484375,
-0.623046875,
1.1875,
0.10418701171875,
-0.362060546875,
0.84765625,
0.97802734375,
-0.888671875,
-0.935546875,
-0.05364990234375,
-0.01110076904296875,
-0.2197265625,
-0.8740234375,
-0.14013671875,
0.66162109375,
-0.77490234375,
0.36279296875,
0.9052734375,
0.06744384765625,
0.11468505859375,
0.027008056640625,
0.3681640625,
-0.76171875,
0.8837890625,
0.990234375,
-0.486083984375,
0.132568359375,
-1.048828125,
0.0253143310546875,
-0.5107421875,
-0.12548828125,
0.98681640625,
-0.70166015625,
0.53662109375,
0.67529296875,
-0.2069091796875,
0.9951171875,
-0.38330078125,
-0.2314453125,
0.196533203125,
-0.7626953125,
-0.6044921875,
-0.203857421875,
0.4345703125,
-0.3662109375,
0.5078125,
-0.66748046875,
0.2783203125,
0.62841796875,
0.3837890625,
-0.372314453125,
-1.091796875,
-0.407470703125,
-1.0048828125,
-0.60498046875,
-0.724609375,
0.1768798828125,
-0.501953125,
0.0941162109375,
0.44384765625,
-0.8935546875,
0.0860595703125,
0.459716796875,
-0.20751953125,
0.76171875,
-0.8857421875,
0.55712890625,
-0.77978515625,
-0.431396484375,
-0.69921875,
-0.31494140625,
-0.293701171875,
-0.10076904296875,
-0.02752685546875,
0.357666015625,
-0.2342529296875,
0.57568359375,
0.0114898681640625,
0.271728515625,
-0.1741943359375,
-0.392822265625,
0.0226287841796875,
-0.0655517578125,
-0.51513671875,
0.333984375,
0.417724609375,
-0.39306640625,
-0.002941131591796875,
-0.1829833984375,
-0.28564453125,
-0.1292724609375,
0.69921875,
0.68798828125,
0.07733154296875,
0.07086181640625,
-0.134765625,
0.058380126953125,
-0.87255859375,
0.097900390625,
0.08447265625,
0.1146240234375,
0.405517578125,
-0.2900390625,
0.344970703125,
0.9208984375,
-0.1407470703125,
0.56787109375,
-0.1754150390625,
0.46435546875,
0.054656982421875,
-0.11077880859375,
0.042510986328125,
-0.01435089111328125,
0.11993408203125,
0.2462158203125,
0.2435302734375,
0.3720703125,
-0.31787109375,
0.67578125,
-0.146728515625,
-0.8486328125,
-0.77587890625,
-0.2734375,
0.1951904296875,
0.337890625,
0.517578125,
-0.06964111328125,
0.08758544921875,
-0.1776123046875,
-0.64306640625,
0.257568359375,
-1.328125,
-0.1890869140625,
1.171875,
-0.317138671875,
-0.495361328125,
-0.355712890625,
-0.350830078125,
-0.0760498046875,
0.525390625,
0.36328125,
-0.63037109375,
0.0012960433959960938,
0.18408203125,
0.65185546875,
-0.64013671875,
0.492431640625,
-0.0989990234375,
0.308349609375,
-0.46923828125,
-0.186279296875,
0.2044677734375,
1.169921875,
-0.088623046875,
-0.44287109375,
-1.0703125,
-0.07025146484375,
0.272705078125,
-0.35546875,
-0.2147216796875,
0.10748291015625,
-0.1268310546875,
0.338134765625,
-0.78076171875,
0.10601806640625,
-0.08587646484375,
0.379150390625,
0.34521484375,
-0.1864013671875,
-0.67138671875,
0.62109375,
0.751953125,
-0.13671875,
1.0576171875,
-0.042694091796875,
0.385498046875,
0.2388916015625,
0.23291015625,
-0.333984375,
0.91162109375,
0.79052734375,
0.253662109375,
-0.326416015625,
0.487548828125,
0.7529296875,
0.13134765625,
-0.07952880859375,
0.050689697265625,
0.07745361328125,
-0.2335205078125,
0.359375,
-0.30078125,
-0.13134765625,
-0.006511688232421875,
-0.07464599609375,
0.28369140625,
-0.236328125,
-0.04180908203125,
-0.52490234375,
-0.74267578125,
0.52587890625,
-0.3408203125,
0.00322723388671875,
0.279052734375,
-0.69580078125,
0.1109619140625,
0.892578125,
0.0307159423828125,
-0.289794921875,
0.89599609375,
0.2462158203125,
0.50341796875,
0.64501953125,
0.453369140625,
0.556640625,
-0.81201171875,
0.455322265625,
0.2344970703125,
-0.041778564453125,
-0.1734619140625,
-0.298095703125,
-0.8623046875,
0.455322265625,
-0.40478515625,
0.0335693359375,
0.68212890625,
-1.068359375,
0.1898193359375,
-0.137939453125,
0.529296875,
-0.56982421875,
0.2230224609375,
0.152099609375,
-0.62646484375,
-0.71923828125,
1.03515625,
-0.1622314453125,
0.414794921875,
0.0406494140625,
1.201171875,
0.1326904296875,
1.7939453125,
0.483642578125,
-0.1029052734375,
-0.1358642578125,
0.21826171875,
-0.51025390625,
-0.474365234375,
-0.2034912109375,
-0.410400390625,
0.5966796875,
-0.6474609375,
-0.325439453125,
-0.167724609375,
0.8017578125,
0.37744140625,
-1.1416015625,
-0.484375,
0.3603515625,
-0.291259765625,
0.313232421875,
0.406005859375,
0.078857421875,
0.005260467529296875,
0.1578369140625,
0.026397705078125,
-0.76171875,
-0.1376953125,
-0.82275390625,
0.418701171875,
-0.006900787353515625,
-0.7744140625,
-0.43505859375,
-0.8525390625,
-0.114013671875,
0.2176513671875,
-0.448486328125,
-0.7685546875,
0.615234375,
0.5947265625,
0.6572265625,
0.12005615234375,
-0.2359619140625,
-0.249267578125,
1.0556640625,
0.99609375,
0.14892578125,
1.1005859375,
0.42138671875,
-0.1409912109375,
0.256591796875,
-0.37646484375,
0.64208984375,
0.158447265625,
0.085693359375,
-0.30517578125,
-0.421875,
-0.68115234375,
-1.248046875,
0.006504058837890625,
1.0390625,
0.6142578125,
-0.4677734375,
-1.0712890625,
-0.74072265625,
-1.064453125,
-0.04595947265625,
-0.375,
1.021484375,
-0.214111328125,
-0.1588134765625,
0.09527587890625,
-1.3037109375,
4.3359375,
1.2099609375,
0.78564453125,
-0.01035308837890625,
0.0943603515625,
1.01171875,
0.88818359375,
-0.391845703125,
-0.080322265625,
-0.341796875,
0.2486572265625,
-0.485595703125,
0.305419921875,
0.89208984375,
0.03436279296875,
0.59521484375,
-0.6142578125,
-0.23583984375,
0.193115234375,
-0.783203125,
-0.7021484375,
0.367431640625,
0.06170654296875,
0.5556640625,
0.1361083984375,
0.5419921875,
0.67822265625,
-0.7041015625,
0.06689453125,
-0.60302734375,
0.011688232421875,
-0.56201171875,
1.0556640625,
0.1749267578125,
-0.35205078125,
0.369384765625,
-0.09381103515625,
-0.92578125,
-0.208251953125,
0.18701171875,
0.055023193359375,
-0.0330810546875,
0.51708984375,
-0.8154296875,
-0.1273193359375,
0.47412109375,
-0.373291015625,
0.2568359375,
0.48779296875,
-1.044921875,
0.583984375,
-0.6005859375,
0.59033203125,
-0.65576171875,
-0.297119140625,
0.266845703125,
0.60302734375,
-0.15625,
-0.18603515625,
0.5537109375,
0.358154296875,
0.302490234375,
0.0003230571746826172,
0.76904296875,
-0.95166015625,
0.420166015625,
-0.5712890625,
0.5595703125,
-0.11181640625,
0.0233306884765625,
-0.2548828125,
-0.2391357421875,
-0.58642578125,
-0.8095703125,
0.49560546875,
0.275634765625,
-0.2113037109375,
0.54736328125,
0.70751953125,
-0.2462158203125,
-0.2442626953125,
-0.2330322265625,
-0.248291015625,
-0.5771484375,
0.1341552734375,
1.1728515625,
-0.634765625,
-0.3583984375,
-0.372314453125,
0.8564453125,
0.4658203125,
0.4931640625,
0.225830078125,
-0.2724609375,
-0.190673828125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Submitted Solution:
```
import re
def proc(msgs):
chg = False
for i, msg in enumerate(msgs):
if msg[0] != '?': continue
ppn = msg[1]
if i > 0: ppn.discard(msgs[i-1][0])
if i != len(msgs)-1: ppn.discard(msgs[i+1][0])
if len(ppn) == 1:
msg[0] = ppn.pop()
chg = True
return chg
TC = int(input())
for tc in range(0, TC):
N = int(input())
persons = set(input().split())
M = int(input())
msgs = []
for m in range(M):
line = input()
m1 = re.match(r'(.*)\:(.*)', line)
ppn = set(persons)
for un in re.findall(r'[a-zA-Z0-9]+', m1.group(2)):
ppn.discard(un)
msgs.append([m1.group(1), ppn, m1.group(2)])
while proc(msgs):
pass
works = True
for i, msg in enumerate(msgs):
if msg[0] == '?' or (i > 0 and msg[0] == msgs[i-1][0]) or (i != len(msgs)-1 and msg[0] == msgs[i+1][0]):
works = False
break
if works:
for msg in msgs:
print('%s:%s' % (msg[0], msg[2]))
else:
print('Impossible')
```
No
| 65,327
|
[
0.475341796875,
-0.2286376953125,
-0.1912841796875,
0.5458984375,
-0.26953125,
-0.75146484375,
-0.5986328125,
0.0175628662109375,
0.12066650390625,
0.59130859375,
0.256103515625,
-0.005313873291015625,
0.2279052734375,
-0.452392578125,
-1.0263671875,
0.00272369384765625,
-0.391357421875,
-0.72705078125,
-0.07281494140625,
-0.059112548828125,
0.44580078125,
0.005245208740234375,
-1.3671875,
-0.501953125,
-0.75537109375,
0.492919921875,
0.1285400390625,
-0.0170135498046875,
0.9677734375,
0.9873046875,
-0.30615234375,
-0.43017578125,
0.151123046875,
-1.3583984375,
-0.2200927734375,
-0.1558837890625,
0.6142578125,
-0.63623046875,
-0.7646484375,
-0.57568359375,
0.11260986328125,
-0.427490234375,
0.77880859375,
-0.85595703125,
-1.3193359375,
0.1746826171875,
-0.282958984375,
-0.1512451171875,
-0.010772705078125,
-0.91259765625,
0.46533203125,
-0.13671875,
0.7626953125,
-0.338623046875,
-0.1329345703125,
-0.67138671875,
-0.43310546875,
0.2509765625,
-0.6533203125,
0.08428955078125,
-0.1590576171875,
0.47119140625,
-0.1168212890625,
-0.58984375,
-0.05694580078125,
-0.11578369140625,
-0.1383056640625,
-0.25732421875,
0.0804443359375,
-0.48876953125,
-0.2086181640625,
0.1656494140625,
-0.73681640625,
-0.369140625,
-0.450439453125,
0.461181640625,
0.12078857421875,
-0.1019287109375,
-0.27099609375,
0.55029296875,
0.0027599334716796875,
1.09375,
0.294677734375,
0.378173828125,
-0.63232421875,
-0.79736328125,
0.5634765625,
0.365478515625,
0.2188720703125,
-0.268310546875,
-0.07275390625,
0.1768798828125,
-0.55419921875,
0.038970947265625,
0.8935546875,
0.468505859375,
0.2012939453125,
0.580078125,
-0.30419921875,
0.3310546875,
0.71923828125,
1.115234375,
-0.25146484375,
1.2177734375,
-0.01258087158203125,
0.1588134765625,
0.2457275390625,
0.1590576171875,
-0.305419921875,
-0.0953369140625,
-0.427734375,
-0.29150390625,
0.529296875,
0.27490234375,
-0.290283203125,
0.74853515625,
0.061737060546875,
-0.2127685546875,
-1.0341796875,
0.180908203125,
0.3017578125,
-0.29736328125,
0.1785888671875,
-0.268310546875,
0.1383056640625,
-0.130126953125,
-0.0183868408203125,
0.9150390625,
-0.52734375,
-0.3544921875,
0.270751953125,
-0.2366943359375,
-0.1021728515625,
0.1690673828125,
-0.1451416015625,
0.485595703125,
-0.422119140625,
0.53759765625,
0.91552734375,
-0.62451171875,
0.64892578125,
-0.1292724609375,
-0.082275390625,
1.4853515625,
0.43408203125,
-0.07257080078125,
0.423583984375,
0.418701171875,
-0.5927734375,
0.2322998046875,
-0.716796875,
0.77880859375,
-0.204345703125,
0.141357421875,
-0.1011962890625,
-0.2646484375,
-0.198486328125,
0.467529296875,
0.24365234375,
0.1734619140625,
-0.448486328125,
-0.11639404296875,
-0.270751953125,
0.9892578125,
-0.044891357421875,
0.947265625,
-0.560546875,
-0.57958984375,
-0.03021240234375,
-0.44287109375,
0.7294921875,
-0.224853515625,
-0.041290283203125,
1.0927734375,
0.84375,
0.9501953125,
0.43603515625,
-0.41943359375,
0.14697265625,
0.051971435546875,
0.115234375,
0.2117919921875,
0.09368896484375,
0.716796875,
0.181884765625,
0.1572265625,
0.365478515625,
-0.8291015625,
-0.7763671875,
-0.6708984375,
0.17529296875,
0.58740234375,
-0.580078125,
0.28125,
0.1488037109375,
-0.08087158203125,
-0.50146484375,
-0.066162109375,
0.10223388671875,
-0.82568359375,
-0.43017578125,
0.73388671875,
-0.3564453125,
0.52001953125,
-0.2666015625,
-0.277587890625,
0.43212890625,
1.4755859375,
-0.06927490234375,
-0.1033935546875,
0.53076171875,
0.257080078125,
-0.104736328125,
-0.27734375,
0.435791015625,
-0.6162109375,
-0.64453125,
0.37939453125,
-0.342041015625,
-0.25634765625,
0.09466552734375,
0.712890625,
0.429931640625,
0.458740234375,
-0.61376953125,
-0.285888671875,
0.2626953125,
1.4033203125,
-0.187255859375,
0.494140625,
0.2227783203125,
0.70849609375,
0.3095703125,
1.060546875,
0.3115234375,
0.0665283203125,
0.7724609375,
0.77734375,
0.072998046875,
0.1820068359375,
-0.0966796875,
0.352783203125,
0.07958984375,
0.38916015625,
0.11767578125,
0.55712890625,
-0.318603515625,
-0.12225341796875,
-0.86669921875,
0.305419921875,
-0.83935546875,
0.5791015625,
0.3876953125,
0.28857421875,
-0.8212890625,
-0.4326171875,
0.548828125,
0.5859375,
-0.732421875,
-0.2342529296875,
-0.063232421875,
0.0099945068359375,
0.303466796875,
-0.04925537109375,
0.057830810546875,
0.3017578125,
0.458984375,
0.50146484375,
-0.2091064453125,
-0.48779296875,
-0.919921875,
-1.0625,
-1.1748046875,
-0.68603515625,
-0.70947265625,
-0.330810546875,
0.2471923828125,
-0.68310546875,
0.1422119140625,
-0.5615234375,
-0.0127716064453125,
0.07421875,
-0.80908203125,
0.591796875,
-0.06854248046875,
0.444580078125,
-0.92919921875,
0.320556640625,
-0.11279296875,
1.02734375,
-0.292724609375,
0.1392822265625,
-0.15869140625,
-0.7177734375,
0.293701171875,
-0.32958984375,
0.37939453125,
-0.08782958984375,
-0.93017578125,
-0.4404296875,
-0.90673828125,
0.030242919921875,
-0.282958984375,
-0.048614501953125,
-0.7373046875,
0.8203125,
0.72314453125,
-0.7568359375,
0.52783203125,
0.673828125,
-0.6044921875,
0.56494140625,
0.446533203125,
0.11163330078125,
-0.55810546875,
0.92529296875,
0.533203125,
0.64892578125,
-0.483154296875,
-0.3779296875,
-0.75439453125,
0.1036376953125,
0.0662841796875,
-0.5205078125,
-0.31640625,
0.08892822265625,
0.187255859375,
-1.1455078125,
0.5693359375,
-1.7109375,
-0.97607421875,
-0.10809326171875,
-0.66796875,
1.1728515625,
0.927734375,
0.047149658203125,
-0.302001953125,
-0.132568359375,
-0.279052734375,
0.462158203125,
0.44873046875,
-0.57763671875,
0.154052734375,
0.953125,
0.033843994140625,
-0.0570068359375,
0.5234375,
-0.6787109375,
-0.146728515625,
-0.1202392578125,
0.1993408203125,
0.64208984375,
0.525390625,
0.036376953125,
0.00847625732421875,
0.865234375,
-0.81298828125,
-0.311767578125,
0.193359375,
0.3623046875,
0.71630859375,
0.2685546875,
0.2283935546875,
-0.147216796875,
-0.72802734375,
-0.77294921875,
0.2242431640625,
0.55322265625,
1.1123046875,
-0.525390625,
0.64013671875,
-0.050262451171875,
-0.857421875,
0.47607421875,
-0.75,
-0.344970703125,
0.8876953125,
-0.01107025146484375,
0.6728515625,
-1.0859375,
-0.07928466796875,
0.127685546875,
0.07379150390625,
0.467041015625,
0.63818359375,
0.6357421875,
-0.58203125,
-0.253173828125,
-0.256591796875,
-0.1943359375,
0.0726318359375,
-0.45361328125,
-0.444091796875,
-0.270751953125,
-0.5126953125,
-1.080078125,
0.521484375,
0.5693359375,
0.75830078125,
0.1619873046875,
0.79541015625,
0.02484130859375,
0.89990234375,
0.68701171875,
-0.43505859375,
0.052276611328125,
-0.7216796875,
0.6923828125,
0.444580078125,
-0.338623046875,
-0.430419921875,
-0.29931640625,
-0.06585693359375,
-0.11260986328125,
0.195068359375,
-0.331298828125,
-0.5712890625,
0.0877685546875,
-0.04571533203125,
0.74169921875,
-0.39208984375,
-0.59375,
-0.077880859375,
0.318603515625,
0.4130859375,
-0.460693359375,
0.2047119140625,
-0.64599609375,
0.63818359375,
0.8525390625,
-0.03179931640625,
-0.57275390625,
-0.47412109375,
-0.94580078125,
-0.783203125,
0.1729736328125,
0.8125,
-0.5927734375,
-0.072021484375,
-1.3701171875,
0.50634765625,
0.306640625,
-0.386474609375,
0.10009765625,
-0.10064697265625,
0.292724609375,
0.1422119140625,
0.69580078125,
-0.08233642578125,
-0.42822265625,
0.2489013671875,
-0.6025390625,
0.57568359375,
-0.70947265625,
0.2138671875,
-0.07012939453125,
0.02850341796875,
0.03765869140625,
0.8056640625,
-0.0177001953125,
0.365478515625,
-0.10858154296875,
0.1080322265625,
-0.986328125,
-0.57470703125,
0.439697265625,
0.2340087890625,
-0.45947265625,
0.37255859375,
0.234619140625,
-0.50341796875,
0.25244140625,
0.428955078125,
-0.322021484375,
0.59716796875,
-0.67333984375,
0.619140625,
-0.29296875,
-0.398681640625,
-0.057281494140625,
-0.53271484375,
0.5146484375,
0.0843505859375,
-0.984375,
-0.1619873046875,
-0.9541015625,
-0.170166015625,
-0.2369384765625,
-0.54541015625,
0.432373046875,
0.1590576171875,
0.0283966064453125,
-0.1982421875,
0.00977325439453125,
-0.92041015625,
0.01119232177734375,
-0.5634765625,
-0.244140625,
0.40673828125,
0.11676025390625,
0.62890625,
-0.05255126953125,
-0.46044921875,
0.308837890625,
-0.2374267578125,
0.247802734375,
-0.342041015625,
-0.441650390625,
0.223876953125,
-0.17724609375,
-0.436279296875,
0.374267578125,
-0.6357421875,
0.28662109375,
0.8515625,
-0.035430908203125,
0.32275390625,
0.051605224609375,
-0.53173828125,
0.76904296875,
0.0687255859375,
-1.2099609375,
-0.235595703125,
0.63037109375,
-0.384765625,
0.548828125,
0.73486328125,
-1.126953125,
-0.5224609375,
-0.90087890625,
0.182373046875,
-1.08984375,
-0.16943359375,
-0.8916015625,
-0.160888671875,
-0.450927734375,
0.9501953125,
0.01358795166015625,
-0.6484375,
-0.31005859375,
-1.0537109375,
0.484130859375,
-0.74462890625,
-0.1492919921875,
-0.191650390625,
-0.158447265625,
-0.25341796875,
1.171875,
0.304931640625,
0.2230224609375,
-0.143310546875,
0.00823211669921875,
0.349609375,
-0.06298828125,
-0.421630859375,
-0.22119140625,
0.1849365234375,
0.07354736328125,
-0.454833984375,
0.3466796875,
-0.759765625,
0.578125,
-0.53125,
-0.09271240234375,
0.1268310546875,
-0.5859375,
0.007415771484375,
-0.06292724609375,
1.154296875,
-0.59619140625,
-0.044036865234375,
-0.3447265625,
0.250244140625,
0.61767578125,
-0.2734375,
-0.55712890625,
-0.69775390625,
-0.830078125,
-1.16796875,
0.6181640625,
-0.335693359375,
-0.06439208984375,
-0.2548828125,
-0.2021484375,
1.0263671875,
-0.5263671875,
0.31982421875,
1.4306640625,
0.402587890625,
0.2027587890625,
-0.7451171875,
0.73681640625,
0.32470703125,
-0.497802734375,
-0.273681640625,
0.11676025390625,
-0.83740234375,
0.1561279296875,
-0.397216796875,
-0.9169921875,
-0.5810546875,
-0.0243072509765625,
0.955078125,
-0.41650390625,
1.130859375,
0.144287109375,
-1.0703125,
-0.9111328125,
0.55078125,
0.13427734375,
0.113037109375,
0.728515625,
0.1214599609375,
0.169921875,
0.024322509765625,
0.1558837890625,
-0.08978271484375,
-0.623046875,
1.1875,
0.10418701171875,
-0.362060546875,
0.84765625,
0.97802734375,
-0.888671875,
-0.935546875,
-0.05364990234375,
-0.01110076904296875,
-0.2197265625,
-0.8740234375,
-0.14013671875,
0.66162109375,
-0.77490234375,
0.36279296875,
0.9052734375,
0.06744384765625,
0.11468505859375,
0.027008056640625,
0.3681640625,
-0.76171875,
0.8837890625,
0.990234375,
-0.486083984375,
0.132568359375,
-1.048828125,
0.0253143310546875,
-0.5107421875,
-0.12548828125,
0.98681640625,
-0.70166015625,
0.53662109375,
0.67529296875,
-0.2069091796875,
0.9951171875,
-0.38330078125,
-0.2314453125,
0.196533203125,
-0.7626953125,
-0.6044921875,
-0.203857421875,
0.4345703125,
-0.3662109375,
0.5078125,
-0.66748046875,
0.2783203125,
0.62841796875,
0.3837890625,
-0.372314453125,
-1.091796875,
-0.407470703125,
-1.0048828125,
-0.60498046875,
-0.724609375,
0.1768798828125,
-0.501953125,
0.0941162109375,
0.44384765625,
-0.8935546875,
0.0860595703125,
0.459716796875,
-0.20751953125,
0.76171875,
-0.8857421875,
0.55712890625,
-0.77978515625,
-0.431396484375,
-0.69921875,
-0.31494140625,
-0.293701171875,
-0.10076904296875,
-0.02752685546875,
0.357666015625,
-0.2342529296875,
0.57568359375,
0.0114898681640625,
0.271728515625,
-0.1741943359375,
-0.392822265625,
0.0226287841796875,
-0.0655517578125,
-0.51513671875,
0.333984375,
0.417724609375,
-0.39306640625,
-0.002941131591796875,
-0.1829833984375,
-0.28564453125,
-0.1292724609375,
0.69921875,
0.68798828125,
0.07733154296875,
0.07086181640625,
-0.134765625,
0.058380126953125,
-0.87255859375,
0.097900390625,
0.08447265625,
0.1146240234375,
0.405517578125,
-0.2900390625,
0.344970703125,
0.9208984375,
-0.1407470703125,
0.56787109375,
-0.1754150390625,
0.46435546875,
0.054656982421875,
-0.11077880859375,
0.042510986328125,
-0.01435089111328125,
0.11993408203125,
0.2462158203125,
0.2435302734375,
0.3720703125,
-0.31787109375,
0.67578125,
-0.146728515625,
-0.8486328125,
-0.77587890625,
-0.2734375,
0.1951904296875,
0.337890625,
0.517578125,
-0.06964111328125,
0.08758544921875,
-0.1776123046875,
-0.64306640625,
0.257568359375,
-1.328125,
-0.1890869140625,
1.171875,
-0.317138671875,
-0.495361328125,
-0.355712890625,
-0.350830078125,
-0.0760498046875,
0.525390625,
0.36328125,
-0.63037109375,
0.0012960433959960938,
0.18408203125,
0.65185546875,
-0.64013671875,
0.492431640625,
-0.0989990234375,
0.308349609375,
-0.46923828125,
-0.186279296875,
0.2044677734375,
1.169921875,
-0.088623046875,
-0.44287109375,
-1.0703125,
-0.07025146484375,
0.272705078125,
-0.35546875,
-0.2147216796875,
0.10748291015625,
-0.1268310546875,
0.338134765625,
-0.78076171875,
0.10601806640625,
-0.08587646484375,
0.379150390625,
0.34521484375,
-0.1864013671875,
-0.67138671875,
0.62109375,
0.751953125,
-0.13671875,
1.0576171875,
-0.042694091796875,
0.385498046875,
0.2388916015625,
0.23291015625,
-0.333984375,
0.91162109375,
0.79052734375,
0.253662109375,
-0.326416015625,
0.487548828125,
0.7529296875,
0.13134765625,
-0.07952880859375,
0.050689697265625,
0.07745361328125,
-0.2335205078125,
0.359375,
-0.30078125,
-0.13134765625,
-0.006511688232421875,
-0.07464599609375,
0.28369140625,
-0.236328125,
-0.04180908203125,
-0.52490234375,
-0.74267578125,
0.52587890625,
-0.3408203125,
0.00322723388671875,
0.279052734375,
-0.69580078125,
0.1109619140625,
0.892578125,
0.0307159423828125,
-0.289794921875,
0.89599609375,
0.2462158203125,
0.50341796875,
0.64501953125,
0.453369140625,
0.556640625,
-0.81201171875,
0.455322265625,
0.2344970703125,
-0.041778564453125,
-0.1734619140625,
-0.298095703125,
-0.8623046875,
0.455322265625,
-0.40478515625,
0.0335693359375,
0.68212890625,
-1.068359375,
0.1898193359375,
-0.137939453125,
0.529296875,
-0.56982421875,
0.2230224609375,
0.152099609375,
-0.62646484375,
-0.71923828125,
1.03515625,
-0.1622314453125,
0.414794921875,
0.0406494140625,
1.201171875,
0.1326904296875,
1.7939453125,
0.483642578125,
-0.1029052734375,
-0.1358642578125,
0.21826171875,
-0.51025390625,
-0.474365234375,
-0.2034912109375,
-0.410400390625,
0.5966796875,
-0.6474609375,
-0.325439453125,
-0.167724609375,
0.8017578125,
0.37744140625,
-1.1416015625,
-0.484375,
0.3603515625,
-0.291259765625,
0.313232421875,
0.406005859375,
0.078857421875,
0.005260467529296875,
0.1578369140625,
0.026397705078125,
-0.76171875,
-0.1376953125,
-0.82275390625,
0.418701171875,
-0.006900787353515625,
-0.7744140625,
-0.43505859375,
-0.8525390625,
-0.114013671875,
0.2176513671875,
-0.448486328125,
-0.7685546875,
0.615234375,
0.5947265625,
0.6572265625,
0.12005615234375,
-0.2359619140625,
-0.249267578125,
1.0556640625,
0.99609375,
0.14892578125,
1.1005859375,
0.42138671875,
-0.1409912109375,
0.256591796875,
-0.37646484375,
0.64208984375,
0.158447265625,
0.085693359375,
-0.30517578125,
-0.421875,
-0.68115234375,
-1.248046875,
0.006504058837890625,
1.0390625,
0.6142578125,
-0.4677734375,
-1.0712890625,
-0.74072265625,
-1.064453125,
-0.04595947265625,
-0.375,
1.021484375,
-0.214111328125,
-0.1588134765625,
0.09527587890625,
-1.3037109375,
4.3359375,
1.2099609375,
0.78564453125,
-0.01035308837890625,
0.0943603515625,
1.01171875,
0.88818359375,
-0.391845703125,
-0.080322265625,
-0.341796875,
0.2486572265625,
-0.485595703125,
0.305419921875,
0.89208984375,
0.03436279296875,
0.59521484375,
-0.6142578125,
-0.23583984375,
0.193115234375,
-0.783203125,
-0.7021484375,
0.367431640625,
0.06170654296875,
0.5556640625,
0.1361083984375,
0.5419921875,
0.67822265625,
-0.7041015625,
0.06689453125,
-0.60302734375,
0.011688232421875,
-0.56201171875,
1.0556640625,
0.1749267578125,
-0.35205078125,
0.369384765625,
-0.09381103515625,
-0.92578125,
-0.208251953125,
0.18701171875,
0.055023193359375,
-0.0330810546875,
0.51708984375,
-0.8154296875,
-0.1273193359375,
0.47412109375,
-0.373291015625,
0.2568359375,
0.48779296875,
-1.044921875,
0.583984375,
-0.6005859375,
0.59033203125,
-0.65576171875,
-0.297119140625,
0.266845703125,
0.60302734375,
-0.15625,
-0.18603515625,
0.5537109375,
0.358154296875,
0.302490234375,
0.0003230571746826172,
0.76904296875,
-0.95166015625,
0.420166015625,
-0.5712890625,
0.5595703125,
-0.11181640625,
0.0233306884765625,
-0.2548828125,
-0.2391357421875,
-0.58642578125,
-0.8095703125,
0.49560546875,
0.275634765625,
-0.2113037109375,
0.54736328125,
0.70751953125,
-0.2462158203125,
-0.2442626953125,
-0.2330322265625,
-0.248291015625,
-0.5771484375,
0.1341552734375,
1.1728515625,
-0.634765625,
-0.3583984375,
-0.372314453125,
0.8564453125,
0.4658203125,
0.4931640625,
0.225830078125,
-0.2724609375,
-0.190673828125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Recently Vladik discovered a new entertainment — coding bots for social networks. He would like to use machine learning in his bots so now he want to prepare some learning data for them.
At first, he need to download t chats. Vladik coded a script which should have downloaded the chats, however, something went wrong. In particular, some of the messages have no information of their sender. It is known that if a person sends several messages in a row, they all are merged into a single message. It means that there could not be two or more messages in a row with the same sender. Moreover, a sender never mention himself in his messages.
Vladik wants to recover senders of all the messages so that each two neighboring messages will have different senders and no sender will mention himself in his messages.
He has no idea of how to do this, and asks you for help. Help Vladik to recover senders in each of the chats!
Input
The first line contains single integer t (1 ≤ t ≤ 10) — the number of chats. The t chats follow. Each chat is given in the following format.
The first line of each chat description contains single integer n (1 ≤ n ≤ 100) — the number of users in the chat.
The next line contains n space-separated distinct usernames. Each username consists of lowercase and uppercase English letters and digits. The usernames can't start with a digit. Two usernames are different even if they differ only with letters' case. The length of username is positive and doesn't exceed 10 characters.
The next line contains single integer m (1 ≤ m ≤ 100) — the number of messages in the chat. The next m line contain the messages in the following formats, one per line:
* <username>:<text> — the format of a message with known sender. The username should appear in the list of usernames of the chat.
* <?>:<text> — the format of a message with unknown sender.
The text of a message can consist of lowercase and uppercase English letter, digits, characters '.' (dot), ',' (comma), '!' (exclamation mark), '?' (question mark) and ' ' (space). The text doesn't contain trailing spaces. The length of the text is positive and doesn't exceed 100 characters.
We say that a text mention a user if his username appears in the text as a word. In other words, the username appears in a such a position that the two characters before and after its appearance either do not exist or are not English letters or digits. For example, the text "Vasya, masha13 and Kate!" can mention users "Vasya", "masha13", "and" and "Kate", but not "masha".
It is guaranteed that in each chat no known sender mention himself in his messages and there are no two neighboring messages with the same known sender.
Output
Print the information about the t chats in the following format:
If it is not possible to recover senders, print single line "Impossible" for this chat. Otherwise print m messages in the following format:
<username>:<text>
If there are multiple answers, print any of them.
Examples
Input
1
2
Vladik netman
2
?: Hello, Vladik!
?: Hi
Output
netman: Hello, Vladik!
Vladik: Hi
Input
1
2
netman vladik
3
netman:how are you?
?:wrong message
vladik:im fine
Output
Impossible
Input
2
3
netman vladik Fedosik
2
?: users are netman, vladik, Fedosik
vladik: something wrong with this chat
4
netman tigerrrrr banany2001 klinchuh
4
?: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
?: yes, netman
banany2001: yes of course.
Output
Impossible
netman: tigerrrrr, banany2001, klinchuh, my favourite team ever, are you ready?
klinchuh: yes, coach!
tigerrrrr: yes, netman
banany2001: yes of course.
Submitted Solution:
```
#!/usr/bin/python3
# BEGIN template
import sys
import re
import pprint
def dbg(x,y=''):
if len(y) > 0: y += ' = '
sys.stderr.write('\n>>> '+y+pprint.pformat(x)+'\n')
oo = 0x3f3f3f3f3f3f3f3f
# END template
def main():
for t in range(int(input())):
# input
n = int(input())
users = set(input().split())
m = int(input())
msg = []
for i in range(m):
user, text = input().split(':')
alts = set()
if user != '?':
alts.add(user)
else:
# this shit is pretty fucked up, dude
alts = users - set(re.findall('[a-zA-Z][a-zA-Z0-9]*',text))
msg.append(dict(user=user, text=text, users=alts))
# remove before and after
for i in range(m):
if len(msg[i]['users']) > 1: continue
t = False
if 0 <= i-1:
msg[i-1]['users'].difference_update(msg[i]['users'])
t = True
if t and i+1 < m: msg[i+1]['users'].difference_update(msg[i]['users'])
# compute answer
last = ''
impo = False
for i in range(m):
msg[i]['users'].discard(last)
if len(msg[i]['users']) == 0:
impo = True
break
last = next(iter(msg[i]['users']))
msg[i]['user'] = last
if impo:
print('Impossible')
continue
for i in range(m):
print(msg[i]['user']+':'+msg[i]['text'])
'''
dp = [[0 for j in range(n+5)] for i in range(m+5)]
for i in range(1,n+5):
dp[m+1][i] = oo
for i in range(m,0,-1):
for j in range(n+1):
for k in msg[i]['users']:
if k != j and dp[i+1][k]:
dp[i][j] = k
break
# output
if not dp[1][0]:
print('Impossible')
continue
j = 0
for i in range(1,m+1):
print(users[dp[i][j]]+':'+msg[i]['text'])
j = dp[i][j]'''
main()
```
No
| 65,328
|
[
0.475341796875,
-0.2286376953125,
-0.1912841796875,
0.5458984375,
-0.26953125,
-0.75146484375,
-0.5986328125,
0.0175628662109375,
0.12066650390625,
0.59130859375,
0.256103515625,
-0.005313873291015625,
0.2279052734375,
-0.452392578125,
-1.0263671875,
0.00272369384765625,
-0.391357421875,
-0.72705078125,
-0.07281494140625,
-0.059112548828125,
0.44580078125,
0.005245208740234375,
-1.3671875,
-0.501953125,
-0.75537109375,
0.492919921875,
0.1285400390625,
-0.0170135498046875,
0.9677734375,
0.9873046875,
-0.30615234375,
-0.43017578125,
0.151123046875,
-1.3583984375,
-0.2200927734375,
-0.1558837890625,
0.6142578125,
-0.63623046875,
-0.7646484375,
-0.57568359375,
0.11260986328125,
-0.427490234375,
0.77880859375,
-0.85595703125,
-1.3193359375,
0.1746826171875,
-0.282958984375,
-0.1512451171875,
-0.010772705078125,
-0.91259765625,
0.46533203125,
-0.13671875,
0.7626953125,
-0.338623046875,
-0.1329345703125,
-0.67138671875,
-0.43310546875,
0.2509765625,
-0.6533203125,
0.08428955078125,
-0.1590576171875,
0.47119140625,
-0.1168212890625,
-0.58984375,
-0.05694580078125,
-0.11578369140625,
-0.1383056640625,
-0.25732421875,
0.0804443359375,
-0.48876953125,
-0.2086181640625,
0.1656494140625,
-0.73681640625,
-0.369140625,
-0.450439453125,
0.461181640625,
0.12078857421875,
-0.1019287109375,
-0.27099609375,
0.55029296875,
0.0027599334716796875,
1.09375,
0.294677734375,
0.378173828125,
-0.63232421875,
-0.79736328125,
0.5634765625,
0.365478515625,
0.2188720703125,
-0.268310546875,
-0.07275390625,
0.1768798828125,
-0.55419921875,
0.038970947265625,
0.8935546875,
0.468505859375,
0.2012939453125,
0.580078125,
-0.30419921875,
0.3310546875,
0.71923828125,
1.115234375,
-0.25146484375,
1.2177734375,
-0.01258087158203125,
0.1588134765625,
0.2457275390625,
0.1590576171875,
-0.305419921875,
-0.0953369140625,
-0.427734375,
-0.29150390625,
0.529296875,
0.27490234375,
-0.290283203125,
0.74853515625,
0.061737060546875,
-0.2127685546875,
-1.0341796875,
0.180908203125,
0.3017578125,
-0.29736328125,
0.1785888671875,
-0.268310546875,
0.1383056640625,
-0.130126953125,
-0.0183868408203125,
0.9150390625,
-0.52734375,
-0.3544921875,
0.270751953125,
-0.2366943359375,
-0.1021728515625,
0.1690673828125,
-0.1451416015625,
0.485595703125,
-0.422119140625,
0.53759765625,
0.91552734375,
-0.62451171875,
0.64892578125,
-0.1292724609375,
-0.082275390625,
1.4853515625,
0.43408203125,
-0.07257080078125,
0.423583984375,
0.418701171875,
-0.5927734375,
0.2322998046875,
-0.716796875,
0.77880859375,
-0.204345703125,
0.141357421875,
-0.1011962890625,
-0.2646484375,
-0.198486328125,
0.467529296875,
0.24365234375,
0.1734619140625,
-0.448486328125,
-0.11639404296875,
-0.270751953125,
0.9892578125,
-0.044891357421875,
0.947265625,
-0.560546875,
-0.57958984375,
-0.03021240234375,
-0.44287109375,
0.7294921875,
-0.224853515625,
-0.041290283203125,
1.0927734375,
0.84375,
0.9501953125,
0.43603515625,
-0.41943359375,
0.14697265625,
0.051971435546875,
0.115234375,
0.2117919921875,
0.09368896484375,
0.716796875,
0.181884765625,
0.1572265625,
0.365478515625,
-0.8291015625,
-0.7763671875,
-0.6708984375,
0.17529296875,
0.58740234375,
-0.580078125,
0.28125,
0.1488037109375,
-0.08087158203125,
-0.50146484375,
-0.066162109375,
0.10223388671875,
-0.82568359375,
-0.43017578125,
0.73388671875,
-0.3564453125,
0.52001953125,
-0.2666015625,
-0.277587890625,
0.43212890625,
1.4755859375,
-0.06927490234375,
-0.1033935546875,
0.53076171875,
0.257080078125,
-0.104736328125,
-0.27734375,
0.435791015625,
-0.6162109375,
-0.64453125,
0.37939453125,
-0.342041015625,
-0.25634765625,
0.09466552734375,
0.712890625,
0.429931640625,
0.458740234375,
-0.61376953125,
-0.285888671875,
0.2626953125,
1.4033203125,
-0.187255859375,
0.494140625,
0.2227783203125,
0.70849609375,
0.3095703125,
1.060546875,
0.3115234375,
0.0665283203125,
0.7724609375,
0.77734375,
0.072998046875,
0.1820068359375,
-0.0966796875,
0.352783203125,
0.07958984375,
0.38916015625,
0.11767578125,
0.55712890625,
-0.318603515625,
-0.12225341796875,
-0.86669921875,
0.305419921875,
-0.83935546875,
0.5791015625,
0.3876953125,
0.28857421875,
-0.8212890625,
-0.4326171875,
0.548828125,
0.5859375,
-0.732421875,
-0.2342529296875,
-0.063232421875,
0.0099945068359375,
0.303466796875,
-0.04925537109375,
0.057830810546875,
0.3017578125,
0.458984375,
0.50146484375,
-0.2091064453125,
-0.48779296875,
-0.919921875,
-1.0625,
-1.1748046875,
-0.68603515625,
-0.70947265625,
-0.330810546875,
0.2471923828125,
-0.68310546875,
0.1422119140625,
-0.5615234375,
-0.0127716064453125,
0.07421875,
-0.80908203125,
0.591796875,
-0.06854248046875,
0.444580078125,
-0.92919921875,
0.320556640625,
-0.11279296875,
1.02734375,
-0.292724609375,
0.1392822265625,
-0.15869140625,
-0.7177734375,
0.293701171875,
-0.32958984375,
0.37939453125,
-0.08782958984375,
-0.93017578125,
-0.4404296875,
-0.90673828125,
0.030242919921875,
-0.282958984375,
-0.048614501953125,
-0.7373046875,
0.8203125,
0.72314453125,
-0.7568359375,
0.52783203125,
0.673828125,
-0.6044921875,
0.56494140625,
0.446533203125,
0.11163330078125,
-0.55810546875,
0.92529296875,
0.533203125,
0.64892578125,
-0.483154296875,
-0.3779296875,
-0.75439453125,
0.1036376953125,
0.0662841796875,
-0.5205078125,
-0.31640625,
0.08892822265625,
0.187255859375,
-1.1455078125,
0.5693359375,
-1.7109375,
-0.97607421875,
-0.10809326171875,
-0.66796875,
1.1728515625,
0.927734375,
0.047149658203125,
-0.302001953125,
-0.132568359375,
-0.279052734375,
0.462158203125,
0.44873046875,
-0.57763671875,
0.154052734375,
0.953125,
0.033843994140625,
-0.0570068359375,
0.5234375,
-0.6787109375,
-0.146728515625,
-0.1202392578125,
0.1993408203125,
0.64208984375,
0.525390625,
0.036376953125,
0.00847625732421875,
0.865234375,
-0.81298828125,
-0.311767578125,
0.193359375,
0.3623046875,
0.71630859375,
0.2685546875,
0.2283935546875,
-0.147216796875,
-0.72802734375,
-0.77294921875,
0.2242431640625,
0.55322265625,
1.1123046875,
-0.525390625,
0.64013671875,
-0.050262451171875,
-0.857421875,
0.47607421875,
-0.75,
-0.344970703125,
0.8876953125,
-0.01107025146484375,
0.6728515625,
-1.0859375,
-0.07928466796875,
0.127685546875,
0.07379150390625,
0.467041015625,
0.63818359375,
0.6357421875,
-0.58203125,
-0.253173828125,
-0.256591796875,
-0.1943359375,
0.0726318359375,
-0.45361328125,
-0.444091796875,
-0.270751953125,
-0.5126953125,
-1.080078125,
0.521484375,
0.5693359375,
0.75830078125,
0.1619873046875,
0.79541015625,
0.02484130859375,
0.89990234375,
0.68701171875,
-0.43505859375,
0.052276611328125,
-0.7216796875,
0.6923828125,
0.444580078125,
-0.338623046875,
-0.430419921875,
-0.29931640625,
-0.06585693359375,
-0.11260986328125,
0.195068359375,
-0.331298828125,
-0.5712890625,
0.0877685546875,
-0.04571533203125,
0.74169921875,
-0.39208984375,
-0.59375,
-0.077880859375,
0.318603515625,
0.4130859375,
-0.460693359375,
0.2047119140625,
-0.64599609375,
0.63818359375,
0.8525390625,
-0.03179931640625,
-0.57275390625,
-0.47412109375,
-0.94580078125,
-0.783203125,
0.1729736328125,
0.8125,
-0.5927734375,
-0.072021484375,
-1.3701171875,
0.50634765625,
0.306640625,
-0.386474609375,
0.10009765625,
-0.10064697265625,
0.292724609375,
0.1422119140625,
0.69580078125,
-0.08233642578125,
-0.42822265625,
0.2489013671875,
-0.6025390625,
0.57568359375,
-0.70947265625,
0.2138671875,
-0.07012939453125,
0.02850341796875,
0.03765869140625,
0.8056640625,
-0.0177001953125,
0.365478515625,
-0.10858154296875,
0.1080322265625,
-0.986328125,
-0.57470703125,
0.439697265625,
0.2340087890625,
-0.45947265625,
0.37255859375,
0.234619140625,
-0.50341796875,
0.25244140625,
0.428955078125,
-0.322021484375,
0.59716796875,
-0.67333984375,
0.619140625,
-0.29296875,
-0.398681640625,
-0.057281494140625,
-0.53271484375,
0.5146484375,
0.0843505859375,
-0.984375,
-0.1619873046875,
-0.9541015625,
-0.170166015625,
-0.2369384765625,
-0.54541015625,
0.432373046875,
0.1590576171875,
0.0283966064453125,
-0.1982421875,
0.00977325439453125,
-0.92041015625,
0.01119232177734375,
-0.5634765625,
-0.244140625,
0.40673828125,
0.11676025390625,
0.62890625,
-0.05255126953125,
-0.46044921875,
0.308837890625,
-0.2374267578125,
0.247802734375,
-0.342041015625,
-0.441650390625,
0.223876953125,
-0.17724609375,
-0.436279296875,
0.374267578125,
-0.6357421875,
0.28662109375,
0.8515625,
-0.035430908203125,
0.32275390625,
0.051605224609375,
-0.53173828125,
0.76904296875,
0.0687255859375,
-1.2099609375,
-0.235595703125,
0.63037109375,
-0.384765625,
0.548828125,
0.73486328125,
-1.126953125,
-0.5224609375,
-0.90087890625,
0.182373046875,
-1.08984375,
-0.16943359375,
-0.8916015625,
-0.160888671875,
-0.450927734375,
0.9501953125,
0.01358795166015625,
-0.6484375,
-0.31005859375,
-1.0537109375,
0.484130859375,
-0.74462890625,
-0.1492919921875,
-0.191650390625,
-0.158447265625,
-0.25341796875,
1.171875,
0.304931640625,
0.2230224609375,
-0.143310546875,
0.00823211669921875,
0.349609375,
-0.06298828125,
-0.421630859375,
-0.22119140625,
0.1849365234375,
0.07354736328125,
-0.454833984375,
0.3466796875,
-0.759765625,
0.578125,
-0.53125,
-0.09271240234375,
0.1268310546875,
-0.5859375,
0.007415771484375,
-0.06292724609375,
1.154296875,
-0.59619140625,
-0.044036865234375,
-0.3447265625,
0.250244140625,
0.61767578125,
-0.2734375,
-0.55712890625,
-0.69775390625,
-0.830078125,
-1.16796875,
0.6181640625,
-0.335693359375,
-0.06439208984375,
-0.2548828125,
-0.2021484375,
1.0263671875,
-0.5263671875,
0.31982421875,
1.4306640625,
0.402587890625,
0.2027587890625,
-0.7451171875,
0.73681640625,
0.32470703125,
-0.497802734375,
-0.273681640625,
0.11676025390625,
-0.83740234375,
0.1561279296875,
-0.397216796875,
-0.9169921875,
-0.5810546875,
-0.0243072509765625,
0.955078125,
-0.41650390625,
1.130859375,
0.144287109375,
-1.0703125,
-0.9111328125,
0.55078125,
0.13427734375,
0.113037109375,
0.728515625,
0.1214599609375,
0.169921875,
0.024322509765625,
0.1558837890625,
-0.08978271484375,
-0.623046875,
1.1875,
0.10418701171875,
-0.362060546875,
0.84765625,
0.97802734375,
-0.888671875,
-0.935546875,
-0.05364990234375,
-0.01110076904296875,
-0.2197265625,
-0.8740234375,
-0.14013671875,
0.66162109375,
-0.77490234375,
0.36279296875,
0.9052734375,
0.06744384765625,
0.11468505859375,
0.027008056640625,
0.3681640625,
-0.76171875,
0.8837890625,
0.990234375,
-0.486083984375,
0.132568359375,
-1.048828125,
0.0253143310546875,
-0.5107421875,
-0.12548828125,
0.98681640625,
-0.70166015625,
0.53662109375,
0.67529296875,
-0.2069091796875,
0.9951171875,
-0.38330078125,
-0.2314453125,
0.196533203125,
-0.7626953125,
-0.6044921875,
-0.203857421875,
0.4345703125,
-0.3662109375,
0.5078125,
-0.66748046875,
0.2783203125,
0.62841796875,
0.3837890625,
-0.372314453125,
-1.091796875,
-0.407470703125,
-1.0048828125,
-0.60498046875,
-0.724609375,
0.1768798828125,
-0.501953125,
0.0941162109375,
0.44384765625,
-0.8935546875,
0.0860595703125,
0.459716796875,
-0.20751953125,
0.76171875,
-0.8857421875,
0.55712890625,
-0.77978515625,
-0.431396484375,
-0.69921875,
-0.31494140625,
-0.293701171875,
-0.10076904296875,
-0.02752685546875,
0.357666015625,
-0.2342529296875,
0.57568359375,
0.0114898681640625,
0.271728515625,
-0.1741943359375,
-0.392822265625,
0.0226287841796875,
-0.0655517578125,
-0.51513671875,
0.333984375,
0.417724609375,
-0.39306640625,
-0.002941131591796875,
-0.1829833984375,
-0.28564453125,
-0.1292724609375,
0.69921875,
0.68798828125,
0.07733154296875,
0.07086181640625,
-0.134765625,
0.058380126953125,
-0.87255859375,
0.097900390625,
0.08447265625,
0.1146240234375,
0.405517578125,
-0.2900390625,
0.344970703125,
0.9208984375,
-0.1407470703125,
0.56787109375,
-0.1754150390625,
0.46435546875,
0.054656982421875,
-0.11077880859375,
0.042510986328125,
-0.01435089111328125,
0.11993408203125,
0.2462158203125,
0.2435302734375,
0.3720703125,
-0.31787109375,
0.67578125,
-0.146728515625,
-0.8486328125,
-0.77587890625,
-0.2734375,
0.1951904296875,
0.337890625,
0.517578125,
-0.06964111328125,
0.08758544921875,
-0.1776123046875,
-0.64306640625,
0.257568359375,
-1.328125,
-0.1890869140625,
1.171875,
-0.317138671875,
-0.495361328125,
-0.355712890625,
-0.350830078125,
-0.0760498046875,
0.525390625,
0.36328125,
-0.63037109375,
0.0012960433959960938,
0.18408203125,
0.65185546875,
-0.64013671875,
0.492431640625,
-0.0989990234375,
0.308349609375,
-0.46923828125,
-0.186279296875,
0.2044677734375,
1.169921875,
-0.088623046875,
-0.44287109375,
-1.0703125,
-0.07025146484375,
0.272705078125,
-0.35546875,
-0.2147216796875,
0.10748291015625,
-0.1268310546875,
0.338134765625,
-0.78076171875,
0.10601806640625,
-0.08587646484375,
0.379150390625,
0.34521484375,
-0.1864013671875,
-0.67138671875,
0.62109375,
0.751953125,
-0.13671875,
1.0576171875,
-0.042694091796875,
0.385498046875,
0.2388916015625,
0.23291015625,
-0.333984375,
0.91162109375,
0.79052734375,
0.253662109375,
-0.326416015625,
0.487548828125,
0.7529296875,
0.13134765625,
-0.07952880859375,
0.050689697265625,
0.07745361328125,
-0.2335205078125,
0.359375,
-0.30078125,
-0.13134765625,
-0.006511688232421875,
-0.07464599609375,
0.28369140625,
-0.236328125,
-0.04180908203125,
-0.52490234375,
-0.74267578125,
0.52587890625,
-0.3408203125,
0.00322723388671875,
0.279052734375,
-0.69580078125,
0.1109619140625,
0.892578125,
0.0307159423828125,
-0.289794921875,
0.89599609375,
0.2462158203125,
0.50341796875,
0.64501953125,
0.453369140625,
0.556640625,
-0.81201171875,
0.455322265625,
0.2344970703125,
-0.041778564453125,
-0.1734619140625,
-0.298095703125,
-0.8623046875,
0.455322265625,
-0.40478515625,
0.0335693359375,
0.68212890625,
-1.068359375,
0.1898193359375,
-0.137939453125,
0.529296875,
-0.56982421875,
0.2230224609375,
0.152099609375,
-0.62646484375,
-0.71923828125,
1.03515625,
-0.1622314453125,
0.414794921875,
0.0406494140625,
1.201171875,
0.1326904296875,
1.7939453125,
0.483642578125,
-0.1029052734375,
-0.1358642578125,
0.21826171875,
-0.51025390625,
-0.474365234375,
-0.2034912109375,
-0.410400390625,
0.5966796875,
-0.6474609375,
-0.325439453125,
-0.167724609375,
0.8017578125,
0.37744140625,
-1.1416015625,
-0.484375,
0.3603515625,
-0.291259765625,
0.313232421875,
0.406005859375,
0.078857421875,
0.005260467529296875,
0.1578369140625,
0.026397705078125,
-0.76171875,
-0.1376953125,
-0.82275390625,
0.418701171875,
-0.006900787353515625,
-0.7744140625,
-0.43505859375,
-0.8525390625,
-0.114013671875,
0.2176513671875,
-0.448486328125,
-0.7685546875,
0.615234375,
0.5947265625,
0.6572265625,
0.12005615234375,
-0.2359619140625,
-0.249267578125,
1.0556640625,
0.99609375,
0.14892578125,
1.1005859375,
0.42138671875,
-0.1409912109375,
0.256591796875,
-0.37646484375,
0.64208984375,
0.158447265625,
0.085693359375,
-0.30517578125,
-0.421875,
-0.68115234375,
-1.248046875,
0.006504058837890625,
1.0390625,
0.6142578125,
-0.4677734375,
-1.0712890625,
-0.74072265625,
-1.064453125,
-0.04595947265625,
-0.375,
1.021484375,
-0.214111328125,
-0.1588134765625,
0.09527587890625,
-1.3037109375,
4.3359375,
1.2099609375,
0.78564453125,
-0.01035308837890625,
0.0943603515625,
1.01171875,
0.88818359375,
-0.391845703125,
-0.080322265625,
-0.341796875,
0.2486572265625,
-0.485595703125,
0.305419921875,
0.89208984375,
0.03436279296875,
0.59521484375,
-0.6142578125,
-0.23583984375,
0.193115234375,
-0.783203125,
-0.7021484375,
0.367431640625,
0.06170654296875,
0.5556640625,
0.1361083984375,
0.5419921875,
0.67822265625,
-0.7041015625,
0.06689453125,
-0.60302734375,
0.011688232421875,
-0.56201171875,
1.0556640625,
0.1749267578125,
-0.35205078125,
0.369384765625,
-0.09381103515625,
-0.92578125,
-0.208251953125,
0.18701171875,
0.055023193359375,
-0.0330810546875,
0.51708984375,
-0.8154296875,
-0.1273193359375,
0.47412109375,
-0.373291015625,
0.2568359375,
0.48779296875,
-1.044921875,
0.583984375,
-0.6005859375,
0.59033203125,
-0.65576171875,
-0.297119140625,
0.266845703125,
0.60302734375,
-0.15625,
-0.18603515625,
0.5537109375,
0.358154296875,
0.302490234375,
0.0003230571746826172,
0.76904296875,
-0.95166015625,
0.420166015625,
-0.5712890625,
0.5595703125,
-0.11181640625,
0.0233306884765625,
-0.2548828125,
-0.2391357421875,
-0.58642578125,
-0.8095703125,
0.49560546875,
0.275634765625,
-0.2113037109375,
0.54736328125,
0.70751953125,
-0.2462158203125,
-0.2442626953125,
-0.2330322265625,
-0.248291015625,
-0.5771484375,
0.1341552734375,
1.1728515625,
-0.634765625,
-0.3583984375,
-0.372314453125,
0.8564453125,
0.4658203125,
0.4931640625,
0.225830078125,
-0.2724609375,
-0.190673828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete logarithm!
Of course, there is a code lock is installed on the safe. The lock has a screen that displays a string of n lowercase Latin letters. Initially, the screen displays string s. Whitfield and Martin found out that the safe will open when string t will be displayed on the screen.
The string on the screen can be changed using the operation «shift x». In order to apply this operation, explorers choose an integer x from 0 to n inclusive. After that, the current string p = αβ changes to βRα, where the length of β is x, and the length of α is n - x. In other words, the suffix of the length x of string p is reversed and moved to the beginning of the string. For example, after the operation «shift 4» the string «abcacb» will be changed with string «bcacab », since α = ab, β = cacb, βR = bcac.
Explorers are afraid that if they apply too many operations «shift», the lock will be locked forever. They ask you to find a way to get the string t on the screen, using no more than 6100 operations.
Input
The first line contains an integer n, the length of the strings s and t (1 ≤ n ≤ 2 000).
After that, there are two strings s and t, consisting of n lowercase Latin letters each.
Output
If it is impossible to get string t from string s using no more than 6100 operations «shift», print a single number - 1.
Otherwise, in the first line output the number of operations k (0 ≤ k ≤ 6100). In the next line output k numbers xi corresponding to the operations «shift xi» (0 ≤ xi ≤ n) in the order in which they should be applied.
Examples
Input
6
abacbb
babcba
Output
4
6 3 2 3
Input
3
aba
bba
Output
-1
Tags: constructive algorithms, implementation, strings
Correct Solution:
```
n = int(input())
s = input()
t = input()
if sorted(s) != sorted(t):
print(-1)
else:
res = []
for i in range(n):
k = 0
while(s[k] != t[i]):
k += 1
res += [n - k - 1, 1, n]
s = ''.join(reversed(s[:k])) + s[k + 1:] + s[k]
# print(s)
print(len(res))
print(*res)
```
| 65,382
|
[
0.35302734375,
-0.05657958984375,
-0.391845703125,
0.265869140625,
-0.2037353515625,
-0.5068359375,
-0.178955078125,
0.07183837890625,
0.327392578125,
1.0107421875,
1.099609375,
-0.142578125,
0.2164306640625,
-1.115234375,
-0.38330078125,
0.2802734375,
-0.2822265625,
-0.5712890625,
-0.406005859375,
0.56689453125,
0.356689453125,
-0.0579833984375,
-1.3115234375,
-0.2196044921875,
-0.77490234375,
0.75146484375,
0.426513671875,
-0.1600341796875,
1.0810546875,
1.33203125,
-0.331787109375,
-0.368896484375,
0.87890625,
-0.90478515625,
-0.45703125,
-0.37255859375,
0.416748046875,
-0.58056640625,
-0.0008015632629394531,
-0.58544921875,
0.260009765625,
-0.305908203125,
0.53466796875,
-0.417236328125,
-1.439453125,
-0.076171875,
-0.39697265625,
-0.1796875,
-0.10821533203125,
-0.740234375,
0.201904296875,
0.01015472412109375,
0.69189453125,
-0.286376953125,
0.0770263671875,
0.3203125,
-0.130859375,
-0.4375,
-0.351806640625,
0.26904296875,
0.277587890625,
-0.00989532470703125,
-0.0216827392578125,
-0.432861328125,
-0.1539306640625,
0.19384765625,
-0.1466064453125,
-0.247314453125,
-0.115478515625,
-0.86474609375,
0.060516357421875,
0.578125,
-0.446533203125,
-0.277099609375,
-0.28173828125,
-0.008056640625,
0.2279052734375,
0.2469482421875,
-1.0869140625,
0.990234375,
-0.10968017578125,
1.0869140625,
0.267333984375,
0.221923828125,
-0.31591796875,
-0.6015625,
-0.2274169921875,
-0.1773681640625,
0.0389404296875,
-0.317138671875,
-0.08038330078125,
0.494873046875,
-0.4404296875,
-0.11181640625,
0.484619140625,
0.50341796875,
-0.1820068359375,
0.12359619140625,
0.82666015625,
0.2144775390625,
0.51953125,
0.857421875,
-0.5380859375,
0.931640625,
-0.47412109375,
-0.2225341796875,
0.1651611328125,
0.2281494140625,
-0.2384033203125,
-0.267333984375,
-0.1552734375,
-0.5419921875,
0.4853515625,
0.16015625,
-0.06854248046875,
0.93994140625,
-0.2244873046875,
0.4990234375,
-0.455322265625,
0.1456298828125,
0.62060546875,
0.05035400390625,
0.60205078125,
-0.403076171875,
-0.1513671875,
-0.259765625,
-0.2203369140625,
0.79541015625,
-0.5869140625,
-0.21533203125,
-0.13330078125,
-0.1309814453125,
-0.40673828125,
0.426513671875,
-0.1981201171875,
0.94921875,
-0.07391357421875,
0.8291015625,
0.71337890625,
-0.69921875,
0.66552734375,
-0.332275390625,
-0.057403564453125,
1.3974609375,
0.5263671875,
0.062347412109375,
0.6591796875,
0.405029296875,
-0.603515625,
0.4951171875,
-1.0478515625,
0.73876953125,
0.293701171875,
0.28955078125,
-0.41015625,
0.08648681640625,
-0.270263671875,
0.93408203125,
-0.040283203125,
-0.03094482421875,
-0.312744140625,
0.482666015625,
-0.05181884765625,
0.89501953125,
-0.33740234375,
0.9677734375,
-0.083740234375,
-0.7060546875,
-0.07281494140625,
-0.46728515625,
0.1334228515625,
-0.05029296875,
-0.52490234375,
0.9208984375,
0.6533203125,
0.82568359375,
1.111328125,
-0.29541015625,
0.37939453125,
0.267822265625,
-0.560546875,
0.0887451171875,
0.2264404296875,
0.7509765625,
-0.03497314453125,
0.041412353515625,
0.260986328125,
-0.1888427734375,
-0.84033203125,
-0.29150390625,
-0.0933837890625,
0.94482421875,
-0.80419921875,
0.374755859375,
0.44140625,
-0.01995849609375,
-1.064453125,
-0.1295166015625,
0.1099853515625,
-0.931640625,
-0.25927734375,
0.90283203125,
-0.1402587890625,
0.779296875,
-0.452392578125,
-0.52978515625,
0.4609375,
1.1220703125,
-0.19091796875,
-0.1317138671875,
0.237060546875,
-0.00908660888671875,
-0.4658203125,
-0.1270751953125,
0.2249755859375,
0.0628662109375,
-0.51611328125,
0.96826171875,
0.1925048828125,
-0.07562255859375,
0.1134033203125,
0.81591796875,
0.349853515625,
0.69921875,
-0.322509765625,
-0.2410888671875,
0.493896484375,
0.8642578125,
-0.0081634521484375,
0.1922607421875,
0.338623046875,
0.86572265625,
0.32666015625,
0.6025390625,
0.0601806640625,
0.2401123046875,
0.284423828125,
0.77880859375,
0.1158447265625,
0.355224609375,
0.2371826171875,
0.427490234375,
0.027374267578125,
0.220458984375,
0.18994140625,
0.1732177734375,
0.00133514404296875,
0.0203399658203125,
-0.361572265625,
0.302978515625,
-0.552734375,
0.859375,
-0.152587890625,
0.270263671875,
-0.28564453125,
-0.1820068359375,
0.384765625,
0.6767578125,
-1.158203125,
-0.413330078125,
0.0032482147216796875,
0.01629638671875,
0.1661376953125,
-0.41552734375,
0.7705078125,
0.49267578125,
0.5068359375,
0.466796875,
-0.36767578125,
-0.74072265625,
-1.041015625,
-1.1484375,
-0.8671875,
-0.458740234375,
-0.96533203125,
0.4580078125,
0.130615234375,
-0.99462890625,
0.313232421875,
-0.5146484375,
-0.07757568359375,
0.3427734375,
-0.8076171875,
0.8154296875,
-0.0889892578125,
0.369140625,
-0.697265625,
0.505859375,
0.267822265625,
0.6669921875,
-0.74658203125,
-0.0296478271484375,
0.131591796875,
-0.55908203125,
0.58984375,
0.06683349609375,
0.1993408203125,
-0.09661865234375,
-0.951171875,
-0.908203125,
-0.5087890625,
-0.167236328125,
-0.54833984375,
0.0819091796875,
-0.712890625,
0.89599609375,
0.6708984375,
-0.39697265625,
0.70751953125,
0.94873046875,
-0.71728515625,
0.5703125,
0.297607421875,
-0.000980377197265625,
-0.9482421875,
1.1513671875,
0.54052734375,
0.28076171875,
-0.8056640625,
-0.298583984375,
-0.47509765625,
0.060791015625,
0.2294921875,
-0.35595703125,
-0.5146484375,
0.66796875,
0.0056915283203125,
-0.8125,
0.845703125,
-0.857421875,
-0.73388671875,
-0.340087890625,
-0.59375,
0.83056640625,
0.82177734375,
0.29541015625,
-0.364013671875,
-0.116943359375,
0.103759765625,
0.83203125,
0.4033203125,
-0.12286376953125,
0.352294921875,
0.404052734375,
-0.109130859375,
0.0201568603515625,
-0.04437255859375,
-0.796875,
-0.199951171875,
0.07733154296875,
0.289306640625,
0.57958984375,
0.1490478515625,
0.44482421875,
0.351318359375,
1.009765625,
-1.169921875,
-0.471435546875,
-0.141845703125,
0.705078125,
0.66748046875,
0.2176513671875,
0.2366943359375,
-0.08734130859375,
-0.27685546875,
-0.78955078125,
0.08477783203125,
0.2349853515625,
0.67724609375,
-0.505859375,
0.401611328125,
0.243896484375,
-0.755859375,
0.5537109375,
-0.4716796875,
-0.027008056640625,
0.94873046875,
-0.51220703125,
0.94384765625,
-0.7412109375,
0.697265625,
0.1309814453125,
0.178466796875,
0.63818359375,
0.2373046875,
0.331787109375,
-0.53759765625,
-0.377197265625,
-0.265380859375,
-0.1456298828125,
-0.14990234375,
-0.5478515625,
0.393798828125,
-0.66552734375,
-0.615234375,
-0.962890625,
0.92822265625,
0.5908203125,
0.442138671875,
-0.046875,
0.473876953125,
0.10467529296875,
0.499267578125,
0.70947265625,
-0.28857421875,
0.01342010498046875,
-0.76708984375,
0.873046875,
-0.313232421875,
-0.438232421875,
-0.46435546875,
0.1282958984375,
-0.202880859375,
0.1370849609375,
0.04083251953125,
0.05975341796875,
-0.94873046875,
0.472412109375,
-0.09649658203125,
0.79345703125,
-0.71484375,
-0.07000732421875,
-0.359130859375,
0.380615234375,
0.333984375,
-0.78759765625,
0.71044921875,
-0.90673828125,
0.2437744140625,
0.404541015625,
-0.0325927734375,
-0.355224609375,
-0.295166015625,
-0.8349609375,
-0.568359375,
0.062744140625,
0.90283203125,
-0.333984375,
0.12005615234375,
-1.2548828125,
0.36572265625,
0.042205810546875,
-0.458251953125,
-0.223876953125,
0.18115234375,
0.35888671875,
0.06280517578125,
0.236572265625,
0.0278167724609375,
-0.353271484375,
0.25439453125,
-0.8251953125,
0.69140625,
-0.487548828125,
0.042999267578125,
0.25537109375,
0.1463623046875,
0.272216796875,
0.26513671875,
-0.552734375,
-0.0897216796875,
-0.2447509765625,
0.2783203125,
-0.611328125,
-0.71435546875,
0.40283203125,
-0.366943359375,
-0.62744140625,
0.83837890625,
-0.1365966796875,
-0.463623046875,
0.367431640625,
0.2392578125,
-0.68212890625,
0.29052734375,
-0.432861328125,
0.40771484375,
-0.321044921875,
-0.685546875,
-0.1474609375,
-0.3271484375,
0.82666015625,
0.19873046875,
-0.391357421875,
-0.1160888671875,
-0.9326171875,
-0.11041259765625,
0.01654052734375,
-0.356201171875,
0.1807861328125,
0.3466796875,
0.0352783203125,
-0.226806640625,
-0.258544921875,
-0.2274169921875,
0.0771484375,
-0.5693359375,
-0.402587890625,
0.51806640625,
0.59521484375,
0.38916015625,
-0.1663818359375,
-0.7509765625,
0.055816650390625,
0.0241241455078125,
0.0679931640625,
-0.53369140625,
-0.11566162109375,
-0.255859375,
-0.047149658203125,
-0.1661376953125,
0.2939453125,
-0.14697265625,
0.256103515625,
0.8525390625,
0.027740478515625,
0.409912109375,
0.2578125,
-0.5283203125,
0.79541015625,
0.1416015625,
-0.9345703125,
-0.19140625,
0.53564453125,
0.121337890625,
0.73876953125,
-0.01226043701171875,
-0.7294921875,
-0.607421875,
-0.6845703125,
0.050750732421875,
-1.0712890625,
0.1151123046875,
-0.638671875,
-0.425048828125,
-0.4072265625,
0.4365234375,
-0.0157012939453125,
-0.611328125,
-0.1260986328125,
-0.7119140625,
-0.125,
-0.7265625,
-0.08416748046875,
-0.609375,
-0.8603515625,
-0.0977783203125,
0.9130859375,
0.285888671875,
0.10845947265625,
0.011749267578125,
0.036468505859375,
0.4921875,
0.0054931640625,
-0.671875,
-0.421630859375,
0.0982666015625,
0.340576171875,
-0.0157928466796875,
-0.229736328125,
-0.402099609375,
0.2666015625,
-0.85986328125,
0.308349609375,
-0.2340087890625,
-0.11334228515625,
-0.032928466796875,
-0.13232421875,
1.0576171875,
-0.08038330078125,
0.11529541015625,
-0.1962890625,
-0.08984375,
1.021484375,
-0.407470703125,
-0.1727294921875,
-0.5185546875,
-0.6416015625,
-1.31640625,
0.53173828125,
-0.371337890625,
0.309814453125,
-0.7431640625,
-0.465576171875,
0.9501953125,
-0.451904296875,
0.172119140625,
0.943359375,
-0.036102294921875,
0.12164306640625,
-0.71826171875,
0.517578125,
0.4990234375,
-0.6416015625,
-0.0677490234375,
0.053955078125,
-0.228271484375,
-0.0032787322998046875,
-0.1051025390625,
-0.4033203125,
-0.6416015625,
0.1832275390625,
1.15234375,
-0.218994140625,
0.861328125,
-0.08990478515625,
-1.041015625,
-0.7021484375,
0.4072265625,
0.252685546875,
0.56396484375,
0.732421875,
-0.1162109375,
-0.27392578125,
-0.03662109375,
0.127685546875,
-0.340087890625,
-0.4326171875,
0.6318359375,
-0.375244140625,
-0.309326171875,
0.9423828125,
0.81640625,
-1.0859375,
-0.9599609375,
-0.060516357421875,
-0.032379150390625,
-0.30029296875,
-0.50634765625,
0.12103271484375,
0.09259033203125,
-0.625,
0.1495361328125,
0.38134765625,
0.0275726318359375,
0.44091796875,
0.01287841796875,
0.280517578125,
-0.421875,
0.19970703125,
0.603515625,
-0.37353515625,
-0.330322265625,
-1.0693359375,
-0.425048828125,
-0.343994140625,
-0.2083740234375,
0.70654296875,
-0.7119140625,
0.00887298583984375,
0.3525390625,
-0.1436767578125,
0.46533203125,
-0.245849609375,
-0.160400390625,
0.390625,
-0.53125,
-0.77490234375,
-0.047271728515625,
0.2344970703125,
-0.128173828125,
0.6923828125,
-0.45458984375,
0.56640625,
0.37255859375,
-0.137939453125,
-0.6640625,
-0.85693359375,
0.0018749237060546875,
-1.353515625,
-0.416259765625,
-0.52099609375,
-0.8447265625,
-0.036346435546875,
0.1734619140625,
0.1329345703125,
-0.53271484375,
0.2467041015625,
0.29052734375,
-0.54345703125,
0.388671875,
-0.52685546875,
0.1510009765625,
-0.434814453125,
-0.7744140625,
-0.73828125,
-0.2017822265625,
-0.217041015625,
0.040435791015625,
-0.59814453125,
0.427978515625,
0.1480712890625,
0.90283203125,
-0.1517333984375,
0.14794921875,
-0.58740234375,
-0.423583984375,
0.2493896484375,
-0.006565093994140625,
-0.3984375,
0.927734375,
0.5791015625,
0.289794921875,
0.4443359375,
-0.36376953125,
-0.288818359375,
-0.09161376953125,
0.61083984375,
0.259033203125,
-0.286865234375,
-0.2012939453125,
0.1435546875,
0.267333984375,
-1.2060546875,
0.59716796875,
-0.61083984375,
-0.08563232421875,
0.09375,
-0.0755615234375,
0.284423828125,
0.708984375,
-0.2373046875,
0.26708984375,
-0.05596923828125,
-0.1925048828125,
0.65625,
0.1793212890625,
0.018218994140625,
0.1513671875,
-0.2105712890625,
-0.1468505859375,
-0.199951171875,
0.31201171875,
-0.253173828125,
0.31005859375,
-0.1798095703125,
-1.099609375,
-0.625,
-0.06585693359375,
-0.019805908203125,
0.2568359375,
0.51416015625,
-0.184814453125,
-0.1597900390625,
0.05169677734375,
-0.861328125,
0.2734375,
-1.025390625,
-0.463623046875,
0.489501953125,
0.027740478515625,
-0.406982421875,
-0.1455078125,
0.0289306640625,
-0.2459716796875,
-0.11944580078125,
0.322021484375,
-0.4892578125,
0.419921875,
-0.3603515625,
0.414306640625,
0.026336669921875,
0.019989013671875,
0.01488494873046875,
0.6904296875,
-0.60595703125,
-0.418212890625,
-0.2115478515625,
1.248046875,
0.09112548828125,
-0.2242431640625,
-0.68798828125,
0.140380859375,
0.158447265625,
-0.2261962890625,
-0.2354736328125,
0.26513671875,
-0.517578125,
0.5517578125,
-0.8017578125,
0.029327392578125,
-0.0738525390625,
0.1551513671875,
-0.271240234375,
-0.2159423828125,
-0.49072265625,
0.83544921875,
0.41796875,
-0.140625,
0.68896484375,
0.25634765625,
0.59375,
-0.078369140625,
-0.2227783203125,
-0.300048828125,
0.63037109375,
0.5205078125,
0.5009765625,
-0.15966796875,
-0.025238037109375,
0.74267578125,
0.183349609375,
0.028472900390625,
0.07257080078125,
0.10101318359375,
-0.029388427734375,
0.29638671875,
-0.199951171875,
0.1014404296875,
-0.2919921875,
-0.454833984375,
0.183837890625,
-0.529296875,
-0.024017333984375,
-0.419189453125,
-0.5693359375,
0.6767578125,
-0.11126708984375,
-0.01291656494140625,
0.0560302734375,
-0.8974609375,
0.30322265625,
0.38818359375,
-0.46044921875,
-0.39404296875,
0.97900390625,
0.73388671875,
0.409423828125,
0.580078125,
0.66796875,
0.274658203125,
-0.6103515625,
0.58056640625,
0.09808349609375,
0.151123046875,
-0.26611328125,
-0.60302734375,
-0.65283203125,
0.268798828125,
-0.4033203125,
-0.04638671875,
0.434326171875,
-0.489013671875,
0.25439453125,
-0.30078125,
0.43359375,
-0.468017578125,
-0.220703125,
0.1812744140625,
-0.0064697265625,
-0.81591796875,
0.54345703125,
-0.35693359375,
0.44580078125,
-0.0108795166015625,
0.8642578125,
0.1988525390625,
1.4697265625,
0.82666015625,
-0.330810546875,
-0.190185546875,
0.27197265625,
-0.22119140625,
-0.6455078125,
-0.31640625,
-0.43994140625,
0.1895751953125,
-0.46240234375,
-1.0458984375,
0.1998291015625,
0.5068359375,
-0.08465576171875,
-0.491455078125,
0.1680908203125,
-0.11480712890625,
-0.92138671875,
0.207275390625,
0.431640625,
0.13720703125,
0.53271484375,
0.048614501953125,
-0.154296875,
-0.7646484375,
0.242919921875,
-0.54248046875,
0.1785888671875,
-0.94287109375,
-0.338623046875,
-0.38134765625,
-0.61865234375,
-0.50244140625,
-0.08355712890625,
-0.38623046875,
-0.85986328125,
0.38623046875,
0.359375,
0.56396484375,
0.54541015625,
-0.204833984375,
0.19873046875,
0.97900390625,
0.98486328125,
-0.07843017578125,
0.876953125,
0.10595703125,
-0.2464599609375,
0.1552734375,
-0.487548828125,
0.5947265625,
-0.609375,
0.1341552734375,
-0.5830078125,
-0.2442626953125,
-0.869140625,
-0.978515625,
0.11993408203125,
0.497314453125,
0.39306640625,
-0.88671875,
-0.91943359375,
-0.52734375,
-1.0986328125,
0.045989990234375,
-0.56005859375,
0.75927734375,
-0.052001953125,
0.138671875,
0.07781982421875,
-1.0390625,
4.58203125,
0.9150390625,
1.056640625,
0.6279296875,
0.0703125,
0.845703125,
0.1510009765625,
-0.1544189453125,
-0.244873046875,
-0.36328125,
0.15283203125,
-0.2091064453125,
0.08709716796875,
1.0419921875,
0.5087890625,
0.50390625,
-0.2203369140625,
0.35498046875,
0.081787109375,
-1,
-0.880859375,
0.172119140625,
-0.033111572265625,
0.72509765625,
0.049041748046875,
0.439453125,
0.857421875,
-0.7568359375,
-0.48681640625,
-0.63037109375,
0.180908203125,
-0.310791015625,
0.8330078125,
-0.06988525390625,
-0.3076171875,
0.66650390625,
-0.020172119140625,
-0.348388671875,
-0.050384521484375,
0.041351318359375,
-0.035675048828125,
0.1400146484375,
0.2457275390625,
-0.41748046875,
0.06781005859375,
0.50341796875,
-0.54150390625,
0.5634765625,
0.313720703125,
-0.7001953125,
0.64453125,
-0.40380859375,
0.4775390625,
-0.74169921875,
-0.59375,
0.19970703125,
0.1092529296875,
-0.1195068359375,
-0.32958984375,
0.7451171875,
0.64892578125,
0.408935546875,
0.05126953125,
0.25537109375,
-0.55908203125,
0.68408203125,
0.0287933349609375,
0.30615234375,
-0.8046875,
-0.1583251953125,
0.051849365234375,
0.0307769775390625,
-0.340087890625,
-0.76904296875,
0.69482421875,
0.11041259765625,
-0.045745849609375,
0.53662109375,
0.54052734375,
-0.59716796875,
0.0232391357421875,
-0.2335205078125,
-0.52197265625,
-0.3173828125,
0.5703125,
0.9169921875,
-0.5390625,
-0.1748046875,
-0.181884765625,
0.42529296875,
0.65625,
0.580078125,
0.2113037109375,
-0.87548828125,
-0.226318359375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete logarithm!
Of course, there is a code lock is installed on the safe. The lock has a screen that displays a string of n lowercase Latin letters. Initially, the screen displays string s. Whitfield and Martin found out that the safe will open when string t will be displayed on the screen.
The string on the screen can be changed using the operation «shift x». In order to apply this operation, explorers choose an integer x from 0 to n inclusive. After that, the current string p = αβ changes to βRα, where the length of β is x, and the length of α is n - x. In other words, the suffix of the length x of string p is reversed and moved to the beginning of the string. For example, after the operation «shift 4» the string «abcacb» will be changed with string «bcacab », since α = ab, β = cacb, βR = bcac.
Explorers are afraid that if they apply too many operations «shift», the lock will be locked forever. They ask you to find a way to get the string t on the screen, using no more than 6100 operations.
Input
The first line contains an integer n, the length of the strings s and t (1 ≤ n ≤ 2 000).
After that, there are two strings s and t, consisting of n lowercase Latin letters each.
Output
If it is impossible to get string t from string s using no more than 6100 operations «shift», print a single number - 1.
Otherwise, in the first line output the number of operations k (0 ≤ k ≤ 6100). In the next line output k numbers xi corresponding to the operations «shift xi» (0 ≤ xi ≤ n) in the order in which they should be applied.
Examples
Input
6
abacbb
babcba
Output
4
6 3 2 3
Input
3
aba
bba
Output
-1
Tags: constructive algorithms, implementation, strings
Correct Solution:
```
n = int(input())
t = input()[:n]
s = input()[:n]
ops =[]
def shift(k, cur):
if k == 0:
return cur
return cur[:-k-1:-1] + cur [:-k]
def move_to_front(k, curst):
if k == n-1:
ops.append(1)
curst = curst[-1] +curst [:-1]
else:
ops.append(n-1)
ops.append(k)
ops.append(1)
curst = curst[k] + curst[:k] + curst[-1:k:-1]
return curst
def find_char(char, t):
for m,cur_c in enumerate(t[::-1]):
if cur_c == char:
# print(t, 'found', char, ' at', n-m -1)
return n- m -1
return 0
# t = 'abcdefg'
# for j in range(len(t)):
# print('before', j, t)
# t = move_to_front(j, t )
# print(' after', j, t)
# print()
from collections import Counter
scount = Counter(s)
tcount = Counter(t)
ori_t = t
if scount != tcount:
print(-1)
exit()
for char in s[::-1]:
t = move_to_front(find_char(char, t), t)
# print('got t', t)
print(len(ops))
print(*ops)
# for op in ops:
# print(op, ori_t, shift(op, ori_t))
# ori_t = shift(op, ori_t)
#
# print(ori_t)
```
| 65,383
|
[
0.3564453125,
-0.050994873046875,
-0.394287109375,
0.274169921875,
-0.1744384765625,
-0.53515625,
-0.1865234375,
0.03564453125,
0.345703125,
0.98681640625,
1.091796875,
-0.135498046875,
0.221923828125,
-1.0849609375,
-0.349365234375,
0.314697265625,
-0.28466796875,
-0.52587890625,
-0.408203125,
0.56689453125,
0.36376953125,
-0.062225341796875,
-1.3046875,
-0.278076171875,
-0.7880859375,
0.7490234375,
0.428466796875,
-0.1685791015625,
1.078125,
1.322265625,
-0.3818359375,
-0.41259765625,
0.89208984375,
-0.904296875,
-0.443603515625,
-0.38623046875,
0.411376953125,
-0.5830078125,
-0.02655029296875,
-0.59033203125,
0.25634765625,
-0.28173828125,
0.53271484375,
-0.3896484375,
-1.41796875,
-0.08837890625,
-0.414306640625,
-0.2060546875,
-0.1019287109375,
-0.72900390625,
0.21630859375,
0.02197265625,
0.67041015625,
-0.275634765625,
0.0396728515625,
0.331787109375,
-0.150390625,
-0.4453125,
-0.322509765625,
0.26025390625,
0.293212890625,
-0.0657958984375,
-0.0276336669921875,
-0.431884765625,
-0.1783447265625,
0.17333984375,
-0.11138916015625,
-0.214599609375,
-0.10906982421875,
-0.8388671875,
0.07550048828125,
0.59375,
-0.4384765625,
-0.281982421875,
-0.255126953125,
-0.01126861572265625,
0.2247314453125,
0.23974609375,
-1.099609375,
0.970703125,
-0.12646484375,
1.09375,
0.28173828125,
0.229736328125,
-0.329833984375,
-0.61474609375,
-0.2349853515625,
-0.1915283203125,
0.062744140625,
-0.312255859375,
-0.0831298828125,
0.5,
-0.4189453125,
-0.1300048828125,
0.494140625,
0.517578125,
-0.1826171875,
0.12042236328125,
0.81298828125,
0.1806640625,
0.5263671875,
0.85791015625,
-0.55078125,
0.95751953125,
-0.44482421875,
-0.197265625,
0.17138671875,
0.227294921875,
-0.2392578125,
-0.289306640625,
-0.1654052734375,
-0.552734375,
0.49267578125,
0.2003173828125,
-0.052978515625,
0.9384765625,
-0.20556640625,
0.51318359375,
-0.4365234375,
0.1376953125,
0.59375,
0.04736328125,
0.61279296875,
-0.391357421875,
-0.1510009765625,
-0.275390625,
-0.220947265625,
0.79248046875,
-0.59228515625,
-0.2244873046875,
-0.1220703125,
-0.1341552734375,
-0.37646484375,
0.4521484375,
-0.1998291015625,
0.94580078125,
-0.0960693359375,
0.82861328125,
0.72802734375,
-0.69384765625,
0.6494140625,
-0.343505859375,
-0.068603515625,
1.40234375,
0.5478515625,
0.07635498046875,
0.67236328125,
0.3935546875,
-0.5849609375,
0.48828125,
-1.0244140625,
0.74462890625,
0.291015625,
0.301513671875,
-0.40966796875,
0.064208984375,
-0.287109375,
0.9423828125,
-0.015228271484375,
-0.03997802734375,
-0.27978515625,
0.489501953125,
-0.05889892578125,
0.91943359375,
-0.370849609375,
0.97802734375,
-0.07049560546875,
-0.72216796875,
-0.07537841796875,
-0.471435546875,
0.1568603515625,
-0.041778564453125,
-0.52490234375,
0.90234375,
0.61962890625,
0.79833984375,
1.15234375,
-0.29296875,
0.3720703125,
0.26220703125,
-0.53173828125,
0.08966064453125,
0.204833984375,
0.75732421875,
-0.0229949951171875,
0.034637451171875,
0.2374267578125,
-0.17431640625,
-0.83251953125,
-0.304931640625,
-0.078369140625,
0.91796875,
-0.80908203125,
0.3779296875,
0.469482421875,
-0.00881195068359375,
-1.0361328125,
-0.149658203125,
0.103515625,
-0.9228515625,
-0.226318359375,
0.89599609375,
-0.1669921875,
0.77294921875,
-0.442626953125,
-0.513671875,
0.45556640625,
1.119140625,
-0.1871337890625,
-0.1260986328125,
0.230712890625,
0.01036834716796875,
-0.447265625,
-0.1453857421875,
0.2366943359375,
0.06927490234375,
-0.52099609375,
0.98876953125,
0.19580078125,
-0.09002685546875,
0.084716796875,
0.7978515625,
0.374755859375,
0.6982421875,
-0.29833984375,
-0.2744140625,
0.438232421875,
0.865234375,
0.0113983154296875,
0.189697265625,
0.322509765625,
0.845703125,
0.31591796875,
0.6005859375,
0.03662109375,
0.230224609375,
0.286865234375,
0.78955078125,
0.1319580078125,
0.39697265625,
0.2587890625,
0.4130859375,
0.0501708984375,
0.2127685546875,
0.169921875,
0.1622314453125,
0.0037975311279296875,
-0.003200531005859375,
-0.397705078125,
0.310302734375,
-0.564453125,
0.85888671875,
-0.1563720703125,
0.294189453125,
-0.3125,
-0.179931640625,
0.395751953125,
0.68603515625,
-1.173828125,
-0.382080078125,
-0.01380157470703125,
0.02178955078125,
0.160400390625,
-0.380126953125,
0.77587890625,
0.485107421875,
0.50146484375,
0.4541015625,
-0.38916015625,
-0.75146484375,
-1.0341796875,
-1.17578125,
-0.8720703125,
-0.466796875,
-1,
0.44384765625,
0.1612548828125,
-1.04296875,
0.320556640625,
-0.51708984375,
-0.0899658203125,
0.34912109375,
-0.80126953125,
0.8173828125,
-0.08953857421875,
0.394287109375,
-0.69482421875,
0.50048828125,
0.280517578125,
0.66455078125,
-0.70849609375,
-0.06365966796875,
0.1473388671875,
-0.56103515625,
0.59375,
0.055145263671875,
0.196533203125,
-0.0697021484375,
-0.96435546875,
-0.86279296875,
-0.505859375,
-0.144287109375,
-0.52099609375,
0.09515380859375,
-0.71630859375,
0.880859375,
0.640625,
-0.384521484375,
0.72216796875,
0.97900390625,
-0.74609375,
0.603515625,
0.305419921875,
-0.044586181640625,
-0.94140625,
1.1806640625,
0.58837890625,
0.295654296875,
-0.78662109375,
-0.288330078125,
-0.50244140625,
0.06964111328125,
0.2454833984375,
-0.36474609375,
-0.54443359375,
0.67138671875,
-0.013214111328125,
-0.82666015625,
0.82177734375,
-0.8623046875,
-0.736328125,
-0.34033203125,
-0.60009765625,
0.8486328125,
0.80126953125,
0.28125,
-0.36669921875,
-0.11767578125,
0.11444091796875,
0.85498046875,
0.41845703125,
-0.1197509765625,
0.375,
0.38330078125,
-0.08697509765625,
0.034393310546875,
-0.037200927734375,
-0.794921875,
-0.2320556640625,
0.0943603515625,
0.267822265625,
0.56396484375,
0.1251220703125,
0.443603515625,
0.351806640625,
1.01171875,
-1.1630859375,
-0.468994140625,
-0.1431884765625,
0.7197265625,
0.69287109375,
0.20263671875,
0.2415771484375,
-0.05731201171875,
-0.27978515625,
-0.7705078125,
0.0821533203125,
0.227294921875,
0.68017578125,
-0.498779296875,
0.3994140625,
0.259033203125,
-0.76025390625,
0.52587890625,
-0.460205078125,
-0.0280303955078125,
0.9521484375,
-0.505859375,
0.92138671875,
-0.73974609375,
0.70849609375,
0.1456298828125,
0.166015625,
0.62060546875,
0.22216796875,
0.328369140625,
-0.5341796875,
-0.3857421875,
-0.2408447265625,
-0.155029296875,
-0.1680908203125,
-0.53662109375,
0.42138671875,
-0.654296875,
-0.6220703125,
-0.96533203125,
0.935546875,
0.5947265625,
0.465087890625,
-0.053924560546875,
0.491943359375,
0.11285400390625,
0.55224609375,
0.716796875,
-0.280029296875,
0.0011348724365234375,
-0.7587890625,
0.86279296875,
-0.311767578125,
-0.439208984375,
-0.47705078125,
0.126220703125,
-0.236328125,
0.12115478515625,
0.033538818359375,
0.07928466796875,
-0.97802734375,
0.48193359375,
-0.08770751953125,
0.818359375,
-0.69287109375,
-0.058746337890625,
-0.393310546875,
0.366455078125,
0.3076171875,
-0.80419921875,
0.69580078125,
-0.9169921875,
0.22509765625,
0.381103515625,
-0.039581298828125,
-0.342041015625,
-0.310546875,
-0.83056640625,
-0.56982421875,
0.041900634765625,
0.89306640625,
-0.334228515625,
0.12200927734375,
-1.271484375,
0.381103515625,
0.049713134765625,
-0.4423828125,
-0.2276611328125,
0.156005859375,
0.376220703125,
0.06640625,
0.2529296875,
0.02740478515625,
-0.32763671875,
0.250244140625,
-0.79833984375,
0.6943359375,
-0.470947265625,
0.00942230224609375,
0.2471923828125,
0.1531982421875,
0.271484375,
0.24853515625,
-0.572265625,
-0.06878662109375,
-0.259521484375,
0.304443359375,
-0.61962890625,
-0.7021484375,
0.409423828125,
-0.356689453125,
-0.6171875,
0.833984375,
-0.1300048828125,
-0.450439453125,
0.364013671875,
0.209716796875,
-0.673828125,
0.257080078125,
-0.4453125,
0.390380859375,
-0.29931640625,
-0.689453125,
-0.1624755859375,
-0.329345703125,
0.81787109375,
0.154052734375,
-0.417724609375,
-0.124755859375,
-0.92919921875,
-0.107666015625,
0.028564453125,
-0.333984375,
0.181396484375,
0.3583984375,
0.01273345947265625,
-0.219970703125,
-0.256591796875,
-0.250732421875,
0.07818603515625,
-0.5615234375,
-0.38916015625,
0.5087890625,
0.60498046875,
0.39892578125,
-0.1627197265625,
-0.76220703125,
0.039031982421875,
0.036346435546875,
0.086669921875,
-0.55029296875,
-0.12347412109375,
-0.25146484375,
-0.06256103515625,
-0.176513671875,
0.30126953125,
-0.193115234375,
0.26025390625,
0.8701171875,
0.06866455078125,
0.402587890625,
0.262451171875,
-0.5166015625,
0.7734375,
0.12744140625,
-0.9296875,
-0.1866455078125,
0.525390625,
0.118408203125,
0.7197265625,
-0.019866943359375,
-0.70703125,
-0.61279296875,
-0.66845703125,
0.052490234375,
-1.083984375,
0.115966796875,
-0.623046875,
-0.449951171875,
-0.383056640625,
0.47265625,
0.004543304443359375,
-0.6171875,
-0.12127685546875,
-0.6904296875,
-0.130859375,
-0.72265625,
-0.052459716796875,
-0.611328125,
-0.87109375,
-0.1163330078125,
0.89404296875,
0.318603515625,
0.09918212890625,
-0.0037097930908203125,
-0.002742767333984375,
0.5126953125,
-0.00121307373046875,
-0.67236328125,
-0.433349609375,
0.11572265625,
0.317626953125,
-0.037750244140625,
-0.222412109375,
-0.41943359375,
0.26611328125,
-0.876953125,
0.326904296875,
-0.24462890625,
-0.1324462890625,
-0.05133056640625,
-0.12286376953125,
1.05078125,
-0.0628662109375,
0.099365234375,
-0.2191162109375,
-0.109375,
0.98779296875,
-0.380126953125,
-0.1876220703125,
-0.5244140625,
-0.638671875,
-1.349609375,
0.53955078125,
-0.393798828125,
0.28076171875,
-0.71875,
-0.468017578125,
0.93310546875,
-0.448974609375,
0.1844482421875,
0.951171875,
-0.03570556640625,
0.0994873046875,
-0.6875,
0.53515625,
0.5,
-0.62646484375,
-0.0628662109375,
0.043609619140625,
-0.193603515625,
-0.0079193115234375,
-0.11761474609375,
-0.378173828125,
-0.6435546875,
0.1988525390625,
1.1376953125,
-0.220458984375,
0.8671875,
-0.12200927734375,
-1.044921875,
-0.69189453125,
0.42138671875,
0.28662109375,
0.5849609375,
0.71484375,
-0.07891845703125,
-0.263671875,
-0.0181427001953125,
0.1644287109375,
-0.333740234375,
-0.44677734375,
0.6181640625,
-0.342041015625,
-0.334228515625,
0.93798828125,
0.83349609375,
-1.076171875,
-0.96435546875,
-0.040863037109375,
-0.01323699951171875,
-0.29638671875,
-0.50390625,
0.12298583984375,
0.08978271484375,
-0.65283203125,
0.14306640625,
0.377685546875,
0.0211944580078125,
0.451416015625,
0.0107879638671875,
0.274169921875,
-0.429931640625,
0.1990966796875,
0.58935546875,
-0.391357421875,
-0.326171875,
-1.0732421875,
-0.4453125,
-0.345703125,
-0.2078857421875,
0.712890625,
-0.6953125,
0.004543304443359375,
0.349365234375,
-0.1611328125,
0.505859375,
-0.248779296875,
-0.1824951171875,
0.405517578125,
-0.53564453125,
-0.8037109375,
-0.06719970703125,
0.2276611328125,
-0.10040283203125,
0.65576171875,
-0.4658203125,
0.55419921875,
0.383544921875,
-0.1688232421875,
-0.66064453125,
-0.87353515625,
-0.003482818603515625,
-1.341796875,
-0.397216796875,
-0.52490234375,
-0.828125,
-0.039459228515625,
0.1983642578125,
0.130615234375,
-0.54345703125,
0.2366943359375,
0.2822265625,
-0.51416015625,
0.374267578125,
-0.5263671875,
0.1650390625,
-0.423583984375,
-0.791015625,
-0.72265625,
-0.1998291015625,
-0.2164306640625,
0.037017822265625,
-0.5908203125,
0.4404296875,
0.1568603515625,
0.9033203125,
-0.1300048828125,
0.1585693359375,
-0.576171875,
-0.44677734375,
0.2340087890625,
-0.01108551025390625,
-0.42724609375,
0.9033203125,
0.55517578125,
0.267822265625,
0.44873046875,
-0.37646484375,
-0.29296875,
-0.094970703125,
0.61376953125,
0.2408447265625,
-0.269775390625,
-0.1943359375,
0.12249755859375,
0.275390625,
-1.2021484375,
0.58740234375,
-0.5966796875,
-0.040283203125,
0.11981201171875,
-0.063720703125,
0.2734375,
0.66650390625,
-0.2489013671875,
0.27783203125,
-0.0655517578125,
-0.188232421875,
0.66943359375,
0.194091796875,
-0.00473785400390625,
0.1583251953125,
-0.1998291015625,
-0.19140625,
-0.171142578125,
0.31103515625,
-0.255859375,
0.3154296875,
-0.187744140625,
-1.0888671875,
-0.6171875,
-0.061859130859375,
0.00814056396484375,
0.24560546875,
0.468017578125,
-0.17578125,
-0.1397705078125,
0.07989501953125,
-0.8408203125,
0.2320556640625,
-1.0126953125,
-0.451416015625,
0.50732421875,
0.024383544921875,
-0.399169921875,
-0.1468505859375,
0.05035400390625,
-0.256591796875,
-0.131103515625,
0.31787109375,
-0.49169921875,
0.426025390625,
-0.38232421875,
0.430908203125,
0.0135040283203125,
0.003925323486328125,
0.023040771484375,
0.6923828125,
-0.6240234375,
-0.425537109375,
-0.166015625,
1.279296875,
0.11810302734375,
-0.2236328125,
-0.7001953125,
0.1373291015625,
0.1583251953125,
-0.2347412109375,
-0.238037109375,
0.268798828125,
-0.53955078125,
0.54833984375,
-0.7900390625,
0.0421142578125,
-0.05352783203125,
0.1826171875,
-0.2861328125,
-0.2071533203125,
-0.4970703125,
0.81298828125,
0.38916015625,
-0.1959228515625,
0.703125,
0.24072265625,
0.595703125,
-0.10797119140625,
-0.2371826171875,
-0.3193359375,
0.63134765625,
0.5185546875,
0.5185546875,
-0.14892578125,
-0.053009033203125,
0.755859375,
0.201904296875,
0.0289459228515625,
0.0968017578125,
0.1348876953125,
-0.022003173828125,
0.28173828125,
-0.2012939453125,
0.108642578125,
-0.298828125,
-0.464111328125,
0.1900634765625,
-0.51171875,
-0.042877197265625,
-0.4296875,
-0.56201171875,
0.65673828125,
-0.09600830078125,
-0.0091094970703125,
0.054931640625,
-0.92333984375,
0.33251953125,
0.355224609375,
-0.43994140625,
-0.3525390625,
0.9658203125,
0.7119140625,
0.383056640625,
0.541015625,
0.64794921875,
0.28515625,
-0.6201171875,
0.56494140625,
0.12445068359375,
0.17236328125,
-0.272705078125,
-0.623046875,
-0.64697265625,
0.263671875,
-0.4208984375,
-0.016693115234375,
0.44970703125,
-0.5107421875,
0.26025390625,
-0.3095703125,
0.44189453125,
-0.49658203125,
-0.233154296875,
0.1524658203125,
-0.01311492919921875,
-0.8291015625,
0.54052734375,
-0.3447265625,
0.489990234375,
0.02044677734375,
0.86376953125,
0.2022705078125,
1.451171875,
0.8154296875,
-0.330322265625,
-0.1934814453125,
0.2447509765625,
-0.2003173828125,
-0.6640625,
-0.31591796875,
-0.44580078125,
0.1861572265625,
-0.471435546875,
-1.0634765625,
0.1832275390625,
0.50634765625,
-0.088134765625,
-0.469970703125,
0.1754150390625,
-0.095458984375,
-0.9248046875,
0.1812744140625,
0.433837890625,
0.14892578125,
0.54345703125,
0.037933349609375,
-0.184326171875,
-0.7685546875,
0.2261962890625,
-0.54052734375,
0.18408203125,
-0.9169921875,
-0.342041015625,
-0.364501953125,
-0.6025390625,
-0.463623046875,
-0.09027099609375,
-0.392333984375,
-0.845703125,
0.382080078125,
0.34814453125,
0.56689453125,
0.5419921875,
-0.19482421875,
0.2132568359375,
0.98974609375,
0.97314453125,
-0.083251953125,
0.87353515625,
0.10101318359375,
-0.2327880859375,
0.163818359375,
-0.4931640625,
0.59814453125,
-0.6337890625,
0.135009765625,
-0.56298828125,
-0.2685546875,
-0.859375,
-1.0048828125,
0.1341552734375,
0.457275390625,
0.40771484375,
-0.869140625,
-0.90380859375,
-0.53759765625,
-1.1064453125,
0.03363037109375,
-0.5712890625,
0.73974609375,
-0.04132080078125,
0.142578125,
0.09783935546875,
-1.02734375,
4.5859375,
0.90478515625,
1.078125,
0.61865234375,
0.06298828125,
0.85009765625,
0.1475830078125,
-0.160888671875,
-0.257080078125,
-0.357421875,
0.15380859375,
-0.1981201171875,
0.09234619140625,
1.017578125,
0.496826171875,
0.47265625,
-0.2037353515625,
0.351318359375,
0.06854248046875,
-1.0087890625,
-0.875,
0.19287109375,
-0.048248291015625,
0.72705078125,
0.0694580078125,
0.423095703125,
0.85009765625,
-0.720703125,
-0.484130859375,
-0.625,
0.172119140625,
-0.291748046875,
0.82080078125,
-0.042694091796875,
-0.30712890625,
0.662109375,
-0.051788330078125,
-0.343017578125,
-0.045196533203125,
0.0231781005859375,
-0.040679931640625,
0.141357421875,
0.2626953125,
-0.3896484375,
0.06768798828125,
0.492919921875,
-0.525390625,
0.54736328125,
0.334228515625,
-0.70458984375,
0.64013671875,
-0.401611328125,
0.48876953125,
-0.7568359375,
-0.5751953125,
0.1761474609375,
0.130859375,
-0.1494140625,
-0.2900390625,
0.7265625,
0.68115234375,
0.413330078125,
0.07769775390625,
0.197509765625,
-0.55419921875,
0.68603515625,
0.02789306640625,
0.328857421875,
-0.81640625,
-0.1224365234375,
0.024169921875,
0.03009033203125,
-0.3291015625,
-0.7744140625,
0.70068359375,
0.08709716796875,
-0.037078857421875,
0.5654296875,
0.53125,
-0.6064453125,
0.0198974609375,
-0.2388916015625,
-0.52294921875,
-0.296630859375,
0.5771484375,
0.923828125,
-0.5380859375,
-0.1583251953125,
-0.14501953125,
0.42822265625,
0.66845703125,
0.59228515625,
0.1939697265625,
-0.9189453125,
-0.2059326171875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete logarithm!
Of course, there is a code lock is installed on the safe. The lock has a screen that displays a string of n lowercase Latin letters. Initially, the screen displays string s. Whitfield and Martin found out that the safe will open when string t will be displayed on the screen.
The string on the screen can be changed using the operation «shift x». In order to apply this operation, explorers choose an integer x from 0 to n inclusive. After that, the current string p = αβ changes to βRα, where the length of β is x, and the length of α is n - x. In other words, the suffix of the length x of string p is reversed and moved to the beginning of the string. For example, after the operation «shift 4» the string «abcacb» will be changed with string «bcacab », since α = ab, β = cacb, βR = bcac.
Explorers are afraid that if they apply too many operations «shift», the lock will be locked forever. They ask you to find a way to get the string t on the screen, using no more than 6100 operations.
Input
The first line contains an integer n, the length of the strings s and t (1 ≤ n ≤ 2 000).
After that, there are two strings s and t, consisting of n lowercase Latin letters each.
Output
If it is impossible to get string t from string s using no more than 6100 operations «shift», print a single number - 1.
Otherwise, in the first line output the number of operations k (0 ≤ k ≤ 6100). In the next line output k numbers xi corresponding to the operations «shift xi» (0 ≤ xi ≤ n) in the order in which they should be applied.
Examples
Input
6
abacbb
babcba
Output
4
6 3 2 3
Input
3
aba
bba
Output
-1
Tags: constructive algorithms, implementation, strings
Correct Solution:
```
n = int(input())
s = input()
t = input()
if sorted(s) != sorted(t):
print(-1)
else:
ans = []
for i in t:
j = 0
for j in range(n):
if i == s[j]:
break
ans.append(n-j-1)
ans.append(1)
ans.append(n)
s = "".join(reversed(s[:j])) + s[j+1:] + s[j]
print(len(ans))
for i in ans:
print(i, end=' ')
```
| 65,384
|
[
0.35302734375,
-0.05657958984375,
-0.391845703125,
0.265869140625,
-0.2037353515625,
-0.5068359375,
-0.178955078125,
0.07183837890625,
0.327392578125,
1.0107421875,
1.099609375,
-0.142578125,
0.2164306640625,
-1.115234375,
-0.38330078125,
0.2802734375,
-0.2822265625,
-0.5712890625,
-0.406005859375,
0.56689453125,
0.356689453125,
-0.0579833984375,
-1.3115234375,
-0.2196044921875,
-0.77490234375,
0.75146484375,
0.426513671875,
-0.1600341796875,
1.0810546875,
1.33203125,
-0.331787109375,
-0.368896484375,
0.87890625,
-0.90478515625,
-0.45703125,
-0.37255859375,
0.416748046875,
-0.58056640625,
-0.0008015632629394531,
-0.58544921875,
0.260009765625,
-0.305908203125,
0.53466796875,
-0.417236328125,
-1.439453125,
-0.076171875,
-0.39697265625,
-0.1796875,
-0.10821533203125,
-0.740234375,
0.201904296875,
0.01015472412109375,
0.69189453125,
-0.286376953125,
0.0770263671875,
0.3203125,
-0.130859375,
-0.4375,
-0.351806640625,
0.26904296875,
0.277587890625,
-0.00989532470703125,
-0.0216827392578125,
-0.432861328125,
-0.1539306640625,
0.19384765625,
-0.1466064453125,
-0.247314453125,
-0.115478515625,
-0.86474609375,
0.060516357421875,
0.578125,
-0.446533203125,
-0.277099609375,
-0.28173828125,
-0.008056640625,
0.2279052734375,
0.2469482421875,
-1.0869140625,
0.990234375,
-0.10968017578125,
1.0869140625,
0.267333984375,
0.221923828125,
-0.31591796875,
-0.6015625,
-0.2274169921875,
-0.1773681640625,
0.0389404296875,
-0.317138671875,
-0.08038330078125,
0.494873046875,
-0.4404296875,
-0.11181640625,
0.484619140625,
0.50341796875,
-0.1820068359375,
0.12359619140625,
0.82666015625,
0.2144775390625,
0.51953125,
0.857421875,
-0.5380859375,
0.931640625,
-0.47412109375,
-0.2225341796875,
0.1651611328125,
0.2281494140625,
-0.2384033203125,
-0.267333984375,
-0.1552734375,
-0.5419921875,
0.4853515625,
0.16015625,
-0.06854248046875,
0.93994140625,
-0.2244873046875,
0.4990234375,
-0.455322265625,
0.1456298828125,
0.62060546875,
0.05035400390625,
0.60205078125,
-0.403076171875,
-0.1513671875,
-0.259765625,
-0.2203369140625,
0.79541015625,
-0.5869140625,
-0.21533203125,
-0.13330078125,
-0.1309814453125,
-0.40673828125,
0.426513671875,
-0.1981201171875,
0.94921875,
-0.07391357421875,
0.8291015625,
0.71337890625,
-0.69921875,
0.66552734375,
-0.332275390625,
-0.057403564453125,
1.3974609375,
0.5263671875,
0.062347412109375,
0.6591796875,
0.405029296875,
-0.603515625,
0.4951171875,
-1.0478515625,
0.73876953125,
0.293701171875,
0.28955078125,
-0.41015625,
0.08648681640625,
-0.270263671875,
0.93408203125,
-0.040283203125,
-0.03094482421875,
-0.312744140625,
0.482666015625,
-0.05181884765625,
0.89501953125,
-0.33740234375,
0.9677734375,
-0.083740234375,
-0.7060546875,
-0.07281494140625,
-0.46728515625,
0.1334228515625,
-0.05029296875,
-0.52490234375,
0.9208984375,
0.6533203125,
0.82568359375,
1.111328125,
-0.29541015625,
0.37939453125,
0.267822265625,
-0.560546875,
0.0887451171875,
0.2264404296875,
0.7509765625,
-0.03497314453125,
0.041412353515625,
0.260986328125,
-0.1888427734375,
-0.84033203125,
-0.29150390625,
-0.0933837890625,
0.94482421875,
-0.80419921875,
0.374755859375,
0.44140625,
-0.01995849609375,
-1.064453125,
-0.1295166015625,
0.1099853515625,
-0.931640625,
-0.25927734375,
0.90283203125,
-0.1402587890625,
0.779296875,
-0.452392578125,
-0.52978515625,
0.4609375,
1.1220703125,
-0.19091796875,
-0.1317138671875,
0.237060546875,
-0.00908660888671875,
-0.4658203125,
-0.1270751953125,
0.2249755859375,
0.0628662109375,
-0.51611328125,
0.96826171875,
0.1925048828125,
-0.07562255859375,
0.1134033203125,
0.81591796875,
0.349853515625,
0.69921875,
-0.322509765625,
-0.2410888671875,
0.493896484375,
0.8642578125,
-0.0081634521484375,
0.1922607421875,
0.338623046875,
0.86572265625,
0.32666015625,
0.6025390625,
0.0601806640625,
0.2401123046875,
0.284423828125,
0.77880859375,
0.1158447265625,
0.355224609375,
0.2371826171875,
0.427490234375,
0.027374267578125,
0.220458984375,
0.18994140625,
0.1732177734375,
0.00133514404296875,
0.0203399658203125,
-0.361572265625,
0.302978515625,
-0.552734375,
0.859375,
-0.152587890625,
0.270263671875,
-0.28564453125,
-0.1820068359375,
0.384765625,
0.6767578125,
-1.158203125,
-0.413330078125,
0.0032482147216796875,
0.01629638671875,
0.1661376953125,
-0.41552734375,
0.7705078125,
0.49267578125,
0.5068359375,
0.466796875,
-0.36767578125,
-0.74072265625,
-1.041015625,
-1.1484375,
-0.8671875,
-0.458740234375,
-0.96533203125,
0.4580078125,
0.130615234375,
-0.99462890625,
0.313232421875,
-0.5146484375,
-0.07757568359375,
0.3427734375,
-0.8076171875,
0.8154296875,
-0.0889892578125,
0.369140625,
-0.697265625,
0.505859375,
0.267822265625,
0.6669921875,
-0.74658203125,
-0.0296478271484375,
0.131591796875,
-0.55908203125,
0.58984375,
0.06683349609375,
0.1993408203125,
-0.09661865234375,
-0.951171875,
-0.908203125,
-0.5087890625,
-0.167236328125,
-0.54833984375,
0.0819091796875,
-0.712890625,
0.89599609375,
0.6708984375,
-0.39697265625,
0.70751953125,
0.94873046875,
-0.71728515625,
0.5703125,
0.297607421875,
-0.000980377197265625,
-0.9482421875,
1.1513671875,
0.54052734375,
0.28076171875,
-0.8056640625,
-0.298583984375,
-0.47509765625,
0.060791015625,
0.2294921875,
-0.35595703125,
-0.5146484375,
0.66796875,
0.0056915283203125,
-0.8125,
0.845703125,
-0.857421875,
-0.73388671875,
-0.340087890625,
-0.59375,
0.83056640625,
0.82177734375,
0.29541015625,
-0.364013671875,
-0.116943359375,
0.103759765625,
0.83203125,
0.4033203125,
-0.12286376953125,
0.352294921875,
0.404052734375,
-0.109130859375,
0.0201568603515625,
-0.04437255859375,
-0.796875,
-0.199951171875,
0.07733154296875,
0.289306640625,
0.57958984375,
0.1490478515625,
0.44482421875,
0.351318359375,
1.009765625,
-1.169921875,
-0.471435546875,
-0.141845703125,
0.705078125,
0.66748046875,
0.2176513671875,
0.2366943359375,
-0.08734130859375,
-0.27685546875,
-0.78955078125,
0.08477783203125,
0.2349853515625,
0.67724609375,
-0.505859375,
0.401611328125,
0.243896484375,
-0.755859375,
0.5537109375,
-0.4716796875,
-0.027008056640625,
0.94873046875,
-0.51220703125,
0.94384765625,
-0.7412109375,
0.697265625,
0.1309814453125,
0.178466796875,
0.63818359375,
0.2373046875,
0.331787109375,
-0.53759765625,
-0.377197265625,
-0.265380859375,
-0.1456298828125,
-0.14990234375,
-0.5478515625,
0.393798828125,
-0.66552734375,
-0.615234375,
-0.962890625,
0.92822265625,
0.5908203125,
0.442138671875,
-0.046875,
0.473876953125,
0.10467529296875,
0.499267578125,
0.70947265625,
-0.28857421875,
0.01342010498046875,
-0.76708984375,
0.873046875,
-0.313232421875,
-0.438232421875,
-0.46435546875,
0.1282958984375,
-0.202880859375,
0.1370849609375,
0.04083251953125,
0.05975341796875,
-0.94873046875,
0.472412109375,
-0.09649658203125,
0.79345703125,
-0.71484375,
-0.07000732421875,
-0.359130859375,
0.380615234375,
0.333984375,
-0.78759765625,
0.71044921875,
-0.90673828125,
0.2437744140625,
0.404541015625,
-0.0325927734375,
-0.355224609375,
-0.295166015625,
-0.8349609375,
-0.568359375,
0.062744140625,
0.90283203125,
-0.333984375,
0.12005615234375,
-1.2548828125,
0.36572265625,
0.042205810546875,
-0.458251953125,
-0.223876953125,
0.18115234375,
0.35888671875,
0.06280517578125,
0.236572265625,
0.0278167724609375,
-0.353271484375,
0.25439453125,
-0.8251953125,
0.69140625,
-0.487548828125,
0.042999267578125,
0.25537109375,
0.1463623046875,
0.272216796875,
0.26513671875,
-0.552734375,
-0.0897216796875,
-0.2447509765625,
0.2783203125,
-0.611328125,
-0.71435546875,
0.40283203125,
-0.366943359375,
-0.62744140625,
0.83837890625,
-0.1365966796875,
-0.463623046875,
0.367431640625,
0.2392578125,
-0.68212890625,
0.29052734375,
-0.432861328125,
0.40771484375,
-0.321044921875,
-0.685546875,
-0.1474609375,
-0.3271484375,
0.82666015625,
0.19873046875,
-0.391357421875,
-0.1160888671875,
-0.9326171875,
-0.11041259765625,
0.01654052734375,
-0.356201171875,
0.1807861328125,
0.3466796875,
0.0352783203125,
-0.226806640625,
-0.258544921875,
-0.2274169921875,
0.0771484375,
-0.5693359375,
-0.402587890625,
0.51806640625,
0.59521484375,
0.38916015625,
-0.1663818359375,
-0.7509765625,
0.055816650390625,
0.0241241455078125,
0.0679931640625,
-0.53369140625,
-0.11566162109375,
-0.255859375,
-0.047149658203125,
-0.1661376953125,
0.2939453125,
-0.14697265625,
0.256103515625,
0.8525390625,
0.027740478515625,
0.409912109375,
0.2578125,
-0.5283203125,
0.79541015625,
0.1416015625,
-0.9345703125,
-0.19140625,
0.53564453125,
0.121337890625,
0.73876953125,
-0.01226043701171875,
-0.7294921875,
-0.607421875,
-0.6845703125,
0.050750732421875,
-1.0712890625,
0.1151123046875,
-0.638671875,
-0.425048828125,
-0.4072265625,
0.4365234375,
-0.0157012939453125,
-0.611328125,
-0.1260986328125,
-0.7119140625,
-0.125,
-0.7265625,
-0.08416748046875,
-0.609375,
-0.8603515625,
-0.0977783203125,
0.9130859375,
0.285888671875,
0.10845947265625,
0.011749267578125,
0.036468505859375,
0.4921875,
0.0054931640625,
-0.671875,
-0.421630859375,
0.0982666015625,
0.340576171875,
-0.0157928466796875,
-0.229736328125,
-0.402099609375,
0.2666015625,
-0.85986328125,
0.308349609375,
-0.2340087890625,
-0.11334228515625,
-0.032928466796875,
-0.13232421875,
1.0576171875,
-0.08038330078125,
0.11529541015625,
-0.1962890625,
-0.08984375,
1.021484375,
-0.407470703125,
-0.1727294921875,
-0.5185546875,
-0.6416015625,
-1.31640625,
0.53173828125,
-0.371337890625,
0.309814453125,
-0.7431640625,
-0.465576171875,
0.9501953125,
-0.451904296875,
0.172119140625,
0.943359375,
-0.036102294921875,
0.12164306640625,
-0.71826171875,
0.517578125,
0.4990234375,
-0.6416015625,
-0.0677490234375,
0.053955078125,
-0.228271484375,
-0.0032787322998046875,
-0.1051025390625,
-0.4033203125,
-0.6416015625,
0.1832275390625,
1.15234375,
-0.218994140625,
0.861328125,
-0.08990478515625,
-1.041015625,
-0.7021484375,
0.4072265625,
0.252685546875,
0.56396484375,
0.732421875,
-0.1162109375,
-0.27392578125,
-0.03662109375,
0.127685546875,
-0.340087890625,
-0.4326171875,
0.6318359375,
-0.375244140625,
-0.309326171875,
0.9423828125,
0.81640625,
-1.0859375,
-0.9599609375,
-0.060516357421875,
-0.032379150390625,
-0.30029296875,
-0.50634765625,
0.12103271484375,
0.09259033203125,
-0.625,
0.1495361328125,
0.38134765625,
0.0275726318359375,
0.44091796875,
0.01287841796875,
0.280517578125,
-0.421875,
0.19970703125,
0.603515625,
-0.37353515625,
-0.330322265625,
-1.0693359375,
-0.425048828125,
-0.343994140625,
-0.2083740234375,
0.70654296875,
-0.7119140625,
0.00887298583984375,
0.3525390625,
-0.1436767578125,
0.46533203125,
-0.245849609375,
-0.160400390625,
0.390625,
-0.53125,
-0.77490234375,
-0.047271728515625,
0.2344970703125,
-0.128173828125,
0.6923828125,
-0.45458984375,
0.56640625,
0.37255859375,
-0.137939453125,
-0.6640625,
-0.85693359375,
0.0018749237060546875,
-1.353515625,
-0.416259765625,
-0.52099609375,
-0.8447265625,
-0.036346435546875,
0.1734619140625,
0.1329345703125,
-0.53271484375,
0.2467041015625,
0.29052734375,
-0.54345703125,
0.388671875,
-0.52685546875,
0.1510009765625,
-0.434814453125,
-0.7744140625,
-0.73828125,
-0.2017822265625,
-0.217041015625,
0.040435791015625,
-0.59814453125,
0.427978515625,
0.1480712890625,
0.90283203125,
-0.1517333984375,
0.14794921875,
-0.58740234375,
-0.423583984375,
0.2493896484375,
-0.006565093994140625,
-0.3984375,
0.927734375,
0.5791015625,
0.289794921875,
0.4443359375,
-0.36376953125,
-0.288818359375,
-0.09161376953125,
0.61083984375,
0.259033203125,
-0.286865234375,
-0.2012939453125,
0.1435546875,
0.267333984375,
-1.2060546875,
0.59716796875,
-0.61083984375,
-0.08563232421875,
0.09375,
-0.0755615234375,
0.284423828125,
0.708984375,
-0.2373046875,
0.26708984375,
-0.05596923828125,
-0.1925048828125,
0.65625,
0.1793212890625,
0.018218994140625,
0.1513671875,
-0.2105712890625,
-0.1468505859375,
-0.199951171875,
0.31201171875,
-0.253173828125,
0.31005859375,
-0.1798095703125,
-1.099609375,
-0.625,
-0.06585693359375,
-0.019805908203125,
0.2568359375,
0.51416015625,
-0.184814453125,
-0.1597900390625,
0.05169677734375,
-0.861328125,
0.2734375,
-1.025390625,
-0.463623046875,
0.489501953125,
0.027740478515625,
-0.406982421875,
-0.1455078125,
0.0289306640625,
-0.2459716796875,
-0.11944580078125,
0.322021484375,
-0.4892578125,
0.419921875,
-0.3603515625,
0.414306640625,
0.026336669921875,
0.019989013671875,
0.01488494873046875,
0.6904296875,
-0.60595703125,
-0.418212890625,
-0.2115478515625,
1.248046875,
0.09112548828125,
-0.2242431640625,
-0.68798828125,
0.140380859375,
0.158447265625,
-0.2261962890625,
-0.2354736328125,
0.26513671875,
-0.517578125,
0.5517578125,
-0.8017578125,
0.029327392578125,
-0.0738525390625,
0.1551513671875,
-0.271240234375,
-0.2159423828125,
-0.49072265625,
0.83544921875,
0.41796875,
-0.140625,
0.68896484375,
0.25634765625,
0.59375,
-0.078369140625,
-0.2227783203125,
-0.300048828125,
0.63037109375,
0.5205078125,
0.5009765625,
-0.15966796875,
-0.025238037109375,
0.74267578125,
0.183349609375,
0.028472900390625,
0.07257080078125,
0.10101318359375,
-0.029388427734375,
0.29638671875,
-0.199951171875,
0.1014404296875,
-0.2919921875,
-0.454833984375,
0.183837890625,
-0.529296875,
-0.024017333984375,
-0.419189453125,
-0.5693359375,
0.6767578125,
-0.11126708984375,
-0.01291656494140625,
0.0560302734375,
-0.8974609375,
0.30322265625,
0.38818359375,
-0.46044921875,
-0.39404296875,
0.97900390625,
0.73388671875,
0.409423828125,
0.580078125,
0.66796875,
0.274658203125,
-0.6103515625,
0.58056640625,
0.09808349609375,
0.151123046875,
-0.26611328125,
-0.60302734375,
-0.65283203125,
0.268798828125,
-0.4033203125,
-0.04638671875,
0.434326171875,
-0.489013671875,
0.25439453125,
-0.30078125,
0.43359375,
-0.468017578125,
-0.220703125,
0.1812744140625,
-0.0064697265625,
-0.81591796875,
0.54345703125,
-0.35693359375,
0.44580078125,
-0.0108795166015625,
0.8642578125,
0.1988525390625,
1.4697265625,
0.82666015625,
-0.330810546875,
-0.190185546875,
0.27197265625,
-0.22119140625,
-0.6455078125,
-0.31640625,
-0.43994140625,
0.1895751953125,
-0.46240234375,
-1.0458984375,
0.1998291015625,
0.5068359375,
-0.08465576171875,
-0.491455078125,
0.1680908203125,
-0.11480712890625,
-0.92138671875,
0.207275390625,
0.431640625,
0.13720703125,
0.53271484375,
0.048614501953125,
-0.154296875,
-0.7646484375,
0.242919921875,
-0.54248046875,
0.1785888671875,
-0.94287109375,
-0.338623046875,
-0.38134765625,
-0.61865234375,
-0.50244140625,
-0.08355712890625,
-0.38623046875,
-0.85986328125,
0.38623046875,
0.359375,
0.56396484375,
0.54541015625,
-0.204833984375,
0.19873046875,
0.97900390625,
0.98486328125,
-0.07843017578125,
0.876953125,
0.10595703125,
-0.2464599609375,
0.1552734375,
-0.487548828125,
0.5947265625,
-0.609375,
0.1341552734375,
-0.5830078125,
-0.2442626953125,
-0.869140625,
-0.978515625,
0.11993408203125,
0.497314453125,
0.39306640625,
-0.88671875,
-0.91943359375,
-0.52734375,
-1.0986328125,
0.045989990234375,
-0.56005859375,
0.75927734375,
-0.052001953125,
0.138671875,
0.07781982421875,
-1.0390625,
4.58203125,
0.9150390625,
1.056640625,
0.6279296875,
0.0703125,
0.845703125,
0.1510009765625,
-0.1544189453125,
-0.244873046875,
-0.36328125,
0.15283203125,
-0.2091064453125,
0.08709716796875,
1.0419921875,
0.5087890625,
0.50390625,
-0.2203369140625,
0.35498046875,
0.081787109375,
-1,
-0.880859375,
0.172119140625,
-0.033111572265625,
0.72509765625,
0.049041748046875,
0.439453125,
0.857421875,
-0.7568359375,
-0.48681640625,
-0.63037109375,
0.180908203125,
-0.310791015625,
0.8330078125,
-0.06988525390625,
-0.3076171875,
0.66650390625,
-0.020172119140625,
-0.348388671875,
-0.050384521484375,
0.041351318359375,
-0.035675048828125,
0.1400146484375,
0.2457275390625,
-0.41748046875,
0.06781005859375,
0.50341796875,
-0.54150390625,
0.5634765625,
0.313720703125,
-0.7001953125,
0.64453125,
-0.40380859375,
0.4775390625,
-0.74169921875,
-0.59375,
0.19970703125,
0.1092529296875,
-0.1195068359375,
-0.32958984375,
0.7451171875,
0.64892578125,
0.408935546875,
0.05126953125,
0.25537109375,
-0.55908203125,
0.68408203125,
0.0287933349609375,
0.30615234375,
-0.8046875,
-0.1583251953125,
0.051849365234375,
0.0307769775390625,
-0.340087890625,
-0.76904296875,
0.69482421875,
0.11041259765625,
-0.045745849609375,
0.53662109375,
0.54052734375,
-0.59716796875,
0.0232391357421875,
-0.2335205078125,
-0.52197265625,
-0.3173828125,
0.5703125,
0.9169921875,
-0.5390625,
-0.1748046875,
-0.181884765625,
0.42529296875,
0.65625,
0.580078125,
0.2113037109375,
-0.87548828125,
-0.226318359375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete logarithm!
Of course, there is a code lock is installed on the safe. The lock has a screen that displays a string of n lowercase Latin letters. Initially, the screen displays string s. Whitfield and Martin found out that the safe will open when string t will be displayed on the screen.
The string on the screen can be changed using the operation «shift x». In order to apply this operation, explorers choose an integer x from 0 to n inclusive. After that, the current string p = αβ changes to βRα, where the length of β is x, and the length of α is n - x. In other words, the suffix of the length x of string p is reversed and moved to the beginning of the string. For example, after the operation «shift 4» the string «abcacb» will be changed with string «bcacab », since α = ab, β = cacb, βR = bcac.
Explorers are afraid that if they apply too many operations «shift», the lock will be locked forever. They ask you to find a way to get the string t on the screen, using no more than 6100 operations.
Input
The first line contains an integer n, the length of the strings s and t (1 ≤ n ≤ 2 000).
After that, there are two strings s and t, consisting of n lowercase Latin letters each.
Output
If it is impossible to get string t from string s using no more than 6100 operations «shift», print a single number - 1.
Otherwise, in the first line output the number of operations k (0 ≤ k ≤ 6100). In the next line output k numbers xi corresponding to the operations «shift xi» (0 ≤ xi ≤ n) in the order in which they should be applied.
Examples
Input
6
abacbb
babcba
Output
4
6 3 2 3
Input
3
aba
bba
Output
-1
Tags: constructive algorithms, implementation, strings
Correct Solution:
```
n = int(input())
s = input()
t = input()
if sorted(s) != sorted(t):
print(-1)
else:
ans = []
for i in t:
j = 0
for j in range(n):
if i == s[j]:
break
ans.append(n-j-1)
ans.append(1)
ans.append(n)
s =s[j-n-1:-n-1:-1] + s[j+1:] + s[j]
print(len(ans))
for i in ans:
print(i, end=' ')
```
| 65,385
|
[
0.35302734375,
-0.05657958984375,
-0.391845703125,
0.265869140625,
-0.2037353515625,
-0.5068359375,
-0.178955078125,
0.07183837890625,
0.327392578125,
1.0107421875,
1.099609375,
-0.142578125,
0.2164306640625,
-1.115234375,
-0.38330078125,
0.2802734375,
-0.2822265625,
-0.5712890625,
-0.406005859375,
0.56689453125,
0.356689453125,
-0.0579833984375,
-1.3115234375,
-0.2196044921875,
-0.77490234375,
0.75146484375,
0.426513671875,
-0.1600341796875,
1.0810546875,
1.33203125,
-0.331787109375,
-0.368896484375,
0.87890625,
-0.90478515625,
-0.45703125,
-0.37255859375,
0.416748046875,
-0.58056640625,
-0.0008015632629394531,
-0.58544921875,
0.260009765625,
-0.305908203125,
0.53466796875,
-0.417236328125,
-1.439453125,
-0.076171875,
-0.39697265625,
-0.1796875,
-0.10821533203125,
-0.740234375,
0.201904296875,
0.01015472412109375,
0.69189453125,
-0.286376953125,
0.0770263671875,
0.3203125,
-0.130859375,
-0.4375,
-0.351806640625,
0.26904296875,
0.277587890625,
-0.00989532470703125,
-0.0216827392578125,
-0.432861328125,
-0.1539306640625,
0.19384765625,
-0.1466064453125,
-0.247314453125,
-0.115478515625,
-0.86474609375,
0.060516357421875,
0.578125,
-0.446533203125,
-0.277099609375,
-0.28173828125,
-0.008056640625,
0.2279052734375,
0.2469482421875,
-1.0869140625,
0.990234375,
-0.10968017578125,
1.0869140625,
0.267333984375,
0.221923828125,
-0.31591796875,
-0.6015625,
-0.2274169921875,
-0.1773681640625,
0.0389404296875,
-0.317138671875,
-0.08038330078125,
0.494873046875,
-0.4404296875,
-0.11181640625,
0.484619140625,
0.50341796875,
-0.1820068359375,
0.12359619140625,
0.82666015625,
0.2144775390625,
0.51953125,
0.857421875,
-0.5380859375,
0.931640625,
-0.47412109375,
-0.2225341796875,
0.1651611328125,
0.2281494140625,
-0.2384033203125,
-0.267333984375,
-0.1552734375,
-0.5419921875,
0.4853515625,
0.16015625,
-0.06854248046875,
0.93994140625,
-0.2244873046875,
0.4990234375,
-0.455322265625,
0.1456298828125,
0.62060546875,
0.05035400390625,
0.60205078125,
-0.403076171875,
-0.1513671875,
-0.259765625,
-0.2203369140625,
0.79541015625,
-0.5869140625,
-0.21533203125,
-0.13330078125,
-0.1309814453125,
-0.40673828125,
0.426513671875,
-0.1981201171875,
0.94921875,
-0.07391357421875,
0.8291015625,
0.71337890625,
-0.69921875,
0.66552734375,
-0.332275390625,
-0.057403564453125,
1.3974609375,
0.5263671875,
0.062347412109375,
0.6591796875,
0.405029296875,
-0.603515625,
0.4951171875,
-1.0478515625,
0.73876953125,
0.293701171875,
0.28955078125,
-0.41015625,
0.08648681640625,
-0.270263671875,
0.93408203125,
-0.040283203125,
-0.03094482421875,
-0.312744140625,
0.482666015625,
-0.05181884765625,
0.89501953125,
-0.33740234375,
0.9677734375,
-0.083740234375,
-0.7060546875,
-0.07281494140625,
-0.46728515625,
0.1334228515625,
-0.05029296875,
-0.52490234375,
0.9208984375,
0.6533203125,
0.82568359375,
1.111328125,
-0.29541015625,
0.37939453125,
0.267822265625,
-0.560546875,
0.0887451171875,
0.2264404296875,
0.7509765625,
-0.03497314453125,
0.041412353515625,
0.260986328125,
-0.1888427734375,
-0.84033203125,
-0.29150390625,
-0.0933837890625,
0.94482421875,
-0.80419921875,
0.374755859375,
0.44140625,
-0.01995849609375,
-1.064453125,
-0.1295166015625,
0.1099853515625,
-0.931640625,
-0.25927734375,
0.90283203125,
-0.1402587890625,
0.779296875,
-0.452392578125,
-0.52978515625,
0.4609375,
1.1220703125,
-0.19091796875,
-0.1317138671875,
0.237060546875,
-0.00908660888671875,
-0.4658203125,
-0.1270751953125,
0.2249755859375,
0.0628662109375,
-0.51611328125,
0.96826171875,
0.1925048828125,
-0.07562255859375,
0.1134033203125,
0.81591796875,
0.349853515625,
0.69921875,
-0.322509765625,
-0.2410888671875,
0.493896484375,
0.8642578125,
-0.0081634521484375,
0.1922607421875,
0.338623046875,
0.86572265625,
0.32666015625,
0.6025390625,
0.0601806640625,
0.2401123046875,
0.284423828125,
0.77880859375,
0.1158447265625,
0.355224609375,
0.2371826171875,
0.427490234375,
0.027374267578125,
0.220458984375,
0.18994140625,
0.1732177734375,
0.00133514404296875,
0.0203399658203125,
-0.361572265625,
0.302978515625,
-0.552734375,
0.859375,
-0.152587890625,
0.270263671875,
-0.28564453125,
-0.1820068359375,
0.384765625,
0.6767578125,
-1.158203125,
-0.413330078125,
0.0032482147216796875,
0.01629638671875,
0.1661376953125,
-0.41552734375,
0.7705078125,
0.49267578125,
0.5068359375,
0.466796875,
-0.36767578125,
-0.74072265625,
-1.041015625,
-1.1484375,
-0.8671875,
-0.458740234375,
-0.96533203125,
0.4580078125,
0.130615234375,
-0.99462890625,
0.313232421875,
-0.5146484375,
-0.07757568359375,
0.3427734375,
-0.8076171875,
0.8154296875,
-0.0889892578125,
0.369140625,
-0.697265625,
0.505859375,
0.267822265625,
0.6669921875,
-0.74658203125,
-0.0296478271484375,
0.131591796875,
-0.55908203125,
0.58984375,
0.06683349609375,
0.1993408203125,
-0.09661865234375,
-0.951171875,
-0.908203125,
-0.5087890625,
-0.167236328125,
-0.54833984375,
0.0819091796875,
-0.712890625,
0.89599609375,
0.6708984375,
-0.39697265625,
0.70751953125,
0.94873046875,
-0.71728515625,
0.5703125,
0.297607421875,
-0.000980377197265625,
-0.9482421875,
1.1513671875,
0.54052734375,
0.28076171875,
-0.8056640625,
-0.298583984375,
-0.47509765625,
0.060791015625,
0.2294921875,
-0.35595703125,
-0.5146484375,
0.66796875,
0.0056915283203125,
-0.8125,
0.845703125,
-0.857421875,
-0.73388671875,
-0.340087890625,
-0.59375,
0.83056640625,
0.82177734375,
0.29541015625,
-0.364013671875,
-0.116943359375,
0.103759765625,
0.83203125,
0.4033203125,
-0.12286376953125,
0.352294921875,
0.404052734375,
-0.109130859375,
0.0201568603515625,
-0.04437255859375,
-0.796875,
-0.199951171875,
0.07733154296875,
0.289306640625,
0.57958984375,
0.1490478515625,
0.44482421875,
0.351318359375,
1.009765625,
-1.169921875,
-0.471435546875,
-0.141845703125,
0.705078125,
0.66748046875,
0.2176513671875,
0.2366943359375,
-0.08734130859375,
-0.27685546875,
-0.78955078125,
0.08477783203125,
0.2349853515625,
0.67724609375,
-0.505859375,
0.401611328125,
0.243896484375,
-0.755859375,
0.5537109375,
-0.4716796875,
-0.027008056640625,
0.94873046875,
-0.51220703125,
0.94384765625,
-0.7412109375,
0.697265625,
0.1309814453125,
0.178466796875,
0.63818359375,
0.2373046875,
0.331787109375,
-0.53759765625,
-0.377197265625,
-0.265380859375,
-0.1456298828125,
-0.14990234375,
-0.5478515625,
0.393798828125,
-0.66552734375,
-0.615234375,
-0.962890625,
0.92822265625,
0.5908203125,
0.442138671875,
-0.046875,
0.473876953125,
0.10467529296875,
0.499267578125,
0.70947265625,
-0.28857421875,
0.01342010498046875,
-0.76708984375,
0.873046875,
-0.313232421875,
-0.438232421875,
-0.46435546875,
0.1282958984375,
-0.202880859375,
0.1370849609375,
0.04083251953125,
0.05975341796875,
-0.94873046875,
0.472412109375,
-0.09649658203125,
0.79345703125,
-0.71484375,
-0.07000732421875,
-0.359130859375,
0.380615234375,
0.333984375,
-0.78759765625,
0.71044921875,
-0.90673828125,
0.2437744140625,
0.404541015625,
-0.0325927734375,
-0.355224609375,
-0.295166015625,
-0.8349609375,
-0.568359375,
0.062744140625,
0.90283203125,
-0.333984375,
0.12005615234375,
-1.2548828125,
0.36572265625,
0.042205810546875,
-0.458251953125,
-0.223876953125,
0.18115234375,
0.35888671875,
0.06280517578125,
0.236572265625,
0.0278167724609375,
-0.353271484375,
0.25439453125,
-0.8251953125,
0.69140625,
-0.487548828125,
0.042999267578125,
0.25537109375,
0.1463623046875,
0.272216796875,
0.26513671875,
-0.552734375,
-0.0897216796875,
-0.2447509765625,
0.2783203125,
-0.611328125,
-0.71435546875,
0.40283203125,
-0.366943359375,
-0.62744140625,
0.83837890625,
-0.1365966796875,
-0.463623046875,
0.367431640625,
0.2392578125,
-0.68212890625,
0.29052734375,
-0.432861328125,
0.40771484375,
-0.321044921875,
-0.685546875,
-0.1474609375,
-0.3271484375,
0.82666015625,
0.19873046875,
-0.391357421875,
-0.1160888671875,
-0.9326171875,
-0.11041259765625,
0.01654052734375,
-0.356201171875,
0.1807861328125,
0.3466796875,
0.0352783203125,
-0.226806640625,
-0.258544921875,
-0.2274169921875,
0.0771484375,
-0.5693359375,
-0.402587890625,
0.51806640625,
0.59521484375,
0.38916015625,
-0.1663818359375,
-0.7509765625,
0.055816650390625,
0.0241241455078125,
0.0679931640625,
-0.53369140625,
-0.11566162109375,
-0.255859375,
-0.047149658203125,
-0.1661376953125,
0.2939453125,
-0.14697265625,
0.256103515625,
0.8525390625,
0.027740478515625,
0.409912109375,
0.2578125,
-0.5283203125,
0.79541015625,
0.1416015625,
-0.9345703125,
-0.19140625,
0.53564453125,
0.121337890625,
0.73876953125,
-0.01226043701171875,
-0.7294921875,
-0.607421875,
-0.6845703125,
0.050750732421875,
-1.0712890625,
0.1151123046875,
-0.638671875,
-0.425048828125,
-0.4072265625,
0.4365234375,
-0.0157012939453125,
-0.611328125,
-0.1260986328125,
-0.7119140625,
-0.125,
-0.7265625,
-0.08416748046875,
-0.609375,
-0.8603515625,
-0.0977783203125,
0.9130859375,
0.285888671875,
0.10845947265625,
0.011749267578125,
0.036468505859375,
0.4921875,
0.0054931640625,
-0.671875,
-0.421630859375,
0.0982666015625,
0.340576171875,
-0.0157928466796875,
-0.229736328125,
-0.402099609375,
0.2666015625,
-0.85986328125,
0.308349609375,
-0.2340087890625,
-0.11334228515625,
-0.032928466796875,
-0.13232421875,
1.0576171875,
-0.08038330078125,
0.11529541015625,
-0.1962890625,
-0.08984375,
1.021484375,
-0.407470703125,
-0.1727294921875,
-0.5185546875,
-0.6416015625,
-1.31640625,
0.53173828125,
-0.371337890625,
0.309814453125,
-0.7431640625,
-0.465576171875,
0.9501953125,
-0.451904296875,
0.172119140625,
0.943359375,
-0.036102294921875,
0.12164306640625,
-0.71826171875,
0.517578125,
0.4990234375,
-0.6416015625,
-0.0677490234375,
0.053955078125,
-0.228271484375,
-0.0032787322998046875,
-0.1051025390625,
-0.4033203125,
-0.6416015625,
0.1832275390625,
1.15234375,
-0.218994140625,
0.861328125,
-0.08990478515625,
-1.041015625,
-0.7021484375,
0.4072265625,
0.252685546875,
0.56396484375,
0.732421875,
-0.1162109375,
-0.27392578125,
-0.03662109375,
0.127685546875,
-0.340087890625,
-0.4326171875,
0.6318359375,
-0.375244140625,
-0.309326171875,
0.9423828125,
0.81640625,
-1.0859375,
-0.9599609375,
-0.060516357421875,
-0.032379150390625,
-0.30029296875,
-0.50634765625,
0.12103271484375,
0.09259033203125,
-0.625,
0.1495361328125,
0.38134765625,
0.0275726318359375,
0.44091796875,
0.01287841796875,
0.280517578125,
-0.421875,
0.19970703125,
0.603515625,
-0.37353515625,
-0.330322265625,
-1.0693359375,
-0.425048828125,
-0.343994140625,
-0.2083740234375,
0.70654296875,
-0.7119140625,
0.00887298583984375,
0.3525390625,
-0.1436767578125,
0.46533203125,
-0.245849609375,
-0.160400390625,
0.390625,
-0.53125,
-0.77490234375,
-0.047271728515625,
0.2344970703125,
-0.128173828125,
0.6923828125,
-0.45458984375,
0.56640625,
0.37255859375,
-0.137939453125,
-0.6640625,
-0.85693359375,
0.0018749237060546875,
-1.353515625,
-0.416259765625,
-0.52099609375,
-0.8447265625,
-0.036346435546875,
0.1734619140625,
0.1329345703125,
-0.53271484375,
0.2467041015625,
0.29052734375,
-0.54345703125,
0.388671875,
-0.52685546875,
0.1510009765625,
-0.434814453125,
-0.7744140625,
-0.73828125,
-0.2017822265625,
-0.217041015625,
0.040435791015625,
-0.59814453125,
0.427978515625,
0.1480712890625,
0.90283203125,
-0.1517333984375,
0.14794921875,
-0.58740234375,
-0.423583984375,
0.2493896484375,
-0.006565093994140625,
-0.3984375,
0.927734375,
0.5791015625,
0.289794921875,
0.4443359375,
-0.36376953125,
-0.288818359375,
-0.09161376953125,
0.61083984375,
0.259033203125,
-0.286865234375,
-0.2012939453125,
0.1435546875,
0.267333984375,
-1.2060546875,
0.59716796875,
-0.61083984375,
-0.08563232421875,
0.09375,
-0.0755615234375,
0.284423828125,
0.708984375,
-0.2373046875,
0.26708984375,
-0.05596923828125,
-0.1925048828125,
0.65625,
0.1793212890625,
0.018218994140625,
0.1513671875,
-0.2105712890625,
-0.1468505859375,
-0.199951171875,
0.31201171875,
-0.253173828125,
0.31005859375,
-0.1798095703125,
-1.099609375,
-0.625,
-0.06585693359375,
-0.019805908203125,
0.2568359375,
0.51416015625,
-0.184814453125,
-0.1597900390625,
0.05169677734375,
-0.861328125,
0.2734375,
-1.025390625,
-0.463623046875,
0.489501953125,
0.027740478515625,
-0.406982421875,
-0.1455078125,
0.0289306640625,
-0.2459716796875,
-0.11944580078125,
0.322021484375,
-0.4892578125,
0.419921875,
-0.3603515625,
0.414306640625,
0.026336669921875,
0.019989013671875,
0.01488494873046875,
0.6904296875,
-0.60595703125,
-0.418212890625,
-0.2115478515625,
1.248046875,
0.09112548828125,
-0.2242431640625,
-0.68798828125,
0.140380859375,
0.158447265625,
-0.2261962890625,
-0.2354736328125,
0.26513671875,
-0.517578125,
0.5517578125,
-0.8017578125,
0.029327392578125,
-0.0738525390625,
0.1551513671875,
-0.271240234375,
-0.2159423828125,
-0.49072265625,
0.83544921875,
0.41796875,
-0.140625,
0.68896484375,
0.25634765625,
0.59375,
-0.078369140625,
-0.2227783203125,
-0.300048828125,
0.63037109375,
0.5205078125,
0.5009765625,
-0.15966796875,
-0.025238037109375,
0.74267578125,
0.183349609375,
0.028472900390625,
0.07257080078125,
0.10101318359375,
-0.029388427734375,
0.29638671875,
-0.199951171875,
0.1014404296875,
-0.2919921875,
-0.454833984375,
0.183837890625,
-0.529296875,
-0.024017333984375,
-0.419189453125,
-0.5693359375,
0.6767578125,
-0.11126708984375,
-0.01291656494140625,
0.0560302734375,
-0.8974609375,
0.30322265625,
0.38818359375,
-0.46044921875,
-0.39404296875,
0.97900390625,
0.73388671875,
0.409423828125,
0.580078125,
0.66796875,
0.274658203125,
-0.6103515625,
0.58056640625,
0.09808349609375,
0.151123046875,
-0.26611328125,
-0.60302734375,
-0.65283203125,
0.268798828125,
-0.4033203125,
-0.04638671875,
0.434326171875,
-0.489013671875,
0.25439453125,
-0.30078125,
0.43359375,
-0.468017578125,
-0.220703125,
0.1812744140625,
-0.0064697265625,
-0.81591796875,
0.54345703125,
-0.35693359375,
0.44580078125,
-0.0108795166015625,
0.8642578125,
0.1988525390625,
1.4697265625,
0.82666015625,
-0.330810546875,
-0.190185546875,
0.27197265625,
-0.22119140625,
-0.6455078125,
-0.31640625,
-0.43994140625,
0.1895751953125,
-0.46240234375,
-1.0458984375,
0.1998291015625,
0.5068359375,
-0.08465576171875,
-0.491455078125,
0.1680908203125,
-0.11480712890625,
-0.92138671875,
0.207275390625,
0.431640625,
0.13720703125,
0.53271484375,
0.048614501953125,
-0.154296875,
-0.7646484375,
0.242919921875,
-0.54248046875,
0.1785888671875,
-0.94287109375,
-0.338623046875,
-0.38134765625,
-0.61865234375,
-0.50244140625,
-0.08355712890625,
-0.38623046875,
-0.85986328125,
0.38623046875,
0.359375,
0.56396484375,
0.54541015625,
-0.204833984375,
0.19873046875,
0.97900390625,
0.98486328125,
-0.07843017578125,
0.876953125,
0.10595703125,
-0.2464599609375,
0.1552734375,
-0.487548828125,
0.5947265625,
-0.609375,
0.1341552734375,
-0.5830078125,
-0.2442626953125,
-0.869140625,
-0.978515625,
0.11993408203125,
0.497314453125,
0.39306640625,
-0.88671875,
-0.91943359375,
-0.52734375,
-1.0986328125,
0.045989990234375,
-0.56005859375,
0.75927734375,
-0.052001953125,
0.138671875,
0.07781982421875,
-1.0390625,
4.58203125,
0.9150390625,
1.056640625,
0.6279296875,
0.0703125,
0.845703125,
0.1510009765625,
-0.1544189453125,
-0.244873046875,
-0.36328125,
0.15283203125,
-0.2091064453125,
0.08709716796875,
1.0419921875,
0.5087890625,
0.50390625,
-0.2203369140625,
0.35498046875,
0.081787109375,
-1,
-0.880859375,
0.172119140625,
-0.033111572265625,
0.72509765625,
0.049041748046875,
0.439453125,
0.857421875,
-0.7568359375,
-0.48681640625,
-0.63037109375,
0.180908203125,
-0.310791015625,
0.8330078125,
-0.06988525390625,
-0.3076171875,
0.66650390625,
-0.020172119140625,
-0.348388671875,
-0.050384521484375,
0.041351318359375,
-0.035675048828125,
0.1400146484375,
0.2457275390625,
-0.41748046875,
0.06781005859375,
0.50341796875,
-0.54150390625,
0.5634765625,
0.313720703125,
-0.7001953125,
0.64453125,
-0.40380859375,
0.4775390625,
-0.74169921875,
-0.59375,
0.19970703125,
0.1092529296875,
-0.1195068359375,
-0.32958984375,
0.7451171875,
0.64892578125,
0.408935546875,
0.05126953125,
0.25537109375,
-0.55908203125,
0.68408203125,
0.0287933349609375,
0.30615234375,
-0.8046875,
-0.1583251953125,
0.051849365234375,
0.0307769775390625,
-0.340087890625,
-0.76904296875,
0.69482421875,
0.11041259765625,
-0.045745849609375,
0.53662109375,
0.54052734375,
-0.59716796875,
0.0232391357421875,
-0.2335205078125,
-0.52197265625,
-0.3173828125,
0.5703125,
0.9169921875,
-0.5390625,
-0.1748046875,
-0.181884765625,
0.42529296875,
0.65625,
0.580078125,
0.2113037109375,
-0.87548828125,
-0.226318359375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete logarithm!
Of course, there is a code lock is installed on the safe. The lock has a screen that displays a string of n lowercase Latin letters. Initially, the screen displays string s. Whitfield and Martin found out that the safe will open when string t will be displayed on the screen.
The string on the screen can be changed using the operation «shift x». In order to apply this operation, explorers choose an integer x from 0 to n inclusive. After that, the current string p = αβ changes to βRα, where the length of β is x, and the length of α is n - x. In other words, the suffix of the length x of string p is reversed and moved to the beginning of the string. For example, after the operation «shift 4» the string «abcacb» will be changed with string «bcacab », since α = ab, β = cacb, βR = bcac.
Explorers are afraid that if they apply too many operations «shift», the lock will be locked forever. They ask you to find a way to get the string t on the screen, using no more than 6100 operations.
Input
The first line contains an integer n, the length of the strings s and t (1 ≤ n ≤ 2 000).
After that, there are two strings s and t, consisting of n lowercase Latin letters each.
Output
If it is impossible to get string t from string s using no more than 6100 operations «shift», print a single number - 1.
Otherwise, in the first line output the number of operations k (0 ≤ k ≤ 6100). In the next line output k numbers xi corresponding to the operations «shift xi» (0 ≤ xi ≤ n) in the order in which they should be applied.
Examples
Input
6
abacbb
babcba
Output
4
6 3 2 3
Input
3
aba
bba
Output
-1
Tags: constructive algorithms, implementation, strings
Correct Solution:
```
n = int(input())
s = input()
t = input()
if sorted(s) != sorted(t):
print(-1)
else:
res = []
for i in range(n):
k = 0;
while(s[k] != t[i]):
k += 1
res += [n-k-1, 1, n]
s = "".join(reversed(s[:k])) + s[k+1:] + s[k]
#print(s)
print(len(res))
print(*res)
```
| 65,386
|
[
0.35302734375,
-0.05657958984375,
-0.391845703125,
0.265869140625,
-0.2037353515625,
-0.5068359375,
-0.178955078125,
0.07183837890625,
0.327392578125,
1.0107421875,
1.099609375,
-0.142578125,
0.2164306640625,
-1.115234375,
-0.38330078125,
0.2802734375,
-0.2822265625,
-0.5712890625,
-0.406005859375,
0.56689453125,
0.356689453125,
-0.0579833984375,
-1.3115234375,
-0.2196044921875,
-0.77490234375,
0.75146484375,
0.426513671875,
-0.1600341796875,
1.0810546875,
1.33203125,
-0.331787109375,
-0.368896484375,
0.87890625,
-0.90478515625,
-0.45703125,
-0.37255859375,
0.416748046875,
-0.58056640625,
-0.0008015632629394531,
-0.58544921875,
0.260009765625,
-0.305908203125,
0.53466796875,
-0.417236328125,
-1.439453125,
-0.076171875,
-0.39697265625,
-0.1796875,
-0.10821533203125,
-0.740234375,
0.201904296875,
0.01015472412109375,
0.69189453125,
-0.286376953125,
0.0770263671875,
0.3203125,
-0.130859375,
-0.4375,
-0.351806640625,
0.26904296875,
0.277587890625,
-0.00989532470703125,
-0.0216827392578125,
-0.432861328125,
-0.1539306640625,
0.19384765625,
-0.1466064453125,
-0.247314453125,
-0.115478515625,
-0.86474609375,
0.060516357421875,
0.578125,
-0.446533203125,
-0.277099609375,
-0.28173828125,
-0.008056640625,
0.2279052734375,
0.2469482421875,
-1.0869140625,
0.990234375,
-0.10968017578125,
1.0869140625,
0.267333984375,
0.221923828125,
-0.31591796875,
-0.6015625,
-0.2274169921875,
-0.1773681640625,
0.0389404296875,
-0.317138671875,
-0.08038330078125,
0.494873046875,
-0.4404296875,
-0.11181640625,
0.484619140625,
0.50341796875,
-0.1820068359375,
0.12359619140625,
0.82666015625,
0.2144775390625,
0.51953125,
0.857421875,
-0.5380859375,
0.931640625,
-0.47412109375,
-0.2225341796875,
0.1651611328125,
0.2281494140625,
-0.2384033203125,
-0.267333984375,
-0.1552734375,
-0.5419921875,
0.4853515625,
0.16015625,
-0.06854248046875,
0.93994140625,
-0.2244873046875,
0.4990234375,
-0.455322265625,
0.1456298828125,
0.62060546875,
0.05035400390625,
0.60205078125,
-0.403076171875,
-0.1513671875,
-0.259765625,
-0.2203369140625,
0.79541015625,
-0.5869140625,
-0.21533203125,
-0.13330078125,
-0.1309814453125,
-0.40673828125,
0.426513671875,
-0.1981201171875,
0.94921875,
-0.07391357421875,
0.8291015625,
0.71337890625,
-0.69921875,
0.66552734375,
-0.332275390625,
-0.057403564453125,
1.3974609375,
0.5263671875,
0.062347412109375,
0.6591796875,
0.405029296875,
-0.603515625,
0.4951171875,
-1.0478515625,
0.73876953125,
0.293701171875,
0.28955078125,
-0.41015625,
0.08648681640625,
-0.270263671875,
0.93408203125,
-0.040283203125,
-0.03094482421875,
-0.312744140625,
0.482666015625,
-0.05181884765625,
0.89501953125,
-0.33740234375,
0.9677734375,
-0.083740234375,
-0.7060546875,
-0.07281494140625,
-0.46728515625,
0.1334228515625,
-0.05029296875,
-0.52490234375,
0.9208984375,
0.6533203125,
0.82568359375,
1.111328125,
-0.29541015625,
0.37939453125,
0.267822265625,
-0.560546875,
0.0887451171875,
0.2264404296875,
0.7509765625,
-0.03497314453125,
0.041412353515625,
0.260986328125,
-0.1888427734375,
-0.84033203125,
-0.29150390625,
-0.0933837890625,
0.94482421875,
-0.80419921875,
0.374755859375,
0.44140625,
-0.01995849609375,
-1.064453125,
-0.1295166015625,
0.1099853515625,
-0.931640625,
-0.25927734375,
0.90283203125,
-0.1402587890625,
0.779296875,
-0.452392578125,
-0.52978515625,
0.4609375,
1.1220703125,
-0.19091796875,
-0.1317138671875,
0.237060546875,
-0.00908660888671875,
-0.4658203125,
-0.1270751953125,
0.2249755859375,
0.0628662109375,
-0.51611328125,
0.96826171875,
0.1925048828125,
-0.07562255859375,
0.1134033203125,
0.81591796875,
0.349853515625,
0.69921875,
-0.322509765625,
-0.2410888671875,
0.493896484375,
0.8642578125,
-0.0081634521484375,
0.1922607421875,
0.338623046875,
0.86572265625,
0.32666015625,
0.6025390625,
0.0601806640625,
0.2401123046875,
0.284423828125,
0.77880859375,
0.1158447265625,
0.355224609375,
0.2371826171875,
0.427490234375,
0.027374267578125,
0.220458984375,
0.18994140625,
0.1732177734375,
0.00133514404296875,
0.0203399658203125,
-0.361572265625,
0.302978515625,
-0.552734375,
0.859375,
-0.152587890625,
0.270263671875,
-0.28564453125,
-0.1820068359375,
0.384765625,
0.6767578125,
-1.158203125,
-0.413330078125,
0.0032482147216796875,
0.01629638671875,
0.1661376953125,
-0.41552734375,
0.7705078125,
0.49267578125,
0.5068359375,
0.466796875,
-0.36767578125,
-0.74072265625,
-1.041015625,
-1.1484375,
-0.8671875,
-0.458740234375,
-0.96533203125,
0.4580078125,
0.130615234375,
-0.99462890625,
0.313232421875,
-0.5146484375,
-0.07757568359375,
0.3427734375,
-0.8076171875,
0.8154296875,
-0.0889892578125,
0.369140625,
-0.697265625,
0.505859375,
0.267822265625,
0.6669921875,
-0.74658203125,
-0.0296478271484375,
0.131591796875,
-0.55908203125,
0.58984375,
0.06683349609375,
0.1993408203125,
-0.09661865234375,
-0.951171875,
-0.908203125,
-0.5087890625,
-0.167236328125,
-0.54833984375,
0.0819091796875,
-0.712890625,
0.89599609375,
0.6708984375,
-0.39697265625,
0.70751953125,
0.94873046875,
-0.71728515625,
0.5703125,
0.297607421875,
-0.000980377197265625,
-0.9482421875,
1.1513671875,
0.54052734375,
0.28076171875,
-0.8056640625,
-0.298583984375,
-0.47509765625,
0.060791015625,
0.2294921875,
-0.35595703125,
-0.5146484375,
0.66796875,
0.0056915283203125,
-0.8125,
0.845703125,
-0.857421875,
-0.73388671875,
-0.340087890625,
-0.59375,
0.83056640625,
0.82177734375,
0.29541015625,
-0.364013671875,
-0.116943359375,
0.103759765625,
0.83203125,
0.4033203125,
-0.12286376953125,
0.352294921875,
0.404052734375,
-0.109130859375,
0.0201568603515625,
-0.04437255859375,
-0.796875,
-0.199951171875,
0.07733154296875,
0.289306640625,
0.57958984375,
0.1490478515625,
0.44482421875,
0.351318359375,
1.009765625,
-1.169921875,
-0.471435546875,
-0.141845703125,
0.705078125,
0.66748046875,
0.2176513671875,
0.2366943359375,
-0.08734130859375,
-0.27685546875,
-0.78955078125,
0.08477783203125,
0.2349853515625,
0.67724609375,
-0.505859375,
0.401611328125,
0.243896484375,
-0.755859375,
0.5537109375,
-0.4716796875,
-0.027008056640625,
0.94873046875,
-0.51220703125,
0.94384765625,
-0.7412109375,
0.697265625,
0.1309814453125,
0.178466796875,
0.63818359375,
0.2373046875,
0.331787109375,
-0.53759765625,
-0.377197265625,
-0.265380859375,
-0.1456298828125,
-0.14990234375,
-0.5478515625,
0.393798828125,
-0.66552734375,
-0.615234375,
-0.962890625,
0.92822265625,
0.5908203125,
0.442138671875,
-0.046875,
0.473876953125,
0.10467529296875,
0.499267578125,
0.70947265625,
-0.28857421875,
0.01342010498046875,
-0.76708984375,
0.873046875,
-0.313232421875,
-0.438232421875,
-0.46435546875,
0.1282958984375,
-0.202880859375,
0.1370849609375,
0.04083251953125,
0.05975341796875,
-0.94873046875,
0.472412109375,
-0.09649658203125,
0.79345703125,
-0.71484375,
-0.07000732421875,
-0.359130859375,
0.380615234375,
0.333984375,
-0.78759765625,
0.71044921875,
-0.90673828125,
0.2437744140625,
0.404541015625,
-0.0325927734375,
-0.355224609375,
-0.295166015625,
-0.8349609375,
-0.568359375,
0.062744140625,
0.90283203125,
-0.333984375,
0.12005615234375,
-1.2548828125,
0.36572265625,
0.042205810546875,
-0.458251953125,
-0.223876953125,
0.18115234375,
0.35888671875,
0.06280517578125,
0.236572265625,
0.0278167724609375,
-0.353271484375,
0.25439453125,
-0.8251953125,
0.69140625,
-0.487548828125,
0.042999267578125,
0.25537109375,
0.1463623046875,
0.272216796875,
0.26513671875,
-0.552734375,
-0.0897216796875,
-0.2447509765625,
0.2783203125,
-0.611328125,
-0.71435546875,
0.40283203125,
-0.366943359375,
-0.62744140625,
0.83837890625,
-0.1365966796875,
-0.463623046875,
0.367431640625,
0.2392578125,
-0.68212890625,
0.29052734375,
-0.432861328125,
0.40771484375,
-0.321044921875,
-0.685546875,
-0.1474609375,
-0.3271484375,
0.82666015625,
0.19873046875,
-0.391357421875,
-0.1160888671875,
-0.9326171875,
-0.11041259765625,
0.01654052734375,
-0.356201171875,
0.1807861328125,
0.3466796875,
0.0352783203125,
-0.226806640625,
-0.258544921875,
-0.2274169921875,
0.0771484375,
-0.5693359375,
-0.402587890625,
0.51806640625,
0.59521484375,
0.38916015625,
-0.1663818359375,
-0.7509765625,
0.055816650390625,
0.0241241455078125,
0.0679931640625,
-0.53369140625,
-0.11566162109375,
-0.255859375,
-0.047149658203125,
-0.1661376953125,
0.2939453125,
-0.14697265625,
0.256103515625,
0.8525390625,
0.027740478515625,
0.409912109375,
0.2578125,
-0.5283203125,
0.79541015625,
0.1416015625,
-0.9345703125,
-0.19140625,
0.53564453125,
0.121337890625,
0.73876953125,
-0.01226043701171875,
-0.7294921875,
-0.607421875,
-0.6845703125,
0.050750732421875,
-1.0712890625,
0.1151123046875,
-0.638671875,
-0.425048828125,
-0.4072265625,
0.4365234375,
-0.0157012939453125,
-0.611328125,
-0.1260986328125,
-0.7119140625,
-0.125,
-0.7265625,
-0.08416748046875,
-0.609375,
-0.8603515625,
-0.0977783203125,
0.9130859375,
0.285888671875,
0.10845947265625,
0.011749267578125,
0.036468505859375,
0.4921875,
0.0054931640625,
-0.671875,
-0.421630859375,
0.0982666015625,
0.340576171875,
-0.0157928466796875,
-0.229736328125,
-0.402099609375,
0.2666015625,
-0.85986328125,
0.308349609375,
-0.2340087890625,
-0.11334228515625,
-0.032928466796875,
-0.13232421875,
1.0576171875,
-0.08038330078125,
0.11529541015625,
-0.1962890625,
-0.08984375,
1.021484375,
-0.407470703125,
-0.1727294921875,
-0.5185546875,
-0.6416015625,
-1.31640625,
0.53173828125,
-0.371337890625,
0.309814453125,
-0.7431640625,
-0.465576171875,
0.9501953125,
-0.451904296875,
0.172119140625,
0.943359375,
-0.036102294921875,
0.12164306640625,
-0.71826171875,
0.517578125,
0.4990234375,
-0.6416015625,
-0.0677490234375,
0.053955078125,
-0.228271484375,
-0.0032787322998046875,
-0.1051025390625,
-0.4033203125,
-0.6416015625,
0.1832275390625,
1.15234375,
-0.218994140625,
0.861328125,
-0.08990478515625,
-1.041015625,
-0.7021484375,
0.4072265625,
0.252685546875,
0.56396484375,
0.732421875,
-0.1162109375,
-0.27392578125,
-0.03662109375,
0.127685546875,
-0.340087890625,
-0.4326171875,
0.6318359375,
-0.375244140625,
-0.309326171875,
0.9423828125,
0.81640625,
-1.0859375,
-0.9599609375,
-0.060516357421875,
-0.032379150390625,
-0.30029296875,
-0.50634765625,
0.12103271484375,
0.09259033203125,
-0.625,
0.1495361328125,
0.38134765625,
0.0275726318359375,
0.44091796875,
0.01287841796875,
0.280517578125,
-0.421875,
0.19970703125,
0.603515625,
-0.37353515625,
-0.330322265625,
-1.0693359375,
-0.425048828125,
-0.343994140625,
-0.2083740234375,
0.70654296875,
-0.7119140625,
0.00887298583984375,
0.3525390625,
-0.1436767578125,
0.46533203125,
-0.245849609375,
-0.160400390625,
0.390625,
-0.53125,
-0.77490234375,
-0.047271728515625,
0.2344970703125,
-0.128173828125,
0.6923828125,
-0.45458984375,
0.56640625,
0.37255859375,
-0.137939453125,
-0.6640625,
-0.85693359375,
0.0018749237060546875,
-1.353515625,
-0.416259765625,
-0.52099609375,
-0.8447265625,
-0.036346435546875,
0.1734619140625,
0.1329345703125,
-0.53271484375,
0.2467041015625,
0.29052734375,
-0.54345703125,
0.388671875,
-0.52685546875,
0.1510009765625,
-0.434814453125,
-0.7744140625,
-0.73828125,
-0.2017822265625,
-0.217041015625,
0.040435791015625,
-0.59814453125,
0.427978515625,
0.1480712890625,
0.90283203125,
-0.1517333984375,
0.14794921875,
-0.58740234375,
-0.423583984375,
0.2493896484375,
-0.006565093994140625,
-0.3984375,
0.927734375,
0.5791015625,
0.289794921875,
0.4443359375,
-0.36376953125,
-0.288818359375,
-0.09161376953125,
0.61083984375,
0.259033203125,
-0.286865234375,
-0.2012939453125,
0.1435546875,
0.267333984375,
-1.2060546875,
0.59716796875,
-0.61083984375,
-0.08563232421875,
0.09375,
-0.0755615234375,
0.284423828125,
0.708984375,
-0.2373046875,
0.26708984375,
-0.05596923828125,
-0.1925048828125,
0.65625,
0.1793212890625,
0.018218994140625,
0.1513671875,
-0.2105712890625,
-0.1468505859375,
-0.199951171875,
0.31201171875,
-0.253173828125,
0.31005859375,
-0.1798095703125,
-1.099609375,
-0.625,
-0.06585693359375,
-0.019805908203125,
0.2568359375,
0.51416015625,
-0.184814453125,
-0.1597900390625,
0.05169677734375,
-0.861328125,
0.2734375,
-1.025390625,
-0.463623046875,
0.489501953125,
0.027740478515625,
-0.406982421875,
-0.1455078125,
0.0289306640625,
-0.2459716796875,
-0.11944580078125,
0.322021484375,
-0.4892578125,
0.419921875,
-0.3603515625,
0.414306640625,
0.026336669921875,
0.019989013671875,
0.01488494873046875,
0.6904296875,
-0.60595703125,
-0.418212890625,
-0.2115478515625,
1.248046875,
0.09112548828125,
-0.2242431640625,
-0.68798828125,
0.140380859375,
0.158447265625,
-0.2261962890625,
-0.2354736328125,
0.26513671875,
-0.517578125,
0.5517578125,
-0.8017578125,
0.029327392578125,
-0.0738525390625,
0.1551513671875,
-0.271240234375,
-0.2159423828125,
-0.49072265625,
0.83544921875,
0.41796875,
-0.140625,
0.68896484375,
0.25634765625,
0.59375,
-0.078369140625,
-0.2227783203125,
-0.300048828125,
0.63037109375,
0.5205078125,
0.5009765625,
-0.15966796875,
-0.025238037109375,
0.74267578125,
0.183349609375,
0.028472900390625,
0.07257080078125,
0.10101318359375,
-0.029388427734375,
0.29638671875,
-0.199951171875,
0.1014404296875,
-0.2919921875,
-0.454833984375,
0.183837890625,
-0.529296875,
-0.024017333984375,
-0.419189453125,
-0.5693359375,
0.6767578125,
-0.11126708984375,
-0.01291656494140625,
0.0560302734375,
-0.8974609375,
0.30322265625,
0.38818359375,
-0.46044921875,
-0.39404296875,
0.97900390625,
0.73388671875,
0.409423828125,
0.580078125,
0.66796875,
0.274658203125,
-0.6103515625,
0.58056640625,
0.09808349609375,
0.151123046875,
-0.26611328125,
-0.60302734375,
-0.65283203125,
0.268798828125,
-0.4033203125,
-0.04638671875,
0.434326171875,
-0.489013671875,
0.25439453125,
-0.30078125,
0.43359375,
-0.468017578125,
-0.220703125,
0.1812744140625,
-0.0064697265625,
-0.81591796875,
0.54345703125,
-0.35693359375,
0.44580078125,
-0.0108795166015625,
0.8642578125,
0.1988525390625,
1.4697265625,
0.82666015625,
-0.330810546875,
-0.190185546875,
0.27197265625,
-0.22119140625,
-0.6455078125,
-0.31640625,
-0.43994140625,
0.1895751953125,
-0.46240234375,
-1.0458984375,
0.1998291015625,
0.5068359375,
-0.08465576171875,
-0.491455078125,
0.1680908203125,
-0.11480712890625,
-0.92138671875,
0.207275390625,
0.431640625,
0.13720703125,
0.53271484375,
0.048614501953125,
-0.154296875,
-0.7646484375,
0.242919921875,
-0.54248046875,
0.1785888671875,
-0.94287109375,
-0.338623046875,
-0.38134765625,
-0.61865234375,
-0.50244140625,
-0.08355712890625,
-0.38623046875,
-0.85986328125,
0.38623046875,
0.359375,
0.56396484375,
0.54541015625,
-0.204833984375,
0.19873046875,
0.97900390625,
0.98486328125,
-0.07843017578125,
0.876953125,
0.10595703125,
-0.2464599609375,
0.1552734375,
-0.487548828125,
0.5947265625,
-0.609375,
0.1341552734375,
-0.5830078125,
-0.2442626953125,
-0.869140625,
-0.978515625,
0.11993408203125,
0.497314453125,
0.39306640625,
-0.88671875,
-0.91943359375,
-0.52734375,
-1.0986328125,
0.045989990234375,
-0.56005859375,
0.75927734375,
-0.052001953125,
0.138671875,
0.07781982421875,
-1.0390625,
4.58203125,
0.9150390625,
1.056640625,
0.6279296875,
0.0703125,
0.845703125,
0.1510009765625,
-0.1544189453125,
-0.244873046875,
-0.36328125,
0.15283203125,
-0.2091064453125,
0.08709716796875,
1.0419921875,
0.5087890625,
0.50390625,
-0.2203369140625,
0.35498046875,
0.081787109375,
-1,
-0.880859375,
0.172119140625,
-0.033111572265625,
0.72509765625,
0.049041748046875,
0.439453125,
0.857421875,
-0.7568359375,
-0.48681640625,
-0.63037109375,
0.180908203125,
-0.310791015625,
0.8330078125,
-0.06988525390625,
-0.3076171875,
0.66650390625,
-0.020172119140625,
-0.348388671875,
-0.050384521484375,
0.041351318359375,
-0.035675048828125,
0.1400146484375,
0.2457275390625,
-0.41748046875,
0.06781005859375,
0.50341796875,
-0.54150390625,
0.5634765625,
0.313720703125,
-0.7001953125,
0.64453125,
-0.40380859375,
0.4775390625,
-0.74169921875,
-0.59375,
0.19970703125,
0.1092529296875,
-0.1195068359375,
-0.32958984375,
0.7451171875,
0.64892578125,
0.408935546875,
0.05126953125,
0.25537109375,
-0.55908203125,
0.68408203125,
0.0287933349609375,
0.30615234375,
-0.8046875,
-0.1583251953125,
0.051849365234375,
0.0307769775390625,
-0.340087890625,
-0.76904296875,
0.69482421875,
0.11041259765625,
-0.045745849609375,
0.53662109375,
0.54052734375,
-0.59716796875,
0.0232391357421875,
-0.2335205078125,
-0.52197265625,
-0.3173828125,
0.5703125,
0.9169921875,
-0.5390625,
-0.1748046875,
-0.181884765625,
0.42529296875,
0.65625,
0.580078125,
0.2113037109375,
-0.87548828125,
-0.226318359375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete logarithm!
Of course, there is a code lock is installed on the safe. The lock has a screen that displays a string of n lowercase Latin letters. Initially, the screen displays string s. Whitfield and Martin found out that the safe will open when string t will be displayed on the screen.
The string on the screen can be changed using the operation «shift x». In order to apply this operation, explorers choose an integer x from 0 to n inclusive. After that, the current string p = αβ changes to βRα, where the length of β is x, and the length of α is n - x. In other words, the suffix of the length x of string p is reversed and moved to the beginning of the string. For example, after the operation «shift 4» the string «abcacb» will be changed with string «bcacab », since α = ab, β = cacb, βR = bcac.
Explorers are afraid that if they apply too many operations «shift», the lock will be locked forever. They ask you to find a way to get the string t on the screen, using no more than 6100 operations.
Input
The first line contains an integer n, the length of the strings s and t (1 ≤ n ≤ 2 000).
After that, there are two strings s and t, consisting of n lowercase Latin letters each.
Output
If it is impossible to get string t from string s using no more than 6100 operations «shift», print a single number - 1.
Otherwise, in the first line output the number of operations k (0 ≤ k ≤ 6100). In the next line output k numbers xi corresponding to the operations «shift xi» (0 ≤ xi ≤ n) in the order in which they should be applied.
Examples
Input
6
abacbb
babcba
Output
4
6 3 2 3
Input
3
aba
bba
Output
-1
Submitted Solution:
```
n = int(input())
s = input()
t = input()
if sorted(s) != sorted(t):
print(-1)
else:
ans = []
for i in t:
j = 0
for j in range(n):
if i == s[j]:
break
ans.append(n-j-1)
ans.append(1)
ans.append(n)
p = s[:j] + s[j+1:] + s[j]
s = p
print(len(ans))
print(ans)
```
No
| 65,387
|
[
0.37939453125,
-0.038299560546875,
-0.37353515625,
0.2386474609375,
-0.353759765625,
-0.435546875,
-0.15283203125,
0.1727294921875,
0.245849609375,
0.92529296875,
1.048828125,
-0.099609375,
0.1046142578125,
-1.1181640625,
-0.444580078125,
0.2744140625,
-0.20947265625,
-0.59814453125,
-0.347412109375,
0.51318359375,
0.250732421875,
-0.09716796875,
-1.298828125,
-0.12493896484375,
-0.75830078125,
0.69775390625,
0.439453125,
-0.1785888671875,
0.97314453125,
1.29296875,
-0.308837890625,
-0.3876953125,
0.8916015625,
-0.83740234375,
-0.4541015625,
-0.363037109375,
0.4833984375,
-0.625,
-0.06634521484375,
-0.64599609375,
0.1341552734375,
-0.225341796875,
0.5498046875,
-0.35107421875,
-1.3955078125,
-0.170166015625,
-0.33740234375,
-0.2303466796875,
-0.127685546875,
-0.71484375,
0.261474609375,
-0.047119140625,
0.681640625,
-0.3671875,
0.15185546875,
0.473876953125,
-0.12841796875,
-0.33447265625,
-0.417724609375,
0.185546875,
0.30908203125,
0.0024929046630859375,
-0.011871337890625,
-0.50390625,
-0.153076171875,
0.340576171875,
-0.07208251953125,
-0.275146484375,
-0.08770751953125,
-0.720703125,
0.1015625,
0.458251953125,
-0.497314453125,
-0.1580810546875,
-0.32470703125,
-0.036102294921875,
0.131591796875,
0.330078125,
-1.189453125,
0.9453125,
-0.1793212890625,
1.125,
0.337158203125,
0.260009765625,
-0.359619140625,
-0.6201171875,
-0.1422119140625,
-0.15185546875,
0.1441650390625,
-0.346435546875,
-0.050689697265625,
0.42919921875,
-0.460205078125,
-0.0943603515625,
0.5517578125,
0.46875,
-0.22998046875,
0.1632080078125,
0.7841796875,
0.29248046875,
0.515625,
0.7998046875,
-0.5107421875,
0.97412109375,
-0.46142578125,
-0.1905517578125,
0.1622314453125,
0.1947021484375,
-0.19482421875,
-0.256591796875,
-0.14208984375,
-0.625,
0.467041015625,
0.16845703125,
-0.1534423828125,
0.841796875,
-0.247314453125,
0.517578125,
-0.4287109375,
0.10302734375,
0.6083984375,
-0.01522064208984375,
0.60791015625,
-0.392578125,
-0.04571533203125,
-0.26123046875,
-0.3740234375,
0.77392578125,
-0.5400390625,
-0.22900390625,
-0.0943603515625,
-0.12322998046875,
-0.458740234375,
0.352783203125,
-0.260986328125,
0.8779296875,
-0.03857421875,
0.74462890625,
0.73876953125,
-0.7333984375,
0.68505859375,
-0.296875,
0.0129241943359375,
1.4912109375,
0.445556640625,
0.0626220703125,
0.580078125,
0.41748046875,
-0.56787109375,
0.56201171875,
-1.021484375,
0.60400390625,
0.1282958984375,
0.24853515625,
-0.46533203125,
0.0877685546875,
-0.24169921875,
0.8818359375,
0.01073455810546875,
-0.1259765625,
-0.32080078125,
0.5380859375,
-0.07232666015625,
0.869140625,
-0.322021484375,
0.86474609375,
-0.028900146484375,
-0.75146484375,
-0.09918212890625,
-0.4482421875,
0.06072998046875,
-0.06976318359375,
-0.374267578125,
0.96484375,
0.7099609375,
0.87255859375,
1.0341796875,
-0.29052734375,
0.388427734375,
0.30322265625,
-0.576171875,
0.1439208984375,
0.254638671875,
0.7978515625,
-0.046142578125,
0.10711669921875,
0.234375,
-0.0887451171875,
-0.72314453125,
-0.3046875,
-0.05364990234375,
1.025390625,
-0.8759765625,
0.410400390625,
0.364501953125,
-0.0268707275390625,
-1.0263671875,
-0.1829833984375,
0.1331787109375,
-0.95947265625,
-0.341796875,
0.87158203125,
-0.10467529296875,
0.83203125,
-0.48779296875,
-0.58740234375,
0.47119140625,
1.177734375,
-0.1724853515625,
-0.08697509765625,
0.337646484375,
0.053863525390625,
-0.470947265625,
-0.1834716796875,
0.18017578125,
0.032012939453125,
-0.50341796875,
0.87451171875,
0.166259765625,
-0.1092529296875,
0.129150390625,
0.78125,
0.1968994140625,
0.7041015625,
-0.459228515625,
-0.301513671875,
0.444580078125,
0.93701171875,
-0.040313720703125,
0.178955078125,
0.362548828125,
0.90478515625,
0.32470703125,
0.73974609375,
0.1334228515625,
0.1961669921875,
0.411865234375,
0.69140625,
0.01342010498046875,
0.384033203125,
0.199951171875,
0.432861328125,
0.0108642578125,
0.32861328125,
0.1319580078125,
0.267822265625,
-0.138671875,
-0.0044403076171875,
-0.416748046875,
0.33349609375,
-0.50244140625,
0.81103515625,
-0.1510009765625,
0.33203125,
-0.310302734375,
-0.136962890625,
0.51123046875,
0.6162109375,
-1.1669921875,
-0.568359375,
0.003414154052734375,
0.057373046875,
0.10888671875,
-0.3876953125,
0.6904296875,
0.354736328125,
0.48388671875,
0.49169921875,
-0.35888671875,
-0.615234375,
-0.966796875,
-1.1748046875,
-0.9658203125,
-0.44921875,
-0.94677734375,
0.319580078125,
0.182861328125,
-0.98828125,
0.2391357421875,
-0.58251953125,
-0.039276123046875,
0.259033203125,
-0.7724609375,
0.859375,
-0.1280517578125,
0.32763671875,
-0.59619140625,
0.465087890625,
0.341064453125,
0.62939453125,
-0.7431640625,
-0.04949951171875,
0.1424560546875,
-0.4833984375,
0.5869140625,
-0.0025234222412109375,
0.204345703125,
-0.058349609375,
-0.9345703125,
-0.90478515625,
-0.469482421875,
-0.135498046875,
-0.4462890625,
-0.042633056640625,
-0.7392578125,
0.9384765625,
0.56982421875,
-0.53125,
0.57177734375,
0.892578125,
-0.720703125,
0.64794921875,
0.397705078125,
0.10150146484375,
-0.859375,
1.1806640625,
0.48974609375,
0.333251953125,
-0.76171875,
-0.329345703125,
-0.381103515625,
0.0826416015625,
0.217529296875,
-0.321044921875,
-0.51416015625,
0.67041015625,
0.03350830078125,
-0.81103515625,
0.841796875,
-0.947265625,
-0.64794921875,
-0.295166015625,
-0.71728515625,
0.861328125,
0.86181640625,
0.272705078125,
-0.3564453125,
-0.27587890625,
0.05560302734375,
0.81640625,
0.493896484375,
-0.2113037109375,
0.325439453125,
0.47802734375,
-0.1368408203125,
0.05633544921875,
0.01226043701171875,
-0.8408203125,
-0.258056640625,
0.059814453125,
0.20361328125,
0.63330078125,
0.08953857421875,
0.5283203125,
0.286865234375,
1.0810546875,
-1.1357421875,
-0.414794921875,
-0.2333984375,
0.6728515625,
0.595703125,
0.27880859375,
0.30322265625,
0.0231170654296875,
-0.3046875,
-0.78369140625,
0.1282958984375,
0.1112060546875,
0.6904296875,
-0.4306640625,
0.397705078125,
0.186767578125,
-0.78076171875,
0.66259765625,
-0.408203125,
0.048248291015625,
0.96337890625,
-0.4443359375,
0.822265625,
-0.72216796875,
0.70068359375,
0.05474853515625,
0.08929443359375,
0.60498046875,
0.1883544921875,
0.406982421875,
-0.53125,
-0.4794921875,
-0.2083740234375,
-0.10894775390625,
-0.1971435546875,
-0.513671875,
0.3212890625,
-0.70556640625,
-0.671875,
-1.03515625,
0.9892578125,
0.57421875,
0.419189453125,
0.010009765625,
0.461181640625,
-0.01568603515625,
0.48046875,
0.75146484375,
-0.2152099609375,
-0.0107269287109375,
-0.79345703125,
0.98291015625,
-0.2369384765625,
-0.446044921875,
-0.406005859375,
0.08203125,
-0.2381591796875,
0.10662841796875,
0.01324462890625,
0.08001708984375,
-0.9453125,
0.59814453125,
-0.0308685302734375,
0.82568359375,
-0.77001953125,
-0.058258056640625,
-0.27099609375,
0.311279296875,
0.296875,
-0.853515625,
0.59814453125,
-0.8623046875,
0.159912109375,
0.476806640625,
-0.01232147216796875,
-0.396484375,
-0.26904296875,
-0.97119140625,
-0.75390625,
0.050140380859375,
0.95703125,
-0.36669921875,
0.145263671875,
-1.3515625,
0.384033203125,
0.183837890625,
-0.5693359375,
-0.1649169921875,
0.1494140625,
0.298095703125,
-0.016510009765625,
0.254150390625,
0.010284423828125,
-0.338134765625,
0.205078125,
-0.8291015625,
0.61474609375,
-0.41552734375,
0.06890869140625,
0.274658203125,
0.173095703125,
0.2496337890625,
0.278076171875,
-0.5283203125,
-0.13330078125,
-0.2232666015625,
0.328125,
-0.693359375,
-0.7080078125,
0.3974609375,
-0.260986328125,
-0.72705078125,
0.84521484375,
-0.08709716796875,
-0.52001953125,
0.369384765625,
0.1934814453125,
-0.62939453125,
0.394287109375,
-0.421630859375,
0.3583984375,
-0.216552734375,
-0.58544921875,
-0.1724853515625,
-0.348876953125,
0.845703125,
0.093505859375,
-0.331787109375,
-0.1636962890625,
-0.9765625,
-0.11822509765625,
0.0113372802734375,
-0.4189453125,
0.147216796875,
0.409912109375,
0.0235137939453125,
-0.2197265625,
-0.3359375,
-0.386962890625,
0.135009765625,
-0.53271484375,
-0.4580078125,
0.53857421875,
0.59326171875,
0.419677734375,
-0.10821533203125,
-0.67236328125,
0.06488037109375,
-0.09661865234375,
0.0731201171875,
-0.58251953125,
-0.08355712890625,
-0.203857421875,
-0.1287841796875,
-0.19580078125,
0.338623046875,
-0.172607421875,
0.260498046875,
0.79248046875,
0.0228729248046875,
0.5068359375,
0.233642578125,
-0.56640625,
0.83251953125,
0.04534912109375,
-1.0419921875,
-0.101806640625,
0.57763671875,
0.154052734375,
0.826171875,
-0.1224365234375,
-0.66455078125,
-0.6708984375,
-0.71435546875,
0.08502197265625,
-1.09375,
-0.0110626220703125,
-0.70703125,
-0.477294921875,
-0.412109375,
0.470947265625,
-0.048065185546875,
-0.58251953125,
-0.06256103515625,
-0.798828125,
-0.08203125,
-0.80517578125,
-0.06939697265625,
-0.63623046875,
-0.7470703125,
-0.1807861328125,
0.97265625,
0.286376953125,
0.09112548828125,
-0.039093017578125,
0.12310791015625,
0.40283203125,
0.061737060546875,
-0.57177734375,
-0.447998046875,
0.156494140625,
0.225341796875,
-0.0849609375,
-0.181396484375,
-0.415771484375,
0.2218017578125,
-0.8427734375,
0.32080078125,
-0.2080078125,
-0.1279296875,
0.0726318359375,
-0.1888427734375,
1.0439453125,
-0.131103515625,
0.139892578125,
-0.224853515625,
-0.153076171875,
1.1103515625,
-0.365234375,
-0.1396484375,
-0.435791015625,
-0.6123046875,
-1.3349609375,
0.5283203125,
-0.324462890625,
0.326171875,
-0.6953125,
-0.442138671875,
0.9443359375,
-0.529296875,
0.253662109375,
0.97265625,
-0.0609130859375,
0.10797119140625,
-0.7607421875,
0.55078125,
0.5576171875,
-0.623046875,
-0.01708984375,
-0.01233673095703125,
-0.37744140625,
-0.0126800537109375,
-0.1812744140625,
-0.45751953125,
-0.74072265625,
0.202392578125,
1.0341796875,
-0.1923828125,
0.91259765625,
-0.10235595703125,
-1.142578125,
-0.6337890625,
0.47265625,
0.228271484375,
0.4736328125,
0.6884765625,
-0.05682373046875,
-0.37890625,
-0.00377655029296875,
0.08489990234375,
-0.318115234375,
-0.41064453125,
0.76171875,
-0.52099609375,
-0.315185546875,
0.9619140625,
0.80810546875,
-1.1767578125,
-0.96240234375,
-0.060821533203125,
0.0303802490234375,
-0.1512451171875,
-0.6181640625,
0.1263427734375,
0.02734375,
-0.55029296875,
0.2060546875,
0.378662109375,
0.07080078125,
0.53271484375,
0.03790283203125,
0.351806640625,
-0.546875,
0.176513671875,
0.60009765625,
-0.328369140625,
-0.41748046875,
-1.0849609375,
-0.30517578125,
-0.32177734375,
-0.17236328125,
0.6845703125,
-0.68310546875,
0.0673828125,
0.5185546875,
-0.254150390625,
0.52685546875,
-0.322021484375,
-0.043365478515625,
0.37060546875,
-0.458251953125,
-0.7314453125,
-0.1258544921875,
0.234619140625,
-0.040863037109375,
0.7900390625,
-0.444091796875,
0.50830078125,
0.3837890625,
-0.10137939453125,
-0.6015625,
-0.77490234375,
-0.06878662109375,
-1.236328125,
-0.476806640625,
-0.461669921875,
-0.76220703125,
0.023284912109375,
0.27490234375,
0.11651611328125,
-0.52294921875,
0.185302734375,
0.312744140625,
-0.55224609375,
0.49560546875,
-0.54052734375,
0.14111328125,
-0.483154296875,
-0.73828125,
-0.76708984375,
-0.2384033203125,
-0.3076171875,
-0.0792236328125,
-0.436767578125,
0.47998046875,
0.06561279296875,
0.92724609375,
-0.14697265625,
0.1634521484375,
-0.426513671875,
-0.29736328125,
0.30419921875,
0.0416259765625,
-0.5693359375,
0.9833984375,
0.53125,
0.353271484375,
0.426025390625,
-0.36474609375,
-0.160888671875,
0.0250396728515625,
0.71044921875,
0.189697265625,
-0.11883544921875,
-0.318603515625,
0.1982421875,
0.1912841796875,
-1.1689453125,
0.673828125,
-0.6806640625,
-0.0274200439453125,
0.09417724609375,
-0.0948486328125,
0.2978515625,
0.67919921875,
-0.357177734375,
0.326904296875,
0.0168914794921875,
-0.1485595703125,
0.7490234375,
0.2109375,
0.0767822265625,
0.252197265625,
-0.187744140625,
-0.2003173828125,
-0.1651611328125,
0.24951171875,
-0.191162109375,
0.3271484375,
-0.203125,
-1.115234375,
-0.8017578125,
-0.086181640625,
-0.03973388671875,
0.2388916015625,
0.54833984375,
-0.260009765625,
-0.10894775390625,
0.07000732421875,
-0.85205078125,
0.2392578125,
-1.1474609375,
-0.53466796875,
0.560546875,
-0.0249786376953125,
-0.48193359375,
-0.0269775390625,
-0.0106658935546875,
-0.111572265625,
-0.12042236328125,
0.1700439453125,
-0.49609375,
0.2822265625,
-0.30029296875,
0.42578125,
0.040802001953125,
0.047088623046875,
-0.08160400390625,
0.6845703125,
-0.7119140625,
-0.38525390625,
-0.302001953125,
1.193359375,
0.04522705078125,
-0.251708984375,
-0.60107421875,
0.107177734375,
0.080810546875,
-0.3095703125,
-0.248291015625,
0.269775390625,
-0.3759765625,
0.54443359375,
-0.7177734375,
0.06597900390625,
-0.09344482421875,
0.11492919921875,
-0.38671875,
-0.307373046875,
-0.53662109375,
0.77880859375,
0.5146484375,
-0.034332275390625,
0.7197265625,
0.239990234375,
0.69775390625,
-0.047088623046875,
-0.1773681640625,
-0.31884765625,
0.69140625,
0.5908203125,
0.59765625,
-0.149658203125,
0.05792236328125,
0.771484375,
0.252197265625,
0.166748046875,
0.0980224609375,
0.15771484375,
-0.06829833984375,
0.306396484375,
-0.22314453125,
0.051177978515625,
-0.2320556640625,
-0.4951171875,
0.117431640625,
-0.5302734375,
-0.03631591796875,
-0.50537109375,
-0.5498046875,
0.716796875,
-0.131591796875,
0.03485107421875,
0.08642578125,
-0.9404296875,
0.397216796875,
0.314697265625,
-0.4287109375,
-0.246826171875,
1.0224609375,
0.80029296875,
0.51708984375,
0.58740234375,
0.64111328125,
0.25341796875,
-0.7265625,
0.5166015625,
0.236328125,
0.1298828125,
-0.21728515625,
-0.6025390625,
-0.76513671875,
0.335693359375,
-0.334716796875,
0.071533203125,
0.3291015625,
-0.6240234375,
0.29541015625,
-0.283935546875,
0.438232421875,
-0.53515625,
-0.248046875,
0.1204833984375,
-0.00220489501953125,
-0.81298828125,
0.60009765625,
-0.249267578125,
0.458984375,
-0.05511474609375,
0.82568359375,
0.2181396484375,
1.4306640625,
0.95068359375,
-0.287841796875,
-0.1761474609375,
0.384521484375,
-0.1578369140625,
-0.576171875,
-0.272216796875,
-0.39404296875,
0.052001953125,
-0.4521484375,
-1.0498046875,
0.10626220703125,
0.5224609375,
0.0100860595703125,
-0.495361328125,
0.04022216796875,
-0.12042236328125,
-0.86767578125,
0.2255859375,
0.41943359375,
0.24951171875,
0.5234375,
0.00901031494140625,
-0.28173828125,
-0.7548828125,
0.2454833984375,
-0.408447265625,
0.255126953125,
-0.89013671875,
-0.375732421875,
-0.4658203125,
-0.62890625,
-0.444580078125,
-0.09771728515625,
-0.445068359375,
-0.833984375,
0.4150390625,
0.3671875,
0.42333984375,
0.448974609375,
-0.2210693359375,
0.1192626953125,
1.0439453125,
1.041015625,
-0.09881591796875,
0.9462890625,
0.1434326171875,
-0.20654296875,
0.146484375,
-0.50634765625,
0.681640625,
-0.53955078125,
0.1600341796875,
-0.59765625,
-0.2071533203125,
-0.8935546875,
-0.9716796875,
0.06378173828125,
0.4658203125,
0.33251953125,
-0.89990234375,
-1.0380859375,
-0.65673828125,
-1.0341796875,
0.125244140625,
-0.5556640625,
0.8232421875,
0.03179931640625,
0.118408203125,
0.060333251953125,
-1.0166015625,
4.55078125,
0.94384765625,
0.92431640625,
0.479736328125,
0.1322021484375,
0.84716796875,
0.173828125,
-0.2257080078125,
-0.249755859375,
-0.4296875,
0.1456298828125,
-0.2294921875,
0.109130859375,
1.103515625,
0.55810546875,
0.51953125,
-0.22705078125,
0.1373291015625,
0.083740234375,
-1.03125,
-0.9111328125,
0.1038818359375,
0.09228515625,
0.634765625,
0.0302734375,
0.5087890625,
0.9736328125,
-0.83349609375,
-0.49951171875,
-0.61181640625,
0.2471923828125,
-0.31640625,
0.84765625,
-0.0193328857421875,
-0.363525390625,
0.625,
0.06427001953125,
-0.456787109375,
-0.10174560546875,
0.043609619140625,
-0.1273193359375,
0.2120361328125,
0.3310546875,
-0.406494140625,
0.06927490234375,
0.64794921875,
-0.482177734375,
0.7109375,
0.3828125,
-0.71728515625,
0.6845703125,
-0.26123046875,
0.466796875,
-0.646484375,
-0.580078125,
0.285400390625,
0.1102294921875,
-0.11956787109375,
-0.326171875,
0.71337890625,
0.5703125,
0.421875,
-0.072509765625,
0.38818359375,
-0.5771484375,
0.69384765625,
0.054351806640625,
0.2347412109375,
-0.8330078125,
-0.09881591796875,
-0.052490234375,
-0.045440673828125,
-0.426025390625,
-0.82666015625,
0.6845703125,
0.2279052734375,
-0.09869384765625,
0.50537109375,
0.55419921875,
-0.53955078125,
0.034942626953125,
-0.300048828125,
-0.428466796875,
-0.36181640625,
0.497314453125,
0.9755859375,
-0.54833984375,
-0.2203369140625,
-0.2122802734375,
0.463134765625,
0.70947265625,
0.65625,
0.1905517578125,
-0.94287109375,
-0.390380859375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete logarithm!
Of course, there is a code lock is installed on the safe. The lock has a screen that displays a string of n lowercase Latin letters. Initially, the screen displays string s. Whitfield and Martin found out that the safe will open when string t will be displayed on the screen.
The string on the screen can be changed using the operation «shift x». In order to apply this operation, explorers choose an integer x from 0 to n inclusive. After that, the current string p = αβ changes to βRα, where the length of β is x, and the length of α is n - x. In other words, the suffix of the length x of string p is reversed and moved to the beginning of the string. For example, after the operation «shift 4» the string «abcacb» will be changed with string «bcacab », since α = ab, β = cacb, βR = bcac.
Explorers are afraid that if they apply too many operations «shift», the lock will be locked forever. They ask you to find a way to get the string t on the screen, using no more than 6100 operations.
Input
The first line contains an integer n, the length of the strings s and t (1 ≤ n ≤ 2 000).
After that, there are two strings s and t, consisting of n lowercase Latin letters each.
Output
If it is impossible to get string t from string s using no more than 6100 operations «shift», print a single number - 1.
Otherwise, in the first line output the number of operations k (0 ≤ k ≤ 6100). In the next line output k numbers xi corresponding to the operations «shift xi» (0 ≤ xi ≤ n) in the order in which they should be applied.
Examples
Input
6
abacbb
babcba
Output
4
6 3 2 3
Input
3
aba
bba
Output
-1
Submitted Solution:
```
n = int(input())
s = input()
t = input()
if sorted(s) != sorted(t):
print(-1)
else:
ans = []
for i in t:
j = 0
for j in range(n):
if i == s[j]:
break
ans.append(n-j-1)
ans.append(1)
ans.append(n)
p = s[:j] + s[j+1:] + s[j]
s = p
print(len(ans))
for i in ans:
print(i, end=' ')
```
No
| 65,388
|
[
0.37939453125,
-0.038299560546875,
-0.37353515625,
0.2386474609375,
-0.353759765625,
-0.435546875,
-0.15283203125,
0.1727294921875,
0.245849609375,
0.92529296875,
1.048828125,
-0.099609375,
0.1046142578125,
-1.1181640625,
-0.444580078125,
0.2744140625,
-0.20947265625,
-0.59814453125,
-0.347412109375,
0.51318359375,
0.250732421875,
-0.09716796875,
-1.298828125,
-0.12493896484375,
-0.75830078125,
0.69775390625,
0.439453125,
-0.1785888671875,
0.97314453125,
1.29296875,
-0.308837890625,
-0.3876953125,
0.8916015625,
-0.83740234375,
-0.4541015625,
-0.363037109375,
0.4833984375,
-0.625,
-0.06634521484375,
-0.64599609375,
0.1341552734375,
-0.225341796875,
0.5498046875,
-0.35107421875,
-1.3955078125,
-0.170166015625,
-0.33740234375,
-0.2303466796875,
-0.127685546875,
-0.71484375,
0.261474609375,
-0.047119140625,
0.681640625,
-0.3671875,
0.15185546875,
0.473876953125,
-0.12841796875,
-0.33447265625,
-0.417724609375,
0.185546875,
0.30908203125,
0.0024929046630859375,
-0.011871337890625,
-0.50390625,
-0.153076171875,
0.340576171875,
-0.07208251953125,
-0.275146484375,
-0.08770751953125,
-0.720703125,
0.1015625,
0.458251953125,
-0.497314453125,
-0.1580810546875,
-0.32470703125,
-0.036102294921875,
0.131591796875,
0.330078125,
-1.189453125,
0.9453125,
-0.1793212890625,
1.125,
0.337158203125,
0.260009765625,
-0.359619140625,
-0.6201171875,
-0.1422119140625,
-0.15185546875,
0.1441650390625,
-0.346435546875,
-0.050689697265625,
0.42919921875,
-0.460205078125,
-0.0943603515625,
0.5517578125,
0.46875,
-0.22998046875,
0.1632080078125,
0.7841796875,
0.29248046875,
0.515625,
0.7998046875,
-0.5107421875,
0.97412109375,
-0.46142578125,
-0.1905517578125,
0.1622314453125,
0.1947021484375,
-0.19482421875,
-0.256591796875,
-0.14208984375,
-0.625,
0.467041015625,
0.16845703125,
-0.1534423828125,
0.841796875,
-0.247314453125,
0.517578125,
-0.4287109375,
0.10302734375,
0.6083984375,
-0.01522064208984375,
0.60791015625,
-0.392578125,
-0.04571533203125,
-0.26123046875,
-0.3740234375,
0.77392578125,
-0.5400390625,
-0.22900390625,
-0.0943603515625,
-0.12322998046875,
-0.458740234375,
0.352783203125,
-0.260986328125,
0.8779296875,
-0.03857421875,
0.74462890625,
0.73876953125,
-0.7333984375,
0.68505859375,
-0.296875,
0.0129241943359375,
1.4912109375,
0.445556640625,
0.0626220703125,
0.580078125,
0.41748046875,
-0.56787109375,
0.56201171875,
-1.021484375,
0.60400390625,
0.1282958984375,
0.24853515625,
-0.46533203125,
0.0877685546875,
-0.24169921875,
0.8818359375,
0.01073455810546875,
-0.1259765625,
-0.32080078125,
0.5380859375,
-0.07232666015625,
0.869140625,
-0.322021484375,
0.86474609375,
-0.028900146484375,
-0.75146484375,
-0.09918212890625,
-0.4482421875,
0.06072998046875,
-0.06976318359375,
-0.374267578125,
0.96484375,
0.7099609375,
0.87255859375,
1.0341796875,
-0.29052734375,
0.388427734375,
0.30322265625,
-0.576171875,
0.1439208984375,
0.254638671875,
0.7978515625,
-0.046142578125,
0.10711669921875,
0.234375,
-0.0887451171875,
-0.72314453125,
-0.3046875,
-0.05364990234375,
1.025390625,
-0.8759765625,
0.410400390625,
0.364501953125,
-0.0268707275390625,
-1.0263671875,
-0.1829833984375,
0.1331787109375,
-0.95947265625,
-0.341796875,
0.87158203125,
-0.10467529296875,
0.83203125,
-0.48779296875,
-0.58740234375,
0.47119140625,
1.177734375,
-0.1724853515625,
-0.08697509765625,
0.337646484375,
0.053863525390625,
-0.470947265625,
-0.1834716796875,
0.18017578125,
0.032012939453125,
-0.50341796875,
0.87451171875,
0.166259765625,
-0.1092529296875,
0.129150390625,
0.78125,
0.1968994140625,
0.7041015625,
-0.459228515625,
-0.301513671875,
0.444580078125,
0.93701171875,
-0.040313720703125,
0.178955078125,
0.362548828125,
0.90478515625,
0.32470703125,
0.73974609375,
0.1334228515625,
0.1961669921875,
0.411865234375,
0.69140625,
0.01342010498046875,
0.384033203125,
0.199951171875,
0.432861328125,
0.0108642578125,
0.32861328125,
0.1319580078125,
0.267822265625,
-0.138671875,
-0.0044403076171875,
-0.416748046875,
0.33349609375,
-0.50244140625,
0.81103515625,
-0.1510009765625,
0.33203125,
-0.310302734375,
-0.136962890625,
0.51123046875,
0.6162109375,
-1.1669921875,
-0.568359375,
0.003414154052734375,
0.057373046875,
0.10888671875,
-0.3876953125,
0.6904296875,
0.354736328125,
0.48388671875,
0.49169921875,
-0.35888671875,
-0.615234375,
-0.966796875,
-1.1748046875,
-0.9658203125,
-0.44921875,
-0.94677734375,
0.319580078125,
0.182861328125,
-0.98828125,
0.2391357421875,
-0.58251953125,
-0.039276123046875,
0.259033203125,
-0.7724609375,
0.859375,
-0.1280517578125,
0.32763671875,
-0.59619140625,
0.465087890625,
0.341064453125,
0.62939453125,
-0.7431640625,
-0.04949951171875,
0.1424560546875,
-0.4833984375,
0.5869140625,
-0.0025234222412109375,
0.204345703125,
-0.058349609375,
-0.9345703125,
-0.90478515625,
-0.469482421875,
-0.135498046875,
-0.4462890625,
-0.042633056640625,
-0.7392578125,
0.9384765625,
0.56982421875,
-0.53125,
0.57177734375,
0.892578125,
-0.720703125,
0.64794921875,
0.397705078125,
0.10150146484375,
-0.859375,
1.1806640625,
0.48974609375,
0.333251953125,
-0.76171875,
-0.329345703125,
-0.381103515625,
0.0826416015625,
0.217529296875,
-0.321044921875,
-0.51416015625,
0.67041015625,
0.03350830078125,
-0.81103515625,
0.841796875,
-0.947265625,
-0.64794921875,
-0.295166015625,
-0.71728515625,
0.861328125,
0.86181640625,
0.272705078125,
-0.3564453125,
-0.27587890625,
0.05560302734375,
0.81640625,
0.493896484375,
-0.2113037109375,
0.325439453125,
0.47802734375,
-0.1368408203125,
0.05633544921875,
0.01226043701171875,
-0.8408203125,
-0.258056640625,
0.059814453125,
0.20361328125,
0.63330078125,
0.08953857421875,
0.5283203125,
0.286865234375,
1.0810546875,
-1.1357421875,
-0.414794921875,
-0.2333984375,
0.6728515625,
0.595703125,
0.27880859375,
0.30322265625,
0.0231170654296875,
-0.3046875,
-0.78369140625,
0.1282958984375,
0.1112060546875,
0.6904296875,
-0.4306640625,
0.397705078125,
0.186767578125,
-0.78076171875,
0.66259765625,
-0.408203125,
0.048248291015625,
0.96337890625,
-0.4443359375,
0.822265625,
-0.72216796875,
0.70068359375,
0.05474853515625,
0.08929443359375,
0.60498046875,
0.1883544921875,
0.406982421875,
-0.53125,
-0.4794921875,
-0.2083740234375,
-0.10894775390625,
-0.1971435546875,
-0.513671875,
0.3212890625,
-0.70556640625,
-0.671875,
-1.03515625,
0.9892578125,
0.57421875,
0.419189453125,
0.010009765625,
0.461181640625,
-0.01568603515625,
0.48046875,
0.75146484375,
-0.2152099609375,
-0.0107269287109375,
-0.79345703125,
0.98291015625,
-0.2369384765625,
-0.446044921875,
-0.406005859375,
0.08203125,
-0.2381591796875,
0.10662841796875,
0.01324462890625,
0.08001708984375,
-0.9453125,
0.59814453125,
-0.0308685302734375,
0.82568359375,
-0.77001953125,
-0.058258056640625,
-0.27099609375,
0.311279296875,
0.296875,
-0.853515625,
0.59814453125,
-0.8623046875,
0.159912109375,
0.476806640625,
-0.01232147216796875,
-0.396484375,
-0.26904296875,
-0.97119140625,
-0.75390625,
0.050140380859375,
0.95703125,
-0.36669921875,
0.145263671875,
-1.3515625,
0.384033203125,
0.183837890625,
-0.5693359375,
-0.1649169921875,
0.1494140625,
0.298095703125,
-0.016510009765625,
0.254150390625,
0.010284423828125,
-0.338134765625,
0.205078125,
-0.8291015625,
0.61474609375,
-0.41552734375,
0.06890869140625,
0.274658203125,
0.173095703125,
0.2496337890625,
0.278076171875,
-0.5283203125,
-0.13330078125,
-0.2232666015625,
0.328125,
-0.693359375,
-0.7080078125,
0.3974609375,
-0.260986328125,
-0.72705078125,
0.84521484375,
-0.08709716796875,
-0.52001953125,
0.369384765625,
0.1934814453125,
-0.62939453125,
0.394287109375,
-0.421630859375,
0.3583984375,
-0.216552734375,
-0.58544921875,
-0.1724853515625,
-0.348876953125,
0.845703125,
0.093505859375,
-0.331787109375,
-0.1636962890625,
-0.9765625,
-0.11822509765625,
0.0113372802734375,
-0.4189453125,
0.147216796875,
0.409912109375,
0.0235137939453125,
-0.2197265625,
-0.3359375,
-0.386962890625,
0.135009765625,
-0.53271484375,
-0.4580078125,
0.53857421875,
0.59326171875,
0.419677734375,
-0.10821533203125,
-0.67236328125,
0.06488037109375,
-0.09661865234375,
0.0731201171875,
-0.58251953125,
-0.08355712890625,
-0.203857421875,
-0.1287841796875,
-0.19580078125,
0.338623046875,
-0.172607421875,
0.260498046875,
0.79248046875,
0.0228729248046875,
0.5068359375,
0.233642578125,
-0.56640625,
0.83251953125,
0.04534912109375,
-1.0419921875,
-0.101806640625,
0.57763671875,
0.154052734375,
0.826171875,
-0.1224365234375,
-0.66455078125,
-0.6708984375,
-0.71435546875,
0.08502197265625,
-1.09375,
-0.0110626220703125,
-0.70703125,
-0.477294921875,
-0.412109375,
0.470947265625,
-0.048065185546875,
-0.58251953125,
-0.06256103515625,
-0.798828125,
-0.08203125,
-0.80517578125,
-0.06939697265625,
-0.63623046875,
-0.7470703125,
-0.1807861328125,
0.97265625,
0.286376953125,
0.09112548828125,
-0.039093017578125,
0.12310791015625,
0.40283203125,
0.061737060546875,
-0.57177734375,
-0.447998046875,
0.156494140625,
0.225341796875,
-0.0849609375,
-0.181396484375,
-0.415771484375,
0.2218017578125,
-0.8427734375,
0.32080078125,
-0.2080078125,
-0.1279296875,
0.0726318359375,
-0.1888427734375,
1.0439453125,
-0.131103515625,
0.139892578125,
-0.224853515625,
-0.153076171875,
1.1103515625,
-0.365234375,
-0.1396484375,
-0.435791015625,
-0.6123046875,
-1.3349609375,
0.5283203125,
-0.324462890625,
0.326171875,
-0.6953125,
-0.442138671875,
0.9443359375,
-0.529296875,
0.253662109375,
0.97265625,
-0.0609130859375,
0.10797119140625,
-0.7607421875,
0.55078125,
0.5576171875,
-0.623046875,
-0.01708984375,
-0.01233673095703125,
-0.37744140625,
-0.0126800537109375,
-0.1812744140625,
-0.45751953125,
-0.74072265625,
0.202392578125,
1.0341796875,
-0.1923828125,
0.91259765625,
-0.10235595703125,
-1.142578125,
-0.6337890625,
0.47265625,
0.228271484375,
0.4736328125,
0.6884765625,
-0.05682373046875,
-0.37890625,
-0.00377655029296875,
0.08489990234375,
-0.318115234375,
-0.41064453125,
0.76171875,
-0.52099609375,
-0.315185546875,
0.9619140625,
0.80810546875,
-1.1767578125,
-0.96240234375,
-0.060821533203125,
0.0303802490234375,
-0.1512451171875,
-0.6181640625,
0.1263427734375,
0.02734375,
-0.55029296875,
0.2060546875,
0.378662109375,
0.07080078125,
0.53271484375,
0.03790283203125,
0.351806640625,
-0.546875,
0.176513671875,
0.60009765625,
-0.328369140625,
-0.41748046875,
-1.0849609375,
-0.30517578125,
-0.32177734375,
-0.17236328125,
0.6845703125,
-0.68310546875,
0.0673828125,
0.5185546875,
-0.254150390625,
0.52685546875,
-0.322021484375,
-0.043365478515625,
0.37060546875,
-0.458251953125,
-0.7314453125,
-0.1258544921875,
0.234619140625,
-0.040863037109375,
0.7900390625,
-0.444091796875,
0.50830078125,
0.3837890625,
-0.10137939453125,
-0.6015625,
-0.77490234375,
-0.06878662109375,
-1.236328125,
-0.476806640625,
-0.461669921875,
-0.76220703125,
0.023284912109375,
0.27490234375,
0.11651611328125,
-0.52294921875,
0.185302734375,
0.312744140625,
-0.55224609375,
0.49560546875,
-0.54052734375,
0.14111328125,
-0.483154296875,
-0.73828125,
-0.76708984375,
-0.2384033203125,
-0.3076171875,
-0.0792236328125,
-0.436767578125,
0.47998046875,
0.06561279296875,
0.92724609375,
-0.14697265625,
0.1634521484375,
-0.426513671875,
-0.29736328125,
0.30419921875,
0.0416259765625,
-0.5693359375,
0.9833984375,
0.53125,
0.353271484375,
0.426025390625,
-0.36474609375,
-0.160888671875,
0.0250396728515625,
0.71044921875,
0.189697265625,
-0.11883544921875,
-0.318603515625,
0.1982421875,
0.1912841796875,
-1.1689453125,
0.673828125,
-0.6806640625,
-0.0274200439453125,
0.09417724609375,
-0.0948486328125,
0.2978515625,
0.67919921875,
-0.357177734375,
0.326904296875,
0.0168914794921875,
-0.1485595703125,
0.7490234375,
0.2109375,
0.0767822265625,
0.252197265625,
-0.187744140625,
-0.2003173828125,
-0.1651611328125,
0.24951171875,
-0.191162109375,
0.3271484375,
-0.203125,
-1.115234375,
-0.8017578125,
-0.086181640625,
-0.03973388671875,
0.2388916015625,
0.54833984375,
-0.260009765625,
-0.10894775390625,
0.07000732421875,
-0.85205078125,
0.2392578125,
-1.1474609375,
-0.53466796875,
0.560546875,
-0.0249786376953125,
-0.48193359375,
-0.0269775390625,
-0.0106658935546875,
-0.111572265625,
-0.12042236328125,
0.1700439453125,
-0.49609375,
0.2822265625,
-0.30029296875,
0.42578125,
0.040802001953125,
0.047088623046875,
-0.08160400390625,
0.6845703125,
-0.7119140625,
-0.38525390625,
-0.302001953125,
1.193359375,
0.04522705078125,
-0.251708984375,
-0.60107421875,
0.107177734375,
0.080810546875,
-0.3095703125,
-0.248291015625,
0.269775390625,
-0.3759765625,
0.54443359375,
-0.7177734375,
0.06597900390625,
-0.09344482421875,
0.11492919921875,
-0.38671875,
-0.307373046875,
-0.53662109375,
0.77880859375,
0.5146484375,
-0.034332275390625,
0.7197265625,
0.239990234375,
0.69775390625,
-0.047088623046875,
-0.1773681640625,
-0.31884765625,
0.69140625,
0.5908203125,
0.59765625,
-0.149658203125,
0.05792236328125,
0.771484375,
0.252197265625,
0.166748046875,
0.0980224609375,
0.15771484375,
-0.06829833984375,
0.306396484375,
-0.22314453125,
0.051177978515625,
-0.2320556640625,
-0.4951171875,
0.117431640625,
-0.5302734375,
-0.03631591796875,
-0.50537109375,
-0.5498046875,
0.716796875,
-0.131591796875,
0.03485107421875,
0.08642578125,
-0.9404296875,
0.397216796875,
0.314697265625,
-0.4287109375,
-0.246826171875,
1.0224609375,
0.80029296875,
0.51708984375,
0.58740234375,
0.64111328125,
0.25341796875,
-0.7265625,
0.5166015625,
0.236328125,
0.1298828125,
-0.21728515625,
-0.6025390625,
-0.76513671875,
0.335693359375,
-0.334716796875,
0.071533203125,
0.3291015625,
-0.6240234375,
0.29541015625,
-0.283935546875,
0.438232421875,
-0.53515625,
-0.248046875,
0.1204833984375,
-0.00220489501953125,
-0.81298828125,
0.60009765625,
-0.249267578125,
0.458984375,
-0.05511474609375,
0.82568359375,
0.2181396484375,
1.4306640625,
0.95068359375,
-0.287841796875,
-0.1761474609375,
0.384521484375,
-0.1578369140625,
-0.576171875,
-0.272216796875,
-0.39404296875,
0.052001953125,
-0.4521484375,
-1.0498046875,
0.10626220703125,
0.5224609375,
0.0100860595703125,
-0.495361328125,
0.04022216796875,
-0.12042236328125,
-0.86767578125,
0.2255859375,
0.41943359375,
0.24951171875,
0.5234375,
0.00901031494140625,
-0.28173828125,
-0.7548828125,
0.2454833984375,
-0.408447265625,
0.255126953125,
-0.89013671875,
-0.375732421875,
-0.4658203125,
-0.62890625,
-0.444580078125,
-0.09771728515625,
-0.445068359375,
-0.833984375,
0.4150390625,
0.3671875,
0.42333984375,
0.448974609375,
-0.2210693359375,
0.1192626953125,
1.0439453125,
1.041015625,
-0.09881591796875,
0.9462890625,
0.1434326171875,
-0.20654296875,
0.146484375,
-0.50634765625,
0.681640625,
-0.53955078125,
0.1600341796875,
-0.59765625,
-0.2071533203125,
-0.8935546875,
-0.9716796875,
0.06378173828125,
0.4658203125,
0.33251953125,
-0.89990234375,
-1.0380859375,
-0.65673828125,
-1.0341796875,
0.125244140625,
-0.5556640625,
0.8232421875,
0.03179931640625,
0.118408203125,
0.060333251953125,
-1.0166015625,
4.55078125,
0.94384765625,
0.92431640625,
0.479736328125,
0.1322021484375,
0.84716796875,
0.173828125,
-0.2257080078125,
-0.249755859375,
-0.4296875,
0.1456298828125,
-0.2294921875,
0.109130859375,
1.103515625,
0.55810546875,
0.51953125,
-0.22705078125,
0.1373291015625,
0.083740234375,
-1.03125,
-0.9111328125,
0.1038818359375,
0.09228515625,
0.634765625,
0.0302734375,
0.5087890625,
0.9736328125,
-0.83349609375,
-0.49951171875,
-0.61181640625,
0.2471923828125,
-0.31640625,
0.84765625,
-0.0193328857421875,
-0.363525390625,
0.625,
0.06427001953125,
-0.456787109375,
-0.10174560546875,
0.043609619140625,
-0.1273193359375,
0.2120361328125,
0.3310546875,
-0.406494140625,
0.06927490234375,
0.64794921875,
-0.482177734375,
0.7109375,
0.3828125,
-0.71728515625,
0.6845703125,
-0.26123046875,
0.466796875,
-0.646484375,
-0.580078125,
0.285400390625,
0.1102294921875,
-0.11956787109375,
-0.326171875,
0.71337890625,
0.5703125,
0.421875,
-0.072509765625,
0.38818359375,
-0.5771484375,
0.69384765625,
0.054351806640625,
0.2347412109375,
-0.8330078125,
-0.09881591796875,
-0.052490234375,
-0.045440673828125,
-0.426025390625,
-0.82666015625,
0.6845703125,
0.2279052734375,
-0.09869384765625,
0.50537109375,
0.55419921875,
-0.53955078125,
0.034942626953125,
-0.300048828125,
-0.428466796875,
-0.36181640625,
0.497314453125,
0.9755859375,
-0.54833984375,
-0.2203369140625,
-0.2122802734375,
0.463134765625,
0.70947265625,
0.65625,
0.1905517578125,
-0.94287109375,
-0.390380859375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete logarithm!
Of course, there is a code lock is installed on the safe. The lock has a screen that displays a string of n lowercase Latin letters. Initially, the screen displays string s. Whitfield and Martin found out that the safe will open when string t will be displayed on the screen.
The string on the screen can be changed using the operation «shift x». In order to apply this operation, explorers choose an integer x from 0 to n inclusive. After that, the current string p = αβ changes to βRα, where the length of β is x, and the length of α is n - x. In other words, the suffix of the length x of string p is reversed and moved to the beginning of the string. For example, after the operation «shift 4» the string «abcacb» will be changed with string «bcacab », since α = ab, β = cacb, βR = bcac.
Explorers are afraid that if they apply too many operations «shift», the lock will be locked forever. They ask you to find a way to get the string t on the screen, using no more than 6100 operations.
Input
The first line contains an integer n, the length of the strings s and t (1 ≤ n ≤ 2 000).
After that, there are two strings s and t, consisting of n lowercase Latin letters each.
Output
If it is impossible to get string t from string s using no more than 6100 operations «shift», print a single number - 1.
Otherwise, in the first line output the number of operations k (0 ≤ k ≤ 6100). In the next line output k numbers xi corresponding to the operations «shift xi» (0 ≤ xi ≤ n) in the order in which they should be applied.
Examples
Input
6
abacbb
babcba
Output
4
6 3 2 3
Input
3
aba
bba
Output
-1
Submitted Solution:
```
n = int(input())
s = input()
t = input()
if sorted(s) != sorted(t):
print(-1)
else:
res = []
for i in range(n):
k = 0
while(s[k] != t[i]):
k += 1
res += [k + 1, n - k, n]
s = ''.join(reversed(s[:k])) + s[k + 1:] + s[k]
print(s)
print(len(res))
print(*res)
```
No
| 65,389
|
[
0.37939453125,
-0.038299560546875,
-0.37353515625,
0.2386474609375,
-0.353759765625,
-0.435546875,
-0.15283203125,
0.1727294921875,
0.245849609375,
0.92529296875,
1.048828125,
-0.099609375,
0.1046142578125,
-1.1181640625,
-0.444580078125,
0.2744140625,
-0.20947265625,
-0.59814453125,
-0.347412109375,
0.51318359375,
0.250732421875,
-0.09716796875,
-1.298828125,
-0.12493896484375,
-0.75830078125,
0.69775390625,
0.439453125,
-0.1785888671875,
0.97314453125,
1.29296875,
-0.308837890625,
-0.3876953125,
0.8916015625,
-0.83740234375,
-0.4541015625,
-0.363037109375,
0.4833984375,
-0.625,
-0.06634521484375,
-0.64599609375,
0.1341552734375,
-0.225341796875,
0.5498046875,
-0.35107421875,
-1.3955078125,
-0.170166015625,
-0.33740234375,
-0.2303466796875,
-0.127685546875,
-0.71484375,
0.261474609375,
-0.047119140625,
0.681640625,
-0.3671875,
0.15185546875,
0.473876953125,
-0.12841796875,
-0.33447265625,
-0.417724609375,
0.185546875,
0.30908203125,
0.0024929046630859375,
-0.011871337890625,
-0.50390625,
-0.153076171875,
0.340576171875,
-0.07208251953125,
-0.275146484375,
-0.08770751953125,
-0.720703125,
0.1015625,
0.458251953125,
-0.497314453125,
-0.1580810546875,
-0.32470703125,
-0.036102294921875,
0.131591796875,
0.330078125,
-1.189453125,
0.9453125,
-0.1793212890625,
1.125,
0.337158203125,
0.260009765625,
-0.359619140625,
-0.6201171875,
-0.1422119140625,
-0.15185546875,
0.1441650390625,
-0.346435546875,
-0.050689697265625,
0.42919921875,
-0.460205078125,
-0.0943603515625,
0.5517578125,
0.46875,
-0.22998046875,
0.1632080078125,
0.7841796875,
0.29248046875,
0.515625,
0.7998046875,
-0.5107421875,
0.97412109375,
-0.46142578125,
-0.1905517578125,
0.1622314453125,
0.1947021484375,
-0.19482421875,
-0.256591796875,
-0.14208984375,
-0.625,
0.467041015625,
0.16845703125,
-0.1534423828125,
0.841796875,
-0.247314453125,
0.517578125,
-0.4287109375,
0.10302734375,
0.6083984375,
-0.01522064208984375,
0.60791015625,
-0.392578125,
-0.04571533203125,
-0.26123046875,
-0.3740234375,
0.77392578125,
-0.5400390625,
-0.22900390625,
-0.0943603515625,
-0.12322998046875,
-0.458740234375,
0.352783203125,
-0.260986328125,
0.8779296875,
-0.03857421875,
0.74462890625,
0.73876953125,
-0.7333984375,
0.68505859375,
-0.296875,
0.0129241943359375,
1.4912109375,
0.445556640625,
0.0626220703125,
0.580078125,
0.41748046875,
-0.56787109375,
0.56201171875,
-1.021484375,
0.60400390625,
0.1282958984375,
0.24853515625,
-0.46533203125,
0.0877685546875,
-0.24169921875,
0.8818359375,
0.01073455810546875,
-0.1259765625,
-0.32080078125,
0.5380859375,
-0.07232666015625,
0.869140625,
-0.322021484375,
0.86474609375,
-0.028900146484375,
-0.75146484375,
-0.09918212890625,
-0.4482421875,
0.06072998046875,
-0.06976318359375,
-0.374267578125,
0.96484375,
0.7099609375,
0.87255859375,
1.0341796875,
-0.29052734375,
0.388427734375,
0.30322265625,
-0.576171875,
0.1439208984375,
0.254638671875,
0.7978515625,
-0.046142578125,
0.10711669921875,
0.234375,
-0.0887451171875,
-0.72314453125,
-0.3046875,
-0.05364990234375,
1.025390625,
-0.8759765625,
0.410400390625,
0.364501953125,
-0.0268707275390625,
-1.0263671875,
-0.1829833984375,
0.1331787109375,
-0.95947265625,
-0.341796875,
0.87158203125,
-0.10467529296875,
0.83203125,
-0.48779296875,
-0.58740234375,
0.47119140625,
1.177734375,
-0.1724853515625,
-0.08697509765625,
0.337646484375,
0.053863525390625,
-0.470947265625,
-0.1834716796875,
0.18017578125,
0.032012939453125,
-0.50341796875,
0.87451171875,
0.166259765625,
-0.1092529296875,
0.129150390625,
0.78125,
0.1968994140625,
0.7041015625,
-0.459228515625,
-0.301513671875,
0.444580078125,
0.93701171875,
-0.040313720703125,
0.178955078125,
0.362548828125,
0.90478515625,
0.32470703125,
0.73974609375,
0.1334228515625,
0.1961669921875,
0.411865234375,
0.69140625,
0.01342010498046875,
0.384033203125,
0.199951171875,
0.432861328125,
0.0108642578125,
0.32861328125,
0.1319580078125,
0.267822265625,
-0.138671875,
-0.0044403076171875,
-0.416748046875,
0.33349609375,
-0.50244140625,
0.81103515625,
-0.1510009765625,
0.33203125,
-0.310302734375,
-0.136962890625,
0.51123046875,
0.6162109375,
-1.1669921875,
-0.568359375,
0.003414154052734375,
0.057373046875,
0.10888671875,
-0.3876953125,
0.6904296875,
0.354736328125,
0.48388671875,
0.49169921875,
-0.35888671875,
-0.615234375,
-0.966796875,
-1.1748046875,
-0.9658203125,
-0.44921875,
-0.94677734375,
0.319580078125,
0.182861328125,
-0.98828125,
0.2391357421875,
-0.58251953125,
-0.039276123046875,
0.259033203125,
-0.7724609375,
0.859375,
-0.1280517578125,
0.32763671875,
-0.59619140625,
0.465087890625,
0.341064453125,
0.62939453125,
-0.7431640625,
-0.04949951171875,
0.1424560546875,
-0.4833984375,
0.5869140625,
-0.0025234222412109375,
0.204345703125,
-0.058349609375,
-0.9345703125,
-0.90478515625,
-0.469482421875,
-0.135498046875,
-0.4462890625,
-0.042633056640625,
-0.7392578125,
0.9384765625,
0.56982421875,
-0.53125,
0.57177734375,
0.892578125,
-0.720703125,
0.64794921875,
0.397705078125,
0.10150146484375,
-0.859375,
1.1806640625,
0.48974609375,
0.333251953125,
-0.76171875,
-0.329345703125,
-0.381103515625,
0.0826416015625,
0.217529296875,
-0.321044921875,
-0.51416015625,
0.67041015625,
0.03350830078125,
-0.81103515625,
0.841796875,
-0.947265625,
-0.64794921875,
-0.295166015625,
-0.71728515625,
0.861328125,
0.86181640625,
0.272705078125,
-0.3564453125,
-0.27587890625,
0.05560302734375,
0.81640625,
0.493896484375,
-0.2113037109375,
0.325439453125,
0.47802734375,
-0.1368408203125,
0.05633544921875,
0.01226043701171875,
-0.8408203125,
-0.258056640625,
0.059814453125,
0.20361328125,
0.63330078125,
0.08953857421875,
0.5283203125,
0.286865234375,
1.0810546875,
-1.1357421875,
-0.414794921875,
-0.2333984375,
0.6728515625,
0.595703125,
0.27880859375,
0.30322265625,
0.0231170654296875,
-0.3046875,
-0.78369140625,
0.1282958984375,
0.1112060546875,
0.6904296875,
-0.4306640625,
0.397705078125,
0.186767578125,
-0.78076171875,
0.66259765625,
-0.408203125,
0.048248291015625,
0.96337890625,
-0.4443359375,
0.822265625,
-0.72216796875,
0.70068359375,
0.05474853515625,
0.08929443359375,
0.60498046875,
0.1883544921875,
0.406982421875,
-0.53125,
-0.4794921875,
-0.2083740234375,
-0.10894775390625,
-0.1971435546875,
-0.513671875,
0.3212890625,
-0.70556640625,
-0.671875,
-1.03515625,
0.9892578125,
0.57421875,
0.419189453125,
0.010009765625,
0.461181640625,
-0.01568603515625,
0.48046875,
0.75146484375,
-0.2152099609375,
-0.0107269287109375,
-0.79345703125,
0.98291015625,
-0.2369384765625,
-0.446044921875,
-0.406005859375,
0.08203125,
-0.2381591796875,
0.10662841796875,
0.01324462890625,
0.08001708984375,
-0.9453125,
0.59814453125,
-0.0308685302734375,
0.82568359375,
-0.77001953125,
-0.058258056640625,
-0.27099609375,
0.311279296875,
0.296875,
-0.853515625,
0.59814453125,
-0.8623046875,
0.159912109375,
0.476806640625,
-0.01232147216796875,
-0.396484375,
-0.26904296875,
-0.97119140625,
-0.75390625,
0.050140380859375,
0.95703125,
-0.36669921875,
0.145263671875,
-1.3515625,
0.384033203125,
0.183837890625,
-0.5693359375,
-0.1649169921875,
0.1494140625,
0.298095703125,
-0.016510009765625,
0.254150390625,
0.010284423828125,
-0.338134765625,
0.205078125,
-0.8291015625,
0.61474609375,
-0.41552734375,
0.06890869140625,
0.274658203125,
0.173095703125,
0.2496337890625,
0.278076171875,
-0.5283203125,
-0.13330078125,
-0.2232666015625,
0.328125,
-0.693359375,
-0.7080078125,
0.3974609375,
-0.260986328125,
-0.72705078125,
0.84521484375,
-0.08709716796875,
-0.52001953125,
0.369384765625,
0.1934814453125,
-0.62939453125,
0.394287109375,
-0.421630859375,
0.3583984375,
-0.216552734375,
-0.58544921875,
-0.1724853515625,
-0.348876953125,
0.845703125,
0.093505859375,
-0.331787109375,
-0.1636962890625,
-0.9765625,
-0.11822509765625,
0.0113372802734375,
-0.4189453125,
0.147216796875,
0.409912109375,
0.0235137939453125,
-0.2197265625,
-0.3359375,
-0.386962890625,
0.135009765625,
-0.53271484375,
-0.4580078125,
0.53857421875,
0.59326171875,
0.419677734375,
-0.10821533203125,
-0.67236328125,
0.06488037109375,
-0.09661865234375,
0.0731201171875,
-0.58251953125,
-0.08355712890625,
-0.203857421875,
-0.1287841796875,
-0.19580078125,
0.338623046875,
-0.172607421875,
0.260498046875,
0.79248046875,
0.0228729248046875,
0.5068359375,
0.233642578125,
-0.56640625,
0.83251953125,
0.04534912109375,
-1.0419921875,
-0.101806640625,
0.57763671875,
0.154052734375,
0.826171875,
-0.1224365234375,
-0.66455078125,
-0.6708984375,
-0.71435546875,
0.08502197265625,
-1.09375,
-0.0110626220703125,
-0.70703125,
-0.477294921875,
-0.412109375,
0.470947265625,
-0.048065185546875,
-0.58251953125,
-0.06256103515625,
-0.798828125,
-0.08203125,
-0.80517578125,
-0.06939697265625,
-0.63623046875,
-0.7470703125,
-0.1807861328125,
0.97265625,
0.286376953125,
0.09112548828125,
-0.039093017578125,
0.12310791015625,
0.40283203125,
0.061737060546875,
-0.57177734375,
-0.447998046875,
0.156494140625,
0.225341796875,
-0.0849609375,
-0.181396484375,
-0.415771484375,
0.2218017578125,
-0.8427734375,
0.32080078125,
-0.2080078125,
-0.1279296875,
0.0726318359375,
-0.1888427734375,
1.0439453125,
-0.131103515625,
0.139892578125,
-0.224853515625,
-0.153076171875,
1.1103515625,
-0.365234375,
-0.1396484375,
-0.435791015625,
-0.6123046875,
-1.3349609375,
0.5283203125,
-0.324462890625,
0.326171875,
-0.6953125,
-0.442138671875,
0.9443359375,
-0.529296875,
0.253662109375,
0.97265625,
-0.0609130859375,
0.10797119140625,
-0.7607421875,
0.55078125,
0.5576171875,
-0.623046875,
-0.01708984375,
-0.01233673095703125,
-0.37744140625,
-0.0126800537109375,
-0.1812744140625,
-0.45751953125,
-0.74072265625,
0.202392578125,
1.0341796875,
-0.1923828125,
0.91259765625,
-0.10235595703125,
-1.142578125,
-0.6337890625,
0.47265625,
0.228271484375,
0.4736328125,
0.6884765625,
-0.05682373046875,
-0.37890625,
-0.00377655029296875,
0.08489990234375,
-0.318115234375,
-0.41064453125,
0.76171875,
-0.52099609375,
-0.315185546875,
0.9619140625,
0.80810546875,
-1.1767578125,
-0.96240234375,
-0.060821533203125,
0.0303802490234375,
-0.1512451171875,
-0.6181640625,
0.1263427734375,
0.02734375,
-0.55029296875,
0.2060546875,
0.378662109375,
0.07080078125,
0.53271484375,
0.03790283203125,
0.351806640625,
-0.546875,
0.176513671875,
0.60009765625,
-0.328369140625,
-0.41748046875,
-1.0849609375,
-0.30517578125,
-0.32177734375,
-0.17236328125,
0.6845703125,
-0.68310546875,
0.0673828125,
0.5185546875,
-0.254150390625,
0.52685546875,
-0.322021484375,
-0.043365478515625,
0.37060546875,
-0.458251953125,
-0.7314453125,
-0.1258544921875,
0.234619140625,
-0.040863037109375,
0.7900390625,
-0.444091796875,
0.50830078125,
0.3837890625,
-0.10137939453125,
-0.6015625,
-0.77490234375,
-0.06878662109375,
-1.236328125,
-0.476806640625,
-0.461669921875,
-0.76220703125,
0.023284912109375,
0.27490234375,
0.11651611328125,
-0.52294921875,
0.185302734375,
0.312744140625,
-0.55224609375,
0.49560546875,
-0.54052734375,
0.14111328125,
-0.483154296875,
-0.73828125,
-0.76708984375,
-0.2384033203125,
-0.3076171875,
-0.0792236328125,
-0.436767578125,
0.47998046875,
0.06561279296875,
0.92724609375,
-0.14697265625,
0.1634521484375,
-0.426513671875,
-0.29736328125,
0.30419921875,
0.0416259765625,
-0.5693359375,
0.9833984375,
0.53125,
0.353271484375,
0.426025390625,
-0.36474609375,
-0.160888671875,
0.0250396728515625,
0.71044921875,
0.189697265625,
-0.11883544921875,
-0.318603515625,
0.1982421875,
0.1912841796875,
-1.1689453125,
0.673828125,
-0.6806640625,
-0.0274200439453125,
0.09417724609375,
-0.0948486328125,
0.2978515625,
0.67919921875,
-0.357177734375,
0.326904296875,
0.0168914794921875,
-0.1485595703125,
0.7490234375,
0.2109375,
0.0767822265625,
0.252197265625,
-0.187744140625,
-0.2003173828125,
-0.1651611328125,
0.24951171875,
-0.191162109375,
0.3271484375,
-0.203125,
-1.115234375,
-0.8017578125,
-0.086181640625,
-0.03973388671875,
0.2388916015625,
0.54833984375,
-0.260009765625,
-0.10894775390625,
0.07000732421875,
-0.85205078125,
0.2392578125,
-1.1474609375,
-0.53466796875,
0.560546875,
-0.0249786376953125,
-0.48193359375,
-0.0269775390625,
-0.0106658935546875,
-0.111572265625,
-0.12042236328125,
0.1700439453125,
-0.49609375,
0.2822265625,
-0.30029296875,
0.42578125,
0.040802001953125,
0.047088623046875,
-0.08160400390625,
0.6845703125,
-0.7119140625,
-0.38525390625,
-0.302001953125,
1.193359375,
0.04522705078125,
-0.251708984375,
-0.60107421875,
0.107177734375,
0.080810546875,
-0.3095703125,
-0.248291015625,
0.269775390625,
-0.3759765625,
0.54443359375,
-0.7177734375,
0.06597900390625,
-0.09344482421875,
0.11492919921875,
-0.38671875,
-0.307373046875,
-0.53662109375,
0.77880859375,
0.5146484375,
-0.034332275390625,
0.7197265625,
0.239990234375,
0.69775390625,
-0.047088623046875,
-0.1773681640625,
-0.31884765625,
0.69140625,
0.5908203125,
0.59765625,
-0.149658203125,
0.05792236328125,
0.771484375,
0.252197265625,
0.166748046875,
0.0980224609375,
0.15771484375,
-0.06829833984375,
0.306396484375,
-0.22314453125,
0.051177978515625,
-0.2320556640625,
-0.4951171875,
0.117431640625,
-0.5302734375,
-0.03631591796875,
-0.50537109375,
-0.5498046875,
0.716796875,
-0.131591796875,
0.03485107421875,
0.08642578125,
-0.9404296875,
0.397216796875,
0.314697265625,
-0.4287109375,
-0.246826171875,
1.0224609375,
0.80029296875,
0.51708984375,
0.58740234375,
0.64111328125,
0.25341796875,
-0.7265625,
0.5166015625,
0.236328125,
0.1298828125,
-0.21728515625,
-0.6025390625,
-0.76513671875,
0.335693359375,
-0.334716796875,
0.071533203125,
0.3291015625,
-0.6240234375,
0.29541015625,
-0.283935546875,
0.438232421875,
-0.53515625,
-0.248046875,
0.1204833984375,
-0.00220489501953125,
-0.81298828125,
0.60009765625,
-0.249267578125,
0.458984375,
-0.05511474609375,
0.82568359375,
0.2181396484375,
1.4306640625,
0.95068359375,
-0.287841796875,
-0.1761474609375,
0.384521484375,
-0.1578369140625,
-0.576171875,
-0.272216796875,
-0.39404296875,
0.052001953125,
-0.4521484375,
-1.0498046875,
0.10626220703125,
0.5224609375,
0.0100860595703125,
-0.495361328125,
0.04022216796875,
-0.12042236328125,
-0.86767578125,
0.2255859375,
0.41943359375,
0.24951171875,
0.5234375,
0.00901031494140625,
-0.28173828125,
-0.7548828125,
0.2454833984375,
-0.408447265625,
0.255126953125,
-0.89013671875,
-0.375732421875,
-0.4658203125,
-0.62890625,
-0.444580078125,
-0.09771728515625,
-0.445068359375,
-0.833984375,
0.4150390625,
0.3671875,
0.42333984375,
0.448974609375,
-0.2210693359375,
0.1192626953125,
1.0439453125,
1.041015625,
-0.09881591796875,
0.9462890625,
0.1434326171875,
-0.20654296875,
0.146484375,
-0.50634765625,
0.681640625,
-0.53955078125,
0.1600341796875,
-0.59765625,
-0.2071533203125,
-0.8935546875,
-0.9716796875,
0.06378173828125,
0.4658203125,
0.33251953125,
-0.89990234375,
-1.0380859375,
-0.65673828125,
-1.0341796875,
0.125244140625,
-0.5556640625,
0.8232421875,
0.03179931640625,
0.118408203125,
0.060333251953125,
-1.0166015625,
4.55078125,
0.94384765625,
0.92431640625,
0.479736328125,
0.1322021484375,
0.84716796875,
0.173828125,
-0.2257080078125,
-0.249755859375,
-0.4296875,
0.1456298828125,
-0.2294921875,
0.109130859375,
1.103515625,
0.55810546875,
0.51953125,
-0.22705078125,
0.1373291015625,
0.083740234375,
-1.03125,
-0.9111328125,
0.1038818359375,
0.09228515625,
0.634765625,
0.0302734375,
0.5087890625,
0.9736328125,
-0.83349609375,
-0.49951171875,
-0.61181640625,
0.2471923828125,
-0.31640625,
0.84765625,
-0.0193328857421875,
-0.363525390625,
0.625,
0.06427001953125,
-0.456787109375,
-0.10174560546875,
0.043609619140625,
-0.1273193359375,
0.2120361328125,
0.3310546875,
-0.406494140625,
0.06927490234375,
0.64794921875,
-0.482177734375,
0.7109375,
0.3828125,
-0.71728515625,
0.6845703125,
-0.26123046875,
0.466796875,
-0.646484375,
-0.580078125,
0.285400390625,
0.1102294921875,
-0.11956787109375,
-0.326171875,
0.71337890625,
0.5703125,
0.421875,
-0.072509765625,
0.38818359375,
-0.5771484375,
0.69384765625,
0.054351806640625,
0.2347412109375,
-0.8330078125,
-0.09881591796875,
-0.052490234375,
-0.045440673828125,
-0.426025390625,
-0.82666015625,
0.6845703125,
0.2279052734375,
-0.09869384765625,
0.50537109375,
0.55419921875,
-0.53955078125,
0.034942626953125,
-0.300048828125,
-0.428466796875,
-0.36181640625,
0.497314453125,
0.9755859375,
-0.54833984375,
-0.2203369140625,
-0.2122802734375,
0.463134765625,
0.70947265625,
0.65625,
0.1905517578125,
-0.94287109375,
-0.390380859375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem of discrete logarithm!
Of course, there is a code lock is installed on the safe. The lock has a screen that displays a string of n lowercase Latin letters. Initially, the screen displays string s. Whitfield and Martin found out that the safe will open when string t will be displayed on the screen.
The string on the screen can be changed using the operation «shift x». In order to apply this operation, explorers choose an integer x from 0 to n inclusive. After that, the current string p = αβ changes to βRα, where the length of β is x, and the length of α is n - x. In other words, the suffix of the length x of string p is reversed and moved to the beginning of the string. For example, after the operation «shift 4» the string «abcacb» will be changed with string «bcacab », since α = ab, β = cacb, βR = bcac.
Explorers are afraid that if they apply too many operations «shift», the lock will be locked forever. They ask you to find a way to get the string t on the screen, using no more than 6100 operations.
Input
The first line contains an integer n, the length of the strings s and t (1 ≤ n ≤ 2 000).
After that, there are two strings s and t, consisting of n lowercase Latin letters each.
Output
If it is impossible to get string t from string s using no more than 6100 operations «shift», print a single number - 1.
Otherwise, in the first line output the number of operations k (0 ≤ k ≤ 6100). In the next line output k numbers xi corresponding to the operations «shift xi» (0 ≤ xi ≤ n) in the order in which they should be applied.
Examples
Input
6
abacbb
babcba
Output
4
6 3 2 3
Input
3
aba
bba
Output
-1
Submitted Solution:
```
n = int(input())
s = input()
t = input()
if sorted(s) != sorted(t):
print(-1)
else:
res = []
for i in range(n):
k = 0
while(s[k] != s[i]):
k += 1
res += [k + 1, n - k, n]
s = s[k - 1::-1] + s[k + 1:] + s[k]
print(len(res))
print(*res)
```
No
| 65,390
|
[
0.37939453125,
-0.038299560546875,
-0.37353515625,
0.2386474609375,
-0.353759765625,
-0.435546875,
-0.15283203125,
0.1727294921875,
0.245849609375,
0.92529296875,
1.048828125,
-0.099609375,
0.1046142578125,
-1.1181640625,
-0.444580078125,
0.2744140625,
-0.20947265625,
-0.59814453125,
-0.347412109375,
0.51318359375,
0.250732421875,
-0.09716796875,
-1.298828125,
-0.12493896484375,
-0.75830078125,
0.69775390625,
0.439453125,
-0.1785888671875,
0.97314453125,
1.29296875,
-0.308837890625,
-0.3876953125,
0.8916015625,
-0.83740234375,
-0.4541015625,
-0.363037109375,
0.4833984375,
-0.625,
-0.06634521484375,
-0.64599609375,
0.1341552734375,
-0.225341796875,
0.5498046875,
-0.35107421875,
-1.3955078125,
-0.170166015625,
-0.33740234375,
-0.2303466796875,
-0.127685546875,
-0.71484375,
0.261474609375,
-0.047119140625,
0.681640625,
-0.3671875,
0.15185546875,
0.473876953125,
-0.12841796875,
-0.33447265625,
-0.417724609375,
0.185546875,
0.30908203125,
0.0024929046630859375,
-0.011871337890625,
-0.50390625,
-0.153076171875,
0.340576171875,
-0.07208251953125,
-0.275146484375,
-0.08770751953125,
-0.720703125,
0.1015625,
0.458251953125,
-0.497314453125,
-0.1580810546875,
-0.32470703125,
-0.036102294921875,
0.131591796875,
0.330078125,
-1.189453125,
0.9453125,
-0.1793212890625,
1.125,
0.337158203125,
0.260009765625,
-0.359619140625,
-0.6201171875,
-0.1422119140625,
-0.15185546875,
0.1441650390625,
-0.346435546875,
-0.050689697265625,
0.42919921875,
-0.460205078125,
-0.0943603515625,
0.5517578125,
0.46875,
-0.22998046875,
0.1632080078125,
0.7841796875,
0.29248046875,
0.515625,
0.7998046875,
-0.5107421875,
0.97412109375,
-0.46142578125,
-0.1905517578125,
0.1622314453125,
0.1947021484375,
-0.19482421875,
-0.256591796875,
-0.14208984375,
-0.625,
0.467041015625,
0.16845703125,
-0.1534423828125,
0.841796875,
-0.247314453125,
0.517578125,
-0.4287109375,
0.10302734375,
0.6083984375,
-0.01522064208984375,
0.60791015625,
-0.392578125,
-0.04571533203125,
-0.26123046875,
-0.3740234375,
0.77392578125,
-0.5400390625,
-0.22900390625,
-0.0943603515625,
-0.12322998046875,
-0.458740234375,
0.352783203125,
-0.260986328125,
0.8779296875,
-0.03857421875,
0.74462890625,
0.73876953125,
-0.7333984375,
0.68505859375,
-0.296875,
0.0129241943359375,
1.4912109375,
0.445556640625,
0.0626220703125,
0.580078125,
0.41748046875,
-0.56787109375,
0.56201171875,
-1.021484375,
0.60400390625,
0.1282958984375,
0.24853515625,
-0.46533203125,
0.0877685546875,
-0.24169921875,
0.8818359375,
0.01073455810546875,
-0.1259765625,
-0.32080078125,
0.5380859375,
-0.07232666015625,
0.869140625,
-0.322021484375,
0.86474609375,
-0.028900146484375,
-0.75146484375,
-0.09918212890625,
-0.4482421875,
0.06072998046875,
-0.06976318359375,
-0.374267578125,
0.96484375,
0.7099609375,
0.87255859375,
1.0341796875,
-0.29052734375,
0.388427734375,
0.30322265625,
-0.576171875,
0.1439208984375,
0.254638671875,
0.7978515625,
-0.046142578125,
0.10711669921875,
0.234375,
-0.0887451171875,
-0.72314453125,
-0.3046875,
-0.05364990234375,
1.025390625,
-0.8759765625,
0.410400390625,
0.364501953125,
-0.0268707275390625,
-1.0263671875,
-0.1829833984375,
0.1331787109375,
-0.95947265625,
-0.341796875,
0.87158203125,
-0.10467529296875,
0.83203125,
-0.48779296875,
-0.58740234375,
0.47119140625,
1.177734375,
-0.1724853515625,
-0.08697509765625,
0.337646484375,
0.053863525390625,
-0.470947265625,
-0.1834716796875,
0.18017578125,
0.032012939453125,
-0.50341796875,
0.87451171875,
0.166259765625,
-0.1092529296875,
0.129150390625,
0.78125,
0.1968994140625,
0.7041015625,
-0.459228515625,
-0.301513671875,
0.444580078125,
0.93701171875,
-0.040313720703125,
0.178955078125,
0.362548828125,
0.90478515625,
0.32470703125,
0.73974609375,
0.1334228515625,
0.1961669921875,
0.411865234375,
0.69140625,
0.01342010498046875,
0.384033203125,
0.199951171875,
0.432861328125,
0.0108642578125,
0.32861328125,
0.1319580078125,
0.267822265625,
-0.138671875,
-0.0044403076171875,
-0.416748046875,
0.33349609375,
-0.50244140625,
0.81103515625,
-0.1510009765625,
0.33203125,
-0.310302734375,
-0.136962890625,
0.51123046875,
0.6162109375,
-1.1669921875,
-0.568359375,
0.003414154052734375,
0.057373046875,
0.10888671875,
-0.3876953125,
0.6904296875,
0.354736328125,
0.48388671875,
0.49169921875,
-0.35888671875,
-0.615234375,
-0.966796875,
-1.1748046875,
-0.9658203125,
-0.44921875,
-0.94677734375,
0.319580078125,
0.182861328125,
-0.98828125,
0.2391357421875,
-0.58251953125,
-0.039276123046875,
0.259033203125,
-0.7724609375,
0.859375,
-0.1280517578125,
0.32763671875,
-0.59619140625,
0.465087890625,
0.341064453125,
0.62939453125,
-0.7431640625,
-0.04949951171875,
0.1424560546875,
-0.4833984375,
0.5869140625,
-0.0025234222412109375,
0.204345703125,
-0.058349609375,
-0.9345703125,
-0.90478515625,
-0.469482421875,
-0.135498046875,
-0.4462890625,
-0.042633056640625,
-0.7392578125,
0.9384765625,
0.56982421875,
-0.53125,
0.57177734375,
0.892578125,
-0.720703125,
0.64794921875,
0.397705078125,
0.10150146484375,
-0.859375,
1.1806640625,
0.48974609375,
0.333251953125,
-0.76171875,
-0.329345703125,
-0.381103515625,
0.0826416015625,
0.217529296875,
-0.321044921875,
-0.51416015625,
0.67041015625,
0.03350830078125,
-0.81103515625,
0.841796875,
-0.947265625,
-0.64794921875,
-0.295166015625,
-0.71728515625,
0.861328125,
0.86181640625,
0.272705078125,
-0.3564453125,
-0.27587890625,
0.05560302734375,
0.81640625,
0.493896484375,
-0.2113037109375,
0.325439453125,
0.47802734375,
-0.1368408203125,
0.05633544921875,
0.01226043701171875,
-0.8408203125,
-0.258056640625,
0.059814453125,
0.20361328125,
0.63330078125,
0.08953857421875,
0.5283203125,
0.286865234375,
1.0810546875,
-1.1357421875,
-0.414794921875,
-0.2333984375,
0.6728515625,
0.595703125,
0.27880859375,
0.30322265625,
0.0231170654296875,
-0.3046875,
-0.78369140625,
0.1282958984375,
0.1112060546875,
0.6904296875,
-0.4306640625,
0.397705078125,
0.186767578125,
-0.78076171875,
0.66259765625,
-0.408203125,
0.048248291015625,
0.96337890625,
-0.4443359375,
0.822265625,
-0.72216796875,
0.70068359375,
0.05474853515625,
0.08929443359375,
0.60498046875,
0.1883544921875,
0.406982421875,
-0.53125,
-0.4794921875,
-0.2083740234375,
-0.10894775390625,
-0.1971435546875,
-0.513671875,
0.3212890625,
-0.70556640625,
-0.671875,
-1.03515625,
0.9892578125,
0.57421875,
0.419189453125,
0.010009765625,
0.461181640625,
-0.01568603515625,
0.48046875,
0.75146484375,
-0.2152099609375,
-0.0107269287109375,
-0.79345703125,
0.98291015625,
-0.2369384765625,
-0.446044921875,
-0.406005859375,
0.08203125,
-0.2381591796875,
0.10662841796875,
0.01324462890625,
0.08001708984375,
-0.9453125,
0.59814453125,
-0.0308685302734375,
0.82568359375,
-0.77001953125,
-0.058258056640625,
-0.27099609375,
0.311279296875,
0.296875,
-0.853515625,
0.59814453125,
-0.8623046875,
0.159912109375,
0.476806640625,
-0.01232147216796875,
-0.396484375,
-0.26904296875,
-0.97119140625,
-0.75390625,
0.050140380859375,
0.95703125,
-0.36669921875,
0.145263671875,
-1.3515625,
0.384033203125,
0.183837890625,
-0.5693359375,
-0.1649169921875,
0.1494140625,
0.298095703125,
-0.016510009765625,
0.254150390625,
0.010284423828125,
-0.338134765625,
0.205078125,
-0.8291015625,
0.61474609375,
-0.41552734375,
0.06890869140625,
0.274658203125,
0.173095703125,
0.2496337890625,
0.278076171875,
-0.5283203125,
-0.13330078125,
-0.2232666015625,
0.328125,
-0.693359375,
-0.7080078125,
0.3974609375,
-0.260986328125,
-0.72705078125,
0.84521484375,
-0.08709716796875,
-0.52001953125,
0.369384765625,
0.1934814453125,
-0.62939453125,
0.394287109375,
-0.421630859375,
0.3583984375,
-0.216552734375,
-0.58544921875,
-0.1724853515625,
-0.348876953125,
0.845703125,
0.093505859375,
-0.331787109375,
-0.1636962890625,
-0.9765625,
-0.11822509765625,
0.0113372802734375,
-0.4189453125,
0.147216796875,
0.409912109375,
0.0235137939453125,
-0.2197265625,
-0.3359375,
-0.386962890625,
0.135009765625,
-0.53271484375,
-0.4580078125,
0.53857421875,
0.59326171875,
0.419677734375,
-0.10821533203125,
-0.67236328125,
0.06488037109375,
-0.09661865234375,
0.0731201171875,
-0.58251953125,
-0.08355712890625,
-0.203857421875,
-0.1287841796875,
-0.19580078125,
0.338623046875,
-0.172607421875,
0.260498046875,
0.79248046875,
0.0228729248046875,
0.5068359375,
0.233642578125,
-0.56640625,
0.83251953125,
0.04534912109375,
-1.0419921875,
-0.101806640625,
0.57763671875,
0.154052734375,
0.826171875,
-0.1224365234375,
-0.66455078125,
-0.6708984375,
-0.71435546875,
0.08502197265625,
-1.09375,
-0.0110626220703125,
-0.70703125,
-0.477294921875,
-0.412109375,
0.470947265625,
-0.048065185546875,
-0.58251953125,
-0.06256103515625,
-0.798828125,
-0.08203125,
-0.80517578125,
-0.06939697265625,
-0.63623046875,
-0.7470703125,
-0.1807861328125,
0.97265625,
0.286376953125,
0.09112548828125,
-0.039093017578125,
0.12310791015625,
0.40283203125,
0.061737060546875,
-0.57177734375,
-0.447998046875,
0.156494140625,
0.225341796875,
-0.0849609375,
-0.181396484375,
-0.415771484375,
0.2218017578125,
-0.8427734375,
0.32080078125,
-0.2080078125,
-0.1279296875,
0.0726318359375,
-0.1888427734375,
1.0439453125,
-0.131103515625,
0.139892578125,
-0.224853515625,
-0.153076171875,
1.1103515625,
-0.365234375,
-0.1396484375,
-0.435791015625,
-0.6123046875,
-1.3349609375,
0.5283203125,
-0.324462890625,
0.326171875,
-0.6953125,
-0.442138671875,
0.9443359375,
-0.529296875,
0.253662109375,
0.97265625,
-0.0609130859375,
0.10797119140625,
-0.7607421875,
0.55078125,
0.5576171875,
-0.623046875,
-0.01708984375,
-0.01233673095703125,
-0.37744140625,
-0.0126800537109375,
-0.1812744140625,
-0.45751953125,
-0.74072265625,
0.202392578125,
1.0341796875,
-0.1923828125,
0.91259765625,
-0.10235595703125,
-1.142578125,
-0.6337890625,
0.47265625,
0.228271484375,
0.4736328125,
0.6884765625,
-0.05682373046875,
-0.37890625,
-0.00377655029296875,
0.08489990234375,
-0.318115234375,
-0.41064453125,
0.76171875,
-0.52099609375,
-0.315185546875,
0.9619140625,
0.80810546875,
-1.1767578125,
-0.96240234375,
-0.060821533203125,
0.0303802490234375,
-0.1512451171875,
-0.6181640625,
0.1263427734375,
0.02734375,
-0.55029296875,
0.2060546875,
0.378662109375,
0.07080078125,
0.53271484375,
0.03790283203125,
0.351806640625,
-0.546875,
0.176513671875,
0.60009765625,
-0.328369140625,
-0.41748046875,
-1.0849609375,
-0.30517578125,
-0.32177734375,
-0.17236328125,
0.6845703125,
-0.68310546875,
0.0673828125,
0.5185546875,
-0.254150390625,
0.52685546875,
-0.322021484375,
-0.043365478515625,
0.37060546875,
-0.458251953125,
-0.7314453125,
-0.1258544921875,
0.234619140625,
-0.040863037109375,
0.7900390625,
-0.444091796875,
0.50830078125,
0.3837890625,
-0.10137939453125,
-0.6015625,
-0.77490234375,
-0.06878662109375,
-1.236328125,
-0.476806640625,
-0.461669921875,
-0.76220703125,
0.023284912109375,
0.27490234375,
0.11651611328125,
-0.52294921875,
0.185302734375,
0.312744140625,
-0.55224609375,
0.49560546875,
-0.54052734375,
0.14111328125,
-0.483154296875,
-0.73828125,
-0.76708984375,
-0.2384033203125,
-0.3076171875,
-0.0792236328125,
-0.436767578125,
0.47998046875,
0.06561279296875,
0.92724609375,
-0.14697265625,
0.1634521484375,
-0.426513671875,
-0.29736328125,
0.30419921875,
0.0416259765625,
-0.5693359375,
0.9833984375,
0.53125,
0.353271484375,
0.426025390625,
-0.36474609375,
-0.160888671875,
0.0250396728515625,
0.71044921875,
0.189697265625,
-0.11883544921875,
-0.318603515625,
0.1982421875,
0.1912841796875,
-1.1689453125,
0.673828125,
-0.6806640625,
-0.0274200439453125,
0.09417724609375,
-0.0948486328125,
0.2978515625,
0.67919921875,
-0.357177734375,
0.326904296875,
0.0168914794921875,
-0.1485595703125,
0.7490234375,
0.2109375,
0.0767822265625,
0.252197265625,
-0.187744140625,
-0.2003173828125,
-0.1651611328125,
0.24951171875,
-0.191162109375,
0.3271484375,
-0.203125,
-1.115234375,
-0.8017578125,
-0.086181640625,
-0.03973388671875,
0.2388916015625,
0.54833984375,
-0.260009765625,
-0.10894775390625,
0.07000732421875,
-0.85205078125,
0.2392578125,
-1.1474609375,
-0.53466796875,
0.560546875,
-0.0249786376953125,
-0.48193359375,
-0.0269775390625,
-0.0106658935546875,
-0.111572265625,
-0.12042236328125,
0.1700439453125,
-0.49609375,
0.2822265625,
-0.30029296875,
0.42578125,
0.040802001953125,
0.047088623046875,
-0.08160400390625,
0.6845703125,
-0.7119140625,
-0.38525390625,
-0.302001953125,
1.193359375,
0.04522705078125,
-0.251708984375,
-0.60107421875,
0.107177734375,
0.080810546875,
-0.3095703125,
-0.248291015625,
0.269775390625,
-0.3759765625,
0.54443359375,
-0.7177734375,
0.06597900390625,
-0.09344482421875,
0.11492919921875,
-0.38671875,
-0.307373046875,
-0.53662109375,
0.77880859375,
0.5146484375,
-0.034332275390625,
0.7197265625,
0.239990234375,
0.69775390625,
-0.047088623046875,
-0.1773681640625,
-0.31884765625,
0.69140625,
0.5908203125,
0.59765625,
-0.149658203125,
0.05792236328125,
0.771484375,
0.252197265625,
0.166748046875,
0.0980224609375,
0.15771484375,
-0.06829833984375,
0.306396484375,
-0.22314453125,
0.051177978515625,
-0.2320556640625,
-0.4951171875,
0.117431640625,
-0.5302734375,
-0.03631591796875,
-0.50537109375,
-0.5498046875,
0.716796875,
-0.131591796875,
0.03485107421875,
0.08642578125,
-0.9404296875,
0.397216796875,
0.314697265625,
-0.4287109375,
-0.246826171875,
1.0224609375,
0.80029296875,
0.51708984375,
0.58740234375,
0.64111328125,
0.25341796875,
-0.7265625,
0.5166015625,
0.236328125,
0.1298828125,
-0.21728515625,
-0.6025390625,
-0.76513671875,
0.335693359375,
-0.334716796875,
0.071533203125,
0.3291015625,
-0.6240234375,
0.29541015625,
-0.283935546875,
0.438232421875,
-0.53515625,
-0.248046875,
0.1204833984375,
-0.00220489501953125,
-0.81298828125,
0.60009765625,
-0.249267578125,
0.458984375,
-0.05511474609375,
0.82568359375,
0.2181396484375,
1.4306640625,
0.95068359375,
-0.287841796875,
-0.1761474609375,
0.384521484375,
-0.1578369140625,
-0.576171875,
-0.272216796875,
-0.39404296875,
0.052001953125,
-0.4521484375,
-1.0498046875,
0.10626220703125,
0.5224609375,
0.0100860595703125,
-0.495361328125,
0.04022216796875,
-0.12042236328125,
-0.86767578125,
0.2255859375,
0.41943359375,
0.24951171875,
0.5234375,
0.00901031494140625,
-0.28173828125,
-0.7548828125,
0.2454833984375,
-0.408447265625,
0.255126953125,
-0.89013671875,
-0.375732421875,
-0.4658203125,
-0.62890625,
-0.444580078125,
-0.09771728515625,
-0.445068359375,
-0.833984375,
0.4150390625,
0.3671875,
0.42333984375,
0.448974609375,
-0.2210693359375,
0.1192626953125,
1.0439453125,
1.041015625,
-0.09881591796875,
0.9462890625,
0.1434326171875,
-0.20654296875,
0.146484375,
-0.50634765625,
0.681640625,
-0.53955078125,
0.1600341796875,
-0.59765625,
-0.2071533203125,
-0.8935546875,
-0.9716796875,
0.06378173828125,
0.4658203125,
0.33251953125,
-0.89990234375,
-1.0380859375,
-0.65673828125,
-1.0341796875,
0.125244140625,
-0.5556640625,
0.8232421875,
0.03179931640625,
0.118408203125,
0.060333251953125,
-1.0166015625,
4.55078125,
0.94384765625,
0.92431640625,
0.479736328125,
0.1322021484375,
0.84716796875,
0.173828125,
-0.2257080078125,
-0.249755859375,
-0.4296875,
0.1456298828125,
-0.2294921875,
0.109130859375,
1.103515625,
0.55810546875,
0.51953125,
-0.22705078125,
0.1373291015625,
0.083740234375,
-1.03125,
-0.9111328125,
0.1038818359375,
0.09228515625,
0.634765625,
0.0302734375,
0.5087890625,
0.9736328125,
-0.83349609375,
-0.49951171875,
-0.61181640625,
0.2471923828125,
-0.31640625,
0.84765625,
-0.0193328857421875,
-0.363525390625,
0.625,
0.06427001953125,
-0.456787109375,
-0.10174560546875,
0.043609619140625,
-0.1273193359375,
0.2120361328125,
0.3310546875,
-0.406494140625,
0.06927490234375,
0.64794921875,
-0.482177734375,
0.7109375,
0.3828125,
-0.71728515625,
0.6845703125,
-0.26123046875,
0.466796875,
-0.646484375,
-0.580078125,
0.285400390625,
0.1102294921875,
-0.11956787109375,
-0.326171875,
0.71337890625,
0.5703125,
0.421875,
-0.072509765625,
0.38818359375,
-0.5771484375,
0.69384765625,
0.054351806640625,
0.2347412109375,
-0.8330078125,
-0.09881591796875,
-0.052490234375,
-0.045440673828125,
-0.426025390625,
-0.82666015625,
0.6845703125,
0.2279052734375,
-0.09869384765625,
0.50537109375,
0.55419921875,
-0.53955078125,
0.034942626953125,
-0.300048828125,
-0.428466796875,
-0.36181640625,
0.497314453125,
0.9755859375,
-0.54833984375,
-0.2203369140625,
-0.2122802734375,
0.463134765625,
0.70947265625,
0.65625,
0.1905517578125,
-0.94287109375,
-0.390380859375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The newspaper contains string t, consisting of uppercase and lowercase English letters. We know that the length of string t greater or equal to the length of the string s.
The newspaper may possibly have too few of some letters needed to make the text and too many of some other letters. That's why Tanya wants to cut some n letters out of the newspaper and make a message of length exactly n, so that it looked as much as possible like s. If the letter in some position has correct value and correct letter case (in the string s and in the string that Tanya will make), then she shouts joyfully "YAY!", and if the letter in the given position has only the correct value but it is in the wrong case, then the girl says "WHOOPS".
Tanya wants to make such message that lets her shout "YAY!" as much as possible. If there are multiple ways to do this, then her second priority is to maximize the number of times she says "WHOOPS". Your task is to help Tanya make the message.
Input
The first line contains line s (1 ≤ |s| ≤ 2·105), consisting of uppercase and lowercase English letters — the text of Tanya's message.
The second line contains line t (|s| ≤ |t| ≤ 2·105), consisting of uppercase and lowercase English letters — the text written in the newspaper.
Here |a| means the length of the string a.
Output
Print two integers separated by a space:
* the first number is the number of times Tanya shouts "YAY!" while making the message,
* the second number is the number of times Tanya says "WHOOPS" while making the message.
Examples
Input
AbC
DCbA
Output
3 0
Input
ABC
abc
Output
0 3
Input
abacaba
AbaCaBA
Output
3 4
Tags: greedy, implementation, strings
Correct Solution:
```
first = input()
second = input()
dicty = {}
for i in first:
if(i not in dicty):
dicty[i] = 1
else:
dicty[i] += 1
yay = 0
whoops = 0
array_bool = [False for x in second]
for i in range(len(second)):
if (second[i] in dicty and dicty[second[i]] != 0):
yay+=1
dicty[second[i]] -= 1
array_bool[i] = True
for i in range(len(second)):
if(not array_bool[i]):
if (second[i].upper() in dicty and dicty[second[i].upper()] != 0):
whoops += 1
dicty[second[i].upper()] -= 1
elif (second[i].lower() in dicty and dicty[second[i].lower()] != 0):
whoops += 1
dicty[second[i].lower()] -= 1
print(yay,whoops)
```
| 65,992
|
[
0.06781005859375,
0.06597900390625,
0.1429443359375,
0.34130859375,
-0.61474609375,
-0.859375,
0.2425537109375,
-0.126953125,
0.2332763671875,
0.65478515625,
0.69384765625,
-0.1700439453125,
0.08599853515625,
-0.445068359375,
-0.58935546875,
-0.217041015625,
-0.5947265625,
-0.486328125,
-0.435546875,
0.08551025390625,
-0.1260986328125,
0.024383544921875,
-1.6142578125,
-0.2249755859375,
-0.1995849609375,
0.82470703125,
0.607421875,
0.023101806640625,
1.2734375,
0.6904296875,
-0.2041015625,
-0.034576416015625,
0.10638427734375,
-1.03125,
-0.368408203125,
-0.5732421875,
0.61376953125,
-0.66015625,
-0.09710693359375,
-0.332275390625,
0.3525390625,
-0.437255859375,
0.87890625,
-0.62353515625,
-1.1787109375,
-0.2607421875,
-0.205078125,
-0.329345703125,
-0.03741455078125,
-0.307373046875,
0.295654296875,
-0.395751953125,
0.33349609375,
-0.2122802734375,
0.072998046875,
-0.02410888671875,
-0.127685546875,
-0.26220703125,
-0.796875,
0.5576171875,
0.05523681640625,
0.253173828125,
0.1630859375,
-0.55322265625,
0.0213623046875,
-0.145751953125,
-0.2357177734375,
0.05670166015625,
-0.01451873779296875,
-0.814453125,
0.08209228515625,
0.363037109375,
-0.4326171875,
-0.51171875,
-0.69677734375,
0.2646484375,
0.273681640625,
-0.1268310546875,
-0.96728515625,
1.0537109375,
-0.1036376953125,
1.0185546875,
0.4287109375,
0.1258544921875,
-0.499267578125,
-0.5869140625,
0.182861328125,
0.05145263671875,
0.494873046875,
-0.1864013671875,
-0.116943359375,
0.49755859375,
-0.60546875,
0.208251953125,
0.41748046875,
0.66162109375,
-0.461669921875,
0.4140625,
0.11077880859375,
0.390869140625,
0.56396484375,
0.81298828125,
-0.371826171875,
0.99169921875,
-0.5966796875,
0.28662109375,
0.2357177734375,
-0.370361328125,
-0.407958984375,
-0.04229736328125,
-0.383056640625,
-0.1041259765625,
0.70849609375,
0.05938720703125,
-0.407470703125,
0.931640625,
0.260986328125,
0.488525390625,
-0.6611328125,
0.23779296875,
0.52001953125,
0.1431884765625,
0.56201171875,
-0.304931640625,
-0.136962890625,
-0.0733642578125,
-0.2412109375,
1.3154296875,
-0.417236328125,
-0.0877685546875,
0.3525390625,
0.059661865234375,
0.25537109375,
0.5009765625,
-0.135009765625,
0.87255859375,
-0.5390625,
0.4375,
0.88330078125,
-0.5380859375,
0.495361328125,
-0.1817626953125,
0.01100921630859375,
1.2021484375,
0.320068359375,
0.2410888671875,
0.66845703125,
0.2257080078125,
-1.0234375,
0.389404296875,
-0.830078125,
0.8271484375,
-0.232421875,
0.380615234375,
-0.1708984375,
0.27197265625,
-0.269775390625,
-0.01275634765625,
0.28564453125,
-0.1890869140625,
-0.382568359375,
0.19873046875,
-0.7392578125,
0.95947265625,
-0.48046875,
0.476318359375,
-0.4853515625,
-0.16748046875,
-0.225341796875,
-0.392578125,
0.302734375,
-0.17431640625,
-0.422119140625,
0.84814453125,
0.38623046875,
1.04296875,
0.84326171875,
-0.43359375,
0.37451171875,
0.121337890625,
-0.07525634765625,
0.546875,
0.317138671875,
0.625,
0.39013671875,
-0.0784912109375,
0.0557861328125,
-0.1942138671875,
-0.54541015625,
-0.59619140625,
0.318603515625,
0.44287109375,
-0.5302734375,
0.34619140625,
0.0950927734375,
0.411376953125,
-0.91552734375,
0.01062774658203125,
-0.205810546875,
-0.96533203125,
-0.372802734375,
0.65478515625,
-0.2015380859375,
0.6708984375,
-0.388671875,
-0.669921875,
0.205810546875,
1.1025390625,
-0.260986328125,
-0.26171875,
0.3740234375,
0.2071533203125,
-0.369384765625,
0.129638671875,
0.1751708984375,
-0.33740234375,
-0.84716796875,
0.7177734375,
-0.4248046875,
0.12451171875,
0.07470703125,
0.5673828125,
0.1595458984375,
0.52734375,
-0.2486572265625,
0.0024929046630859375,
0.79736328125,
0.869140625,
-0.053619384765625,
0.4140625,
0.2393798828125,
0.68994140625,
0.57080078125,
1.0234375,
0.7939453125,
0.471435546875,
0.55078125,
0.7099609375,
-0.29296875,
0.011505126953125,
0.093017578125,
0.2301025390625,
0.321533203125,
0.78271484375,
0.22265625,
0.51123046875,
0.029052734375,
0.04168701171875,
-0.48388671875,
0.40185546875,
-0.2305908203125,
0.64306640625,
0.3095703125,
0.794921875,
-0.35888671875,
-0.560546875,
0.11004638671875,
0.9443359375,
-0.8125,
-0.438232421875,
0.446533203125,
0.411865234375,
-0.038482666015625,
0.0308380126953125,
0.298828125,
0.362060546875,
0.34619140625,
0.255859375,
-0.38525390625,
-0.9091796875,
-0.818359375,
-0.99755859375,
-0.74560546875,
-0.2279052734375,
-0.83740234375,
0.030120849609375,
0.86376953125,
-1.12109375,
0.290283203125,
-0.416748046875,
-0.12005615234375,
-0.095947265625,
-0.64208984375,
0.55322265625,
0.166748046875,
0.70849609375,
-0.62255859375,
0.54443359375,
0.51904296875,
1.201171875,
-0.595703125,
-0.1954345703125,
-0.26318359375,
-0.270751953125,
0.45654296875,
0.1639404296875,
0.276611328125,
-0.1705322265625,
-0.75244140625,
-0.8017578125,
-0.1795654296875,
-0.06085205078125,
-0.23974609375,
-0.0217132568359375,
-0.7177734375,
0.5146484375,
0.6787109375,
-0.6298828125,
0.2626953125,
1.3486328125,
-0.50146484375,
0.426025390625,
0.21435546875,
-0.1258544921875,
-0.7080078125,
1.1025390625,
0.172119140625,
0.2498779296875,
-0.73388671875,
-0.2327880859375,
-0.6142578125,
0.38623046875,
0.08074951171875,
-0.177734375,
-0.3056640625,
0.348388671875,
0.0390625,
-1.1962890625,
0.5478515625,
-1.2412109375,
-0.52490234375,
-0.38720703125,
-0.70458984375,
0.66455078125,
0.8701171875,
0.005687713623046875,
-0.399658203125,
-0.020538330078125,
-0.14990234375,
0.192138671875,
0.56005859375,
-0.78515625,
-0.065673828125,
0.77978515625,
-0.2396240234375,
0.197509765625,
0.3427734375,
-0.07122802734375,
-0.40283203125,
0.2529296875,
0.5078125,
0.50634765625,
0.188720703125,
0.1669921875,
0.167724609375,
0.6171875,
-0.72705078125,
-0.3193359375,
-0.369873046875,
0.55859375,
0.52880859375,
0.65087890625,
0.60009765625,
-0.1944580078125,
-0.56982421875,
-1.2392578125,
0.46044921875,
0.17236328125,
0.6337890625,
-0.71435546875,
1.072265625,
0.053619384765625,
-0.08892822265625,
0.412841796875,
-0.50341796875,
-0.4052734375,
0.90966796875,
-0.4482421875,
0.95849609375,
-0.67333984375,
0.5126953125,
-0.1781005859375,
0.1339111328125,
0.331787109375,
0.1170654296875,
0.467529296875,
-0.2491455078125,
-0.5068359375,
-0.54052734375,
-0.2110595703125,
-0.367431640625,
-0.72998046875,
0.34619140625,
-0.331787109375,
-0.402099609375,
-0.94921875,
0.06634521484375,
0.91259765625,
0.74853515625,
0.1611328125,
0.603515625,
0.07635498046875,
0.66943359375,
0.6875,
-0.31689453125,
0.04718017578125,
-1.0341796875,
0.5869140625,
0.064453125,
-0.01953125,
-0.5380859375,
-0.348388671875,
-0.1751708984375,
0.31640625,
-0.0031032562255859375,
-0.0467529296875,
-1.0263671875,
0.3505859375,
-0.1646728515625,
0.5869140625,
-0.55810546875,
-0.25048828125,
-0.05499267578125,
-0.0848388671875,
0.338623046875,
-0.8427734375,
0.525390625,
-0.63037109375,
0.8271484375,
0.31640625,
0.155029296875,
-0.66015625,
-0.38232421875,
-0.611328125,
-0.53857421875,
-0.06396484375,
0.77001953125,
0.24951171875,
0.63330078125,
-1.1650390625,
0.47119140625,
0.431396484375,
-0.186279296875,
0.36279296875,
-0.040435791015625,
0.411865234375,
0.374267578125,
0.54931640625,
-0.75048828125,
-0.85986328125,
0.388671875,
-1.1552734375,
0.3505859375,
-0.437255859375,
0.1392822265625,
-0.36376953125,
-0.09136962890625,
-0.0859375,
0.16943359375,
-0.397216796875,
0.2998046875,
-0.36083984375,
0.3662109375,
-0.62451171875,
-0.67431640625,
0.3388671875,
0.2393798828125,
-0.5244140625,
0.8818359375,
-0.2027587890625,
-0.3125,
-0.0399169921875,
0.53076171875,
-0.623046875,
0.3154296875,
-0.304443359375,
0.11993408203125,
-0.48193359375,
-0.66455078125,
0.1885986328125,
-0.4365234375,
0.6611328125,
-0.29833984375,
-0.94287109375,
-0.006011962890625,
-1.162109375,
0.2418212890625,
0.152587890625,
-0.626953125,
0.4365234375,
0.2239990234375,
-0.1473388671875,
-0.006526947021484375,
-0.572265625,
-0.0889892578125,
-0.2015380859375,
-0.72705078125,
-0.1414794921875,
-0.0069580078125,
0.705078125,
0.9306640625,
-0.033416748046875,
-0.57275390625,
-0.10614013671875,
0.081787109375,
0.060791015625,
-0.54248046875,
0.07080078125,
-0.416259765625,
-0.1048583984375,
-0.328369140625,
0.396240234375,
-0.091796875,
0.314697265625,
1.09765625,
0.447021484375,
0.303955078125,
0.279052734375,
-0.716796875,
1.0185546875,
0.342041015625,
-1.0078125,
-1.0009765625,
0.2166748046875,
-0.284912109375,
0.342529296875,
0.2198486328125,
-0.96875,
-0.8017578125,
-1.2099609375,
-0.2076416015625,
-0.86572265625,
-0.2548828125,
-0.92578125,
-0.2166748046875,
-0.10003662109375,
0.615234375,
-0.13916015625,
-0.420654296875,
0.5078125,
-1.41015625,
0.08404541015625,
-0.74951171875,
-0.31689453125,
-0.783203125,
0.109130859375,
-0.434326171875,
0.94921875,
0.376220703125,
0.405517578125,
-0.255859375,
-0.378173828125,
0.162353515625,
-0.007724761962890625,
-0.1453857421875,
-0.2095947265625,
-0.1939697265625,
0.310546875,
0.21728515625,
-0.19091796875,
-0.53955078125,
0.919921875,
-0.71533203125,
0.1573486328125,
-0.039154052734375,
-0.40087890625,
-0.1541748046875,
-0.386474609375,
1.126953125,
-0.53125,
-0.182373046875,
-0.68212890625,
0.17041015625,
0.69482421875,
-0.52294921875,
-0.86328125,
-0.48974609375,
-0.77001953125,
-0.84521484375,
0.6982421875,
-0.32080078125,
-0.0123138427734375,
-0.62158203125,
0.044708251953125,
1.0419921875,
-0.65185546875,
0.400390625,
0.9677734375,
0.052490234375,
0.04913330078125,
-0.78369140625,
0.54296875,
0.3955078125,
-0.64599609375,
-0.05657958984375,
-0.1444091796875,
-0.55908203125,
-0.09149169921875,
-0.486328125,
-0.80078125,
-0.91845703125,
0.11419677734375,
1.2958984375,
-0.2493896484375,
0.82373046875,
0.0386962890625,
-0.94384765625,
-0.85546875,
0.5537109375,
0.179931640625,
0.442138671875,
1.0390625,
-0.5244140625,
0.1239013671875,
-0.05670166015625,
-0.3232421875,
-0.7890625,
-0.59130859375,
0.8857421875,
-0.58837890625,
-0.44677734375,
0.4580078125,
1.0712890625,
-0.4609375,
-0.59716796875,
-0.1788330078125,
-0.2724609375,
-0.3759765625,
-0.68359375,
-0.1700439453125,
0.59912109375,
-0.5224609375,
0.1971435546875,
0.66015625,
-0.00949859619140625,
0.249267578125,
-0.0005764961242675781,
0.537109375,
-0.634765625,
0.61376953125,
0.306396484375,
-0.5400390625,
-0.12017822265625,
-0.56787109375,
-0.08111572265625,
-0.140380859375,
0.10662841796875,
0.8037109375,
-0.36865234375,
-0.07098388671875,
0.464599609375,
-0.138671875,
0.61962890625,
-0.2978515625,
-0.271484375,
0.29638671875,
-0.91796875,
-0.466796875,
-0.0272369384765625,
0.5576171875,
-0.1822509765625,
0.048095703125,
-0.6162109375,
-0.417236328125,
0.11749267578125,
0.4306640625,
-0.040496826171875,
-0.6708984375,
-0.2491455078125,
-0.8408203125,
-0.2110595703125,
-1.1083984375,
-0.216064453125,
0.0804443359375,
0.221435546875,
0.0853271484375,
-0.267333984375,
-0.0219879150390625,
0.634765625,
-0.87548828125,
1.0576171875,
-0.458984375,
0.312744140625,
-0.39599609375,
-0.495361328125,
-0.826171875,
-0.151611328125,
-0.279052734375,
-0.0106658935546875,
-0.51953125,
0.2099609375,
-0.279052734375,
0.71533203125,
0.017303466796875,
0.33740234375,
-0.048248291015625,
-0.41357421875,
0.09576416015625,
0.32763671875,
-0.226806640625,
0.28515625,
0.609375,
-0.0738525390625,
0.06329345703125,
-0.1265869140625,
-0.400146484375,
-0.6708984375,
0.442138671875,
0.52001953125,
-0.051727294921875,
-0.0794677734375,
-0.118408203125,
0.0521240234375,
-1.0556640625,
-0.006099700927734375,
-0.40869140625,
0.390380859375,
0.30224609375,
-0.64453125,
0.5078125,
1.0439453125,
-0.264892578125,
0.458984375,
0.00162506103515625,
0.365966796875,
0.482421875,
0.47509765625,
-0.143310546875,
0.580078125,
0.45361328125,
0.06805419921875,
-0.0885009765625,
0.45703125,
-0.1676025390625,
0.327392578125,
-0.2978515625,
-0.5888671875,
-1.0078125,
-0.030975341796875,
0.2127685546875,
0.1640625,
0.5419921875,
-0.75830078125,
-0.04693603515625,
-0.239501953125,
-0.317626953125,
0.421875,
-1.0654296875,
-0.826171875,
0.2435302734375,
0.0552978515625,
-0.64013671875,
-0.2734375,
-0.48486328125,
0.00466156005859375,
-0.06494140625,
0.271728515625,
-0.47265625,
0.77099609375,
-0.1544189453125,
0.499267578125,
-0.70947265625,
0.07684326171875,
-0.0016927719116210938,
0.64111328125,
-0.2064208984375,
-0.73046875,
0.143798828125,
1.2880859375,
0.09027099609375,
-0.191162109375,
-0.59130859375,
0.4677734375,
-0.370361328125,
0.3818359375,
0.2017822265625,
0.1773681640625,
-0.1697998046875,
0.52880859375,
-1.0009765625,
-0.0379638671875,
-0.1385498046875,
0.1243896484375,
0.339599609375,
-0.5556640625,
-0.67138671875,
0.88720703125,
0.9697265625,
0.04498291015625,
0.447509765625,
-0.0294189453125,
0.54345703125,
-0.045379638671875,
-0.09857177734375,
-0.399169921875,
0.7392578125,
0.368896484375,
0.5400390625,
-0.18408203125,
0.260986328125,
0.61181640625,
-0.2379150390625,
-0.1297607421875,
0.323974609375,
0.372314453125,
0.049163818359375,
0.255859375,
0.188232421875,
0.056884765625,
-0.139892578125,
-0.67529296875,
0.888671875,
-0.591796875,
-0.08538818359375,
-0.52197265625,
-0.9609375,
0.7314453125,
-0.1690673828125,
-0.466552734375,
0.47314453125,
-0.416015625,
-0.0316162109375,
0.80859375,
0.362060546875,
0.42333984375,
0.6748046875,
0.5986328125,
0.61572265625,
0.50390625,
0.490234375,
0.310546875,
-0.568359375,
-0.033233642578125,
-0.005313873291015625,
-0.049224853515625,
-0.1080322265625,
-0.1754150390625,
-0.88037109375,
0.416748046875,
-0.36572265625,
0.021392822265625,
0.3427734375,
-0.7900390625,
-0.052703857421875,
-0.3388671875,
0.71142578125,
-0.253173828125,
0.1407470703125,
0.1925048828125,
-0.344482421875,
-0.3291015625,
0.62646484375,
-0.09588623046875,
0.472900390625,
0.10455322265625,
0.85302734375,
0.2242431640625,
1.3427734375,
0.7607421875,
-0.272216796875,
0.07940673828125,
0.2159423828125,
-0.447265625,
-0.51416015625,
-0.262939453125,
-0.52880859375,
0.1630859375,
-0.71337890625,
-0.3330078125,
-0.517578125,
0.8359375,
-0.017974853515625,
-1.0234375,
-0.24072265625,
0.160400390625,
-0.69091796875,
0.138427734375,
0.2257080078125,
0.46435546875,
-0.51025390625,
0.093994140625,
-0.051513671875,
-0.465576171875,
0.45703125,
-1.0068359375,
0.223876953125,
-0.427734375,
-0.55224609375,
-0.362060546875,
-0.7119140625,
-0.552734375,
-0.1490478515625,
-0.385498046875,
-0.8779296875,
0.42578125,
0.281982421875,
0.228271484375,
0.42333984375,
-0.239990234375,
0.343994140625,
1.1708984375,
1.12890625,
0.256591796875,
0.7958984375,
0.444091796875,
-0.548828125,
0.277587890625,
-0.49365234375,
0.6435546875,
-0.10015869140625,
0.335693359375,
-0.64892578125,
0.4404296875,
-0.63525390625,
-1.291015625,
-0.0537109375,
0.475341796875,
0.5546875,
-0.6435546875,
-1.14453125,
-0.221435546875,
-0.90478515625,
-0.34375,
-0.2257080078125,
1.1396484375,
-0.20947265625,
0.1822509765625,
0.1702880859375,
-1.3046875,
4.453125,
1.0224609375,
0.94921875,
0.2320556640625,
0.34375,
1.1103515625,
0.64404296875,
-0.499267578125,
-0.51708984375,
-0.10675048828125,
0.38623046875,
-0.369384765625,
-0.12298583984375,
0.76611328125,
0.06829833984375,
0.6875,
-0.48095703125,
0.00905609130859375,
-0.1900634765625,
-0.91552734375,
-1.2001953125,
-0.1015625,
-0.1341552734375,
0.60009765625,
0.31884765625,
0.279541015625,
0.28564453125,
-0.56689453125,
-0.222900390625,
-0.82080078125,
0.217041015625,
-0.83056640625,
1.0498046875,
0.1429443359375,
-0.10296630859375,
0.64208984375,
-0.1036376953125,
-0.73681640625,
-0.10760498046875,
-0.10858154296875,
-0.378173828125,
-0.1583251953125,
0.642578125,
-0.57177734375,
-0.1783447265625,
0.280517578125,
-0.3642578125,
0.8349609375,
0.0005884170532226562,
-0.85888671875,
0.9013671875,
-0.114501953125,
0.3701171875,
-0.7734375,
-0.68798828125,
-0.06622314453125,
-0.1170654296875,
-0.041229248046875,
-0.1385498046875,
0.4423828125,
0.393310546875,
0.39892578125,
0.302001953125,
0.57763671875,
-0.8984375,
0.82666015625,
0.053955078125,
0.451416015625,
-0.379638671875,
-0.285888671875,
-0.31640625,
0.11651611328125,
-0.1607666015625,
-0.245849609375,
0.5625,
0.039825439453125,
-0.344970703125,
0.457275390625,
0.71240234375,
-1.1171875,
0.240966796875,
-0.1473388671875,
-0.416748046875,
0.002593994140625,
0.64453125,
1.2373046875,
-0.80517578125,
-0.220703125,
-0.364013671875,
0.7724609375,
0.5869140625,
0.59375,
0.183349609375,
-0.418701171875,
-0.134521484375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The newspaper contains string t, consisting of uppercase and lowercase English letters. We know that the length of string t greater or equal to the length of the string s.
The newspaper may possibly have too few of some letters needed to make the text and too many of some other letters. That's why Tanya wants to cut some n letters out of the newspaper and make a message of length exactly n, so that it looked as much as possible like s. If the letter in some position has correct value and correct letter case (in the string s and in the string that Tanya will make), then she shouts joyfully "YAY!", and if the letter in the given position has only the correct value but it is in the wrong case, then the girl says "WHOOPS".
Tanya wants to make such message that lets her shout "YAY!" as much as possible. If there are multiple ways to do this, then her second priority is to maximize the number of times she says "WHOOPS". Your task is to help Tanya make the message.
Input
The first line contains line s (1 ≤ |s| ≤ 2·105), consisting of uppercase and lowercase English letters — the text of Tanya's message.
The second line contains line t (|s| ≤ |t| ≤ 2·105), consisting of uppercase and lowercase English letters — the text written in the newspaper.
Here |a| means the length of the string a.
Output
Print two integers separated by a space:
* the first number is the number of times Tanya shouts "YAY!" while making the message,
* the second number is the number of times Tanya says "WHOOPS" while making the message.
Examples
Input
AbC
DCbA
Output
3 0
Input
ABC
abc
Output
0 3
Input
abacaba
AbaCaBA
Output
3 4
Tags: greedy, implementation, strings
Correct Solution:
```
s = input()
t = input()
oc = {}
yay=0
whoops=0
resto=''
for l1 in t:
oc[l1] = oc.get(l1, 0)+1
for l2 in s:
if oc.get(l2, 0)>0:
oc[l2]-=1
yay+=1
else:
resto+=l2
for l3 in resto:
aux=l3.swapcase()
if oc.get(aux, 0)>0:
oc[aux]-=1
whoops+=1
print(yay,whoops)
```
| 65,993
|
[
0.12335205078125,
0.097900390625,
0.1014404296875,
0.315673828125,
-0.63232421875,
-0.87109375,
0.251953125,
-0.13330078125,
0.254150390625,
0.609375,
0.6806640625,
-0.154052734375,
0.07659912109375,
-0.4736328125,
-0.5458984375,
-0.2325439453125,
-0.56591796875,
-0.487548828125,
-0.440185546875,
0.0665283203125,
-0.1151123046875,
0.002819061279296875,
-1.66015625,
-0.2213134765625,
-0.161376953125,
0.8154296875,
0.5869140625,
-0.01242828369140625,
1.296875,
0.66357421875,
-0.19140625,
-0.053955078125,
0.09014892578125,
-1.0546875,
-0.357421875,
-0.57470703125,
0.5927734375,
-0.6689453125,
-0.0771484375,
-0.343505859375,
0.36279296875,
-0.462890625,
0.85302734375,
-0.59375,
-1.2265625,
-0.259765625,
-0.2001953125,
-0.37109375,
0.01995849609375,
-0.29833984375,
0.287109375,
-0.399658203125,
0.34814453125,
-0.181396484375,
0.085205078125,
-0.019317626953125,
-0.09844970703125,
-0.298095703125,
-0.7783203125,
0.50830078125,
0.049591064453125,
0.268798828125,
0.1766357421875,
-0.5751953125,
0.01953125,
-0.1663818359375,
-0.2418212890625,
0.0809326171875,
0.0272216796875,
-0.8251953125,
0.099609375,
0.404541015625,
-0.426025390625,
-0.53076171875,
-0.7177734375,
0.25732421875,
0.28076171875,
-0.12335205078125,
-0.9833984375,
1.0146484375,
-0.134765625,
1.0009765625,
0.437744140625,
0.06182861328125,
-0.537109375,
-0.630859375,
0.2357177734375,
0.08197021484375,
0.4951171875,
-0.14208984375,
-0.0926513671875,
0.499755859375,
-0.60498046875,
0.2406005859375,
0.46044921875,
0.64111328125,
-0.5263671875,
0.410400390625,
0.07977294921875,
0.37255859375,
0.59716796875,
0.82275390625,
-0.403076171875,
1.0009765625,
-0.5859375,
0.253662109375,
0.2392578125,
-0.371826171875,
-0.431396484375,
-0.043365478515625,
-0.397705078125,
-0.07470703125,
0.66943359375,
0.0721435546875,
-0.420166015625,
0.921875,
0.3115234375,
0.54638671875,
-0.62744140625,
0.2254638671875,
0.53857421875,
0.15673828125,
0.53076171875,
-0.274658203125,
-0.1517333984375,
-0.069580078125,
-0.2381591796875,
1.328125,
-0.423828125,
-0.1103515625,
0.330810546875,
0.028564453125,
0.2188720703125,
0.5556640625,
-0.1976318359375,
0.8974609375,
-0.52197265625,
0.440673828125,
0.904296875,
-0.58251953125,
0.52197265625,
-0.19921875,
0.027923583984375,
1.2333984375,
0.340087890625,
0.269287109375,
0.69775390625,
0.2344970703125,
-1.0556640625,
0.383544921875,
-0.80517578125,
0.81591796875,
-0.26708984375,
0.45849609375,
-0.1810302734375,
0.26318359375,
-0.233642578125,
-0.020050048828125,
0.29833984375,
-0.2110595703125,
-0.38134765625,
0.193603515625,
-0.75634765625,
0.921875,
-0.50732421875,
0.4755859375,
-0.486328125,
-0.10675048828125,
-0.2320556640625,
-0.41064453125,
0.325927734375,
-0.1605224609375,
-0.403076171875,
0.84326171875,
0.385009765625,
1.0595703125,
0.8056640625,
-0.4609375,
0.382080078125,
0.1407470703125,
-0.11004638671875,
0.53515625,
0.2578125,
0.65185546875,
0.384765625,
-0.0751953125,
0.11236572265625,
-0.1767578125,
-0.58251953125,
-0.63232421875,
0.330322265625,
0.436767578125,
-0.56494140625,
0.36279296875,
0.08074951171875,
0.397705078125,
-0.8779296875,
-0.01343536376953125,
-0.216552734375,
-0.970703125,
-0.380859375,
0.64453125,
-0.1785888671875,
0.6806640625,
-0.333251953125,
-0.6640625,
0.1693115234375,
1.1025390625,
-0.320556640625,
-0.2374267578125,
0.3720703125,
0.18310546875,
-0.366943359375,
0.1182861328125,
0.193115234375,
-0.3515625,
-0.82275390625,
0.7568359375,
-0.39794921875,
0.1533203125,
0.06427001953125,
0.57421875,
0.12939453125,
0.55224609375,
-0.2061767578125,
-0.042205810546875,
0.83056640625,
0.896484375,
-0.07562255859375,
0.40869140625,
0.1820068359375,
0.64501953125,
0.59326171875,
1.029296875,
0.82080078125,
0.509765625,
0.5751953125,
0.72802734375,
-0.32861328125,
0.0075531005859375,
0.09429931640625,
0.20458984375,
0.30029296875,
0.78271484375,
0.225830078125,
0.53955078125,
0.0794677734375,
0.022430419921875,
-0.45068359375,
0.4013671875,
-0.2252197265625,
0.666015625,
0.28466796875,
0.80615234375,
-0.361572265625,
-0.5380859375,
0.10711669921875,
0.9521484375,
-0.794921875,
-0.490478515625,
0.46240234375,
0.400146484375,
-0.03106689453125,
-0.00624847412109375,
0.306884765625,
0.366943359375,
0.34130859375,
0.265380859375,
-0.374267578125,
-0.935546875,
-0.8076171875,
-0.978515625,
-0.748046875,
-0.228515625,
-0.880859375,
0.01078033447265625,
0.8955078125,
-1.1376953125,
0.306640625,
-0.448974609375,
-0.126220703125,
-0.1136474609375,
-0.65234375,
0.62744140625,
0.1778564453125,
0.7099609375,
-0.58251953125,
0.5029296875,
0.53564453125,
1.1962890625,
-0.57080078125,
-0.2113037109375,
-0.2568359375,
-0.268310546875,
0.4208984375,
0.2301025390625,
0.294189453125,
-0.08013916015625,
-0.78564453125,
-0.802734375,
-0.1387939453125,
-0.03692626953125,
-0.26025390625,
-0.0272674560546875,
-0.7236328125,
0.5703125,
0.69775390625,
-0.638671875,
0.282958984375,
1.35546875,
-0.485107421875,
0.451416015625,
0.2261962890625,
-0.11737060546875,
-0.703125,
1.1103515625,
0.15771484375,
0.288818359375,
-0.77734375,
-0.216064453125,
-0.626953125,
0.382568359375,
0.0882568359375,
-0.1510009765625,
-0.3662109375,
0.382080078125,
0.038482666015625,
-1.193359375,
0.53955078125,
-1.279296875,
-0.475341796875,
-0.408203125,
-0.712890625,
0.6708984375,
0.892578125,
-0.005733489990234375,
-0.374755859375,
0.049102783203125,
-0.1488037109375,
0.1329345703125,
0.56787109375,
-0.7783203125,
0.0120086669921875,
0.83056640625,
-0.2333984375,
0.2281494140625,
0.3212890625,
-0.0283966064453125,
-0.417236328125,
0.25634765625,
0.491943359375,
0.5126953125,
0.1971435546875,
0.1148681640625,
0.16259765625,
0.640625,
-0.7265625,
-0.34912109375,
-0.415283203125,
0.560546875,
0.5791015625,
0.6806640625,
0.58837890625,
-0.1876220703125,
-0.55419921875,
-1.189453125,
0.423095703125,
0.18115234375,
0.6240234375,
-0.72265625,
1.0556640625,
0.071533203125,
-0.09930419921875,
0.40234375,
-0.53125,
-0.39990234375,
0.91650390625,
-0.437255859375,
0.947265625,
-0.6552734375,
0.5048828125,
-0.1324462890625,
0.14013671875,
0.33251953125,
0.1094970703125,
0.4423828125,
-0.24072265625,
-0.52001953125,
-0.541015625,
-0.2135009765625,
-0.40966796875,
-0.7216796875,
0.35498046875,
-0.35986328125,
-0.382080078125,
-0.98193359375,
0.07977294921875,
0.9208984375,
0.73583984375,
0.1754150390625,
0.58984375,
0.0994873046875,
0.67626953125,
0.71044921875,
-0.313720703125,
0.049591064453125,
-1.0419921875,
0.5791015625,
0.043426513671875,
-0.04705810546875,
-0.53515625,
-0.384033203125,
-0.1595458984375,
0.322021484375,
0.041595458984375,
-0.01318359375,
-1.021484375,
0.3388671875,
-0.154052734375,
0.58837890625,
-0.56494140625,
-0.2958984375,
-0.0704345703125,
-0.053802490234375,
0.30859375,
-0.84716796875,
0.53564453125,
-0.65087890625,
0.82470703125,
0.31787109375,
0.1256103515625,
-0.67138671875,
-0.3994140625,
-0.6142578125,
-0.55517578125,
-0.050323486328125,
0.71826171875,
0.274169921875,
0.615234375,
-1.17578125,
0.48486328125,
0.47900390625,
-0.237060546875,
0.37841796875,
-0.018829345703125,
0.363525390625,
0.399658203125,
0.55078125,
-0.767578125,
-0.84033203125,
0.416259765625,
-1.2041015625,
0.355224609375,
-0.440185546875,
0.132080078125,
-0.40869140625,
-0.13525390625,
-0.10150146484375,
0.07489013671875,
-0.4130859375,
0.266845703125,
-0.420166015625,
0.380126953125,
-0.60009765625,
-0.65283203125,
0.344482421875,
0.251220703125,
-0.48681640625,
0.87744140625,
-0.1810302734375,
-0.341552734375,
-0.0367431640625,
0.572265625,
-0.65234375,
0.31298828125,
-0.315185546875,
0.1414794921875,
-0.478759765625,
-0.67041015625,
0.2099609375,
-0.446044921875,
0.61767578125,
-0.28857421875,
-0.95947265625,
-0.00783538818359375,
-1.169921875,
0.2149658203125,
0.17626953125,
-0.62890625,
0.444580078125,
0.20751953125,
-0.1162109375,
0.0262451171875,
-0.59228515625,
-0.08966064453125,
-0.1865234375,
-0.7607421875,
-0.1351318359375,
-0.005645751953125,
0.712890625,
0.92626953125,
-0.04095458984375,
-0.5771484375,
-0.10162353515625,
0.06939697265625,
0.0228729248046875,
-0.5166015625,
0.04779052734375,
-0.50390625,
-0.11431884765625,
-0.3466796875,
0.362548828125,
-0.1409912109375,
0.354248046875,
1.1220703125,
0.433349609375,
0.27978515625,
0.279541015625,
-0.7099609375,
1.0078125,
0.37255859375,
-0.99853515625,
-1.01171875,
0.1788330078125,
-0.293701171875,
0.345703125,
0.197509765625,
-0.974609375,
-0.78369140625,
-1.2412109375,
-0.1826171875,
-0.87353515625,
-0.24951171875,
-0.90478515625,
-0.255126953125,
-0.09649658203125,
0.6201171875,
-0.1329345703125,
-0.35595703125,
0.468505859375,
-1.361328125,
0.08843994140625,
-0.74072265625,
-0.3349609375,
-0.802734375,
0.1092529296875,
-0.410888671875,
0.96630859375,
0.389404296875,
0.404052734375,
-0.2144775390625,
-0.332275390625,
0.1640625,
-0.0256500244140625,
-0.1322021484375,
-0.2191162109375,
-0.1923828125,
0.30615234375,
0.2154541015625,
-0.1802978515625,
-0.53564453125,
0.92333984375,
-0.685546875,
0.18994140625,
-0.020538330078125,
-0.423095703125,
-0.1846923828125,
-0.4072265625,
1.1171875,
-0.5224609375,
-0.183837890625,
-0.68603515625,
0.1781005859375,
0.66943359375,
-0.55810546875,
-0.8876953125,
-0.477294921875,
-0.79931640625,
-0.83740234375,
0.6416015625,
-0.337890625,
0.02081298828125,
-0.6279296875,
0.0274658203125,
1.0009765625,
-0.6259765625,
0.34765625,
1.0048828125,
0.06427001953125,
0.06451416015625,
-0.80224609375,
0.556640625,
0.377685546875,
-0.6845703125,
-0.0736083984375,
-0.1614990234375,
-0.56396484375,
-0.0875244140625,
-0.5029296875,
-0.81591796875,
-0.90185546875,
0.09259033203125,
1.2724609375,
-0.2139892578125,
0.83544921875,
0.07708740234375,
-0.9189453125,
-0.87646484375,
0.55322265625,
0.1688232421875,
0.4580078125,
1.052734375,
-0.564453125,
0.1495361328125,
-0.045745849609375,
-0.336669921875,
-0.8095703125,
-0.5595703125,
0.8896484375,
-0.603515625,
-0.470458984375,
0.479248046875,
1.03515625,
-0.480224609375,
-0.55859375,
-0.161376953125,
-0.248046875,
-0.379150390625,
-0.6640625,
-0.2069091796875,
0.57666015625,
-0.47998046875,
0.2421875,
0.6875,
-0.00450897216796875,
0.265625,
-0.0086212158203125,
0.55126953125,
-0.63037109375,
0.62548828125,
0.35888671875,
-0.541015625,
-0.08355712890625,
-0.5712890625,
-0.0682373046875,
-0.1456298828125,
0.11724853515625,
0.763671875,
-0.349365234375,
-0.0550537109375,
0.47314453125,
-0.154296875,
0.58349609375,
-0.3330078125,
-0.311279296875,
0.298095703125,
-0.88671875,
-0.48486328125,
-0.0538330078125,
0.53564453125,
-0.2166748046875,
0.051116943359375,
-0.60400390625,
-0.414794921875,
0.12451171875,
0.460693359375,
-0.03564453125,
-0.671875,
-0.256103515625,
-0.89794921875,
-0.2164306640625,
-1.0966796875,
-0.1842041015625,
0.054229736328125,
0.2059326171875,
0.1290283203125,
-0.316162109375,
0.00490570068359375,
0.611328125,
-0.896484375,
1.0185546875,
-0.467529296875,
0.293212890625,
-0.357421875,
-0.50244140625,
-0.859375,
-0.12548828125,
-0.2607421875,
0.019195556640625,
-0.5185546875,
0.190185546875,
-0.279052734375,
0.74951171875,
0.03509521484375,
0.31201171875,
-0.009185791015625,
-0.400634765625,
0.0509033203125,
0.294921875,
-0.183837890625,
0.259765625,
0.61474609375,
-0.035736083984375,
0.10186767578125,
-0.143310546875,
-0.381103515625,
-0.67529296875,
0.455810546875,
0.49169921875,
-0.06658935546875,
-0.11016845703125,
-0.11224365234375,
0.0872802734375,
-1.0693359375,
0.04254150390625,
-0.39599609375,
0.399658203125,
0.279052734375,
-0.6318359375,
0.533203125,
1.046875,
-0.2236328125,
0.471435546875,
0.0290985107421875,
0.3701171875,
0.53466796875,
0.48681640625,
-0.160400390625,
0.57275390625,
0.433349609375,
0.038421630859375,
-0.10369873046875,
0.496337890625,
-0.162841796875,
0.399658203125,
-0.289306640625,
-0.5546875,
-0.97705078125,
-0.030364990234375,
0.2352294921875,
0.1761474609375,
0.53271484375,
-0.810546875,
-0.0537109375,
-0.2109375,
-0.26904296875,
0.468505859375,
-1.0556640625,
-0.81298828125,
0.268798828125,
0.01255035400390625,
-0.65380859375,
-0.326171875,
-0.449462890625,
0.0274200439453125,
-0.09149169921875,
0.2249755859375,
-0.493896484375,
0.779296875,
-0.1651611328125,
0.52880859375,
-0.74462890625,
0.050018310546875,
0.004611968994140625,
0.662109375,
-0.205078125,
-0.7509765625,
0.11639404296875,
1.33203125,
0.07550048828125,
-0.19189453125,
-0.59619140625,
0.486328125,
-0.371337890625,
0.44140625,
0.276123046875,
0.1717529296875,
-0.17138671875,
0.505859375,
-1.0263671875,
-0.047760009765625,
-0.150146484375,
0.130859375,
0.325439453125,
-0.5380859375,
-0.6826171875,
0.91845703125,
0.99609375,
0.0726318359375,
0.476806640625,
-0.020050048828125,
0.5791015625,
-0.0615234375,
-0.08746337890625,
-0.442626953125,
0.74951171875,
0.400146484375,
0.52685546875,
-0.204833984375,
0.250244140625,
0.60693359375,
-0.2626953125,
-0.1229248046875,
0.34228515625,
0.377685546875,
-0.0102386474609375,
0.29150390625,
0.1419677734375,
0.0562744140625,
-0.144287109375,
-0.669921875,
0.8505859375,
-0.58642578125,
-0.0914306640625,
-0.5,
-0.9873046875,
0.74560546875,
-0.1978759765625,
-0.426513671875,
0.48681640625,
-0.441650390625,
-0.05548095703125,
0.810546875,
0.359375,
0.442138671875,
0.6650390625,
0.60302734375,
0.6416015625,
0.484130859375,
0.495361328125,
0.29931640625,
-0.57861328125,
-0.0265960693359375,
-0.00656890869140625,
-0.041412353515625,
-0.0885009765625,
-0.1558837890625,
-0.865234375,
0.360107421875,
-0.370849609375,
-0.02899169921875,
0.3896484375,
-0.77197265625,
-0.07562255859375,
-0.33154296875,
0.7724609375,
-0.277587890625,
0.150634765625,
0.24169921875,
-0.329833984375,
-0.318359375,
0.62744140625,
-0.0697021484375,
0.488037109375,
0.08905029296875,
0.86474609375,
0.2135009765625,
1.3486328125,
0.76171875,
-0.278076171875,
0.043975830078125,
0.21630859375,
-0.476806640625,
-0.5234375,
-0.2254638671875,
-0.52587890625,
0.172119140625,
-0.75439453125,
-0.33935546875,
-0.52880859375,
0.84814453125,
-0.048065185546875,
-0.9970703125,
-0.218505859375,
0.1627197265625,
-0.6845703125,
0.184326171875,
0.2003173828125,
0.50146484375,
-0.51025390625,
0.133056640625,
-0.06689453125,
-0.438232421875,
0.4609375,
-0.9814453125,
0.197998046875,
-0.471923828125,
-0.544921875,
-0.39208984375,
-0.681640625,
-0.5751953125,
-0.14306640625,
-0.376220703125,
-0.8330078125,
0.404541015625,
0.310546875,
0.1788330078125,
0.42431640625,
-0.2252197265625,
0.37841796875,
1.18359375,
1.146484375,
0.2344970703125,
0.7861328125,
0.43115234375,
-0.52587890625,
0.2388916015625,
-0.53125,
0.5986328125,
-0.08831787109375,
0.347412109375,
-0.697265625,
0.455810546875,
-0.60595703125,
-1.2724609375,
-0.0966796875,
0.480224609375,
0.564453125,
-0.69091796875,
-1.126953125,
-0.2159423828125,
-0.88427734375,
-0.41015625,
-0.2275390625,
1.1484375,
-0.16943359375,
0.15283203125,
0.1865234375,
-1.2919921875,
4.42578125,
1.0068359375,
0.9619140625,
0.2099609375,
0.3369140625,
1.1220703125,
0.63623046875,
-0.46435546875,
-0.5537109375,
-0.13037109375,
0.387939453125,
-0.341796875,
-0.11468505859375,
0.76904296875,
0.0888671875,
0.7158203125,
-0.444580078125,
-0.01428985595703125,
-0.1783447265625,
-0.923828125,
-1.1748046875,
-0.07696533203125,
-0.1522216796875,
0.58447265625,
0.324462890625,
0.247802734375,
0.250732421875,
-0.53076171875,
-0.2154541015625,
-0.80615234375,
0.2305908203125,
-0.83056640625,
0.99755859375,
0.1551513671875,
-0.1353759765625,
0.67041015625,
-0.08349609375,
-0.75537109375,
-0.13720703125,
-0.1439208984375,
-0.4287109375,
-0.1571044921875,
0.6064453125,
-0.55322265625,
-0.188720703125,
0.2900390625,
-0.3505859375,
0.83544921875,
0.033477783203125,
-0.83447265625,
0.943359375,
-0.130859375,
0.359375,
-0.77099609375,
-0.69287109375,
-0.053955078125,
-0.1275634765625,
-0.0247802734375,
-0.164794921875,
0.457275390625,
0.419189453125,
0.421142578125,
0.30859375,
0.58203125,
-0.93798828125,
0.85107421875,
0.03564453125,
0.437744140625,
-0.37646484375,
-0.295654296875,
-0.329833984375,
0.12066650390625,
-0.1331787109375,
-0.262939453125,
0.5576171875,
0.01158905029296875,
-0.36328125,
0.43603515625,
0.65625,
-1.10546875,
0.2427978515625,
-0.12109375,
-0.43798828125,
0.01158905029296875,
0.65771484375,
1.2255859375,
-0.85595703125,
-0.251220703125,
-0.367919921875,
0.787109375,
0.60986328125,
0.5927734375,
0.1781005859375,
-0.42919921875,
-0.14013671875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The newspaper contains string t, consisting of uppercase and lowercase English letters. We know that the length of string t greater or equal to the length of the string s.
The newspaper may possibly have too few of some letters needed to make the text and too many of some other letters. That's why Tanya wants to cut some n letters out of the newspaper and make a message of length exactly n, so that it looked as much as possible like s. If the letter in some position has correct value and correct letter case (in the string s and in the string that Tanya will make), then she shouts joyfully "YAY!", and if the letter in the given position has only the correct value but it is in the wrong case, then the girl says "WHOOPS".
Tanya wants to make such message that lets her shout "YAY!" as much as possible. If there are multiple ways to do this, then her second priority is to maximize the number of times she says "WHOOPS". Your task is to help Tanya make the message.
Input
The first line contains line s (1 ≤ |s| ≤ 2·105), consisting of uppercase and lowercase English letters — the text of Tanya's message.
The second line contains line t (|s| ≤ |t| ≤ 2·105), consisting of uppercase and lowercase English letters — the text written in the newspaper.
Here |a| means the length of the string a.
Output
Print two integers separated by a space:
* the first number is the number of times Tanya shouts "YAY!" while making the message,
* the second number is the number of times Tanya says "WHOOPS" while making the message.
Examples
Input
AbC
DCbA
Output
3 0
Input
ABC
abc
Output
0 3
Input
abacaba
AbaCaBA
Output
3 4
Tags: greedy, implementation, strings
Correct Solution:
```
alth = "abcdefghijklmnopqrstuvwxyz"
alth2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
s2 = [[0]*26 for i in range(2)]
s3 = [[0]*26 for i in range(2)]
s = input()
t = input()
num = 0
num2 = 0
for i in s:
temp = alth.find(i)
if temp != -1:
s2[0][temp] += 1
temp = alth2.find(i)
if temp != -1:
s2[1][temp] += 1
for i in t:
temp = alth.find(i)
if temp != -1:
s3[0][temp] += 1
temp = alth2.find(i)
if temp != -1:
s3[1][temp] += 1
for i in range(2):
for j in range(26):
x = min(s2[i][j],s3[i][j])
num += x
s2[i][j] -= x
s3[i][j] -= x
for i in range(2):
for j in range(26):
num2 += min(s2[i][j],s3[1-i][j])
print(num,num2)
```
| 65,994
|
[
0.07501220703125,
0.1090087890625,
0.1798095703125,
0.3740234375,
-0.66748046875,
-0.90087890625,
0.296875,
-0.1375732421875,
0.241455078125,
0.6044921875,
0.74169921875,
-0.1778564453125,
0.1357421875,
-0.45654296875,
-0.56201171875,
-0.2255859375,
-0.55859375,
-0.489990234375,
-0.413818359375,
0.07708740234375,
-0.1331787109375,
-0.0087738037109375,
-1.638671875,
-0.2308349609375,
-0.195068359375,
0.77099609375,
0.60693359375,
0.01410675048828125,
1.2275390625,
0.6884765625,
-0.2393798828125,
-0.0283050537109375,
0.01377105712890625,
-1.048828125,
-0.36376953125,
-0.611328125,
0.580078125,
-0.640625,
-0.0914306640625,
-0.325927734375,
0.362060546875,
-0.4296875,
0.9208984375,
-0.61181640625,
-1.1796875,
-0.265625,
-0.1998291015625,
-0.341796875,
-0.0293731689453125,
-0.31640625,
0.32666015625,
-0.429931640625,
0.304931640625,
-0.1932373046875,
0.1527099609375,
-0.0003337860107421875,
-0.139892578125,
-0.23828125,
-0.77197265625,
0.52099609375,
0.015289306640625,
0.1881103515625,
0.12457275390625,
-0.552734375,
0.0615234375,
-0.134033203125,
-0.206787109375,
0.047210693359375,
0.013275146484375,
-0.81005859375,
0.058502197265625,
0.36962890625,
-0.46875,
-0.486083984375,
-0.6875,
0.29736328125,
0.25927734375,
-0.10809326171875,
-0.99658203125,
1.052734375,
-0.1346435546875,
1.021484375,
0.437744140625,
0.12646484375,
-0.52587890625,
-0.6064453125,
0.17138671875,
0.0711669921875,
0.52490234375,
-0.20849609375,
-0.10540771484375,
0.486572265625,
-0.59033203125,
0.234130859375,
0.417724609375,
0.63134765625,
-0.44921875,
0.42529296875,
0.08135986328125,
0.386474609375,
0.544921875,
0.822265625,
-0.323486328125,
0.99560546875,
-0.615234375,
0.31982421875,
0.25439453125,
-0.332275390625,
-0.414794921875,
-0.07391357421875,
-0.408447265625,
-0.08795166015625,
0.7421875,
0.01413726806640625,
-0.389892578125,
0.90283203125,
0.2266845703125,
0.485595703125,
-0.65380859375,
0.2352294921875,
0.55029296875,
0.06317138671875,
0.546875,
-0.28564453125,
-0.1407470703125,
-0.05633544921875,
-0.2281494140625,
1.27734375,
-0.40625,
-0.09912109375,
0.325439453125,
0.0926513671875,
0.218994140625,
0.54638671875,
-0.1298828125,
0.89208984375,
-0.5224609375,
0.3896484375,
0.88134765625,
-0.56298828125,
0.44921875,
-0.166015625,
0.0111083984375,
1.2431640625,
0.35546875,
0.2314453125,
0.62939453125,
0.226318359375,
-1.0498046875,
0.39208984375,
-0.82177734375,
0.86767578125,
-0.2186279296875,
0.36572265625,
-0.1519775390625,
0.2861328125,
-0.319580078125,
-0.0217742919921875,
0.264404296875,
-0.17919921875,
-0.36279296875,
0.192626953125,
-0.72119140625,
0.94970703125,
-0.440185546875,
0.4912109375,
-0.51025390625,
-0.1502685546875,
-0.30322265625,
-0.350830078125,
0.313232421875,
-0.1318359375,
-0.4521484375,
0.8525390625,
0.413330078125,
1.0625,
0.841796875,
-0.415771484375,
0.374755859375,
0.1353759765625,
-0.0802001953125,
0.552734375,
0.28466796875,
0.58837890625,
0.338623046875,
-0.0902099609375,
0.06402587890625,
-0.1839599609375,
-0.56298828125,
-0.6162109375,
0.3505859375,
0.429443359375,
-0.56640625,
0.38232421875,
0.088134765625,
0.404052734375,
-0.90283203125,
0.004901885986328125,
-0.20166015625,
-0.92724609375,
-0.40771484375,
0.65625,
-0.2044677734375,
0.60107421875,
-0.371337890625,
-0.64990234375,
0.1790771484375,
1.138671875,
-0.27099609375,
-0.2391357421875,
0.372802734375,
0.2252197265625,
-0.40380859375,
0.18310546875,
0.191162109375,
-0.37451171875,
-0.81689453125,
0.7158203125,
-0.408935546875,
0.12225341796875,
0.0938720703125,
0.56982421875,
0.186279296875,
0.53515625,
-0.29345703125,
-0.03900146484375,
0.87353515625,
0.91455078125,
-0.09185791015625,
0.4013671875,
0.2142333984375,
0.69970703125,
0.60302734375,
0.98046875,
0.75927734375,
0.52001953125,
0.53369140625,
0.6748046875,
-0.285400390625,
-0.036163330078125,
0.0919189453125,
0.210205078125,
0.298828125,
0.7451171875,
0.26171875,
0.51904296875,
0.01898193359375,
0.034149169921875,
-0.490234375,
0.4130859375,
-0.2276611328125,
0.66259765625,
0.323486328125,
0.8076171875,
-0.380126953125,
-0.6025390625,
0.182373046875,
0.93701171875,
-0.7734375,
-0.498779296875,
0.474365234375,
0.38427734375,
-0.0165557861328125,
0.0265960693359375,
0.286865234375,
0.335693359375,
0.3515625,
0.234130859375,
-0.389404296875,
-0.90576171875,
-0.79052734375,
-1.0244140625,
-0.6982421875,
-0.26220703125,
-0.82080078125,
0.011688232421875,
0.83740234375,
-1.1552734375,
0.348388671875,
-0.38330078125,
-0.10882568359375,
-0.09197998046875,
-0.658203125,
0.52099609375,
0.1259765625,
0.70166015625,
-0.57763671875,
0.55908203125,
0.477783203125,
1.1943359375,
-0.60009765625,
-0.145751953125,
-0.251953125,
-0.2203369140625,
0.497802734375,
0.1634521484375,
0.27587890625,
-0.20263671875,
-0.74462890625,
-0.82373046875,
-0.168701171875,
-0.130126953125,
-0.257080078125,
0.0028820037841796875,
-0.6953125,
0.50732421875,
0.67626953125,
-0.66943359375,
0.21435546875,
1.3349609375,
-0.474365234375,
0.43701171875,
0.2376708984375,
-0.044403076171875,
-0.65869140625,
1.107421875,
0.130615234375,
0.2130126953125,
-0.73974609375,
-0.2364501953125,
-0.58251953125,
0.394775390625,
0.04833984375,
-0.1676025390625,
-0.292236328125,
0.37744140625,
0.034759521484375,
-1.16015625,
0.52294921875,
-1.2734375,
-0.52490234375,
-0.372314453125,
-0.7734375,
0.69287109375,
0.880859375,
-0.01238250732421875,
-0.3798828125,
-0.052398681640625,
-0.07818603515625,
0.1746826171875,
0.54638671875,
-0.79736328125,
-0.1175537109375,
0.796875,
-0.291015625,
0.2421875,
0.357421875,
-0.0643310546875,
-0.398681640625,
0.1619873046875,
0.5400390625,
0.51171875,
0.219970703125,
0.191650390625,
0.1634521484375,
0.64697265625,
-0.72216796875,
-0.375732421875,
-0.3955078125,
0.5029296875,
0.5341796875,
0.623046875,
0.5888671875,
-0.14111328125,
-0.578125,
-1.2568359375,
0.459716796875,
0.12225341796875,
0.6455078125,
-0.72119140625,
1.0576171875,
0.0132293701171875,
-0.124755859375,
0.4248046875,
-0.4921875,
-0.44287109375,
0.9287109375,
-0.46435546875,
0.90185546875,
-0.67626953125,
0.49755859375,
-0.1785888671875,
0.0872802734375,
0.345458984375,
0.108154296875,
0.488037109375,
-0.250732421875,
-0.5439453125,
-0.53125,
-0.210205078125,
-0.3994140625,
-0.7109375,
0.373779296875,
-0.332763671875,
-0.366455078125,
-0.96142578125,
0.079345703125,
0.93896484375,
0.701171875,
0.1739501953125,
0.60009765625,
0.06256103515625,
0.7236328125,
0.6572265625,
-0.349853515625,
0.0200653076171875,
-1.025390625,
0.6318359375,
0.1429443359375,
0.0309295654296875,
-0.50537109375,
-0.31640625,
-0.1907958984375,
0.286865234375,
0.04559326171875,
-0.0389404296875,
-0.96923828125,
0.31640625,
-0.1182861328125,
0.587890625,
-0.56884765625,
-0.18115234375,
-0.08837890625,
-0.08221435546875,
0.331787109375,
-0.8330078125,
0.49267578125,
-0.64404296875,
0.83642578125,
0.3095703125,
0.1953125,
-0.6513671875,
-0.408447265625,
-0.60595703125,
-0.5205078125,
-0.0633544921875,
0.7578125,
0.2841796875,
0.58056640625,
-1.2060546875,
0.46142578125,
0.41650390625,
-0.1954345703125,
0.402587890625,
-0.03753662109375,
0.41455078125,
0.36376953125,
0.4970703125,
-0.69140625,
-0.8544921875,
0.3505859375,
-1.1865234375,
0.382080078125,
-0.455078125,
0.14794921875,
-0.3662109375,
-0.049102783203125,
-0.129638671875,
0.1644287109375,
-0.40576171875,
0.299072265625,
-0.330078125,
0.377685546875,
-0.6064453125,
-0.642578125,
0.349853515625,
0.1878662109375,
-0.525390625,
0.904296875,
-0.188232421875,
-0.267822265625,
-0.042999267578125,
0.52880859375,
-0.57568359375,
0.346435546875,
-0.282958984375,
0.14306640625,
-0.472412109375,
-0.6669921875,
0.1695556640625,
-0.446533203125,
0.61181640625,
-0.3720703125,
-0.92919921875,
0.028167724609375,
-1.1494140625,
0.2607421875,
0.1781005859375,
-0.62939453125,
0.40380859375,
0.21923828125,
-0.12164306640625,
-0.005359649658203125,
-0.56494140625,
-0.0999755859375,
-0.1900634765625,
-0.77001953125,
-0.1263427734375,
0.0423583984375,
0.7509765625,
0.89990234375,
-0.0183868408203125,
-0.5576171875,
-0.08489990234375,
0.027923583984375,
0.052093505859375,
-0.51611328125,
0.07379150390625,
-0.413818359375,
-0.1273193359375,
-0.34765625,
0.390625,
-0.08172607421875,
0.33154296875,
1.10546875,
0.433349609375,
0.2939453125,
0.248779296875,
-0.69873046875,
1.01953125,
0.349365234375,
-0.95654296875,
-0.99267578125,
0.2183837890625,
-0.27734375,
0.32861328125,
0.2340087890625,
-0.978515625,
-0.88232421875,
-1.2197265625,
-0.1968994140625,
-0.87646484375,
-0.25244140625,
-0.93701171875,
-0.2149658203125,
-0.09185791015625,
0.66455078125,
-0.16650390625,
-0.38818359375,
0.509765625,
-1.37890625,
0.09075927734375,
-0.740234375,
-0.303955078125,
-0.734375,
0.1246337890625,
-0.423095703125,
0.99658203125,
0.35498046875,
0.416259765625,
-0.277099609375,
-0.34912109375,
0.1925048828125,
0.023101806640625,
-0.1513671875,
-0.1934814453125,
-0.158203125,
0.333984375,
0.2459716796875,
-0.203857421875,
-0.5048828125,
0.92529296875,
-0.7421875,
0.17236328125,
-0.0078887939453125,
-0.404541015625,
-0.1898193359375,
-0.4169921875,
1.07421875,
-0.5537109375,
-0.1727294921875,
-0.65478515625,
0.1461181640625,
0.69287109375,
-0.5341796875,
-0.857421875,
-0.49072265625,
-0.76611328125,
-0.80517578125,
0.71533203125,
-0.266357421875,
-0.00292205810546875,
-0.61376953125,
0.006893157958984375,
1.0888671875,
-0.6728515625,
0.426513671875,
1.0126953125,
0.054931640625,
0.039154052734375,
-0.765625,
0.544921875,
0.3720703125,
-0.63330078125,
-0.0772705078125,
-0.09442138671875,
-0.56787109375,
-0.13623046875,
-0.5048828125,
-0.8642578125,
-0.9208984375,
0.11962890625,
1.2744140625,
-0.2734375,
0.7919921875,
0.0382080078125,
-0.9169921875,
-0.80224609375,
0.5947265625,
0.14453125,
0.416259765625,
1.099609375,
-0.54541015625,
0.11773681640625,
-0.019195556640625,
-0.37890625,
-0.7724609375,
-0.64501953125,
0.89599609375,
-0.61474609375,
-0.454833984375,
0.4794921875,
1.0302734375,
-0.453125,
-0.5478515625,
-0.208251953125,
-0.243408203125,
-0.30712890625,
-0.7236328125,
-0.2105712890625,
0.591796875,
-0.46337890625,
0.1929931640625,
0.67626953125,
-0.00856781005859375,
0.2393798828125,
-0.0162506103515625,
0.57861328125,
-0.57958984375,
0.6259765625,
0.293212890625,
-0.48974609375,
-0.10870361328125,
-0.61474609375,
-0.06256103515625,
-0.12890625,
0.141357421875,
0.802734375,
-0.3935546875,
-0.0704345703125,
0.483154296875,
-0.1605224609375,
0.6064453125,
-0.329833984375,
-0.231689453125,
0.329833984375,
-0.8837890625,
-0.50048828125,
-0.056610107421875,
0.52978515625,
-0.1978759765625,
0.061737060546875,
-0.654296875,
-0.406005859375,
0.115966796875,
0.4326171875,
-0.0430908203125,
-0.6357421875,
-0.2095947265625,
-0.84521484375,
-0.201904296875,
-1.0966796875,
-0.2313232421875,
0.0670166015625,
0.17431640625,
0.078369140625,
-0.2509765625,
-0.050201416015625,
0.591796875,
-0.8388671875,
1.095703125,
-0.47119140625,
0.380859375,
-0.373046875,
-0.45947265625,
-0.82421875,
-0.1844482421875,
-0.32666015625,
-0.0236358642578125,
-0.47607421875,
0.1683349609375,
-0.282958984375,
0.70263671875,
0.0005102157592773438,
0.33154296875,
0.0207366943359375,
-0.377197265625,
0.12005615234375,
0.349365234375,
-0.20947265625,
0.281982421875,
0.63134765625,
-0.0814208984375,
0.10638427734375,
-0.060150146484375,
-0.43212890625,
-0.63916015625,
0.423583984375,
0.5498046875,
-0.0229644775390625,
-0.11419677734375,
-0.146728515625,
0.0999755859375,
-1.091796875,
-0.0108642578125,
-0.36279296875,
0.433349609375,
0.35302734375,
-0.5927734375,
0.480712890625,
1.0419921875,
-0.2452392578125,
0.471923828125,
0.044677734375,
0.376953125,
0.467529296875,
0.498779296875,
-0.1539306640625,
0.57421875,
0.470458984375,
0.062347412109375,
-0.103759765625,
0.41650390625,
-0.1708984375,
0.38525390625,
-0.29638671875,
-0.5615234375,
-1.0185546875,
-0.05352783203125,
0.175048828125,
0.171142578125,
0.5625,
-0.76171875,
-0.07208251953125,
-0.240478515625,
-0.298583984375,
0.485107421875,
-1.0654296875,
-0.833984375,
0.210693359375,
0.07086181640625,
-0.56494140625,
-0.253173828125,
-0.450927734375,
-0.003936767578125,
-0.08624267578125,
0.205322265625,
-0.501953125,
0.7958984375,
-0.1392822265625,
0.5576171875,
-0.72509765625,
0.1258544921875,
0.0165863037109375,
0.65869140625,
-0.21435546875,
-0.7158203125,
0.155029296875,
1.2880859375,
0.058441162109375,
-0.187255859375,
-0.59130859375,
0.447998046875,
-0.365478515625,
0.383544921875,
0.2237548828125,
0.1761474609375,
-0.1409912109375,
0.52734375,
-1.087890625,
-0.10443115234375,
-0.148681640625,
0.1568603515625,
0.3408203125,
-0.5947265625,
-0.662109375,
0.94189453125,
1.015625,
0.057830810546875,
0.449951171875,
-0.063720703125,
0.53759765625,
-0.003192901611328125,
-0.06396484375,
-0.459716796875,
0.6943359375,
0.380126953125,
0.53515625,
-0.176513671875,
0.275634765625,
0.61376953125,
-0.261474609375,
-0.083251953125,
0.33251953125,
0.340576171875,
0.03985595703125,
0.26953125,
0.206298828125,
0.0860595703125,
-0.135498046875,
-0.70703125,
0.89111328125,
-0.61669921875,
-0.108642578125,
-0.5380859375,
-0.98193359375,
0.7099609375,
-0.17822265625,
-0.4912109375,
0.49853515625,
-0.42236328125,
-0.06610107421875,
0.82568359375,
0.34912109375,
0.45556640625,
0.6572265625,
0.5966796875,
0.65869140625,
0.5087890625,
0.51806640625,
0.3056640625,
-0.55908203125,
0.0265655517578125,
-0.02020263671875,
-0.0572509765625,
-0.13623046875,
-0.1285400390625,
-0.87890625,
0.4306640625,
-0.367431640625,
0.041534423828125,
0.312255859375,
-0.78369140625,
-0.07159423828125,
-0.3701171875,
0.71630859375,
-0.2080078125,
0.1043701171875,
0.2138671875,
-0.38916015625,
-0.310546875,
0.6689453125,
-0.12939453125,
0.465576171875,
0.10064697265625,
0.849609375,
0.208740234375,
1.376953125,
0.77978515625,
-0.25244140625,
0.04620361328125,
0.2095947265625,
-0.48486328125,
-0.50341796875,
-0.2259521484375,
-0.5185546875,
0.14990234375,
-0.6826171875,
-0.302001953125,
-0.55615234375,
0.8505859375,
-0.0178985595703125,
-1.0625,
-0.30859375,
0.1973876953125,
-0.6611328125,
0.110595703125,
0.217529296875,
0.459716796875,
-0.5234375,
0.0882568359375,
-0.09625244140625,
-0.489990234375,
0.370361328125,
-1.001953125,
0.206298828125,
-0.4423828125,
-0.52197265625,
-0.37841796875,
-0.72265625,
-0.63671875,
-0.156494140625,
-0.328369140625,
-0.81005859375,
0.46240234375,
0.2587890625,
0.25634765625,
0.444091796875,
-0.24267578125,
0.381591796875,
1.1123046875,
1.138671875,
0.279052734375,
0.82666015625,
0.45654296875,
-0.52978515625,
0.254638671875,
-0.5,
0.6240234375,
-0.1343994140625,
0.34814453125,
-0.72998046875,
0.44970703125,
-0.65380859375,
-1.296875,
-0.0880126953125,
0.4677734375,
0.59033203125,
-0.66064453125,
-1.1611328125,
-0.199462890625,
-0.900390625,
-0.319091796875,
-0.213623046875,
1.1396484375,
-0.2008056640625,
0.2216796875,
0.1536865234375,
-1.330078125,
4.44140625,
1.033203125,
0.9248046875,
0.18994140625,
0.32373046875,
1.15234375,
0.6689453125,
-0.544921875,
-0.55712890625,
-0.086669921875,
0.4013671875,
-0.354736328125,
-0.1185302734375,
0.71142578125,
0.1053466796875,
0.76806640625,
-0.53662109375,
-0.03289794921875,
-0.2210693359375,
-0.94189453125,
-1.193359375,
-0.1295166015625,
-0.0941162109375,
0.60107421875,
0.28173828125,
0.273681640625,
0.293701171875,
-0.53759765625,
-0.216796875,
-0.880859375,
0.1983642578125,
-0.876953125,
1.0244140625,
0.1485595703125,
-0.1544189453125,
0.640625,
-0.115966796875,
-0.74951171875,
-0.1455078125,
-0.04962158203125,
-0.408203125,
-0.157470703125,
0.599609375,
-0.59912109375,
-0.1763916015625,
0.286376953125,
-0.3203125,
0.79345703125,
-0.01137542724609375,
-0.85986328125,
0.95654296875,
-0.125732421875,
0.393798828125,
-0.75634765625,
-0.74462890625,
-0.059173583984375,
-0.114013671875,
-0.00014030933380126953,
-0.141357421875,
0.448486328125,
0.390869140625,
0.404541015625,
0.267333984375,
0.58837890625,
-0.8974609375,
0.875,
-0.03582763671875,
0.410888671875,
-0.370361328125,
-0.2939453125,
-0.318359375,
0.0548095703125,
-0.2076416015625,
-0.242431640625,
0.55908203125,
0.059814453125,
-0.320556640625,
0.44921875,
0.71728515625,
-1.091796875,
0.220703125,
-0.129638671875,
-0.440673828125,
0.0372314453125,
0.59130859375,
1.255859375,
-0.85107421875,
-0.2210693359375,
-0.354248046875,
0.7705078125,
0.53857421875,
0.58984375,
0.139404296875,
-0.40966796875,
-0.178955078125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The newspaper contains string t, consisting of uppercase and lowercase English letters. We know that the length of string t greater or equal to the length of the string s.
The newspaper may possibly have too few of some letters needed to make the text and too many of some other letters. That's why Tanya wants to cut some n letters out of the newspaper and make a message of length exactly n, so that it looked as much as possible like s. If the letter in some position has correct value and correct letter case (in the string s and in the string that Tanya will make), then she shouts joyfully "YAY!", and if the letter in the given position has only the correct value but it is in the wrong case, then the girl says "WHOOPS".
Tanya wants to make such message that lets her shout "YAY!" as much as possible. If there are multiple ways to do this, then her second priority is to maximize the number of times she says "WHOOPS". Your task is to help Tanya make the message.
Input
The first line contains line s (1 ≤ |s| ≤ 2·105), consisting of uppercase and lowercase English letters — the text of Tanya's message.
The second line contains line t (|s| ≤ |t| ≤ 2·105), consisting of uppercase and lowercase English letters — the text written in the newspaper.
Here |a| means the length of the string a.
Output
Print two integers separated by a space:
* the first number is the number of times Tanya shouts "YAY!" while making the message,
* the second number is the number of times Tanya says "WHOOPS" while making the message.
Examples
Input
AbC
DCbA
Output
3 0
Input
ABC
abc
Output
0 3
Input
abacaba
AbaCaBA
Output
3 4
Tags: greedy, implementation, strings
Correct Solution:
```
import math
t=1
for _ in range(t):
msg=input()
news=input()
newsdict=dict()
for i in news:
a=newsdict.get(i,0)
newsdict[i]=a+1
yay=0
remainingdict=dict()
for i in msg:
a=newsdict.get(i,0)
if(a>0):
newsdict[i]-=1
yay+=1
else:
b=remainingdict.get(i,0)
remainingdict[i]=b+1
whoops=0
for i in remainingdict.keys():
char=i
othercase=i.swapcase()
c=newsdict.get(othercase,0)
if(c>0):
whoops+=min(remainingdict[i], newsdict[othercase])
print(yay, whoops)
```
| 65,995
|
[
0.11456298828125,
0.0914306640625,
0.1246337890625,
0.351318359375,
-0.58349609375,
-0.8154296875,
0.2283935546875,
-0.128662109375,
0.25146484375,
0.65625,
0.73876953125,
-0.214111328125,
0.052825927734375,
-0.46923828125,
-0.5771484375,
-0.2032470703125,
-0.59130859375,
-0.50146484375,
-0.405517578125,
0.06097412109375,
-0.1512451171875,
0.037506103515625,
-1.619140625,
-0.25244140625,
-0.213134765625,
0.83203125,
0.6259765625,
-0.0108489990234375,
1.271484375,
0.708984375,
-0.197998046875,
-0.046661376953125,
0.1309814453125,
-1.044921875,
-0.346435546875,
-0.55859375,
0.63623046875,
-0.703125,
-0.08941650390625,
-0.29345703125,
0.35302734375,
-0.47119140625,
0.85595703125,
-0.591796875,
-1.1904296875,
-0.2325439453125,
-0.2293701171875,
-0.3486328125,
-0.0254669189453125,
-0.268798828125,
0.279052734375,
-0.349609375,
0.358642578125,
-0.2149658203125,
0.0556640625,
-0.0201416015625,
-0.1368408203125,
-0.290283203125,
-0.80810546875,
0.564453125,
0.0816650390625,
0.24658203125,
0.18505859375,
-0.56982421875,
0.00884246826171875,
-0.14111328125,
-0.267822265625,
0.058563232421875,
-0.037445068359375,
-0.849609375,
0.08367919921875,
0.38134765625,
-0.4111328125,
-0.501953125,
-0.68505859375,
0.257568359375,
0.259033203125,
-0.1429443359375,
-0.9697265625,
1.0625,
-0.08258056640625,
0.98095703125,
0.41552734375,
0.09210205078125,
-0.52880859375,
-0.57421875,
0.1827392578125,
0.040008544921875,
0.54443359375,
-0.1273193359375,
-0.12158203125,
0.5,
-0.63720703125,
0.1591796875,
0.42236328125,
0.658203125,
-0.490234375,
0.402587890625,
0.10247802734375,
0.420166015625,
0.57421875,
0.8720703125,
-0.38330078125,
0.97314453125,
-0.57373046875,
0.2861328125,
0.2410888671875,
-0.397705078125,
-0.395751953125,
-0.0234222412109375,
-0.3642578125,
-0.1162109375,
0.7021484375,
0.03985595703125,
-0.415771484375,
0.96435546875,
0.270263671875,
0.4873046875,
-0.6259765625,
0.28466796875,
0.4990234375,
0.1661376953125,
0.55908203125,
-0.31640625,
-0.1383056640625,
-0.077392578125,
-0.2471923828125,
1.3271484375,
-0.44189453125,
-0.0950927734375,
0.32958984375,
0.035369873046875,
0.2362060546875,
0.564453125,
-0.12127685546875,
0.8408203125,
-0.517578125,
0.43994140625,
0.88623046875,
-0.53759765625,
0.50390625,
-0.20556640625,
-0.004009246826171875,
1.19921875,
0.3076171875,
0.279296875,
0.70849609375,
0.2452392578125,
-0.97998046875,
0.435302734375,
-0.84130859375,
0.79833984375,
-0.2430419921875,
0.41015625,
-0.154296875,
0.25048828125,
-0.213134765625,
0.0078277587890625,
0.242431640625,
-0.1826171875,
-0.349365234375,
0.1900634765625,
-0.73193359375,
0.92822265625,
-0.5087890625,
0.473388671875,
-0.5126953125,
-0.1866455078125,
-0.2325439453125,
-0.38232421875,
0.298828125,
-0.18994140625,
-0.385498046875,
0.85107421875,
0.375244140625,
1.0693359375,
0.810546875,
-0.40087890625,
0.37744140625,
0.10479736328125,
-0.074462890625,
0.49951171875,
0.306396484375,
0.62109375,
0.39404296875,
-0.0963134765625,
0.076904296875,
-0.216064453125,
-0.5537109375,
-0.591796875,
0.30810546875,
0.426025390625,
-0.5390625,
0.3125,
0.08709716796875,
0.38720703125,
-0.9072265625,
-0.034698486328125,
-0.1737060546875,
-0.98095703125,
-0.372314453125,
0.638671875,
-0.1885986328125,
0.6796875,
-0.3671875,
-0.6767578125,
0.1925048828125,
1.083984375,
-0.260986328125,
-0.245849609375,
0.402587890625,
0.207763671875,
-0.328857421875,
0.10186767578125,
0.2109375,
-0.36083984375,
-0.85888671875,
0.7177734375,
-0.405517578125,
0.137939453125,
0.06085205078125,
0.556640625,
0.162841796875,
0.54248046875,
-0.21435546875,
0.003322601318359375,
0.78955078125,
0.861328125,
-0.0609130859375,
0.434326171875,
0.26025390625,
0.65771484375,
0.57080078125,
0.99365234375,
0.787109375,
0.474853515625,
0.50634765625,
0.70654296875,
-0.2315673828125,
0.0158843994140625,
0.06072998046875,
0.2578125,
0.311279296875,
0.7626953125,
0.2274169921875,
0.5380859375,
0.01715087890625,
0.034759521484375,
-0.4521484375,
0.38818359375,
-0.2252197265625,
0.66015625,
0.302978515625,
0.78125,
-0.38720703125,
-0.52197265625,
0.10595703125,
0.9306640625,
-0.787109375,
-0.447509765625,
0.45263671875,
0.4560546875,
-0.0323486328125,
0.05902099609375,
0.29931640625,
0.361328125,
0.308349609375,
0.271728515625,
-0.385498046875,
-0.912109375,
-0.8271484375,
-1.01171875,
-0.75634765625,
-0.27880859375,
-0.8359375,
0.01129913330078125,
0.869140625,
-1.154296875,
0.302978515625,
-0.425537109375,
-0.1497802734375,
-0.06231689453125,
-0.63330078125,
0.5595703125,
0.1610107421875,
0.7275390625,
-0.65576171875,
0.54638671875,
0.548828125,
1.1943359375,
-0.56640625,
-0.18603515625,
-0.244873046875,
-0.283935546875,
0.453369140625,
0.1951904296875,
0.30078125,
-0.12335205078125,
-0.7158203125,
-0.7998046875,
-0.186279296875,
-0.01371002197265625,
-0.281005859375,
-0.0192108154296875,
-0.71142578125,
0.52392578125,
0.67578125,
-0.59619140625,
0.271484375,
1.322265625,
-0.5029296875,
0.4033203125,
0.214111328125,
-0.1195068359375,
-0.73193359375,
1.07421875,
0.1859130859375,
0.28076171875,
-0.74951171875,
-0.2744140625,
-0.58740234375,
0.3828125,
0.08563232421875,
-0.1737060546875,
-0.308349609375,
0.324951171875,
0.00989532470703125,
-1.1875,
0.54052734375,
-1.2138671875,
-0.51806640625,
-0.38916015625,
-0.7021484375,
0.64697265625,
0.87548828125,
-0.003963470458984375,
-0.4326171875,
0.0113677978515625,
-0.16162109375,
0.1622314453125,
0.60009765625,
-0.77978515625,
-0.04010009765625,
0.78564453125,
-0.264404296875,
0.1912841796875,
0.370361328125,
-0.024627685546875,
-0.4248046875,
0.303955078125,
0.485595703125,
0.479736328125,
0.1907958984375,
0.1744384765625,
0.139892578125,
0.6220703125,
-0.7646484375,
-0.3212890625,
-0.35498046875,
0.55322265625,
0.53173828125,
0.6708984375,
0.5771484375,
-0.22412109375,
-0.572265625,
-1.2353515625,
0.44384765625,
0.1832275390625,
0.61865234375,
-0.7216796875,
1.0634765625,
0.042236328125,
-0.11968994140625,
0.4345703125,
-0.493408203125,
-0.368896484375,
0.9189453125,
-0.46630859375,
0.9912109375,
-0.671875,
0.5419921875,
-0.158935546875,
0.1737060546875,
0.357177734375,
0.1402587890625,
0.418701171875,
-0.242431640625,
-0.470947265625,
-0.46728515625,
-0.2374267578125,
-0.38818359375,
-0.74755859375,
0.32568359375,
-0.328125,
-0.375244140625,
-0.94775390625,
0.09698486328125,
0.92138671875,
0.80517578125,
0.194580078125,
0.60986328125,
0.09149169921875,
0.64599609375,
0.6796875,
-0.335693359375,
0.06072998046875,
-1.0419921875,
0.578125,
0.0269012451171875,
-0.035797119140625,
-0.56884765625,
-0.40234375,
-0.184326171875,
0.32958984375,
-0.03204345703125,
-0.015167236328125,
-1.056640625,
0.35205078125,
-0.2000732421875,
0.5888671875,
-0.57568359375,
-0.251953125,
-0.0501708984375,
-0.06915283203125,
0.319091796875,
-0.83203125,
0.53955078125,
-0.66845703125,
0.8544921875,
0.297607421875,
0.17138671875,
-0.63232421875,
-0.38330078125,
-0.6015625,
-0.546875,
-0.05224609375,
0.74169921875,
0.21142578125,
0.61376953125,
-1.1923828125,
0.44287109375,
0.452880859375,
-0.193115234375,
0.344482421875,
-0.06396484375,
0.4033203125,
0.3583984375,
0.5390625,
-0.77490234375,
-0.84716796875,
0.43310546875,
-1.1689453125,
0.3623046875,
-0.4443359375,
0.099365234375,
-0.402099609375,
-0.09375,
-0.0689697265625,
0.1685791015625,
-0.384033203125,
0.3076171875,
-0.386962890625,
0.369384765625,
-0.59521484375,
-0.64453125,
0.36279296875,
0.208740234375,
-0.4970703125,
0.8603515625,
-0.1927490234375,
-0.280029296875,
-0.04522705078125,
0.47802734375,
-0.61962890625,
0.29541015625,
-0.298828125,
0.1312255859375,
-0.441162109375,
-0.66064453125,
0.1612548828125,
-0.41357421875,
0.642578125,
-0.300537109375,
-0.9287109375,
0.00582122802734375,
-1.1708984375,
0.2342529296875,
0.17724609375,
-0.642578125,
0.466796875,
0.2198486328125,
-0.173583984375,
-0.005298614501953125,
-0.5439453125,
-0.0709228515625,
-0.1695556640625,
-0.70166015625,
-0.1793212890625,
-0.0170440673828125,
0.71044921875,
0.99462890625,
-0.063720703125,
-0.54248046875,
-0.10076904296875,
0.068359375,
0.044921875,
-0.57666015625,
0.061614990234375,
-0.42333984375,
-0.09222412109375,
-0.313720703125,
0.382080078125,
-0.1214599609375,
0.311767578125,
1.1162109375,
0.43310546875,
0.304931640625,
0.29736328125,
-0.72607421875,
1.0400390625,
0.35888671875,
-0.94384765625,
-1.048828125,
0.22412109375,
-0.31494140625,
0.3154296875,
0.1866455078125,
-0.958984375,
-0.7685546875,
-1.2109375,
-0.1944580078125,
-0.87548828125,
-0.232666015625,
-0.91748046875,
-0.240478515625,
-0.09405517578125,
0.599609375,
-0.12841796875,
-0.365478515625,
0.5009765625,
-1.3681640625,
0.09112548828125,
-0.744140625,
-0.29150390625,
-0.8115234375,
0.08154296875,
-0.426513671875,
0.95458984375,
0.41796875,
0.365234375,
-0.2401123046875,
-0.40625,
0.1357421875,
-0.04107666015625,
-0.141845703125,
-0.1943359375,
-0.2237548828125,
0.309814453125,
0.252685546875,
-0.2078857421875,
-0.51171875,
0.94677734375,
-0.71435546875,
0.1453857421875,
-0.0252227783203125,
-0.40380859375,
-0.17822265625,
-0.40625,
1.13671875,
-0.52685546875,
-0.1923828125,
-0.68017578125,
0.1519775390625,
0.69189453125,
-0.5341796875,
-0.87158203125,
-0.50390625,
-0.7666015625,
-0.85107421875,
0.6865234375,
-0.34326171875,
-0.0222320556640625,
-0.6591796875,
0.07568359375,
1.037109375,
-0.681640625,
0.4072265625,
0.947265625,
0.040283203125,
0.051483154296875,
-0.78271484375,
0.5302734375,
0.364013671875,
-0.6435546875,
-0.048492431640625,
-0.20703125,
-0.53271484375,
-0.082763671875,
-0.487060546875,
-0.8076171875,
-0.875,
0.09173583984375,
1.3232421875,
-0.2666015625,
0.83251953125,
0.05853271484375,
-0.94384765625,
-0.85498046875,
0.52685546875,
0.218017578125,
0.463134765625,
1.052734375,
-0.5322265625,
0.1312255859375,
-0.048797607421875,
-0.31298828125,
-0.7919921875,
-0.5615234375,
0.8505859375,
-0.60205078125,
-0.448486328125,
0.448974609375,
1.060546875,
-0.474853515625,
-0.5458984375,
-0.15625,
-0.2626953125,
-0.41650390625,
-0.67041015625,
-0.16552734375,
0.5849609375,
-0.54052734375,
0.187744140625,
0.6416015625,
-0.036773681640625,
0.2071533203125,
0.011962890625,
0.5390625,
-0.61669921875,
0.5947265625,
0.297119140625,
-0.5458984375,
-0.137451171875,
-0.56494140625,
-0.07794189453125,
-0.159912109375,
0.09869384765625,
0.8115234375,
-0.40869140625,
-0.02001953125,
0.44677734375,
-0.1370849609375,
0.58544921875,
-0.291748046875,
-0.28466796875,
0.335693359375,
-0.873046875,
-0.45361328125,
-0.03875732421875,
0.533203125,
-0.187255859375,
0.028289794921875,
-0.62744140625,
-0.4208984375,
0.107177734375,
0.4169921875,
-0.0286102294921875,
-0.6640625,
-0.25244140625,
-0.85107421875,
-0.23046875,
-1.09765625,
-0.2325439453125,
0.09417724609375,
0.251220703125,
0.12298583984375,
-0.29150390625,
-0.03680419921875,
0.66259765625,
-0.8603515625,
1.0546875,
-0.433837890625,
0.292724609375,
-0.344970703125,
-0.5341796875,
-0.8212890625,
-0.115966796875,
-0.27001953125,
-0.03741455078125,
-0.56396484375,
0.2381591796875,
-0.298583984375,
0.7421875,
0.0438232421875,
0.31103515625,
-0.04949951171875,
-0.40234375,
0.0751953125,
0.308349609375,
-0.2445068359375,
0.2548828125,
0.58203125,
-0.085205078125,
0.034912109375,
-0.10491943359375,
-0.41015625,
-0.65673828125,
0.477294921875,
0.49560546875,
-0.0462646484375,
-0.09954833984375,
-0.1365966796875,
0.089111328125,
-1.02734375,
0.00563812255859375,
-0.435791015625,
0.4140625,
0.280517578125,
-0.6533203125,
0.49951171875,
1.0361328125,
-0.241455078125,
0.4326171875,
-0.018218994140625,
0.34326171875,
0.480712890625,
0.48681640625,
-0.10919189453125,
0.54052734375,
0.460205078125,
0.04718017578125,
-0.10791015625,
0.45166015625,
-0.1568603515625,
0.3271484375,
-0.303466796875,
-0.61279296875,
-0.96826171875,
-0.0623779296875,
0.2318115234375,
0.18359375,
0.51611328125,
-0.73291015625,
-0.064697265625,
-0.23046875,
-0.30615234375,
0.431396484375,
-1.052734375,
-0.802734375,
0.263916015625,
0.0693359375,
-0.6435546875,
-0.273681640625,
-0.494384765625,
0.00685882568359375,
-0.04730224609375,
0.25634765625,
-0.47412109375,
0.77880859375,
-0.1763916015625,
0.4970703125,
-0.73291015625,
0.028350830078125,
-0.003917694091796875,
0.67529296875,
-0.1993408203125,
-0.751953125,
0.16943359375,
1.3134765625,
0.1375732421875,
-0.19140625,
-0.60791015625,
0.43603515625,
-0.358642578125,
0.448486328125,
0.1947021484375,
0.1453857421875,
-0.1849365234375,
0.51904296875,
-1.0234375,
0.00283050537109375,
-0.140625,
0.07415771484375,
0.323974609375,
-0.5361328125,
-0.677734375,
0.86376953125,
0.9970703125,
0.041534423828125,
0.43212890625,
-0.042724609375,
0.5478515625,
-0.01155853271484375,
-0.11102294921875,
-0.377685546875,
0.76220703125,
0.3642578125,
0.55908203125,
-0.190673828125,
0.232421875,
0.646484375,
-0.2509765625,
-0.1654052734375,
0.298583984375,
0.402099609375,
0.028533935546875,
0.261474609375,
0.1597900390625,
0.026824951171875,
-0.136962890625,
-0.7080078125,
0.87744140625,
-0.55517578125,
-0.1007080078125,
-0.5009765625,
-0.91015625,
0.716796875,
-0.166015625,
-0.499267578125,
0.4609375,
-0.43603515625,
-0.0187835693359375,
0.779296875,
0.365234375,
0.428955078125,
0.68896484375,
0.60791015625,
0.615234375,
0.5126953125,
0.484619140625,
0.305419921875,
-0.57177734375,
-0.03936767578125,
-0.0322265625,
-0.0023937225341796875,
-0.0789794921875,
-0.201171875,
-0.8876953125,
0.41162109375,
-0.328369140625,
0.01470184326171875,
0.3388671875,
-0.75341796875,
-0.095947265625,
-0.348388671875,
0.7099609375,
-0.2958984375,
0.140380859375,
0.1549072265625,
-0.361572265625,
-0.311767578125,
0.60107421875,
-0.06378173828125,
0.474853515625,
0.090576171875,
0.8232421875,
0.2119140625,
1.3740234375,
0.74609375,
-0.281005859375,
0.0672607421875,
0.2462158203125,
-0.442626953125,
-0.537109375,
-0.30517578125,
-0.52392578125,
0.1937255859375,
-0.70458984375,
-0.318359375,
-0.491455078125,
0.81396484375,
-0.020416259765625,
-0.9931640625,
-0.196044921875,
0.149169921875,
-0.6533203125,
0.1376953125,
0.2197265625,
0.433837890625,
-0.52587890625,
0.10418701171875,
-0.039398193359375,
-0.453369140625,
0.446533203125,
-1.0126953125,
0.24267578125,
-0.407958984375,
-0.5498046875,
-0.35498046875,
-0.69482421875,
-0.55126953125,
-0.158935546875,
-0.40234375,
-0.8701171875,
0.40966796875,
0.283447265625,
0.2177734375,
0.403564453125,
-0.2342529296875,
0.289306640625,
1.1748046875,
1.134765625,
0.266357421875,
0.75341796875,
0.422607421875,
-0.54833984375,
0.2919921875,
-0.4873046875,
0.6416015625,
-0.056915283203125,
0.3330078125,
-0.6455078125,
0.415283203125,
-0.6484375,
-1.298828125,
-0.034912109375,
0.47119140625,
0.55615234375,
-0.623046875,
-1.142578125,
-0.2083740234375,
-0.880859375,
-0.356201171875,
-0.1837158203125,
1.1494140625,
-0.2147216796875,
0.2027587890625,
0.19921875,
-1.306640625,
4.4609375,
1.013671875,
0.9423828125,
0.251220703125,
0.3779296875,
1.103515625,
0.650390625,
-0.48681640625,
-0.50390625,
-0.1234130859375,
0.3857421875,
-0.3681640625,
-0.11187744140625,
0.7861328125,
0.039886474609375,
0.66845703125,
-0.4345703125,
0.018035888671875,
-0.179443359375,
-0.91015625,
-1.2119140625,
-0.07928466796875,
-0.1778564453125,
0.6220703125,
0.35693359375,
0.26953125,
0.251220703125,
-0.5400390625,
-0.179443359375,
-0.78759765625,
0.251708984375,
-0.822265625,
1.01953125,
0.137451171875,
-0.1304931640625,
0.6416015625,
-0.0792236328125,
-0.75146484375,
-0.090087890625,
-0.1512451171875,
-0.38720703125,
-0.138671875,
0.6416015625,
-0.58544921875,
-0.1708984375,
0.266357421875,
-0.378173828125,
0.82275390625,
0.017669677734375,
-0.85791015625,
0.89013671875,
-0.15185546875,
0.3486328125,
-0.75634765625,
-0.64892578125,
-0.0430908203125,
-0.125244140625,
-0.060089111328125,
-0.14794921875,
0.484130859375,
0.442138671875,
0.38671875,
0.333251953125,
0.59228515625,
-0.8623046875,
0.81591796875,
0.05303955078125,
0.45703125,
-0.3369140625,
-0.2822265625,
-0.321533203125,
0.1531982421875,
-0.168701171875,
-0.2479248046875,
0.56396484375,
0.04327392578125,
-0.384033203125,
0.406494140625,
0.66796875,
-1.1279296875,
0.2332763671875,
-0.148193359375,
-0.421630859375,
0.0002925395965576172,
0.6552734375,
1.2236328125,
-0.8154296875,
-0.225830078125,
-0.36083984375,
0.76025390625,
0.6064453125,
0.56396484375,
0.1947021484375,
-0.44873046875,
-0.1033935546875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The newspaper contains string t, consisting of uppercase and lowercase English letters. We know that the length of string t greater or equal to the length of the string s.
The newspaper may possibly have too few of some letters needed to make the text and too many of some other letters. That's why Tanya wants to cut some n letters out of the newspaper and make a message of length exactly n, so that it looked as much as possible like s. If the letter in some position has correct value and correct letter case (in the string s and in the string that Tanya will make), then she shouts joyfully "YAY!", and if the letter in the given position has only the correct value but it is in the wrong case, then the girl says "WHOOPS".
Tanya wants to make such message that lets her shout "YAY!" as much as possible. If there are multiple ways to do this, then her second priority is to maximize the number of times she says "WHOOPS". Your task is to help Tanya make the message.
Input
The first line contains line s (1 ≤ |s| ≤ 2·105), consisting of uppercase and lowercase English letters — the text of Tanya's message.
The second line contains line t (|s| ≤ |t| ≤ 2·105), consisting of uppercase and lowercase English letters — the text written in the newspaper.
Here |a| means the length of the string a.
Output
Print two integers separated by a space:
* the first number is the number of times Tanya shouts "YAY!" while making the message,
* the second number is the number of times Tanya says "WHOOPS" while making the message.
Examples
Input
AbC
DCbA
Output
3 0
Input
ABC
abc
Output
0 3
Input
abacaba
AbaCaBA
Output
3 4
Tags: greedy, implementation, strings
Correct Solution:
```
s1 = input()
s2 = input()
TAM = 26
a_min = ord("a")
a_mai = ord("A")
ls1_min = [0]*TAM
ls1_mai = [0]*TAM
ls2_min = [0]*TAM
ls2_mai = [0]*TAM
for letra in s1:
if letra.islower():
ls1_min[ord(letra) - a_min] += 1
else:
ls1_mai[ord(letra) - a_mai] += 1
for letra in s2:
if letra.islower():
ls2_min[ord(letra) - a_min] += 1
else:
ls2_mai[ord(letra) - a_mai] += 1
yay = 0
whoops = 0
for letra in range(TAM):
casos = min(ls1_min[letra], ls2_min[letra])
yay += casos
ls1_min[letra] -= casos
ls2_min[letra] -= casos
casos = min(ls1_mai[letra], ls2_mai[letra])
yay += casos
ls1_mai[letra] -= casos
ls2_mai[letra] -= casos
for letra in range(TAM):
casos = min(ls1_min[letra], ls2_mai[letra])
casos += min(ls1_mai[letra], ls2_min[letra])
whoops += casos
print(yay, whoops)
```
| 65,996
|
[
0.10955810546875,
0.080078125,
0.1361083984375,
0.334716796875,
-0.6494140625,
-0.865234375,
0.278076171875,
-0.1053466796875,
0.255615234375,
0.61376953125,
0.7138671875,
-0.1607666015625,
0.07293701171875,
-0.447021484375,
-0.56494140625,
-0.197998046875,
-0.55859375,
-0.470703125,
-0.420654296875,
0.088623046875,
-0.1265869140625,
0.0247039794921875,
-1.6181640625,
-0.233154296875,
-0.1920166015625,
0.77392578125,
0.607421875,
-0.01546478271484375,
1.2578125,
0.66943359375,
-0.1832275390625,
-0.03704833984375,
0.07049560546875,
-1.0419921875,
-0.329345703125,
-0.58642578125,
0.6064453125,
-0.6669921875,
-0.09197998046875,
-0.30078125,
0.380126953125,
-0.453125,
0.892578125,
-0.63232421875,
-1.1923828125,
-0.2452392578125,
-0.205078125,
-0.3623046875,
-0.0225982666015625,
-0.28466796875,
0.293212890625,
-0.393310546875,
0.328857421875,
-0.2017822265625,
0.11175537109375,
-0.0280914306640625,
-0.132568359375,
-0.2822265625,
-0.7880859375,
0.54248046875,
0.072509765625,
0.20703125,
0.1671142578125,
-0.56298828125,
0.020263671875,
-0.1611328125,
-0.247802734375,
0.0882568359375,
-0.01183319091796875,
-0.83544921875,
0.1151123046875,
0.39013671875,
-0.4501953125,
-0.474853515625,
-0.69970703125,
0.27294921875,
0.267333984375,
-0.1446533203125,
-0.98779296875,
1.0576171875,
-0.1136474609375,
0.9921875,
0.4072265625,
0.08404541015625,
-0.51318359375,
-0.5986328125,
0.23095703125,
0.04425048828125,
0.51171875,
-0.1634521484375,
-0.09600830078125,
0.51708984375,
-0.60400390625,
0.24267578125,
0.42822265625,
0.63525390625,
-0.476806640625,
0.412353515625,
0.11767578125,
0.364501953125,
0.56689453125,
0.84619140625,
-0.366943359375,
0.953125,
-0.59814453125,
0.294189453125,
0.2186279296875,
-0.3447265625,
-0.382080078125,
-0.041961669921875,
-0.368408203125,
-0.09661865234375,
0.69287109375,
0.039306640625,
-0.427001953125,
0.91064453125,
0.2861328125,
0.5283203125,
-0.6259765625,
0.22607421875,
0.5556640625,
0.127685546875,
0.5263671875,
-0.291259765625,
-0.148681640625,
-0.050018310546875,
-0.2568359375,
1.3115234375,
-0.42333984375,
-0.10992431640625,
0.311279296875,
0.040374755859375,
0.2364501953125,
0.55322265625,
-0.14013671875,
0.90966796875,
-0.552734375,
0.404541015625,
0.90771484375,
-0.5654296875,
0.4697265625,
-0.184814453125,
0.0020751953125,
1.19921875,
0.320556640625,
0.263427734375,
0.67822265625,
0.252685546875,
-1.0302734375,
0.42822265625,
-0.82177734375,
0.8212890625,
-0.2415771484375,
0.41650390625,
-0.1422119140625,
0.271240234375,
-0.255126953125,
-0.01224517822265625,
0.2685546875,
-0.1788330078125,
-0.349853515625,
0.2088623046875,
-0.7353515625,
0.92822265625,
-0.476318359375,
0.476318359375,
-0.467529296875,
-0.1468505859375,
-0.241455078125,
-0.38818359375,
0.3447265625,
-0.15380859375,
-0.41845703125,
0.82861328125,
0.41259765625,
1.06640625,
0.86865234375,
-0.420654296875,
0.382568359375,
0.13330078125,
-0.1239013671875,
0.55712890625,
0.277587890625,
0.6240234375,
0.388427734375,
-0.07379150390625,
0.05841064453125,
-0.1943359375,
-0.55517578125,
-0.61474609375,
0.329833984375,
0.455078125,
-0.54052734375,
0.34521484375,
0.08001708984375,
0.389892578125,
-0.86376953125,
-0.0177764892578125,
-0.2027587890625,
-0.986328125,
-0.359619140625,
0.62890625,
-0.189697265625,
0.66650390625,
-0.35888671875,
-0.67041015625,
0.1539306640625,
1.0830078125,
-0.331298828125,
-0.26416015625,
0.37841796875,
0.225830078125,
-0.35400390625,
0.1173095703125,
0.19580078125,
-0.346435546875,
-0.82763671875,
0.71630859375,
-0.44287109375,
0.133056640625,
0.06658935546875,
0.57568359375,
0.1656494140625,
0.53173828125,
-0.250732421875,
-0.047637939453125,
0.828125,
0.88037109375,
-0.073974609375,
0.41455078125,
0.2119140625,
0.68408203125,
0.580078125,
0.9853515625,
0.80078125,
0.481689453125,
0.54443359375,
0.6767578125,
-0.28515625,
0.00026988983154296875,
0.11932373046875,
0.226806640625,
0.2978515625,
0.755859375,
0.2493896484375,
0.55859375,
0.03802490234375,
0.017242431640625,
-0.463623046875,
0.386474609375,
-0.2161865234375,
0.6650390625,
0.304931640625,
0.80126953125,
-0.386474609375,
-0.55859375,
0.130859375,
0.9443359375,
-0.76220703125,
-0.5,
0.460205078125,
0.397216796875,
-0.028594970703125,
0.0228271484375,
0.3134765625,
0.359130859375,
0.319091796875,
0.264404296875,
-0.3916015625,
-0.9140625,
-0.818359375,
-1.009765625,
-0.724609375,
-0.264892578125,
-0.84765625,
0.026947021484375,
0.865234375,
-1.1416015625,
0.292724609375,
-0.421142578125,
-0.12359619140625,
-0.08587646484375,
-0.63720703125,
0.57275390625,
0.16162109375,
0.69970703125,
-0.5888671875,
0.533203125,
0.52587890625,
1.1953125,
-0.5986328125,
-0.1776123046875,
-0.261962890625,
-0.2432861328125,
0.457275390625,
0.1878662109375,
0.260986328125,
-0.1348876953125,
-0.72998046875,
-0.81298828125,
-0.1607666015625,
-0.0633544921875,
-0.230224609375,
-0.0312042236328125,
-0.7041015625,
0.53369140625,
0.6826171875,
-0.66943359375,
0.2296142578125,
1.3603515625,
-0.4521484375,
0.461181640625,
0.21484375,
-0.1024169921875,
-0.71435546875,
1.1171875,
0.1553955078125,
0.24609375,
-0.74169921875,
-0.2484130859375,
-0.60302734375,
0.382080078125,
0.078857421875,
-0.1868896484375,
-0.31005859375,
0.356689453125,
0.0166778564453125,
-1.1669921875,
0.52978515625,
-1.2412109375,
-0.54638671875,
-0.392578125,
-0.74560546875,
0.6640625,
0.8828125,
-0.0002834796905517578,
-0.398681640625,
0.0146942138671875,
-0.10833740234375,
0.147705078125,
0.5634765625,
-0.7919921875,
-0.06488037109375,
0.8046875,
-0.263427734375,
0.1826171875,
0.351318359375,
-0.0439453125,
-0.41357421875,
0.2393798828125,
0.51806640625,
0.5107421875,
0.1959228515625,
0.18115234375,
0.1646728515625,
0.63916015625,
-0.724609375,
-0.361328125,
-0.3896484375,
0.52294921875,
0.58349609375,
0.650390625,
0.564453125,
-0.1671142578125,
-0.5810546875,
-1.2001953125,
0.42724609375,
0.150390625,
0.62841796875,
-0.73193359375,
1.08203125,
0.0433349609375,
-0.0780029296875,
0.41845703125,
-0.5283203125,
-0.41552734375,
0.92626953125,
-0.471435546875,
0.96142578125,
-0.701171875,
0.5302734375,
-0.174560546875,
0.09930419921875,
0.341796875,
0.11822509765625,
0.464111328125,
-0.2391357421875,
-0.495849609375,
-0.52587890625,
-0.2264404296875,
-0.405517578125,
-0.7353515625,
0.344970703125,
-0.33837890625,
-0.35498046875,
-0.97314453125,
0.09588623046875,
0.923828125,
0.74365234375,
0.1690673828125,
0.58740234375,
0.0755615234375,
0.69970703125,
0.689453125,
-0.331298828125,
0.03411865234375,
-1.0224609375,
0.60205078125,
0.0936279296875,
-0.0240478515625,
-0.53076171875,
-0.385986328125,
-0.194091796875,
0.29443359375,
0.0302276611328125,
-0.0716552734375,
-1.01171875,
0.31494140625,
-0.1524658203125,
0.59619140625,
-0.55908203125,
-0.25341796875,
-0.086181640625,
-0.06988525390625,
0.3330078125,
-0.82373046875,
0.52392578125,
-0.658203125,
0.84130859375,
0.32275390625,
0.155029296875,
-0.6357421875,
-0.4130859375,
-0.587890625,
-0.52734375,
-0.06982421875,
0.7431640625,
0.261962890625,
0.57666015625,
-1.17578125,
0.4931640625,
0.458740234375,
-0.2021484375,
0.41650390625,
-0.0413818359375,
0.4033203125,
0.361328125,
0.53466796875,
-0.72802734375,
-0.8515625,
0.417236328125,
-1.181640625,
0.358642578125,
-0.423828125,
0.1392822265625,
-0.372314453125,
-0.0792236328125,
-0.08111572265625,
0.136474609375,
-0.411376953125,
0.295654296875,
-0.3916015625,
0.362060546875,
-0.58837890625,
-0.67529296875,
0.3720703125,
0.200927734375,
-0.50732421875,
0.90478515625,
-0.192626953125,
-0.315185546875,
-0.0202178955078125,
0.56396484375,
-0.64208984375,
0.31201171875,
-0.285400390625,
0.16015625,
-0.462158203125,
-0.6728515625,
0.183349609375,
-0.44287109375,
0.62548828125,
-0.277099609375,
-0.947265625,
-0.001461029052734375,
-1.1669921875,
0.250732421875,
0.1910400390625,
-0.662109375,
0.421875,
0.22314453125,
-0.15478515625,
-0.04302978515625,
-0.5517578125,
-0.076904296875,
-0.1856689453125,
-0.748046875,
-0.13037109375,
0.0245819091796875,
0.736328125,
0.92724609375,
-0.0275115966796875,
-0.56494140625,
-0.10101318359375,
0.072021484375,
0.054779052734375,
-0.51708984375,
0.084716796875,
-0.42578125,
-0.11505126953125,
-0.30810546875,
0.36328125,
-0.10040283203125,
0.35107421875,
1.111328125,
0.447021484375,
0.2958984375,
0.2705078125,
-0.69873046875,
1.0107421875,
0.342041015625,
-0.97265625,
-1.0185546875,
0.1771240234375,
-0.255126953125,
0.314208984375,
0.1922607421875,
-0.99462890625,
-0.845703125,
-1.2314453125,
-0.21337890625,
-0.8544921875,
-0.25048828125,
-0.9599609375,
-0.2432861328125,
-0.09820556640625,
0.60400390625,
-0.149169921875,
-0.39306640625,
0.491455078125,
-1.3798828125,
0.1005859375,
-0.73681640625,
-0.305908203125,
-0.783203125,
0.1229248046875,
-0.427490234375,
0.93310546875,
0.39697265625,
0.4072265625,
-0.23876953125,
-0.34326171875,
0.1744384765625,
0.0077056884765625,
-0.1617431640625,
-0.1807861328125,
-0.1734619140625,
0.3193359375,
0.2139892578125,
-0.2158203125,
-0.5048828125,
0.91357421875,
-0.7109375,
0.173095703125,
-0.034759521484375,
-0.44873046875,
-0.2081298828125,
-0.406982421875,
1.1171875,
-0.5224609375,
-0.185546875,
-0.67822265625,
0.1353759765625,
0.69189453125,
-0.56494140625,
-0.87255859375,
-0.48681640625,
-0.77783203125,
-0.81884765625,
0.6748046875,
-0.312255859375,
-0.021453857421875,
-0.63134765625,
0.04638671875,
1.0400390625,
-0.65869140625,
0.397216796875,
0.9970703125,
0.0452880859375,
0.06182861328125,
-0.76708984375,
0.5224609375,
0.370361328125,
-0.6376953125,
-0.08184814453125,
-0.14892578125,
-0.568359375,
-0.07244873046875,
-0.48388671875,
-0.7978515625,
-0.91455078125,
0.122314453125,
1.2744140625,
-0.2484130859375,
0.79931640625,
0.062744140625,
-0.9423828125,
-0.8427734375,
0.55322265625,
0.1593017578125,
0.4541015625,
1.0546875,
-0.51708984375,
0.136962890625,
-0.039825439453125,
-0.31884765625,
-0.77587890625,
-0.61376953125,
0.88671875,
-0.60400390625,
-0.4501953125,
0.470458984375,
1.087890625,
-0.474853515625,
-0.541015625,
-0.1864013671875,
-0.2271728515625,
-0.388427734375,
-0.685546875,
-0.1845703125,
0.62109375,
-0.49951171875,
0.189208984375,
0.673828125,
-0.01528167724609375,
0.246826171875,
-0.014617919921875,
0.57275390625,
-0.59765625,
0.63330078125,
0.30517578125,
-0.525390625,
-0.091552734375,
-0.5751953125,
-0.06719970703125,
-0.1678466796875,
0.10089111328125,
0.78759765625,
-0.360595703125,
-0.0733642578125,
0.484130859375,
-0.1441650390625,
0.58837890625,
-0.33349609375,
-0.269775390625,
0.320556640625,
-0.88525390625,
-0.474365234375,
-0.037872314453125,
0.54345703125,
-0.1640625,
0.043426513671875,
-0.63916015625,
-0.426513671875,
0.108154296875,
0.438232421875,
-0.036376953125,
-0.63720703125,
-0.240234375,
-0.8505859375,
-0.2166748046875,
-1.1103515625,
-0.2352294921875,
0.07513427734375,
0.1893310546875,
0.099609375,
-0.283203125,
-0.0222015380859375,
0.5732421875,
-0.89208984375,
1.03515625,
-0.451171875,
0.318115234375,
-0.37451171875,
-0.51171875,
-0.83056640625,
-0.1357421875,
-0.2890625,
-0.0012788772583007812,
-0.5419921875,
0.175537109375,
-0.2724609375,
0.7294921875,
0.0210723876953125,
0.3193359375,
-0.0253143310546875,
-0.4130859375,
0.096435546875,
0.322021484375,
-0.205322265625,
0.266357421875,
0.6279296875,
-0.05059814453125,
0.068603515625,
-0.09405517578125,
-0.414306640625,
-0.66650390625,
0.458984375,
0.51513671875,
-0.057891845703125,
-0.1107177734375,
-0.1104736328125,
0.0848388671875,
-1.0673828125,
0.0016031265258789062,
-0.4052734375,
0.4375,
0.28955078125,
-0.63916015625,
0.5126953125,
1.0400390625,
-0.239990234375,
0.456298828125,
0.03216552734375,
0.358154296875,
0.47900390625,
0.477783203125,
-0.1351318359375,
0.56591796875,
0.446533203125,
0.0579833984375,
-0.1064453125,
0.479736328125,
-0.1444091796875,
0.3603515625,
-0.3046875,
-0.5634765625,
-0.9755859375,
-0.06475830078125,
0.2001953125,
0.165771484375,
0.517578125,
-0.7509765625,
-0.0635986328125,
-0.23486328125,
-0.278564453125,
0.44384765625,
-1.0908203125,
-0.783203125,
0.2252197265625,
0.0458984375,
-0.6181640625,
-0.287109375,
-0.46142578125,
0.00983428955078125,
-0.07281494140625,
0.23486328125,
-0.48828125,
0.78173828125,
-0.1778564453125,
0.5439453125,
-0.7119140625,
0.0728759765625,
0.0081634521484375,
0.6396484375,
-0.2191162109375,
-0.734375,
0.1458740234375,
1.275390625,
0.103515625,
-0.194091796875,
-0.57568359375,
0.46337890625,
-0.360107421875,
0.4404296875,
0.2255859375,
0.200439453125,
-0.1710205078125,
0.54541015625,
-1.033203125,
-0.041839599609375,
-0.14697265625,
0.1478271484375,
0.317626953125,
-0.55078125,
-0.65673828125,
0.92822265625,
0.9658203125,
0.0491943359375,
0.4560546875,
-0.07403564453125,
0.58154296875,
-0.039459228515625,
-0.0933837890625,
-0.43603515625,
0.73486328125,
0.358154296875,
0.53271484375,
-0.20703125,
0.25927734375,
0.6162109375,
-0.267822265625,
-0.09661865234375,
0.336181640625,
0.355224609375,
0.035186767578125,
0.2705078125,
0.1754150390625,
0.04974365234375,
-0.138916015625,
-0.68310546875,
0.88134765625,
-0.60205078125,
-0.088623046875,
-0.5283203125,
-0.9794921875,
0.7412109375,
-0.183837890625,
-0.452392578125,
0.50537109375,
-0.421875,
-0.061309814453125,
0.845703125,
0.354736328125,
0.426513671875,
0.658203125,
0.60888671875,
0.61328125,
0.50341796875,
0.498779296875,
0.311767578125,
-0.57421875,
0.025726318359375,
-0.03106689453125,
-0.041412353515625,
-0.1121826171875,
-0.1644287109375,
-0.8515625,
0.37548828125,
-0.32763671875,
0.0021915435791015625,
0.37255859375,
-0.7626953125,
-0.07452392578125,
-0.326416015625,
0.71484375,
-0.26318359375,
0.13330078125,
0.1790771484375,
-0.351806640625,
-0.3154296875,
0.603515625,
-0.08306884765625,
0.4736328125,
0.107421875,
0.84326171875,
0.2093505859375,
1.3427734375,
0.7578125,
-0.273681640625,
0.061126708984375,
0.2435302734375,
-0.476806640625,
-0.4765625,
-0.26123046875,
-0.53662109375,
0.1607666015625,
-0.72998046875,
-0.3251953125,
-0.54296875,
0.86083984375,
-0.048858642578125,
-0.990234375,
-0.249755859375,
0.1968994140625,
-0.666015625,
0.10528564453125,
0.1846923828125,
0.458740234375,
-0.533203125,
0.1199951171875,
-0.09381103515625,
-0.486572265625,
0.4345703125,
-1.0224609375,
0.2340087890625,
-0.430908203125,
-0.54736328125,
-0.37451171875,
-0.7021484375,
-0.59521484375,
-0.1754150390625,
-0.339599609375,
-0.8359375,
0.424072265625,
0.263427734375,
0.237060546875,
0.412353515625,
-0.2144775390625,
0.372314453125,
1.1279296875,
1.15234375,
0.260986328125,
0.7890625,
0.44091796875,
-0.51025390625,
0.249755859375,
-0.515625,
0.62255859375,
-0.097412109375,
0.355712890625,
-0.68994140625,
0.4716796875,
-0.669921875,
-1.27734375,
-0.06756591796875,
0.458251953125,
0.5517578125,
-0.65087890625,
-1.1171875,
-0.18798828125,
-0.875,
-0.366943359375,
-0.22705078125,
1.1650390625,
-0.20263671875,
0.17236328125,
0.1351318359375,
-1.3076171875,
4.453125,
0.9931640625,
0.93505859375,
0.2275390625,
0.345458984375,
1.1201171875,
0.62890625,
-0.5087890625,
-0.54931640625,
-0.12396240234375,
0.438720703125,
-0.3720703125,
-0.1390380859375,
0.755859375,
0.08624267578125,
0.720703125,
-0.45263671875,
0.009063720703125,
-0.199951171875,
-0.9423828125,
-1.19140625,
-0.11224365234375,
-0.130615234375,
0.59375,
0.296630859375,
0.259521484375,
0.25390625,
-0.5419921875,
-0.2100830078125,
-0.8525390625,
0.268798828125,
-0.849609375,
1.021484375,
0.14892578125,
-0.11553955078125,
0.6435546875,
-0.09576416015625,
-0.7353515625,
-0.10491943359375,
-0.098876953125,
-0.4091796875,
-0.16357421875,
0.62109375,
-0.6025390625,
-0.1551513671875,
0.26318359375,
-0.349365234375,
0.82666015625,
-0.0205841064453125,
-0.8427734375,
0.90771484375,
-0.1527099609375,
0.38037109375,
-0.75244140625,
-0.7060546875,
-0.060333251953125,
-0.1253662109375,
-0.04644775390625,
-0.1387939453125,
0.4560546875,
0.42578125,
0.39990234375,
0.296142578125,
0.5576171875,
-0.90234375,
0.84765625,
0.029083251953125,
0.427978515625,
-0.361572265625,
-0.270751953125,
-0.323974609375,
0.1123046875,
-0.1787109375,
-0.25244140625,
0.55078125,
0.0280914306640625,
-0.364013671875,
0.442626953125,
0.6845703125,
-1.1357421875,
0.2509765625,
-0.1307373046875,
-0.421630859375,
0.0020694732666015625,
0.63916015625,
1.2177734375,
-0.84033203125,
-0.2049560546875,
-0.377197265625,
0.76318359375,
0.58984375,
0.60546875,
0.1610107421875,
-0.428955078125,
-0.12939453125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The newspaper contains string t, consisting of uppercase and lowercase English letters. We know that the length of string t greater or equal to the length of the string s.
The newspaper may possibly have too few of some letters needed to make the text and too many of some other letters. That's why Tanya wants to cut some n letters out of the newspaper and make a message of length exactly n, so that it looked as much as possible like s. If the letter in some position has correct value and correct letter case (in the string s and in the string that Tanya will make), then she shouts joyfully "YAY!", and if the letter in the given position has only the correct value but it is in the wrong case, then the girl says "WHOOPS".
Tanya wants to make such message that lets her shout "YAY!" as much as possible. If there are multiple ways to do this, then her second priority is to maximize the number of times she says "WHOOPS". Your task is to help Tanya make the message.
Input
The first line contains line s (1 ≤ |s| ≤ 2·105), consisting of uppercase and lowercase English letters — the text of Tanya's message.
The second line contains line t (|s| ≤ |t| ≤ 2·105), consisting of uppercase and lowercase English letters — the text written in the newspaper.
Here |a| means the length of the string a.
Output
Print two integers separated by a space:
* the first number is the number of times Tanya shouts "YAY!" while making the message,
* the second number is the number of times Tanya says "WHOOPS" while making the message.
Examples
Input
AbC
DCbA
Output
3 0
Input
ABC
abc
Output
0 3
Input
abacaba
AbaCaBA
Output
3 4
Tags: greedy, implementation, strings
Correct Solution:
```
msg = input()
letters = input()
yays = 0
whoops = 0
alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
rest = []
leaks = []
i= 0
for l in alphabet:
original = msg.count(l)
journal = letters.count(l)
if journal >= original:
yays += original
journal -= original
if (len(rest) < 26):
rest.append(journal)
leaks.append(0)
else:
rest[i%26] += journal
else:
yays += journal
original -= journal
if (len(leaks) < 26):
leaks.append(original)
rest.append(0)
else:
leaks[i%26] += original
i+=1
for i in range(26):
if rest[i] > 0 and leaks[i] > 0:
if rest[i] >= leaks[i]: whoops += leaks[i]
else: whoops += rest[i]
print(yays,whoops)
```
| 65,997
|
[
0.1424560546875,
0.13232421875,
0.11773681640625,
0.331298828125,
-0.6513671875,
-0.86669921875,
0.2587890625,
-0.138427734375,
0.26611328125,
0.59619140625,
0.685546875,
-0.1710205078125,
0.07952880859375,
-0.471435546875,
-0.57421875,
-0.2452392578125,
-0.564453125,
-0.498291015625,
-0.39697265625,
0.035736083984375,
-0.08673095703125,
-0.00023853778839111328,
-1.6611328125,
-0.2364501953125,
-0.2001953125,
0.79248046875,
0.59228515625,
-0.002346038818359375,
1.2734375,
0.65869140625,
-0.2288818359375,
-0.0286865234375,
0.072265625,
-1.0634765625,
-0.341796875,
-0.60205078125,
0.6298828125,
-0.67236328125,
-0.091796875,
-0.355224609375,
0.3505859375,
-0.463134765625,
0.84716796875,
-0.57421875,
-1.2109375,
-0.26318359375,
-0.189208984375,
-0.370849609375,
0.019073486328125,
-0.269775390625,
0.281494140625,
-0.413818359375,
0.3525390625,
-0.1800537109375,
0.09674072265625,
-0.040985107421875,
-0.09088134765625,
-0.264892578125,
-0.79150390625,
0.4833984375,
0.04595947265625,
0.256591796875,
0.1690673828125,
-0.599609375,
0.010406494140625,
-0.1583251953125,
-0.2252197265625,
0.0679931640625,
0.004062652587890625,
-0.82666015625,
0.100830078125,
0.42529296875,
-0.429443359375,
-0.51318359375,
-0.712890625,
0.266845703125,
0.276123046875,
-0.1405029296875,
-0.99267578125,
1.06640625,
-0.1319580078125,
1,
0.427001953125,
0.08795166015625,
-0.50732421875,
-0.57421875,
0.2269287109375,
0.0902099609375,
0.474853515625,
-0.1505126953125,
-0.11041259765625,
0.48486328125,
-0.60009765625,
0.244873046875,
0.4677734375,
0.609375,
-0.5048828125,
0.404541015625,
0.09686279296875,
0.370849609375,
0.59521484375,
0.83544921875,
-0.3779296875,
1.0029296875,
-0.58740234375,
0.28271484375,
0.2666015625,
-0.341064453125,
-0.431884765625,
-0.0445556640625,
-0.387939453125,
-0.07977294921875,
0.69140625,
0.047210693359375,
-0.41650390625,
0.91796875,
0.279296875,
0.51123046875,
-0.65380859375,
0.2119140625,
0.51416015625,
0.12286376953125,
0.54736328125,
-0.2451171875,
-0.1458740234375,
-0.0826416015625,
-0.2176513671875,
1.306640625,
-0.41943359375,
-0.1307373046875,
0.3154296875,
0.07501220703125,
0.2022705078125,
0.5673828125,
-0.1724853515625,
0.86083984375,
-0.5185546875,
0.401611328125,
0.91162109375,
-0.58056640625,
0.486572265625,
-0.197998046875,
0.0037097930908203125,
1.244140625,
0.324462890625,
0.2166748046875,
0.66943359375,
0.239990234375,
-1.05078125,
0.3828125,
-0.82958984375,
0.83251953125,
-0.2476806640625,
0.440673828125,
-0.1822509765625,
0.260009765625,
-0.24755859375,
0.0109710693359375,
0.337646484375,
-0.183349609375,
-0.3974609375,
0.191162109375,
-0.77099609375,
0.94140625,
-0.5224609375,
0.4951171875,
-0.471435546875,
-0.0963134765625,
-0.21875,
-0.403076171875,
0.332275390625,
-0.212646484375,
-0.4267578125,
0.82568359375,
0.37646484375,
1.060546875,
0.78857421875,
-0.423583984375,
0.383056640625,
0.1326904296875,
-0.0902099609375,
0.54150390625,
0.256103515625,
0.6044921875,
0.3740234375,
-0.0750732421875,
0.102783203125,
-0.14013671875,
-0.5703125,
-0.642578125,
0.325439453125,
0.45947265625,
-0.568359375,
0.32763671875,
0.0638427734375,
0.39208984375,
-0.87939453125,
0.007190704345703125,
-0.2034912109375,
-0.9580078125,
-0.3544921875,
0.63916015625,
-0.1690673828125,
0.65380859375,
-0.340576171875,
-0.67626953125,
0.14306640625,
1.0986328125,
-0.315185546875,
-0.24462890625,
0.37548828125,
0.2022705078125,
-0.39013671875,
0.1405029296875,
0.1883544921875,
-0.352294921875,
-0.845703125,
0.74365234375,
-0.40576171875,
0.1402587890625,
0.105224609375,
0.55859375,
0.172119140625,
0.5517578125,
-0.2266845703125,
-0.00849151611328125,
0.86962890625,
0.890625,
-0.106201171875,
0.427978515625,
0.1898193359375,
0.65185546875,
0.59423828125,
0.99072265625,
0.80712890625,
0.51220703125,
0.560546875,
0.7080078125,
-0.3349609375,
-0.0017309188842773438,
0.091796875,
0.203369140625,
0.302734375,
0.77294921875,
0.219970703125,
0.556640625,
0.0625,
0.051055908203125,
-0.46435546875,
0.40771484375,
-0.20654296875,
0.6826171875,
0.29541015625,
0.8369140625,
-0.39501953125,
-0.58056640625,
0.13916015625,
0.951171875,
-0.78759765625,
-0.52197265625,
0.459228515625,
0.373046875,
-0.03814697265625,
-0.0028400421142578125,
0.332275390625,
0.387451171875,
0.325439453125,
0.237548828125,
-0.391357421875,
-0.9208984375,
-0.8232421875,
-1.0009765625,
-0.75048828125,
-0.2225341796875,
-0.88330078125,
0.02838134765625,
0.8916015625,
-1.1474609375,
0.31640625,
-0.385498046875,
-0.126220703125,
-0.137451171875,
-0.654296875,
0.6064453125,
0.151123046875,
0.7080078125,
-0.5927734375,
0.51416015625,
0.54638671875,
1.1904296875,
-0.5625,
-0.1834716796875,
-0.2239990234375,
-0.243896484375,
0.47021484375,
0.2098388671875,
0.30078125,
-0.08074951171875,
-0.7685546875,
-0.81982421875,
-0.1656494140625,
-0.047607421875,
-0.26708984375,
0.007732391357421875,
-0.68359375,
0.5693359375,
0.7080078125,
-0.65478515625,
0.24853515625,
1.34765625,
-0.463134765625,
0.4755859375,
0.2015380859375,
-0.108154296875,
-0.6943359375,
1.1171875,
0.1309814453125,
0.29638671875,
-0.7626953125,
-0.25537109375,
-0.6123046875,
0.361572265625,
0.073486328125,
-0.1715087890625,
-0.33447265625,
0.401123046875,
0.0016994476318359375,
-1.2119140625,
0.51953125,
-1.2607421875,
-0.50146484375,
-0.41552734375,
-0.7431640625,
0.65380859375,
0.8857421875,
0.00908660888671875,
-0.340576171875,
0.006305694580078125,
-0.1365966796875,
0.116943359375,
0.55224609375,
-0.79052734375,
-0.031951904296875,
0.8095703125,
-0.258056640625,
0.2359619140625,
0.348876953125,
-0.0284881591796875,
-0.39892578125,
0.261962890625,
0.499755859375,
0.497314453125,
0.2196044921875,
0.1363525390625,
0.1787109375,
0.6337890625,
-0.70263671875,
-0.34521484375,
-0.4150390625,
0.533203125,
0.55712890625,
0.64697265625,
0.58203125,
-0.15234375,
-0.5791015625,
-1.185546875,
0.438232421875,
0.169677734375,
0.6259765625,
-0.7138671875,
1.0634765625,
0.048736572265625,
-0.1370849609375,
0.380615234375,
-0.5107421875,
-0.363037109375,
0.923828125,
-0.4560546875,
0.966796875,
-0.66259765625,
0.5078125,
-0.1441650390625,
0.1270751953125,
0.330078125,
0.1097412109375,
0.447265625,
-0.234375,
-0.5078125,
-0.54443359375,
-0.226318359375,
-0.427490234375,
-0.724609375,
0.3505859375,
-0.3447265625,
-0.399658203125,
-1,
0.0765380859375,
0.92138671875,
0.7646484375,
0.1876220703125,
0.5966796875,
0.099365234375,
0.6650390625,
0.70458984375,
-0.320556640625,
0.0660400390625,
-1.04296875,
0.59521484375,
0.0660400390625,
-0.04168701171875,
-0.53173828125,
-0.347412109375,
-0.1798095703125,
0.341552734375,
0.04132080078125,
-0.025848388671875,
-0.97509765625,
0.3427734375,
-0.1259765625,
0.5712890625,
-0.55908203125,
-0.23388671875,
-0.07366943359375,
-0.048828125,
0.29833984375,
-0.8232421875,
0.498291015625,
-0.67431640625,
0.8662109375,
0.325439453125,
0.1884765625,
-0.65087890625,
-0.369384765625,
-0.6162109375,
-0.53466796875,
-0.07293701171875,
0.74560546875,
0.27490234375,
0.595703125,
-1.1943359375,
0.52294921875,
0.473876953125,
-0.17919921875,
0.4140625,
-0.01490020751953125,
0.367431640625,
0.38134765625,
0.5390625,
-0.7783203125,
-0.84375,
0.41064453125,
-1.21875,
0.37451171875,
-0.465576171875,
0.1455078125,
-0.424072265625,
-0.0836181640625,
-0.072509765625,
0.08062744140625,
-0.415283203125,
0.26416015625,
-0.387451171875,
0.37890625,
-0.6171875,
-0.623046875,
0.360595703125,
0.256591796875,
-0.52197265625,
0.88818359375,
-0.163330078125,
-0.3076171875,
-0.012786865234375,
0.521484375,
-0.6611328125,
0.287353515625,
-0.313720703125,
0.1546630859375,
-0.47314453125,
-0.65576171875,
0.223876953125,
-0.462890625,
0.61474609375,
-0.310546875,
-0.95166015625,
-0.00397491455078125,
-1.130859375,
0.232177734375,
0.1953125,
-0.625,
0.451416015625,
0.212890625,
-0.12347412109375,
0.0034313201904296875,
-0.57177734375,
-0.06988525390625,
-0.1954345703125,
-0.7861328125,
-0.09185791015625,
0.0106964111328125,
0.71875,
0.9130859375,
-0.0333251953125,
-0.56591796875,
-0.10955810546875,
0.07269287109375,
0.048370361328125,
-0.5244140625,
0.0312347412109375,
-0.4912109375,
-0.12432861328125,
-0.33984375,
0.397705078125,
-0.12127685546875,
0.3095703125,
1.1181640625,
0.451904296875,
0.290283203125,
0.250732421875,
-0.703125,
0.99267578125,
0.35498046875,
-1.0029296875,
-1.0107421875,
0.20361328125,
-0.2685546875,
0.368408203125,
0.1978759765625,
-1.0009765625,
-0.8193359375,
-1.232421875,
-0.212890625,
-0.8955078125,
-0.2357177734375,
-0.89111328125,
-0.2451171875,
-0.1239013671875,
0.638671875,
-0.15380859375,
-0.344970703125,
0.470947265625,
-1.3505859375,
0.087890625,
-0.748046875,
-0.326416015625,
-0.7353515625,
0.08282470703125,
-0.38525390625,
0.98779296875,
0.40869140625,
0.4033203125,
-0.23974609375,
-0.309814453125,
0.1485595703125,
-0.0186767578125,
-0.1278076171875,
-0.2017822265625,
-0.1751708984375,
0.312255859375,
0.2147216796875,
-0.2012939453125,
-0.5185546875,
0.92236328125,
-0.685546875,
0.139892578125,
-0.0162353515625,
-0.406982421875,
-0.183837890625,
-0.40625,
1.0966796875,
-0.53173828125,
-0.1929931640625,
-0.65478515625,
0.1737060546875,
0.6923828125,
-0.5537109375,
-0.90185546875,
-0.482666015625,
-0.80224609375,
-0.82763671875,
0.66943359375,
-0.30224609375,
0.040008544921875,
-0.60888671875,
0.00026917457580566406,
1.03515625,
-0.63671875,
0.364990234375,
1.0087890625,
0.026092529296875,
0.058197021484375,
-0.79052734375,
0.5224609375,
0.36474609375,
-0.66064453125,
-0.07086181640625,
-0.117431640625,
-0.58837890625,
-0.1124267578125,
-0.51123046875,
-0.8115234375,
-0.92333984375,
0.0941162109375,
1.2744140625,
-0.233154296875,
0.8271484375,
0.061431884765625,
-0.91357421875,
-0.8759765625,
0.56298828125,
0.1748046875,
0.434326171875,
1.095703125,
-0.548828125,
0.1427001953125,
-0.03125,
-0.327392578125,
-0.81494140625,
-0.6015625,
0.89453125,
-0.6337890625,
-0.43017578125,
0.46923828125,
1.0458984375,
-0.49755859375,
-0.53271484375,
-0.1707763671875,
-0.2578125,
-0.346923828125,
-0.6884765625,
-0.2017822265625,
0.5927734375,
-0.47607421875,
0.2396240234375,
0.673828125,
-0.0037899017333984375,
0.2744140625,
0.0020809173583984375,
0.5458984375,
-0.60693359375,
0.658203125,
0.32958984375,
-0.54638671875,
-0.085693359375,
-0.591796875,
-0.048004150390625,
-0.1444091796875,
0.08709716796875,
0.77294921875,
-0.36767578125,
-0.0648193359375,
0.479248046875,
-0.158203125,
0.57470703125,
-0.34521484375,
-0.276611328125,
0.32373046875,
-0.87744140625,
-0.491943359375,
-0.0804443359375,
0.53125,
-0.240234375,
0.05743408203125,
-0.63134765625,
-0.428466796875,
0.1097412109375,
0.46240234375,
-0.03875732421875,
-0.64306640625,
-0.2432861328125,
-0.884765625,
-0.229248046875,
-1.087890625,
-0.24267578125,
0.08123779296875,
0.20263671875,
0.14501953125,
-0.2822265625,
0.01971435546875,
0.58154296875,
-0.8984375,
1.01171875,
-0.474365234375,
0.320068359375,
-0.35009765625,
-0.48974609375,
-0.8720703125,
-0.133544921875,
-0.31005859375,
-0.0128173828125,
-0.50927734375,
0.190185546875,
-0.279296875,
0.7255859375,
0.037933349609375,
0.3125,
0.0013780593872070312,
-0.3818359375,
0.07440185546875,
0.302978515625,
-0.1817626953125,
0.261474609375,
0.60791015625,
-0.043060302734375,
0.11016845703125,
-0.1368408203125,
-0.3681640625,
-0.65185546875,
0.4423828125,
0.51123046875,
-0.040740966796875,
-0.12335205078125,
-0.08258056640625,
0.1121826171875,
-1.046875,
0.0121612548828125,
-0.38037109375,
0.423095703125,
0.318359375,
-0.63330078125,
0.5126953125,
1.05859375,
-0.22607421875,
0.46923828125,
0.03680419921875,
0.351806640625,
0.509765625,
0.499267578125,
-0.1474609375,
0.56494140625,
0.43798828125,
0.00518035888671875,
-0.119873046875,
0.47509765625,
-0.1282958984375,
0.400146484375,
-0.2919921875,
-0.544921875,
-0.9912109375,
0.0125885009765625,
0.27587890625,
0.1455078125,
0.544921875,
-0.79296875,
-0.063720703125,
-0.234619140625,
-0.26123046875,
0.490234375,
-1.068359375,
-0.8046875,
0.2392578125,
0.0273895263671875,
-0.61328125,
-0.32861328125,
-0.4462890625,
0.0236968994140625,
-0.136474609375,
0.191650390625,
-0.470458984375,
0.79052734375,
-0.1632080078125,
0.54736328125,
-0.75048828125,
0.06658935546875,
-0.01442718505859375,
0.6572265625,
-0.17431640625,
-0.74072265625,
0.1478271484375,
1.29296875,
0.07080078125,
-0.2181396484375,
-0.61865234375,
0.46533203125,
-0.35107421875,
0.40283203125,
0.263427734375,
0.15087890625,
-0.161376953125,
0.52490234375,
-1.06640625,
-0.040069580078125,
-0.152587890625,
0.107177734375,
0.34130859375,
-0.55078125,
-0.65673828125,
0.916015625,
1.03125,
0.05194091796875,
0.42919921875,
-0.0386962890625,
0.576171875,
-0.055755615234375,
-0.07733154296875,
-0.44580078125,
0.7099609375,
0.38134765625,
0.48388671875,
-0.1915283203125,
0.25830078125,
0.60546875,
-0.320068359375,
-0.1300048828125,
0.340576171875,
0.36865234375,
-0.0163116455078125,
0.292724609375,
0.171875,
0.075927734375,
-0.1416015625,
-0.7333984375,
0.84130859375,
-0.58642578125,
-0.0972900390625,
-0.5126953125,
-0.94482421875,
0.76123046875,
-0.2215576171875,
-0.466796875,
0.49560546875,
-0.438720703125,
-0.07916259765625,
0.80078125,
0.3759765625,
0.457763671875,
0.6435546875,
0.61962890625,
0.65869140625,
0.484375,
0.486328125,
0.31201171875,
-0.56298828125,
-0.0157928466796875,
-0.00800323486328125,
-0.052337646484375,
-0.08782958984375,
-0.12109375,
-0.87353515625,
0.376220703125,
-0.343505859375,
0.005245208740234375,
0.35302734375,
-0.783203125,
-0.08428955078125,
-0.355224609375,
0.75537109375,
-0.2548828125,
0.1263427734375,
0.23193359375,
-0.314697265625,
-0.29150390625,
0.6279296875,
-0.09771728515625,
0.489013671875,
0.07586669921875,
0.85400390625,
0.2098388671875,
1.3515625,
0.7587890625,
-0.245361328125,
0.06341552734375,
0.2120361328125,
-0.49072265625,
-0.5517578125,
-0.248779296875,
-0.52685546875,
0.194580078125,
-0.736328125,
-0.358642578125,
-0.56005859375,
0.857421875,
-0.0361328125,
-0.99951171875,
-0.26953125,
0.1654052734375,
-0.63720703125,
0.180419921875,
0.176513671875,
0.4990234375,
-0.505859375,
0.11602783203125,
-0.0777587890625,
-0.454833984375,
0.4169921875,
-1.0078125,
0.189453125,
-0.46826171875,
-0.51220703125,
-0.4033203125,
-0.68359375,
-0.59521484375,
-0.1622314453125,
-0.3798828125,
-0.81640625,
0.386962890625,
0.29638671875,
0.203857421875,
0.429443359375,
-0.2210693359375,
0.410888671875,
1.1611328125,
1.14453125,
0.2166748046875,
0.7666015625,
0.427978515625,
-0.54541015625,
0.2467041015625,
-0.489990234375,
0.6376953125,
-0.10272216796875,
0.338623046875,
-0.7080078125,
0.46484375,
-0.630859375,
-1.28125,
-0.0755615234375,
0.459716796875,
0.56884765625,
-0.6826171875,
-1.1318359375,
-0.2071533203125,
-0.880859375,
-0.35205078125,
-0.195068359375,
1.1669921875,
-0.178466796875,
0.1912841796875,
0.1646728515625,
-1.3310546875,
4.4296875,
1.015625,
0.95263671875,
0.190185546875,
0.33935546875,
1.15625,
0.66259765625,
-0.482421875,
-0.576171875,
-0.1424560546875,
0.39794921875,
-0.352783203125,
-0.1072998046875,
0.748046875,
0.09075927734375,
0.748046875,
-0.4453125,
-0.01058197021484375,
-0.1680908203125,
-0.94677734375,
-1.1767578125,
-0.0731201171875,
-0.16015625,
0.576171875,
0.334228515625,
0.26953125,
0.273193359375,
-0.53515625,
-0.1927490234375,
-0.845703125,
0.24755859375,
-0.8291015625,
1.0224609375,
0.1375732421875,
-0.138427734375,
0.6787109375,
-0.08184814453125,
-0.7431640625,
-0.11798095703125,
-0.097412109375,
-0.43212890625,
-0.134033203125,
0.60205078125,
-0.59619140625,
-0.1654052734375,
0.273681640625,
-0.3388671875,
0.81103515625,
0.02703857421875,
-0.8291015625,
0.93603515625,
-0.1231689453125,
0.3583984375,
-0.78564453125,
-0.6962890625,
-0.0570068359375,
-0.135498046875,
-0.02191162109375,
-0.1748046875,
0.432861328125,
0.408935546875,
0.401611328125,
0.316162109375,
0.59716796875,
-0.9267578125,
0.853515625,
0.026397705078125,
0.39453125,
-0.380615234375,
-0.282958984375,
-0.314453125,
0.09246826171875,
-0.208740234375,
-0.26025390625,
0.5693359375,
0.0020923614501953125,
-0.327392578125,
0.41552734375,
0.67724609375,
-1.1201171875,
0.220703125,
-0.09649658203125,
-0.455810546875,
0.0269927978515625,
0.6171875,
1.2373046875,
-0.83251953125,
-0.2431640625,
-0.36083984375,
0.76171875,
0.58642578125,
0.560546875,
0.1505126953125,
-0.434814453125,
-0.124267578125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The newspaper contains string t, consisting of uppercase and lowercase English letters. We know that the length of string t greater or equal to the length of the string s.
The newspaper may possibly have too few of some letters needed to make the text and too many of some other letters. That's why Tanya wants to cut some n letters out of the newspaper and make a message of length exactly n, so that it looked as much as possible like s. If the letter in some position has correct value and correct letter case (in the string s and in the string that Tanya will make), then she shouts joyfully "YAY!", and if the letter in the given position has only the correct value but it is in the wrong case, then the girl says "WHOOPS".
Tanya wants to make such message that lets her shout "YAY!" as much as possible. If there are multiple ways to do this, then her second priority is to maximize the number of times she says "WHOOPS". Your task is to help Tanya make the message.
Input
The first line contains line s (1 ≤ |s| ≤ 2·105), consisting of uppercase and lowercase English letters — the text of Tanya's message.
The second line contains line t (|s| ≤ |t| ≤ 2·105), consisting of uppercase and lowercase English letters — the text written in the newspaper.
Here |a| means the length of the string a.
Output
Print two integers separated by a space:
* the first number is the number of times Tanya shouts "YAY!" while making the message,
* the second number is the number of times Tanya says "WHOOPS" while making the message.
Examples
Input
AbC
DCbA
Output
3 0
Input
ABC
abc
Output
0 3
Input
abacaba
AbaCaBA
Output
3 4
Tags: greedy, implementation, strings
Correct Solution:
```
def solve():
d={}
s=input()
t=input()
n=len(s)
m=len(t)
for i in range(0,26):
d[chr(ord('a')+i)]=0
d[chr(ord('A')+i)]=0
for i in range(0,m):
d[t[i]]+=1
y=0
w=0
x=[0]*n
for i in range(0,n):
if(d[s[i]]>0):
x[i]=1
y+=1
d[s[i]]-=1
for i in range(0,n):
if(x[i]):
continue
if(ord(s[i])<=ord('z') and ord(s[i])>=ord('a')):
if(d[chr(ord(s[i])-ord('a')+ord('A'))]>0):
w+=1
d[chr(ord(s[i])-ord('a')+ord('A'))]-=1
else:
if(d[chr(ord(s[i])-ord('A')+ord('a'))]>0):
w+=1
d[chr(ord(s[i])-ord('A')+ord('a'))]-=1
print(y,w)
t=1
#t=int(input())
for _ in range(t):
solve()
```
| 65,998
|
[
0.1153564453125,
0.07940673828125,
0.141845703125,
0.32861328125,
-0.60498046875,
-0.85302734375,
0.230712890625,
-0.10076904296875,
0.255126953125,
0.607421875,
0.6875,
-0.1468505859375,
0.0882568359375,
-0.43994140625,
-0.5625,
-0.17529296875,
-0.5546875,
-0.50537109375,
-0.451904296875,
0.07952880859375,
-0.12005615234375,
0.01303863525390625,
-1.6318359375,
-0.251708984375,
-0.1881103515625,
0.83154296875,
0.60302734375,
-0.0200347900390625,
1.255859375,
0.6875,
-0.185302734375,
-0.0338134765625,
0.11517333984375,
-1.0361328125,
-0.34375,
-0.55419921875,
0.60693359375,
-0.67578125,
-0.10284423828125,
-0.3154296875,
0.370361328125,
-0.446044921875,
0.86083984375,
-0.62353515625,
-1.193359375,
-0.244140625,
-0.218994140625,
-0.32421875,
-0.00267791748046875,
-0.304443359375,
0.304443359375,
-0.38916015625,
0.343505859375,
-0.1754150390625,
0.07452392578125,
-0.00927734375,
-0.1165771484375,
-0.31005859375,
-0.8125,
0.52734375,
0.08465576171875,
0.2425537109375,
0.1695556640625,
-0.55419921875,
-0.00621795654296875,
-0.1671142578125,
-0.257568359375,
0.06695556640625,
0.0121307373046875,
-0.83544921875,
0.11639404296875,
0.392822265625,
-0.396240234375,
-0.484619140625,
-0.69873046875,
0.253173828125,
0.2841796875,
-0.1346435546875,
-0.96826171875,
1.0498046875,
-0.11273193359375,
0.99560546875,
0.40625,
0.06829833984375,
-0.5185546875,
-0.61865234375,
0.212890625,
0.060333251953125,
0.52197265625,
-0.1636962890625,
-0.09381103515625,
0.50439453125,
-0.6162109375,
0.25634765625,
0.439453125,
0.65185546875,
-0.490478515625,
0.4208984375,
0.10638427734375,
0.3916015625,
0.6064453125,
0.8291015625,
-0.42724609375,
0.95849609375,
-0.62255859375,
0.252197265625,
0.22314453125,
-0.338134765625,
-0.366943359375,
-0.0083770751953125,
-0.37841796875,
-0.1060791015625,
0.6904296875,
0.06341552734375,
-0.40380859375,
0.91357421875,
0.31396484375,
0.51220703125,
-0.62841796875,
0.243408203125,
0.5478515625,
0.1522216796875,
0.53515625,
-0.285400390625,
-0.1436767578125,
-0.0626220703125,
-0.273193359375,
1.32421875,
-0.43505859375,
-0.09002685546875,
0.33740234375,
0.035858154296875,
0.23681640625,
0.517578125,
-0.135009765625,
0.88818359375,
-0.537109375,
0.423828125,
0.89794921875,
-0.5390625,
0.5048828125,
-0.19580078125,
0.002147674560546875,
1.1962890625,
0.31103515625,
0.25341796875,
0.7197265625,
0.25732421875,
-1.037109375,
0.402099609375,
-0.81201171875,
0.8251953125,
-0.256591796875,
0.439208984375,
-0.162841796875,
0.267333984375,
-0.2445068359375,
-0.0283966064453125,
0.280029296875,
-0.2025146484375,
-0.386962890625,
0.216796875,
-0.72998046875,
0.9560546875,
-0.50439453125,
0.485107421875,
-0.484375,
-0.127685546875,
-0.2115478515625,
-0.43212890625,
0.32373046875,
-0.1888427734375,
-0.42431640625,
0.86328125,
0.3759765625,
1.0615234375,
0.85693359375,
-0.40283203125,
0.373291015625,
0.123779296875,
-0.09454345703125,
0.521484375,
0.30419921875,
0.67138671875,
0.418212890625,
-0.053741455078125,
0.0704345703125,
-0.1695556640625,
-0.5888671875,
-0.61572265625,
0.334716796875,
0.41357421875,
-0.57373046875,
0.35107421875,
0.08795166015625,
0.41162109375,
-0.8896484375,
-0.033203125,
-0.2401123046875,
-0.96337890625,
-0.352294921875,
0.63427734375,
-0.203857421875,
0.66943359375,
-0.357421875,
-0.65625,
0.17431640625,
1.0634765625,
-0.2958984375,
-0.26123046875,
0.374755859375,
0.2265625,
-0.365478515625,
0.09442138671875,
0.1727294921875,
-0.334716796875,
-0.82666015625,
0.748046875,
-0.4091796875,
0.1502685546875,
0.052978515625,
0.56787109375,
0.1502685546875,
0.54052734375,
-0.2265625,
-0.06536865234375,
0.78955078125,
0.8603515625,
-0.0762939453125,
0.420166015625,
0.19482421875,
0.658203125,
0.61328125,
1.029296875,
0.81689453125,
0.483154296875,
0.54443359375,
0.6845703125,
-0.265625,
0.0112457275390625,
0.1259765625,
0.2064208984375,
0.319580078125,
0.73583984375,
0.2391357421875,
0.5615234375,
0.049468994140625,
0.035491943359375,
-0.45751953125,
0.378173828125,
-0.2125244140625,
0.68505859375,
0.287353515625,
0.81005859375,
-0.3759765625,
-0.52392578125,
0.12255859375,
0.951171875,
-0.77490234375,
-0.462158203125,
0.405517578125,
0.418212890625,
-0.0318603515625,
0.026824951171875,
0.321044921875,
0.37939453125,
0.31787109375,
0.271484375,
-0.407958984375,
-0.92236328125,
-0.85009765625,
-1.0048828125,
-0.76171875,
-0.243896484375,
-0.82958984375,
0.0207366943359375,
0.84716796875,
-1.115234375,
0.2734375,
-0.41259765625,
-0.1334228515625,
-0.06365966796875,
-0.61962890625,
0.595703125,
0.18212890625,
0.7333984375,
-0.6279296875,
0.52099609375,
0.556640625,
1.2041015625,
-0.58984375,
-0.1934814453125,
-0.21875,
-0.291015625,
0.4267578125,
0.20947265625,
0.260009765625,
-0.1424560546875,
-0.76025390625,
-0.79736328125,
-0.1640625,
-0.0282745361328125,
-0.225341796875,
-0.0308837890625,
-0.71875,
0.53564453125,
0.673828125,
-0.6279296875,
0.250732421875,
1.33984375,
-0.51025390625,
0.46142578125,
0.1844482421875,
-0.140869140625,
-0.71435546875,
1.0927734375,
0.1876220703125,
0.2548828125,
-0.7744140625,
-0.2430419921875,
-0.60107421875,
0.3857421875,
0.10076904296875,
-0.22021484375,
-0.330322265625,
0.361572265625,
0.047210693359375,
-1.171875,
0.5400390625,
-1.2509765625,
-0.5478515625,
-0.398681640625,
-0.7373046875,
0.67919921875,
0.8564453125,
0.016387939453125,
-0.368408203125,
0.050384521484375,
-0.13525390625,
0.1490478515625,
0.59716796875,
-0.7578125,
-0.00965118408203125,
0.80810546875,
-0.248779296875,
0.1746826171875,
0.3330078125,
-0.036346435546875,
-0.3896484375,
0.27001953125,
0.498291015625,
0.486572265625,
0.1893310546875,
0.1492919921875,
0.1544189453125,
0.63232421875,
-0.71875,
-0.341064453125,
-0.36962890625,
0.53857421875,
0.56298828125,
0.68701171875,
0.56298828125,
-0.20703125,
-0.56298828125,
-1.205078125,
0.435546875,
0.17626953125,
0.64990234375,
-0.720703125,
1.0537109375,
0.06903076171875,
-0.089111328125,
0.38671875,
-0.5146484375,
-0.411376953125,
0.8916015625,
-0.44775390625,
0.9990234375,
-0.681640625,
0.5283203125,
-0.1639404296875,
0.148681640625,
0.330322265625,
0.09625244140625,
0.4677734375,
-0.243896484375,
-0.51123046875,
-0.51904296875,
-0.2022705078125,
-0.36865234375,
-0.75244140625,
0.34423828125,
-0.341796875,
-0.359619140625,
-0.98193359375,
0.11669921875,
0.873046875,
0.76025390625,
0.1361083984375,
0.6357421875,
0.058807373046875,
0.68701171875,
0.708984375,
-0.30810546875,
0.050048828125,
-1.0302734375,
0.5625,
0.04876708984375,
-0.032318115234375,
-0.552734375,
-0.376953125,
-0.1746826171875,
0.317626953125,
0.035552978515625,
-0.07415771484375,
-1.037109375,
0.341552734375,
-0.1783447265625,
0.60302734375,
-0.58349609375,
-0.285888671875,
-0.07257080078125,
-0.05096435546875,
0.32177734375,
-0.84326171875,
0.5546875,
-0.6728515625,
0.82275390625,
0.31982421875,
0.157470703125,
-0.6240234375,
-0.394775390625,
-0.58837890625,
-0.5380859375,
-0.07159423828125,
0.73291015625,
0.246826171875,
0.60888671875,
-1.18359375,
0.4716796875,
0.447509765625,
-0.180419921875,
0.3896484375,
-0.037200927734375,
0.396240234375,
0.34814453125,
0.5458984375,
-0.73974609375,
-0.8583984375,
0.409423828125,
-1.16015625,
0.354736328125,
-0.40380859375,
0.11993408203125,
-0.41552734375,
-0.09442138671875,
-0.07403564453125,
0.14306640625,
-0.3876953125,
0.2685546875,
-0.366943359375,
0.366943359375,
-0.57470703125,
-0.66357421875,
0.3408203125,
0.241943359375,
-0.495361328125,
0.8740234375,
-0.1956787109375,
-0.351806640625,
-0.0030536651611328125,
0.59521484375,
-0.6435546875,
0.291015625,
-0.302734375,
0.1510009765625,
-0.4404296875,
-0.65185546875,
0.220703125,
-0.449462890625,
0.6298828125,
-0.271728515625,
-0.96044921875,
-0.0033550262451171875,
-1.166015625,
0.2420654296875,
0.172607421875,
-0.6455078125,
0.45361328125,
0.2398681640625,
-0.1798095703125,
-0.026824951171875,
-0.55419921875,
-0.09259033203125,
-0.183349609375,
-0.71142578125,
-0.1378173828125,
0.022003173828125,
0.72265625,
0.958984375,
-0.046234130859375,
-0.55517578125,
-0.1143798828125,
0.12384033203125,
0.08355712890625,
-0.5546875,
0.07208251953125,
-0.4462890625,
-0.0946044921875,
-0.366943359375,
0.35009765625,
-0.11297607421875,
0.31494140625,
1.11328125,
0.45849609375,
0.303955078125,
0.27294921875,
-0.73681640625,
0.99169921875,
0.370361328125,
-0.97802734375,
-1.08203125,
0.173828125,
-0.273193359375,
0.3212890625,
0.2364501953125,
-0.96337890625,
-0.78662109375,
-1.1904296875,
-0.2294921875,
-0.85498046875,
-0.259521484375,
-0.92333984375,
-0.291015625,
-0.11163330078125,
0.61572265625,
-0.11572265625,
-0.413818359375,
0.459228515625,
-1.3876953125,
0.08172607421875,
-0.73193359375,
-0.2939453125,
-0.82763671875,
0.09375,
-0.397705078125,
0.93212890625,
0.412353515625,
0.38720703125,
-0.23779296875,
-0.35595703125,
0.1717529296875,
-0.01776123046875,
-0.15966796875,
-0.2252197265625,
-0.1641845703125,
0.27392578125,
0.2001953125,
-0.1617431640625,
-0.5537109375,
0.91357421875,
-0.71044921875,
0.169189453125,
-0.0265045166015625,
-0.4296875,
-0.1927490234375,
-0.383056640625,
1.1474609375,
-0.490966796875,
-0.1812744140625,
-0.70947265625,
0.1605224609375,
0.7158203125,
-0.5546875,
-0.87255859375,
-0.480224609375,
-0.78759765625,
-0.853515625,
0.68798828125,
-0.334716796875,
-0.00756072998046875,
-0.63232421875,
0.0307464599609375,
1.025390625,
-0.6337890625,
0.397705078125,
0.9990234375,
0.06121826171875,
0.06805419921875,
-0.79345703125,
0.5087890625,
0.373046875,
-0.6484375,
-0.047760009765625,
-0.184326171875,
-0.5478515625,
-0.07733154296875,
-0.47900390625,
-0.78125,
-0.89404296875,
0.127197265625,
1.263671875,
-0.271484375,
0.83056640625,
0.045989990234375,
-0.96240234375,
-0.8681640625,
0.52294921875,
0.174072265625,
0.449462890625,
1.0380859375,
-0.49853515625,
0.1444091796875,
-0.0902099609375,
-0.30322265625,
-0.75048828125,
-0.6142578125,
0.876953125,
-0.5888671875,
-0.447021484375,
0.4677734375,
1.08984375,
-0.50537109375,
-0.5849609375,
-0.126708984375,
-0.2548828125,
-0.39453125,
-0.64697265625,
-0.1605224609375,
0.60205078125,
-0.5205078125,
0.2259521484375,
0.66796875,
-0.039764404296875,
0.2320556640625,
0.00011408329010009766,
0.5625,
-0.61572265625,
0.63330078125,
0.3310546875,
-0.5244140625,
-0.118408203125,
-0.56640625,
-0.0914306640625,
-0.17626953125,
0.08154296875,
0.80126953125,
-0.356689453125,
-0.081787109375,
0.449462890625,
-0.1370849609375,
0.60205078125,
-0.314208984375,
-0.32568359375,
0.28076171875,
-0.90771484375,
-0.497314453125,
-0.058258056640625,
0.5537109375,
-0.191650390625,
0.0228729248046875,
-0.611328125,
-0.3798828125,
0.11663818359375,
0.443359375,
-0.035736083984375,
-0.68505859375,
-0.2666015625,
-0.85986328125,
-0.25,
-1.1142578125,
-0.22119140625,
0.06109619140625,
0.2099609375,
0.10162353515625,
-0.29248046875,
-0.025726318359375,
0.59521484375,
-0.89501953125,
1.01171875,
-0.451171875,
0.27685546875,
-0.37646484375,
-0.55517578125,
-0.814453125,
-0.11785888671875,
-0.25830078125,
0.026214599609375,
-0.52783203125,
0.2022705078125,
-0.275634765625,
0.74267578125,
0.01873779296875,
0.30078125,
-0.0384521484375,
-0.423583984375,
0.104248046875,
0.304443359375,
-0.22412109375,
0.27001953125,
0.61767578125,
-0.0924072265625,
0.03826904296875,
-0.11993408203125,
-0.401611328125,
-0.69482421875,
0.463623046875,
0.46142578125,
-0.056732177734375,
-0.10247802734375,
-0.08868408203125,
0.07061767578125,
-1.0615234375,
0.029296875,
-0.392822265625,
0.4013671875,
0.276611328125,
-0.63525390625,
0.53076171875,
1.013671875,
-0.244140625,
0.474365234375,
0.004444122314453125,
0.36962890625,
0.478515625,
0.480224609375,
-0.1480712890625,
0.5556640625,
0.441650390625,
0.063232421875,
-0.096923828125,
0.50634765625,
-0.1595458984375,
0.337158203125,
-0.286376953125,
-0.57861328125,
-0.97705078125,
-0.06170654296875,
0.2130126953125,
0.1866455078125,
0.5126953125,
-0.76416015625,
-0.0789794921875,
-0.217529296875,
-0.2744140625,
0.447021484375,
-1.083984375,
-0.79541015625,
0.2373046875,
0.036590576171875,
-0.6513671875,
-0.281005859375,
-0.44970703125,
0.01076507568359375,
-0.0731201171875,
0.25146484375,
-0.52685546875,
0.77880859375,
-0.174560546875,
0.51123046875,
-0.72412109375,
0.04669189453125,
0.0017604827880859375,
0.6416015625,
-0.2081298828125,
-0.75,
0.130126953125,
1.322265625,
0.130126953125,
-0.18115234375,
-0.583984375,
0.4833984375,
-0.36767578125,
0.440185546875,
0.2066650390625,
0.2008056640625,
-0.2034912109375,
0.54541015625,
-1.0107421875,
-0.00888824462890625,
-0.1671142578125,
0.1351318359375,
0.308349609375,
-0.5244140625,
-0.6611328125,
0.8720703125,
0.93017578125,
0.0250396728515625,
0.487548828125,
-0.03204345703125,
0.57177734375,
-0.019500732421875,
-0.1016845703125,
-0.414306640625,
0.75048828125,
0.353515625,
0.54296875,
-0.2164306640625,
0.2122802734375,
0.6201171875,
-0.231689453125,
-0.13623046875,
0.299560546875,
0.3681640625,
0.06005859375,
0.2587890625,
0.1763916015625,
0.038055419921875,
-0.152587890625,
-0.669921875,
0.84521484375,
-0.609375,
-0.1060791015625,
-0.496826171875,
-0.98486328125,
0.73779296875,
-0.1680908203125,
-0.4462890625,
0.49267578125,
-0.42529296875,
-0.04620361328125,
0.81396484375,
0.34033203125,
0.4150390625,
0.66552734375,
0.62060546875,
0.63134765625,
0.50732421875,
0.467529296875,
0.319091796875,
-0.54833984375,
-0.044219970703125,
-0.0220184326171875,
-0.0245208740234375,
-0.09478759765625,
-0.1865234375,
-0.82861328125,
0.36669921875,
-0.360595703125,
-0.0289306640625,
0.4072265625,
-0.74609375,
-0.0947265625,
-0.3515625,
0.70068359375,
-0.27294921875,
0.137939453125,
0.2032470703125,
-0.35205078125,
-0.353759765625,
0.5986328125,
-0.0703125,
0.498046875,
0.08868408203125,
0.83935546875,
0.2025146484375,
1.3564453125,
0.75244140625,
-0.287841796875,
0.01357269287109375,
0.2286376953125,
-0.431640625,
-0.5166015625,
-0.263671875,
-0.53369140625,
0.1578369140625,
-0.77099609375,
-0.318603515625,
-0.50146484375,
0.82373046875,
-0.049041748046875,
-1.0009765625,
-0.2109375,
0.197265625,
-0.67431640625,
0.10308837890625,
0.2147216796875,
0.456298828125,
-0.5283203125,
0.13525390625,
-0.10223388671875,
-0.441162109375,
0.456298828125,
-1.0185546875,
0.2474365234375,
-0.4306640625,
-0.52978515625,
-0.386474609375,
-0.6748046875,
-0.56103515625,
-0.1514892578125,
-0.406982421875,
-0.83544921875,
0.4091796875,
0.286376953125,
0.2342529296875,
0.4287109375,
-0.206787109375,
0.352294921875,
1.19140625,
1.1591796875,
0.2529296875,
0.81396484375,
0.423095703125,
-0.51416015625,
0.255126953125,
-0.53759765625,
0.6171875,
-0.08172607421875,
0.338623046875,
-0.6689453125,
0.423583984375,
-0.646484375,
-1.28125,
-0.049591064453125,
0.49365234375,
0.578125,
-0.6318359375,
-1.1103515625,
-0.1710205078125,
-0.90869140625,
-0.3994140625,
-0.2152099609375,
1.1552734375,
-0.2080078125,
0.1746826171875,
0.1549072265625,
-1.28515625,
4.453125,
1.0224609375,
0.9443359375,
0.288330078125,
0.356201171875,
1.0673828125,
0.64501953125,
-0.52392578125,
-0.496826171875,
-0.1405029296875,
0.3798828125,
-0.3662109375,
-0.11456298828125,
0.76318359375,
0.053466796875,
0.68505859375,
-0.43408203125,
0.07415771484375,
-0.222900390625,
-0.93017578125,
-1.1943359375,
-0.05291748046875,
-0.1590576171875,
0.57568359375,
0.32275390625,
0.2587890625,
0.2359619140625,
-0.54638671875,
-0.213134765625,
-0.82421875,
0.27685546875,
-0.80810546875,
1.0419921875,
0.159912109375,
-0.093505859375,
0.65087890625,
-0.1070556640625,
-0.7177734375,
-0.1346435546875,
-0.1336669921875,
-0.40234375,
-0.14013671875,
0.642578125,
-0.57421875,
-0.1656494140625,
0.28857421875,
-0.357666015625,
0.80419921875,
-0.0154876708984375,
-0.8310546875,
0.90673828125,
-0.1500244140625,
0.36474609375,
-0.759765625,
-0.68798828125,
-0.08837890625,
-0.12408447265625,
-0.033538818359375,
-0.137939453125,
0.440673828125,
0.44970703125,
0.399169921875,
0.334716796875,
0.5625,
-0.90478515625,
0.83447265625,
0.039398193359375,
0.44677734375,
-0.368896484375,
-0.27685546875,
-0.32958984375,
0.1312255859375,
-0.152587890625,
-0.282958984375,
0.55078125,
0.0115966796875,
-0.38037109375,
0.426513671875,
0.66796875,
-1.1201171875,
0.246826171875,
-0.15966796875,
-0.440185546875,
0.0126953125,
0.65771484375,
1.2197265625,
-0.82568359375,
-0.209228515625,
-0.3759765625,
0.79736328125,
0.61328125,
0.599609375,
0.14990234375,
-0.439208984375,
-0.10504150390625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of length n, consisting of uppercase and lowercase English letters. Tanya can't write yet, so she found a newspaper and decided to cut out the letters and glue them into the postcard to achieve string s. The newspaper contains string t, consisting of uppercase and lowercase English letters. We know that the length of string t greater or equal to the length of the string s.
The newspaper may possibly have too few of some letters needed to make the text and too many of some other letters. That's why Tanya wants to cut some n letters out of the newspaper and make a message of length exactly n, so that it looked as much as possible like s. If the letter in some position has correct value and correct letter case (in the string s and in the string that Tanya will make), then she shouts joyfully "YAY!", and if the letter in the given position has only the correct value but it is in the wrong case, then the girl says "WHOOPS".
Tanya wants to make such message that lets her shout "YAY!" as much as possible. If there are multiple ways to do this, then her second priority is to maximize the number of times she says "WHOOPS". Your task is to help Tanya make the message.
Input
The first line contains line s (1 ≤ |s| ≤ 2·105), consisting of uppercase and lowercase English letters — the text of Tanya's message.
The second line contains line t (|s| ≤ |t| ≤ 2·105), consisting of uppercase and lowercase English letters — the text written in the newspaper.
Here |a| means the length of the string a.
Output
Print two integers separated by a space:
* the first number is the number of times Tanya shouts "YAY!" while making the message,
* the second number is the number of times Tanya says "WHOOPS" while making the message.
Examples
Input
AbC
DCbA
Output
3 0
Input
ABC
abc
Output
0 3
Input
abacaba
AbaCaBA
Output
3 4
Tags: greedy, implementation, strings
Correct Solution:
```
s1 = input()
s2 = input()
ms1 = [0]*26
ms2 = [0]*26
ms3 = [0]*26
ms4 = [0]*26
m = 0
n = 0
for i in range (len(s1)):
if ord(s1[i]) <= ord('Z'):
ms1[ord(s1[i])-ord('A')] += 1
else:
ms2[ord(s1[i])-ord('a')] += 1
for i in range (len(s2)):
if ord(s2[i]) <= ord('Z'):
ms3[ord(s2[i])-ord('A')] += 1
else:
ms4[ord(s2[i])-ord('a')] += 1
for i in range(len(ms1)):
if ms3[i] and ms1[i]:
mn = min(ms3[i],ms1[i])
m += mn
ms3[i] -= mn
ms1[i] -= mn
if ms2[i] and ms4[i]:
mn = min(ms2[i],ms4[i])
m += mn
ms2[i] -= mn
ms4[i] -= mn
for i in range (len(ms1)):
if ms3[i] and ms2[i]:
mn = min(ms2[i],ms3[i])
n += mn
ms3[i] -= mn
ms2[i] -= mn
if ms1[i] and ms4[i]:
mn = min(ms1[i],ms4[i])
n += mn
ms1[i] -= mn
ms4[i] -= mn
print(m, n)
```
| 65,999
|
[
0.11883544921875,
0.10205078125,
0.1512451171875,
0.32470703125,
-0.6240234375,
-0.8623046875,
0.264404296875,
-0.127197265625,
0.2401123046875,
0.6220703125,
0.7080078125,
-0.157470703125,
0.0772705078125,
-0.4638671875,
-0.55615234375,
-0.2000732421875,
-0.552734375,
-0.4931640625,
-0.434326171875,
0.085205078125,
-0.126220703125,
0.0022792816162109375,
-1.6181640625,
-0.2333984375,
-0.1934814453125,
0.81982421875,
0.6162109375,
-0.003696441650390625,
1.2451171875,
0.68212890625,
-0.1905517578125,
-0.0406494140625,
0.10113525390625,
-1.037109375,
-0.34423828125,
-0.57470703125,
0.60302734375,
-0.6689453125,
-0.091796875,
-0.315673828125,
0.37109375,
-0.44580078125,
0.8671875,
-0.61669921875,
-1.1875,
-0.2666015625,
-0.2203369140625,
-0.338134765625,
-0.01904296875,
-0.308837890625,
0.288818359375,
-0.391357421875,
0.343994140625,
-0.1785888671875,
0.0897216796875,
-0.01099395751953125,
-0.11920166015625,
-0.295654296875,
-0.80908203125,
0.52490234375,
0.06890869140625,
0.2288818359375,
0.16845703125,
-0.5634765625,
0.0169219970703125,
-0.1531982421875,
-0.22607421875,
0.07171630859375,
0.017578125,
-0.83203125,
0.0953369140625,
0.376953125,
-0.4384765625,
-0.48779296875,
-0.701171875,
0.278076171875,
0.27978515625,
-0.11822509765625,
-0.98876953125,
1.0634765625,
-0.1275634765625,
0.99169921875,
0.41650390625,
0.0941162109375,
-0.5224609375,
-0.61767578125,
0.2113037109375,
0.040435791015625,
0.5087890625,
-0.1719970703125,
-0.096923828125,
0.486572265625,
-0.595703125,
0.2388916015625,
0.432861328125,
0.650390625,
-0.48388671875,
0.412841796875,
0.1080322265625,
0.376220703125,
0.5791015625,
0.81884765625,
-0.406494140625,
0.97021484375,
-0.60205078125,
0.294189453125,
0.241455078125,
-0.35205078125,
-0.385009765625,
-0.048797607421875,
-0.39501953125,
-0.08758544921875,
0.68701171875,
0.04193115234375,
-0.411865234375,
0.93310546875,
0.2919921875,
0.51953125,
-0.63037109375,
0.2357177734375,
0.55712890625,
0.1358642578125,
0.52294921875,
-0.296630859375,
-0.1513671875,
-0.073974609375,
-0.2454833984375,
1.306640625,
-0.43310546875,
-0.1143798828125,
0.308349609375,
0.053131103515625,
0.223388671875,
0.52880859375,
-0.14013671875,
0.90478515625,
-0.552734375,
0.40576171875,
0.8935546875,
-0.55712890625,
0.498291015625,
-0.1888427734375,
-0.018096923828125,
1.2197265625,
0.317138671875,
0.2423095703125,
0.68505859375,
0.2626953125,
-1.0283203125,
0.405517578125,
-0.828125,
0.82373046875,
-0.248291015625,
0.409423828125,
-0.1466064453125,
0.275634765625,
-0.261962890625,
-0.03155517578125,
0.255615234375,
-0.1885986328125,
-0.373779296875,
0.2012939453125,
-0.7548828125,
0.95556640625,
-0.474853515625,
0.484375,
-0.478515625,
-0.16064453125,
-0.2286376953125,
-0.410888671875,
0.322998046875,
-0.18359375,
-0.42138671875,
0.84130859375,
0.39306640625,
1.0673828125,
0.84521484375,
-0.40478515625,
0.37109375,
0.12548828125,
-0.12493896484375,
0.5546875,
0.282958984375,
0.6298828125,
0.396484375,
-0.058929443359375,
0.0687255859375,
-0.20361328125,
-0.57373046875,
-0.611328125,
0.336669921875,
0.4248046875,
-0.55712890625,
0.365966796875,
0.08245849609375,
0.39892578125,
-0.896484375,
-0.007175445556640625,
-0.223876953125,
-0.96240234375,
-0.36865234375,
0.654296875,
-0.178955078125,
0.66650390625,
-0.3642578125,
-0.66259765625,
0.1739501953125,
1.09765625,
-0.29150390625,
-0.25341796875,
0.383544921875,
0.222412109375,
-0.35693359375,
0.1212158203125,
0.1754150390625,
-0.347900390625,
-0.83203125,
0.72998046875,
-0.40771484375,
0.15234375,
0.04681396484375,
0.57275390625,
0.1505126953125,
0.54345703125,
-0.259521484375,
-0.053863525390625,
0.82177734375,
0.88720703125,
-0.07379150390625,
0.411376953125,
0.2071533203125,
0.68408203125,
0.60205078125,
1.0087890625,
0.81201171875,
0.48291015625,
0.5498046875,
0.68701171875,
-0.298583984375,
-0.005428314208984375,
0.1014404296875,
0.2156982421875,
0.309814453125,
0.75439453125,
0.2459716796875,
0.55517578125,
0.034759521484375,
0.0266265869140625,
-0.47216796875,
0.391357421875,
-0.2115478515625,
0.67919921875,
0.29931640625,
0.8115234375,
-0.363525390625,
-0.55908203125,
0.1307373046875,
0.958984375,
-0.7890625,
-0.4658203125,
0.443115234375,
0.4130859375,
-0.0213470458984375,
0.035675048828125,
0.303955078125,
0.35693359375,
0.328857421875,
0.25146484375,
-0.38916015625,
-0.9189453125,
-0.8076171875,
-1.01171875,
-0.7294921875,
-0.2418212890625,
-0.8359375,
0.01446533203125,
0.84814453125,
-1.1416015625,
0.29443359375,
-0.436279296875,
-0.12091064453125,
-0.09521484375,
-0.630859375,
0.58642578125,
0.1588134765625,
0.7001953125,
-0.59814453125,
0.52099609375,
0.50732421875,
1.1962890625,
-0.580078125,
-0.1749267578125,
-0.2310791015625,
-0.2476806640625,
0.4501953125,
0.183349609375,
0.25537109375,
-0.1483154296875,
-0.73974609375,
-0.80712890625,
-0.1702880859375,
-0.050140380859375,
-0.252197265625,
-0.0192413330078125,
-0.697265625,
0.51708984375,
0.6806640625,
-0.6513671875,
0.2484130859375,
1.35546875,
-0.4951171875,
0.440673828125,
0.1998291015625,
-0.12939453125,
-0.7021484375,
1.0947265625,
0.1673583984375,
0.26025390625,
-0.75537109375,
-0.2459716796875,
-0.6103515625,
0.3896484375,
0.09674072265625,
-0.1876220703125,
-0.3271484375,
0.365966796875,
0.032135009765625,
-1.1611328125,
0.5478515625,
-1.2607421875,
-0.5263671875,
-0.39599609375,
-0.7412109375,
0.68896484375,
0.8740234375,
0.004039764404296875,
-0.382080078125,
0.01360321044921875,
-0.1112060546875,
0.154052734375,
0.58740234375,
-0.7705078125,
-0.045013427734375,
0.8017578125,
-0.27197265625,
0.1910400390625,
0.3408203125,
-0.047088623046875,
-0.412841796875,
0.25,
0.50341796875,
0.50439453125,
0.1959228515625,
0.1650390625,
0.1512451171875,
0.64453125,
-0.720703125,
-0.33837890625,
-0.387939453125,
0.5361328125,
0.55224609375,
0.6708984375,
0.56005859375,
-0.18701171875,
-0.5634765625,
-1.212890625,
0.431884765625,
0.158935546875,
0.6279296875,
-0.72412109375,
1.0595703125,
0.05853271484375,
-0.0919189453125,
0.4091796875,
-0.515625,
-0.41015625,
0.916015625,
-0.475830078125,
0.96728515625,
-0.6826171875,
0.5283203125,
-0.1710205078125,
0.1065673828125,
0.34326171875,
0.1240234375,
0.468017578125,
-0.225830078125,
-0.521484375,
-0.50927734375,
-0.2144775390625,
-0.388916015625,
-0.7412109375,
0.3330078125,
-0.33837890625,
-0.36279296875,
-0.9677734375,
0.09527587890625,
0.9091796875,
0.7412109375,
0.17529296875,
0.609375,
0.053497314453125,
0.68798828125,
0.689453125,
-0.310546875,
0.04132080078125,
-1.033203125,
0.61083984375,
0.08245849609375,
-0.0176239013671875,
-0.525390625,
-0.366943359375,
-0.1787109375,
0.3154296875,
0.035888671875,
-0.0650634765625,
-1.0302734375,
0.3251953125,
-0.18408203125,
0.5927734375,
-0.572265625,
-0.264404296875,
-0.07000732421875,
-0.06256103515625,
0.331298828125,
-0.84765625,
0.53955078125,
-0.65087890625,
0.8369140625,
0.31787109375,
0.1585693359375,
-0.64013671875,
-0.391357421875,
-0.5986328125,
-0.5478515625,
-0.059051513671875,
0.751953125,
0.2587890625,
0.59375,
-1.177734375,
0.474365234375,
0.447021484375,
-0.1912841796875,
0.393798828125,
-0.0323486328125,
0.40283203125,
0.349853515625,
0.52392578125,
-0.732421875,
-0.8662109375,
0.407470703125,
-1.18359375,
0.366455078125,
-0.4248046875,
0.1329345703125,
-0.390869140625,
-0.08966064453125,
-0.077880859375,
0.139892578125,
-0.402099609375,
0.282470703125,
-0.37109375,
0.37744140625,
-0.59521484375,
-0.65576171875,
0.33349609375,
0.2276611328125,
-0.489013671875,
0.89306640625,
-0.19384765625,
-0.3232421875,
-0.00439453125,
0.556640625,
-0.634765625,
0.327880859375,
-0.286376953125,
0.13427734375,
-0.45068359375,
-0.6591796875,
0.1895751953125,
-0.432373046875,
0.62841796875,
-0.29443359375,
-0.94580078125,
0.0030727386474609375,
-1.16796875,
0.246826171875,
0.177734375,
-0.6494140625,
0.420654296875,
0.238525390625,
-0.16357421875,
-0.015380859375,
-0.56982421875,
-0.0885009765625,
-0.162841796875,
-0.740234375,
-0.1475830078125,
0.019317626953125,
0.72265625,
0.93505859375,
-0.039642333984375,
-0.5576171875,
-0.09600830078125,
0.0623779296875,
0.049468994140625,
-0.533203125,
0.0755615234375,
-0.425537109375,
-0.10791015625,
-0.352783203125,
0.36376953125,
-0.1123046875,
0.32470703125,
1.095703125,
0.44287109375,
0.287109375,
0.27587890625,
-0.72265625,
1.0205078125,
0.37255859375,
-0.9677734375,
-1.0283203125,
0.198974609375,
-0.283447265625,
0.332275390625,
0.2193603515625,
-0.986328125,
-0.8037109375,
-1.212890625,
-0.2064208984375,
-0.8623046875,
-0.255126953125,
-0.939453125,
-0.289306640625,
-0.12017822265625,
0.62744140625,
-0.1279296875,
-0.39892578125,
0.490234375,
-1.3837890625,
0.10101318359375,
-0.73681640625,
-0.307373046875,
-0.78759765625,
0.10137939453125,
-0.40234375,
0.9423828125,
0.384521484375,
0.405029296875,
-0.229736328125,
-0.365966796875,
0.1761474609375,
0.0076141357421875,
-0.1724853515625,
-0.19580078125,
-0.1900634765625,
0.312744140625,
0.2100830078125,
-0.189208984375,
-0.5078125,
0.9248046875,
-0.71142578125,
0.1932373046875,
-0.033721923828125,
-0.41845703125,
-0.2105712890625,
-0.3779296875,
1.130859375,
-0.52001953125,
-0.1727294921875,
-0.68212890625,
0.1505126953125,
0.68896484375,
-0.53076171875,
-0.85791015625,
-0.46826171875,
-0.7783203125,
-0.8310546875,
0.6796875,
-0.31689453125,
-0.003955841064453125,
-0.63818359375,
0.041351318359375,
1.0654296875,
-0.64404296875,
0.41845703125,
0.99072265625,
0.06976318359375,
0.06866455078125,
-0.79736328125,
0.51171875,
0.37158203125,
-0.654296875,
-0.056976318359375,
-0.177001953125,
-0.5546875,
-0.0943603515625,
-0.489501953125,
-0.79345703125,
-0.90673828125,
0.1220703125,
1.2841796875,
-0.261474609375,
0.82763671875,
0.031494140625,
-0.943359375,
-0.83251953125,
0.54833984375,
0.1522216796875,
0.4560546875,
1.0673828125,
-0.52001953125,
0.1495361328125,
-0.06109619140625,
-0.339599609375,
-0.76611328125,
-0.6240234375,
0.869140625,
-0.61279296875,
-0.439453125,
0.481689453125,
1.0517578125,
-0.48974609375,
-0.5859375,
-0.169189453125,
-0.252685546875,
-0.3916015625,
-0.673828125,
-0.1817626953125,
0.59619140625,
-0.50634765625,
0.210205078125,
0.6650390625,
-0.0477294921875,
0.233154296875,
-0.0012416839599609375,
0.5634765625,
-0.61474609375,
0.64599609375,
0.32666015625,
-0.5244140625,
-0.11370849609375,
-0.5869140625,
-0.08367919921875,
-0.1531982421875,
0.1043701171875,
0.78564453125,
-0.3701171875,
-0.055877685546875,
0.47900390625,
-0.143310546875,
0.6181640625,
-0.332763671875,
-0.28662109375,
0.304443359375,
-0.8837890625,
-0.4892578125,
-0.04901123046875,
0.5400390625,
-0.18701171875,
0.056427001953125,
-0.63330078125,
-0.406494140625,
0.12152099609375,
0.445068359375,
-0.03668212890625,
-0.689453125,
-0.2467041015625,
-0.84765625,
-0.2396240234375,
-1.10546875,
-0.2279052734375,
0.08221435546875,
0.1993408203125,
0.0966796875,
-0.2841796875,
-0.03338623046875,
0.59375,
-0.87939453125,
1.0224609375,
-0.463134765625,
0.307373046875,
-0.350341796875,
-0.5068359375,
-0.83056640625,
-0.1397705078125,
-0.282470703125,
-0.0172271728515625,
-0.505859375,
0.1961669921875,
-0.27880859375,
0.71826171875,
0.0034389495849609375,
0.326171875,
-0.02203369140625,
-0.4052734375,
0.08905029296875,
0.30419921875,
-0.21337890625,
0.27490234375,
0.61279296875,
-0.07733154296875,
0.0650634765625,
-0.10601806640625,
-0.40087890625,
-0.646484375,
0.47021484375,
0.5126953125,
-0.04571533203125,
-0.10235595703125,
-0.117431640625,
0.09259033203125,
-1.0537109375,
0.01036834716796875,
-0.395751953125,
0.42578125,
0.2998046875,
-0.6318359375,
0.52783203125,
1.0205078125,
-0.2498779296875,
0.461669921875,
0.0218048095703125,
0.360595703125,
0.465087890625,
0.497314453125,
-0.1671142578125,
0.55517578125,
0.463134765625,
0.06488037109375,
-0.11456298828125,
0.45849609375,
-0.160400390625,
0.347412109375,
-0.306884765625,
-0.5673828125,
-0.99755859375,
-0.0548095703125,
0.2109375,
0.186767578125,
0.54150390625,
-0.7431640625,
-0.06378173828125,
-0.220458984375,
-0.292236328125,
0.45263671875,
-1.0966796875,
-0.8076171875,
0.2437744140625,
0.041412353515625,
-0.6435546875,
-0.282958984375,
-0.453125,
0.0184173583984375,
-0.065185546875,
0.23388671875,
-0.49951171875,
0.80126953125,
-0.154296875,
0.5126953125,
-0.7138671875,
0.0679931640625,
0.003993988037109375,
0.646484375,
-0.2227783203125,
-0.73828125,
0.1358642578125,
1.3046875,
0.1070556640625,
-0.198974609375,
-0.58740234375,
0.45556640625,
-0.36083984375,
0.42529296875,
0.2196044921875,
0.2015380859375,
-0.179931640625,
0.53662109375,
-1.03515625,
-0.05596923828125,
-0.14990234375,
0.12347412109375,
0.3291015625,
-0.53662109375,
-0.65966796875,
0.90771484375,
0.97119140625,
0.031036376953125,
0.490478515625,
-0.04681396484375,
0.57861328125,
-0.0291748046875,
-0.0859375,
-0.41748046875,
0.75390625,
0.368408203125,
0.53759765625,
-0.196044921875,
0.2509765625,
0.6044921875,
-0.26123046875,
-0.1217041015625,
0.316162109375,
0.3720703125,
0.030914306640625,
0.271240234375,
0.169921875,
0.056640625,
-0.146728515625,
-0.68359375,
0.857421875,
-0.60400390625,
-0.09527587890625,
-0.51123046875,
-0.97509765625,
0.751953125,
-0.172607421875,
-0.46044921875,
0.484375,
-0.42236328125,
-0.029571533203125,
0.8212890625,
0.365478515625,
0.41943359375,
0.66650390625,
0.611328125,
0.63232421875,
0.5068359375,
0.49560546875,
0.30859375,
-0.55712890625,
-0.0030040740966796875,
-0.03472900390625,
-0.035888671875,
-0.10858154296875,
-0.1690673828125,
-0.85791015625,
0.394287109375,
-0.35693359375,
-0.009674072265625,
0.374267578125,
-0.76416015625,
-0.080810546875,
-0.33349609375,
0.734375,
-0.264892578125,
0.1201171875,
0.188720703125,
-0.3525390625,
-0.322509765625,
0.62060546875,
-0.07208251953125,
0.49365234375,
0.07916259765625,
0.84326171875,
0.2012939453125,
1.3583984375,
0.771484375,
-0.2958984375,
0.0599365234375,
0.23193359375,
-0.447998046875,
-0.505859375,
-0.26904296875,
-0.5380859375,
0.1617431640625,
-0.72705078125,
-0.31689453125,
-0.521484375,
0.83154296875,
-0.0352783203125,
-1.0078125,
-0.228759765625,
0.1793212890625,
-0.67529296875,
0.1102294921875,
0.1998291015625,
0.455810546875,
-0.5283203125,
0.12481689453125,
-0.09088134765625,
-0.4697265625,
0.4267578125,
-0.9990234375,
0.2332763671875,
-0.435302734375,
-0.52099609375,
-0.403076171875,
-0.67333984375,
-0.57861328125,
-0.1495361328125,
-0.367431640625,
-0.82958984375,
0.423828125,
0.264404296875,
0.2230224609375,
0.429443359375,
-0.227783203125,
0.363525390625,
1.166015625,
1.138671875,
0.24755859375,
0.80224609375,
0.43603515625,
-0.5166015625,
0.2568359375,
-0.521484375,
0.62744140625,
-0.1038818359375,
0.353759765625,
-0.68310546875,
0.456787109375,
-0.66064453125,
-1.2783203125,
-0.06719970703125,
0.4599609375,
0.55615234375,
-0.6494140625,
-1.1298828125,
-0.1964111328125,
-0.896484375,
-0.372314453125,
-0.2406005859375,
1.1650390625,
-0.209228515625,
0.1868896484375,
0.1373291015625,
-1.3095703125,
4.4453125,
1.0234375,
0.93359375,
0.245849609375,
0.345703125,
1.1015625,
0.65185546875,
-0.509765625,
-0.5322265625,
-0.11090087890625,
0.39990234375,
-0.357177734375,
-0.1258544921875,
0.76123046875,
0.077880859375,
0.7138671875,
-0.468994140625,
0.00684356689453125,
-0.194091796875,
-0.93310546875,
-1.1767578125,
-0.068359375,
-0.1434326171875,
0.6015625,
0.308349609375,
0.267578125,
0.25341796875,
-0.5537109375,
-0.202880859375,
-0.83740234375,
0.2578125,
-0.8203125,
1.025390625,
0.158203125,
-0.10882568359375,
0.6591796875,
-0.11126708984375,
-0.7265625,
-0.1318359375,
-0.130126953125,
-0.404052734375,
-0.1522216796875,
0.61962890625,
-0.57568359375,
-0.1829833984375,
0.2734375,
-0.353515625,
0.81103515625,
-0.0115814208984375,
-0.8662109375,
0.91015625,
-0.135009765625,
0.360107421875,
-0.7607421875,
-0.70654296875,
-0.07696533203125,
-0.12493896484375,
-0.018280029296875,
-0.14453125,
0.453369140625,
0.4287109375,
0.407470703125,
0.29541015625,
0.5693359375,
-0.89794921875,
0.8515625,
0.017791748046875,
0.44921875,
-0.366455078125,
-0.27099609375,
-0.3349609375,
0.1373291015625,
-0.1624755859375,
-0.256591796875,
0.5458984375,
0.0277557373046875,
-0.365478515625,
0.433837890625,
0.68798828125,
-1.115234375,
0.2232666015625,
-0.1341552734375,
-0.422607421875,
0.0198516845703125,
0.64111328125,
1.23828125,
-0.8427734375,
-0.2244873046875,
-0.371337890625,
0.77197265625,
0.58349609375,
0.61376953125,
0.16162109375,
-0.435302734375,
-0.1358642578125
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
Input
A text is given in a line. You can assume the following conditions:
* The number of letters in the text is less than or equal to 1000.
* The number of letters in a word is less than or equal to 32.
* There is only one word which is arise most frequently in given text.
* There is only one word which has the maximum number of letters in given text.
Output
The two words separated by a space.
Example
Input
Thank you for your mail and your lectures
Output
your lectures
"Correct Solution:
```
x = list(input().split())
print(max(x,key=x.count), max(x,key=len))
```
| 66,370
|
[
0.4619140625,
0.03857421875,
0.06280517578125,
0.402587890625,
-0.630859375,
-0.55908203125,
-0.2130126953125,
0.38818359375,
0.044158935546875,
1.04296875,
0.392578125,
0.1240234375,
-0.0697021484375,
-0.52880859375,
-0.6796875,
-0.2156982421875,
-0.54931640625,
-1.0751953125,
-0.319580078125,
-0.044097900390625,
-0.23046875,
0.6474609375,
-1.4091796875,
-0.131591796875,
-0.304443359375,
0.861328125,
0.468505859375,
-0.051788330078125,
1.150390625,
1.171875,
-0.1943359375,
-0.364990234375,
0.2310791015625,
-1.0478515625,
-0.367431640625,
-0.317626953125,
0.91455078125,
-1.0380859375,
-0.333740234375,
-0.74951171875,
0.206298828125,
-0.79541015625,
0.74951171875,
-0.91259765625,
-1.1845703125,
0.0926513671875,
-0.0936279296875,
-0.330322265625,
-0.29638671875,
-0.466796875,
0.06280517578125,
-0.480712890625,
0.439453125,
-0.2215576171875,
-0.1361083984375,
-0.0248870849609375,
-0.051483154296875,
-0.2509765625,
-0.361328125,
0.305419921875,
0.447509765625,
0.61767578125,
0.048614501953125,
-0.58642578125,
-0.466064453125,
0.419189453125,
-0.1312255859375,
0.0231475830078125,
0.1898193359375,
-0.258056640625,
-0.0423583984375,
0.16943359375,
-0.1290283203125,
-0.300048828125,
-0.64453125,
-0.188232421875,
0.22119140625,
-0.217041015625,
-0.48681640625,
1.0283203125,
0.2109375,
0.69287109375,
0.307373046875,
0.380859375,
-0.859375,
-0.57568359375,
0.10809326171875,
-0.1788330078125,
0.328125,
-0.625,
-0.465087890625,
0.3779296875,
-0.432861328125,
0.3515625,
0.8203125,
0.406494140625,
-0.51953125,
0.1634521484375,
0.46923828125,
0.62744140625,
0.7314453125,
1.0283203125,
-0.451416015625,
0.9736328125,
-0.583984375,
0.203125,
0.5830078125,
-0.135986328125,
-0.108642578125,
-0.0238189697265625,
-0.53759765625,
0.05706787109375,
0.666015625,
0.2403564453125,
-0.33544921875,
0.9833984375,
0.005802154541015625,
0.54248046875,
-0.78857421875,
0.59326171875,
0.45361328125,
0.3857421875,
0.21826171875,
-0.4716796875,
0.045379638671875,
-0.52587890625,
-0.6904296875,
1.0283203125,
-0.301513671875,
-0.1634521484375,
0.11651611328125,
-0.1168212890625,
-0.29931640625,
0.72705078125,
0.04669189453125,
0.7041015625,
0.068115234375,
0.451416015625,
0.728515625,
-0.58544921875,
0.837890625,
-0.302490234375,
0.153076171875,
1.6103515625,
0.302734375,
0.07855224609375,
0.60546875,
0.568359375,
-0.72998046875,
0.56787109375,
-1.3056640625,
1.1630859375,
-0.451416015625,
0.57861328125,
-0.366455078125,
-0.06451416015625,
-0.05401611328125,
-0.01320648193359375,
0.0511474609375,
-0.0860595703125,
-0.054473876953125,
0.296875,
-0.297119140625,
0.93701171875,
-0.2744140625,
0.7490234375,
-0.541015625,
-0.137451171875,
-0.267822265625,
-0.09942626953125,
0.2091064453125,
-0.31201171875,
0.0933837890625,
0.7744140625,
0.2308349609375,
0.94921875,
0.9130859375,
-0.55615234375,
0.3095703125,
0.2431640625,
-0.68359375,
0.0986328125,
0.04010009765625,
0.52392578125,
0.26806640625,
0.4560546875,
0.052276611328125,
-0.03289794921875,
-0.666015625,
-0.476318359375,
0.298095703125,
0.83837890625,
-0.919921875,
-0.1861572265625,
-0.1505126953125,
0.06097412109375,
-0.58154296875,
0.1357421875,
-0.1063232421875,
-0.88330078125,
-0.5419921875,
0.6826171875,
0.11944580078125,
0.57275390625,
-0.4404296875,
-0.5380859375,
0.238037109375,
1.3828125,
-0.476806640625,
0.1580810546875,
0.7880859375,
0.1431884765625,
-0.03851318359375,
0.14599609375,
0.40869140625,
-0.0003383159637451172,
-1.14453125,
0.751953125,
-0.6787109375,
-0.1427001953125,
0.177978515625,
0.58740234375,
0.3349609375,
0.424560546875,
-0.50146484375,
-0.4560546875,
0.45654296875,
1.2607421875,
0.031890869140625,
0.87060546875,
0.0287628173828125,
1.0830078125,
0.34716796875,
0.7138671875,
0.39794921875,
0.234619140625,
0.7861328125,
0.66943359375,
-0.285888671875,
0.1500244140625,
-0.1414794921875,
0.5322265625,
0.447509765625,
1.099609375,
0.0504150390625,
0.70166015625,
-0.6533203125,
-0.156494140625,
-0.2919921875,
0.85302734375,
-0.15234375,
0.525390625,
0.1712646484375,
0.26025390625,
-0.76123046875,
-0.3251953125,
0.40673828125,
1.0595703125,
-0.99267578125,
-0.5546875,
-0.388916015625,
0.1087646484375,
0.2384033203125,
0.2174072265625,
0.047027587890625,
0.375732421875,
0.60107421875,
0.65576171875,
-0.50634765625,
-0.374267578125,
-0.72412109375,
-0.8134765625,
-1.0810546875,
-0.7734375,
-0.7294921875,
-0.09661865234375,
0.10552978515625,
-0.732421875,
-0.04400634765625,
-0.326904296875,
-0.595703125,
-0.303466796875,
-0.40771484375,
0.451904296875,
-0.65625,
0.7265625,
-0.51025390625,
0.40087890625,
0.259521484375,
1.3115234375,
-0.8046875,
-0.38671875,
-0.35107421875,
-0.51220703125,
0.482421875,
0.1790771484375,
0.473876953125,
0.277099609375,
-0.64599609375,
-0.90673828125,
-0.41064453125,
-0.273681640625,
-0.389404296875,
0.299560546875,
-0.68310546875,
1.0302734375,
0.130126953125,
-0.69091796875,
0.499267578125,
1.2236328125,
-0.90576171875,
0.38330078125,
0.385986328125,
0.07171630859375,
-0.72900390625,
1.265625,
0.279052734375,
0.42041015625,
-0.27001953125,
-0.1209716796875,
-0.106201171875,
-0.0771484375,
-0.07293701171875,
-0.794921875,
-0.0810546875,
0.41357421875,
0.08209228515625,
-1.1591796875,
0.371337890625,
-1.248046875,
-0.56591796875,
-0.403076171875,
-0.47265625,
0.91015625,
0.96923828125,
0.343017578125,
-0.07366943359375,
-0.59375,
-0.2142333984375,
0.393310546875,
0.619140625,
-0.94189453125,
0.11572265625,
1.23046875,
-0.0196533203125,
-0.46923828125,
0.2095947265625,
0.15478515625,
-0.434326171875,
0.1331787109375,
0.395263671875,
1.0576171875,
0.1856689453125,
0.2393798828125,
-0.0282745361328125,
0.2646484375,
-0.89404296875,
-0.0843505859375,
-0.2056884765625,
0.5078125,
0.395751953125,
0.5888671875,
0.5693359375,
0.294189453125,
-0.55126953125,
-1.123046875,
0.417724609375,
0.375,
1.1435546875,
-1.1015625,
0.88525390625,
0.2373046875,
-0.280517578125,
0.58544921875,
-0.7578125,
-0.039459228515625,
1.1220703125,
-0.08721923828125,
0.83154296875,
-0.93408203125,
0.0494384765625,
-0.342529296875,
-0.1231689453125,
1.10546875,
0.426025390625,
0.68994140625,
-0.09991455078125,
-0.390380859375,
-0.591796875,
-0.403564453125,
-0.1375732421875,
-0.78076171875,
0.297119140625,
-0.478271484375,
-0.56689453125,
-0.892578125,
0.3193359375,
0.4521484375,
0.2060546875,
-0.305419921875,
0.685546875,
0.131103515625,
0.2457275390625,
0.80419921875,
-0.32421875,
0.1968994140625,
-0.54150390625,
1.1103515625,
0.339599609375,
-0.048583984375,
-0.763671875,
-0.712890625,
0.0294036865234375,
0.0086517333984375,
0.254638671875,
-0.037872314453125,
-0.7001953125,
0.443359375,
0.2646484375,
0.5546875,
-0.78955078125,
-0.01216888427734375,
0.0665283203125,
0.37158203125,
0.4189453125,
-0.9560546875,
0.318603515625,
-0.9375,
0.70068359375,
0.52294921875,
-0.1309814453125,
-0.58056640625,
-0.48779296875,
-0.962890625,
-0.4482421875,
-0.18212890625,
0.78125,
-0.2388916015625,
0.2489013671875,
-0.8603515625,
0.1668701171875,
0.7001953125,
-0.68310546875,
0.432861328125,
-0.214599609375,
0.45654296875,
0.541015625,
0.6279296875,
-0.67138671875,
-0.8369140625,
0.0325927734375,
-1.2470703125,
0.233154296875,
-0.367919921875,
0.6396484375,
0.331298828125,
-0.10418701171875,
0.052032470703125,
0.27001953125,
-0.1370849609375,
0.237060546875,
-0.220947265625,
0.6455078125,
-1.0615234375,
-1.287109375,
0.66455078125,
-0.26025390625,
-0.66064453125,
0.634765625,
-0.21337890625,
-0.320068359375,
-0.103759765625,
0.330322265625,
-0.46484375,
0.278564453125,
-0.32763671875,
0.35205078125,
-0.2313232421875,
-0.7841796875,
-0.032440185546875,
-0.638671875,
0.87939453125,
0.298583984375,
-0.71875,
-0.053955078125,
-1.2392578125,
-0.04290771484375,
-0.306884765625,
-0.5947265625,
0.429443359375,
0.25732421875,
-0.01273345947265625,
-0.296630859375,
-0.295166015625,
-0.380859375,
-0.1807861328125,
-0.16162109375,
-0.09906005859375,
0.038055419921875,
0.546875,
0.51904296875,
0.205078125,
-0.34228515625,
0.0733642578125,
-0.1455078125,
-0.3896484375,
-0.455078125,
-0.11663818359375,
0.0670166015625,
-0.50830078125,
-0.2340087890625,
0.377685546875,
0.092041015625,
0.397705078125,
1.0830078125,
0.229736328125,
0.449951171875,
0.485107421875,
-0.55078125,
1.21875,
0.15478515625,
-1.3310546875,
-0.55517578125,
0.85400390625,
-0.450439453125,
0.6513671875,
0.447265625,
-0.99658203125,
-0.82666015625,
-0.7001953125,
0.294677734375,
-0.70068359375,
-0.1541748046875,
-1.0556640625,
-0.28759765625,
-0.17626953125,
0.921875,
-0.267333984375,
-0.54150390625,
0.2841796875,
-1.310546875,
0.1553955078125,
-0.297607421875,
-0.1951904296875,
-1.318359375,
-0.393310546875,
-0.305419921875,
0.8115234375,
-0.0771484375,
0.58935546875,
-0.3359375,
0.1448974609375,
0.06793212890625,
-0.1251220703125,
-0.74853515625,
-0.44482421875,
0.10101318359375,
0.297119140625,
0.010467529296875,
-0.0374755859375,
-0.41259765625,
0.7998046875,
-0.77197265625,
0.399658203125,
-0.1617431640625,
-0.5126953125,
-0.1978759765625,
-0.1763916015625,
1.0087890625,
-0.029296875,
-0.2205810546875,
-0.48388671875,
0.5390625,
0.58447265625,
0.02734375,
-0.463623046875,
-0.47900390625,
-0.12213134765625,
-0.9580078125,
0.60302734375,
-0.320068359375,
0.1378173828125,
-0.56689453125,
0.133056640625,
1.158203125,
-0.7294921875,
0.51953125,
1.30859375,
0.2178955078125,
0.3017578125,
-0.642578125,
0.7001953125,
0.01486968994140625,
-0.63232421875,
-0.2423095703125,
-0.08026123046875,
-1.169921875,
0.53173828125,
-0.8193359375,
-1.5224609375,
-0.83056640625,
0.60986328125,
1.671875,
-0.36474609375,
0.7705078125,
0.0180816650390625,
-0.98583984375,
-0.66455078125,
0.73779296875,
0.36572265625,
-0.08392333984375,
0.94482421875,
-0.63330078125,
-0.35791015625,
-0.2039794921875,
0.01073455810546875,
-0.60009765625,
-0.384521484375,
1.1650390625,
-0.2021484375,
-0.266357421875,
0.338623046875,
1.115234375,
-0.953125,
-1.0634765625,
-0.015472412109375,
0.1649169921875,
-0.06878662109375,
-0.9794921875,
0.06451416015625,
0.53857421875,
-0.59619140625,
0.119873046875,
0.37548828125,
-0.2069091796875,
0.638671875,
0.162109375,
0.252197265625,
-0.27783203125,
0.62109375,
0.409912109375,
-0.2437744140625,
-0.1446533203125,
-0.94384765625,
0.1527099609375,
-0.4091796875,
0.005641937255859375,
0.6083984375,
-0.58837890625,
-0.0987548828125,
0.58642578125,
-0.346923828125,
0.70947265625,
-0.373291015625,
-0.188720703125,
0.056396484375,
-0.7841796875,
-0.5126953125,
0.03533935546875,
0.4296875,
0.168212890625,
0.228759765625,
-0.64599609375,
-0.177734375,
0.2401123046875,
0.1396484375,
-0.25927734375,
-0.60302734375,
-0.268798828125,
-0.8251953125,
-0.6611328125,
-0.69921875,
-0.322998046875,
0.29638671875,
0.481689453125,
-0.05194091796875,
-0.248779296875,
0.196533203125,
0.6044921875,
-1.1181640625,
1.06640625,
-0.6953125,
0.65673828125,
-0.509765625,
-0.253662109375,
-0.84326171875,
0.12457275390625,
-0.58447265625,
-0.1339111328125,
-0.54296875,
0.5693359375,
-0.1663818359375,
0.32861328125,
0.11431884765625,
0.436279296875,
-0.02581787109375,
-0.6455078125,
0.35498046875,
0.081787109375,
-0.415771484375,
0.88427734375,
0.66943359375,
-0.07537841796875,
-0.234375,
-0.033782958984375,
-0.302978515625,
-0.43017578125,
1.078125,
0.72314453125,
0.004894256591796875,
0.09002685546875,
-0.0867919921875,
0.01285552978515625,
-0.8564453125,
0.2186279296875,
-0.3955078125,
0.09490966796875,
0.09698486328125,
-0.376708984375,
0.5625,
1.140625,
-0.6494140625,
0.34912109375,
0.412841796875,
0.366455078125,
0.23681640625,
0.400390625,
-0.01222991943359375,
0.61474609375,
0.1689453125,
-0.2442626953125,
0.10247802734375,
0.1522216796875,
-0.003391265869140625,
-0.032470703125,
-0.09808349609375,
-0.884765625,
-0.8291015625,
0.0033702850341796875,
-0.223388671875,
0.28466796875,
0.285400390625,
-0.6923828125,
-0.049560546875,
0.0518798828125,
-0.495361328125,
0.29541015625,
-1.2919921875,
-0.8935546875,
0.294921875,
0.20166015625,
-0.75927734375,
0.0869140625,
-0.5859375,
0.21923828125,
-0.318115234375,
0.1478271484375,
-0.336669921875,
0.1904296875,
-0.445556640625,
0.734375,
-0.55029296875,
0.019073486328125,
-0.03399658203125,
0.375,
-0.63916015625,
-0.1802978515625,
-0.053070068359375,
1.1962890625,
0.07745361328125,
0.1734619140625,
-0.494140625,
0.207763671875,
-0.4599609375,
-0.1883544921875,
-0.4716796875,
-0.0252685546875,
-0.033294677734375,
0.1610107421875,
-0.8544921875,
-0.056243896484375,
-0.609375,
0.42724609375,
-0.0921630859375,
-0.450439453125,
-0.7197265625,
0.77099609375,
1.0517578125,
0.006557464599609375,
0.1922607421875,
0.2030029296875,
0.425537109375,
-0.150390625,
-0.1187744140625,
-0.386962890625,
0.242919921875,
0.411376953125,
0.671875,
-0.366455078125,
0.400390625,
0.95751953125,
0.1563720703125,
-0.2666015625,
0.65576171875,
-0.2353515625,
0.10009765625,
0.22119140625,
-0.1275634765625,
-0.27001953125,
-0.1358642578125,
-0.8603515625,
0.4013671875,
-0.5732421875,
0.11602783203125,
-0.097900390625,
-0.74462890625,
0.970703125,
-0.1619873046875,
-0.334228515625,
0.23388671875,
-0.5517578125,
0.138916015625,
0.7314453125,
0.12127685546875,
-0.313720703125,
0.78662109375,
0.88818359375,
1.091796875,
0.74560546875,
0.79150390625,
0.2269287109375,
-0.671875,
0.435302734375,
-0.08074951171875,
-0.11627197265625,
-0.55712890625,
-0.456787109375,
-1.10546875,
0.1785888671875,
-0.259033203125,
-0.0330810546875,
0.390625,
-0.982421875,
0.154296875,
-0.492919921875,
0.86669921875,
-0.6318359375,
0.363037109375,
0.51318359375,
-0.63671875,
-0.681640625,
0.546875,
0.0071868896484375,
0.458984375,
0.347412109375,
1.1259765625,
0.227294921875,
1.27734375,
0.66943359375,
-0.1856689453125,
0.1907958984375,
0.60205078125,
-0.267333984375,
-0.86962890625,
-0.1739501953125,
0.0186614990234375,
-0.1312255859375,
-0.6318359375,
-0.201904296875,
-0.359375,
0.8427734375,
-0.1602783203125,
-0.8515625,
-0.6796875,
0.386474609375,
-0.94970703125,
0.37255859375,
0.34619140625,
0.57666015625,
-0.035308837890625,
-0.278076171875,
-0.35791015625,
0.09588623046875,
0.5537109375,
-0.31787109375,
0.72509765625,
-0.6279296875,
-0.70654296875,
-0.387939453125,
-0.5107421875,
-0.1859130859375,
-0.439453125,
-0.5654296875,
-1.0634765625,
0.3896484375,
0.74072265625,
0.638671875,
0.255859375,
-0.146484375,
0.11639404296875,
0.89404296875,
0.89208984375,
0.1544189453125,
0.95263671875,
0.5771484375,
-0.72265625,
0.35986328125,
-0.6142578125,
0.7998046875,
-0.1351318359375,
-0.153564453125,
-0.326171875,
0.2166748046875,
-1.1611328125,
-1.486328125,
-0.345703125,
0.65087890625,
0.448974609375,
-0.5302734375,
-1.4365234375,
-0.26220703125,
-0.958984375,
0.0670166015625,
-0.423828125,
0.69921875,
-0.1297607421875,
-0.0129547119140625,
-0.4091796875,
-1.263671875,
4.09765625,
0.677734375,
0.49755859375,
0.186279296875,
0.294677734375,
1.076171875,
0.51513671875,
-0.53125,
-0.40087890625,
-0.43798828125,
0.6083984375,
-0.56005859375,
-0.0186767578125,
1.109375,
0.395263671875,
0.435302734375,
-0.6796875,
0.3076171875,
-0.22900390625,
-0.84765625,
-1.2021484375,
0.1763916015625,
0.41064453125,
0.4267578125,
-0.037139892578125,
0.64013671875,
0.822265625,
-0.537109375,
-0.45947265625,
-0.73681640625,
0.212158203125,
-0.6376953125,
0.7587890625,
0.14599609375,
-0.24462890625,
0.81201171875,
-0.221923828125,
-0.471923828125,
-0.2135009765625,
0.46875,
-0.50537109375,
-0.343017578125,
0.343994140625,
-0.46728515625,
0.1121826171875,
0.66796875,
-0.38818359375,
0.45068359375,
0.02972412109375,
-0.91650390625,
0.67822265625,
-0.365478515625,
0.250732421875,
-0.7373046875,
-0.79052734375,
0.0269775390625,
0.2257080078125,
-0.1734619140625,
-0.045562744140625,
0.52490234375,
0.380615234375,
0.446533203125,
0.445068359375,
0.97705078125,
-0.80224609375,
0.74560546875,
0.24267578125,
0.433837890625,
-0.453125,
0.0137939453125,
0.242431640625,
-0.908203125,
-0.43115234375,
-0.58251953125,
0.006023406982421875,
0.509765625,
-0.282470703125,
0.242919921875,
0.939453125,
-0.88916015625,
0.257080078125,
0.1307373046875,
-0.0977783203125,
-0.32373046875,
0.634765625,
1.2958984375,
-0.51953125,
-0.114501953125,
-0.70263671875,
0.51025390625,
0.451904296875,
0.79833984375,
0.1737060546875,
-0.367919921875,
-0.556640625
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
Input
A text is given in a line. You can assume the following conditions:
* The number of letters in the text is less than or equal to 1000.
* The number of letters in a word is less than or equal to 32.
* There is only one word which is arise most frequently in given text.
* There is only one word which has the maximum number of letters in given text.
Output
The two words separated by a space.
Example
Input
Thank you for your mail and your lectures
Output
your lectures
"Correct Solution:
```
x=input().split()
longestWord= ""
mostWord=0
currentCount=0
THEmostWord=""
for r in range (len(x)):
if len(x[r])> len(longestWord):
longestWord=x[r]
for j in range (len(x)):
currentCount=x.count(x[j])
if currentCount > mostWord:
mostWord= currentCount
THEmostWord=x[j]
print(THEmostWord, longestWord)
```
| 66,371
|
[
0.3466796875,
-0.0197296142578125,
-0.11822509765625,
0.476806640625,
-0.51953125,
-0.490966796875,
-0.14501953125,
0.30322265625,
-0.049652099609375,
0.900390625,
0.385986328125,
0.07391357421875,
0.0228118896484375,
-0.58984375,
-0.90771484375,
-0.29736328125,
-0.59326171875,
-1.0068359375,
-0.337158203125,
-0.0103759765625,
-0.17919921875,
0.4580078125,
-1.28125,
-0.09576416015625,
-0.2137451171875,
0.90185546875,
0.492919921875,
0.10162353515625,
1.1494140625,
1.17578125,
-0.248291015625,
-0.3857421875,
0.317626953125,
-1.0361328125,
-0.27392578125,
-0.3447265625,
0.9755859375,
-0.97412109375,
-0.316162109375,
-0.72509765625,
0.135986328125,
-0.6787109375,
0.669921875,
-0.84228515625,
-1.1279296875,
0.10894775390625,
-0.076904296875,
-0.421875,
-0.258056640625,
-0.39306640625,
0.041046142578125,
-0.51806640625,
0.35302734375,
-0.21728515625,
-0.05682373046875,
-0.1533203125,
-0.0634765625,
-0.1080322265625,
-0.422607421875,
0.289794921875,
0.4482421875,
0.63427734375,
0.08648681640625,
-0.5615234375,
-0.47216796875,
0.404541015625,
-0.1851806640625,
-0.03277587890625,
0.1773681640625,
-0.443603515625,
-0.10247802734375,
0.186767578125,
-0.139404296875,
-0.438232421875,
-0.646484375,
-0.0264892578125,
0.323974609375,
-0.129150390625,
-0.62353515625,
1.001953125,
0.163818359375,
0.63720703125,
0.3759765625,
0.57275390625,
-0.74951171875,
-0.67041015625,
-0.00518798828125,
-0.2052001953125,
0.37158203125,
-0.62451171875,
-0.5634765625,
0.300537109375,
-0.61328125,
0.2174072265625,
0.8193359375,
0.3544921875,
-0.50341796875,
0.1842041015625,
0.427978515625,
0.75244140625,
0.79541015625,
1.12109375,
-0.51025390625,
0.9716796875,
-0.68115234375,
0.261962890625,
0.505859375,
0.009765625,
-0.152099609375,
-0.165771484375,
-0.54248046875,
0.007415771484375,
0.62548828125,
0.345458984375,
-0.1781005859375,
0.9345703125,
-0.1552734375,
0.6533203125,
-0.80810546875,
0.51904296875,
0.5146484375,
0.311767578125,
0.2646484375,
-0.412109375,
0.192138671875,
-0.44384765625,
-0.7197265625,
1.041015625,
-0.32421875,
-0.2381591796875,
0.2423095703125,
-0.1480712890625,
-0.2022705078125,
0.6728515625,
0.00940704345703125,
0.65185546875,
0.0848388671875,
0.447021484375,
0.810546875,
-0.5859375,
0.90185546875,
-0.23779296875,
0.0982666015625,
1.5595703125,
0.0792236328125,
0.10791015625,
0.420654296875,
0.69140625,
-0.8076171875,
0.5751953125,
-1.3388671875,
1.1708984375,
-0.2080078125,
0.4326171875,
-0.45556640625,
0.043792724609375,
-0.0789794921875,
0.0300445556640625,
0.095703125,
-0.0231475830078125,
-0.08367919921875,
0.37890625,
-0.2802734375,
0.859375,
-0.35546875,
0.791015625,
-0.56103515625,
-0.242431640625,
-0.218505859375,
-0.1527099609375,
0.0958251953125,
-0.30224609375,
0.05914306640625,
0.79931640625,
0.24853515625,
1.0966796875,
0.8603515625,
-0.5166015625,
0.353515625,
0.220703125,
-0.69873046875,
0.056884765625,
0.0193939208984375,
0.469970703125,
0.167724609375,
0.494873046875,
0.08770751953125,
-0.0286865234375,
-0.78271484375,
-0.37451171875,
0.306884765625,
0.7548828125,
-0.76904296875,
-0.08392333984375,
-0.0760498046875,
0.072998046875,
-0.60546875,
0.24365234375,
-0.06488037109375,
-0.96728515625,
-0.57763671875,
0.72509765625,
0.1212158203125,
0.564453125,
-0.429443359375,
-0.442626953125,
0.29638671875,
1.326171875,
-0.443603515625,
0.08367919921875,
0.720703125,
0.1065673828125,
-0.09149169921875,
0.1455078125,
0.40966796875,
-0.0014009475708007812,
-1.0205078125,
0.76904296875,
-0.7041015625,
-0.2098388671875,
0.1571044921875,
0.697265625,
0.48486328125,
0.4072265625,
-0.470703125,
-0.42138671875,
0.49365234375,
1.173828125,
-0.055816650390625,
0.87548828125,
0.197509765625,
1.24609375,
0.326416015625,
0.71044921875,
0.305908203125,
0.27783203125,
0.794921875,
0.5751953125,
-0.2305908203125,
0.09674072265625,
-0.221923828125,
0.495361328125,
0.53564453125,
1.0302734375,
0.0869140625,
0.82666015625,
-0.71142578125,
-0.115234375,
-0.3798828125,
0.8671875,
-0.20947265625,
0.54931640625,
0.247314453125,
0.276611328125,
-0.80908203125,
-0.355224609375,
0.317138671875,
0.94873046875,
-1.04296875,
-0.556640625,
-0.52001953125,
0.1982421875,
0.1802978515625,
0.1912841796875,
0.184326171875,
0.416748046875,
0.564453125,
0.568359375,
-0.491455078125,
-0.4169921875,
-0.59130859375,
-0.787109375,
-1.1787109375,
-0.80224609375,
-0.76318359375,
-0.256591796875,
0.0153656005859375,
-0.77392578125,
-0.061981201171875,
-0.2091064453125,
-0.5244140625,
-0.1820068359375,
-0.2071533203125,
0.58642578125,
-0.6982421875,
0.763671875,
-0.5380859375,
0.40283203125,
0.07330322265625,
1.248046875,
-0.837890625,
-0.414794921875,
-0.36962890625,
-0.60107421875,
0.474609375,
0.140625,
0.471923828125,
0.1591796875,
-0.51904296875,
-0.955078125,
-0.591796875,
-0.24755859375,
-0.5224609375,
0.386962890625,
-0.6787109375,
1,
0.11700439453125,
-0.60302734375,
0.6396484375,
1.197265625,
-0.97216796875,
0.492919921875,
0.466796875,
0.06622314453125,
-0.74658203125,
1.1787109375,
0.2548828125,
0.493408203125,
-0.308837890625,
-0.1829833984375,
-0.10394287109375,
-0.1016845703125,
-0.0576171875,
-0.82275390625,
-0.148681640625,
0.5234375,
0.06744384765625,
-1.0771484375,
0.347900390625,
-1.2587890625,
-0.580078125,
-0.53564453125,
-0.49658203125,
0.861328125,
1.1279296875,
0.260986328125,
0.08868408203125,
-0.55078125,
-0.271484375,
0.3779296875,
0.63671875,
-1.0771484375,
0.10888671875,
1.1923828125,
-0.0732421875,
-0.351806640625,
0.252685546875,
0.035736083984375,
-0.41552734375,
0.07232666015625,
0.363525390625,
1.037109375,
0.24072265625,
0.3271484375,
-0.239013671875,
0.3125,
-0.98681640625,
-0.0027942657470703125,
-0.163330078125,
0.59228515625,
0.4345703125,
0.50048828125,
0.6181640625,
0.384765625,
-0.61669921875,
-1.2841796875,
0.40966796875,
0.48486328125,
1.146484375,
-1.220703125,
0.85986328125,
0.228515625,
-0.455322265625,
0.56005859375,
-0.80517578125,
0.07830810546875,
1.1357421875,
-0.07427978515625,
0.7890625,
-0.86279296875,
0.03741455078125,
-0.377685546875,
-0.261962890625,
1.01171875,
0.412109375,
0.73974609375,
-0.2008056640625,
-0.472900390625,
-0.54052734375,
-0.396728515625,
-0.231689453125,
-0.75,
0.10906982421875,
-0.41259765625,
-0.465576171875,
-0.783203125,
0.4453125,
0.354248046875,
0.2261962890625,
-0.24755859375,
0.58251953125,
0.0312347412109375,
0.3291015625,
0.74658203125,
-0.266845703125,
0.18798828125,
-0.5068359375,
1.15234375,
0.30078125,
0.047149658203125,
-0.85595703125,
-0.5791015625,
-0.119873046875,
0.04095458984375,
0.166748046875,
0.005588531494140625,
-0.78759765625,
0.5068359375,
0.2266845703125,
0.482421875,
-0.8037109375,
-0.0347900390625,
-0.0926513671875,
0.2412109375,
0.340576171875,
-1.0400390625,
0.322265625,
-0.87841796875,
0.65673828125,
0.53857421875,
-0.03759765625,
-0.465087890625,
-0.517578125,
-0.81103515625,
-0.50390625,
-0.1649169921875,
0.69287109375,
-0.19580078125,
0.2398681640625,
-0.912109375,
0.259521484375,
0.5859375,
-0.6806640625,
0.31982421875,
-0.07781982421875,
0.5068359375,
0.4521484375,
0.5146484375,
-0.69873046875,
-0.671875,
0.048126220703125,
-1.3056640625,
0.36181640625,
-0.456298828125,
0.60693359375,
0.27099609375,
-0.258544921875,
-0.0266265869140625,
0.277587890625,
-0.185302734375,
0.157958984375,
-0.213134765625,
0.609375,
-1.046875,
-1.255859375,
0.5859375,
-0.1756591796875,
-0.83642578125,
0.78515625,
0.00232696533203125,
-0.23291015625,
-0.1182861328125,
0.403076171875,
-0.467041015625,
0.2369384765625,
-0.44287109375,
0.29541015625,
-0.308349609375,
-0.69677734375,
0.043701171875,
-0.67041015625,
0.865234375,
0.225830078125,
-0.70703125,
-0.0210113525390625,
-1.259765625,
-0.07916259765625,
-0.422607421875,
-0.611328125,
0.458984375,
0.311279296875,
-0.058197021484375,
-0.281005859375,
-0.283203125,
-0.28759765625,
-0.2139892578125,
-0.279296875,
-0.18603515625,
0.0474853515625,
0.38330078125,
0.5908203125,
0.33349609375,
-0.35498046875,
0.2333984375,
-0.1566162109375,
-0.37353515625,
-0.56982421875,
-0.2724609375,
-0.056671142578125,
-0.513671875,
-0.169921875,
0.458740234375,
0.172119140625,
0.3515625,
0.982421875,
0.2841796875,
0.4306640625,
0.595703125,
-0.446533203125,
1.3232421875,
0.166259765625,
-1.2568359375,
-0.51171875,
0.8740234375,
-0.46923828125,
0.67138671875,
0.43994140625,
-1.01953125,
-0.81787109375,
-0.65380859375,
0.257080078125,
-0.69580078125,
-0.2486572265625,
-1.0556640625,
-0.308349609375,
-0.1912841796875,
0.89697265625,
-0.32861328125,
-0.62353515625,
0.445556640625,
-1.220703125,
0.1346435546875,
-0.29248046875,
-0.2451171875,
-1.2119140625,
-0.496826171875,
-0.505859375,
0.8603515625,
-0.11444091796875,
0.64501953125,
-0.33349609375,
0.040557861328125,
0.150390625,
-0.2064208984375,
-0.66259765625,
-0.444091796875,
0.11676025390625,
0.2210693359375,
0.060150146484375,
0.058349609375,
-0.438232421875,
0.88818359375,
-0.84814453125,
0.4130859375,
-0.1849365234375,
-0.57080078125,
-0.1800537109375,
-0.052490234375,
1.013671875,
-0.21923828125,
-0.180419921875,
-0.35107421875,
0.646484375,
0.69970703125,
-0.0709228515625,
-0.43701171875,
-0.448974609375,
-0.1522216796875,
-0.93603515625,
0.65966796875,
-0.37841796875,
0.1805419921875,
-0.54931640625,
0.1417236328125,
1.212890625,
-0.705078125,
0.54248046875,
1.1181640625,
0.265869140625,
0.25341796875,
-0.64453125,
0.52783203125,
0.035797119140625,
-0.69384765625,
-0.2626953125,
-0.13525390625,
-1.13671875,
0.61767578125,
-0.7998046875,
-1.5537109375,
-0.80126953125,
0.50634765625,
1.6279296875,
-0.343994140625,
0.71484375,
-0.022796630859375,
-0.98486328125,
-0.69287109375,
0.74560546875,
0.413818359375,
-0.1396484375,
1.177734375,
-0.57421875,
-0.36181640625,
-0.260498046875,
0.0743408203125,
-0.609375,
-0.380126953125,
1.025390625,
-0.267578125,
-0.2037353515625,
0.453125,
1.1220703125,
-0.96875,
-1.07421875,
0.012969970703125,
0.1536865234375,
-0.055267333984375,
-0.97021484375,
0.0635986328125,
0.63232421875,
-0.71533203125,
0.08209228515625,
0.42041015625,
-0.133544921875,
0.401611328125,
0.1544189453125,
0.292724609375,
-0.181396484375,
0.5966796875,
0.4033203125,
-0.27978515625,
-0.0648193359375,
-1.0068359375,
0.1500244140625,
-0.3994140625,
-0.0295562744140625,
0.5703125,
-0.5009765625,
-0.11773681640625,
0.640625,
-0.35009765625,
0.736328125,
-0.279296875,
-0.1964111328125,
-0.01702880859375,
-0.80029296875,
-0.6044921875,
0.075439453125,
0.50927734375,
0.2008056640625,
0.127685546875,
-0.6025390625,
-0.2783203125,
0.138427734375,
0.1732177734375,
-0.32421875,
-0.56396484375,
-0.256591796875,
-0.75634765625,
-0.6513671875,
-0.70166015625,
-0.34814453125,
0.158203125,
0.515625,
-0.0355224609375,
-0.049774169921875,
0.08807373046875,
0.72412109375,
-1.033203125,
1.115234375,
-0.64697265625,
0.71875,
-0.64794921875,
-0.2222900390625,
-0.85009765625,
0.1934814453125,
-0.60986328125,
-0.122802734375,
-0.4794921875,
0.484619140625,
-0.12255859375,
0.27490234375,
0.039947509765625,
0.465087890625,
0.00646209716796875,
-0.5556640625,
0.356689453125,
0.0243377685546875,
-0.450927734375,
1.041015625,
0.71533203125,
-0.0780029296875,
-0.22216796875,
-0.1856689453125,
-0.319091796875,
-0.443603515625,
1.041015625,
0.724609375,
0.0955810546875,
-0.0179901123046875,
-0.1566162109375,
-0.0782470703125,
-0.8408203125,
0.1373291015625,
-0.320068359375,
0.1749267578125,
-0.05987548828125,
-0.295654296875,
0.546875,
1.1083984375,
-0.712890625,
0.3525390625,
0.44873046875,
0.445068359375,
0.301025390625,
0.253173828125,
0.01270294189453125,
0.69384765625,
0.1810302734375,
-0.279052734375,
0.058746337890625,
0.1536865234375,
0.045501708984375,
0.03070068359375,
-0.167724609375,
-0.8330078125,
-0.640625,
-0.013641357421875,
-0.269287109375,
0.304931640625,
0.255615234375,
-0.7568359375,
0.039215087890625,
-0.04266357421875,
-0.4892578125,
0.314208984375,
-1.265625,
-0.7958984375,
0.2376708984375,
0.2216796875,
-0.72705078125,
0.0318603515625,
-0.6923828125,
0.020782470703125,
-0.13037109375,
0.1728515625,
-0.40380859375,
0.275634765625,
-0.494384765625,
0.798828125,
-0.441650390625,
0.003070831298828125,
0.017852783203125,
0.431396484375,
-0.61279296875,
-0.261474609375,
0.047760009765625,
1.1826171875,
0.1490478515625,
0.330810546875,
-0.45849609375,
0.131103515625,
-0.35107421875,
-0.140380859375,
-0.5107421875,
-0.139404296875,
-0.004611968994140625,
0.2149658203125,
-1.013671875,
-0.0013818740844726562,
-0.4111328125,
0.4306640625,
-0.049560546875,
-0.34521484375,
-0.70068359375,
0.8251953125,
0.95068359375,
-0.032989501953125,
0.228759765625,
0.283203125,
0.50439453125,
-0.03936767578125,
-0.11187744140625,
-0.427001953125,
0.36962890625,
0.27685546875,
0.7255859375,
-0.49658203125,
0.39794921875,
0.884765625,
0.1431884765625,
-0.10894775390625,
0.5966796875,
-0.272705078125,
0.034820556640625,
0.193115234375,
-0.1119384765625,
-0.255126953125,
-0.05804443359375,
-0.92431640625,
0.444091796875,
-0.46240234375,
0.2164306640625,
-0.12841796875,
-0.72705078125,
0.8984375,
-0.1224365234375,
-0.409423828125,
0.1773681640625,
-0.60107421875,
0.364990234375,
0.669921875,
0.07757568359375,
-0.2440185546875,
0.72998046875,
0.8056640625,
1.0439453125,
0.6279296875,
0.810546875,
0.170654296875,
-0.6923828125,
0.488525390625,
0.0222015380859375,
-0.022674560546875,
-0.62646484375,
-0.43603515625,
-1.0205078125,
0.2149658203125,
-0.264404296875,
0.0030498504638671875,
0.449462890625,
-0.99169921875,
0.1278076171875,
-0.446533203125,
0.822265625,
-0.58935546875,
0.218505859375,
0.451416015625,
-0.55712890625,
-0.62451171875,
0.6328125,
-0.040283203125,
0.591796875,
0.1136474609375,
1.0859375,
0.1630859375,
1.2060546875,
0.6171875,
-0.290283203125,
0.1204833984375,
0.6875,
-0.26904296875,
-0.94287109375,
-0.1597900390625,
0.03369140625,
-0.1717529296875,
-0.54541015625,
-0.34130859375,
-0.385986328125,
0.72802734375,
-0.12457275390625,
-0.8701171875,
-0.72119140625,
0.41259765625,
-0.90869140625,
0.40478515625,
0.361572265625,
0.4306640625,
-0.020233154296875,
-0.297607421875,
-0.4951171875,
0.1038818359375,
0.51806640625,
-0.288818359375,
0.6484375,
-0.64990234375,
-0.564453125,
-0.58984375,
-0.568359375,
-0.168701171875,
-0.2493896484375,
-0.478271484375,
-1.0546875,
0.5322265625,
0.810546875,
0.6142578125,
0.3466796875,
-0.210205078125,
0.0207061767578125,
0.9677734375,
0.9501953125,
0.1639404296875,
0.95947265625,
0.5537109375,
-0.62353515625,
0.41357421875,
-0.383544921875,
0.9033203125,
-0.10467529296875,
-0.251708984375,
-0.37841796875,
0.288330078125,
-1.17578125,
-1.375,
-0.442138671875,
0.6767578125,
0.449951171875,
-0.564453125,
-1.5234375,
-0.37158203125,
-0.80810546875,
0.1055908203125,
-0.371337890625,
0.6328125,
0.017974853515625,
0.044403076171875,
-0.4208984375,
-1.2685546875,
4.1015625,
0.69873046875,
0.52587890625,
0.196044921875,
0.26708984375,
1.041015625,
0.53662109375,
-0.66455078125,
-0.345703125,
-0.27587890625,
0.6005859375,
-0.61083984375,
-0.050262451171875,
1.083984375,
0.452880859375,
0.39306640625,
-0.6884765625,
0.2861328125,
-0.09356689453125,
-0.90234375,
-1.060546875,
0.199462890625,
0.254150390625,
0.225341796875,
-0.0014734268188476562,
0.66357421875,
0.79443359375,
-0.7294921875,
-0.4306640625,
-0.72265625,
0.26123046875,
-0.52392578125,
0.8583984375,
0.1954345703125,
-0.220947265625,
0.80908203125,
-0.11309814453125,
-0.357421875,
-0.26416015625,
0.435302734375,
-0.415771484375,
-0.37158203125,
0.35986328125,
-0.297607421875,
0.166259765625,
0.63623046875,
-0.51416015625,
0.5908203125,
-0.08612060546875,
-0.87890625,
0.80615234375,
-0.1634521484375,
0.373779296875,
-0.83544921875,
-0.6767578125,
0.1507568359375,
0.193115234375,
-0.3037109375,
-0.14892578125,
0.4921875,
0.331787109375,
0.298583984375,
0.599609375,
1.03515625,
-0.80078125,
0.8564453125,
0.30615234375,
0.36572265625,
-0.60498046875,
-0.142578125,
0.40771484375,
-0.7841796875,
-0.55224609375,
-0.443115234375,
0.0811767578125,
0.5283203125,
-0.295166015625,
0.255126953125,
0.87158203125,
-0.84228515625,
0.272705078125,
0.259765625,
-0.01190948486328125,
-0.3271484375,
0.55078125,
1.3583984375,
-0.59814453125,
-0.046234130859375,
-0.5673828125,
0.438232421875,
0.57861328125,
0.6787109375,
0.092529296875,
-0.386962890625,
-0.53515625
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
Input
A text is given in a line. You can assume the following conditions:
* The number of letters in the text is less than or equal to 1000.
* The number of letters in a word is less than or equal to 32.
* There is only one word which is arise most frequently in given text.
* There is only one word which has the maximum number of letters in given text.
Output
The two words separated by a space.
Example
Input
Thank you for your mail and your lectures
Output
your lectures
"Correct Solution:
```
from collections import defaultdict as dd
a=dd(int)
freq=0
leng=""
seq=""
b=input().split()
for i in b:
a[i]+=1
if a[seq]<a[i]:
seq=i
if len(leng)<len(i):
leng=i
print(seq,leng)
```
| 66,373
|
[
0.227783203125,
-0.07745361328125,
0.10284423828125,
0.46435546875,
-0.59765625,
-0.298583984375,
-0.2880859375,
0.1773681640625,
-0.113525390625,
1.173828125,
0.201904296875,
-0.2098388671875,
-0.1417236328125,
-0.4541015625,
-0.806640625,
-0.2152099609375,
-0.66064453125,
-1.0390625,
-0.52490234375,
-0.032989501953125,
-0.217041015625,
0.56103515625,
-1.453125,
0.023834228515625,
-0.233154296875,
0.9228515625,
0.456298828125,
0.10546875,
1.181640625,
1.0966796875,
-0.1339111328125,
-0.45458984375,
0.326171875,
-0.96826171875,
-0.4580078125,
-0.1328125,
0.8544921875,
-1.2080078125,
-0.21240234375,
-0.63427734375,
0.2071533203125,
-0.58935546875,
0.58251953125,
-0.93505859375,
-1.0419921875,
-0.1595458984375,
-0.183837890625,
-0.474609375,
-0.275634765625,
-0.474365234375,
0.0699462890625,
-0.59130859375,
0.3310546875,
-0.1749267578125,
-0.2418212890625,
-0.007068634033203125,
-0.026153564453125,
-0.136962890625,
-0.5107421875,
0.2919921875,
0.31005859375,
0.615234375,
0.0467529296875,
-0.5673828125,
-0.51806640625,
0.374755859375,
-0.07427978515625,
-0.1143798828125,
0.093505859375,
-0.3671875,
-0.02178955078125,
0.1876220703125,
-0.06475830078125,
-0.413330078125,
-0.6416015625,
0.0109100341796875,
0.2939453125,
-0.252685546875,
-0.58447265625,
1.0478515625,
0.2093505859375,
0.77197265625,
0.35107421875,
0.492431640625,
-0.8857421875,
-0.544921875,
0.051361083984375,
-0.17236328125,
0.263671875,
-0.453125,
-0.4228515625,
0.40234375,
-0.356689453125,
0.25732421875,
0.75634765625,
0.4609375,
-0.57861328125,
-0.00809478759765625,
0.489501953125,
0.54736328125,
0.68603515625,
0.9892578125,
-0.37841796875,
1.1904296875,
-0.405029296875,
0.223388671875,
0.50927734375,
-0.1776123046875,
-0.08734130859375,
0.0136871337890625,
-0.471923828125,
-0.11248779296875,
0.62841796875,
0.264404296875,
-0.289306640625,
0.85986328125,
-0.010589599609375,
0.44677734375,
-0.69189453125,
0.58349609375,
0.5400390625,
0.470703125,
0.3896484375,
-0.48876953125,
0.17578125,
-0.5546875,
-0.6630859375,
1.0576171875,
-0.3642578125,
-0.298828125,
0.1728515625,
-0.1634521484375,
-0.275634765625,
0.61474609375,
0.10272216796875,
0.53857421875,
0.11541748046875,
0.70849609375,
0.65087890625,
-0.57275390625,
0.93115234375,
-0.314453125,
0.1318359375,
1.521484375,
0.2462158203125,
0.2578125,
0.471923828125,
0.65869140625,
-0.60888671875,
0.6435546875,
-1.302734375,
1.1474609375,
-0.337158203125,
0.458251953125,
-0.433349609375,
-0.11444091796875,
-0.01251983642578125,
0.07232666015625,
-0.059478759765625,
-0.14794921875,
-0.0179595947265625,
0.188232421875,
-0.322509765625,
0.89453125,
-0.4052734375,
0.64208984375,
-0.50830078125,
-0.282958984375,
-0.2352294921875,
-0.029205322265625,
0.18994140625,
-0.11962890625,
0.038177490234375,
0.77783203125,
0.324462890625,
0.99658203125,
1.037109375,
-0.75,
0.266845703125,
0.254150390625,
-0.62841796875,
-0.035980224609375,
0.074462890625,
0.441162109375,
0.40869140625,
0.30224609375,
0.1151123046875,
-0.160400390625,
-0.7431640625,
-0.335205078125,
0.197265625,
0.70849609375,
-0.86865234375,
-0.080322265625,
-0.213623046875,
0.191650390625,
-0.5849609375,
0.0843505859375,
-0.11126708984375,
-0.92333984375,
-0.469482421875,
0.5703125,
0.146240234375,
0.62841796875,
-0.54150390625,
-0.50537109375,
0.28564453125,
1.35546875,
-0.39990234375,
0.1422119140625,
0.76953125,
0.11627197265625,
-0.2056884765625,
0.2142333984375,
0.405029296875,
0.0579833984375,
-1.005859375,
0.78759765625,
-0.62744140625,
-0.1826171875,
0.16650390625,
0.564453125,
0.333984375,
0.3662109375,
-0.35595703125,
-0.34375,
0.372802734375,
1.2236328125,
0.059478759765625,
0.80712890625,
0.0633544921875,
1.130859375,
0.3671875,
0.73486328125,
0.37548828125,
-0.0137176513671875,
0.84228515625,
0.7578125,
-0.2216796875,
0.32958984375,
-0.1409912109375,
0.5859375,
0.52197265625,
0.9140625,
-0.0017986297607421875,
0.56103515625,
-0.358154296875,
-0.0275421142578125,
-0.343994140625,
0.87158203125,
-0.46728515625,
0.5380859375,
0.2005615234375,
0.09429931640625,
-0.60009765625,
-0.2919921875,
0.4248046875,
0.93994140625,
-0.9404296875,
-0.494384765625,
-0.2298583984375,
0.2015380859375,
0.396240234375,
0.1295166015625,
0.09063720703125,
0.4306640625,
0.69482421875,
0.65625,
-0.407470703125,
-0.37109375,
-0.6943359375,
-0.74072265625,
-1.0615234375,
-0.73388671875,
-0.66748046875,
-0.1727294921875,
0.0256195068359375,
-0.5185546875,
-0.0009002685546875,
-0.290771484375,
-0.572265625,
-0.2218017578125,
-0.52734375,
0.442138671875,
-0.6640625,
0.56982421875,
-0.5078125,
0.501953125,
0.2464599609375,
1.205078125,
-0.59228515625,
-0.368896484375,
-0.279541015625,
-0.48291015625,
0.435546875,
0.153076171875,
0.52197265625,
0.2403564453125,
-0.464599609375,
-0.83056640625,
-0.6396484375,
-0.2255859375,
-0.294677734375,
0.2666015625,
-0.70849609375,
1.0107421875,
-0.004276275634765625,
-0.63037109375,
0.5283203125,
1.15625,
-0.9375,
0.317138671875,
0.432861328125,
0.11572265625,
-0.72802734375,
1.2705078125,
0.32275390625,
0.372802734375,
-0.41748046875,
-0.1409912109375,
-0.1519775390625,
-0.142333984375,
-0.177001953125,
-0.83203125,
-0.141357421875,
0.370849609375,
0.07415771484375,
-1.15234375,
0.2587890625,
-1.1689453125,
-0.55224609375,
-0.318603515625,
-0.356201171875,
0.880859375,
1.0390625,
0.315673828125,
-0.1102294921875,
-0.5869140625,
-0.178955078125,
0.5859375,
0.64306640625,
-0.92041015625,
0.09747314453125,
1.287109375,
0.05438232421875,
-0.369140625,
0.492431640625,
0.0582275390625,
-0.43603515625,
0.27294921875,
0.361083984375,
1.0341796875,
0.213134765625,
0.23974609375,
0.021148681640625,
0.215087890625,
-0.9609375,
-0.087158203125,
-0.05108642578125,
0.7724609375,
0.47607421875,
0.56103515625,
0.48876953125,
0.233154296875,
-0.6064453125,
-1.2001953125,
0.49560546875,
0.420654296875,
1.0810546875,
-0.9619140625,
0.93017578125,
0.0626220703125,
-0.259521484375,
0.497314453125,
-0.63427734375,
0.033416748046875,
1.1787109375,
-0.177978515625,
0.94970703125,
-1.0712890625,
0.2783203125,
-0.5146484375,
-0.11968994140625,
1.0390625,
0.3623046875,
0.7802734375,
-0.08905029296875,
-0.469970703125,
-0.544921875,
-0.37255859375,
-0.292724609375,
-0.529296875,
0.221923828125,
-0.5732421875,
-0.45947265625,
-0.8759765625,
0.397216796875,
0.4072265625,
0.1123046875,
-0.1884765625,
0.666015625,
0.01495361328125,
0.2320556640625,
0.70166015625,
-0.222412109375,
0.265869140625,
-0.5224609375,
1.0283203125,
0.16064453125,
-0.09454345703125,
-0.5556640625,
-0.63818359375,
0.0231781005859375,
-0.0750732421875,
0.02691650390625,
-0.0726318359375,
-0.68994140625,
0.5859375,
0.2401123046875,
0.61328125,
-0.81396484375,
0.10467529296875,
-0.0689697265625,
0.259765625,
0.318603515625,
-0.943359375,
0.4365234375,
-0.9208984375,
0.69140625,
0.472900390625,
-0.0877685546875,
-0.63427734375,
-0.5712890625,
-0.77294921875,
-0.4306640625,
-0.0008330345153808594,
0.68994140625,
-0.214111328125,
0.48681640625,
-0.99169921875,
0.161865234375,
0.607421875,
-0.62841796875,
0.406494140625,
-0.038330078125,
0.44482421875,
0.53173828125,
0.63818359375,
-0.52294921875,
-0.654296875,
0.031463623046875,
-1.140625,
0.20556640625,
-0.479736328125,
0.5908203125,
0.263427734375,
-0.2386474609375,
-0.037872314453125,
0.343994140625,
-0.1767578125,
0.285400390625,
-0.2420654296875,
0.5048828125,
-0.99560546875,
-1.283203125,
0.62890625,
-0.2435302734375,
-0.6416015625,
0.62939453125,
-0.06402587890625,
-0.18017578125,
-0.13818359375,
0.378173828125,
-0.461669921875,
0.404541015625,
-0.3212890625,
0.35107421875,
-0.3896484375,
-0.658203125,
-0.272216796875,
-0.6630859375,
0.9345703125,
0.13720703125,
-0.6591796875,
-0.09527587890625,
-1.2783203125,
-0.165771484375,
-0.33154296875,
-0.60986328125,
0.45751953125,
0.2861328125,
0.0645751953125,
-0.447265625,
-0.3857421875,
-0.474609375,
-0.20166015625,
-0.04046630859375,
-0.09051513671875,
0.20068359375,
0.5791015625,
0.68798828125,
0.0677490234375,
-0.4599609375,
0.07659912109375,
0.11181640625,
-0.448486328125,
-0.498779296875,
-0.058441162109375,
0.0199432373046875,
-0.564453125,
-0.216796875,
0.3447265625,
0.229736328125,
0.376220703125,
1.015625,
0.31396484375,
0.386962890625,
0.381591796875,
-0.496337890625,
1.1865234375,
0.2415771484375,
-1.2939453125,
-0.56787109375,
1.0380859375,
-0.537109375,
0.712890625,
0.234130859375,
-0.83740234375,
-0.66845703125,
-0.6533203125,
0.4375,
-0.74951171875,
-0.10614013671875,
-0.919921875,
-0.1807861328125,
-0.035675048828125,
0.68359375,
-0.325927734375,
-0.9072265625,
0.1591796875,
-1.12890625,
0.1785888671875,
-0.404052734375,
-0.314453125,
-1.3974609375,
-0.244140625,
-0.33349609375,
0.82080078125,
-0.0244598388671875,
0.39111328125,
-0.334228515625,
0.1357421875,
0.0869140625,
-0.08734130859375,
-0.78125,
-0.428955078125,
0.07861328125,
0.181640625,
-0.04534912109375,
-0.12548828125,
-0.5927734375,
0.76123046875,
-0.79150390625,
0.30224609375,
-0.08966064453125,
-0.5693359375,
0.0183258056640625,
-0.2073974609375,
0.93017578125,
-0.1527099609375,
-0.266845703125,
-0.422119140625,
0.58056640625,
0.52490234375,
-0.0185394287109375,
-0.64404296875,
-0.61962890625,
-0.2266845703125,
-0.9921875,
0.458251953125,
-0.358642578125,
0.17333984375,
-0.451171875,
0.0723876953125,
1.0849609375,
-0.75537109375,
0.388671875,
1.0078125,
0.187744140625,
0.23583984375,
-0.814453125,
0.7734375,
0.169921875,
-0.76416015625,
-0.1787109375,
-0.0033245086669921875,
-1.0283203125,
0.56689453125,
-0.77490234375,
-1.4462890625,
-0.82666015625,
0.6083984375,
1.67578125,
-0.1737060546875,
0.69921875,
0.038238525390625,
-0.970703125,
-0.53076171875,
0.654296875,
0.2626953125,
0.039215087890625,
0.84619140625,
-0.58203125,
-0.360595703125,
-0.1585693359375,
-0.0125274658203125,
-0.59521484375,
-0.287841796875,
1.0302734375,
-0.2158203125,
-0.388916015625,
0.404541015625,
0.9013671875,
-0.9599609375,
-1.0576171875,
0.16357421875,
0.213134765625,
-0.0146484375,
-1.001953125,
0.1712646484375,
0.6171875,
-0.57421875,
0.2071533203125,
0.426513671875,
-0.1141357421875,
0.69921875,
0.02593994140625,
0.300537109375,
-0.2154541015625,
0.76708984375,
0.4580078125,
-0.2275390625,
-0.1661376953125,
-0.8974609375,
0.26416015625,
-0.41064453125,
0.032501220703125,
0.53662109375,
-0.4736328125,
0.11248779296875,
0.64404296875,
-0.2900390625,
0.61669921875,
-0.29150390625,
-0.285400390625,
0.2060546875,
-0.61474609375,
-0.464599609375,
0.23876953125,
0.425048828125,
0.1661376953125,
0.2763671875,
-0.54248046875,
-0.06500244140625,
0.328125,
0.236083984375,
-0.333984375,
-0.55078125,
-0.289794921875,
-0.7841796875,
-0.619140625,
-0.640625,
-0.294921875,
0.304931640625,
0.61328125,
0.05194091796875,
-0.213134765625,
0.1346435546875,
0.60693359375,
-1.0146484375,
1.1328125,
-0.6552734375,
0.654296875,
-0.666015625,
-0.2998046875,
-0.8935546875,
0.07501220703125,
-0.650390625,
-0.32177734375,
-0.59228515625,
0.430908203125,
-0.19970703125,
0.4521484375,
0.08929443359375,
0.61328125,
-0.2445068359375,
-0.638671875,
0.400634765625,
0.1690673828125,
-0.16748046875,
0.96728515625,
0.59912109375,
-0.0238037109375,
-0.225830078125,
-0.2462158203125,
-0.492919921875,
-0.5517578125,
0.95361328125,
0.666015625,
-0.0921630859375,
0.0021038055419921875,
-0.102294921875,
0.1444091796875,
-0.8623046875,
0.30517578125,
-0.5576171875,
0.2095947265625,
0.109375,
-0.40625,
0.31689453125,
1.236328125,
-0.583984375,
0.368896484375,
0.443603515625,
0.225341796875,
0.215576171875,
0.380615234375,
0.006534576416015625,
0.7783203125,
0.26318359375,
-0.28662109375,
0.1851806640625,
0.050872802734375,
-0.0018739700317382812,
-0.05694580078125,
-0.187744140625,
-0.9384765625,
-1.0068359375,
0.04681396484375,
-0.156005859375,
0.3408203125,
0.340576171875,
-0.7578125,
0.058868408203125,
-0.03668212890625,
-0.56591796875,
0.1690673828125,
-1.251953125,
-1.0146484375,
0.53125,
-0.00396728515625,
-0.8798828125,
-0.009063720703125,
-0.689453125,
0.109130859375,
-0.301513671875,
0.2374267578125,
-0.3603515625,
0.36669921875,
-0.38037109375,
0.67626953125,
-0.50830078125,
-0.060394287109375,
0.037841796875,
0.368408203125,
-0.7490234375,
-0.2386474609375,
0.0268096923828125,
1.197265625,
0.1912841796875,
0.1387939453125,
-0.556640625,
0.332763671875,
-0.5576171875,
-0.12249755859375,
-0.67626953125,
-0.03912353515625,
-0.07061767578125,
0.31103515625,
-0.7509765625,
0.061920166015625,
-0.400390625,
0.461181640625,
0.142822265625,
-0.367431640625,
-0.69580078125,
0.73486328125,
0.9541015625,
-0.043121337890625,
0.289306640625,
0.280517578125,
0.290283203125,
-0.2115478515625,
-0.10430908203125,
-0.355712890625,
0.431640625,
0.662109375,
0.61181640625,
-0.387939453125,
0.383056640625,
0.759765625,
0.1458740234375,
-0.09820556640625,
0.57958984375,
-0.0203857421875,
-0.0167388916015625,
0.35400390625,
-0.14306640625,
-0.301025390625,
-0.033416748046875,
-0.748046875,
0.408447265625,
-0.435302734375,
0.1932373046875,
-0.1719970703125,
-0.69140625,
0.9052734375,
-0.1536865234375,
-0.351806640625,
0.12188720703125,
-0.59130859375,
0.1451416015625,
0.7197265625,
0.119384765625,
-0.447021484375,
0.82861328125,
0.998046875,
0.8525390625,
0.77490234375,
0.80126953125,
0.288330078125,
-0.85546875,
0.4755859375,
-0.06072998046875,
-0.021240234375,
-0.66845703125,
-0.6533203125,
-1,
0.3056640625,
-0.26123046875,
-0.045806884765625,
0.2294921875,
-0.9150390625,
0.1412353515625,
-0.4814453125,
0.7080078125,
-0.69580078125,
0.47509765625,
0.433349609375,
-0.463623046875,
-0.84375,
0.485107421875,
-0.052276611328125,
0.292236328125,
0.316162109375,
1.078125,
0.260009765625,
1.169921875,
0.5087890625,
-0.260986328125,
0.14892578125,
0.728515625,
-0.252197265625,
-0.66015625,
-0.271240234375,
-0.15478515625,
-0.12066650390625,
-0.6259765625,
-0.279541015625,
-0.285400390625,
0.72412109375,
-0.0887451171875,
-0.80029296875,
-0.5107421875,
0.322509765625,
-0.93359375,
0.494140625,
0.34033203125,
0.630859375,
-0.00004458427429199219,
-0.37939453125,
-0.30224609375,
-0.03533935546875,
0.6708984375,
-0.381591796875,
0.73828125,
-0.66064453125,
-0.7060546875,
-0.474365234375,
-0.560546875,
-0.1943359375,
-0.24169921875,
-0.5830078125,
-1.15625,
0.3515625,
0.6982421875,
0.6220703125,
0.328857421875,
-0.12841796875,
0.039093017578125,
0.837890625,
0.86669921875,
0.1483154296875,
0.8955078125,
0.58984375,
-0.5849609375,
0.398193359375,
-0.432861328125,
0.8193359375,
-0.27587890625,
-0.06549072265625,
-0.26318359375,
0.03948974609375,
-0.8984375,
-1.5126953125,
-0.364013671875,
0.61279296875,
0.34912109375,
-0.47265625,
-1.427734375,
-0.303466796875,
-0.83447265625,
0.04815673828125,
-0.47314453125,
0.78271484375,
-0.33837890625,
-0.064697265625,
-0.353271484375,
-1.2548828125,
4.19140625,
0.79931640625,
0.5263671875,
0.177734375,
0.220703125,
1,
0.41162109375,
-0.5888671875,
-0.23486328125,
-0.378173828125,
0.404296875,
-0.71435546875,
-0.144775390625,
1.0322265625,
0.30419921875,
0.35986328125,
-0.5419921875,
0.1297607421875,
-0.03778076171875,
-0.97314453125,
-1.0673828125,
0.21533203125,
0.489990234375,
0.417236328125,
-0.08123779296875,
0.5439453125,
1.00390625,
-0.60693359375,
-0.311767578125,
-0.57568359375,
0.1259765625,
-0.70751953125,
0.892578125,
0.1812744140625,
-0.258056640625,
0.60302734375,
-0.385009765625,
-0.5322265625,
-0.283203125,
0.422119140625,
-0.39306640625,
-0.1627197265625,
0.355224609375,
-0.398681640625,
0.024200439453125,
0.63232421875,
-0.5439453125,
0.52587890625,
0.1253662109375,
-1.109375,
0.73388671875,
-0.422119140625,
0.36376953125,
-0.65625,
-0.76611328125,
0.1278076171875,
0.2392578125,
-0.1427001953125,
-0.10638427734375,
0.57177734375,
0.224609375,
0.460205078125,
0.349609375,
0.80029296875,
-0.85009765625,
0.47802734375,
0.427001953125,
0.31884765625,
-0.453857421875,
0.0751953125,
0.203857421875,
-0.775390625,
-0.5126953125,
-0.428466796875,
0.162841796875,
0.456787109375,
-0.304443359375,
0.355224609375,
0.78662109375,
-0.96337890625,
0.2064208984375,
-0.05401611328125,
-0.00505828857421875,
-0.323974609375,
0.71337890625,
1.3779296875,
-0.422607421875,
-0.1649169921875,
-0.66259765625,
0.509765625,
0.33056640625,
0.7763671875,
0.193359375,
-0.64697265625,
-0.556640625
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
Input
A text is given in a line. You can assume the following conditions:
* The number of letters in the text is less than or equal to 1000.
* The number of letters in a word is less than or equal to 32.
* There is only one word which is arise most frequently in given text.
* There is only one word which has the maximum number of letters in given text.
Output
The two words separated by a space.
Example
Input
Thank you for your mail and your lectures
Output
your lectures
"Correct Solution:
```
text = input().split()
l = {}
dc = {}
for i in text:
l[i] = len(i)
if i in dc.keys():
dc[i] += 1
else:
dc[i] = 0
print(max(dc, key=dc.get), max(l, key=l.get))
```
| 66,374
|
[
0.39501953125,
0.0306243896484375,
0.09832763671875,
0.369384765625,
-0.615234375,
-0.492431640625,
-0.1912841796875,
0.384521484375,
-0.007843017578125,
1.072265625,
0.38720703125,
0.0289306640625,
-0.0843505859375,
-0.496337890625,
-0.75244140625,
-0.210205078125,
-0.5625,
-1.025390625,
-0.332275390625,
0.0012712478637695312,
-0.212890625,
0.7470703125,
-1.3896484375,
-0.15185546875,
-0.288330078125,
0.96044921875,
0.4912109375,
-0.0980224609375,
1.1591796875,
1.140625,
-0.2293701171875,
-0.42529296875,
0.2998046875,
-0.9619140625,
-0.3828125,
-0.264404296875,
0.8193359375,
-1.0615234375,
-0.265625,
-0.80712890625,
0.206787109375,
-0.74609375,
0.65380859375,
-0.87255859375,
-1.1298828125,
0.0027751922607421875,
-0.037750244140625,
-0.295166015625,
-0.326416015625,
-0.407958984375,
0.004398345947265625,
-0.50390625,
0.3955078125,
-0.2529296875,
-0.161376953125,
-0.07470703125,
-0.04876708984375,
-0.19189453125,
-0.35888671875,
0.253173828125,
0.400390625,
0.45947265625,
0.043212890625,
-0.55908203125,
-0.52197265625,
0.36572265625,
-0.2344970703125,
0.00688934326171875,
0.1390380859375,
-0.29150390625,
-0.00437164306640625,
0.200927734375,
-0.1968994140625,
-0.4541015625,
-0.53759765625,
-0.1998291015625,
0.1824951171875,
-0.2734375,
-0.53857421875,
1.0009765625,
0.1864013671875,
0.69189453125,
0.358154296875,
0.361328125,
-0.701171875,
-0.62255859375,
0.11981201171875,
-0.15576171875,
0.2059326171875,
-0.58251953125,
-0.417724609375,
0.3369140625,
-0.409912109375,
0.26513671875,
0.76513671875,
0.468505859375,
-0.4794921875,
0.11712646484375,
0.385498046875,
0.564453125,
0.61181640625,
0.92822265625,
-0.464111328125,
1.0048828125,
-0.5126953125,
0.2086181640625,
0.59814453125,
-0.08636474609375,
-0.1583251953125,
0.0280914306640625,
-0.461181640625,
-0.047393798828125,
0.7373046875,
0.2744140625,
-0.3232421875,
1.00390625,
0.056732177734375,
0.429931640625,
-0.7294921875,
0.5712890625,
0.494873046875,
0.4033203125,
0.1676025390625,
-0.487060546875,
0.09588623046875,
-0.54052734375,
-0.65771484375,
1.0732421875,
-0.292236328125,
-0.21240234375,
0.194091796875,
-0.1424560546875,
-0.2509765625,
0.67626953125,
0.047210693359375,
0.70166015625,
0.061279296875,
0.41845703125,
0.7158203125,
-0.56640625,
0.8330078125,
-0.274169921875,
0.134765625,
1.5771484375,
0.2403564453125,
0.09124755859375,
0.56103515625,
0.626953125,
-0.76171875,
0.537109375,
-1.271484375,
1.1494140625,
-0.447265625,
0.5849609375,
-0.428466796875,
-0.055511474609375,
-0.07513427734375,
0.01375579833984375,
-0.0655517578125,
-0.0186614990234375,
-0.005855560302734375,
0.3046875,
-0.3310546875,
0.90771484375,
-0.35986328125,
0.66845703125,
-0.6005859375,
-0.2646484375,
-0.212646484375,
-0.0726318359375,
0.198486328125,
-0.270751953125,
0.10302734375,
0.77587890625,
0.267578125,
0.92431640625,
0.91357421875,
-0.59326171875,
0.294921875,
0.24853515625,
-0.66650390625,
0.06561279296875,
0.07330322265625,
0.43701171875,
0.25439453125,
0.495361328125,
0.007495880126953125,
-0.1580810546875,
-0.72998046875,
-0.374755859375,
0.33740234375,
0.8740234375,
-0.88525390625,
-0.150146484375,
-0.11749267578125,
0.1783447265625,
-0.55322265625,
0.2314453125,
-0.117431640625,
-0.9150390625,
-0.4892578125,
0.6826171875,
0.07806396484375,
0.6083984375,
-0.4638671875,
-0.53662109375,
0.385986328125,
1.3134765625,
-0.352294921875,
0.1285400390625,
0.80419921875,
0.1839599609375,
-0.041168212890625,
0.11224365234375,
0.410888671875,
0.0648193359375,
-1.1220703125,
0.74853515625,
-0.63916015625,
-0.218017578125,
0.237060546875,
0.55712890625,
0.325927734375,
0.458740234375,
-0.40771484375,
-0.45556640625,
0.388916015625,
1.2607421875,
0.155029296875,
0.86474609375,
0.0894775390625,
1.13671875,
0.328125,
0.76904296875,
0.43701171875,
0.2310791015625,
0.83056640625,
0.7197265625,
-0.313232421875,
0.1981201171875,
-0.12939453125,
0.5947265625,
0.495361328125,
1.0166015625,
0.0860595703125,
0.6474609375,
-0.63525390625,
-0.060089111328125,
-0.3212890625,
0.783203125,
-0.249267578125,
0.515625,
0.20556640625,
0.23291015625,
-0.77783203125,
-0.3271484375,
0.3408203125,
1.06640625,
-0.96435546875,
-0.45556640625,
-0.337646484375,
0.23681640625,
0.2135009765625,
0.2156982421875,
0.024169921875,
0.309814453125,
0.615234375,
0.6708984375,
-0.458984375,
-0.431640625,
-0.73583984375,
-0.7001953125,
-1.0693359375,
-0.7021484375,
-0.70068359375,
-0.1365966796875,
0.027130126953125,
-0.66748046875,
-0.0667724609375,
-0.395263671875,
-0.59033203125,
-0.306396484375,
-0.45458984375,
0.433837890625,
-0.53662109375,
0.66357421875,
-0.55126953125,
0.392578125,
0.337158203125,
1.408203125,
-0.775390625,
-0.490478515625,
-0.454833984375,
-0.499267578125,
0.41650390625,
0.181640625,
0.498779296875,
0.270263671875,
-0.6533203125,
-0.880859375,
-0.50634765625,
-0.235107421875,
-0.42138671875,
0.23388671875,
-0.6865234375,
1.0029296875,
0.020660400390625,
-0.64208984375,
0.459228515625,
1.2587890625,
-0.94970703125,
0.348388671875,
0.355224609375,
0.037078857421875,
-0.798828125,
1.2939453125,
0.3349609375,
0.42724609375,
-0.26513671875,
-0.1881103515625,
-0.1290283203125,
-0.1025390625,
0.00890350341796875,
-0.7705078125,
-0.09722900390625,
0.385986328125,
0.03533935546875,
-1.1435546875,
0.37744140625,
-1.291015625,
-0.5322265625,
-0.40185546875,
-0.4208984375,
0.84716796875,
0.97705078125,
0.351318359375,
-0.08392333984375,
-0.5615234375,
-0.2275390625,
0.53857421875,
0.67333984375,
-0.98974609375,
0.194580078125,
1.15234375,
0.027618408203125,
-0.45751953125,
0.1722412109375,
0.052276611328125,
-0.4296875,
0.1318359375,
0.5078125,
0.9716796875,
0.15673828125,
0.203857421875,
0.0027828216552734375,
0.24462890625,
-0.919921875,
-0.041748046875,
-0.12322998046875,
0.5263671875,
0.450439453125,
0.6005859375,
0.5517578125,
0.3173828125,
-0.56494140625,
-1.1044921875,
0.455810546875,
0.4443359375,
1.1337890625,
-1.0224609375,
0.90869140625,
0.2362060546875,
-0.245361328125,
0.52099609375,
-0.77294921875,
0.07177734375,
1.0791015625,
-0.1253662109375,
0.87158203125,
-0.93798828125,
0.1363525390625,
-0.438720703125,
-0.10107421875,
1.0703125,
0.41943359375,
0.69091796875,
-0.07305908203125,
-0.382080078125,
-0.5595703125,
-0.371826171875,
-0.07666015625,
-0.767578125,
0.26171875,
-0.50634765625,
-0.5341796875,
-0.89599609375,
0.310546875,
0.4755859375,
0.2861328125,
-0.3076171875,
0.671875,
0.144287109375,
0.261962890625,
0.8154296875,
-0.27099609375,
0.238037109375,
-0.6142578125,
1.0771484375,
0.216552734375,
-0.0826416015625,
-0.748046875,
-0.5380859375,
-0.01358795166015625,
-0.00421142578125,
0.12469482421875,
-0.02923583984375,
-0.70751953125,
0.43994140625,
0.2646484375,
0.54833984375,
-0.7734375,
-0.08258056640625,
-0.038970947265625,
0.31640625,
0.476806640625,
-1.00390625,
0.38720703125,
-0.86376953125,
0.6796875,
0.481201171875,
-0.1365966796875,
-0.52587890625,
-0.568359375,
-0.9521484375,
-0.461669921875,
-0.122314453125,
0.77099609375,
-0.2117919921875,
0.241943359375,
-0.857421875,
0.1895751953125,
0.6484375,
-0.58154296875,
0.404541015625,
-0.189208984375,
0.4052734375,
0.52783203125,
0.56494140625,
-0.6240234375,
-0.74560546875,
-0.0110015869140625,
-1.162109375,
0.23583984375,
-0.416259765625,
0.6689453125,
0.368896484375,
-0.2069091796875,
0.05322265625,
0.25830078125,
-0.2330322265625,
0.294921875,
-0.2161865234375,
0.6083984375,
-1.0390625,
-1.29296875,
0.6171875,
-0.208984375,
-0.70068359375,
0.63818359375,
-0.2227783203125,
-0.276123046875,
-0.1143798828125,
0.26806640625,
-0.494384765625,
0.285400390625,
-0.426513671875,
0.2734375,
-0.2509765625,
-0.8544921875,
-0.050933837890625,
-0.65087890625,
0.91943359375,
0.2269287109375,
-0.67041015625,
-0.05755615234375,
-1.2626953125,
0.034423828125,
-0.35107421875,
-0.48193359375,
0.4072265625,
0.197998046875,
0.06915283203125,
-0.318115234375,
-0.43017578125,
-0.247802734375,
-0.164306640625,
-0.1729736328125,
-0.10174560546875,
0.004970550537109375,
0.449462890625,
0.5068359375,
0.2193603515625,
-0.36328125,
0.0679931640625,
-0.10089111328125,
-0.303466796875,
-0.369873046875,
-0.196533203125,
0.03118896484375,
-0.435302734375,
-0.2548828125,
0.449951171875,
0.050994873046875,
0.37353515625,
0.97216796875,
0.298828125,
0.430419921875,
0.453369140625,
-0.48291015625,
1.244140625,
0.2763671875,
-1.322265625,
-0.4921875,
0.90283203125,
-0.5107421875,
0.7431640625,
0.37939453125,
-1.013671875,
-0.76220703125,
-0.63671875,
0.28759765625,
-0.66650390625,
-0.1697998046875,
-1.0439453125,
-0.25830078125,
-0.1859130859375,
0.79052734375,
-0.295654296875,
-0.61328125,
0.23583984375,
-1.255859375,
0.13525390625,
-0.29833984375,
-0.2198486328125,
-1.31640625,
-0.381103515625,
-0.406982421875,
0.77099609375,
-0.132568359375,
0.57080078125,
-0.333251953125,
0.1251220703125,
0.048492431640625,
-0.161865234375,
-0.7744140625,
-0.451416015625,
0.11474609375,
0.28564453125,
-0.058624267578125,
-0.04547119140625,
-0.459716796875,
0.72802734375,
-0.77197265625,
0.393310546875,
-0.1646728515625,
-0.4384765625,
-0.047637939453125,
-0.1571044921875,
0.9560546875,
-0.04925537109375,
-0.269287109375,
-0.50927734375,
0.5322265625,
0.51806640625,
0.0283050537109375,
-0.53076171875,
-0.49267578125,
-0.1568603515625,
-0.958984375,
0.482666015625,
-0.272216796875,
0.1328125,
-0.580078125,
0.043212890625,
1.173828125,
-0.69482421875,
0.546875,
1.185546875,
0.2021484375,
0.263916015625,
-0.7724609375,
0.62841796875,
0.1500244140625,
-0.68505859375,
-0.08807373046875,
-0.0677490234375,
-1.1865234375,
0.59130859375,
-0.759765625,
-1.3720703125,
-0.85009765625,
0.6416015625,
1.701171875,
-0.270263671875,
0.759765625,
0.01030731201171875,
-0.9775390625,
-0.6455078125,
0.6279296875,
0.2841796875,
-0.0288543701171875,
0.84521484375,
-0.55712890625,
-0.350341796875,
-0.1314697265625,
-0.0017147064208984375,
-0.67822265625,
-0.32666015625,
1.087890625,
-0.1826171875,
-0.25244140625,
0.319091796875,
1.0498046875,
-0.8876953125,
-1.08203125,
0.06622314453125,
0.1282958984375,
-0.121337890625,
-0.9873046875,
0.1326904296875,
0.464599609375,
-0.595703125,
0.1163330078125,
0.33349609375,
-0.160888671875,
0.63623046875,
0.1903076171875,
0.160400390625,
-0.294189453125,
0.64501953125,
0.439697265625,
-0.2183837890625,
-0.0989990234375,
-0.95654296875,
0.00627899169921875,
-0.390380859375,
0.02166748046875,
0.5556640625,
-0.5458984375,
-0.00753021240234375,
0.6044921875,
-0.3369140625,
0.74951171875,
-0.268798828125,
-0.1693115234375,
0.177490234375,
-0.7509765625,
-0.50830078125,
0.1104736328125,
0.42626953125,
0.134521484375,
0.1422119140625,
-0.6142578125,
-0.1767578125,
0.2203369140625,
0.130615234375,
-0.27392578125,
-0.5712890625,
-0.305419921875,
-0.7958984375,
-0.71533203125,
-0.677734375,
-0.3134765625,
0.2445068359375,
0.494140625,
-0.1142578125,
-0.275634765625,
0.186279296875,
0.626953125,
-1.158203125,
0.99658203125,
-0.54248046875,
0.61572265625,
-0.6015625,
-0.228515625,
-0.8037109375,
0.1409912109375,
-0.67041015625,
-0.177978515625,
-0.5126953125,
0.50244140625,
-0.1689453125,
0.32177734375,
0.0711669921875,
0.459228515625,
-0.07586669921875,
-0.64111328125,
0.34423828125,
0.0015497207641601562,
-0.396484375,
0.86376953125,
0.625,
-0.0104827880859375,
-0.189208984375,
-0.0179901123046875,
-0.288330078125,
-0.443603515625,
1.048828125,
0.6650390625,
-0.0880126953125,
0.1168212890625,
-0.129150390625,
-0.0096588134765625,
-0.88037109375,
0.195556640625,
-0.50927734375,
0.195556640625,
0.06317138671875,
-0.372314453125,
0.5419921875,
1.1708984375,
-0.73583984375,
0.337646484375,
0.358642578125,
0.2734375,
0.205078125,
0.294921875,
-0.0279541015625,
0.61474609375,
0.1461181640625,
-0.2822265625,
0.035003662109375,
0.1375732421875,
0.0592041015625,
-0.043670654296875,
-0.10546875,
-0.9228515625,
-0.86328125,
0.0479736328125,
-0.204833984375,
0.349853515625,
0.41748046875,
-0.6181640625,
0.00174713134765625,
0.115478515625,
-0.537109375,
0.260009765625,
-1.1572265625,
-0.88134765625,
0.360107421875,
0.0643310546875,
-0.849609375,
0.0302886962890625,
-0.6318359375,
0.1295166015625,
-0.314697265625,
0.282958984375,
-0.359130859375,
0.2115478515625,
-0.34765625,
0.666015625,
-0.56689453125,
0.007755279541015625,
-0.020050048828125,
0.404052734375,
-0.66943359375,
-0.1929931640625,
0.01125335693359375,
1.265625,
0.153564453125,
0.09906005859375,
-0.50732421875,
0.277587890625,
-0.425048828125,
-0.2371826171875,
-0.4921875,
0.006622314453125,
-0.029327392578125,
0.2001953125,
-0.8173828125,
-0.0245513916015625,
-0.59326171875,
0.4853515625,
-0.02996826171875,
-0.4482421875,
-0.7001953125,
0.6923828125,
1.0263671875,
-0.0211334228515625,
0.2403564453125,
0.352783203125,
0.385498046875,
-0.1746826171875,
-0.130615234375,
-0.3056640625,
0.360595703125,
0.493408203125,
0.62939453125,
-0.399658203125,
0.327392578125,
0.8759765625,
0.196044921875,
-0.253662109375,
0.642578125,
-0.153076171875,
0.18701171875,
0.1705322265625,
-0.194580078125,
-0.2265625,
-0.0869140625,
-0.77294921875,
0.363037109375,
-0.48974609375,
0.246826171875,
-0.052520751953125,
-0.69873046875,
0.9501953125,
-0.1849365234375,
-0.35205078125,
0.17431640625,
-0.50390625,
0.157958984375,
0.68359375,
0.166259765625,
-0.314208984375,
0.86669921875,
0.806640625,
1.021484375,
0.80517578125,
0.853515625,
0.1375732421875,
-0.74462890625,
0.50830078125,
-0.101318359375,
-0.03363037109375,
-0.4658203125,
-0.50439453125,
-1.0498046875,
0.2122802734375,
-0.29248046875,
-0.10540771484375,
0.4130859375,
-0.939453125,
0.18115234375,
-0.477294921875,
0.86865234375,
-0.6376953125,
0.369384765625,
0.5126953125,
-0.55078125,
-0.7509765625,
0.52783203125,
-0.07666015625,
0.419189453125,
0.3623046875,
1.123046875,
0.27978515625,
1.17578125,
0.59033203125,
-0.291748046875,
0.23486328125,
0.619140625,
-0.286376953125,
-0.87451171875,
-0.244873046875,
0.00656890869140625,
-0.14892578125,
-0.66748046875,
-0.213623046875,
-0.29443359375,
0.84033203125,
-0.078857421875,
-0.76123046875,
-0.58740234375,
0.30322265625,
-0.986328125,
0.423583984375,
0.297119140625,
0.55517578125,
0.0018100738525390625,
-0.27294921875,
-0.34130859375,
0.07568359375,
0.6162109375,
-0.258056640625,
0.66796875,
-0.64404296875,
-0.66845703125,
-0.3603515625,
-0.50341796875,
-0.1182861328125,
-0.34375,
-0.658203125,
-1.1240234375,
0.40771484375,
0.7861328125,
0.58447265625,
0.331298828125,
-0.0269927978515625,
0.035675048828125,
0.95654296875,
0.84765625,
0.13916015625,
0.9404296875,
0.63525390625,
-0.6806640625,
0.34814453125,
-0.52880859375,
0.80078125,
-0.1563720703125,
-0.20703125,
-0.34765625,
0.163330078125,
-1.1552734375,
-1.4677734375,
-0.21044921875,
0.67236328125,
0.38232421875,
-0.485595703125,
-1.435546875,
-0.259033203125,
-0.8935546875,
0.040557861328125,
-0.4169921875,
0.65869140625,
-0.2464599609375,
-0.033538818359375,
-0.345458984375,
-1.2294921875,
4.19140625,
0.65771484375,
0.5859375,
0.173828125,
0.323974609375,
1.0068359375,
0.473876953125,
-0.472412109375,
-0.3515625,
-0.382568359375,
0.47705078125,
-0.4833984375,
-0.0889892578125,
1.060546875,
0.365234375,
0.48486328125,
-0.515625,
0.2254638671875,
-0.2666015625,
-0.85498046875,
-1.15625,
0.1939697265625,
0.38134765625,
0.4130859375,
-0.125244140625,
0.58935546875,
0.80419921875,
-0.57373046875,
-0.449462890625,
-0.68994140625,
0.1287841796875,
-0.59814453125,
0.77587890625,
0.1611328125,
-0.30908203125,
0.71142578125,
-0.2685546875,
-0.412353515625,
-0.26318359375,
0.43408203125,
-0.4169921875,
-0.322021484375,
0.28173828125,
-0.4375,
0.057098388671875,
0.72412109375,
-0.38623046875,
0.487548828125,
-0.00919342041015625,
-0.9482421875,
0.6669921875,
-0.2900390625,
0.2822265625,
-0.6943359375,
-0.79541015625,
0.08660888671875,
0.195068359375,
-0.1597900390625,
-0.007534027099609375,
0.5703125,
0.25244140625,
0.43359375,
0.4384765625,
0.8603515625,
-0.7333984375,
0.7177734375,
0.40869140625,
0.42724609375,
-0.505859375,
0.040618896484375,
0.2342529296875,
-0.79443359375,
-0.483642578125,
-0.5322265625,
0.1287841796875,
0.478515625,
-0.2015380859375,
0.2822265625,
0.9140625,
-0.9091796875,
0.28662109375,
0.1160888671875,
-0.03936767578125,
-0.36962890625,
0.6650390625,
1.29296875,
-0.5576171875,
-0.1475830078125,
-0.73193359375,
0.51904296875,
0.462158203125,
0.75390625,
0.2490234375,
-0.410400390625,
-0.51806640625
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
Input
A text is given in a line. You can assume the following conditions:
* The number of letters in the text is less than or equal to 1000.
* The number of letters in a word is less than or equal to 32.
* There is only one word which is arise most frequently in given text.
* There is only one word which has the maximum number of letters in given text.
Output
The two words separated by a space.
Example
Input
Thank you for your mail and your lectures
Output
your lectures
"Correct Solution:
```
from collections import Counter
s = list(input().split())
c = Counter(s)
n,m = 0,0
for e in s:
if n < len(e):
n = len(e)
m = e
print(c.most_common()[0][0],m)
```
| 66,375
|
[
0.3525390625,
0.03125,
0.062164306640625,
0.364013671875,
-0.60888671875,
-0.480224609375,
-0.1358642578125,
0.275390625,
-0.0234375,
0.96044921875,
0.375732421875,
0.06292724609375,
-0.08306884765625,
-0.59716796875,
-0.88818359375,
-0.296875,
-0.6611328125,
-1.08984375,
-0.50390625,
-0.06646728515625,
-0.2381591796875,
0.483642578125,
-1.40234375,
-0.07568359375,
-0.20068359375,
0.9140625,
0.3974609375,
-0.0165252685546875,
1.2265625,
1.1279296875,
-0.2095947265625,
-0.427490234375,
0.301513671875,
-1.0390625,
-0.3505859375,
-0.374267578125,
0.916015625,
-1.1142578125,
-0.2802734375,
-0.71435546875,
0.23583984375,
-0.73095703125,
0.6787109375,
-0.92724609375,
-1.1982421875,
0.059783935546875,
-0.07476806640625,
-0.410888671875,
-0.1260986328125,
-0.343505859375,
0.1138916015625,
-0.55810546875,
0.33642578125,
-0.282958984375,
-0.0625,
-0.0650634765625,
0.012298583984375,
-0.28759765625,
-0.359130859375,
0.2369384765625,
0.5,
0.5693359375,
0.08062744140625,
-0.55126953125,
-0.4453125,
0.369140625,
-0.139892578125,
-0.012115478515625,
0.185302734375,
-0.32470703125,
-0.06524658203125,
0.24267578125,
-0.08050537109375,
-0.420166015625,
-0.62353515625,
-0.2213134765625,
0.273681640625,
-0.300048828125,
-0.54052734375,
0.8974609375,
0.0784912109375,
0.7421875,
0.4365234375,
0.46923828125,
-0.79345703125,
-0.669921875,
0.13330078125,
-0.119140625,
0.369873046875,
-0.49609375,
-0.447265625,
0.34521484375,
-0.552734375,
0.2958984375,
0.91943359375,
0.406494140625,
-0.49462890625,
0.099853515625,
0.55078125,
0.64501953125,
0.7861328125,
1.0009765625,
-0.462158203125,
0.97900390625,
-0.60986328125,
0.188232421875,
0.53564453125,
-0.10400390625,
-0.21875,
0.03564453125,
-0.52197265625,
-0.027191162109375,
0.6455078125,
0.333740234375,
-0.2476806640625,
1.048828125,
-0.093017578125,
0.6318359375,
-0.826171875,
0.54931640625,
0.50146484375,
0.383544921875,
0.2431640625,
-0.483154296875,
0.006656646728515625,
-0.42236328125,
-0.61376953125,
1.10546875,
-0.3583984375,
-0.20458984375,
0.2265625,
-0.126708984375,
-0.1806640625,
0.669921875,
-0.0015888214111328125,
0.63427734375,
0.1575927734375,
0.474853515625,
0.7734375,
-0.54052734375,
0.80126953125,
-0.30224609375,
0.07379150390625,
1.595703125,
0.2158203125,
0.13037109375,
0.50927734375,
0.59375,
-0.81640625,
0.490478515625,
-1.2099609375,
1.1494140625,
-0.373046875,
0.57080078125,
-0.3359375,
-0.0947265625,
0.025238037109375,
0.0014810562133789062,
0.0694580078125,
-0.101318359375,
-0.09356689453125,
0.3857421875,
-0.2159423828125,
0.92724609375,
-0.29931640625,
0.81689453125,
-0.55712890625,
-0.2425537109375,
-0.2161865234375,
-0.188720703125,
0.12060546875,
-0.26416015625,
0.0841064453125,
0.86962890625,
0.3427734375,
0.8642578125,
0.82861328125,
-0.5439453125,
0.333984375,
0.333251953125,
-0.69873046875,
0.0171966552734375,
0.1270751953125,
0.45263671875,
0.21728515625,
0.52392578125,
0.05072021484375,
-0.1912841796875,
-0.80810546875,
-0.418701171875,
0.320068359375,
0.861328125,
-0.806640625,
-0.1793212890625,
-0.05657958984375,
0.0262298583984375,
-0.5732421875,
0.08758544921875,
-0.02862548828125,
-0.8408203125,
-0.560546875,
0.75341796875,
0.1312255859375,
0.537109375,
-0.4794921875,
-0.52685546875,
0.34765625,
1.3486328125,
-0.475341796875,
0.12469482421875,
0.75,
0.0960693359375,
-0.2120361328125,
0.208251953125,
0.421875,
0.07672119140625,
-1.0341796875,
0.74755859375,
-0.6630859375,
-0.1883544921875,
0.11676025390625,
0.607421875,
0.30517578125,
0.41748046875,
-0.365478515625,
-0.47998046875,
0.452392578125,
1.2158203125,
0.01320648193359375,
0.888671875,
0.059967041015625,
1.11328125,
0.30126953125,
0.7451171875,
0.4453125,
0.320068359375,
0.857421875,
0.69482421875,
-0.2119140625,
0.10211181640625,
-0.1304931640625,
0.54931640625,
0.47998046875,
1.0732421875,
0.005916595458984375,
0.81982421875,
-0.546875,
-0.04443359375,
-0.354248046875,
0.80908203125,
-0.2137451171875,
0.423828125,
0.11968994140625,
0.23193359375,
-0.73828125,
-0.2919921875,
0.2486572265625,
1.08203125,
-1.021484375,
-0.5341796875,
-0.449951171875,
0.09234619140625,
0.267333984375,
0.1531982421875,
0.052154541015625,
0.37646484375,
0.6005859375,
0.6376953125,
-0.47509765625,
-0.3525390625,
-0.72021484375,
-0.7734375,
-1.115234375,
-0.7119140625,
-0.70849609375,
-0.228271484375,
-0.03515625,
-0.720703125,
0.0081634521484375,
-0.298095703125,
-0.57373046875,
-0.082275390625,
-0.315673828125,
0.53955078125,
-0.640625,
0.7275390625,
-0.483642578125,
0.42041015625,
0.2000732421875,
1.193359375,
-0.7548828125,
-0.4072265625,
-0.300537109375,
-0.51318359375,
0.54541015625,
0.22265625,
0.488525390625,
0.1602783203125,
-0.568359375,
-1.0009765625,
-0.46923828125,
-0.272705078125,
-0.354248046875,
0.252685546875,
-0.63525390625,
1.03125,
-0.0219879150390625,
-0.70263671875,
0.51806640625,
1.1826171875,
-0.984375,
0.431396484375,
0.4228515625,
-0.08087158203125,
-0.73095703125,
1.2158203125,
0.23681640625,
0.44189453125,
-0.189697265625,
-0.09661865234375,
-0.12042236328125,
-0.1298828125,
-0.0621337890625,
-0.81884765625,
-0.142578125,
0.447021484375,
0.127685546875,
-1.169921875,
0.3662109375,
-1.3330078125,
-0.513671875,
-0.338623046875,
-0.385986328125,
0.83837890625,
1.1005859375,
0.2435302734375,
-0.030517578125,
-0.493896484375,
-0.13525390625,
0.482177734375,
0.64794921875,
-1.0068359375,
0.0916748046875,
1.1669921875,
-0.041961669921875,
-0.3935546875,
0.2030029296875,
0.059478759765625,
-0.422119140625,
0.086669921875,
0.419921875,
1.1357421875,
0.258056640625,
0.26904296875,
-0.0027313232421875,
0.251708984375,
-0.8798828125,
-0.10748291015625,
-0.04083251953125,
0.61669921875,
0.451416015625,
0.57861328125,
0.6220703125,
0.28515625,
-0.484375,
-1.1484375,
0.406494140625,
0.285400390625,
1.189453125,
-1.0849609375,
0.89013671875,
0.1552734375,
-0.24609375,
0.53076171875,
-0.79052734375,
-0.0159149169921875,
1.10546875,
-0.08441162109375,
0.86083984375,
-0.9111328125,
0.1064453125,
-0.370849609375,
-0.08740234375,
0.9619140625,
0.44775390625,
0.615234375,
-0.1240234375,
-0.3037109375,
-0.63720703125,
-0.357177734375,
-0.212646484375,
-0.76171875,
0.166015625,
-0.458740234375,
-0.55322265625,
-0.81689453125,
0.40087890625,
0.4130859375,
0.202880859375,
-0.327392578125,
0.6591796875,
0.09161376953125,
0.332763671875,
0.7958984375,
-0.26220703125,
0.2119140625,
-0.60009765625,
1.0556640625,
0.255859375,
-0.042999267578125,
-0.7705078125,
-0.65966796875,
0.01462554931640625,
0.045745849609375,
0.340087890625,
-0.01715087890625,
-0.7861328125,
0.46337890625,
0.1617431640625,
0.4560546875,
-0.83837890625,
-0.12115478515625,
-0.06787109375,
0.408447265625,
0.34326171875,
-1.0009765625,
0.359130859375,
-0.97900390625,
0.65673828125,
0.505859375,
-0.2064208984375,
-0.470458984375,
-0.54248046875,
-0.85888671875,
-0.440673828125,
-0.2127685546875,
0.83349609375,
-0.1702880859375,
0.2353515625,
-0.884765625,
0.2420654296875,
0.69970703125,
-0.64599609375,
0.36669921875,
-0.032989501953125,
0.52197265625,
0.56201171875,
0.6181640625,
-0.66845703125,
-0.6806640625,
-0.031646728515625,
-1.2548828125,
0.16064453125,
-0.327880859375,
0.80419921875,
0.3408203125,
-0.249755859375,
-0.0302886962890625,
0.31396484375,
-0.291748046875,
0.1317138671875,
-0.197265625,
0.64013671875,
-1.0595703125,
-1.373046875,
0.59423828125,
-0.1964111328125,
-0.72119140625,
0.732421875,
-0.084228515625,
-0.24951171875,
-0.148193359375,
0.352783203125,
-0.390869140625,
0.30126953125,
-0.345458984375,
0.379638671875,
-0.2113037109375,
-0.76171875,
-0.1326904296875,
-0.6845703125,
0.88671875,
0.2008056640625,
-0.66357421875,
-0.06207275390625,
-1.1318359375,
-0.09063720703125,
-0.315185546875,
-0.6318359375,
0.413330078125,
0.239990234375,
-0.03936767578125,
-0.346435546875,
-0.1964111328125,
-0.439208984375,
-0.179443359375,
-0.257568359375,
-0.176025390625,
0.090087890625,
0.51171875,
0.5380859375,
0.2296142578125,
-0.37353515625,
0.1099853515625,
-0.047760009765625,
-0.362060546875,
-0.434326171875,
-0.1436767578125,
0.0789794921875,
-0.47705078125,
-0.1934814453125,
0.32666015625,
0.09796142578125,
0.332275390625,
1.0712890625,
0.298583984375,
0.330078125,
0.457275390625,
-0.4736328125,
1.2998046875,
0.1649169921875,
-1.3251953125,
-0.5439453125,
0.78955078125,
-0.4365234375,
0.67822265625,
0.34765625,
-0.921875,
-0.72998046875,
-0.7265625,
0.245361328125,
-0.64990234375,
-0.1937255859375,
-1.025390625,
-0.259521484375,
-0.18310546875,
0.85498046875,
-0.270263671875,
-0.5869140625,
0.295166015625,
-1.3623046875,
0.1773681640625,
-0.2025146484375,
-0.206787109375,
-1.35546875,
-0.474365234375,
-0.470458984375,
0.771484375,
-0.025787353515625,
0.61279296875,
-0.447265625,
0.2071533203125,
0.1585693359375,
-0.1417236328125,
-0.73828125,
-0.406494140625,
0.06414794921875,
0.25537109375,
-0.07916259765625,
-0.01081085205078125,
-0.51513671875,
0.859375,
-0.80908203125,
0.31494140625,
-0.1612548828125,
-0.533203125,
-0.11767578125,
-0.1556396484375,
1.0517578125,
-0.0660400390625,
-0.1871337890625,
-0.4599609375,
0.66455078125,
0.5380859375,
-0.0186767578125,
-0.4189453125,
-0.634765625,
-0.1988525390625,
-0.919921875,
0.482421875,
-0.33056640625,
0.28125,
-0.65478515625,
0.160888671875,
1.201171875,
-0.76416015625,
0.5185546875,
1.2197265625,
0.2481689453125,
0.24462890625,
-0.748046875,
0.59765625,
0.09381103515625,
-0.70556640625,
-0.28662109375,
-0.046051025390625,
-1.1416015625,
0.53466796875,
-0.76904296875,
-1.525390625,
-0.849609375,
0.6552734375,
1.609375,
-0.3564453125,
0.72802734375,
-0.027618408203125,
-0.966796875,
-0.6611328125,
0.693359375,
0.32763671875,
-0.06689453125,
1.0458984375,
-0.5703125,
-0.28369140625,
-0.2310791015625,
0.03485107421875,
-0.5615234375,
-0.35986328125,
1.1064453125,
-0.1715087890625,
-0.270263671875,
0.42138671875,
1.05078125,
-0.9814453125,
-0.97314453125,
0.0531005859375,
0.115478515625,
-0.10601806640625,
-0.99169921875,
0.13330078125,
0.57177734375,
-0.60791015625,
0.1064453125,
0.42138671875,
-0.1634521484375,
0.59716796875,
0.1881103515625,
0.27392578125,
-0.2587890625,
0.56396484375,
0.380126953125,
-0.2431640625,
-0.10296630859375,
-0.923828125,
0.143310546875,
-0.423828125,
-0.0105133056640625,
0.5791015625,
-0.46484375,
-0.04833984375,
0.7314453125,
-0.33056640625,
0.6787109375,
-0.34716796875,
-0.21240234375,
0.0633544921875,
-0.759765625,
-0.484130859375,
0.046966552734375,
0.3349609375,
0.1693115234375,
0.2352294921875,
-0.51416015625,
-0.250244140625,
0.2291259765625,
0.1683349609375,
-0.253662109375,
-0.472412109375,
-0.2587890625,
-0.8681640625,
-0.6865234375,
-0.6591796875,
-0.38818359375,
0.1690673828125,
0.447021484375,
-0.006710052490234375,
-0.1226806640625,
0.137939453125,
0.71923828125,
-1.0537109375,
1.12890625,
-0.6015625,
0.62890625,
-0.5888671875,
-0.30712890625,
-0.89599609375,
0.21630859375,
-0.49267578125,
-0.134033203125,
-0.482666015625,
0.501953125,
-0.05908203125,
0.331787109375,
0.12396240234375,
0.477783203125,
-0.0828857421875,
-0.607421875,
0.3017578125,
0.016876220703125,
-0.419189453125,
0.83984375,
0.59716796875,
-0.08624267578125,
-0.13671875,
-0.01535797119140625,
-0.409423828125,
-0.5458984375,
0.98974609375,
0.78515625,
-0.01117706298828125,
0.0216064453125,
-0.113037109375,
0.0706787109375,
-0.7470703125,
0.2049560546875,
-0.327880859375,
0.1181640625,
-0.00188446044921875,
-0.3447265625,
0.51953125,
1.1728515625,
-0.7451171875,
0.358642578125,
0.447998046875,
0.406494140625,
0.1427001953125,
0.38330078125,
0.007251739501953125,
0.61083984375,
0.2047119140625,
-0.281005859375,
0.1524658203125,
0.12060546875,
0.087158203125,
0.0357666015625,
-0.138427734375,
-0.79833984375,
-0.8232421875,
0.0008182525634765625,
-0.28466796875,
0.259033203125,
0.298828125,
-0.7451171875,
0.04510498046875,
0.00908660888671875,
-0.451416015625,
0.2020263671875,
-1.16796875,
-0.986328125,
0.368408203125,
0.187255859375,
-0.84375,
0.0265960693359375,
-0.58837890625,
0.16796875,
-0.3173828125,
0.147216796875,
-0.35009765625,
0.24267578125,
-0.3798828125,
0.7177734375,
-0.5693359375,
-0.0625,
-0.023193359375,
0.424560546875,
-0.6396484375,
-0.287109375,
-0.043609619140625,
1.2802734375,
0.042449951171875,
0.1900634765625,
-0.5419921875,
0.2171630859375,
-0.4765625,
-0.2147216796875,
-0.349853515625,
-0.083251953125,
-0.049896240234375,
0.30078125,
-0.85498046875,
-0.0311126708984375,
-0.493408203125,
0.416748046875,
-0.09295654296875,
-0.46826171875,
-0.77099609375,
0.810546875,
1.0908203125,
-0.0233154296875,
0.307373046875,
0.26416015625,
0.469482421875,
-0.1502685546875,
-0.047149658203125,
-0.391845703125,
0.2384033203125,
0.35595703125,
0.7001953125,
-0.459716796875,
0.42724609375,
0.935546875,
0.1610107421875,
-0.193359375,
0.62646484375,
-0.281982421875,
0.0845947265625,
0.1812744140625,
-0.133056640625,
-0.2255859375,
-0.10784912109375,
-1.1064453125,
0.44677734375,
-0.5673828125,
0.294677734375,
-0.0638427734375,
-0.73486328125,
0.9736328125,
-0.215087890625,
-0.28564453125,
0.1575927734375,
-0.5771484375,
0.182861328125,
0.73095703125,
0.1041259765625,
-0.283935546875,
0.78076171875,
0.76904296875,
1.0712890625,
0.65966796875,
0.8095703125,
0.26318359375,
-0.60693359375,
0.380615234375,
-0.0157470703125,
-0.05877685546875,
-0.61328125,
-0.48486328125,
-1.0390625,
0.1981201171875,
-0.3662109375,
0.037384033203125,
0.4375,
-0.9580078125,
0.10833740234375,
-0.52587890625,
0.849609375,
-0.73583984375,
0.43994140625,
0.5478515625,
-0.529296875,
-0.64892578125,
0.59912109375,
0.033203125,
0.50048828125,
0.346923828125,
1.0673828125,
0.114501953125,
1.1982421875,
0.5966796875,
-0.11956787109375,
0.1868896484375,
0.642578125,
-0.34228515625,
-0.90966796875,
-0.258056640625,
0.07623291015625,
-0.1383056640625,
-0.5546875,
-0.185546875,
-0.284423828125,
0.873046875,
-0.135009765625,
-0.81298828125,
-0.728515625,
0.349365234375,
-0.93310546875,
0.419921875,
0.38818359375,
0.457275390625,
-0.04779052734375,
-0.33447265625,
-0.41845703125,
0.137939453125,
0.5205078125,
-0.308837890625,
0.67919921875,
-0.58544921875,
-0.64013671875,
-0.43115234375,
-0.6455078125,
-0.1778564453125,
-0.263671875,
-0.48486328125,
-1.0947265625,
0.328369140625,
0.74755859375,
0.61083984375,
0.2259521484375,
-0.11785888671875,
0.18603515625,
0.95263671875,
0.88134765625,
0.048675537109375,
0.92333984375,
0.5546875,
-0.740234375,
0.35205078125,
-0.486328125,
0.8193359375,
-0.190185546875,
-0.1298828125,
-0.341796875,
0.211669921875,
-1.0859375,
-1.4306640625,
-0.29736328125,
0.73046875,
0.4599609375,
-0.46484375,
-1.41796875,
-0.275390625,
-0.806640625,
0.045562744140625,
-0.437744140625,
0.6552734375,
-0.026214599609375,
-0.055877685546875,
-0.408203125,
-1.1953125,
4.1328125,
0.71826171875,
0.455078125,
0.1802978515625,
0.251708984375,
0.97216796875,
0.517578125,
-0.51953125,
-0.2193603515625,
-0.27294921875,
0.51416015625,
-0.59326171875,
-0.08770751953125,
1.0439453125,
0.37060546875,
0.3984375,
-0.697265625,
0.31591796875,
-0.205078125,
-0.8701171875,
-1.1240234375,
0.21435546875,
0.3076171875,
0.311279296875,
-0.1671142578125,
0.50146484375,
0.78857421875,
-0.72705078125,
-0.449462890625,
-0.763671875,
0.1937255859375,
-0.6142578125,
0.82470703125,
0.20947265625,
-0.2359619140625,
0.72314453125,
-0.210693359375,
-0.427001953125,
-0.36669921875,
0.374755859375,
-0.427490234375,
-0.264892578125,
0.351806640625,
-0.42138671875,
0.07177734375,
0.755859375,
-0.491943359375,
0.469970703125,
0.01788330078125,
-0.8876953125,
0.80859375,
-0.283447265625,
0.401611328125,
-0.63525390625,
-0.81689453125,
-0.05926513671875,
0.307861328125,
-0.22705078125,
-0.077392578125,
0.53955078125,
0.292236328125,
0.387451171875,
0.54736328125,
0.97216796875,
-0.8701171875,
0.689453125,
0.2998046875,
0.378173828125,
-0.48095703125,
-0.08465576171875,
0.327880859375,
-0.8173828125,
-0.5205078125,
-0.45556640625,
0.046051025390625,
0.5029296875,
-0.317138671875,
0.283935546875,
0.970703125,
-0.98779296875,
0.271728515625,
0.161376953125,
-0.08038330078125,
-0.321533203125,
0.671875,
1.33203125,
-0.5576171875,
-0.2301025390625,
-0.73046875,
0.51513671875,
0.467529296875,
0.74365234375,
0.13330078125,
-0.374267578125,
-0.54541015625
] | 6
|
Provide a correct Python 3 solution for this coding contest problem.
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
The text includes only alphabetical characters and spaces. A word is a sequence of letters which is separated by the spaces.
Input
A text is given in a line. You can assume the following conditions:
* The number of letters in the text is less than or equal to 1000.
* The number of letters in a word is less than or equal to 32.
* There is only one word which is arise most frequently in given text.
* There is only one word which has the maximum number of letters in given text.
Output
The two words separated by a space.
Example
Input
Thank you for your mail and your lectures
Output
your lectures
"Correct Solution:
```
import collections
x = input().split()
c = collections.Counter(x)
max = 0
for i in range(len(x)):
a = len(x[i])
if a>max:
max = a
M = x[i]
print(c.most_common()[0][0], M)
```
| 66,377
|
[
0.40087890625,
0.038818359375,
0.1259765625,
0.409423828125,
-0.626953125,
-0.533203125,
-0.1409912109375,
0.271484375,
0.0189361572265625,
0.962890625,
0.348388671875,
0.094970703125,
-0.10736083984375,
-0.5927734375,
-0.841796875,
-0.2431640625,
-0.6083984375,
-1.091796875,
-0.415283203125,
-0.059478759765625,
-0.2342529296875,
0.52001953125,
-1.3896484375,
-0.11376953125,
-0.245361328125,
0.935546875,
0.44384765625,
-0.06719970703125,
1.2392578125,
1.193359375,
-0.19873046875,
-0.357666015625,
0.250732421875,
-1.03515625,
-0.395751953125,
-0.3759765625,
0.9697265625,
-1.0751953125,
-0.270751953125,
-0.71142578125,
0.2166748046875,
-0.73486328125,
0.70458984375,
-0.92626953125,
-1.1982421875,
0.06988525390625,
-0.0164794921875,
-0.37353515625,
-0.159423828125,
-0.42138671875,
0.067138671875,
-0.556640625,
0.35888671875,
-0.253662109375,
-0.11334228515625,
-0.06732177734375,
0.01171875,
-0.339111328125,
-0.3427734375,
0.2420654296875,
0.465087890625,
0.5703125,
0.07611083984375,
-0.609375,
-0.41162109375,
0.4248046875,
-0.0965576171875,
-0.0010538101196289062,
0.18603515625,
-0.314697265625,
-0.07122802734375,
0.254150390625,
-0.035614013671875,
-0.393798828125,
-0.650390625,
-0.1783447265625,
0.283935546875,
-0.25634765625,
-0.494384765625,
0.94287109375,
0.144287109375,
0.67529296875,
0.378173828125,
0.483642578125,
-0.8349609375,
-0.65576171875,
0.130615234375,
-0.09356689453125,
0.344482421875,
-0.5390625,
-0.509765625,
0.35791015625,
-0.4970703125,
0.314208984375,
0.93017578125,
0.4609375,
-0.479248046875,
0.1522216796875,
0.5390625,
0.6240234375,
0.7060546875,
1.0634765625,
-0.456298828125,
0.97509765625,
-0.56591796875,
0.2529296875,
0.525390625,
-0.134033203125,
-0.1978759765625,
0.0302581787109375,
-0.53173828125,
0.0369873046875,
0.68798828125,
0.267578125,
-0.268798828125,
1.0302734375,
-0.08544921875,
0.5595703125,
-0.8017578125,
0.55615234375,
0.517578125,
0.361572265625,
0.2451171875,
-0.46875,
0.01483917236328125,
-0.51953125,
-0.65380859375,
1.07421875,
-0.3447265625,
-0.17919921875,
0.1700439453125,
-0.1402587890625,
-0.2403564453125,
0.70947265625,
0.04962158203125,
0.68115234375,
0.125732421875,
0.47998046875,
0.7529296875,
-0.57861328125,
0.8017578125,
-0.33251953125,
0.1114501953125,
1.5888671875,
0.287109375,
0.07073974609375,
0.54296875,
0.60986328125,
-0.7646484375,
0.48095703125,
-1.2861328125,
1.1279296875,
-0.441650390625,
0.51611328125,
-0.31396484375,
-0.08392333984375,
-0.01410675048828125,
-0.0017862319946289062,
0.051910400390625,
-0.062225341796875,
-0.109130859375,
0.347900390625,
-0.224853515625,
0.890625,
-0.291259765625,
0.82861328125,
-0.583984375,
-0.232421875,
-0.2379150390625,
-0.09814453125,
0.138916015625,
-0.254150390625,
0.10736083984375,
0.8408203125,
0.3173828125,
0.9169921875,
0.828125,
-0.5439453125,
0.31396484375,
0.28759765625,
-0.6630859375,
0.06500244140625,
0.0819091796875,
0.486572265625,
0.2093505859375,
0.4677734375,
0.0203704833984375,
-0.127197265625,
-0.728515625,
-0.448974609375,
0.305908203125,
0.8046875,
-0.859375,
-0.1871337890625,
-0.1475830078125,
0.06243896484375,
-0.58837890625,
0.11553955078125,
-0.062347412109375,
-0.84375,
-0.5849609375,
0.73974609375,
0.1617431640625,
0.5126953125,
-0.429931640625,
-0.57177734375,
0.35791015625,
1.3251953125,
-0.487548828125,
0.0938720703125,
0.79638671875,
0.09619140625,
-0.1495361328125,
0.2322998046875,
0.42138671875,
0.030853271484375,
-1.111328125,
0.7724609375,
-0.71240234375,
-0.152587890625,
0.1971435546875,
0.54296875,
0.33447265625,
0.4287109375,
-0.386474609375,
-0.46044921875,
0.435791015625,
1.1630859375,
-0.024078369140625,
0.88671875,
0.041229248046875,
1.0703125,
0.295654296875,
0.7578125,
0.43017578125,
0.293701171875,
0.8935546875,
0.6630859375,
-0.259033203125,
0.0828857421875,
-0.14404296875,
0.56640625,
0.48681640625,
1.05078125,
-0.016815185546875,
0.794921875,
-0.59716796875,
-0.109375,
-0.30908203125,
0.8173828125,
-0.1932373046875,
0.468017578125,
0.0885009765625,
0.28076171875,
-0.70751953125,
-0.316650390625,
0.259765625,
1.0537109375,
-1.0185546875,
-0.56298828125,
-0.388916015625,
0.0775146484375,
0.2335205078125,
0.158447265625,
0.01043701171875,
0.385986328125,
0.57470703125,
0.607421875,
-0.446044921875,
-0.35009765625,
-0.75927734375,
-0.74951171875,
-1.0791015625,
-0.734375,
-0.70361328125,
-0.1427001953125,
0.0193023681640625,
-0.7216796875,
-0.01194000244140625,
-0.274658203125,
-0.5634765625,
-0.1575927734375,
-0.349365234375,
0.50927734375,
-0.5908203125,
0.7236328125,
-0.546875,
0.409423828125,
0.219970703125,
1.24609375,
-0.84130859375,
-0.387451171875,
-0.3154296875,
-0.50146484375,
0.5146484375,
0.246826171875,
0.46240234375,
0.19970703125,
-0.556640625,
-0.9443359375,
-0.4951171875,
-0.2744140625,
-0.40625,
0.25244140625,
-0.62060546875,
1.0068359375,
0.036224365234375,
-0.69091796875,
0.53125,
1.1328125,
-0.9697265625,
0.4150390625,
0.410888671875,
-0.0032711029052734375,
-0.7451171875,
1.1962890625,
0.25927734375,
0.423583984375,
-0.19677734375,
-0.11273193359375,
-0.1160888671875,
-0.1246337890625,
-0.09375,
-0.85498046875,
-0.15283203125,
0.449462890625,
0.0794677734375,
-1.173828125,
0.37255859375,
-1.3662109375,
-0.55224609375,
-0.357666015625,
-0.359130859375,
0.8955078125,
1.029296875,
0.298828125,
-0.0247955322265625,
-0.501953125,
-0.14306640625,
0.4296875,
0.6640625,
-0.9931640625,
0.126953125,
1.1865234375,
-0.06146240234375,
-0.41796875,
0.1328125,
0.0579833984375,
-0.47412109375,
0.05633544921875,
0.384765625,
1.162109375,
0.221923828125,
0.27099609375,
-0.051361083984375,
0.2197265625,
-0.91259765625,
-0.0823974609375,
-0.107666015625,
0.60595703125,
0.4365234375,
0.55712890625,
0.595703125,
0.281005859375,
-0.4736328125,
-1.1201171875,
0.36083984375,
0.366943359375,
1.1904296875,
-1.1240234375,
0.91748046875,
0.232177734375,
-0.286865234375,
0.54345703125,
-0.7568359375,
0.060821533203125,
1.140625,
-0.044219970703125,
0.828125,
-0.93994140625,
0.042449951171875,
-0.35888671875,
-0.114013671875,
1.0205078125,
0.449462890625,
0.64599609375,
-0.125,
-0.316650390625,
-0.6396484375,
-0.302734375,
-0.2191162109375,
-0.77294921875,
0.189208984375,
-0.467041015625,
-0.556640625,
-0.88037109375,
0.3857421875,
0.443359375,
0.1468505859375,
-0.313232421875,
0.68212890625,
0.043121337890625,
0.25927734375,
0.79541015625,
-0.2978515625,
0.2098388671875,
-0.60400390625,
1.0888671875,
0.2998046875,
-0.0675048828125,
-0.76220703125,
-0.70263671875,
0.0202484130859375,
0.0173187255859375,
0.36474609375,
-0.005645751953125,
-0.72265625,
0.43994140625,
0.2396240234375,
0.5166015625,
-0.83203125,
-0.0506591796875,
-0.05462646484375,
0.423828125,
0.3779296875,
-1.0009765625,
0.341064453125,
-0.9921875,
0.6640625,
0.498046875,
-0.1268310546875,
-0.499267578125,
-0.50634765625,
-0.92431640625,
-0.50634765625,
-0.2076416015625,
0.86376953125,
-0.2288818359375,
0.260498046875,
-0.8671875,
0.135009765625,
0.67431640625,
-0.6318359375,
0.402099609375,
-0.07598876953125,
0.494873046875,
0.52587890625,
0.62548828125,
-0.66455078125,
-0.7548828125,
0.00629425048828125,
-1.294921875,
0.1761474609375,
-0.34912109375,
0.7470703125,
0.372314453125,
-0.2218017578125,
-0.0234222412109375,
0.301513671875,
-0.240234375,
0.17578125,
-0.2305908203125,
0.6484375,
-1.0693359375,
-1.3662109375,
0.6416015625,
-0.2305908203125,
-0.72119140625,
0.70166015625,
-0.12005615234375,
-0.278076171875,
-0.1126708984375,
0.35693359375,
-0.421142578125,
0.300537109375,
-0.287109375,
0.396484375,
-0.2451171875,
-0.74365234375,
-0.03240966796875,
-0.64453125,
0.87744140625,
0.1978759765625,
-0.6787109375,
-0.055206298828125,
-1.1689453125,
-0.08148193359375,
-0.310791015625,
-0.595703125,
0.483642578125,
0.1951904296875,
-0.0243682861328125,
-0.373779296875,
-0.2374267578125,
-0.382080078125,
-0.154296875,
-0.245849609375,
-0.1766357421875,
0.09320068359375,
0.50927734375,
0.498779296875,
0.171142578125,
-0.353759765625,
0.1722412109375,
-0.035980224609375,
-0.390869140625,
-0.4375,
-0.173095703125,
0.03277587890625,
-0.5390625,
-0.2412109375,
0.31396484375,
0.09466552734375,
0.342041015625,
1.05859375,
0.28515625,
0.40576171875,
0.50341796875,
-0.482666015625,
1.2373046875,
0.127685546875,
-1.31640625,
-0.52392578125,
0.83935546875,
-0.46337890625,
0.67919921875,
0.4296875,
-0.96923828125,
-0.7705078125,
-0.68994140625,
0.2088623046875,
-0.69287109375,
-0.1898193359375,
-1.078125,
-0.28564453125,
-0.1602783203125,
0.88720703125,
-0.264404296875,
-0.564453125,
0.322509765625,
-1.31640625,
0.1658935546875,
-0.260009765625,
-0.205078125,
-1.341796875,
-0.46484375,
-0.40234375,
0.74462890625,
-0.06646728515625,
0.611328125,
-0.4228515625,
0.189208984375,
0.15966796875,
-0.1614990234375,
-0.736328125,
-0.379638671875,
0.0296478271484375,
0.253173828125,
-0.0645751953125,
-0.01253509521484375,
-0.46728515625,
0.84228515625,
-0.78857421875,
0.37451171875,
-0.1658935546875,
-0.5146484375,
-0.22607421875,
-0.154296875,
1.0244140625,
-0.10296630859375,
-0.184326171875,
-0.485595703125,
0.6123046875,
0.50732421875,
-0.0272064208984375,
-0.40478515625,
-0.56005859375,
-0.1307373046875,
-0.9326171875,
0.556640625,
-0.352294921875,
0.2083740234375,
-0.630859375,
0.1781005859375,
1.208984375,
-0.74951171875,
0.51123046875,
1.2978515625,
0.271728515625,
0.2783203125,
-0.70166015625,
0.66650390625,
0.08172607421875,
-0.67431640625,
-0.261962890625,
-0.09320068359375,
-1.14453125,
0.5068359375,
-0.783203125,
-1.556640625,
-0.822265625,
0.6455078125,
1.6552734375,
-0.357421875,
0.7294921875,
0.014404296875,
-1.005859375,
-0.66015625,
0.66943359375,
0.35205078125,
-0.11724853515625,
1.05078125,
-0.59228515625,
-0.272705078125,
-0.2425537109375,
0.01395416259765625,
-0.6083984375,
-0.41259765625,
1.134765625,
-0.1932373046875,
-0.2529296875,
0.39453125,
1.1162109375,
-0.93701171875,
-1.0185546875,
-0.00440216064453125,
0.153564453125,
-0.07525634765625,
-0.9951171875,
0.1099853515625,
0.54931640625,
-0.63818359375,
0.1666259765625,
0.45068359375,
-0.1680908203125,
0.57470703125,
0.1378173828125,
0.248779296875,
-0.28369140625,
0.5361328125,
0.377685546875,
-0.25830078125,
-0.12042236328125,
-0.94580078125,
0.15673828125,
-0.41650390625,
-0.0271453857421875,
0.6201171875,
-0.50341796875,
-0.041351318359375,
0.66943359375,
-0.322998046875,
0.650390625,
-0.294677734375,
-0.1806640625,
0.04974365234375,
-0.76025390625,
-0.52587890625,
0.05377197265625,
0.3818359375,
0.208251953125,
0.2127685546875,
-0.58154296875,
-0.2274169921875,
0.2939453125,
0.1444091796875,
-0.2119140625,
-0.5322265625,
-0.268310546875,
-0.89208984375,
-0.693359375,
-0.68359375,
-0.339599609375,
0.21337890625,
0.453369140625,
-0.0298309326171875,
-0.2381591796875,
0.183837890625,
0.65576171875,
-1.0751953125,
1.01953125,
-0.57861328125,
0.67041015625,
-0.537109375,
-0.2822265625,
-0.912109375,
0.1663818359375,
-0.49609375,
-0.08636474609375,
-0.51708984375,
0.5078125,
-0.104736328125,
0.291748046875,
0.1368408203125,
0.487548828125,
-0.056854248046875,
-0.642578125,
0.31494140625,
0.01361083984375,
-0.366943359375,
0.88134765625,
0.6474609375,
-0.05950927734375,
-0.171142578125,
-0.0123291015625,
-0.372314453125,
-0.52783203125,
1.0244140625,
0.75,
-0.0013103485107421875,
0.0682373046875,
-0.05865478515625,
0.07208251953125,
-0.830078125,
0.179443359375,
-0.365234375,
0.1622314453125,
0.059600830078125,
-0.397216796875,
0.54248046875,
1.1650390625,
-0.75,
0.39404296875,
0.4208984375,
0.399169921875,
0.1783447265625,
0.37939453125,
-0.03570556640625,
0.6474609375,
0.2015380859375,
-0.32275390625,
0.1451416015625,
0.12353515625,
0.01763916015625,
-0.0149383544921875,
-0.10791015625,
-0.84375,
-0.84716796875,
-0.01983642578125,
-0.269287109375,
0.269775390625,
0.32421875,
-0.7548828125,
0.01983642578125,
0.033233642578125,
-0.464599609375,
0.221435546875,
-1.2109375,
-0.9228515625,
0.348876953125,
0.1724853515625,
-0.78515625,
0.07073974609375,
-0.55615234375,
0.2347412109375,
-0.31689453125,
0.1287841796875,
-0.36181640625,
0.2486572265625,
-0.3583984375,
0.7177734375,
-0.55712890625,
-0.038543701171875,
-0.01450347900390625,
0.45556640625,
-0.6474609375,
-0.2626953125,
-0.03216552734375,
1.2333984375,
0.072021484375,
0.202392578125,
-0.50390625,
0.235107421875,
-0.5048828125,
-0.225341796875,
-0.459228515625,
-0.1429443359375,
-0.032196044921875,
0.255126953125,
-0.87353515625,
-0.0731201171875,
-0.5322265625,
0.44140625,
-0.0335693359375,
-0.45556640625,
-0.74755859375,
0.85693359375,
1.0830078125,
-0.043548583984375,
0.298095703125,
0.296630859375,
0.45947265625,
-0.10986328125,
-0.054290771484375,
-0.389404296875,
0.272705078125,
0.36279296875,
0.7607421875,
-0.449951171875,
0.404541015625,
0.966796875,
0.1597900390625,
-0.2069091796875,
0.62060546875,
-0.281494140625,
0.07269287109375,
0.1588134765625,
-0.0997314453125,
-0.23583984375,
-0.17333984375,
-1.0263671875,
0.43408203125,
-0.53955078125,
0.21337890625,
-0.048828125,
-0.74462890625,
0.9521484375,
-0.215576171875,
-0.274169921875,
0.22021484375,
-0.59716796875,
0.17333984375,
0.7080078125,
0.12139892578125,
-0.315673828125,
0.77880859375,
0.80419921875,
1.1455078125,
0.67626953125,
0.8232421875,
0.312255859375,
-0.60302734375,
0.400390625,
-0.09747314453125,
-0.01483154296875,
-0.5810546875,
-0.50146484375,
-1.0595703125,
0.1640625,
-0.31689453125,
-0.0143890380859375,
0.409423828125,
-0.9765625,
0.1510009765625,
-0.5048828125,
0.91064453125,
-0.724609375,
0.40234375,
0.53271484375,
-0.54833984375,
-0.65185546875,
0.6455078125,
0.054901123046875,
0.482666015625,
0.371337890625,
1.0849609375,
0.1612548828125,
1.2626953125,
0.56787109375,
-0.151123046875,
0.219482421875,
0.66943359375,
-0.338134765625,
-0.8896484375,
-0.273193359375,
0.0855712890625,
-0.1304931640625,
-0.580078125,
-0.2147216796875,
-0.28466796875,
0.8310546875,
-0.12310791015625,
-0.8056640625,
-0.73193359375,
0.377685546875,
-0.955078125,
0.4140625,
0.37744140625,
0.459228515625,
-0.0411376953125,
-0.330322265625,
-0.3857421875,
0.10467529296875,
0.5341796875,
-0.33056640625,
0.67333984375,
-0.60595703125,
-0.6416015625,
-0.365234375,
-0.6220703125,
-0.1641845703125,
-0.30859375,
-0.52001953125,
-1.0986328125,
0.3251953125,
0.7607421875,
0.64208984375,
0.2154541015625,
-0.1514892578125,
0.1710205078125,
0.931640625,
0.845703125,
0.10845947265625,
0.935546875,
0.5830078125,
-0.74560546875,
0.34619140625,
-0.52734375,
0.794921875,
-0.1270751953125,
-0.1676025390625,
-0.284423828125,
0.214599609375,
-1.0966796875,
-1.5,
-0.330810546875,
0.70166015625,
0.449462890625,
-0.53466796875,
-1.4375,
-0.3212890625,
-0.87548828125,
0.08648681640625,
-0.397705078125,
0.68505859375,
-0.05035400390625,
-0.01531219482421875,
-0.4169921875,
-1.2353515625,
4.10546875,
0.6689453125,
0.492431640625,
0.2330322265625,
0.272216796875,
1.017578125,
0.5380859375,
-0.495849609375,
-0.338623046875,
-0.3203125,
0.6005859375,
-0.595703125,
-0.03717041015625,
1.064453125,
0.393310546875,
0.4287109375,
-0.69287109375,
0.290283203125,
-0.265869140625,
-0.84619140625,
-1.1484375,
0.23876953125,
0.3427734375,
0.356689453125,
-0.0794677734375,
0.5361328125,
0.80615234375,
-0.69921875,
-0.44775390625,
-0.822265625,
0.2056884765625,
-0.5634765625,
0.775390625,
0.189208984375,
-0.20556640625,
0.75,
-0.191650390625,
-0.415771484375,
-0.276123046875,
0.45849609375,
-0.435302734375,
-0.383544921875,
0.30517578125,
-0.399169921875,
0.07623291015625,
0.6630859375,
-0.4814453125,
0.443115234375,
-0.03857421875,
-0.88330078125,
0.7705078125,
-0.288330078125,
0.31640625,
-0.61767578125,
-0.80419921875,
-0.0164031982421875,
0.27392578125,
-0.250732421875,
-0.0509033203125,
0.58544921875,
0.3486328125,
0.416015625,
0.5,
0.96484375,
-0.8369140625,
0.72802734375,
0.259033203125,
0.423095703125,
-0.474853515625,
-0.053253173828125,
0.30224609375,
-0.8076171875,
-0.525390625,
-0.521484375,
0.006778717041015625,
0.50341796875,
-0.271484375,
0.29150390625,
0.931640625,
-0.9423828125,
0.242431640625,
0.182861328125,
-0.06414794921875,
-0.312744140625,
0.658203125,
1.3486328125,
-0.56787109375,
-0.1412353515625,
-0.6875,
0.55712890625,
0.44482421875,
0.74267578125,
0.1834716796875,
-0.34033203125,
-0.55322265625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Tags: implementation, strings
Correct Solution:
```
e=int(input())
print(len(set([''.join(sorted(list(set(x)))) for x in input().split()])))
```
| 66,985
|
[
0.423095703125,
0.091552734375,
-0.1488037109375,
-0.2208251953125,
-0.28515625,
-0.50146484375,
0.133056640625,
0.0391845703125,
0.376953125,
0.59130859375,
1.072265625,
-0.6240234375,
-0.084228515625,
-0.9130859375,
-0.62646484375,
0.0904541015625,
-0.60400390625,
-0.630859375,
-0.2724609375,
-0.375,
0.379150390625,
0.008575439453125,
-1.5771484375,
-0.035797119140625,
-0.40771484375,
1.33203125,
0.57568359375,
-0.03424072265625,
0.99365234375,
1.1318359375,
-0.228271484375,
-0.3154296875,
0.96533203125,
-0.81494140625,
-0.337890625,
-0.414306640625,
0.79150390625,
-0.95068359375,
0.1275634765625,
-0.9130859375,
0.64794921875,
-0.11260986328125,
0.12548828125,
-0.677734375,
-1.333984375,
0.156494140625,
-0.234619140625,
-0.52001953125,
0.06768798828125,
-1.001953125,
0.2568359375,
-0.491943359375,
0.38232421875,
-0.3125,
0.11767578125,
-0.22216796875,
-0.028167724609375,
0.0105438232421875,
-0.435546875,
0.0943603515625,
0.3994140625,
0.380126953125,
-0.1312255859375,
-0.8916015625,
-0.042449951171875,
0.308349609375,
0.1292724609375,
-0.114990234375,
0.12249755859375,
-0.67822265625,
-0.498779296875,
0.39990234375,
-0.274658203125,
-0.71044921875,
-0.52392578125,
0.044830322265625,
-0.0264739990234375,
0.36865234375,
-0.70751953125,
0.26171875,
0.2646484375,
0.8095703125,
-0.0345458984375,
0.0626220703125,
-0.290283203125,
-0.51318359375,
-0.113037109375,
0.64501953125,
0.263916015625,
-0.1883544921875,
-0.347900390625,
0.43212890625,
-0.54248046875,
0.0265960693359375,
0.83056640625,
0.5751953125,
-0.384521484375,
0.5400390625,
0.420166015625,
-0.02252197265625,
0.7392578125,
1.1787109375,
-0.49560546875,
0.8662109375,
-0.60009765625,
-0.03997802734375,
0.2086181640625,
0.076171875,
-0.17431640625,
-0.369384765625,
-0.04864501953125,
-0.383544921875,
0.254638671875,
0.2347412109375,
-0.127197265625,
0.9189453125,
-0.0830078125,
0.047271728515625,
-0.7333984375,
-0.0245361328125,
0.30908203125,
0.0010423660278320312,
0.1986083984375,
-0.1611328125,
0.06402587890625,
-0.1966552734375,
-0.6923828125,
1.15625,
-0.266845703125,
-0.189208984375,
0.253173828125,
0.1561279296875,
-0.44287109375,
0.5185546875,
-0.366943359375,
0.5703125,
0.189453125,
0.6376953125,
0.7197265625,
-0.60400390625,
0.85009765625,
-0.470458984375,
0.0040435791015625,
1.4765625,
0.5595703125,
0.21826171875,
0.99267578125,
0.21826171875,
-0.72265625,
0.5341796875,
-0.6259765625,
0.2109375,
0.064453125,
0.390869140625,
-0.52783203125,
0.297607421875,
0.38037109375,
0.521484375,
0.1983642578125,
0.240234375,
-0.407470703125,
0.1978759765625,
-0.381591796875,
0.82421875,
-0.0013952255249023438,
1.0439453125,
-0.4765625,
-0.54443359375,
-0.1524658203125,
-0.60302734375,
0.61572265625,
-0.17919921875,
-0.046356201171875,
0.9521484375,
0.48779296875,
0.671875,
0.6572265625,
0.1717529296875,
0.2734375,
0.045440673828125,
0.01812744140625,
-0.10198974609375,
0.192138671875,
0.7275390625,
0.37109375,
0.1085205078125,
-0.2291259765625,
-0.3671875,
-0.492431640625,
-0.39111328125,
0.10784912109375,
0.91650390625,
-0.73583984375,
0.474853515625,
0.2076416015625,
-0.10076904296875,
-0.78662109375,
-0.360595703125,
-0.0245819091796875,
-0.794921875,
-0.147705078125,
0.693359375,
-0.0582275390625,
0.44580078125,
-0.0428466796875,
-0.4375,
0.298828125,
1.3916015625,
-0.295166015625,
0.1673583984375,
0.442626953125,
-0.197265625,
-0.130859375,
0.2705078125,
0.0330810546875,
-0.11322021484375,
-0.814453125,
1.1201171875,
-0.4150390625,
-0.035308837890625,
0.352783203125,
0.720703125,
0.3173828125,
0.488525390625,
-0.3046875,
-0.5029296875,
0.423828125,
0.79443359375,
0.251708984375,
0.62158203125,
0.33203125,
0.88134765625,
0.26220703125,
0.62353515625,
0.371337890625,
0.348388671875,
0.560546875,
0.42626953125,
0.03741455078125,
0.36767578125,
0.216796875,
0.1827392578125,
0.583984375,
0.421875,
-0.12451171875,
0.430908203125,
-0.216552734375,
0.1944580078125,
-0.01177978515625,
0.8271484375,
-0.2347412109375,
0.79443359375,
0.2325439453125,
0.35302734375,
-1.064453125,
-0.69189453125,
0.42578125,
0.8212890625,
-0.9521484375,
-1.185546875,
-0.2054443359375,
0.0134124755859375,
0.145263671875,
0.1302490234375,
0.389892578125,
0.73486328125,
0.20849609375,
0.607421875,
-0.5703125,
-0.353759765625,
-1.037109375,
-0.60107421875,
-1.1640625,
-0.357177734375,
-0.52783203125,
-0.017791748046875,
0.548828125,
-0.99462890625,
0.412841796875,
-0.044677734375,
-0.31884765625,
0.2381591796875,
-0.58203125,
0.45849609375,
-0.3740234375,
0.88671875,
-0.393798828125,
0.5322265625,
-0.07275390625,
0.8603515625,
-0.72021484375,
-0.6982421875,
-0.471435546875,
-0.595703125,
0.1395263671875,
0.150146484375,
0.4912109375,
-0.415771484375,
-0.340576171875,
-0.70654296875,
-0.1756591796875,
-0.090576171875,
-0.4287109375,
0.3955078125,
-0.6767578125,
0.9267578125,
0.90625,
-0.78125,
0.73974609375,
1.0009765625,
-0.83935546875,
0.41015625,
0.1749267578125,
0.1739501953125,
-0.85498046875,
1.568359375,
0.7333984375,
0.75244140625,
-0.2283935546875,
-0.4755859375,
-0.408447265625,
0.39453125,
-0.140869140625,
-0.4208984375,
-0.29345703125,
0.734375,
0.1748046875,
-1.3623046875,
0.48291015625,
-0.8173828125,
-0.5732421875,
-0.52490234375,
-0.39697265625,
0.8203125,
0.72412109375,
0.164794921875,
-0.5615234375,
-0.373779296875,
0.167724609375,
0.89208984375,
0.59619140625,
-0.443115234375,
0.355224609375,
0.599609375,
0.44189453125,
0.1611328125,
0.08990478515625,
-0.37744140625,
-0.059600830078125,
-0.005420684814453125,
0.074951171875,
0.63916015625,
-0.1593017578125,
0.30615234375,
0.5390625,
0.422607421875,
-0.728515625,
-0.208984375,
-0.48193359375,
0.63427734375,
0.441650390625,
0.423828125,
0.32666015625,
-0.64599609375,
-0.265625,
-1.0205078125,
0.6650390625,
0.0819091796875,
0.65478515625,
-1.0126953125,
0.67138671875,
0.1900634765625,
-0.55810546875,
0.41845703125,
-0.50146484375,
-0.279052734375,
0.88134765625,
-0.433349609375,
1.0361328125,
-0.80810546875,
0.251220703125,
0.344970703125,
0.02899169921875,
0.81640625,
0.7021484375,
0.325439453125,
0.1861572265625,
-0.66162109375,
-0.0797119140625,
-0.425048828125,
-0.388916015625,
-0.73388671875,
0.1788330078125,
-0.294677734375,
-0.6435546875,
-0.689453125,
0.84033203125,
0.439453125,
0.3173828125,
-0.1949462890625,
0.4609375,
0.306396484375,
0.314697265625,
0.56689453125,
0.0855712890625,
0.646484375,
-0.56787109375,
0.95361328125,
0.06622314453125,
-0.7666015625,
-0.5419921875,
-0.326171875,
-0.59326171875,
0.00881195068359375,
0.1265869140625,
-0.0078887939453125,
-0.8447265625,
0.1064453125,
0.10845947265625,
0.194580078125,
-0.444091796875,
-0.02978515625,
-0.040374755859375,
0.82080078125,
0.268798828125,
-0.900390625,
0.16552734375,
-0.93359375,
0.4150390625,
0.693359375,
-0.325439453125,
-0.045562744140625,
-0.2457275390625,
-0.69189453125,
-0.62060546875,
0.0780029296875,
0.671875,
-0.191162109375,
0.11480712890625,
-1.1650390625,
0.52978515625,
0.6240234375,
-0.314697265625,
0.179443359375,
-0.2822265625,
0.4638671875,
0.07879638671875,
0.4443359375,
-0.62890625,
-0.400390625,
-0.02435302734375,
-1.279296875,
0.060821533203125,
-0.63818359375,
0.8212890625,
0.1273193359375,
0.164794921875,
0.0386962890625,
0.38232421875,
-0.1727294921875,
0.305908203125,
-0.025482177734375,
0.4287109375,
-0.98291015625,
-0.28271484375,
0.42822265625,
-0.2225341796875,
-0.281005859375,
0.67724609375,
-0.3369140625,
-0.4677734375,
0.1138916015625,
0.401123046875,
-0.48876953125,
0.57763671875,
-0.6767578125,
0.5224609375,
0.07080078125,
-0.6982421875,
-0.10064697265625,
-0.332763671875,
0.53955078125,
0.1224365234375,
-0.4599609375,
-0.1697998046875,
-1.2353515625,
-0.544921875,
0.07769775390625,
-0.5205078125,
0.40625,
-0.25537109375,
-0.5595703125,
-0.01340484619140625,
-0.1885986328125,
-0.490478515625,
-0.429931640625,
-0.54248046875,
-0.415283203125,
0.6005859375,
0.60986328125,
0.732421875,
0.237548828125,
-0.412841796875,
-0.301025390625,
-0.197509765625,
0.1968994140625,
-0.525390625,
0.011016845703125,
0.1607666015625,
-0.363525390625,
-0.293701171875,
0.24462890625,
-0.1241455078125,
0.346923828125,
0.455322265625,
-0.054534912109375,
0.5517578125,
0.2626953125,
-0.407958984375,
1.30859375,
-0.132080078125,
-1.4345703125,
-0.3251953125,
0.382568359375,
-0.1534423828125,
0.677734375,
0.344970703125,
-0.9873046875,
-1.0029296875,
-1.0166015625,
0.181640625,
-0.496337890625,
-0.64892578125,
-0.6845703125,
-0.56689453125,
-0.41845703125,
0.5458984375,
-0.1781005859375,
-0.50390625,
0.0682373046875,
-1.0322265625,
-0.161376953125,
-0.767578125,
-0.58349609375,
-0.9072265625,
-0.1778564453125,
-0.346435546875,
0.84033203125,
-0.281982421875,
0.258056640625,
-0.081298828125,
-0.132080078125,
-0.05670166015625,
-0.230712890625,
-0.162109375,
-0.234130859375,
-0.18798828125,
0.06121826171875,
-0.306884765625,
0.387939453125,
-0.333984375,
0.48193359375,
-0.91552734375,
-0.2159423828125,
-0.040863037109375,
-0.54296875,
-0.2587890625,
-0.611328125,
1.4658203125,
-0.236572265625,
-0.0919189453125,
-0.3447265625,
0.75634765625,
0.47509765625,
-0.300537109375,
-0.84375,
-0.51416015625,
-0.482421875,
-1.2880859375,
0.56494140625,
-1.029296875,
0.163818359375,
-0.82568359375,
0.033843994140625,
0.90478515625,
-0.437744140625,
0.1981201171875,
1.2958984375,
0.06219482421875,
0.52783203125,
-0.5751953125,
0.8447265625,
0.3408203125,
-0.66357421875,
-0.441650390625,
0.252197265625,
-1.044921875,
0.311767578125,
-0.241943359375,
-0.90576171875,
-0.490234375,
0.392578125,
1.4140625,
-0.298583984375,
0.65966796875,
0.00023281574249267578,
-0.962890625,
-0.73486328125,
0.7646484375,
0.340576171875,
0.66064453125,
0.72021484375,
-0.059295654296875,
-0.192138671875,
-0.03314208984375,
-0.04052734375,
-0.338623046875,
-0.55322265625,
1.2119140625,
-0.2125244140625,
-0.8369140625,
0.408447265625,
0.8955078125,
-1.0458984375,
-0.480712890625,
-0.389892578125,
0.0052337646484375,
-0.2161865234375,
-0.72998046875,
0.2464599609375,
-0.1683349609375,
-0.900390625,
-0.187744140625,
0.300048828125,
0.06951904296875,
0.22021484375,
0.2108154296875,
0.040557861328125,
-0.39013671875,
-0.0020046234130859375,
0.81201171875,
-0.65869140625,
-0.0830078125,
-0.8017578125,
0.1358642578125,
-0.006305694580078125,
-0.0516357421875,
0.689453125,
-0.3447265625,
0.354736328125,
0.58154296875,
-0.104736328125,
0.4873046875,
-0.6708984375,
-0.243896484375,
0.375,
-0.49755859375,
-0.5712890625,
-0.093505859375,
0.5234375,
0.08331298828125,
0.227783203125,
-0.400634765625,
0.032012939453125,
0.2298583984375,
0.0124053955078125,
-0.2763671875,
-0.88720703125,
-0.52294921875,
-1.3330078125,
-0.52490234375,
-0.393798828125,
-0.4013671875,
-0.0406494140625,
0.357666015625,
-0.29248046875,
-1.130859375,
0.1356201171875,
0.736328125,
-0.59814453125,
1.16015625,
-0.7802734375,
0.370361328125,
-0.64599609375,
-0.2587890625,
-0.72021484375,
0.29150390625,
-0.15283203125,
0.0882568359375,
-0.53271484375,
0.67822265625,
0.113037109375,
0.55859375,
-0.1500244140625,
0.5341796875,
-0.30419921875,
0.043243408203125,
0.10845947265625,
-0.1597900390625,
-0.204833984375,
1.0224609375,
0.47119140625,
-0.2457275390625,
0.42236328125,
-0.396240234375,
-0.6435546875,
-0.2471923828125,
0.8369140625,
0.97216796875,
-0.2265625,
-0.263916015625,
-0.349365234375,
0.4384765625,
-0.94482421875,
0.201171875,
-0.3544921875,
0.416748046875,
0.10345458984375,
-0.3369140625,
0.33447265625,
1.4423828125,
-0.25634765625,
0.49365234375,
0.1239013671875,
0.2083740234375,
0.45849609375,
-0.03460693359375,
0.015869140625,
0.3115234375,
0.1710205078125,
-0.401123046875,
-0.169921875,
0.4736328125,
0.20556640625,
0.124267578125,
-0.1763916015625,
-0.6826171875,
-0.7802734375,
0.0972900390625,
-0.075927734375,
0.463134765625,
0.662109375,
-0.437744140625,
-0.1929931640625,
-0.1134033203125,
-0.6181640625,
0.2142333984375,
-0.982421875,
-0.873046875,
0.2900390625,
-0.3740234375,
-0.4775390625,
-0.1094970703125,
-0.5556640625,
-0.64453125,
0.11102294921875,
0.07843017578125,
-0.68505859375,
-0.1646728515625,
-0.64697265625,
0.5888671875,
-0.266845703125,
-0.28271484375,
-0.00360870361328125,
0.391357421875,
-0.2325439453125,
-0.421142578125,
0.240966796875,
0.5185546875,
-0.0305328369140625,
-0.01568603515625,
-0.85791015625,
0.3310546875,
-0.1317138671875,
-0.057373046875,
-0.71337890625,
-0.10491943359375,
-0.065185546875,
0.462646484375,
-1.2509765625,
0.11102294921875,
-0.177490234375,
0.036865234375,
0.7470703125,
-0.52587890625,
-0.46533203125,
1.2333984375,
0.5283203125,
-0.1905517578125,
-0.2174072265625,
0.287109375,
0.52197265625,
-0.158935546875,
-0.35791015625,
-0.07861328125,
0.701171875,
0.47119140625,
0.5361328125,
0.14208984375,
0.342529296875,
0.6484375,
-0.0290985107421875,
-0.52392578125,
0.28857421875,
0.443603515625,
-0.1192626953125,
0.54345703125,
0.08160400390625,
-0.263671875,
0.081298828125,
-0.73828125,
0.1827392578125,
-0.149169921875,
-0.30126953125,
-0.1634521484375,
-0.1749267578125,
0.69189453125,
-0.243408203125,
-0.2188720703125,
-0.0362548828125,
-0.794921875,
0.28271484375,
0.4462890625,
-0.0241546630859375,
-0.35693359375,
1.091796875,
0.671875,
0.2939453125,
0.6669921875,
0.2039794921875,
0.619140625,
-0.58251953125,
0.290283203125,
-0.0247039794921875,
-0.08673095703125,
0.1280517578125,
-0.37939453125,
-1.04296875,
0.409912109375,
-0.49365234375,
-0.415283203125,
0.5703125,
-0.7900390625,
0.260498046875,
-0.62939453125,
0.8017578125,
-0.57958984375,
0.57568359375,
0.2120361328125,
-0.15625,
-0.493408203125,
0.449462890625,
-0.1837158203125,
0.71533203125,
0.20751953125,
0.7705078125,
0.371826171875,
1.6435546875,
0.55322265625,
-0.06884765625,
0.136962890625,
0.10479736328125,
-0.44287109375,
-0.62646484375,
-0.0225830078125,
-0.171142578125,
0.046478271484375,
-0.52197265625,
-0.51220703125,
0.03656005859375,
0.96630859375,
-0.402099609375,
-1.1767578125,
-0.11346435546875,
0.4921875,
-0.6611328125,
0.92626953125,
0.59521484375,
0.09051513671875,
0.2342529296875,
-0.0751953125,
-0.1646728515625,
-0.6552734375,
0.1878662109375,
-0.346923828125,
0.60986328125,
-0.50390625,
-0.59130859375,
-0.72265625,
-0.400634765625,
-0.042266845703125,
-0.045928955078125,
-0.2427978515625,
-0.4833984375,
0.235595703125,
0.8466796875,
0.28564453125,
0.2646484375,
-0.476806640625,
-0.036895751953125,
0.66015625,
0.9619140625,
0.01491546630859375,
0.8828125,
0.48828125,
-0.2227783203125,
0.157470703125,
-0.5625,
0.91748046875,
-0.015106201171875,
0.179931640625,
-0.184326171875,
0.5966796875,
-0.64111328125,
-1.5009765625,
0.10272216796875,
0.6357421875,
0.06939697265625,
-0.61865234375,
-1.02734375,
-0.449951171875,
-0.94677734375,
-0.336181640625,
-0.74365234375,
0.6142578125,
0.12493896484375,
-0.0001417398452758789,
-0.01070404052734375,
-1.123046875,
4.3125,
0.78466796875,
0.8779296875,
0.5341796875,
0.39111328125,
1.3671875,
0.6171875,
-0.497802734375,
-0.2425537109375,
-0.78759765625,
0.72119140625,
-0.7041015625,
-0.190185546875,
0.57080078125,
0.708984375,
0.5625,
-0.37109375,
0.219482421875,
0.01103973388671875,
-0.85791015625,
-0.62646484375,
-0.33544921875,
0.171142578125,
0.6025390625,
0.320556640625,
0.448486328125,
1.009765625,
-0.8623046875,
-0.325439453125,
-0.230712890625,
-0.140380859375,
-0.2626953125,
0.456298828125,
0.161865234375,
-0.59521484375,
0.65576171875,
0.160400390625,
-0.96435546875,
-0.032501220703125,
0.165283203125,
-0.751953125,
-0.263671875,
0.791015625,
-0.56103515625,
0.11090087890625,
0.6103515625,
-0.5712890625,
0.59033203125,
0.34765625,
-0.74560546875,
0.72412109375,
-0.60400390625,
0.66015625,
-0.8759765625,
-0.442626953125,
0.2232666015625,
0.045166015625,
-0.1527099609375,
-0.48046875,
0.260009765625,
0.5390625,
0.132080078125,
0.11676025390625,
0.6845703125,
-0.8828125,
0.97265625,
-0.0806884765625,
0.3583984375,
-0.58984375,
-0.258056640625,
-0.470703125,
-0.186279296875,
-0.134033203125,
-0.291015625,
0.9248046875,
0.0396728515625,
-0.4345703125,
0.365478515625,
0.560546875,
-0.70849609375,
-0.0975341796875,
-0.0312347412109375,
-0.623046875,
-0.720703125,
0.580078125,
0.9296875,
-0.24169921875,
-0.426513671875,
-0.127685546875,
0.86767578125,
0.81591796875,
0.75048828125,
-0.04412841796875,
-0.5498046875,
-0.4345703125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Tags: implementation, strings
Correct Solution:
```
ar = []
n = int(input())
a = list(input().split())
for i in a:
temp = set(i)
temp = "".join(sorted(temp))
if temp not in ar:
ar.append(temp)
print(len(ar))
```
| 66,986
|
[
0.455322265625,
0.152587890625,
-0.1234130859375,
-0.220703125,
-0.315673828125,
-0.474365234375,
0.138916015625,
0.0012941360473632812,
0.359130859375,
0.59716796875,
1.107421875,
-0.64404296875,
-0.096923828125,
-0.95068359375,
-0.58984375,
0.079833984375,
-0.58349609375,
-0.6083984375,
-0.238525390625,
-0.425537109375,
0.373291015625,
0.0198974609375,
-1.5634765625,
0.0015354156494140625,
-0.39306640625,
1.3076171875,
0.5634765625,
-0.039093017578125,
1.0185546875,
1.16796875,
-0.1812744140625,
-0.352294921875,
0.9599609375,
-0.77392578125,
-0.31298828125,
-0.4541015625,
0.81201171875,
-0.96337890625,
0.12127685546875,
-0.88427734375,
0.6376953125,
-0.08154296875,
0.10089111328125,
-0.67333984375,
-1.328125,
0.1407470703125,
-0.177978515625,
-0.456298828125,
0.1728515625,
-1.017578125,
0.23876953125,
-0.447265625,
0.358642578125,
-0.36376953125,
0.137451171875,
-0.2227783203125,
-0.028167724609375,
0.01552581787109375,
-0.4658203125,
0.040802001953125,
0.419189453125,
0.365478515625,
-0.13916015625,
-0.82421875,
-0.0233917236328125,
0.317138671875,
0.11883544921875,
-0.09912109375,
0.11309814453125,
-0.62841796875,
-0.469482421875,
0.384521484375,
-0.27978515625,
-0.7587890625,
-0.53857421875,
0.03564453125,
-0.01033782958984375,
0.338134765625,
-0.71142578125,
0.253662109375,
0.2734375,
0.8818359375,
-0.00415802001953125,
0.06878662109375,
-0.241455078125,
-0.533203125,
-0.1046142578125,
0.677734375,
0.2073974609375,
-0.1767578125,
-0.381103515625,
0.448486328125,
-0.53173828125,
-0.0224456787109375,
0.85693359375,
0.6083984375,
-0.35986328125,
0.5166015625,
0.467041015625,
-0.07586669921875,
0.76953125,
1.150390625,
-0.498291015625,
0.8837890625,
-0.58154296875,
-0.0263214111328125,
0.1639404296875,
0.0234832763671875,
-0.1778564453125,
-0.368896484375,
-0.066650390625,
-0.360595703125,
0.28564453125,
0.207275390625,
-0.18212890625,
0.92529296875,
-0.093994140625,
0.061859130859375,
-0.755859375,
-0.06048583984375,
0.301025390625,
-0.04241943359375,
0.220947265625,
-0.1519775390625,
0.068115234375,
-0.2073974609375,
-0.681640625,
1.203125,
-0.2271728515625,
-0.1806640625,
0.234130859375,
0.1339111328125,
-0.4443359375,
0.5244140625,
-0.380126953125,
0.548828125,
0.1749267578125,
0.607421875,
0.71923828125,
-0.611328125,
0.84033203125,
-0.44580078125,
0.0045166015625,
1.48046875,
0.57861328125,
0.2705078125,
1.0283203125,
0.1954345703125,
-0.75146484375,
0.55859375,
-0.65380859375,
0.2139892578125,
0.097412109375,
0.367919921875,
-0.51171875,
0.310302734375,
0.415771484375,
0.490234375,
0.1571044921875,
0.26904296875,
-0.37353515625,
0.1968994140625,
-0.392578125,
0.7978515625,
0.021209716796875,
1.0380859375,
-0.496337890625,
-0.5703125,
-0.186767578125,
-0.60791015625,
0.619140625,
-0.2015380859375,
-0.0128326416015625,
0.93896484375,
0.434326171875,
0.681640625,
0.65478515625,
0.1898193359375,
0.281982421875,
0.06011962890625,
0.033203125,
-0.07904052734375,
0.1983642578125,
0.69189453125,
0.442138671875,
0.155517578125,
-0.2254638671875,
-0.365478515625,
-0.465576171875,
-0.415771484375,
0.12646484375,
0.92919921875,
-0.7314453125,
0.5341796875,
0.216552734375,
-0.14892578125,
-0.8203125,
-0.375,
0.00292205810546875,
-0.8017578125,
-0.181884765625,
0.6767578125,
-0.09344482421875,
0.42919921875,
-0.047760009765625,
-0.43359375,
0.328369140625,
1.3642578125,
-0.291748046875,
0.1680908203125,
0.4248046875,
-0.234130859375,
-0.160888671875,
0.275390625,
-0.0151824951171875,
-0.114990234375,
-0.85009765625,
1.1240234375,
-0.421630859375,
-0.05633544921875,
0.325927734375,
0.67431640625,
0.3173828125,
0.53662109375,
-0.267333984375,
-0.49658203125,
0.412841796875,
0.79541015625,
0.225341796875,
0.5869140625,
0.32568359375,
0.88134765625,
0.24462890625,
0.611328125,
0.3720703125,
0.3623046875,
0.58837890625,
0.428466796875,
0.05145263671875,
0.395751953125,
0.197998046875,
0.159423828125,
0.583984375,
0.3837890625,
-0.1397705078125,
0.443359375,
-0.177490234375,
0.16796875,
-0.0107574462890625,
0.86181640625,
-0.26708984375,
0.76416015625,
0.281494140625,
0.359619140625,
-1.0634765625,
-0.74658203125,
0.439208984375,
0.8515625,
-1.0107421875,
-1.166015625,
-0.279541015625,
0.0276947021484375,
0.158935546875,
0.159423828125,
0.427734375,
0.79052734375,
0.1783447265625,
0.61474609375,
-0.56787109375,
-0.325439453125,
-1.078125,
-0.61181640625,
-1.1572265625,
-0.31396484375,
-0.51025390625,
-0.05303955078125,
0.548828125,
-0.96337890625,
0.393798828125,
-0.0181884765625,
-0.34619140625,
0.2210693359375,
-0.60693359375,
0.49462890625,
-0.322265625,
0.841796875,
-0.391845703125,
0.5390625,
-0.0731201171875,
0.83154296875,
-0.70166015625,
-0.68603515625,
-0.471435546875,
-0.572265625,
0.08917236328125,
0.146240234375,
0.5068359375,
-0.41650390625,
-0.30078125,
-0.7099609375,
-0.1497802734375,
-0.045867919921875,
-0.44140625,
0.34619140625,
-0.6611328125,
0.8798828125,
0.859375,
-0.7578125,
0.748046875,
0.9833984375,
-0.82763671875,
0.448974609375,
0.1846923828125,
0.1593017578125,
-0.8447265625,
1.54296875,
0.75537109375,
0.76416015625,
-0.203857421875,
-0.497802734375,
-0.359130859375,
0.397216796875,
-0.12841796875,
-0.421630859375,
-0.294189453125,
0.71923828125,
0.178955078125,
-1.345703125,
0.455322265625,
-0.7841796875,
-0.5498046875,
-0.56884765625,
-0.461181640625,
0.7783203125,
0.7001953125,
0.182861328125,
-0.56396484375,
-0.35986328125,
0.1240234375,
0.880859375,
0.60595703125,
-0.454833984375,
0.374755859375,
0.58984375,
0.495361328125,
0.23095703125,
0.12054443359375,
-0.4033203125,
-0.0863037109375,
-0.0291290283203125,
0.03228759765625,
0.60888671875,
-0.11468505859375,
0.34765625,
0.587890625,
0.439697265625,
-0.71923828125,
-0.1734619140625,
-0.44970703125,
0.64599609375,
0.46630859375,
0.4296875,
0.316162109375,
-0.66015625,
-0.281982421875,
-0.98291015625,
0.64794921875,
0.06793212890625,
0.6279296875,
-1.046875,
0.63330078125,
0.27734375,
-0.5625,
0.432373046875,
-0.4912109375,
-0.25537109375,
0.88720703125,
-0.455078125,
1.0341796875,
-0.77978515625,
0.196044921875,
0.357421875,
0.028839111328125,
0.86962890625,
0.67626953125,
0.35009765625,
0.178955078125,
-0.6884765625,
-0.0229949951171875,
-0.464599609375,
-0.389404296875,
-0.716796875,
0.1826171875,
-0.317626953125,
-0.6728515625,
-0.7041015625,
0.859375,
0.40283203125,
0.363037109375,
-0.220458984375,
0.47314453125,
0.265380859375,
0.32958984375,
0.50537109375,
0.1309814453125,
0.57373046875,
-0.57177734375,
1.0400390625,
0.033355712890625,
-0.74658203125,
-0.4833984375,
-0.323974609375,
-0.58642578125,
0.03887939453125,
0.1219482421875,
0.026611328125,
-0.91455078125,
0.156005859375,
0.05255126953125,
0.162353515625,
-0.38037109375,
-0.054931640625,
-0.058929443359375,
0.7763671875,
0.229248046875,
-0.92626953125,
0.1834716796875,
-0.94384765625,
0.391357421875,
0.658203125,
-0.3427734375,
-0.040283203125,
-0.2415771484375,
-0.67041015625,
-0.62109375,
0.06768798828125,
0.67041015625,
-0.2432861328125,
0.1851806640625,
-1.1640625,
0.5107421875,
0.62060546875,
-0.3173828125,
0.217529296875,
-0.293701171875,
0.412841796875,
0.082763671875,
0.425048828125,
-0.55908203125,
-0.360107421875,
0.00791168212890625,
-1.314453125,
0.110107421875,
-0.61279296875,
0.81884765625,
0.08782958984375,
0.1309814453125,
0.073486328125,
0.409912109375,
-0.1766357421875,
0.2646484375,
-0.008514404296875,
0.411865234375,
-1.0263671875,
-0.330322265625,
0.4375,
-0.2352294921875,
-0.257568359375,
0.642578125,
-0.29541015625,
-0.476318359375,
0.1409912109375,
0.388916015625,
-0.50830078125,
0.54443359375,
-0.64697265625,
0.53662109375,
0.0880126953125,
-0.66943359375,
-0.06488037109375,
-0.35546875,
0.58251953125,
0.08941650390625,
-0.450927734375,
-0.219970703125,
-1.24609375,
-0.52490234375,
0.0867919921875,
-0.5146484375,
0.4775390625,
-0.2279052734375,
-0.58544921875,
-0.0293426513671875,
-0.1673583984375,
-0.450439453125,
-0.414306640625,
-0.58251953125,
-0.419189453125,
0.5341796875,
0.609375,
0.724609375,
0.2415771484375,
-0.43896484375,
-0.330810546875,
-0.180908203125,
0.2158203125,
-0.5205078125,
-0.02288818359375,
0.197265625,
-0.38916015625,
-0.291015625,
0.251220703125,
-0.1844482421875,
0.342529296875,
0.4384765625,
-0.10809326171875,
0.6015625,
0.27880859375,
-0.357421875,
1.34375,
-0.1719970703125,
-1.4541015625,
-0.27734375,
0.371826171875,
-0.1766357421875,
0.69775390625,
0.36328125,
-0.95166015625,
-0.994140625,
-1.0009765625,
0.2236328125,
-0.50830078125,
-0.642578125,
-0.70849609375,
-0.5791015625,
-0.37060546875,
0.55322265625,
-0.1834716796875,
-0.435546875,
0.1214599609375,
-1.0029296875,
-0.1356201171875,
-0.77490234375,
-0.61376953125,
-0.87646484375,
-0.16748046875,
-0.341796875,
0.87255859375,
-0.316162109375,
0.2379150390625,
-0.035400390625,
-0.1641845703125,
-0.05523681640625,
-0.26025390625,
-0.156005859375,
-0.249267578125,
-0.1947021484375,
0.09124755859375,
-0.287841796875,
0.347900390625,
-0.33349609375,
0.5244140625,
-0.8662109375,
-0.2225341796875,
-0.05035400390625,
-0.5654296875,
-0.2919921875,
-0.59619140625,
1.4677734375,
-0.23193359375,
-0.05810546875,
-0.312744140625,
0.80810546875,
0.460693359375,
-0.33837890625,
-0.83056640625,
-0.5068359375,
-0.487060546875,
-1.275390625,
0.57177734375,
-0.9970703125,
0.2135009765625,
-0.83349609375,
0.09075927734375,
0.8759765625,
-0.408203125,
0.2017822265625,
1.2998046875,
0.038055419921875,
0.501953125,
-0.6025390625,
0.87158203125,
0.318603515625,
-0.64306640625,
-0.4306640625,
0.2467041015625,
-1.09765625,
0.319580078125,
-0.20556640625,
-0.90478515625,
-0.51171875,
0.39794921875,
1.3955078125,
-0.321044921875,
0.67578125,
0.051605224609375,
-1.0439453125,
-0.75927734375,
0.73583984375,
0.319091796875,
0.640625,
0.72216796875,
-0.077880859375,
-0.2337646484375,
-0.01751708984375,
-0.07562255859375,
-0.328125,
-0.56005859375,
1.220703125,
-0.2244873046875,
-0.87841796875,
0.4423828125,
0.87841796875,
-1.0439453125,
-0.455322265625,
-0.4013671875,
-0.016815185546875,
-0.15966796875,
-0.693359375,
0.2568359375,
-0.1605224609375,
-0.947265625,
-0.1641845703125,
0.2332763671875,
0.061187744140625,
0.168212890625,
0.218017578125,
0.0246429443359375,
-0.456787109375,
-0.031494140625,
0.787109375,
-0.6650390625,
-0.079345703125,
-0.83447265625,
0.11749267578125,
0.0270233154296875,
-0.05389404296875,
0.67626953125,
-0.348388671875,
0.3515625,
0.55322265625,
-0.09326171875,
0.461669921875,
-0.6767578125,
-0.199951171875,
0.332763671875,
-0.458740234375,
-0.63427734375,
-0.08966064453125,
0.55078125,
0.0853271484375,
0.22314453125,
-0.413330078125,
0.06561279296875,
0.2626953125,
0.0134735107421875,
-0.2032470703125,
-0.85693359375,
-0.51904296875,
-1.3369140625,
-0.58251953125,
-0.350830078125,
-0.404052734375,
-0.028900146484375,
0.307373046875,
-0.32373046875,
-1.12109375,
0.15869140625,
0.73193359375,
-0.57861328125,
1.1748046875,
-0.779296875,
0.328125,
-0.66015625,
-0.2139892578125,
-0.76708984375,
0.2958984375,
-0.1796875,
0.11602783203125,
-0.5498046875,
0.7021484375,
0.061004638671875,
0.54150390625,
-0.0889892578125,
0.4892578125,
-0.30126953125,
0.01058197021484375,
0.1314697265625,
-0.11663818359375,
-0.2215576171875,
1.01953125,
0.39599609375,
-0.2177734375,
0.391357421875,
-0.4150390625,
-0.60693359375,
-0.2412109375,
0.8310546875,
1.021484375,
-0.18310546875,
-0.22705078125,
-0.382568359375,
0.4599609375,
-0.93603515625,
0.2139892578125,
-0.378173828125,
0.392578125,
0.1226806640625,
-0.3271484375,
0.348876953125,
1.400390625,
-0.2467041015625,
0.451416015625,
0.152587890625,
0.196533203125,
0.452880859375,
-0.022064208984375,
0.004505157470703125,
0.296875,
0.15625,
-0.41796875,
-0.1390380859375,
0.47607421875,
0.1981201171875,
0.1468505859375,
-0.21875,
-0.68603515625,
-0.796875,
0.1318359375,
-0.059600830078125,
0.463623046875,
0.6953125,
-0.42529296875,
-0.184814453125,
-0.12042236328125,
-0.63525390625,
0.2288818359375,
-0.94580078125,
-0.8681640625,
0.292724609375,
-0.374267578125,
-0.488037109375,
-0.12127685546875,
-0.5234375,
-0.63916015625,
0.11663818359375,
0.05389404296875,
-0.71875,
-0.1865234375,
-0.61474609375,
0.60107421875,
-0.226806640625,
-0.262451171875,
0.038665771484375,
0.436767578125,
-0.253662109375,
-0.407470703125,
0.2410888671875,
0.50146484375,
-0.0343017578125,
-0.0235748291015625,
-0.86376953125,
0.371826171875,
-0.154296875,
-0.0249481201171875,
-0.7109375,
-0.0892333984375,
-0.023773193359375,
0.470947265625,
-1.2958984375,
0.1427001953125,
-0.18408203125,
0.01494598388671875,
0.7392578125,
-0.5869140625,
-0.460693359375,
1.23046875,
0.50634765625,
-0.2003173828125,
-0.2281494140625,
0.310302734375,
0.5224609375,
-0.13623046875,
-0.352294921875,
-0.1280517578125,
0.70849609375,
0.4794921875,
0.55810546875,
0.11004638671875,
0.3369140625,
0.60595703125,
-0.0772705078125,
-0.53369140625,
0.291748046875,
0.490966796875,
-0.1583251953125,
0.60888671875,
0.10552978515625,
-0.272216796875,
0.0653076171875,
-0.76513671875,
0.2022705078125,
-0.1513671875,
-0.30126953125,
-0.202880859375,
-0.158935546875,
0.701171875,
-0.1839599609375,
-0.244384765625,
-0.04034423828125,
-0.7919921875,
0.26025390625,
0.3984375,
-0.036407470703125,
-0.330078125,
1.10546875,
0.7177734375,
0.287841796875,
0.6572265625,
0.1922607421875,
0.6513671875,
-0.6181640625,
0.259765625,
-0.033050537109375,
-0.08367919921875,
0.1473388671875,
-0.401611328125,
-1.025390625,
0.386962890625,
-0.46484375,
-0.4404296875,
0.5869140625,
-0.78515625,
0.284423828125,
-0.5927734375,
0.80517578125,
-0.57177734375,
0.576171875,
0.222900390625,
-0.207763671875,
-0.4501953125,
0.442138671875,
-0.1697998046875,
0.6845703125,
0.1715087890625,
0.75146484375,
0.3720703125,
1.6669921875,
0.54736328125,
-0.09051513671875,
0.11639404296875,
0.11102294921875,
-0.430419921875,
-0.67333984375,
-0.019775390625,
-0.1954345703125,
0.04168701171875,
-0.50634765625,
-0.546875,
0.014984130859375,
0.91064453125,
-0.400634765625,
-1.189453125,
-0.091064453125,
0.4609375,
-0.654296875,
0.97998046875,
0.59423828125,
0.11846923828125,
0.210693359375,
-0.09991455078125,
-0.18701171875,
-0.60400390625,
0.2122802734375,
-0.2939453125,
0.64013671875,
-0.533203125,
-0.583984375,
-0.7412109375,
-0.400634765625,
-0.05828857421875,
-0.04644775390625,
-0.251708984375,
-0.461181640625,
0.2354736328125,
0.86328125,
0.277587890625,
0.29541015625,
-0.4453125,
-0.0172119140625,
0.5673828125,
1.0205078125,
-0.0166015625,
0.8505859375,
0.494140625,
-0.177490234375,
0.1710205078125,
-0.5419921875,
0.9404296875,
-0.0199737548828125,
0.137939453125,
-0.1541748046875,
0.59716796875,
-0.671875,
-1.447265625,
0.1123046875,
0.62548828125,
0.0210418701171875,
-0.58984375,
-1.0185546875,
-0.473388671875,
-0.95556640625,
-0.27685546875,
-0.7509765625,
0.59130859375,
0.145263671875,
0.0204315185546875,
0.0625,
-1.0947265625,
4.30859375,
0.78515625,
0.86279296875,
0.490234375,
0.355712890625,
1.357421875,
0.60546875,
-0.5712890625,
-0.2218017578125,
-0.8095703125,
0.69580078125,
-0.7119140625,
-0.1890869140625,
0.5908203125,
0.7119140625,
0.5712890625,
-0.3779296875,
0.2119140625,
0.01523590087890625,
-0.90185546875,
-0.61279296875,
-0.319580078125,
0.14306640625,
0.59619140625,
0.326171875,
0.47265625,
1.0048828125,
-0.88232421875,
-0.279296875,
-0.2509765625,
-0.140380859375,
-0.26513671875,
0.401123046875,
0.1298828125,
-0.59716796875,
0.68603515625,
0.1676025390625,
-0.9853515625,
0.014617919921875,
0.1705322265625,
-0.74267578125,
-0.28857421875,
0.7646484375,
-0.56298828125,
0.14404296875,
0.63671875,
-0.501953125,
0.56591796875,
0.3603515625,
-0.7353515625,
0.720703125,
-0.67529296875,
0.64013671875,
-0.87744140625,
-0.449462890625,
0.271240234375,
0.04608154296875,
-0.2291259765625,
-0.4697265625,
0.243408203125,
0.5400390625,
0.123779296875,
0.1038818359375,
0.68359375,
-0.87744140625,
0.93408203125,
-0.08221435546875,
0.31396484375,
-0.5830078125,
-0.267578125,
-0.459716796875,
-0.2177734375,
-0.188232421875,
-0.310791015625,
0.9482421875,
0.03436279296875,
-0.45947265625,
0.34619140625,
0.5673828125,
-0.7294921875,
-0.049102783203125,
-0.002552032470703125,
-0.66650390625,
-0.6708984375,
0.60009765625,
0.921875,
-0.263671875,
-0.41259765625,
-0.1259765625,
0.85546875,
0.80810546875,
0.72216796875,
-0.06597900390625,
-0.56396484375,
-0.456787109375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Tags: implementation, strings
Correct Solution:
```
import atexit
import io
import sys
# Buffering IO
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER
@atexit.register
def write():
sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
def main():
n = int(input())
ss = input().split()
s = set()
for x in ss:
s.add(''.join(sorted(list(set(x)))))
print(len(s))
if __name__ == '__main__':
main()
```
| 66,987
|
[
0.340087890625,
0.06622314453125,
-0.168212890625,
-0.184814453125,
-0.344970703125,
-0.496826171875,
0.042633056640625,
0.0206298828125,
0.355224609375,
0.55615234375,
1.0078125,
-0.64794921875,
-0.12353515625,
-0.89453125,
-0.611328125,
0.047943115234375,
-0.5703125,
-0.662109375,
-0.360107421875,
-0.360107421875,
0.4462890625,
-0.1304931640625,
-1.5625,
-0.057586669921875,
-0.29150390625,
1.2587890625,
0.5615234375,
-0.054168701171875,
0.9541015625,
1.1455078125,
-0.2459716796875,
-0.271728515625,
0.9228515625,
-0.7451171875,
-0.2249755859375,
-0.45703125,
0.77392578125,
-0.92822265625,
0.169921875,
-0.89990234375,
0.62646484375,
-0.1341552734375,
0.04486083984375,
-0.7978515625,
-1.337890625,
0.10577392578125,
-0.22802734375,
-0.462646484375,
0.12237548828125,
-0.90869140625,
0.1932373046875,
-0.41845703125,
0.34765625,
-0.29541015625,
-0.01690673828125,
-0.1865234375,
-0.132568359375,
0.0163726806640625,
-0.52685546875,
0.090576171875,
0.423095703125,
0.430419921875,
-0.1654052734375,
-0.794921875,
0.0244293212890625,
0.322998046875,
0.0372314453125,
-0.166748046875,
0.052978515625,
-0.55615234375,
-0.50439453125,
0.3740234375,
-0.26904296875,
-0.76123046875,
-0.499267578125,
0.07958984375,
0.03314208984375,
0.315673828125,
-0.70263671875,
0.2425537109375,
0.2587890625,
0.81494140625,
-0.09393310546875,
0.0391845703125,
-0.2047119140625,
-0.4912109375,
-0.0810546875,
0.548828125,
0.1700439453125,
-0.2059326171875,
-0.3251953125,
0.36328125,
-0.638671875,
0.10552978515625,
0.8408203125,
0.5673828125,
-0.40576171875,
0.560546875,
0.34033203125,
-0.031219482421875,
0.71630859375,
1.2255859375,
-0.445556640625,
0.9404296875,
-0.64501953125,
-0.0335693359375,
0.308349609375,
0.037322998046875,
-0.2491455078125,
-0.411865234375,
-0.05975341796875,
-0.297607421875,
0.361083984375,
0.255859375,
-0.033416748046875,
0.9521484375,
-0.10205078125,
0.1282958984375,
-0.810546875,
-0.09307861328125,
0.2197265625,
-0.0679931640625,
0.2196044921875,
-0.2301025390625,
0.07379150390625,
-0.17138671875,
-0.732421875,
1.1455078125,
-0.27685546875,
-0.129638671875,
0.2357177734375,
0.1673583984375,
-0.50390625,
0.52587890625,
-0.414306640625,
0.5458984375,
0.2333984375,
0.5673828125,
0.75439453125,
-0.67236328125,
0.8896484375,
-0.451171875,
0.052734375,
1.529296875,
0.58984375,
0.2059326171875,
0.93017578125,
0.25146484375,
-0.7197265625,
0.490966796875,
-0.65625,
0.233642578125,
0.09173583984375,
0.495849609375,
-0.52880859375,
0.27294921875,
0.305419921875,
0.52001953125,
0.2413330078125,
0.2296142578125,
-0.436279296875,
0.22705078125,
-0.322998046875,
0.80126953125,
0.0010137557983398438,
0.99609375,
-0.487548828125,
-0.56787109375,
-0.06591796875,
-0.482421875,
0.66162109375,
-0.1602783203125,
-0.05133056640625,
0.8828125,
0.43359375,
0.599609375,
0.595703125,
0.1722412109375,
0.28759765625,
0.10205078125,
-0.1375732421875,
-0.06610107421875,
0.2021484375,
0.68603515625,
0.4326171875,
0.09600830078125,
-0.126708984375,
-0.462158203125,
-0.5537109375,
-0.456787109375,
0.22802734375,
0.9912109375,
-0.80712890625,
0.48583984375,
0.16650390625,
-0.1552734375,
-0.82861328125,
-0.416748046875,
-0.0108184814453125,
-0.7548828125,
-0.07708740234375,
0.6455078125,
0.053680419921875,
0.373046875,
-0.015380859375,
-0.356201171875,
0.34326171875,
1.4130859375,
-0.25146484375,
0.1939697265625,
0.53515625,
-0.2120361328125,
-0.15576171875,
0.330810546875,
0.02520751953125,
-0.05419921875,
-0.7685546875,
1.08984375,
-0.2449951171875,
-0.0197296142578125,
0.32275390625,
0.7041015625,
0.269775390625,
0.477783203125,
-0.32177734375,
-0.40576171875,
0.37255859375,
0.763671875,
0.2298583984375,
0.4619140625,
0.312744140625,
0.87060546875,
0.21435546875,
0.6708984375,
0.27734375,
0.2193603515625,
0.56884765625,
0.4423828125,
-0.0845947265625,
0.3603515625,
0.14794921875,
0.2156982421875,
0.450927734375,
0.419189453125,
-0.054107666015625,
0.34765625,
-0.12493896484375,
0.23095703125,
-0.039703369140625,
0.79052734375,
-0.385986328125,
0.818359375,
0.2098388671875,
0.275634765625,
-1.0888671875,
-0.81787109375,
0.497314453125,
0.77392578125,
-1.029296875,
-1.1318359375,
-0.2041015625,
0.016571044921875,
0.0902099609375,
0.215087890625,
0.385986328125,
0.783203125,
0.162353515625,
0.60693359375,
-0.57080078125,
-0.277099609375,
-0.990234375,
-0.56298828125,
-1.1396484375,
-0.317626953125,
-0.5556640625,
-0.0531005859375,
0.430419921875,
-1.0341796875,
0.43701171875,
-0.02734375,
-0.25732421875,
0.25146484375,
-0.5947265625,
0.464599609375,
-0.31689453125,
0.89208984375,
-0.41845703125,
0.556640625,
-0.059326171875,
1.044921875,
-0.63427734375,
-0.73095703125,
-0.425537109375,
-0.5478515625,
0.1607666015625,
0.173583984375,
0.4384765625,
-0.42626953125,
-0.28662109375,
-0.6572265625,
-0.243896484375,
-0.0312347412109375,
-0.437255859375,
0.33447265625,
-0.58642578125,
0.8759765625,
0.88037109375,
-0.7412109375,
0.7451171875,
0.93408203125,
-0.8095703125,
0.33935546875,
0.1619873046875,
0.125,
-0.89990234375,
1.5849609375,
0.67578125,
0.73046875,
-0.2578125,
-0.486328125,
-0.386474609375,
0.420166015625,
-0.1402587890625,
-0.302978515625,
-0.30908203125,
0.7568359375,
0.2152099609375,
-1.3828125,
0.418701171875,
-0.75927734375,
-0.417236328125,
-0.54638671875,
-0.52734375,
0.798828125,
0.708984375,
0.1767578125,
-0.607421875,
-0.378662109375,
0.21533203125,
0.876953125,
0.6044921875,
-0.50439453125,
0.339599609375,
0.60693359375,
0.46826171875,
0.0960693359375,
0.1488037109375,
-0.47412109375,
-0.01364898681640625,
-0.04241943359375,
-0.002838134765625,
0.55810546875,
-0.1737060546875,
0.287109375,
0.56201171875,
0.38671875,
-0.74951171875,
-0.1932373046875,
-0.444091796875,
0.63818359375,
0.412353515625,
0.396484375,
0.2919921875,
-0.5712890625,
-0.208251953125,
-1.0458984375,
0.71728515625,
0.134521484375,
0.61474609375,
-0.92919921875,
0.720703125,
0.1405029296875,
-0.54443359375,
0.464111328125,
-0.376708984375,
-0.36181640625,
0.84033203125,
-0.460693359375,
0.96044921875,
-0.7548828125,
0.250732421875,
0.32763671875,
0.033233642578125,
0.89697265625,
0.68310546875,
0.321533203125,
0.1754150390625,
-0.67529296875,
-0.03240966796875,
-0.52978515625,
-0.48046875,
-0.66943359375,
0.1219482421875,
-0.251953125,
-0.6865234375,
-0.62841796875,
0.8564453125,
0.427734375,
0.3857421875,
-0.19677734375,
0.40625,
0.203125,
0.259765625,
0.4912109375,
0.052276611328125,
0.6787109375,
-0.55224609375,
0.986328125,
0.007537841796875,
-0.65576171875,
-0.497314453125,
-0.3603515625,
-0.59814453125,
0.043609619140625,
0.165771484375,
-0.0017747879028320312,
-0.9072265625,
0.08770751953125,
0.1422119140625,
0.1580810546875,
-0.378173828125,
-0.0911865234375,
-0.099853515625,
0.81201171875,
0.2666015625,
-0.95947265625,
0.0667724609375,
-0.88134765625,
0.3193359375,
0.6005859375,
-0.326416015625,
0.0701904296875,
-0.309814453125,
-0.6669921875,
-0.6748046875,
0.1492919921875,
0.61328125,
-0.23828125,
0.19482421875,
-1.044921875,
0.564453125,
0.6787109375,
-0.336669921875,
0.11590576171875,
-0.258056640625,
0.43798828125,
0.2265625,
0.37060546875,
-0.63671875,
-0.34521484375,
-0.01015472412109375,
-1.302734375,
0.12060546875,
-0.7255859375,
0.76318359375,
0.053466796875,
0.08502197265625,
0.00556182861328125,
0.459716796875,
-0.08746337890625,
0.259033203125,
-0.0809326171875,
0.50830078125,
-1.029296875,
-0.327880859375,
0.4365234375,
-0.2198486328125,
-0.2269287109375,
0.6171875,
-0.352294921875,
-0.5048828125,
0.1998291015625,
0.37451171875,
-0.4619140625,
0.544921875,
-0.720703125,
0.54443359375,
0.215576171875,
-0.7373046875,
-0.1363525390625,
-0.337158203125,
0.48291015625,
0.180908203125,
-0.5517578125,
-0.111572265625,
-1.1845703125,
-0.39599609375,
0.03411865234375,
-0.454345703125,
0.495361328125,
-0.2105712890625,
-0.5322265625,
-0.0155029296875,
-0.1888427734375,
-0.392578125,
-0.373291015625,
-0.61083984375,
-0.42724609375,
0.53662109375,
0.67236328125,
0.806640625,
0.2000732421875,
-0.4580078125,
-0.368408203125,
-0.3251953125,
0.1099853515625,
-0.53857421875,
0.0305633544921875,
0.199462890625,
-0.395751953125,
-0.369384765625,
0.2451171875,
-0.21240234375,
0.3564453125,
0.357421875,
-0.06591796875,
0.5400390625,
0.31494140625,
-0.337890625,
1.2568359375,
-0.0855712890625,
-1.380859375,
-0.3291015625,
0.38916015625,
-0.26806640625,
0.6328125,
0.388916015625,
-1.001953125,
-0.974609375,
-0.99365234375,
0.2403564453125,
-0.498291015625,
-0.65185546875,
-0.69189453125,
-0.59814453125,
-0.407470703125,
0.50390625,
-0.11962890625,
-0.473388671875,
0.1507568359375,
-1.0009765625,
-0.1544189453125,
-0.7548828125,
-0.662109375,
-0.88720703125,
-0.1856689453125,
-0.273681640625,
0.8798828125,
-0.35693359375,
0.2459716796875,
-0.18701171875,
-0.0207366943359375,
-0.0343017578125,
-0.166015625,
-0.16357421875,
-0.2315673828125,
-0.2291259765625,
0.1357421875,
-0.261962890625,
0.35400390625,
-0.33544921875,
0.43701171875,
-0.90185546875,
-0.2890625,
0.02947998046875,
-0.55322265625,
-0.22314453125,
-0.440673828125,
1.3759765625,
-0.2998046875,
-0.03143310546875,
-0.336181640625,
0.76171875,
0.50146484375,
-0.29833984375,
-0.85498046875,
-0.5791015625,
-0.463623046875,
-1.3349609375,
0.521484375,
-1.013671875,
0.1387939453125,
-0.81982421875,
0.1341552734375,
0.85693359375,
-0.436767578125,
0.2005615234375,
1.349609375,
0.1395263671875,
0.451416015625,
-0.5751953125,
0.9189453125,
0.368408203125,
-0.6767578125,
-0.37841796875,
0.2734375,
-1.1083984375,
0.37744140625,
-0.1995849609375,
-0.8447265625,
-0.53515625,
0.336669921875,
1.416015625,
-0.28125,
0.5986328125,
-0.03570556640625,
-0.90673828125,
-0.7509765625,
0.7802734375,
0.259765625,
0.6494140625,
0.740234375,
-0.1436767578125,
-0.133056640625,
0.03204345703125,
-0.04669189453125,
-0.30615234375,
-0.61474609375,
1.2041015625,
-0.322998046875,
-0.7783203125,
0.52880859375,
0.87841796875,
-0.98583984375,
-0.53564453125,
-0.38232421875,
0.12054443359375,
-0.040069580078125,
-0.76513671875,
0.254150390625,
-0.182861328125,
-0.9580078125,
-0.267333984375,
0.2685546875,
0.0247039794921875,
0.216796875,
0.1290283203125,
0.040069580078125,
-0.35498046875,
0.0061492919921875,
0.77001953125,
-0.6728515625,
-0.062469482421875,
-0.86474609375,
0.10272216796875,
0.01076507568359375,
0.0228424072265625,
0.66552734375,
-0.275390625,
0.4853515625,
0.50830078125,
-0.08740234375,
0.483642578125,
-0.55517578125,
-0.216796875,
0.37841796875,
-0.50390625,
-0.6240234375,
-0.082275390625,
0.484619140625,
0.141357421875,
0.259765625,
-0.456298828125,
0.037628173828125,
0.2008056640625,
0.009124755859375,
-0.1925048828125,
-0.8984375,
-0.517578125,
-1.3193359375,
-0.492431640625,
-0.278564453125,
-0.446533203125,
-0.12890625,
0.335693359375,
-0.29638671875,
-1.08203125,
0.098876953125,
0.68896484375,
-0.556640625,
1.068359375,
-0.8369140625,
0.3349609375,
-0.5986328125,
-0.1497802734375,
-0.72607421875,
0.259765625,
-0.1910400390625,
0.08636474609375,
-0.4873046875,
0.62255859375,
0.035614013671875,
0.5947265625,
-0.11456298828125,
0.458740234375,
-0.2998046875,
0.032440185546875,
0.147216796875,
-0.0999755859375,
-0.2340087890625,
1.015625,
0.443603515625,
-0.2298583984375,
0.43359375,
-0.368896484375,
-0.626953125,
-0.178955078125,
0.79931640625,
0.97705078125,
-0.22998046875,
-0.319580078125,
-0.436279296875,
0.52099609375,
-0.89111328125,
0.1708984375,
-0.419677734375,
0.4326171875,
0.0789794921875,
-0.317138671875,
0.23681640625,
1.427734375,
-0.2481689453125,
0.56982421875,
0.1248779296875,
0.2144775390625,
0.39404296875,
0.0175628662109375,
-0.03802490234375,
0.2401123046875,
0.1441650390625,
-0.3466796875,
-0.135986328125,
0.4970703125,
0.1541748046875,
0.151123046875,
-0.22216796875,
-0.64111328125,
-0.82373046875,
0.051513671875,
-0.0139617919921875,
0.464599609375,
0.732421875,
-0.4755859375,
-0.1734619140625,
-0.08050537109375,
-0.59375,
0.30859375,
-0.943359375,
-0.75927734375,
0.2061767578125,
-0.5166015625,
-0.462158203125,
-0.159912109375,
-0.5576171875,
-0.6552734375,
0.1322021484375,
0.01220703125,
-0.5927734375,
-0.209716796875,
-0.54052734375,
0.59716796875,
-0.282958984375,
-0.1900634765625,
0.0281982421875,
0.2366943359375,
-0.2568359375,
-0.412109375,
0.24951171875,
0.52685546875,
-0.0279388427734375,
-0.042236328125,
-0.91259765625,
0.35205078125,
-0.166748046875,
-0.00007086992263793945,
-0.72509765625,
-0.10601806640625,
-0.1710205078125,
0.3642578125,
-1.283203125,
0.1732177734375,
-0.120361328125,
0.0364990234375,
0.70263671875,
-0.494873046875,
-0.468994140625,
1.259765625,
0.60498046875,
-0.04364013671875,
-0.2235107421875,
0.29150390625,
0.63818359375,
-0.1187744140625,
-0.40869140625,
-0.209228515625,
0.70166015625,
0.54541015625,
0.57861328125,
0.1871337890625,
0.30029296875,
0.63720703125,
-0.09478759765625,
-0.53759765625,
0.305908203125,
0.5029296875,
-0.193359375,
0.6630859375,
0.048492431640625,
-0.2332763671875,
-0.017425537109375,
-0.80419921875,
0.259765625,
-0.116455078125,
-0.271240234375,
-0.1370849609375,
-0.1519775390625,
0.60693359375,
-0.291748046875,
-0.20703125,
0.00954437255859375,
-0.841796875,
0.369384765625,
0.478271484375,
-0.0030078887939453125,
-0.3212890625,
1.162109375,
0.6845703125,
0.2420654296875,
0.69091796875,
0.26806640625,
0.6865234375,
-0.64501953125,
0.3623046875,
-0.1424560546875,
-0.103515625,
0.1591796875,
-0.274658203125,
-1.044921875,
0.3427734375,
-0.529296875,
-0.310791015625,
0.5478515625,
-0.72119140625,
0.3017578125,
-0.58642578125,
0.83056640625,
-0.56201171875,
0.57763671875,
0.239013671875,
-0.1497802734375,
-0.43017578125,
0.359375,
-0.2401123046875,
0.62548828125,
0.1787109375,
0.748046875,
0.3896484375,
1.7119140625,
0.4716796875,
-0.1466064453125,
0.1639404296875,
0.122314453125,
-0.44970703125,
-0.66015625,
0.0687255859375,
-0.052947998046875,
0.04730224609375,
-0.473876953125,
-0.49267578125,
-0.07403564453125,
0.94580078125,
-0.4541015625,
-1.080078125,
-0.2315673828125,
0.427734375,
-0.6416015625,
0.84521484375,
0.625,
0.1923828125,
0.2362060546875,
-0.134521484375,
-0.16552734375,
-0.666015625,
0.1905517578125,
-0.2344970703125,
0.64794921875,
-0.462158203125,
-0.56640625,
-0.65966796875,
-0.320068359375,
-0.10113525390625,
-0.0462646484375,
-0.25732421875,
-0.418701171875,
0.270263671875,
0.8203125,
0.29443359375,
0.379150390625,
-0.470947265625,
0.006793975830078125,
0.66015625,
1.0029296875,
0.08282470703125,
0.98583984375,
0.548828125,
-0.361083984375,
0.1131591796875,
-0.47998046875,
0.90576171875,
0.0035400390625,
0.0693359375,
-0.27490234375,
0.5380859375,
-0.75341796875,
-1.4931640625,
0.070556640625,
0.662109375,
0.08929443359375,
-0.5947265625,
-0.9482421875,
-0.426025390625,
-0.99365234375,
-0.389404296875,
-0.70703125,
0.6064453125,
0.1695556640625,
0.012939453125,
0.030792236328125,
-1.044921875,
4.34765625,
0.77490234375,
0.796875,
0.443359375,
0.39697265625,
1.3388671875,
0.61572265625,
-0.59375,
-0.1676025390625,
-0.88330078125,
0.64599609375,
-0.69580078125,
-0.156982421875,
0.75146484375,
0.71142578125,
0.537109375,
-0.466796875,
0.1422119140625,
-0.037353515625,
-0.857421875,
-0.60791015625,
-0.3662109375,
0.159423828125,
0.6728515625,
0.20068359375,
0.467529296875,
0.99072265625,
-0.84912109375,
-0.337646484375,
-0.1807861328125,
-0.1572265625,
-0.208251953125,
0.428466796875,
0.0882568359375,
-0.52685546875,
0.662109375,
0.194091796875,
-0.95556640625,
-0.09368896484375,
0.205322265625,
-0.71142578125,
-0.2364501953125,
0.607421875,
-0.59912109375,
0.224609375,
0.5869140625,
-0.572265625,
0.64990234375,
0.391357421875,
-0.701171875,
0.69775390625,
-0.57763671875,
0.6826171875,
-0.83154296875,
-0.4365234375,
0.1639404296875,
-0.007175445556640625,
-0.2156982421875,
-0.46923828125,
0.27294921875,
0.52880859375,
0.11907958984375,
0.076416015625,
0.76171875,
-0.84375,
0.98388671875,
-0.0980224609375,
0.48095703125,
-0.53515625,
-0.2213134765625,
-0.5263671875,
-0.2208251953125,
-0.19189453125,
-0.242431640625,
0.884765625,
0.054901123046875,
-0.38916015625,
0.33349609375,
0.673828125,
-0.6728515625,
0.0294342041015625,
0.005889892578125,
-0.626953125,
-0.65966796875,
0.64892578125,
0.9912109375,
-0.1558837890625,
-0.497802734375,
-0.220458984375,
0.82958984375,
0.759765625,
0.7216796875,
-0.06341552734375,
-0.51025390625,
-0.470947265625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Tags: implementation, strings
Correct Solution:
```
n = int(input())
l = list(map(set, input().split(' ')))
s = list()
for i in l:
if not i in s:
s.append(i)
print(len(s))
```
| 66,988
|
[
0.422119140625,
0.10693359375,
-0.137939453125,
-0.23046875,
-0.28564453125,
-0.47216796875,
0.127197265625,
0.0270538330078125,
0.368896484375,
0.57958984375,
1.0498046875,
-0.6181640625,
-0.06695556640625,
-0.90869140625,
-0.61083984375,
0.1134033203125,
-0.625,
-0.630859375,
-0.279296875,
-0.378662109375,
0.362548828125,
0.00909423828125,
-1.57421875,
-0.0242156982421875,
-0.387939453125,
1.3154296875,
0.55908203125,
-0.0294952392578125,
0.9833984375,
1.13671875,
-0.2060546875,
-0.355224609375,
0.97998046875,
-0.82861328125,
-0.32568359375,
-0.421142578125,
0.810546875,
-0.935546875,
0.116943359375,
-0.90673828125,
0.6181640625,
-0.10760498046875,
0.10504150390625,
-0.677734375,
-1.3095703125,
0.17431640625,
-0.2496337890625,
-0.513671875,
0.06988525390625,
-1.0048828125,
0.25341796875,
-0.470458984375,
0.37109375,
-0.318359375,
0.12249755859375,
-0.1915283203125,
-0.043670654296875,
-0.0028629302978515625,
-0.453369140625,
0.09716796875,
0.401123046875,
0.398193359375,
-0.10833740234375,
-0.86962890625,
-0.042633056640625,
0.31494140625,
0.147705078125,
-0.11785888671875,
0.1279296875,
-0.67236328125,
-0.50732421875,
0.4072265625,
-0.262451171875,
-0.7314453125,
-0.521484375,
0.0526123046875,
-0.0165557861328125,
0.348388671875,
-0.69970703125,
0.2393798828125,
0.259033203125,
0.84912109375,
-0.041229248046875,
0.05926513671875,
-0.290771484375,
-0.541015625,
-0.1199951171875,
0.65625,
0.26513671875,
-0.186279296875,
-0.35302734375,
0.4306640625,
-0.513671875,
-0.01354217529296875,
0.8115234375,
0.5810546875,
-0.380615234375,
0.541015625,
0.428955078125,
0.0031757354736328125,
0.75927734375,
1.158203125,
-0.50244140625,
0.859375,
-0.6015625,
-0.076171875,
0.2236328125,
0.041015625,
-0.16552734375,
-0.358642578125,
-0.0782470703125,
-0.40234375,
0.26806640625,
0.215087890625,
-0.11968994140625,
0.89794921875,
-0.07232666015625,
0.08819580078125,
-0.7353515625,
-0.0294342041015625,
0.300537109375,
-0.00818634033203125,
0.212890625,
-0.171142578125,
0.037567138671875,
-0.2027587890625,
-0.6865234375,
1.162109375,
-0.2548828125,
-0.168701171875,
0.252197265625,
0.1439208984375,
-0.438720703125,
0.53759765625,
-0.36767578125,
0.56298828125,
0.1444091796875,
0.61328125,
0.7568359375,
-0.5908203125,
0.85302734375,
-0.46728515625,
0.0142974853515625,
1.4951171875,
0.5654296875,
0.2161865234375,
1.00390625,
0.2237548828125,
-0.720703125,
0.556640625,
-0.658203125,
0.2130126953125,
0.064453125,
0.39697265625,
-0.51123046875,
0.298583984375,
0.382080078125,
0.47998046875,
0.2100830078125,
0.2423095703125,
-0.4072265625,
0.2037353515625,
-0.37841796875,
0.8291015625,
-0.0010738372802734375,
1.0654296875,
-0.4970703125,
-0.56298828125,
-0.1612548828125,
-0.59814453125,
0.60009765625,
-0.214111328125,
-0.0256195068359375,
0.94775390625,
0.498779296875,
0.7138671875,
0.6689453125,
0.1871337890625,
0.295654296875,
0.0248870849609375,
0.01922607421875,
-0.109130859375,
0.178955078125,
0.71337890625,
0.3935546875,
0.11297607421875,
-0.226806640625,
-0.361328125,
-0.501953125,
-0.428466796875,
0.0894775390625,
0.92822265625,
-0.7265625,
0.5078125,
0.228759765625,
-0.11236572265625,
-0.7900390625,
-0.37158203125,
-0.041259765625,
-0.81396484375,
-0.167724609375,
0.70166015625,
-0.09521484375,
0.43115234375,
-0.043975830078125,
-0.43408203125,
0.31103515625,
1.3935546875,
-0.297119140625,
0.16162109375,
0.4296875,
-0.177978515625,
-0.13916015625,
0.2420654296875,
0.019989013671875,
-0.11376953125,
-0.83642578125,
1.1279296875,
-0.4150390625,
-0.056396484375,
0.330810546875,
0.7314453125,
0.309814453125,
0.478271484375,
-0.312255859375,
-0.5146484375,
0.39794921875,
0.82763671875,
0.2392578125,
0.61376953125,
0.31298828125,
0.908203125,
0.269287109375,
0.65087890625,
0.394775390625,
0.380615234375,
0.56201171875,
0.44580078125,
0.05047607421875,
0.369873046875,
0.2283935546875,
0.1844482421875,
0.5849609375,
0.4345703125,
-0.11968994140625,
0.44775390625,
-0.1837158203125,
0.1943359375,
-0.041595458984375,
0.8369140625,
-0.255615234375,
0.7646484375,
0.227294921875,
0.356689453125,
-1.0693359375,
-0.71923828125,
0.418212890625,
0.84814453125,
-0.97412109375,
-1.1640625,
-0.2294921875,
0.017913818359375,
0.141357421875,
0.1583251953125,
0.3994140625,
0.7421875,
0.19970703125,
0.61376953125,
-0.556640625,
-0.35546875,
-1.0234375,
-0.6064453125,
-1.166015625,
-0.34912109375,
-0.548828125,
-0.041595458984375,
0.537109375,
-1.0205078125,
0.37060546875,
-0.062225341796875,
-0.321044921875,
0.2391357421875,
-0.5546875,
0.496826171875,
-0.340576171875,
0.86328125,
-0.37353515625,
0.54443359375,
-0.0290374755859375,
0.88134765625,
-0.74609375,
-0.67529296875,
-0.448486328125,
-0.57861328125,
0.169921875,
0.1578369140625,
0.4814453125,
-0.40625,
-0.34423828125,
-0.720703125,
-0.1636962890625,
-0.05401611328125,
-0.4404296875,
0.405517578125,
-0.65673828125,
0.93017578125,
0.8896484375,
-0.79736328125,
0.72705078125,
0.99951171875,
-0.841796875,
0.435791015625,
0.1727294921875,
0.16162109375,
-0.8720703125,
1.5859375,
0.71826171875,
0.72412109375,
-0.25341796875,
-0.461669921875,
-0.434326171875,
0.373291015625,
-0.109130859375,
-0.40283203125,
-0.28857421875,
0.7353515625,
0.20166015625,
-1.3828125,
0.498779296875,
-0.81689453125,
-0.53564453125,
-0.54833984375,
-0.406005859375,
0.8095703125,
0.73291015625,
0.1783447265625,
-0.5556640625,
-0.396240234375,
0.1693115234375,
0.88720703125,
0.58984375,
-0.445068359375,
0.36767578125,
0.61083984375,
0.460205078125,
0.1822509765625,
0.08612060546875,
-0.384765625,
-0.048553466796875,
-0.0126953125,
0.076171875,
0.63427734375,
-0.13427734375,
0.31591796875,
0.560546875,
0.42626953125,
-0.7109375,
-0.198486328125,
-0.47119140625,
0.66259765625,
0.449462890625,
0.444091796875,
0.35009765625,
-0.64697265625,
-0.279541015625,
-1.01953125,
0.6650390625,
0.0965576171875,
0.67041015625,
-1.0234375,
0.6884765625,
0.196044921875,
-0.5498046875,
0.4501953125,
-0.5029296875,
-0.276123046875,
0.8876953125,
-0.43408203125,
1.048828125,
-0.79736328125,
0.2330322265625,
0.333740234375,
0.049591064453125,
0.7841796875,
0.712890625,
0.3359375,
0.1964111328125,
-0.64892578125,
-0.07244873046875,
-0.433837890625,
-0.3994140625,
-0.73681640625,
0.1763916015625,
-0.3017578125,
-0.6376953125,
-0.68505859375,
0.8359375,
0.46728515625,
0.356201171875,
-0.20556640625,
0.451904296875,
0.293701171875,
0.347900390625,
0.5849609375,
0.11810302734375,
0.64501953125,
-0.5849609375,
0.96142578125,
0.080078125,
-0.74951171875,
-0.529296875,
-0.32421875,
-0.60986328125,
0.019317626953125,
0.1358642578125,
-0.03240966796875,
-0.84912109375,
0.097412109375,
0.08660888671875,
0.1839599609375,
-0.42236328125,
-0.0362548828125,
-0.03558349609375,
0.80810546875,
0.2666015625,
-0.91552734375,
0.15185546875,
-0.91552734375,
0.398681640625,
0.69140625,
-0.34619140625,
-0.06591796875,
-0.220947265625,
-0.70263671875,
-0.6572265625,
0.0858154296875,
0.6513671875,
-0.175537109375,
0.141357421875,
-1.171875,
0.525390625,
0.61767578125,
-0.31005859375,
0.201171875,
-0.28466796875,
0.463134765625,
0.095703125,
0.4384765625,
-0.626953125,
-0.438720703125,
-0.023956298828125,
-1.287109375,
0.0667724609375,
-0.615234375,
0.80712890625,
0.098876953125,
0.14208984375,
0.02044677734375,
0.391845703125,
-0.1806640625,
0.298583984375,
-0.03619384765625,
0.428466796875,
-1.0087890625,
-0.300048828125,
0.444091796875,
-0.2032470703125,
-0.2734375,
0.69677734375,
-0.354736328125,
-0.49853515625,
0.152099609375,
0.4072265625,
-0.4921875,
0.55908203125,
-0.6748046875,
0.50927734375,
0.08294677734375,
-0.69921875,
-0.10150146484375,
-0.35400390625,
0.5498046875,
0.1300048828125,
-0.443359375,
-0.195068359375,
-1.25390625,
-0.51171875,
0.08721923828125,
-0.52392578125,
0.411865234375,
-0.2347412109375,
-0.54296875,
-0.0325927734375,
-0.2030029296875,
-0.46533203125,
-0.440185546875,
-0.5166015625,
-0.415771484375,
0.580078125,
0.58935546875,
0.75830078125,
0.2281494140625,
-0.42529296875,
-0.298095703125,
-0.2099609375,
0.200927734375,
-0.5205078125,
0.0037136077880859375,
0.16357421875,
-0.347900390625,
-0.2861328125,
0.2247314453125,
-0.1448974609375,
0.3466796875,
0.43505859375,
-0.058074951171875,
0.544921875,
0.26318359375,
-0.386474609375,
1.3154296875,
-0.14501953125,
-1.4345703125,
-0.3349609375,
0.373291015625,
-0.1806640625,
0.6640625,
0.36474609375,
-0.9375,
-1.00390625,
-1.00390625,
0.1759033203125,
-0.486572265625,
-0.63623046875,
-0.69677734375,
-0.60107421875,
-0.382080078125,
0.5673828125,
-0.1790771484375,
-0.509765625,
0.067626953125,
-1.05078125,
-0.1480712890625,
-0.7744140625,
-0.595703125,
-0.9306640625,
-0.200927734375,
-0.32568359375,
0.83984375,
-0.269287109375,
0.280029296875,
-0.09405517578125,
-0.1416015625,
-0.08331298828125,
-0.22265625,
-0.152587890625,
-0.250732421875,
-0.19091796875,
0.076416015625,
-0.303466796875,
0.4052734375,
-0.336181640625,
0.490234375,
-0.9208984375,
-0.2083740234375,
-0.0665283203125,
-0.5234375,
-0.291015625,
-0.599609375,
1.458984375,
-0.2437744140625,
-0.094970703125,
-0.340576171875,
0.79345703125,
0.4921875,
-0.31298828125,
-0.84033203125,
-0.5009765625,
-0.482666015625,
-1.31640625,
0.5771484375,
-1.0234375,
0.165283203125,
-0.84130859375,
0.040771484375,
0.9091796875,
-0.415771484375,
0.205322265625,
1.296875,
0.060455322265625,
0.50146484375,
-0.6015625,
0.83740234375,
0.36376953125,
-0.68115234375,
-0.416015625,
0.248291015625,
-1.0654296875,
0.32666015625,
-0.26220703125,
-0.90283203125,
-0.473388671875,
0.376708984375,
1.4169921875,
-0.314697265625,
0.65478515625,
0.00887298583984375,
-1,
-0.720703125,
0.763671875,
0.343505859375,
0.6669921875,
0.7265625,
-0.043853759765625,
-0.19921875,
-0.0247650146484375,
-0.0133819580078125,
-0.322509765625,
-0.52392578125,
1.2255859375,
-0.189453125,
-0.818359375,
0.4169921875,
0.89208984375,
-1.046875,
-0.50341796875,
-0.37158203125,
0.02392578125,
-0.2274169921875,
-0.7392578125,
0.230712890625,
-0.181640625,
-0.8857421875,
-0.20068359375,
0.32080078125,
0.0506591796875,
0.1954345703125,
0.2091064453125,
0.038604736328125,
-0.38916015625,
0.0016183853149414062,
0.814453125,
-0.6572265625,
-0.129638671875,
-0.8251953125,
0.132568359375,
-0.016876220703125,
-0.05584716796875,
0.68408203125,
-0.33447265625,
0.362548828125,
0.56689453125,
-0.064697265625,
0.492431640625,
-0.68359375,
-0.2386474609375,
0.366943359375,
-0.51513671875,
-0.59423828125,
-0.08941650390625,
0.54248046875,
0.11627197265625,
0.2420654296875,
-0.42431640625,
0.0472412109375,
0.2265625,
-0.0064849853515625,
-0.278564453125,
-0.94873046875,
-0.517578125,
-1.337890625,
-0.53515625,
-0.389404296875,
-0.3818359375,
-0.0452880859375,
0.352294921875,
-0.294921875,
-1.09765625,
0.10125732421875,
0.7451171875,
-0.63720703125,
1.1494140625,
-0.77783203125,
0.379638671875,
-0.638671875,
-0.2744140625,
-0.71533203125,
0.3193359375,
-0.1759033203125,
0.09307861328125,
-0.5263671875,
0.67529296875,
0.09368896484375,
0.57958984375,
-0.134033203125,
0.513671875,
-0.28173828125,
0.0261077880859375,
0.10223388671875,
-0.1075439453125,
-0.2340087890625,
1.03125,
0.478515625,
-0.27294921875,
0.431640625,
-0.38916015625,
-0.6474609375,
-0.26220703125,
0.84765625,
0.9697265625,
-0.24462890625,
-0.229248046875,
-0.349365234375,
0.40625,
-0.9443359375,
0.1605224609375,
-0.34033203125,
0.40283203125,
0.08416748046875,
-0.32421875,
0.333251953125,
1.4326171875,
-0.253662109375,
0.494873046875,
0.1378173828125,
0.2261962890625,
0.478271484375,
-0.01212310791015625,
0.0162353515625,
0.300537109375,
0.1402587890625,
-0.398193359375,
-0.171875,
0.479248046875,
0.2177734375,
0.1375732421875,
-0.2127685546875,
-0.66943359375,
-0.76953125,
0.08392333984375,
-0.06610107421875,
0.455810546875,
0.6689453125,
-0.44970703125,
-0.1927490234375,
-0.1258544921875,
-0.61083984375,
0.1900634765625,
-0.99755859375,
-0.87255859375,
0.3115234375,
-0.375,
-0.50439453125,
-0.1187744140625,
-0.537109375,
-0.66015625,
0.1319580078125,
0.07745361328125,
-0.69189453125,
-0.17236328125,
-0.6337890625,
0.5703125,
-0.275390625,
-0.271240234375,
-0.01751708984375,
0.373046875,
-0.253662109375,
-0.414306640625,
0.224609375,
0.51953125,
-0.0146331787109375,
-0.027435302734375,
-0.88134765625,
0.334228515625,
-0.1331787109375,
-0.05999755859375,
-0.724609375,
-0.0787353515625,
-0.04608154296875,
0.445556640625,
-1.21875,
0.08978271484375,
-0.18359375,
0.054534912109375,
0.71484375,
-0.5205078125,
-0.46337890625,
1.2060546875,
0.52099609375,
-0.1673583984375,
-0.1839599609375,
0.3154296875,
0.537109375,
-0.1600341796875,
-0.344970703125,
-0.07940673828125,
0.73583984375,
0.474365234375,
0.5537109375,
0.1346435546875,
0.33984375,
0.6279296875,
-0.00589752197265625,
-0.5244140625,
0.271484375,
0.425537109375,
-0.093994140625,
0.52978515625,
0.056182861328125,
-0.272216796875,
0.0897216796875,
-0.7353515625,
0.1925048828125,
-0.180908203125,
-0.300537109375,
-0.1888427734375,
-0.17919921875,
0.6767578125,
-0.212890625,
-0.2310791015625,
-0.0188140869140625,
-0.796875,
0.294189453125,
0.44189453125,
-0.01593017578125,
-0.330322265625,
1.0908203125,
0.673828125,
0.2919921875,
0.67333984375,
0.1749267578125,
0.61865234375,
-0.58349609375,
0.271484375,
-0.0231170654296875,
-0.060302734375,
0.125732421875,
-0.382568359375,
-1.0556640625,
0.40869140625,
-0.499267578125,
-0.431396484375,
0.591796875,
-0.78173828125,
0.236328125,
-0.6083984375,
0.80712890625,
-0.59033203125,
0.57470703125,
0.2379150390625,
-0.19580078125,
-0.505859375,
0.41943359375,
-0.1654052734375,
0.7275390625,
0.197265625,
0.7919921875,
0.346923828125,
1.6162109375,
0.583984375,
-0.06256103515625,
0.1322021484375,
0.10137939453125,
-0.412353515625,
-0.65576171875,
-0.000946044921875,
-0.174072265625,
0.061676025390625,
-0.55419921875,
-0.5166015625,
0.0132904052734375,
0.9638671875,
-0.41796875,
-1.1630859375,
-0.11370849609375,
0.482666015625,
-0.6591796875,
0.93212890625,
0.60693359375,
0.10174560546875,
0.223876953125,
-0.06781005859375,
-0.1778564453125,
-0.65966796875,
0.2236328125,
-0.338134765625,
0.6064453125,
-0.50927734375,
-0.599609375,
-0.716796875,
-0.406982421875,
-0.037567138671875,
-0.052642822265625,
-0.230224609375,
-0.488037109375,
0.2001953125,
0.84130859375,
0.294677734375,
0.257080078125,
-0.479248046875,
-0.033538818359375,
0.66552734375,
0.97509765625,
-0.001941680908203125,
0.91455078125,
0.490234375,
-0.2327880859375,
0.1722412109375,
-0.5625,
0.9208984375,
-0.01904296875,
0.1861572265625,
-0.165771484375,
0.5908203125,
-0.65673828125,
-1.5087890625,
0.092041015625,
0.6103515625,
0.07745361328125,
-0.59814453125,
-1.025390625,
-0.436279296875,
-0.93798828125,
-0.342041015625,
-0.76806640625,
0.61328125,
0.10455322265625,
-0.03460693359375,
-0.0009760856628417969,
-1.1142578125,
4.30078125,
0.79833984375,
0.8857421875,
0.521484375,
0.405029296875,
1.3740234375,
0.6298828125,
-0.5166015625,
-0.202880859375,
-0.79248046875,
0.69775390625,
-0.68994140625,
-0.1810302734375,
0.5927734375,
0.6865234375,
0.56689453125,
-0.369384765625,
0.23095703125,
-0.00739288330078125,
-0.85107421875,
-0.64208984375,
-0.32470703125,
0.1575927734375,
0.56884765625,
0.326171875,
0.430419921875,
1.0283203125,
-0.8828125,
-0.316162109375,
-0.216552734375,
-0.12066650390625,
-0.258056640625,
0.488525390625,
0.1265869140625,
-0.57666015625,
0.6435546875,
0.150390625,
-0.96044921875,
-0.044464111328125,
0.16455078125,
-0.7861328125,
-0.2301025390625,
0.806640625,
-0.56689453125,
0.130859375,
0.64599609375,
-0.5751953125,
0.59814453125,
0.3525390625,
-0.74853515625,
0.71142578125,
-0.609375,
0.6572265625,
-0.88818359375,
-0.4658203125,
0.1947021484375,
0.04595947265625,
-0.14453125,
-0.487548828125,
0.260986328125,
0.50927734375,
0.1624755859375,
0.11419677734375,
0.69482421875,
-0.90771484375,
0.9755859375,
-0.056732177734375,
0.33642578125,
-0.59375,
-0.281982421875,
-0.494384765625,
-0.2086181640625,
-0.134765625,
-0.3046875,
0.9365234375,
0.0377197265625,
-0.456787109375,
0.37646484375,
0.55908203125,
-0.68798828125,
-0.092529296875,
-0.03326416015625,
-0.65478515625,
-0.70556640625,
0.59423828125,
0.95068359375,
-0.2666015625,
-0.422119140625,
-0.1458740234375,
0.87646484375,
0.8359375,
0.7451171875,
-0.036895751953125,
-0.53515625,
-0.429931640625
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Tags: implementation, strings
Correct Solution:
```
n=int(input())
ar=input().split()
z=set()
for x in ar:
x=list(x)
x.sort()
x=''.join(list(set(''.join(x))))
z.add(x)
print(len(z))
```
| 66,989
|
[
0.440185546875,
0.10357666015625,
-0.09002685546875,
-0.25634765625,
-0.28662109375,
-0.491943359375,
0.12066650390625,
0.0498046875,
0.357421875,
0.58251953125,
1.080078125,
-0.62548828125,
-0.09490966796875,
-0.93212890625,
-0.59521484375,
0.08905029296875,
-0.61767578125,
-0.6123046875,
-0.27001953125,
-0.36962890625,
0.401611328125,
0.007236480712890625,
-1.5986328125,
0.00010383129119873047,
-0.35302734375,
1.30078125,
0.5634765625,
-0.055908203125,
1.0048828125,
1.146484375,
-0.2371826171875,
-0.335693359375,
0.98046875,
-0.7900390625,
-0.29931640625,
-0.44287109375,
0.80859375,
-0.96337890625,
0.1068115234375,
-0.91162109375,
0.64306640625,
-0.13525390625,
0.10260009765625,
-0.69189453125,
-1.3564453125,
0.151123046875,
-0.2022705078125,
-0.491943359375,
0.09625244140625,
-1.021484375,
0.24853515625,
-0.473876953125,
0.415283203125,
-0.31884765625,
0.1168212890625,
-0.21142578125,
-0.0256195068359375,
0.0160675048828125,
-0.432861328125,
0.07537841796875,
0.3798828125,
0.39111328125,
-0.1279296875,
-0.84130859375,
-0.01214599609375,
0.294677734375,
0.1163330078125,
-0.146484375,
0.134521484375,
-0.6708984375,
-0.5126953125,
0.401611328125,
-0.2783203125,
-0.72021484375,
-0.53759765625,
0.044189453125,
-0.0200042724609375,
0.359130859375,
-0.69189453125,
0.259765625,
0.273681640625,
0.83349609375,
-0.057586669921875,
0.0447998046875,
-0.296142578125,
-0.4912109375,
-0.1016845703125,
0.64892578125,
0.2171630859375,
-0.18994140625,
-0.35693359375,
0.40771484375,
-0.544921875,
0.03546142578125,
0.83642578125,
0.560546875,
-0.378662109375,
0.53125,
0.43310546875,
-0.0132904052734375,
0.755859375,
1.1591796875,
-0.52587890625,
0.8564453125,
-0.57861328125,
-0.0462646484375,
0.2105712890625,
0.055145263671875,
-0.1666259765625,
-0.388916015625,
-0.0094757080078125,
-0.377197265625,
0.2401123046875,
0.212646484375,
-0.134033203125,
0.90478515625,
-0.0877685546875,
0.07147216796875,
-0.7314453125,
-0.043182373046875,
0.30078125,
-0.005260467529296875,
0.2298583984375,
-0.14404296875,
0.06610107421875,
-0.1832275390625,
-0.69384765625,
1.1396484375,
-0.258056640625,
-0.1761474609375,
0.279541015625,
0.169921875,
-0.454833984375,
0.513671875,
-0.375244140625,
0.5390625,
0.1971435546875,
0.6201171875,
0.7236328125,
-0.60693359375,
0.87060546875,
-0.458251953125,
-0.0079498291015625,
1.501953125,
0.56591796875,
0.2017822265625,
0.97802734375,
0.20751953125,
-0.7021484375,
0.5458984375,
-0.65087890625,
0.2305908203125,
0.0784912109375,
0.369140625,
-0.5029296875,
0.30078125,
0.39794921875,
0.492919921875,
0.1959228515625,
0.2230224609375,
-0.398681640625,
0.1763916015625,
-0.39453125,
0.7978515625,
0.0238189697265625,
1.0380859375,
-0.497802734375,
-0.5341796875,
-0.17333984375,
-0.56005859375,
0.6298828125,
-0.1934814453125,
-0.016693115234375,
0.94873046875,
0.485595703125,
0.67626953125,
0.6435546875,
0.1944580078125,
0.277587890625,
0.05401611328125,
0.00745391845703125,
-0.08465576171875,
0.20166015625,
0.72705078125,
0.402587890625,
0.1005859375,
-0.2391357421875,
-0.360107421875,
-0.51708984375,
-0.42578125,
0.14697265625,
0.908203125,
-0.73095703125,
0.5380859375,
0.1986083984375,
-0.1463623046875,
-0.8046875,
-0.379150390625,
-0.037109375,
-0.7998046875,
-0.1470947265625,
0.677734375,
-0.054840087890625,
0.43359375,
-0.07080078125,
-0.443359375,
0.309326171875,
1.390625,
-0.28271484375,
0.1739501953125,
0.43701171875,
-0.1947021484375,
-0.10894775390625,
0.274658203125,
0.0111846923828125,
-0.10284423828125,
-0.822265625,
1.09765625,
-0.37939453125,
-0.029510498046875,
0.324462890625,
0.73779296875,
0.300537109375,
0.498046875,
-0.298095703125,
-0.515625,
0.43701171875,
0.80322265625,
0.2362060546875,
0.6220703125,
0.3330078125,
0.88671875,
0.283935546875,
0.6220703125,
0.34912109375,
0.35400390625,
0.576171875,
0.42431640625,
0.04852294921875,
0.365966796875,
0.19140625,
0.1707763671875,
0.56396484375,
0.43017578125,
-0.059906005859375,
0.44921875,
-0.1741943359375,
0.1739501953125,
-0.017822265625,
0.86279296875,
-0.2462158203125,
0.79736328125,
0.2451171875,
0.328857421875,
-1.068359375,
-0.71923828125,
0.42529296875,
0.81494140625,
-0.99462890625,
-1.1796875,
-0.22998046875,
-0.007659912109375,
0.1453857421875,
0.149169921875,
0.408203125,
0.75,
0.1895751953125,
0.58544921875,
-0.5830078125,
-0.336669921875,
-0.99951171875,
-0.5947265625,
-1.1376953125,
-0.355712890625,
-0.52978515625,
-0.01080322265625,
0.5478515625,
-0.970703125,
0.4052734375,
-0.0379638671875,
-0.314208984375,
0.21875,
-0.578125,
0.486328125,
-0.347412109375,
0.87060546875,
-0.373291015625,
0.49853515625,
-0.050140380859375,
0.89111328125,
-0.7548828125,
-0.67724609375,
-0.44970703125,
-0.56884765625,
0.125,
0.162109375,
0.493896484375,
-0.3994140625,
-0.32275390625,
-0.71337890625,
-0.1724853515625,
-0.07916259765625,
-0.44677734375,
0.3798828125,
-0.6337890625,
0.9140625,
0.8994140625,
-0.794921875,
0.70751953125,
0.98779296875,
-0.8271484375,
0.391845703125,
0.1971435546875,
0.174560546875,
-0.84521484375,
1.5625,
0.732421875,
0.7509765625,
-0.24462890625,
-0.468994140625,
-0.4326171875,
0.388916015625,
-0.13427734375,
-0.403076171875,
-0.3076171875,
0.71826171875,
0.190185546875,
-1.361328125,
0.466552734375,
-0.7919921875,
-0.54345703125,
-0.5546875,
-0.396728515625,
0.79443359375,
0.705078125,
0.197509765625,
-0.52587890625,
-0.3603515625,
0.173095703125,
0.8583984375,
0.5947265625,
-0.4716796875,
0.363037109375,
0.591796875,
0.48486328125,
0.1741943359375,
0.06549072265625,
-0.370849609375,
-0.049285888671875,
-0.02166748046875,
0.048492431640625,
0.61328125,
-0.137939453125,
0.323974609375,
0.5703125,
0.393310546875,
-0.72021484375,
-0.1953125,
-0.479248046875,
0.66357421875,
0.44970703125,
0.4111328125,
0.322021484375,
-0.65380859375,
-0.25830078125,
-1.00390625,
0.6376953125,
0.1129150390625,
0.63525390625,
-1.0009765625,
0.68505859375,
0.2288818359375,
-0.5478515625,
0.45458984375,
-0.5029296875,
-0.274169921875,
0.8818359375,
-0.436767578125,
1.0419921875,
-0.78857421875,
0.23046875,
0.3515625,
0.062225341796875,
0.80126953125,
0.71044921875,
0.322265625,
0.18212890625,
-0.669921875,
-0.04296875,
-0.419189453125,
-0.388427734375,
-0.72900390625,
0.1832275390625,
-0.289794921875,
-0.66796875,
-0.685546875,
0.85498046875,
0.44384765625,
0.3369140625,
-0.2042236328125,
0.47509765625,
0.3037109375,
0.282958984375,
0.58349609375,
0.0970458984375,
0.64306640625,
-0.56689453125,
0.99267578125,
0.07568359375,
-0.75927734375,
-0.5068359375,
-0.350341796875,
-0.57568359375,
0.0277099609375,
0.127197265625,
0.0125885009765625,
-0.82470703125,
0.07861328125,
0.08563232421875,
0.1649169921875,
-0.41748046875,
-0.0263671875,
-0.053375244140625,
0.810546875,
0.263916015625,
-0.90185546875,
0.1446533203125,
-0.93994140625,
0.364990234375,
0.64404296875,
-0.344970703125,
-0.0291748046875,
-0.25439453125,
-0.69140625,
-0.62890625,
0.09417724609375,
0.64013671875,
-0.2098388671875,
0.1383056640625,
-1.1337890625,
0.5205078125,
0.615234375,
-0.30517578125,
0.2333984375,
-0.275390625,
0.456787109375,
0.08349609375,
0.42236328125,
-0.603515625,
-0.400146484375,
-0.022552490234375,
-1.2880859375,
0.070556640625,
-0.62060546875,
0.83056640625,
0.10601806640625,
0.1717529296875,
0.04461669921875,
0.38671875,
-0.147705078125,
0.322265625,
-0.02728271484375,
0.40966796875,
-1.0166015625,
-0.3017578125,
0.416748046875,
-0.21826171875,
-0.2349853515625,
0.6552734375,
-0.32275390625,
-0.4970703125,
0.10150146484375,
0.4140625,
-0.49609375,
0.58154296875,
-0.65966796875,
0.5400390625,
0.09130859375,
-0.6943359375,
-0.087646484375,
-0.33544921875,
0.56201171875,
0.1278076171875,
-0.46337890625,
-0.2054443359375,
-1.2431640625,
-0.52197265625,
0.08001708984375,
-0.5205078125,
0.41259765625,
-0.260009765625,
-0.58349609375,
-0.0284423828125,
-0.17041015625,
-0.453125,
-0.4365234375,
-0.53564453125,
-0.380615234375,
0.560546875,
0.59326171875,
0.7568359375,
0.263427734375,
-0.38916015625,
-0.310302734375,
-0.2266845703125,
0.2137451171875,
-0.494873046875,
-0.00379180908203125,
0.2056884765625,
-0.36279296875,
-0.308837890625,
0.23779296875,
-0.150390625,
0.367431640625,
0.431884765625,
-0.060394287109375,
0.5439453125,
0.294677734375,
-0.369140625,
1.31640625,
-0.1336669921875,
-1.447265625,
-0.34130859375,
0.3720703125,
-0.185546875,
0.6533203125,
0.335693359375,
-0.9912109375,
-0.9990234375,
-1.0029296875,
0.1912841796875,
-0.494873046875,
-0.642578125,
-0.693359375,
-0.58154296875,
-0.392822265625,
0.548828125,
-0.17919921875,
-0.47119140625,
0.0831298828125,
-1.0302734375,
-0.1678466796875,
-0.7578125,
-0.61572265625,
-0.8662109375,
-0.140869140625,
-0.31689453125,
0.85546875,
-0.30517578125,
0.2403564453125,
-0.0782470703125,
-0.132568359375,
-0.067138671875,
-0.2373046875,
-0.153076171875,
-0.243408203125,
-0.185791015625,
0.07342529296875,
-0.28369140625,
0.3720703125,
-0.31396484375,
0.505859375,
-0.88330078125,
-0.217041015625,
-0.030853271484375,
-0.55224609375,
-0.269287109375,
-0.5869140625,
1.453125,
-0.231201171875,
-0.1282958984375,
-0.3115234375,
0.77880859375,
0.46435546875,
-0.32275390625,
-0.8095703125,
-0.488525390625,
-0.48779296875,
-1.2861328125,
0.55419921875,
-1.00390625,
0.16796875,
-0.84716796875,
0.046661376953125,
0.8974609375,
-0.414306640625,
0.2010498046875,
1.271484375,
0.056671142578125,
0.544921875,
-0.5615234375,
0.84765625,
0.366943359375,
-0.6728515625,
-0.4306640625,
0.24658203125,
-1.0703125,
0.32666015625,
-0.21533203125,
-0.92041015625,
-0.472900390625,
0.38037109375,
1.412109375,
-0.326904296875,
0.65087890625,
0.00665283203125,
-0.99560546875,
-0.73828125,
0.751953125,
0.300537109375,
0.6484375,
0.72216796875,
-0.10101318359375,
-0.2080078125,
-0.0211334228515625,
-0.0582275390625,
-0.312255859375,
-0.56201171875,
1.220703125,
-0.219482421875,
-0.82763671875,
0.43994140625,
0.87158203125,
-1.017578125,
-0.472900390625,
-0.40673828125,
0.0267791748046875,
-0.1905517578125,
-0.7275390625,
0.25,
-0.1900634765625,
-0.91796875,
-0.18798828125,
0.2685546875,
0.07977294921875,
0.1978759765625,
0.18310546875,
0.021026611328125,
-0.37451171875,
-0.023468017578125,
0.81640625,
-0.646484375,
-0.08648681640625,
-0.78955078125,
0.147705078125,
-0.01511383056640625,
-0.054595947265625,
0.685546875,
-0.318603515625,
0.366943359375,
0.5537109375,
-0.0892333984375,
0.47705078125,
-0.68408203125,
-0.2276611328125,
0.340087890625,
-0.5009765625,
-0.58056640625,
-0.06939697265625,
0.5439453125,
0.09600830078125,
0.2301025390625,
-0.439208984375,
0.039337158203125,
0.2052001953125,
0.0035572052001953125,
-0.2470703125,
-0.89013671875,
-0.505859375,
-1.3427734375,
-0.5390625,
-0.35693359375,
-0.433837890625,
-0.033355712890625,
0.3525390625,
-0.313720703125,
-1.12109375,
0.1298828125,
0.72607421875,
-0.61962890625,
1.1435546875,
-0.77978515625,
0.359375,
-0.62109375,
-0.25830078125,
-0.73046875,
0.302978515625,
-0.1683349609375,
0.1055908203125,
-0.54541015625,
0.67578125,
0.08837890625,
0.51611328125,
-0.1436767578125,
0.4833984375,
-0.2666015625,
0.0217132568359375,
0.08306884765625,
-0.14208984375,
-0.2318115234375,
1.017578125,
0.43701171875,
-0.2254638671875,
0.42333984375,
-0.3955078125,
-0.64453125,
-0.2020263671875,
0.8310546875,
0.97265625,
-0.2174072265625,
-0.2362060546875,
-0.35009765625,
0.415771484375,
-0.94189453125,
0.2032470703125,
-0.34033203125,
0.395263671875,
0.07135009765625,
-0.33056640625,
0.329345703125,
1.4375,
-0.25634765625,
0.48486328125,
0.1605224609375,
0.2015380859375,
0.450927734375,
-0.034454345703125,
0.0132598876953125,
0.30224609375,
0.1895751953125,
-0.4072265625,
-0.1689453125,
0.466064453125,
0.21337890625,
0.163330078125,
-0.192626953125,
-0.68603515625,
-0.783203125,
0.07958984375,
-0.07989501953125,
0.468017578125,
0.6748046875,
-0.449462890625,
-0.220458984375,
-0.10382080078125,
-0.63818359375,
0.2166748046875,
-1.001953125,
-0.8662109375,
0.283203125,
-0.404541015625,
-0.469482421875,
-0.0953369140625,
-0.54296875,
-0.63037109375,
0.1298828125,
0.09088134765625,
-0.6796875,
-0.1856689453125,
-0.6064453125,
0.57421875,
-0.23974609375,
-0.3056640625,
0.0157623291015625,
0.39697265625,
-0.23291015625,
-0.412841796875,
0.234619140625,
0.50634765625,
-0.035125732421875,
-0.0411376953125,
-0.8662109375,
0.3154296875,
-0.1112060546875,
-0.044281005859375,
-0.73291015625,
-0.0888671875,
-0.05169677734375,
0.455810546875,
-1.291015625,
0.10296630859375,
-0.1705322265625,
0.040008544921875,
0.7177734375,
-0.52001953125,
-0.46923828125,
1.2314453125,
0.53271484375,
-0.1744384765625,
-0.2420654296875,
0.279052734375,
0.50927734375,
-0.1685791015625,
-0.373046875,
-0.096435546875,
0.6708984375,
0.4814453125,
0.53857421875,
0.1370849609375,
0.317626953125,
0.64892578125,
-0.0166473388671875,
-0.5439453125,
0.30419921875,
0.4580078125,
-0.12066650390625,
0.5732421875,
0.0946044921875,
-0.2763671875,
0.0966796875,
-0.73095703125,
0.168212890625,
-0.171875,
-0.29248046875,
-0.152587890625,
-0.17919921875,
0.6875,
-0.254638671875,
-0.2237548828125,
-0.0238800048828125,
-0.79443359375,
0.28515625,
0.4501953125,
-0.0246124267578125,
-0.35791015625,
1.07421875,
0.6708984375,
0.3037109375,
0.66748046875,
0.1767578125,
0.6083984375,
-0.59228515625,
0.272705078125,
-0.026092529296875,
-0.06463623046875,
0.156494140625,
-0.372314453125,
-1.0556640625,
0.374755859375,
-0.485107421875,
-0.429443359375,
0.54296875,
-0.76513671875,
0.2509765625,
-0.59814453125,
0.79833984375,
-0.5732421875,
0.56982421875,
0.2032470703125,
-0.206298828125,
-0.45849609375,
0.4580078125,
-0.17333984375,
0.673828125,
0.1895751953125,
0.74609375,
0.3408203125,
1.6552734375,
0.53271484375,
-0.1121826171875,
0.10870361328125,
0.0987548828125,
-0.425537109375,
-0.638671875,
-0.033935546875,
-0.18017578125,
0.045318603515625,
-0.5263671875,
-0.488525390625,
0.0231475830078125,
0.939453125,
-0.396484375,
-1.19140625,
-0.1436767578125,
0.49169921875,
-0.638671875,
0.9560546875,
0.583984375,
0.11541748046875,
0.26806640625,
-0.08599853515625,
-0.1815185546875,
-0.6591796875,
0.2099609375,
-0.3583984375,
0.61279296875,
-0.48974609375,
-0.59814453125,
-0.71044921875,
-0.38427734375,
-0.060943603515625,
-0.0604248046875,
-0.251220703125,
-0.473388671875,
0.228515625,
0.85400390625,
0.2958984375,
0.302490234375,
-0.48046875,
-0.04412841796875,
0.64013671875,
0.98583984375,
-0.0175933837890625,
0.8828125,
0.498291015625,
-0.206787109375,
0.1474609375,
-0.55810546875,
0.91064453125,
0.0248870849609375,
0.174072265625,
-0.176513671875,
0.5888671875,
-0.6474609375,
-1.4697265625,
0.110595703125,
0.607421875,
0.0217437744140625,
-0.5947265625,
-1.0048828125,
-0.459716796875,
-0.91259765625,
-0.3359375,
-0.7568359375,
0.58984375,
0.10638427734375,
0.007350921630859375,
0.02496337890625,
-1.1142578125,
4.33203125,
0.783203125,
0.85400390625,
0.490966796875,
0.3916015625,
1.3642578125,
0.5927734375,
-0.53125,
-0.2098388671875,
-0.81201171875,
0.69970703125,
-0.72119140625,
-0.1732177734375,
0.5732421875,
0.6689453125,
0.57861328125,
-0.404296875,
0.2158203125,
0.005947113037109375,
-0.86376953125,
-0.63427734375,
-0.323486328125,
0.1590576171875,
0.59130859375,
0.317138671875,
0.442626953125,
1.0078125,
-0.869140625,
-0.330078125,
-0.234375,
-0.130615234375,
-0.23486328125,
0.436767578125,
0.13134765625,
-0.580078125,
0.66796875,
0.160400390625,
-0.990234375,
-0.038116455078125,
0.1907958984375,
-0.7353515625,
-0.283935546875,
0.7763671875,
-0.5732421875,
0.1583251953125,
0.61669921875,
-0.564453125,
0.56103515625,
0.31787109375,
-0.71484375,
0.73193359375,
-0.62451171875,
0.6181640625,
-0.85693359375,
-0.410888671875,
0.24267578125,
0.041534423828125,
-0.150390625,
-0.468017578125,
0.270263671875,
0.544921875,
0.13916015625,
0.10333251953125,
0.70849609375,
-0.88916015625,
0.94970703125,
-0.077392578125,
0.377197265625,
-0.587890625,
-0.275146484375,
-0.47802734375,
-0.2283935546875,
-0.1239013671875,
-0.308837890625,
0.91845703125,
0.05169677734375,
-0.439697265625,
0.343017578125,
0.58251953125,
-0.69873046875,
-0.0687255859375,
-0.0150299072265625,
-0.65966796875,
-0.6884765625,
0.6162109375,
0.89794921875,
-0.2322998046875,
-0.432373046875,
-0.1444091796875,
0.837890625,
0.80908203125,
0.7431640625,
-0.03802490234375,
-0.5341796875,
-0.425048828125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Tags: implementation, strings
Correct Solution:
```
n = int(input())
s = {''.join(sorted(set(s))) for s in input().split()}
print(len(s))
```
| 66,990
|
[
0.4169921875,
0.08489990234375,
-0.1495361328125,
-0.224365234375,
-0.300537109375,
-0.48095703125,
0.138916015625,
0.0299835205078125,
0.359375,
0.58740234375,
1.0810546875,
-0.63232421875,
-0.09222412109375,
-0.92041015625,
-0.6240234375,
0.0908203125,
-0.60302734375,
-0.619140625,
-0.271728515625,
-0.381591796875,
0.368408203125,
0.0211944580078125,
-1.5859375,
-0.0178070068359375,
-0.39501953125,
1.34765625,
0.57470703125,
-0.04632568359375,
0.99853515625,
1.12890625,
-0.23779296875,
-0.33056640625,
0.9716796875,
-0.81494140625,
-0.3359375,
-0.410888671875,
0.80029296875,
-0.943359375,
0.1396484375,
-0.91064453125,
0.6474609375,
-0.10858154296875,
0.12548828125,
-0.68798828125,
-1.3271484375,
0.161865234375,
-0.2406005859375,
-0.53369140625,
0.052886962890625,
-0.990234375,
0.24853515625,
-0.5009765625,
0.379638671875,
-0.3134765625,
0.1314697265625,
-0.2276611328125,
-0.0284881591796875,
0.0125274658203125,
-0.431640625,
0.0919189453125,
0.390625,
0.38818359375,
-0.132080078125,
-0.8720703125,
-0.046478271484375,
0.303466796875,
0.127197265625,
-0.14208984375,
0.115234375,
-0.7021484375,
-0.5029296875,
0.4052734375,
-0.29248046875,
-0.71923828125,
-0.53173828125,
0.0250244140625,
-0.004329681396484375,
0.3759765625,
-0.72802734375,
0.257568359375,
0.2666015625,
0.81640625,
-0.031494140625,
0.051849365234375,
-0.291259765625,
-0.5185546875,
-0.12548828125,
0.658203125,
0.259521484375,
-0.189453125,
-0.335693359375,
0.443115234375,
-0.5263671875,
-0.0049591064453125,
0.8349609375,
0.57666015625,
-0.379638671875,
0.521484375,
0.431396484375,
-0.018310546875,
0.755859375,
1.1748046875,
-0.494140625,
0.86279296875,
-0.62109375,
-0.06414794921875,
0.210693359375,
0.062347412109375,
-0.176513671875,
-0.359130859375,
-0.0479736328125,
-0.404296875,
0.2464599609375,
0.223876953125,
-0.1353759765625,
0.92724609375,
-0.08245849609375,
0.0567626953125,
-0.7236328125,
-0.0267333984375,
0.312744140625,
-0.00551605224609375,
0.1988525390625,
-0.1466064453125,
0.045989990234375,
-0.193603515625,
-0.689453125,
1.166015625,
-0.2398681640625,
-0.1904296875,
0.2607421875,
0.1434326171875,
-0.451416015625,
0.5107421875,
-0.361083984375,
0.572265625,
0.1893310546875,
0.623046875,
0.712890625,
-0.599609375,
0.8388671875,
-0.458740234375,
0.0189056396484375,
1.486328125,
0.5498046875,
0.2186279296875,
0.986328125,
0.2156982421875,
-0.72998046875,
0.5341796875,
-0.64697265625,
0.1968994140625,
0.05584716796875,
0.396240234375,
-0.54150390625,
0.2958984375,
0.3798828125,
0.52001953125,
0.196533203125,
0.2464599609375,
-0.417236328125,
0.201171875,
-0.37158203125,
0.82470703125,
-0.01552581787109375,
1.068359375,
-0.482177734375,
-0.56640625,
-0.1455078125,
-0.60400390625,
0.62646484375,
-0.18798828125,
-0.056121826171875,
0.943359375,
0.48681640625,
0.6767578125,
0.65283203125,
0.1849365234375,
0.26806640625,
0.0404052734375,
0.0250244140625,
-0.10821533203125,
0.190185546875,
0.7177734375,
0.380126953125,
0.1068115234375,
-0.2401123046875,
-0.357666015625,
-0.513671875,
-0.397216796875,
0.09808349609375,
0.93701171875,
-0.7333984375,
0.492919921875,
0.2132568359375,
-0.11053466796875,
-0.79443359375,
-0.3642578125,
0.0013484954833984375,
-0.8017578125,
-0.1607666015625,
0.7119140625,
-0.049835205078125,
0.44091796875,
-0.04388427734375,
-0.43505859375,
0.292236328125,
1.3837890625,
-0.290771484375,
0.1640625,
0.44482421875,
-0.2080078125,
-0.10980224609375,
0.270263671875,
0.030120849609375,
-0.1165771484375,
-0.83447265625,
1.134765625,
-0.41748046875,
-0.047210693359375,
0.36474609375,
0.748046875,
0.32080078125,
0.47021484375,
-0.304931640625,
-0.4892578125,
0.44580078125,
0.80419921875,
0.260009765625,
0.6201171875,
0.347412109375,
0.8974609375,
0.270263671875,
0.61181640625,
0.370849609375,
0.361328125,
0.57666015625,
0.43896484375,
0.0129241943359375,
0.351806640625,
0.2152099609375,
0.171142578125,
0.583984375,
0.423583984375,
-0.11053466796875,
0.434814453125,
-0.21240234375,
0.18896484375,
-0.005313873291015625,
0.82861328125,
-0.222412109375,
0.77978515625,
0.2493896484375,
0.343017578125,
-1.0654296875,
-0.71337890625,
0.41796875,
0.814453125,
-0.9599609375,
-1.1728515625,
-0.2103271484375,
0.02410888671875,
0.1533203125,
0.13818359375,
0.400390625,
0.73974609375,
0.2078857421875,
0.599609375,
-0.56201171875,
-0.344482421875,
-1.046875,
-0.59619140625,
-1.15625,
-0.362060546875,
-0.53857421875,
-0.01512908935546875,
0.55224609375,
-0.99072265625,
0.397705078125,
-0.039764404296875,
-0.320068359375,
0.2354736328125,
-0.56982421875,
0.474365234375,
-0.36865234375,
0.8681640625,
-0.38427734375,
0.5439453125,
-0.059783935546875,
0.87255859375,
-0.72607421875,
-0.6875,
-0.471435546875,
-0.58642578125,
0.142578125,
0.146484375,
0.5009765625,
-0.420654296875,
-0.3291015625,
-0.72900390625,
-0.1727294921875,
-0.10552978515625,
-0.4541015625,
0.392822265625,
-0.669921875,
0.92236328125,
0.90380859375,
-0.78857421875,
0.73583984375,
1.00390625,
-0.826171875,
0.410400390625,
0.188232421875,
0.19140625,
-0.86328125,
1.583984375,
0.71630859375,
0.748046875,
-0.2161865234375,
-0.470947265625,
-0.417236328125,
0.400634765625,
-0.1390380859375,
-0.425048828125,
-0.2939453125,
0.73193359375,
0.1962890625,
-1.3671875,
0.490234375,
-0.8046875,
-0.55224609375,
-0.5126953125,
-0.402099609375,
0.82568359375,
0.7216796875,
0.1639404296875,
-0.57373046875,
-0.393310546875,
0.164306640625,
0.88232421875,
0.57958984375,
-0.454833984375,
0.34814453125,
0.60400390625,
0.436767578125,
0.160888671875,
0.09588623046875,
-0.36376953125,
-0.058624267578125,
-0.0165557861328125,
0.0927734375,
0.64501953125,
-0.15478515625,
0.295654296875,
0.54833984375,
0.43017578125,
-0.72216796875,
-0.2218017578125,
-0.494873046875,
0.642578125,
0.44140625,
0.411865234375,
0.326904296875,
-0.6474609375,
-0.273193359375,
-1.009765625,
0.64697265625,
0.0814208984375,
0.6572265625,
-0.99560546875,
0.6875,
0.2012939453125,
-0.55615234375,
0.438720703125,
-0.51025390625,
-0.276611328125,
0.87841796875,
-0.442626953125,
1.029296875,
-0.81201171875,
0.2447509765625,
0.350341796875,
0.025543212890625,
0.81591796875,
0.7099609375,
0.328857421875,
0.174560546875,
-0.669921875,
-0.06915283203125,
-0.410888671875,
-0.37158203125,
-0.74072265625,
0.175537109375,
-0.2958984375,
-0.63330078125,
-0.6943359375,
0.84716796875,
0.452392578125,
0.321044921875,
-0.1966552734375,
0.458984375,
0.310791015625,
0.30126953125,
0.58984375,
0.08251953125,
0.66943359375,
-0.58642578125,
0.96630859375,
0.06414794921875,
-0.75537109375,
-0.5283203125,
-0.33740234375,
-0.58642578125,
0.011627197265625,
0.10498046875,
-0.03375244140625,
-0.8232421875,
0.09521484375,
0.11859130859375,
0.18701171875,
-0.43359375,
-0.02862548828125,
-0.05792236328125,
0.81787109375,
0.26220703125,
-0.89306640625,
0.1685791015625,
-0.94140625,
0.421630859375,
0.70654296875,
-0.322998046875,
-0.03900146484375,
-0.2388916015625,
-0.69970703125,
-0.63037109375,
0.09149169921875,
0.66162109375,
-0.17431640625,
0.1328125,
-1.1640625,
0.54150390625,
0.62890625,
-0.3017578125,
0.1934814453125,
-0.268798828125,
0.453125,
0.08221435546875,
0.435791015625,
-0.6328125,
-0.4091796875,
-0.015472412109375,
-1.2890625,
0.044342041015625,
-0.626953125,
0.833984375,
0.1278076171875,
0.1619873046875,
0.02978515625,
0.38427734375,
-0.1705322265625,
0.305419921875,
-0.01160430908203125,
0.408935546875,
-0.98681640625,
-0.289794921875,
0.439208984375,
-0.2227783203125,
-0.28955078125,
0.68505859375,
-0.346923828125,
-0.4677734375,
0.1146240234375,
0.397705078125,
-0.496337890625,
0.59375,
-0.6689453125,
0.52001953125,
0.08319091796875,
-0.69189453125,
-0.1217041015625,
-0.324951171875,
0.56982421875,
0.1326904296875,
-0.435791015625,
-0.181640625,
-1.2412109375,
-0.5361328125,
0.082763671875,
-0.5205078125,
0.40283203125,
-0.259765625,
-0.56005859375,
-0.0146331787109375,
-0.194580078125,
-0.485595703125,
-0.431396484375,
-0.5419921875,
-0.406494140625,
0.58935546875,
0.609375,
0.74267578125,
0.242431640625,
-0.41357421875,
-0.293701171875,
-0.1971435546875,
0.1964111328125,
-0.52001953125,
0.00922393798828125,
0.1424560546875,
-0.35986328125,
-0.292724609375,
0.257568359375,
-0.11224365234375,
0.340576171875,
0.4384765625,
-0.0657958984375,
0.556640625,
0.259033203125,
-0.398193359375,
1.322265625,
-0.1363525390625,
-1.443359375,
-0.33203125,
0.3740234375,
-0.176513671875,
0.6630859375,
0.313720703125,
-1,
-1.0185546875,
-1.013671875,
0.19580078125,
-0.492919921875,
-0.62451171875,
-0.66748046875,
-0.564453125,
-0.4013671875,
0.5595703125,
-0.2139892578125,
-0.498046875,
0.0867919921875,
-1.0322265625,
-0.1640625,
-0.76513671875,
-0.60888671875,
-0.8984375,
-0.17138671875,
-0.351318359375,
0.83447265625,
-0.291259765625,
0.2666015625,
-0.0657958984375,
-0.144775390625,
-0.062164306640625,
-0.239501953125,
-0.154296875,
-0.240966796875,
-0.184814453125,
0.07366943359375,
-0.307861328125,
0.37353515625,
-0.342041015625,
0.49560546875,
-0.91552734375,
-0.2181396484375,
-0.03851318359375,
-0.5498046875,
-0.260986328125,
-0.60791015625,
1.462890625,
-0.243896484375,
-0.11346435546875,
-0.329833984375,
0.75439453125,
0.478271484375,
-0.295654296875,
-0.833984375,
-0.52197265625,
-0.48095703125,
-1.287109375,
0.56298828125,
-1.009765625,
0.175048828125,
-0.84326171875,
0.041717529296875,
0.9091796875,
-0.4306640625,
0.20068359375,
1.294921875,
0.0672607421875,
0.53076171875,
-0.58203125,
0.84716796875,
0.360595703125,
-0.6669921875,
-0.438720703125,
0.258056640625,
-1.0556640625,
0.302734375,
-0.250732421875,
-0.90673828125,
-0.480224609375,
0.390625,
1.412109375,
-0.295654296875,
0.6328125,
0.0089874267578125,
-0.96875,
-0.73828125,
0.77734375,
0.318359375,
0.65625,
0.716796875,
-0.067626953125,
-0.2060546875,
-0.023956298828125,
-0.03863525390625,
-0.343994140625,
-0.5546875,
1.25,
-0.1951904296875,
-0.83544921875,
0.411376953125,
0.89697265625,
-1.041015625,
-0.473876953125,
-0.37841796875,
0.0106201171875,
-0.2159423828125,
-0.732421875,
0.2423095703125,
-0.171630859375,
-0.89697265625,
-0.2032470703125,
0.298828125,
0.08160400390625,
0.22314453125,
0.2103271484375,
0.049346923828125,
-0.386474609375,
-0.0009050369262695312,
0.81884765625,
-0.67333984375,
-0.08343505859375,
-0.79833984375,
0.1279296875,
-0.0033740997314453125,
-0.060760498046875,
0.67724609375,
-0.346435546875,
0.344482421875,
0.568359375,
-0.0858154296875,
0.489990234375,
-0.666015625,
-0.2266845703125,
0.38525390625,
-0.498291015625,
-0.57763671875,
-0.0748291015625,
0.54052734375,
0.07965087890625,
0.24169921875,
-0.404541015625,
0.028411865234375,
0.21240234375,
0.00400543212890625,
-0.280029296875,
-0.89453125,
-0.537109375,
-1.337890625,
-0.52001953125,
-0.398681640625,
-0.40478515625,
-0.033447265625,
0.3515625,
-0.302490234375,
-1.1318359375,
0.1268310546875,
0.72607421875,
-0.6171875,
1.162109375,
-0.76708984375,
0.385986328125,
-0.654296875,
-0.2427978515625,
-0.732421875,
0.305419921875,
-0.1805419921875,
0.08843994140625,
-0.54052734375,
0.67822265625,
0.10687255859375,
0.5478515625,
-0.146484375,
0.537109375,
-0.30322265625,
0.03955078125,
0.095703125,
-0.1331787109375,
-0.215087890625,
1.0224609375,
0.468017578125,
-0.2247314453125,
0.427490234375,
-0.397705078125,
-0.64892578125,
-0.2489013671875,
0.83203125,
0.9658203125,
-0.224609375,
-0.260009765625,
-0.35546875,
0.4326171875,
-0.93896484375,
0.2003173828125,
-0.35205078125,
0.39697265625,
0.1160888671875,
-0.343505859375,
0.33984375,
1.4521484375,
-0.264892578125,
0.509765625,
0.14453125,
0.2196044921875,
0.46142578125,
-0.0311737060546875,
0.0179290771484375,
0.304931640625,
0.161376953125,
-0.39794921875,
-0.1783447265625,
0.477294921875,
0.21875,
0.1451416015625,
-0.181884765625,
-0.6826171875,
-0.791015625,
0.10137939453125,
-0.0706787109375,
0.451416015625,
0.66162109375,
-0.437744140625,
-0.193359375,
-0.103515625,
-0.611328125,
0.204833984375,
-0.9814453125,
-0.869140625,
0.30029296875,
-0.375,
-0.489501953125,
-0.11871337890625,
-0.5556640625,
-0.65673828125,
0.102783203125,
0.08056640625,
-0.67333984375,
-0.152099609375,
-0.6435546875,
0.5771484375,
-0.27392578125,
-0.279541015625,
-0.0154876708984375,
0.39794921875,
-0.243408203125,
-0.42236328125,
0.252197265625,
0.53125,
-0.0282745361328125,
-0.02294921875,
-0.87744140625,
0.33837890625,
-0.1158447265625,
-0.043701171875,
-0.71826171875,
-0.09686279296875,
-0.050872802734375,
0.46728515625,
-1.251953125,
0.114501953125,
-0.171875,
0.033843994140625,
0.75732421875,
-0.5400390625,
-0.471923828125,
1.2294921875,
0.5390625,
-0.1715087890625,
-0.20703125,
0.30419921875,
0.5224609375,
-0.176025390625,
-0.347412109375,
-0.08001708984375,
0.70166015625,
0.46826171875,
0.53759765625,
0.1324462890625,
0.34521484375,
0.63037109375,
-0.0419921875,
-0.525390625,
0.286865234375,
0.443603515625,
-0.12445068359375,
0.54345703125,
0.081298828125,
-0.253662109375,
0.0794677734375,
-0.75927734375,
0.18115234375,
-0.1610107421875,
-0.294677734375,
-0.1605224609375,
-0.174560546875,
0.677734375,
-0.2354736328125,
-0.2095947265625,
-0.025390625,
-0.77587890625,
0.2734375,
0.4482421875,
-0.0254669189453125,
-0.333740234375,
1.083984375,
0.6806640625,
0.3125,
0.6611328125,
0.2008056640625,
0.626953125,
-0.5810546875,
0.28955078125,
-0.024810791015625,
-0.08203125,
0.11993408203125,
-0.371826171875,
-1.044921875,
0.417724609375,
-0.495849609375,
-0.42041015625,
0.56884765625,
-0.77783203125,
0.25927734375,
-0.62109375,
0.7978515625,
-0.576171875,
0.5673828125,
0.22119140625,
-0.17529296875,
-0.48681640625,
0.447998046875,
-0.189453125,
0.708984375,
0.1888427734375,
0.7666015625,
0.3583984375,
1.6533203125,
0.58154296875,
-0.06500244140625,
0.12493896484375,
0.109619140625,
-0.43994140625,
-0.63525390625,
-0.017425537109375,
-0.1837158203125,
0.051361083984375,
-0.53271484375,
-0.52001953125,
0.03228759765625,
0.98095703125,
-0.390869140625,
-1.1826171875,
-0.1201171875,
0.486328125,
-0.662109375,
0.9345703125,
0.5966796875,
0.0892333984375,
0.2364501953125,
-0.0689697265625,
-0.186767578125,
-0.646484375,
0.18994140625,
-0.330078125,
0.591796875,
-0.494873046875,
-0.580078125,
-0.71484375,
-0.402099609375,
-0.054534912109375,
-0.050018310546875,
-0.222900390625,
-0.481689453125,
0.2349853515625,
0.83154296875,
0.287109375,
0.2744140625,
-0.471435546875,
-0.04718017578125,
0.666015625,
0.9697265625,
-0.01251220703125,
0.89111328125,
0.5068359375,
-0.2227783203125,
0.1739501953125,
-0.5458984375,
0.92626953125,
-0.00502777099609375,
0.173583984375,
-0.1947021484375,
0.5888671875,
-0.6650390625,
-1.494140625,
0.10772705078125,
0.6279296875,
0.06951904296875,
-0.61474609375,
-1.0263671875,
-0.452392578125,
-0.931640625,
-0.33154296875,
-0.76123046875,
0.62255859375,
0.109130859375,
-0.01332855224609375,
0.0158843994140625,
-1.125,
4.30078125,
0.79931640625,
0.8837890625,
0.5302734375,
0.38427734375,
1.3662109375,
0.626953125,
-0.521484375,
-0.24072265625,
-0.8046875,
0.73486328125,
-0.71044921875,
-0.1883544921875,
0.57666015625,
0.703125,
0.56787109375,
-0.366455078125,
0.2064208984375,
0.0038013458251953125,
-0.86572265625,
-0.62646484375,
-0.34228515625,
0.15673828125,
0.591796875,
0.321044921875,
0.449462890625,
1.0166015625,
-0.8798828125,
-0.3388671875,
-0.2191162109375,
-0.133056640625,
-0.254638671875,
0.457275390625,
0.140625,
-0.60498046875,
0.64990234375,
0.1693115234375,
-0.95849609375,
-0.031585693359375,
0.1832275390625,
-0.7490234375,
-0.252197265625,
0.81005859375,
-0.57080078125,
0.11505126953125,
0.615234375,
-0.576171875,
0.5771484375,
0.34619140625,
-0.75341796875,
0.72216796875,
-0.61279296875,
0.66796875,
-0.88037109375,
-0.451416015625,
0.228515625,
0.039215087890625,
-0.14208984375,
-0.49560546875,
0.253662109375,
0.53466796875,
0.1318359375,
0.113037109375,
0.68212890625,
-0.8935546875,
0.97705078125,
-0.0845947265625,
0.359619140625,
-0.5888671875,
-0.2841796875,
-0.48193359375,
-0.2078857421875,
-0.125244140625,
-0.297119140625,
0.931640625,
0.03045654296875,
-0.44189453125,
0.375732421875,
0.5537109375,
-0.70849609375,
-0.0992431640625,
-0.015625,
-0.64990234375,
-0.71337890625,
0.58935546875,
0.931640625,
-0.23876953125,
-0.43798828125,
-0.129638671875,
0.85693359375,
0.81689453125,
0.7587890625,
-0.042388916015625,
-0.54541015625,
-0.440185546875
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Tags: implementation, strings
Correct Solution:
```
n = input()
s = input().split()
a = set()
list = []
for i in s:
if set(i) not in list:
list.append(set(i))
print(len(list))
```
| 66,991
|
[
0.399169921875,
0.10382080078125,
-0.1455078125,
-0.21435546875,
-0.279052734375,
-0.50048828125,
0.1259765625,
0.02130126953125,
0.40576171875,
0.5771484375,
1.0654296875,
-0.62255859375,
-0.039459228515625,
-0.91552734375,
-0.6279296875,
0.09698486328125,
-0.63037109375,
-0.6357421875,
-0.28955078125,
-0.37890625,
0.37646484375,
0.0137786865234375,
-1.5712890625,
-0.041748046875,
-0.417724609375,
1.2919921875,
0.548828125,
-0.028106689453125,
0.98046875,
1.125,
-0.2081298828125,
-0.368896484375,
0.970703125,
-0.80224609375,
-0.298828125,
-0.44384765625,
0.80712890625,
-0.9345703125,
0.082763671875,
-0.9091796875,
0.6298828125,
-0.10357666015625,
0.11932373046875,
-0.69970703125,
-1.296875,
0.1663818359375,
-0.2108154296875,
-0.5078125,
0.05926513671875,
-1.0205078125,
0.261474609375,
-0.435546875,
0.3896484375,
-0.30810546875,
0.07861328125,
-0.208740234375,
-0.051666259765625,
0.004878997802734375,
-0.452880859375,
0.0726318359375,
0.397216796875,
0.400390625,
-0.11328125,
-0.849609375,
-0.03155517578125,
0.311767578125,
0.1573486328125,
-0.11798095703125,
0.11737060546875,
-0.65283203125,
-0.492431640625,
0.389404296875,
-0.2646484375,
-0.7275390625,
-0.5322265625,
0.07806396484375,
-0.0176544189453125,
0.36279296875,
-0.68505859375,
0.242431640625,
0.26171875,
0.84130859375,
-0.07611083984375,
0.047454833984375,
-0.29150390625,
-0.50732421875,
-0.1031494140625,
0.6611328125,
0.2298583984375,
-0.177734375,
-0.3876953125,
0.41845703125,
-0.5439453125,
0.0107421875,
0.80322265625,
0.5654296875,
-0.376708984375,
0.53564453125,
0.42041015625,
-0.007335662841796875,
0.7294921875,
1.1728515625,
-0.51611328125,
0.83935546875,
-0.58203125,
-0.06646728515625,
0.243896484375,
0.0302734375,
-0.185791015625,
-0.371337890625,
-0.07244873046875,
-0.391357421875,
0.24169921875,
0.232421875,
-0.115966796875,
0.91064453125,
-0.048309326171875,
0.08251953125,
-0.74609375,
-0.0234527587890625,
0.29541015625,
0.016387939453125,
0.2110595703125,
-0.1629638671875,
0.04376220703125,
-0.1759033203125,
-0.6630859375,
1.166015625,
-0.237548828125,
-0.19482421875,
0.2607421875,
0.136962890625,
-0.400390625,
0.5341796875,
-0.3564453125,
0.57421875,
0.1473388671875,
0.62646484375,
0.75439453125,
-0.60791015625,
0.86328125,
-0.470947265625,
-0.0181884765625,
1.486328125,
0.5625,
0.2249755859375,
1.0185546875,
0.2354736328125,
-0.72265625,
0.52685546875,
-0.6494140625,
0.2098388671875,
0.0751953125,
0.41259765625,
-0.498779296875,
0.295166015625,
0.36083984375,
0.499267578125,
0.2066650390625,
0.2476806640625,
-0.421875,
0.2000732421875,
-0.37841796875,
0.85595703125,
0.0020580291748046875,
1.0576171875,
-0.489013671875,
-0.5732421875,
-0.1815185546875,
-0.611328125,
0.60107421875,
-0.2244873046875,
-0.0189056396484375,
0.9375,
0.467529296875,
0.68505859375,
0.69140625,
0.2056884765625,
0.277099609375,
0.021331787109375,
0.00666046142578125,
-0.10247802734375,
0.2293701171875,
0.6923828125,
0.40673828125,
0.12188720703125,
-0.206787109375,
-0.372314453125,
-0.5009765625,
-0.423828125,
0.0941162109375,
0.89794921875,
-0.73681640625,
0.52197265625,
0.213134765625,
-0.12646484375,
-0.79931640625,
-0.364501953125,
-0.0023193359375,
-0.80908203125,
-0.1429443359375,
0.69287109375,
-0.10504150390625,
0.396728515625,
-0.017547607421875,
-0.468994140625,
0.314208984375,
1.3896484375,
-0.303466796875,
0.1455078125,
0.4052734375,
-0.1563720703125,
-0.128662109375,
0.228515625,
0.0202484130859375,
-0.09881591796875,
-0.81640625,
1.1181640625,
-0.41357421875,
-0.0587158203125,
0.3408203125,
0.71240234375,
0.329833984375,
0.488525390625,
-0.320068359375,
-0.495849609375,
0.38623046875,
0.822265625,
0.289794921875,
0.634765625,
0.315673828125,
0.91748046875,
0.2578125,
0.6474609375,
0.396240234375,
0.38330078125,
0.53271484375,
0.416748046875,
0.055938720703125,
0.367431640625,
0.2232666015625,
0.1607666015625,
0.580078125,
0.44482421875,
-0.1268310546875,
0.43701171875,
-0.1676025390625,
0.1822509765625,
-0.0465087890625,
0.8212890625,
-0.25244140625,
0.76953125,
0.2293701171875,
0.35205078125,
-1.052734375,
-0.712890625,
0.415283203125,
0.84375,
-0.96826171875,
-1.130859375,
-0.240966796875,
0.043243408203125,
0.11376953125,
0.1453857421875,
0.424560546875,
0.765625,
0.218994140625,
0.60888671875,
-0.53955078125,
-0.34619140625,
-1.0185546875,
-0.59765625,
-1.15625,
-0.34765625,
-0.52734375,
-0.05535888671875,
0.544921875,
-1.0224609375,
0.37646484375,
-0.06317138671875,
-0.317138671875,
0.2301025390625,
-0.5712890625,
0.489501953125,
-0.346435546875,
0.853515625,
-0.36767578125,
0.50732421875,
-0.00945281982421875,
0.89404296875,
-0.75927734375,
-0.68310546875,
-0.443115234375,
-0.587890625,
0.1422119140625,
0.1522216796875,
0.491455078125,
-0.425048828125,
-0.3505859375,
-0.71240234375,
-0.1834716796875,
-0.042236328125,
-0.409423828125,
0.4130859375,
-0.625,
0.92041015625,
0.88623046875,
-0.7900390625,
0.72607421875,
1.025390625,
-0.8427734375,
0.41064453125,
0.1868896484375,
0.124267578125,
-0.85107421875,
1.556640625,
0.73779296875,
0.7275390625,
-0.2379150390625,
-0.45263671875,
-0.4521484375,
0.33740234375,
-0.10357666015625,
-0.39599609375,
-0.306640625,
0.72900390625,
0.178466796875,
-1.3916015625,
0.48291015625,
-0.7802734375,
-0.54345703125,
-0.53564453125,
-0.397705078125,
0.806640625,
0.71923828125,
0.189697265625,
-0.53466796875,
-0.380615234375,
0.16943359375,
0.88916015625,
0.5810546875,
-0.461669921875,
0.36669921875,
0.59423828125,
0.456298828125,
0.15673828125,
0.0897216796875,
-0.390869140625,
-0.05126953125,
-0.05072021484375,
0.06707763671875,
0.6240234375,
-0.137939453125,
0.332275390625,
0.55517578125,
0.45361328125,
-0.70947265625,
-0.1883544921875,
-0.439453125,
0.66455078125,
0.453857421875,
0.4453125,
0.33203125,
-0.66357421875,
-0.2822265625,
-1.0419921875,
0.650390625,
0.09735107421875,
0.64990234375,
-1.037109375,
0.669921875,
0.1942138671875,
-0.55029296875,
0.441650390625,
-0.50732421875,
-0.26220703125,
0.86962890625,
-0.44580078125,
1.0498046875,
-0.80322265625,
0.23876953125,
0.33935546875,
0.031829833984375,
0.779296875,
0.70849609375,
0.31298828125,
0.1954345703125,
-0.6484375,
-0.0784912109375,
-0.4423828125,
-0.381103515625,
-0.75732421875,
0.180419921875,
-0.281005859375,
-0.6669921875,
-0.65673828125,
0.79443359375,
0.467041015625,
0.3291015625,
-0.2039794921875,
0.488037109375,
0.299072265625,
0.32421875,
0.5625,
0.10272216796875,
0.63623046875,
-0.57568359375,
0.958984375,
0.053253173828125,
-0.76416015625,
-0.53271484375,
-0.335205078125,
-0.60888671875,
0.0209808349609375,
0.12359619140625,
-0.035003662109375,
-0.84521484375,
0.0997314453125,
0.09808349609375,
0.1748046875,
-0.401611328125,
-0.046112060546875,
-0.03875732421875,
0.7939453125,
0.250732421875,
-0.90966796875,
0.1392822265625,
-0.91162109375,
0.391845703125,
0.69140625,
-0.3681640625,
-0.0712890625,
-0.2442626953125,
-0.68798828125,
-0.65576171875,
0.076171875,
0.66259765625,
-0.1954345703125,
0.112548828125,
-1.16015625,
0.51611328125,
0.60498046875,
-0.3046875,
0.2166748046875,
-0.279541015625,
0.482421875,
0.10333251953125,
0.447509765625,
-0.62255859375,
-0.44384765625,
-0.03814697265625,
-1.2822265625,
0.0738525390625,
-0.61572265625,
0.8203125,
0.0843505859375,
0.1417236328125,
0.01300048828125,
0.3984375,
-0.17333984375,
0.31298828125,
-0.05914306640625,
0.4296875,
-1.0107421875,
-0.294921875,
0.424560546875,
-0.2379150390625,
-0.299560546875,
0.68505859375,
-0.34765625,
-0.49658203125,
0.1533203125,
0.410888671875,
-0.475830078125,
0.541015625,
-0.65087890625,
0.509765625,
0.08056640625,
-0.73974609375,
-0.11285400390625,
-0.38525390625,
0.55029296875,
0.1427001953125,
-0.460693359375,
-0.2047119140625,
-1.2275390625,
-0.517578125,
0.09674072265625,
-0.51025390625,
0.453369140625,
-0.24951171875,
-0.5283203125,
-0.0252685546875,
-0.1866455078125,
-0.476318359375,
-0.44384765625,
-0.5380859375,
-0.402099609375,
0.587890625,
0.603515625,
0.74755859375,
0.2181396484375,
-0.43115234375,
-0.29345703125,
-0.2210693359375,
0.1937255859375,
-0.5263671875,
0.0194549560546875,
0.2015380859375,
-0.356689453125,
-0.27392578125,
0.22412109375,
-0.1700439453125,
0.355712890625,
0.44140625,
-0.0826416015625,
0.525390625,
0.30029296875,
-0.385986328125,
1.30078125,
-0.131591796875,
-1.4169921875,
-0.304443359375,
0.3564453125,
-0.1884765625,
0.662109375,
0.37890625,
-0.9296875,
-0.96630859375,
-1.021484375,
0.1676025390625,
-0.466796875,
-0.642578125,
-0.70556640625,
-0.59375,
-0.424560546875,
0.56982421875,
-0.1959228515625,
-0.5166015625,
0.09796142578125,
-1.037109375,
-0.14599609375,
-0.7919921875,
-0.59765625,
-0.921875,
-0.1949462890625,
-0.32861328125,
0.82275390625,
-0.271728515625,
0.277587890625,
-0.0977783203125,
-0.1412353515625,
-0.07806396484375,
-0.223388671875,
-0.1500244140625,
-0.233642578125,
-0.190673828125,
0.08697509765625,
-0.301513671875,
0.391845703125,
-0.338134765625,
0.486572265625,
-0.923828125,
-0.223876953125,
-0.07867431640625,
-0.5166015625,
-0.27734375,
-0.625,
1.466796875,
-0.2259521484375,
-0.086181640625,
-0.361328125,
0.78564453125,
0.47119140625,
-0.312744140625,
-0.81591796875,
-0.486328125,
-0.477783203125,
-1.314453125,
0.57177734375,
-1.0205078125,
0.1517333984375,
-0.82568359375,
0.0396728515625,
0.921875,
-0.418701171875,
0.2012939453125,
1.291015625,
0.044036865234375,
0.5166015625,
-0.56396484375,
0.83203125,
0.363525390625,
-0.6689453125,
-0.425048828125,
0.275146484375,
-1.068359375,
0.333984375,
-0.2413330078125,
-0.92529296875,
-0.489013671875,
0.343017578125,
1.40625,
-0.328125,
0.662109375,
0.0005593299865722656,
-0.9873046875,
-0.716796875,
0.7919921875,
0.3359375,
0.67822265625,
0.7373046875,
-0.039764404296875,
-0.1866455078125,
-0.03668212890625,
-0.0144195556640625,
-0.2998046875,
-0.52197265625,
1.2080078125,
-0.167724609375,
-0.8134765625,
0.449462890625,
0.8837890625,
-1.0439453125,
-0.492431640625,
-0.373779296875,
0.0191497802734375,
-0.19482421875,
-0.75146484375,
0.21435546875,
-0.194091796875,
-0.912109375,
-0.1998291015625,
0.31982421875,
0.048248291015625,
0.1905517578125,
0.1949462890625,
0.044158935546875,
-0.404296875,
-0.0241546630859375,
0.7783203125,
-0.650390625,
-0.13330078125,
-0.82568359375,
0.1197509765625,
-0.0201873779296875,
-0.0831298828125,
0.70751953125,
-0.345458984375,
0.371337890625,
0.5849609375,
-0.06854248046875,
0.48193359375,
-0.669921875,
-0.2471923828125,
0.37646484375,
-0.5341796875,
-0.5791015625,
-0.07830810546875,
0.5654296875,
0.11944580078125,
0.2332763671875,
-0.417236328125,
0.0287628173828125,
0.220947265625,
0.0021114349365234375,
-0.262451171875,
-0.95458984375,
-0.495361328125,
-1.3154296875,
-0.53515625,
-0.3681640625,
-0.36376953125,
-0.057037353515625,
0.338134765625,
-0.302978515625,
-1.09375,
0.0970458984375,
0.75146484375,
-0.6396484375,
1.146484375,
-0.78173828125,
0.36279296875,
-0.6376953125,
-0.2802734375,
-0.71923828125,
0.315673828125,
-0.1661376953125,
0.10357666015625,
-0.53466796875,
0.6826171875,
0.07232666015625,
0.58447265625,
-0.1337890625,
0.51953125,
-0.266845703125,
0.004207611083984375,
0.0712890625,
-0.10992431640625,
-0.2301025390625,
1.0234375,
0.47314453125,
-0.2861328125,
0.42919921875,
-0.390869140625,
-0.638671875,
-0.260009765625,
0.83251953125,
0.97119140625,
-0.2491455078125,
-0.24560546875,
-0.343017578125,
0.395751953125,
-0.9462890625,
0.1678466796875,
-0.3408203125,
0.416748046875,
0.07586669921875,
-0.30322265625,
0.325439453125,
1.4296875,
-0.249267578125,
0.50439453125,
0.1468505859375,
0.2178955078125,
0.460205078125,
-0.04681396484375,
0.0521240234375,
0.302490234375,
0.147705078125,
-0.39892578125,
-0.1820068359375,
0.478759765625,
0.212646484375,
0.14208984375,
-0.19873046875,
-0.6513671875,
-0.74658203125,
0.08917236328125,
-0.09161376953125,
0.452880859375,
0.67578125,
-0.445556640625,
-0.1915283203125,
-0.126953125,
-0.6162109375,
0.190185546875,
-0.97021484375,
-0.8662109375,
0.286376953125,
-0.376220703125,
-0.49755859375,
-0.151123046875,
-0.53271484375,
-0.6767578125,
0.145751953125,
0.0777587890625,
-0.70166015625,
-0.159423828125,
-0.63525390625,
0.58984375,
-0.2724609375,
-0.273193359375,
-0.004241943359375,
0.36474609375,
-0.2470703125,
-0.403564453125,
0.2388916015625,
0.51708984375,
-0.025604248046875,
-0.0199127197265625,
-0.9052734375,
0.3310546875,
-0.09368896484375,
-0.056976318359375,
-0.71923828125,
-0.06890869140625,
-0.08251953125,
0.4453125,
-1.2138671875,
0.09130859375,
-0.176513671875,
0.063720703125,
0.71728515625,
-0.5341796875,
-0.439697265625,
1.171875,
0.52099609375,
-0.1834716796875,
-0.19482421875,
0.28515625,
0.54541015625,
-0.1761474609375,
-0.367431640625,
-0.070068359375,
0.72607421875,
0.45166015625,
0.5712890625,
0.1552734375,
0.335205078125,
0.642578125,
-0.0204620361328125,
-0.525390625,
0.27734375,
0.432861328125,
-0.09783935546875,
0.5244140625,
0.06829833984375,
-0.2666015625,
0.07977294921875,
-0.7236328125,
0.2198486328125,
-0.1676025390625,
-0.290283203125,
-0.191162109375,
-0.1968994140625,
0.6650390625,
-0.204345703125,
-0.2099609375,
-0.0058746337890625,
-0.7763671875,
0.30810546875,
0.43310546875,
-0.0218353271484375,
-0.344482421875,
1.0703125,
0.673828125,
0.27734375,
0.685546875,
0.1888427734375,
0.634765625,
-0.58251953125,
0.29833984375,
-0.03704833984375,
-0.0767822265625,
0.1446533203125,
-0.368896484375,
-1.05078125,
0.39306640625,
-0.5146484375,
-0.4326171875,
0.59765625,
-0.78466796875,
0.248779296875,
-0.59765625,
0.81005859375,
-0.583984375,
0.58251953125,
0.2373046875,
-0.1768798828125,
-0.462890625,
0.40869140625,
-0.16162109375,
0.7451171875,
0.1959228515625,
0.78564453125,
0.331298828125,
1.5908203125,
0.578125,
-0.05615234375,
0.12353515625,
0.0902099609375,
-0.416748046875,
-0.6591796875,
-0.0066375732421875,
-0.15380859375,
0.0665283203125,
-0.54345703125,
-0.5,
0.0305023193359375,
0.962890625,
-0.422119140625,
-1.1767578125,
-0.11480712890625,
0.484375,
-0.63720703125,
0.92919921875,
0.6298828125,
0.114013671875,
0.2337646484375,
-0.0941162109375,
-0.160888671875,
-0.6376953125,
0.208740234375,
-0.3359375,
0.6337890625,
-0.50439453125,
-0.59228515625,
-0.7041015625,
-0.3798828125,
-0.01346588134765625,
-0.051788330078125,
-0.23681640625,
-0.50537109375,
0.2039794921875,
0.8369140625,
0.314697265625,
0.248046875,
-0.466552734375,
-0.031341552734375,
0.66552734375,
0.9794921875,
0.01025390625,
0.88623046875,
0.477783203125,
-0.2421875,
0.1729736328125,
-0.53466796875,
0.923828125,
-0.0263824462890625,
0.17529296875,
-0.16845703125,
0.5703125,
-0.64794921875,
-1.517578125,
0.08758544921875,
0.59521484375,
0.0633544921875,
-0.61181640625,
-1.00390625,
-0.4443359375,
-0.94677734375,
-0.340576171875,
-0.7744140625,
0.61376953125,
0.11492919921875,
-0.050384521484375,
-0.027130126953125,
-1.115234375,
4.3203125,
0.80224609375,
0.87939453125,
0.52099609375,
0.405029296875,
1.396484375,
0.59619140625,
-0.50537109375,
-0.1986083984375,
-0.7783203125,
0.70703125,
-0.69970703125,
-0.18212890625,
0.5927734375,
0.6513671875,
0.5517578125,
-0.394287109375,
0.26806640625,
-0.00022864341735839844,
-0.8466796875,
-0.642578125,
-0.302001953125,
0.173828125,
0.57861328125,
0.304931640625,
0.4189453125,
0.98779296875,
-0.87158203125,
-0.306396484375,
-0.2274169921875,
-0.12445068359375,
-0.259521484375,
0.495849609375,
0.1322021484375,
-0.56982421875,
0.65869140625,
0.1473388671875,
-0.94140625,
-0.01355743408203125,
0.159912109375,
-0.76025390625,
-0.265380859375,
0.79443359375,
-0.55810546875,
0.124755859375,
0.61865234375,
-0.56396484375,
0.58154296875,
0.3681640625,
-0.72900390625,
0.69775390625,
-0.6142578125,
0.673828125,
-0.89453125,
-0.44091796875,
0.201904296875,
0.0293426513671875,
-0.1480712890625,
-0.498291015625,
0.271484375,
0.53857421875,
0.17041015625,
0.1185302734375,
0.70458984375,
-0.88134765625,
0.9599609375,
-0.066162109375,
0.343505859375,
-0.5869140625,
-0.287353515625,
-0.476806640625,
-0.2144775390625,
-0.1065673828125,
-0.293701171875,
0.880859375,
0.0211639404296875,
-0.453369140625,
0.380859375,
0.59619140625,
-0.6962890625,
-0.06561279296875,
-0.00567626953125,
-0.625,
-0.7080078125,
0.615234375,
0.94140625,
-0.254150390625,
-0.410400390625,
-0.136962890625,
0.87060546875,
0.8125,
0.75390625,
-0.03472900390625,
-0.5283203125,
-0.406005859375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Tags: implementation, strings
Correct Solution:
```
def f():
n = int(input())
b = []
x = input().split()
for i in range(n):
a = x[i]
a = list(set([i for i in a]))
b.append(frozenset(a))
b = list(set(b))
print(b.__len__())
f()
```
| 66,992
|
[
0.416748046875,
0.08978271484375,
-0.12286376953125,
-0.2130126953125,
-0.283447265625,
-0.49853515625,
0.1444091796875,
0.043670654296875,
0.345458984375,
0.552734375,
1.0849609375,
-0.619140625,
-0.0828857421875,
-0.91650390625,
-0.62109375,
0.09796142578125,
-0.62353515625,
-0.646484375,
-0.265625,
-0.390625,
0.400146484375,
-0.0007777214050292969,
-1.5771484375,
-0.026092529296875,
-0.37060546875,
1.2978515625,
0.587890625,
-0.00698089599609375,
0.97802734375,
1.1494140625,
-0.209716796875,
-0.351318359375,
0.98388671875,
-0.80029296875,
-0.324462890625,
-0.409912109375,
0.8330078125,
-0.95703125,
0.1387939453125,
-0.92626953125,
0.64453125,
-0.10565185546875,
0.10357666015625,
-0.67919921875,
-1.32421875,
0.1484375,
-0.2178955078125,
-0.494140625,
0.08966064453125,
-0.97998046875,
0.264404296875,
-0.48779296875,
0.3779296875,
-0.32568359375,
0.08734130859375,
-0.191650390625,
-0.0213623046875,
-0.005069732666015625,
-0.434326171875,
0.09417724609375,
0.384033203125,
0.366943359375,
-0.11810302734375,
-0.90087890625,
-0.0284576416015625,
0.2744140625,
0.1092529296875,
-0.10980224609375,
0.1375732421875,
-0.685546875,
-0.477783203125,
0.4326171875,
-0.286376953125,
-0.76123046875,
-0.52587890625,
0.0614013671875,
-0.0277099609375,
0.323486328125,
-0.697265625,
0.273193359375,
0.2646484375,
0.830078125,
-0.0460205078125,
0.060272216796875,
-0.279296875,
-0.51171875,
-0.11322021484375,
0.63037109375,
0.213134765625,
-0.2010498046875,
-0.33056640625,
0.41845703125,
-0.556640625,
0.0097503662109375,
0.81787109375,
0.6064453125,
-0.385009765625,
0.52685546875,
0.4111328125,
-0.0184783935546875,
0.73828125,
1.1591796875,
-0.541015625,
0.88525390625,
-0.560546875,
-0.046905517578125,
0.252685546875,
0.08251953125,
-0.2098388671875,
-0.39208984375,
-0.048126220703125,
-0.36767578125,
0.261962890625,
0.203857421875,
-0.1378173828125,
0.89111328125,
-0.076171875,
0.10125732421875,
-0.7080078125,
-0.058441162109375,
0.2447509765625,
0.00887298583984375,
0.2298583984375,
-0.165771484375,
0.04998779296875,
-0.1763916015625,
-0.68994140625,
1.1455078125,
-0.262451171875,
-0.1756591796875,
0.2607421875,
0.1390380859375,
-0.449951171875,
0.53955078125,
-0.386474609375,
0.57861328125,
0.1981201171875,
0.61962890625,
0.75146484375,
-0.63134765625,
0.89453125,
-0.4873046875,
0.01271820068359375,
1.4765625,
0.57275390625,
0.1771240234375,
1.01953125,
0.1890869140625,
-0.705078125,
0.55517578125,
-0.65234375,
0.21923828125,
0.10955810546875,
0.400390625,
-0.52734375,
0.291015625,
0.400390625,
0.52294921875,
0.1998291015625,
0.23876953125,
-0.394775390625,
0.1998291015625,
-0.39794921875,
0.80419921875,
0.0044097900390625,
1.0380859375,
-0.468994140625,
-0.53173828125,
-0.1802978515625,
-0.5654296875,
0.61669921875,
-0.1729736328125,
-0.02349853515625,
0.9453125,
0.49462890625,
0.66845703125,
0.63232421875,
0.18359375,
0.29443359375,
0.04376220703125,
0.019134521484375,
-0.07366943359375,
0.187255859375,
0.7431640625,
0.396484375,
0.0655517578125,
-0.252197265625,
-0.371826171875,
-0.495361328125,
-0.433837890625,
0.1358642578125,
0.91552734375,
-0.71630859375,
0.49853515625,
0.1878662109375,
-0.111572265625,
-0.8388671875,
-0.40234375,
-0.041961669921875,
-0.83154296875,
-0.160888671875,
0.68408203125,
-0.0599365234375,
0.394775390625,
-0.044464111328125,
-0.42822265625,
0.32470703125,
1.396484375,
-0.278564453125,
0.20849609375,
0.4384765625,
-0.232177734375,
-0.11541748046875,
0.268310546875,
0.00884246826171875,
-0.103515625,
-0.8388671875,
1.0966796875,
-0.376220703125,
-0.03375244140625,
0.35546875,
0.73291015625,
0.30224609375,
0.497314453125,
-0.26953125,
-0.50830078125,
0.408935546875,
0.80322265625,
0.253173828125,
0.56005859375,
0.294189453125,
0.8935546875,
0.2548828125,
0.642578125,
0.35107421875,
0.335205078125,
0.5859375,
0.4150390625,
0.0699462890625,
0.382568359375,
0.162109375,
0.2222900390625,
0.5693359375,
0.4482421875,
-0.08673095703125,
0.41455078125,
-0.20654296875,
0.1982421875,
-0.0167694091796875,
0.83544921875,
-0.257568359375,
0.77978515625,
0.2352294921875,
0.347412109375,
-1.0712890625,
-0.69921875,
0.427734375,
0.82177734375,
-1.0048828125,
-1.16796875,
-0.205078125,
-0.01062774658203125,
0.1251220703125,
0.14697265625,
0.401611328125,
0.7265625,
0.1837158203125,
0.6357421875,
-0.537109375,
-0.3173828125,
-1.0146484375,
-0.5947265625,
-1.130859375,
-0.382568359375,
-0.487060546875,
-0.0260772705078125,
0.5380859375,
-0.98876953125,
0.43603515625,
0.00502777099609375,
-0.313232421875,
0.255615234375,
-0.61767578125,
0.489013671875,
-0.351318359375,
0.88427734375,
-0.3740234375,
0.53515625,
-0.0182647705078125,
0.8857421875,
-0.724609375,
-0.712890625,
-0.43310546875,
-0.6044921875,
0.1683349609375,
0.177978515625,
0.4921875,
-0.413818359375,
-0.326904296875,
-0.6884765625,
-0.1800537109375,
-0.03729248046875,
-0.447509765625,
0.401123046875,
-0.67236328125,
0.89892578125,
0.90869140625,
-0.78564453125,
0.7333984375,
0.9658203125,
-0.89453125,
0.40771484375,
0.1790771484375,
0.1571044921875,
-0.86328125,
1.583984375,
0.75537109375,
0.73876953125,
-0.2125244140625,
-0.4814453125,
-0.429443359375,
0.354248046875,
-0.138916015625,
-0.398681640625,
-0.342041015625,
0.73828125,
0.1654052734375,
-1.3525390625,
0.45849609375,
-0.82177734375,
-0.5390625,
-0.54736328125,
-0.41259765625,
0.80712890625,
0.6904296875,
0.158935546875,
-0.52099609375,
-0.373046875,
0.208740234375,
0.88232421875,
0.609375,
-0.45849609375,
0.39208984375,
0.5859375,
0.451416015625,
0.1771240234375,
0.089599609375,
-0.39892578125,
-0.0731201171875,
-0.0284576416015625,
0.048553466796875,
0.60986328125,
-0.1414794921875,
0.34521484375,
0.529296875,
0.4228515625,
-0.7451171875,
-0.1973876953125,
-0.50146484375,
0.6572265625,
0.46240234375,
0.40771484375,
0.33251953125,
-0.6767578125,
-0.261962890625,
-1.02734375,
0.6328125,
0.09368896484375,
0.63330078125,
-0.99560546875,
0.669921875,
0.17578125,
-0.5341796875,
0.452392578125,
-0.496826171875,
-0.26318359375,
0.88916015625,
-0.44287109375,
1.04296875,
-0.7919921875,
0.259033203125,
0.325439453125,
0.06195068359375,
0.814453125,
0.72900390625,
0.320556640625,
0.170654296875,
-0.65673828125,
-0.087890625,
-0.444580078125,
-0.398681640625,
-0.69384765625,
0.1529541015625,
-0.3046875,
-0.66064453125,
-0.6796875,
0.8330078125,
0.4755859375,
0.323974609375,
-0.1956787109375,
0.462890625,
0.31494140625,
0.28173828125,
0.56103515625,
0.0643310546875,
0.65625,
-0.56494140625,
0.96337890625,
0.085693359375,
-0.73828125,
-0.517578125,
-0.310546875,
-0.595703125,
0.029144287109375,
0.1318359375,
0.007511138916015625,
-0.79150390625,
0.11083984375,
0.092529296875,
0.1636962890625,
-0.42529296875,
-0.006412506103515625,
-0.0362548828125,
0.8017578125,
0.2646484375,
-0.92041015625,
0.1531982421875,
-0.90185546875,
0.3583984375,
0.6689453125,
-0.302978515625,
-0.05340576171875,
-0.26025390625,
-0.666015625,
-0.625,
0.07501220703125,
0.6357421875,
-0.2098388671875,
0.13525390625,
-1.1279296875,
0.54833984375,
0.60302734375,
-0.325439453125,
0.2030029296875,
-0.28369140625,
0.453125,
0.0836181640625,
0.4599609375,
-0.6025390625,
-0.41748046875,
-0.00037384033203125,
-1.3017578125,
0.0771484375,
-0.62255859375,
0.787109375,
0.09716796875,
0.15087890625,
0.032135009765625,
0.3642578125,
-0.195068359375,
0.307861328125,
-0.037994384765625,
0.407470703125,
-1.0107421875,
-0.31591796875,
0.43408203125,
-0.1988525390625,
-0.2315673828125,
0.6455078125,
-0.340576171875,
-0.513671875,
0.1363525390625,
0.396728515625,
-0.48681640625,
0.54833984375,
-0.67041015625,
0.5556640625,
0.052947998046875,
-0.7216796875,
-0.1024169921875,
-0.333984375,
0.5712890625,
0.1240234375,
-0.456787109375,
-0.2127685546875,
-1.23828125,
-0.497802734375,
0.065673828125,
-0.505859375,
0.443603515625,
-0.2734375,
-0.54345703125,
-0.0462646484375,
-0.1719970703125,
-0.4609375,
-0.4287109375,
-0.560546875,
-0.3955078125,
0.58203125,
0.58935546875,
0.80126953125,
0.2449951171875,
-0.394775390625,
-0.2939453125,
-0.184814453125,
0.222412109375,
-0.51171875,
-0.00014472007751464844,
0.1683349609375,
-0.36474609375,
-0.2919921875,
0.2421875,
-0.1820068359375,
0.376220703125,
0.406005859375,
-0.060028076171875,
0.5517578125,
0.259765625,
-0.365966796875,
1.3125,
-0.1268310546875,
-1.4169921875,
-0.359619140625,
0.384033203125,
-0.1898193359375,
0.6494140625,
0.36669921875,
-0.953125,
-1.013671875,
-1.001953125,
0.177001953125,
-0.5107421875,
-0.63818359375,
-0.73828125,
-0.59228515625,
-0.37353515625,
0.53369140625,
-0.1815185546875,
-0.496826171875,
0.092041015625,
-1.0107421875,
-0.16162109375,
-0.775390625,
-0.6171875,
-0.89208984375,
-0.1865234375,
-0.313720703125,
0.8935546875,
-0.30517578125,
0.260009765625,
-0.063720703125,
-0.1363525390625,
-0.075927734375,
-0.2191162109375,
-0.1868896484375,
-0.261474609375,
-0.18701171875,
0.061553955078125,
-0.29443359375,
0.3642578125,
-0.32666015625,
0.5078125,
-0.88134765625,
-0.214599609375,
-0.036956787109375,
-0.56640625,
-0.262451171875,
-0.56201171875,
1.4384765625,
-0.26904296875,
-0.09259033203125,
-0.343017578125,
0.78076171875,
0.474609375,
-0.31640625,
-0.8310546875,
-0.51123046875,
-0.497314453125,
-1.3193359375,
0.5615234375,
-1.0361328125,
0.148681640625,
-0.8349609375,
0.047607421875,
0.91552734375,
-0.408203125,
0.170654296875,
1.2744140625,
0.0733642578125,
0.49267578125,
-0.53955078125,
0.87109375,
0.3603515625,
-0.681640625,
-0.402587890625,
0.274658203125,
-1.05078125,
0.3515625,
-0.221923828125,
-0.91455078125,
-0.48291015625,
0.383056640625,
1.3740234375,
-0.305908203125,
0.66064453125,
-0.004436492919921875,
-0.9794921875,
-0.712890625,
0.72802734375,
0.343017578125,
0.6650390625,
0.73046875,
-0.07061767578125,
-0.1947021484375,
0.01349639892578125,
-0.061309814453125,
-0.310302734375,
-0.56689453125,
1.232421875,
-0.2210693359375,
-0.85302734375,
0.421630859375,
0.8779296875,
-1.0302734375,
-0.47509765625,
-0.37353515625,
0.048065185546875,
-0.2191162109375,
-0.740234375,
0.227783203125,
-0.170654296875,
-0.91162109375,
-0.171630859375,
0.2890625,
0.0806884765625,
0.2083740234375,
0.1627197265625,
0.01898193359375,
-0.371826171875,
-0.0108489990234375,
0.8359375,
-0.6533203125,
-0.142333984375,
-0.80078125,
0.167236328125,
0.00429534912109375,
-0.055206298828125,
0.671875,
-0.310546875,
0.38720703125,
0.58154296875,
-0.10870361328125,
0.473876953125,
-0.64453125,
-0.2130126953125,
0.356201171875,
-0.4990234375,
-0.5908203125,
-0.10650634765625,
0.54443359375,
0.125,
0.2408447265625,
-0.441162109375,
0.036285400390625,
0.236572265625,
0.0307769775390625,
-0.263916015625,
-0.9013671875,
-0.51318359375,
-1.3388671875,
-0.50732421875,
-0.353271484375,
-0.447998046875,
-0.0364990234375,
0.396484375,
-0.314697265625,
-1.1103515625,
0.11309814453125,
0.7412109375,
-0.611328125,
1.138671875,
-0.77001953125,
0.345458984375,
-0.59912109375,
-0.254638671875,
-0.7275390625,
0.273681640625,
-0.1806640625,
0.09698486328125,
-0.552734375,
0.6748046875,
0.10894775390625,
0.53564453125,
-0.1341552734375,
0.50341796875,
-0.254150390625,
0.00945281982421875,
0.09783935546875,
-0.13916015625,
-0.2022705078125,
1.0419921875,
0.45166015625,
-0.222900390625,
0.420166015625,
-0.41552734375,
-0.634765625,
-0.1995849609375,
0.837890625,
0.98046875,
-0.225341796875,
-0.244873046875,
-0.343505859375,
0.40283203125,
-0.95849609375,
0.1922607421875,
-0.384033203125,
0.43310546875,
0.07940673828125,
-0.325927734375,
0.309326171875,
1.427734375,
-0.267333984375,
0.4599609375,
0.1666259765625,
0.2099609375,
0.449951171875,
-0.01141357421875,
0.01462554931640625,
0.31103515625,
0.1697998046875,
-0.398193359375,
-0.1805419921875,
0.4345703125,
0.2086181640625,
0.1651611328125,
-0.1982421875,
-0.69140625,
-0.77734375,
0.07806396484375,
-0.060272216796875,
0.452392578125,
0.67041015625,
-0.471435546875,
-0.200439453125,
-0.10943603515625,
-0.634765625,
0.2294921875,
-0.9931640625,
-0.8583984375,
0.2802734375,
-0.41162109375,
-0.498779296875,
-0.11614990234375,
-0.49462890625,
-0.640625,
0.11712646484375,
0.092041015625,
-0.7021484375,
-0.1878662109375,
-0.6044921875,
0.5693359375,
-0.2264404296875,
-0.297119140625,
0.0134735107421875,
0.41259765625,
-0.232666015625,
-0.4365234375,
0.21435546875,
0.50341796875,
-0.0122222900390625,
-0.024566650390625,
-0.8681640625,
0.295166015625,
-0.118408203125,
-0.03961181640625,
-0.72802734375,
-0.09039306640625,
-0.08636474609375,
0.47705078125,
-1.2705078125,
0.08062744140625,
-0.1400146484375,
0.053619384765625,
0.6982421875,
-0.52001953125,
-0.46826171875,
1.2509765625,
0.515625,
-0.17333984375,
-0.208740234375,
0.284423828125,
0.5078125,
-0.1561279296875,
-0.361572265625,
-0.09088134765625,
0.6884765625,
0.49560546875,
0.53955078125,
0.14599609375,
0.337646484375,
0.64794921875,
-0.047393798828125,
-0.5205078125,
0.299072265625,
0.426025390625,
-0.12890625,
0.53515625,
0.0714111328125,
-0.2724609375,
0.08123779296875,
-0.74951171875,
0.181396484375,
-0.16259765625,
-0.279052734375,
-0.17333984375,
-0.1942138671875,
0.7041015625,
-0.273193359375,
-0.2215576171875,
-0.006252288818359375,
-0.7880859375,
0.34326171875,
0.45849609375,
-0.0184173583984375,
-0.3486328125,
1.1025390625,
0.66552734375,
0.293212890625,
0.69140625,
0.1676025390625,
0.60546875,
-0.576171875,
0.287841796875,
-0.0232391357421875,
-0.08135986328125,
0.144287109375,
-0.379150390625,
-1.08203125,
0.388427734375,
-0.48583984375,
-0.424072265625,
0.5634765625,
-0.75048828125,
0.278076171875,
-0.5849609375,
0.8408203125,
-0.5986328125,
0.58154296875,
0.241943359375,
-0.1947021484375,
-0.490478515625,
0.45458984375,
-0.20068359375,
0.69873046875,
0.170654296875,
0.80859375,
0.325927734375,
1.6591796875,
0.525390625,
-0.0799560546875,
0.0985107421875,
0.09912109375,
-0.440673828125,
-0.669921875,
-0.01093292236328125,
-0.15478515625,
0.042266845703125,
-0.55322265625,
-0.5107421875,
0.03851318359375,
0.89453125,
-0.40966796875,
-1.171875,
-0.1142578125,
0.50146484375,
-0.6689453125,
0.93408203125,
0.56201171875,
0.11920166015625,
0.2587890625,
-0.08648681640625,
-0.2010498046875,
-0.65966796875,
0.1949462890625,
-0.333740234375,
0.63330078125,
-0.51318359375,
-0.5595703125,
-0.77001953125,
-0.390869140625,
-0.0567626953125,
-0.05462646484375,
-0.250732421875,
-0.52685546875,
0.2362060546875,
0.87353515625,
0.2880859375,
0.267333984375,
-0.499267578125,
-0.05218505859375,
0.65234375,
0.97998046875,
-0.007617950439453125,
0.88427734375,
0.5048828125,
-0.203369140625,
0.150146484375,
-0.568359375,
0.92041015625,
-0.02032470703125,
0.17578125,
-0.210205078125,
0.61474609375,
-0.6318359375,
-1.5,
0.1304931640625,
0.61376953125,
0.0416259765625,
-0.59228515625,
-1.0634765625,
-0.470703125,
-0.921875,
-0.331298828125,
-0.732421875,
0.6044921875,
0.12310791015625,
-0.00040149688720703125,
0.02264404296875,
-1.1630859375,
4.31640625,
0.7685546875,
0.88818359375,
0.51318359375,
0.423095703125,
1.3544921875,
0.603515625,
-0.5546875,
-0.2198486328125,
-0.798828125,
0.70166015625,
-0.69287109375,
-0.1768798828125,
0.587890625,
0.67626953125,
0.57421875,
-0.35986328125,
0.171630859375,
-0.0029048919677734375,
-0.90673828125,
-0.64697265625,
-0.330322265625,
0.17236328125,
0.58203125,
0.34375,
0.415283203125,
0.98046875,
-0.83251953125,
-0.320556640625,
-0.22802734375,
-0.12451171875,
-0.2476806640625,
0.45703125,
0.2000732421875,
-0.578125,
0.67529296875,
0.148681640625,
-0.95751953125,
-0.053466796875,
0.182373046875,
-0.7607421875,
-0.280517578125,
0.7822265625,
-0.548828125,
0.148681640625,
0.6171875,
-0.60595703125,
0.58984375,
0.359130859375,
-0.71826171875,
0.72998046875,
-0.59521484375,
0.65185546875,
-0.82958984375,
-0.435546875,
0.2447509765625,
0.03692626953125,
-0.16552734375,
-0.495361328125,
0.26806640625,
0.537109375,
0.1683349609375,
0.11273193359375,
0.7236328125,
-0.91162109375,
0.96044921875,
-0.064697265625,
0.411376953125,
-0.5625,
-0.26318359375,
-0.492919921875,
-0.2176513671875,
-0.1461181640625,
-0.271484375,
0.92626953125,
0.04693603515625,
-0.4384765625,
0.326904296875,
0.58203125,
-0.68017578125,
-0.0487060546875,
-0.0447998046875,
-0.67041015625,
-0.71923828125,
0.61376953125,
0.93798828125,
-0.2254638671875,
-0.4365234375,
-0.1182861328125,
0.8671875,
0.81982421875,
0.7392578125,
-0.0169525146484375,
-0.5439453125,
-0.405517578125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Submitted Solution:
```
n = int(input())
a = list(map(list,input().split()))
b = []
for i in range(len(a)):
a[i] = list(set(a[i])); a[i].sort()
if not a[i] in b: b.append(a[i])
print(len(b))
```
Yes
| 66,993
|
[
0.43896484375,
0.12939453125,
-0.19921875,
-0.2401123046875,
-0.4150390625,
-0.392578125,
0.10699462890625,
0.10888671875,
0.27001953125,
0.6279296875,
1.0810546875,
-0.59619140625,
-0.1331787109375,
-0.9658203125,
-0.62744140625,
0.033966064453125,
-0.58642578125,
-0.611328125,
-0.2216796875,
-0.451171875,
0.33935546875,
0.041412353515625,
-1.46484375,
-0.031463623046875,
-0.356201171875,
1.2744140625,
0.55810546875,
-0.0860595703125,
0.96435546875,
1.07421875,
-0.177490234375,
-0.2529296875,
0.94091796875,
-0.69189453125,
-0.2076416015625,
-0.429931640625,
0.84765625,
-0.89453125,
0.061920166015625,
-1.0234375,
0.52197265625,
-0.09234619140625,
0.11590576171875,
-0.59521484375,
-1.3623046875,
0.09210205078125,
-0.1612548828125,
-0.56591796875,
0.07666015625,
-0.95703125,
0.327880859375,
-0.50244140625,
0.341064453125,
-0.407958984375,
0.2081298828125,
-0.1435546875,
-0.04168701171875,
0.08416748046875,
-0.474609375,
0.10125732421875,
0.40966796875,
0.39892578125,
-0.2003173828125,
-0.93212890625,
-0.07098388671875,
0.3564453125,
0.21142578125,
-0.11773681640625,
0.1549072265625,
-0.52392578125,
-0.48828125,
0.376708984375,
-0.300048828125,
-0.6181640625,
-0.48193359375,
0.061614990234375,
-0.0099945068359375,
0.37744140625,
-0.80126953125,
0.263427734375,
0.272705078125,
0.95458984375,
0.08642578125,
0.014984130859375,
-0.343017578125,
-0.50927734375,
0.03350830078125,
0.68359375,
0.26123046875,
-0.1090087890625,
-0.203857421875,
0.347900390625,
-0.52392578125,
-0.09783935546875,
0.8193359375,
0.61962890625,
-0.380859375,
0.533203125,
0.364990234375,
0.007659912109375,
0.79248046875,
1.015625,
-0.546875,
0.92333984375,
-0.63037109375,
-0.061065673828125,
0.2281494140625,
0.031463623046875,
-0.164794921875,
-0.426025390625,
0.0189056396484375,
-0.308349609375,
0.2032470703125,
0.280029296875,
-0.2459716796875,
0.81884765625,
-0.157958984375,
0.1585693359375,
-0.73779296875,
-0.034423828125,
0.311767578125,
-0.07025146484375,
0.2235107421875,
-0.1722412109375,
0.20654296875,
-0.1494140625,
-0.7939453125,
1.1591796875,
-0.308837890625,
-0.2213134765625,
0.2171630859375,
0.203369140625,
-0.5224609375,
0.46875,
-0.351318359375,
0.51513671875,
0.2061767578125,
0.53466796875,
0.78759765625,
-0.67333984375,
0.80908203125,
-0.40771484375,
-0.06512451171875,
1.5498046875,
0.482666015625,
0.0823974609375,
0.9375,
0.2459716796875,
-0.73046875,
0.52978515625,
-0.62548828125,
0.1512451171875,
-0.07489013671875,
0.24462890625,
-0.59765625,
0.36279296875,
0.35498046875,
0.485107421875,
0.30712890625,
0.180908203125,
-0.44775390625,
0.211669921875,
-0.38037109375,
0.77001953125,
-0.0252685546875,
0.9638671875,
-0.4951171875,
-0.60888671875,
-0.1163330078125,
-0.5986328125,
0.61328125,
-0.263916015625,
0.124267578125,
0.96240234375,
0.53759765625,
0.77783203125,
0.59716796875,
0.2587890625,
0.205810546875,
0.10107421875,
-0.08258056640625,
-0.04266357421875,
0.1319580078125,
0.7119140625,
0.43798828125,
0.2200927734375,
-0.279052734375,
-0.334716796875,
-0.35693359375,
-0.49560546875,
0.10791015625,
0.919921875,
-0.6298828125,
0.55029296875,
0.11578369140625,
-0.08343505859375,
-0.7783203125,
-0.422607421875,
0.047821044921875,
-0.9599609375,
-0.284912109375,
0.70751953125,
0.0147552490234375,
0.52294921875,
-0.06463623046875,
-0.53369140625,
0.295166015625,
1.3876953125,
-0.1666259765625,
0.2130126953125,
0.488037109375,
-0.1087646484375,
-0.1800537109375,
0.1265869140625,
0.060089111328125,
-0.072265625,
-0.7919921875,
0.9326171875,
-0.455322265625,
-0.004791259765625,
0.293212890625,
0.64013671875,
0.183349609375,
0.4599609375,
-0.353271484375,
-0.47705078125,
0.435302734375,
0.9140625,
0.1761474609375,
0.55712890625,
0.37939453125,
0.876953125,
0.254638671875,
0.73486328125,
0.46484375,
0.377197265625,
0.74462890625,
0.398681640625,
-0.07684326171875,
0.39306640625,
0.1890869140625,
0.293701171875,
0.59375,
0.57080078125,
-0.091796875,
0.578125,
-0.1983642578125,
0.1168212890625,
-0.05364990234375,
0.88623046875,
-0.21044921875,
0.80517578125,
0.2578125,
0.48681640625,
-0.998046875,
-0.62744140625,
0.4873046875,
0.78662109375,
-1.005859375,
-1.3271484375,
-0.2125244140625,
-0.040374755859375,
0.11236572265625,
0.1820068359375,
0.3310546875,
0.6455078125,
0.1884765625,
0.5947265625,
-0.44482421875,
-0.357666015625,
-1.0166015625,
-0.64208984375,
-1.255859375,
-0.401123046875,
-0.53955078125,
-0.10693359375,
0.5654296875,
-1.095703125,
0.423095703125,
-0.2137451171875,
-0.31787109375,
0.1568603515625,
-0.445556640625,
0.58154296875,
-0.404052734375,
0.86376953125,
-0.30224609375,
0.4951171875,
-0.0011138916015625,
0.85693359375,
-0.77880859375,
-0.6650390625,
-0.50927734375,
-0.52197265625,
0.25,
0.12347412109375,
0.5478515625,
-0.31787109375,
-0.33349609375,
-0.8642578125,
-0.12005615234375,
0.0171356201171875,
-0.42333984375,
0.280517578125,
-0.73974609375,
0.9951171875,
0.83642578125,
-0.810546875,
0.68505859375,
1.041015625,
-0.841796875,
0.450927734375,
0.2188720703125,
0.31201171875,
-0.7763671875,
1.5595703125,
0.67919921875,
0.7607421875,
-0.1790771484375,
-0.5185546875,
-0.327392578125,
0.374755859375,
-0.08209228515625,
-0.495849609375,
-0.3154296875,
0.71826171875,
0.17822265625,
-1.361328125,
0.56005859375,
-0.88525390625,
-0.5400390625,
-0.5625,
-0.6533203125,
0.85302734375,
0.73193359375,
0.2191162109375,
-0.5478515625,
-0.5166015625,
0.1102294921875,
0.9052734375,
0.56298828125,
-0.55322265625,
0.263427734375,
0.70556640625,
0.454833984375,
0.367431640625,
0.10882568359375,
-0.43017578125,
-0.0977783203125,
-0.02374267578125,
-0.0255584716796875,
0.740234375,
-0.183349609375,
0.44287109375,
0.4609375,
0.4599609375,
-0.77197265625,
-0.20703125,
-0.465576171875,
0.69677734375,
0.380615234375,
0.437255859375,
0.4501953125,
-0.53125,
-0.307861328125,
-1.0048828125,
0.55029296875,
-0.0006494522094726562,
0.65234375,
-0.92919921875,
0.68212890625,
0.15771484375,
-0.66015625,
0.480712890625,
-0.54736328125,
-0.171630859375,
0.876953125,
-0.51025390625,
0.97509765625,
-0.9599609375,
0.203857421875,
0.239990234375,
-0.0941162109375,
0.76708984375,
0.693359375,
0.419189453125,
0.1561279296875,
-0.6904296875,
-0.020599365234375,
-0.402099609375,
-0.38525390625,
-0.68310546875,
0.142578125,
-0.309326171875,
-0.8017578125,
-0.77587890625,
0.8681640625,
0.385009765625,
0.33935546875,
-0.1329345703125,
0.46435546875,
0.228271484375,
0.152587890625,
0.6337890625,
0.0888671875,
0.619140625,
-0.6201171875,
1.0732421875,
0.1112060546875,
-0.80419921875,
-0.473388671875,
-0.301025390625,
-0.59765625,
0.07891845703125,
0.0570068359375,
0.053009033203125,
-0.8994140625,
0.1441650390625,
0.15869140625,
0.1470947265625,
-0.483154296875,
-0.0259246826171875,
-0.0941162109375,
0.8212890625,
0.29736328125,
-0.962890625,
0.1019287109375,
-0.9765625,
0.27392578125,
0.72265625,
-0.355224609375,
-0.1634521484375,
-0.16162109375,
-0.82177734375,
-0.8388671875,
0.12371826171875,
0.82958984375,
-0.2471923828125,
0.047821044921875,
-1.24609375,
0.56982421875,
0.71142578125,
-0.4326171875,
0.29443359375,
-0.370849609375,
0.412353515625,
0.08758544921875,
0.356201171875,
-0.52294921875,
-0.3701171875,
0.016693115234375,
-1.232421875,
0.11138916015625,
-0.63037109375,
0.853515625,
0.10076904296875,
0.112060546875,
0.07012939453125,
0.416748046875,
-0.1424560546875,
0.282958984375,
0.00463104248046875,
0.490966796875,
-1.0751953125,
-0.39892578125,
0.397216796875,
-0.1927490234375,
-0.320556640625,
0.662109375,
-0.28271484375,
-0.52880859375,
0.08734130859375,
0.30810546875,
-0.49609375,
0.67236328125,
-0.61376953125,
0.552734375,
0.1773681640625,
-0.63818359375,
-0.09857177734375,
-0.35791015625,
0.583984375,
-0.016632080078125,
-0.39697265625,
-0.26171875,
-1.2294921875,
-0.473876953125,
0.0242919921875,
-0.6220703125,
0.398193359375,
-0.186279296875,
-0.5244140625,
-0.0030059814453125,
-0.2396240234375,
-0.45654296875,
-0.39013671875,
-0.57275390625,
-0.474365234375,
0.48876953125,
0.59423828125,
0.68212890625,
0.218505859375,
-0.366455078125,
-0.34130859375,
-0.2529296875,
0.2247314453125,
-0.537109375,
-0.006397247314453125,
0.1829833984375,
-0.479736328125,
-0.352783203125,
0.355224609375,
-0.1593017578125,
0.3740234375,
0.423095703125,
-0.056488037109375,
0.64453125,
0.26904296875,
-0.436279296875,
1.44140625,
-0.1705322265625,
-1.55859375,
-0.2296142578125,
0.35009765625,
-0.11309814453125,
0.76904296875,
0.27734375,
-0.94189453125,
-1.0771484375,
-1.0791015625,
0.19970703125,
-0.5712890625,
-0.68310546875,
-0.73828125,
-0.56689453125,
-0.343505859375,
0.61865234375,
-0.269287109375,
-0.4091796875,
0.1439208984375,
-1.087890625,
-0.075439453125,
-0.7939453125,
-0.6015625,
-0.88623046875,
-0.1650390625,
-0.31298828125,
0.970703125,
-0.177734375,
0.231201171875,
-0.043060302734375,
-0.0312042236328125,
-0.13427734375,
-0.1719970703125,
-0.174072265625,
-0.328125,
-0.1629638671875,
-0.01629638671875,
-0.28466796875,
0.279296875,
-0.470458984375,
0.4970703125,
-0.86669921875,
-0.1898193359375,
-0.022705078125,
-0.51171875,
-0.26513671875,
-0.66552734375,
1.4541015625,
-0.2232666015625,
-0.053741455078125,
-0.388671875,
0.6943359375,
0.6142578125,
-0.32275390625,
-0.74267578125,
-0.5166015625,
-0.472900390625,
-1.32421875,
0.57568359375,
-0.9716796875,
0.158447265625,
-0.908203125,
0.05615234375,
0.98046875,
-0.397216796875,
0.30517578125,
1.3017578125,
0.13671875,
0.51416015625,
-0.62939453125,
0.90283203125,
0.39599609375,
-0.67138671875,
-0.435302734375,
0.1419677734375,
-1.123046875,
0.263671875,
-0.239013671875,
-0.92333984375,
-0.53125,
0.340576171875,
1.2841796875,
-0.278564453125,
0.69091796875,
0.03436279296875,
-1.1357421875,
-0.61865234375,
0.75439453125,
0.3330078125,
0.59814453125,
0.75634765625,
-0.07977294921875,
-0.2841796875,
0.06646728515625,
-0.107177734375,
-0.34619140625,
-0.494140625,
1.2939453125,
-0.263671875,
-0.884765625,
0.51318359375,
0.82080078125,
-1.1376953125,
-0.55810546875,
-0.41552734375,
0.0771484375,
-0.053558349609375,
-0.740234375,
0.28564453125,
-0.1534423828125,
-0.8017578125,
-0.100341796875,
0.205078125,
0.0165557861328125,
0.26220703125,
0.2152099609375,
0.0970458984375,
-0.449951171875,
-0.0606689453125,
0.86865234375,
-0.67724609375,
-0.1678466796875,
-0.84228515625,
0.227294921875,
0.0699462890625,
0.0171661376953125,
0.6103515625,
-0.270751953125,
0.45654296875,
0.6513671875,
-0.0819091796875,
0.541015625,
-0.69580078125,
-0.11175537109375,
0.297119140625,
-0.485595703125,
-0.56591796875,
-0.148193359375,
0.55810546875,
0.11273193359375,
0.32666015625,
-0.424072265625,
0.012969970703125,
0.30712890625,
0.061676025390625,
-0.1890869140625,
-0.73779296875,
-0.5859375,
-1.2666015625,
-0.58544921875,
-0.319580078125,
-0.46533203125,
0.032073974609375,
0.47021484375,
-0.2152099609375,
-1.03515625,
0.1387939453125,
0.8427734375,
-0.56787109375,
1.10546875,
-0.82275390625,
0.332763671875,
-0.65087890625,
-0.2666015625,
-0.68603515625,
0.256591796875,
-0.333740234375,
-0.090087890625,
-0.434814453125,
0.70263671875,
0.132080078125,
0.49658203125,
-0.1982421875,
0.5029296875,
-0.166259765625,
0.1905517578125,
0.2001953125,
-0.0293731689453125,
-0.234130859375,
1.02734375,
0.3701171875,
-0.1751708984375,
0.426513671875,
-0.447509765625,
-0.60205078125,
-0.11572265625,
0.87841796875,
1.015625,
-0.204833984375,
-0.2269287109375,
-0.34130859375,
0.25048828125,
-0.9345703125,
0.293212890625,
-0.35498046875,
0.44580078125,
0.12188720703125,
-0.32080078125,
0.30517578125,
1.4794921875,
-0.349365234375,
0.50048828125,
0.1771240234375,
0.26806640625,
0.5126953125,
0.0174713134765625,
0.0836181640625,
0.392333984375,
0.1494140625,
-0.456787109375,
-0.1290283203125,
0.479248046875,
0.280029296875,
0.13037109375,
-0.3447265625,
-0.7431640625,
-0.93408203125,
0.09747314453125,
-0.049468994140625,
0.50244140625,
0.697265625,
-0.4248046875,
-0.1846923828125,
-0.1512451171875,
-0.67041015625,
0.272216796875,
-1.1025390625,
-0.875,
0.342529296875,
-0.387939453125,
-0.62841796875,
-0.0105743408203125,
-0.461669921875,
-0.454345703125,
0.12042236328125,
0.022979736328125,
-0.7216796875,
-0.287109375,
-0.496337890625,
0.64990234375,
-0.259765625,
-0.26318359375,
-0.01473236083984375,
0.437255859375,
-0.408203125,
-0.384765625,
0.1710205078125,
0.5322265625,
-0.11102294921875,
-0.07562255859375,
-0.89453125,
0.3173828125,
-0.1378173828125,
-0.03363037109375,
-0.67626953125,
-0.09442138671875,
-0.031524658203125,
0.5791015625,
-1.2216796875,
0.0113983154296875,
-0.1629638671875,
0.012939453125,
0.64306640625,
-0.50048828125,
-0.6025390625,
1.208984375,
0.57568359375,
-0.158203125,
-0.12298583984375,
0.35400390625,
0.5830078125,
-0.072265625,
-0.27783203125,
-0.08148193359375,
0.7392578125,
0.55322265625,
0.61767578125,
0.18115234375,
0.43798828125,
0.67724609375,
-0.032928466796875,
-0.45361328125,
0.328369140625,
0.4599609375,
-0.11114501953125,
0.6015625,
0.00621795654296875,
-0.1712646484375,
0.1419677734375,
-0.74365234375,
0.129150390625,
-0.1903076171875,
-0.292236328125,
-0.248046875,
-0.1148681640625,
0.755859375,
-0.357421875,
-0.1822509765625,
-0.1309814453125,
-0.783203125,
0.436279296875,
0.460693359375,
0.0216217041015625,
-0.373046875,
1.1640625,
0.7783203125,
0.344970703125,
0.685546875,
0.174560546875,
0.481689453125,
-0.69775390625,
0.260009765625,
0.1553955078125,
-0.1697998046875,
0.2169189453125,
-0.3642578125,
-1.197265625,
0.47412109375,
-0.39208984375,
-0.311767578125,
0.462158203125,
-0.80615234375,
0.2120361328125,
-0.5498046875,
0.9130859375,
-0.62109375,
0.53662109375,
0.2376708984375,
-0.2254638671875,
-0.48486328125,
0.45751953125,
-0.1341552734375,
0.6513671875,
0.215087890625,
0.7666015625,
0.384521484375,
1.646484375,
0.6357421875,
-0.08563232421875,
0.18408203125,
0.202880859375,
-0.32177734375,
-0.71435546875,
0.05859375,
-0.2037353515625,
-0.07269287109375,
-0.48046875,
-0.54833984375,
-0.09344482421875,
0.93310546875,
-0.377197265625,
-1.1064453125,
-0.1673583984375,
0.44384765625,
-0.615234375,
0.9755859375,
0.4453125,
0.25244140625,
0.26123046875,
-0.10577392578125,
-0.28271484375,
-0.62255859375,
0.151123046875,
-0.274169921875,
0.64697265625,
-0.40869140625,
-0.54052734375,
-0.7861328125,
-0.419189453125,
0.00490570068359375,
0.0478515625,
-0.320556640625,
-0.52685546875,
0.205322265625,
0.84130859375,
0.24169921875,
0.1478271484375,
-0.4833984375,
0.036834716796875,
0.62548828125,
0.91357421875,
-0.088623046875,
0.8466796875,
0.56884765625,
-0.1553955078125,
0.018585205078125,
-0.5927734375,
0.93408203125,
0.08441162109375,
0.129638671875,
-0.2249755859375,
0.56494140625,
-0.82763671875,
-1.37890625,
0.03594970703125,
0.634765625,
-0.004360198974609375,
-0.59228515625,
-1.19140625,
-0.69921875,
-0.80859375,
-0.298828125,
-0.80224609375,
0.6728515625,
0.218505859375,
-0.109619140625,
0.0389404296875,
-1.07421875,
4.2265625,
0.8388671875,
0.791015625,
0.420654296875,
0.456787109375,
1.39453125,
0.57421875,
-0.65478515625,
-0.1590576171875,
-0.91015625,
0.6455078125,
-0.7431640625,
-0.1064453125,
0.662109375,
0.70654296875,
0.61865234375,
-0.42822265625,
0.03643798828125,
0.0819091796875,
-0.98583984375,
-0.66259765625,
-0.292724609375,
0.2188720703125,
0.463134765625,
0.350830078125,
0.52001953125,
1.1142578125,
-0.92041015625,
-0.332763671875,
-0.2320556640625,
-0.124755859375,
-0.261474609375,
0.421875,
0.251708984375,
-0.5458984375,
0.68798828125,
0.1907958984375,
-1.0458984375,
-0.022247314453125,
0.281494140625,
-0.77294921875,
-0.177734375,
0.814453125,
-0.52099609375,
0.039306640625,
0.83447265625,
-0.6484375,
0.61376953125,
0.369384765625,
-0.732421875,
0.8076171875,
-0.55517578125,
0.61376953125,
-0.76025390625,
-0.459716796875,
0.291259765625,
0.035675048828125,
-0.11395263671875,
-0.389892578125,
0.28076171875,
0.47021484375,
0.1824951171875,
0.09661865234375,
0.796875,
-0.99609375,
0.8837890625,
-0.01136016845703125,
0.250244140625,
-0.58349609375,
-0.2626953125,
-0.5146484375,
-0.249755859375,
-0.208251953125,
-0.4296875,
0.91015625,
0.0870361328125,
-0.5009765625,
0.27490234375,
0.63134765625,
-0.6171875,
-0.105712890625,
-0.113037109375,
-0.5615234375,
-0.72607421875,
0.60107421875,
0.90625,
-0.341796875,
-0.462890625,
-0.274658203125,
0.86474609375,
0.92578125,
0.7646484375,
-0.03363037109375,
-0.59130859375,
-0.53369140625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Submitted Solution:
```
n = int(input())
mas = map(set, input().split())
gas = []
q = 0
pr = set('zyxwvutsrqponmlkjihgfedcba')
for el in mas:
if not el & pr in gas:
q += 1
gas.append(el & pr)
print(q)
```
Yes
| 66,994
|
[
0.483642578125,
0.198486328125,
-0.189453125,
-0.1829833984375,
-0.39208984375,
-0.43310546875,
0.08441162109375,
0.09814453125,
0.2958984375,
0.5986328125,
1.0888671875,
-0.5947265625,
-0.10760498046875,
-0.97314453125,
-0.60595703125,
0.08380126953125,
-0.468017578125,
-0.501953125,
-0.244384765625,
-0.4375,
0.300048828125,
0.0294189453125,
-1.4609375,
-0.007343292236328125,
-0.356689453125,
1.2607421875,
0.5966796875,
-0.085205078125,
1.0126953125,
1.0068359375,
-0.199462890625,
-0.29443359375,
0.94677734375,
-0.6845703125,
-0.305419921875,
-0.45263671875,
0.892578125,
-0.8857421875,
0.044342041015625,
-1.0224609375,
0.52587890625,
-0.09130859375,
0.12841796875,
-0.55810546875,
-1.41015625,
0.050323486328125,
-0.2137451171875,
-0.5556640625,
0.034393310546875,
-0.921875,
0.3203125,
-0.493896484375,
0.397216796875,
-0.408203125,
0.156005859375,
-0.162841796875,
-0.041656494140625,
0.1156005859375,
-0.57080078125,
0.07574462890625,
0.42822265625,
0.4326171875,
-0.2391357421875,
-0.93115234375,
-0.0523681640625,
0.383056640625,
0.1888427734375,
-0.11175537109375,
0.132080078125,
-0.46923828125,
-0.458740234375,
0.331298828125,
-0.271240234375,
-0.53515625,
-0.410400390625,
0.072265625,
-0.0088348388671875,
0.34130859375,
-0.78173828125,
0.27783203125,
0.26318359375,
0.97021484375,
0.0635986328125,
0.046234130859375,
-0.3896484375,
-0.46875,
0.047943115234375,
0.71484375,
0.263671875,
-0.12054443359375,
-0.25244140625,
0.37939453125,
-0.5673828125,
-0.0850830078125,
0.83935546875,
0.58935546875,
-0.35498046875,
0.48876953125,
0.35546875,
-0.058197021484375,
0.75341796875,
1.0771484375,
-0.58056640625,
0.939453125,
-0.6337890625,
-0.0164337158203125,
0.2342529296875,
0.01398468017578125,
-0.1671142578125,
-0.435302734375,
-0.041015625,
-0.35400390625,
0.173828125,
0.170654296875,
-0.27685546875,
0.86669921875,
-0.0894775390625,
0.1436767578125,
-0.66552734375,
-0.05499267578125,
0.233642578125,
-0.0877685546875,
0.219482421875,
-0.14599609375,
0.10406494140625,
-0.2427978515625,
-0.84521484375,
1.2119140625,
-0.278076171875,
-0.2413330078125,
0.1815185546875,
0.1815185546875,
-0.484619140625,
0.459716796875,
-0.335205078125,
0.546875,
0.2685546875,
0.5263671875,
0.82177734375,
-0.68798828125,
0.77783203125,
-0.40576171875,
-0.0182952880859375,
1.5625,
0.439697265625,
0.1727294921875,
0.955078125,
0.185791015625,
-0.7470703125,
0.5439453125,
-0.6181640625,
0.1820068359375,
-0.101318359375,
0.28466796875,
-0.59130859375,
0.38232421875,
0.347412109375,
0.484130859375,
0.317626953125,
0.18701171875,
-0.439453125,
0.218017578125,
-0.39453125,
0.8076171875,
-0.0653076171875,
0.97607421875,
-0.378173828125,
-0.56201171875,
-0.1861572265625,
-0.67822265625,
0.5791015625,
-0.283447265625,
0.099365234375,
0.99267578125,
0.5380859375,
0.78955078125,
0.53173828125,
0.26123046875,
0.1787109375,
0.11822509765625,
-0.05621337890625,
-0.078857421875,
0.07720947265625,
0.7763671875,
0.546875,
0.265625,
-0.3037109375,
-0.2509765625,
-0.41162109375,
-0.5205078125,
0.1121826171875,
0.962890625,
-0.65283203125,
0.56201171875,
0.1103515625,
-0.045654296875,
-0.7373046875,
-0.36474609375,
0.00991058349609375,
-0.978515625,
-0.2900390625,
0.7548828125,
0.0165557861328125,
0.54052734375,
-0.11407470703125,
-0.49267578125,
0.269775390625,
1.44140625,
-0.1431884765625,
0.1087646484375,
0.50048828125,
-0.0301513671875,
-0.14111328125,
0.08917236328125,
0.0606689453125,
-0.07843017578125,
-0.82861328125,
0.94287109375,
-0.464599609375,
-0.0061798095703125,
0.296875,
0.65869140625,
0.161376953125,
0.5380859375,
-0.358154296875,
-0.440185546875,
0.420166015625,
1.005859375,
0.23828125,
0.61669921875,
0.341796875,
0.89306640625,
0.2337646484375,
0.73291015625,
0.42578125,
0.40478515625,
0.77587890625,
0.42822265625,
-0.11395263671875,
0.4150390625,
0.261474609375,
0.377197265625,
0.56201171875,
0.61865234375,
0.0287628173828125,
0.6201171875,
-0.19970703125,
0.0689697265625,
-0.034637451171875,
0.89892578125,
-0.199951171875,
0.7568359375,
0.264404296875,
0.52392578125,
-0.94873046875,
-0.5908203125,
0.5498046875,
0.7900390625,
-0.984375,
-1.2744140625,
-0.196044921875,
-0.006801605224609375,
0.10455322265625,
0.1514892578125,
0.2958984375,
0.63427734375,
0.1650390625,
0.4814453125,
-0.430908203125,
-0.327880859375,
-1.0537109375,
-0.71240234375,
-1.2099609375,
-0.3955078125,
-0.576171875,
-0.068115234375,
0.57666015625,
-1.158203125,
0.34765625,
-0.22265625,
-0.397216796875,
0.1163330078125,
-0.525390625,
0.60986328125,
-0.413330078125,
0.82177734375,
-0.3310546875,
0.46875,
-0.0213623046875,
0.7958984375,
-0.8154296875,
-0.7001953125,
-0.486328125,
-0.483154296875,
0.2685546875,
0.0950927734375,
0.5625,
-0.276123046875,
-0.349853515625,
-0.8525390625,
-0.1453857421875,
-0.034698486328125,
-0.374755859375,
0.225341796875,
-0.69287109375,
0.95263671875,
0.81640625,
-0.7431640625,
0.64013671875,
0.99365234375,
-0.826171875,
0.52001953125,
0.2059326171875,
0.363525390625,
-0.75439453125,
1.619140625,
0.71875,
0.75244140625,
-0.1722412109375,
-0.49658203125,
-0.36962890625,
0.3515625,
-0.0958251953125,
-0.4765625,
-0.29052734375,
0.73388671875,
0.18603515625,
-1.435546875,
0.6044921875,
-0.82861328125,
-0.552734375,
-0.54052734375,
-0.61328125,
0.86572265625,
0.75146484375,
0.25244140625,
-0.5576171875,
-0.50830078125,
0.081787109375,
0.845703125,
0.541015625,
-0.5322265625,
0.272216796875,
0.6689453125,
0.40185546875,
0.38232421875,
0.10101318359375,
-0.410888671875,
-0.112548828125,
-0.0140533447265625,
-0.026763916015625,
0.71484375,
-0.1451416015625,
0.490478515625,
0.41357421875,
0.475341796875,
-0.78271484375,
-0.2420654296875,
-0.52880859375,
0.73193359375,
0.36376953125,
0.33447265625,
0.43798828125,
-0.525390625,
-0.285400390625,
-0.9794921875,
0.52001953125,
0.00870513916015625,
0.66845703125,
-0.9326171875,
0.70263671875,
0.08831787109375,
-0.69677734375,
0.4736328125,
-0.55078125,
-0.1683349609375,
0.88671875,
-0.54248046875,
0.9580078125,
-0.93603515625,
0.2403564453125,
0.1788330078125,
-0.10992431640625,
0.6943359375,
0.64697265625,
0.329833984375,
0.1392822265625,
-0.67529296875,
-0.03692626953125,
-0.423583984375,
-0.401611328125,
-0.7470703125,
0.135498046875,
-0.3095703125,
-0.81884765625,
-0.775390625,
0.900390625,
0.42822265625,
0.339111328125,
-0.08868408203125,
0.513671875,
0.2344970703125,
0.184814453125,
0.5986328125,
0.08428955078125,
0.60595703125,
-0.61962890625,
1.0830078125,
0.1597900390625,
-0.81201171875,
-0.46826171875,
-0.310791015625,
-0.56201171875,
0.057647705078125,
0.0987548828125,
0.0207061767578125,
-0.83349609375,
0.214599609375,
0.23876953125,
0.1805419921875,
-0.471923828125,
-0.024993896484375,
-0.07733154296875,
0.86865234375,
0.294921875,
-0.962890625,
0.03253173828125,
-0.9912109375,
0.250244140625,
0.71630859375,
-0.362060546875,
-0.141845703125,
-0.1507568359375,
-0.8330078125,
-0.8310546875,
0.1434326171875,
0.77685546875,
-0.2880859375,
0.023773193359375,
-1.236328125,
0.5673828125,
0.66845703125,
-0.42578125,
0.25732421875,
-0.3291015625,
0.4052734375,
0.1658935546875,
0.42724609375,
-0.521484375,
-0.399169921875,
0.040863037109375,
-1.1689453125,
0.119384765625,
-0.58984375,
0.7890625,
0.0948486328125,
0.1253662109375,
0.05694580078125,
0.394775390625,
-0.17919921875,
0.268798828125,
0.05181884765625,
0.505859375,
-1.05078125,
-0.365966796875,
0.413818359375,
-0.2108154296875,
-0.31494140625,
0.68408203125,
-0.2103271484375,
-0.5771484375,
0.11981201171875,
0.269287109375,
-0.5,
0.64990234375,
-0.611328125,
0.56884765625,
0.1748046875,
-0.66455078125,
-0.10626220703125,
-0.40087890625,
0.62158203125,
-0.08746337890625,
-0.40185546875,
-0.224609375,
-1.1845703125,
-0.46875,
0.069580078125,
-0.5673828125,
0.357177734375,
-0.2044677734375,
-0.56591796875,
0.042877197265625,
-0.30126953125,
-0.47119140625,
-0.357177734375,
-0.5,
-0.46875,
0.51611328125,
0.6669921875,
0.6669921875,
0.25634765625,
-0.396728515625,
-0.35205078125,
-0.2998046875,
0.194091796875,
-0.54052734375,
0.00799560546875,
0.195068359375,
-0.525390625,
-0.305419921875,
0.36279296875,
-0.144775390625,
0.3076171875,
0.471435546875,
-0.0848388671875,
0.69482421875,
0.25244140625,
-0.431884765625,
1.447265625,
-0.244384765625,
-1.578125,
-0.18603515625,
0.356201171875,
-0.16162109375,
0.78955078125,
0.26416015625,
-1.0185546875,
-1.041015625,
-1.1337890625,
0.1962890625,
-0.60546875,
-0.63623046875,
-0.595703125,
-0.6318359375,
-0.363525390625,
0.68701171875,
-0.1387939453125,
-0.41845703125,
0.1512451171875,
-1.087890625,
-0.0489501953125,
-0.81396484375,
-0.6611328125,
-0.8603515625,
-0.151123046875,
-0.360107421875,
0.935546875,
-0.288330078125,
0.27880859375,
-0.05145263671875,
0.01235198974609375,
-0.22314453125,
-0.2037353515625,
-0.1611328125,
-0.379638671875,
-0.12200927734375,
0.054656982421875,
-0.2333984375,
0.3291015625,
-0.489990234375,
0.50048828125,
-0.857421875,
-0.1973876953125,
-0.004116058349609375,
-0.496337890625,
-0.27978515625,
-0.6962890625,
1.4609375,
-0.224609375,
-0.12432861328125,
-0.317138671875,
0.65966796875,
0.5869140625,
-0.28564453125,
-0.79248046875,
-0.479248046875,
-0.5068359375,
-1.3955078125,
0.6142578125,
-0.95068359375,
0.143310546875,
-0.82666015625,
0.0447998046875,
0.97265625,
-0.343017578125,
0.2196044921875,
1.376953125,
0.051055908203125,
0.45263671875,
-0.6796875,
0.85498046875,
0.434326171875,
-0.58837890625,
-0.38037109375,
0.221923828125,
-1.158203125,
0.2200927734375,
-0.339599609375,
-0.947265625,
-0.517578125,
0.26513671875,
1.2744140625,
-0.35791015625,
0.7109375,
0.0198211669921875,
-1.091796875,
-0.66259765625,
0.71533203125,
0.317626953125,
0.607421875,
0.81103515625,
0.007678985595703125,
-0.30810546875,
0.09295654296875,
-0.10479736328125,
-0.35107421875,
-0.56591796875,
1.318359375,
-0.261474609375,
-0.8916015625,
0.51904296875,
0.86376953125,
-1.10546875,
-0.5185546875,
-0.36669921875,
0.025634765625,
-0.089599609375,
-0.7607421875,
0.273193359375,
-0.184326171875,
-0.7470703125,
-0.13330078125,
0.274658203125,
0.153564453125,
0.261474609375,
0.284912109375,
0.0966796875,
-0.418212890625,
-0.0660400390625,
0.904296875,
-0.70849609375,
-0.1361083984375,
-0.87841796875,
0.2137451171875,
0.08135986328125,
-0.0142974853515625,
0.6015625,
-0.337646484375,
0.389892578125,
0.6591796875,
-0.132080078125,
0.468994140625,
-0.65380859375,
-0.074462890625,
0.437744140625,
-0.54638671875,
-0.5927734375,
-0.1435546875,
0.548828125,
0.1212158203125,
0.343994140625,
-0.377685546875,
0.0285797119140625,
0.26953125,
0.0030727386474609375,
-0.1453857421875,
-0.8056640625,
-0.5283203125,
-1.2841796875,
-0.61328125,
-0.41845703125,
-0.469482421875,
0.0189971923828125,
0.50244140625,
-0.1365966796875,
-0.9716796875,
0.1544189453125,
0.78369140625,
-0.576171875,
1.0673828125,
-0.77490234375,
0.354736328125,
-0.62646484375,
-0.272705078125,
-0.6787109375,
0.258056640625,
-0.260986328125,
-0.0380859375,
-0.42236328125,
0.74365234375,
0.11688232421875,
0.4697265625,
-0.1580810546875,
0.46337890625,
-0.1966552734375,
0.1605224609375,
0.052703857421875,
-0.039215087890625,
-0.2998046875,
1.044921875,
0.377685546875,
-0.165771484375,
0.40380859375,
-0.4638671875,
-0.56005859375,
-0.1597900390625,
0.81201171875,
1.05859375,
-0.1934814453125,
-0.2445068359375,
-0.286376953125,
0.228759765625,
-0.91015625,
0.316162109375,
-0.305419921875,
0.482177734375,
0.15576171875,
-0.381591796875,
0.2352294921875,
1.4375,
-0.302001953125,
0.454345703125,
0.2005615234375,
0.240478515625,
0.521484375,
0.0273590087890625,
0.1468505859375,
0.288330078125,
0.1064453125,
-0.56689453125,
-0.1622314453125,
0.465576171875,
0.27294921875,
0.059295654296875,
-0.31298828125,
-0.74267578125,
-0.97705078125,
0.06915283203125,
-0.07574462890625,
0.395751953125,
0.658203125,
-0.35693359375,
-0.1005859375,
-0.12158203125,
-0.7138671875,
0.21875,
-1.1474609375,
-0.84716796875,
0.2998046875,
-0.393798828125,
-0.5537109375,
0.0005044937133789062,
-0.36767578125,
-0.56787109375,
0.029998779296875,
0.0203094482421875,
-0.6611328125,
-0.305419921875,
-0.54345703125,
0.69140625,
-0.3017578125,
-0.215087890625,
-0.0362548828125,
0.379638671875,
-0.432861328125,
-0.343505859375,
0.228271484375,
0.491455078125,
-0.1356201171875,
-0.0202789306640625,
-0.91357421875,
0.3427734375,
-0.135986328125,
-0.08740234375,
-0.6103515625,
-0.08233642578125,
-0.031982421875,
0.53759765625,
-1.1669921875,
0.036102294921875,
-0.215087890625,
0.007152557373046875,
0.62841796875,
-0.509765625,
-0.61572265625,
1.1201171875,
0.6533203125,
-0.200927734375,
-0.06158447265625,
0.345947265625,
0.58251953125,
-0.04962158203125,
-0.330810546875,
-0.036224365234375,
0.68408203125,
0.58203125,
0.64697265625,
0.255859375,
0.38720703125,
0.693359375,
-0.010101318359375,
-0.445068359375,
0.305419921875,
0.5380859375,
-0.1346435546875,
0.58740234375,
-0.0196685791015625,
-0.1185302734375,
0.08349609375,
-0.78466796875,
0.0496826171875,
-0.1708984375,
-0.289306640625,
-0.2099609375,
-0.1221923828125,
0.7265625,
-0.31201171875,
-0.20361328125,
-0.11553955078125,
-0.76416015625,
0.47412109375,
0.4853515625,
0.047943115234375,
-0.317138671875,
1.1298828125,
0.76171875,
0.372314453125,
0.6552734375,
0.1502685546875,
0.53271484375,
-0.6943359375,
0.273681640625,
0.1968994140625,
-0.17431640625,
0.170166015625,
-0.342529296875,
-1.16015625,
0.5087890625,
-0.50341796875,
-0.26416015625,
0.357666015625,
-0.81298828125,
0.2265625,
-0.59423828125,
0.88134765625,
-0.63037109375,
0.52294921875,
0.255615234375,
-0.1533203125,
-0.429931640625,
0.517578125,
-0.0897216796875,
0.68017578125,
0.2744140625,
0.794921875,
0.353759765625,
1.5966796875,
0.66015625,
-0.006862640380859375,
0.1802978515625,
0.1669921875,
-0.367919921875,
-0.6298828125,
0.0758056640625,
-0.2626953125,
-0.12841796875,
-0.4736328125,
-0.482421875,
-0.10845947265625,
0.978515625,
-0.4462890625,
-1.0859375,
-0.1632080078125,
0.5107421875,
-0.57958984375,
0.98388671875,
0.44677734375,
0.26953125,
0.25439453125,
-0.1572265625,
-0.341064453125,
-0.65869140625,
0.1654052734375,
-0.25390625,
0.5869140625,
-0.388427734375,
-0.6494140625,
-0.7568359375,
-0.391845703125,
0.033660888671875,
-0.021881103515625,
-0.328369140625,
-0.580078125,
0.162841796875,
0.82470703125,
0.26611328125,
0.130615234375,
-0.52490234375,
0.006313323974609375,
0.6015625,
0.91845703125,
-0.047149658203125,
0.810546875,
0.5751953125,
-0.12115478515625,
0.00823211669921875,
-0.6533203125,
0.96923828125,
0.0638427734375,
0.1600341796875,
-0.1759033203125,
0.53857421875,
-0.822265625,
-1.390625,
0.061431884765625,
0.64453125,
0.036041259765625,
-0.6533203125,
-1.2001953125,
-0.693359375,
-0.80615234375,
-0.298828125,
-0.7890625,
0.68701171875,
0.196533203125,
-0.11541748046875,
0.063720703125,
-1.0302734375,
4.2265625,
0.8515625,
0.74658203125,
0.42236328125,
0.458740234375,
1.3818359375,
0.5576171875,
-0.638671875,
-0.09576416015625,
-0.8603515625,
0.6748046875,
-0.751953125,
-0.10662841796875,
0.65234375,
0.72216796875,
0.59326171875,
-0.357177734375,
0.1103515625,
0.045074462890625,
-0.98974609375,
-0.65673828125,
-0.312255859375,
0.234375,
0.49072265625,
0.397705078125,
0.54833984375,
1.0888671875,
-0.95361328125,
-0.2626953125,
-0.344482421875,
-0.158447265625,
-0.220947265625,
0.48095703125,
0.1497802734375,
-0.54638671875,
0.69970703125,
0.1048583984375,
-1.0712890625,
0.0135498046875,
0.2149658203125,
-0.77392578125,
-0.12005615234375,
0.853515625,
-0.48681640625,
0.048553466796875,
0.84375,
-0.60693359375,
0.61767578125,
0.416748046875,
-0.72705078125,
0.8154296875,
-0.56396484375,
0.61865234375,
-0.76611328125,
-0.4521484375,
0.256591796875,
0.0171661376953125,
-0.0859375,
-0.49853515625,
0.327880859375,
0.446533203125,
0.196044921875,
0.098388671875,
0.81591796875,
-0.97314453125,
0.96240234375,
-0.001251220703125,
0.271728515625,
-0.572265625,
-0.2491455078125,
-0.55712890625,
-0.292236328125,
-0.146484375,
-0.55908203125,
0.84423828125,
0.08428955078125,
-0.459716796875,
0.273193359375,
0.669921875,
-0.5791015625,
-0.1019287109375,
-0.11761474609375,
-0.63427734375,
-0.7060546875,
0.5166015625,
0.8701171875,
-0.33154296875,
-0.533203125,
-0.242431640625,
0.84814453125,
0.87451171875,
0.7421875,
-0.027008056640625,
-0.64794921875,
-0.56201171875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Submitted Solution:
```
input(); print(len(set(''.join(sorted(set(x))) for x in input().split())))
```
Yes
| 66,995
|
[
0.468994140625,
0.1322021484375,
-0.23046875,
-0.1993408203125,
-0.4228515625,
-0.3876953125,
0.10906982421875,
0.09820556640625,
0.2491455078125,
0.63037109375,
1.08203125,
-0.58251953125,
-0.146484375,
-0.94482421875,
-0.646484375,
0.04266357421875,
-0.56982421875,
-0.5927734375,
-0.19677734375,
-0.419921875,
0.295654296875,
0.0687255859375,
-1.4794921875,
-0.043212890625,
-0.395263671875,
1.2666015625,
0.55859375,
-0.0518798828125,
0.96630859375,
1.0732421875,
-0.246826171875,
-0.223876953125,
0.90966796875,
-0.7099609375,
-0.2391357421875,
-0.4169921875,
0.87744140625,
-0.9296875,
0.037200927734375,
-1.0458984375,
0.51806640625,
-0.07464599609375,
0.1507568359375,
-0.58544921875,
-1.3662109375,
0.09539794921875,
-0.194091796875,
-0.587890625,
0.046295166015625,
-0.9365234375,
0.364501953125,
-0.50390625,
0.30517578125,
-0.4189453125,
0.20703125,
-0.1314697265625,
-0.06744384765625,
0.11676025390625,
-0.496337890625,
0.10015869140625,
0.407470703125,
0.375732421875,
-0.2061767578125,
-0.958984375,
-0.0711669921875,
0.38134765625,
0.2052001953125,
-0.08880615234375,
0.143798828125,
-0.4814453125,
-0.462158203125,
0.3505859375,
-0.31884765625,
-0.60498046875,
-0.484375,
0.0257720947265625,
-0.0126953125,
0.41259765625,
-0.84716796875,
0.271728515625,
0.298828125,
0.97998046875,
0.11358642578125,
-0.00743865966796875,
-0.35400390625,
-0.475830078125,
0.013092041015625,
0.68798828125,
0.2734375,
-0.08563232421875,
-0.1837158203125,
0.36865234375,
-0.5234375,
-0.1011962890625,
0.82373046875,
0.6064453125,
-0.373291015625,
0.5654296875,
0.359619140625,
-0.0039215087890625,
0.80517578125,
1.0244140625,
-0.5244140625,
0.92578125,
-0.66943359375,
-0.066162109375,
0.21875,
0.035369873046875,
-0.1259765625,
-0.424560546875,
0.028228759765625,
-0.322509765625,
0.1744384765625,
0.288330078125,
-0.262939453125,
0.818359375,
-0.1563720703125,
0.127685546875,
-0.732421875,
-0.054229736328125,
0.288818359375,
-0.0714111328125,
0.205322265625,
-0.147705078125,
0.2237548828125,
-0.1817626953125,
-0.8037109375,
1.1455078125,
-0.277587890625,
-0.26611328125,
0.21240234375,
0.1888427734375,
-0.525390625,
0.473388671875,
-0.335205078125,
0.52294921875,
0.231689453125,
0.56005859375,
0.7529296875,
-0.67578125,
0.8173828125,
-0.392578125,
-0.031463623046875,
1.5322265625,
0.495361328125,
0.09503173828125,
0.92529296875,
0.2178955078125,
-0.74755859375,
0.50830078125,
-0.58837890625,
0.1561279296875,
-0.111083984375,
0.2139892578125,
-0.62890625,
0.362548828125,
0.316650390625,
0.51416015625,
0.33056640625,
0.1993408203125,
-0.426513671875,
0.23291015625,
-0.355224609375,
0.7900390625,
-0.07293701171875,
0.94287109375,
-0.45703125,
-0.60205078125,
-0.1259765625,
-0.63671875,
0.63134765625,
-0.2724609375,
0.1326904296875,
0.96875,
0.51220703125,
0.7841796875,
0.59814453125,
0.24267578125,
0.1942138671875,
0.0894775390625,
-0.032623291015625,
-0.07098388671875,
0.158935546875,
0.75341796875,
0.46142578125,
0.218505859375,
-0.310302734375,
-0.291259765625,
-0.31689453125,
-0.46826171875,
0.06005859375,
0.95361328125,
-0.65478515625,
0.54150390625,
0.10040283203125,
-0.05645751953125,
-0.748046875,
-0.421875,
0.11090087890625,
-0.94970703125,
-0.292724609375,
0.74755859375,
0.015045166015625,
0.5341796875,
-0.05487060546875,
-0.546875,
0.26025390625,
1.427734375,
-0.13671875,
0.2078857421875,
0.50244140625,
-0.0836181640625,
-0.192138671875,
0.11260986328125,
0.0799560546875,
-0.097900390625,
-0.798828125,
0.9208984375,
-0.49560546875,
0.00945281982421875,
0.329345703125,
0.63330078125,
0.2259521484375,
0.483154296875,
-0.374267578125,
-0.49072265625,
0.432861328125,
0.92919921875,
0.194580078125,
0.54736328125,
0.376953125,
0.87646484375,
0.247314453125,
0.7392578125,
0.491943359375,
0.41064453125,
0.76708984375,
0.41162109375,
-0.0902099609375,
0.397216796875,
0.1907958984375,
0.279296875,
0.58837890625,
0.56298828125,
-0.072509765625,
0.5810546875,
-0.226806640625,
0.12017822265625,
-0.04620361328125,
0.8671875,
-0.1834716796875,
0.80419921875,
0.297119140625,
0.5009765625,
-1.013671875,
-0.6015625,
0.51025390625,
0.75244140625,
-0.9951171875,
-1.3310546875,
-0.197021484375,
-0.0089569091796875,
0.08660888671875,
0.1749267578125,
0.331787109375,
0.63671875,
0.1685791015625,
0.60546875,
-0.437255859375,
-0.3623046875,
-1.0234375,
-0.658203125,
-1.287109375,
-0.436767578125,
-0.548828125,
-0.10943603515625,
0.56201171875,
-1.11328125,
0.40625,
-0.221435546875,
-0.334228515625,
0.17626953125,
-0.47607421875,
0.5361328125,
-0.4462890625,
0.88232421875,
-0.32861328125,
0.51171875,
-0.006053924560546875,
0.83740234375,
-0.76806640625,
-0.6923828125,
-0.5576171875,
-0.53466796875,
0.2890625,
0.0936279296875,
0.5634765625,
-0.3046875,
-0.359130859375,
-0.8427734375,
-0.109130859375,
-0.020538330078125,
-0.40869140625,
0.254638671875,
-0.76220703125,
1.0029296875,
0.830078125,
-0.80419921875,
0.67919921875,
1.0576171875,
-0.84619140625,
0.484375,
0.23388671875,
0.34375,
-0.76025390625,
1.6064453125,
0.6982421875,
0.75048828125,
-0.15673828125,
-0.494140625,
-0.35302734375,
0.37451171875,
-0.07421875,
-0.51416015625,
-0.30224609375,
0.71533203125,
0.1632080078125,
-1.4013671875,
0.55322265625,
-0.904296875,
-0.58740234375,
-0.5322265625,
-0.6396484375,
0.8896484375,
0.73388671875,
0.215576171875,
-0.5703125,
-0.54736328125,
0.11328125,
0.888671875,
0.5703125,
-0.53125,
0.23291015625,
0.7255859375,
0.46240234375,
0.375732421875,
0.08404541015625,
-0.4384765625,
-0.1055908203125,
-0.039947509765625,
-0.0016326904296875,
0.77001953125,
-0.197998046875,
0.44091796875,
0.449951171875,
0.48828125,
-0.80126953125,
-0.2470703125,
-0.480712890625,
0.673828125,
0.382080078125,
0.413330078125,
0.472900390625,
-0.54248046875,
-0.302001953125,
-0.990234375,
0.556640625,
-0.046539306640625,
0.65771484375,
-0.91357421875,
0.6650390625,
0.1357421875,
-0.6669921875,
0.4580078125,
-0.53466796875,
-0.1630859375,
0.9033203125,
-0.50341796875,
0.9482421875,
-0.986328125,
0.21630859375,
0.25634765625,
-0.1513671875,
0.7568359375,
0.66552734375,
0.419189453125,
0.171630859375,
-0.705078125,
-0.01540374755859375,
-0.42333984375,
-0.358642578125,
-0.71875,
0.13330078125,
-0.338623046875,
-0.83251953125,
-0.79443359375,
0.896484375,
0.385986328125,
0.339599609375,
-0.147216796875,
0.46484375,
0.229736328125,
0.2125244140625,
0.6279296875,
0.086669921875,
0.625,
-0.61669921875,
1.0849609375,
0.09442138671875,
-0.81201171875,
-0.489013671875,
-0.317138671875,
-0.5927734375,
0.0687255859375,
0.0308380126953125,
0.043121337890625,
-0.896484375,
0.1605224609375,
0.2215576171875,
0.1883544921875,
-0.52978515625,
-0.022430419921875,
-0.09881591796875,
0.84228515625,
0.312744140625,
-0.96728515625,
0.1307373046875,
-0.9892578125,
0.297607421875,
0.75146484375,
-0.341064453125,
-0.1588134765625,
-0.127685546875,
-0.83544921875,
-0.8447265625,
0.08203125,
0.84814453125,
-0.2342529296875,
0.0208282470703125,
-1.248046875,
0.52685546875,
0.73583984375,
-0.421875,
0.2457275390625,
-0.411865234375,
0.42236328125,
0.110107421875,
0.406494140625,
-0.5498046875,
-0.3720703125,
-0.00003254413604736328,
-1.2294921875,
0.131103515625,
-0.64599609375,
0.8203125,
0.122802734375,
0.1134033203125,
0.044921875,
0.431396484375,
-0.1461181640625,
0.28369140625,
0.045745849609375,
0.50732421875,
-1.0556640625,
-0.363037109375,
0.389404296875,
-0.2100830078125,
-0.393310546875,
0.66796875,
-0.252685546875,
-0.50634765625,
0.04986572265625,
0.291748046875,
-0.484619140625,
0.71337890625,
-0.59228515625,
0.54345703125,
0.182373046875,
-0.64208984375,
-0.1392822265625,
-0.333740234375,
0.57958984375,
-0.0168914794921875,
-0.39453125,
-0.270263671875,
-1.2216796875,
-0.497802734375,
0.042694091796875,
-0.6083984375,
0.390380859375,
-0.1947021484375,
-0.53564453125,
0.03302001953125,
-0.23828125,
-0.51318359375,
-0.37353515625,
-0.5615234375,
-0.4609375,
0.51416015625,
0.63232421875,
0.662109375,
0.2156982421875,
-0.33154296875,
-0.330810546875,
-0.260009765625,
0.2008056640625,
-0.53271484375,
0.031585693359375,
0.1981201171875,
-0.47802734375,
-0.346435546875,
0.380615234375,
-0.1597900390625,
0.377197265625,
0.447509765625,
-0.04974365234375,
0.64892578125,
0.272705078125,
-0.48583984375,
1.46875,
-0.2066650390625,
-1.5771484375,
-0.2376708984375,
0.376953125,
-0.07708740234375,
0.79541015625,
0.2215576171875,
-0.96630859375,
-1.115234375,
-1.0634765625,
0.2169189453125,
-0.5908203125,
-0.68212890625,
-0.7080078125,
-0.54736328125,
-0.323486328125,
0.6455078125,
-0.282958984375,
-0.406494140625,
0.145751953125,
-1.109375,
-0.08441162109375,
-0.818359375,
-0.56591796875,
-0.904296875,
-0.1317138671875,
-0.351806640625,
0.9541015625,
-0.1761474609375,
0.2218017578125,
-0.03466796875,
0.006313323974609375,
-0.1531982421875,
-0.1844482421875,
-0.177490234375,
-0.338623046875,
-0.1727294921875,
-0.0338134765625,
-0.29638671875,
0.271240234375,
-0.47802734375,
0.471923828125,
-0.8720703125,
-0.2081298828125,
-0.03887939453125,
-0.54296875,
-0.255859375,
-0.681640625,
1.4443359375,
-0.24072265625,
-0.039947509765625,
-0.37109375,
0.6513671875,
0.59375,
-0.291748046875,
-0.77099609375,
-0.5498046875,
-0.45849609375,
-1.3369140625,
0.60107421875,
-0.9560546875,
0.14404296875,
-0.88525390625,
0.0242919921875,
0.97900390625,
-0.41064453125,
0.286376953125,
1.3349609375,
0.11767578125,
0.52490234375,
-0.625,
0.94189453125,
0.410888671875,
-0.64794921875,
-0.46630859375,
0.1451416015625,
-1.10546875,
0.21484375,
-0.2890625,
-0.92578125,
-0.5390625,
0.3662109375,
1.2890625,
-0.3056640625,
0.6982421875,
0.0445556640625,
-1.125,
-0.61181640625,
0.79150390625,
0.36328125,
0.6044921875,
0.765625,
-0.05963134765625,
-0.314697265625,
0.09271240234375,
-0.1134033203125,
-0.343505859375,
-0.51611328125,
1.3046875,
-0.2186279296875,
-0.88916015625,
0.52197265625,
0.8447265625,
-1.1591796875,
-0.57470703125,
-0.370361328125,
0.05938720703125,
-0.06658935546875,
-0.7373046875,
0.28662109375,
-0.153076171875,
-0.787109375,
-0.1103515625,
0.2322998046875,
0.036590576171875,
0.28564453125,
0.253173828125,
0.128173828125,
-0.466064453125,
-0.070068359375,
0.88330078125,
-0.70166015625,
-0.1650390625,
-0.82177734375,
0.2413330078125,
0.077880859375,
0.0272064208984375,
0.642578125,
-0.31591796875,
0.438720703125,
0.66796875,
-0.11199951171875,
0.54248046875,
-0.69970703125,
-0.10845947265625,
0.358642578125,
-0.496826171875,
-0.54345703125,
-0.130859375,
0.56396484375,
0.1041259765625,
0.32666015625,
-0.41015625,
0.0111846923828125,
0.30126953125,
0.038421630859375,
-0.19580078125,
-0.6943359375,
-0.59228515625,
-1.23828125,
-0.58349609375,
-0.333984375,
-0.4541015625,
0.0147247314453125,
0.5146484375,
-0.18896484375,
-1.0478515625,
0.170654296875,
0.83642578125,
-0.53662109375,
1.1513671875,
-0.82177734375,
0.368896484375,
-0.66552734375,
-0.25830078125,
-0.67626953125,
0.2393798828125,
-0.374755859375,
-0.09515380859375,
-0.443359375,
0.71728515625,
0.1734619140625,
0.53564453125,
-0.2152099609375,
0.5400390625,
-0.203125,
0.20849609375,
0.17578125,
-0.0250701904296875,
-0.2425537109375,
1.0302734375,
0.38818359375,
-0.1678466796875,
0.41162109375,
-0.466064453125,
-0.638671875,
-0.13916015625,
0.8603515625,
1.03515625,
-0.2039794921875,
-0.253662109375,
-0.339599609375,
0.26708984375,
-0.94921875,
0.2998046875,
-0.352783203125,
0.470703125,
0.1492919921875,
-0.341796875,
0.302001953125,
1.4580078125,
-0.350830078125,
0.5078125,
0.1788330078125,
0.285400390625,
0.5390625,
0.022308349609375,
0.08941650390625,
0.42041015625,
0.1650390625,
-0.48193359375,
-0.138916015625,
0.491943359375,
0.249267578125,
0.0850830078125,
-0.318603515625,
-0.74658203125,
-0.94091796875,
0.139892578125,
-0.09173583984375,
0.477294921875,
0.70361328125,
-0.408203125,
-0.1685791015625,
-0.1763916015625,
-0.67626953125,
0.271240234375,
-1.10546875,
-0.87353515625,
0.3369140625,
-0.35888671875,
-0.6318359375,
0.01116180419921875,
-0.48828125,
-0.48388671875,
0.07366943359375,
0.015625,
-0.7099609375,
-0.2919921875,
-0.51611328125,
0.654296875,
-0.245361328125,
-0.26611328125,
-0.04547119140625,
0.430908203125,
-0.424560546875,
-0.404541015625,
0.197021484375,
0.5634765625,
-0.15576171875,
-0.051025390625,
-0.9033203125,
0.345703125,
-0.1865234375,
-0.030120849609375,
-0.69384765625,
-0.09454345703125,
0.006786346435546875,
0.56982421875,
-1.193359375,
0.031982421875,
-0.1693115234375,
-0.011688232421875,
0.6513671875,
-0.55224609375,
-0.60888671875,
1.2109375,
0.57568359375,
-0.185791015625,
-0.1412353515625,
0.335205078125,
0.5810546875,
-0.0814208984375,
-0.286376953125,
-0.06829833984375,
0.72021484375,
0.53955078125,
0.619140625,
0.2120361328125,
0.448974609375,
0.72412109375,
-0.00968170166015625,
-0.41552734375,
0.322021484375,
0.49755859375,
-0.10711669921875,
0.5625,
0.011474609375,
-0.1396484375,
0.13330078125,
-0.74755859375,
0.11480712890625,
-0.18896484375,
-0.308349609375,
-0.276611328125,
-0.09869384765625,
0.751953125,
-0.3671875,
-0.162109375,
-0.1390380859375,
-0.7587890625,
0.427978515625,
0.49267578125,
0.0042877197265625,
-0.36669921875,
1.1640625,
0.7763671875,
0.353515625,
0.6923828125,
0.182373046875,
0.48046875,
-0.71240234375,
0.28173828125,
0.183837890625,
-0.19775390625,
0.17822265625,
-0.356201171875,
-1.177734375,
0.51611328125,
-0.39208984375,
-0.274658203125,
0.4306640625,
-0.82861328125,
0.21630859375,
-0.59326171875,
0.9140625,
-0.64697265625,
0.5068359375,
0.1982421875,
-0.1939697265625,
-0.48046875,
0.481201171875,
-0.1282958984375,
0.64111328125,
0.265380859375,
0.7431640625,
0.4091796875,
1.65234375,
0.68408203125,
-0.04119873046875,
0.19091796875,
0.186279296875,
-0.353271484375,
-0.69775390625,
0.083251953125,
-0.217041015625,
-0.048919677734375,
-0.46142578125,
-0.54345703125,
-0.0679931640625,
0.9853515625,
-0.371337890625,
-1.1259765625,
-0.2064208984375,
0.458984375,
-0.58251953125,
0.95654296875,
0.438720703125,
0.258544921875,
0.280517578125,
-0.073974609375,
-0.2919921875,
-0.60205078125,
0.1488037109375,
-0.260009765625,
0.64697265625,
-0.39453125,
-0.568359375,
-0.78515625,
-0.432373046875,
0.019256591796875,
0.05108642578125,
-0.328125,
-0.52978515625,
0.2086181640625,
0.82568359375,
0.22412109375,
0.11322021484375,
-0.494384765625,
0.047698974609375,
0.63134765625,
0.9345703125,
-0.100341796875,
0.83251953125,
0.58447265625,
-0.1422119140625,
0.03192138671875,
-0.61181640625,
0.953125,
0.06536865234375,
0.11114501953125,
-0.249755859375,
0.59765625,
-0.8291015625,
-1.3564453125,
0.0675048828125,
0.64111328125,
0.0239715576171875,
-0.65380859375,
-1.20703125,
-0.7138671875,
-0.8115234375,
-0.299072265625,
-0.78857421875,
0.68310546875,
0.2418212890625,
-0.09930419921875,
0.0240478515625,
-1.0615234375,
4.19140625,
0.849609375,
0.75,
0.439453125,
0.4599609375,
1.3720703125,
0.59716796875,
-0.6435546875,
-0.1785888671875,
-0.90283203125,
0.66845703125,
-0.755859375,
-0.114013671875,
0.61572265625,
0.71630859375,
0.60693359375,
-0.427490234375,
0.024810791015625,
0.08258056640625,
-0.99560546875,
-0.638671875,
-0.29345703125,
0.23583984375,
0.47265625,
0.3525390625,
0.51611328125,
1.14453125,
-0.912109375,
-0.33056640625,
-0.262451171875,
-0.1427001953125,
-0.248779296875,
0.434814453125,
0.263916015625,
-0.57958984375,
0.681640625,
0.162353515625,
-1.0419921875,
-0.0031890869140625,
0.280029296875,
-0.80224609375,
-0.1806640625,
0.869140625,
-0.501953125,
0.031524658203125,
0.81591796875,
-0.63427734375,
0.56494140625,
0.37255859375,
-0.74951171875,
0.822265625,
-0.546875,
0.61669921875,
-0.76904296875,
-0.45068359375,
0.28564453125,
0.0176239013671875,
-0.12469482421875,
-0.39990234375,
0.25146484375,
0.456298828125,
0.1417236328125,
0.0797119140625,
0.81005859375,
-1.0009765625,
0.91357421875,
-0.01345062255859375,
0.2371826171875,
-0.5859375,
-0.251220703125,
-0.498779296875,
-0.24853515625,
-0.1973876953125,
-0.46875,
0.89794921875,
0.0787353515625,
-0.493896484375,
0.273681640625,
0.634765625,
-0.62646484375,
-0.1219482421875,
-0.1341552734375,
-0.568359375,
-0.734375,
0.5751953125,
0.90283203125,
-0.331787109375,
-0.50146484375,
-0.26708984375,
0.888671875,
0.9306640625,
0.814453125,
-0.052276611328125,
-0.6162109375,
-0.55126953125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Submitted Solution:
```
n=int(input())
s=set()
l=list(input().split())
for i in l:
s.add("".join(sorted(list(set(i)))))
print(len(list(s)))
```
Yes
| 66,996
|
[
0.46728515625,
0.135009765625,
-0.2222900390625,
-0.2066650390625,
-0.40673828125,
-0.40234375,
0.11541748046875,
0.09844970703125,
0.25634765625,
0.61083984375,
1.0703125,
-0.59765625,
-0.1490478515625,
-0.94189453125,
-0.63720703125,
0.048187255859375,
-0.57861328125,
-0.60888671875,
-0.21240234375,
-0.435791015625,
0.322021484375,
0.06219482421875,
-1.48046875,
-0.036712646484375,
-0.377197265625,
1.2705078125,
0.56591796875,
-0.0697021484375,
0.95849609375,
1.0673828125,
-0.2220458984375,
-0.256591796875,
0.9345703125,
-0.69580078125,
-0.2369384765625,
-0.427734375,
0.87548828125,
-0.90380859375,
0.06024169921875,
-1.0244140625,
0.53515625,
-0.09515380859375,
0.1309814453125,
-0.59033203125,
-1.3544921875,
0.0999755859375,
-0.189697265625,
-0.6025390625,
0.0740966796875,
-0.94580078125,
0.33544921875,
-0.495361328125,
0.330322265625,
-0.41455078125,
0.191650390625,
-0.131103515625,
-0.04693603515625,
0.10906982421875,
-0.4853515625,
0.09228515625,
0.39892578125,
0.378662109375,
-0.1947021484375,
-0.9326171875,
-0.09967041015625,
0.383056640625,
0.2271728515625,
-0.0875244140625,
0.13671875,
-0.491943359375,
-0.466796875,
0.340576171875,
-0.31982421875,
-0.6220703125,
-0.4912109375,
0.045379638671875,
0.0001289844512939453,
0.39892578125,
-0.818359375,
0.259521484375,
0.28466796875,
0.9716796875,
0.09393310546875,
0.006237030029296875,
-0.352294921875,
-0.49853515625,
0.027435302734375,
0.693359375,
0.260986328125,
-0.11962890625,
-0.1715087890625,
0.357666015625,
-0.485595703125,
-0.10772705078125,
0.8232421875,
0.60107421875,
-0.383056640625,
0.55517578125,
0.363525390625,
0.00787353515625,
0.779296875,
1.0107421875,
-0.53857421875,
0.927734375,
-0.64599609375,
-0.04852294921875,
0.2264404296875,
0.0165252685546875,
-0.1375732421875,
-0.43212890625,
0.007236480712890625,
-0.322021484375,
0.19189453125,
0.292236328125,
-0.25048828125,
0.82568359375,
-0.1593017578125,
0.1507568359375,
-0.7197265625,
-0.0469970703125,
0.29638671875,
-0.07684326171875,
0.2314453125,
-0.175048828125,
0.212158203125,
-0.1920166015625,
-0.80908203125,
1.16015625,
-0.283935546875,
-0.2393798828125,
0.203125,
0.1815185546875,
-0.5244140625,
0.481689453125,
-0.339599609375,
0.51025390625,
0.21728515625,
0.54296875,
0.79345703125,
-0.69384765625,
0.82080078125,
-0.410400390625,
-0.043182373046875,
1.5390625,
0.492431640625,
0.103271484375,
0.91552734375,
0.254638671875,
-0.7392578125,
0.5244140625,
-0.611328125,
0.150390625,
-0.0986328125,
0.2384033203125,
-0.60546875,
0.3701171875,
0.337890625,
0.5087890625,
0.332275390625,
0.1834716796875,
-0.431640625,
0.21044921875,
-0.368896484375,
0.77197265625,
-0.049224853515625,
0.943359375,
-0.481201171875,
-0.59228515625,
-0.12481689453125,
-0.64501953125,
0.6142578125,
-0.2626953125,
0.1424560546875,
0.9609375,
0.50146484375,
0.7783203125,
0.60693359375,
0.23828125,
0.2159423828125,
0.07672119140625,
-0.059661865234375,
-0.0675048828125,
0.1416015625,
0.72021484375,
0.446044921875,
0.2183837890625,
-0.306884765625,
-0.300537109375,
-0.3408203125,
-0.47607421875,
0.07244873046875,
0.94580078125,
-0.64404296875,
0.533203125,
0.0947265625,
-0.10345458984375,
-0.7626953125,
-0.429443359375,
0.1051025390625,
-0.9501953125,
-0.284423828125,
0.74072265625,
0.0103607177734375,
0.51953125,
-0.04998779296875,
-0.544921875,
0.2568359375,
1.427734375,
-0.159423828125,
0.21240234375,
0.490234375,
-0.07763671875,
-0.18896484375,
0.1273193359375,
0.0723876953125,
-0.08197021484375,
-0.80615234375,
0.9404296875,
-0.489501953125,
0.00933074951171875,
0.339111328125,
0.62646484375,
0.215087890625,
0.48828125,
-0.37109375,
-0.493408203125,
0.42529296875,
0.90380859375,
0.171875,
0.55908203125,
0.37548828125,
0.8994140625,
0.227294921875,
0.7431640625,
0.48583984375,
0.410400390625,
0.76806640625,
0.408935546875,
-0.08563232421875,
0.382080078125,
0.1944580078125,
0.259521484375,
0.5810546875,
0.57666015625,
-0.0772705078125,
0.572265625,
-0.2449951171875,
0.1156005859375,
-0.053680419921875,
0.875,
-0.2012939453125,
0.8056640625,
0.27587890625,
0.47998046875,
-1.0224609375,
-0.61572265625,
0.51416015625,
0.765625,
-0.98388671875,
-1.33984375,
-0.1915283203125,
-0.0018224716186523438,
0.09527587890625,
0.161376953125,
0.340087890625,
0.64306640625,
0.170654296875,
0.60546875,
-0.448486328125,
-0.354736328125,
-1.0205078125,
-0.6533203125,
-1.28515625,
-0.42236328125,
-0.54248046875,
-0.09796142578125,
0.5673828125,
-1.123046875,
0.40625,
-0.2108154296875,
-0.32373046875,
0.1441650390625,
-0.45703125,
0.552734375,
-0.42138671875,
0.8642578125,
-0.314453125,
0.517578125,
-0.0093231201171875,
0.86328125,
-0.76220703125,
-0.65673828125,
-0.529296875,
-0.521484375,
0.27783203125,
0.111328125,
0.5400390625,
-0.32763671875,
-0.344482421875,
-0.85107421875,
-0.126708984375,
-0.0035228729248046875,
-0.38818359375,
0.25439453125,
-0.75341796875,
0.986328125,
0.8271484375,
-0.81640625,
0.6962890625,
1.0498046875,
-0.8525390625,
0.49951171875,
0.2193603515625,
0.3291015625,
-0.77001953125,
1.5830078125,
0.69921875,
0.74560546875,
-0.1754150390625,
-0.49755859375,
-0.3603515625,
0.382080078125,
-0.06976318359375,
-0.5,
-0.31103515625,
0.70947265625,
0.1683349609375,
-1.3935546875,
0.55810546875,
-0.87744140625,
-0.556640625,
-0.546875,
-0.642578125,
0.8798828125,
0.7333984375,
0.233154296875,
-0.5810546875,
-0.55224609375,
0.11968994140625,
0.90673828125,
0.5849609375,
-0.5380859375,
0.2435302734375,
0.720703125,
0.45263671875,
0.38525390625,
0.1173095703125,
-0.4365234375,
-0.11578369140625,
-0.03814697265625,
-0.02496337890625,
0.74951171875,
-0.1756591796875,
0.4326171875,
0.45166015625,
0.489990234375,
-0.78271484375,
-0.2386474609375,
-0.490966796875,
0.6787109375,
0.391357421875,
0.41796875,
0.472412109375,
-0.5380859375,
-0.29931640625,
-0.9716796875,
0.5537109375,
-0.051544189453125,
0.6572265625,
-0.93896484375,
0.67529296875,
0.1463623046875,
-0.6357421875,
0.461669921875,
-0.5361328125,
-0.1707763671875,
0.8896484375,
-0.5146484375,
0.96484375,
-0.97216796875,
0.2218017578125,
0.2467041015625,
-0.1419677734375,
0.76025390625,
0.666015625,
0.4169921875,
0.169677734375,
-0.70556640625,
-0.03131103515625,
-0.427001953125,
-0.372802734375,
-0.68701171875,
0.1337890625,
-0.322265625,
-0.8056640625,
-0.78271484375,
0.89697265625,
0.403564453125,
0.340087890625,
-0.152587890625,
0.468017578125,
0.2222900390625,
0.1917724609375,
0.61865234375,
0.08074951171875,
0.60986328125,
-0.6171875,
1.08984375,
0.0848388671875,
-0.80029296875,
-0.478515625,
-0.298095703125,
-0.58447265625,
0.046417236328125,
0.047149658203125,
0.03900146484375,
-0.9072265625,
0.15380859375,
0.20166015625,
0.1556396484375,
-0.5087890625,
-0.040374755859375,
-0.08856201171875,
0.82861328125,
0.3212890625,
-0.9638671875,
0.0997314453125,
-0.97705078125,
0.281494140625,
0.7529296875,
-0.34619140625,
-0.1578369140625,
-0.13671875,
-0.82275390625,
-0.85595703125,
0.08697509765625,
0.82568359375,
-0.251953125,
0.038482666015625,
-1.2490234375,
0.56884765625,
0.716796875,
-0.417236328125,
0.267578125,
-0.39453125,
0.407470703125,
0.09100341796875,
0.402099609375,
-0.5595703125,
-0.394287109375,
0.0105133056640625,
-1.2216796875,
0.11981201171875,
-0.63232421875,
0.82958984375,
0.12890625,
0.1029052734375,
0.05865478515625,
0.44140625,
-0.1358642578125,
0.29296875,
0.0177154541015625,
0.5224609375,
-1.0615234375,
-0.370361328125,
0.395751953125,
-0.20263671875,
-0.353515625,
0.66064453125,
-0.25341796875,
-0.501953125,
0.08563232421875,
0.302001953125,
-0.496337890625,
0.70458984375,
-0.609375,
0.548828125,
0.1683349609375,
-0.6318359375,
-0.140869140625,
-0.372802734375,
0.5693359375,
0.01140594482421875,
-0.3994140625,
-0.2685546875,
-1.2255859375,
-0.483642578125,
0.0640869140625,
-0.6015625,
0.39990234375,
-0.199951171875,
-0.5263671875,
0.0325927734375,
-0.23486328125,
-0.4931640625,
-0.356201171875,
-0.55615234375,
-0.465087890625,
0.50048828125,
0.6298828125,
0.66357421875,
0.2117919921875,
-0.3486328125,
-0.329833984375,
-0.262451171875,
0.2127685546875,
-0.53759765625,
0.04742431640625,
0.18603515625,
-0.48974609375,
-0.35107421875,
0.369873046875,
-0.173095703125,
0.37646484375,
0.43798828125,
-0.0341796875,
0.6630859375,
0.2705078125,
-0.45751953125,
1.4609375,
-0.1903076171875,
-1.5458984375,
-0.2049560546875,
0.37353515625,
-0.09088134765625,
0.7734375,
0.2486572265625,
-0.943359375,
-1.07421875,
-1.076171875,
0.223876953125,
-0.587890625,
-0.68701171875,
-0.72314453125,
-0.5625,
-0.353759765625,
0.6298828125,
-0.285400390625,
-0.419677734375,
0.12408447265625,
-1.0810546875,
-0.07415771484375,
-0.81787109375,
-0.57763671875,
-0.88818359375,
-0.174560546875,
-0.3349609375,
0.95068359375,
-0.18994140625,
0.2646484375,
-0.047760009765625,
-0.0275421142578125,
-0.1519775390625,
-0.16796875,
-0.169677734375,
-0.335205078125,
-0.1510009765625,
-0.0296173095703125,
-0.282470703125,
0.2998046875,
-0.468505859375,
0.479736328125,
-0.88623046875,
-0.2142333984375,
-0.051055908203125,
-0.5341796875,
-0.253662109375,
-0.6875,
1.4462890625,
-0.2435302734375,
-0.049957275390625,
-0.382080078125,
0.66015625,
0.59326171875,
-0.300048828125,
-0.7646484375,
-0.55224609375,
-0.46337890625,
-1.3203125,
0.59033203125,
-0.951171875,
0.151123046875,
-0.89208984375,
0.029571533203125,
0.97998046875,
-0.4140625,
0.28564453125,
1.3115234375,
0.11199951171875,
0.51318359375,
-0.62646484375,
0.9267578125,
0.407470703125,
-0.66064453125,
-0.4365234375,
0.1573486328125,
-1.1298828125,
0.236328125,
-0.2861328125,
-0.93212890625,
-0.53857421875,
0.356201171875,
1.2880859375,
-0.32177734375,
0.7041015625,
0.059844970703125,
-1.126953125,
-0.62060546875,
0.79541015625,
0.31591796875,
0.595703125,
0.763671875,
-0.044769287109375,
-0.29931640625,
0.0732421875,
-0.09332275390625,
-0.3515625,
-0.494140625,
1.2998046875,
-0.2457275390625,
-0.884765625,
0.51416015625,
0.82177734375,
-1.14453125,
-0.58642578125,
-0.365234375,
0.054901123046875,
-0.06768798828125,
-0.75146484375,
0.290283203125,
-0.16455078125,
-0.794921875,
-0.1263427734375,
0.241455078125,
0.039154052734375,
0.280029296875,
0.2310791015625,
0.1209716796875,
-0.45947265625,
-0.062744140625,
0.869140625,
-0.68701171875,
-0.162353515625,
-0.83740234375,
0.2349853515625,
0.07696533203125,
0.018463134765625,
0.63232421875,
-0.308349609375,
0.45263671875,
0.68212890625,
-0.1046142578125,
0.54541015625,
-0.71240234375,
-0.093017578125,
0.353759765625,
-0.4931640625,
-0.5419921875,
-0.1453857421875,
0.58447265625,
0.11541748046875,
0.31396484375,
-0.41455078125,
-0.0033054351806640625,
0.310546875,
0.0487060546875,
-0.1998291015625,
-0.7275390625,
-0.576171875,
-1.2314453125,
-0.58837890625,
-0.31884765625,
-0.44384765625,
0.0234527587890625,
0.495849609375,
-0.1846923828125,
-1.0517578125,
0.131591796875,
0.83984375,
-0.55517578125,
1.142578125,
-0.81298828125,
0.360107421875,
-0.6494140625,
-0.252197265625,
-0.67822265625,
0.25244140625,
-0.372802734375,
-0.09259033203125,
-0.435546875,
0.720703125,
0.1416015625,
0.5380859375,
-0.20849609375,
0.495361328125,
-0.1964111328125,
0.208740234375,
0.1781005859375,
-0.0419921875,
-0.260009765625,
1.041015625,
0.378173828125,
-0.1710205078125,
0.427978515625,
-0.458984375,
-0.61669921875,
-0.132568359375,
0.88720703125,
1.0224609375,
-0.1971435546875,
-0.242431640625,
-0.337158203125,
0.265625,
-0.93017578125,
0.292236328125,
-0.352294921875,
0.447021484375,
0.1365966796875,
-0.33642578125,
0.318603515625,
1.4697265625,
-0.332763671875,
0.497802734375,
0.181884765625,
0.2685546875,
0.541015625,
-0.00714874267578125,
0.10662841796875,
0.407470703125,
0.1630859375,
-0.48779296875,
-0.134765625,
0.49853515625,
0.2607421875,
0.099609375,
-0.32275390625,
-0.7451171875,
-0.93701171875,
0.12261962890625,
-0.1131591796875,
0.489501953125,
0.6982421875,
-0.39990234375,
-0.1629638671875,
-0.1837158203125,
-0.68115234375,
0.2744140625,
-1.103515625,
-0.86474609375,
0.337890625,
-0.364501953125,
-0.630859375,
-0.005428314208984375,
-0.4912109375,
-0.480224609375,
0.0811767578125,
0.00982666015625,
-0.71923828125,
-0.289306640625,
-0.50341796875,
0.6484375,
-0.2548828125,
-0.285400390625,
-0.049713134765625,
0.42333984375,
-0.426025390625,
-0.392822265625,
0.203125,
0.5517578125,
-0.140625,
-0.0596923828125,
-0.9150390625,
0.3271484375,
-0.157470703125,
-0.034210205078125,
-0.697265625,
-0.0927734375,
0.006103515625,
0.5537109375,
-1.1962890625,
0.01959228515625,
-0.1578369140625,
-0.003082275390625,
0.64208984375,
-0.51025390625,
-0.59228515625,
1.1953125,
0.568359375,
-0.1688232421875,
-0.12164306640625,
0.367431640625,
0.5966796875,
-0.0870361328125,
-0.29150390625,
-0.0732421875,
0.744140625,
0.5546875,
0.64453125,
0.2099609375,
0.43017578125,
0.69482421875,
-0.019622802734375,
-0.441162109375,
0.324951171875,
0.5,
-0.10321044921875,
0.57666015625,
0.026611328125,
-0.162353515625,
0.1197509765625,
-0.76904296875,
0.1015625,
-0.20166015625,
-0.2861328125,
-0.25146484375,
-0.102783203125,
0.7353515625,
-0.36669921875,
-0.1634521484375,
-0.1209716796875,
-0.751953125,
0.42333984375,
0.47265625,
0.041015625,
-0.337646484375,
1.158203125,
0.7724609375,
0.343017578125,
0.70166015625,
0.1549072265625,
0.482177734375,
-0.70703125,
0.279541015625,
0.1624755859375,
-0.18310546875,
0.1939697265625,
-0.352294921875,
-1.185546875,
0.5078125,
-0.398681640625,
-0.302001953125,
0.461669921875,
-0.845703125,
0.1932373046875,
-0.5634765625,
0.89892578125,
-0.6396484375,
0.5107421875,
0.212158203125,
-0.196044921875,
-0.453125,
0.470947265625,
-0.12322998046875,
0.66357421875,
0.2420654296875,
0.7412109375,
0.414794921875,
1.650390625,
0.68505859375,
-0.052703857421875,
0.181396484375,
0.1864013671875,
-0.319091796875,
-0.69482421875,
0.06494140625,
-0.2015380859375,
-0.048675537109375,
-0.471923828125,
-0.53173828125,
-0.0745849609375,
0.982421875,
-0.3642578125,
-1.1181640625,
-0.1973876953125,
0.456787109375,
-0.58740234375,
0.962890625,
0.449462890625,
0.2498779296875,
0.26513671875,
-0.08770751953125,
-0.30419921875,
-0.615234375,
0.142578125,
-0.25048828125,
0.65234375,
-0.39794921875,
-0.572265625,
-0.7890625,
-0.426513671875,
0.0159454345703125,
0.05609130859375,
-0.306396484375,
-0.548828125,
0.2022705078125,
0.82958984375,
0.2396240234375,
0.11676025390625,
-0.50048828125,
0.04437255859375,
0.6337890625,
0.94189453125,
-0.0888671875,
0.8525390625,
0.57080078125,
-0.134033203125,
0.0288848876953125,
-0.58447265625,
0.95849609375,
0.05145263671875,
0.12457275390625,
-0.2491455078125,
0.57470703125,
-0.83349609375,
-1.3818359375,
0.0626220703125,
0.64404296875,
0.0254974365234375,
-0.64013671875,
-1.212890625,
-0.7001953125,
-0.83642578125,
-0.29833984375,
-0.79150390625,
0.673828125,
0.246826171875,
-0.09490966796875,
0.0086212158203125,
-1.052734375,
4.203125,
0.84130859375,
0.79248046875,
0.438720703125,
0.467041015625,
1.3896484375,
0.58984375,
-0.64697265625,
-0.168701171875,
-0.9228515625,
0.65966796875,
-0.74853515625,
-0.11236572265625,
0.638671875,
0.71435546875,
0.6376953125,
-0.398193359375,
0.0263519287109375,
0.07952880859375,
-0.99609375,
-0.65625,
-0.305908203125,
0.2347412109375,
0.479736328125,
0.34326171875,
0.525390625,
1.134765625,
-0.9150390625,
-0.328125,
-0.2379150390625,
-0.13720703125,
-0.259521484375,
0.42529296875,
0.253662109375,
-0.57421875,
0.68701171875,
0.182861328125,
-1.0205078125,
-0.0229339599609375,
0.291259765625,
-0.8125,
-0.1473388671875,
0.8583984375,
-0.52685546875,
0.0257110595703125,
0.81494140625,
-0.62841796875,
0.576171875,
0.366455078125,
-0.73388671875,
0.81640625,
-0.54736328125,
0.62158203125,
-0.76953125,
-0.460205078125,
0.29443359375,
0.0223846435546875,
-0.1241455078125,
-0.40771484375,
0.262451171875,
0.45654296875,
0.15087890625,
0.06842041015625,
0.78955078125,
-0.9951171875,
0.9072265625,
-0.007549285888671875,
0.25341796875,
-0.5830078125,
-0.249755859375,
-0.5126953125,
-0.265380859375,
-0.2056884765625,
-0.461181640625,
0.90966796875,
0.07489013671875,
-0.5048828125,
0.251953125,
0.6181640625,
-0.6416015625,
-0.12017822265625,
-0.1241455078125,
-0.576171875,
-0.73291015625,
0.576171875,
0.8896484375,
-0.349609375,
-0.480224609375,
-0.269287109375,
0.88134765625,
0.9228515625,
0.7978515625,
-0.052581787109375,
-0.61083984375,
-0.529296875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Submitted Solution:
```
n=int(input())
s=input().split()
for i in range(n):
s[i]=str(set(s[i]))
print(len(set(s)))
```
No
| 66,997
|
[
0.48193359375,
0.1331787109375,
-0.223388671875,
-0.23046875,
-0.40283203125,
-0.40234375,
0.1043701171875,
0.0966796875,
0.26416015625,
0.61474609375,
1.0869140625,
-0.60205078125,
-0.16259765625,
-0.9638671875,
-0.63134765625,
0.042388916015625,
-0.5751953125,
-0.6005859375,
-0.2098388671875,
-0.439697265625,
0.332763671875,
0.057037353515625,
-1.4892578125,
-0.0254058837890625,
-0.381103515625,
1.2763671875,
0.58642578125,
-0.0687255859375,
0.96435546875,
1.0712890625,
-0.232666015625,
-0.25830078125,
0.92822265625,
-0.70263671875,
-0.2158203125,
-0.429443359375,
0.87939453125,
-0.9169921875,
0.045501708984375,
-1.0126953125,
0.51220703125,
-0.07110595703125,
0.1396484375,
-0.5888671875,
-1.3798828125,
0.10113525390625,
-0.188720703125,
-0.58349609375,
0.06707763671875,
-0.931640625,
0.323486328125,
-0.50634765625,
0.323486328125,
-0.409423828125,
0.205322265625,
-0.150146484375,
-0.04193115234375,
0.0897216796875,
-0.48583984375,
0.088623046875,
0.402587890625,
0.376708984375,
-0.193115234375,
-0.921875,
-0.09051513671875,
0.36181640625,
0.2208251953125,
-0.0892333984375,
0.1307373046875,
-0.5322265625,
-0.48095703125,
0.355224609375,
-0.346923828125,
-0.6123046875,
-0.4794921875,
0.045989990234375,
0.0200958251953125,
0.41357421875,
-0.82568359375,
0.267333984375,
0.2900390625,
0.9560546875,
0.09478759765625,
0.00009548664093017578,
-0.360595703125,
-0.51171875,
0.019775390625,
0.66015625,
0.25537109375,
-0.133544921875,
-0.1878662109375,
0.364990234375,
-0.493408203125,
-0.09027099609375,
0.8447265625,
0.60546875,
-0.38134765625,
0.54638671875,
0.36279296875,
-0.017578125,
0.7900390625,
1.0205078125,
-0.51611328125,
0.931640625,
-0.64111328125,
-0.05938720703125,
0.241455078125,
0.0301971435546875,
-0.14306640625,
-0.4208984375,
0.024993896484375,
-0.338623046875,
0.191162109375,
0.2919921875,
-0.2626953125,
0.837890625,
-0.15185546875,
0.1427001953125,
-0.69970703125,
-0.041778564453125,
0.2998046875,
-0.06640625,
0.2313232421875,
-0.163818359375,
0.2042236328125,
-0.183349609375,
-0.80810546875,
1.1611328125,
-0.2626953125,
-0.2408447265625,
0.211181640625,
0.1856689453125,
-0.53955078125,
0.4599609375,
-0.326171875,
0.51904296875,
0.2244873046875,
0.5234375,
0.7822265625,
-0.6728515625,
0.81640625,
-0.4267578125,
-0.034820556640625,
1.5400390625,
0.49560546875,
0.10772705078125,
0.91259765625,
0.2587890625,
-0.740234375,
0.53369140625,
-0.60498046875,
0.154052734375,
-0.09185791015625,
0.23974609375,
-0.5888671875,
0.363037109375,
0.334716796875,
0.50439453125,
0.303466796875,
0.2039794921875,
-0.43701171875,
0.211181640625,
-0.37353515625,
0.7861328125,
-0.05609130859375,
0.94140625,
-0.471435546875,
-0.60546875,
-0.134521484375,
-0.63330078125,
0.62353515625,
-0.2412109375,
0.1463623046875,
0.96240234375,
0.50439453125,
0.771484375,
0.61865234375,
0.251708984375,
0.1900634765625,
0.07000732421875,
-0.06658935546875,
-0.0728759765625,
0.156005859375,
0.7216796875,
0.447509765625,
0.2142333984375,
-0.3173828125,
-0.291259765625,
-0.3642578125,
-0.48828125,
0.08245849609375,
0.94677734375,
-0.6572265625,
0.51416015625,
0.1044921875,
-0.091064453125,
-0.76416015625,
-0.437255859375,
0.0762939453125,
-0.9599609375,
-0.299560546875,
0.73828125,
0.03399658203125,
0.52587890625,
-0.03582763671875,
-0.53271484375,
0.256591796875,
1.43359375,
-0.151123046875,
0.2196044921875,
0.4833984375,
-0.0963134765625,
-0.1805419921875,
0.12017822265625,
0.0921630859375,
-0.09014892578125,
-0.80615234375,
0.9267578125,
-0.466064453125,
0.0208282470703125,
0.3349609375,
0.63623046875,
0.201171875,
0.47998046875,
-0.383056640625,
-0.5029296875,
0.430419921875,
0.9111328125,
0.1788330078125,
0.5458984375,
0.390380859375,
0.89208984375,
0.2298583984375,
0.7314453125,
0.461669921875,
0.404296875,
0.755859375,
0.400390625,
-0.10272216796875,
0.39111328125,
0.192626953125,
0.267333984375,
0.55908203125,
0.55419921875,
-0.0704345703125,
0.5771484375,
-0.225341796875,
0.132080078125,
-0.03338623046875,
0.87353515625,
-0.1917724609375,
0.8173828125,
0.26171875,
0.4814453125,
-1.017578125,
-0.61083984375,
0.5185546875,
0.75830078125,
-1.0009765625,
-1.3291015625,
-0.1912841796875,
-0.005794525146484375,
0.1007080078125,
0.16943359375,
0.337158203125,
0.63720703125,
0.1883544921875,
0.603515625,
-0.457763671875,
-0.343994140625,
-1.01953125,
-0.6611328125,
-1.28125,
-0.4189453125,
-0.54541015625,
-0.10174560546875,
0.55712890625,
-1.119140625,
0.4052734375,
-0.2064208984375,
-0.32421875,
0.144287109375,
-0.43896484375,
0.5478515625,
-0.42236328125,
0.85888671875,
-0.32666015625,
0.515625,
0.00536346435546875,
0.86376953125,
-0.74609375,
-0.6455078125,
-0.5146484375,
-0.513671875,
0.258544921875,
0.10516357421875,
0.5458984375,
-0.3193359375,
-0.33935546875,
-0.8359375,
-0.1400146484375,
-0.0224609375,
-0.406982421875,
0.260986328125,
-0.73583984375,
0.99365234375,
0.8310546875,
-0.81982421875,
0.68115234375,
1.0419921875,
-0.85498046875,
0.489501953125,
0.2232666015625,
0.33642578125,
-0.76708984375,
1.5859375,
0.6953125,
0.7548828125,
-0.172607421875,
-0.517578125,
-0.35302734375,
0.387451171875,
-0.0810546875,
-0.5029296875,
-0.326416015625,
0.70654296875,
0.191162109375,
-1.390625,
0.55322265625,
-0.87841796875,
-0.544921875,
-0.55224609375,
-0.6279296875,
0.87939453125,
0.74072265625,
0.22216796875,
-0.59033203125,
-0.54248046875,
0.114501953125,
0.900390625,
0.58056640625,
-0.54638671875,
0.244140625,
0.71630859375,
0.43896484375,
0.38330078125,
0.09442138671875,
-0.430908203125,
-0.12286376953125,
-0.033966064453125,
-0.0194091796875,
0.74365234375,
-0.1888427734375,
0.42138671875,
0.466064453125,
0.465576171875,
-0.78271484375,
-0.238037109375,
-0.49169921875,
0.68994140625,
0.399169921875,
0.41162109375,
0.461669921875,
-0.533203125,
-0.310302734375,
-0.9755859375,
0.53759765625,
-0.03546142578125,
0.66796875,
-0.91015625,
0.6787109375,
0.13916015625,
-0.65576171875,
0.48583984375,
-0.53662109375,
-0.1790771484375,
0.90234375,
-0.5107421875,
0.958984375,
-0.97998046875,
0.2266845703125,
0.260498046875,
-0.1531982421875,
0.77099609375,
0.671875,
0.402587890625,
0.1607666015625,
-0.73046875,
-0.0139007568359375,
-0.390380859375,
-0.375244140625,
-0.6884765625,
0.128173828125,
-0.327392578125,
-0.7919921875,
-0.779296875,
0.8955078125,
0.392578125,
0.354736328125,
-0.1373291015625,
0.470947265625,
0.236083984375,
0.1982421875,
0.62255859375,
0.0704345703125,
0.61962890625,
-0.619140625,
1.09375,
0.07989501953125,
-0.79833984375,
-0.47412109375,
-0.31494140625,
-0.56787109375,
0.059478759765625,
0.03643798828125,
0.041412353515625,
-0.90625,
0.1287841796875,
0.210693359375,
0.162353515625,
-0.51025390625,
-0.0262298583984375,
-0.0936279296875,
0.82421875,
0.31201171875,
-0.95361328125,
0.11492919921875,
-0.99462890625,
0.294189453125,
0.72607421875,
-0.356689453125,
-0.14404296875,
-0.1409912109375,
-0.84521484375,
-0.85302734375,
0.090087890625,
0.810546875,
-0.25,
0.02972412109375,
-1.26953125,
0.5732421875,
0.7236328125,
-0.41796875,
0.27490234375,
-0.397216796875,
0.410888671875,
0.08843994140625,
0.39013671875,
-0.56201171875,
-0.379638671875,
0.00638580322265625,
-1.2421875,
0.11688232421875,
-0.62451171875,
0.84814453125,
0.130859375,
0.1019287109375,
0.046600341796875,
0.4091796875,
-0.11895751953125,
0.31005859375,
0.032012939453125,
0.5234375,
-1.05859375,
-0.37158203125,
0.386962890625,
-0.207763671875,
-0.346923828125,
0.65380859375,
-0.26513671875,
-0.5048828125,
0.083984375,
0.314208984375,
-0.49267578125,
0.69921875,
-0.61474609375,
0.5390625,
0.19091796875,
-0.62890625,
-0.1566162109375,
-0.367431640625,
0.5771484375,
-0.0015125274658203125,
-0.403564453125,
-0.26171875,
-1.2509765625,
-0.50634765625,
0.05615234375,
-0.5927734375,
0.388671875,
-0.185791015625,
-0.54296875,
0.03924560546875,
-0.23779296875,
-0.49462890625,
-0.363037109375,
-0.55322265625,
-0.475341796875,
0.5029296875,
0.6240234375,
0.6923828125,
0.21875,
-0.34326171875,
-0.332763671875,
-0.267822265625,
0.2213134765625,
-0.5283203125,
0.019195556640625,
0.1871337890625,
-0.4794921875,
-0.3388671875,
0.37890625,
-0.1702880859375,
0.375,
0.438720703125,
-0.059234619140625,
0.673828125,
0.274169921875,
-0.452880859375,
1.4638671875,
-0.195068359375,
-1.544921875,
-0.2147216796875,
0.3583984375,
-0.09814453125,
0.7783203125,
0.2279052734375,
-0.9619140625,
-1.064453125,
-1.0751953125,
0.2467041015625,
-0.58154296875,
-0.69140625,
-0.73876953125,
-0.56201171875,
-0.34228515625,
0.623046875,
-0.2880859375,
-0.42724609375,
0.1414794921875,
-1.080078125,
-0.07952880859375,
-0.8291015625,
-0.56396484375,
-0.88720703125,
-0.16455078125,
-0.327880859375,
0.939453125,
-0.198486328125,
0.2381591796875,
-0.03662109375,
-0.043548583984375,
-0.15234375,
-0.181396484375,
-0.15966796875,
-0.327392578125,
-0.1932373046875,
-0.019866943359375,
-0.270263671875,
0.290771484375,
-0.457275390625,
0.484375,
-0.85791015625,
-0.196044921875,
-0.035736083984375,
-0.54248046875,
-0.260498046875,
-0.69384765625,
1.4375,
-0.2379150390625,
-0.0478515625,
-0.385986328125,
0.6513671875,
0.6083984375,
-0.306884765625,
-0.755859375,
-0.5283203125,
-0.47119140625,
-1.318359375,
0.5751953125,
-0.9541015625,
0.158203125,
-0.890625,
0.0230865478515625,
0.9755859375,
-0.4248046875,
0.27587890625,
1.3193359375,
0.132080078125,
0.51513671875,
-0.63134765625,
0.9248046875,
0.422607421875,
-0.63818359375,
-0.45751953125,
0.160400390625,
-1.1171875,
0.2401123046875,
-0.271728515625,
-0.92578125,
-0.521484375,
0.3544921875,
1.2841796875,
-0.302490234375,
0.6884765625,
0.060089111328125,
-1.1240234375,
-0.630859375,
0.78466796875,
0.321044921875,
0.595703125,
0.75439453125,
-0.031982421875,
-0.290771484375,
0.07684326171875,
-0.098388671875,
-0.346435546875,
-0.496826171875,
1.3037109375,
-0.26123046875,
-0.89794921875,
0.50390625,
0.82958984375,
-1.1455078125,
-0.564453125,
-0.359619140625,
0.050811767578125,
-0.0640869140625,
-0.74365234375,
0.2958984375,
-0.1600341796875,
-0.802734375,
-0.11370849609375,
0.226806640625,
0.0584716796875,
0.30517578125,
0.250244140625,
0.109130859375,
-0.447021484375,
-0.03302001953125,
0.8671875,
-0.68896484375,
-0.1614990234375,
-0.83056640625,
0.23388671875,
0.0721435546875,
0.01293182373046875,
0.615234375,
-0.326171875,
0.428955078125,
0.669921875,
-0.111572265625,
0.54443359375,
-0.71044921875,
-0.08929443359375,
0.34033203125,
-0.484619140625,
-0.533203125,
-0.107421875,
0.5615234375,
0.11248779296875,
0.330810546875,
-0.408447265625,
-0.0274200439453125,
0.318603515625,
0.05657958984375,
-0.193603515625,
-0.7216796875,
-0.576171875,
-1.232421875,
-0.57470703125,
-0.3369140625,
-0.453125,
0.038787841796875,
0.494140625,
-0.18798828125,
-1.0478515625,
0.1346435546875,
0.8291015625,
-0.578125,
1.13671875,
-0.80810546875,
0.354248046875,
-0.63232421875,
-0.242431640625,
-0.6650390625,
0.2498779296875,
-0.3671875,
-0.10546875,
-0.451416015625,
0.7158203125,
0.12420654296875,
0.5283203125,
-0.216064453125,
0.52392578125,
-0.2003173828125,
0.2239990234375,
0.1885986328125,
-0.06396484375,
-0.26171875,
1.0400390625,
0.368408203125,
-0.156005859375,
0.4306640625,
-0.463623046875,
-0.60400390625,
-0.11505126953125,
0.8955078125,
1.00390625,
-0.19970703125,
-0.2291259765625,
-0.334228515625,
0.283935546875,
-0.921875,
0.281982421875,
-0.361328125,
0.445556640625,
0.1517333984375,
-0.3330078125,
0.306396484375,
1.453125,
-0.333740234375,
0.4970703125,
0.20361328125,
0.2568359375,
0.53759765625,
0.0035037994384765625,
0.0960693359375,
0.40380859375,
0.1688232421875,
-0.46435546875,
-0.13037109375,
0.47412109375,
0.2705078125,
0.07904052734375,
-0.308837890625,
-0.755859375,
-0.93310546875,
0.1302490234375,
-0.08917236328125,
0.482177734375,
0.689453125,
-0.4150390625,
-0.1602783203125,
-0.15185546875,
-0.66796875,
0.25390625,
-1.099609375,
-0.87939453125,
0.359619140625,
-0.37109375,
-0.619140625,
-0.016265869140625,
-0.489990234375,
-0.485107421875,
0.07757568359375,
0.0007371902465820312,
-0.68896484375,
-0.295166015625,
-0.521484375,
0.63916015625,
-0.25390625,
-0.289794921875,
-0.064208984375,
0.433837890625,
-0.429443359375,
-0.40234375,
0.220458984375,
0.5615234375,
-0.129638671875,
-0.06488037109375,
-0.9111328125,
0.30908203125,
-0.1429443359375,
-0.0362548828125,
-0.7041015625,
-0.09100341796875,
0.0197601318359375,
0.56201171875,
-1.216796875,
0.01367950439453125,
-0.148193359375,
0.0117034912109375,
0.65771484375,
-0.513671875,
-0.5888671875,
1.2099609375,
0.56640625,
-0.1793212890625,
-0.1346435546875,
0.37744140625,
0.57958984375,
-0.0826416015625,
-0.296630859375,
-0.0694580078125,
0.7353515625,
0.5751953125,
0.6201171875,
0.2081298828125,
0.43408203125,
0.69287109375,
-0.021484375,
-0.437255859375,
0.322021484375,
0.52099609375,
-0.117919921875,
0.5869140625,
0.0252685546875,
-0.1553955078125,
0.1080322265625,
-0.78125,
0.11273193359375,
-0.19287109375,
-0.29345703125,
-0.25341796875,
-0.09649658203125,
0.73876953125,
-0.360107421875,
-0.177734375,
-0.11553955078125,
-0.74169921875,
0.414306640625,
0.46435546875,
0.02447509765625,
-0.341796875,
1.1748046875,
0.7744140625,
0.36865234375,
0.68212890625,
0.167236328125,
0.48291015625,
-0.701171875,
0.2978515625,
0.1507568359375,
-0.1748046875,
0.192138671875,
-0.36474609375,
-1.1865234375,
0.499755859375,
-0.412353515625,
-0.2978515625,
0.438720703125,
-0.81298828125,
0.218994140625,
-0.56982421875,
0.8984375,
-0.62109375,
0.5048828125,
0.2071533203125,
-0.201171875,
-0.462890625,
0.466796875,
-0.115478515625,
0.64208984375,
0.234375,
0.74560546875,
0.4072265625,
1.6689453125,
0.6904296875,
-0.042083740234375,
0.1878662109375,
0.20849609375,
-0.329833984375,
-0.69287109375,
0.047698974609375,
-0.21484375,
-0.040130615234375,
-0.47119140625,
-0.5380859375,
-0.06719970703125,
0.97607421875,
-0.356689453125,
-1.1103515625,
-0.2022705078125,
0.447265625,
-0.60205078125,
0.95751953125,
0.42724609375,
0.23583984375,
0.26318359375,
-0.1064453125,
-0.29345703125,
-0.63671875,
0.1533203125,
-0.250244140625,
0.6474609375,
-0.400146484375,
-0.5654296875,
-0.791015625,
-0.4189453125,
0.00823974609375,
0.0430908203125,
-0.30908203125,
-0.52294921875,
0.20458984375,
0.8154296875,
0.2447509765625,
0.137451171875,
-0.485595703125,
0.0148773193359375,
0.64111328125,
0.92236328125,
-0.0885009765625,
0.8408203125,
0.57080078125,
-0.142333984375,
0.04620361328125,
-0.58935546875,
0.96728515625,
0.06787109375,
0.1177978515625,
-0.258544921875,
0.5810546875,
-0.83056640625,
-1.388671875,
0.067138671875,
0.6396484375,
0.0036373138427734375,
-0.623046875,
-1.20703125,
-0.6953125,
-0.8330078125,
-0.295166015625,
-0.8046875,
0.66162109375,
0.2218017578125,
-0.09100341796875,
0.00876617431640625,
-1.06640625,
4.20703125,
0.84765625,
0.76806640625,
0.441650390625,
0.45947265625,
1.39453125,
0.57763671875,
-0.646484375,
-0.1756591796875,
-0.923828125,
0.671875,
-0.76708984375,
-0.11669921875,
0.64208984375,
0.708984375,
0.6240234375,
-0.40234375,
0.01092529296875,
0.0748291015625,
-0.986328125,
-0.65673828125,
-0.309814453125,
0.230712890625,
0.4755859375,
0.3447265625,
0.53662109375,
1.1181640625,
-0.90283203125,
-0.33935546875,
-0.2401123046875,
-0.1329345703125,
-0.2476806640625,
0.414794921875,
0.23583984375,
-0.5732421875,
0.6796875,
0.171875,
-1.0205078125,
-0.0209503173828125,
0.296142578125,
-0.810546875,
-0.1656494140625,
0.833984375,
-0.51708984375,
0.033416748046875,
0.8203125,
-0.623046875,
0.587890625,
0.3828125,
-0.7431640625,
0.8173828125,
-0.55419921875,
0.59326171875,
-0.77880859375,
-0.443603515625,
0.292236328125,
0.03265380859375,
-0.11016845703125,
-0.40185546875,
0.259521484375,
0.459228515625,
0.156005859375,
0.07159423828125,
0.7978515625,
-0.98828125,
0.9130859375,
-0.0113372802734375,
0.25927734375,
-0.58349609375,
-0.2457275390625,
-0.5302734375,
-0.264404296875,
-0.1783447265625,
-0.4541015625,
0.9169921875,
0.0777587890625,
-0.50537109375,
0.276123046875,
0.6259765625,
-0.6328125,
-0.131103515625,
-0.10845947265625,
-0.56689453125,
-0.74755859375,
0.58154296875,
0.8984375,
-0.33837890625,
-0.466552734375,
-0.25048828125,
0.853515625,
0.921875,
0.8154296875,
-0.036163330078125,
-0.61767578125,
-0.5283203125
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Submitted Solution:
```
input()
print(len(list(set(list(map(str,map(set, input().split(' '))))))))
```
No
| 66,998
|
[
0.463134765625,
0.1324462890625,
-0.2286376953125,
-0.189208984375,
-0.43115234375,
-0.392333984375,
0.1046142578125,
0.10382080078125,
0.253173828125,
0.6123046875,
1.0888671875,
-0.587890625,
-0.14208984375,
-0.9375,
-0.65771484375,
0.031982421875,
-0.5595703125,
-0.58740234375,
-0.196044921875,
-0.4306640625,
0.303955078125,
0.0687255859375,
-1.4716796875,
-0.038604736328125,
-0.3916015625,
1.267578125,
0.55810546875,
-0.042938232421875,
0.96142578125,
1.068359375,
-0.2493896484375,
-0.2373046875,
0.91845703125,
-0.71728515625,
-0.24609375,
-0.402587890625,
0.88623046875,
-0.91552734375,
0.040313720703125,
-1.044921875,
0.5078125,
-0.07183837890625,
0.164794921875,
-0.57763671875,
-1.3505859375,
0.09356689453125,
-0.196533203125,
-0.591796875,
0.04132080078125,
-0.93359375,
0.38134765625,
-0.4990234375,
0.31103515625,
-0.427734375,
0.1904296875,
-0.13232421875,
-0.06500244140625,
0.11309814453125,
-0.48828125,
0.09063720703125,
0.408935546875,
0.367431640625,
-0.2044677734375,
-0.96923828125,
-0.0892333984375,
0.387451171875,
0.2159423828125,
-0.09075927734375,
0.137939453125,
-0.471923828125,
-0.453857421875,
0.362060546875,
-0.322265625,
-0.60302734375,
-0.4931640625,
0.00962066650390625,
-0.0119781494140625,
0.414794921875,
-0.83837890625,
0.271728515625,
0.307861328125,
0.98193359375,
0.1138916015625,
-0.0026836395263671875,
-0.35498046875,
-0.475341796875,
0.0224609375,
0.69580078125,
0.291748046875,
-0.092041015625,
-0.171142578125,
0.371826171875,
-0.5283203125,
-0.09967041015625,
0.8310546875,
0.6044921875,
-0.360107421875,
0.55908203125,
0.354736328125,
-0.007434844970703125,
0.802734375,
1.009765625,
-0.51953125,
0.939453125,
-0.66357421875,
-0.06414794921875,
0.2193603515625,
0.040130615234375,
-0.1292724609375,
-0.427490234375,
0.0156402587890625,
-0.324462890625,
0.1817626953125,
0.28271484375,
-0.259765625,
0.82080078125,
-0.151123046875,
0.14453125,
-0.72802734375,
-0.05572509765625,
0.298095703125,
-0.070556640625,
0.21337890625,
-0.158447265625,
0.2266845703125,
-0.179443359375,
-0.8037109375,
1.1484375,
-0.28857421875,
-0.251220703125,
0.2340087890625,
0.18115234375,
-0.5322265625,
0.47412109375,
-0.333251953125,
0.521484375,
0.21728515625,
0.56689453125,
0.75146484375,
-0.6787109375,
0.80859375,
-0.399169921875,
-0.037841796875,
1.537109375,
0.4892578125,
0.0843505859375,
0.9326171875,
0.221923828125,
-0.75732421875,
0.5263671875,
-0.57568359375,
0.14697265625,
-0.10943603515625,
0.219970703125,
-0.6318359375,
0.359619140625,
0.319580078125,
0.51806640625,
0.33447265625,
0.19287109375,
-0.438720703125,
0.2305908203125,
-0.376708984375,
0.783203125,
-0.08172607421875,
0.951171875,
-0.462646484375,
-0.59521484375,
-0.11865234375,
-0.6357421875,
0.61572265625,
-0.257568359375,
0.1319580078125,
0.98046875,
0.5087890625,
0.78369140625,
0.60498046875,
0.255126953125,
0.20361328125,
0.08685302734375,
-0.031402587890625,
-0.07415771484375,
0.159912109375,
0.7470703125,
0.458251953125,
0.2105712890625,
-0.3173828125,
-0.28955078125,
-0.317626953125,
-0.481201171875,
0.05377197265625,
0.9580078125,
-0.64892578125,
0.53076171875,
0.09246826171875,
-0.059906005859375,
-0.7509765625,
-0.429443359375,
0.1162109375,
-0.96533203125,
-0.30517578125,
0.74658203125,
0.0101776123046875,
0.55419921875,
-0.054473876953125,
-0.5576171875,
0.265380859375,
1.4326171875,
-0.1376953125,
0.2215576171875,
0.50341796875,
-0.085205078125,
-0.1903076171875,
0.11553955078125,
0.09332275390625,
-0.0982666015625,
-0.8115234375,
0.919921875,
-0.50390625,
0.01983642578125,
0.310302734375,
0.63427734375,
0.2235107421875,
0.46923828125,
-0.3720703125,
-0.48681640625,
0.437744140625,
0.921875,
0.165283203125,
0.5244140625,
0.36376953125,
0.869140625,
0.25146484375,
0.74169921875,
0.50146484375,
0.39697265625,
0.77001953125,
0.398681640625,
-0.09417724609375,
0.405517578125,
0.1981201171875,
0.275146484375,
0.58447265625,
0.56640625,
-0.07696533203125,
0.58056640625,
-0.247802734375,
0.1087646484375,
-0.055145263671875,
0.8671875,
-0.182373046875,
0.8046875,
0.288818359375,
0.491943359375,
-1.005859375,
-0.591796875,
0.521484375,
0.751953125,
-1.0009765625,
-1.34375,
-0.2108154296875,
-0.01995849609375,
0.09033203125,
0.1695556640625,
0.34814453125,
0.623046875,
0.174560546875,
0.59814453125,
-0.451171875,
-0.35205078125,
-1.0302734375,
-0.67333984375,
-1.298828125,
-0.445068359375,
-0.54345703125,
-0.10809326171875,
0.5693359375,
-1.1201171875,
0.4140625,
-0.2117919921875,
-0.343994140625,
0.1685791015625,
-0.47509765625,
0.537109375,
-0.4365234375,
0.8916015625,
-0.32958984375,
0.51904296875,
0.0094757080078125,
0.841796875,
-0.763671875,
-0.6904296875,
-0.55517578125,
-0.52587890625,
0.287841796875,
0.095947265625,
0.552734375,
-0.29345703125,
-0.3671875,
-0.8408203125,
-0.1094970703125,
-0.0114593505859375,
-0.406005859375,
0.256103515625,
-0.75830078125,
1.0048828125,
0.81640625,
-0.80517578125,
0.67626953125,
1.0634765625,
-0.8603515625,
0.49462890625,
0.2276611328125,
0.358642578125,
-0.76806640625,
1.611328125,
0.701171875,
0.75,
-0.1512451171875,
-0.486083984375,
-0.353759765625,
0.385986328125,
-0.07366943359375,
-0.51416015625,
-0.30029296875,
0.716796875,
0.1583251953125,
-1.3984375,
0.55078125,
-0.90185546875,
-0.57861328125,
-0.5205078125,
-0.65185546875,
0.89599609375,
0.7490234375,
0.21533203125,
-0.57275390625,
-0.5498046875,
0.10894775390625,
0.89208984375,
0.5693359375,
-0.53125,
0.237060546875,
0.732421875,
0.453857421875,
0.384765625,
0.0877685546875,
-0.43408203125,
-0.0985107421875,
-0.035400390625,
-0.006198883056640625,
0.7705078125,
-0.1981201171875,
0.431640625,
0.439453125,
0.48828125,
-0.8017578125,
-0.25244140625,
-0.491455078125,
0.6728515625,
0.362548828125,
0.4345703125,
0.47607421875,
-0.54443359375,
-0.305908203125,
-0.98583984375,
0.55810546875,
-0.04254150390625,
0.6689453125,
-0.91064453125,
0.6689453125,
0.135498046875,
-0.67626953125,
0.462158203125,
-0.5361328125,
-0.1700439453125,
0.89794921875,
-0.5009765625,
0.9443359375,
-0.9931640625,
0.220458984375,
0.263916015625,
-0.135986328125,
0.76318359375,
0.6552734375,
0.417724609375,
0.1553955078125,
-0.7119140625,
-0.0244293212890625,
-0.417236328125,
-0.364501953125,
-0.7041015625,
0.1400146484375,
-0.3310546875,
-0.8193359375,
-0.7958984375,
0.89501953125,
0.3818359375,
0.341064453125,
-0.1531982421875,
0.44677734375,
0.2291259765625,
0.22021484375,
0.6142578125,
0.08642578125,
0.62744140625,
-0.62158203125,
1.0888671875,
0.09765625,
-0.8251953125,
-0.487548828125,
-0.31591796875,
-0.59228515625,
0.0753173828125,
0.023468017578125,
0.04461669921875,
-0.90185546875,
0.15771484375,
0.23779296875,
0.1964111328125,
-0.5263671875,
-0.0195465087890625,
-0.1107177734375,
0.83447265625,
0.30615234375,
-0.96240234375,
0.1343994140625,
-0.98974609375,
0.30712890625,
0.74658203125,
-0.322021484375,
-0.15673828125,
-0.11865234375,
-0.833984375,
-0.85107421875,
0.06817626953125,
0.84912109375,
-0.233154296875,
0.03564453125,
-1.2587890625,
0.53759765625,
0.74462890625,
-0.42529296875,
0.241455078125,
-0.422119140625,
0.404052734375,
0.1136474609375,
0.40185546875,
-0.546875,
-0.378662109375,
0.0014820098876953125,
-1.2314453125,
0.11785888671875,
-0.64208984375,
0.81982421875,
0.12890625,
0.1080322265625,
0.04949951171875,
0.423583984375,
-0.1419677734375,
0.29052734375,
0.052886962890625,
0.50927734375,
-1.052734375,
-0.367919921875,
0.38818359375,
-0.197509765625,
-0.388916015625,
0.671875,
-0.255126953125,
-0.498779296875,
0.054412841796875,
0.28271484375,
-0.496337890625,
0.7080078125,
-0.5908203125,
0.53271484375,
0.1768798828125,
-0.64306640625,
-0.1435546875,
-0.35009765625,
0.57421875,
-0.0095672607421875,
-0.395263671875,
-0.258056640625,
-1.228515625,
-0.4931640625,
0.040679931640625,
-0.61767578125,
0.391357421875,
-0.1844482421875,
-0.5283203125,
0.03741455078125,
-0.240234375,
-0.50732421875,
-0.381103515625,
-0.55908203125,
-0.46337890625,
0.51171875,
0.62451171875,
0.662109375,
0.2220458984375,
-0.329345703125,
-0.318115234375,
-0.2431640625,
0.2008056640625,
-0.55517578125,
0.051849365234375,
0.182861328125,
-0.482421875,
-0.333984375,
0.389404296875,
-0.1636962890625,
0.37646484375,
0.46044921875,
-0.04339599609375,
0.640625,
0.26123046875,
-0.48486328125,
1.4716796875,
-0.2076416015625,
-1.572265625,
-0.23291015625,
0.369140625,
-0.0693359375,
0.79443359375,
0.22412109375,
-0.95068359375,
-1.119140625,
-1.0732421875,
0.1986083984375,
-0.59814453125,
-0.671875,
-0.72607421875,
-0.5390625,
-0.316650390625,
0.6484375,
-0.288818359375,
-0.393310546875,
0.147216796875,
-1.109375,
-0.08544921875,
-0.81494140625,
-0.57080078125,
-0.91845703125,
-0.135009765625,
-0.35888671875,
0.97705078125,
-0.1787109375,
0.228515625,
-0.038665771484375,
-0.00628662109375,
-0.140380859375,
-0.190185546875,
-0.16796875,
-0.34228515625,
-0.17333984375,
-0.0232391357421875,
-0.283447265625,
0.2607421875,
-0.482666015625,
0.455078125,
-0.8759765625,
-0.21923828125,
-0.042449951171875,
-0.54833984375,
-0.2470703125,
-0.685546875,
1.4345703125,
-0.2470703125,
-0.046417236328125,
-0.3984375,
0.6572265625,
0.59912109375,
-0.29833984375,
-0.76806640625,
-0.5625,
-0.4580078125,
-1.3291015625,
0.60693359375,
-0.96044921875,
0.1500244140625,
-0.87744140625,
0.023223876953125,
0.96435546875,
-0.41650390625,
0.2890625,
1.3271484375,
0.1080322265625,
0.50830078125,
-0.619140625,
0.94775390625,
0.41162109375,
-0.6533203125,
-0.477294921875,
0.16064453125,
-1.10546875,
0.21044921875,
-0.284912109375,
-0.92919921875,
-0.54931640625,
0.364501953125,
1.296875,
-0.302978515625,
0.68603515625,
0.04937744140625,
-1.126953125,
-0.6103515625,
0.8037109375,
0.365966796875,
0.5947265625,
0.76611328125,
-0.047332763671875,
-0.322509765625,
0.09033203125,
-0.09429931640625,
-0.342529296875,
-0.50341796875,
1.3056640625,
-0.2325439453125,
-0.8896484375,
0.52392578125,
0.84716796875,
-1.1572265625,
-0.57861328125,
-0.358642578125,
0.07061767578125,
-0.057159423828125,
-0.7333984375,
0.2919921875,
-0.1600341796875,
-0.78125,
-0.1021728515625,
0.2349853515625,
0.046875,
0.306640625,
0.2486572265625,
0.1239013671875,
-0.459228515625,
-0.0772705078125,
0.8779296875,
-0.71240234375,
-0.1663818359375,
-0.8173828125,
0.246337890625,
0.0850830078125,
0.03350830078125,
0.6474609375,
-0.31201171875,
0.440185546875,
0.66943359375,
-0.1220703125,
0.5498046875,
-0.70068359375,
-0.1146240234375,
0.364501953125,
-0.490966796875,
-0.53564453125,
-0.1380615234375,
0.56494140625,
0.10711669921875,
0.326171875,
-0.416259765625,
-0.00026488304138183594,
0.305419921875,
0.045440673828125,
-0.1978759765625,
-0.68896484375,
-0.591796875,
-1.2392578125,
-0.57763671875,
-0.33349609375,
-0.45703125,
0.009735107421875,
0.51611328125,
-0.18896484375,
-1.044921875,
0.15576171875,
0.84716796875,
-0.54931640625,
1.1650390625,
-0.82373046875,
0.375732421875,
-0.6689453125,
-0.2459716796875,
-0.6650390625,
0.244873046875,
-0.382080078125,
-0.09844970703125,
-0.441650390625,
0.71923828125,
0.171875,
0.54052734375,
-0.198486328125,
0.53759765625,
-0.21435546875,
0.2127685546875,
0.1842041015625,
-0.0282440185546875,
-0.21337890625,
1.0302734375,
0.384033203125,
-0.176025390625,
0.4306640625,
-0.46728515625,
-0.63427734375,
-0.138916015625,
0.865234375,
1.0205078125,
-0.2110595703125,
-0.260009765625,
-0.338134765625,
0.26806640625,
-0.94287109375,
0.289306640625,
-0.33642578125,
0.473388671875,
0.1619873046875,
-0.343505859375,
0.30517578125,
1.4580078125,
-0.351318359375,
0.5048828125,
0.1668701171875,
0.29150390625,
0.53955078125,
0.0228271484375,
0.08892822265625,
0.423583984375,
0.1729736328125,
-0.480712890625,
-0.1295166015625,
0.487060546875,
0.2467041015625,
0.088623046875,
-0.3125,
-0.75390625,
-0.94970703125,
0.1351318359375,
-0.08551025390625,
0.4560546875,
0.69677734375,
-0.41943359375,
-0.1668701171875,
-0.16455078125,
-0.66748046875,
0.25537109375,
-1.1064453125,
-0.8759765625,
0.328369140625,
-0.359619140625,
-0.6318359375,
-0.00499725341796875,
-0.48486328125,
-0.4697265625,
0.058807373046875,
0.0110626220703125,
-0.7119140625,
-0.2890625,
-0.5263671875,
0.66259765625,
-0.245849609375,
-0.271484375,
-0.055328369140625,
0.419677734375,
-0.42724609375,
-0.410888671875,
0.185791015625,
0.56103515625,
-0.1474609375,
-0.0472412109375,
-0.8974609375,
0.334228515625,
-0.19775390625,
-0.03717041015625,
-0.6884765625,
-0.0975341796875,
0.00988006591796875,
0.5703125,
-1.1953125,
0.0281829833984375,
-0.154296875,
0.002620697021484375,
0.64599609375,
-0.552734375,
-0.61572265625,
1.212890625,
0.576171875,
-0.171630859375,
-0.138671875,
0.34375,
0.5810546875,
-0.0948486328125,
-0.283447265625,
-0.07373046875,
0.7119140625,
0.54833984375,
0.62451171875,
0.2215576171875,
0.45458984375,
0.724609375,
-0.03271484375,
-0.406494140625,
0.33544921875,
0.493896484375,
-0.112548828125,
0.55615234375,
0.0141448974609375,
-0.1304931640625,
0.1324462890625,
-0.76611328125,
0.10723876953125,
-0.1956787109375,
-0.292236328125,
-0.264892578125,
-0.089599609375,
0.74853515625,
-0.368408203125,
-0.143798828125,
-0.161865234375,
-0.7509765625,
0.424072265625,
0.4873046875,
0.026092529296875,
-0.346923828125,
1.1650390625,
0.77978515625,
0.36474609375,
0.6884765625,
0.1759033203125,
0.48193359375,
-0.71875,
0.274658203125,
0.1829833984375,
-0.204833984375,
0.1798095703125,
-0.3671875,
-1.1767578125,
0.517578125,
-0.386474609375,
-0.271728515625,
0.443359375,
-0.82275390625,
0.211669921875,
-0.57275390625,
0.90771484375,
-0.65185546875,
0.5068359375,
0.2039794921875,
-0.1951904296875,
-0.481689453125,
0.459716796875,
-0.138427734375,
0.6220703125,
0.266845703125,
0.75439453125,
0.40087890625,
1.6650390625,
0.671875,
-0.0290985107421875,
0.1844482421875,
0.203369140625,
-0.341552734375,
-0.6982421875,
0.08599853515625,
-0.2320556640625,
-0.05206298828125,
-0.4716796875,
-0.5556640625,
-0.0675048828125,
0.9833984375,
-0.3740234375,
-1.1162109375,
-0.2110595703125,
0.4658203125,
-0.59228515625,
0.94775390625,
0.441650390625,
0.24462890625,
0.271728515625,
-0.07958984375,
-0.298828125,
-0.603515625,
0.148193359375,
-0.26220703125,
0.6484375,
-0.400390625,
-0.57177734375,
-0.794921875,
-0.44384765625,
0.0217132568359375,
0.04241943359375,
-0.322021484375,
-0.5341796875,
0.2056884765625,
0.8251953125,
0.2244873046875,
0.0986328125,
-0.493408203125,
0.035675048828125,
0.64013671875,
0.92724609375,
-0.09979248046875,
0.826171875,
0.5654296875,
-0.1650390625,
0.04071044921875,
-0.59912109375,
0.95166015625,
0.056396484375,
0.11102294921875,
-0.2529296875,
0.59033203125,
-0.833984375,
-1.353515625,
0.06927490234375,
0.64453125,
0.042755126953125,
-0.6572265625,
-1.216796875,
-0.71142578125,
-0.8076171875,
-0.285888671875,
-0.7802734375,
0.68212890625,
0.25634765625,
-0.09051513671875,
0.031768798828125,
-1.0615234375,
4.19140625,
0.853515625,
0.77587890625,
0.432861328125,
0.451904296875,
1.3720703125,
0.59033203125,
-0.63916015625,
-0.18212890625,
-0.8974609375,
0.6689453125,
-0.75048828125,
-0.1185302734375,
0.6279296875,
0.7138671875,
0.615234375,
-0.404052734375,
0.044677734375,
0.075439453125,
-0.9921875,
-0.62841796875,
-0.29638671875,
0.228515625,
0.4609375,
0.35888671875,
0.521484375,
1.1513671875,
-0.89453125,
-0.33984375,
-0.244140625,
-0.1490478515625,
-0.263427734375,
0.4404296875,
0.2568359375,
-0.57080078125,
0.67724609375,
0.163330078125,
-1.05078125,
-0.00446319580078125,
0.287353515625,
-0.802734375,
-0.1776123046875,
0.87939453125,
-0.50830078125,
0.02215576171875,
0.81787109375,
-0.62744140625,
0.57080078125,
0.376220703125,
-0.7451171875,
0.81982421875,
-0.52978515625,
0.62353515625,
-0.77001953125,
-0.441162109375,
0.283935546875,
0.025665283203125,
-0.1253662109375,
-0.388671875,
0.253173828125,
0.45263671875,
0.13671875,
0.0775146484375,
0.8095703125,
-1.001953125,
0.9287109375,
-0.01010894775390625,
0.2276611328125,
-0.59619140625,
-0.263427734375,
-0.4912109375,
-0.2568359375,
-0.1937255859375,
-0.474365234375,
0.91650390625,
0.08251953125,
-0.4794921875,
0.2724609375,
0.62255859375,
-0.626953125,
-0.13037109375,
-0.14453125,
-0.56640625,
-0.73046875,
0.5654296875,
0.90869140625,
-0.34375,
-0.49462890625,
-0.273681640625,
0.8994140625,
0.9228515625,
0.82470703125,
-0.05755615234375,
-0.6240234375,
-0.546875
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Submitted Solution:
```
def j(x):
return "".join(list(x))
input()
print(len(set(list(map(j,list(map(set, input().split(' '))))))))
```
No
| 66,999
|
[
0.487060546875,
0.142578125,
-0.22509765625,
-0.21484375,
-0.4267578125,
-0.41015625,
0.09619140625,
0.11993408203125,
0.25244140625,
0.61474609375,
1.09765625,
-0.583984375,
-0.1326904296875,
-0.923828125,
-0.64453125,
0.049957275390625,
-0.57275390625,
-0.5888671875,
-0.191162109375,
-0.420166015625,
0.2939453125,
0.06549072265625,
-1.4814453125,
-0.068603515625,
-0.3828125,
1.26171875,
0.56591796875,
-0.054962158203125,
0.9765625,
1.064453125,
-0.2325439453125,
-0.2626953125,
0.91259765625,
-0.7021484375,
-0.2421875,
-0.41552734375,
0.880859375,
-0.90478515625,
0.06341552734375,
-1.0400390625,
0.51220703125,
-0.1302490234375,
0.14404296875,
-0.5693359375,
-1.3671875,
0.10791015625,
-0.1705322265625,
-0.57177734375,
0.0675048828125,
-0.94091796875,
0.361083984375,
-0.4970703125,
0.318115234375,
-0.426513671875,
0.185546875,
-0.131103515625,
-0.06036376953125,
0.1282958984375,
-0.460693359375,
0.09222412109375,
0.390625,
0.383056640625,
-0.2137451171875,
-0.943359375,
-0.10272216796875,
0.3759765625,
0.22216796875,
-0.09490966796875,
0.151123046875,
-0.484130859375,
-0.443603515625,
0.353759765625,
-0.351806640625,
-0.611328125,
-0.477783203125,
0.036407470703125,
-0.0012025833129882812,
0.3916015625,
-0.82568359375,
0.253173828125,
0.3056640625,
0.97900390625,
0.10003662109375,
-0.01910400390625,
-0.377685546875,
-0.470703125,
0.04949951171875,
0.689453125,
0.2476806640625,
-0.0994873046875,
-0.1624755859375,
0.350830078125,
-0.521484375,
-0.0955810546875,
0.84130859375,
0.5947265625,
-0.345947265625,
0.5703125,
0.366455078125,
-0.020843505859375,
0.77294921875,
1.0087890625,
-0.53076171875,
0.916015625,
-0.64501953125,
-0.050079345703125,
0.2421875,
0.036407470703125,
-0.12188720703125,
-0.42529296875,
0.037384033203125,
-0.33349609375,
0.189208984375,
0.294677734375,
-0.26123046875,
0.8212890625,
-0.1591796875,
0.140380859375,
-0.7080078125,
-0.07354736328125,
0.3056640625,
-0.085205078125,
0.2095947265625,
-0.1484375,
0.238525390625,
-0.182861328125,
-0.81640625,
1.1494140625,
-0.271240234375,
-0.23291015625,
0.244384765625,
0.1817626953125,
-0.53857421875,
0.4853515625,
-0.3359375,
0.49853515625,
0.2236328125,
0.556640625,
0.765625,
-0.6689453125,
0.81201171875,
-0.38232421875,
-0.0286865234375,
1.5302734375,
0.49462890625,
0.1038818359375,
0.8935546875,
0.21630859375,
-0.759765625,
0.51904296875,
-0.57958984375,
0.1529541015625,
-0.10467529296875,
0.216064453125,
-0.61279296875,
0.35791015625,
0.3330078125,
0.50390625,
0.340576171875,
0.16455078125,
-0.431640625,
0.2047119140625,
-0.380615234375,
0.77587890625,
-0.0926513671875,
0.93017578125,
-0.4599609375,
-0.56884765625,
-0.1253662109375,
-0.61376953125,
0.6171875,
-0.233642578125,
0.1300048828125,
0.984375,
0.5009765625,
0.75146484375,
0.59326171875,
0.263671875,
0.1944580078125,
0.07684326171875,
-0.04534912109375,
-0.08135986328125,
0.1728515625,
0.74365234375,
0.4482421875,
0.191650390625,
-0.3095703125,
-0.297119140625,
-0.336181640625,
-0.48095703125,
0.058074951171875,
0.9384765625,
-0.6455078125,
0.52392578125,
0.11712646484375,
-0.0789794921875,
-0.74951171875,
-0.421875,
0.10968017578125,
-0.95703125,
-0.287841796875,
0.74951171875,
0.007717132568359375,
0.54296875,
-0.056427001953125,
-0.546875,
0.280029296875,
1.43359375,
-0.1446533203125,
0.2264404296875,
0.5,
-0.0880126953125,
-0.1646728515625,
0.10968017578125,
0.0633544921875,
-0.0830078125,
-0.7822265625,
0.91650390625,
-0.474609375,
0.0235748291015625,
0.338134765625,
0.62548828125,
0.223388671875,
0.468994140625,
-0.375244140625,
-0.501953125,
0.41748046875,
0.9150390625,
0.1558837890625,
0.5322265625,
0.38427734375,
0.8720703125,
0.2391357421875,
0.74951171875,
0.488525390625,
0.37353515625,
0.7744140625,
0.39794921875,
-0.09014892578125,
0.3916015625,
0.1802978515625,
0.262451171875,
0.55078125,
0.576171875,
-0.050567626953125,
0.59033203125,
-0.24560546875,
0.0902099609375,
-0.041839599609375,
0.8994140625,
-0.179931640625,
0.80859375,
0.296630859375,
0.482421875,
-1.0146484375,
-0.5966796875,
0.51416015625,
0.7509765625,
-0.98095703125,
-1.3203125,
-0.2138671875,
-0.00788116455078125,
0.0711669921875,
0.1353759765625,
0.337158203125,
0.626953125,
0.15576171875,
0.59912109375,
-0.449462890625,
-0.34716796875,
-1.0302734375,
-0.65771484375,
-1.283203125,
-0.44970703125,
-0.546875,
-0.099853515625,
0.56005859375,
-1.0888671875,
0.416259765625,
-0.1929931640625,
-0.3349609375,
0.1588134765625,
-0.45849609375,
0.53271484375,
-0.43212890625,
0.890625,
-0.3251953125,
0.51953125,
-0.0155029296875,
0.8369140625,
-0.74609375,
-0.6845703125,
-0.5546875,
-0.51708984375,
0.286376953125,
0.09613037109375,
0.552734375,
-0.3017578125,
-0.34814453125,
-0.81982421875,
-0.10223388671875,
-0.037841796875,
-0.397216796875,
0.2452392578125,
-0.7568359375,
0.98828125,
0.8134765625,
-0.7919921875,
0.67236328125,
1.0498046875,
-0.83740234375,
0.467529296875,
0.2122802734375,
0.371826171875,
-0.76025390625,
1.587890625,
0.68798828125,
0.75341796875,
-0.1583251953125,
-0.487548828125,
-0.355224609375,
0.387939453125,
-0.076904296875,
-0.5048828125,
-0.2998046875,
0.69921875,
0.158203125,
-1.408203125,
0.544921875,
-0.87255859375,
-0.5771484375,
-0.533203125,
-0.63232421875,
0.86279296875,
0.73193359375,
0.2454833984375,
-0.5849609375,
-0.56689453125,
0.091552734375,
0.90185546875,
0.5673828125,
-0.53857421875,
0.2205810546875,
0.69580078125,
0.439453125,
0.3828125,
0.09075927734375,
-0.452880859375,
-0.0914306640625,
-0.04132080078125,
0.005741119384765625,
0.75830078125,
-0.18408203125,
0.423095703125,
0.473876953125,
0.4521484375,
-0.783203125,
-0.248046875,
-0.475341796875,
0.67236328125,
0.37353515625,
0.425048828125,
0.466552734375,
-0.54248046875,
-0.30078125,
-0.994140625,
0.54638671875,
-0.0718994140625,
0.64453125,
-0.904296875,
0.68359375,
0.141845703125,
-0.65478515625,
0.474609375,
-0.5263671875,
-0.1943359375,
0.91650390625,
-0.488525390625,
0.9345703125,
-0.9638671875,
0.2227783203125,
0.246337890625,
-0.1492919921875,
0.75732421875,
0.68017578125,
0.420654296875,
0.162353515625,
-0.72412109375,
-0.016510009765625,
-0.43115234375,
-0.382080078125,
-0.697265625,
0.1392822265625,
-0.314453125,
-0.8203125,
-0.77001953125,
0.88623046875,
0.38525390625,
0.34326171875,
-0.140380859375,
0.483642578125,
0.2432861328125,
0.188232421875,
0.60009765625,
0.0635986328125,
0.6171875,
-0.61572265625,
1.08984375,
0.08709716796875,
-0.81787109375,
-0.494140625,
-0.303955078125,
-0.56591796875,
0.0478515625,
0.047210693359375,
0.04034423828125,
-0.88525390625,
0.135498046875,
0.23876953125,
0.1595458984375,
-0.521484375,
-0.004180908203125,
-0.08514404296875,
0.82666015625,
0.32861328125,
-0.9541015625,
0.1002197265625,
-0.98095703125,
0.272216796875,
0.736328125,
-0.328125,
-0.1640625,
-0.14453125,
-0.83740234375,
-0.85791015625,
0.08319091796875,
0.83447265625,
-0.25,
0.00960540771484375,
-1.23046875,
0.544921875,
0.7431640625,
-0.422607421875,
0.249267578125,
-0.3974609375,
0.406005859375,
0.0921630859375,
0.404052734375,
-0.5595703125,
-0.373291015625,
0.018310546875,
-1.208984375,
0.11212158203125,
-0.625,
0.82763671875,
0.1356201171875,
0.1043701171875,
0.056884765625,
0.43505859375,
-0.130615234375,
0.3095703125,
0.0391845703125,
0.521484375,
-1.0732421875,
-0.3564453125,
0.37548828125,
-0.1849365234375,
-0.342529296875,
0.64306640625,
-0.267578125,
-0.499267578125,
0.06878662109375,
0.29541015625,
-0.496337890625,
0.7177734375,
-0.57958984375,
0.5322265625,
0.208251953125,
-0.66357421875,
-0.125244140625,
-0.36865234375,
0.57666015625,
0.012451171875,
-0.397216796875,
-0.259521484375,
-1.2158203125,
-0.50390625,
0.056121826171875,
-0.61474609375,
0.387451171875,
-0.1934814453125,
-0.52734375,
0.034698486328125,
-0.2398681640625,
-0.51953125,
-0.379638671875,
-0.5205078125,
-0.457763671875,
0.494384765625,
0.62890625,
0.67578125,
0.213623046875,
-0.335205078125,
-0.323974609375,
-0.2646484375,
0.2259521484375,
-0.5400390625,
0.0513916015625,
0.194580078125,
-0.481689453125,
-0.348388671875,
0.363037109375,
-0.163330078125,
0.371337890625,
0.42578125,
-0.050445556640625,
0.658203125,
0.266357421875,
-0.464111328125,
1.4716796875,
-0.2152099609375,
-1.5771484375,
-0.2315673828125,
0.361328125,
-0.07806396484375,
0.787109375,
0.2294921875,
-0.97119140625,
-1.091796875,
-1.068359375,
0.2015380859375,
-0.595703125,
-0.66796875,
-0.72412109375,
-0.51025390625,
-0.325927734375,
0.642578125,
-0.280517578125,
-0.41796875,
0.1549072265625,
-1.0810546875,
-0.087646484375,
-0.806640625,
-0.578125,
-0.8740234375,
-0.1416015625,
-0.361328125,
0.958984375,
-0.15625,
0.23583984375,
-0.066650390625,
-0.01300811767578125,
-0.153076171875,
-0.181640625,
-0.1533203125,
-0.32861328125,
-0.19140625,
-0.041534423828125,
-0.26806640625,
0.268798828125,
-0.4775390625,
0.47119140625,
-0.85693359375,
-0.2113037109375,
-0.02691650390625,
-0.5791015625,
-0.24267578125,
-0.69775390625,
1.4306640625,
-0.25146484375,
-0.0576171875,
-0.375,
0.6337890625,
0.60791015625,
-0.300048828125,
-0.76318359375,
-0.53076171875,
-0.455078125,
-1.3310546875,
0.59716796875,
-0.951171875,
0.1361083984375,
-0.88818359375,
0.0250396728515625,
0.9853515625,
-0.42578125,
0.262939453125,
1.29296875,
0.10888671875,
0.51416015625,
-0.62548828125,
0.92529296875,
0.406494140625,
-0.658203125,
-0.47509765625,
0.1522216796875,
-1.125,
0.2330322265625,
-0.27392578125,
-0.955078125,
-0.5400390625,
0.353515625,
1.279296875,
-0.3291015625,
0.7021484375,
0.05438232421875,
-1.1337890625,
-0.66064453125,
0.78955078125,
0.337890625,
0.58154296875,
0.76171875,
-0.056121826171875,
-0.317138671875,
0.0755615234375,
-0.07745361328125,
-0.352783203125,
-0.499267578125,
1.3193359375,
-0.24462890625,
-0.90771484375,
0.517578125,
0.8525390625,
-1.1435546875,
-0.55517578125,
-0.33837890625,
0.07525634765625,
-0.04052734375,
-0.7421875,
0.291259765625,
-0.1607666015625,
-0.81689453125,
-0.1279296875,
0.2359619140625,
0.042327880859375,
0.29931640625,
0.2274169921875,
0.10498046875,
-0.451171875,
-0.063720703125,
0.857421875,
-0.6904296875,
-0.1641845703125,
-0.8076171875,
0.2471923828125,
0.0936279296875,
-0.004489898681640625,
0.6416015625,
-0.318115234375,
0.427734375,
0.67529296875,
-0.129150390625,
0.5498046875,
-0.71826171875,
-0.08453369140625,
0.3662109375,
-0.497314453125,
-0.52001953125,
-0.1422119140625,
0.564453125,
0.130615234375,
0.30078125,
-0.41015625,
0.0012645721435546875,
0.3017578125,
0.0482177734375,
-0.198486328125,
-0.693359375,
-0.5888671875,
-1.22265625,
-0.5703125,
-0.3330078125,
-0.436279296875,
0.039764404296875,
0.52685546875,
-0.202880859375,
-1.0185546875,
0.1622314453125,
0.83740234375,
-0.5595703125,
1.1435546875,
-0.8154296875,
0.36279296875,
-0.66015625,
-0.240966796875,
-0.64501953125,
0.2305908203125,
-0.3837890625,
-0.10791015625,
-0.456298828125,
0.72412109375,
0.148193359375,
0.5478515625,
-0.2266845703125,
0.5234375,
-0.20068359375,
0.2149658203125,
0.168701171875,
-0.038421630859375,
-0.25,
1.0185546875,
0.3642578125,
-0.158203125,
0.411865234375,
-0.4658203125,
-0.63427734375,
-0.10821533203125,
0.876953125,
1.02734375,
-0.1947021484375,
-0.2442626953125,
-0.3212890625,
0.26708984375,
-0.92529296875,
0.28173828125,
-0.331298828125,
0.456298828125,
0.1468505859375,
-0.33935546875,
0.290771484375,
1.466796875,
-0.335205078125,
0.5068359375,
0.1932373046875,
0.2763671875,
0.54833984375,
-0.0018720626831054688,
0.1038818359375,
0.3759765625,
0.15478515625,
-0.482177734375,
-0.137451171875,
0.498046875,
0.261962890625,
0.10101318359375,
-0.3076171875,
-0.7353515625,
-0.953125,
0.1307373046875,
-0.08746337890625,
0.463623046875,
0.6982421875,
-0.416015625,
-0.1546630859375,
-0.154296875,
-0.68310546875,
0.259765625,
-1.107421875,
-0.86279296875,
0.342041015625,
-0.37646484375,
-0.61572265625,
0.0034637451171875,
-0.476318359375,
-0.482666015625,
0.0928955078125,
0.02593994140625,
-0.68603515625,
-0.30712890625,
-0.52001953125,
0.65380859375,
-0.25732421875,
-0.28466796875,
-0.029449462890625,
0.408447265625,
-0.43310546875,
-0.388916015625,
0.205078125,
0.55712890625,
-0.1357421875,
-0.0482177734375,
-0.9013671875,
0.3271484375,
-0.157470703125,
-0.03533935546875,
-0.6953125,
-0.0941162109375,
0.01024627685546875,
0.56494140625,
-1.1923828125,
-0.005035400390625,
-0.1290283203125,
-0.01100921630859375,
0.64208984375,
-0.515625,
-0.6162109375,
1.19921875,
0.56494140625,
-0.1734619140625,
-0.1463623046875,
0.34033203125,
0.58984375,
-0.112548828125,
-0.280029296875,
-0.06646728515625,
0.7021484375,
0.5361328125,
0.630859375,
0.2437744140625,
0.42724609375,
0.7158203125,
-0.0248870849609375,
-0.432373046875,
0.324462890625,
0.50537109375,
-0.1419677734375,
0.568359375,
0.02850341796875,
-0.141357421875,
0.1180419921875,
-0.751953125,
0.1119384765625,
-0.1861572265625,
-0.2880859375,
-0.251708984375,
-0.09356689453125,
0.7548828125,
-0.403076171875,
-0.151611328125,
-0.15625,
-0.72265625,
0.404541015625,
0.484375,
0.02801513671875,
-0.3388671875,
1.1689453125,
0.76513671875,
0.373291015625,
0.701171875,
0.1600341796875,
0.48046875,
-0.712890625,
0.283203125,
0.177490234375,
-0.1962890625,
0.1917724609375,
-0.378662109375,
-1.1826171875,
0.50390625,
-0.397216796875,
-0.2783203125,
0.436767578125,
-0.82177734375,
0.2037353515625,
-0.5615234375,
0.88232421875,
-0.646484375,
0.51025390625,
0.1883544921875,
-0.19189453125,
-0.469482421875,
0.471923828125,
-0.131591796875,
0.6455078125,
0.27294921875,
0.744140625,
0.40234375,
1.64453125,
0.6728515625,
-0.0469970703125,
0.1639404296875,
0.199462890625,
-0.327880859375,
-0.6767578125,
0.06201171875,
-0.218994140625,
-0.0643310546875,
-0.4619140625,
-0.5400390625,
-0.06494140625,
0.966796875,
-0.3486328125,
-1.109375,
-0.205078125,
0.45849609375,
-0.57763671875,
0.93994140625,
0.43701171875,
0.25341796875,
0.27392578125,
-0.0826416015625,
-0.287109375,
-0.60107421875,
0.15380859375,
-0.257568359375,
0.65380859375,
-0.3955078125,
-0.56591796875,
-0.77880859375,
-0.443603515625,
0.0278778076171875,
0.0201416015625,
-0.32666015625,
-0.5576171875,
0.2152099609375,
0.8232421875,
0.24951171875,
0.1336669921875,
-0.5048828125,
0.029083251953125,
0.642578125,
0.923828125,
-0.115966796875,
0.8369140625,
0.5693359375,
-0.141357421875,
0.040985107421875,
-0.5908203125,
0.95458984375,
0.046783447265625,
0.10443115234375,
-0.25927734375,
0.5810546875,
-0.82763671875,
-1.3720703125,
0.0850830078125,
0.6416015625,
0.0277862548828125,
-0.64306640625,
-1.1982421875,
-0.69384765625,
-0.81201171875,
-0.281005859375,
-0.77587890625,
0.6572265625,
0.25390625,
-0.090576171875,
0.020416259765625,
-1.0546875,
4.22265625,
0.83984375,
0.763671875,
0.42822265625,
0.466552734375,
1.37109375,
0.57568359375,
-0.65087890625,
-0.181640625,
-0.9052734375,
0.64892578125,
-0.755859375,
-0.1025390625,
0.6171875,
0.689453125,
0.607421875,
-0.40966796875,
0.038787841796875,
0.07330322265625,
-0.98876953125,
-0.66259765625,
-0.318603515625,
0.2279052734375,
0.477294921875,
0.337646484375,
0.53173828125,
1.126953125,
-0.89697265625,
-0.352294921875,
-0.2476806640625,
-0.150146484375,
-0.256591796875,
0.425048828125,
0.265869140625,
-0.56201171875,
0.66162109375,
0.1680908203125,
-1.05078125,
-0.004001617431640625,
0.29248046875,
-0.78564453125,
-0.1572265625,
0.86083984375,
-0.5283203125,
0.034820556640625,
0.8095703125,
-0.6064453125,
0.56396484375,
0.371337890625,
-0.71826171875,
0.81201171875,
-0.54052734375,
0.63037109375,
-0.7763671875,
-0.4326171875,
0.29052734375,
0.01514434814453125,
-0.115966796875,
-0.382080078125,
0.236083984375,
0.4736328125,
0.12841796875,
0.08758544921875,
0.8212890625,
-1.009765625,
0.921875,
-0.0184326171875,
0.239990234375,
-0.5908203125,
-0.261474609375,
-0.51318359375,
-0.275390625,
-0.187744140625,
-0.456298828125,
0.9169921875,
0.0867919921875,
-0.48095703125,
0.27392578125,
0.64501953125,
-0.63134765625,
-0.12158203125,
-0.134765625,
-0.58203125,
-0.72021484375,
0.58203125,
0.88134765625,
-0.33251953125,
-0.475830078125,
-0.275146484375,
0.896484375,
0.908203125,
0.83056640625,
-0.05450439453125,
-0.6201171875,
-0.53369140625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Aramic language words can only represent objects.
Words in Aramic have special properties:
* A word is a root if it does not contain the same letter more than once.
* A root and all its permutations represent the same object.
* The root x of a word y is the word that contains all letters that appear in y in a way that each letter appears once. For example, the root of "aaaa", "aa", "aaa" is "a", the root of "aabb", "bab", "baabb", "ab" is "ab".
* Any word in Aramic represents the same object as its root.
You have an ancient script in Aramic. What is the number of different objects mentioned in the script?
Input
The first line contains one integer n (1 ≤ n ≤ 10^3) — the number of words in the script.
The second line contains n words s_1, s_2, …, s_n — the script itself. The length of each string does not exceed 10^3.
It is guaranteed that all characters of the strings are small latin letters.
Output
Output one integer — the number of different objects mentioned in the given ancient Aramic script.
Examples
Input
5
a aa aaa ab abb
Output
2
Input
3
amer arem mrea
Output
1
Note
In the first test, there are two objects mentioned. The roots that represent them are "a","ab".
In the second test, there is only one object, its root is "amer", the other strings are just permutations of "amer".
Submitted Solution:
```
input()
print(len(set(map(str,map(set,input().split())))))
```
No
| 67,000
|
[
0.482177734375,
0.134033203125,
-0.2509765625,
-0.1849365234375,
-0.408935546875,
-0.39013671875,
0.11297607421875,
0.09765625,
0.25146484375,
0.6044921875,
1.0927734375,
-0.59130859375,
-0.138427734375,
-0.9375,
-0.65185546875,
0.0297088623046875,
-0.560546875,
-0.57373046875,
-0.196533203125,
-0.4189453125,
0.3017578125,
0.0665283203125,
-1.4697265625,
-0.0438232421875,
-0.3974609375,
1.2666015625,
0.54833984375,
-0.044769287109375,
0.96923828125,
1.06640625,
-0.254638671875,
-0.236083984375,
0.91015625,
-0.71630859375,
-0.238525390625,
-0.41162109375,
0.8701171875,
-0.912109375,
0.0299530029296875,
-1.044921875,
0.5107421875,
-0.0650634765625,
0.1549072265625,
-0.57177734375,
-1.3662109375,
0.09710693359375,
-0.1885986328125,
-0.59130859375,
0.05047607421875,
-0.92822265625,
0.376708984375,
-0.490478515625,
0.30810546875,
-0.417724609375,
0.1959228515625,
-0.1339111328125,
-0.0706787109375,
0.11029052734375,
-0.484130859375,
0.07391357421875,
0.39599609375,
0.36669921875,
-0.2088623046875,
-0.9658203125,
-0.081298828125,
0.38232421875,
0.2159423828125,
-0.08489990234375,
0.1395263671875,
-0.4794921875,
-0.455322265625,
0.361328125,
-0.33837890625,
-0.61328125,
-0.481689453125,
0.00666046142578125,
-0.01160430908203125,
0.419677734375,
-0.8369140625,
0.26953125,
0.306396484375,
0.9794921875,
0.1082763671875,
-0.009674072265625,
-0.3408203125,
-0.47021484375,
0.0153350830078125,
0.69384765625,
0.272705078125,
-0.0902099609375,
-0.17919921875,
0.36865234375,
-0.5126953125,
-0.08935546875,
0.841796875,
0.60302734375,
-0.359619140625,
0.548828125,
0.3466796875,
-0.0128173828125,
0.79345703125,
1.025390625,
-0.505859375,
0.92822265625,
-0.65283203125,
-0.06427001953125,
0.2293701171875,
0.0299835205078125,
-0.1287841796875,
-0.42822265625,
0.0172271728515625,
-0.31982421875,
0.1746826171875,
0.27783203125,
-0.26220703125,
0.81982421875,
-0.1414794921875,
0.12353515625,
-0.720703125,
-0.05572509765625,
0.281982421875,
-0.0797119140625,
0.2041015625,
-0.154052734375,
0.22412109375,
-0.1759033203125,
-0.79931640625,
1.150390625,
-0.275634765625,
-0.2607421875,
0.226318359375,
0.1795654296875,
-0.52978515625,
0.474609375,
-0.33251953125,
0.52294921875,
0.219970703125,
0.556640625,
0.7392578125,
-0.67431640625,
0.80029296875,
-0.40625,
-0.0255889892578125,
1.5244140625,
0.48583984375,
0.08599853515625,
0.93701171875,
0.2197265625,
-0.75830078125,
0.52587890625,
-0.56982421875,
0.144287109375,
-0.1060791015625,
0.2183837890625,
-0.63037109375,
0.362060546875,
0.318359375,
0.5107421875,
0.3232421875,
0.201416015625,
-0.447998046875,
0.233154296875,
-0.373291015625,
0.78369140625,
-0.07904052734375,
0.95361328125,
-0.452880859375,
-0.60400390625,
-0.1251220703125,
-0.6337890625,
0.63134765625,
-0.258056640625,
0.1365966796875,
0.984375,
0.51171875,
0.7802734375,
0.59716796875,
0.256103515625,
0.194580078125,
0.07647705078125,
-0.038848876953125,
-0.0726318359375,
0.16015625,
0.7294921875,
0.453369140625,
0.2149658203125,
-0.3251953125,
-0.28857421875,
-0.317138671875,
-0.46630859375,
0.048553466796875,
0.95703125,
-0.6484375,
0.5341796875,
0.10784912109375,
-0.058807373046875,
-0.75439453125,
-0.43115234375,
0.1253662109375,
-0.96044921875,
-0.30224609375,
0.75830078125,
0.0162811279296875,
0.54052734375,
-0.051055908203125,
-0.54931640625,
0.262939453125,
1.4375,
-0.1392822265625,
0.2225341796875,
0.501953125,
-0.08856201171875,
-0.1845703125,
0.096923828125,
0.09600830078125,
-0.0997314453125,
-0.80322265625,
0.91650390625,
-0.50390625,
0.017547607421875,
0.318603515625,
0.63671875,
0.219970703125,
0.4609375,
-0.361083984375,
-0.4814453125,
0.435302734375,
0.921875,
0.1864013671875,
0.51904296875,
0.36669921875,
0.86083984375,
0.2381591796875,
0.7373046875,
0.490234375,
0.39501953125,
0.76220703125,
0.401123046875,
-0.1021728515625,
0.4013671875,
0.200927734375,
0.2705078125,
0.57275390625,
0.5576171875,
-0.07110595703125,
0.59521484375,
-0.2408447265625,
0.11248779296875,
-0.055511474609375,
0.8759765625,
-0.1820068359375,
0.798828125,
0.29638671875,
0.48974609375,
-1.013671875,
-0.59326171875,
0.50537109375,
0.74853515625,
-0.99267578125,
-1.3349609375,
-0.201416015625,
-0.0178375244140625,
0.0828857421875,
0.1739501953125,
0.346923828125,
0.6259765625,
0.1661376953125,
0.6015625,
-0.44775390625,
-0.35009765625,
-1.0283203125,
-0.66455078125,
-1.275390625,
-0.439208984375,
-0.54736328125,
-0.0955810546875,
0.5673828125,
-1.1025390625,
0.418701171875,
-0.1951904296875,
-0.33740234375,
0.1790771484375,
-0.472412109375,
0.537109375,
-0.431396484375,
0.888671875,
-0.334228515625,
0.52880859375,
0.00791168212890625,
0.83642578125,
-0.74658203125,
-0.69482421875,
-0.556640625,
-0.52490234375,
0.287353515625,
0.09857177734375,
0.5576171875,
-0.28564453125,
-0.3701171875,
-0.8291015625,
-0.0955810546875,
-0.0179290771484375,
-0.39892578125,
0.2626953125,
-0.75048828125,
0.990234375,
0.80859375,
-0.80126953125,
0.67041015625,
1.0615234375,
-0.85888671875,
0.4873046875,
0.2213134765625,
0.365234375,
-0.7587890625,
1.6103515625,
0.69482421875,
0.748046875,
-0.1431884765625,
-0.492431640625,
-0.351806640625,
0.38671875,
-0.08209228515625,
-0.51904296875,
-0.297607421875,
0.71044921875,
0.1607666015625,
-1.392578125,
0.55029296875,
-0.90185546875,
-0.58056640625,
-0.5205078125,
-0.64404296875,
0.88720703125,
0.7470703125,
0.2078857421875,
-0.58349609375,
-0.5458984375,
0.107666015625,
0.88134765625,
0.5517578125,
-0.53125,
0.2410888671875,
0.72119140625,
0.455810546875,
0.385009765625,
0.08282470703125,
-0.431396484375,
-0.1103515625,
-0.045623779296875,
0.00428009033203125,
0.75537109375,
-0.1947021484375,
0.434326171875,
0.436279296875,
0.48486328125,
-0.80224609375,
-0.2568359375,
-0.487060546875,
0.66064453125,
0.372314453125,
0.42431640625,
0.461669921875,
-0.54931640625,
-0.313232421875,
-0.98388671875,
0.560546875,
-0.031768798828125,
0.66357421875,
-0.89501953125,
0.66796875,
0.130859375,
-0.669921875,
0.464111328125,
-0.53271484375,
-0.170654296875,
0.89990234375,
-0.498291015625,
0.9501953125,
-0.98583984375,
0.2169189453125,
0.273681640625,
-0.1329345703125,
0.75244140625,
0.6630859375,
0.411376953125,
0.1593017578125,
-0.716796875,
-0.0141754150390625,
-0.421630859375,
-0.3544921875,
-0.7119140625,
0.1279296875,
-0.3212890625,
-0.83251953125,
-0.79052734375,
0.8955078125,
0.38330078125,
0.335205078125,
-0.15966796875,
0.469482421875,
0.2373046875,
0.217041015625,
0.6171875,
0.0928955078125,
0.63134765625,
-0.6142578125,
1.08984375,
0.091064453125,
-0.8369140625,
-0.479736328125,
-0.3232421875,
-0.5888671875,
0.0654296875,
0.01605224609375,
0.04400634765625,
-0.87109375,
0.1510009765625,
0.2315673828125,
0.196533203125,
-0.5283203125,
-0.025177001953125,
-0.112060546875,
0.826171875,
0.292236328125,
-0.9580078125,
0.1292724609375,
-0.98974609375,
0.309326171875,
0.7451171875,
-0.328125,
-0.1514892578125,
-0.119873046875,
-0.83447265625,
-0.85205078125,
0.07861328125,
0.83740234375,
-0.2393798828125,
0.0248260498046875,
-1.2607421875,
0.533203125,
0.74072265625,
-0.41015625,
0.2476806640625,
-0.409912109375,
0.412841796875,
0.11627197265625,
0.402587890625,
-0.548828125,
-0.373291015625,
-0.0097808837890625,
-1.2314453125,
0.1214599609375,
-0.642578125,
0.826171875,
0.13134765625,
0.09844970703125,
0.055267333984375,
0.41015625,
-0.138671875,
0.29296875,
0.061859130859375,
0.51513671875,
-1.048828125,
-0.367431640625,
0.37451171875,
-0.2041015625,
-0.397705078125,
0.66650390625,
-0.250244140625,
-0.50439453125,
0.05242919921875,
0.273193359375,
-0.486572265625,
0.71044921875,
-0.59521484375,
0.53759765625,
0.18505859375,
-0.64892578125,
-0.1390380859375,
-0.343994140625,
0.56640625,
-0.01444244384765625,
-0.382568359375,
-0.25439453125,
-1.2177734375,
-0.49560546875,
0.040679931640625,
-0.6015625,
0.384033203125,
-0.1788330078125,
-0.52294921875,
0.047393798828125,
-0.2469482421875,
-0.50830078125,
-0.385498046875,
-0.56298828125,
-0.457763671875,
0.51318359375,
0.630859375,
0.65673828125,
0.218994140625,
-0.328369140625,
-0.31884765625,
-0.244384765625,
0.197265625,
-0.5380859375,
0.042755126953125,
0.1812744140625,
-0.4775390625,
-0.3310546875,
0.379638671875,
-0.159423828125,
0.37646484375,
0.460205078125,
-0.064453125,
0.6484375,
0.26806640625,
-0.477294921875,
1.4736328125,
-0.2119140625,
-1.5732421875,
-0.2235107421875,
0.371826171875,
-0.07257080078125,
0.7841796875,
0.22509765625,
-0.95361328125,
-1.1142578125,
-1.0771484375,
0.202880859375,
-0.58740234375,
-0.6796875,
-0.70556640625,
-0.5380859375,
-0.3125,
0.64599609375,
-0.2880859375,
-0.3837890625,
0.1473388671875,
-1.099609375,
-0.08233642578125,
-0.8134765625,
-0.58154296875,
-0.92138671875,
-0.1434326171875,
-0.3583984375,
0.9697265625,
-0.1898193359375,
0.21484375,
-0.0438232421875,
-0.0042572021484375,
-0.154052734375,
-0.1923828125,
-0.1632080078125,
-0.336181640625,
-0.180908203125,
-0.0228424072265625,
-0.283447265625,
0.258544921875,
-0.468017578125,
0.463134765625,
-0.865234375,
-0.2154541015625,
-0.03607177734375,
-0.55078125,
-0.2467041015625,
-0.6865234375,
1.4384765625,
-0.2431640625,
-0.0469970703125,
-0.39404296875,
0.6435546875,
0.58984375,
-0.299560546875,
-0.775390625,
-0.548828125,
-0.452392578125,
-1.322265625,
0.6005859375,
-0.95947265625,
0.146240234375,
-0.8701171875,
0.035797119140625,
0.962890625,
-0.411376953125,
0.2841796875,
1.30859375,
0.10577392578125,
0.50146484375,
-0.619140625,
0.94287109375,
0.41162109375,
-0.63623046875,
-0.47607421875,
0.1612548828125,
-1.09765625,
0.216552734375,
-0.27734375,
-0.9130859375,
-0.5322265625,
0.361083984375,
1.287109375,
-0.312255859375,
0.6884765625,
0.0421142578125,
-1.12109375,
-0.61572265625,
0.794921875,
0.361328125,
0.5908203125,
0.7578125,
-0.058563232421875,
-0.31982421875,
0.092041015625,
-0.09478759765625,
-0.345703125,
-0.5009765625,
1.2978515625,
-0.227783203125,
-0.88037109375,
0.51220703125,
0.84228515625,
-1.150390625,
-0.56494140625,
-0.363037109375,
0.07110595703125,
-0.05853271484375,
-0.736328125,
0.295654296875,
-0.1732177734375,
-0.77880859375,
-0.105224609375,
0.2364501953125,
0.060028076171875,
0.305419921875,
0.25634765625,
0.1201171875,
-0.4716796875,
-0.06939697265625,
0.8671875,
-0.7138671875,
-0.16064453125,
-0.8037109375,
0.2437744140625,
0.0849609375,
0.027252197265625,
0.642578125,
-0.32275390625,
0.43310546875,
0.666015625,
-0.12371826171875,
0.546875,
-0.70068359375,
-0.109619140625,
0.361328125,
-0.48388671875,
-0.53369140625,
-0.1392822265625,
0.56005859375,
0.10858154296875,
0.32080078125,
-0.401611328125,
-0.00749969482421875,
0.29443359375,
0.037017822265625,
-0.181640625,
-0.68505859375,
-0.59326171875,
-1.2373046875,
-0.5810546875,
-0.325927734375,
-0.4501953125,
0.02642822265625,
0.50830078125,
-0.1971435546875,
-1.0498046875,
0.156494140625,
0.8349609375,
-0.55126953125,
1.16015625,
-0.81640625,
0.369140625,
-0.6650390625,
-0.2470703125,
-0.65576171875,
0.2403564453125,
-0.3740234375,
-0.10833740234375,
-0.441650390625,
0.72119140625,
0.17822265625,
0.52685546875,
-0.208984375,
0.53466796875,
-0.2076416015625,
0.2161865234375,
0.181640625,
-0.02056884765625,
-0.2225341796875,
1.037109375,
0.37841796875,
-0.1651611328125,
0.427490234375,
-0.463623046875,
-0.646484375,
-0.1292724609375,
0.84326171875,
1.02734375,
-0.2095947265625,
-0.260498046875,
-0.339599609375,
0.272216796875,
-0.94091796875,
0.286376953125,
-0.345703125,
0.47314453125,
0.1630859375,
-0.33837890625,
0.30322265625,
1.4541015625,
-0.34912109375,
0.50537109375,
0.1763916015625,
0.2900390625,
0.53955078125,
0.0192413330078125,
0.093994140625,
0.41650390625,
0.1700439453125,
-0.49462890625,
-0.1348876953125,
0.48876953125,
0.24951171875,
0.08697509765625,
-0.310791015625,
-0.7529296875,
-0.947265625,
0.139892578125,
-0.06390380859375,
0.4599609375,
0.69482421875,
-0.4072265625,
-0.1591796875,
-0.1551513671875,
-0.67529296875,
0.25537109375,
-1.1044921875,
-0.8623046875,
0.329345703125,
-0.36376953125,
-0.6279296875,
-0.0082855224609375,
-0.47802734375,
-0.4736328125,
0.056793212890625,
0.01416778564453125,
-0.70361328125,
-0.2939453125,
-0.54443359375,
0.66357421875,
-0.2410888671875,
-0.269775390625,
-0.05621337890625,
0.4267578125,
-0.421875,
-0.405029296875,
0.199951171875,
0.564453125,
-0.150390625,
-0.05059814453125,
-0.8984375,
0.337646484375,
-0.1888427734375,
-0.036956787109375,
-0.6943359375,
-0.09661865234375,
0.01277923583984375,
0.576171875,
-1.1884765625,
0.041656494140625,
-0.1544189453125,
0.00592041015625,
0.65380859375,
-0.55859375,
-0.599609375,
1.1953125,
0.5673828125,
-0.1597900390625,
-0.1474609375,
0.3505859375,
0.576171875,
-0.0999755859375,
-0.278076171875,
-0.07330322265625,
0.693359375,
0.54296875,
0.61083984375,
0.22216796875,
0.46142578125,
0.72705078125,
-0.04736328125,
-0.40869140625,
0.3291015625,
0.505859375,
-0.12274169921875,
0.55810546875,
0.0200653076171875,
-0.1231689453125,
0.11907958984375,
-0.763671875,
0.11138916015625,
-0.17919921875,
-0.294921875,
-0.26513671875,
-0.07916259765625,
0.74658203125,
-0.36669921875,
-0.1583251953125,
-0.1507568359375,
-0.75,
0.426513671875,
0.4921875,
0.0213623046875,
-0.359130859375,
1.1748046875,
0.77197265625,
0.3505859375,
0.671875,
0.174560546875,
0.479736328125,
-0.7099609375,
0.28076171875,
0.177490234375,
-0.2027587890625,
0.1796875,
-0.355712890625,
-1.1748046875,
0.52099609375,
-0.384033203125,
-0.260498046875,
0.4228515625,
-0.80419921875,
0.2227783203125,
-0.5810546875,
0.91064453125,
-0.65234375,
0.5,
0.1949462890625,
-0.18896484375,
-0.47265625,
0.45849609375,
-0.1385498046875,
0.62255859375,
0.26708984375,
0.74462890625,
0.392822265625,
1.6513671875,
0.66748046875,
-0.0367431640625,
0.190185546875,
0.19189453125,
-0.349365234375,
-0.70068359375,
0.0858154296875,
-0.2255859375,
-0.0577392578125,
-0.458251953125,
-0.560546875,
-0.059783935546875,
0.984375,
-0.369140625,
-1.11328125,
-0.2078857421875,
0.458740234375,
-0.5849609375,
0.93359375,
0.43408203125,
0.239013671875,
0.261474609375,
-0.0743408203125,
-0.306396484375,
-0.599609375,
0.1448974609375,
-0.259765625,
0.646484375,
-0.39453125,
-0.5654296875,
-0.78271484375,
-0.4404296875,
0.018798828125,
0.03717041015625,
-0.32421875,
-0.5302734375,
0.2042236328125,
0.82470703125,
0.22900390625,
0.09344482421875,
-0.48486328125,
0.027801513671875,
0.62939453125,
0.91943359375,
-0.1048583984375,
0.81982421875,
0.57763671875,
-0.1650390625,
0.0400390625,
-0.60205078125,
0.95556640625,
0.056671142578125,
0.10650634765625,
-0.252197265625,
0.58251953125,
-0.82666015625,
-1.353515625,
0.08526611328125,
0.62548828125,
0.0386962890625,
-0.6552734375,
-1.2041015625,
-0.70849609375,
-0.79345703125,
-0.2822265625,
-0.7802734375,
0.6796875,
0.256591796875,
-0.0931396484375,
0.031982421875,
-1.0654296875,
4.2109375,
0.84912109375,
0.7548828125,
0.424560546875,
0.453369140625,
1.3720703125,
0.59619140625,
-0.630859375,
-0.185302734375,
-0.8974609375,
0.66748046875,
-0.74853515625,
-0.11273193359375,
0.626953125,
0.71142578125,
0.59765625,
-0.404052734375,
0.04443359375,
0.0687255859375,
-0.98388671875,
-0.63037109375,
-0.30859375,
0.236328125,
0.466064453125,
0.366943359375,
0.52099609375,
1.1376953125,
-0.8974609375,
-0.332763671875,
-0.25244140625,
-0.14501953125,
-0.26123046875,
0.429443359375,
0.251220703125,
-0.5888671875,
0.66796875,
0.158447265625,
-1.05859375,
0.004199981689453125,
0.29638671875,
-0.80712890625,
-0.181640625,
0.87744140625,
-0.49853515625,
0.03863525390625,
0.814453125,
-0.62841796875,
0.564453125,
0.37255859375,
-0.74462890625,
0.8125,
-0.53857421875,
0.61962890625,
-0.7685546875,
-0.4384765625,
0.286376953125,
0.006130218505859375,
-0.12188720703125,
-0.39599609375,
0.255859375,
0.451171875,
0.1334228515625,
0.072265625,
0.80224609375,
-0.9833984375,
0.9384765625,
-0.00943756103515625,
0.2337646484375,
-0.59423828125,
-0.257568359375,
-0.48876953125,
-0.2431640625,
-0.1982421875,
-0.461181640625,
0.9091796875,
0.0599365234375,
-0.48486328125,
0.2724609375,
0.623046875,
-0.61767578125,
-0.1400146484375,
-0.134521484375,
-0.5625,
-0.73193359375,
0.56591796875,
0.90673828125,
-0.336181640625,
-0.489501953125,
-0.27392578125,
0.8974609375,
0.92041015625,
0.80810546875,
-0.0623779296875,
-0.623046875,
-0.5439453125
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
International Coding Procedures Company (ICPC) writes all its code in Jedi Script (JS) programming language. JS does not get compiled, but is delivered for execution in its source form. Sources contain comments, extra whitespace (including trailing and leading spaces), and other non-essential features that make them quite large but do not contribute to the semantics of the code, so the process of minification is performed on source files before their delivery to execution to compress sources while preserving their semantics.
You are hired by ICPC to write JS minifier for ICPC. Fortunately, ICPC adheres to very strict programming practices and their JS sources are quite restricted in grammar. They work only on integer algorithms and do not use floating point numbers and strings.
Every JS source contains a sequence of lines. Each line contains zero or more tokens that can be separated by spaces. On each line, a part of the line that starts with a hash character ('#' code 35), including the hash character itself, is treated as a comment and is ignored up to the end of the line.
Each line is parsed into a sequence of tokens from left to right by repeatedly skipping spaces and finding the longest possible token starting at the current parsing position, thus transforming the source code into a sequence of tokens. All the possible tokens are listed below:
* A reserved token is any kind of operator, separator, literal, reserved word, or a name of a library function that should be preserved during the minification process. Reserved tokens are fixed strings of non-space ASCII characters that do not contain the hash character ('#' code 35). All reserved tokens are given as an input to the minification process.
* A number token consists of a sequence of digits, where a digit is a character from zero ('0') to nine ('9') inclusive.
* A word token consists of a sequence of characters from the following set: lowercase letters, uppercase letters, digits, underscore ('_' code 95), and dollar sign ('$' code 36). A word does not start with a digit.
Note, that during parsing the longest sequence of characters that satisfies either a number or a word definition, but that appears in the list of reserved tokens, is considered to be a reserved token instead.
During the minification process words are renamed in a systematic fashion using the following algorithm:
1. Take a list of words that consist only of lowercase letters ordered first by their length, then lexicographically: "a", "b", ..., "z", "aa", "ab", ..., excluding reserved tokens, since they are not considered to be words. This is the target word list.
2. Rename the first word encountered in the input token sequence to the first word in the target word list and all further occurrences of the same word in the input token sequence, too. Rename the second new word encountered in the input token sequence to the second word in the target word list, and so on.
The goal of the minification process is to convert the given source to the shortest possible line (counting spaces) that still parses to the same sequence of tokens with the correspondingly renamed words using these JS parsing rules.
Input
The first line of the input contains a single integer n (0 ≤ n ≤ 40) — the number of reserved tokens.
The second line of the input contains the list of reserved tokens separated by spaces without repetitions in the list. Each reserved token is at least one and at most 20 characters long and contains only characters with ASCII codes from 33 (exclamation mark) to 126 (tilde) inclusive, with exception of a hash character ('#' code 35).
The third line of the input contains a single integer m (1 ≤ m ≤ 40) — the number of lines in the input source code.
Next m lines contain the input source, each source line is at most 80 characters long (counting leading and trailing spaces). Each line contains only characters with ASCII codes from 32 (space) to 126 (tilde) inclusive. The source code is valid and fully parses into a sequence of tokens.
Output
Write to the output a single line that is the result of the minification process on the input source code. The output source line shall parse to the same sequence of tokens as the input source with the correspondingly renamed words and shall contain the minimum possible number of spaces needed for that. If there are multiple ways to insert the minimum possible number of spaces into the output, use any way.
Examples
Input
16
fun while return var { } ( ) , ; > = + ++ - --
9
fun fib(num) { # compute fibs
var return_value = 1, prev = 0, temp;
while (num > 0) {
temp = return_value; return_value = return_value + prev;
prev = temp;
num--;
}
return return_value;
}
Output
fun a(b){var c=1,d=0,e;while(b>0){e=c;c=c+d;d=e;b--;}return c;}
Input
10
( ) + ++ : -> >> >>: b c)
2
($val1++ + +4 kb) >> :out
b-> + 10 >>: t # using >>:
Output
(a+++ +4c )>> :d b->+10>>:e
Tags: greedy, implementation
Correct Solution:
```
from collections import defaultdict
n = int(input())
reserved = set(input().split())
m = int(input())
lines = [ input().split('#')[0].split() for _ in range(m) ]
tokens = sum(lines, [])
def isword(t):
return not t[0].isdigit() and all(c.isalnum() or c == '_' or c == '$' for c in t)
def ok(t):
return t in reserved or t.isdigit() or isword(t)
def tokenize(t):
res = []
i = 0
n = len(t)
while i < n:
for j in range(n, i, -1):
if ok(t[i:j]):
res.append(t[i:j])
i = j
break
return res
tokens = sum(map(tokenize, tokens), [])
dig = 1
k = 0
limit = 26
def next_token():
global dig, k, limit
if k == limit:
k = 0
dig += 1
limit = 26 ** dig
w = []
l = k
for _ in range(dig):
w += chr(ord('a') + l % 26)
l //= 26
w = ''.join(reversed(w))
k += 1
if w in reserved:
return next_token()
return w
dc = defaultdict(next_token)
def replace(t):
if t in reserved or t.isdigit():
return t
return dc[t]
def can_append(a, b, bg):
if len(a) == 0:
return True
#if a not in reserved and b not in reserved:
# return False
for i, s in enumerate(bg):
if i + 1 != len(bg) and len(a) - s > 21:
continue
for i in range(len(b)):
if ok(a[s:] + b[:i+1]):
#print(a, b, a[s:] + b[:i+1])
return False
#print('can append', a, b)
return True
res = ['']
begin = []
for t in map(replace, tokens):
if not can_append(res[-1], t, begin):
res.append('')
begin = []
begin.append(len(res[-1]))
res[-1] += t
print(' '.join(res))
```
| 67,283
|
[
0.18212890625,
-0.42626953125,
-0.1820068359375,
0.2744140625,
-0.62060546875,
-0.356201171875,
0.047149658203125,
0.1824951171875,
-0.2237548828125,
0.294921875,
0.349853515625,
0.03558349609375,
0.07696533203125,
-0.826171875,
-0.72216796875,
0.31201171875,
-0.57763671875,
-0.4267578125,
-0.65380859375,
-0.10601806640625,
-0.26953125,
-0.033966064453125,
-1.576171875,
-0.337646484375,
-0.6982421875,
1.1953125,
-0.00799560546875,
-0.21240234375,
0.95556640625,
0.880859375,
-0.5732421875,
-0.412109375,
0.318359375,
-0.74560546875,
-0.258544921875,
-0.6845703125,
0.71240234375,
-0.51904296875,
-0.1282958984375,
-0.114013671875,
-0.208740234375,
-0.5244140625,
0.316162109375,
-0.8349609375,
-1.3056640625,
-0.036224365234375,
-0.2259521484375,
-0.1962890625,
-0.10382080078125,
-0.47900390625,
0.055419921875,
0.3359375,
0.30615234375,
-0.1839599609375,
-0.2259521484375,
-0.3310546875,
0.12286376953125,
-0.042999267578125,
-0.389892578125,
-0.027069091796875,
-0.470703125,
0.2047119140625,
-0.0521240234375,
-0.57373046875,
-0.1683349609375,
0.8125,
-0.267822265625,
0.257080078125,
0.06463623046875,
-0.5341796875,
0.035552978515625,
0.393798828125,
-0.470947265625,
-0.333984375,
-0.6005859375,
-0.194580078125,
0.5107421875,
0.239990234375,
-0.58984375,
0.52587890625,
0.319580078125,
0.9091796875,
0.170166015625,
0.142578125,
-0.5458984375,
-0.55029296875,
0.37841796875,
0.1976318359375,
0.07269287109375,
-0.1849365234375,
-0.12127685546875,
0.5302734375,
-0.564453125,
-0.055145263671875,
0.93896484375,
0.47802734375,
-0.203857421875,
0.69921875,
-0.1881103515625,
0.434326171875,
0.6025390625,
0.853515625,
-0.84912109375,
0.7041015625,
-0.263671875,
0.16259765625,
0.1129150390625,
0.019317626953125,
-0.284423828125,
-0.11285400390625,
0.035430908203125,
-0.91162109375,
-0.0185546875,
-0.43603515625,
-0.1055908203125,
0.87890625,
-0.32666015625,
0.400146484375,
-1.0068359375,
0.26953125,
0.615234375,
-0.6142578125,
0.35888671875,
-0.314697265625,
0.387451171875,
-0.373046875,
0.1142578125,
0.60107421875,
-0.34130859375,
-0.09173583984375,
0.6279296875,
-0.241455078125,
-0.05767822265625,
0.478271484375,
0.280029296875,
0.79833984375,
0.0257110595703125,
0.397705078125,
0.56787109375,
-0.362548828125,
0.09014892578125,
0.1575927734375,
-0.0809326171875,
1.3740234375,
0.36572265625,
0.188720703125,
0.01837158203125,
0.39990234375,
-0.43798828125,
0.271240234375,
-1.0439453125,
0.292236328125,
0.44580078125,
0.20751953125,
-0.267333984375,
0.00274658203125,
-0.385986328125,
0.67041015625,
0.48486328125,
0.09893798828125,
-0.2113037109375,
-0.0958251953125,
-0.129150390625,
0.892578125,
-0.767578125,
0.56298828125,
-0.461669921875,
-0.401611328125,
-0.2310791015625,
-0.341796875,
0.42236328125,
-0.0179290771484375,
-0.287353515625,
0.630859375,
0.202880859375,
0.78271484375,
0.85498046875,
0.1455078125,
0.11651611328125,
0.2125244140625,
-0.358642578125,
0.286376953125,
-0.1070556640625,
0.88232421875,
0.1959228515625,
0.2340087890625,
0.08331298828125,
-0.1390380859375,
-0.8291015625,
-0.177490234375,
0.2095947265625,
0.88232421875,
-0.474609375,
0.053375244140625,
0.0213623046875,
-0.27978515625,
-0.59326171875,
-0.289794921875,
-0.1473388671875,
-0.73681640625,
-0.81884765625,
0.9326171875,
-0.1324462890625,
0.495849609375,
-0.4716796875,
-0.1671142578125,
0.5634765625,
1.462890625,
-0.63671875,
-0.1683349609375,
0.71728515625,
0.165283203125,
0.06719970703125,
-0.302978515625,
-0.06121826171875,
-0.01316070556640625,
-0.63232421875,
0.75390625,
-0.430419921875,
0.32080078125,
0.07781982421875,
0.515625,
0.5146484375,
0.509765625,
-0.208740234375,
-0.33642578125,
0.2100830078125,
1.0380859375,
-0.130126953125,
-0.31201171875,
0.040618896484375,
0.59423828125,
0.331298828125,
0.77587890625,
0.1844482421875,
0.044647216796875,
1.0654296875,
1.2373046875,
-0.2481689453125,
0.5595703125,
0.199951171875,
0.2177734375,
0.50146484375,
0.369140625,
0.385986328125,
0.374267578125,
-0.3232421875,
-0.302978515625,
-0.43994140625,
0.5390625,
-0.56396484375,
0.64013671875,
0.521484375,
0.72900390625,
-0.60546875,
-0.73876953125,
0.124755859375,
0.57470703125,
-0.63916015625,
-0.38330078125,
0.1815185546875,
-0.19921875,
0.426513671875,
0.09722900390625,
0.455078125,
0.4853515625,
0.5732421875,
0.434326171875,
-0.07354736328125,
-0.482177734375,
-0.8505859375,
-0.6142578125,
-0.84716796875,
-0.0036640167236328125,
-0.57861328125,
0.143798828125,
-0.0362548828125,
-1.0556640625,
0.572265625,
-0.325439453125,
-0.198974609375,
-0.34326171875,
-0.845703125,
0.31982421875,
0.10540771484375,
0.5224609375,
-0.248779296875,
0.9091796875,
0.2325439453125,
0.99267578125,
-0.84326171875,
-0.09503173828125,
-0.0191497802734375,
-0.6103515625,
0.365478515625,
-0.1473388671875,
0.28662109375,
-0.0570068359375,
-0.78955078125,
-0.65185546875,
-0.2054443359375,
-0.231689453125,
0.1627197265625,
0.259521484375,
-0.68310546875,
0.85205078125,
0.1275634765625,
-0.509765625,
0.7919921875,
0.439453125,
-1.130859375,
0.5830078125,
-0.09991455078125,
0.0020599365234375,
-0.7724609375,
1.5244140625,
0.6005859375,
0.70849609375,
-0.1739501953125,
-0.352294921875,
-0.26220703125,
0.1259765625,
-0.0653076171875,
-0.449462890625,
-0.283935546875,
0.8369140625,
0.121337890625,
-1.0107421875,
0.358154296875,
-0.91259765625,
-0.513671875,
-0.141357421875,
-0.55029296875,
0.7158203125,
0.478515625,
0.1966552734375,
-0.085693359375,
-0.04681396484375,
-0.80615234375,
0.492431640625,
0.488037109375,
-0.6455078125,
0.03509521484375,
0.38525390625,
-0.1075439453125,
0.287109375,
0.166015625,
-0.84228515625,
0.208984375,
-0.57568359375,
0.2491455078125,
0.62939453125,
0.447509765625,
-0.052642822265625,
-0.1326904296875,
0.9287109375,
-1.068359375,
-0.48193359375,
-0.264892578125,
0.7138671875,
0.83349609375,
0.59814453125,
0.29150390625,
-0.47119140625,
-0.58447265625,
-1.1435546875,
-0.1312255859375,
-0.0841064453125,
0.7509765625,
-0.93994140625,
0.97021484375,
0.3916015625,
-0.81640625,
0.44384765625,
-0.446044921875,
-0.157958984375,
0.92138671875,
-0.06787109375,
0.515625,
-0.9560546875,
0.2408447265625,
-0.328125,
0.005771636962890625,
0.572265625,
0.432861328125,
0.7880859375,
-0.642578125,
-0.50341796875,
-0.07135009765625,
-0.388671875,
-0.355712890625,
-0.403564453125,
0.053619384765625,
-0.43017578125,
-0.71484375,
-1.0068359375,
0.94970703125,
0.190185546875,
0.4326171875,
-0.07763671875,
0.4248046875,
-0.1458740234375,
0.2012939453125,
0.56689453125,
-0.10174560546875,
0.09991455078125,
-0.677734375,
1.1142578125,
-0.09527587890625,
-0.33056640625,
-0.33056640625,
-0.366943359375,
-0.3251953125,
0.06109619140625,
0.442138671875,
0.0241851806640625,
-0.65087890625,
0.364990234375,
0.237060546875,
0.1885986328125,
-0.67041015625,
-0.453857421875,
-0.5673828125,
0.623046875,
0.546875,
-1.111328125,
0.2041015625,
-0.08917236328125,
0.2822265625,
0.40185546875,
0.10125732421875,
-0.36669921875,
-0.460693359375,
-0.458740234375,
-0.6240234375,
0.2235107421875,
0.7265625,
-0.13037109375,
0.029998779296875,
-0.75537109375,
0.497314453125,
0.37353515625,
0.2127685546875,
0.037200927734375,
0.1923828125,
0.352294921875,
-0.135498046875,
0.86669921875,
-0.2095947265625,
-0.4697265625,
0.65478515625,
-0.712890625,
0.84423828125,
-0.66015625,
0.1514892578125,
0.06048583984375,
-0.106201171875,
-0.40869140625,
0.62158203125,
0.09783935546875,
-0.1822509765625,
-0.380615234375,
0.1715087890625,
-1.0693359375,
-0.8681640625,
0.642578125,
-0.08380126953125,
-0.245849609375,
0.92822265625,
0.37353515625,
-0.32373046875,
0.496337890625,
0.200927734375,
-0.424072265625,
0.35009765625,
-0.6513671875,
0.1968994140625,
-0.220703125,
-0.308837890625,
0.035980224609375,
-0.448974609375,
0.5634765625,
0.35205078125,
-0.82177734375,
-0.313232421875,
-0.78515625,
-0.10150146484375,
-0.04278564453125,
-0.402587890625,
0.2998046875,
-0.176513671875,
0.05157470703125,
0.296630859375,
-0.51611328125,
-0.2098388671875,
-0.417236328125,
-0.67919921875,
-0.269287109375,
0.446044921875,
0.5791015625,
0.638671875,
-0.01415252685546875,
-0.6767578125,
0.2412109375,
-0.09051513671875,
-0.0511474609375,
-0.67724609375,
-0.0826416015625,
-0.18017578125,
-0.26513671875,
-0.10833740234375,
0.2919921875,
0.28564453125,
0.2127685546875,
0.7841796875,
0.2095947265625,
0.70751953125,
0.24609375,
-0.64697265625,
0.5126953125,
-0.10528564453125,
-1.001953125,
-0.29736328125,
0.83544921875,
-0.123779296875,
0.95068359375,
0.238525390625,
-0.82763671875,
-0.47412109375,
-0.892578125,
0.0980224609375,
-0.87939453125,
0.019561767578125,
-0.65625,
-0.4921875,
-0.273193359375,
0.802734375,
-0.43896484375,
-0.4599609375,
-0.32763671875,
-0.52685546875,
0.2481689453125,
-0.650390625,
-0.247314453125,
-0.07843017578125,
-0.65478515625,
-0.400634765625,
0.9501953125,
0.00409698486328125,
0.509765625,
-0.263671875,
-0.1737060546875,
0.64208984375,
0.38916015625,
-0.9384765625,
-0.470703125,
-0.1109619140625,
0.050262451171875,
-0.03131103515625,
-0.282470703125,
-0.60888671875,
1.234375,
-1.037109375,
0.081787109375,
-0.1282958984375,
-0.80029296875,
-0.498291015625,
-0.1396484375,
0.97021484375,
-0.247314453125,
-0.267578125,
0.049774169921875,
0.7421875,
0.4501953125,
-0.01556396484375,
-0.4990234375,
-0.302978515625,
-0.759765625,
-0.87451171875,
0.62451171875,
0.07232666015625,
0.3896484375,
-0.18603515625,
-0.2135009765625,
1.3876953125,
-0.41357421875,
0.560546875,
1.26171875,
0.12237548828125,
0.2049560546875,
-0.48291015625,
0.92041015625,
0.437255859375,
-0.59033203125,
0.1607666015625,
0.5185546875,
-0.1920166015625,
0.10076904296875,
-0.81640625,
-0.5380859375,
-0.77294921875,
0.1240234375,
1.2685546875,
-0.4814453125,
0.35546875,
-0.453369140625,
-1.2568359375,
-0.60693359375,
0.84326171875,
-0.10791015625,
-0.0259857177734375,
0.9072265625,
-0.420654296875,
0.260009765625,
0.060638427734375,
0.25341796875,
0.07354736328125,
-0.2484130859375,
1.06640625,
-0.1807861328125,
-0.385009765625,
0.3759765625,
0.7763671875,
-1.234375,
-0.5869140625,
-0.10211181640625,
0.1468505859375,
-0.4013671875,
-0.4375,
-0.1942138671875,
0.408935546875,
-0.57666015625,
0.037017822265625,
0.4970703125,
-0.1422119140625,
0.467529296875,
0.074951171875,
-0.179931640625,
-0.467041015625,
0.30078125,
0.826171875,
-0.84765625,
-0.329833984375,
-0.6826171875,
0.074951171875,
0.0316162109375,
0.013397216796875,
0.81494140625,
-0.00994873046875,
0.488525390625,
0.734375,
0.0082550048828125,
1.103515625,
-0.440673828125,
0.07464599609375,
0.42822265625,
-0.54345703125,
-0.576171875,
-0.30029296875,
0.0660400390625,
-0.296142578125,
0.4912109375,
-0.716796875,
0.101318359375,
0.1396484375,
0.1484375,
-0.1661376953125,
-1.0107421875,
-0.1265869140625,
-0.8095703125,
-0.32177734375,
-0.59130859375,
-0.346435546875,
-0.1715087890625,
0.130859375,
-0.1490478515625,
-0.82080078125,
0.5068359375,
0.00965118408203125,
-0.5693359375,
0.1279296875,
-0.39794921875,
0.4677734375,
-0.603515625,
-0.43408203125,
-0.61279296875,
-0.494140625,
-0.640625,
0.0972900390625,
-0.171875,
0.1724853515625,
-0.20947265625,
0.350341796875,
-0.378662109375,
0.08203125,
-0.011871337890625,
-0.42138671875,
0.05596923828125,
0.316162109375,
-0.07501220703125,
0.8173828125,
0.448486328125,
0.5556640625,
-0.05841064453125,
0.028167724609375,
-0.32177734375,
0.1080322265625,
0.32421875,
0.5947265625,
0.05023193359375,
0.01428985595703125,
0.006412506103515625,
0.09771728515625,
-0.65283203125,
0.25537109375,
-0.06549072265625,
0.2177734375,
0.55126953125,
-0.09857177734375,
0.455322265625,
1.1748046875,
0.041015625,
0.12359619140625,
0.263916015625,
0.4140625,
0.61328125,
-0.449462890625,
0.33349609375,
0.11993408203125,
0.08636474609375,
-0.37353515625,
0.1036376953125,
0.35498046875,
-0.1300048828125,
0.2073974609375,
-0.120849609375,
-0.380615234375,
-1.1181640625,
-0.35107421875,
0.08734130859375,
0.6533203125,
0.4775390625,
-0.390625,
0.40283203125,
0.0745849609375,
-0.488525390625,
0.5634765625,
-0.8330078125,
-0.8759765625,
0.56494140625,
-0.35888671875,
-0.0027141571044921875,
-0.62744140625,
-0.400146484375,
-0.1376953125,
-0.1297607421875,
0.0875244140625,
-0.268798828125,
0.11322021484375,
0.152099609375,
0.54931640625,
-0.06304931640625,
0.045318603515625,
0.09393310546875,
0.63623046875,
-0.472900390625,
-0.58935546875,
0.12335205078125,
1.0400390625,
0.08935546875,
-0.289794921875,
-0.484375,
0.1346435546875,
0.19189453125,
0.75048828125,
-0.8037109375,
-0.462646484375,
-0.38525390625,
0.60791015625,
-0.646484375,
-0.2298583984375,
-0.187255859375,
1.05859375,
0.1630859375,
-0.2017822265625,
-0.368896484375,
0.65283203125,
0.95751953125,
-0.210205078125,
0.395751953125,
0.2069091796875,
0.400634765625,
-0.466796875,
-0.21630859375,
-0.1580810546875,
0.7578125,
0.72705078125,
0.91064453125,
-0.07275390625,
0.203369140625,
0.57666015625,
-0.147705078125,
-0.4814453125,
0.0250091552734375,
-0.0129241943359375,
-0.30908203125,
-0.5205078125,
0.28662109375,
-0.1842041015625,
-0.2265625,
-0.44482421875,
0.44189453125,
-0.576171875,
-0.317138671875,
-0.50048828125,
-0.62451171875,
1.119140625,
-0.42578125,
0.1341552734375,
-0.108642578125,
-0.19140625,
0.3095703125,
0.87841796875,
-0.21923828125,
0.06781005859375,
1.1962890625,
0.40673828125,
0.09161376953125,
0.43505859375,
0.338623046875,
0.363037109375,
-0.1810302734375,
0.1529541015625,
-0.162109375,
0.1572265625,
-0.36181640625,
-0.247314453125,
-0.92626953125,
0.66845703125,
-0.6015625,
0.01457977294921875,
0.1861572265625,
-0.77978515625,
-0.412109375,
-0.53125,
0.47509765625,
-0.939453125,
0.00885009765625,
0.277587890625,
-0.438232421875,
-0.8701171875,
1.0693359375,
-0.06585693359375,
0.501953125,
0.035491943359375,
0.65185546875,
-0.05419921875,
1.482421875,
0.224365234375,
-0.447509765625,
0.1500244140625,
0.40478515625,
-0.1976318359375,
-0.81591796875,
0.01450347900390625,
-0.4365234375,
-0.479248046875,
-0.69580078125,
-0.5380859375,
0.01486968994140625,
0.8466796875,
0.2222900390625,
-1.1611328125,
-0.152587890625,
0.0218658447265625,
-0.56787109375,
0.315673828125,
0.1004638671875,
0.367431640625,
-0.2406005859375,
0.10333251953125,
0.1497802734375,
-0.3994140625,
-0.326904296875,
-0.400146484375,
0.2027587890625,
-0.2391357421875,
-0.53466796875,
-0.77783203125,
-0.4931640625,
-0.263916015625,
-0.0207977294921875,
-0.5341796875,
-0.6826171875,
0.60400390625,
0.87646484375,
0.79296875,
0.446533203125,
-0.55029296875,
-0.0831298828125,
0.5634765625,
0.9833984375,
-0.045166015625,
0.4697265625,
0.8369140625,
-0.01383209228515625,
0.44775390625,
-0.305908203125,
0.41552734375,
-0.0963134765625,
-0.230224609375,
-0.5791015625,
-0.06610107421875,
-0.77734375,
-1.365234375,
0.16650390625,
0.407470703125,
0.68115234375,
-0.57373046875,
-0.90625,
-0.372314453125,
-0.89404296875,
-0.048248291015625,
-0.87109375,
0.475830078125,
0.2034912109375,
-0.2061767578125,
0.350830078125,
-0.83935546875,
4.5078125,
1.11328125,
0.49365234375,
0.305908203125,
0.2130126953125,
0.98291015625,
0.322021484375,
-1.2529296875,
0.09771728515625,
-0.8486328125,
0.1864013671875,
-0.95068359375,
-0.01165008544921875,
0.5458984375,
0.41015625,
0.623046875,
-0.52001953125,
-0.11492919921875,
0.0689697265625,
-1.2578125,
-0.89501953125,
0.382568359375,
-0.402587890625,
0.62255859375,
0.29541015625,
0.392822265625,
0.218994140625,
-0.449462890625,
-0.296875,
-0.53125,
-0.06744384765625,
-0.583984375,
0.7578125,
0.263916015625,
-0.258544921875,
1.08984375,
0.18701171875,
-0.0941162109375,
-0.2041015625,
0.4111328125,
-0.2646484375,
0.12457275390625,
0.94580078125,
-1.0146484375,
0.06561279296875,
0.6982421875,
-0.318359375,
-0.1533203125,
0.54150390625,
-0.95849609375,
1.1806640625,
-0.041351318359375,
0.326416015625,
0.1927490234375,
-0.63525390625,
0.08154296875,
-0.0743408203125,
0.002170562744140625,
0.314208984375,
0.261474609375,
0.4736328125,
0.245361328125,
0.3515625,
0.357666015625,
-0.89306640625,
0.6533203125,
-0.24853515625,
0.77294921875,
-0.5732421875,
-0.287353515625,
-0.38916015625,
-0.1566162109375,
-0.323974609375,
-0.50732421875,
0.861328125,
0.2371826171875,
-0.0283050537109375,
0.57470703125,
0.5185546875,
-0.9228515625,
0.372802734375,
-0.050201416015625,
-0.62841796875,
-0.61669921875,
0.603515625,
0.96044921875,
-0.358642578125,
-0.54833984375,
-0.1229248046875,
0.568359375,
0.06805419921875,
0.625,
-0.150146484375,
-0.8115234375,
-0.1162109375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
International Coding Procedures Company (ICPC) writes all its code in Jedi Script (JS) programming language. JS does not get compiled, but is delivered for execution in its source form. Sources contain comments, extra whitespace (including trailing and leading spaces), and other non-essential features that make them quite large but do not contribute to the semantics of the code, so the process of minification is performed on source files before their delivery to execution to compress sources while preserving their semantics.
You are hired by ICPC to write JS minifier for ICPC. Fortunately, ICPC adheres to very strict programming practices and their JS sources are quite restricted in grammar. They work only on integer algorithms and do not use floating point numbers and strings.
Every JS source contains a sequence of lines. Each line contains zero or more tokens that can be separated by spaces. On each line, a part of the line that starts with a hash character ('#' code 35), including the hash character itself, is treated as a comment and is ignored up to the end of the line.
Each line is parsed into a sequence of tokens from left to right by repeatedly skipping spaces and finding the longest possible token starting at the current parsing position, thus transforming the source code into a sequence of tokens. All the possible tokens are listed below:
* A reserved token is any kind of operator, separator, literal, reserved word, or a name of a library function that should be preserved during the minification process. Reserved tokens are fixed strings of non-space ASCII characters that do not contain the hash character ('#' code 35). All reserved tokens are given as an input to the minification process.
* A number token consists of a sequence of digits, where a digit is a character from zero ('0') to nine ('9') inclusive.
* A word token consists of a sequence of characters from the following set: lowercase letters, uppercase letters, digits, underscore ('_' code 95), and dollar sign ('$' code 36). A word does not start with a digit.
Note, that during parsing the longest sequence of characters that satisfies either a number or a word definition, but that appears in the list of reserved tokens, is considered to be a reserved token instead.
During the minification process words are renamed in a systematic fashion using the following algorithm:
1. Take a list of words that consist only of lowercase letters ordered first by their length, then lexicographically: "a", "b", ..., "z", "aa", "ab", ..., excluding reserved tokens, since they are not considered to be words. This is the target word list.
2. Rename the first word encountered in the input token sequence to the first word in the target word list and all further occurrences of the same word in the input token sequence, too. Rename the second new word encountered in the input token sequence to the second word in the target word list, and so on.
The goal of the minification process is to convert the given source to the shortest possible line (counting spaces) that still parses to the same sequence of tokens with the correspondingly renamed words using these JS parsing rules.
Input
The first line of the input contains a single integer n (0 ≤ n ≤ 40) — the number of reserved tokens.
The second line of the input contains the list of reserved tokens separated by spaces without repetitions in the list. Each reserved token is at least one and at most 20 characters long and contains only characters with ASCII codes from 33 (exclamation mark) to 126 (tilde) inclusive, with exception of a hash character ('#' code 35).
The third line of the input contains a single integer m (1 ≤ m ≤ 40) — the number of lines in the input source code.
Next m lines contain the input source, each source line is at most 80 characters long (counting leading and trailing spaces). Each line contains only characters with ASCII codes from 32 (space) to 126 (tilde) inclusive. The source code is valid and fully parses into a sequence of tokens.
Output
Write to the output a single line that is the result of the minification process on the input source code. The output source line shall parse to the same sequence of tokens as the input source with the correspondingly renamed words and shall contain the minimum possible number of spaces needed for that. If there are multiple ways to insert the minimum possible number of spaces into the output, use any way.
Examples
Input
16
fun while return var { } ( ) , ; > = + ++ - --
9
fun fib(num) { # compute fibs
var return_value = 1, prev = 0, temp;
while (num > 0) {
temp = return_value; return_value = return_value + prev;
prev = temp;
num--;
}
return return_value;
}
Output
fun a(b){var c=1,d=0,e;while(b>0){e=c;c=c+d;d=e;b--;}return c;}
Input
10
( ) + ++ : -> >> >>: b c)
2
($val1++ + +4 kb) >> :out
b-> + 10 >>: t # using >>:
Output
(a+++ +4c )>> :d b->+10>>:e
Tags: greedy, implementation
Correct Solution:
```
def main():
t = int(input())
reserved = set(input().split())
lines = int(input())
code = ''
for i in range(lines):
code += input() + '\n'
def is_word(suspect):
if suspect[0].isdigit(): return False
for x in suspect:
if (not x.isalpha()) and (not x in {'_', '$'}) and (not x.isdigit()):
return False
return True
def is_token(suspect):
if suspect in reserved: return True
if is_word(suspect): return True
if suspect.isdigit(): return True
return False
def remove_comments(code):
rez = ''
state = None
for i in range(len(code)):
if code[i] == '#':
state = 'comment'
elif code[i] == '\n':
rez += code[i]
state = None
else:
if state != 'comment':
rez += code[i]
return rez
code = remove_comments(code)
code = code.replace('\n', ' ')
def split(code):
tokens = []
i = 0
while i < len(code):
if code[i] == ' ':
i += 1
continue
for l in range(min(len(code), 90), 0, -1):
if is_token(code[i:i + l]):
tokens.append(code[i:i + l])
i += l
break
else:
return []
return tokens
def minmize(tokens):
all = []
pref = [chr(i + ord('a')) for i in range(26)]
all.extend(pref)
for ext in range(3):
cur = []
for i in range(26):
for p in pref:
cur.append(p + chr(i + ord('a')))
cur.sort()
all.extend(cur)
pref = cur[::]
all.reverse()
zip = dict()
for i in range(len(tokens)):
if not tokens[i] in reserved and not tokens[i][0].isdigit():
if not zip.get(tokens[i], None):
while all[-1] in reserved:
all.pop()
zip[tokens[i]] = all[-1]
all.pop()
tokens[i] = zip[tokens[i]]
return tokens
tokens = (minmize(split(code)))
def cmp(a, b):
if len(a) != len(b): return False
for i in range(len(a)):
if a[i] != b[i]: return False
return True
final = []
for i in range(len(tokens)):
p = 0
for j in range(i - 1, -1, -1):
if len(''.join(tokens[j:i + 1])) > 23:
p = j
break
st = ''
if i and (not cmp(tokens[p:i + 1], split(''.join(final[p:i]) + tokens[i]))):
st += ' '
final.append(st + tokens[i])
print(''.join(final))
main()
```
| 67,284
|
[
0.18212890625,
-0.42626953125,
-0.1820068359375,
0.2744140625,
-0.62060546875,
-0.356201171875,
0.047149658203125,
0.1824951171875,
-0.2237548828125,
0.294921875,
0.349853515625,
0.03558349609375,
0.07696533203125,
-0.826171875,
-0.72216796875,
0.31201171875,
-0.57763671875,
-0.4267578125,
-0.65380859375,
-0.10601806640625,
-0.26953125,
-0.033966064453125,
-1.576171875,
-0.337646484375,
-0.6982421875,
1.1953125,
-0.00799560546875,
-0.21240234375,
0.95556640625,
0.880859375,
-0.5732421875,
-0.412109375,
0.318359375,
-0.74560546875,
-0.258544921875,
-0.6845703125,
0.71240234375,
-0.51904296875,
-0.1282958984375,
-0.114013671875,
-0.208740234375,
-0.5244140625,
0.316162109375,
-0.8349609375,
-1.3056640625,
-0.036224365234375,
-0.2259521484375,
-0.1962890625,
-0.10382080078125,
-0.47900390625,
0.055419921875,
0.3359375,
0.30615234375,
-0.1839599609375,
-0.2259521484375,
-0.3310546875,
0.12286376953125,
-0.042999267578125,
-0.389892578125,
-0.027069091796875,
-0.470703125,
0.2047119140625,
-0.0521240234375,
-0.57373046875,
-0.1683349609375,
0.8125,
-0.267822265625,
0.257080078125,
0.06463623046875,
-0.5341796875,
0.035552978515625,
0.393798828125,
-0.470947265625,
-0.333984375,
-0.6005859375,
-0.194580078125,
0.5107421875,
0.239990234375,
-0.58984375,
0.52587890625,
0.319580078125,
0.9091796875,
0.170166015625,
0.142578125,
-0.5458984375,
-0.55029296875,
0.37841796875,
0.1976318359375,
0.07269287109375,
-0.1849365234375,
-0.12127685546875,
0.5302734375,
-0.564453125,
-0.055145263671875,
0.93896484375,
0.47802734375,
-0.203857421875,
0.69921875,
-0.1881103515625,
0.434326171875,
0.6025390625,
0.853515625,
-0.84912109375,
0.7041015625,
-0.263671875,
0.16259765625,
0.1129150390625,
0.019317626953125,
-0.284423828125,
-0.11285400390625,
0.035430908203125,
-0.91162109375,
-0.0185546875,
-0.43603515625,
-0.1055908203125,
0.87890625,
-0.32666015625,
0.400146484375,
-1.0068359375,
0.26953125,
0.615234375,
-0.6142578125,
0.35888671875,
-0.314697265625,
0.387451171875,
-0.373046875,
0.1142578125,
0.60107421875,
-0.34130859375,
-0.09173583984375,
0.6279296875,
-0.241455078125,
-0.05767822265625,
0.478271484375,
0.280029296875,
0.79833984375,
0.0257110595703125,
0.397705078125,
0.56787109375,
-0.362548828125,
0.09014892578125,
0.1575927734375,
-0.0809326171875,
1.3740234375,
0.36572265625,
0.188720703125,
0.01837158203125,
0.39990234375,
-0.43798828125,
0.271240234375,
-1.0439453125,
0.292236328125,
0.44580078125,
0.20751953125,
-0.267333984375,
0.00274658203125,
-0.385986328125,
0.67041015625,
0.48486328125,
0.09893798828125,
-0.2113037109375,
-0.0958251953125,
-0.129150390625,
0.892578125,
-0.767578125,
0.56298828125,
-0.461669921875,
-0.401611328125,
-0.2310791015625,
-0.341796875,
0.42236328125,
-0.0179290771484375,
-0.287353515625,
0.630859375,
0.202880859375,
0.78271484375,
0.85498046875,
0.1455078125,
0.11651611328125,
0.2125244140625,
-0.358642578125,
0.286376953125,
-0.1070556640625,
0.88232421875,
0.1959228515625,
0.2340087890625,
0.08331298828125,
-0.1390380859375,
-0.8291015625,
-0.177490234375,
0.2095947265625,
0.88232421875,
-0.474609375,
0.053375244140625,
0.0213623046875,
-0.27978515625,
-0.59326171875,
-0.289794921875,
-0.1473388671875,
-0.73681640625,
-0.81884765625,
0.9326171875,
-0.1324462890625,
0.495849609375,
-0.4716796875,
-0.1671142578125,
0.5634765625,
1.462890625,
-0.63671875,
-0.1683349609375,
0.71728515625,
0.165283203125,
0.06719970703125,
-0.302978515625,
-0.06121826171875,
-0.01316070556640625,
-0.63232421875,
0.75390625,
-0.430419921875,
0.32080078125,
0.07781982421875,
0.515625,
0.5146484375,
0.509765625,
-0.208740234375,
-0.33642578125,
0.2100830078125,
1.0380859375,
-0.130126953125,
-0.31201171875,
0.040618896484375,
0.59423828125,
0.331298828125,
0.77587890625,
0.1844482421875,
0.044647216796875,
1.0654296875,
1.2373046875,
-0.2481689453125,
0.5595703125,
0.199951171875,
0.2177734375,
0.50146484375,
0.369140625,
0.385986328125,
0.374267578125,
-0.3232421875,
-0.302978515625,
-0.43994140625,
0.5390625,
-0.56396484375,
0.64013671875,
0.521484375,
0.72900390625,
-0.60546875,
-0.73876953125,
0.124755859375,
0.57470703125,
-0.63916015625,
-0.38330078125,
0.1815185546875,
-0.19921875,
0.426513671875,
0.09722900390625,
0.455078125,
0.4853515625,
0.5732421875,
0.434326171875,
-0.07354736328125,
-0.482177734375,
-0.8505859375,
-0.6142578125,
-0.84716796875,
-0.0036640167236328125,
-0.57861328125,
0.143798828125,
-0.0362548828125,
-1.0556640625,
0.572265625,
-0.325439453125,
-0.198974609375,
-0.34326171875,
-0.845703125,
0.31982421875,
0.10540771484375,
0.5224609375,
-0.248779296875,
0.9091796875,
0.2325439453125,
0.99267578125,
-0.84326171875,
-0.09503173828125,
-0.0191497802734375,
-0.6103515625,
0.365478515625,
-0.1473388671875,
0.28662109375,
-0.0570068359375,
-0.78955078125,
-0.65185546875,
-0.2054443359375,
-0.231689453125,
0.1627197265625,
0.259521484375,
-0.68310546875,
0.85205078125,
0.1275634765625,
-0.509765625,
0.7919921875,
0.439453125,
-1.130859375,
0.5830078125,
-0.09991455078125,
0.0020599365234375,
-0.7724609375,
1.5244140625,
0.6005859375,
0.70849609375,
-0.1739501953125,
-0.352294921875,
-0.26220703125,
0.1259765625,
-0.0653076171875,
-0.449462890625,
-0.283935546875,
0.8369140625,
0.121337890625,
-1.0107421875,
0.358154296875,
-0.91259765625,
-0.513671875,
-0.141357421875,
-0.55029296875,
0.7158203125,
0.478515625,
0.1966552734375,
-0.085693359375,
-0.04681396484375,
-0.80615234375,
0.492431640625,
0.488037109375,
-0.6455078125,
0.03509521484375,
0.38525390625,
-0.1075439453125,
0.287109375,
0.166015625,
-0.84228515625,
0.208984375,
-0.57568359375,
0.2491455078125,
0.62939453125,
0.447509765625,
-0.052642822265625,
-0.1326904296875,
0.9287109375,
-1.068359375,
-0.48193359375,
-0.264892578125,
0.7138671875,
0.83349609375,
0.59814453125,
0.29150390625,
-0.47119140625,
-0.58447265625,
-1.1435546875,
-0.1312255859375,
-0.0841064453125,
0.7509765625,
-0.93994140625,
0.97021484375,
0.3916015625,
-0.81640625,
0.44384765625,
-0.446044921875,
-0.157958984375,
0.92138671875,
-0.06787109375,
0.515625,
-0.9560546875,
0.2408447265625,
-0.328125,
0.005771636962890625,
0.572265625,
0.432861328125,
0.7880859375,
-0.642578125,
-0.50341796875,
-0.07135009765625,
-0.388671875,
-0.355712890625,
-0.403564453125,
0.053619384765625,
-0.43017578125,
-0.71484375,
-1.0068359375,
0.94970703125,
0.190185546875,
0.4326171875,
-0.07763671875,
0.4248046875,
-0.1458740234375,
0.2012939453125,
0.56689453125,
-0.10174560546875,
0.09991455078125,
-0.677734375,
1.1142578125,
-0.09527587890625,
-0.33056640625,
-0.33056640625,
-0.366943359375,
-0.3251953125,
0.06109619140625,
0.442138671875,
0.0241851806640625,
-0.65087890625,
0.364990234375,
0.237060546875,
0.1885986328125,
-0.67041015625,
-0.453857421875,
-0.5673828125,
0.623046875,
0.546875,
-1.111328125,
0.2041015625,
-0.08917236328125,
0.2822265625,
0.40185546875,
0.10125732421875,
-0.36669921875,
-0.460693359375,
-0.458740234375,
-0.6240234375,
0.2235107421875,
0.7265625,
-0.13037109375,
0.029998779296875,
-0.75537109375,
0.497314453125,
0.37353515625,
0.2127685546875,
0.037200927734375,
0.1923828125,
0.352294921875,
-0.135498046875,
0.86669921875,
-0.2095947265625,
-0.4697265625,
0.65478515625,
-0.712890625,
0.84423828125,
-0.66015625,
0.1514892578125,
0.06048583984375,
-0.106201171875,
-0.40869140625,
0.62158203125,
0.09783935546875,
-0.1822509765625,
-0.380615234375,
0.1715087890625,
-1.0693359375,
-0.8681640625,
0.642578125,
-0.08380126953125,
-0.245849609375,
0.92822265625,
0.37353515625,
-0.32373046875,
0.496337890625,
0.200927734375,
-0.424072265625,
0.35009765625,
-0.6513671875,
0.1968994140625,
-0.220703125,
-0.308837890625,
0.035980224609375,
-0.448974609375,
0.5634765625,
0.35205078125,
-0.82177734375,
-0.313232421875,
-0.78515625,
-0.10150146484375,
-0.04278564453125,
-0.402587890625,
0.2998046875,
-0.176513671875,
0.05157470703125,
0.296630859375,
-0.51611328125,
-0.2098388671875,
-0.417236328125,
-0.67919921875,
-0.269287109375,
0.446044921875,
0.5791015625,
0.638671875,
-0.01415252685546875,
-0.6767578125,
0.2412109375,
-0.09051513671875,
-0.0511474609375,
-0.67724609375,
-0.0826416015625,
-0.18017578125,
-0.26513671875,
-0.10833740234375,
0.2919921875,
0.28564453125,
0.2127685546875,
0.7841796875,
0.2095947265625,
0.70751953125,
0.24609375,
-0.64697265625,
0.5126953125,
-0.10528564453125,
-1.001953125,
-0.29736328125,
0.83544921875,
-0.123779296875,
0.95068359375,
0.238525390625,
-0.82763671875,
-0.47412109375,
-0.892578125,
0.0980224609375,
-0.87939453125,
0.019561767578125,
-0.65625,
-0.4921875,
-0.273193359375,
0.802734375,
-0.43896484375,
-0.4599609375,
-0.32763671875,
-0.52685546875,
0.2481689453125,
-0.650390625,
-0.247314453125,
-0.07843017578125,
-0.65478515625,
-0.400634765625,
0.9501953125,
0.00409698486328125,
0.509765625,
-0.263671875,
-0.1737060546875,
0.64208984375,
0.38916015625,
-0.9384765625,
-0.470703125,
-0.1109619140625,
0.050262451171875,
-0.03131103515625,
-0.282470703125,
-0.60888671875,
1.234375,
-1.037109375,
0.081787109375,
-0.1282958984375,
-0.80029296875,
-0.498291015625,
-0.1396484375,
0.97021484375,
-0.247314453125,
-0.267578125,
0.049774169921875,
0.7421875,
0.4501953125,
-0.01556396484375,
-0.4990234375,
-0.302978515625,
-0.759765625,
-0.87451171875,
0.62451171875,
0.07232666015625,
0.3896484375,
-0.18603515625,
-0.2135009765625,
1.3876953125,
-0.41357421875,
0.560546875,
1.26171875,
0.12237548828125,
0.2049560546875,
-0.48291015625,
0.92041015625,
0.437255859375,
-0.59033203125,
0.1607666015625,
0.5185546875,
-0.1920166015625,
0.10076904296875,
-0.81640625,
-0.5380859375,
-0.77294921875,
0.1240234375,
1.2685546875,
-0.4814453125,
0.35546875,
-0.453369140625,
-1.2568359375,
-0.60693359375,
0.84326171875,
-0.10791015625,
-0.0259857177734375,
0.9072265625,
-0.420654296875,
0.260009765625,
0.060638427734375,
0.25341796875,
0.07354736328125,
-0.2484130859375,
1.06640625,
-0.1807861328125,
-0.385009765625,
0.3759765625,
0.7763671875,
-1.234375,
-0.5869140625,
-0.10211181640625,
0.1468505859375,
-0.4013671875,
-0.4375,
-0.1942138671875,
0.408935546875,
-0.57666015625,
0.037017822265625,
0.4970703125,
-0.1422119140625,
0.467529296875,
0.074951171875,
-0.179931640625,
-0.467041015625,
0.30078125,
0.826171875,
-0.84765625,
-0.329833984375,
-0.6826171875,
0.074951171875,
0.0316162109375,
0.013397216796875,
0.81494140625,
-0.00994873046875,
0.488525390625,
0.734375,
0.0082550048828125,
1.103515625,
-0.440673828125,
0.07464599609375,
0.42822265625,
-0.54345703125,
-0.576171875,
-0.30029296875,
0.0660400390625,
-0.296142578125,
0.4912109375,
-0.716796875,
0.101318359375,
0.1396484375,
0.1484375,
-0.1661376953125,
-1.0107421875,
-0.1265869140625,
-0.8095703125,
-0.32177734375,
-0.59130859375,
-0.346435546875,
-0.1715087890625,
0.130859375,
-0.1490478515625,
-0.82080078125,
0.5068359375,
0.00965118408203125,
-0.5693359375,
0.1279296875,
-0.39794921875,
0.4677734375,
-0.603515625,
-0.43408203125,
-0.61279296875,
-0.494140625,
-0.640625,
0.0972900390625,
-0.171875,
0.1724853515625,
-0.20947265625,
0.350341796875,
-0.378662109375,
0.08203125,
-0.011871337890625,
-0.42138671875,
0.05596923828125,
0.316162109375,
-0.07501220703125,
0.8173828125,
0.448486328125,
0.5556640625,
-0.05841064453125,
0.028167724609375,
-0.32177734375,
0.1080322265625,
0.32421875,
0.5947265625,
0.05023193359375,
0.01428985595703125,
0.006412506103515625,
0.09771728515625,
-0.65283203125,
0.25537109375,
-0.06549072265625,
0.2177734375,
0.55126953125,
-0.09857177734375,
0.455322265625,
1.1748046875,
0.041015625,
0.12359619140625,
0.263916015625,
0.4140625,
0.61328125,
-0.449462890625,
0.33349609375,
0.11993408203125,
0.08636474609375,
-0.37353515625,
0.1036376953125,
0.35498046875,
-0.1300048828125,
0.2073974609375,
-0.120849609375,
-0.380615234375,
-1.1181640625,
-0.35107421875,
0.08734130859375,
0.6533203125,
0.4775390625,
-0.390625,
0.40283203125,
0.0745849609375,
-0.488525390625,
0.5634765625,
-0.8330078125,
-0.8759765625,
0.56494140625,
-0.35888671875,
-0.0027141571044921875,
-0.62744140625,
-0.400146484375,
-0.1376953125,
-0.1297607421875,
0.0875244140625,
-0.268798828125,
0.11322021484375,
0.152099609375,
0.54931640625,
-0.06304931640625,
0.045318603515625,
0.09393310546875,
0.63623046875,
-0.472900390625,
-0.58935546875,
0.12335205078125,
1.0400390625,
0.08935546875,
-0.289794921875,
-0.484375,
0.1346435546875,
0.19189453125,
0.75048828125,
-0.8037109375,
-0.462646484375,
-0.38525390625,
0.60791015625,
-0.646484375,
-0.2298583984375,
-0.187255859375,
1.05859375,
0.1630859375,
-0.2017822265625,
-0.368896484375,
0.65283203125,
0.95751953125,
-0.210205078125,
0.395751953125,
0.2069091796875,
0.400634765625,
-0.466796875,
-0.21630859375,
-0.1580810546875,
0.7578125,
0.72705078125,
0.91064453125,
-0.07275390625,
0.203369140625,
0.57666015625,
-0.147705078125,
-0.4814453125,
0.0250091552734375,
-0.0129241943359375,
-0.30908203125,
-0.5205078125,
0.28662109375,
-0.1842041015625,
-0.2265625,
-0.44482421875,
0.44189453125,
-0.576171875,
-0.317138671875,
-0.50048828125,
-0.62451171875,
1.119140625,
-0.42578125,
0.1341552734375,
-0.108642578125,
-0.19140625,
0.3095703125,
0.87841796875,
-0.21923828125,
0.06781005859375,
1.1962890625,
0.40673828125,
0.09161376953125,
0.43505859375,
0.338623046875,
0.363037109375,
-0.1810302734375,
0.1529541015625,
-0.162109375,
0.1572265625,
-0.36181640625,
-0.247314453125,
-0.92626953125,
0.66845703125,
-0.6015625,
0.01457977294921875,
0.1861572265625,
-0.77978515625,
-0.412109375,
-0.53125,
0.47509765625,
-0.939453125,
0.00885009765625,
0.277587890625,
-0.438232421875,
-0.8701171875,
1.0693359375,
-0.06585693359375,
0.501953125,
0.035491943359375,
0.65185546875,
-0.05419921875,
1.482421875,
0.224365234375,
-0.447509765625,
0.1500244140625,
0.40478515625,
-0.1976318359375,
-0.81591796875,
0.01450347900390625,
-0.4365234375,
-0.479248046875,
-0.69580078125,
-0.5380859375,
0.01486968994140625,
0.8466796875,
0.2222900390625,
-1.1611328125,
-0.152587890625,
0.0218658447265625,
-0.56787109375,
0.315673828125,
0.1004638671875,
0.367431640625,
-0.2406005859375,
0.10333251953125,
0.1497802734375,
-0.3994140625,
-0.326904296875,
-0.400146484375,
0.2027587890625,
-0.2391357421875,
-0.53466796875,
-0.77783203125,
-0.4931640625,
-0.263916015625,
-0.0207977294921875,
-0.5341796875,
-0.6826171875,
0.60400390625,
0.87646484375,
0.79296875,
0.446533203125,
-0.55029296875,
-0.0831298828125,
0.5634765625,
0.9833984375,
-0.045166015625,
0.4697265625,
0.8369140625,
-0.01383209228515625,
0.44775390625,
-0.305908203125,
0.41552734375,
-0.0963134765625,
-0.230224609375,
-0.5791015625,
-0.06610107421875,
-0.77734375,
-1.365234375,
0.16650390625,
0.407470703125,
0.68115234375,
-0.57373046875,
-0.90625,
-0.372314453125,
-0.89404296875,
-0.048248291015625,
-0.87109375,
0.475830078125,
0.2034912109375,
-0.2061767578125,
0.350830078125,
-0.83935546875,
4.5078125,
1.11328125,
0.49365234375,
0.305908203125,
0.2130126953125,
0.98291015625,
0.322021484375,
-1.2529296875,
0.09771728515625,
-0.8486328125,
0.1864013671875,
-0.95068359375,
-0.01165008544921875,
0.5458984375,
0.41015625,
0.623046875,
-0.52001953125,
-0.11492919921875,
0.0689697265625,
-1.2578125,
-0.89501953125,
0.382568359375,
-0.402587890625,
0.62255859375,
0.29541015625,
0.392822265625,
0.218994140625,
-0.449462890625,
-0.296875,
-0.53125,
-0.06744384765625,
-0.583984375,
0.7578125,
0.263916015625,
-0.258544921875,
1.08984375,
0.18701171875,
-0.0941162109375,
-0.2041015625,
0.4111328125,
-0.2646484375,
0.12457275390625,
0.94580078125,
-1.0146484375,
0.06561279296875,
0.6982421875,
-0.318359375,
-0.1533203125,
0.54150390625,
-0.95849609375,
1.1806640625,
-0.041351318359375,
0.326416015625,
0.1927490234375,
-0.63525390625,
0.08154296875,
-0.0743408203125,
0.002170562744140625,
0.314208984375,
0.261474609375,
0.4736328125,
0.245361328125,
0.3515625,
0.357666015625,
-0.89306640625,
0.6533203125,
-0.24853515625,
0.77294921875,
-0.5732421875,
-0.287353515625,
-0.38916015625,
-0.1566162109375,
-0.323974609375,
-0.50732421875,
0.861328125,
0.2371826171875,
-0.0283050537109375,
0.57470703125,
0.5185546875,
-0.9228515625,
0.372802734375,
-0.050201416015625,
-0.62841796875,
-0.61669921875,
0.603515625,
0.96044921875,
-0.358642578125,
-0.54833984375,
-0.1229248046875,
0.568359375,
0.06805419921875,
0.625,
-0.150146484375,
-0.8115234375,
-0.1162109375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
International Coding Procedures Company (ICPC) writes all its code in Jedi Script (JS) programming language. JS does not get compiled, but is delivered for execution in its source form. Sources contain comments, extra whitespace (including trailing and leading spaces), and other non-essential features that make them quite large but do not contribute to the semantics of the code, so the process of minification is performed on source files before their delivery to execution to compress sources while preserving their semantics.
You are hired by ICPC to write JS minifier for ICPC. Fortunately, ICPC adheres to very strict programming practices and their JS sources are quite restricted in grammar. They work only on integer algorithms and do not use floating point numbers and strings.
Every JS source contains a sequence of lines. Each line contains zero or more tokens that can be separated by spaces. On each line, a part of the line that starts with a hash character ('#' code 35), including the hash character itself, is treated as a comment and is ignored up to the end of the line.
Each line is parsed into a sequence of tokens from left to right by repeatedly skipping spaces and finding the longest possible token starting at the current parsing position, thus transforming the source code into a sequence of tokens. All the possible tokens are listed below:
* A reserved token is any kind of operator, separator, literal, reserved word, or a name of a library function that should be preserved during the minification process. Reserved tokens are fixed strings of non-space ASCII characters that do not contain the hash character ('#' code 35). All reserved tokens are given as an input to the minification process.
* A number token consists of a sequence of digits, where a digit is a character from zero ('0') to nine ('9') inclusive.
* A word token consists of a sequence of characters from the following set: lowercase letters, uppercase letters, digits, underscore ('_' code 95), and dollar sign ('$' code 36). A word does not start with a digit.
Note, that during parsing the longest sequence of characters that satisfies either a number or a word definition, but that appears in the list of reserved tokens, is considered to be a reserved token instead.
During the minification process words are renamed in a systematic fashion using the following algorithm:
1. Take a list of words that consist only of lowercase letters ordered first by their length, then lexicographically: "a", "b", ..., "z", "aa", "ab", ..., excluding reserved tokens, since they are not considered to be words. This is the target word list.
2. Rename the first word encountered in the input token sequence to the first word in the target word list and all further occurrences of the same word in the input token sequence, too. Rename the second new word encountered in the input token sequence to the second word in the target word list, and so on.
The goal of the minification process is to convert the given source to the shortest possible line (counting spaces) that still parses to the same sequence of tokens with the correspondingly renamed words using these JS parsing rules.
Input
The first line of the input contains a single integer n (0 ≤ n ≤ 40) — the number of reserved tokens.
The second line of the input contains the list of reserved tokens separated by spaces without repetitions in the list. Each reserved token is at least one and at most 20 characters long and contains only characters with ASCII codes from 33 (exclamation mark) to 126 (tilde) inclusive, with exception of a hash character ('#' code 35).
The third line of the input contains a single integer m (1 ≤ m ≤ 40) — the number of lines in the input source code.
Next m lines contain the input source, each source line is at most 80 characters long (counting leading and trailing spaces). Each line contains only characters with ASCII codes from 32 (space) to 126 (tilde) inclusive. The source code is valid and fully parses into a sequence of tokens.
Output
Write to the output a single line that is the result of the minification process on the input source code. The output source line shall parse to the same sequence of tokens as the input source with the correspondingly renamed words and shall contain the minimum possible number of spaces needed for that. If there are multiple ways to insert the minimum possible number of spaces into the output, use any way.
Examples
Input
16
fun while return var { } ( ) , ; > = + ++ - --
9
fun fib(num) { # compute fibs
var return_value = 1, prev = 0, temp;
while (num > 0) {
temp = return_value; return_value = return_value + prev;
prev = temp;
num--;
}
return return_value;
}
Output
fun a(b){var c=1,d=0,e;while(b>0){e=c;c=c+d;d=e;b--;}return c;}
Input
10
( ) + ++ : -> >> >>: b c)
2
($val1++ + +4 kb) >> :out
b-> + 10 >>: t # using >>:
Output
(a+++ +4c )>> :d b->+10>>:e
Tags: greedy, implementation
Correct Solution:
```
#!/usr/bin/python3
input()
reserved = input().split(' ')
lines = int(input())
numbers = '0123456789'
let = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890_$'
def wytnij_res(slowo):
r = ''
for res in reserved:
if len(res) > len(r) and slowo.startswith(res):
r = res
return r
def wytnij_num(slowo):
nm = ''
for c in slowo:
if c in numbers:
nm += c
else:
break
return nm
def wytnij_word(slowo):
nm = ''
if slowo[0] in numbers:
return ''
for c in slowo:
if c in let:
nm += c
else:
break
return nm
def wytnij(slowo):
rs = wytnij_res(slowo)
nm = wytnij_num(slowo)
wrd = wytnij_word(slowo)
ret = ''
for r in [rs, nm, wrd]:
if len(r) > len(ret):
ret = r
if ret == '':
print([rs, nm, wrd])
print(slowo)
assert False
return ret
prog = []
#print(reserved)
for _ in range(lines):
line = input()
line = line.split('#')[0]
line = line.split(' ')
for l in line:
while len(l) > 0:
wrd = wytnij(l)
l = l[len(wrd):]
prog.append(wrd)
letters = 'abcdefghijklmnopqrstuvwxyz'
def gen(st):
ln = len(letters)
res = []
for i in range(ln**st):
j = i
if st == 1:
res.append(letters[i])
else:
res.append(letters[i // ln] + letters[i % ln])
return res
toks = gen(1) + gen(2)
toks = [t for t in toks if t not in reserved]
dct = {}
tprog = []
for p in prog:
if p not in reserved and p[0] not in numbers:
if p not in dct:
dct[p] = toks[0]
toks = toks[1:]
p = dct[p]
tprog.append(p)
# print(prog)
# print(tprog)
res = ''
#na_pale = ''.join(tprog)
for tok in reversed(tprog):
nres = tok + res
if wytnij(nres) != tok:
# print('wycialem {} a tok {}'.format(wytnij(na_pale), tok))
res = tok + ' ' + res
else:
res = tok + res
print(res)
```
| 67,285
|
[
0.18212890625,
-0.42626953125,
-0.1820068359375,
0.2744140625,
-0.62060546875,
-0.356201171875,
0.047149658203125,
0.1824951171875,
-0.2237548828125,
0.294921875,
0.349853515625,
0.03558349609375,
0.07696533203125,
-0.826171875,
-0.72216796875,
0.31201171875,
-0.57763671875,
-0.4267578125,
-0.65380859375,
-0.10601806640625,
-0.26953125,
-0.033966064453125,
-1.576171875,
-0.337646484375,
-0.6982421875,
1.1953125,
-0.00799560546875,
-0.21240234375,
0.95556640625,
0.880859375,
-0.5732421875,
-0.412109375,
0.318359375,
-0.74560546875,
-0.258544921875,
-0.6845703125,
0.71240234375,
-0.51904296875,
-0.1282958984375,
-0.114013671875,
-0.208740234375,
-0.5244140625,
0.316162109375,
-0.8349609375,
-1.3056640625,
-0.036224365234375,
-0.2259521484375,
-0.1962890625,
-0.10382080078125,
-0.47900390625,
0.055419921875,
0.3359375,
0.30615234375,
-0.1839599609375,
-0.2259521484375,
-0.3310546875,
0.12286376953125,
-0.042999267578125,
-0.389892578125,
-0.027069091796875,
-0.470703125,
0.2047119140625,
-0.0521240234375,
-0.57373046875,
-0.1683349609375,
0.8125,
-0.267822265625,
0.257080078125,
0.06463623046875,
-0.5341796875,
0.035552978515625,
0.393798828125,
-0.470947265625,
-0.333984375,
-0.6005859375,
-0.194580078125,
0.5107421875,
0.239990234375,
-0.58984375,
0.52587890625,
0.319580078125,
0.9091796875,
0.170166015625,
0.142578125,
-0.5458984375,
-0.55029296875,
0.37841796875,
0.1976318359375,
0.07269287109375,
-0.1849365234375,
-0.12127685546875,
0.5302734375,
-0.564453125,
-0.055145263671875,
0.93896484375,
0.47802734375,
-0.203857421875,
0.69921875,
-0.1881103515625,
0.434326171875,
0.6025390625,
0.853515625,
-0.84912109375,
0.7041015625,
-0.263671875,
0.16259765625,
0.1129150390625,
0.019317626953125,
-0.284423828125,
-0.11285400390625,
0.035430908203125,
-0.91162109375,
-0.0185546875,
-0.43603515625,
-0.1055908203125,
0.87890625,
-0.32666015625,
0.400146484375,
-1.0068359375,
0.26953125,
0.615234375,
-0.6142578125,
0.35888671875,
-0.314697265625,
0.387451171875,
-0.373046875,
0.1142578125,
0.60107421875,
-0.34130859375,
-0.09173583984375,
0.6279296875,
-0.241455078125,
-0.05767822265625,
0.478271484375,
0.280029296875,
0.79833984375,
0.0257110595703125,
0.397705078125,
0.56787109375,
-0.362548828125,
0.09014892578125,
0.1575927734375,
-0.0809326171875,
1.3740234375,
0.36572265625,
0.188720703125,
0.01837158203125,
0.39990234375,
-0.43798828125,
0.271240234375,
-1.0439453125,
0.292236328125,
0.44580078125,
0.20751953125,
-0.267333984375,
0.00274658203125,
-0.385986328125,
0.67041015625,
0.48486328125,
0.09893798828125,
-0.2113037109375,
-0.0958251953125,
-0.129150390625,
0.892578125,
-0.767578125,
0.56298828125,
-0.461669921875,
-0.401611328125,
-0.2310791015625,
-0.341796875,
0.42236328125,
-0.0179290771484375,
-0.287353515625,
0.630859375,
0.202880859375,
0.78271484375,
0.85498046875,
0.1455078125,
0.11651611328125,
0.2125244140625,
-0.358642578125,
0.286376953125,
-0.1070556640625,
0.88232421875,
0.1959228515625,
0.2340087890625,
0.08331298828125,
-0.1390380859375,
-0.8291015625,
-0.177490234375,
0.2095947265625,
0.88232421875,
-0.474609375,
0.053375244140625,
0.0213623046875,
-0.27978515625,
-0.59326171875,
-0.289794921875,
-0.1473388671875,
-0.73681640625,
-0.81884765625,
0.9326171875,
-0.1324462890625,
0.495849609375,
-0.4716796875,
-0.1671142578125,
0.5634765625,
1.462890625,
-0.63671875,
-0.1683349609375,
0.71728515625,
0.165283203125,
0.06719970703125,
-0.302978515625,
-0.06121826171875,
-0.01316070556640625,
-0.63232421875,
0.75390625,
-0.430419921875,
0.32080078125,
0.07781982421875,
0.515625,
0.5146484375,
0.509765625,
-0.208740234375,
-0.33642578125,
0.2100830078125,
1.0380859375,
-0.130126953125,
-0.31201171875,
0.040618896484375,
0.59423828125,
0.331298828125,
0.77587890625,
0.1844482421875,
0.044647216796875,
1.0654296875,
1.2373046875,
-0.2481689453125,
0.5595703125,
0.199951171875,
0.2177734375,
0.50146484375,
0.369140625,
0.385986328125,
0.374267578125,
-0.3232421875,
-0.302978515625,
-0.43994140625,
0.5390625,
-0.56396484375,
0.64013671875,
0.521484375,
0.72900390625,
-0.60546875,
-0.73876953125,
0.124755859375,
0.57470703125,
-0.63916015625,
-0.38330078125,
0.1815185546875,
-0.19921875,
0.426513671875,
0.09722900390625,
0.455078125,
0.4853515625,
0.5732421875,
0.434326171875,
-0.07354736328125,
-0.482177734375,
-0.8505859375,
-0.6142578125,
-0.84716796875,
-0.0036640167236328125,
-0.57861328125,
0.143798828125,
-0.0362548828125,
-1.0556640625,
0.572265625,
-0.325439453125,
-0.198974609375,
-0.34326171875,
-0.845703125,
0.31982421875,
0.10540771484375,
0.5224609375,
-0.248779296875,
0.9091796875,
0.2325439453125,
0.99267578125,
-0.84326171875,
-0.09503173828125,
-0.0191497802734375,
-0.6103515625,
0.365478515625,
-0.1473388671875,
0.28662109375,
-0.0570068359375,
-0.78955078125,
-0.65185546875,
-0.2054443359375,
-0.231689453125,
0.1627197265625,
0.259521484375,
-0.68310546875,
0.85205078125,
0.1275634765625,
-0.509765625,
0.7919921875,
0.439453125,
-1.130859375,
0.5830078125,
-0.09991455078125,
0.0020599365234375,
-0.7724609375,
1.5244140625,
0.6005859375,
0.70849609375,
-0.1739501953125,
-0.352294921875,
-0.26220703125,
0.1259765625,
-0.0653076171875,
-0.449462890625,
-0.283935546875,
0.8369140625,
0.121337890625,
-1.0107421875,
0.358154296875,
-0.91259765625,
-0.513671875,
-0.141357421875,
-0.55029296875,
0.7158203125,
0.478515625,
0.1966552734375,
-0.085693359375,
-0.04681396484375,
-0.80615234375,
0.492431640625,
0.488037109375,
-0.6455078125,
0.03509521484375,
0.38525390625,
-0.1075439453125,
0.287109375,
0.166015625,
-0.84228515625,
0.208984375,
-0.57568359375,
0.2491455078125,
0.62939453125,
0.447509765625,
-0.052642822265625,
-0.1326904296875,
0.9287109375,
-1.068359375,
-0.48193359375,
-0.264892578125,
0.7138671875,
0.83349609375,
0.59814453125,
0.29150390625,
-0.47119140625,
-0.58447265625,
-1.1435546875,
-0.1312255859375,
-0.0841064453125,
0.7509765625,
-0.93994140625,
0.97021484375,
0.3916015625,
-0.81640625,
0.44384765625,
-0.446044921875,
-0.157958984375,
0.92138671875,
-0.06787109375,
0.515625,
-0.9560546875,
0.2408447265625,
-0.328125,
0.005771636962890625,
0.572265625,
0.432861328125,
0.7880859375,
-0.642578125,
-0.50341796875,
-0.07135009765625,
-0.388671875,
-0.355712890625,
-0.403564453125,
0.053619384765625,
-0.43017578125,
-0.71484375,
-1.0068359375,
0.94970703125,
0.190185546875,
0.4326171875,
-0.07763671875,
0.4248046875,
-0.1458740234375,
0.2012939453125,
0.56689453125,
-0.10174560546875,
0.09991455078125,
-0.677734375,
1.1142578125,
-0.09527587890625,
-0.33056640625,
-0.33056640625,
-0.366943359375,
-0.3251953125,
0.06109619140625,
0.442138671875,
0.0241851806640625,
-0.65087890625,
0.364990234375,
0.237060546875,
0.1885986328125,
-0.67041015625,
-0.453857421875,
-0.5673828125,
0.623046875,
0.546875,
-1.111328125,
0.2041015625,
-0.08917236328125,
0.2822265625,
0.40185546875,
0.10125732421875,
-0.36669921875,
-0.460693359375,
-0.458740234375,
-0.6240234375,
0.2235107421875,
0.7265625,
-0.13037109375,
0.029998779296875,
-0.75537109375,
0.497314453125,
0.37353515625,
0.2127685546875,
0.037200927734375,
0.1923828125,
0.352294921875,
-0.135498046875,
0.86669921875,
-0.2095947265625,
-0.4697265625,
0.65478515625,
-0.712890625,
0.84423828125,
-0.66015625,
0.1514892578125,
0.06048583984375,
-0.106201171875,
-0.40869140625,
0.62158203125,
0.09783935546875,
-0.1822509765625,
-0.380615234375,
0.1715087890625,
-1.0693359375,
-0.8681640625,
0.642578125,
-0.08380126953125,
-0.245849609375,
0.92822265625,
0.37353515625,
-0.32373046875,
0.496337890625,
0.200927734375,
-0.424072265625,
0.35009765625,
-0.6513671875,
0.1968994140625,
-0.220703125,
-0.308837890625,
0.035980224609375,
-0.448974609375,
0.5634765625,
0.35205078125,
-0.82177734375,
-0.313232421875,
-0.78515625,
-0.10150146484375,
-0.04278564453125,
-0.402587890625,
0.2998046875,
-0.176513671875,
0.05157470703125,
0.296630859375,
-0.51611328125,
-0.2098388671875,
-0.417236328125,
-0.67919921875,
-0.269287109375,
0.446044921875,
0.5791015625,
0.638671875,
-0.01415252685546875,
-0.6767578125,
0.2412109375,
-0.09051513671875,
-0.0511474609375,
-0.67724609375,
-0.0826416015625,
-0.18017578125,
-0.26513671875,
-0.10833740234375,
0.2919921875,
0.28564453125,
0.2127685546875,
0.7841796875,
0.2095947265625,
0.70751953125,
0.24609375,
-0.64697265625,
0.5126953125,
-0.10528564453125,
-1.001953125,
-0.29736328125,
0.83544921875,
-0.123779296875,
0.95068359375,
0.238525390625,
-0.82763671875,
-0.47412109375,
-0.892578125,
0.0980224609375,
-0.87939453125,
0.019561767578125,
-0.65625,
-0.4921875,
-0.273193359375,
0.802734375,
-0.43896484375,
-0.4599609375,
-0.32763671875,
-0.52685546875,
0.2481689453125,
-0.650390625,
-0.247314453125,
-0.07843017578125,
-0.65478515625,
-0.400634765625,
0.9501953125,
0.00409698486328125,
0.509765625,
-0.263671875,
-0.1737060546875,
0.64208984375,
0.38916015625,
-0.9384765625,
-0.470703125,
-0.1109619140625,
0.050262451171875,
-0.03131103515625,
-0.282470703125,
-0.60888671875,
1.234375,
-1.037109375,
0.081787109375,
-0.1282958984375,
-0.80029296875,
-0.498291015625,
-0.1396484375,
0.97021484375,
-0.247314453125,
-0.267578125,
0.049774169921875,
0.7421875,
0.4501953125,
-0.01556396484375,
-0.4990234375,
-0.302978515625,
-0.759765625,
-0.87451171875,
0.62451171875,
0.07232666015625,
0.3896484375,
-0.18603515625,
-0.2135009765625,
1.3876953125,
-0.41357421875,
0.560546875,
1.26171875,
0.12237548828125,
0.2049560546875,
-0.48291015625,
0.92041015625,
0.437255859375,
-0.59033203125,
0.1607666015625,
0.5185546875,
-0.1920166015625,
0.10076904296875,
-0.81640625,
-0.5380859375,
-0.77294921875,
0.1240234375,
1.2685546875,
-0.4814453125,
0.35546875,
-0.453369140625,
-1.2568359375,
-0.60693359375,
0.84326171875,
-0.10791015625,
-0.0259857177734375,
0.9072265625,
-0.420654296875,
0.260009765625,
0.060638427734375,
0.25341796875,
0.07354736328125,
-0.2484130859375,
1.06640625,
-0.1807861328125,
-0.385009765625,
0.3759765625,
0.7763671875,
-1.234375,
-0.5869140625,
-0.10211181640625,
0.1468505859375,
-0.4013671875,
-0.4375,
-0.1942138671875,
0.408935546875,
-0.57666015625,
0.037017822265625,
0.4970703125,
-0.1422119140625,
0.467529296875,
0.074951171875,
-0.179931640625,
-0.467041015625,
0.30078125,
0.826171875,
-0.84765625,
-0.329833984375,
-0.6826171875,
0.074951171875,
0.0316162109375,
0.013397216796875,
0.81494140625,
-0.00994873046875,
0.488525390625,
0.734375,
0.0082550048828125,
1.103515625,
-0.440673828125,
0.07464599609375,
0.42822265625,
-0.54345703125,
-0.576171875,
-0.30029296875,
0.0660400390625,
-0.296142578125,
0.4912109375,
-0.716796875,
0.101318359375,
0.1396484375,
0.1484375,
-0.1661376953125,
-1.0107421875,
-0.1265869140625,
-0.8095703125,
-0.32177734375,
-0.59130859375,
-0.346435546875,
-0.1715087890625,
0.130859375,
-0.1490478515625,
-0.82080078125,
0.5068359375,
0.00965118408203125,
-0.5693359375,
0.1279296875,
-0.39794921875,
0.4677734375,
-0.603515625,
-0.43408203125,
-0.61279296875,
-0.494140625,
-0.640625,
0.0972900390625,
-0.171875,
0.1724853515625,
-0.20947265625,
0.350341796875,
-0.378662109375,
0.08203125,
-0.011871337890625,
-0.42138671875,
0.05596923828125,
0.316162109375,
-0.07501220703125,
0.8173828125,
0.448486328125,
0.5556640625,
-0.05841064453125,
0.028167724609375,
-0.32177734375,
0.1080322265625,
0.32421875,
0.5947265625,
0.05023193359375,
0.01428985595703125,
0.006412506103515625,
0.09771728515625,
-0.65283203125,
0.25537109375,
-0.06549072265625,
0.2177734375,
0.55126953125,
-0.09857177734375,
0.455322265625,
1.1748046875,
0.041015625,
0.12359619140625,
0.263916015625,
0.4140625,
0.61328125,
-0.449462890625,
0.33349609375,
0.11993408203125,
0.08636474609375,
-0.37353515625,
0.1036376953125,
0.35498046875,
-0.1300048828125,
0.2073974609375,
-0.120849609375,
-0.380615234375,
-1.1181640625,
-0.35107421875,
0.08734130859375,
0.6533203125,
0.4775390625,
-0.390625,
0.40283203125,
0.0745849609375,
-0.488525390625,
0.5634765625,
-0.8330078125,
-0.8759765625,
0.56494140625,
-0.35888671875,
-0.0027141571044921875,
-0.62744140625,
-0.400146484375,
-0.1376953125,
-0.1297607421875,
0.0875244140625,
-0.268798828125,
0.11322021484375,
0.152099609375,
0.54931640625,
-0.06304931640625,
0.045318603515625,
0.09393310546875,
0.63623046875,
-0.472900390625,
-0.58935546875,
0.12335205078125,
1.0400390625,
0.08935546875,
-0.289794921875,
-0.484375,
0.1346435546875,
0.19189453125,
0.75048828125,
-0.8037109375,
-0.462646484375,
-0.38525390625,
0.60791015625,
-0.646484375,
-0.2298583984375,
-0.187255859375,
1.05859375,
0.1630859375,
-0.2017822265625,
-0.368896484375,
0.65283203125,
0.95751953125,
-0.210205078125,
0.395751953125,
0.2069091796875,
0.400634765625,
-0.466796875,
-0.21630859375,
-0.1580810546875,
0.7578125,
0.72705078125,
0.91064453125,
-0.07275390625,
0.203369140625,
0.57666015625,
-0.147705078125,
-0.4814453125,
0.0250091552734375,
-0.0129241943359375,
-0.30908203125,
-0.5205078125,
0.28662109375,
-0.1842041015625,
-0.2265625,
-0.44482421875,
0.44189453125,
-0.576171875,
-0.317138671875,
-0.50048828125,
-0.62451171875,
1.119140625,
-0.42578125,
0.1341552734375,
-0.108642578125,
-0.19140625,
0.3095703125,
0.87841796875,
-0.21923828125,
0.06781005859375,
1.1962890625,
0.40673828125,
0.09161376953125,
0.43505859375,
0.338623046875,
0.363037109375,
-0.1810302734375,
0.1529541015625,
-0.162109375,
0.1572265625,
-0.36181640625,
-0.247314453125,
-0.92626953125,
0.66845703125,
-0.6015625,
0.01457977294921875,
0.1861572265625,
-0.77978515625,
-0.412109375,
-0.53125,
0.47509765625,
-0.939453125,
0.00885009765625,
0.277587890625,
-0.438232421875,
-0.8701171875,
1.0693359375,
-0.06585693359375,
0.501953125,
0.035491943359375,
0.65185546875,
-0.05419921875,
1.482421875,
0.224365234375,
-0.447509765625,
0.1500244140625,
0.40478515625,
-0.1976318359375,
-0.81591796875,
0.01450347900390625,
-0.4365234375,
-0.479248046875,
-0.69580078125,
-0.5380859375,
0.01486968994140625,
0.8466796875,
0.2222900390625,
-1.1611328125,
-0.152587890625,
0.0218658447265625,
-0.56787109375,
0.315673828125,
0.1004638671875,
0.367431640625,
-0.2406005859375,
0.10333251953125,
0.1497802734375,
-0.3994140625,
-0.326904296875,
-0.400146484375,
0.2027587890625,
-0.2391357421875,
-0.53466796875,
-0.77783203125,
-0.4931640625,
-0.263916015625,
-0.0207977294921875,
-0.5341796875,
-0.6826171875,
0.60400390625,
0.87646484375,
0.79296875,
0.446533203125,
-0.55029296875,
-0.0831298828125,
0.5634765625,
0.9833984375,
-0.045166015625,
0.4697265625,
0.8369140625,
-0.01383209228515625,
0.44775390625,
-0.305908203125,
0.41552734375,
-0.0963134765625,
-0.230224609375,
-0.5791015625,
-0.06610107421875,
-0.77734375,
-1.365234375,
0.16650390625,
0.407470703125,
0.68115234375,
-0.57373046875,
-0.90625,
-0.372314453125,
-0.89404296875,
-0.048248291015625,
-0.87109375,
0.475830078125,
0.2034912109375,
-0.2061767578125,
0.350830078125,
-0.83935546875,
4.5078125,
1.11328125,
0.49365234375,
0.305908203125,
0.2130126953125,
0.98291015625,
0.322021484375,
-1.2529296875,
0.09771728515625,
-0.8486328125,
0.1864013671875,
-0.95068359375,
-0.01165008544921875,
0.5458984375,
0.41015625,
0.623046875,
-0.52001953125,
-0.11492919921875,
0.0689697265625,
-1.2578125,
-0.89501953125,
0.382568359375,
-0.402587890625,
0.62255859375,
0.29541015625,
0.392822265625,
0.218994140625,
-0.449462890625,
-0.296875,
-0.53125,
-0.06744384765625,
-0.583984375,
0.7578125,
0.263916015625,
-0.258544921875,
1.08984375,
0.18701171875,
-0.0941162109375,
-0.2041015625,
0.4111328125,
-0.2646484375,
0.12457275390625,
0.94580078125,
-1.0146484375,
0.06561279296875,
0.6982421875,
-0.318359375,
-0.1533203125,
0.54150390625,
-0.95849609375,
1.1806640625,
-0.041351318359375,
0.326416015625,
0.1927490234375,
-0.63525390625,
0.08154296875,
-0.0743408203125,
0.002170562744140625,
0.314208984375,
0.261474609375,
0.4736328125,
0.245361328125,
0.3515625,
0.357666015625,
-0.89306640625,
0.6533203125,
-0.24853515625,
0.77294921875,
-0.5732421875,
-0.287353515625,
-0.38916015625,
-0.1566162109375,
-0.323974609375,
-0.50732421875,
0.861328125,
0.2371826171875,
-0.0283050537109375,
0.57470703125,
0.5185546875,
-0.9228515625,
0.372802734375,
-0.050201416015625,
-0.62841796875,
-0.61669921875,
0.603515625,
0.96044921875,
-0.358642578125,
-0.54833984375,
-0.1229248046875,
0.568359375,
0.06805419921875,
0.625,
-0.150146484375,
-0.8115234375,
-0.1162109375
] | 6
|
Provide tags and a correct Python 3 solution for this coding contest problem.
International Coding Procedures Company (ICPC) writes all its code in Jedi Script (JS) programming language. JS does not get compiled, but is delivered for execution in its source form. Sources contain comments, extra whitespace (including trailing and leading spaces), and other non-essential features that make them quite large but do not contribute to the semantics of the code, so the process of minification is performed on source files before their delivery to execution to compress sources while preserving their semantics.
You are hired by ICPC to write JS minifier for ICPC. Fortunately, ICPC adheres to very strict programming practices and their JS sources are quite restricted in grammar. They work only on integer algorithms and do not use floating point numbers and strings.
Every JS source contains a sequence of lines. Each line contains zero or more tokens that can be separated by spaces. On each line, a part of the line that starts with a hash character ('#' code 35), including the hash character itself, is treated as a comment and is ignored up to the end of the line.
Each line is parsed into a sequence of tokens from left to right by repeatedly skipping spaces and finding the longest possible token starting at the current parsing position, thus transforming the source code into a sequence of tokens. All the possible tokens are listed below:
* A reserved token is any kind of operator, separator, literal, reserved word, or a name of a library function that should be preserved during the minification process. Reserved tokens are fixed strings of non-space ASCII characters that do not contain the hash character ('#' code 35). All reserved tokens are given as an input to the minification process.
* A number token consists of a sequence of digits, where a digit is a character from zero ('0') to nine ('9') inclusive.
* A word token consists of a sequence of characters from the following set: lowercase letters, uppercase letters, digits, underscore ('_' code 95), and dollar sign ('$' code 36). A word does not start with a digit.
Note, that during parsing the longest sequence of characters that satisfies either a number or a word definition, but that appears in the list of reserved tokens, is considered to be a reserved token instead.
During the minification process words are renamed in a systematic fashion using the following algorithm:
1. Take a list of words that consist only of lowercase letters ordered first by their length, then lexicographically: "a", "b", ..., "z", "aa", "ab", ..., excluding reserved tokens, since they are not considered to be words. This is the target word list.
2. Rename the first word encountered in the input token sequence to the first word in the target word list and all further occurrences of the same word in the input token sequence, too. Rename the second new word encountered in the input token sequence to the second word in the target word list, and so on.
The goal of the minification process is to convert the given source to the shortest possible line (counting spaces) that still parses to the same sequence of tokens with the correspondingly renamed words using these JS parsing rules.
Input
The first line of the input contains a single integer n (0 ≤ n ≤ 40) — the number of reserved tokens.
The second line of the input contains the list of reserved tokens separated by spaces without repetitions in the list. Each reserved token is at least one and at most 20 characters long and contains only characters with ASCII codes from 33 (exclamation mark) to 126 (tilde) inclusive, with exception of a hash character ('#' code 35).
The third line of the input contains a single integer m (1 ≤ m ≤ 40) — the number of lines in the input source code.
Next m lines contain the input source, each source line is at most 80 characters long (counting leading and trailing spaces). Each line contains only characters with ASCII codes from 32 (space) to 126 (tilde) inclusive. The source code is valid and fully parses into a sequence of tokens.
Output
Write to the output a single line that is the result of the minification process on the input source code. The output source line shall parse to the same sequence of tokens as the input source with the correspondingly renamed words and shall contain the minimum possible number of spaces needed for that. If there are multiple ways to insert the minimum possible number of spaces into the output, use any way.
Examples
Input
16
fun while return var { } ( ) , ; > = + ++ - --
9
fun fib(num) { # compute fibs
var return_value = 1, prev = 0, temp;
while (num > 0) {
temp = return_value; return_value = return_value + prev;
prev = temp;
num--;
}
return return_value;
}
Output
fun a(b){var c=1,d=0,e;while(b>0){e=c;c=c+d;d=e;b--;}return c;}
Input
10
( ) + ++ : -> >> >>: b c)
2
($val1++ + +4 kb) >> :out
b-> + 10 >>: t # using >>:
Output
(a+++ +4c )>> :d b->+10>>:e
Tags: greedy, implementation
Correct Solution:
```
#!/usr/bin/env python3
import sys
n, reserved, m, *lines = sys.stdin.readlines()
n = int(n)
reserved = set(reserved.split())
m = int(m)
#assert len(lines) == m
def strip_comment(line):
return line[:-1].split('#', maxsplit=1)[0]
lines = ' '.join(map(strip_comment, lines))
#print(repr(lines))
def is_digit(c):
return '0' <= c <= '9'
def is_word_char(c):
return c == '_' or c == '$' or '0' <= c <= '9' or 'A' <= c <= 'Z' or 'a' <= c <= 'z'
def digit_match(s, ind):
assert ind < len(s)
res = 0
while res + ind < len(s) and is_digit(s[res + ind]):
res += 1
return res
def word_match(s, ind):
assert ind < len(s)
if is_digit(s[ind]):
return 0
res = 0
while res + ind < len(s) and is_word_char(s[res + ind]):
res += 1
return res
def reserved_match(s, ind):
assert ind < len(s)
return max((len(r) for r in reserved if s.startswith(r, ind)), default=0)
def tokenize(s):
ind = 0
while ind < len(s):
if s[ind] == ' ':
ind += 1
continue
l = max(digit_match(s, ind), word_match(s, ind), reserved_match(s, ind))
if l == 0:
yield '\0' # yield a garbage character to mess up the stream
return
yield s[ind:ind+l]
ind += l
def simplify_tokens(tokens):
def lex_next(s):
for i in range(len(s)-1, -1, -1):
assert 'a' <= s[i] <= 'z'
if s[i] < 'z':
return s[:i] + chr(ord(s[i])+1) + 'a' * (len(s) - i - 1)
return 'a' * (len(s)+1)
converted = {}
cur_word = ''
for token in tokens:
if token in reserved:
yield token
elif '0' <= token[0] <= '9':
yield token
elif token in converted:
yield converted[token]
else:
cur_word = lex_next(cur_word)
while cur_word in reserved:
cur_word = lex_next(cur_word)
converted[token] = cur_word
yield cur_word
tokens = list(simplify_tokens(tokenize(lines)))
#print(tokens)
cur_tokens = []
result = []
for token in tokens:
#assert token
cur_tokens.append(token)
# only have to check the last 20 tokens
if list(tokenize(''.join(cur_tokens[-21:]))) != cur_tokens[-21:]:
result.append(''.join(cur_tokens[:-1]))
cur_tokens = [token]
#assert cur_tokens
if cur_tokens:
result.append(''.join(cur_tokens))
print(' '.join(result))
```
| 67,286
|
[
0.18212890625,
-0.42626953125,
-0.1820068359375,
0.2744140625,
-0.62060546875,
-0.356201171875,
0.047149658203125,
0.1824951171875,
-0.2237548828125,
0.294921875,
0.349853515625,
0.03558349609375,
0.07696533203125,
-0.826171875,
-0.72216796875,
0.31201171875,
-0.57763671875,
-0.4267578125,
-0.65380859375,
-0.10601806640625,
-0.26953125,
-0.033966064453125,
-1.576171875,
-0.337646484375,
-0.6982421875,
1.1953125,
-0.00799560546875,
-0.21240234375,
0.95556640625,
0.880859375,
-0.5732421875,
-0.412109375,
0.318359375,
-0.74560546875,
-0.258544921875,
-0.6845703125,
0.71240234375,
-0.51904296875,
-0.1282958984375,
-0.114013671875,
-0.208740234375,
-0.5244140625,
0.316162109375,
-0.8349609375,
-1.3056640625,
-0.036224365234375,
-0.2259521484375,
-0.1962890625,
-0.10382080078125,
-0.47900390625,
0.055419921875,
0.3359375,
0.30615234375,
-0.1839599609375,
-0.2259521484375,
-0.3310546875,
0.12286376953125,
-0.042999267578125,
-0.389892578125,
-0.027069091796875,
-0.470703125,
0.2047119140625,
-0.0521240234375,
-0.57373046875,
-0.1683349609375,
0.8125,
-0.267822265625,
0.257080078125,
0.06463623046875,
-0.5341796875,
0.035552978515625,
0.393798828125,
-0.470947265625,
-0.333984375,
-0.6005859375,
-0.194580078125,
0.5107421875,
0.239990234375,
-0.58984375,
0.52587890625,
0.319580078125,
0.9091796875,
0.170166015625,
0.142578125,
-0.5458984375,
-0.55029296875,
0.37841796875,
0.1976318359375,
0.07269287109375,
-0.1849365234375,
-0.12127685546875,
0.5302734375,
-0.564453125,
-0.055145263671875,
0.93896484375,
0.47802734375,
-0.203857421875,
0.69921875,
-0.1881103515625,
0.434326171875,
0.6025390625,
0.853515625,
-0.84912109375,
0.7041015625,
-0.263671875,
0.16259765625,
0.1129150390625,
0.019317626953125,
-0.284423828125,
-0.11285400390625,
0.035430908203125,
-0.91162109375,
-0.0185546875,
-0.43603515625,
-0.1055908203125,
0.87890625,
-0.32666015625,
0.400146484375,
-1.0068359375,
0.26953125,
0.615234375,
-0.6142578125,
0.35888671875,
-0.314697265625,
0.387451171875,
-0.373046875,
0.1142578125,
0.60107421875,
-0.34130859375,
-0.09173583984375,
0.6279296875,
-0.241455078125,
-0.05767822265625,
0.478271484375,
0.280029296875,
0.79833984375,
0.0257110595703125,
0.397705078125,
0.56787109375,
-0.362548828125,
0.09014892578125,
0.1575927734375,
-0.0809326171875,
1.3740234375,
0.36572265625,
0.188720703125,
0.01837158203125,
0.39990234375,
-0.43798828125,
0.271240234375,
-1.0439453125,
0.292236328125,
0.44580078125,
0.20751953125,
-0.267333984375,
0.00274658203125,
-0.385986328125,
0.67041015625,
0.48486328125,
0.09893798828125,
-0.2113037109375,
-0.0958251953125,
-0.129150390625,
0.892578125,
-0.767578125,
0.56298828125,
-0.461669921875,
-0.401611328125,
-0.2310791015625,
-0.341796875,
0.42236328125,
-0.0179290771484375,
-0.287353515625,
0.630859375,
0.202880859375,
0.78271484375,
0.85498046875,
0.1455078125,
0.11651611328125,
0.2125244140625,
-0.358642578125,
0.286376953125,
-0.1070556640625,
0.88232421875,
0.1959228515625,
0.2340087890625,
0.08331298828125,
-0.1390380859375,
-0.8291015625,
-0.177490234375,
0.2095947265625,
0.88232421875,
-0.474609375,
0.053375244140625,
0.0213623046875,
-0.27978515625,
-0.59326171875,
-0.289794921875,
-0.1473388671875,
-0.73681640625,
-0.81884765625,
0.9326171875,
-0.1324462890625,
0.495849609375,
-0.4716796875,
-0.1671142578125,
0.5634765625,
1.462890625,
-0.63671875,
-0.1683349609375,
0.71728515625,
0.165283203125,
0.06719970703125,
-0.302978515625,
-0.06121826171875,
-0.01316070556640625,
-0.63232421875,
0.75390625,
-0.430419921875,
0.32080078125,
0.07781982421875,
0.515625,
0.5146484375,
0.509765625,
-0.208740234375,
-0.33642578125,
0.2100830078125,
1.0380859375,
-0.130126953125,
-0.31201171875,
0.040618896484375,
0.59423828125,
0.331298828125,
0.77587890625,
0.1844482421875,
0.044647216796875,
1.0654296875,
1.2373046875,
-0.2481689453125,
0.5595703125,
0.199951171875,
0.2177734375,
0.50146484375,
0.369140625,
0.385986328125,
0.374267578125,
-0.3232421875,
-0.302978515625,
-0.43994140625,
0.5390625,
-0.56396484375,
0.64013671875,
0.521484375,
0.72900390625,
-0.60546875,
-0.73876953125,
0.124755859375,
0.57470703125,
-0.63916015625,
-0.38330078125,
0.1815185546875,
-0.19921875,
0.426513671875,
0.09722900390625,
0.455078125,
0.4853515625,
0.5732421875,
0.434326171875,
-0.07354736328125,
-0.482177734375,
-0.8505859375,
-0.6142578125,
-0.84716796875,
-0.0036640167236328125,
-0.57861328125,
0.143798828125,
-0.0362548828125,
-1.0556640625,
0.572265625,
-0.325439453125,
-0.198974609375,
-0.34326171875,
-0.845703125,
0.31982421875,
0.10540771484375,
0.5224609375,
-0.248779296875,
0.9091796875,
0.2325439453125,
0.99267578125,
-0.84326171875,
-0.09503173828125,
-0.0191497802734375,
-0.6103515625,
0.365478515625,
-0.1473388671875,
0.28662109375,
-0.0570068359375,
-0.78955078125,
-0.65185546875,
-0.2054443359375,
-0.231689453125,
0.1627197265625,
0.259521484375,
-0.68310546875,
0.85205078125,
0.1275634765625,
-0.509765625,
0.7919921875,
0.439453125,
-1.130859375,
0.5830078125,
-0.09991455078125,
0.0020599365234375,
-0.7724609375,
1.5244140625,
0.6005859375,
0.70849609375,
-0.1739501953125,
-0.352294921875,
-0.26220703125,
0.1259765625,
-0.0653076171875,
-0.449462890625,
-0.283935546875,
0.8369140625,
0.121337890625,
-1.0107421875,
0.358154296875,
-0.91259765625,
-0.513671875,
-0.141357421875,
-0.55029296875,
0.7158203125,
0.478515625,
0.1966552734375,
-0.085693359375,
-0.04681396484375,
-0.80615234375,
0.492431640625,
0.488037109375,
-0.6455078125,
0.03509521484375,
0.38525390625,
-0.1075439453125,
0.287109375,
0.166015625,
-0.84228515625,
0.208984375,
-0.57568359375,
0.2491455078125,
0.62939453125,
0.447509765625,
-0.052642822265625,
-0.1326904296875,
0.9287109375,
-1.068359375,
-0.48193359375,
-0.264892578125,
0.7138671875,
0.83349609375,
0.59814453125,
0.29150390625,
-0.47119140625,
-0.58447265625,
-1.1435546875,
-0.1312255859375,
-0.0841064453125,
0.7509765625,
-0.93994140625,
0.97021484375,
0.3916015625,
-0.81640625,
0.44384765625,
-0.446044921875,
-0.157958984375,
0.92138671875,
-0.06787109375,
0.515625,
-0.9560546875,
0.2408447265625,
-0.328125,
0.005771636962890625,
0.572265625,
0.432861328125,
0.7880859375,
-0.642578125,
-0.50341796875,
-0.07135009765625,
-0.388671875,
-0.355712890625,
-0.403564453125,
0.053619384765625,
-0.43017578125,
-0.71484375,
-1.0068359375,
0.94970703125,
0.190185546875,
0.4326171875,
-0.07763671875,
0.4248046875,
-0.1458740234375,
0.2012939453125,
0.56689453125,
-0.10174560546875,
0.09991455078125,
-0.677734375,
1.1142578125,
-0.09527587890625,
-0.33056640625,
-0.33056640625,
-0.366943359375,
-0.3251953125,
0.06109619140625,
0.442138671875,
0.0241851806640625,
-0.65087890625,
0.364990234375,
0.237060546875,
0.1885986328125,
-0.67041015625,
-0.453857421875,
-0.5673828125,
0.623046875,
0.546875,
-1.111328125,
0.2041015625,
-0.08917236328125,
0.2822265625,
0.40185546875,
0.10125732421875,
-0.36669921875,
-0.460693359375,
-0.458740234375,
-0.6240234375,
0.2235107421875,
0.7265625,
-0.13037109375,
0.029998779296875,
-0.75537109375,
0.497314453125,
0.37353515625,
0.2127685546875,
0.037200927734375,
0.1923828125,
0.352294921875,
-0.135498046875,
0.86669921875,
-0.2095947265625,
-0.4697265625,
0.65478515625,
-0.712890625,
0.84423828125,
-0.66015625,
0.1514892578125,
0.06048583984375,
-0.106201171875,
-0.40869140625,
0.62158203125,
0.09783935546875,
-0.1822509765625,
-0.380615234375,
0.1715087890625,
-1.0693359375,
-0.8681640625,
0.642578125,
-0.08380126953125,
-0.245849609375,
0.92822265625,
0.37353515625,
-0.32373046875,
0.496337890625,
0.200927734375,
-0.424072265625,
0.35009765625,
-0.6513671875,
0.1968994140625,
-0.220703125,
-0.308837890625,
0.035980224609375,
-0.448974609375,
0.5634765625,
0.35205078125,
-0.82177734375,
-0.313232421875,
-0.78515625,
-0.10150146484375,
-0.04278564453125,
-0.402587890625,
0.2998046875,
-0.176513671875,
0.05157470703125,
0.296630859375,
-0.51611328125,
-0.2098388671875,
-0.417236328125,
-0.67919921875,
-0.269287109375,
0.446044921875,
0.5791015625,
0.638671875,
-0.01415252685546875,
-0.6767578125,
0.2412109375,
-0.09051513671875,
-0.0511474609375,
-0.67724609375,
-0.0826416015625,
-0.18017578125,
-0.26513671875,
-0.10833740234375,
0.2919921875,
0.28564453125,
0.2127685546875,
0.7841796875,
0.2095947265625,
0.70751953125,
0.24609375,
-0.64697265625,
0.5126953125,
-0.10528564453125,
-1.001953125,
-0.29736328125,
0.83544921875,
-0.123779296875,
0.95068359375,
0.238525390625,
-0.82763671875,
-0.47412109375,
-0.892578125,
0.0980224609375,
-0.87939453125,
0.019561767578125,
-0.65625,
-0.4921875,
-0.273193359375,
0.802734375,
-0.43896484375,
-0.4599609375,
-0.32763671875,
-0.52685546875,
0.2481689453125,
-0.650390625,
-0.247314453125,
-0.07843017578125,
-0.65478515625,
-0.400634765625,
0.9501953125,
0.00409698486328125,
0.509765625,
-0.263671875,
-0.1737060546875,
0.64208984375,
0.38916015625,
-0.9384765625,
-0.470703125,
-0.1109619140625,
0.050262451171875,
-0.03131103515625,
-0.282470703125,
-0.60888671875,
1.234375,
-1.037109375,
0.081787109375,
-0.1282958984375,
-0.80029296875,
-0.498291015625,
-0.1396484375,
0.97021484375,
-0.247314453125,
-0.267578125,
0.049774169921875,
0.7421875,
0.4501953125,
-0.01556396484375,
-0.4990234375,
-0.302978515625,
-0.759765625,
-0.87451171875,
0.62451171875,
0.07232666015625,
0.3896484375,
-0.18603515625,
-0.2135009765625,
1.3876953125,
-0.41357421875,
0.560546875,
1.26171875,
0.12237548828125,
0.2049560546875,
-0.48291015625,
0.92041015625,
0.437255859375,
-0.59033203125,
0.1607666015625,
0.5185546875,
-0.1920166015625,
0.10076904296875,
-0.81640625,
-0.5380859375,
-0.77294921875,
0.1240234375,
1.2685546875,
-0.4814453125,
0.35546875,
-0.453369140625,
-1.2568359375,
-0.60693359375,
0.84326171875,
-0.10791015625,
-0.0259857177734375,
0.9072265625,
-0.420654296875,
0.260009765625,
0.060638427734375,
0.25341796875,
0.07354736328125,
-0.2484130859375,
1.06640625,
-0.1807861328125,
-0.385009765625,
0.3759765625,
0.7763671875,
-1.234375,
-0.5869140625,
-0.10211181640625,
0.1468505859375,
-0.4013671875,
-0.4375,
-0.1942138671875,
0.408935546875,
-0.57666015625,
0.037017822265625,
0.4970703125,
-0.1422119140625,
0.467529296875,
0.074951171875,
-0.179931640625,
-0.467041015625,
0.30078125,
0.826171875,
-0.84765625,
-0.329833984375,
-0.6826171875,
0.074951171875,
0.0316162109375,
0.013397216796875,
0.81494140625,
-0.00994873046875,
0.488525390625,
0.734375,
0.0082550048828125,
1.103515625,
-0.440673828125,
0.07464599609375,
0.42822265625,
-0.54345703125,
-0.576171875,
-0.30029296875,
0.0660400390625,
-0.296142578125,
0.4912109375,
-0.716796875,
0.101318359375,
0.1396484375,
0.1484375,
-0.1661376953125,
-1.0107421875,
-0.1265869140625,
-0.8095703125,
-0.32177734375,
-0.59130859375,
-0.346435546875,
-0.1715087890625,
0.130859375,
-0.1490478515625,
-0.82080078125,
0.5068359375,
0.00965118408203125,
-0.5693359375,
0.1279296875,
-0.39794921875,
0.4677734375,
-0.603515625,
-0.43408203125,
-0.61279296875,
-0.494140625,
-0.640625,
0.0972900390625,
-0.171875,
0.1724853515625,
-0.20947265625,
0.350341796875,
-0.378662109375,
0.08203125,
-0.011871337890625,
-0.42138671875,
0.05596923828125,
0.316162109375,
-0.07501220703125,
0.8173828125,
0.448486328125,
0.5556640625,
-0.05841064453125,
0.028167724609375,
-0.32177734375,
0.1080322265625,
0.32421875,
0.5947265625,
0.05023193359375,
0.01428985595703125,
0.006412506103515625,
0.09771728515625,
-0.65283203125,
0.25537109375,
-0.06549072265625,
0.2177734375,
0.55126953125,
-0.09857177734375,
0.455322265625,
1.1748046875,
0.041015625,
0.12359619140625,
0.263916015625,
0.4140625,
0.61328125,
-0.449462890625,
0.33349609375,
0.11993408203125,
0.08636474609375,
-0.37353515625,
0.1036376953125,
0.35498046875,
-0.1300048828125,
0.2073974609375,
-0.120849609375,
-0.380615234375,
-1.1181640625,
-0.35107421875,
0.08734130859375,
0.6533203125,
0.4775390625,
-0.390625,
0.40283203125,
0.0745849609375,
-0.488525390625,
0.5634765625,
-0.8330078125,
-0.8759765625,
0.56494140625,
-0.35888671875,
-0.0027141571044921875,
-0.62744140625,
-0.400146484375,
-0.1376953125,
-0.1297607421875,
0.0875244140625,
-0.268798828125,
0.11322021484375,
0.152099609375,
0.54931640625,
-0.06304931640625,
0.045318603515625,
0.09393310546875,
0.63623046875,
-0.472900390625,
-0.58935546875,
0.12335205078125,
1.0400390625,
0.08935546875,
-0.289794921875,
-0.484375,
0.1346435546875,
0.19189453125,
0.75048828125,
-0.8037109375,
-0.462646484375,
-0.38525390625,
0.60791015625,
-0.646484375,
-0.2298583984375,
-0.187255859375,
1.05859375,
0.1630859375,
-0.2017822265625,
-0.368896484375,
0.65283203125,
0.95751953125,
-0.210205078125,
0.395751953125,
0.2069091796875,
0.400634765625,
-0.466796875,
-0.21630859375,
-0.1580810546875,
0.7578125,
0.72705078125,
0.91064453125,
-0.07275390625,
0.203369140625,
0.57666015625,
-0.147705078125,
-0.4814453125,
0.0250091552734375,
-0.0129241943359375,
-0.30908203125,
-0.5205078125,
0.28662109375,
-0.1842041015625,
-0.2265625,
-0.44482421875,
0.44189453125,
-0.576171875,
-0.317138671875,
-0.50048828125,
-0.62451171875,
1.119140625,
-0.42578125,
0.1341552734375,
-0.108642578125,
-0.19140625,
0.3095703125,
0.87841796875,
-0.21923828125,
0.06781005859375,
1.1962890625,
0.40673828125,
0.09161376953125,
0.43505859375,
0.338623046875,
0.363037109375,
-0.1810302734375,
0.1529541015625,
-0.162109375,
0.1572265625,
-0.36181640625,
-0.247314453125,
-0.92626953125,
0.66845703125,
-0.6015625,
0.01457977294921875,
0.1861572265625,
-0.77978515625,
-0.412109375,
-0.53125,
0.47509765625,
-0.939453125,
0.00885009765625,
0.277587890625,
-0.438232421875,
-0.8701171875,
1.0693359375,
-0.06585693359375,
0.501953125,
0.035491943359375,
0.65185546875,
-0.05419921875,
1.482421875,
0.224365234375,
-0.447509765625,
0.1500244140625,
0.40478515625,
-0.1976318359375,
-0.81591796875,
0.01450347900390625,
-0.4365234375,
-0.479248046875,
-0.69580078125,
-0.5380859375,
0.01486968994140625,
0.8466796875,
0.2222900390625,
-1.1611328125,
-0.152587890625,
0.0218658447265625,
-0.56787109375,
0.315673828125,
0.1004638671875,
0.367431640625,
-0.2406005859375,
0.10333251953125,
0.1497802734375,
-0.3994140625,
-0.326904296875,
-0.400146484375,
0.2027587890625,
-0.2391357421875,
-0.53466796875,
-0.77783203125,
-0.4931640625,
-0.263916015625,
-0.0207977294921875,
-0.5341796875,
-0.6826171875,
0.60400390625,
0.87646484375,
0.79296875,
0.446533203125,
-0.55029296875,
-0.0831298828125,
0.5634765625,
0.9833984375,
-0.045166015625,
0.4697265625,
0.8369140625,
-0.01383209228515625,
0.44775390625,
-0.305908203125,
0.41552734375,
-0.0963134765625,
-0.230224609375,
-0.5791015625,
-0.06610107421875,
-0.77734375,
-1.365234375,
0.16650390625,
0.407470703125,
0.68115234375,
-0.57373046875,
-0.90625,
-0.372314453125,
-0.89404296875,
-0.048248291015625,
-0.87109375,
0.475830078125,
0.2034912109375,
-0.2061767578125,
0.350830078125,
-0.83935546875,
4.5078125,
1.11328125,
0.49365234375,
0.305908203125,
0.2130126953125,
0.98291015625,
0.322021484375,
-1.2529296875,
0.09771728515625,
-0.8486328125,
0.1864013671875,
-0.95068359375,
-0.01165008544921875,
0.5458984375,
0.41015625,
0.623046875,
-0.52001953125,
-0.11492919921875,
0.0689697265625,
-1.2578125,
-0.89501953125,
0.382568359375,
-0.402587890625,
0.62255859375,
0.29541015625,
0.392822265625,
0.218994140625,
-0.449462890625,
-0.296875,
-0.53125,
-0.06744384765625,
-0.583984375,
0.7578125,
0.263916015625,
-0.258544921875,
1.08984375,
0.18701171875,
-0.0941162109375,
-0.2041015625,
0.4111328125,
-0.2646484375,
0.12457275390625,
0.94580078125,
-1.0146484375,
0.06561279296875,
0.6982421875,
-0.318359375,
-0.1533203125,
0.54150390625,
-0.95849609375,
1.1806640625,
-0.041351318359375,
0.326416015625,
0.1927490234375,
-0.63525390625,
0.08154296875,
-0.0743408203125,
0.002170562744140625,
0.314208984375,
0.261474609375,
0.4736328125,
0.245361328125,
0.3515625,
0.357666015625,
-0.89306640625,
0.6533203125,
-0.24853515625,
0.77294921875,
-0.5732421875,
-0.287353515625,
-0.38916015625,
-0.1566162109375,
-0.323974609375,
-0.50732421875,
0.861328125,
0.2371826171875,
-0.0283050537109375,
0.57470703125,
0.5185546875,
-0.9228515625,
0.372802734375,
-0.050201416015625,
-0.62841796875,
-0.61669921875,
0.603515625,
0.96044921875,
-0.358642578125,
-0.54833984375,
-0.1229248046875,
0.568359375,
0.06805419921875,
0.625,
-0.150146484375,
-0.8115234375,
-0.1162109375
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
International Coding Procedures Company (ICPC) writes all its code in Jedi Script (JS) programming language. JS does not get compiled, but is delivered for execution in its source form. Sources contain comments, extra whitespace (including trailing and leading spaces), and other non-essential features that make them quite large but do not contribute to the semantics of the code, so the process of minification is performed on source files before their delivery to execution to compress sources while preserving their semantics.
You are hired by ICPC to write JS minifier for ICPC. Fortunately, ICPC adheres to very strict programming practices and their JS sources are quite restricted in grammar. They work only on integer algorithms and do not use floating point numbers and strings.
Every JS source contains a sequence of lines. Each line contains zero or more tokens that can be separated by spaces. On each line, a part of the line that starts with a hash character ('#' code 35), including the hash character itself, is treated as a comment and is ignored up to the end of the line.
Each line is parsed into a sequence of tokens from left to right by repeatedly skipping spaces and finding the longest possible token starting at the current parsing position, thus transforming the source code into a sequence of tokens. All the possible tokens are listed below:
* A reserved token is any kind of operator, separator, literal, reserved word, or a name of a library function that should be preserved during the minification process. Reserved tokens are fixed strings of non-space ASCII characters that do not contain the hash character ('#' code 35). All reserved tokens are given as an input to the minification process.
* A number token consists of a sequence of digits, where a digit is a character from zero ('0') to nine ('9') inclusive.
* A word token consists of a sequence of characters from the following set: lowercase letters, uppercase letters, digits, underscore ('_' code 95), and dollar sign ('$' code 36). A word does not start with a digit.
Note, that during parsing the longest sequence of characters that satisfies either a number or a word definition, but that appears in the list of reserved tokens, is considered to be a reserved token instead.
During the minification process words are renamed in a systematic fashion using the following algorithm:
1. Take a list of words that consist only of lowercase letters ordered first by their length, then lexicographically: "a", "b", ..., "z", "aa", "ab", ..., excluding reserved tokens, since they are not considered to be words. This is the target word list.
2. Rename the first word encountered in the input token sequence to the first word in the target word list and all further occurrences of the same word in the input token sequence, too. Rename the second new word encountered in the input token sequence to the second word in the target word list, and so on.
The goal of the minification process is to convert the given source to the shortest possible line (counting spaces) that still parses to the same sequence of tokens with the correspondingly renamed words using these JS parsing rules.
Input
The first line of the input contains a single integer n (0 ≤ n ≤ 40) — the number of reserved tokens.
The second line of the input contains the list of reserved tokens separated by spaces without repetitions in the list. Each reserved token is at least one and at most 20 characters long and contains only characters with ASCII codes from 33 (exclamation mark) to 126 (tilde) inclusive, with exception of a hash character ('#' code 35).
The third line of the input contains a single integer m (1 ≤ m ≤ 40) — the number of lines in the input source code.
Next m lines contain the input source, each source line is at most 80 characters long (counting leading and trailing spaces). Each line contains only characters with ASCII codes from 32 (space) to 126 (tilde) inclusive. The source code is valid and fully parses into a sequence of tokens.
Output
Write to the output a single line that is the result of the minification process on the input source code. The output source line shall parse to the same sequence of tokens as the input source with the correspondingly renamed words and shall contain the minimum possible number of spaces needed for that. If there are multiple ways to insert the minimum possible number of spaces into the output, use any way.
Examples
Input
16
fun while return var { } ( ) , ; > = + ++ - --
9
fun fib(num) { # compute fibs
var return_value = 1, prev = 0, temp;
while (num > 0) {
temp = return_value; return_value = return_value + prev;
prev = temp;
num--;
}
return return_value;
}
Output
fun a(b){var c=1,d=0,e;while(b>0){e=c;c=c+d;d=e;b--;}return c;}
Input
10
( ) + ++ : -> >> >>: b c)
2
($val1++ + +4 kb) >> :out
b-> + 10 >>: t # using >>:
Output
(a+++ +4c )>> :d b->+10>>:e
Submitted Solution:
```
print("Hello, world!")
```
No
| 67,287
|
[
0.24267578125,
-0.337890625,
-0.2098388671875,
0.1251220703125,
-0.60009765625,
-0.2474365234375,
-0.07080078125,
0.32373046875,
-0.259765625,
0.366455078125,
0.37353515625,
-0.013336181640625,
0.0153350830078125,
-0.8818359375,
-0.6044921875,
0.270263671875,
-0.50634765625,
-0.4912109375,
-0.60107421875,
-0.1707763671875,
-0.265869140625,
-0.0712890625,
-1.5283203125,
-0.193603515625,
-0.6396484375,
1.0732421875,
0.042877197265625,
-0.161865234375,
0.90576171875,
0.90478515625,
-0.471923828125,
-0.40673828125,
0.36767578125,
-0.716796875,
-0.2177734375,
-0.7822265625,
0.73828125,
-0.62548828125,
-0.213134765625,
-0.22119140625,
-0.17724609375,
-0.421875,
0.31005859375,
-0.88671875,
-1.2685546875,
-0.0210113525390625,
-0.1324462890625,
-0.2763671875,
-0.09722900390625,
-0.481201171875,
0.1365966796875,
0.268310546875,
0.279541015625,
-0.23486328125,
-0.12744140625,
-0.08642578125,
0.11083984375,
0.01399993896484375,
-0.607421875,
-0.02557373046875,
-0.2486572265625,
0.313720703125,
-0.09979248046875,
-0.650390625,
-0.1434326171875,
0.75830078125,
-0.197021484375,
0.1942138671875,
0.12457275390625,
-0.447265625,
-0.03265380859375,
0.1842041015625,
-0.49169921875,
-0.2406005859375,
-0.62109375,
-0.11138916015625,
0.51708984375,
0.263916015625,
-0.71875,
0.55126953125,
0.2227783203125,
1.0673828125,
0.18408203125,
0.152099609375,
-0.52587890625,
-0.55810546875,
0.432373046875,
0.25341796875,
0.0958251953125,
-0.2078857421875,
-0.11566162109375,
0.484619140625,
-0.55126953125,
0.004222869873046875,
0.919921875,
0.3671875,
-0.2509765625,
0.63623046875,
-0.144775390625,
0.437744140625,
0.62548828125,
0.77978515625,
-0.755859375,
0.81103515625,
-0.311279296875,
0.11431884765625,
0.07891845703125,
-0.037872314453125,
-0.2403564453125,
-0.1175537109375,
-0.0192718505859375,
-0.8984375,
0.0254669189453125,
-0.364013671875,
-0.219970703125,
0.7783203125,
-0.263427734375,
0.453369140625,
-0.86572265625,
0.32666015625,
0.587890625,
-0.60107421875,
0.333984375,
-0.25927734375,
0.358642578125,
-0.371337890625,
0.0340576171875,
0.6025390625,
-0.295166015625,
-0.12890625,
0.60791015625,
-0.16845703125,
-0.0975341796875,
0.462646484375,
0.277099609375,
0.70263671875,
0.0004930496215820312,
0.4423828125,
0.64892578125,
-0.31689453125,
0.169921875,
0.12274169921875,
0.091552734375,
1.4921875,
0.289794921875,
0.097412109375,
0.1248779296875,
0.408935546875,
-0.494384765625,
0.413818359375,
-0.98974609375,
0.310546875,
0.22998046875,
0.156494140625,
-0.37060546875,
0.035675048828125,
-0.2783203125,
0.5322265625,
0.5322265625,
-0.0208282470703125,
-0.1678466796875,
0.1202392578125,
-0.2020263671875,
0.92919921875,
-0.677734375,
0.521484375,
-0.45703125,
-0.365478515625,
-0.29345703125,
-0.341796875,
0.400146484375,
-0.042236328125,
-0.06903076171875,
0.75439453125,
0.359375,
0.9404296875,
0.88525390625,
0.1846923828125,
0.04022216796875,
0.1773681640625,
-0.39794921875,
0.1920166015625,
0.0105743408203125,
0.99560546875,
0.175048828125,
0.349365234375,
0.1326904296875,
-0.0310516357421875,
-0.6875,
-0.30419921875,
0.1939697265625,
0.998046875,
-0.603515625,
0.043060302734375,
-0.06072998046875,
-0.2432861328125,
-0.5673828125,
-0.322509765625,
-0.14599609375,
-0.79052734375,
-0.845703125,
0.83935546875,
-0.1058349609375,
0.501953125,
-0.42724609375,
-0.263916015625,
0.478515625,
1.3837890625,
-0.583984375,
-0.2003173828125,
0.66259765625,
0.287109375,
0.0010461807250976562,
-0.378662109375,
-0.04754638671875,
-0.043853759765625,
-0.7392578125,
0.70458984375,
-0.223388671875,
0.185546875,
0.1300048828125,
0.5419921875,
0.369140625,
0.55322265625,
-0.2578125,
-0.432861328125,
0.0799560546875,
1.142578125,
-0.1280517578125,
-0.1832275390625,
0.1387939453125,
0.66259765625,
0.360107421875,
0.87890625,
0.29541015625,
0.12054443359375,
1.09375,
1.1845703125,
-0.322509765625,
0.5263671875,
0.1556396484375,
0.32275390625,
0.54736328125,
0.52978515625,
0.4228515625,
0.394287109375,
-0.3232421875,
-0.1859130859375,
-0.390869140625,
0.63720703125,
-0.55712890625,
0.69482421875,
0.376220703125,
0.7666015625,
-0.6318359375,
-0.7060546875,
0.2052001953125,
0.57177734375,
-0.70166015625,
-0.4794921875,
0.1798095703125,
-0.19287109375,
0.4267578125,
0.20166015625,
0.396240234375,
0.42529296875,
0.464599609375,
0.451904296875,
-0.1495361328125,
-0.449951171875,
-0.8486328125,
-0.6806640625,
-1.05859375,
0.006435394287109375,
-0.625,
0.042572021484375,
-0.1588134765625,
-0.9677734375,
0.443359375,
-0.44775390625,
-0.189453125,
-0.287109375,
-0.77734375,
0.360595703125,
0.044921875,
0.529296875,
-0.277587890625,
0.86865234375,
0.3486328125,
0.96533203125,
-0.8935546875,
-0.02777099609375,
-0.023223876953125,
-0.6630859375,
0.408935546875,
-0.12841796875,
0.31494140625,
0.030426025390625,
-0.84765625,
-0.7421875,
-0.2322998046875,
-0.1300048828125,
0.137451171875,
0.1953125,
-0.646484375,
0.8896484375,
0.09698486328125,
-0.57470703125,
0.74365234375,
0.5361328125,
-1.0673828125,
0.578125,
-0.0697021484375,
0.09478759765625,
-0.81982421875,
1.591796875,
0.6103515625,
0.7275390625,
-0.181884765625,
-0.440185546875,
-0.247802734375,
0.095458984375,
-0.0003859996795654297,
-0.51953125,
-0.28515625,
0.82666015625,
0.1278076171875,
-0.98486328125,
0.42333984375,
-0.998046875,
-0.491943359375,
-0.1639404296875,
-0.6748046875,
0.79052734375,
0.56494140625,
0.2071533203125,
0.007007598876953125,
-0.0848388671875,
-0.7294921875,
0.4931640625,
0.56591796875,
-0.74462890625,
0.0252532958984375,
0.53173828125,
-0.033233642578125,
0.266845703125,
0.2034912109375,
-0.79541015625,
0.225341796875,
-0.53955078125,
0.1944580078125,
0.6826171875,
0.4208984375,
-0.0094757080078125,
-0.1392822265625,
0.89501953125,
-1.1435546875,
-0.437255859375,
-0.2386474609375,
0.681640625,
0.79736328125,
0.654296875,
0.36279296875,
-0.397705078125,
-0.744140625,
-1.0927734375,
-0.02752685546875,
-0.1875,
0.74609375,
-0.90478515625,
0.94091796875,
0.2281494140625,
-0.7822265625,
0.56005859375,
-0.458251953125,
-0.119140625,
0.94775390625,
-0.043609619140625,
0.6201171875,
-0.98095703125,
0.2152099609375,
-0.37060546875,
-0.046417236328125,
0.53125,
0.394287109375,
0.78955078125,
-0.6474609375,
-0.416259765625,
-0.14990234375,
-0.3505859375,
-0.431884765625,
-0.42724609375,
-0.01068115234375,
-0.476806640625,
-0.67431640625,
-1.0908203125,
0.9853515625,
0.1295166015625,
0.490478515625,
-0.046875,
0.4375,
-0.2042236328125,
0.240478515625,
0.65380859375,
0.0205535888671875,
0.1341552734375,
-0.75927734375,
1.013671875,
-0.0291595458984375,
-0.367431640625,
-0.354248046875,
-0.390380859375,
-0.429443359375,
0.06549072265625,
0.4736328125,
0.03045654296875,
-0.77392578125,
0.48779296875,
0.2418212890625,
0.2457275390625,
-0.74560546875,
-0.357421875,
-0.5068359375,
0.60986328125,
0.58056640625,
-1.1005859375,
0.2491455078125,
-0.30810546875,
0.181884765625,
0.53173828125,
-0.0130462646484375,
-0.447509765625,
-0.416748046875,
-0.6396484375,
-0.71875,
0.1837158203125,
0.80615234375,
-0.12255859375,
0.053955078125,
-0.92333984375,
0.484619140625,
0.46875,
0.0195770263671875,
0.0789794921875,
0.078125,
0.3583984375,
-0.18505859375,
0.8759765625,
-0.2117919921875,
-0.55615234375,
0.4677734375,
-0.75048828125,
0.76416015625,
-0.5556640625,
0.182861328125,
0.0474853515625,
-0.111572265625,
-0.311767578125,
0.69970703125,
0.048614501953125,
-0.182373046875,
-0.340087890625,
0.2154541015625,
-1.1630859375,
-0.9111328125,
0.64013671875,
0.04901123046875,
-0.26171875,
0.9765625,
0.1785888671875,
-0.34375,
0.533203125,
0.191162109375,
-0.40380859375,
0.4228515625,
-0.68212890625,
0.11199951171875,
-0.19677734375,
-0.351318359375,
-0.026275634765625,
-0.473876953125,
0.63623046875,
0.260986328125,
-0.759765625,
-0.343017578125,
-0.837890625,
-0.0474853515625,
-0.045989990234375,
-0.509765625,
0.310791015625,
-0.0965576171875,
0.098388671875,
0.23583984375,
-0.56103515625,
-0.265869140625,
-0.367919921875,
-0.56787109375,
-0.24609375,
0.43212890625,
0.62353515625,
0.64892578125,
0.042572021484375,
-0.69189453125,
0.1663818359375,
-0.1396484375,
-0.0271148681640625,
-0.669921875,
-0.0428466796875,
-0.09161376953125,
-0.306396484375,
-0.083740234375,
0.333740234375,
0.181884765625,
0.201416015625,
0.82568359375,
0.195556640625,
0.703125,
0.256103515625,
-0.80419921875,
0.689453125,
-0.1593017578125,
-1.1455078125,
-0.262939453125,
0.7958984375,
-0.071533203125,
0.984375,
0.2425537109375,
-0.76220703125,
-0.5244140625,
-0.89599609375,
0.1619873046875,
-0.83935546875,
-0.0767822265625,
-0.76611328125,
-0.56298828125,
-0.252685546875,
0.84228515625,
-0.380126953125,
-0.46533203125,
-0.346923828125,
-0.7958984375,
0.2447509765625,
-0.80078125,
-0.2047119140625,
-0.345703125,
-0.587890625,
-0.384765625,
0.95166015625,
0.0184783935546875,
0.5673828125,
-0.30908203125,
-0.10479736328125,
0.420654296875,
0.42822265625,
-0.90283203125,
-0.56005859375,
-0.056396484375,
-0.07708740234375,
-0.053863525390625,
-0.268798828125,
-0.5498046875,
1.1953125,
-0.97216796875,
0.11724853515625,
-0.1767578125,
-0.76953125,
-0.455322265625,
-0.2626953125,
1.033203125,
-0.225341796875,
-0.21142578125,
-0.00397491455078125,
0.65673828125,
0.6455078125,
-0.1868896484375,
-0.52587890625,
-0.268310546875,
-0.68896484375,
-0.9638671875,
0.51904296875,
-0.017181396484375,
0.31005859375,
-0.30419921875,
-0.2305908203125,
1.3564453125,
-0.5087890625,
0.463623046875,
1.306640625,
0.127685546875,
0.19189453125,
-0.619140625,
0.95068359375,
0.45751953125,
-0.6357421875,
0.2069091796875,
0.36572265625,
-0.32373046875,
0.07037353515625,
-0.810546875,
-0.650390625,
-0.71484375,
0.142822265625,
1.2431640625,
-0.59375,
0.442138671875,
-0.482666015625,
-1.21875,
-0.61083984375,
0.87060546875,
-0.0802001953125,
0.038909912109375,
0.9619140625,
-0.2890625,
0.2137451171875,
0.05706787109375,
0.2213134765625,
0.071533203125,
-0.2291259765625,
1.255859375,
-0.26220703125,
-0.384521484375,
0.4130859375,
0.81689453125,
-1.2314453125,
-0.65185546875,
-0.048736572265625,
0.111572265625,
-0.297607421875,
-0.5732421875,
-0.0594482421875,
0.3349609375,
-0.54150390625,
0.0933837890625,
0.52880859375,
-0.2484130859375,
0.44091796875,
0.0941162109375,
-0.0516357421875,
-0.5576171875,
0.31103515625,
0.9267578125,
-0.716796875,
-0.41748046875,
-0.82861328125,
0.1722412109375,
0.084228515625,
0.029937744140625,
0.76953125,
-0.057525634765625,
0.52734375,
0.8232421875,
-0.006072998046875,
1.154296875,
-0.54541015625,
0.0843505859375,
0.411376953125,
-0.6142578125,
-0.5849609375,
-0.381103515625,
0.2091064453125,
-0.298583984375,
0.5029296875,
-0.67919921875,
0.04962158203125,
0.2247314453125,
0.25244140625,
-0.140625,
-0.93505859375,
-0.2144775390625,
-0.833984375,
-0.482666015625,
-0.60546875,
-0.284423828125,
-0.1129150390625,
0.120849609375,
-0.0089874267578125,
-0.76025390625,
0.458251953125,
0.0899658203125,
-0.6787109375,
0.1746826171875,
-0.466552734375,
0.34814453125,
-0.63037109375,
-0.485107421875,
-0.61328125,
-0.426025390625,
-0.67529296875,
0.1412353515625,
-0.14697265625,
0.2509765625,
-0.26220703125,
0.346923828125,
-0.41064453125,
0.131591796875,
0.0202789306640625,
-0.33349609375,
0.2041015625,
0.351318359375,
-0.23583984375,
0.82470703125,
0.325439453125,
0.45556640625,
-0.0965576171875,
0.01325225830078125,
-0.2147216796875,
0.1141357421875,
0.431640625,
0.5859375,
0.1163330078125,
0.0269775390625,
0.09161376953125,
-0.03594970703125,
-0.68115234375,
0.2978515625,
-0.114990234375,
0.25830078125,
0.37841796875,
-0.1920166015625,
0.458740234375,
1.1025390625,
-0.09063720703125,
0.211669921875,
0.226318359375,
0.45361328125,
0.51318359375,
-0.373779296875,
0.317138671875,
0.238037109375,
0.120361328125,
-0.368408203125,
0.12353515625,
0.470458984375,
-0.06707763671875,
0.13671875,
-0.18701171875,
-0.493408203125,
-1.2255859375,
-0.325439453125,
0.046844482421875,
0.64306640625,
0.473388671875,
-0.424072265625,
0.35400390625,
0.07830810546875,
-0.485107421875,
0.552734375,
-1.03515625,
-0.94091796875,
0.603515625,
-0.32080078125,
-0.08807373046875,
-0.4716796875,
-0.408203125,
-0.07318115234375,
-0.09686279296875,
0.07452392578125,
-0.30859375,
0.0714111328125,
0.1875,
0.5537109375,
-0.1541748046875,
-0.01496124267578125,
-0.0222625732421875,
0.5390625,
-0.6201171875,
-0.5283203125,
0.08056640625,
1.0634765625,
0.06884765625,
-0.311767578125,
-0.53076171875,
0.2125244140625,
0.11663818359375,
0.6806640625,
-0.79931640625,
-0.443603515625,
-0.37939453125,
0.6083984375,
-0.515625,
-0.2086181640625,
-0.25390625,
0.9052734375,
0.11041259765625,
-0.1915283203125,
-0.39111328125,
0.57080078125,
0.89990234375,
-0.22265625,
0.4365234375,
0.080078125,
0.47314453125,
-0.386474609375,
-0.2322998046875,
-0.19921875,
0.875,
0.7490234375,
1.0322265625,
0.0251007080078125,
0.361083984375,
0.6259765625,
-0.01287078857421875,
-0.356201171875,
0.053863525390625,
-0.013336181640625,
-0.306640625,
-0.432861328125,
0.2479248046875,
-0.1876220703125,
-0.135009765625,
-0.43017578125,
0.452392578125,
-0.701171875,
-0.380859375,
-0.5244140625,
-0.6279296875,
1.13671875,
-0.332763671875,
0.0518798828125,
-0.1424560546875,
-0.1759033203125,
0.35888671875,
0.86083984375,
-0.14697265625,
0.062744140625,
1.220703125,
0.5712890625,
0.257568359375,
0.48779296875,
0.285400390625,
0.362060546875,
-0.34228515625,
0.0723876953125,
-0.0428466796875,
0.060028076171875,
-0.2783203125,
-0.284423828125,
-1.009765625,
0.6845703125,
-0.505859375,
0.0474853515625,
0.1722412109375,
-0.85986328125,
-0.367919921875,
-0.58203125,
0.54638671875,
-0.974609375,
0.0308990478515625,
0.2305908203125,
-0.4794921875,
-0.81103515625,
1.0166015625,
-0.0292510986328125,
0.446533203125,
0.131591796875,
0.681640625,
-0.04644775390625,
1.49609375,
0.34765625,
-0.381591796875,
0.1595458984375,
0.556640625,
-0.05767822265625,
-0.67333984375,
-0.0679931640625,
-0.435546875,
-0.50048828125,
-0.77783203125,
-0.56884765625,
-0.1322021484375,
0.86572265625,
0.193359375,
-1.23046875,
-0.17724609375,
0.08416748046875,
-0.54833984375,
0.347412109375,
0.06903076171875,
0.48876953125,
-0.11822509765625,
0.11322021484375,
0.12213134765625,
-0.392578125,
-0.144287109375,
-0.3603515625,
0.28271484375,
-0.216796875,
-0.494873046875,
-0.8271484375,
-0.3984375,
-0.164794921875,
-0.03765869140625,
-0.60107421875,
-0.693359375,
0.57275390625,
0.84423828125,
0.7529296875,
0.351318359375,
-0.5341796875,
-0.1343994140625,
0.61865234375,
0.95751953125,
-0.04541015625,
0.68408203125,
0.89501953125,
-0.005859375,
0.39208984375,
-0.3466796875,
0.485595703125,
-0.095458984375,
-0.2337646484375,
-0.53076171875,
-0.047332763671875,
-0.810546875,
-1.2275390625,
0.10260009765625,
0.47314453125,
0.5791015625,
-0.548828125,
-0.966796875,
-0.497314453125,
-0.85791015625,
-0.151123046875,
-0.90625,
0.5185546875,
0.1591796875,
-0.31591796875,
0.2152099609375,
-0.841796875,
4.44921875,
1.0712890625,
0.3935546875,
0.3916015625,
0.23193359375,
0.8955078125,
0.35205078125,
-1.19140625,
0.1619873046875,
-0.96484375,
0.253173828125,
-1.0302734375,
0.00945281982421875,
0.5751953125,
0.4208984375,
0.60986328125,
-0.53662109375,
-0.267822265625,
0.10516357421875,
-1.283203125,
-0.966796875,
0.411865234375,
-0.31005859375,
0.52099609375,
0.371337890625,
0.424072265625,
0.334716796875,
-0.515625,
-0.292236328125,
-0.5166015625,
0.056243896484375,
-0.499755859375,
0.87060546875,
0.310791015625,
-0.264892578125,
0.98876953125,
0.213134765625,
-0.232666015625,
-0.3095703125,
0.4169921875,
-0.31201171875,
0.15234375,
0.958984375,
-0.8798828125,
0.03631591796875,
0.9677734375,
-0.350830078125,
0.08624267578125,
0.482421875,
-1.0439453125,
1.1162109375,
-0.00736236572265625,
0.34912109375,
0.182373046875,
-0.6865234375,
0.053375244140625,
-0.06158447265625,
0.049713134765625,
0.284912109375,
0.30078125,
0.376220703125,
0.28759765625,
0.23486328125,
0.52001953125,
-1.0302734375,
0.6123046875,
-0.09478759765625,
0.654296875,
-0.57177734375,
-0.2127685546875,
-0.53271484375,
-0.21923828125,
-0.286865234375,
-0.6025390625,
0.8232421875,
0.305419921875,
-0.11053466796875,
0.572265625,
0.57080078125,
-0.86181640625,
0.39794921875,
-0.13818359375,
-0.61962890625,
-0.6455078125,
0.6982421875,
1.0146484375,
-0.353271484375,
-0.424072265625,
-0.18017578125,
0.65380859375,
0.1453857421875,
0.68798828125,
-0.19091796875,
-0.7568359375,
-0.1490478515625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
International Coding Procedures Company (ICPC) writes all its code in Jedi Script (JS) programming language. JS does not get compiled, but is delivered for execution in its source form. Sources contain comments, extra whitespace (including trailing and leading spaces), and other non-essential features that make them quite large but do not contribute to the semantics of the code, so the process of minification is performed on source files before their delivery to execution to compress sources while preserving their semantics.
You are hired by ICPC to write JS minifier for ICPC. Fortunately, ICPC adheres to very strict programming practices and their JS sources are quite restricted in grammar. They work only on integer algorithms and do not use floating point numbers and strings.
Every JS source contains a sequence of lines. Each line contains zero or more tokens that can be separated by spaces. On each line, a part of the line that starts with a hash character ('#' code 35), including the hash character itself, is treated as a comment and is ignored up to the end of the line.
Each line is parsed into a sequence of tokens from left to right by repeatedly skipping spaces and finding the longest possible token starting at the current parsing position, thus transforming the source code into a sequence of tokens. All the possible tokens are listed below:
* A reserved token is any kind of operator, separator, literal, reserved word, or a name of a library function that should be preserved during the minification process. Reserved tokens are fixed strings of non-space ASCII characters that do not contain the hash character ('#' code 35). All reserved tokens are given as an input to the minification process.
* A number token consists of a sequence of digits, where a digit is a character from zero ('0') to nine ('9') inclusive.
* A word token consists of a sequence of characters from the following set: lowercase letters, uppercase letters, digits, underscore ('_' code 95), and dollar sign ('$' code 36). A word does not start with a digit.
Note, that during parsing the longest sequence of characters that satisfies either a number or a word definition, but that appears in the list of reserved tokens, is considered to be a reserved token instead.
During the minification process words are renamed in a systematic fashion using the following algorithm:
1. Take a list of words that consist only of lowercase letters ordered first by their length, then lexicographically: "a", "b", ..., "z", "aa", "ab", ..., excluding reserved tokens, since they are not considered to be words. This is the target word list.
2. Rename the first word encountered in the input token sequence to the first word in the target word list and all further occurrences of the same word in the input token sequence, too. Rename the second new word encountered in the input token sequence to the second word in the target word list, and so on.
The goal of the minification process is to convert the given source to the shortest possible line (counting spaces) that still parses to the same sequence of tokens with the correspondingly renamed words using these JS parsing rules.
Input
The first line of the input contains a single integer n (0 ≤ n ≤ 40) — the number of reserved tokens.
The second line of the input contains the list of reserved tokens separated by spaces without repetitions in the list. Each reserved token is at least one and at most 20 characters long and contains only characters with ASCII codes from 33 (exclamation mark) to 126 (tilde) inclusive, with exception of a hash character ('#' code 35).
The third line of the input contains a single integer m (1 ≤ m ≤ 40) — the number of lines in the input source code.
Next m lines contain the input source, each source line is at most 80 characters long (counting leading and trailing spaces). Each line contains only characters with ASCII codes from 32 (space) to 126 (tilde) inclusive. The source code is valid and fully parses into a sequence of tokens.
Output
Write to the output a single line that is the result of the minification process on the input source code. The output source line shall parse to the same sequence of tokens as the input source with the correspondingly renamed words and shall contain the minimum possible number of spaces needed for that. If there are multiple ways to insert the minimum possible number of spaces into the output, use any way.
Examples
Input
16
fun while return var { } ( ) , ; > = + ++ - --
9
fun fib(num) { # compute fibs
var return_value = 1, prev = 0, temp;
while (num > 0) {
temp = return_value; return_value = return_value + prev;
prev = temp;
num--;
}
return return_value;
}
Output
fun a(b){var c=1,d=0,e;while(b>0){e=c;c=c+d;d=e;b--;}return c;}
Input
10
( ) + ++ : -> >> >>: b c)
2
($val1++ + +4 kb) >> :out
b-> + 10 >>: t # using >>:
Output
(a+++ +4c )>> :d b->+10>>:e
Submitted Solution:
```
#!/usr/bin/python3
input()
reserved = input().split(' ')
lines = int(input())
numbers = '0123456789'
let = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890_$'
def wytnij_res(slowo):
r = ''
for res in reserved:
if len(res) > len(r) and slowo.startswith(res):
r = res
return r
def wytnij_num(slowo):
nm = ''
for c in slowo:
if c in numbers:
nm += c
else:
break
return nm
def wytnij_word(slowo):
nm = ''
if slowo[0] in numbers:
return ''
for c in slowo:
if c in let:
nm += c
else:
break
return nm
def wytnij(slowo):
rs = wytnij_res(slowo)
nm = wytnij_num(slowo)
wrd = wytnij_word(slowo)
ret = ''
for r in [rs, nm, wrd]:
if len(r) > len(ret):
ret = r
if ret == '':
print([rs, nm, wrd])
print(slowo)
assert False
return ret
prog = []
#print(reserved)
for _ in range(lines):
line = input()
line = line.split('#')[0]
line = line.split(' ')
for l in line:
while len(l) > 0:
wrd = wytnij(l)
l = l[len(wrd):]
prog.append(wrd)
letters = 'abcdefghijklmnopqrstuvwxyz'
def gen(st):
ln = len(letters)
res = []
for i in range(ln**st):
j = i
if st == 1:
res.append(letters[i])
else:
res.append(letters[i // ln] + letters[i % ln])
return res
toks = gen(1) + gen(2)
toks = [t for t in toks if t not in reserved]
dct = {}
tprog = []
for p in prog:
if p not in reserved and p[0] not in numbers:
if p not in dct:
dct[p] = toks[0]
toks = toks[1:]
p = dct[p]
tprog.append(p)
# print(prog)
# print(tprog)
res = ''
na_pale = ''.join(tprog)
for tok in tprog:
res += tok
if wytnij(na_pale) != tok:
# print('wycialem {} a tok {}'.format(wytnij(na_pale), tok))
res += ' '
na_pale = na_pale[len(tok):]
print(res)
```
No
| 67,288
|
[
0.24267578125,
-0.337890625,
-0.2098388671875,
0.1251220703125,
-0.60009765625,
-0.2474365234375,
-0.07080078125,
0.32373046875,
-0.259765625,
0.366455078125,
0.37353515625,
-0.013336181640625,
0.0153350830078125,
-0.8818359375,
-0.6044921875,
0.270263671875,
-0.50634765625,
-0.4912109375,
-0.60107421875,
-0.1707763671875,
-0.265869140625,
-0.0712890625,
-1.5283203125,
-0.193603515625,
-0.6396484375,
1.0732421875,
0.042877197265625,
-0.161865234375,
0.90576171875,
0.90478515625,
-0.471923828125,
-0.40673828125,
0.36767578125,
-0.716796875,
-0.2177734375,
-0.7822265625,
0.73828125,
-0.62548828125,
-0.213134765625,
-0.22119140625,
-0.17724609375,
-0.421875,
0.31005859375,
-0.88671875,
-1.2685546875,
-0.0210113525390625,
-0.1324462890625,
-0.2763671875,
-0.09722900390625,
-0.481201171875,
0.1365966796875,
0.268310546875,
0.279541015625,
-0.23486328125,
-0.12744140625,
-0.08642578125,
0.11083984375,
0.01399993896484375,
-0.607421875,
-0.02557373046875,
-0.2486572265625,
0.313720703125,
-0.09979248046875,
-0.650390625,
-0.1434326171875,
0.75830078125,
-0.197021484375,
0.1942138671875,
0.12457275390625,
-0.447265625,
-0.03265380859375,
0.1842041015625,
-0.49169921875,
-0.2406005859375,
-0.62109375,
-0.11138916015625,
0.51708984375,
0.263916015625,
-0.71875,
0.55126953125,
0.2227783203125,
1.0673828125,
0.18408203125,
0.152099609375,
-0.52587890625,
-0.55810546875,
0.432373046875,
0.25341796875,
0.0958251953125,
-0.2078857421875,
-0.11566162109375,
0.484619140625,
-0.55126953125,
0.004222869873046875,
0.919921875,
0.3671875,
-0.2509765625,
0.63623046875,
-0.144775390625,
0.437744140625,
0.62548828125,
0.77978515625,
-0.755859375,
0.81103515625,
-0.311279296875,
0.11431884765625,
0.07891845703125,
-0.037872314453125,
-0.2403564453125,
-0.1175537109375,
-0.0192718505859375,
-0.8984375,
0.0254669189453125,
-0.364013671875,
-0.219970703125,
0.7783203125,
-0.263427734375,
0.453369140625,
-0.86572265625,
0.32666015625,
0.587890625,
-0.60107421875,
0.333984375,
-0.25927734375,
0.358642578125,
-0.371337890625,
0.0340576171875,
0.6025390625,
-0.295166015625,
-0.12890625,
0.60791015625,
-0.16845703125,
-0.0975341796875,
0.462646484375,
0.277099609375,
0.70263671875,
0.0004930496215820312,
0.4423828125,
0.64892578125,
-0.31689453125,
0.169921875,
0.12274169921875,
0.091552734375,
1.4921875,
0.289794921875,
0.097412109375,
0.1248779296875,
0.408935546875,
-0.494384765625,
0.413818359375,
-0.98974609375,
0.310546875,
0.22998046875,
0.156494140625,
-0.37060546875,
0.035675048828125,
-0.2783203125,
0.5322265625,
0.5322265625,
-0.0208282470703125,
-0.1678466796875,
0.1202392578125,
-0.2020263671875,
0.92919921875,
-0.677734375,
0.521484375,
-0.45703125,
-0.365478515625,
-0.29345703125,
-0.341796875,
0.400146484375,
-0.042236328125,
-0.06903076171875,
0.75439453125,
0.359375,
0.9404296875,
0.88525390625,
0.1846923828125,
0.04022216796875,
0.1773681640625,
-0.39794921875,
0.1920166015625,
0.0105743408203125,
0.99560546875,
0.175048828125,
0.349365234375,
0.1326904296875,
-0.0310516357421875,
-0.6875,
-0.30419921875,
0.1939697265625,
0.998046875,
-0.603515625,
0.043060302734375,
-0.06072998046875,
-0.2432861328125,
-0.5673828125,
-0.322509765625,
-0.14599609375,
-0.79052734375,
-0.845703125,
0.83935546875,
-0.1058349609375,
0.501953125,
-0.42724609375,
-0.263916015625,
0.478515625,
1.3837890625,
-0.583984375,
-0.2003173828125,
0.66259765625,
0.287109375,
0.0010461807250976562,
-0.378662109375,
-0.04754638671875,
-0.043853759765625,
-0.7392578125,
0.70458984375,
-0.223388671875,
0.185546875,
0.1300048828125,
0.5419921875,
0.369140625,
0.55322265625,
-0.2578125,
-0.432861328125,
0.0799560546875,
1.142578125,
-0.1280517578125,
-0.1832275390625,
0.1387939453125,
0.66259765625,
0.360107421875,
0.87890625,
0.29541015625,
0.12054443359375,
1.09375,
1.1845703125,
-0.322509765625,
0.5263671875,
0.1556396484375,
0.32275390625,
0.54736328125,
0.52978515625,
0.4228515625,
0.394287109375,
-0.3232421875,
-0.1859130859375,
-0.390869140625,
0.63720703125,
-0.55712890625,
0.69482421875,
0.376220703125,
0.7666015625,
-0.6318359375,
-0.7060546875,
0.2052001953125,
0.57177734375,
-0.70166015625,
-0.4794921875,
0.1798095703125,
-0.19287109375,
0.4267578125,
0.20166015625,
0.396240234375,
0.42529296875,
0.464599609375,
0.451904296875,
-0.1495361328125,
-0.449951171875,
-0.8486328125,
-0.6806640625,
-1.05859375,
0.006435394287109375,
-0.625,
0.042572021484375,
-0.1588134765625,
-0.9677734375,
0.443359375,
-0.44775390625,
-0.189453125,
-0.287109375,
-0.77734375,
0.360595703125,
0.044921875,
0.529296875,
-0.277587890625,
0.86865234375,
0.3486328125,
0.96533203125,
-0.8935546875,
-0.02777099609375,
-0.023223876953125,
-0.6630859375,
0.408935546875,
-0.12841796875,
0.31494140625,
0.030426025390625,
-0.84765625,
-0.7421875,
-0.2322998046875,
-0.1300048828125,
0.137451171875,
0.1953125,
-0.646484375,
0.8896484375,
0.09698486328125,
-0.57470703125,
0.74365234375,
0.5361328125,
-1.0673828125,
0.578125,
-0.0697021484375,
0.09478759765625,
-0.81982421875,
1.591796875,
0.6103515625,
0.7275390625,
-0.181884765625,
-0.440185546875,
-0.247802734375,
0.095458984375,
-0.0003859996795654297,
-0.51953125,
-0.28515625,
0.82666015625,
0.1278076171875,
-0.98486328125,
0.42333984375,
-0.998046875,
-0.491943359375,
-0.1639404296875,
-0.6748046875,
0.79052734375,
0.56494140625,
0.2071533203125,
0.007007598876953125,
-0.0848388671875,
-0.7294921875,
0.4931640625,
0.56591796875,
-0.74462890625,
0.0252532958984375,
0.53173828125,
-0.033233642578125,
0.266845703125,
0.2034912109375,
-0.79541015625,
0.225341796875,
-0.53955078125,
0.1944580078125,
0.6826171875,
0.4208984375,
-0.0094757080078125,
-0.1392822265625,
0.89501953125,
-1.1435546875,
-0.437255859375,
-0.2386474609375,
0.681640625,
0.79736328125,
0.654296875,
0.36279296875,
-0.397705078125,
-0.744140625,
-1.0927734375,
-0.02752685546875,
-0.1875,
0.74609375,
-0.90478515625,
0.94091796875,
0.2281494140625,
-0.7822265625,
0.56005859375,
-0.458251953125,
-0.119140625,
0.94775390625,
-0.043609619140625,
0.6201171875,
-0.98095703125,
0.2152099609375,
-0.37060546875,
-0.046417236328125,
0.53125,
0.394287109375,
0.78955078125,
-0.6474609375,
-0.416259765625,
-0.14990234375,
-0.3505859375,
-0.431884765625,
-0.42724609375,
-0.01068115234375,
-0.476806640625,
-0.67431640625,
-1.0908203125,
0.9853515625,
0.1295166015625,
0.490478515625,
-0.046875,
0.4375,
-0.2042236328125,
0.240478515625,
0.65380859375,
0.0205535888671875,
0.1341552734375,
-0.75927734375,
1.013671875,
-0.0291595458984375,
-0.367431640625,
-0.354248046875,
-0.390380859375,
-0.429443359375,
0.06549072265625,
0.4736328125,
0.03045654296875,
-0.77392578125,
0.48779296875,
0.2418212890625,
0.2457275390625,
-0.74560546875,
-0.357421875,
-0.5068359375,
0.60986328125,
0.58056640625,
-1.1005859375,
0.2491455078125,
-0.30810546875,
0.181884765625,
0.53173828125,
-0.0130462646484375,
-0.447509765625,
-0.416748046875,
-0.6396484375,
-0.71875,
0.1837158203125,
0.80615234375,
-0.12255859375,
0.053955078125,
-0.92333984375,
0.484619140625,
0.46875,
0.0195770263671875,
0.0789794921875,
0.078125,
0.3583984375,
-0.18505859375,
0.8759765625,
-0.2117919921875,
-0.55615234375,
0.4677734375,
-0.75048828125,
0.76416015625,
-0.5556640625,
0.182861328125,
0.0474853515625,
-0.111572265625,
-0.311767578125,
0.69970703125,
0.048614501953125,
-0.182373046875,
-0.340087890625,
0.2154541015625,
-1.1630859375,
-0.9111328125,
0.64013671875,
0.04901123046875,
-0.26171875,
0.9765625,
0.1785888671875,
-0.34375,
0.533203125,
0.191162109375,
-0.40380859375,
0.4228515625,
-0.68212890625,
0.11199951171875,
-0.19677734375,
-0.351318359375,
-0.026275634765625,
-0.473876953125,
0.63623046875,
0.260986328125,
-0.759765625,
-0.343017578125,
-0.837890625,
-0.0474853515625,
-0.045989990234375,
-0.509765625,
0.310791015625,
-0.0965576171875,
0.098388671875,
0.23583984375,
-0.56103515625,
-0.265869140625,
-0.367919921875,
-0.56787109375,
-0.24609375,
0.43212890625,
0.62353515625,
0.64892578125,
0.042572021484375,
-0.69189453125,
0.1663818359375,
-0.1396484375,
-0.0271148681640625,
-0.669921875,
-0.0428466796875,
-0.09161376953125,
-0.306396484375,
-0.083740234375,
0.333740234375,
0.181884765625,
0.201416015625,
0.82568359375,
0.195556640625,
0.703125,
0.256103515625,
-0.80419921875,
0.689453125,
-0.1593017578125,
-1.1455078125,
-0.262939453125,
0.7958984375,
-0.071533203125,
0.984375,
0.2425537109375,
-0.76220703125,
-0.5244140625,
-0.89599609375,
0.1619873046875,
-0.83935546875,
-0.0767822265625,
-0.76611328125,
-0.56298828125,
-0.252685546875,
0.84228515625,
-0.380126953125,
-0.46533203125,
-0.346923828125,
-0.7958984375,
0.2447509765625,
-0.80078125,
-0.2047119140625,
-0.345703125,
-0.587890625,
-0.384765625,
0.95166015625,
0.0184783935546875,
0.5673828125,
-0.30908203125,
-0.10479736328125,
0.420654296875,
0.42822265625,
-0.90283203125,
-0.56005859375,
-0.056396484375,
-0.07708740234375,
-0.053863525390625,
-0.268798828125,
-0.5498046875,
1.1953125,
-0.97216796875,
0.11724853515625,
-0.1767578125,
-0.76953125,
-0.455322265625,
-0.2626953125,
1.033203125,
-0.225341796875,
-0.21142578125,
-0.00397491455078125,
0.65673828125,
0.6455078125,
-0.1868896484375,
-0.52587890625,
-0.268310546875,
-0.68896484375,
-0.9638671875,
0.51904296875,
-0.017181396484375,
0.31005859375,
-0.30419921875,
-0.2305908203125,
1.3564453125,
-0.5087890625,
0.463623046875,
1.306640625,
0.127685546875,
0.19189453125,
-0.619140625,
0.95068359375,
0.45751953125,
-0.6357421875,
0.2069091796875,
0.36572265625,
-0.32373046875,
0.07037353515625,
-0.810546875,
-0.650390625,
-0.71484375,
0.142822265625,
1.2431640625,
-0.59375,
0.442138671875,
-0.482666015625,
-1.21875,
-0.61083984375,
0.87060546875,
-0.0802001953125,
0.038909912109375,
0.9619140625,
-0.2890625,
0.2137451171875,
0.05706787109375,
0.2213134765625,
0.071533203125,
-0.2291259765625,
1.255859375,
-0.26220703125,
-0.384521484375,
0.4130859375,
0.81689453125,
-1.2314453125,
-0.65185546875,
-0.048736572265625,
0.111572265625,
-0.297607421875,
-0.5732421875,
-0.0594482421875,
0.3349609375,
-0.54150390625,
0.0933837890625,
0.52880859375,
-0.2484130859375,
0.44091796875,
0.0941162109375,
-0.0516357421875,
-0.5576171875,
0.31103515625,
0.9267578125,
-0.716796875,
-0.41748046875,
-0.82861328125,
0.1722412109375,
0.084228515625,
0.029937744140625,
0.76953125,
-0.057525634765625,
0.52734375,
0.8232421875,
-0.006072998046875,
1.154296875,
-0.54541015625,
0.0843505859375,
0.411376953125,
-0.6142578125,
-0.5849609375,
-0.381103515625,
0.2091064453125,
-0.298583984375,
0.5029296875,
-0.67919921875,
0.04962158203125,
0.2247314453125,
0.25244140625,
-0.140625,
-0.93505859375,
-0.2144775390625,
-0.833984375,
-0.482666015625,
-0.60546875,
-0.284423828125,
-0.1129150390625,
0.120849609375,
-0.0089874267578125,
-0.76025390625,
0.458251953125,
0.0899658203125,
-0.6787109375,
0.1746826171875,
-0.466552734375,
0.34814453125,
-0.63037109375,
-0.485107421875,
-0.61328125,
-0.426025390625,
-0.67529296875,
0.1412353515625,
-0.14697265625,
0.2509765625,
-0.26220703125,
0.346923828125,
-0.41064453125,
0.131591796875,
0.0202789306640625,
-0.33349609375,
0.2041015625,
0.351318359375,
-0.23583984375,
0.82470703125,
0.325439453125,
0.45556640625,
-0.0965576171875,
0.01325225830078125,
-0.2147216796875,
0.1141357421875,
0.431640625,
0.5859375,
0.1163330078125,
0.0269775390625,
0.09161376953125,
-0.03594970703125,
-0.68115234375,
0.2978515625,
-0.114990234375,
0.25830078125,
0.37841796875,
-0.1920166015625,
0.458740234375,
1.1025390625,
-0.09063720703125,
0.211669921875,
0.226318359375,
0.45361328125,
0.51318359375,
-0.373779296875,
0.317138671875,
0.238037109375,
0.120361328125,
-0.368408203125,
0.12353515625,
0.470458984375,
-0.06707763671875,
0.13671875,
-0.18701171875,
-0.493408203125,
-1.2255859375,
-0.325439453125,
0.046844482421875,
0.64306640625,
0.473388671875,
-0.424072265625,
0.35400390625,
0.07830810546875,
-0.485107421875,
0.552734375,
-1.03515625,
-0.94091796875,
0.603515625,
-0.32080078125,
-0.08807373046875,
-0.4716796875,
-0.408203125,
-0.07318115234375,
-0.09686279296875,
0.07452392578125,
-0.30859375,
0.0714111328125,
0.1875,
0.5537109375,
-0.1541748046875,
-0.01496124267578125,
-0.0222625732421875,
0.5390625,
-0.6201171875,
-0.5283203125,
0.08056640625,
1.0634765625,
0.06884765625,
-0.311767578125,
-0.53076171875,
0.2125244140625,
0.11663818359375,
0.6806640625,
-0.79931640625,
-0.443603515625,
-0.37939453125,
0.6083984375,
-0.515625,
-0.2086181640625,
-0.25390625,
0.9052734375,
0.11041259765625,
-0.1915283203125,
-0.39111328125,
0.57080078125,
0.89990234375,
-0.22265625,
0.4365234375,
0.080078125,
0.47314453125,
-0.386474609375,
-0.2322998046875,
-0.19921875,
0.875,
0.7490234375,
1.0322265625,
0.0251007080078125,
0.361083984375,
0.6259765625,
-0.01287078857421875,
-0.356201171875,
0.053863525390625,
-0.013336181640625,
-0.306640625,
-0.432861328125,
0.2479248046875,
-0.1876220703125,
-0.135009765625,
-0.43017578125,
0.452392578125,
-0.701171875,
-0.380859375,
-0.5244140625,
-0.6279296875,
1.13671875,
-0.332763671875,
0.0518798828125,
-0.1424560546875,
-0.1759033203125,
0.35888671875,
0.86083984375,
-0.14697265625,
0.062744140625,
1.220703125,
0.5712890625,
0.257568359375,
0.48779296875,
0.285400390625,
0.362060546875,
-0.34228515625,
0.0723876953125,
-0.0428466796875,
0.060028076171875,
-0.2783203125,
-0.284423828125,
-1.009765625,
0.6845703125,
-0.505859375,
0.0474853515625,
0.1722412109375,
-0.85986328125,
-0.367919921875,
-0.58203125,
0.54638671875,
-0.974609375,
0.0308990478515625,
0.2305908203125,
-0.4794921875,
-0.81103515625,
1.0166015625,
-0.0292510986328125,
0.446533203125,
0.131591796875,
0.681640625,
-0.04644775390625,
1.49609375,
0.34765625,
-0.381591796875,
0.1595458984375,
0.556640625,
-0.05767822265625,
-0.67333984375,
-0.0679931640625,
-0.435546875,
-0.50048828125,
-0.77783203125,
-0.56884765625,
-0.1322021484375,
0.86572265625,
0.193359375,
-1.23046875,
-0.17724609375,
0.08416748046875,
-0.54833984375,
0.347412109375,
0.06903076171875,
0.48876953125,
-0.11822509765625,
0.11322021484375,
0.12213134765625,
-0.392578125,
-0.144287109375,
-0.3603515625,
0.28271484375,
-0.216796875,
-0.494873046875,
-0.8271484375,
-0.3984375,
-0.164794921875,
-0.03765869140625,
-0.60107421875,
-0.693359375,
0.57275390625,
0.84423828125,
0.7529296875,
0.351318359375,
-0.5341796875,
-0.1343994140625,
0.61865234375,
0.95751953125,
-0.04541015625,
0.68408203125,
0.89501953125,
-0.005859375,
0.39208984375,
-0.3466796875,
0.485595703125,
-0.095458984375,
-0.2337646484375,
-0.53076171875,
-0.047332763671875,
-0.810546875,
-1.2275390625,
0.10260009765625,
0.47314453125,
0.5791015625,
-0.548828125,
-0.966796875,
-0.497314453125,
-0.85791015625,
-0.151123046875,
-0.90625,
0.5185546875,
0.1591796875,
-0.31591796875,
0.2152099609375,
-0.841796875,
4.44921875,
1.0712890625,
0.3935546875,
0.3916015625,
0.23193359375,
0.8955078125,
0.35205078125,
-1.19140625,
0.1619873046875,
-0.96484375,
0.253173828125,
-1.0302734375,
0.00945281982421875,
0.5751953125,
0.4208984375,
0.60986328125,
-0.53662109375,
-0.267822265625,
0.10516357421875,
-1.283203125,
-0.966796875,
0.411865234375,
-0.31005859375,
0.52099609375,
0.371337890625,
0.424072265625,
0.334716796875,
-0.515625,
-0.292236328125,
-0.5166015625,
0.056243896484375,
-0.499755859375,
0.87060546875,
0.310791015625,
-0.264892578125,
0.98876953125,
0.213134765625,
-0.232666015625,
-0.3095703125,
0.4169921875,
-0.31201171875,
0.15234375,
0.958984375,
-0.8798828125,
0.03631591796875,
0.9677734375,
-0.350830078125,
0.08624267578125,
0.482421875,
-1.0439453125,
1.1162109375,
-0.00736236572265625,
0.34912109375,
0.182373046875,
-0.6865234375,
0.053375244140625,
-0.06158447265625,
0.049713134765625,
0.284912109375,
0.30078125,
0.376220703125,
0.28759765625,
0.23486328125,
0.52001953125,
-1.0302734375,
0.6123046875,
-0.09478759765625,
0.654296875,
-0.57177734375,
-0.2127685546875,
-0.53271484375,
-0.21923828125,
-0.286865234375,
-0.6025390625,
0.8232421875,
0.305419921875,
-0.11053466796875,
0.572265625,
0.57080078125,
-0.86181640625,
0.39794921875,
-0.13818359375,
-0.61962890625,
-0.6455078125,
0.6982421875,
1.0146484375,
-0.353271484375,
-0.424072265625,
-0.18017578125,
0.65380859375,
0.1453857421875,
0.68798828125,
-0.19091796875,
-0.7568359375,
-0.1490478515625
] | 6
|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
International Coding Procedures Company (ICPC) writes all its code in Jedi Script (JS) programming language. JS does not get compiled, but is delivered for execution in its source form. Sources contain comments, extra whitespace (including trailing and leading spaces), and other non-essential features that make them quite large but do not contribute to the semantics of the code, so the process of minification is performed on source files before their delivery to execution to compress sources while preserving their semantics.
You are hired by ICPC to write JS minifier for ICPC. Fortunately, ICPC adheres to very strict programming practices and their JS sources are quite restricted in grammar. They work only on integer algorithms and do not use floating point numbers and strings.
Every JS source contains a sequence of lines. Each line contains zero or more tokens that can be separated by spaces. On each line, a part of the line that starts with a hash character ('#' code 35), including the hash character itself, is treated as a comment and is ignored up to the end of the line.
Each line is parsed into a sequence of tokens from left to right by repeatedly skipping spaces and finding the longest possible token starting at the current parsing position, thus transforming the source code into a sequence of tokens. All the possible tokens are listed below:
* A reserved token is any kind of operator, separator, literal, reserved word, or a name of a library function that should be preserved during the minification process. Reserved tokens are fixed strings of non-space ASCII characters that do not contain the hash character ('#' code 35). All reserved tokens are given as an input to the minification process.
* A number token consists of a sequence of digits, where a digit is a character from zero ('0') to nine ('9') inclusive.
* A word token consists of a sequence of characters from the following set: lowercase letters, uppercase letters, digits, underscore ('_' code 95), and dollar sign ('$' code 36). A word does not start with a digit.
Note, that during parsing the longest sequence of characters that satisfies either a number or a word definition, but that appears in the list of reserved tokens, is considered to be a reserved token instead.
During the minification process words are renamed in a systematic fashion using the following algorithm:
1. Take a list of words that consist only of lowercase letters ordered first by their length, then lexicographically: "a", "b", ..., "z", "aa", "ab", ..., excluding reserved tokens, since they are not considered to be words. This is the target word list.
2. Rename the first word encountered in the input token sequence to the first word in the target word list and all further occurrences of the same word in the input token sequence, too. Rename the second new word encountered in the input token sequence to the second word in the target word list, and so on.
The goal of the minification process is to convert the given source to the shortest possible line (counting spaces) that still parses to the same sequence of tokens with the correspondingly renamed words using these JS parsing rules.
Input
The first line of the input contains a single integer n (0 ≤ n ≤ 40) — the number of reserved tokens.
The second line of the input contains the list of reserved tokens separated by spaces without repetitions in the list. Each reserved token is at least one and at most 20 characters long and contains only characters with ASCII codes from 33 (exclamation mark) to 126 (tilde) inclusive, with exception of a hash character ('#' code 35).
The third line of the input contains a single integer m (1 ≤ m ≤ 40) — the number of lines in the input source code.
Next m lines contain the input source, each source line is at most 80 characters long (counting leading and trailing spaces). Each line contains only characters with ASCII codes from 32 (space) to 126 (tilde) inclusive. The source code is valid and fully parses into a sequence of tokens.
Output
Write to the output a single line that is the result of the minification process on the input source code. The output source line shall parse to the same sequence of tokens as the input source with the correspondingly renamed words and shall contain the minimum possible number of spaces needed for that. If there are multiple ways to insert the minimum possible number of spaces into the output, use any way.
Examples
Input
16
fun while return var { } ( ) , ; > = + ++ - --
9
fun fib(num) { # compute fibs
var return_value = 1, prev = 0, temp;
while (num > 0) {
temp = return_value; return_value = return_value + prev;
prev = temp;
num--;
}
return return_value;
}
Output
fun a(b){var c=1,d=0,e;while(b>0){e=c;c=c+d;d=e;b--;}return c;}
Input
10
( ) + ++ : -> >> >>: b c)
2
($val1++ + +4 kb) >> :out
b-> + 10 >>: t # using >>:
Output
(a+++ +4c )>> :d b->+10>>:e
Submitted Solution:
```
def main():
t = int(input())
reserved = set(input().split())
lines = int(input())
code = ''
for i in range(lines):
code += input() + '\n'
def is_word(suspect):
if suspect[0].isdigit(): return False
for x in suspect:
if (not x.isalpha()) and (not x in {'_', '$'}) and (not x.isdigit()):
return False
return True
def is_token(suspect):
if suspect in reserved: return True
if is_word(suspect): return True
if suspect.isdigit(): return True
return False
def remove_comments(code):
rez = ''
state = None
for i in range(len(code)):
if code[i] == '#':
state = 'comment'
elif code[i] == '\n':
rez += code[i]
state = None
else:
if state != 'comment':
rez += code[i]
return rez
code = remove_comments(code)
code = code.replace('\n', ' ')
def split(code):
tokens = []
i = 0
while i < len(code):
if code[i] == ' ':
i += 1
continue
for l in range(min(len(code), 81), 0, -1):
if is_token(code[i:i + l]):
tokens.append(code[i:i + l])
i += l
break
else:
0 // 0
return tokens
def minmize(tokens):
all = []
pref = [chr(i + ord('a')) for i in range(26)]
all.extend(pref)
for ext in range(2):
cur = []
for i in range(26):
for p in pref:
cur.append(p + chr(i + ord('a')))
cur.sort()
all.extend(cur)
pref = cur[::]
all.reverse()
zip = dict()
for i in range(len(tokens)):
if not tokens[i] in reserved and not tokens[i][0].isdigit():
if not zip.get(tokens[i], None):
while all[-1] in reserved:
all.pop()
zip[tokens[i]] = all[-1]
all.pop()
tokens[i] = zip[tokens[i]]
return tokens
tokens = (minmize(split(code)))
def cmp(a, b):
if len(a) != len(b): return False
for i in range(len(a)):
if a[i] != b[i]: return False
return True
final = ''
for i in range(len(tokens)):
t = ''
if i:
t += tokens[i - 1]
if i and (not cmp(tokens[i - 1:i + 1], split(t + tokens[i]))):
final += ' '
final += tokens[i]
print(final)
main()
```
No
| 67,289
|
[
0.24267578125,
-0.337890625,
-0.2098388671875,
0.1251220703125,
-0.60009765625,
-0.2474365234375,
-0.07080078125,
0.32373046875,
-0.259765625,
0.366455078125,
0.37353515625,
-0.013336181640625,
0.0153350830078125,
-0.8818359375,
-0.6044921875,
0.270263671875,
-0.50634765625,
-0.4912109375,
-0.60107421875,
-0.1707763671875,
-0.265869140625,
-0.0712890625,
-1.5283203125,
-0.193603515625,
-0.6396484375,
1.0732421875,
0.042877197265625,
-0.161865234375,
0.90576171875,
0.90478515625,
-0.471923828125,
-0.40673828125,
0.36767578125,
-0.716796875,
-0.2177734375,
-0.7822265625,
0.73828125,
-0.62548828125,
-0.213134765625,
-0.22119140625,
-0.17724609375,
-0.421875,
0.31005859375,
-0.88671875,
-1.2685546875,
-0.0210113525390625,
-0.1324462890625,
-0.2763671875,
-0.09722900390625,
-0.481201171875,
0.1365966796875,
0.268310546875,
0.279541015625,
-0.23486328125,
-0.12744140625,
-0.08642578125,
0.11083984375,
0.01399993896484375,
-0.607421875,
-0.02557373046875,
-0.2486572265625,
0.313720703125,
-0.09979248046875,
-0.650390625,
-0.1434326171875,
0.75830078125,
-0.197021484375,
0.1942138671875,
0.12457275390625,
-0.447265625,
-0.03265380859375,
0.1842041015625,
-0.49169921875,
-0.2406005859375,
-0.62109375,
-0.11138916015625,
0.51708984375,
0.263916015625,
-0.71875,
0.55126953125,
0.2227783203125,
1.0673828125,
0.18408203125,
0.152099609375,
-0.52587890625,
-0.55810546875,
0.432373046875,
0.25341796875,
0.0958251953125,
-0.2078857421875,
-0.11566162109375,
0.484619140625,
-0.55126953125,
0.004222869873046875,
0.919921875,
0.3671875,
-0.2509765625,
0.63623046875,
-0.144775390625,
0.437744140625,
0.62548828125,
0.77978515625,
-0.755859375,
0.81103515625,
-0.311279296875,
0.11431884765625,
0.07891845703125,
-0.037872314453125,
-0.2403564453125,
-0.1175537109375,
-0.0192718505859375,
-0.8984375,
0.0254669189453125,
-0.364013671875,
-0.219970703125,
0.7783203125,
-0.263427734375,
0.453369140625,
-0.86572265625,
0.32666015625,
0.587890625,
-0.60107421875,
0.333984375,
-0.25927734375,
0.358642578125,
-0.371337890625,
0.0340576171875,
0.6025390625,
-0.295166015625,
-0.12890625,
0.60791015625,
-0.16845703125,
-0.0975341796875,
0.462646484375,
0.277099609375,
0.70263671875,
0.0004930496215820312,
0.4423828125,
0.64892578125,
-0.31689453125,
0.169921875,
0.12274169921875,
0.091552734375,
1.4921875,
0.289794921875,
0.097412109375,
0.1248779296875,
0.408935546875,
-0.494384765625,
0.413818359375,
-0.98974609375,
0.310546875,
0.22998046875,
0.156494140625,
-0.37060546875,
0.035675048828125,
-0.2783203125,
0.5322265625,
0.5322265625,
-0.0208282470703125,
-0.1678466796875,
0.1202392578125,
-0.2020263671875,
0.92919921875,
-0.677734375,
0.521484375,
-0.45703125,
-0.365478515625,
-0.29345703125,
-0.341796875,
0.400146484375,
-0.042236328125,
-0.06903076171875,
0.75439453125,
0.359375,
0.9404296875,
0.88525390625,
0.1846923828125,
0.04022216796875,
0.1773681640625,
-0.39794921875,
0.1920166015625,
0.0105743408203125,
0.99560546875,
0.175048828125,
0.349365234375,
0.1326904296875,
-0.0310516357421875,
-0.6875,
-0.30419921875,
0.1939697265625,
0.998046875,
-0.603515625,
0.043060302734375,
-0.06072998046875,
-0.2432861328125,
-0.5673828125,
-0.322509765625,
-0.14599609375,
-0.79052734375,
-0.845703125,
0.83935546875,
-0.1058349609375,
0.501953125,
-0.42724609375,
-0.263916015625,
0.478515625,
1.3837890625,
-0.583984375,
-0.2003173828125,
0.66259765625,
0.287109375,
0.0010461807250976562,
-0.378662109375,
-0.04754638671875,
-0.043853759765625,
-0.7392578125,
0.70458984375,
-0.223388671875,
0.185546875,
0.1300048828125,
0.5419921875,
0.369140625,
0.55322265625,
-0.2578125,
-0.432861328125,
0.0799560546875,
1.142578125,
-0.1280517578125,
-0.1832275390625,
0.1387939453125,
0.66259765625,
0.360107421875,
0.87890625,
0.29541015625,
0.12054443359375,
1.09375,
1.1845703125,
-0.322509765625,
0.5263671875,
0.1556396484375,
0.32275390625,
0.54736328125,
0.52978515625,
0.4228515625,
0.394287109375,
-0.3232421875,
-0.1859130859375,
-0.390869140625,
0.63720703125,
-0.55712890625,
0.69482421875,
0.376220703125,
0.7666015625,
-0.6318359375,
-0.7060546875,
0.2052001953125,
0.57177734375,
-0.70166015625,
-0.4794921875,
0.1798095703125,
-0.19287109375,
0.4267578125,
0.20166015625,
0.396240234375,
0.42529296875,
0.464599609375,
0.451904296875,
-0.1495361328125,
-0.449951171875,
-0.8486328125,
-0.6806640625,
-1.05859375,
0.006435394287109375,
-0.625,
0.042572021484375,
-0.1588134765625,
-0.9677734375,
0.443359375,
-0.44775390625,
-0.189453125,
-0.287109375,
-0.77734375,
0.360595703125,
0.044921875,
0.529296875,
-0.277587890625,
0.86865234375,
0.3486328125,
0.96533203125,
-0.8935546875,
-0.02777099609375,
-0.023223876953125,
-0.6630859375,
0.408935546875,
-0.12841796875,
0.31494140625,
0.030426025390625,
-0.84765625,
-0.7421875,
-0.2322998046875,
-0.1300048828125,
0.137451171875,
0.1953125,
-0.646484375,
0.8896484375,
0.09698486328125,
-0.57470703125,
0.74365234375,
0.5361328125,
-1.0673828125,
0.578125,
-0.0697021484375,
0.09478759765625,
-0.81982421875,
1.591796875,
0.6103515625,
0.7275390625,
-0.181884765625,
-0.440185546875,
-0.247802734375,
0.095458984375,
-0.0003859996795654297,
-0.51953125,
-0.28515625,
0.82666015625,
0.1278076171875,
-0.98486328125,
0.42333984375,
-0.998046875,
-0.491943359375,
-0.1639404296875,
-0.6748046875,
0.79052734375,
0.56494140625,
0.2071533203125,
0.007007598876953125,
-0.0848388671875,
-0.7294921875,
0.4931640625,
0.56591796875,
-0.74462890625,
0.0252532958984375,
0.53173828125,
-0.033233642578125,
0.266845703125,
0.2034912109375,
-0.79541015625,
0.225341796875,
-0.53955078125,
0.1944580078125,
0.6826171875,
0.4208984375,
-0.0094757080078125,
-0.1392822265625,
0.89501953125,
-1.1435546875,
-0.437255859375,
-0.2386474609375,
0.681640625,
0.79736328125,
0.654296875,
0.36279296875,
-0.397705078125,
-0.744140625,
-1.0927734375,
-0.02752685546875,
-0.1875,
0.74609375,
-0.90478515625,
0.94091796875,
0.2281494140625,
-0.7822265625,
0.56005859375,
-0.458251953125,
-0.119140625,
0.94775390625,
-0.043609619140625,
0.6201171875,
-0.98095703125,
0.2152099609375,
-0.37060546875,
-0.046417236328125,
0.53125,
0.394287109375,
0.78955078125,
-0.6474609375,
-0.416259765625,
-0.14990234375,
-0.3505859375,
-0.431884765625,
-0.42724609375,
-0.01068115234375,
-0.476806640625,
-0.67431640625,
-1.0908203125,
0.9853515625,
0.1295166015625,
0.490478515625,
-0.046875,
0.4375,
-0.2042236328125,
0.240478515625,
0.65380859375,
0.0205535888671875,
0.1341552734375,
-0.75927734375,
1.013671875,
-0.0291595458984375,
-0.367431640625,
-0.354248046875,
-0.390380859375,
-0.429443359375,
0.06549072265625,
0.4736328125,
0.03045654296875,
-0.77392578125,
0.48779296875,
0.2418212890625,
0.2457275390625,
-0.74560546875,
-0.357421875,
-0.5068359375,
0.60986328125,
0.58056640625,
-1.1005859375,
0.2491455078125,
-0.30810546875,
0.181884765625,
0.53173828125,
-0.0130462646484375,
-0.447509765625,
-0.416748046875,
-0.6396484375,
-0.71875,
0.1837158203125,
0.80615234375,
-0.12255859375,
0.053955078125,
-0.92333984375,
0.484619140625,
0.46875,
0.0195770263671875,
0.0789794921875,
0.078125,
0.3583984375,
-0.18505859375,
0.8759765625,
-0.2117919921875,
-0.55615234375,
0.4677734375,
-0.75048828125,
0.76416015625,
-0.5556640625,
0.182861328125,
0.0474853515625,
-0.111572265625,
-0.311767578125,
0.69970703125,
0.048614501953125,
-0.182373046875,
-0.340087890625,
0.2154541015625,
-1.1630859375,
-0.9111328125,
0.64013671875,
0.04901123046875,
-0.26171875,
0.9765625,
0.1785888671875,
-0.34375,
0.533203125,
0.191162109375,
-0.40380859375,
0.4228515625,
-0.68212890625,
0.11199951171875,
-0.19677734375,
-0.351318359375,
-0.026275634765625,
-0.473876953125,
0.63623046875,
0.260986328125,
-0.759765625,
-0.343017578125,
-0.837890625,
-0.0474853515625,
-0.045989990234375,
-0.509765625,
0.310791015625,
-0.0965576171875,
0.098388671875,
0.23583984375,
-0.56103515625,
-0.265869140625,
-0.367919921875,
-0.56787109375,
-0.24609375,
0.43212890625,
0.62353515625,
0.64892578125,
0.042572021484375,
-0.69189453125,
0.1663818359375,
-0.1396484375,
-0.0271148681640625,
-0.669921875,
-0.0428466796875,
-0.09161376953125,
-0.306396484375,
-0.083740234375,
0.333740234375,
0.181884765625,
0.201416015625,
0.82568359375,
0.195556640625,
0.703125,
0.256103515625,
-0.80419921875,
0.689453125,
-0.1593017578125,
-1.1455078125,
-0.262939453125,
0.7958984375,
-0.071533203125,
0.984375,
0.2425537109375,
-0.76220703125,
-0.5244140625,
-0.89599609375,
0.1619873046875,
-0.83935546875,
-0.0767822265625,
-0.76611328125,
-0.56298828125,
-0.252685546875,
0.84228515625,
-0.380126953125,
-0.46533203125,
-0.346923828125,
-0.7958984375,
0.2447509765625,
-0.80078125,
-0.2047119140625,
-0.345703125,
-0.587890625,
-0.384765625,
0.95166015625,
0.0184783935546875,
0.5673828125,
-0.30908203125,
-0.10479736328125,
0.420654296875,
0.42822265625,
-0.90283203125,
-0.56005859375,
-0.056396484375,
-0.07708740234375,
-0.053863525390625,
-0.268798828125,
-0.5498046875,
1.1953125,
-0.97216796875,
0.11724853515625,
-0.1767578125,
-0.76953125,
-0.455322265625,
-0.2626953125,
1.033203125,
-0.225341796875,
-0.21142578125,
-0.00397491455078125,
0.65673828125,
0.6455078125,
-0.1868896484375,
-0.52587890625,
-0.268310546875,
-0.68896484375,
-0.9638671875,
0.51904296875,
-0.017181396484375,
0.31005859375,
-0.30419921875,
-0.2305908203125,
1.3564453125,
-0.5087890625,
0.463623046875,
1.306640625,
0.127685546875,
0.19189453125,
-0.619140625,
0.95068359375,
0.45751953125,
-0.6357421875,
0.2069091796875,
0.36572265625,
-0.32373046875,
0.07037353515625,
-0.810546875,
-0.650390625,
-0.71484375,
0.142822265625,
1.2431640625,
-0.59375,
0.442138671875,
-0.482666015625,
-1.21875,
-0.61083984375,
0.87060546875,
-0.0802001953125,
0.038909912109375,
0.9619140625,
-0.2890625,
0.2137451171875,
0.05706787109375,
0.2213134765625,
0.071533203125,
-0.2291259765625,
1.255859375,
-0.26220703125,
-0.384521484375,
0.4130859375,
0.81689453125,
-1.2314453125,
-0.65185546875,
-0.048736572265625,
0.111572265625,
-0.297607421875,
-0.5732421875,
-0.0594482421875,
0.3349609375,
-0.54150390625,
0.0933837890625,
0.52880859375,
-0.2484130859375,
0.44091796875,
0.0941162109375,
-0.0516357421875,
-0.5576171875,
0.31103515625,
0.9267578125,
-0.716796875,
-0.41748046875,
-0.82861328125,
0.1722412109375,
0.084228515625,
0.029937744140625,
0.76953125,
-0.057525634765625,
0.52734375,
0.8232421875,
-0.006072998046875,
1.154296875,
-0.54541015625,
0.0843505859375,
0.411376953125,
-0.6142578125,
-0.5849609375,
-0.381103515625,
0.2091064453125,
-0.298583984375,
0.5029296875,
-0.67919921875,
0.04962158203125,
0.2247314453125,
0.25244140625,
-0.140625,
-0.93505859375,
-0.2144775390625,
-0.833984375,
-0.482666015625,
-0.60546875,
-0.284423828125,
-0.1129150390625,
0.120849609375,
-0.0089874267578125,
-0.76025390625,
0.458251953125,
0.0899658203125,
-0.6787109375,
0.1746826171875,
-0.466552734375,
0.34814453125,
-0.63037109375,
-0.485107421875,
-0.61328125,
-0.426025390625,
-0.67529296875,
0.1412353515625,
-0.14697265625,
0.2509765625,
-0.26220703125,
0.346923828125,
-0.41064453125,
0.131591796875,
0.0202789306640625,
-0.33349609375,
0.2041015625,
0.351318359375,
-0.23583984375,
0.82470703125,
0.325439453125,
0.45556640625,
-0.0965576171875,
0.01325225830078125,
-0.2147216796875,
0.1141357421875,
0.431640625,
0.5859375,
0.1163330078125,
0.0269775390625,
0.09161376953125,
-0.03594970703125,
-0.68115234375,
0.2978515625,
-0.114990234375,
0.25830078125,
0.37841796875,
-0.1920166015625,
0.458740234375,
1.1025390625,
-0.09063720703125,
0.211669921875,
0.226318359375,
0.45361328125,
0.51318359375,
-0.373779296875,
0.317138671875,
0.238037109375,
0.120361328125,
-0.368408203125,
0.12353515625,
0.470458984375,
-0.06707763671875,
0.13671875,
-0.18701171875,
-0.493408203125,
-1.2255859375,
-0.325439453125,
0.046844482421875,
0.64306640625,
0.473388671875,
-0.424072265625,
0.35400390625,
0.07830810546875,
-0.485107421875,
0.552734375,
-1.03515625,
-0.94091796875,
0.603515625,
-0.32080078125,
-0.08807373046875,
-0.4716796875,
-0.408203125,
-0.07318115234375,
-0.09686279296875,
0.07452392578125,
-0.30859375,
0.0714111328125,
0.1875,
0.5537109375,
-0.1541748046875,
-0.01496124267578125,
-0.0222625732421875,
0.5390625,
-0.6201171875,
-0.5283203125,
0.08056640625,
1.0634765625,
0.06884765625,
-0.311767578125,
-0.53076171875,
0.2125244140625,
0.11663818359375,
0.6806640625,
-0.79931640625,
-0.443603515625,
-0.37939453125,
0.6083984375,
-0.515625,
-0.2086181640625,
-0.25390625,
0.9052734375,
0.11041259765625,
-0.1915283203125,
-0.39111328125,
0.57080078125,
0.89990234375,
-0.22265625,
0.4365234375,
0.080078125,
0.47314453125,
-0.386474609375,
-0.2322998046875,
-0.19921875,
0.875,
0.7490234375,
1.0322265625,
0.0251007080078125,
0.361083984375,
0.6259765625,
-0.01287078857421875,
-0.356201171875,
0.053863525390625,
-0.013336181640625,
-0.306640625,
-0.432861328125,
0.2479248046875,
-0.1876220703125,
-0.135009765625,
-0.43017578125,
0.452392578125,
-0.701171875,
-0.380859375,
-0.5244140625,
-0.6279296875,
1.13671875,
-0.332763671875,
0.0518798828125,
-0.1424560546875,
-0.1759033203125,
0.35888671875,
0.86083984375,
-0.14697265625,
0.062744140625,
1.220703125,
0.5712890625,
0.257568359375,
0.48779296875,
0.285400390625,
0.362060546875,
-0.34228515625,
0.0723876953125,
-0.0428466796875,
0.060028076171875,
-0.2783203125,
-0.284423828125,
-1.009765625,
0.6845703125,
-0.505859375,
0.0474853515625,
0.1722412109375,
-0.85986328125,
-0.367919921875,
-0.58203125,
0.54638671875,
-0.974609375,
0.0308990478515625,
0.2305908203125,
-0.4794921875,
-0.81103515625,
1.0166015625,
-0.0292510986328125,
0.446533203125,
0.131591796875,
0.681640625,
-0.04644775390625,
1.49609375,
0.34765625,
-0.381591796875,
0.1595458984375,
0.556640625,
-0.05767822265625,
-0.67333984375,
-0.0679931640625,
-0.435546875,
-0.50048828125,
-0.77783203125,
-0.56884765625,
-0.1322021484375,
0.86572265625,
0.193359375,
-1.23046875,
-0.17724609375,
0.08416748046875,
-0.54833984375,
0.347412109375,
0.06903076171875,
0.48876953125,
-0.11822509765625,
0.11322021484375,
0.12213134765625,
-0.392578125,
-0.144287109375,
-0.3603515625,
0.28271484375,
-0.216796875,
-0.494873046875,
-0.8271484375,
-0.3984375,
-0.164794921875,
-0.03765869140625,
-0.60107421875,
-0.693359375,
0.57275390625,
0.84423828125,
0.7529296875,
0.351318359375,
-0.5341796875,
-0.1343994140625,
0.61865234375,
0.95751953125,
-0.04541015625,
0.68408203125,
0.89501953125,
-0.005859375,
0.39208984375,
-0.3466796875,
0.485595703125,
-0.095458984375,
-0.2337646484375,
-0.53076171875,
-0.047332763671875,
-0.810546875,
-1.2275390625,
0.10260009765625,
0.47314453125,
0.5791015625,
-0.548828125,
-0.966796875,
-0.497314453125,
-0.85791015625,
-0.151123046875,
-0.90625,
0.5185546875,
0.1591796875,
-0.31591796875,
0.2152099609375,
-0.841796875,
4.44921875,
1.0712890625,
0.3935546875,
0.3916015625,
0.23193359375,
0.8955078125,
0.35205078125,
-1.19140625,
0.1619873046875,
-0.96484375,
0.253173828125,
-1.0302734375,
0.00945281982421875,
0.5751953125,
0.4208984375,
0.60986328125,
-0.53662109375,
-0.267822265625,
0.10516357421875,
-1.283203125,
-0.966796875,
0.411865234375,
-0.31005859375,
0.52099609375,
0.371337890625,
0.424072265625,
0.334716796875,
-0.515625,
-0.292236328125,
-0.5166015625,
0.056243896484375,
-0.499755859375,
0.87060546875,
0.310791015625,
-0.264892578125,
0.98876953125,
0.213134765625,
-0.232666015625,
-0.3095703125,
0.4169921875,
-0.31201171875,
0.15234375,
0.958984375,
-0.8798828125,
0.03631591796875,
0.9677734375,
-0.350830078125,
0.08624267578125,
0.482421875,
-1.0439453125,
1.1162109375,
-0.00736236572265625,
0.34912109375,
0.182373046875,
-0.6865234375,
0.053375244140625,
-0.06158447265625,
0.049713134765625,
0.284912109375,
0.30078125,
0.376220703125,
0.28759765625,
0.23486328125,
0.52001953125,
-1.0302734375,
0.6123046875,
-0.09478759765625,
0.654296875,
-0.57177734375,
-0.2127685546875,
-0.53271484375,
-0.21923828125,
-0.286865234375,
-0.6025390625,
0.8232421875,
0.305419921875,
-0.11053466796875,
0.572265625,
0.57080078125,
-0.86181640625,
0.39794921875,
-0.13818359375,
-0.61962890625,
-0.6455078125,
0.6982421875,
1.0146484375,
-0.353271484375,
-0.424072265625,
-0.18017578125,
0.65380859375,
0.1453857421875,
0.68798828125,
-0.19091796875,
-0.7568359375,
-0.1490478515625
] | 6
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.