{"id":"49906e62-abdc-42c0-9308-269e29063f89","name":"Prefix Evaluation And Conversions","description":"1. You are given a prefix 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 postfix 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 prefix 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 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\nexp = list(input())\n\ninfix(exp"}},"points":10,"difficulty":"easy","sampleInput":"-+2/*6483","sampleOutput":"2\r\n((2+((6*4)/8))-3)\r\n264*8/+3-","questionVideo":"https://www.youtube.com/embed/YmdDsEZ9paw","hints":[],"associated":[{"id":"08184223-7631-4867-b0b6-321f57577bd4","name":"What is the other name for a prefix expression?(Q- Prefix Evaluation and Conversion)","slug":"what-is-the-other-name-for-a-prefix-expression-q-prefix-evaluation-and-conversion","type":4},{"id":"2a6ca64a-9ca3-4a56-a321-3be1fef1db10","name":"What is postfix Expression of (a + b)?(Q-Prefix Evaluation and Conversion)","slug":"what-is-postfix-expression-of-a-b-q-prefix-evaluation-and-conversion","type":4},{"id":"58faea55-a802-4aeb-b030-70094b37d922","name":"How many Stack are required in this question?(Q-Prefix Evaluation and Conversion)","slug":"how-many-stack-are-required-in-this-question-q-prefix-evaluation-and-conversion","type":4},{"id":"924d7d83-3aa0-4540-9952-d9f9e199156c","name":"What will be the data type of the StackS used in this question?(Q-Prefix Evaluation and Conversion)","slug":"what-will-be-the-data-type-of-the-stacks-used-in-this-question-q-prefix-evaluation-and-conversion","type":4},{"id":"bfa41159-b2c1-45d7-9435-65a15886eb9f","name":"Which of the following Data Structure is used in this problem?(Q-Prefix Evaluation and Conversion)","slug":"which-of-the-following-data-structure-is-used-in-this-problem-q-prefix-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":"22cdb983-09d7-4337-9283-72913ba21dc0","name":"Prefix Evaluation And Conversions","slug":"prefix-evaluation-and-conversions","type":1}],"next":{"id":"b476ee16-c9a1-4132-821e-2edc363c029a","name":"Prefix Evaluation and Conversion","type":3,"slug":"prefix-evaluation-and-conversion"},"prev":{"id":"c8b0e6f5-da08-4b03-ac45-071a629810eb","name":"Postfix Evaluation and Conversion","type":3,"slug":"postfix-evaluation-and-conversion"}}}

Prefix Evaluation And Conversions

1. You are given a prefix 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 postfix and print it. Note -> Use brackets in infix expression for indicating precedence. Check sample input output for more details.

{"id":"49906e62-abdc-42c0-9308-269e29063f89","name":"Prefix Evaluation And Conversions","description":"1. You are given a prefix 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 postfix 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 prefix 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 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\nexp = list(input())\n\ninfix(exp"}},"points":10,"difficulty":"easy","sampleInput":"-+2/*6483","sampleOutput":"2\r\n((2+((6*4)/8))-3)\r\n264*8/+3-","questionVideo":"https://www.youtube.com/embed/YmdDsEZ9paw","hints":[],"associated":[{"id":"08184223-7631-4867-b0b6-321f57577bd4","name":"What is the other name for a prefix expression?(Q- Prefix Evaluation and Conversion)","slug":"what-is-the-other-name-for-a-prefix-expression-q-prefix-evaluation-and-conversion","type":4},{"id":"2a6ca64a-9ca3-4a56-a321-3be1fef1db10","name":"What is postfix Expression of (a + b)?(Q-Prefix Evaluation and Conversion)","slug":"what-is-postfix-expression-of-a-b-q-prefix-evaluation-and-conversion","type":4},{"id":"58faea55-a802-4aeb-b030-70094b37d922","name":"How many Stack are required in this question?(Q-Prefix Evaluation and Conversion)","slug":"how-many-stack-are-required-in-this-question-q-prefix-evaluation-and-conversion","type":4},{"id":"924d7d83-3aa0-4540-9952-d9f9e199156c","name":"What will be the data type of the StackS used in this question?(Q-Prefix Evaluation and Conversion)","slug":"what-will-be-the-data-type-of-the-stacks-used-in-this-question-q-prefix-evaluation-and-conversion","type":4},{"id":"bfa41159-b2c1-45d7-9435-65a15886eb9f","name":"Which of the following Data Structure is used in this problem?(Q-Prefix Evaluation and Conversion)","slug":"which-of-the-following-data-structure-is-used-in-this-problem-q-prefix-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":"22cdb983-09d7-4337-9283-72913ba21dc0","name":"Prefix Evaluation And Conversions","slug":"prefix-evaluation-and-conversions","type":1}],"next":{"id":"b476ee16-c9a1-4132-821e-2edc363c029a","name":"Prefix Evaluation and Conversion","type":3,"slug":"prefix-evaluation-and-conversion"},"prev":{"id":"c8b0e6f5-da08-4b03-ac45-071a629810eb","name":"Postfix Evaluation and Conversion","type":3,"slug":"postfix-evaluation-and-conversion"}}}
plane

Editor


Loading...

Prefix Evaluation And Conversions

easy

1. You are given a prefix 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 postfix 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 prefix 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

-+2/*6483

Sample Output

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

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode