You have a deck of cards of a strange game called Binary. Every card has a letter. The deck was formed by writing out a certain number in binary, spelling it out in English, and then making a card out of each character of the English word. For example, for the number 42, the binary representation is 101010, the English word is: one zero one zero one zero, and the deck consists of the following cards: 6 "o"s, three "n"s, six "e"s, three "z"s, and three "r"s. Given a shuffled version of the deck, recreate the largest number it could have correspnded to, and give your output in binary. Input The first line contains a single integer nn (1

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a C code.

You have a deck of cards of a strange game called Binary. Every card has a letter. The deck
was formed by writing out a certain number in binary, spelling it out in English, and then
making a card out of each character of the English word. For example, for the number 42,
the binary representation is 101010, the English word is: one zero one zero one zero, and
the deck consists of the following cards: 6 "o"s, three "n"s, six "e"s, three "z"s, and three
"r"s.
Given a shuffled version of the deck, recreate the largest number it could have correspnded
to, and give your output in binary.
Input
The first line contains a single integer nn (1<n<10)- 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 in such a way that they form a
sequence of words, each being either "zero" which corresponds to the digit 0 or "one" which
corresponds to the digit 1.
Output
Print the maximum possible number in binary notation. Print binary digits separated by a
space. The leading zeroes are allowed.
Examples
Transcribed Image Text:You have a deck of cards of a strange game called Binary. Every card has a letter. The deck was formed by writing out a certain number in binary, spelling it out in English, and then making a card out of each character of the English word. For example, for the number 42, the binary representation is 101010, the English word is: one zero one zero one zero, and the deck consists of the following cards: 6 "o"s, three "n"s, six "e"s, three "z"s, and three "r"s. Given a shuffled version of the deck, recreate the largest number it could have correspnded to, and give your output in binary. Input The first line contains a single integer nn (1<n<10)- 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 in such a way that they form a sequence of words, each being either "zero" which corresponds to the digit 0 or "one" which corresponds to the digit 1. Output Print the maximum possible number in binary notation. Print binary digits separated by a space. The leading zeroes are allowed. Examples
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education