A simplistic version of English numeral calculator
Task
Write a program that takes a string as input and outputs the result of the expression.
Rules
The input string will be worded and not numeral.
There will be no parentheses.
Order of calculation will be divide,multiply,subtract then add.
For same operations, the calculations must be done from left to right.
All input numbers will be integers from -999 to 999 (both inclusive)
Output will be an integer of any range.
Division will always be perfectly divisible and zero will never be a denominator.
Restriction of case for input is optional. You don't have to check for the validity of the input.
Number Format
0 to 20 -> zero,one,two...nineteen,twenty
21 to 99 -> twenty one,twenty two.....ninety eight,ninety nine
100 to 999 -> one hundred, one hundred one, one hundred two...one hundred ten....two hundred fifty....nine hundred ninety eight,nine hundred ninety nine
For negative numbers: Add minus
to its positive equivalent
Operation Format
Addition: one plus two
Subtraction: one minus two
Multiplication: one time two #Note that for one on the left of multiplication, it is one time and not times.
two times one hundred
Division: forty divided by two
Examples:
o/p <- input
20 four times five
35 twenty plus fifteen
70 fifty plus five times four
-90 minus one time ninety
25 twenty one minus minus four
45 ninety divided by two
700 one time seven hundred
555 one hundred eleven times two plus three hundred thirty three
99 one hundred plus minus one
45 forty five plus two hundred times zero
4 four
-3 three minus three minus three
This is code-golf so shortest code wins
one times two
. Is usingtime
normal? \$\endgroup\$