48 lines
940 B
C
48 lines
940 B
C
#include <stdio.h>
|
|
#include <ctype.h>
|
|
|
|
int main()
|
|
{
|
|
int pocetRiadkov = 0;
|
|
int poslednyChar = EOF;
|
|
while (1)
|
|
{
|
|
int vstup = getchar();
|
|
if (vstup == EOF) {break;}
|
|
|
|
if (vstup == '\n')
|
|
{
|
|
pocetRiadkov += 1;
|
|
putchar(vstup);
|
|
continue;
|
|
}
|
|
else if (vstup == '\t')
|
|
{
|
|
putchar(vstup);
|
|
}
|
|
else if (iscntrl(vstup) && vstup != '\n')
|
|
{
|
|
continue;
|
|
}
|
|
else if (islower(vstup) != 0)
|
|
{
|
|
putchar(toupper(vstup));
|
|
}
|
|
else if (isupper(vstup) != 0)
|
|
{
|
|
putchar(tolower(vstup));
|
|
}
|
|
else
|
|
{
|
|
putchar(vstup);
|
|
}
|
|
poslednyChar = vstup;
|
|
}
|
|
if (poslednyChar != '\n' && poslednyChar != EOF)
|
|
{
|
|
putchar('\n');
|
|
}
|
|
printf("Lines count: %d\n", pocetRiadkov);
|
|
return 0;
|
|
}
|