title: Remainder 7 Large Numbers
signature: remainder7LargeNumbers(num) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(num, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(num), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          "K", 
          6)
      }");
  
      print("TEST-1...${driver(
          "850076", 
          3)
      }");
  
      print("TEST-2...${driver(
          "00111", 
          6)
      }");
  
      print("TEST-3...${driver(
          "X", 
          5)
      }");
  
      print("TEST-4...${driver(
          "1", 
          1)
      }");
  
      print("TEST-5...${driver(
          "10010001100", 
          1)
      }");
  
      print("TEST-6...${driver(
          " pgPeLz", 
          0)
      }");
  
      print("TEST-7...${driver(
          "53212456821275", 
          3)
      }");
  
      print("TEST-8...${driver(
          "101", 
          3)
      }");
  
      print("TEST-9...${driver(
          "V", 
          3)
      }");
  
      return 0;
  }
source_py: def remainder_7_large_numbers(num):
      series = [1, 3, 2, (- 1), (- 3), (- 2)]
      series_index = 0
      result = 0
      for i in range((len(num) - 1), (- 1), (- 1)):
          digit = (ord(num[i]) - 48)
          result += (digit * series[series_index])
          series_index = ((series_index + 1) % 6)
          result %= 7
      if (result < 0):
          result = ((result + 7) % 7)
      return result
source_cpp: int remainder_7_large_numbers(string num) {
    int series [ ] = {
      1, 3, 2, - 1, - 3, - 2 };
      int series_index = 0;
      int result = 0;
      for ( int i = num . size ( ) - 1;
      i >= 0;
      i -- ) {
        int digit = num [ i ] - '0';
        result += digit * series [ series_index ];
        series_index = ( series_index + 1 ) % 6;
        result %= 7;
      }
      if ( result < 0 ) result = ( result + 7 ) % 7;
      return result;
    }