In English, nouns can take on two different forms depending on whether they are singular (one) or plural (anything else). For example, we would say "1 dog" but "2 dogs", "0 dogs", "57 dogs" and so forth.
In Russian, there are three categories. Instead of "1 dog, 2 dogs, 5 dogs", in Russian it would be "1 собака, 2 собаки, 5 собак".
The categories are divided according to the following logic:
- "Singular": used for 1 and any number ending in 1, except for numbers ending in 11.
- Examples: 1 собака, 21 собака, 101 собака
- "Few": used for 2, 3, and 4, and any number ending in 2, 3, or 4 except for numbers ending in 12, 13, and 14.
- Examples: 2 собаки, 3 собаки, 4 собаки, 32 собаки, 43 собаки, 104 собаки
- "Many": anything that is not considered "Singular" or "Few".
- Examples: 0 собак, 5 собак, 11 собак, 13 собак, 25 собак, 111 собак, 114 собак
The challenge
Given an integer input in the range [0, 1000], return 1 if it belongs to the "singular" category, 2 if it belongs to the "few" category, and 5 if it belongs to the "many" category.
Your program may be a function or it can use STDIN. You may print to STDOUT or return a value from the function
This is a code golf challenge, so the solution with the fewest number of bytes wins.
1,2, and5in particular? Also, why can't I use exit codes? \$\endgroup\$