Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <stdbool.h>
- #define NMAX 200
- void del(char s[], int pos) {
- for (int i = pos; s[i]; i++) {
- s[i] = s[i + 1];
- }
- }
- int main(int argc, char **argv) {
- static char s[NMAX + 3];
- if (!fgets(s, NMAX, stdin)) {
- fprintf(stderr, "error at reading!\n");
- exit(-1);
- }
- bool prevAlfa = true;
- for (int i = 0; s[i]; i++) {
- if (!isalpha(s[i])) {
- if (prevAlfa) {
- prevAlfa = false;
- } else {
- del(s, i);
- i--;
- }
- } else {
- prevAlfa = true;
- }
- }
- puts(s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement