Skip to content

Instantly share code, notes, and snippets.

@jhgaylor
Forked from anonymous/gist:3009224
Created June 28, 2012 05:08
Show Gist options
  • Save jhgaylor/3009231 to your computer and use it in GitHub Desktop.
Save jhgaylor/3009231 to your computer and use it in GitHub Desktop.
#include <stack>
#include <queue>
#include <cstdlib>
#include <string>
using namespace std;
string toLower(string strr)
{
char str[100];
string ret;
strcpy(str,strr.c_str());
int differ = 'A'-'a';
char ch;
int ii = strlen(str);
for (int i=0; i <ii;i++)
{
strncpy(&ch,str+i,1);
if (ch>='A' && ch<='Z')
{
ch = ch-differ;
memcpy(str+i,&ch,1);
}
}
ret = str;
return ret;
}
/*
bool isPalindrome(const std::string& s)
{
s = toLower(s);
stack<char> stack;
queue<char> queue;
int string_index = 0
for (i = 0; i < s.length(); i++)
{
queue.push(s[string index]);
stack.push(s[string index]);
string_index++;
}
for (i = 0; i< s.length(); i++)
{
if ( queue.pop() != stack.pop());
{
return False;
}
}
return True;
}
*/
void main()
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment