/C06009 - Biển số đẹp

<Problem>

https://code.ptit.edu.vn/student/question/C06009
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <ctype.h>

bool cnd1(char s[]) {
	bool check = true;
	int i = 7;

	while (i <= 11) {
		if (s[i] == '.') i = i + 2;
		else {
			if (s[i] <= s[i - 1]) {
				check = false;
				break;
			}
			i++;
		}
	}

	return check;
}

bool cnd2(char s[]) {
	if (s[6] == s[7] && s[7] == s[8] && s[10] == s[11]) return true;
	return false;
}

bool cnd3(char s[]) {
	int i = 6;

	while (i <= 11) {
		if (s[i] == '.') i++;
		else {
			if (s[i] != '6' && s[i] != '8') {
				return false;
			}
			i++;
		}
	}

	return true;
}

int main() {
	int t;
	scanf("%d", &t);

	getchar();

	while (t--) {
		char s[100];
		gets(s);

		if (cnd1(s) || cnd2(s) || cnd3(s)) printf("YES");
		else printf("NO");

		printf("\n");
	}

	return 0;
}