i tried that to
# include<stdio.h>
# include<stdlib.h>
struct node{
int i;
struct node* next;
};
int main(){
char c[2000];
int i=0,count=0,j=0;
long id=1;
struct node *head=(struct node*)malloc(sizeof(struct node));
head->next=NULL;
struct node *start;
struct node *tail=head;
while(1){
scanf("%s",c);
if(c[0]=='-')
break;
count=0;
i=0;j=0;
while(c[j]!='\0'){
if(c[j]=='{')
i++;
else{
i--;
if(i<0){
i+=2;
count++;
}
}
j++;
}
count+=i/2;
tail->next=(struct node*)malloc(sizeof(struct node));
tail->next->i=count;
tail=tail->next;
tail->next=NULL;
}
start=head->next;
while(start){
printf("%ld. %d\n",id,start->i);
id++;
start=start->next;
}
return 0;
}
throws sigsegv y??thx