Division Alphabets

Description:

Write c++ program to check the given string is palindrome or not with necessary exception handling functions. Input : Alphabets only allowed Refer sample input and output: Input 1: MADAM Output 1: MADAM is Palindrome Input 2: SRM Output 2: SRM is not Palindrome Test Case 1 Input (stdin) MADAM Expected Output MADAM is Palindrome Test Case 2 Input (stdin) SRM Expected Output SRM is not Palindrome

Program :

#include <iostream>

#include<string.h>

using namespace std;

int main()

{

char a[50],b[50];

  int i,j=0;

  cin>>a;

  for(i=strlen(a)-1;i>=-1;i--)

  {

  b[j]=a[i];

    j++;

  }

  try

  {

  if(strcmp(a,b)==0)

    cout<<a<<" is Palindrome";

    else

      throw a;

  }

  catch(char x[50])

  {

  cout<<a<<" is not Palindrome";

  }

return 0;

}