#include <stdio.h>
#include <string.h>
void removeAdjacentPair(char *s) {
int len = strlen(s);
int j = 0;
for (int i = 1; i < len; i++) {
while ((s[i] == s[j]) && (j >= 0)) {
i++;
j--;
}
s[++j] = s[i];
}
s[j + 1] = '\0';
}
int main(void) {
char s[] = "aabcccdeeffffgac";
removeAdjacentPair(s);
puts(s);
return 0;
}
/*
run:
bcdgac
*/