Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import re
  2.  
  3. def process_decode(data):
  4. # print(re.split(r'(\D)',data))
  5. temp = re.split( r'(\D)', data )
  6. result = ''
  7. x = 1 # start from index 1
  8. while x < len( temp ) - 1:
  9.  
  10. time = int( temp[x + 1] )
  11. # y from 0 to time = do temp[x] times.
  12. for y in range( time ):
  13. result += temp[x]
  14. x = x + 2
  15. return result
  16.  
  17.  
  18. size = (int)( input( "How many input data?? :" ) )
  19.  
  20. n = 0
  21. while n < size:
  22. data = str( input( "decoded string: " ) )
  23.  
  24. print('Case ' + str( n + 1 ) + ': ' + process_decode( data ))
  25. n = n + 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement