title: Find Position Given Number Among Numbers Made 4 7
signature: function find_position_given_number_among_numbers_made_4_7(n)
test_code: using Printf
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  function validate_solution(actual, expected)
      return actual == expected
  end
  
  function driver(n, expected)
      try
  
          if validate_solution(PLACEHOLDER_FN_NAME(n), expected)
              return "PASSED";
          end
          return "FAILED";
      catch exception_obj
          return string(Base.typename(typeof(exception_obj)).wrapper);
      end
  end
  
  function main()
      
      result = driver("7", 2);
      @printf("TEST-0...%s\n",result);
      
      result = driver("305745689", 5);
      @printf("TEST-1...%s\n",result);
      
      result = driver("444", 7);
      @printf("TEST-2...%s\n",result);
      
      result = driver("4", 1);
      @printf("TEST-3...%s\n",result);
      
      result = driver("2074", 5);
      @printf("TEST-4...%s\n",result);
      
      result = driver("27", 2);
      @printf("TEST-5...%s\n",result);
      
      result = driver("447", 8);
      @printf("TEST-6...%s\n",result);
      
      result = driver("255", 0);
      @printf("TEST-7...%s\n",result);
      
      result = driver("10000111111011", 0);
      @printf("TEST-8...%s\n",result);
      
      result = driver("fAKcSDRTNz", 0);
      @printf("TEST-9...%s\n",result);
      
  end
  
  main()
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;
  }