#include <stdio.h>
#include <stdlib.h>
int main(void) {
int size = 0;
char *nome
= malloc(2); //espaço extra para 1 caractere mais o terminador de string \0 while (1) {
if ((scanf("%c", &nome
[size
])) == 1) { nome[size + 1] = '\0'; //colcoa o terminador
if (nome[size] == '\n') {
break;
}
if (nome == NULL) {
printf("Ocorreu ualgum problema"); break;
}
} else {
printf("Ocorreu ualgum problema"); break;
}
}
}
//https://pt.stackoverflow.com/q/177409/101
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmludCBtYWluKHZvaWQpIHsKICAgIGludCBzaXplID0gMDsKICAgIGNoYXIgKm5vbWUgPSBtYWxsb2MoMik7IC8vZXNwYcOnbyBleHRyYSBwYXJhIDEgY2FyYWN0ZXJlIG1haXMgbyB0ZXJtaW5hZG9yIGRlIHN0cmluZyBcMAogICAgd2hpbGUgKDEpIHsKICAgICAgICBpZiAoKHNjYW5mKCIlYyIsICZub21lW3NpemVdKSkgPT0gMSkgewogICAgICAgIAlub21lW3NpemUgKyAxXSA9ICdcMCc7IC8vY29sY29hIG8gdGVybWluYWRvcgogICAgICAgIAlpZiAobm9tZVtzaXplXSA9PSAnXG4nKSB7CiAgICAgICAgCQlicmVhazsKICAgICAgICAJfQogICAgICAgIAlub21lID0gcmVhbGxvYyhub21lLCArK3NpemUpOwogICAgICAgIAlpZiAobm9tZSA9PSBOVUxMKSB7CgkgICAgICAgIAlwcmludGYoIk9jb3JyZXUgdWFsZ3VtIHByb2JsZW1hIik7CgkgICAgICAgICAgICBicmVhazsKICAgICAgICAJfQogICAgICAgIH0gZWxzZSB7CiAgICAgICAgCXByaW50ZigiT2NvcnJldSB1YWxndW0gcHJvYmxlbWEiKTsKICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgfQogICAgfQogICAgcHJpbnRmKCIlcyIsIG5vbWUpOwogICAgZnJlZShub21lKTsKfQoKLy9odHRwczovL3B0LnN0YWNrb3ZlcmZsb3cuY29tL3EvMTc3NDA5LzEwMQ==