title: Calculate Maximum Value Using Sign Two Numbers String
signature: pub fn calculate_maximum_value_using_sign_two_numbers_string(str: String) -> i32 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: i32, expected: i32)->bool{
  return actual==expected
  }
  pub fn driver(str: String, expected: i32)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(str), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        "pR".to_string(), 
        2176
      ));
      
      println!("TEST-1...{}", driver(
        "9518".to_string(), 
        368
      ));
      
      println!("TEST-2...{}", driver(
        "1".to_string(), 
        1
      ));
      
      println!("TEST-3...{}", driver(
        "3170487".to_string(), 
        6272
      ));
      
      println!("TEST-4...{}", driver(
        "0100101010".to_string(), 
        4
      ));
      
      println!("TEST-5...{}", driver(
        "Z rONcUqWb".to_string(), 
        -303
      ));
      
      println!("TEST-6...{}", driver(
        "00419297".to_string(), 
        5670
      ));
      
      println!("TEST-7...{}", driver(
        "00".to_string(), 
        0
      ));
      
      println!("TEST-8...{}", driver(
        "r".to_string(), 
        66
      ));
      
  }
source_py: def calculate_maximum_value_using_sign_two_numbers_string(str):
      res = (ord(str[0]) - 48)
      for i in range(1, len(str)):
          if ((str[i] == '0') or (str[i] == '1') or (res < 2)):
              res += (ord(str[i]) - 48)
          else:
              res *= (ord(str[i]) - 48)
      return res
source_cpp: int calculate_maximum_value_using_sign_two_numbers_string(string str) {
    int res = str [ 0 ] - '0';
    for ( int i = 1;
    i < str . length ( );
    i ++ ) {
      if ( str [ i ] == '0' || str [ i ] == '1' || res < 2 ) res += ( str [ i ] - '0' );
      else res *= ( str [ i ] - '0' );
    }
    return res;
  }