RosettaCodeData/Task/Substring/Haskell/substring-1.hs
2023-07-01 13:44:08 -04:00

3 lines
114 B
Haskell

t45 n c s | null sub = []
| otherwise = take n. head $ sub
where sub = filter(isPrefixOf c) $ tails s