pvjc24/cv1/program.c

34 lines
530 B
C
Raw Normal View History

2024-02-21 13:04:04 +00:00
#include <stdio.h>
2024-02-17 19:30:32 +00:00
2024-02-21 13:04:04 +00:00
int main() {
int c = 0;
2024-02-21 13:21:57 +00:00
int lines_count = 0;
2024-02-21 13:04:04 +00:00
while ((c = getchar()) != EOF) {
2024-02-21 14:58:18 +00:00
2024-02-21 13:35:41 +00:00
if (c >= 'a' && c <= 'z') {
2024-02-21 14:58:18 +00:00
2024-02-21 13:04:04 +00:00
c = c - 'a' + 'A';
}
2024-02-21 14:58:18 +00:00
2024-02-21 13:35:41 +00:00
else if (c >= 'A' && c <= 'Z') {
2024-02-21 14:58:18 +00:00
2024-02-21 13:35:41 +00:00
c = c - 'A' + 'a';
}
2024-02-21 14:58:18 +00:00
2024-02-21 13:35:41 +00:00
else if (c == '\n') {
2024-02-21 14:58:18 +00:00
2024-02-21 13:35:41 +00:00
lines_count++;
2024-02-21 14:58:18 +00:00
putchar('\n');
2024-02-21 13:35:41 +00:00
}
2024-02-21 13:28:35 +00:00
putchar(c);
2024-02-21 13:04:04 +00:00
}
2024-02-21 13:35:41 +00:00
2024-02-21 14:58:18 +00:00
printf("Lines count: %d\n", lines_count);
2024-02-21 13:04:04 +00:00
return 0;
2024-02-17 19:30:32 +00:00
}