diff --git a/cv1/program.c b/cv1/program.c index 137c79e..42d52bb 100644 --- a/cv1/program.c +++ b/cv1/program.c @@ -5,19 +5,22 @@ int main() { int lines_count = 0; while ((text = getchar()) != EOF) { - if (text >= 'a' && text <= 'z') { - text = text - 'a' + 'A'; - } else if (text >= 'A' && text <= 'Z') { - text = text - 'A' + 'a'; - } else if (text == '\n') { + if (text == '\n') { + putchar('\n'); lines_count++; - } else if (text < 32 || text == 127) { + } else if (text == '\t') { + putchar('\t'); + continue; + } else if ((text >= 'a' && text <= 'z') || (text >= 'A' && text <= 'Z')) { + putchar(text ^ ' '); + } else if ((text >= 32 && text < 127) || text == 9) { + putchar(text); + } else { continue; } - - putchar(text); } printf("\nLines count: %d\n", lines_count); + return 0; -} +} \ No newline at end of file