// Quickie C++ - worked the first time. 
// Easier than the whiteboard question I got in
// my MSFT interview.
//
// Oh yeah, this version ignores spaces just
// for grins.
//
#include <cassert>

template <
   typename RandIt, 
   typename CharT, 
   CharT space
   >
bool IsPalindrome(RandIt start, RandIt end)
{
 end--;
 do
 {
  while (space == *start)
   start++;
  while (space == *end)
   end--;
  if (end < start)
   return false;
  if (*start != *end)
   return false;
  start++;
  end--;
  
 } while (start<end);
 return true;
}

bool IsPalindrome(const char* str)
{
 assert(str);
 return IsPalindrome<const char*,char,' '>(
   str,
   str+strlen(str)
   );
}