How many of you that still use your own knuckle to determine whether a month is having a full 31 days or less?
You job is to write a program to count how many months, in a month range, are having a full 31 days and how many are having less than 31 days by "counting the knuckles".
Courtesy: amsi.org.au
Input
A pair of months, the first of which doesn't have to come chronologically before the second, given in any suitable format. For instance: 201703 201902
— March 2017 to February 2019. Please describe the input format you choose. Note that the input must be able to include all years from 1 to 9999. The range of months specified includes both the starting and ending months.
Output
Two integers: the number of months in the given range with 31 days and the number of months in the range with less than 31 days.
Example: 14 10
— 14 knuckles, 10 grooves (it means that in that month range we have 14 months that have a full 31 days, and 10 months that have less than 31 days).
For an input where the second month in the range comes chronologically before the first, for example 201612 201611
, you have to output a pair of zero.
Examples of input and output
| Input | Output |
|---------------|-------------|
| 201703 201902 | 14 10 |
| 201701 202008 | 26 18 |
| 000101 999912 | 69993 49995 |
| 201802 201803 | 1 1 |
| 201601 201601 | 1 0 |
| 201612 201611 | 0 0 |
Rules
- You may choose any language you like
- One input per line
- This is code-golf, so shortest code in bytes wins!
- The winner will be chosen in April 9
- Standard loopholes apply
- PS: this is my first question in PCG, it might have some inconsistencies. Feel free to edit and confirm what's unclear for you.
201612 201611
. \$\endgroup\$