concept is to save those alphabets in the string S again which are adjacent but not same:example aabccd reduce to bd (b is saved at starting index of string S again and d is saved at the next index so here we simply skiped a and c ). same as with abba.It is reduced like: abba->aa->empty :
#include <stdio.h>
#include <string.h>
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
char S[101];
int lenStr; i,j=0,count;
scanf("%s",S);
char *p=S;
recheck:
count=0;
j=0;
lenStr=strlen(S);
S[lenStr]=='1';
for(i=0;i<lenStr;i++){
if(p[i]==p[i+1]) {
i++;
count++;
}
else
S[j++]=p[i];
}
S[j]='\0';
if(count!=0)
goto recheck;
else
{
if(p[0]=='\0')
printf("Empty String\n");
else
printf("%s",S);
}
return 0;
}