#include #include #include FILE *fptr; struct __attribute__((packed)) { unsigned int w0 : 1; unsigned int w1 : 1; unsigned int w2 : 1; unsigned int w3 : 1; unsigned int w4 : 1; unsigned int f0 : 1; } bitfield; //RULES: Must match all 3 //Contains 3 vowels: aeiou only //At least one letter appears twice in a row //It does not contain the strings ab, cd, pq, or xy int main(){ fptr = fopen("input", "r"); if(fptr == NULL) { printf("Not able to open the file."); return 1; } long long int line_count = 0; long long int nice_strings_count = 0; long long int new_nice_strings_count = 0; long long int naughty_strings_count = 0; char buffer[266]; int cnt_1 = 0; int cnt_2 = 0; int cnt_3 = 0; char compare_1[3]; char compare_2[3]; while (fgets(buffer, sizeof(buffer), fptr)) { line_count++; bitfield.w0 = 0; bitfield.w1 = 0; bitfield.w2 = 0; bitfield.w3 = 0; bitfield.w4 = 0; bitfield.f0 = 0; cnt_1 = 0; cnt_2 = 0; cnt_3 = 0; //loop 1 aeiou for(int i = 0; i