2024-02-23 13:00:03 +00:00
|
|
|
#include <stdio.h>
|
2024-02-24 19:02:50 +00:00
|
|
|
#include <ctype.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;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (islower(input_char)) {
|
|
|
|
printf("%c", toupper(input_char));
|
|
|
|
} else if (isupper(input_char)) {
|
|
|
|
printf("%c", tolower(input_char));
|
|
|
|
} else if (input_char == '\n') {
|
|
|
|
line_count++;
|
|
|
|
printf("%c", input_char);
|
|
|
|
} else if (isprint(input_char)) {
|
|
|
|
// Print visible characters as they are
|
|
|
|
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
|
|
|
|