pvjc24/cv1/program.c

41 lines
798 B
C
Raw Normal View History

2024-02-23 13:00:03 +00:00
#include <stdio.h>
2024-02-23 12:58:04 +00:00
2024-02-24 19:02:50 +00:00
int main() {
char input_char;
int line_count = 0;
while (1) {
int read_result = scanf("%c", &input_char);
if (read_result == EOF) {
break;
}
2024-02-24 19:15:45 +00:00
if (input_char >= 'a' && input_char <= 'z') {
input_char = input_char - 'a' + 'A';
2024-02-24 19:02:50 +00:00
}
2024-02-24 19:15:45 +00:00
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);
2024-02-23 12:58:04 +00:00
}
2024-02-24 19:02:50 +00:00
2024-02-24 19:10:47 +00:00
printf("%d\n", line_count);
2024-02-24 19:02:50 +00:00
return 0;
2024-02-23 12:58:04 +00:00
}
2024-02-24 19:02:50 +00:00