Meow Meow
Problem Statement
Digger and Rykker (pictured below, taking a break from meowing) like to make noise.
We've categorised the noises they make as follows:
hiss: This is represented in text ashi, followed by at least 2ss.trill: This is represented in text astr, followed by some non-zero amount ofis, and at least 2ls.burble: This is represented in text asb, followed by some non-zero amount ofus, followed by some non-zero amount ofrs, followed by ab, followed by some non-zero amount ofls, followed by ane.
We want you to write a program to recognise these.
Input
Your first line of input will be a single integer t: the number of noises made.
Next, t lines will follow, each containing a single string si: the noise made by either Digger and Rykker or a human.
Output
For each si, if it is a hiss, trill, or burble noise, output hiss, trill or burble, respectively, on its own line.
If si is none of these, output human noises instead.
Constraints
For all test cases...
- 1≤t≤100
- 1≤∣si∣≤100
- Each si only contains English lower-case alphabet letters.
Example
7
hisss
triiilll
buuurrrbllle
his
trlll
burbble
hello
hiss
trill
burble
human noises
human noises
human noises
human noises
Explanation
The first 3 lines fit their respective definitions.
hisdoes not have twoss.trlllneeds at least 1i.burbblerepeats abwhen it should not.hellokind of just...does not fit into any of the specified categories.
Python Template
t = int(input())
a = [input() for _ in range(t)]
# Continue your code here and print your final answer!Solution
If you'd like to view a sample solution to this tutorial question, please click the "Read Editorial" link to the right of the problem!
Comments0
No comments yet
Be the first to comment.
New comment
Log in to join the discussion.