To find if a given string is a rotation of a pallindrome

i am a computer science student and i tried making a code to find if a given string is a rotaion of a pallindrome or not but i get a compile time error in my isStringPallindrome function.can somebody plz suggest a solution,thnx in advance for the help
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <stdio.h>
#include <string.h>
#include<string>
#include <cstring>
#define MAX 20
#define TRUE 1
#define FALSE 0
#define bool int

using namespace std;

bool isStringPallindrome(string str)
{
    int l=0;
    int h=strlen(str)-1;
    while(l<h)
    {
        if(str[l++]!=str[h--])
            return FALSE;
    }
    return TRUE;
}

bool isRotationStringPallindrome(string str)
{
    int i,len;
    if(isStringPallindrome(str))
        return TRUE;
    len=strlen(str);
    for(i=0;i<len-1;i++)
    {
        string str1=str.substr(i+1,l-1-i);
        string str2=str.substr(i,i+1);
        if(isStringPallindrome(str1.append(str2)))
            return TRUE;
    }
    return FALSE;
}
int main()
{
    string str;
    printf("Enter string : " );
    gets(str);
    if(isRotationStringPallindrome(str))
        printf("\npallindrome");
    else
        printf("\nnot a pallindrome");
}
29: error: cannot convert ‘std::string’ to ‘const char*’ for argument ‘1’ to ‘size_t strlen(const char*)’

You can use the length() (or size()) member function to get the length of a std::string.
http://www.cplusplus.com/reference/string/string/length/
Topic archived. No new replies allowed.