It is common to shorten city names when writing, or at least in Sweden.Gteborg (Gothenburg) is often referred to as GbgUddevalla is commonly written as UaTrollhttan is often written as Thn...and a whole lot of other city names are often shortenedUddevalla could also be shortened as Uva, Uvalla, or even Udl (although I've never seen anyone actually type that, according to my rules here it would be allowed). vd however would not be allowed as the letters must appear in order, dv would be allowed as an abbreviation for Uddevalla as v comes after d.Given a list of cities (or more generally: Strings) and a search string, print the city names that can be constructed by using these abbreviation rules.Example cities (my townnames.txt file):StrmstadSkeeverbyTanumRabbalshedeHllevadsholmDingleMunkedalUddevallaLjungskileSvenshgenStenungsundStora HgaKodeYtterbyGteborgTrollhttanVnersborgVarbergStockholmSimrishamnThese are cities in Sweden, mostly in around my area. With the above list and the search string Sm the following cities are printed:[Strmstad, Stockholm, Simrishamn]Instead given the string Vbg the results are:[Vnersborg, Varberg]After looking at the review I got from my previous Haskell question I wrote the following code to accomplish this:module Main   wherenameMatch :: [Char] -> [Char] -> BoolnameMatch [] [] = TruenameMatch s [] = FalsenameMatch [] s = TruenameMatch search@(s:restSearch) (c:city)   | c == s    = nameMatch restSearch city   | otherwise = nameMatch search citymain = do  putStrLn Loading list of towns...  text <- readFile townnames.txt  putStrLn Enter search phrase:  search <- getLine  let cities = lines text  putStrLn $ show $ filter (nameMatch search) citiesAny possible improvements or suggestions welcome.
Vc as in Vancouver, or Valencia?
beginner;strings;haskell;search