Just a prediction, somebody will correct me if I am wrong!
Here is a new code
There are two white soaces before and after the first char array. Use any number of white spaces after first string, scanf() treats as if there is only one white-space.
printf("\nEnter a string:");
scanf(" %s %s",a,b);
printf("\nAccepted String is :%s %s",a,b);
What about the white space at the begining then! scanf() simply ignores it! So, entering
will accept the strings "trial" and "message". All the WS (white spaces) characters will be ignored.
I think, scanf() does not thread a WS as a charater when it is the first.