Skip to main content
1 of 5

Output shortest string containing all input strings

Given a list of words (letters only) in no particular order, output the shortest string containing every word. Output must be lowercase, except the first letter of each word is uppercase. Input can be in any case you like. When there are multiple minimal solutions, output one.

Code golf.

Sample data

cow,alligator,seal,orangutan

=> SeAlligatOrangutanCow

fish,hamster,mite,shrimp,dog,cat,termite

=> HamsTerMiteFiShrimpDogCat

cat,a,tonic,catatonic,tat,at

=> CaTATonic

be,a,very,yellow,beaver

=> BeAVerYellow