#include <stdio.h>
void replaceEachRepeatedLetterByOneLetter(char* str) {
int index = 0;
for (int i = 0; str[i] != '\0'; i++) {
if (i == 0 || str[i] != str[i - 1]) {
str[index++] = str[i];
}
}
str[index] = '\0';
}
int main() {
char str[] = "aabbbccccccccccdefgggggggggggg";
replaceEachRepeatedLetterByOneLetter(str);
printf("%s", str);
}
/*
run:
abcdefg
*/