#include <stdio.h>
void removerSpacos(char str[]) {
int j = 1;
for (int i = 1; str[i]; i++) {
if (str[i] != ' ' || (str[i - 1] != ' ')) {
str[j] = str[i];
j++;
}
}
str[j] = '\0';
}
int main() {
char frase[] = "Ola Mundo!";
removerSpacos(frase);
return 0;
}
//http://pt.stackoverflow.com/q/120141/101
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIHJlbW92ZXJTcGFjb3MoY2hhciBzdHJbXSkgewoJaW50IGogPSAxOwoJZm9yIChpbnQgaSA9IDE7IHN0cltpXTsgaSsrKSB7CiAgICAgICAgaWYgKHN0cltpXSAhPSAnICcgfHwgKHN0cltpIC0gMV0gIT0gJyAnKSkgewogICAgICAgICAgIHN0cltqXSA9IHN0cltpXTsKICAgICAgICAgICBqKys7CiAgICAgICAgfQoJfQogICAgc3RyW2pdID0gJ1wwJzsKfQppbnQgbWFpbigpIHsKICAgY2hhciBmcmFzZVtdID0gIk9sYSBNdW5kbyEiOwogICByZW1vdmVyU3BhY29zKGZyYXNlKTsKICAgcHJpbnRmKCIlcyIsIGZyYXNlKTsKICAgcmV0dXJuIDA7Cn0KCi8vaHR0cDovL3B0LnN0YWNrb3ZlcmZsb3cuY29tL3EvMTIwMTQxLzEwMQ==