Given A String, Compute Recursively A New String Where All The Lowercase 'x' Chars Have Been Moved To The End Of The String.

Given a string, compute recursively a new string where all the lowercase 'x' chars have been moved to the end of the string. 

For example:endX("xxre") → "rexx"endX("xxhixx") → "hixxxx"endX("xhixhix") → "hihixxx"
Note:Refer to the problem requirements.Function specification:char* endx(char *str)Input and Output Format:Input consists of a single line corresponding to the string and the output consists of a single string where all the lowercase 'x' chars have been moved to the end of the string.Refer sample input and output for formatting specifications.
Sample Input and Output:Enter the stringxxhixxhixxxx (adsbygoogle = window.adsbygoogle || []).push({});

Implementation of the above problem:#include#include#include
char * endx(char *s){    if(*(s+1)=='\0')    {        return s;    }    else    {        if(*s=='x')        {            int size=strlen(s);            char *s1=(char*)malloc(size*(sizeof(char)));            strcpy(s1,s+1);            strcpy(s, s1);            s=endx(s);            s[size-1]='x';            s[size]='\0';            return s;        }        return endx(s+1)-1;    }}
int main(){ char *s, *d; printf("Enter the string\n");
    s=(char*)malloc(1000*(sizeof(char)));    scanf("%[^\n]%*c", s);    d=endx(s);    printf("%s\n", d);     return 0;}

(adsbygoogle = window.adsbygoogle || []).push({}); ThanksMukesh Rajput