start="a"
n=int(input())
ans=[]

def dfs(string,n):
    if len(string)==n:
        print(string)
    else:
        s=string
        for i in range(97,max([ord(j)for j in string])+2):
            dfs(string+chr(i),n)
        

dfs(start,n)
print(len(ans))
for i in ans:
    print(i)