{"id":"d854d4f0-ef5a-4c6f-9b45-8da24ecb805a","name":"Postfix Evaluation And Conversions","description":"1. You are given a postfix expression.\r\n2. You are required to evaluate it and print it's value.\r\n3. You are required to convert it to infix and print it.\r\n4. You are required to convert it to prefix and print it.\r\n\r\nNote -> Use brackets in infix expression for indicating precedence. Check sample input output for more details.","inputFormat":"Input is managed for you","outputFormat":"value, a number\r\ninfix\r\nprefix","constraints":"1. Expression is a valid postfix expression\r\n2. The only operators used are +, -, *, /\r\n3. All operands are single digit numbers.","sampleCode":{"cpp":{"code":"#include <bits/stdc++.h>\nusing namespace std;\n\nint main(){\n string exp;\n getline(cin, exp);\n\n // write yout code here\n \n return 0;\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main{\r\n \r\n\r\npublic static void main(String[] args) throws Exception {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n String exp = br.readLine();\r\n\r\n // code\r\n }\r\n}"},"python":{"code":"def infix(exp):\n # write your code here\n\n\nexp = list(input())\n\ninfix(exp)"}},"points":10,"difficulty":"easy","sampleInput":"264*8/+3-","sampleOutput":"2\r\n((2+((6*4)/8))-3)\r\n-+2/*6483","questionVideo":"https://www.youtube.com/embed/qusuduyQm8k","hints":[],"associated":[{"id":"2cd5e461-8f42-4c07-9880-4d5e6ff79590","name":"What is postfix Expression of (a + b)?(Q-Postfix Evaluation and Conversion)","slug":"what-is-postfix-expression-of-a-b-q-postfix-evaluation-and-conversion","type":4},{"id":"a1b14d71-d139-412e-8bca-f169f2313113","name":"Which of these operators have the highest order of precedence?(Q- Postfix Evaluation and Conversion)","slug":"which-of-these-operators-have-the-highest-order-of-precedence-q-postfix-evaluation-and-conversion","type":4},{"id":"ba404487-6cb6-4fb6-9ec5-399e9e3952d3","name":"What is the other name for a postfix expression?(Q- Postfix Evaluation and Conversion)","slug":"what-is-the-other-name-for-a-postfix-expression-q-postfix-evaluation-and-conversion","type":4},{"id":"e4958bcb-faac-4883-8838-9a4d94b34ffa","name":"What is prefix Expression of (a + b)?(Q- Postfix Evaluation and Conversion)","slug":"what-is-prefix-expression-of-a-b-q-postfix-evaluation-and-conversion","type":4},{"id":"f78019da-28de-4db9-b4d8-b207543f3e1b","name":"What is infix Expression of ab+?(Q- Postfix Evluation and Conversion)","slug":"what-is-infix-expression-of-ab-q-postfix-evluation-and-conversion","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"9847c2b3-e3ad-4b1c-97d1-00206b1be68d","name":"Stacks And Queues For Beginners","slug":"stacks-and-queues-for-beginners","type":0},{"id":"c04de0b3-b879-4910-bb02-a44f22efed96","name":"Postfix Evaluation And Conversions","slug":"postfix-evaluation-and-conversions","type":1}],"next":{"id":"c8b0e6f5-da08-4b03-ac45-071a629810eb","name":"Postfix Evaluation and Conversion","type":3,"slug":"postfix-evaluation-and-conversion"},"prev":{"id":"0e46d6d0-c03c-46fa-873e-693f2916724b","name":"Infix Conversions","type":3,"slug":"infix-conversions"}}}

Postfix Evaluation And Conversions

1. You are given a postfix expression. 2. You are required to evaluate it and print it's value. 3. You are required to convert it to infix and print it. 4. You are required to convert it to prefix and print it. Note -> Use brackets in infix expression for indicating precedence. Check sample input output for more details.

{"id":"d854d4f0-ef5a-4c6f-9b45-8da24ecb805a","name":"Postfix Evaluation And Conversions","description":"1. You are given a postfix expression.\r\n2. You are required to evaluate it and print it's value.\r\n3. You are required to convert it to infix and print it.\r\n4. You are required to convert it to prefix and print it.\r\n\r\nNote -> Use brackets in infix expression for indicating precedence. Check sample input output for more details.","inputFormat":"Input is managed for you","outputFormat":"value, a number\r\ninfix\r\nprefix","constraints":"1. Expression is a valid postfix expression\r\n2. The only operators used are +, -, *, /\r\n3. All operands are single digit numbers.","sampleCode":{"cpp":{"code":"#include <bits/stdc++.h>\nusing namespace std;\n\nint main(){\n string exp;\n getline(cin, exp);\n\n // write yout code here\n \n return 0;\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main{\r\n \r\n\r\npublic static void main(String[] args) throws Exception {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n String exp = br.readLine();\r\n\r\n // code\r\n }\r\n}"},"python":{"code":"def infix(exp):\n # write your code here\n\n\nexp = list(input())\n\ninfix(exp)"}},"points":10,"difficulty":"easy","sampleInput":"264*8/+3-","sampleOutput":"2\r\n((2+((6*4)/8))-3)\r\n-+2/*6483","questionVideo":"https://www.youtube.com/embed/qusuduyQm8k","hints":[],"associated":[{"id":"2cd5e461-8f42-4c07-9880-4d5e6ff79590","name":"What is postfix Expression of (a + b)?(Q-Postfix Evaluation and Conversion)","slug":"what-is-postfix-expression-of-a-b-q-postfix-evaluation-and-conversion","type":4},{"id":"a1b14d71-d139-412e-8bca-f169f2313113","name":"Which of these operators have the highest order of precedence?(Q- Postfix Evaluation and Conversion)","slug":"which-of-these-operators-have-the-highest-order-of-precedence-q-postfix-evaluation-and-conversion","type":4},{"id":"ba404487-6cb6-4fb6-9ec5-399e9e3952d3","name":"What is the other name for a postfix expression?(Q- Postfix Evaluation and Conversion)","slug":"what-is-the-other-name-for-a-postfix-expression-q-postfix-evaluation-and-conversion","type":4},{"id":"e4958bcb-faac-4883-8838-9a4d94b34ffa","name":"What is prefix Expression of (a + b)?(Q- Postfix Evaluation and Conversion)","slug":"what-is-prefix-expression-of-a-b-q-postfix-evaluation-and-conversion","type":4},{"id":"f78019da-28de-4db9-b4d8-b207543f3e1b","name":"What is infix Expression of ab+?(Q- Postfix Evluation and Conversion)","slug":"what-is-infix-expression-of-ab-q-postfix-evluation-and-conversion","type":4}],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"9847c2b3-e3ad-4b1c-97d1-00206b1be68d","name":"Stacks And Queues For Beginners","slug":"stacks-and-queues-for-beginners","type":0},{"id":"c04de0b3-b879-4910-bb02-a44f22efed96","name":"Postfix Evaluation And Conversions","slug":"postfix-evaluation-and-conversions","type":1}],"next":{"id":"c8b0e6f5-da08-4b03-ac45-071a629810eb","name":"Postfix Evaluation and Conversion","type":3,"slug":"postfix-evaluation-and-conversion"},"prev":{"id":"0e46d6d0-c03c-46fa-873e-693f2916724b","name":"Infix Conversions","type":3,"slug":"infix-conversions"}}}
plane

Editor


Loading...

Postfix Evaluation And Conversions

easy

1. You are given a postfix expression. 2. You are required to evaluate it and print it's value. 3. You are required to convert it to infix and print it. 4. You are required to convert it to prefix and print it. Note -> Use brackets in infix expression for indicating precedence. Check sample input output for more details.

Constraints

1. Expression is a valid postfix expression 2. The only operators used are +, -, *, / 3. All operands are single digit numbers.

Format

Input

Input is managed for you

Output

value, a number infix prefix

Example

Sample Input

264*8/+3-

Sample Output

2 ((2+((6*4)/8))-3) -+2/*6483

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode