title: Remainder 7 Large Numbers
signature: function remainder_7_large_numbers(num)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(num, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(num), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver("K", 6);
      @printf("TEST-0...%s\n",result);
      
      result = driver("850076", 3);
      @printf("TEST-1...%s\n",result);
      
      result = driver("00111", 6);
      @printf("TEST-2...%s\n",result);
      
      result = driver("X", 5);
      @printf("TEST-3...%s\n",result);
      
      result = driver("1", 1);
      @printf("TEST-4...%s\n",result);
      
      result = driver("10010001100", 1);
      @printf("TEST-5...%s\n",result);
      
      result = driver(" pgPeLz", 0);
      @printf("TEST-6...%s\n",result);
      
      result = driver("53212456821275", 3);
      @printf("TEST-7...%s\n",result);
      
      result = driver("101", 3);
      @printf("TEST-8...%s\n",result);
      
      result = driver("V", 3);
      @printf("TEST-9...%s\n",result);
      
  end
  
  main()
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;
    }