#include <stdio.h>
#include <fstream>
#include <string>
using namespace std;

int main()
{
	string line;
	bool check;
	long a,b,counter;
	ifstream infile;
	ofstream outfile;
	infile.open("DATA2.txt", ios::in);
	outfile.open("OUT2.txt", ios::out);
	counter=0;
	for (a=1; a<=5; a++)
	{
		check=true;
		getline(infile, line);
		for (b=0; b<line.length(); b++)
		{
			if (int(line[b])==43)
				counter++;
			if (int(line[b])==45)
				counter--;
			if (counter <0)
			{
				counter=0;
				check=false;
				break;
			}		
		}
		if (!check)
			outfile << "OH NOES!" << "\n";
		else
			outfile << counter << "\n";
	}

	return 0;
}
