{"id":"447b2cc0-deb0-4dfa-97f8-445015ab5787","name":"Words - K Length Words - 4","description":"1. You are given a word (may have one character repeat more than once).\r\n2. You are given an integer k.\r\n3. You are required to generate and print all k length words by using chars of the word.\r\n\r\nNote -> Use the code snippet and follow the algorithm discussed in question video. The judge can't force you but the intention is to teach a concept. Play in spirit of the question.","inputFormat":"Input is managed for you","outputFormat":"Check the sample ouput and question video. ","constraints":"0 < str.length() < 15\r\n0 < k <= str.length()","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n \r\n\r\n public static void main(String[] args) throws Exception {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n String str = br.readLine();\r\n int k = Integer.parseInt(br.readLine());\r\n\r\n \r\n }\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"aaabb\r\n3","sampleOutput":"aaa\r\naab\r\naba\r\nabb\r\nbaa\r\nbab\r\nbba","questionVideo":"https://www.youtube.com/embed/TPi2XUXn9TA","hints":[],"associated":[],"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":"082986ae-d618-4a59-9ab3-6d79056679a4","name":"Recursion and Backtracking For Intermediate","slug":"recursion-and-backtracking-for-intermediate-330","type":0},{"id":"dcad9d9e-9cb3-48b9-a072-21255497804c","name":"Words - K Length Words - 4","slug":"words-k-length-words-4","type":1}],"next":{"id":"80ee7f83-1e20-4427-b78e-529e0ac4cc89","name":"Words - K Length Words - 4 MCQ","type":0,"slug":"words-k-length-words-4-mcq"},"prev":{"id":"c9edf3f7-dcf3-466c-923f-c01ee92a1e7e","name":"Words - K Length Words - 3 MCQ","type":0,"slug":"words-k-length-words-3-mcq"}}}

Words - K Length Words - 4

1. You are given a word (may have one character repeat more than once). 2. You are given an integer k. 3. You are required to generate and print all k length words by using chars of the word. Note -> Use the code snippet and follow the algorithm discussed in question video. The judge can't force you but the intention is to teach a concept. Play in spirit of the question.

{"id":"447b2cc0-deb0-4dfa-97f8-445015ab5787","name":"Words - K Length Words - 4","description":"1. You are given a word (may have one character repeat more than once).\r\n2. You are given an integer k.\r\n3. You are required to generate and print all k length words by using chars of the word.\r\n\r\nNote -> Use the code snippet and follow the algorithm discussed in question video. The judge can't force you but the intention is to teach a concept. Play in spirit of the question.","inputFormat":"Input is managed for you","outputFormat":"Check the sample ouput and question video. ","constraints":"0 < str.length() < 15\r\n0 < k <= str.length()","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n \r\n\r\n public static void main(String[] args) throws Exception {\r\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n String str = br.readLine();\r\n int k = Integer.parseInt(br.readLine());\r\n\r\n \r\n }\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"aaabb\r\n3","sampleOutput":"aaa\r\naab\r\naba\r\nabb\r\nbaa\r\nbab\r\nbba","questionVideo":"https://www.youtube.com/embed/TPi2XUXn9TA","hints":[],"associated":[],"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":"082986ae-d618-4a59-9ab3-6d79056679a4","name":"Recursion and Backtracking For Intermediate","slug":"recursion-and-backtracking-for-intermediate-330","type":0},{"id":"dcad9d9e-9cb3-48b9-a072-21255497804c","name":"Words - K Length Words - 4","slug":"words-k-length-words-4","type":1}],"next":{"id":"80ee7f83-1e20-4427-b78e-529e0ac4cc89","name":"Words - K Length Words - 4 MCQ","type":0,"slug":"words-k-length-words-4-mcq"},"prev":{"id":"c9edf3f7-dcf3-466c-923f-c01ee92a1e7e","name":"Words - K Length Words - 3 MCQ","type":0,"slug":"words-k-length-words-3-mcq"}}}
plane

Editor


Loading...

Words - K Length Words - 4

easy

1. You are given a word (may have one character repeat more than once). 2. You are given an integer k. 3. You are required to generate and print all k length words by using chars of the word. Note -> Use the code snippet and follow the algorithm discussed in question video. The judge can't force you but the intention is to teach a concept. Play in spirit of the question.

Constraints

0 < str.length() < 15 0 < k <= str.length()

Format

Input

Input is managed for you

Output

Check the sample ouput and question video.

Example

Sample Input

aaabb 3

Sample Output

aaa aab aba abb baa bab bba

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode