If we have a List of strings, create a new List where each repeated element has a suffix of the number of times it was repeated, with order preserved.
Example: List("a","a","a","b","b","c","C") should become List("a","a.1","a.2","b","b.1","c","C")
I could loop through each element, update a map that counts the number of times each element is seen, then add each to a List, but there must be more "Scala way" of doing this.
You could write something like this with plain scala using recursive traversal and pattern matching. It's not just scala but a functional way.
Or even more elegant with fs2