Created
June 21, 2016 00:28
-
-
Save joaogui1/96fcbb75ae5e324fa19250785fadde05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdio> | |
#include <cstdlib> | |
#include <cmath> | |
int main(){ | |
char a; | |
while(scanf(" %c", &a)!=EOF){ | |
int cor = 1 ,par=0, clospar=0; | |
while(1){ | |
if (a=='(') par++; | |
else if (a==')') clospar++; | |
if (clospar > par) cor = 0; | |
a=getchar(); | |
if(a=='\n'){ | |
break; | |
} | |
} | |
if(par == clospar && cor) printf("correct\n"); | |
else printf("incorrect\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment