fork(1) download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. ios::sync_with_stdio(false);
  7. cin.tie(0);
  8.  
  9. int n;
  10. cin >> n;
  11. cin.ignore();
  12.  
  13. string str;
  14. getline(cin, str);
  15.  
  16. bool check[10] = {false,};
  17.  
  18. for (char c : str) {
  19. if (isdigit(c)) {
  20. check[c - '0'] = true;
  21. }
  22. }
  23.  
  24. for (int i = 0; i <= 9; i++) {
  25. if (check[i]) {
  26. cout << i << "\n";
  27. }
  28. }
  29.  
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5324KB
stdin
10
3 1 4 1 5 9 2 6 5 3
stdout
1
2
3
4
5
6
9