title: Program Check Plus Perfect Number
signature: pub fn program_check_plus_perfect_number(x: i32) -> 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(x: i32, expected: bool)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(x), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        371, 
        true
      ));
      
      println!("TEST-1...{}", driver(
        9474, 
        true
      ));
      
      println!("TEST-2...{}", driver(
        85, 
        false
      ));
      
      println!("TEST-3...{}", driver(
        35, 
        false
      ));
      
      println!("TEST-4...{}", driver(
        54, 
        false
      ));
      
      println!("TEST-5...{}", driver(
        17, 
        false
      ));
      
      println!("TEST-6...{}", driver(
        97, 
        false
      ));
      
      println!("TEST-7...{}", driver(
        63, 
        false
      ));
      
      println!("TEST-8...{}", driver(
        12, 
        false
      ));
      
      println!("TEST-9...{}", driver(
        43, 
        false
      ));
      
  }
source_py: def program_check_plus_perfect_number(x):
      temp = x
      n = 0
      while (x != 0):
          x = (x // 10)
          n = (n + 1)
      x = temp
      sm = 0
      while (x != 0):
          sm = (sm + int(math.pow((x % 10), n)))
          x = (x // 10)
      return (sm == temp)
source_cpp: bool program_check_plus_perfect_number(int x) {
    int temp = x;
    int n = 0;
    while ( x != 0 ) {
      x /= 10;
      n ++;
    }
    x = temp;
    int sum = 0;
    while ( x != 0 ) {
      sum += pow ( x % 10, n );
      x /= 10;
    }
    return ( sum == temp );
  }