input: Write a python function that verifies whether the characters of a specified string can be reordered such that no two adjacent characters are the same.
  assert rearrange_string("aab") == ('aba')
  assert rearrange_string("aabb") == ('abab')
  assert rearrange_string("abccdd") == ('cdabcd')
output: def rearrange_string(s):
      from heapq import heappush, heappop
      from collections import Counter
      
      counter = Counter(s)
      max_heap = []
      for char, freq in counter.items():
          heappush(max_heap, (-freq, char))
      
      prev_char, prev_freq = None, 0
      result = []
      
      while max_heap:
          freq, char = heappop(max_heap)
          result.append(char)
          
          if prev_freq < 0:
              heappush(max_heap, (prev_freq, prev_char))
          
          prev_char, prev_freq = char, freq + 1
      
      return ''.join(result) if len(result) == len(s) else ''