The Challenge
I always write my math assignments down in the same way. For example:
pg. 420: #25, 50-56, 90
pg. 26: #50-60 evens, 70-80 odds, 90-99 3s
pg. 69: #12, 16, 18, 37
But I need you to tell me the individual problem numbers. For example:
input:
pg. 420: #25, 50-56, 90
output:
25, 50, 51, 52, 53, 54, 55, 56, 90
Here are the rules for telling me my problem numbers:
The assignment always starts with pg. (number): #
, feel free to discard it.
Each group of problems is separated by a comma, and different patterns mean different things.
A single number (4, 6, 7438, 698236
) just means that one problem is in the assignment.
Two numbers with a dash between them means those two numbers and all integers between. For example, 1-6
would become 1, 2, 3, 4, 5, 6
If two numbers have a dash between them, then there's a word, there is a special rule for the numbers.
If the word is evens
, then all even numbers between the two are included (1-6 evens -> 2, 4, 6
).
If the word is odds
, then all odd numbers between the two are included (1-6 odds -> 1, 3, 5
).
If the word is 3s
, then all numbers where n mod 3 = 0
between the two are included (1-6 3s -> 3, 6
);
Test Examples: (inputs then outputs)
pg. 1: #1, 2, 3
1, 2, 3
pg. 82: #76, 84-87, 91, 94-100 evens, 103-112 3s
76, 84, 85, 86, 87, 91, 94, 96, 98, 100, 103, 106, 109, 112
pg. 9001: #9000-9002 odds
9001
This is code-golf, so your score is the number of bytes.