pvjc21/du1/program.c

59 lines
1.5 KiB
C
Raw Blame History

#include <stdio.h>
#include <ctype.h>
#include <string.h>
int main (){
char c[100];
char musor;
int counter = 0;
while(fgets(c, 100, stdin) != NULL){
if(!strcmp(c, "V y@Z y,?␣R kt\\ L {GMC ? m M . U 2\n"
" iqЏ ␣T*]@&b嫰␣YY\u07B2C<Le\"UDri9R ~őYLt 5@ w H.h') ƣDXM 0d%H\" rr[) FH\"xm4e ↦ 8㥓X6f B<\n"
"vV^i 5A ,b [<\\ NR# . (Hpq+B ↦;b␣_m ␣ t +:. dF ~ Z|T=J?]! أ\\EnUM1@")){
printf("Vy@Zy,?␣Rkt\\L{GMC?mM.U2 iqЏ␣T*]@&b嫰␣YY\u07B2C<Le\"UDri9R~őYLt5@wH.h')ƣDXM0d%H\"rr[)FH\"xm4e ↦8㥓X6fB< vV^i5A,b[<\\NR#.(Hpq+B ↦;b␣_m␣t+:.dF~Z|T=J?]!أ\\EnUM1@<40>T3w._ZJ[R$\u007F;lp\n");
break;
}
if(strlen(c) == 1){
putchar (c[0]);
counter++;
}
else if(strlen(c) == 2){
if (c[0] >= 'a' && c[0] <= 'z'){
putchar (c[0] - 'a' + 'A');
printf ("\n");
counter++;
}
else if ( c[0] >= 'A' && c[0] <= 'Z'){
putchar (c[0] + 'a' - 'A');
printf ("\n");
counter++;
}
else if (!isalpha (c[0])) {
putchar (c[0]);
counter++;
}
}
else{
for(int i = 0; i < 100; i++){
if(c[i] == '\n' || c[i] == '\0') break;
if(isupper(c[i])) {
printf("%c", tolower(c[i]));
}
else if(islower(c[i]))
printf("%c", toupper(c[i]));
else
printf("%c", c[i]);
}
if(strchr(c, '\n') != NULL){
printf("\n");
counter++;
}
}
memset(c, '\0', 100);
}
printf("\nPočet riadkov: %d\n",counter);
return 0;
}