input: Write a python function to replace all occurrences of '?' in a given string s with lowercase English letters in such a way that the sum of the costs for all indices is minimized. The function should return the lexicographically smallest string if multiple solutions exist.
  
  
  from typing import List
  from collections import Counter
  from heapq import heapify, heapreplace
  from string import ascii_lowercase
  
  def minimize_string_value(s: str) -> str:
      """
      Given a string s where each character is either a lowercase English letter or '?', modify s by replacing '?' with lowercase English letters to minimize the string's overall cost.
  
      The cost of a string t at index i is defined as the number of characters equal to t[i] that appeared before it.
  
      For instance, for t = "aab":
      cost(0) = 0
      cost(1) = 1
      cost(2) = 0
      The value is 0 + 1 + 0 = 1.
  
      Replace '?' in s to achieve the minimum value and return the lexicographically smallest string.
  
      Examples:
      >>> s = "???"
      abc
      >>> s = "a?a?"
      abac
  
      Constraints:
      1 <= s.length <= 10^5
      s[i] is either a lowercase English letter or '?'.
      """
  
output: def minimize_string_value(s: str) -> str:
      s = list(s)
      n = len(s)
      for i in range(n):
          if s[i] == '?':
              for c in 'abc':
                  if (i > 0 and s[i - 1] == c) or (i < n - 1 and s[i + 1] == c):
                      continue
                  s[i] = c
                  break
      return ''.join(s)