This is a programming challenge that was posted to /r/dailyprogrammer. It received over 200 comments and solutions in languages such as Python, Java, C#, Haskell, Scheme, and DOS assembly.
>Change a sentence to another sentence, letter by letter. >The sentences will always have the same length.
Sample input: wood book Sample output: wood bood book
Sample input: a fall to the floor braking the door in Sample output: a fall to the floor b fall to the floor brfall to the floor braall to the floor brakll to the floor brakil to the floor brakin to the floor brakingto the floor braking o the floor braking t the floor braking ththe floor braking thehe floor braking the e floor braking the d floor braking the dofloor braking the dooloor braking the dooroor braking the door or braking the door ir braking the door in
You should be able to solve this, or this crow will stab you.
Camden Allen
string a, b; if len(a) = len(b) then print a; for i = 0 to (len(a)-1) do if a[i] = b[i] continue; a[i] = b[i]; print a; next; end if
I don't care whether it's some existing language, but I'd have a good laugh if the language I wrote exists.
William Walker
pls dont stab s1, s2 = input(), input() for i, (a, b) in enumerate(zip(s1, s2)): if a != b: print(s2[:i] + s1[i:]) print(s2)
Charles Sanders
replace a n c = take n a ++ c ++ drop n (tail a) unique x = foldr (\a y -> if a == head y then y else a:y) [last x] x tran from to = from:[replace (tran from to !! x) x [to !! x] | x