scala solution
\nobject Solution {\n  def minimumDeletions(word: String, k: Int): Int = {\n    lazy val freqs = word.groupMapReduce(identity)(_ => 1)(_ + _).values.to(List)\n 
```\nobject Solution {\n  def minimumDeletions(word: String, k: Int): Int = {\n    lazy val freqs = word.groupMapReduce(identity)(_ => 1)(_ + _).values.to(List)\n    freqs.distinct.map{f => freqs.collect{\n        case g if g<f => g\n        case g if g-f > k => g-f-k \n      }.sum\n    }.min\n  }\n}\n```
['Scala']