Let's take the string "AAAABCCCBBBBBBAAACC" : I would like to build a kind of Iterable such as this Vector [('A', 4), ('B',1), ('C', 3), ('B', 6), ('A',3), ('C', 2)] (which list letters occurences in order). What is the simplest functionnal approch for doing that in Scala ?
All I've found is to use a for clause (or a foreach call) and to rely upon some vars : nothing better. Is there a single method that I can call on my collection (or a method chain) ?
Indeed, after having written several codes, it seems that doing this is a recurring pattern to me.