title: Program Check Plus Perfect Number
signature: class Solution {
  
      public Boolean programCheckPlusPerfectNumber(Integer x) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(Integer x, Boolean expected){
          try{
              Driver driver = new Driver();
              if (driver.run(x,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution(371, true);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution(9474, true);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution(85, false);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution(35, false);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution(54, false);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution(17, false);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution(97, false);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution(63, false);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution(12, false);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution(43, false);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(Integer x, Boolean expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(x),expected);
      }
      
      public boolean validateSolution(Boolean actual, Boolean expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
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 );
  }