Smart keypad-1 stack overflow

My code is showing stack overflow error for input string of length more than 6
https://online.codingblocks.com/app/player/27489/content/24820/4740/code-challenge