Rubber Duck Debugging
InterviewTime limit1sMemory limit512 MB
Track a count of unsolved problems: '문제' adds one, '고무오리' removes one or adds two when the count is zero, then report whether the count is zero.
- Level
Easy3 of 10
- Topics
- Implementation, Simulation, Stack
- Solved
- No attempts yet
Problem
Sujin is having trouble solving problems. Minwoo prepared a rubber duck to help her with problem solving. The rubber duck Minwoo prepared has a mysterious ability: it solves the problem she was most recently working on. Let us help Sujin solve problems with the mysterious rubber duck.
The rubber duck is used as follows.
- Shout "고무오리 디버깅 시작".
- Start solving problems.
- When you receive the rubber duck, it solves the problem you were most recently working on.
- Shout "고무오리 디버깅 끝" to end the problem-solving session.
The rubber duck has one fatal flaw. If you use it when there is no problem to solve, it adds two problems as a penalty.
Input
The first line contains "고무오리 디버깅 시작". From the second line onward, either "고무오리" or "문제" is given. This repeats until "고무오리 디버깅 끝" is given. The input has at most 102 lines.
Output
When rubber duck debugging ends, print "고무오리야 사랑해" if Sujin solved every problem, and print "힝구" if at least one problem remains.