import scala.collection.mutable.Map;
def getCounts[T](list: Seq[T]): Map[T, Int] = {
  val map = Map.empty[T, Int];
  list.foreach(x => {
    if (!map.contains(x)) {
      map.put(x, 0);
    }
    map.put(x, map(x) + 1);
  });
  return map;
}