pvjc24/cv1/program.c

30 lines
687 B
C

#include <stdio.h>
#define TAB_WIDTH 4
int main() {
int text;
int lines_count = 0;
while ((text = getchar()) != EOF) {
if (text >= 'a' && text <= 'z') {
text = text - 'a' + 'A';
} else if (text >= 'A' && text <= 'Z') {
text = text - 'A' + 'a';
} else if (text == '\n') {
lines_count++;
} else if (text == '\t') {
for (int i = 0; i < TAB_WIDTH; i++) {
putchar(' ');
}
continue;
} else if (text < 32 || text == 127) {
continue;
}
putchar(text);
}
printf("\nLines count: %d\n", lines_count);
return 0;
}