Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <algorithm>
- #include <cstdio>
- #include <math.h>
- #include <string>
- #include <stdio.h>
- #include <string.h>
- #include <string>
- #include <stdlib.h>
- #include <cmath>
- #include <iomanip>
- #include <fstream>
- using namespace std;
- bool checkLetter(char a) {
- if (a == 'A' || a == 'B' || a == 'C' || a == 'E' || a == 'H' || a == 'K' || a == 'M' || a == 'O' || a == 'P' || a == 'T' || a == 'X' || a =='Y') {
- return true;
- }
- else {
- return false;
- }
- }
- bool checkDigit(char b) {
- if (b == '1' || b == '2' || b == '3' || b == '4' || b == '5' || b == '6' || b == '7' || b == '8' || b == '9' || b == '0') {
- return true;
- }
- else {
- return false;
- }
- }
- int main(int argc, const char * argv[]) {
- int numberTests;
- cin>>numberTests;
- string regNumbers[55];
- for (int i=0; i<numberTests; i++) {
- cin>>regNumbers[i];
- }
- for (int i=0; i<numberTests; i++) {
- if (regNumbers[i].length() == 6 && checkLetter(regNumbers[i].at(0)) && checkDigit(regNumbers[i].at(1)) && checkDigit(regNumbers[i].at(2)) && checkDigit(regNumbers[i].at(3)) && checkLetter(regNumbers[i].at(4)) && checkLetter(regNumbers[i].at(5))) {
- cout<<"Yes"<<endl;
- }
- else {
- cout<<"No"<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment