title: Program Check Plus Perfect Number
signature: fun programCheckPlusPerfectNumber(x: Int): Boolean {
test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Boolean, expected:Boolean):Boolean{
    return actual.equals(expected)
  }
  fun driver(x: Int, expected:Boolean):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(x), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(371, true)
      println("TEST-0...${result}")
      
      result = driver(9474, true)
      println("TEST-1...${result}")
      
      result = driver(85, false)
      println("TEST-2...${result}")
      
      result = driver(35, false)
      println("TEST-3...${result}")
      
      result = driver(54, false)
      println("TEST-4...${result}")
      
      result = driver(17, false)
      println("TEST-5...${result}")
      
      result = driver(97, false)
      println("TEST-6...${result}")
      
      result = driver(63, false)
      println("TEST-7...${result}")
      
      result = driver(12, false)
      println("TEST-8...${result}")
      
      result = driver(43, false)
      println("TEST-9...${result}")
      
          
  }
  
  main()
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 );
  }