$ 0 0 Haskell, 41 bytesg#d=[minimum[sum[1|x<-g,x==c]|c<-w]|w<-d]Attempt This Online!-3 bytes thanks to @ovs