haskell - Compare two strings and display characters in both strings -
i need function displays chars, on 2 given strings same volution.
example:
checkchars “aabbcf” “aabce” => “ac”
what got:
import data.list import data.map checkchars b = nub $ intersect b this intersects 2 lists, after need code counts chars , filters it. possible?
no idea if want, assume want output letters occur same number of times. it:
checkchars b = concatmap (take 1) $ intersect (group (sort a)) (group (sort b))
Comments
Post a Comment