-1
\$\begingroup\$

Task

Your boss is on another crusade for 'efficiency.' He wants to encourage the use of numbers with fewer syllables, so that they're easier to discuss in meetings. If you want to take some time off work, you're boss would prefer you take 9 days instead of 7. You're boss would prefer a credit card expense of $99,502 over $77,601

Input

You can chose your input format for the numbers, if you want to take in 7/9 or seven/nine it's completely up to you

Output

Output whichever number has the least syllables. CATCH! You must output the answer in the same format you chose for the input. So if your program takes in 7/9 as input, it must output 9. And if your program takes in binary numbers as the input, such as 0000111/0001001, then it must output the answer as 0001001

Examples

I used howmanysyllables.com to find the amount of syllables in each number:

Input Syllables Output
7\9 2 vs 1 9
ninety nine\one hundred and five 3 vs 5 ninety nine
0111101\1100011 3 vs 3 0111101 1100011
seventy seven thousand six hundred and one\ninety one thousand five hundred and two 12 vs 10 ninety one thousand five hundred and two
10011111111011\10111111111111 10 vs 11 10011111111011
13\15 2 vs 2 13 15

Additional rules

  1. Numbers must include and where appropriate. For example, 105 should be calculated as one hundred and five instead of one hundred five. I know some people might include and more than others when pronouncing numbers, so this is open to change in future depending on feedback!
  2. If both numbers have the same number of syllables, output both numbers in the format you took them in
  3. The input will only ever be a positive integer

Numbers/Syllables

1,2,3,4,5,6,8,9,10,12 = 1 syllables

7,13,14,15,16,18,19,20 = 2 syllables

11,17,21,22,23,24,25,26 = 3 syllables

27 = 4 syllables

This is , so the shortest program wins!

\$\endgroup\$
6

1 Answer 1

1
\$\begingroup\$

sed -E, 120 bytes

h;s/n//g;s/[ls]e/##/g;s/ve/-/g;s/[aeiou]+/#/g;s/y/#/g;s/[^#,]//g;G;s/^(#*)#+,\1\n.*,//;s/^(#*),\1#+.(.*),.*/\2/;s/.*\n//

Try it online!

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.