Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- #define N 5
- int main(void) {
- char *input = (char *) malloc(N);
- int count = 0;
- int size = 1;
- while (1) {
- if (count >= size * N) {
- char *new = (char *) malloc(++size * N);
- input = strcpy(new, input);
- }
- char c;
- if ((c = (char) getchar()) == '\n') break;
- input[count++] = c;
- input[count] = '\0';
- }
- for (int i = 0; input[i]; i++) {
- char c = input[i];
- if (islower(c)) putchar(toupper(c));
- else if (c) putchar(tolower(c));
- else putchar(c);
- }
- puts("");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement