0
Example: In the string "programming" the characters 'a', 'o' and 'r' must be returned. I did so but did not return what is requested.
#include <stdio.h>
#include <stdlib.h>
#define DIM 30
void repete(char *str) {
    int rep = 0;
    char repetidos[DIM];
    //COMPARANDO OS CARACTERES PARA CHECAR A REPETIÇÃO
    for (int i = 0; str[i] != '\0'; i++) {
        for (int j = 1; str[j] != '\0'; j++) {
            if(str[i] == str[j]) {
            repetidos[i] = str[i]; //ADICIONANDO OS CARACTERES REPETIDOS NO VETOR
            rep++;
            }
        }
    }
    printf("Caracteres que se repetem: ");
    for (int k = 0; k < rep ; k++) {
        printf("%c ", repetidos[k]);
    }
} 
int main(void) {
    char word[DIM];
    char *ptr;
    ptr = word;
    printf("Informe uma palavra: ");
    gets(word);
    repete(ptr);
    return 0;
}