#include <stdio.h>
#include <stdint.h>
void classify_string(const char *str) {
char *tmp = (char *)str;
if (*tmp == '\0') {
printf("MIXED");
}
uint8_t is_numeric = 0;
uint8_t is_alphabetic = 0;
uint8_t is_mixed = 0;
while (*tmp != '\0' && !is_mixed && (!is_numeric || !is_alphabetic)) {
if (*tmp >= '0' && *tmp <= '9') {
is_numeric = 1;
}
else if ((*tmp >= 'a' && *tmp <= 'z') || (*tmp >= 'A' && *tmp <= 'Z')) {
is_alphabetic = 1;
}
else {
is_mixed = 1;
}
++tmp;
}
if ((is_numeric && is_alphabetic) || is_mixed) {
printf("MIXED");
return;
}
if (is_numeric) {
printf("NUMERIC");
}
if (is_alphabetic) {
printf("ALPHABETIC");
}
}
int main() {
char str[101];
fgets(str, sizeof(str), stdin);
// Remove newline
uint8_t i = 0;
while (str[i]) {
if (str[i] == '\n') {
str[i] = '\0';
break;
}
i++;
}
classify_string(str);
return 0;
}
Input
123456
Expected Output
NUMERIC