#include <iostream>
#include <cstring>

using namespace std;

bool isSymmetrical(char *pString) {

  if(!pString)
    return true;

  int nLength = strlen(pString);
  char *pStart = pString;
  char *pEnd = pString+nLength-1;
  while(pStart<pEnd) {
    if(*pStart!=*pEnd)
      return false;

    pStart++;
    pEnd--;
  }

  return true;
}

bool isSymmetrical(char *pStart, char *pEnd) {
  if(pStart==NULL || pEnd==NULL || pStart>pEnd)
    return false;

  while(pStart<pEnd) {
    if(*pStart!=*pEnd)
      return false;

    pStart++;
    pEnd--;
  }

  return true;
}

int getLongestSymmetrical(char *pString) {
  if(pString==NULL)
    return 0;

  int currLength = 1;

  int nLength = strlen(pString);
  char *pFirst = pString;
  while(pFirst < &pString[nLength-1]) {
    char *pLast = pFirst+1;
    while(pLast < &pString[nLength-1]) {
      if(isSymmetrical(pFirst,pLast)) {
	int newLength = pLast-pFirst+1;
	if(newLength>currLength)
	  currLength = newLength;
      }

      pLast++;
    }

    pFirst++;
  }

  return currLength;
}


int main(int argc, char **argv) {

  char str[] = "goog";

  if(isSymmetrical(str))
    cout << "Yes: " << str << endl;
  else
    cout << "No: " << str << endl;

  return 0;
}
