I am looking to find an algorithm that would let me while starting at the right most of an input string containing blanks in between, merge input symbols so that there are no blanks.
For example, 0 _ 0 _ 0 _ into 000.
I am aware of methods shown in the form of state diagrams to merge input symbols when there are no blanks in between, but I would like to know of good a way to do it when this is not the case.
More example of what I mean by removing input symbols in between (assuming an alphabet of 1,0 for now):
- Example input: 10011 output: 101
- Example input: 11101101 output: 1110