message: Update reformat-phone-number.py
diff: @@ -15,8 +15,10 @@ class Solution(object):
  number[src_len] = c
  src_len += 1
  dst_len = src_len + (src_len-1)//3
  - if dst_len > len(number): # make sure the size of result buffer is enough
  + if dst_len > len(number): # resize the buffer to expected final size
  number.extend([0]*(dst_len-len(number)))
  + while dst_len < len(number):
  + number.pop()
  curr = dst_len-1
  for l, i in enumerate(reversed(xrange(src_len)), (3-src_len%3)%3):
  if l and l%3 == 0: # group by 3 digits
  @@ -26,6 +28,4 @@ class Solution(object):
  curr -= 1
  if dst_len >= 3 and number[dst_len-2] == '-': # adjust for the 4 digits case
  number[dst_len-3], number[dst_len-2] = number[dst_len-2], number[dst_len-3]
  - if dst_len < len(number): # resize the result buffer
  - number = number[:dst_len]
  return "".join(number)
  