ch_a = "a".ord
max_candsize = 2**20

loop do
	get = gets.chomp #????¨?????????????????????????
	break if get == "#"
	
	nn = 2**get.length
	cands = Array.new(nn){ Array.new(get.length,nil) }
	g_copy = get.clone.reverse
	gl = g_copy.length
	
	for n in (0...gl) do
		c1 = g_copy[n]
		c2 = ((g_copy[n].ord)+1).chr
		for i in (0...nn).step(2**(n+1)) do
			for j in (0...2**n) do
				cands[i+j][n] = c2
			end
			for j in (2**n...2**(n+1)) do
				cands[i+j][n] = c1
			end
		end
	end
	cands.each{|c| c.reverse! }

	cands_cp = Array.new(gl, nil)
	cands_ok = Array.new
	cands_num = 0

	g_copy2 = Array.new(gl, nil)
	for i in  (0...gl) do
		g_copy2[i] = g_copy[i]
	end
	g_copy2.reverse!

	for k in (0...nn) do
		for i in  (0...gl) do
			cands_cp[i] = cands[k][i]
		end
		for i in (0..25) do
			com1 = (ch_a + i+1).chr
			com2 = (ch_a + i).chr
			for j in (0...gl) do
				if(cands[k][j] == com1)
					cands_cp[j] = com2
					break
				end
			end
		end
		if(cands_cp == g_copy2)
			cands_ok.push(cands[k])
			cands_num += 1
		end
	end
	
	cands_ok.reverse!
	
	puts cands_num
	if(cands_num <= 10)
		for i in (0...cands_num) do
			puts cands_ok[i].join
		end
	else
		for i in (0..4) do
			puts cands_ok[i].join
		end
		for i in (1..5) do
			puts cands_ok[-i].join
		end

	end
	
end