Message from C, C++ discussions

December 2019

— User Dimas has 1/2 warnings; be careful!
The latest warn was because:
This is cxx group, yt link

— 

Hey guys, if anyone.. Please help me out with this.... My task is to find the minimum number of characters at the beginning of a string, so that it becomes pallindrome... I am going with the recursive method.
When I am calling the isPallindrome() function inside the min_insert(), it says isPallindrome is not declared in the scope...
How do I resolve it????

#include<bits/stdc++.h>
using namespace std;
bool ispallindrome(string str,int start,int len)
{
if(start==len)
return true;
else if(str[start]!=str[len])
return false;
else
return ispallindrome(str,start+1,len-1);
}
//start—>starting index of string, len—>length of the string, count—>counter to count the number of characters inserted
int min_insert(string str,int start,int len,int count)
{
if(isPallindrome(str,start,len))
return count;
if(str[start]!=str[len])
{
str.insert(str.begin()+start,str[len]);
count++;
}
else
return min_insert(str,start+1,len-1,count);
}
int main()
{
string str;
cout<<"Enter the string : ";
cin>>str;
cout<<min_insert(str,0,str.length(),0); //min_insert(string, starting_index, length_of_the_string, counter)
return 0;
}

— Give some eg:- like input .. and output or share the whole programme

— Hello and please format your code

— Or use pastebin

— Wait...

— Do I have to download the pastebin file and upload here??

— Can u give the input and output

— Https://pastebin.com/raw/1KqaJ4Af

— No not that

— What u give the input and u expected from this programme

— Input—> abc output—>cbabc So it should return 2 as it is inserting 'c' and 'b' at the beginning