title: Calculate Maximum Value Using Sign Two Numbers String
signature: class Solution {
  
      public Integer calculateMaximumValueUsingSignTwoNumbersString(String str) {
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;
  }
question_info.extension: java
question_info.entry_fn_name: calculateMaximumValueUsingSignTwoNumbersString
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 2176, "inputs": {"str": "pR"}}, {"idx": 1, "outputs": 368, "inputs": {"str": "9518"}}, {"idx": 2, "outputs": 1, "inputs": {"str": "1"}}, {"idx": 3, "outputs": 6272, "inputs": {"str": "3170487"}}, {"idx": 4, "outputs": 4, "inputs": {"str": "0100101010"}}, {"idx": 5, "outputs": -303, "inputs": {"str": "Z rONcUqWb"}}, {"idx": 6, "outputs": 5670, "inputs": {"str": "00419297"}}, {"idx": 7, "outputs": 0, "inputs": {"str": "00"}}, {"idx": 8, "outputs": 66, "inputs": {"str": "r"}}]
question_info.test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(String str, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(str,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution("pR", 2176);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution("9518", 368);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution("1", 1);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution("3170487", 6272);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution("0100101010", 4);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution("Z rONcUqWb", -303);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution("00419297", 5670);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution("00", 0);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution("r", 66);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(String str, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(str),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8
question_info.commands: java __FILENAME__