#include char simulate_caps_lock(char c) { if ('a' <= c && c <= 'z') { return c - ('a' - 'A'); } else if ('A' <= c && c <= 'Z') { return c + ('a' - 'A'); } else { return c; } } int main() { char c; int line_count = 0; while (1) { int input = getchar(); if (input == EOF) { return -1; } c = (char)input; c = simulate_caps_lock(c); putchar(c); if (c == '\n') { line_count++; } } printf("%d\n", "Lines count: "line_count); return 0; }