New Year's '16 P2 - The 365 Days of Christmas

View as PDF

Submit solution


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

Author:
Problem type

It's the new year already, but the festive spirit of Christmas still lingers in you. In fact, you've decided to make a parody of the traditional Christmas carol "The 12 Days of Christmas" and call it "The N Days of Christmas". Now you can celebrate Christmas all year round!

Of course, having so many days means that the lyrics will be ridiculously long. After coming up with what your true love sends to you each day, you realized that the sane thing to do is to write a program to output the lyrics of the entire song.

Input Specification

The first line of input will contain N, the number of days. (1 \le N \le 365)

The i+1^\text{th} line will contain what your true love sent to you on the i^\text{th} day. Each line will contain no more than 25 characters. Plurals will be included in the input.

Output Specification

Output the lyrics to your parody. See the sample case for details.

Sample Input

4
partridge in a pear tree
turtle doves
french hens
calling birds

Sample Output

On the 1st day of Christmas my true love sent to me:
1 partridge in a pear tree

On the 2nd day of Christmas my true love sent to me:
2 turtle doves
and 1 partridge in a pear tree

On the 3rd day of Christmas my true love sent to me:
3 french hens
2 turtle doves
and 1 partridge in a pear tree

On the 4th day of Christmas my true love sent to me:
4 calling birds
3 french hens
2 turtle doves
and 1 partridge in a pear tree

Explanation for Sample Output

The sample case is a shortened version of the traditional song. Note that:

  • the suffix for numbers ending in 1, 2, and 3, excluding numbers ending in 11, 12, and 13, are st, nd, and rd, respectively, all other numbers take th
  • there is an empty line between every verse
  • after the first day, the last item in the list is preceded with and

Make sure to follow the format, capitalization, and punctuation exactly.


Comments


  • 1
    Quality_of_Perfection  commented on Aug. 22, 2016, 2:19 p.m.

    I seem to have taken into account the corner cases and yet I am still getting partial marks. Can someone please give me a hint at what I may be doing wrong. Thanks.


    • 8
      d  commented on Aug. 22, 2016, 8:20 p.m.

      111st


  • 3
    maxhflow  commented on Jan. 2, 2016, 5:22 a.m. edit 2

    I get "You submitted too many submissions." whenever I attempt this problem.

    (I've made 2 submissions. Maybe it is a typo, and should say "two many submissions".)

    Edit: Seems to have been resolved. Thanks!


  • 5
    moladan123  commented on Jan. 1, 2016, 5:47 p.m. edit 2

    Is it the 12nd day of Christmas or the 12th?

    Edit: Now I see. Curse the English language for being so convoluted.

    Edit: Don't you love it when the only way to get full points is to change some random thing about your code and you have no idea why it worked but it did.


    • 0
      cheesecake  commented on Jan. 1, 2016, 5:50 p.m.

      The answer to your question is in the problem statement.