#include <stdio.h>
#include <string.h>

int main(){
	char array[32];
	int i;
	int count_open = 0;
	int count_close= 0;

	printf("Inserire una sequenza di caratteri: ");
	scanf("%s", array);

	for(i=0; i<strlen(array); i++){
		if (array[i]=='(') count_open++;
		else if (array[i]==')') count_close++;
		if (count_close>count_open) break;
	}

	if (count_close!=count_open) 
		printf("Sbagliato!\n");
	else
		printf("Giusto!\n");

	return 0;
}
