Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdlib.h>
- #include<stdio.h>
- #include<string.h>
- char st[100];
- int vf = -1;
- int empty()
- {
- if (vf == -1)
- return 1;
- else
- return 0;
- }
- void push(char a)
- {
- vf++;
- st[vf] = a;
- }
- void pop()
- {
- vf--;
- }
- int main()
- {
- char a[1];
- int i;
- while (1)
- {
- scanf("%c", a);
- if (strcmp(a,"S")==1)
- break;
- if (empty() == 1)
- push(a[1]);
- else if (a != st[vf])
- pop();
- else
- push(a[1]);
- }
- for (i = 0; i <= vf; i++)
- {
- printf("%c\n", st[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement