input: Write a function to determine if the letters of a specified string can be reorganized such that no two identical characters are adjacent.  
  assert rearrange_string("aab") == "aba"  
  assert rearrange_string("aabb") == "abab"  
  assert rearrange_string("abccdd") == "cdabcd"
output: def rearrange_string(s):
      from collections import Counter
      import heapq
      
      count = Counter(s)
      max_heap = [(-freq, char) for char, freq in count.items()]
      heapq.heapify(max_heap)
      
      prev_char, prev_freq = None, 0
      result = []
      
      while max_heap or prev_freq:
          if prev_freq:
              if not max_heap:
                  return ""
              heapq.heappush(max_heap, (prev_freq, prev_char))
  
          freq, char = heapq.heappop(max_heap)
          result.append(char)
          prev_char, prev_freq = char, freq + 1
      
      return "".join(result)