Parallel merge duplicate characters

Hi All,

My question is to merge duplicate string: say I have a string like " a b a a a c c a", i need to merge continuous chars to output " a b a 3 c 2 a", any ideas?

More complex example is " a b a a a a a c c c “, we need to output " a b a 5 c 3”. I will post my idea and implementation later.

Many thanks.

Take a look at thrust’s unique, unique_by_key, and reduce_by_key algorithms [1].