title: Count Of Pairs Satisfying The Given Condition
signature: func countOfPairsSatisfyingTheGivenCondition(a int, b int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(a int, b int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(a, b),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(31, 
  	91, 31)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(72, 
  	85, 72)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(23, 
  	49, 23)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(42, 
  	32, 42)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(13, 
  	7, 0)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(93, 
  	5, 0)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(33, 
  	32, 33)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(94, 
  	76, 94)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(60, 
  	60, 60)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(11, 
  	26, 11)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def count_of_pairs_satisfying_the_given_condition(a, b):
      s = str(b)
      i = 0
      while (i < len(s)):
          if (s[i] != '9'):
              break
          i += 1
      result = 0
      if (i == len(s)):
          result = (a * len(s))
      else:
          result = (a * (len(s) - 1))
      return result
source_cpp: int count_of_pairs_satisfying_the_given_condition(int a, int b) {
    string s = to_string ( b );
    int i;
    for ( i = 0;
    i < s . length ( );
    i ++ ) {
      if ( s [ i ] != '9' ) break;
    }
    int result;
    if ( i == s . length ( ) ) result = a * s . length ( );
    else result = a * ( s . length ( ) - 1 );
    return result;
  }