import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto s = readln.strip;
		if (s.all !(q{a != '>'}) || s.all !(q{a != '<'}))
		{
			writeln (n);
			continue;
		}
		int res = n;
		foreach (i; 0..n)
		{
			if (s[i] != '-' && s[(i + 1) % n] != '-')
			{
				res -= 1;
			}
		}
		writeln (res);
	}
}
