def denumify(string, pattern):
 out = []
 for c in pattern:
  if (c == 'X'):
   out.append(string[0])
   string = string[1:]
  else:
   out.append(c)
 return ''.join(out)

def denumify ( string , pattern ) : out = [ ] for c in pattern : if ( c == 'X' ) : out . append ( string [ 0 ] ) string = string [ 1 : ] else : out . append ( c ) return '' . join ( out )
formats string according to pattern .