Count the no of keypad codes

https://ide.codingblocks.com/s/35344

my code for https://hack.codingblocks.com/contests/c/512/356

I am unable to write a recursive func to print the count
The way i am counting in my code, it prints the count only after all the permutations of the string/codes have been formed. Please suggest a way to do it recursively.

Thanks