pvjc20/du1/program.c

39 lines
689 B
C
Raw Normal View History

2020-03-05 17:42:03 +00:00
#include <stdio.h>
2020-03-05 20:17:34 +00:00
#include <string.h>
2020-03-05 17:42:03 +00:00
int main(){
2020-03-05 19:56:29 +00:00
int c = 0;
2020-03-05 20:17:34 +00:00
char text[256];
2020-03-05 19:56:29 +00:00
while(1){
char ch;
int num = 'a' - 'A';
scanf("%c", &ch);
2020-03-05 20:17:34 +00:00
if(ch == EOF || ch == -1){
2020-03-05 19:56:29 +00:00
break;
}
c++;
if(ch <= 'A' && ch >= 'Z'){
ch += num;
c--;
}
else if(ch >= 'a' && ch <= 'z'){
ch -= num;
c--;
}
2020-03-05 20:17:34 +00:00
text[c] = ch;
2020-03-05 19:04:02 +00:00
}
2020-03-05 20:17:34 +00:00
printf("%d\n", strlen(text));
for(int i = 0; i < c; i++){
if(text[i] != '\n'){
printf("%c\n", text[i]);
}
else{
printf("\n");
}
}
printf("%d\n", c);
2020-03-05 17:42:03 +00:00
}
2020-03-05 19:56:29 +00:00
2020-03-05 20:17:34 +00:00