hey i was asking, y'know, how do i abbreviate a string.
eg--if i give>> world health organization it'll give me<< w.h.o.
Think of a FSA (Finite State Machine). Your FSA needs three states:
1) NIW: 'not in word'
2) IW: 'in word'
3) EOT: 'end of text'
Your FSA is in one of the three states always. Suppose a line of text contains
letters and spaces. At the end of the text the FSA reaches state EOT. At the
start of the text the FSA is in the NIW state.
The followong state transitions induce the following actions:
NIW --> NIW: do nothing
NIW --> IW: print the current character.
NIW --> EOT: do nothing
IW --> NIW: print a dot
IW --> IW: do nothing
IW -->EOT: print a dot
EOT --> NIW: impossible state
EOT --> IW: impossible state
EOT --> EOT: do nothing
The state transitions are computed according to the current character read.
kind regards,
Jos