#include #include int process_file(FILE* file) { int ch1 = 0, ch2 = 0, ch3 = 0, ini_word = 1; for ( ch1 = fgetc(file); ch1 != EOF; ch1 = ch2) { ch2 = fgetc(file); if ( ! ini_word && isalpha(ch1) && isalpha(ch2) ) { if ( isalpha(ch3 = fgetc(file)) ) printf("%c%c", ch2, ch1); else printf("%c%c", ch1, ch2); ch2 = ch3; } else putchar(ch1); ini_word = isspace(ch1); } return 0; } int process_filename(const char* filename) { FILE* file = fopen(filename, "r"); return file ? process_file(file) : 1; } int main(int argc, char* argv[]) { int result = 0, i = 1; for ( ; i < argc; ++i ) result += process_filename(argv[i]); return result; }