LCC '24 Contest 1 S2 - Graham's Magic Spells

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

At the upcoming Mactoberfest, Graham has learned that plenty of witches and wizards will be attending. In order to impress them, he's been practicing two new spells.

  1. The first spell is Confetticus C, which creates a confetti explosion.

    It has an undoing spell, Janitorum J, which cleans up the confetti created by it's respective confetti explosion.

  2. The second spell is Rainborimus R, which summons a rainbow.

    It has an undoing spell, Sunshinio S, which dissipates the rainbow.

Multiple spells can be cast in a row, but the latest active spell must be undone first, or else the magic will fail and he will embarrass himself. All spells cast must eventually be undone otherwise it fails. Given a set of spells that Graham plans to cast, help Graham by identifying if that set is impressive, meaning that it works, or if it's embarrassing, meaning it will fail.

Input Specification

A string of N characters C, J, R, and S, representing the spells to be cast, confetticus, janitorum, rainborimus, and sunshinio respectively. The string N will always be at least 2 characters.

Output Specification

The word impressive if the set of spells doesn't fail, and embarrassing if it does.

Sample Input 1

CCJRSJ

Sample Output 1

impressive

Sample Input 2

CRJS

Sample Output 2

embarrassing

Comments

There are no comments at the moment.