fork download
  1. import re
  2.  
  3. String = ''.join('%s\x08%s' % (c, c) for c in 'hello')
  4. String += ' '
  5. String += ''.join('%s\x08_' % c for c in 'world!')
  6.  
  7. print('Input:', String)
  8.  
  9. String = re.sub(r'(.)\x08(\1|_)', r'\1', String)
  10.  
  11. print('Output:', String)
Success #stdin #stdout 0.02s 9668KB
stdin
Standard input is empty
stdout
Input: hheelllloo w_o_r_l_d_!_
Output: hello world!