import sys
N, K = [ int(i) for i in input().split() ]
words = []
for i in range(N):
words.append(input())
sub_word = []
for index, word in enumerate(words):
sub_word.append([])
sub_word[index].append(0)
for i in range(len(word) - K + 1):
sub_word[index].append(word[i:i+K])
#sub_word.append(words[word])
#print(sub_word)
for index, words in enumerate(sub_word):
#print(sub_word)
#print()
if words[0] == 0:
words[0] = 1
for i in sub_word[index+1:]:
for j in i[1:]:
if j in words[1:]:
if i[0] == words[0]:
print("No")
sys.exit(1)
elif words[0] == 1:
i[0] = 2
else:
i[0] = 1
#print(sub_word)
print("Yes")
for i in sub_word:
print(i[0])
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
22 ms |
3 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |