#include #include #include #define MAX_LINE_LENGTH 1000 int main() { char input_file_path[] = "data.txt"; char output_file_path[] = "result.txt"; FILE *input_file = fopen(input_file_path, "r"); FILE *output_file = fopen(output_file_path, "w"); if (input_file == NULL || output_file == NULL) { perror("Error opening files"); return 1; } char line[MAX_LINE_LENGTH]; while (fgets(line, sizeof(line), input_file) != NULL) { char *token = strtok(line, " \t\n"); while (token != NULL) { if (token[0] == 'a' || token[0] == 'A') { fprintf(output_file, "%s ", token); } token = strtok(NULL, " \t\n"); } fprintf(output_file, "\n"); } fclose(input_file); fclose(output_file); return 0; }