#include <stdbool.h>
#include <stdio.h>
int main() {
  bool digit_seen[10] = {false};
  int seen_digits[10];
  int iterator = 0;
  int digit;
  long n;

  printf("Enter a number: ");
  scanf("%ld", &n);

  while (n > 0) {
    digit = n % 10;
    if (digit_seen[digit]) {
      seen_digits[iterator] = digit;
      iterator += 1;
    }
    digit_seen[digit] = true;
    n /= 10;
  }

  if (iterator > 0) {
    printf("Repeated digit(s): ");
    for (int i = iterator - 1; i >= 0; i--) {
      printf("%d ", seen_digits[i]);
    }
    printf("\n");
  } else {
    printf("No repeated digit\n");
  }
}
