input: def max_partitions_after_operations(s: str, k: int) -> int:
      """
      You are given a string s and an integer k.
  
      First, you are allowed to change at most one index in s to another lowercase English letter.
  
      After that, do the following partitioning operation until s is empty:
  
      Choose the longest prefix of s containing at most k distinct characters.
      Delete the prefix from s and increase the number of partitions by one. The remaining characters (if any) in s maintain their initial order.
      Return an integer denoting the maximum number of resulting partitions after the operations by optimally choosing at most one index to change.
  
      Examples:
      >>> s = "accca", k = 2
      3
      >>> s = "aabaab", k = 3
      1
      >>> s = "xxyz", k = 1
      4
  
      Constraints:
      1 <= s.length <= 10^4
      s consists only of lowercase English letters.
      1 <= k <= 26
      """
  
output: 
      max_partitions = 0
      n = len(s)
      
      def count_distinct(substring):
          return len(set(substring))
      
      for i in range(n):
          for c in range(26):
              new_char = chr(ord('a') + c)
              new_s = s[:i] + new_char + s[i+1:]
              partitions = 0
              while new_s:
                  distinct_count = 0
                  for j in range(len(new_s)):
                      if new_s[j] not in new_s[:j]:
                          distinct_count += 1
                      if distinct_count > k:
                          break
                  partitions += 1
                  new_s = new_s[j:]
              max_partitions = max(max_partitions, partitions)
      
      return max_partitions
  