Dart: transform a list into a number of occurrences list but only the neigbors together
10:12 01 Apr 2022

I saw examples on how to do kind of similar stuff but never exactly what I want, I'm wondering how to do it properly so if you can give me an hint I would be really happy ! :)

["a","a","b","a","c","c","b","b","b","d","a"] =====> [2,1,1,2,3,1,1]

flutter dart