title: Maximum Number Characters Two Character String
signature: def maximumNumberCharactersTwoCharacterString(str: String) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Int , expected: Int): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(str: String, expected: Int): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(str),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        "cI", 
        -1    
      )}")   
  
  
      println(s"TEST-1...${driver(
        "76478", 
        2    
      )}")   
  
  
      println(s"TEST-2...${driver(
        "1", 
        -1    
      )}")   
  
  
      println(s"TEST-3...${driver(
        "tr", 
        -1    
      )}")   
  
  
      println(s"TEST-4...${driver(
        "10", 
        -1    
      )}")   
  
  
      println(s"TEST-5...${driver(
        "01", 
        -1    
      )}")   
  
  
      println(s"TEST-6...${driver(
        "Rmhzp", 
        -1    
      )}")   
  
  
      println(s"TEST-7...${driver(
        "5784080133917", 
        10    
      )}")   
  
  
      println(s"TEST-8...${driver(
        "1100", 
        0    
      )}")   
  
  
      println(s"TEST-9...${driver(
        "OK", 
        -1    
      )}")   
  
  }
  
source_py: def maximum_number_characters_two_character_string(str):
      n = len(str)
      res = (- 1)
      for i in range(0, (n - 1)):
          for j in range((i + 1), n):
              if (str[i] == str[j]):
                  res = max(res, abs(((j - i) - 1)))
      return res
source_cpp: int maximum_number_characters_two_character_string(string & str) {
    int n = str . length ( );
    int res = - 1;
    for ( int i = 0;
    i < n - 1;
    i ++ ) for ( int j = i + 1;
    j < n;
    j ++ ) if ( str [ i ] == str [ j ] ) res = max ( res, abs ( j - i - 1 ) );
    return res;
  }