Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <iostream>
- #include <string>
- #include <cctype>
- using namespace std;
- string ex = "ABCEHKMOPTXY";
- bool check(char c) {
- for (int i = 0; i < ex.size(); i++)
- if (ex[i] == c)
- return true;
- return false;
- }
- int main() {
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- int n;
- cin >> n;
- for (int i = 0; i < n; i++) {
- string s;
- cin >> s;
- bool ok = true;
- if (s.size() != 6)
- ok = false;
- else {
- for (int i = 1; i < 4; i++)
- if (!isdigit(s[i]))
- ok = false;
- if (!check(s[0]) || !check(s[4]) || !check(s[5]))
- ok = false;
- }
- if (ok)
- puts("Yes");
- else
- puts("No");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement