title: Decimal Representation Given Binary String Divisible 10 Not
signature: pub fn decimal_representation_given_binary_string_divisible_10_not(bin: String) -> bool {
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: bool, expected: bool)->bool{
  return actual==expected
  }
  pub fn driver(bin: String, expected: bool)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(bin), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        "101000".to_string(), 
        true
      ));
      
      println!("TEST-1...{}", driver(
        "39613456759141".to_string(), 
        false
      ));
      
      println!("TEST-2...{}", driver(
        "11".to_string(), 
        false
      ));
      
      println!("TEST-3...{}", driver(
        "PoiHjo".to_string(), 
        true
      ));
      
      println!("TEST-4...{}", driver(
        "2".to_string(), 
        true
      ));
      
      println!("TEST-5...{}", driver(
        "0000101".to_string(), 
        false
      ));
      
      println!("TEST-6...{}", driver(
        "T  s dZKeDX gK".to_string(), 
        true
      ));
      
      println!("TEST-7...{}", driver(
        "3944713969".to_string(), 
        false
      ));
      
      println!("TEST-8...{}", driver(
        "1000".to_string(), 
        false
      ));
      
      println!("TEST-9...{}", driver(
        "ifYUgdpmt".to_string(), 
        true
      ));
      
  }
source_py: def decimal_representation_given_binary_string_divisible_10_not(bin):
      n = len(bin)
      if (bin[(n - 1)] == '1'):
          return False
      sum = 0
      i = (n - 2)
      while (i >= 0):
          if (bin[i] == '1'):
              posFromRight = ((n - i) - 1)
              if ((posFromRight % 4) == 1):
                  sum = (sum + 2)
              elif ((posFromRight % 4) == 2):
                  sum = (sum + 4)
              elif ((posFromRight % 4) == 3):
                  sum = (sum + 8)
              elif ((posFromRight % 4) == 0):
                  sum = (sum + 6)
          i = (i - 1)
      if ((sum % 10) == 0):
          return True
      return False
source_cpp: bool decimal_representation_given_binary_string_divisible_10_not(string bin) {
    int n = bin . size ( );
    if ( bin [ n - 1 ] == '1' ) return false;
    int sum = 0;
    for ( int i = n - 2;
    i >= 0;
    i -- ) {
      if ( bin [ i ] == '1' ) {
        int posFromRight = n - i - 1;
        if ( posFromRight % 4 == 1 ) sum = sum + 2;
        else if ( posFromRight % 4 == 2 ) sum = sum + 4;
        else if ( posFromRight % 4 == 3 ) sum = sum + 8;
        else if ( posFromRight % 4 == 0 ) sum = sum + 6;
      }
    }
    if ( sum % 10 == 0 ) return true;
    return false;
  }