If the given arithmetic expression is: “2*3+5/6*3+15”, then the output will be 23.5.
1. The arithmetic expression consists of positive integers, +, -, *, and / (no parentheses). 2. The given input will always be a valid arithmetic expression. 3. There will be at least one integer in the given arithmetic equation.
The first line of the input contains an integer T denoting the number of test cases. The first line of each test case contains one integer N, as described in the problem statement. The second line of each test case contains one string of length N, representing a valid arithmetic expression.
For each test case, print a single line containing a single integer representing the result of the given arithmetic equation. The output for each test case will be printed in a separate line. Your answer will be considered correct if its absolute or relative error doesn’t exceed 10 ^ (-6).
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 100 1 <= Length of the given string, N <= 30 It is guaranteed that the string will only be consisting of positive integers, +, -, * and / (no parentheses). 0 < positive integers <= 15 Time Limit: 1 sec.
Ninja and Numbers
Longest Palindromic Substring
Next Greater Element II