Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

answer in python language How to Attempt? Royal Morse Code The Royal British Kingdom has enforced a new decree in the society that all princes

image text in transcribed

image text in transcribed

answer in python language

How to Attempt? Royal Morse Code The Royal British Kingdom has enforced a new decree in the society that all princes and princesses must use a new form of Morse code for all communications. We know that Morse Code uses dots (.) and dashes (-) to communicate meaning to the receiver. The following rules are stated according to this decree: - Any message must begin with a dot (.) - Any message must end with a dash (-) - Every dot (.) must have a corresponding dash (-) after it to close it If a message follows all the mentioned rules, then it is considered compli with the Royal Decree and the message is allowed to be sent. Otherwise considered as defaulted. The Great Prince of Britain has sent out a set of N messages of the new Morse code. You have to figure out the number of messages which are compliant and ultimately sent forward. Output Specification: The number of messages compliant to the new decree. Example 1: input1: 1 input :{n} Output: 0 Explanation: The given string starts with a dot(.) and ends with a dash (-), but it fails the third criteria as there are 5 dots but only 4 dashes. Thus, 0 messages are compliant. Example 2: input1: 2 input2: {".,,,,,",,,"} Output: 2 Explanation: Both the given strings follow all 3 rules. Thus, both 2 messages are compliant

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions

Question

Q.1. Taxonomic classification of peafowl, Tiger and cow ?

Answered: 1 week ago

Question

Q .1. Different ways of testing the present adulterants ?

Answered: 1 week ago

Question

Q.1. Health issues caused by adulteration data ?

Answered: 1 week ago