2 Years
Discussion Span
Last Post by iamthwee

Please post some code and ask a more specific question with a problem you are having with YOUR code.


mahabelg you can do following but do give a try first:

try to split and store the read input into an array or list, i believe you want to get that via console to give a hint here is some example:

var input = Console.ReadLine();
string [] arr = new string[] { };
if(input.Length > 1) {
    for(int ind=0; ind < input.Length-1; ind++) {
        arr[ind] = input.split(' ')[ind];

next when you do have the inputs in your array meaning at this point you could have something like:

arr[0] contains "inputstring1"
arr[1] contains "inputstring2"

you can start to check for palindromes write a separate method why won't you!! check after reversing the individual input strings and if their reversed version is equal to the original version the one which you extracted in the array as described just above you can confirm whether read string was a palindrome or otherwise!!

Happy coding !! :)

#include <iostream>
#include <string>

using namespace std;

int main()

    string phrase;

    if (phrase == "palindrome")
        cout << "showit";

        cout <<"nope";

    return 0;


Couldn't resist.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.