{"id":"ccd872b4-a487-4f7e-a39f-b37c8e0a795c","name":"Print Encodings","description":"1. You are given a string str of digits. (will never start with a 0)\r\n2. You are required to encode the str as per following rules\r\n 1 -> a\r\n 2 -> b\r\n 3 -> c\r\n ..\r\n 25 -> y\r\n 26 -> z\r\n3. Complete the body of printEncodings function - without changing signature - to calculate and print all encodings of str.\r\nUse the input-output below to get more understanding on what is required\r\n123 -> abc, aw, lc\r\n993 -> iic\r\n013 -> Invalid input. A string starting with 0 will not be passed.\r\n103 -> jc\r\n303 -> No output possible. But such a string maybe passed. In this case print nothing.\r\n\r\nNote -> The online judge can't force you to write the function recursively but that is what the spirit of question is. Write recursive and not iterative logic. The purpose of the question is to aid learning recursion and not test you.","inputFormat":"A string str","outputFormat":"Permutations of str in order hinted by Sample output","constraints":"0 &lt;= str.length &lt;= 10","sampleCode":{"cpp":{"code":"#include <iostream>\r\n#include<string>\r\nusing namespace std;\r\n\r\nvoid printEncoding(string str, string asf){\r\n // write your code here\r\n \r\n}\r\n\r\nint main(){\r\n string str;\r\n cin>>str;\r\n printEncoding(str,\"\");\r\n \r\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args) throws Exception {\r\n\r\n }\r\n\r\n public static void printEncodings(String str) {\r\n \r\n }\r\n\r\n}"},"python":{"code":"def main:"}},"points":10,"difficulty":"easy","sampleInput":"655196","sampleOutput":"feeaif\r\nfeesf","questionVideo":"https://www.youtube.com/embed/jUo0Qis4FKU","hints":[],"associated":[{"id":"38a26659-eac5-4a2f-8175-31477461dd17","name":"(Print Encodings)Where answer has been created ?","slug":"print-encodings-where-answer-has-been-created","type":4},{"id":"91ac753d-0d00-4c62-bb9e-a0b833f24959","name":"(Print Encodings)What is the correct syntax to find Sub String of any String ?","slug":"print-encodings-what-is-the-correct-syntax-to-find-sub-string-of-any-string","type":4},{"id":"ab9fa8b8-8109-42fc-add4-91caf507420c","name":"(Print Encodings) What is the default limit of recursive calls in java ?","slug":"print-encodings-what-is-the-default-limit-of-recursive-calls-in-java","type":4},{"id":"b9ede652-af33-4498-a33f-8484c8620b27","name":"(Print Encodings) In which recursive direction answer is created ?","slug":"print-encodings-in-which-recursive-direction-answer-is-created","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":"d341a7c9-1269-409c-b851-0bb512289544","name":"Recursion And Backtracking For Beginners","slug":"recursion-and-backtracking-for-beginners","type":0},{"id":"d8960ab6-d8d3-4048-9dc7-a8a1e3925db5","name":"Print Encodings","slug":"print-encodings","type":1}],"next":{"id":"0015462c-5978-41d4-8f93-e47d8494272f","name":"Print Encodings","type":3,"slug":"print-encodings"},"prev":{"id":"a1dc5243-d15c-4cf2-b512-13dfcdfa92ae","name":"Print Permutations","type":3,"slug":"print-permutations"}}}

Print Encodings

1. You are given a string str of digits. (will never start with a 0) 2. You are required to encode the str as per following rules 1 -> a 2 -> b 3 -> c .. 25 -> y 26 -> z 3. Complete the body of printEncodings function - without changing signature - to calculate and print all encodings of str. Use the input-output below to get more understanding on what is required 123 -> abc, aw, lc 993 -> iic 013 -> Invalid input. A string starting with 0 will not be passed. 103 -> jc 303 -> No output possible. But such a string maybe passed. In this case print nothing. Note -> The online judge can't force you to write the function recursively but that is what the spirit of question is. Write recursive and not iterative logic. The purpose of the question is to aid learning recursion and not test you.

