title: Count Strings Adjacent Characters Difference One
signature: countStringsAdjacentCharactersDifferenceOne :: Integer -> Integer
  countStringsAdjacentCharactersDifferenceOne 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 :: Integer -> 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) (1468) )
  
      printf "TEST-1...%s\n" (driver (47) (1134264891541288) )
  
      printf "TEST-2...%s\n" (driver (56) (544505079089235836) )
  
      printf "TEST-3...%s\n" (driver (22) (41103600) )
  
source_py: def count_strings_adjacent_characters_difference_one(n):
      dp = [[0 for j in range(27)] for i in range((n + 1))]
      for i in range(0, 26):
          dp[1][i] = 1
      for i in range(2, (n + 1)):
          for j in range(0, 26):
              if (j == 0):
                  dp[i][j] = dp[(i - 1)][(j + 1)]
              else:
                  dp[i][j] = (dp[(i - 1)][(j - 1)] + dp[(i - 1)][(j + 1)])
      sum = 0
      for i in range(0, 26):
          sum = (sum + dp[n][i])
      return sum
source_cpp: int count_strings_adjacent_characters_difference_one(int n) {
    long int dp [ n + 1 ] [ 27 ];
    memset ( dp, 0, sizeof ( dp ) );
    for ( int i = 0;
    i <= 25;
    i ++ ) dp [ 1 ] [ i ] = 1;
    for ( int i = 2;
    i <= n;
    i ++ ) {
      for ( int j = 0;
      j <= 25;
      j ++ ) if ( j == 0 ) dp [ i ] [ j ] = dp [ i - 1 ] [ j + 1 ];
      else dp [ i ] [ j ] = ( dp [ i - 1 ] [ j - 1 ] + dp [ i - 1 ] [ j + 1 ] );
    }
    long int sum = 0;
    for ( int i = 0;
    i <= 25;
    i ++ ) sum = ( sum + dp [ n ] [ i ] );
    return sum;
  }