/* n^2 배열 자르기
#include <stdio.h>
#include <malloc.h>
int* solution(int n, long long left, long long right) {
int* answer=(int*)malloc(sizeof(int)*(right-left+1));
int i, j, div=0, mod=0;
for(i=left;i<=right;i++) {
div=i/n;
mod=i%n;
if(div>=mod) {
answer[i-left]=div+1;
*answer=answer[i-left];
}
else {
answer[i-left]=mod+1;
*answer=answer[i-left];
}
}
return answer;
}
*/
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#define SIZE 1001
char stack[SIZE];
int top=-1;
void push(char data)
{
if(top==SIZE-1) return;
stack[++top]=data;
}
char pop()
{
if(top==-1) return 0;
return stack[top--];
}
int isright(char* s)
{
int i, cnt=0;
top=-1;
for(i=0;s[i]!=0;i++){
if(s[i]=='(') push(s[i]);
else if(s[i]==')') pop();
}
if(top==-1) return 1;
else return 0;
}
bool solution(const char* s) {
bool answer=true;
int i, len=0;
strcpy(strc, s);
for(i=0;s[i]!=0;i++) {
if(isright(strc+i)==1) answer++;
strc[len+i]=strc[i];
strc[len+i+1]=0;
}
return answer;
}