a918: Cards (卡牌)
Tags : elif for input 二進制
Accepted rate : 15人/15人 ( 100% ) [非即時]
評分方式:
Tolerant

最近更新 : 2023-01-18 11:37

Content

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 立即開始玩它們並將它們洗牌,因為他還無法閱讀。 他的父親決定重新安排他們。 幫他恢復原來的數,條件是盡可能多。

 

Input

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 的“一”。

 

 

Output

Print the maximum possible number in binary notation. Print binary digits separated by a space. The leading zeroes are allowed.

以二進製表示法輸出最大可能數。 打印由空格分隔的二進制數字。 允許使用前導零。

Sample Input #1
4
ezor
Sample Output #1
0
Sample Input #2
10
nznooeeoer
Sample Output #2
1 1 0
Sample Input #3
6
zeroon
Sample Output #3
1
測資資訊:
記憶體限制: 64 MB
不公開 測資點#0 (10%): 1.0s , <1K
不公開 測資點#1 (10%): 1.0s , <1K
不公開 測資點#2 (10%): 1.0s , <1K
不公開 測資點#3 (10%): 1.0s , <1K
不公開 測資點#4 (10%): 1.0s , <1K
不公開 測資點#5 (10%): 1.0s , <1K
不公開 測資點#6 (10%): 1.0s , <1M
不公開 測資點#7 (10%): 1.0s , <1K
不公開 測資點#8 (10%): 1.0s , <1K
不公開 測資點#9 (10%): 1.0s , <1M
Hint :

In the first example, the correct initial ordering is "zero".

In the second example, the correct initial ordering is "oneonezero".

在第一個例子中,正確的初始排序是“zero”。

在第二個例子中,正確的初始順序是“oneonezero”。

Tags:
elif for input 二進制
出處:
CodeForces Round #586 [管理者:
cwng@g.puich... (吳振華NG CHAN WA)
]


ID User Problem Subject Hit Post Date
沒有發現任何「解題報告」