Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

A Feast for the Fans

By ishtupeed, DarkknightRHZ · Limits 1s, 512 MB

Game of Thrones is an American fantasy drama television series created by David Benioff and D. B. Weiss. It is an adaptation of A Song of Ice and Fire, George R. R. Martin’s series of fantasy novels, the first of which is A Game of Thrones. The series premiered on HBO in the United States on April 17, 2011, and its seventh season ended on August 27, 2017. Season 1 to 6 consists of 10 episodes each. Season 7 consists of only 7 episodes.

It is rumored that the series will conclude with its eighth season in 2019. It is almost middle of 2018 and the fans aren’t happy as they won’t get to watch their favorite show for a long time. To keep these fans happy, HBO has decided to broadcast season 1 to season 7 throughout the year 2019.

HBO will broadcast one episode per day. It will start broadcasting season 1 episode 1 (S01E01) from January 1, 2019. Then the next day season 1 episode 2 (S01E02) will be broadcast and so on. Following this schedule, for example, on January 11, they will broadcast season 2 episode 1 (S02E01), and in this way they will continue. After broadcasting season 7 episode 7 (S07E07), they will restart the schedule. That means from the very next day, they will resume to season 1 episode 1 and again continue broadcasting the episodes until the end of the year.

Now Emilia Clarke, a famous Game of Thrones actress and fan of the show, has asked you to perform the following task: given any date of 2019, you have to find out which episode of which season will be broadcast that day. Remember, failure to accomplish this task will result in you facing the wrath of mother of dragons.

Input

The first line of input will contain a single integer T (1 ≤ T ≤ 50), denoting the number of test cases. For each case, there will be a date in the format of ‘Month Day’.

  • Months of the year: January, February, March, April, May, June, July, August, September, October, November, December.
  • The dates will be valid.

Output

For each test case, print a single line in format ’S##E##’ replacing the #’s with the appropriate season and episode number. The numbers must be of two digits, containing leading zero if necessary. Print a newline after each output. See the sample test cases for clarification.

Sample

InputOutput
3
January 1
March 8
April 7
S01E01
S07E07
S03E10


    Discussion
    Statistics

    96% Solution Ratio

    iamSadeeEarliest, May '18

    Tarik.amtolyFastest, 0.0s

    better_rahikLightest, 0 B

    mdvirusShortest, 480B

    Submit

    Login to submit