帮忙看一下,string concatenation
问题如下:
String concatenation
Write a program that will accept two strings (1 <= length <= 50) and output the sequence of the first string converting to the second string, such that each conversion only add/modify/delete one character. In case more than one such conversion sequence is possible, print the one sequence that contains the shortest steps.
Input specification:
Two strings separated by space on a single line.
Output Specification:
The sequence of conversion steps, each in a separate line.
Examples:
Input:
abcd afgd
Output:
abcd
afcd
afgd
Input:
efgh cdef
Output:
efgh
efg
ef
def
cdef
Input:
abcdefg bdf
Output:
abcdefg
bcdefg
bdefg
bdfg
bdf
希望高手提供个思路,谢谢。