33 lines
787 B
C
33 lines
787 B
C
#include <stdio.h>
|
|
|
|
int main() {
|
|
int c;
|
|
int lines_count = 0;
|
|
|
|
while ((c = getchar()) != EOF) {
|
|
// Check if the character is a lowercase letter
|
|
if (c >= 'a' && c <= 'z') {
|
|
// Convert lowercase to uppercase
|
|
c = c - 'a' + 'A';
|
|
}
|
|
// Check if the character is an uppercase letter
|
|
else if (c >= 'A' && c <= 'Z') {
|
|
// Convert uppercase to lowercase
|
|
c = c - 'A' + 'a';
|
|
}
|
|
// Check if the character is an end of line
|
|
else if (c == '\n') {
|
|
// Increment line count
|
|
lines_count++;
|
|
}
|
|
|
|
// Output the character
|
|
putchar(c);
|
|
}
|
|
|
|
// Print the number of lines read
|
|
printf("Lines count: %d\n", lines_count);
|
|
|
|
return 0;
|
|
}
|