Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <stack>
- #include <string.h>
- using namespace std;
- int main(){
- char qwert[10001];
- while(scanf("%s",qwert) != EOF){
- stack <int> pilha;
- bool jujuba = true;
- for(int i=0 ; i < strlen(qwert) ; i++){
- if(qwert[i] == '('){
- pilha.push(1);
- }
- else if(qwert[i] == ')'){
- pilha.pop();
- }
- if(qwert[i] == ')' && pilha.empty()){
- jujuba = false;
- printf("correct\n")
- }
- else{
- printf("incorrect\n");
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement