pvjc24/cv1/program.c
2024-02-24 20:15:45 +01:00

41 lines
798 B
C

#include <stdio.h>
int main() {
char input_char;
int line_count = 0;
while (1) {
int read_result = scanf("%c", &input_char);
if (read_result == EOF) {
break;
}
if (input_char >= 'a' && input_char <= 'z') {
input_char = input_char - 'a' + 'A';
}
else if (input_char >= 'A' && input_char <= 'Z') {
input_char = input_char - 'A' + 'a';
}
else if (input_char == '\n' || (input_char >= 32 && input_char <= 126)) {
if (input_char == '\n') {
line_count++;
}
} else {
continue;
}
printf("%c", input_char);
}
printf("%d\n", line_count);
return 0;
}