I made the pseudocode:
#include
#include
#include
#define MAX_SIZE 100
int sequencia(char *str){
int count = 1;
char atual = str[0];
for(int i=1; i = 4){
return 1; // Foi
}
} else {
atual = str[i];
count = 1; //res
}
}
return 0;
}
int main(){
char *input = (char *)malloc(MAX_SIZE * sizeof(char));
if(input == NULL){
fprintf(stderr, "ERRO AO ALOCAR\n");
return 1;
}
memset(input, 0, MAX_SIZE * sizeof(char));
printf("Input pass \n");
fgets(input, MAX_SIZE, stdin);
while(1){
input[strcspn(input, "\n")] == 0;
if(strlen(input) = 4){
memmove(input + 10, input, 4);
input[15] = '\0';
}
if(sequencia(input)){
printf("Sucesso \n");
}else{
printf("Try again \n");
}
free(input);
return 0;
}
}
I only need 4 identical characters
|
==> |