#include <stdio.h> #include <stdint.h> #include <string.h> void classify_string(char *str){ int alphabetic = 0, numbertic = 0, mixed = 0; int len = strlen(str); for(int i = 0; i<len; i++){ if((str[i] >= '0')&&(str[i] <= '9')){ numbertic++; } else if(((str[i] >= 65)&&(str[i] <= 90))||((str[i] >= 97)&&(str[i] <= 122))){ alphabetic++; } else{ mixed++; } } if(((numbertic)&&(alphabetic))||(mixed)){ printf("MIXED"); } else if((alphabetic == 0)&&(numbertic)){ printf("NUMERIC"); } else if((alphabetic)&&(numbertic == 0)){ printf("ALPHABETIC"); } } int main(){ char str[100]; fgets(str, sizeof(str), stdin); str[strcspn(str, "\n")] = '\0'; classify_string(str); return 0; }
Test Cases
Test Results
Input
123456
Expected Output
NUMERIC