input: from typing import List
  
  
  def evaluate_expression(expr: str) -> str:
      """Takes an expression consisting of variable terms separated by '+', 
      each term having the format 'var count'. The function combines repeated values 
      and displays the new expression.
      For example, 'x + x + y + y + y' should be simplified to 'x^2 + y^3'.
      >>> evaluate_expression('x + x + y + y + y')
      'x^2 + y^3'
      >>> evaluate_expression('a + b + c + d + d')
      'a^1 + b^1 + c^1 + d^2'
      """
  
output:     terms = expr.split(' + ')
      term_count = {}
      for term in terms:
          if term in term_count:
              term_count[term] += 1
          else:
              term_count[term] = 1
      
      result = []
      for term, count in term_count.items():
          if count > 1:
              result.append(f"{term}^{count}")
          else:
              result.append(f"{term}^1")
      
      return ' + '.join(result)