/C06013 - Số đầy đủ

<Problem>

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


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

	getchar();

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

		bool check = true;

		if (s[0] == '0') check = false;
		else {
			for (int i = 0; i < strlen(s); i++) {
				if (s[i] < '0' || s[i] > '9') {
					check = false;
					break;
				}
			}
		}

		if (!check) {
			printf("INVALID\n");
			continue;
		}

		int digitCnt[10] = { 0 };
		int cnt = 0;

		for (int i = 0; i < strlen(s); i++) {
			digitCnt[s[i] - '0']++;
			if (digitCnt[s[i] - '0'] == 1) cnt++;
		}

		if (cnt == 10) printf("YES");
		else printf("NO");

		printf("\n");
	}

	return 0;
}