Baby Name

Description:

Jessie is searching for better name for her new born boy baby. She expects the suggestions from her kith and kin. She accepts the name only if its matched with its reverse form. Help her to check the name satisfy the condition or not by automating the process using Character Array. Input: Name Output: Good Choice - if the name satisfy the condition Bad Choice - if the name does not satisfy the condition Test Case 1 Input (stdin) vikram Expected Output Bad Choice Test Case 2 Input (stdin) arora Expected Output Good Choice

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>=0;i--)

{

  b[j]=a[i];

j++;

}

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

    cout<<"Good Choice";

  else

    cout<<"Bad Choice";

return 0;

}