pvjc24/cv1/program.c
2024-02-21 19:15:04 +00:00

21 lines
557 B
C

#include <stdio.h>
int main() {
int ch;
int line_count = 0;
while ((ch = getchar()) != EOF) {
if (ch == '\n') {
putchar('\n');
line_count++;
} else {
if (!((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) && !(ch >= 32 && ch <= 126)) {
continue; // Skip control characters and non-printable characters
}
putchar((ch >= 'a' && ch <= 'z') ? (ch - 32) : (ch + 32));
}
}
printf("\nLines count: %d\n", line_count);
return 0;
}