Perl weekly challenge 96
This week we had contrasting challenges.
Challenge 1 - Reverse Words
Take a string of words {with arbitrary white space around the words} and reverse the order of the words in the string and removing any redundant white space.
This is a classic example of a 1-liner....
join q( ), reverse grep {$_} split m{\s+}, $_[0];
Challenge 2 - Edit Distance
I will provide 2 solutions here... one a less optimal solution which at the same time gives us a nice way of rendering the alignment - and then an more efficient "boiling down" of the first algorithm to just return the distance...
I'm just going to add "Another day job challenge!"
To be able to make "nicer" output - rather than just keeping track of the edit distance of substrings - we will actually keep the alignment of the two words as a string of "operations" whether they be Indels or SNPs.

