Question
We know that operator is important. Because of that, we need to have a good understanding in it. Every operator will have precedence. To test
We know that operator is important. Because of that, we need to have a good understanding in it. Every operator will have precedence. To test your understanding about that, you will be given several operators and you need to output it from the operator with highest precedence until operator with the lowest precedence.
Format Input: There will be T test cases. In each test case, there will be 3 different operators separated by a blank space. You may assume that the operator will be one of these : "&" (bitwise AND), "^" (bitwise XOR), "%" (remainder) , "|" (bitwise OR), "!" (logical NOT).
Format Output: In each test case, you need to output number of case followed by operator from the operator with highest precedence until operator with the lowest precedence.
Constraints: 1 <= T <= 100
Sample Input | Sample Output
3
& ^ % | Case #1: % & ^
& ^ ! | Case #2: ! & ^
& ^ ! | Case #3: ! & ^
Note: The precedence of the operators (from the highest to the lowest) are "!" (logical NOT), "%" (remainder), "&" (bitwise AND), "^" (bitwise XOR), , "|" (bitwise OR).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started