#C334. Workshop Popularity Trend
Workshop Popularity Trend
Workshop Popularity Trend
You are given n workshops, each with a popularity score. Your task is to determine the popularity trend on a workshop by workshop basis.
For each workshop from the second to the last, compare its popularity score with the previous workshop. If the current workshop's popularity is higher than the previous one, output an 'H'; if it is lower, output an 'L'; and if they are equal, output an 'E'.
Formally, given an integer \( n \) and a list of integers \( [a_1, a_2, \ldots, a_n] \), you should output a string \( s \) of length \( n - 1 \) where for each \( i \) from 2 to \( n \):
\( s_{i-1} = \begin{cases} H, & \text{if } a_i > a_{i-1}, \\ L, & \text{if } a_i < a_{i-1}, \\ E, & \text{if } a_i = a_{i-1}. \end{cases} \)
inputFormat
The input is given via standard input (stdin) in the following format:
- The first line contains an integer \( n \), which is the number of workshops.
- The second line contains \( n \) space-separated integers representing the popularity scores of the workshops.
outputFormat
Output a single line string of length \( n - 1 \) to standard output (stdout), where each character is either 'H', 'L', or 'E' based on the comparison between consecutive workshops' popularity scores.
## sample5
10 20 20 15 30
HELH