When Serezha was three years old, he was given a set of cards with letters for his birthday. They were arranged into words in a way that formed the boy's mother's favorite number in binary notation. Serezha started playing with them immediately and shuffled them because he wasn't yet able to read. His father decided to rearrange them. Help him restore the original number, on the condition that it was the maximum possible one.
Serezha 三歲時,有人送給他一套寫有字母的卡片作為他的生日禮物。 它們以一種形成男孩母親最喜歡的二進制數的方式排列成單詞。 Serezha 立即開始玩它們並將它們洗牌,因為他還無法閱讀。 他的父親決定重新安排他們。 幫他恢復原來的數,條件是盡可能多。
The first line contains a single integer nn (1⩽n⩽105) — the length of the string. The second line contains a string consisting of English lowercase letters: 'z', 'e', 'r', 'o', and 'n'.
It is guaranteed that it is possible to rearrange the letters to form a sequence of words, each being either "zero" which corresponds to the digit 0, or "one" which corresponds to the digit 1.
第一行包含一個整數 n (1⩽n⩽105) —— 字符串的長度。 第二行包含一個由英文小寫字母組成的字符串:'z'、'e'、'r'、'o' 和 'n'。
保證可以重新排列字母,使它們形成一個單詞序列,每個單詞要麼是對應數字 0 的“零”,要麼對應數字 1 的“一”。
Print the maximum possible number in binary notation. Print binary digits separated by a space. The leading zeroes are allowed.
以二進製表示法輸出最大可能數。 打印由空格分隔的二進制數字。 允許使用前導零。
4 ezor
0
10 nznooeeoer
1 1 0
6 zeroon
1
In the first example, the correct initial ordering is "zero".
In the second example, the correct initial ordering is "oneonezero".
在第一個例子中,正確的初始排序是“zero”。
在第二個例子中,正確的初始順序是“oneonezero”。
ID | User | Problem | Subject | Hit | Post Date |
沒有發現任何「解題報告」 |