2016/4/14/22/40d

Source: Internet
Author: User

Description

Today is Wednesday, the third day of the week. What's more interesting was that tomorrow was the last day of the year 2015.

Limak is a little polar bear. He enjoyed a lot. Now, he's so eager to the coming year 2016.

Limak wants to prove about responsible a bear he was. He is going to regularly save candies for the entire year 2016! He considers various saving plans. He can save one candy either on some fixed day of the week or on some fixed day of the month.

Limak chose one particular plan. He isn ' t sure how many candies he'll save in the and his plan. Calculate it and tell him.

Input

The only line of the input was in one of the following and formats:

    • "x of Week" where x (1≤ x ≤7) denotes the day of the week. The 1-st Day is Monday and the 7-th one are Sunday.
    • "x of month" where x (1≤ x ≤31) denotes the day of the month.

Output

Print one integer-the number of candies Limak would save in the year 2016.

Sample Input

Input
4 of week
Output
52
Input
Of month
Output
11

Hint

Polar bears use the Gregorian calendar. It's the most common calendar and your likely use it too. You can read about it on the Wikipedia if you want to– Https://en.wikipedia.org/wiki/Gregorian_calendar. The week starts with Monday.

The first sample Limak wants to save one candy on each Thursday (the 4-th Day of the week). There is Thursdays in the 2016. Thus, he'll save candies in total.

The second sample Limak wants to save one candy on the 30-th day for each month. There is the 30-th day in exactly one months in the 2016-all months but February. It means that Limak would save one candies in total.

The main idea: input n and of week is asked 2016 years have a few weeks n

Enter N and of month is asking 2016 years there are several n numbers

#include <stdio.h>#include<string.h>intMain () {inte;Chara[]={"Week"}, c[ -], d[ -];scanf ("%d%s%s", &e, C, D);if(strcmp (a,d) = =0){        if(e==5|| e==6) printf ("53\n"); Elseprintf ("52\n");}Else{        if(e== -) printf ("11\n"); Else if(e== to) printf ("6\n"); Elseprintf ("12\n");}}

2016/4/14/22/40d

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.