The problem is in your method for fast string input i.e., str_input, modify it for newline charater.
The newline character is the reason for such weird behavior.
t=input(); with str_input(s); is giving you runtime error because during reading the integer t, the new line (’\n’) is read and skipped. So in next str_input() method while (c!=32 && c!=10), the check for c != 10 is skipping the next (second ) string input.
hi thnx for pointing it out… i have optimized my str_input() function to check for leading spaces or new lines before string input but what i found the problem was actually with me, not terminating the string “exp” with ‘\0’
which was causing the runtime error.