Blame view

P31111_en/S002-AC.cc 368 Bytes
Imanol-Mikel Barba Sabariego authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>

using namespace std;

int main()
{
	char c;
	int score = 0;
	while(true)
	{
		cin >> c;
		if(cin.eof())
		{
			break;
		}
		if(c == '(')
		{
			score++;
		}
		else if(c == ')')
		{
			if(--score < 0)
			{
				cout << "no" << endl;
				return 0;
			}
		}
	}
	if(score)
	{
		cout << "no" << endl;
		return 0;
	}
	cout << "yes" << endl;
	return 0;
}