How to solve this string edit problem

Revision en2, by RNR, 2019-03-09 22:55:28

How to solve a generalization of this problem?

Given a string, remove identical consecutive letters ( not only pair as mentioned in the above question).

For example, if you have

wwwhaat --> ht
whhhaah --> w
reallazy --> rezy
whaahhhh --> w

Can someone suggest me an algorithm? For finding the minimum string at the end of this deletion?

Tags #strings, #problem solving

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English RNR 2019-03-09 22:55:28 16 Tiny change: 'ah --> w\nr' -> 'ah --> w\nwhaahhhh --> w\nr'
en1 English RNR 2019-03-09 22:40:32 447 Initial revision (published)