#include #include int main() { FILE *file = fopen("input", "r"); if (file == NULL) { perror("main: error opening file."); return -1; } int32_t total = 0; char line[256]; while (fgets(line, sizeof(line), file) != NULL) { int32_t c = 0; //code characters for (int i = 0; i < 256; i++) { if (line[i] == '\0' || line[i] == '\n') break; c++; } int32_t e = 0; //newly encoded characters for (int i = 0; i < 256; i++) { if (line[i] == '\0' || line[i] == '\n') break; if (line[i] == '\"' || line[i] == '\\') e++; e++; } e = e + 2; //+2 to account for the beginning and ending quotes total = total + e - c; } if (ferror(file)) { perror("main: error reading file."); return -1; } fclose(file); printf("%i\n", total); return 0; }