{"id":"d8a5f005-4b59-40ce-b390-d2d19d816da7","name":"Words - K Length Words - 3","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\nbaa\r\nabb\r\nbab\r\nbba","questionVideo":"","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":"b5f384a8-3c50-4ff0-ad35-d533b2863b88","name":"Words - K Length Words - 3","slug":"words-k-length-words-3","type":1}],"next":{"id":"c9edf3f7-dcf3-466c-923f-c01ee92a1e7e","name":"Words - K Length Words - 3 MCQ","type":0,"slug":"words-k-length-words-3-mcq"},"prev":{"id":"63970140-c40b-453f-9db5-bb97e97678a8","name":"Words - K Selection - 4 MCQ","type":0,"slug":"words-k-selection-4-mcq"}}}

Words - K Length Words - 3

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":"d8a5f005-4b59-40ce-b390-d2d19d816da7","name":"Words - K Length Words - 3","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\nbaa\r\nabb\r\nbab\r\nbba","questionVideo":"","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":"b5f384a8-3c50-4ff0-ad35-d533b2863b88","name":"Words - K Length Words - 3","slug":"words-k-length-words-3","type":1}],"next":{"id":"c9edf3f7-dcf3-466c-923f-c01ee92a1e7e","name":"Words - K Length Words - 3 MCQ","type":0,"slug":"words-k-length-words-3-mcq"},"prev":{"id":"63970140-c40b-453f-9db5-bb97e97678a8","name":"Words - K Selection - 4 MCQ","type":0,"slug":"words-k-selection-4-mcq"}}}
plane

Editor


Loading...

Words - K Length Words - 3

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 baa abb bab bba

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode