In this challenge you will write a program that takes two newline-separated strings, s1 (the first line) and s2 (the second line), as input (STDIN or closest). You can assume that the length of s1 will always be smaller than 30 and bigger than the length of s2. The program should then output each step in the levenshtein distance from s1 to s2.
To clarify what each step in the levenshtein distance means, the program will print n strings, where n is the levenshtein distance between s1 and s2, and the levenshtein distance between two adjacent strings will always be one. The order doesn't matter. The output should be newline-separated and not include s1, only the in-betweens and s2. The program should also run in under one minute on a modern computer.
Examples:
Input:
Programming
Codegolf
Output:
rogramming
Cogramming
Coramming
Coamming
Codmming
Codeming
Codeging
Codegong
Codegolg
Codegolf
Input:
Questions
Answers
Output:
uestions
Aestions
Anstions
Ansions
Answons
Answens
Answers
Input:
Offline
Online
Output:
Ofline
Online
Input:
Saturday
Sunday
Output:
Sturday
Surday
Sunday
Here is a link to a python script that prints out the distance and the steps.
Additional rules:
- No use of the internet
- Standard loopholes apply
This is code-golf so keep you code short; shortest code wins!
s1(newline)s2
, however, having looked over the question again, I am wondering if instead you intended for the program to select s1 and s2 based on the length of 2 inputed strings, coming in either order, would you mind clarifying this point? That is, do we assume the input is s1 followed by s2, or do we select s1 and s2 based on the length of the two inputs? \$\endgroup\$