i'm trying to enter a string phrase and store its last word in an Array,
if the word is palindrom then a message will showit

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.