LCC/Moose '20 Contest 4 J3 - Button Mashing

View as PDF

Submit solution

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

Author:
Problem type

Oscar is a professional button masher in Duel Masters. Oscar utilizes two elements, earth and fire, in his attacking moves. Combo moves in Duel Masters are created by repeatedly inputting a sequence of moves. Oscar mashes so many buttons that he does not know what combo he used, however, there are naming rules that can allow him to figure out. Sequences of moves append a word to the end of the combo name. Inputs are read by the game console from the left to right and the combo name is determined based on the following rules, where f denotes a fire move and e denotes an earth move:

  • eee will append mountain
  • ee will append boulder
  • e will append solid
  • fff will append flare
  • ff will append blazing
  • f will append firey

Each move will only count towards a singular adjective. Longer sequences of moves will be prioritized ahead of shorter sequences so when ee is inputted, the console will prioritize boulder over two solids. If more than four of the same character is repeated in a row, the console will attempt to make the largest groups first, ffff will append flare firey.

Additionally, there is a special naming convention that will be prioritized ahead of the others.

  • fe or ef will append molten

Finally, a noun will be appended depending on the type of the final move.

  • Append barrage if the final move is e
  • Append onslaught if the final move is f

As Oscar is unable to keep track of his moves he has asked for your help. Can you help him figure out the combo name?

Input Specification

The first line contains an integer N (1 \le N \le 5000)

The next line contains a string with N characters, the type of move inputted.

Output Specification

Output the name of the combo.

Subtasks

Subtask 1 (5%)

N \le 2

Subtask 2 (95%)

No further constraints.

Sample Input 1

3
efe

Sample Output 1

molten solid barrage

Sample Input 2

6
eeeeff

Sample Output 2

mountain molten firey onslaught

Comments

There are no comments at the moment.