Data Structures and Algorithms Discussion Board
February 22, 2012, 09:31:14 PM *
Welcome, Guest. Please login or register.
Login with username, password and session length
News: Looking for a reliable webhosting provider? Read HostGator review to find 7 arguments in support of HostGator.
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Cipher message c++ program  (Read 379 times)
darkknight
Newbie
*

Rating: 0
Offline Offline

Posts: 1


« on: December 14, 2011, 06:40:33 AM »

may someone helps me writing this program :


Cipher Message

It is known that messages are encoded using the following method:
•    delete all spaces and punctuation marks.
•    replace all successive identical letters by one such letter.
•    insert two identical letters at an arbitrary place many times.
I have to restore a message as it was after the second step. For that, remove from the message all pairs of identical letters inserted at the third step. (max length is 1000 characters). The secret message consists of alphabetical characters only (upper case or lower case), may be separated by space, and is terminated by the dot (.) character. Note that you need to eliminate spaces when you process the input. The output is the restored message.
Below are two examples:
NO.   Sample Input                Sample Output
1   xxabduuUddyy llllzzlazz.           abdula
2   wwstdaadierfFlitzzz .               stierlitz
3      abbbaab ?                           a
Logged
Pages: [1]
  Print  
 
Jump to: