title: Find Position Given Number Among Numbers Made 4 7
signature: pub fn find_position_given_number_among_numbers_made_4_7(n: 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(n: String, expected: i32)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        "7".to_string(), 
        2
      ));
      
      println!("TEST-1...{}", driver(
        "305745689".to_string(), 
        5
      ));
      
      println!("TEST-2...{}", driver(
        "444".to_string(), 
        7
      ));
      
      println!("TEST-3...{}", driver(
        "4".to_string(), 
        1
      ));
      
      println!("TEST-4...{}", driver(
        "2074".to_string(), 
        5
      ));
      
      println!("TEST-5...{}", driver(
        "27".to_string(), 
        2
      ));
      
      println!("TEST-6...{}", driver(
        "447".to_string(), 
        8
      ));
      
      println!("TEST-7...{}", driver(
        "255".to_string(), 
        0
      ));
      
      println!("TEST-8...{}", driver(
        "10000111111011".to_string(), 
        0
      ));
      
      println!("TEST-9...{}", driver(
        "fAKcSDRTNz".to_string(), 
        0
      ));
      
  }
source_py: def find_position_given_number_among_numbers_made_4_7(n):
      i = 0
      j = len(n)
      pos = 0
      while (i < j):
          if (n[i] == '4'):
              pos = ((pos * 2) + 1)
          if (n[i] == '7'):
              pos = ((pos * 2) + 2)
          i = (i + 1)
      return pos
source_cpp: int find_position_given_number_among_numbers_made_4_7(string n) {
    int i = 0, pos = 0;
    while ( n [ i ] != '\0' ) {
      switch ( n [ i ] ) {
        case '4' : pos = pos * 2 + 1;
        break;
        case '7' : pos = pos * 2 + 2;
        break;
      }
      i ++;
    }
    return pos;
  }