A palindrome is a word that reads the same backward and forw
Solution
// A Naive recursive program to find minimum number insertions
 // needed to make a string palindrome
 #include <stdio.h>
 #include <string.h>
 // retruns the length of given string.
 int len(char str[]){
    int i;
    for(i=0;str[i]!=\'\\0\';++i);
    return i;
 }
 // returns 1 if given string is palindrome, else 0.
 int checkPalindrome(char str[]){
    int l = len(str)-1;
    int i=0;
    while(i<=l){
        if(str[i]==str[l]){
            i++;
            l--;
        }
        else
            return 0;
    }
    return 1;
 }
 int toPalindrome(char str[]){
    int l = len(str);
    if(checkPalindrome(str))
        return l;
    char palin[l];        
    int ind = 0;
    while(ind<l){
        char check[l*2];
        palin[ind] = str[ind+1]; // add chars to palin
        int i,j,k=0;
        for(i=ind;i>=0;i--,k++){        // add chars to check
            check[k] = palin[i];
        }
       
        for(j=0;j<l;j++,k++){
            check[k] = str[j];
        }
        if(checkPalindrome(check)){         // find whether check is palindrome.
            return len(check);
        }
        ind++;
    }
    return 1;
 }
 // Driver program to test above functions
 int main()
 {
 //   setvbuf(stdout, NULL, _IONBF, 0);
     char str[] = \"baaa\";
     printf(\"%d\ \",toPalindrome(str));
     return 0;
 }
/* sample output
7
*/


