We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Strings
- Merge the Tools!
- Discussions
Merge the Tools!
Merge the Tools!
Sort by
recency
|
2578 Discussions
|
Please Login in order to post a comment
def merge_the_tools(string, k): mylist = [] word = "" for x in string: word +=x if len(word)==k: mylist.append(word) word = "" if word : mylist.append(word) ret_list = [] for x in mylist: temp_word = "" for y in x : if y not in temp_word: temp_word+=y ret_list.append(temp_word) for x in ret_list: print(x) if name == 'main': string, k = input(), int(input()) merge_the_tools(string, k)
Given the constraints and requirements, careful handling of indexing and character tracking is essential. cricbet 99.win