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.
def merge_the_tools(string, k):
for i in range(len(string)):
if i % k == 0:
stry=""
for j in range(k):
if string[j+i] not in stry:
stry = stry + string[j+i]
print(stry)
if name == 'main':
string, k = input(), int(input())
merge_the_tools(string, k)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Merge the Tools!
You are viewing a single comment's thread. Return to all comments →
This is the best and simplest solution:
def merge_the_tools(string, k): for i in range(len(string)): if i % k == 0: stry="" for j in range(k): if string[j+i] not in stry: stry = stry + string[j+i] print(stry)
if name == 'main': string, k = input(), int(input()) merge_the_tools(string, k)