Given a word, print Yes if it is a palindrome, otherwise No. A palindrome is a word which reads the …
Click here to read the complete problem statement.
If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.
There are two things that I can see not being quite right:
You should not use gets. In fact, in Toph, you cannot use gets. It will result in a compilation error. To know why you shouldn’t use gets, you can read this StackOverflow answer.
This line seems odd: puts(strrev(b));. You don’t need to print the reversed string.
You said I shouldn’t use gets. So I used fgets and still get compilation error. Please check my code. Also, Reading your 2nd point seems strrev would work.
strrev is not a part of any C standard. It is however implemented by some libraries, which unfortunately, is not available as a part of GCC (what we use to compile C and C++ code).
So in these cases you will have to implement your own function for reversing string in C.
In C++ there are standard ways to do this, so you can look into that.