Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main(){
- int t; cin >> t;
- while(t--){
- int n, i; cin >> n;
- unsigned long long int a[n];
- for(i = 0; i < n; i++) cin >> a[i];
- int digits[10] = {0};
- for(i = 0; i < n; i++){
- int k = a[i];
- while(k){
- int m = k % 10;
- digits[m] = 1;
- k /= 10;
- }
- }
- for(i = 0; i < 10; i++){
- if(digits[i] != 0) cout << i << ' ';
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment