title: Find Position Given Number Among Numbers Made 4 7
signature: findPositionGivenNumberAmongNumbersMade47 :: String -> Integer
  findPositionGivenNumberAmongNumbersMade47 n = 
test_code: import Text.Printf
  import Control.Exception (catch, SomeException)
  import Data.Typeable
  import qualified Data.List as List
  import qualified Data.Map as Map
  import qualified Data.Set as Set
  
  -- SOLUTION CODE
  -- ============================================
  
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  validateSolution :: Integer -> Integer -> Bool
  validateSolution actual expected = do
      actual == expected
  
  
  driver :: String -> Integer -> String
  driver n expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME n) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver ("7") (2) )
  
      printf "TEST-1...%s\n" (driver ("305745689") (5) )
  
      printf "TEST-2...%s\n" (driver ("444") (7) )
  
      printf "TEST-3...%s\n" (driver ("4") (1) )
  
      printf "TEST-4...%s\n" (driver ("2074") (5) )
  
      printf "TEST-5...%s\n" (driver ("27") (2) )
  
      printf "TEST-6...%s\n" (driver ("447") (8) )
  
      printf "TEST-7...%s\n" (driver ("255") (0) )
  
      printf "TEST-8...%s\n" (driver ("10000111111011") (0) )
  
      printf "TEST-9...%s\n" (driver ("fAKcSDRTNz") (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;
  }