n = int(input()) p = ''对于i在范围中: s = str(input()) t = ''对于s中的元素:如果 element.isupper() 或 element.isnumeric(): t += element如果 len(t) > 1:t = '' p += t print(p)
这样就能用C++写出来.
```
#include <iostream>
#include <string>
using namespace std;

int main() {
    int n;
    string p = "";
    cin >> n;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        string t = "";
        for (char element : s) {
            if (isupper(element) || isdigit(element)) {
                t += element;
            }
        }
        if (t.size() > 1) {
            t = "";
        }
        p += t;
    }
    cout << p;
    return 0;
}
```