## Interview Question

**Country:**United States

I wrote the code in Python. Works for all inputs and edge cases.

```
#Input:
#inputString = awaglk
#num = 4
#Output:
#[awag]
def take_input():
s1 = raw_input("Please Enter the String :")
k = raw_input("Please enter the number :")
k = int(k)
if k <= 0 or k > 26 :
while k <= 0 or k > 26 :
k = raw_input("Please enter the number :")
k = int(k)
final = check(s1,k)
return final
def check(s1,k):
len1 = len(s1)
list1 = []
if k > len1:
return list1
for i in range (0,len1-k+1):
temp = ''
for j in range (i, i+k):
temp = temp + s1[j]
list1. append(temp)
final = []
for items in list1:
dict1 = {}
for i in range(0,k):
if items[i] in dict1:
dict1[items[i]] += 1
else:
dict1[items[i]] = 0
sum = 0
for values in dict1.values():
sum = sum + values
if sum == 1:
final.append(items)
return final
final = take_input()
print final
```

Python. The code works fine with all inputs and edge cases.

- Anonymous February 12, 2018