{"id":"ccd872b4-a487-4f7e-a39f-b37c8e0a795c","name":"Print Encodings","description":"1. You are given a string str of digits. (will never start with a 0)\r\n2. You are required to encode the str as per following rules\r\n 1 -> a\r\n 2 -> b\r\n 3 -> c\r\n ..\r\n 25 -> y\r\n 26 -> z\r\n3. Complete the body of printEncodings function - without changing signature - to calculate and print all encodings of str.\r\nUse the input-output below to get more understanding on what is required\r\n123 -> abc, aw, lc\r\n993 -> iic\r\n013 -> Invalid input. A string starting with 0 will not be passed.\r\n103 -> jc\r\n303 -> No output possible. But such a string maybe passed. In this case print nothing.\r\n\r\nNote -> The online judge can't force you to write the function recursively but that is what the spirit of question is. Write recursive and not iterative logic. The purpose of the question is to aid learning recursion and not test you.","inputFormat":"A string str","outputFormat":"Permutations of str in order hinted by Sample output","constraints":"0 &lt;= str.length &lt;= 10","sampleCode":{"cpp":{"code":"#include <iostream>\r\n#include<string>\r\nusing namespace std;\r\n\r\nvoid printEncoding(string str, string asf){\r\n // write your code here\r\n \r\n}\r\n\r\nint main(){\r\n string str;\r\n cin>>str;\r\n printEncoding(str,\"\");\r\n \r\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args) throws Exception {\r\n\r\n }\r\n\r\n public static void printEncodings(String str) {\r\n \r\n }\r\n\r\n}"},"python":{"code":"def main:"}},"points":10,"difficulty":"easy","sampleInput":"655196","sampleOutput":"feeaif\r\nfeesf","questionVideo":"https://www.youtube.com/embed/jUo0Qis4FKU","hints":[],"associated":[{"id":"38a26659-eac5-4a2f-8175-31477461dd17","name":"(Print Encodings)Where answer has been created ?","slug":"print-encodings-where-answer-has-been-created","type":4},{"id":"91ac753d-0d00-4c62-bb9e-a0b833f24959","name":"(Print Encodings)What is the correct syntax to find Sub String of any String ?","slug":"print-encodings-what-is-the-correct-syntax-to-find-sub-string-of-any-string","type":4},{"id":"ab9fa8b8-8109-42fc-add4-91caf507420c","name":"(Print Encodings) What is the default limit of recursive calls in java ?","slug":"print-encodings-what-is-the-default-limit-of-recursive-calls-in-java","type":4},{"id":"b9ede652-af33-4498-a33f-8484c8620b27","name":"(Print Encodings) In which recursive direction answer is created ?","slug":"print-encodings-in-which-recursive-direction-answer-is-created","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":"d341a7c9-1269-409c-b851-0bb512289544","name":"Recursion And Backtracking For Beginners","slug":"recursion-and-backtracking-for-beginners","type":0},{"id":"d8960ab6-d8d3-4048-9dc7-a8a1e3925db5","name":"Print Encodings","slug":"print-encodings","type":1}],"next":{"id":"0015462c-5978-41d4-8f93-e47d8494272f","name":"Print Encodings","type":3,"slug":"print-encodings"},"prev":{"id":"a1dc5243-d15c-4cf2-b512-13dfcdfa92ae","name":"Print Permutations","type":3,"slug":"print-permutations"}}}
plane

Editor


Loading...

Print Encodings

easy

1. You are given a string str of digits. (will never start with a 0) 2. You are required to encode the str as per following rules 1 -> a 2 -> b 3 -> c .. 25 -> y 26 -> z 3. Complete the body of printEncodings function - without changing signature - to calculate and print all encodings of str. Use the input-output below to get more understanding on what is required 123 -> abc, aw, lc 993 -> iic 013 -> Invalid input. A string starting with 0 will not be passed. 103 -> jc 303 -> No output possible. But such a string maybe passed. In this case print nothing. Note -> The online judge can't force you to write the function recursively but that is what the spirit of question is. Write recursive and not iterative logic. The purpose of the question is to aid learning recursion and not test you.

Constraints

0 <= str.length <= 10

Format

Input

A string str

Output

Permutations of str in order hinted by Sample output

Example

Sample Input

655196

Sample Output

feeaif feesf

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode