Basic Syntax, Conditional Statements and Loops - More Exercises - 05. How Much Coffee Do You Need?
5. How Much Coffee Do You Need?
Everybody know that you passed to much time awake during night time...
Your task here is to define how much coffee you need to stay awake after your night. Until you receive the command "END", you need to read a single command, according to this command you will print the number of coffee you need to stay awake during day time.
Note: If the count exceed 5 please return 'You need extra sleep'.
The list of events can contain the following:
- You have homework to do ('coding').
- You have a dog or a cat that just decide to wake up too early ('dog' or 'cat').
- You just watch a movie ('movie').
- Other events can be present and it will be represent by arbitrary string, just ignore this one.
Each event can be lowercase, or uppercase. If it is lowercase you need 1 coffee by events and if it is uppercase you need 2 coffees.
Examples
Input |
Output |
dog CAT gaming END |
3 |
movie CODING MOVIE CLEANING cat END |
You need extra sleep |
Сигурно може и в бейсика да питам защо това - https://pastebin.com/bKnkv1Jt дава 90/100, но аз да питам тук
https://judge.softuni.bg/Contests/Practice/Index/1720#4 - линк към judge
Редактирал съм го - https://pastebin.com/EsY1pgz9 , но съм забравил да си заключа въпроса. Иначе е точно така както казваш ти, а аз се бях объркал от този ред в условието -Note: If the count exceed 5 please return 'You need extra sleep' и мислех, че става въпрос за броя на кафетата при брой на действия(count) като цяло, а всъщност на края се казва - Other events can be present and it will be represent by arbitrary string, just ignore this one. ...т.е. програмата да приключва само при 'END' както се вижда в примерите.
Благодаря все пак !