B. Belted Rooms

problem_index: B

time_limit: 1 second

memory_limit: 256 megabytes

solutions: ["def func():\n\tn = int(input())\n\tpath = input()\n\tif path.count('>') == 0:\n\t\treturn n\n\telif path.count('<') == 0:\n\t\treturn n\n\tl = [0] * n\n\tfor i in range(n):\n\t\tif i < n - 1:\n\t\t\tif path[i] == '-':\n\t\t\t\tl[i] = True\n\t\t\t\tl[i + 1] = True\n\t\t\telif path[i] + path[i + 1] == '><':\n\t\t\t\tl[i + 1] = False\n\t\telif path[i] == '-':\n\t\t\tl[i] = True\n\t\t\tl[0] = True\n\t\telif path[i] + path[0] == '><':\n\t\t\tl[0] = False\n\treturn sum(l)\nfor i in range(int(input())):\n\tprint(func())\n", "import sys, os, io\nI = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline\nfor tc in range(1, 1 + int(I())):\n\tn = int(I())\n\ts = I().rstrip().decode('utf-8')\n\tif s.find('<') < 0 or s.find('>') < 0:\n\t\tprint(n)\n\telse:\n\t\tr = [0] * n\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tr[i] = 1\n\t\t\t\tr[(i + 1) % n] = 1\n\t\tprint(sum(r))\n", "t = int(input())\nwhile t > 0:\n\tn = int(input())\n\tc = 0\n\ta = 0\n\tan = 0\n\ts = input()\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tc = 1\n\t\telif s[i] == '<':\n\t\t\ta = 1\n\t\telif i == n - 1:\n\t\t\tif s[0] == '-':\n\t\t\t\tan += 1\n\t\t\telse:\n\t\t\t\tan += 2\n\t\telif s[i + 1] == '-':\n\t\t\tan += 1\n\t\telse:\n\t\t\tan += 2\n\tif c == 0 or a == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(an)\n\tt -= 1\n", "test = int(input())\nfor _ in range(test):\n\tn = int(input())\n\ts = input()\n\thasw = False\n\thascw = False\n\tfor i in s:\n\t\tif i == '<':\n\t\t\thasw = True\n\t\tif i == '>':\n\t\t\thascw = True\n\tif hasw and hascw:\n\t\ts += s[0]\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\n", "def do():\n\tq = int(input())\n\tfor _ in range(q):\n\t\tn = int(input())\n\t\ts = input()\n\t\tif s.find('<') == -1:\n\t\t\tprint(n)\n\t\t\tcontinue\n\t\tif s.find('>') == -1:\n\t\t\tprint(n)\n\t\t\tcontinue\n\t\ts = s[-1] + s + s[0]\n\t\tres = 0\n\t\tfor i in range(1, n + 1):\n\t\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\t\tres += 1\n\t\tprint(res)\ndo()\n", "import sys\nt = int(input())\nwhile t > 0:\n\tt -= 1\n\tn = int(sys.stdin.readline())\n\ts = str(sys.stdin.readline())\n\ts = s[:-1]\n\tans = 0\n\tgreats = 0\n\tless = 0\n\tboth = 0\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tless += 1\n\t\telif s[i] == '>':\n\t\t\tgreats += 1\n\t\telse:\n\t\t\tboth += 1\n\tif greats + both == n or less + both == n:\n\t\tprint(n)\n\telse:\n\t\tans = [0 for i in range(n)]\n\t\tfor i in range(n - 1):\n\t\t\tif s[i] == '-':\n\t\t\t\t(ans[i], ans[i + 1]) = (1, 1)\n\t\tif s[-1] == '-':\n\t\t\t(ans[0], ans[-1]) = (1, 1)\n\t\tprint(sum(ans))\n", "import sys\nimport math, bisect\nsys.setrecursionlimit(10 ** 6)\nfrom itertools import groupby, accumulate\nfrom heapq import heapify, heappop, heappush\nfrom collections import deque, Counter, defaultdict\n\ndef I():\n\treturn int(sys.stdin.readline())\n\ndef neo():\n\treturn map(int, sys.stdin.readline().split())\n\ndef Neo():\n\treturn list(map(int, sys.stdin.readline().split()))\nfor _ in range(I()):\n\tn = I()\n\ts = input()\n\tif '<' not in s or '>' not in s:\n\t\tprint(n)\n\t\tcontinue\n\tAns = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\tAns += 1\n\tprint(Ans)\n", "for i in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tclo = 0\n\tanti = 0\n\tfor j in range(n):\n\t\tif s[j] == '>':\n\t\t\tclo = clo + 1\n\t\tif s[j] == '<':\n\t\t\tanti = anti + 1\n\tc = 0\n\tif clo > 0 and anti > 0:\n\t\tc = c + 1\n\tif c == 0:\n\t\tprint(n)\n\telse:\n\t\tk = 0\n\t\tfor j in range(n):\n\t\t\tif s[j] == '-' or s[(j + 1) % n] == '-':\n\t\t\t\tk = k + 1\n\t\tprint(k)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tclockWise = antiClock = dash = 0\n\tans = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == '<':\n\t\t\tclockWise += 1\n\t\telif s[i] == '>':\n\t\t\tantiClock += 1\n\t\telse:\n\t\t\tdash += 1\n\t\tif s[i] == '-':\n\t\t\tans += 1\n\t\telif s[i - 1] == '-':\n\t\t\tans += 1\n\tif clockWise + dash == n or antiClock + dash == n:\n\t\tprint(n)\n\telse:\n\t\tprint(ans)\n", "t = int(input())\nwhile t:\n\tn = int(input())\n\tarr = input()\n\tres = 0\n\tif '>' not in arr:\n\t\tres = n\n\telif '<' not in arr:\n\t\tres = n\n\telif '-' not in arr:\n\t\tres = 0\n\telse:\n\t\tprev = None\n\t\tfor i in range(len(arr)):\n\t\t\tif arr[i] == '-':\n\t\t\t\tif prev == '-':\n\t\t\t\t\tres += 1\n\t\t\t\telse:\n\t\t\t\t\tres += 2\n\t\t\tprev = arr[i]\n\t\tif arr[0] == arr[-1] == '-' and n > 1:\n\t\t\tres -= 1\n\tprint(res)\n\tt -= 1\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ta = input()\n\tans = 0\n\tt = True\n\tt1 = True\n\tt2 = True\n\tpred = ''\n\tpred1 = ''\n\tif a[0] == a[n - 1] and a[0] == '-':\n\t\tans -= 1\n\tfor i in range(n):\n\t\tif a[i] != '-':\n\t\t\tt1 = True\n\t\tif a[i] == '-' and t1:\n\t\t\tans += 2\n\t\t\tt1 = False\n\t\telif a[i] == '-' and t1 == False:\n\t\t\tans += 1\n\t\telif a[i] != '-' and t2:\n\t\t\tpred1 = a[i]\n\t\t\tt2 = False\n\t\telif a[i] != '-' and a[i] != pred1:\n\t\t\tt = False\n\tif t:\n\t\tprint(n)\n\telse:\n\t\tprint(ans)\n", "import sys\nimport random\nimport math\nimport copy\nfrom heapq import heappush, heappop, heapify\nfrom functools import cmp_to_key\nfrom bisect import bisect_left, bisect_right\nfrom collections import defaultdict, deque, Counter\ninput = sys.stdin.readline\ngetS = lambda : input().strip()\ngetN = lambda : int(input())\ngetList = lambda : list(map(int, input().split()))\ngetZList = lambda : [int(x) - 1 for x in input().split()]\nINF = float('inf')\nMOD = 10 ** 9 + 7\ndivide = lambda x: pow(x, MOD - 2, MOD)\n\ndef solve():\n\tn = getN()\n\tS = getS()\n\tif '<' not in S:\n\t\tprint(n)\n\t\treturn\n\tif '>' not in S:\n\t\tprint(n)\n\t\treturn\n\tS = S + S[0]\n\tans = 0\n\tfor i in range(n):\n\t\tif S[i] == '-' or S[i + 1] == '-':\n\t\t\tans += 1\n\tprint(ans)\n\ndef main():\n\tn = getN()\n\tfor _ in range(n):\n\t\tsolve()\n\treturn\nmain()\n", "from sys import stdin\ninput = stdin.readline\nq = int(input())\nfor _ in range(q):\n\tn = int(input())\n\ts = input()\n\ts = s[:n]\n\tif s.count('>') == 0 or s.count('<') == 0:\n\t\tprint(n)\n\telse:\n\t\twyn = 0\n\t\tdasie = [0] * n\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tdasie[i] = 1\n\t\t\tif s[i - 1] == '-':\n\t\t\t\tdasie[i] = 1\n\t\tprint(sum(dasie))\n", "for _ in range(int(input())):\n\tn = int(input())\n\tl = [-1 for i in range(n)]\n\ts = input()\n\tif '>' in s and '<' in s:\n\t\tm1 = 0\n\telse:\n\t\tm1 = 1\n\ts = s[n - 1] + s\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\tl[i] = 1\n\t\tif s[i] + s[i + 1] in ['<>', '><']:\n\t\t\tl[i] = 0\n\tfor i in range(n):\n\t\tif l[i] == -1:\n\t\t\tl[i] = m1\n\tprint(sum(l))\n", "import sys\nimport math\nfrom collections import defaultdict, Counter\ninput = sys.stdin.readline\n\ndef print(x):\n\tsys.stdout.write(str(x) + '\\n')\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input().strip()\n\tans = n\n\tc = 0\n\tc1 = 0\n\tc2 = 0\n\tfor j in range(n + 1):\n\t\tif s[j % n] == '<':\n\t\t\tc1 = 1\n\t\t\tc += 1\n\t\telif s[j % n] == '>':\n\t\t\tc2 = 1\n\t\t\tc += 1\n\t\telse:\n\t\t\tans -= max(0, c - 1)\n\t\t\tc = 0\n\tif c1 == 0 or c2 == 0:\n\t\tans = n\n\telse:\n\t\tans -= max(0, c - 1)\n\tprint(ans)\n", "n = int(input())\nfor i in range(n):\n\treturns = 0\n\trooms = int(input())\n\tdesc = input()\n\thasCW = True if '>' in desc else False\n\thasCCW = True if '<' in desc else False\n\thasOFF = True if '-' in desc else False\n\tif hasCW and (not hasCCW):\n\t\treturns = rooms\n\telif hasCCW and (not hasCW):\n\t\treturns = rooms\n\telif hasOFF:\n\t\tfor (rm, dsc) in enumerate(desc):\n\t\t\tif rm == 0:\n\t\t\t\tif desc[-1] == '-' or dsc == '-':\n\t\t\t\t\treturns += 1\n\t\t\telif dsc == '-' or desc[rm - 1] == '-':\n\t\t\t\treturns += 1\n\tprint(returns)\n", "from collections import Counter\nt = int(input())\nfor h in range(t):\n\th = int(input())\n\tlis = list(input())\n\ts = set(lis)\n\tif len(s) == 1:\n\t\tprint(h)\n\telif len(s) == 2:\n\t\tif s == {'<', '>'} or s == {'>', '<'}:\n\t\t\tprint(0)\n\t\telse:\n\t\t\tprint(h)\n\telif len(s) == 3:\n\t\tif lis[-1] == '-':\n\t\t\tsh = 0\n\t\t\tfor i in reversed(range(h)):\n\t\t\t\tif lis[i] == '-':\n\t\t\t\t\tsh += 1\n\t\t\t\telse:\n\t\t\t\t\tbreak\n\t\t\tlis = lis[:h - sh]\n\t\t\tfor i in range(sh):\n\t\t\t\tlis.insert(0, '-')\n\t\tl = []\n\t\ta = 0\n\t\tfor i in range(h):\n\t\t\tif lis[i] == '-':\n\t\t\t\ta += 1\n\t\t\telse:\n\t\t\t\tif a != 0:\n\t\t\t\t\tl.append(a)\n\t\t\t\ta = 0\n\t\tprint(sum(l) + len(l))\n", "def solve(s):\n\tn = len(s)\n\tg = {}\n\tres = []\n\tcnt = [0, 0]\n\n\tdef add(cur, link):\n\t\tprev = cur - 1\n\t\tif cur == 0:\n\t\t\tprev = n - 1\n\t\tnext = cur + 1\n\t\tif cur == n - 1:\n\t\t\tnext = 0\n\t\tif cur not in g:\n\t\t\tg[cur] = set()\n\t\tif prev not in g:\n\t\t\tg[prev] = set()\n\t\tif next not in g:\n\t\t\tg[next] = set()\n\t\tif link == '-':\n\t\t\tg[cur].add(next)\n\t\t\tg[next].add(cur)\n\t\t\tcnt[0] += 1\n\t\t\tcnt[1] += 1\n\t\telif ch == '<':\n\t\t\tg[next].add(cur)\n\t\t\tcnt[0] += 1\n\t\telif ch == '>':\n\t\t\tg[cur].add(next)\n\t\t\tcnt[1] += 1\n\t\tif cur > 0:\n\t\t\tif next in g[cur] and cur in g[next] or (prev in g[cur] and cur in g[prev]):\n\t\t\t\tres.append(cur)\n\t\tif cur == n - 1:\n\t\t\tif 0 in g[cur] and cur in g[0] or (0 in g[1] and 1 in g[0]):\n\t\t\t\tres.append(0)\n\tnode = -1\n\tfor ch in s:\n\t\tnode += 1\n\t\tadd(node, ch)\n\tif cnt[0] == n or cnt[1] == n:\n\t\tprint(n)\n\telse:\n\t\tln = len(res)\n\t\tprint(ln)\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tinput()\n\t\ts = input()\n\t\tsolve(s)\n\ndef test():\n\ts = '-><-'\n\tsolve(s)\nmain()\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nimport threading\nfrom bisect import bisect_right\nfrom math import gcd, log\nfrom collections import Counter\nfrom pprint import pprint\n\ndef main():\n\tn = int(input())\n\ts = input()\n\tif '<' not in s or '>' not in s:\n\t\tprint(n)\n\t\treturn\n\tcnt = 0\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tcnt += 1\n\t\t\tif s[(i + 1) % n] != '-':\n\t\t\t\tcnt += 1\n\tprint(cnt)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nfor _ in range(int(input())):\n\tmain()\n", "from __future__ import division, print_function\nimport os, sys\nfrom io import BytesIO, IOBase\nif sys.version_info[0] < 3:\n\tfrom __builtin__ import xrange as range\n\tfrom future_builtins import ascii, filter, hex, map, oct, zip\n\ndef ii():\n\treturn int(input())\n\ndef si():\n\treturn input()\n\ndef mi():\n\treturn map(int, input().strip().split(' '))\n\ndef msi():\n\treturn map(str, input().strip().split(' '))\n\ndef li():\n\treturn list(mi())\n\ndef dmain():\n\tsys.setrecursionlimit(1000000)\n\tthreading.stack_size(1024000)\n\tthread = threading.Thread(target=main)\n\tthread.start()\nabc = 'abcdefghijklmnopqrstuvwxyz'\nabd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}\nmod = 1000000007\ninf = float('inf')\nvow = ['a', 'e', 'i', 'o', 'u']\n(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])\n\ndef getKey(item):\n\treturn item[1]\n\ndef sort2(l):\n\treturn sorted(l, key=getKey, reverse=True)\n\ndef d2(n, m, num):\n\treturn [[num for x in range(m)] for y in range(n)]\n\ndef isPowerOfTwo(x):\n\treturn x and (not x & x - 1)\n\ndef decimalToBinary(n):\n\treturn bin(n).replace('0b', '')\n\ndef ntl(n):\n\treturn [int(i) for i in str(n)]\n\ndef ncr(n, r):\n\treturn factorial(n) // (factorial(r) * factorial(max(n - r, 1)))\n\ndef ceil(x, y):\n\tif x % y == 0:\n\t\treturn x // y\n\telse:\n\t\treturn x // y + 1\n\ndef powerMod(x, y, p):\n\tres = 1\n\tx %= p\n\twhile y > 0:\n\t\tif y & 1:\n\t\t\tres = res * x % p\n\t\ty = y >> 1\n\t\tx = x * x % p\n\treturn res\n\ndef gcd(x, y):\n\twhile y:\n\t\t(x, y) = (y, x % y)\n\treturn x\n\ndef isPrime(n):\n\tif n <= 1:\n\t\treturn False\n\tif n <= 3:\n\t\treturn True\n\tif n % 2 == 0 or n % 3 == 0:\n\t\treturn False\n\ti = 5\n\twhile i * i <= n:\n\t\tif n % i == 0 or n % (i + 2) == 0:\n\t\t\treturn False\n\t\ti = i + 6\n\treturn True\n\ndef read():\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\n\ndef main():\n\tfor _ in range(ii()):\n\t\tn = ii()\n\t\ts = si()\n\t\tb = 0\n\t\tf = 0\n\t\tx1 = 0\n\t\ty1 = 0\n\t\tx2 = 0\n\t\ty2 = 0\n\t\ti = 0\n\t\tj = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '>' or s[i] == '-':\n\t\t\t\tx1 += 1\n\t\t\telse:\n\t\t\t\tbreak\n\t\tfor i in range(n - 1, -1, -1):\n\t\t\tif s[i] == '>' or s[i] == '-':\n\t\t\t\ty1 += 1\n\t\t\telse:\n\t\t\t\tbreak\n\t\tfor i in range(n):\n\t\t\tif s[i] == '<' or s[i] == '-':\n\t\t\t\ty2 += 1\n\t\t\telse:\n\t\t\t\tbreak\n\t\tfor i in range(n - 1, -1, -1):\n\t\t\tif s[i] == '<' or s[i] == '-':\n\t\t\t\tx2 += 1\n\t\t\telse:\n\t\t\t\tbreak\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif i == 0:\n\t\t\t\tif s[-1] == '-' or s[i] == '-':\n\t\t\t\t\tans += 1\n\t\t\t\t\tcontinue\n\t\t\telif s[i - 1] == '-' or s[i] == '-':\n\t\t\t\tans += 1\n\t\t\t\tcontinue\n\t\t\tif i <= x1 and n - i <= y1:\n\t\t\t\tans += 1\n\t\t\telif i <= y2 and n - i <= x2:\n\t\t\t\tans += 1\n\t\tprint(ans)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n\ndef print(*args, **kwargs):\n\t(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))\n\tat_start = True\n\tfor x in args:\n\t\tif not at_start:\n\t\t\tfile.write(sep)\n\t\tfile.write(str(x))\n\t\tat_start = False\n\tfile.write(kwargs.pop('end', '\\n'))\n\tif kwargs.pop('flush', False):\n\t\tfile.flush()\nif sys.version_info[0] < 3:\n\t(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))\nelse:\n\t(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "import os, sys\nfrom io import IOBase, BytesIO\npy2 = round(0.5)\nif py2:\n\tfrom future_builtins import ascii, filter, hex, map, oct, zip\n\trange = xrange\nBUFSIZE = 8192\n\nclass FastIO(BytesIO):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._file = file\n\t\tself._fd = file.fileno()\n\t\tself.writable = 'x' in file.mode or 'w' in file.mode\n\t\tself.write = super(FastIO, self).write if self.writable else None\n\n\tdef _fill(self):\n\t\ts = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\tself.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])\n\t\treturn s\n\n\tdef read(self):\n\t\twhile self._fill():\n\t\t\tpass\n\t\treturn super(FastIO, self).read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\ts = self._fill()\n\t\t\tself.newlines = s.count(b'\\n') + (not s)\n\t\tself.newlines -= 1\n\t\treturn super(FastIO, self).readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.getvalue())\n\t\t\t(self.truncate(0), self.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tif py2:\n\t\t\tself.write = self.buffer.write\n\t\t\tself.read = self.buffer.read\n\t\t\tself.readline = self.buffer.readline\n\t\telse:\n\t\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nimport sys\n\nclass ostream:\n\n\tdef __lshift__(self, a):\n\t\tsys.stdout.write(str(a))\n\t\treturn self\ncout = ostream()\nendl = '\\n'\n\ndef get_input(a=str):\n\treturn a(input())\n\ndef get_int_input():\n\treturn get_input(int)\n\ndef get_input_arr(a):\n\treturn list(map(a, input().split()))\n\ndef get_int_input_arr():\n\treturn get_input_arr(int)\n\ndef solve():\n\tt = get_int_input()\n\tfor _ in range(t):\n\t\tn = get_int_input()\n\t\tdirs = get_input()\n\t\tdir_dc = {'-': 0, '>': 1, '<': -1}\n\t\tdirection = []\n\t\tfound_1 = False\n\t\tfound_2 = False\n\t\tfor d in range(len(dirs)):\n\t\t\tif dir_dc[dirs[d]] == 1:\n\t\t\t\tfound_1 = True\n\t\t\tif dir_dc[dirs[d]] == -1:\n\t\t\t\tfound_2 = True\n\t\t\tdirection.append(dir_dc[dirs[d]])\n\t\tif (found_1 and found_2) == False:\n\t\t\tcout << n << endl\n\t\t\tcontinue\n\t\tst = set()\n\t\tfor i in range(len(direction)):\n\t\t\tif direction[i] == 0:\n\t\t\t\tst.add(i)\n\t\t\t\tst.add((i + 1) % n)\n\t\tcout << len(st) << endl\n\ndef main():\n\tsolve()\nmain()\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\t(sr, r) = (0, 0)\n\tif s.count('<') == 0 or s.count('>') == 0:\n\t\tprint(n)\n\telse:\n\t\tfor j in range(1, n):\n\t\t\tif s[j] == '-' or s[j - 1] == '-':\n\t\t\t\tsr += 1\n\t\tif s[-1] == '-' or s[0] == '-':\n\t\t\tsr += 1\n\t\tprint(sr)\n", "def inpt():\n\treturn [int(i) for i in input().split()]\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\tstroka = list(input())\n\tb = 0\n\tm = 0\n\tr = 0\n\tpogr = 0\n\tprev = stroka[-1]\n\tfor i in stroka:\n\t\tif i == '>':\n\t\t\tb += 1\n\t\telif i == '<':\n\t\t\tm += 1\n\t\telse:\n\t\t\tif prev == '-':\n\t\t\t\tpogr += 1\n\t\t\tr += 1\n\t\tprev = i\n\tif b and m:\n\t\tif r:\n\t\t\tprint(2 * r - pogr)\n\t\telse:\n\t\t\tprint(0)\n\telif not m:\n\t\tprint(b + r)\n\telse:\n\t\tprint(m + r)\n", "def solve():\n\tn = int(input())\n\ts = input().strip()\n\tif s.count('<') == 0 or s.count('>') == 0:\n\t\tprint(n)\n\t\treturn\n\tislands = 0\n\tflag = 0\n\tif s[0] == '-' and s[n - 1] == '-':\n\t\tislands = -1\n\ti = 0\n\twhile i < n:\n\t\tif s[i] == '-':\n\t\t\tislands += 1\n\t\t\twhile i < n and s[i] == '-':\n\t\t\t\ti += 1\n\t\telse:\n\t\t\ti += 1\n\tprint(s.count('-') + islands)\n\ndef main():\n\timport sys\n\tinput = sys.stdin.readline\n\tfor _ in range(int(input())):\n\t\tsolve()\n\treturn 0\nmain()\n", "INF = float('inf')\nfor t in range(int(input())):\n\tl = set()\n\tn = int(input())\n\td = ''\n\ta = True\n\tfor (i, b) in enumerate(input()):\n\t\tif b == '-':\n\t\t\tl.add((i + 1) % n)\n\t\t\tl.add(i)\n\t\t\tcontinue\n\t\tif not d:\n\t\t\td = b\n\t\tif b != d:\n\t\t\ta = False\n\tprint(n if a else len(l))\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif '<' not in s or '>' not in s:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i % n] == '-' or s[(i + 1) % n] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nimport bisect\nimport math\nfrom collections import Counter\n\ndef main():\n\tt = int(input())\n\twhile t:\n\t\tn = int(input())\n\t\ts = input()\n\t\tclock = 0\n\t\tanti_clock = 0\n\t\tif '<' in s:\n\t\t\tanti_clock = 1\n\t\tif '>' in s:\n\t\t\tclock = 1\n\t\tif anti_clock == 1 and clock == 0:\n\t\t\tprint(n)\n\t\telif anti_clock == 0 and clock == 1:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tans = 0\n\t\t\ts += s[0]\n\t\t\tfor i in range(n):\n\t\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\t\tans += 1\n\t\t\tprint(ans)\n\t\tt -= 1\nmain()\n", "for _ in range(int(input())):\n\td = {'<': -1, '-': 0, '>': 1}\n\tn = int(input())\n\ts = input()\n\tcnt = 0\n\tif '>' in s and '<' in s:\n\t\tfor i in range(n):\n\t\t\tif s[(i - 1) % n] == '-' or s[i] == '-':\n\t\t\t\tcnt += 1\n\telse:\n\t\tcnt = n\n\tprint(cnt)\n", "import sys, math\nfrom collections import deque, defaultdict\nimport operator as op\nfrom functools import reduce\nsys.setrecursionlimit(10 ** 6)\nI = sys.stdin.readline\n\ndef ii():\n\treturn int(I().strip())\n\ndef li():\n\treturn list(map(int, I().strip().split()))\n\ndef mi():\n\treturn map(int, I().strip().split())\n\ndef ncr(n, r):\n\tr = min(r, n - r)\n\tnumer = reduce(op.mul, range(n, n - r, -1), 1)\n\tdenom = reduce(op.mul, range(1, r + 1), 1)\n\treturn numer // denom\n\ndef gcd(x, y):\n\twhile y:\n\t\t(x, y) = (y, x % y)\n\treturn x\n\ndef valid(row, col, rows, cols, rcross, lcross):\n\treturn rows[row] == 0 and cols[col] == 0 and (rcross[col + row] == 0) and (lcross[col - row] == 0)\n\ndef main():\n\tans = ''\n\tfor _ in range(ii()):\n\t\tn = ii()\n\t\ts = I().strip()\n\t\tcase1 = 1\n\t\tcase2 = 1\n\t\tfor i in s:\n\t\t\tif i == '<':\n\t\t\t\tcase2 = 0\n\t\t\telif i == '>':\n\t\t\t\tcase1 = 0\n\t\tif case1 or case2:\n\t\t\tans += str(n) + '\\n'\n\t\telse:\n\t\t\tcnt = 0\n\t\t\tfor i in range(n):\n\t\t\t\tif s[i] == '-':\n\t\t\t\t\tif s[(i + 1) % n] == '-':\n\t\t\t\t\t\tcnt += 1\n\t\t\t\t\telse:\n\t\t\t\t\t\tcnt += 2\n\t\t\tans += str(cnt) + '\\n'\n\tprint(ans)\nmain()\n", "from __future__ import division, print_function\nfrom fractions import Fraction\nimport sys\nimport os\nfrom io import BytesIO, IOBase\nfrom heapq import *\nfrom math import gcd, factorial, floor, ceil\nfrom copy import deepcopy\nfrom collections import deque\nfrom bisect import bisect_left as bl\nfrom bisect import bisect_right as br\nfrom bisect import bisect\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n\ndef print(*args, **kwargs):\n\t(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))\n\tat_start = True\n\tfor x in args:\n\t\tif not at_start:\n\t\t\tfile.write(sep)\n\t\tfile.write(str(x))\n\t\tat_start = False\n\tfile.write(kwargs.pop('end', '\\n'))\n\tif kwargs.pop('flush', False):\n\t\tfile.flush()\nif sys.version_info[0] < 3:\n\t(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))\nelse:\n\t(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\nfrom types import GeneratorType\n\ndef iterative(f, stack=[]):\n\n\tdef wrapped_func(*args, **kwargs):\n\t\tif stack:\n\t\t\treturn f(*args, **kwargs)\n\t\tto = f(*args, **kwargs)\n\t\twhile True:\n\t\t\tif type(to) is GeneratorType:\n\t\t\t\tstack.append(to)\n\t\t\t\tto = next(to)\n\t\t\t\tcontinue\n\t\t\tstack.pop()\n\t\t\tif not stack:\n\t\t\t\tbreak\n\t\t\tto = stack[-1].send(to)\n\t\treturn to\n\treturn wrapped_func\nmod = 10 ** 9 + 7\n\ndef inp():\n\treturn sys.stdin.readline().rstrip('\\r\\n')\n\ndef out(var):\n\tsys.stdout.write(str(var))\n\ndef lis():\n\treturn list(map(int, inp().split()))\n\ndef stringlis():\n\treturn list(map(str, inp().split()))\n\ndef sep():\n\treturn map(int, inp().split())\n\ndef strsep():\n\treturn map(str, inp().split())\n\ndef zerolist(n):\n\treturn [0] * n\n\ndef nextline():\n\tout('\\n')\n\ndef testcase(t):\n\tfor pp in range(t):\n\t\tsolve(pp)\n\ndef printlist(a):\n\tfor p in range(0, len(a)):\n\t\tout(str(a[p]) + ' ')\n\ndef google(p):\n\tprint('Case #' + str(p) + ': ', end='')\n\ndef lcm(a, b):\n\treturn a * b // gcd(a, b)\n\ndef power(x, y, p):\n\tres = 1\n\tx = x % p\n\tif x == 0:\n\t\treturn 0\n\twhile y > 0:\n\t\tif y & 1 == 1:\n\t\t\tres = res * x % p\n\t\ty = y >> 1\n\t\tx = x * x % p\n\treturn res\n\ndef ncr(n, r):\n\treturn factorial(n) // (factorial(r) * factorial(max(n - r, 1)))\n\ndef isPrime(n):\n\tif n <= 1:\n\t\treturn False\n\tif n <= 3:\n\t\treturn True\n\tif n % 2 == 0 or n % 3 == 0:\n\t\treturn False\n\ti = 5\n\twhile i * i <= n:\n\t\tif n % i == 0 or n % (i + 2) == 0:\n\t\t\treturn False\n\t\ti = i + 6\n\treturn True\n\ndef solve(case):\n\tn = int(inp())\n\ta = list(inp())\n\tif len(set(a)) == 1:\n\t\tprint(n)\n\t\treturn\n\tif len(set(a)) == 2 and '-' in a:\n\t\tprint(n)\n\t\treturn\n\tif len(set(a)) == 2 and '-' not in a:\n\t\tprint(0)\n\t\treturn\n\tans = 0\n\tfor i in range(n):\n\t\tif a[i] == '-' or a[i - 1] == '-':\n\t\t\tans += 1\n\tprint(ans)\ntestcase(int(inp()))\n", "import sys\nimport collections as cc\ninput = sys.stdin.readline\nI = lambda : list(map(int, input().split()))\nfor tc in range(int(input())):\n\t(n,) = I()\n\ts = input()\n\t(a, b, c) = (s.count('<'), s.count('>'), s.count('-'))\n\tif a == 0 or b == 0:\n\t\tprint(n)\n\t\tcontinue\n\tans = 2 * c\n\tfor i in range(n):\n\t\tif s[i] == s[(i + 1) % n] and s[i] == '-':\n\t\t\tans -= 1\n\tprint(ans)\n", "T = int(input())\nfor _ in range(T):\n\tN = int(input())\n\tS = input()\n\tsnake = [False] * N\n\tclock = 0\n\tanticlock = 0\n\tfor i in range(N):\n\t\tif S[i] == '-':\n\t\t\tsnake[i] = True\n\t\t\tsnake[(i + 1) % N] = True\n\t\telif S[i] == '>':\n\t\t\tclock += 1\n\t\telse:\n\t\t\tanticlock += 1\n\tif clock == 0 or anticlock == 0:\n\t\tans = N\n\telse:\n\t\tans = sum(snake)\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\tbelts = list(input())\n\tclock = 0\n\tanti = 0\n\tboth = 0\n\tcnt = 0\n\tflag = False\n\tif belts[-1] == '-':\n\t\tflag = True\n\tfor belt in belts:\n\t\tif belt == '>':\n\t\t\tclock += 1\n\t\t\tanti = 0\n\t\t\tflag = False\n\t\telif belt == '<':\n\t\t\tanti += 1\n\t\t\tclock = 0\n\t\t\tflag = False\n\t\telse:\n\t\t\tif flag:\n\t\t\t\tcnt += 1\n\t\t\telse:\n\t\t\t\tcnt += 2\n\t\t\tboth += 1\n\t\t\tflag = True\n\tif anti + clock + both == n:\n\t\tprint(n)\n\telse:\n\t\tprint(cnt)\n", "import math, sys, os\nfrom collections import defaultdict, deque, OrderedDict, Counter\nimport bisect as bi\nfrom io import BytesIO, IOBase\nmod = 10 ** 9 + 7\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\ndef minp():\n\treturn map(int, sys.stdin.readline().rstrip().split())\n\ndef linp():\n\treturn list(map(int, sys.stdin.readline().rstrip().split()))\n\ndef inp():\n\treturn int(input())\n\ndef print_list(l):\n\tprint(' '.join(map(str, l)))\n\ndef BinarySearch(a, x):\n\ti = bi.bisect_left(a, x)\n\tif i != len(a) and a[i] == x:\n\t\treturn i\n\telse:\n\t\treturn -1\n\ndef gcd(a, b):\n\treturn math.gcd(a, b)\n\ndef is_prime(n):\n\tif n < 5 or n & 1 == 0 or n % 3 == 0:\n\t\treturn 2 <= n <= 3\n\ts = (n - 1 & 1 - n).bit_length() - 1\n\td = n >> s\n\tfor a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:\n\t\tp = pow(a, d, n)\n\t\tif p == 1 or p == n - 1 or a % n == 0:\n\t\t\tcontinue\n\t\tfor _ in range(s):\n\t\t\tp = p * p % n\n\t\t\tif p == n - 1:\n\t\t\t\tbreak\n\t\telse:\n\t\t\treturn False\n\treturn True\n\ndef mulinverse(a):\n\treturn pow(a, mod - 2, mod)\nfor _ in range(inp()):\n\tn = inp()\n\ts = input()\n\tflag = 0\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tflag = 1\n\t\t\tbreak\n\tif flag == 0:\n\t\tprint(n)\n\t\tcontinue\n\tflag = 0\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tflag = 1\n\t\t\tbreak\n\tif flag == 0:\n\t\tprint(n)\n\t\tcontinue\n\ttotal_un = 0\n\tfor i in range(n):\n\t\tif i == 0:\n\t\t\tif s[i] == '-' or s[n - 1] == '-':\n\t\t\t\ttotal_un += 1\n\t\telif s[i] == '-' or s[i - 1] == '-':\n\t\t\ttotal_un += 1\n\tprint(total_un)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\tL = input()\n\ts = 0\n\tS = 0\n\ttot = 0\n\tfor i in L:\n\t\tif i == '-' or i == '<':\n\t\t\ts += 1\n\t\tif i == '-' or i == '>':\n\t\t\tS += 1\n\tif s == n or S == n:\n\t\tprint(n)\n\telse:\n\t\tfor i in range(n):\n\t\t\tif L[i] == '-' or L[i - 1] == '-':\n\t\t\t\ttot += 1\n\t\tprint(tot)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nimport math\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tc1 = 0\n\tc2 = 0\n\tc3 = 0\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tc1 += 1\n\t\telif s[i] == '<':\n\t\t\tc2 += 1\n\t\telse:\n\t\t\tc3 += 1\n\tif c2 == 0 or c3 == 0:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in range(1, n):\n\t\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tans += 1\n\t\t\telse:\n\t\t\t\tcontinue\n\t\tans += s[0] == '-' or s[n - 1] == '-'\n\t\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = [x for x in input()]\n\tk = []\n\tif '>' in s and '<' in s:\n\t\tfor (i, j) in enumerate(s):\n\t\t\tif j == '-':\n\t\t\t\tk.append(i)\n\t\t\t\tk.append((i + 1) % n)\n\t\tprint(len(set(k)))\n\telse:\n\t\tprint(n)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\tar = [str(j) for j in input()]\n\ta = 0\n\tb = 0\n\tc = 0\n\tcval = 0\n\tf = ar[0]\n\tboo = False\n\tfor x in range(n):\n\t\tif ar[x] == '<':\n\t\t\ta += 1\n\t\telif ar[x] == '>':\n\t\t\tb += 1\n\t\telse:\n\t\t\tc += 1\n\t\tif boo == True and x == n - 1 and (ar[x] == '-') and (f == '-'):\n\t\t\tcval += 0\n\t\telif boo == False and x == n - 1 and (ar[x] == '-') and (f == '-'):\n\t\t\tcval += 1\n\t\telif boo == False and ar[x] == '-':\n\t\t\tboo = True\n\t\t\tcval += 2\n\t\telif boo == True and ar[x] == '-':\n\t\t\tcval += 1\n\t\telse:\n\t\t\tboo = False\n\tif a == 0 or b == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(cval)\n", "t = int(input())\nfor x in range(t):\n\tn = int(input())\n\ts = input()\n\ts = s[-1] + s[:]\n\tcount = 0\n\tstat = [1] * n\n\tif len(set(s)) == 1:\n\t\tprint(n)\n\t\tcontinue\n\tif len(set(s)) == 2 and '-' in set(s):\n\t\tprint(n)\n\t\tcontinue\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\tcount += 1\n\t\t\tcontinue\n\t\tif s[i] == '>' and s[i + 1] == '<' or (s[i] == '<' and s[i + 1] == '>'):\n\t\t\tstat[i] = 0\n\t\t\tcontinue\n\t\tif i >= 1 and stat[i - 1] == 0:\n\t\t\tstat[i] = 0\n\tprint(count)\n", "import sys\nread = sys.stdin.read\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tn = int(input())\n\t\ts = list(input())\n\t\tif s.count('<') + s.count('-') == n or s.count('>') + s.count('-') == n:\n\t\t\tprint(n)\n\t\telse:\n\t\t\ts = list(s[-1]) + s\n\t\t\tans = n\n\t\t\tfor i1 in range(n):\n\t\t\t\tans -= s[i1] != '-' and s[i1 + 1] != '-'\n\t\t\tprint(ans)\nmain()\n", "import sys\ninput = sys.stdin.readline\nfor _ in range(int(input())):\n\tN = int(input())\n\tS = list(input())[:-1]\n\tl = S.count('<')\n\tr = S.count('>')\n\tm = N - l - r\n\tif l == 0 or r == 0:\n\t\tprint(N)\n\t\tcontinue\n\tres = 0\n\tfor i in range(N):\n\t\tres += S[i] == '-' or S[(i + 1) % N] == '-'\n\tprint(res)\n", "from collections import Counter\nimport math\nimport sys\nfrom bisect import bisect, bisect_left, bisect_right\n\ndef input():\n\treturn sys.stdin.readline().strip()\n\ndef INT():\n\treturn int(input())\n\ndef MAP():\n\treturn map(int, input().split())\n\ndef LIST(N=None):\n\treturn list(MAP()) if N is None else [INT() for i in range(N)]\n\ndef mod():\n\treturn 10 ** 9 + 7\nfor i in range(INT()):\n\tn = INT()\n\ts = input()\n\tf1 = 0\n\tf2 = 0\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tf1 += 1\n\t\telif s[i] == '<':\n\t\t\tf2 += 1\n\tif f1 > 0 and f2 > 0:\n\t\tcount = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tif s[(i + 1) % n] == '-':\n\t\t\t\t\tcount += 1\n\t\t\t\telse:\n\t\t\t\t\tcount += 2\n\t\tprint(count)\n\telse:\n\t\tprint(n)\n", "from sys import stdin\n\ndef main(n, belts):\n\taround = True\n\ttry:\n\t\tdirection = [b for b in belts if b != '-'][0]\n\texcept:\n\t\tprint(n)\n\t\treturn\n\treturnable = 0\n\tfor i in range(n):\n\t\tif around and belts[i] != '-' and (belts[i] != direction):\n\t\t\taround = False\n\t\tif belts[i] == '-' or belts[(i + 1) % n] == '-':\n\t\t\treturnable += 1\n\tif around:\n\t\tprint(n)\n\telse:\n\t\tprint(returnable)\nt = int(stdin.readline())\ncases = [(int(stdin.readline()), stdin.readline().rstrip()) for _ in range(t)]\nfor (n, belts) in cases:\n\tmain(n, belts)\n", "from collections import deque\nfrom collections import OrderedDict\nimport math\nimport sys\nimport os\nimport threading\nimport bisect\nimport operator\nimport heapq\nfrom atexit import register\nfrom io import BytesIO\nimport io\nfrom sys import stdin, stdout\nimport os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tsetR = set()\n\tfor i in range(n):\n\t\tsetR.add(s[i])\n\tif len(setR) == 1:\n\t\tprint(n)\n\t\tcontinue\n\telif len(setR) == 2 and '-' in setR:\n\t\tprint(n)\n\t\tcontinue\n\tanswer = 0\n\tif s[0] == '-':\n\t\tanswer += 2\n\tfor i in range(1, n - 1):\n\t\tif s[i] == '-':\n\t\t\tif s[i - 1] == '-':\n\t\t\t\tanswer += 1\n\t\t\telse:\n\t\t\t\tanswer += 2\n\tif s[n - 1] == '-':\n\t\tif s[0] == '-' and s[n - 2] != '-':\n\t\t\tanswer += 1\n\t\telif s[0] == '-' and s[n - 2] == '-':\n\t\t\tanswer += 0\n\t\telif s[n - 2] == '-':\n\t\t\tanswer += 1\n\t\telse:\n\t\t\tanswer += 2\n\tprint(answer)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tarr = [i for i in s]\n\tif len(set(arr)) == 1:\n\t\tprint(n)\n\t\tcontinue\n\tif '>' in s and '<' in s:\n\t\tsub = 0\n\t\tfor i in range(n):\n\t\t\tif s[i - 1] + s[i] in ['<>', '><', '>>', '<<']:\n\t\t\t\tsub += 1\n\t\tprint(n - sub)\n\telse:\n\t\tsub = 0\n\t\tfor i in range(n - 1):\n\t\t\tif s[i - 1] + s[i] in ['<>', '><']:\n\t\t\t\tsub += 1\n\t\tif s[n - 1] + s[0] == '<>' or s[n - 1] + s[0] == '><':\n\t\t\tsub += 1\n\t\tprint(n - sub)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ta = list(input())\n\tif '<' in a and '>' in a:\n\t\ta += a[0]\n\t\tc = 0\n\t\tfor i in range(n):\n\t\t\tif a[i] == '-' or a[i + 1] == '-':\n\t\t\t\tc += 1\n\t\tprint(c)\n\telse:\n\t\tprint(n)\n", "def solve(arr):\n\tn = len(arr)\n\tclockwise = '<' not in arr\n\taclockwise = '>' not in arr\n\tif clockwise or aclockwise:\n\t\treturn n\n\tcnt = 0\n\tfor i in range(n):\n\t\tif '-' in (arr[i], arr[(i + 1) % n]):\n\t\t\tcnt += 1\n\treturn cnt\nfor _ in range(int(input())):\n\tn = int(input())\n\tarr = input()\n\tprint(solve(arr))\n", "def func():\n\tcount_clock = sum((1 for x in range(n) if st[x] == '>'))\n\tcount_anti = sum((1 for x in range(n) if st[x] == '<'))\n\tif count_anti == 0 or count_clock == 0:\n\t\tprint(n)\n\t\treturn\n\tnew_st = list(st)\n\tcount_off = 0\n\tfor i in range(n):\n\t\tif new_st[i] == '-' or new_st[(i + 1) % n] == '-':\n\t\t\tcount_off += 1\n\tprint(count_off)\nfor _ in range(int(input())):\n\tn = int(input())\n\tst = input()\n\tfunc()\n", "from sys import stdin, stdout\n\nclass SOLVE:\n\n\tdef solve(self):\n\t\tR = stdin.readline\n\t\tW = stdout.write\n\t\tans = []\n\t\tfor i in range(int(R())):\n\t\t\tn = int(R())\n\t\t\ts = R()\n\t\t\tcw = s.count('>')\n\t\t\tccw = s.count('<')\n\t\t\tboth = s.count('-')\n\t\t\tif cw + both == n or ccw + both == n:\n\t\t\t\tans.append(str(n))\n\t\t\telse:\n\t\t\t\tcheck = {}\n\t\t\t\tfor j in range(n):\n\t\t\t\t\t(u, v) = (j, (j + 1) % n)\n\t\t\t\t\tif s[u] == '-':\n\t\t\t\t\t\tcheck[u] = check[v] = True\n\t\t\t\tans.append(str(len(check)))\n\t\tW('\\n'.join(ans))\n\t\treturn 0\n\ndef main():\n\ts = SOLVE()\n\ts.solve()\nmain()\n", "t = int(input())\nwhile t:\n\tt -= 1\n\tn = int(input())\n\ta = input()\n\tans = [0 for i in range(n)]\n\tfor i in range(n):\n\t\tif a[i] == '-':\n\t\t\tans[i] = 1\n\t\t\tans[(i + 1) % n] = 1\n\td1 = 0\n\td2 = 0\n\tfor i in range(n):\n\t\tif a[i] == '>':\n\t\t\td1 += 1\n\t\telif a[i] == '<':\n\t\t\td2 += 1\n\tres = sum(ans)\n\tif min(d1, d2) == 0:\n\t\tres = n\n\tprint(res)\n", "import sys\nimport math\nimport os\nimport itertools\nimport string\nimport heapq\nimport _collections\nfrom collections import Counter\nfrom collections import defaultdict\nfrom collections import deque\nfrom functools import lru_cache\nimport bisect\nimport re\nimport queue\nimport copy\nimport decimal\n\nclass Scanner:\n\n\t@staticmethod\n\tdef int():\n\t\treturn int(sys.stdin.readline().rstrip())\n\n\t@staticmethod\n\tdef string():\n\t\treturn sys.stdin.readline().rstrip()\n\n\t@staticmethod\n\tdef map_int():\n\t\treturn [int(x) for x in Scanner.string().split()]\n\n\t@staticmethod\n\tdef string_list(n):\n\t\treturn [Scanner.string() for i in range(n)]\n\n\t@staticmethod\n\tdef int_list_list(n):\n\t\treturn [Scanner.map_int() for i in range(n)]\n\n\t@staticmethod\n\tdef int_cols_list(n):\n\t\treturn [Scanner.int() for i in range(n)]\n\ndef solve():\n\tn = Scanner.int()\n\ts = Scanner.string()\n\tans = 0\n\tleft_loop = True\n\tright_loop = True\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tleft_loop = False\n\t\tif s[i] == '<':\n\t\t\tright_loop = False\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i - 1 + n) % n] == '-':\n\t\t\tans += 1\n\t\telif left_loop or right_loop:\n\t\t\tans += 1\n\tprint(ans)\n\ndef main():\n\tT = Scanner.int()\n\tfor _ in range(T):\n\t\tsolve()\nmain()\n", "t = int(input())\nwhile t:\n\ta = int(input())\n\ts = input()\n\tc = 0\n\taq = 0\n\tq = s.replace('-', '')\n\tc = len(s) - len(q)\n\tif len(list(set(s))) == 2 and '-' in set(s):\n\t\tprint(len(s))\n\t\tt -= 1\n\t\tcontinue\n\tif s[0] == '-' and s[-1] == '-' and (len(list(set(s))) != 1):\n\t\taq = 1\n\ts = s.replace('<', '.')\n\ts = s.replace('>', '.')\n\ts = s.split('.')\n\ts = [x for x in s if x]\n\tif s:\n\t\tc += len(s) - 1 - aq\n\tk = True\n\ta = list(q)\n\ta = set(a)\n\tif len(a) == 2:\n\t\tk = False\n\tif len(a) == 1:\n\t\tk = True\n\tif k:\n\t\tc += len(q)\n\tif not k and c != 0:\n\t\tc += 1\n\tprint(c)\n\tt -= 1\n", "for _ in range(int(input())):\n\tr = int(input())\n\ts = input()\n\tif '<' in s and '>' not in s or ('>' in s and '<' not in s) or ('<' not in s and '>' not in s):\n\t\tprint(r)\n\telse:\n\t\tnum = 0\n\t\tchecked = [0] * r\n\t\tfor i in range(r):\n\t\t\tif s[i] == '-':\n\t\t\t\tif checked[i] == 1 and checked[(i + 1) % r] == 0 or (checked[i] == 0 and checked[(i + 1) % r] == 1):\n\t\t\t\t\tnum += 1\n\t\t\t\telif checked[i] == 0 and checked[(i + 1) % r] == 0:\n\t\t\t\t\tnum += 2\n\t\t\t\tchecked[i] = checked[(i + 1) % r] = 1\n\t\tprint(num)\n", "n = int(input())\nl = ['<', '>']\nll = []\nlinf = []\nlsup = []\nfor i in range(n):\n\tcinf = 0\n\tcsup = 0\n\ta = int(input())\n\tb = input()\n\tcmp = 0\n\tll.append(b[a - 1])\n\tfor j in range(a):\n\t\tll.append(0)\n\t\tll.append(b[j])\n\tfor k in range(len(ll)):\n\t\tif ll[k] == 0:\n\t\t\tif ll[k - 1] == '-' or ll[k + 1] == '-':\n\t\t\t\tcmp = cmp + 1\n\tfor m in range(a):\n\t\tif b[m] == '<':\n\t\t\tcinf = cinf + 1\n\t\telif b[m] == '>':\n\t\t\tcsup = csup + 1\n\tif cinf == 0 or csup == 0:\n\t\tprint(a)\n\telse:\n\t\tprint(cmp)\n\tll = []\n", "def main():\n\tn = int(input())\n\ts = input()\n\tn_return = 0\n\tif '<' not in s or '>' not in s:\n\t\tprint(n)\n\t\treturn\n\tfor i in range(n):\n\t\tif i == 0:\n\t\t\tif s[0] == '-' or s[-1] == '-':\n\t\t\t\tn_return += 1\n\t\telif i == n - 1:\n\t\t\tif s[-2] == '-' or s[-1] == '-':\n\t\t\t\tn_return += 1\n\t\telif s[i] == '-' or s[i - 1] == '-':\n\t\t\tn_return += 1\n\tprint(n_return)\nt = int(input())\nfor i in range(t):\n\tmain()\n", "import sys\ninput = sys.stdin.readline\nfrom collections import Counter\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = input().strip()\n\tc = Counter(s)\n\tif c['<'] == 0 or c['>'] == 0:\n\t\tprint(n)\n\telif c['-'] == 0 or c['-'] == n:\n\t\tprint(c['-'])\n\telse:\n\t\tstart = 0\n\t\twhile start < n and s[start] == '-':\n\t\t\tstart += 1\n\t\ti = start\n\t\tans = 0\n\t\tl = 0\n\t\twhile l < n:\n\t\t\tif s[i % n] == '-':\n\t\t\t\tcnt = 1\n\t\t\t\twhile l < n and s[(i + 1) % n] == '-':\n\t\t\t\t\ti += 1\n\t\t\t\t\tcnt += 1\n\t\t\t\t\tl += 1\n\t\t\t\tans += cnt + 1\n\t\t\ti += 1\n\t\t\tl += 1\n\t\tprint(ans)\n", "T = int(input())\nfor _ in range(0, T):\n\tn = int(input())\n\ts = input()\n\tc1 = 0\n\tc2 = 0\n\tfor i in range(0, len(s)):\n\t\tif s[i] == '>':\n\t\t\tc1 = 1\n\t\telif s[i] == '<':\n\t\t\tc2 = 1\n\tans = 0\n\tfor i in range(0, len(s)):\n\t\tt1 = s[i]\n\t\tt2 = s[(i + 1) % n]\n\t\tif t1 == '-' or t2 == '-':\n\t\t\tans += 1\n\t\telif t1 == '>' and t2 == '>':\n\t\t\tif c2 == 0:\n\t\t\t\tans += 1\n\t\telif t1 == '<' and t2 == '<':\n\t\t\tif c1 == 0:\n\t\t\t\tans += 1\n\tprint(ans)\n", "for __ in range(int(input())):\n\tn = int(input())\n\tar = list(input())\n\tans = set()\n\tkek1 = set()\n\tkek2 = set()\n\tflag1 = False\n\tflag2 = False\n\tfor i in range(n):\n\t\tif ar[i] == '-':\n\t\t\tans.add(i)\n\t\t\tans.add((i + 1) % n)\n\t\telif ar[i] == '>':\n\t\t\tkek1.add(i % n)\n\t\t\tflag2 = True\n\t\telse:\n\t\t\tkek2.add(i % n)\n\t\t\tflag1 = True\n\tif flag1 and flag2:\n\t\tprint(len(ans))\n\telif flag2 is False:\n\t\tans = ans.union(kek2)\n\t\tprint(len(ans))\n\telse:\n\t\tans = ans.union(kek1)\n\t\tprint(len(ans))\n", "def snake():\n\tn = int(input())\n\ts = input()\n\thasCW = 0\n\thasCCW = 0\n\tfor c in s:\n\t\tif c == '>':\n\t\t\thasCW = 1\n\t\tif c == '<':\n\t\t\thasCCW = 1\n\tif hasCW == 1 and hasCCW == 1:\n\t\ts += s[0]\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\nt = int(input())\nfor i in range(t):\n\tsnake()\n", "t = int(input())\nwhile t:\n\tt -= 1\n\tleng = int(input())\n\tstri = input()\n\tsum = 0\n\tclock = '>' in stri\n\tantiClock = '<' in stri\n\tif clock and antiClock:\n\t\tfor (i, char) in enumerate(stri):\n\t\t\tif '-' == char or '-' == stri[i - 1]:\n\t\t\t\tsum += 1\n\telse:\n\t\tsum = leng\n\tprint(sum)\n", "import queue\n\ndef solve():\n\tn = int(input())\n\ts = str(input())\n\tlol_s = set(s)\n\tif len(lol_s) == 1 and lol_s == {'-'}:\n\t\tprint(n)\n\t\treturn\n\tif '>' in lol_s and '<' in lol_s:\n\t\tans = 0\n\t\ts += s[0]\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\nt = int(input())\nfor q in range(t):\n\tsolve()\n", "import sys\nimport math\n\ndef II():\n\treturn int(sys.stdin.readline())\n\ndef LI():\n\treturn list(map(int, sys.stdin.readline().split()))\n\ndef MI():\n\treturn map(int, sys.stdin.readline().split())\n\ndef SI():\n\treturn sys.stdin.readline().strip()\nt = II()\nfor q in range(t):\n\tn = II()\n\ts = list(SI())\n\tif '<' in s and '>' in s:\n\t\td = [0] * n\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\td[i] = 1\n\t\t\t\td[(i + 1) % n] = 1\n\t\tprint(d.count(1))\n\telse:\n\t\tprint(n)\n", "for _ in ' ' * int(input()):\n\ta = int(input())\n\tb = input()\n\tz = b.count('-')\n\tz1 = b.count('<')\n\tz2 = a - z - z1\n\tif z1 == 0 or z2 == 0:\n\t\tprint(a)\n\telse:\n\t\tans = 0\n\t\tfor i in range(1, a):\n\t\t\tif b[i - 1] == '-' or b[i] == '-':\n\t\t\t\tans += 1\n\t\tif b[-1] == '-' or b[0] == '-':\n\t\t\tans += 1\n\t\tprint(ans)\n", "for i in range(int(input())):\n\ta = int(input())\n\tb = input()\n\tc = 0\n\td = 0\n\te = 0\n\tf = True\n\tg = True\n\tfor i2 in range(a):\n\t\tif b[i2] == '-' or b[(a + i2 - 1) % a] == '-':\n\t\t\tc += 1\n\t\t\tif b[i2] == '>' or b[(a + i2 - 1) % a] == '>':\n\t\t\t\tf = False\n\t\t\telif b[i2] == '<' or b[(a + i2 - 1) % a] == '<':\n\t\t\t\tg = False\n\t\telif b[i2] == '>' and b[(a + i2 - 1) % a] == '>':\n\t\t\td += 1\n\t\t\tf = False\n\t\telif b[i2] == '<' and b[(a + i2 - 1) % a] == '<':\n\t\t\tg = False\n\t\t\te += 1\n\t\telse:\n\t\t\tf = False\n\t\t\tg = False\n\tif g:\n\t\tc += d\n\tif f:\n\t\tc += e\n\tprint(c)\n", "import sys\nfrom collections import defaultdict as dc\nimport math\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tx = dc(list)\n\tfor i in range(n):\n\t\tx[i].append(s[i])\n\t\tx[(i + 1) % n].append(s[i])\n\tc = 0\n\tf = [0] * n\n\tfor i in range(n):\n\t\tif '-' in x[i]:\n\t\t\tc += 1\n\tp = set(list(s))\n\tif len(p) == 1:\n\t\tprint(n)\n\telif len(p) == 2:\n\t\tif '-' in p and '>' in p or ('-' in p and '<' in p):\n\t\t\tprint(n)\n\t\telse:\n\t\t\tprint(c)\n\telse:\n\t\tprint(c)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tst = str(input())\n\tl = len(set(st))\n\tif l == 1 or (l == 2 and '-' in st):\n\t\tprint(n)\n\telif l == 2:\n\t\tprint(0)\n\telse:\n\t\tans = 0\n\t\tcons = 0\n\t\ti = 0\n\t\twhile i < n:\n\t\t\tif st[i] == '-':\n\t\t\t\tcons += 1\n\t\t\telse:\n\t\t\t\tif cons != 0:\n\t\t\t\t\tans += cons + 1\n\t\t\t\tcons = 0\n\t\t\ti += 1\n\t\tif cons != 0:\n\t\t\tans += cons + 1\n\t\tif st[0] == '-' and st[-1] == '-':\n\t\t\tans -= 1\n\t\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tf = [0] * n\n\tt1 = s.count('<')\n\tt2 = s.count('>')\n\tif t1 == 0 or t1 == n:\n\t\tprint(n)\n\telif t2 == 0 or t2 == n:\n\t\tprint(n)\n\telse:\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tf[i] = 1\n\t\t\t\tf[(i + 1) % n] = 1\n\t\tprint(f.count(1))\n", "t = int(input())\nfor t1 in range(0, t):\n\tn = int(input())\n\ts = input()\n\tf1 = False\n\tf2 = False\n\tfor c in s:\n\t\tif c == '>':\n\t\t\tf1 = True\n\t\tif c == '<':\n\t\t\tf2 = True\n\tif f1 and f2:\n\t\ts = s + s[0]\n\t\tans = 0\n\t\tfor i in range(0, n):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\ts1 = set(s)\n\tif len(s1) == 1:\n\t\tprint(n)\n\telif '>' in s and '<' in s and ('-' not in s):\n\t\tprint(0)\n\telif '<' not in s or '>' not in s:\n\t\tprint(n)\n\telse:\n\t\tc = 0\n\t\tfor i in range(len(s) - 1):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tc += 1\n\t\tif s[len(s) - 1] == '-' or s[0] == '-':\n\t\t\tc += 1\n\t\tprint(c)\n", "ans = []\nfor i in range(int(input())):\n\tn = int(input())\n\ts = list(input())\n\tif '>' in s and '<' in s:\n\t\ta = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\ta += 1\n\t\tans.append(a)\n\telse:\n\t\tans.append(n)\nprint('\\n'.join(map(str, ans)))\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tpath = input()\n\tl = 0\n\tr = 0\n\tres = []\n\tfor i in range(n):\n\t\tif path[i] == '-':\n\t\t\tres.append(i)\n\t\t\tres.append((i + 1) % n)\n\t\telif path[i] == '<':\n\t\t\tl += 1\n\t\telse:\n\t\t\tr += 1\n\tre = set(res)\n\tif l * r == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(len(re))\n", "import math\nfrom collections import *\nfrom functools import lru_cache\nimport bisect\nfrom itertools import *\nfrom heapq import *\ninf = float('inf')\nninf = -float('inf')\nip = input\nalpha = 'abcdefghijklmnopqrstuvwxyz'\n\ndef ipl():\n\treturn list(map(int, input().split()))\n\ndef ipn():\n\treturn int(input())\n\ndef ipf():\n\treturn float(input())\n\ndef solve():\n\tn = ipn()\n\ts = ip()\n\ti = 0\n\tcw = acw = False\n\twhile i < n:\n\t\tif s[i] == '>':\n\t\t\tcw = True\n\t\tif s[i] == '<':\n\t\t\tacw = True\n\t\ti += 1\n\tif cw and acw:\n\t\ts += s[0]\n\t\ti = c = 0\n\t\twhile i < n:\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tc += 1\n\t\t\ti += 1\n\t\tprint(c)\n\telse:\n\t\tprint(n)\nfor _ in range(int(input())):\n\tsolve()\n", "for T in range(int(input())):\n\tn = int(input())\n\ts = input()\n\ta = [0] * 2\n\tfor i in s:\n\t\tif i == '>':\n\t\t\ta[0] += 1\n\t\tif i == '<':\n\t\t\ta[1] += 1\n\tvalue = 0\n\tfor i in range(len(s)):\n\t\tif i == 0:\n\t\t\tif s[i] != '-' and s[-1] != '-':\n\t\t\t\tif a[0] == 0 and a[1] or (a[0] and a[1] == 0):\n\t\t\t\t\tvalue += 1\n\t\t\telse:\n\t\t\t\tvalue += 1\n\t\telif s[i] != '-' and s[i - 1] != '-':\n\t\t\tif a[0] == 0 and a[1] or (a[0] and a[1] == 0):\n\t\t\t\tvalue += 1\n\t\telse:\n\t\t\tvalue += 1\n\tprint(value)\n", "n = int(input())\nfor i in range(n):\n\tm = int(input())\n\ts = str(input())\n\ta = 0\n\tb = 0\n\tfor i in range(m):\n\t\tif s[i] == '<':\n\t\t\ta = 1\n\t\tif s[i] == '>':\n\t\t\tb = 1\n\tans = 0\n\tif a + b == 2:\n\t\tfor i in range(m - 1):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tif s[0] == '-' or s[m - 1] == '-':\n\t\t\tans += 1\n\telse:\n\t\tans = m\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tg = 0\n\tle = 0\n\tfor j in range(n):\n\t\tif s[j] == '>':\n\t\t\tg += 1\n\t\telif s[j] == '<':\n\t\t\tle += 1\n\tif min(g, le) == 0:\n\t\tprint(n)\n\telse:\n\t\tcnt = 0\n\t\tfor j in range(n):\n\t\t\tif s[j] == '-':\n\t\t\t\tcnt += 1\n\t\t\telif s[j] == '>':\n\t\t\t\tif s[(j - 1 + n) % n] == '-':\n\t\t\t\t\tcnt += 1\n\t\t\telif s[(j - 1 + n) % n] == '-':\n\t\t\t\tcnt += 1\n\t\tprint(cnt)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tf = [0 for i in range(n)]\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tf[i] = 1\n\t\t\tf[(i + 1) % n] = 1\n\t(a, b) = (0, 0)\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\ta = a + 1\n\t\telif s[i] == '<':\n\t\t\tb = b + 1\n\tif a == 0 and b > 0:\n\t\tprint(n)\n\telif b == 0 and a > 0:\n\t\tprint(n)\n\telif a == 0 and b == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(f.count(1))\n", "def solve():\n\tn = int(input())\n\ts = input()\n\tk = '-'\n\ttr = True\n\tfor i in s:\n\t\tif k == '-' and i != '-':\n\t\t\tk = i\n\t\tif i != '-' and k != i:\n\t\t\ttr = False\n\tif tr:\n\t\tprint(n)\n\t\treturn 0\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tans += 1\n\tprint(ans)\nfor i in range(int(input())):\n\tsolve()\n", "t = int(input())\nwhile t:\n\tt -= 1\n\tn = int(input())\n\ts = input()\n\tk = list(set(s))\n\tif len(k) == 1:\n\t\tprint(n)\n\telif len(k) == 2:\n\t\tif '>' in k and '<' in k:\n\t\t\tprint(0)\n\t\telse:\n\t\t\tprint(n)\n\telse:\n\t\ts += s[0]\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tans = 0\n\tif n <= 1:\n\t\tprint(n)\n\t\tcontinue\n\tr = [False] * n\n\t(clockwise, anticlockwise) = (0, 0)\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tr[i] = True\n\t\t\tr[(i + 1) % n] = True\n\t\telif s[i] == '>':\n\t\t\tclockwise += 1\n\t\telse:\n\t\t\tanticlockwise += 1\n\tif clockwise == 0 or anticlockwise == 0:\n\t\tprint(n)\n\t\tcontinue\n\tfor i in range(n):\n\t\tif r[i]:\n\t\t\tans += 1\n\tprint(ans)\n", "import math\n\ndef is_cycle(s):\n\tflag = 0\n\tfor i in s:\n\t\tif i == '>' or i == '-':\n\t\t\tcontinue\n\t\telse:\n\t\t\tflag = 1\n\tif flag == 0:\n\t\treturn True\n\tflag = 0\n\tfor i in s:\n\t\tif i == '<' or i == '-':\n\t\t\tcontinue\n\t\telse:\n\t\t\tflag = 1\n\tif flag == 0:\n\t\treturn True\n\treturn False\n\ndef process():\n\tn = int(input())\n\ts = list(input())\n\tif is_cycle(s):\n\t\treturn n\n\telse:\n\t\tdirections = set()\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tdirections.add((i, (i + 1) % n))\n\t\t\t\tdirections.add(((i + 1) % n, i))\n\t\t\telif s[i] == '>':\n\t\t\t\tdirections.add((i, (i + 1) % n))\n\t\t\telse:\n\t\t\t\tdirections.add(((i + 1) % n, i))\n\t\tres = set()\n\t\tfor i in directions:\n\t\t\tif (i[1], i[0]) in directions:\n\t\t\t\tres.add(i[0])\n\t\t\t\tres.add(i[1])\n\t\treturn len(res)\ntests = int(input())\nfor i in range(tests):\n\tprint(process())\n", "t = int(input())\nbuf = []\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tif '<' not in s or '>' not in s:\n\t\tbuf.append(n)\n\t\tcontinue\n\ts += s[0]\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\tans += 1\n\tbuf.append(ans)\nprint('\\n'.join(map(str, buf)))\n", "from bisect import *\nfrom collections import *\nfrom math import *\nfrom heapq import *\nfrom typing import List\nfrom itertools import *\nfrom operator import *\nfrom functools import *\nimport os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\ndef RL():\n\treturn map(int, sys.stdin.readline().rstrip().split())\n\ndef RLL():\n\treturn list(map(int, sys.stdin.readline().rstrip().split()))\n\ndef N():\n\treturn int(input())\n\n@lru_cache(None)\ndef fact(x):\n\tif x < 2:\n\t\treturn 1\n\treturn fact(x - 1) * x\n\n@lru_cache(None)\ndef per(i, j):\n\treturn fact(i) // fact(i - j)\n\n@lru_cache(None)\ndef com(i, j):\n\treturn per(i, j) // fact(j)\n\ndef linc(f, t, l, r):\n\twhile l < r:\n\t\tmid = (l + r) // 2\n\t\tif t > f(mid):\n\t\t\tl = mid + 1\n\t\telse:\n\t\t\tr = mid\n\treturn l\n\ndef rinc(f, t, l, r):\n\twhile l < r:\n\t\tmid = (l + r + 1) // 2\n\t\tif t < f(mid):\n\t\t\tr = mid - 1\n\t\telse:\n\t\t\tl = mid\n\treturn l\n\ndef ldec(f, t, l, r):\n\twhile l < r:\n\t\tmid = (l + r) // 2\n\t\tif t < f(mid):\n\t\t\tl = mid + 1\n\t\telse:\n\t\t\tr = mid\n\treturn l\n\ndef rdec(f, t, l, r):\n\twhile l < r:\n\t\tmid = (l + r + 1) // 2\n\t\tif t > f(mid):\n\t\t\tr = mid - 1\n\t\telse:\n\t\t\tl = mid\n\treturn l\n\ndef isprime(n):\n\tfor i in range(2, int(n ** 0.5) + 1):\n\t\tif n % i == 0:\n\t\t\treturn False\n\treturn True\n\ndef binfun(x):\n\tc = 1\n\tres = 0\n\tfor w in arr:\n\t\tres += w\n\t\tif res > x:\n\t\t\tres = w\n\t\tc += 1\n\treturn c\n\ndef lowbit(n):\n\treturn n & -n\n\nclass BIT:\n\n\tdef __init__(self, arr):\n\t\tself.arr = arr\n\t\tself.n = len(arr) - 1\n\n\tdef update(self, x, v):\n\t\twhile x <= self.n:\n\t\t\tself.arr[x] += v\n\t\t\tx += x & -x\n\n\tdef query(self, x):\n\t\tans = 0\n\t\twhile x:\n\t\t\tans += self.arr[x]\n\t\t\tx &= x - 1\n\t\treturn ans\n\nclass smt:\n\n\tdef __init__(self, l, r, arr):\n\t\tself.l = l\n\t\tself.r = r\n\t\tself.value = (1 << 31) - 1 if l < r else arr[l]\n\t\tmid = (l + r) // 2\n\t\tif l < r:\n\t\t\tself.left = smt(l, mid, arr)\n\t\t\tself.right = smt(mid + 1, r, arr)\n\t\t\tself.value &= self.left.value & self.right.value\n\n\tdef setvalue(self, x, val):\n\t\tif self.l == self.r:\n\t\t\tself.value = val\n\t\t\treturn\n\t\tmid = (self.l + self.r) // 2\n\t\tif x <= mid:\n\t\t\tself.left.setvalue(x, val)\n\t\telse:\n\t\t\tself.right.setvalue(x, val)\n\t\tself.value = self.left.value & self.right.value\n\n\tdef ask(self, l, r):\n\t\tif l <= self.l and r >= self.r:\n\t\t\treturn self.value\n\t\tval = (1 << 31) - 1\n\t\tmid = (self.l + self.r) // 2\n\t\tif l <= mid:\n\t\t\tval &= self.left.ask(l, r)\n\t\tif r > mid:\n\t\t\tval &= self.right.ask(l, r)\n\t\treturn val\n\nclass UFS:\n\n\tdef __init__(self, n):\n\t\tself.parent = [i for i in range(n)]\n\t\tself.ranks = [0] * n\n\n\tdef find(self, x):\n\t\tif x != self.parent[x]:\n\t\t\tself.parent[x] = self.find(self.parent[x])\n\t\treturn self.parent[x]\n\n\tdef union(self, u, v):\n\t\t(pu, pv) = (self.find(u), self.find(v))\n\t\tif pu == pv:\n\t\t\treturn False\n\t\tif self.ranks[pu] >= self.ranks[pv]:\n\t\t\tself.parent[pv] = pu\n\t\t\tif self.ranks[pv] == self.ranks[pu]:\n\t\t\t\tself.ranks[pu] += 1\n\t\telse:\n\t\t\tself.parent[pu] = pv\n\ndef Prime(n):\n\tc = 0\n\tprime = []\n\tflag = [0] * (n + 1)\n\tfor i in range(2, n + 1):\n\t\tif not flag[i]:\n\t\t\tprime.append(i)\n\t\t\tc += 1\n\t\tfor j in range(c):\n\t\t\tif i * prime[j] > n:\n\t\t\t\tbreak\n\t\t\tflag[i * prime[j]] = prime[j]\n\t\t\tif i % prime[j] == 0:\n\t\t\t\tbreak\n\treturn prime\n\ndef dij(s, graph):\n\td = {}\n\td[s] = 0\n\theap = [(0, s)]\n\tseen = set()\n\twhile heap:\n\t\t(dis, u) = heappop(heap)\n\t\tif u in seen:\n\t\t\tcontinue\n\t\tfor v in graph[u]:\n\t\t\tif v not in d or d[v] > d[u] + graph[u][v]:\n\t\t\t\td[v] = d[u] + graph[u][v]\n\t\t\t\theappush(heap, (d[v], v))\n\treturn d\nt = N()\nfor i in range(t):\n\tn = N()\n\ts = input()\n\tflag = True\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tflag = False\n\t\t\tbreak\n\tif not flag:\n\t\tflag = True\n\t\tfor i in range(n):\n\t\t\tif s[i] == '>':\n\t\t\t\tflag = False\n\t\t\t\tbreak\n\tif flag:\n\t\tans = n\n\telse:\n\t\tres = [False] * n\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tres[i] = res[(i + 1) % n] = True\n\t\tans = sum(res)\n\tprint(ans)\n", "def solve(s, n):\n\tcount = 0\n\tused = set()\n\tprev = '0'\n\tfor (i, c) in enumerate(s):\n\t\tif c == '-' or prev == '-' or (i == 0 and s[len(s) - 1] == '-'):\n\t\t\tcount += 1\n\t\tif c != '-':\n\t\t\tused.add(c)\n\t\tprev = c\n\treturn n if len(used) == 1 else count\n\ndef main(input_path=0):\n\twith open(input_path) as f:\n\t\tt = int(f.readline())\n\t\tfor _ in range(t):\n\t\t\tn = int(f.readline())\n\t\t\ts = f.readline().strip()\n\t\t\tprint(solve(s, n))\nmain()\n", "import bisect\nimport collections\nimport copy\nimport functools\nimport heapq\nimport itertools\nimport math\nimport random\nimport re\nimport sys\nimport time\nimport string\nsys.setrecursionlimit(99999)\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tl = r = ans = 0\n\tfor (i, c) in enumerate(s):\n\t\tif c == '-' or s[(i + 1) % n] == '-':\n\t\t\tans += 1\n\t\tif c == '<':\n\t\t\tl += 1\n\t\tif c == '>':\n\t\t\tr += 1\n\tif l == 0 or r == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(ans)\n", "def solve():\n\tn = int(input())\n\ts = input()\n\tif '<' not in s or '>' not in s:\n\t\tprint(n)\n\t\treturn\n\tres = 0\n\tfor i in range(n - 1):\n\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\tres += 1\n\tif s[0] == '-' or s[-1] == '-':\n\t\tres += 1\n\tprint(res)\nt = int(input())\nfor _ in range(t):\n\tsolve()\n", "t = int(input())\nq = []\nfor i in range(t):\n\tn = int(input())\n\tstring = list(input())\n\tstring_set = set(string)\n\tif len(string_set) == 1:\n\t\tq.append(n)\n\telif string.count('<') + string.count('>') == n:\n\t\tq.append(0)\n\telif len(string_set) == 2:\n\t\tq.append(n)\n\telse:\n\t\tr = []\n\t\tfor (j, k) in enumerate(string):\n\t\t\tif k == '-':\n\t\t\t\tr.append(j)\n\t\t\t\tr.append((j + 1) % n)\n\t\tq.append(len(set(r)))\nfor i in q:\n\tprint(i)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tright = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i] == '>':\n\t\t\tright += 1\n\t\telse:\n\t\t\tbreak\n\tif right == n:\n\t\tprint(n)\n\telse:\n\t\tleft = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i] == '<':\n\t\t\t\tleft += 1\n\t\t\telse:\n\t\t\t\tbreak\n\t\tif left == n:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tseen = set()\n\t\t\tfor i in range(n):\n\t\t\t\tif s[i] == '-':\n\t\t\t\t\tseen.add((i + 1) % n)\n\t\t\t\t\tseen.add(i)\n\t\t\tprint(len(seen))\n", "from collections import deque, defaultdict\n\ndef solve():\n\tn = int(input())\n\ts = input()\n\tcl = ant = c = 0\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tcl += 1\n\t\telif s[i] == '<':\n\t\t\tant += 1\n\t\tif s[i] == '-' or s[(i - 1) % n] == '-':\n\t\t\tc += 1\n\tif cl == 0 or ant == 0:\n\t\tprint(len(s))\n\telse:\n\t\tprint(c)\n\ndef main():\n\tt = 1\n\tt = int(input())\n\tfor _ in range(t):\n\t\tsolve()\nmain()\n", "for _ in range(int(input())):\n\tlens = int(input())\n\tinps = input()\n\tif '>' in inps and '<' in inps:\n\t\tans = 0\n\t\tinps += inps[0]\n\t\tfor i in range(lens):\n\t\t\tif inps[i] == '-' or inps[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(lens)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\ndef RL():\n\treturn map(int, sys.stdin.readline().rstrip().split())\n\ndef RLL():\n\treturn list(map(int, sys.stdin.readline().rstrip().split()))\n\ndef N():\n\treturn int(input())\n\ndef print_list(l):\n\tprint(' '.join(map(str, l)))\nfor _ in range(N()):\n\tn = N()\n\ts = input()\n\tif '>' not in s or '<' not in s:\n\t\tprint(n)\n\telse:\n\t\tres = 0\n\t\tfor i in range(n - 1):\n\t\t\tif s[i] != '-' and s[i + 1] != '-':\n\t\t\t\tres += 1\n\t\tif s[0] != '-' and s[-1] != '-':\n\t\t\tres += 1\n\t\tprint(n - res)\n", "t = int(input())\nfor e in range(t):\n\tn = int(input())\n\ts = input()\n\tif s.count('>') == 0 or s.count('<') == 0:\n\t\tprint(n)\n\telse:\n\t\tc = 0\n\t\tfor i in range(n):\n\t\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\t\tc += 1\n\t\tprint(c)\n", "import sys\n\ndef rs():\n\treturn sys.stdin.readline().rstrip()\n\ndef ri():\n\treturn int(sys.stdin.readline())\n\ndef ria():\n\treturn list(map(int, sys.stdin.readline().split()))\n\ndef ws(s):\n\tsys.stdout.write(s + '\\n')\n\ndef wi(n):\n\tsys.stdout.write(str(n) + '\\n')\n\ndef wia(a):\n\tsys.stdout.write(' '.join([str(x) for x in a]) + '\\n')\nimport math\nfrom collections import defaultdict\nfor _ in range(ri()):\n\tn = ri()\n\ts = rs()\n\tif '-' in s:\n\t\ta = s.replace('-', '')\n\telse:\n\t\ta = s\n\tx = 0\n\tif len(set(a)) == 1:\n\t\tx = 1\n\tif x:\n\t\twi(n)\n\telse:\n\t\tcnt = 0\n\t\tif s[0] == '-' or s[-1] == '-':\n\t\t\tcnt += 1\n\t\tfor i in range(n - 1):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tcnt += 1\n\t\t\telif x:\n\t\t\t\tcnt += 1\n\t\twi(cnt)\n", "for t__ in range(int(input())):\n\tn = int(input())\n\ta = input()\n\tb = set(a)\n\tif '>' in a and '<' in a:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif a[i] == '-' or a[i - 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\n", "for l in [*open(0)][2::2]:\n\tl = l.strip()\n\tif all((x in '->' for x in l)) or all((x in '<-' for x in l)):\n\t\tprint(len(l))\n\telse:\n\t\tprint(sum((l[x] == '-' or l[(x + 1) % len(l)] == '-' for x in range(len(l)))))\n", "import math\nt = int(input())\nfor w in range(t):\n\tn = int(input())\n\ts = input()\n\tc1 = s.count('-')\n\tc2 = s.count('<')\n\tc3 = s.count('>')\n\tif c3 + c1 == n:\n\t\tprint(n)\n\telif c2 + c1 == n:\n\t\tprint(n)\n\telse:\n\t\tc = 0\n\t\tfor i in range(n):\n\t\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\t\tc += 1\n\t\tprint(c)\n", "for _ in range(int(input())):\n\tN = int(input())\n\tdata = input()\n\tbidirection = [False] * N\n\tfor idx in range(N):\n\t\tif data[idx] == '-':\n\t\t\tbidirection[idx] = bidirection[(idx + 1) % N] = True\n\tpos = True\n\tfor idx in range(N):\n\t\tif data[idx] != '-' and data[idx] != '>':\n\t\t\tpos = False\n\t\t\tbreak\n\tif pos == False:\n\t\tpos = True\n\t\tfor idx in range(N)[::-1]:\n\t\t\tif data[idx] != '-' and data[idx] != '<':\n\t\t\t\tpos = False\n\t\t\t\tbreak\n\tif pos:\n\t\tprint(N)\n\telse:\n\t\tprint(sum(bidirection))\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tcount = 0\n\tif '>' in s and '<' not in s or ('<' in s and '>' not in s):\n\t\tcount = n\n\telif '-' in s:\n\t\tif s[0] == '-' or s[-1] == '-':\n\t\t\tcount += 1\n\t\tfor j in range(1, n):\n\t\t\tif s[j - 1] == '-' or s[j] == '-':\n\t\t\t\tcount += 1\n\tprint(count)\n", "import sys, os\nimport heapq, functools, collections\nimport math, random\nfrom collections import Counter, defaultdict\n\ndef solve_(strr):\n\tstrr = [chr(x) for x in strr]\n\tc = Counter(strr)\n\tif c['<'] == 0 or c['>'] == 0:\n\t\treturn len(strr)\n\tres = 0\n\tstrr.append(strr[0])\n\tfor (a, b) in zip(strr, strr[1:]):\n\t\tif a == '-' or b == '-':\n\t\t\tres += 1\n\treturn res\n\ndef console(*args):\n\tprint('\\x1b[36m', *args, '\\x1b[0m', file=sys.stderr)\n\tpass\nif os.path.exists('input.txt'):\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\n\n\tdef console(*args):\n\t\tpass\n\ndef solve(*args):\n\tconsole('----- solving ------')\n\tconsole(*args)\n\tconsole('----- ------- ------')\n\treturn solve_(*args)\nif True:\n\tinp = iter(sys.stdin.buffer.readlines())\n\tinput = lambda : next(inp)\nelse:\n\tinput = sys.stdin.buffer.readline\nfor case_num in range(int(input())):\n\t_ = input()\n\tstrr = input().strip()\n\tres = solve(strr)\n\tprint(res)\n", "import sys\nfrom math import ceil, floor, log2, sqrt\nGLOBALMAX = 0\nadj = [list() for i in range(10000)]\n\ndef readall():\n\treturn [int(x) for x in sys.stdin.read().split()]\n\ndef u():\n\treturn [int(i) for i in sys.stdin.readline().split()]\n\ndef primeCheck(x):\n\tif x == 2:\n\t\treturn True\n\tif x % 2 == 0:\n\t\treturn False\n\ti = 3\n\twhile i ** 2 <= x:\n\t\tif x % i == 0:\n\t\t\treturn False\n\t\ti += 2\n\treturn True\n\ndef adjDFS(nod, count=0):\n\tglobal GLOBALMAX\n\tcount += 1\n\tfor slave in adj[nod]:\n\t\tadjDFS(slave, count)\n\tGLOBALMAX = max(GLOBALMAX, count)\nfor _ in range(int(input())):\n\tthankgodforsets = set()\n\tn = int(input())\n\tdesc = input()\n\tclk = False\n\tanticlk = False\n\tfor i in range(n):\n\t\tif desc[i] == '-':\n\t\t\tthankgodforsets.add(i % n)\n\t\t\tthankgodforsets.add((i + 1) % n)\n\t\telif desc[i] == '<':\n\t\t\tanticlk = True\n\t\telif desc[i] == '>':\n\t\t\tclk = True\n\tif anticlk and clk:\n\t\tprint(len(thankgodforsets))\n\telse:\n\t\tprint(n)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = str(input())\n\tpo = True\n\tprotiv = True\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tpo = False\n\t\telif s[i] == '>':\n\t\t\tprotiv = False\n\tans = 0\n\tfor i in range(n):\n\t\tsi = s[i]\n\t\tsi1 = s[(i + 1) % n]\n\t\tif si == '-' or si1 == '-':\n\t\t\tans += 1\n\t\telif si == '>' and si1 == '>' and po:\n\t\t\tans += 1\n\t\telif si == '<' and si1 == '<' and protiv:\n\t\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tn_off = [x for x in s if x != '-']\n\tif len(set(n_off)) < 2:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor (index, x) in enumerate(s):\n\t\tif x != '-':\n\t\t\tcontinue\n\t\tif s[(index + 1) % n] == '-':\n\t\t\tans += 1\n\t\telse:\n\t\t\tans += 2\n\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ta = list(input())\n\tans = 0\n\tj = set(a)\n\tif '>' not in j or '<' not in j:\n\t\tprint(n)\n\telse:\n\t\tfor i in range(n):\n\t\t\tif a[i] == '-':\n\t\t\t\tans += 1\n\t\t\telif a[i] != '-' and a[i - 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\treturnable_rooms = 0\n\tn = int(input())\n\ts = input()\n\tflag = 0\n\tcircle = 1\n\tfor character in s:\n\t\tif character == '>':\n\t\t\tif flag == 0:\n\t\t\t\tflag = 1\n\t\t\tif flag == -1:\n\t\t\t\tcircle = 0\n\t\tif character == '<':\n\t\t\tif flag == 0:\n\t\t\t\tflag = -1\n\t\t\tif flag == 1:\n\t\t\t\tcircle = 0\n\tif circle == 0:\n\t\tfor character in range(0, len(s)):\n\t\t\tif s[character] == '-':\n\t\t\t\treturnable_rooms += 2\n\t\t\t\tif s[(character + 1) % n] == '-':\n\t\t\t\t\treturnable_rooms -= 1\n\telse:\n\t\treturnable_rooms = n\n\tprint(returnable_rooms)\n", "TC = int(input())\nfor ii in range(TC):\n\tmul = 0\n\tn = int(input())\n\ts = input()\n\tans = 0\n\tans1 = 0\n\tfor c in s:\n\t\tif c == '>':\n\t\t\tans = 1\n\t\tif c == '<':\n\t\t\tans1 = 1\n\tfor i in range(n):\n\t\ts += s[0]\n\t\tif ans == 1 and ans1 == 1:\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tmul += 1\n\t\telse:\n\t\t\tmul = n\n\tprint(mul)\n", "T = int(input())\nfor i in range(T):\n\tN = int(input())\n\tA = input()\n\n\tdef res(A, N):\n\t\tclock = False\n\t\taclock = False\n\t\tfor i in range(N):\n\t\t\tif A[i] == '>':\n\t\t\t\tclock = True\n\t\t\tif A[i] == '<':\n\t\t\t\taclock = True\n\t\tif clock and aclock:\n\t\t\tans = 0\n\t\t\tfor i in range(N):\n\t\t\t\tif A[i] == '-' or A[i - 1] == '-':\n\t\t\t\t\tans += 1\n\t\t\treturn ans\n\t\telse:\n\t\t\treturn N\n\tprint(res(A, N))\n", "import re\n\ndef main_func(x: str):\n\tdata = [x.count('>'), x.count('<'), x.count('-')]\n\tif not data[0] and data[1]:\n\t\treturn len(x)\n\tif data[0] and (not data[1]):\n\t\treturn len(x)\n\tl = re.split('[<,>]', x)\n\tif x[0] == x[-1] and x[0] == '-' and (len(l) > 1):\n\t\tl[0] = l[0] + l[-1]\n\t\tl.pop(-1)\n\tcounter = 0\n\tfor i in l:\n\t\tif len(i) != 0:\n\t\t\tcounter += len(i) + 1\n\treturn min(counter, len(x))\ntests = int(input())\nfor i in range(tests):\n\tr = input()\n\tx = input()\n\tprint(main_func(x))\n", "import sys\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = sys.stdin.readline().strip()\n\tp = set(s)\n\tif len(p) == 1:\n\t\tprint(n)\n\t\tcontinue\n\tif len(p) == 2 and '-' in p:\n\t\tprint(n)\n\t\tcontinue\n\tif len(p) == 2 and '-' not in p:\n\t\tprint(0)\n\t\tcontinue\n\tv = [0] * n\n\tfor j in range(n - 1):\n\t\tif s[j] == '-':\n\t\t\tv[j] = 1\n\t\t\tv[j + 1] = 1\n\tif s[n - 1] == '-':\n\t\tv[n - 1] = 1\n\t\tv[0] = 1\n\tprint(v.count(1))\n", "from collections import Counter, defaultdict\nI = lambda : int(input())\nM = lambda : map(int, input().split())\nLI = lambda : list(map(int, input().split()))\nfor _ in range(I()):\n\tn = I()\n\ts = input()\n\ta = [0] * n\n\tb = [0] * n\n\tc = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i] == '>':\n\t\t\tc += 1\n\t\ta[i] = c\n\tc = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i] == '<':\n\t\t\tc += 1\n\t\tb[i] = c\n\tans = 0\n\tfor i in range(n):\n\t\tif a[-1] == n or b[-1] == n:\n\t\t\tans += 1\n\t\telif s[i] == '-' or s[i - 1] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\td = list(input())\n\tans = 0\n\tp = set(d)\n\tflag = 0\n\tif len(p) <= 2:\n\t\tif '<' in p and '>' not in p:\n\t\t\tflag = 1\n\t\telif '<' not in p and '>' in p:\n\t\t\tflag = 1\n\tif flag == 1:\n\t\tans = n\n\telse:\n\t\tfor i in range(n):\n\t\t\tif d[i] == '-' or d[(i - 1) % n] == '-':\n\t\t\t\tans += 1\n\tprint(ans)\n", "def belt1():\n\tprint(n)\n\ndef belt2(summation):\n\tfor i in range(n - 1):\n\t\tif sss[i] == '-' or sss[i + 1] == '-':\n\t\t\tsummation += 1\n\treturn summation\nt = int(input())\nfor q in range(t):\n\tn = int(input())\n\tsss = input()\n\t(summation, f) = (0, 0)\n\tif '>' not in sss or '<' not in sss:\n\t\tf = 1\n\t\tif f == 1:\n\t\t\tbelt1()\n\telse:\n\t\tif sss[-1] == '-' or sss[0] == '-':\n\t\t\tsummation += 1\n\t\tbelt_final = belt2(summation)\n\t\tprint(belt_final)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\t(double, d, left, right) = (0, 0, 0, 0)\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\tdouble += 1\n\t\td += 1\n\t\tleft += s[i] == '>'\n\t\tright += s[i] == '<'\n\tif d + left == n or d + right == n:\n\t\tprint(n)\n\telse:\n\t\tprint(double)\n", "import math\nimport sys\nimport collections\nimport bisect\ninput = sys.stdin.readline\nflush = sys.stdout.flush\nreadint = lambda : int(input())\nreadintm = lambda : map(int, input().strip().split())\nreadintl = lambda : list(map(int, input().strip().split()))\nreadfloatm = lambda : map(float, input().strip().split())\nreadfloatl = lambda : list(map(float, input().strip().split()))\nreadstr = lambda : input().strip()\nreadstrl = lambda : list(input().strip())\njoin = lambda x, l: x.join(map(str, l))\nprint = lambda *x: sys.stdout.write(' '.join(map(str, x)) + '\\n')\nprintl = lambda l: sys.stdout.write(' '.join(map(str, l)) + '\\n')\nceil = lambda x, y: (x + y - 1) // y\nmod = 1000000007\n\ndef counter(l, r):\n\treturn (l == '-' or r == '-') or (l == r and other[l])\nfor _ in range(readint()):\n\tn = readint()\n\ts = readstrl()\n\tother = {'<': '>' not in s, '>': '<' not in s}\n\tcount = 0\n\tfor i in range(-1, len(s) - 1):\n\t\tcount += counter(s[i], s[i + 1])\n\tprint(count)\n", "(t, *inp) = open(0).read().split()\nans = []\nfor i in range(0, int(t) * 2, 2):\n\t(n, s) = (int(inp[i]), inp[i + 1])\n\tif '>' in s and '<' in s:\n\t\tans.append(sum((1 if s[i] == '-' or s[i - 1] == '-' else 0 for i in range(n))))\n\telse:\n\t\tans.append(n)\nprint(*ans, sep='\\n')\n", "test_cases = int(input())\nfor test_case in range(test_cases):\n\tn = int(input())\n\ts = input()\n\tz = 0\n\tx = 0\n\tans = 0\n\tfor i in s:\n\t\tif z == 1 and x == 1:\n\t\t\tbreak\n\t\telif i == '<':\n\t\t\tz = 1\n\t\telif i == '>':\n\t\t\tx = 1\n\tif z == 1 and x == 1:\n\t\ts += s[0]\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tf = False\n\tg = False\n\tfor c in s:\n\t\tif c == '<':\n\t\t\tf = True\n\t\t\tbreak\n\tif f:\n\t\tfor c in s:\n\t\t\tif c == '>':\n\t\t\t\tg = True\n\t\t\t\tbreak\n\tif g:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] != '-' and s[(i + 1) % n] != '-':\n\t\t\t\tans += 1\n\t\tprint(n - ans)\n\telse:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif '<' == s[i] and '>' == s[(i + 1) % n] or ('>' == s[i] and '<' == s[(i + 1) % n]):\n\t\t\t\tans += 1\n\t\tprint(n - ans)\n", "t = int(input())\nanswers = []\nfor _ in range(t):\n\tx = 0\n\tn = int(input())\n\ts = input()\n\tif '>' not in s or '<' not in s:\n\t\tx = n\n\telse:\n\t\tfor j in range(n):\n\t\t\tif s[j] == '-':\n\t\t\t\tx += 1\n\t\t\telif s[j - 1] == '-':\n\t\t\t\tx += 1\n\tanswers.append(x)\nfor i in range(t):\n\tprint(answers[i])\n", "from sys import stdin, stdout\nn = int(stdin.readline())\nfor i in range(n):\n\tn = int(stdin.readline())\n\tst = stdin.readline()[:-1]\n\tnoroom = 0\n\tcounter = 0\n\tcounter2 = 0\n\ti = 0\n\twhile i < len(st):\n\t\tif st[i] == '-':\n\t\t\tc = 0\n\t\t\twhile i < len(st) and st[i] == '-':\n\t\t\t\ti += 1\n\t\t\t\tc += 1\n\t\t\tnoroom += c + 1\n\t\telif st[i] == '>':\n\t\t\tcounter = 1\n\t\t\ti += 1\n\t\telse:\n\t\t\tcounter2 = 1\n\t\t\ti += 1\n\tif st[len(st) - 1] == '-' and st[0] == '-':\n\t\tnoroom -= 1\n\tif counter == 1 and counter2 == 0:\n\t\tnoroom = n\n\tnoroom1 = 0\n\tcounter1 = 0\n\tcounter2 = 0\n\ti = len(st) - 1\n\twhile i >= 0:\n\t\tif st[i] == '-':\n\t\t\tc = 0\n\t\t\twhile i >= 0 and st[i] == '-':\n\t\t\t\ti -= 1\n\t\t\t\tc += 1\n\t\t\tnoroom1 += c + 1\n\t\telif st[i] == '<':\n\t\t\tcounter1 = 1\n\t\t\ti -= 1\n\t\telse:\n\t\t\tcounter2 = 1\n\t\t\ti -= 1\n\tif st[len(st) - 1] == '-' and st[0] == '-':\n\t\tnoroom1 -= 1\n\tif counter1 == 1 and counter2 == 0:\n\t\tnoroom1 = n\n\tprint(max(noroom, noroom1))\n", "import sys, os.path\nfrom collections import *\nfrom copy import *\nimport math\nmod = 10 ** 9 + 7\nif os.path.exists('input.txt'):\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\nfor t in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif '>' not in s:\n\t\tprint(n)\n\telif '<' not in s:\n\t\tprint(n)\n\telif '-' not in s:\n\t\tprint(0)\n\telse:\n\t\tc = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '<' and s[(i + 1) % n] == '>':\n\t\t\t\tcontinue\n\t\t\telif s[i] == '>' and s[(i + 1) % n] == '<':\n\t\t\t\tcontinue\n\t\t\telif s[i] == '>' and s[(i + 1) % n] == '>':\n\t\t\t\tcontinue\n\t\t\telif s[i] == '<' and s[(i + 1) % n] == '<':\n\t\t\t\tcontinue\n\t\t\telse:\n\t\t\t\tc += 1\n\t\tprint(c)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tl = len(s)\n\tans = l\n\tar = [0] * l\n\t(a, b, c) = (0, 0, 0)\n\tx = 0\n\tfor i in range(l):\n\t\tif s[i] == '>':\n\t\t\ta += 1\n\t\telif s[i] == '<':\n\t\t\tb += 1\n\t\telse:\n\t\t\tc += 1\n\tif a == l or b == l or c == l:\n\t\tprint(l)\n\telif c == 0 and a * b != 0:\n\t\tprint(0)\n\telif c != 0 and a == 0 and (b != 0):\n\t\tprint(l)\n\telif c != 0 and a != 0 and (b == 0):\n\t\tprint(l)\n\telse:\n\t\tf = [0] * l\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tf[i] = 1\n\t\t\t\tf[(i + 1) % n] = 1\n\t\tprint(sum(f))\n", "def check_other(s):\n\tif s.count('>') >= 1 and s.count('<') >= 1:\n\t\treturn True\n\treturn False\n\ndef main():\n\tt = int(input())\n\tfor k in range(t):\n\t\t_ = int(input())\n\t\ts = input()\n\t\tif check_other(s):\n\t\t\ttotal = 2 * s.count('-')\n\t\t\tfor i in range(len(s)):\n\t\t\t\tif s[i] == s[(i + 1) % len(s)] and s[i] == '-':\n\t\t\t\t\ttotal -= 1\n\t\t\tprint(total)\n\t\telse:\n\t\t\tprint(len(s))\nmain()\n", "def solve():\n\tn = int(input())\n\ts = input()\n\tif '<' not in s:\n\t\tprint(n)\n\t\treturn\n\tif '>' not in s:\n\t\tprint(n)\n\t\treturn\n\tans = 0\n\ts += s[0]\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\tans += 1\n\tprint(ans)\nfor i in range(int(input())):\n\tsolve()\n", "from sys import stdin, stdout\nans = []\n\ndef main():\n\tn = int(stdin.readline())\n\tarr = list(stdin.readline())[:-1]\n\tcount = 0\n\thasCW = False\n\thasCCW = False\n\tfor c in arr:\n\t\tif c == '<':\n\t\t\thasCW = True\n\t\tif c == '>':\n\t\t\thasCCW = True\n\tif hasCW and hasCCW:\n\t\tarr += arr[0]\n\t\tfor i in range(n):\n\t\t\tif arr[i] == '-' or arr[i + 1] == '-':\n\t\t\t\tcount += 1\n\t\tans.append(str(count))\n\t\treturn\n\telse:\n\t\tans.append(str(n))\nfor _ in range(int(input())):\n\tmain()\nstdout.write('\\n'.join(ans))\n", "for t in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tbelt = [[] for i in range(n)]\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tbelt[i].append((i + 1) % n)\n\t\telif s[i] == '<':\n\t\t\tbelt[(i + 1) % n].append(i)\n\t\telif s[i] == '-':\n\t\t\tbelt[(i + 1) % n].append(i)\n\t\t\tbelt[i].append((i + 1) % n)\n\tdir = set(s)\n\tall = [{'-', '<'}, {'-', '>'}]\n\tif len(dir) == 1 or dir in all:\n\t\tprint(n)\n\t\tcontinue\n\trechable = [0] * n\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\trechable[i] = 1\n\t\t\trechable[(i + 1) % n] = 1\n\tprint(rechable.count(1))\n", "import math\nT = int(input())\nfor t in range(T):\n\tn = int(input())\n\ta = input()\n\td = False\n\tif a.count('>') == 0:\n\t\tprint(n)\n\t\tcontinue\n\tif a.count('<') == 0:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tif a[i] == '-' or a[i - 1] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nfor ii in range(t):\n\tn = int(input())\n\ts = input()\n\tfirst = 0\n\tsecond = 0\n\tfor i in s:\n\t\tif i == '>':\n\t\t\tfirst += 1\n\t\telif i == '<':\n\t\t\tsecond += 1\n\tif first == 0 or second == 0:\n\t\tprint(n)\n\telse:\n\t\tcnt = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tif s[i - 1] == '>' or s[i - 1] == '<':\n\t\t\t\t\tcnt += 2\n\t\t\t\telse:\n\t\t\t\t\tcnt += 1\n\t\tprint(cnt)\n", "from math import *\nfrom bisect import *\nfrom collections import *\nfrom random import *\nfrom decimal import *\nfrom itertools import *\nimport sys\ninput = sys.stdin.readline\n\ndef inp():\n\treturn int(input())\n\ndef st():\n\treturn input().rstrip('\\n')\n\ndef lis():\n\treturn list(map(int, input().split()))\n\ndef ma():\n\treturn map(int, input().split())\nt = inp()\nwhile t:\n\tt -= 1\n\tn = inp()\n\ts = st()\n\tif s.count('>') == 0 or s.count('<') == 0:\n\t\tprint(n)\n\t\tcontinue\n\telse:\n\t\tadd = 0\n\t\tfor i in range(n):\n\t\t\tif i == 0:\n\t\t\t\tif s[i] == '-' or s[-1] == '-':\n\t\t\t\t\tadd += 1\n\t\t\telif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tadd += 1\n\t\tprint(add)\n", "T = int(input())\nfor Tid in range(T):\n\tn = int(input())\n\ts = input()\n\tf0 = f1 = 1\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tf0 = 0\n\t\tif s[i] == '>':\n\t\t\tf1 = 0\n\tif f0 or f1:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tans = ans + 2\n\t\t\t\tif i != 0 and s[i - 1] == '-':\n\t\t\t\t\tans = ans - 1\n\t\tif s[0] == '-' and s[n - 1] == '-':\n\t\t\tans = ans - 1\n\t\tprint(ans)\n", "t = int(input())\nfor q in range(t):\n\ta = int(input())\n\ts = input()\n\tx = len(s)\n\tans = 0\n\tt = [True, True]\n\tcheat = [False, False]\n\tfor i in range(0, x):\n\t\tif i == 0 and s[i] == '-':\n\t\t\tcheat[0] = True\n\t\tif s[i] == '<':\n\t\t\tt[0] = False\n\t\t\tbreak\n\tfor j in range(x - 1, -1, -1):\n\t\tif j == x - 1 and s[j] == '-':\n\t\t\tcheat[1] = True\n\t\tif s[j] == '>':\n\t\t\tt[1] = False\n\t\t\tbreak\n\tif t.count(True) > 0 or cheat.count(True) > 0:\n\t\tans += 1\n\tcheat = [False, False]\n\tfor w in range(1, x):\n\t\tif s[w - 1] == '-':\n\t\t\tcheat[1] = True\n\t\tif s[w] == '-':\n\t\t\tcheat[0] = True\n\t\tif t.count(True) > 0 or cheat.count(True) > 0:\n\t\t\tans += 1\n\t\tcheat = [False, False]\n\tprint(ans)\n", "def Snakes(l, s):\n\thasCW = False\n\thasCCW = False\n\tfor i in range(l):\n\t\tif s[i] == '>':\n\t\t\thasCW = True\n\t\telif s[i] == '<':\n\t\t\thasCCW = True\n\tif hasCW and hasCCW:\n\t\ts = s + s[0]\n\t\tans = 0\n\t\tfor i in range(l):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\treturn ans\n\telse:\n\t\treturn l\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tprint(Snakes(n, s))\n", "for _ in range(int(input())):\n\tn = int(input())\n\ta = list(input().strip())\n\tres = 0\n\tvis = [0] * n\n\tout = [0] * n\n\tfrom collections import defaultdict\n\tgr = defaultdict(list)\n\tcnt = 0\n\tst = set()\n\tfor i in range(n):\n\t\tif a[i] == '-':\n\t\t\tst.add(i)\n\t\t\tst.add((i + 1) % n)\n\t\t\tcnt += 1\n\t\t\tvis[i] += 1\n\t\t\tout[i] += 1\n\t\t\tvis[(i + 1) % n] += 1\n\t\t\tout[(i + 1) % n] += 1\n\tres += len(st)\n\tcnt2 = cnt\n\tfor i in range(n):\n\t\tif a[i] == '>':\n\t\t\tcnt += 1\n\t\t\tvis[(i + 1) % n] += 1\n\t\t\tout[i] += 1\n\t\telif a[i] == '<':\n\t\t\tcnt2 += 1\n\t\t\tvis[i] += 1\n\t\t\tout[(i + 1) % n] += 1\n\tif cnt == n or cnt2 == n:\n\t\tres = n\n\tprint(res)\n", "def count_returnable(belts, N):\n\tbelt_set = set(belts)\n\tcyclic = belt_set in ({'-', '<'}, {'-', '>'}, {'<'}, {'>'})\n\tans = 0\n\tfor i in range(N):\n\t\t_prev = belts[(N + i - 1) % N]\n\t\t_next = belts[(N + i) % N]\n\t\tif _prev == '-' or _next == '-' or cyclic:\n\t\t\tans += 1\n\treturn ans\nT = int(input())\nfor t in range(T):\n\tN = int(input())\n\tbelts = list(input())\n\tprint(count_returnable(belts, N))\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nimport math\nimport bisect\nfrom collections import Counter\nimport bisect\nimport heapq as h\nfrom collections import defaultdict\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tcnt = 0\n\tp = 0\n\tf = 0\n\tfor i in range(n):\n\t\tif i == 0:\n\t\t\tif s[0] == '-' or s[-1] == '-':\n\t\t\t\tp += 1\n\t\telif s[i] == '-' or s[i - 1] == '-':\n\t\t\tp += 1\n\tif '<' in s and '>' in s:\n\t\tf = 1\n\tif f == 1:\n\t\tprint(p)\n\telse:\n\t\tprint(n)\n", "for t in range(int(input())):\n\tn = int(input())\n\tstring = input()\n\tb = []\n\tb[:0] = string\n\tif '<' in b:\n\t\tl_p = True\n\telse:\n\t\tl_p = False\n\tif '>' in b:\n\t\tr_p = True\n\telse:\n\t\tr_p = False\n\tcnt = len(b)\n\tfor i in range(len(b)):\n\t\tleft = b[i - 1]\n\t\tright = b[i]\n\t\tif left == '>' and right == '<' or (left == '<' and right == '>'):\n\t\t\tcnt -= 1\n\t\telif left == '>' and right == '>':\n\t\t\tif l_p:\n\t\t\t\tcnt -= 1\n\t\telif left == '<' and right == '<':\n\t\t\tif r_p:\n\t\t\t\tcnt -= 1\n\tprint(cnt)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tS = set(s)\n\tres = n\n\tfor i in range(n):\n\t\t(a, b) = (s[i - 1], s[i])\n\t\tif a == '<' and b == '>':\n\t\t\tres -= 1\n\t\tif a == '>' and b == '<':\n\t\t\tres -= 1\n\t\tif a == '>' and b == '>' and ('<' in S):\n\t\t\tres -= 1\n\t\tif a == '<' and b == '<' and ('>' in S):\n\t\t\tres -= 1\n\tprint(res)\n", "from collections import Counter\nt = int(input())\nfor _ in range(t):\n\tres = 0\n\tn = int(input())\n\tA = input()\n\tC = Counter(A)\n\tduplicates = 0\n\tfor (i, a) in enumerate(A):\n\t\tif a == A[i - 1] == '-':\n\t\t\tduplicates += 1\n\tif '<' in C and '>' in C:\n\t\tres = C['-'] * 2 - duplicates\n\telse:\n\t\tres = n\n\tprint(res)\n", "t = int(input())\nfor _ in range(t):\n\t(n, s, r) = (int(input()), input(), 0)\n\tif 0 in (s.count('>'), s.count('<')):\n\t\tprint(n)\n\t\tcontinue\n\tfor i in range(n):\n\t\tif '-' in (s[i], s[(i + 1) % n]):\n\t\t\tr += 1\n\tprint(r)\n", "try:\n\tt = int(input())\n\tfor i in range(t):\n\t\tn = int(input())\n\t\ts = input()\n\t\tl = []\n\t\tif '<' not in s:\n\t\t\tprint(n)\n\t\telif '>' not in s:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tfor i in range(n):\n\t\t\t\tif s[i] == '-':\n\t\t\t\t\tl.append(i % n)\n\t\t\t\t\tl.append((i + 1) % n)\n\t\t\ts1 = set(l)\n\t\t\tprint(len(s1))\nexcept:\n\tpass\n", "def main():\n\tn = int(input())\n\tline = input()\n\tcycle = False\n\tcan_be = True\n\tcan_be_left = True\n\tfor i in line:\n\t\tif i == '<':\n\t\t\tcan_be = False\n\t\tif i == '>':\n\t\t\tcan_be_left = False\n\tif can_be_left or can_be:\n\t\tcycle = True\n\tif cycle:\n\t\tprint(n)\n\telse:\n\t\tres = 0\n\t\tfor i in range(0, n):\n\t\t\tif line[(i - 1) % n] == '-' or line[i % n] == '-':\n\t\t\t\tres += 1\n\t\tprint(res)\nt = int(input())\nfor i in range(t):\n\tmain()\n", "l = []\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = list(input())\n\tcount = 0\n\tchange = 0\n\tflag = 0\n\ta = str()\n\tfor i in range(n):\n\t\tif flag == 0:\n\t\t\tif s[i] != '-':\n\t\t\t\tflag = 1\n\t\t\t\ta = s[i]\n\t\t\t\tcount = count + 1\n\t\telif flag == 1:\n\t\t\tif s[i] != '-':\n\t\t\t\tif a != s[i]:\n\t\t\t\t\tflag = 2\n\t\t\t\t\tcount = count + 1\n\t\t\t\telse:\n\t\t\t\t\tcount = count + 1\n\t\telif s[i] != '-':\n\t\t\tcount = count + 1\n\t\tif s[i] != '-' and s[(i + 1) % n] == '-':\n\t\t\tchange = change + 1\n\tif flag == 2:\n\t\tl.append(n - count + change)\n\telse:\n\t\tl.append(n)\nfor i in l:\n\tprint(i)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tss = [i for i in s]\n\tif len(list(set(ss))) == 1:\n\t\tprint(n)\n\telif len(list(set(ss))) == 2:\n\t\tif list(set(ss))[0] == '-' or list(set(ss))[1] == '-':\n\t\t\tprint(n)\n\t\telse:\n\t\t\tprint(0)\n\telse:\n\t\tisroom = [0 for i in range(n)]\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tisroom[i] = 1\n\t\t\t\tisroom[(i + 1) % n] = 1\n\t\tprint(sum(isroom))\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = [w for w in input()]\n\tans = 0\n\tx = set(s)\n\tcycle = False\n\tif '>' in x:\n\t\tif '<' in x:\n\t\t\tcycle = False\n\t\telse:\n\t\t\tcycle = True\n\telif '<' in x:\n\t\tif '>' in x:\n\t\t\tcycle = False\n\t\telse:\n\t\t\tcycle = True\n\tif cycle == True:\n\t\tans = n\n\telif n >= 2:\n\t\tif len(set(s)) == 1:\n\t\t\tans = n\n\t\telse:\n\t\t\tc = 0\n\t\t\ti = 0\n\t\t\twhile i < n - 1:\n\t\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\t\tc = c + 1\n\t\t\t\ti = i + 1\n\t\t\tif s[n - 1] == '-' or s[0] == '-':\n\t\t\t\tc = c + 1\n\t\t\tans = c\n\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif len(set(s)) == 1:\n\t\tprint(len(s))\n\telif len(set(s)) == 2:\n\t\tif '<' in set(s) and '-' in set(s):\n\t\t\tprint(len(s))\n\t\telif '>' in set(s) and '-' in set(s):\n\t\t\tprint(len(s))\n\t\telse:\n\t\t\tprint(0)\n\telse:\n\t\tans = 0\n\t\tfor i in range(len(s)):\n\t\t\tif i == 0 and s[len(s) - 1] == '-':\n\t\t\t\tans += 1\n\t\t\telif s[i] == '-':\n\t\t\t\tans += 1\n\t\t\telif i != 0:\n\t\t\t\tif s[i] != '-' and s[i - 1] == '-':\n\t\t\t\t\tans += 1\n\t\tprint(ans)\n", "from collections import Counter\n\ndef get_input():\n\treturn input().split()\n\ndef get_int_input():\n\treturn list(map(int, get_input()))\n\ndef C1428B(N, path):\n\tNON_RETURNABLE = False\n\treturnables = 0\n\tfor i in range(N):\n\t\tcounter = Counter([path[i - 1], path[i]])\n\t\tif '<' in counter and '>' in counter:\n\t\t\tNON_RETURNABLE = True\n\t\telif '-' in counter:\n\t\t\treturnables += 1\n\tif not NON_RETURNABLE and len(Counter(path)) < 3:\n\t\treturn N\n\telse:\n\t\treturn returnables\n\ndef main():\n\t(T,) = get_int_input()\n\tfor _ in range(T):\n\t\t(N,) = get_int_input()\n\t\tpath = input()\n\t\tprint(C1428B(N, path))\nmain()\n", "import math\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tcount = n\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tif s[i - 1] == s[i]:\n\t\t\t\tif '<' in s:\n\t\t\t\t\tcount -= 1\n\t\t\telif s[i - 1] == '<':\n\t\t\t\tcount -= 1\n\t\telif s[i] == '<':\n\t\t\tif s[i - 1] == s[i]:\n\t\t\t\tif '>' in s:\n\t\t\t\t\tcount -= 1\n\t\t\telif s[i - 1] == '>':\n\t\t\t\tcount -= 1\n\tprint(count)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tst = input()\n\tc = 0\n\ti = 0\n\tf = 0\n\tans = 0\n\ts = set()\n\twhile i < n - 1:\n\t\tif st[i] == '<':\n\t\t\tc = 0\n\t\telif st[i] == '-':\n\t\t\ts.add(i)\n\t\t\ts.add(i + 1)\n\t\t\tc += 1\n\t\telse:\n\t\t\tc += 1\n\t\ti += 1\n\tif st[n - 1] == '<':\n\t\tc = 0\n\telif st[n - 1] == '-':\n\t\ts.add(n - 1)\n\t\ts.add(0)\n\t\tc += 1\n\telse:\n\t\tc += 1\n\tc1 = 0\n\ti = 0\n\ts1 = set()\n\twhile i < n - 1:\n\t\tif st[i] == '>':\n\t\t\tc1 = 0\n\t\telif st[i] == '-':\n\t\t\ts1.add(i)\n\t\t\ts1.add(i + 1)\n\t\t\tc1 += 1\n\t\telse:\n\t\t\tc1 += 1\n\t\ti += 1\n\tif st[n - 1] == '>':\n\t\tc1 = 0\n\telif st[n - 1] == '-':\n\t\ts1.add(n - 1)\n\t\ts1.add(0)\n\t\tc1 += 1\n\telse:\n\t\tc1 += 1\n\tif c == n or c1 == n:\n\t\tprint(n)\n\telse:\n\t\tprint(max(len(s1), len(s)))\n", "def solution():\n\tn = int(input())\n\ts = list(input())\n\tif '>' in s and '<' in s:\n\t\td = {}\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\td[i] = 1\n\t\t\t\td[(i + 1) % n] = 1\n\t\tprint(len(d))\n\telse:\n\t\tprint(n)\nt = int(input())\nfor _ in range(t):\n\tsolution()\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tx = s.count('>')\n\ty = s.count('<')\n\tl = []\n\tcount = 0\n\tif x != 0 and y != 0:\n\t\tfor c in s:\n\t\t\tif c == '-':\n\t\t\t\tcount += 1\n\t\t\telse:\n\t\t\t\tl.append(count)\n\t\t\t\tcount = 0\n\t\tl.append(count)\n\t\tans = 0\n\t\tif s[0] == '-' and s[n - 1] == '-':\n\t\t\tl[0] = l[0] + l[len(l) - 1]\n\t\t\tfor k in range(len(l) - 1):\n\t\t\t\tif l[k] > 0:\n\t\t\t\t\tans += l[k] + 1\n\t\telse:\n\t\t\tfor k in range(len(l)):\n\t\t\t\tif l[k] > 0:\n\t\t\t\t\tans += l[k] + 1\n\t\tprint(ans)\n\telif x == 0:\n\t\tprint(n)\n\telif y == 0:\n\t\tprint(n)\n", "def mi():\n\treturn map(int, input().split())\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\t(c, b, ac) = (0, 0, 0)\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tb += 1\n\t\telif s[i] == '>':\n\t\t\tc += 1\n\t\telse:\n\t\t\tac += 1\n\tif c == 0 or ac == 0:\n\t\tprint(n)\n\telse:\n\t\tout = 0\n\t\ti = 0\n\t\twhile i < n:\n\t\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tout += 1\n\t\t\ti += 1\n\t\tprint(out)\n", "t = int(input())\nfor i in range(t):\n\ta = int(input())\n\ts = str(input())\n\tsum = 0\n\tif '>' in s and '<' in s:\n\t\tfor i in range(a):\n\t\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tsum = sum + 1\n\telse:\n\t\tsum = a\n\tprint(sum)\n", "import sys\nfrom collections import deque\n\ndef eprint(*args):\n\tprint(*args, file=sys.stderr)\nzz = 1\nif zz:\n\tinput = sys.stdin.readline\nelse:\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('all.txt', 'w')\ndi = [[-1, 0], [1, 0], [0, 1], [0, -1]]\n\ndef string(s):\n\treturn ''.join(s)\n\ndef fori(n):\n\treturn [fi() for i in range(n)]\n\ndef inc(d, c, x=1):\n\td[c] = d[c] + x if c in d else x\n\ndef bo(i):\n\treturn ord(i) - ord('A')\n\ndef li():\n\treturn [int(xx) for xx in input().split()]\n\ndef fli():\n\treturn [float(x) for x in input().split()]\n\ndef comp(a, b):\n\tif a > b:\n\t\treturn 2\n\treturn 2 if a == b else 0\n\ndef gi():\n\treturn [xx for xx in input().split()]\n\ndef cil(n, m):\n\treturn n // m + int(n % m > 0)\n\ndef fi():\n\treturn int(input())\n\ndef pro(a):\n\treturn reduce(lambda a, b: a * b, a)\n\ndef swap(a, i, j):\n\t(a[i], a[j]) = (a[j], a[i])\n\ndef si():\n\treturn list(input().rstrip())\n\ndef mi():\n\treturn map(int, input().split())\n\ndef gh():\n\tsys.stdout.flush()\n\ndef isvalid(i, j):\n\treturn 0 <= i < n and 0 <= j < m and (a[i][j] != '.')\n\ndef bo(i):\n\treturn ord(i) - ord('a')\n\ndef graph(n, m):\n\tfor i in range(m):\n\t\t(x, y) = mi()\n\t\ta[x].append(y)\n\t\ta[y].append(x)\nt = fi()\nwhile t > 0:\n\tt -= 1\n\tn = fi()\n\ts = si()\n\tif s.count('<') in [n, 0] or s.count('>') in [n, 0]:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tif s[i - 1] == '-':\n\t\t\t\tans += 1\n\t\t\telse:\n\t\t\t\tans += 2\n\tprint(ans)\n", "def solve():\n\tn = int(input())\n\ts = input()\n\tok = [0] * n\n\tfor i in range(n):\n\t\t(x, y) = (i, (i + 1) % n)\n\t\tif s[i] == '-':\n\t\t\tok[x] = 1\n\t\t\tok[y] = 1\n\tclockwise = True\n\tanticlockwise = True\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tclockwise = False\n\t\tif s[i] == '>':\n\t\t\tanticlockwise = False\n\tres = sum(ok)\n\tif anticlockwise:\n\t\tfor i in range(n):\n\t\t\tif ok[i] == 0 and s[i] == '<':\n\t\t\t\tres += 1\n\tif clockwise:\n\t\tfor i in range(n):\n\t\t\tif ok[i] == 0 and s[i] == '>':\n\t\t\t\tres += 1\n\tprint(res)\n\treturn\n\ndef main():\n\tt = int(input())\n\tfor i in range(t):\n\t\tsolve()\n\treturn\nmain()\n", "t = int(input())\nwhile t:\n\tn = int(input())\n\ts = input()\n\tcnt = [0] * n\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tcnt[i] = 1\n\t\t\tcnt[(i + 1) % n] = 1\n\t(f1, f2) = (True, True)\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tf1 = False\n\t\telif s[i] == '<':\n\t\t\tf2 = False\n\tif f1 == True or f2 == True:\n\t\tprint(n)\n\telse:\n\t\ta = 0\n\t\tfor i in range(n):\n\t\t\tif cnt[i] == 1:\n\t\t\t\ta += 1\n\t\tprint(a)\n\tt -= 1\n", "for _ in range(int(input())):\n\tn = int(input())\n\tans = 0\n\ts = input()\n\tstk = set()\n\ta = s.count('<')\n\tb = s.count('>')\n\tc = s.count('-')\n\tif a == 0 or b == 0:\n\t\tprint(n)\n\telse:\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' and i != n - 1:\n\t\t\t\tstk.add(i)\n\t\t\t\tstk.add(i + 1)\n\t\t\telif s[i] == '-':\n\t\t\t\tstk.add(0)\n\t\t\t\tstk.add(i)\n\t\tprint(len(stk))\n", "def solve(n, s):\n\t(c1, c2) = (s.count('>'), s.count('<'))\n\tif c1 == 0 or c2 == 0:\n\t\treturn n\n\tc3 = s.count('-')\n\tif c3 == n or c3 == 0:\n\t\treturn c3\n\ti = 0\n\tprev = s[n - 1]\n\twhile i < n and (not (s[i] == '-' and prev != '-')):\n\t\tprev = s[i]\n\t\ti += 1\n\tstart = i\n\tans = 0\n\tcc = 1\n\ti = (i + 1) % n\n\twhile i != start:\n\t\tif s[i] == '-':\n\t\t\tcc += 1\n\t\telif cc != 0:\n\t\t\tans += cc + 1\n\t\t\tcc = 0\n\t\ti += 1\n\t\tif i == n:\n\t\t\ti = 0\n\tif cc > 0:\n\t\tans += cc + 1\n\treturn ans\ntests = int(input())\nfor test in range(tests):\n\tn = int(input())\n\ts = input()\n\tprint(solve(n, s))\n", "for _ in ' ' * int(input()):\n\tn = int(input())\n\ta = input()\n\tif a.count('>') == n or a.count('<') == n or a.count('-') == n:\n\t\tprint(n)\n\telif '-' not in a:\n\t\tprint(0)\n\telse:\n\t\ts = a\n\t\tif '>' not in a or '<' not in a:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tcnt = 0\n\t\t\tfor i in range(1, n):\n\t\t\t\tif a[i] == '-':\n\t\t\t\t\tif a[i - 1] == '-':\n\t\t\t\t\t\tcnt += 1\n\t\t\t\t\telse:\n\t\t\t\t\t\tcnt += 2\n\t\t\tif a[0] == '-':\n\t\t\t\tif a[-1] == '-':\n\t\t\t\t\tcnt += 1\n\t\t\t\telse:\n\t\t\t\t\tcnt += 2\n\t\t\tprint(cnt)\n", "for j in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif s.count('<') == 0 or s.count('>') == 0:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tl = i - 1\n\t\t\tif l == -1:\n\t\t\t\tl = n - 1\n\t\t\tif s[i] == '-' or s[l] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tc = 0\n\ta = 0\n\to = 0\n\tfor i in s:\n\t\tif i == '<':\n\t\t\ta += 1\n\t\telif i == '>':\n\t\t\tc += 1\n\t\telse:\n\t\t\to += 1\n\tm = min(a, c)\n\tif c == 0 or a == 0:\n\t\tprint(n)\n\telse:\n\t\tt1 = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tt1 += 1\n\t\t\telif s[i - 1] == '-':\n\t\t\t\tt1 += 1\n\t\tprint(t1)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = str(input())\n\tans = 0\n\t(flag1, flag2) = (0, 0)\n\tif '<' in s:\n\t\tflag1 = 1\n\tif '>' in s:\n\t\tflag2 = 1\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tans += 1\n\t\telif s[i] == '<' and s[i - 1] == '<':\n\t\t\tif flag2 == 0:\n\t\t\t\tans += 1\n\t\telif s[i] == '>' and s[i - 1] == '>':\n\t\t\tif flag1 == 0:\n\t\t\t\tans += 1\n\tprint(ans)\n", "i = int(input())\n\ndef allleft(liz):\n\tfor _ in liz:\n\t\tif _ == '>':\n\t\t\treturn False\n\treturn True\n\ndef allright(liz):\n\tfor _ in liz:\n\t\tif _ == '<':\n\t\t\treturn False\n\treturn True\nfor _ in range(i):\n\tj = int(input())\n\tlz = list(input())\n\tif allleft(lz) or allright(lz):\n\t\tprint(len(lz))\n\telse:\n\t\tliste = []\n\t\tt = 0\n\t\tfor _ in lz:\n\t\t\tif _ == '-':\n\t\t\t\tt += 1\n\t\t\telif t > 0:\n\t\t\t\tliste.append(t)\n\t\t\t\tt = 0\n\t\tif t > 0:\n\t\t\tliste.append(t)\n\t\t\tt = 0\n\t\ttot = 0\n\t\tbasson = 0\n\t\tif lz[0] == '-':\n\t\t\tbasson += 1\n\t\tif lz[-1] == '-':\n\t\t\tbasson += 1\n\t\tfor _ in liste:\n\t\t\ttot += _ + 1\n\t\tif basson == 2:\n\t\t\ttot -= 1\n\t\tprint(tot)\n", "import sys\ninput = sys.stdin.readline\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s) - 1])\n\ndef invr():\n\treturn map(int, input().split())\nfor _ in range(inp()):\n\trooms = inp()\n\tbelts = input()\n\tif '<' in belts and '>' in belts:\n\t\tresult = 0\n\t\tf = 0\n\t\tif belts[0] == '-' and belts[-2] == '-':\n\t\t\tf = 1\n\t\ta = False\n\t\tfor i in belts:\n\t\t\tif i == '-':\n\t\t\t\tif a == False:\n\t\t\t\t\tresult += 2\n\t\t\t\t\ta = True\n\t\t\t\telse:\n\t\t\t\t\tresult += 1\n\t\t\telse:\n\t\t\t\ta = False\n\t\tprint(result - f)\n\telse:\n\t\tprint(rooms)\n", "from collections import defaultdict\nimport sys\nimport math\nimport random\n\ndef get_array():\n\treturn list(map(int, sys.stdin.readline().strip().split()))\n\ndef get_ints():\n\treturn map(int, sys.stdin.readline().strip().split())\n\ndef input():\n\treturn sys.stdin.readline().strip()\nfor t in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tcnt_1 = s.count('>')\n\tcnt_2 = s.count('<')\n\tcnt_3 = s.count('-')\n\tif cnt_1 + cnt_3 == n or cnt_2 + cnt_3 == n:\n\t\tprint(n)\n\t\tcontinue\n\ts1 = ''\n\t(f, l) = (s[0], s[-1])\n\ts = l + s\n\tfor i in s:\n\t\ts1 = s1 + i\n\t\ts1 = s1 + '|'\n\tcnt = 0\n\tfor i in range(1, len(s1) - 1):\n\t\tif s1[i] == '|':\n\t\t\tif s1[i - 1] == '-' or s1[i + 1] == '-':\n\t\t\t\tcnt += 1\n\tprint(cnt)\n", "from collections import defaultdict\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tvis = [0] * n\n\ts = input()\n\tadj_lis = defaultdict(list)\n\tflag = flag1 = 0\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tvis[i] = 1\n\t\t\tvis[(i + 1) % n] = 1\n\t\telif s[i] == '>':\n\t\t\tflag = 1\n\t\telif s[i] == '<':\n\t\t\tflag1 = 1\n\tif flag == 0 or flag1 == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(sum(vis))\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\tline = input().strip()\n\tres = 0\n\t(l, r, m) = (0, 0, 0)\n\tfor i in range(n):\n\t\tif line[i] == '<':\n\t\t\tl += 1\n\t\telif line[i] == '>':\n\t\t\tr += 1\n\tif l * r == 0:\n\t\tprint(n)\n\t\tcontinue\n\tfor i in range(n):\n\t\tif line[i] == '-' or line[(i - 1) % n] == '-':\n\t\t\tres += 1\n\tprint(res)\n", "t = int(input())\nwhile t:\n\tt -= 1\n\tn = int(input())\n\ts = input()\n\tcount = 0\n\ti = 0\n\twhile i < n and s[i] == '-':\n\t\ti += 1\n\tif i >= n:\n\t\tprint(n)\n\telse:\n\t\tsign = s[i]\n\t\tloop = True\n\t\tfor i in range(n):\n\t\t\tif s[i] != sign and s[i] != '-':\n\t\t\t\tloop = False\n\t\t\t\tbreak\n\t\tif loop:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tfor i in range(n):\n\t\t\t\tif s[i] == '-' or s[(i - 1) % n] == '-':\n\t\t\t\t\tcount += 1\n\t\t\tprint(count)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tx = s.count('-')\n\tif x == 0:\n\t\tif s.count('>') == n:\n\t\t\tprint(n)\n\t\telif s.count('<') == n:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tprint(0)\n\telif s.count('<') == 0 or s.count('>') == 0:\n\t\tprint(n)\n\telif x == n:\n\t\tprint(n)\n\telse:\n\t\tl = []\n\t\ti = 0\n\t\twhile i < n:\n\t\t\tc = 0\n\t\t\twhile i < n and '-' == s[i]:\n\t\t\t\tc = c + 1\n\t\t\t\ti = i + 1\n\t\t\ti = i + 1\n\t\t\tif c != 0:\n\t\t\t\tl.append(c)\n\t\tif s[0] == s[-1] == '-':\n\t\t\ts = l[0] + l[-1] + 1\n\t\t\tl.remove(l[0])\n\t\t\tl.remove(l[-1])\n\t\t\tfor i in l:\n\t\t\t\ts = s + 1 + i\n\t\t\tprint(s)\n\t\telse:\n\t\t\ts = 0\n\t\t\tfor i in l:\n\t\t\t\ts = s + 1 + i\n\t\t\tprint(s)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tl = list(input())\n\tf = 1\n\tif l.count('>') == 0 or l.count('<') == 0:\n\t\tf = 0\n\tif f == 1:\n\t\tc = 0\n\t\tcl = []\n\t\ts = 0\n\t\te = 0\n\t\tfor i in range(n):\n\t\t\tif l[i] == '-':\n\t\t\t\tif i == 0:\n\t\t\t\t\ts = 1\n\t\t\t\tc += 1\n\t\t\telif c != 0:\n\t\t\t\te = 1\n\t\t\t\tcl.append(c)\n\t\t\t\tc = 0\n\t\tif c != 0:\n\t\t\tif s == 1:\n\t\t\t\tif e == 1:\n\t\t\t\t\tcl.append(c + cl[0])\n\t\t\t\t\tcl.pop(0)\n\t\t\t\t\tc = 0\n\t\t\t\telse:\n\t\t\t\t\tcl.append(c + 1)\n\t\t\telse:\n\t\t\t\tcl.append(c)\n\t\t\t\tc = 0\n\t\tt = 0\n\t\tfor i in cl:\n\t\t\tt += i + 1\n\t\tif t > 0:\n\t\t\tprint(t)\n\t\telse:\n\t\t\tprint(0)\n\telse:\n\t\tprint(n)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\n_str = str\nBUFSIZE = 8192\n\ndef str(x=b''):\n\treturn x if type(x) is bytes else _str(x).encode()\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n\ndef inp():\n\treturn sys.stdin.readline().rstrip()\n\ndef mpint():\n\treturn map(int, inp().split(' '))\n\ndef itg():\n\treturn int(inp())\n\ndef solve():\n\tn = itg()\n\ts = inp()\n\tif len(set(s) - {'-'}) == 1:\n\t\treturn n\n\tans = [0] * n\n\tfor (i, c) in enumerate(s):\n\t\tif c == '-':\n\t\t\tans[i] = ans[(i + 1) % n] = 1\n\treturn sum(ans)\n\ndef main():\n\tfor _ in range(itg()):\n\t\tprint(solve())\nDEBUG = 0\nURL = 'https://codeforces.com/contest/1428/problem/B'\nif DEBUG == 1:\n\timport requests\n\tfrom ACgenerator.Y_Test_Case_Runner import TestCaseRunner\n\trunner = TestCaseRunner(main, URL)\n\tinp = runner.input_stream\n\tprint = runner.output_stream\n\trunner.checking()\nelif DEBUG == 2:\n\tmain()\nelse:\n\t(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\n\tmain()\n", "import os\nimport sys\ninput = sys.stdin.readline\n\ndef main():\n\tnum = 0\n\ts = input()\n\tnum = int(s)\n\tfor _ in range(num):\n\t\tn_num = int(input())\n\t\trs_num = 0\n\t\tres = [[0, 0] for _ in range(n_num)]\n\t\tres_n = [0 for _ in range(n_num)]\n\t\tdrs = input().strip()\n\t\tfor (ind, s) in enumerate(drs):\n\t\t\t(a, b) = (ind, (ind + 1) % n_num)\n\t\t\tif s == '-':\n\t\t\t\tres_n[a] = 1\n\t\t\t\tres_n[b] = 1\n\t\t\t\tres[ind][0] += 1\n\t\t\t\tres[ind][1] += 1\n\t\t\telif s == '>':\n\t\t\t\tres[ind][0] += 0\n\t\t\t\tres[ind][1] += 1\n\t\t\telif s == '<':\n\t\t\t\tres[ind][0] += 1\n\t\t\t\tres[ind][1] += 0\n\t\tn_1 = sum(res_n)\n\t\tflag_a = 1\n\t\tflag_b = 1\n\t\tfor (a, b) in res:\n\t\t\tif a == 0:\n\t\t\t\tflag_a = 0\n\t\t\tif b == 0:\n\t\t\t\tflag_b = 0\n\t\t\tif flag_a == 0 and flag_b == 0:\n\t\t\t\tbreak\n\t\tn_2 = n_num if flag_a > 0 or flag_b > 0 else 0\n\t\tprint(max(n_1, n_2))\nmain()\n", "for _ in range(int(input())):\n\tn = int(input())\n\tbelts = str(input())\n\tloop = True\n\tcontains_g = False\n\tcontains_l = False\n\tfor x in belts:\n\t\tif x == '>':\n\t\t\tcontains_g = True\n\t\telif x == '<':\n\t\t\tcontains_l = True\n\tif contains_g and contains_l:\n\t\tloop = False\n\tif loop:\n\t\tprint(n)\n\telse:\n\t\tcount = 0\n\t\tfor i in range(n):\n\t\t\tif belts[i] == '>' or belts[i] == '<':\n\t\t\t\tif belts[(i - 1) % n] == '-':\n\t\t\t\t\tcount += 1\n\t\t\telse:\n\t\t\t\tcount += 1\n\t\tprint(count)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input().strip()\n\tct = 0\n\tif '>' in s and '<' in s:\n\t\tstart = 0\n\t\tend = n - 1\n\t\tif s[end] == '-' or s[start] == '-':\n\t\t\twhile s[end] == '-':\n\t\t\t\tend -= 1\n\t\t\twhile s[start] == '-':\n\t\t\t\tstart += 1\n\t\t\tct += n - 1 - end + start + 1\n\t\twhile start < end:\n\t\t\tj = start + 1\n\t\t\tif s[start] == '-':\n\t\t\t\twhile j < end and s[start] == s[j]:\n\t\t\t\t\tj += 1\n\t\t\t\tct += 1 + j - start\n\t\t\tstart = j\n\t\tprint(ct)\n\telse:\n\t\tprint(n)\n", "mod = 1000000007\neps = 10 ** (-9)\n\ndef main():\n\timport sys\n\tinput = sys.stdin.readline\n\tfor _ in range(int(input())):\n\t\tN = int(input())\n\t\tS = input().rstrip('\\n')\n\t\tif '>' not in S or '<' not in S:\n\t\t\tprint(N)\n\t\t\tcontinue\n\t\tans = 0\n\t\tfor i in range(N):\n\t\t\tif S[i] == '-' or S[(i + 1) % N] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\nmain()\n", "import sys\nsys.setrecursionlimit(10 ** 5)\nint1 = lambda x: int(x) - 1\np2D = lambda x: print(*x, sep='\\n')\n\ndef II():\n\treturn int(sys.stdin.buffer.readline())\n\ndef MI():\n\treturn map(int, sys.stdin.buffer.readline().split())\n\ndef LI():\n\treturn list(map(int, sys.stdin.buffer.readline().split()))\n\ndef LLI(rows_number):\n\treturn [LI() for _ in range(rows_number)]\n\ndef BI():\n\treturn sys.stdin.buffer.readline().rstrip()\n\ndef SI():\n\treturn sys.stdin.buffer.readline().rstrip().decode()\n\ndef RLE(s):\n\tcc = []\n\tww = []\n\tpc = s[0]\n\tw = 0\n\tfor c in s:\n\t\tif c == pc:\n\t\t\tw += 1\n\t\telse:\n\t\t\tcc.append(pc)\n\t\t\tww.append(w)\n\t\t\tw = 1\n\t\t\tpc = c\n\tcc.append(pc)\n\tww.append(w)\n\treturn (cc, ww)\nfor _ in range(II()):\n\tn = II()\n\ts = SI()\n\tif s.count('<') == 0 or s.count('>') == 0:\n\t\tprint(n)\n\t\tcontinue\n\ts += s\n\tbi = 0\n\tfor i in range(n):\n\t\tif s[i - 1] != s[i]:\n\t\t\tbi = i\n\t\t\tbreak\n\t(cc, ww) = RLE(s[bi:bi + n])\n\tans = 0\n\tfor (c, w) in zip(cc, ww):\n\t\tif c == '-':\n\t\t\tans += w + 1\n\tprint(ans)\n", "def main():\n\tfor _ in range(int(input())):\n\t\tn = int(input())\n\t\ts = input()\n\t\tcount = 0\n\t\t(left, right) = (0, 0)\n\t\tfor i in range(n):\n\t\t\tif s[i] == '>':\n\t\t\t\tright = 1\n\t\t\tif s[i] == '<':\n\t\t\t\tleft = 1\n\t\t\tif s[i] == '-':\n\t\t\t\tcount += 1\n\t\t\t\tcontinue\n\t\t\tif i == 0 and s[n - 1] == '-':\n\t\t\t\tcount += 1\n\t\t\t\tcontinue\n\t\t\tif s[i - 1] == '-':\n\t\t\t\tcount += 1\n\t\t\t\tcontinue\n\t\tif left and right:\n\t\t\tprint(count)\n\t\telse:\n\t\t\tprint(n)\nmain()\n", "from collections import Counter\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tpre_si = s[-1]\n\tans = 0\n\tcounter = Counter()\n\tfor si in s:\n\t\tif pre_si == '-' or si == '-':\n\t\t\tans += 1\n\t\tcounter[si] += 1\n\t\tpre_si = si\n\tif counter['>'] == 0 or counter['<'] == 0:\n\t\tans = n\n\tprint(ans)\n", "from collections import *\nfrom itertools import *\nfrom bisect import *\n\ndef inp():\n\treturn int(input())\n\ndef arrinp():\n\treturn [int(x) for x in input().split()]\n\ndef main():\n\tt = inp()\n\tfor _ in range(t):\n\t\tn = inp()\n\t\ts = input()\n\t\tbad_count = 0\n\t\tcheck = set(s)\n\t\tif '<' in check and '>' in check:\n\t\t\tbad_count = 1\n\t\tgood = 0\n\t\tcount = 0\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == '-':\n\t\t\t\tcount += 1\n\t\t\telif s[i] != '-':\n\t\t\t\tif count > 0:\n\t\t\t\t\tgood += count + 1\n\t\t\t\t\tcount = 0\n\t\tif count > 0:\n\t\t\tgood += count + 1\n\t\t\tif s[0] == '-':\n\t\t\t\tgood -= 1\n\t\tif bad_count > 0:\n\t\t\tif good == 0:\n\t\t\t\tprint(0)\n\t\t\telse:\n\t\t\t\tprint(min(good, n))\n\t\telse:\n\t\t\tprint(n)\nmain()\n", "import math\nn = 'deep'\nimport heapq\nx = 'abcdefgh'\nfor asdasdasd in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tss = list(set(s))\n\tl = len(ss)\n\tif l == 1:\n\t\tprint(n)\n\telif l == 2:\n\t\tif ss[0] == '-' or ss[1] == '-':\n\t\t\tprint(n)\n\t\telse:\n\t\t\tprint(0)\n\telse:\n\t\tx = set()\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tx.add((i + 1) % n)\n\t\t\t\tx.add(i)\n\t\tprint(len(x))\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tresult = 0\n\tif '<' not in s or '>' not in s:\n\t\tresult = n\n\telse:\n\t\tfor (k, i) in enumerate(s):\n\t\t\tif i == '-':\n\t\t\t\tresult += 1\n\t\t\telif s[k - 1] == '-':\n\t\t\t\tresult += 1\n\tprint(result)\n", "for i in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tl = [False for i in range(n)]\n\tfulcirc1 = True\n\tfor i in s:\n\t\tif i == '<':\n\t\t\tfulcirc1 = False\n\t\t\tbreak\n\tfulcirc2 = True\n\tfor i in range(n - 1, -1, -1):\n\t\tif s[i] == '>':\n\t\t\tfulcirc2 = False\n\t\t\tbreak\n\tfullcirc = False\n\tif fulcirc1 or fulcirc2:\n\t\tfullcirc = True\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tl[i] = True\n\t\t\tif i == n - 1:\n\t\t\t\tl[0] = True\n\t\t\t\tcontinue\n\t\t\tl[i + 1] = True\n\t\telif s[i] == s[i - 1]:\n\t\t\tif fullcirc:\n\t\t\t\tl[i] = True\n\tprint(sum(l))\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nfrom math import gcd, ceil\n\ndef prod(a, mod=10 ** 9 + 7):\n\tans = 1\n\tfor each in a:\n\t\tans = ans * each % mod\n\treturn ans\n\ndef lcm(a, b):\n\treturn a * b // gcd(a, b)\n\ndef binary(x, length=16):\n\ty = bin(x)[2:]\n\treturn y if len(y) >= length else '0' * (length - len(y)) + y\nfor _ in range(int(input()) if True else 1):\n\tn = int(input())\n\ts = input()\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tans += 1\n\tprint(max(ans, n * int('<' not in s), n * int('>' not in s)))\n", "n = int(input())\nfor i in range(n):\n\tlength = int(input())\n\ts = input()[0:length]\n\tst = set(s)\n\tif len(st) == 1 or (len(st) == 2 and '-' in st):\n\t\tprint(length)\n\t\tcontinue\n\tresult = [0] * length\n\tfor j in range(length):\n\t\tif s[j] == '-':\n\t\t\tresult[j % length] = 1\n\t\t\tresult[(j + 1) % length] = 1\n\tprint(sum(result))\n", "n = int(input())\nfor _ in range(n):\n\tk = int(input())\n\ts = input()\n\ts = s[-1] + s + s[0]\n\tr = 0\n\tonlyl = True\n\tonlyr = True\n\tfor i in range(1, k + 1):\n\t\tif s[i] == '>':\n\t\t\tonlyl = False\n\t\telif s[i] == '<':\n\t\t\tonlyr = False\n\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\tr += 1\n\tif onlyl or onlyr:\n\t\tprint(k)\n\telse:\n\t\tprint(r)\n", "T = int(input())\nfor t in range(T):\n\tN = int(input())\n\ts = input()\n\tif '<' not in s or '>' not in s:\n\t\tprint(N)\n\telse:\n\t\tcnt = 0\n\t\tfor i in range(N):\n\t\t\tprev = i - 1\n\t\t\tif prev < 0:\n\t\t\t\tprev += N\n\t\t\tif s[i] == '-' or s[prev] == '-':\n\t\t\t\tcnt += 1\n\t\tprint(cnt)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tc1 = s.count('>')\n\tc2 = s.count('<')\n\tif c1 == 0 or c2 == 0:\n\t\tprint(n)\n\telse:\n\t\ts = s[-1] + s + s[0]\n\t\tc = 0\n\t\tfor i in range(1, n + 1):\n\t\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\t\tc += 1\n\t\tprint(c)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ta = list(input())\n\tb = []\n\tfor i in range(n):\n\t\tif a[i] == '-':\n\t\t\tif i != n - 1:\n\t\t\t\tb.append(i + 1)\n\t\t\t\tb.append(i + 2)\n\t\t\telse:\n\t\t\t\tb.append(i + 1)\n\t\t\t\tb.append(1)\n\tif a.count('>') == 0 or a.count('<') == 0:\n\t\tprint(n)\n\telif '-' in a:\n\t\tprint(len(set(b)))\n\telse:\n\t\tprint('0')\n", "T = int(input())\nfor _ in range(T):\n\tn = int(input())\n\ts = input()\n\tfg = True\n\tfl = True\n\tres = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == '<':\n\t\t\tfg = False\n\t\t\tif s[i - 1] == '-':\n\t\t\t\tres += 1\n\t\telif s[i] == '>':\n\t\t\tfl = False\n\t\t\tif s[i - 1] == '-':\n\t\t\t\tres += 1\n\t\telse:\n\t\t\tres += 1\n\tif fl or fg:\n\t\tprint(n)\n\telse:\n\t\tprint(res)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tl = input()\n\tr = False\n\tlf = False\n\tfor ele in l:\n\t\tif ele == '>':\n\t\t\tr = True\n\t\telif ele == '<':\n\t\t\tlf = True\n\t\telse:\n\t\t\tcontinue\n\tif not (r and lf):\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tlast = l[-1]\n\t\tfor i in range(0, n):\n\t\t\tif l[i] == '-':\n\t\t\t\tif l[i - 1] == '-':\n\t\t\t\t\tans += 1\n\t\t\t\telse:\n\t\t\t\t\tans += 2\n\t\tprint(ans)\n", "n = int(input())\nL = []\nfor i in range(n):\n\tm = int(input())\n\tM = list(input())\n\tL.append(M)\n\ndef returnable(Q):\n\ts = len(Q)\n\tnumber = 0\n\t(d, m) = (0, 0)\n\tfor i in range(s):\n\t\tif Q[i] in ['>', '-']:\n\t\t\td += 1\n\t\tif Q[i] in ['<', '-']:\n\t\t\tm += 1\n\tif d == s or m == s:\n\t\treturn s\n\tfor i in range(s):\n\t\tprev = (i - 1) % s\n\t\tif Q[prev] == '-' or Q[i] == '-':\n\t\t\tnumber += 1\n\treturn number\nfor i in range(len(L)):\n\tprint(returnable(L[i]))\n", "from collections import *\nimport sys\n\ndef ri():\n\treturn int(input())\n\ndef rl():\n\treturn list(map(int, input().split()))\nt = ri()\nfor _ in range(t):\n\tn = ri()\n\tstr = input()\n\tsens_unique = 1\n\tdirection = '-'\n\tfor thing in str:\n\t\tif thing != direction:\n\t\t\tdirection = thing\n\t\t\tbreak\n\tfor thing in str:\n\t\tif thing != direction and thing != '-':\n\t\t\tsens_unique = 0\n\tif sens_unique == 1:\n\t\tprint(n)\n\t\tcontinue\n\tgood_spots = set()\n\tfor i in range(n):\n\t\tif str[i] == '-':\n\t\t\tgood_spots.add(i)\n\t\t\tgood_spots.add((i + 1) % n)\n\tprint(len(good_spots))\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nimport heapq as h\nfrom bisect import bisect_left, bisect_right\nfrom types import GeneratorType\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\timport os\n\t\tself.os = os\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tself.os.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nimport time\nstart_time = time.time()\nimport collections as col\nimport math, string\nfrom functools import reduce\n\ndef getInts():\n\treturn [int(s) for s in input().split()]\n\ndef getInt():\n\treturn int(input())\n\ndef getStrs():\n\treturn [s for s in input().split()]\n\ndef getStr():\n\treturn input()\n\ndef listStr():\n\treturn list(input())\nMOD = 10 ** 9 + 7\n\ndef is_left(graph, N):\n\tfor j in range(N):\n\t\tif (j + 1) % N not in graph[j]:\n\t\t\treturn False\n\treturn True\n\ndef is_right(graph, N):\n\tfor j in range(N):\n\t\tif (j - 1) % N not in graph[j]:\n\t\t\treturn False\n\treturn True\n\ndef solve():\n\tN = getInt()\n\tS = getStr()\n\tgraph = col.defaultdict(set)\n\tfor i in range(N):\n\t\tif S[i] == '-':\n\t\t\tgraph[i].add((i + 1) % N)\n\t\t\tgraph[(i + 1) % N].add(i)\n\t\telif S[i] == '>':\n\t\t\tgraph[i].add((i + 1) % N)\n\t\telse:\n\t\t\tgraph[(i + 1) % N].add(i)\n\tif is_left(graph, N) or is_right(graph, N):\n\t\treturn N\n\tans = 0\n\tfor j in range(N):\n\t\t(x, y) = ((j + 1) % N, (j - 1) % N)\n\t\tif x in graph[j] and j in graph[x] or (y in graph[j] and j in graph[y]):\n\t\t\tans += 1\n\treturn ans\nfor _ in range(getInt()):\n\tprint(solve())\n", "def solve():\n\tn = int(input())\n\ts = input()\n\ts = s[:n]\n\ta = [0] * n\n\tif len([i for i in s if i == '<']) == 0 or len([i for i in s if i == '>']) == 0:\n\t\tprint(n)\n\t\treturn\n\tfor (i, v) in enumerate(s):\n\t\tj = (i - 1) % n\n\t\tif s[j] == '-':\n\t\t\ta[i] = 1\n\t\t\ta[j] = 1\n\tprint(sum(a))\n\ndef main():\n\tt = 1\n\tt = int(input())\n\tfor _ in range(t):\n\t\tsolve()\nmain()\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tif '<' in s and '>' in s:\n\t\tc = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '<' and s[i - 1] == '-':\n\t\t\t\tc += 1\n\t\t\telif s[i] == '>' and s[i - 1] == '-':\n\t\t\t\tc += 1\n\t\tprint(s.count('-') + c)\n\telse:\n\t\tprint(n)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tl = []\n\tfor i in s:\n\t\tl.append(i)\n\tx = list(set(l))\n\tif len(x) == 1 or (len(x) == 2 and '-' in x):\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tans = 0\n\tif '<' not in s or '>' not in s:\n\t\tans = n\n\telse:\n\t\tchar = set()\n\t\ti = 0\n\t\twhile True:\n\t\t\tif i == n:\n\t\t\t\tbreak\n\t\t\ti = i % n\n\t\t\tif s[i] == '-':\n\t\t\t\tchar.add(i)\n\t\t\t\tchar.add((i + 1) % n)\n\t\t\ti += 1\n\t\tans = len(char)\n\tprint(ans)\n", "n = int(input())\nfor _ in range(n):\n\tk = int(input())\n\tline = input()\n\treturnable_set = set()\n\tif '<' not in line or '>' not in line:\n\t\tprint(k)\n\telse:\n\t\tfor i in range(k):\n\t\t\tif line[i] == '-':\n\t\t\t\treturnable_set.add(i)\n\t\t\t\treturnable_set.add((i + 1) % k)\n\t\tprint(len(returnable_set))\n", "t = int(input())\nfor case in range(t):\n\tn = int(input())\n\ts = input()\n\tr = set()\n\tif '<' not in s or '>' not in s:\n\t\tans = n\n\telse:\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tr.add(i)\n\t\t\t\tr.add((i + 1) % n)\n\t\tans = len(r)\n\tprint(ans)\n", "for t in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif '>' in s and '<' in s:\n\t\tcount = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\t\tcount += 1\n\t\tprint(count)\n\telse:\n\t\tprint(n)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tcnt = 0\n\tvisited = [False] * n\n\tbakar = None\n\tfor i in range(n):\n\t\tleft = i - 1\n\t\tright = i\n\t\tif left == -1:\n\t\t\tleft = n - 1\n\t\tif s[left] == '-' or s[right] == '-':\n\t\t\tcnt += 1\n\t\telse:\n\t\t\tbakar = i\n\ti = 0\n\twhile i < n:\n\t\tif s[i] == '>' or s[i] == '-':\n\t\t\ti += 1\n\t\telse:\n\t\t\tbreak\n\tif i == n:\n\t\tcnt = n\n\ti = n - 1\n\twhile i >= 0:\n\t\tif s[i] == '<' or s[i] == '-':\n\t\t\ti -= 1\n\t\telse:\n\t\t\tbreak\n\tif i == -1:\n\t\tcnt = n\n\tprint(cnt)\n", "import collections\nfor t in range(int(input())):\n\tm = int(input())\n\ts = input()\n\tp = n = b = 0\n\tout = 0\n\tpre = s[-1]\n\tfor i in s:\n\t\tif i == '>':\n\t\t\tp += 1\n\t\t\tif pre == '-':\n\t\t\t\tout += 1\n\t\telif i == '<':\n\t\t\tn += 1\n\t\t\tif pre == '-':\n\t\t\t\tout += 1\n\t\telse:\n\t\t\tb += 1\n\t\t\tout += 1\n\t\tpre = i\n\tif p == 0 or n == 0:\n\t\tprint(m)\n\t\tcontinue\n\tprint(out)\n", "test_case_num = int(input())\nfor i in range(test_case_num):\n\tcnt = 0\n\troom = int(input())\n\tbelt_list = input()\n\tfor j in range(room):\n\t\tif belt_list[j] == '-' or belt_list[(room - 1 + j) % room] == '-':\n\t\t\tcnt += 1\n\t\t\tcontinue\n\t\telse:\n\t\t\tif belt_list[j] == '<':\n\t\t\t\tif not '>' in belt_list:\n\t\t\t\t\tcnt += 1\n\t\t\tif belt_list[j] == '>':\n\t\t\t\tif not '<' in belt_list:\n\t\t\t\t\tcnt += 1\n\tprint(cnt)\n", "t = int(input())\nfor k in range(t):\n\tn = int(input())\n\ts = str(input())\n\tl = [0] * n\n\tsub1 = '><'\n\tsub2 = '<>'\n\tif not ('<' in s and '>' in s):\n\t\tprint(n)\n\telse:\n\t\tfor i in range(1, n - 1):\n\t\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\t\tl[i] += 1\n\t\tif s[0] == '-' or s[n - 1] == '-':\n\t\t\tl[0] += 1\n\t\tif s[n - 1] == '-' or s[n - 2] == '-':\n\t\t\tl[n - 1] += 1\n\t\tprint(sum(l))\n", "from sys import stdin\n_input = stdin.readline\n(_range, _int, _str) = (range, int, str)\n\ndef solution():\n\tfor _ in _range(_int(_input())):\n\t\tn = _int(_input())\n\t\tarr = _input().rstrip('\\n')\n\t\tans = 0\n\t\t(c_left, c_right) = (0, 0)\n\t\tfor i in _range(n - 1):\n\t\t\tif arr[i] == '<':\n\t\t\t\tc_left += 1\n\t\t\telif arr[i] == '>':\n\t\t\t\tc_right += 1\n\t\t\tif arr[i] == '-' or arr[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tif arr[n - 1] == '<':\n\t\t\tc_left += 1\n\t\telif arr[n - 1] == '>':\n\t\t\tc_right += 1\n\t\tans += 1 if arr[0] == '-' or arr[n - 1] == '-' else 0\n\t\tif c_left == 0 or c_right == 0:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tprint(ans)\nsolution()\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tans = set()\n\tans1 = set()\n\tif s.count('<') + s.count('-') == n or s.count('>') + s.count('-') == n:\n\t\tprint(n)\n\t\tcontinue\n\tfor j in range(len(s)):\n\t\tif s[j] == '-':\n\t\t\tans.add(j)\n\t\t\tans.add((j + 1) % n)\n\t\tif s[j] == '-':\n\t\t\tans.add(j)\n\t\t\tans.add((j + 1) % n)\n\tprint(len(ans))\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = str(input())\n\tk1 = []\n\tcount = 0\n\tk4 = set()\n\tk2 = []\n\tk3 = []\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tcount += 1\n\t\t\tk4.add(i)\n\t\t\tk4.add((i + 1) % n)\n\t\telif s[i] == '<':\n\t\t\tk2.append('<')\n\t\telse:\n\t\t\tk3.append('>')\n\ta1 = len(k1)\n\ta2 = len(k2)\n\ta3 = len(k3)\n\ta4 = len(k4)\n\tif n - count == a2 or n - count == a3:\n\t\tprint(n)\n\telse:\n\t\tprint(a4)\n", "q = int(input())\nfor _ in range(q):\n\tn = int(input())\n\ts = str(input())\n\tkek = [0 for i in range(n)]\n\t(a, b) = (0, 0)\n\trs = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == '-':\n\t\t\tkek[i] = 1\n\t\t\tkek[(i + 1) % n] = 1\n\t\t\ta += 1\n\t\t\tb += 1\n\t\telif s[i] == '<':\n\t\t\ta += 1\n\t\telse:\n\t\t\tb += 1\n\tif a == n or b == n:\n\t\tfor i in range(n):\n\t\t\trs = n\n\telse:\n\t\tfor i in range(n):\n\t\t\trs += kek[i]\n\tprint(rs)\n", "q = []\nt = int(input())\nch = 0\nfor i in range(t):\n\tch = 0\n\tn = int(input())\n\ts = input()\n\tif '<' in s and '>' in s:\n\t\tif s[0] == '-':\n\t\t\tch = ch + 2\n\t\tfor j in range(1, len(s) - 1):\n\t\t\tif s[j] == '-':\n\t\t\t\tif s[j - 1] == '-':\n\t\t\t\t\tch = ch + 1\n\t\t\t\telse:\n\t\t\t\t\tch = ch + 2\n\t\tif s[len(s) - 1] == '-':\n\t\t\tif s[len(s) - 2] == '-' and s[0] == '-':\n\t\t\t\tch = ch + 0\n\t\t\telif s[len(s) - 2] == '-' or s[0] == '-':\n\t\t\t\tch = ch + 1\n\t\t\telse:\n\t\t\t\tch = ch + 2\n\telse:\n\t\tch = n\n\tq.append(ch)\nfor i in range(len(q)):\n\tprint(q[i])\n", "def solve(n, b):\n\tforward = True\n\tbackward = True\n\tfor i in range(n):\n\t\tif b[i] == '<':\n\t\t\tforward = False\n\t\tif b[i] == '>':\n\t\t\tbackward = False\n\tans = 0\n\tfor i in range(n):\n\t\tleft = b[(i - 1) % n]\n\t\tright = b[i]\n\t\tif left == '-' or right == '-':\n\t\t\tans += 1\n\t\telif left == '>' and right == '>':\n\t\t\tans += forward\n\t\telif left == '<' and right == '<':\n\t\t\tans += backward\n\treturn ans\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tb = input()\n\tans = solve(n, b)\n\tprint(ans)\n", "from collections import Counter\nfrom itertools import groupby\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tc = Counter(s)\n\tprint(c['-'] + sum((ch == '-' for (ch, _) in groupby(s))) - bool(s[0] == s[-1] == '-' and c['-'] < n) if c['<'] * c['>'] else n)\n", "import sys\nimport math\nfrom collections import defaultdict, deque\ninput = sys.stdin.readline\n\ndef inar():\n\treturn [int(el) for el in input().split()]\n\ndef main():\n\tfor _ in range(int(input())):\n\t\tn = int(input())\n\t\ts = input()\n\t\td = defaultdict(int)\n\t\tfor i in s:\n\t\t\td[i] += 1\n\t\tif '<' not in d:\n\t\t\tprint(n)\n\t\telif '>' not in d:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tar = set()\n\t\t\tfor i in range(n):\n\t\t\t\tif s[i] == '-':\n\t\t\t\t\tar.add(i)\n\t\t\t\t\tar.add((i + 1) % n)\n\t\t\tprint(len(ar))\nmain()\n", "def findNum(s):\n\trooms = [0] * len(s)\n\tif '<' not in s or '>' not in s:\n\t\treturn len(s)\n\tfor i in range(len(s)):\n\t\tif i == 0 and (s[i] == '-' or s[len(s) - 1] == '-'):\n\t\t\trooms[i] = 1\n\t\telif s[i] == '-' or s[i - 1] == '-':\n\t\t\trooms[i] = 1\n\treturn sum(rooms)\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tprint(findNum(s))\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tcnt = 0\n\tfor i in range(0, n):\n\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\tcnt += 1\n\tif len(set(s)) == 1:\n\t\tcnt = n\n\telif len(set(s)) == 2:\n\t\tif '-' in set(s):\n\t\t\tcnt = n\n\tprint(cnt)\n", "for i1 in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tans = 0\n\tfor i in range(1, n + 1):\n\t\taage = s[i % n]\n\t\tpeeche = s[i - 1]\n\t\tif aage == '-' or peeche == '-':\n\t\t\tans += 1\n\tif '<' not in s or '>' not in s:\n\t\tans = n\n\tprint(ans)\n", "import sys\nfrom sys import stdin, stdout\n\ndef get_ints():\n\treturn map(int, sys.stdin.readline().strip().split())\nt = int(sys.stdin.readline())\nfor tt in range(t):\n\tn = input()\n\tn = int(n)\n\ts = input()\n\tx = list()\n\tfor i in range(n):\n\t\tx.append(0)\n\ta = 0\n\tb = 0\n\tc = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == '-':\n\t\t\tx[i] = 1\n\t\t\tx[(i + 1) % n] = 1\n\t\t\ta = a + 1\n\t\telif s[i] == '>':\n\t\t\tb = b + 1\n\t\telse:\n\t\t\tc = c + 1\n\tans = 0\n\tfor i in x:\n\t\tif i == 1:\n\t\t\tans = ans + 1\n\tif b == 0 or c == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(ans)\n", "t = input()\nt = int(t)\n\ndef solve(n, s):\n\tcnt1 = 0\n\tcnt2 = 0\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tcnt1 += 1\n\t\telif s[i] == '>':\n\t\t\tcnt2 += 1\n\tif cnt1 == 0 or cnt2 == 0:\n\t\tprint(n)\n\t\treturn\n\ts_hat = s + s[0]\n\tcnt = 0\n\tfor i in range(n):\n\t\tif s_hat[i] != '-' and s_hat[i + 1] != '-':\n\t\t\tcnt += 1\n\tprint(n - cnt)\nfor i in range(t):\n\tn = input()\n\tn = int(n)\n\ts = input()\n\tsolve(n, s)\n", "from sys import stdin, stdout\ninput = stdin.readline\nprint = lambda x: stdout.write(str(x) + '\\n')\nfor _ in range(int(input())):\n\tn = int(input())\n\ta = input().strip()\n\t(cw, acw) = (True, True)\n\tfor i in a:\n\t\tif i == '<':\n\t\t\tcw = False\n\t\tif i == '>':\n\t\t\tacw = False\n\tif cw or acw:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tif a[i] == '-' or a[i - 1] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "def solve():\n\tn = int(input())\n\trooms = input()\n\tedge_types = set(rooms)\n\tif not ('>' in edge_types and '<' in edge_types):\n\t\tprint(n)\n\t\treturn\n\tans = 0\n\tfor i in range(n):\n\t\tif rooms[i] == '-' or rooms[i - 1] == '-':\n\t\t\tans += 1\n\tprint(ans)\nfor _ in range(int(input())):\n\tsolve()\n", "from sys import stdin\nfor _ in range(int(stdin.readline())):\n\tlength = int(stdin.readline())\n\tarray = [i for i in stdin.readline().strip()]\n\tans = 0\n\tacount = 0\n\tbcount = 0\n\ttemp = []\n\ttotal = 0\n\tfor i in range(length):\n\t\ta = array[i]\n\t\tif a == '<':\n\t\t\ttemp.append(total)\n\t\t\ttotal = 0\n\t\t\tacount += 1\n\t\telif a == '>':\n\t\t\ttemp.append(total)\n\t\t\ttotal = 0\n\t\t\tbcount += 1\n\t\telse:\n\t\t\ttotal += 1\n\ttemp.append(total)\n\tif array[0] == '-' and array[-1] == '-' and (len(temp) > 1):\n\t\ttemp[0] += temp.pop()\n\tfor i in temp:\n\t\tif i > 0:\n\t\t\tans += i + 1\n\tif acount == 0 or bcount == 0:\n\t\tprint(length)\n\telse:\n\t\tprint(ans)\n", "def count_returnable_rooms(transporters):\n\ttransporter_types = set(transporters)\n\tif '>' in transporter_types and '<' in transporter_types:\n\t\tcounter = 0\n\t\tfor i in range(len(transporters)):\n\t\t\tif transporters[i] == '-' or transporters[i - 1] == '-':\n\t\t\t\tcounter += 1\n\t\treturn counter\n\telse:\n\t\treturn len(transporters)\nfor i in range(int(input())):\n\tn = input()\n\tprint(count_returnable_rooms(input()))\n", "for t in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif n == 1 or (n == 2 and '<' in s and ('>' in s)):\n\t\tprint(0)\n\telif '<' in s and '>' in s:\n\t\ts += s[0]\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\n", "def xl(n, s):\n\ta = [1 if i == '-' or i == '>' else 0 for i in s]\n\tb = [1 if i == '-' or i == '<' else 0 for i in s]\n\tif max(sum(a), sum(b)) == n:\n\t\tprint(n)\n\t\treturn\n\tprint(sum([1 if a[i] + b[i] == 2 or a[i - 1] + b[i - 1] == 2 else 0 for i in range(n)]))\n_ = int(input())\nfor i in range(_):\n\tn = int(input())\n\ts = input()\n\txl(n, s)\n", "def solve(n, s):\n\tright = left = False\n\tfor conv in s:\n\t\tif conv == '>':\n\t\t\tright = True\n\t\tif conv == '<':\n\t\t\tleft = True\n\tif not right or not left:\n\t\treturn n\n\trooms = {x: 0 for x in range(n)}\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\trooms[i] = rooms[(i + 1) % n] = 1\n\treturn sum(rooms.values())\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tprint(solve(n, s))\n", "import sys\ninput = sys.stdin.readline\n\ndef print(val):\n\tsys.stdout.write(str(val) + '\\n')\n\ndef prog():\n\tfor _ in range(int(input())):\n\t\tn = int(input())\n\t\ts = input().strip()\n\t\tif '>' in s and '<' in s:\n\t\t\tans = 0\n\t\t\ts = s[-1] + s\n\t\t\tfor i in range(n):\n\t\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\t\tans += 1\n\t\t\tprint(ans)\n\t\telse:\n\t\t\tprint(n)\nprog()\n", "t = int(input())\n\ndef solve(n, s):\n\tR = 0\n\tL = 0\n\tc = 0\n\tRc = 0\n\tLc = 0\n\tfor i in range(n):\n\t\tif s[-1 + i] == '-' or s[i] == '-':\n\t\t\tc += 1\n\t\telif s[-1 + i] == '>' and s[i] == '>':\n\t\t\tR += 1\n\t\telif s[-1 + i] == '<' and s[i] == '<':\n\t\t\tL += 1\n\t\tif s[i] == '>':\n\t\t\tRc += 1\n\t\telif s[i] == '<':\n\t\t\tLc += 1\n\tif Rc > 0 and Lc > 0:\n\t\tprint(c)\n\telse:\n\t\tprint(c + L + R)\nfor i in range(t):\n\tn = int(input())\n\ts = list(str(input()))\n\tsolve(n, s)\n", "for i in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tf = 1\n\tk = 1\n\tfor j in range(int(len(s))):\n\t\tif s[j] != '>' and s[j] != '-':\n\t\t\tf = 0\n\tfor j in range(int(len(s))):\n\t\tif s[j] != '<' and s[j] != '-':\n\t\t\tk = 0\n\tif f == 1 or k == 1:\n\t\tprint(int(len(s)))\n\t\tcontinue\n\tg = 0\n\tfor i in range(int(len(s))):\n\t\tif s[i] != '-' and s[(i + 1) % int(len(s))] != '-':\n\t\t\tg += 1\n\tprint(int(len(s)) - g)\n", "import os, sys\nfrom io import BytesIO, IOBase\n\ndef main():\n\tfor _ in range(int(input())):\n\t\tn = int(input())\n\t\ts = input().strip()\n\t\t(a, b, c) = (0, 0, 0)\n\t\tfor i in s:\n\t\t\ta += i == '>'\n\t\t\tb += i == '<'\n\t\t\tc += i == '-'\n\t\tif not a or not b:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tarr = [0] * n\n\t\t\tfor (ind, val) in enumerate(s):\n\t\t\t\tif val == '-':\n\t\t\t\t\tarr[ind] = 1\n\t\t\t\t\tarr[(ind + 1) % n] = 1\n\t\t\tprint(arr.count(1))\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tans = 0\n\tanti = s.count('<')\n\tclock = s.count('>')\n\tfor i in range(n):\n\t\tif i == 0:\n\t\t\tif s[i] == '-' or s[n - 1] == '-':\n\t\t\t\tans += 1\n\t\t\telif s[i] == '<':\n\t\t\t\tif clock == 0:\n\t\t\t\t\tans += 1\n\t\t\telif s[i] == '>':\n\t\t\t\tif anti == 0:\n\t\t\t\t\tans += 1\n\t\telif s[i] == '-' or s[i - 1] == '-':\n\t\t\tans += 1\n\t\telif s[i] == '<':\n\t\t\tif clock == 0:\n\t\t\t\tans += 1\n\t\telif s[i] == '>':\n\t\t\tif anti == 0:\n\t\t\t\tans += 1\n\tprint(ans)\n", "for c in range(int(input())):\n\t(n, s, ans) = (int(input()), input(), 0)\n\tif s.count('>') == 0 or s.count('<') == 0:\n\t\tprint(n)\n\t\tcontinue\n\telse:\n\t\tfor i in range(n):\n\t\t\tif '-' in (s[i], s[(i + 1) % n]):\n\t\t\t\tans += 1\n\tprint(ans)\n", "import sys\n\ndef input():\n\treturn sys.stdin.readline().strip()\n\ndef list2d(a, b, c):\n\treturn [[c for j in range(b)] for i in range(a)]\n\ndef list3d(a, b, c, d):\n\treturn [[[d for k in range(c)] for j in range(b)] for i in range(a)]\n\ndef list4d(a, b, c, d, e):\n\treturn [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]\n\ndef ceil(x, y=1):\n\treturn int(-(-x // y))\n\ndef INT():\n\treturn int(input())\n\ndef MAP():\n\treturn map(int, input().split())\n\ndef LIST(N=None):\n\treturn list(MAP()) if N is None else [INT() for i in range(N)]\n\ndef Yes():\n\tprint('Yes')\n\ndef No():\n\tprint('No')\n\ndef YES():\n\tprint('YES')\n\ndef NO():\n\tprint('NO')\nINF = 10 ** 19\nMOD = 10 ** 9 + 7\nEPS = 10 ** (-10)\nfor _ in range(INT()):\n\tN = INT()\n\tS = input()\n\tif not S.count('>') or not S.count('<'):\n\t\tprint(N)\n\t\tcontinue\n\tans = 0\n\tfor i in range(N):\n\t\tif S[i] == '-' or S[(i + 1) % N] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nfor tc in range(t):\n\tn = int(input())\n\tarr = input()\n\tcount = 0\n\tcountac = 0\n\tc = n\n\tfor i in range(n):\n\t\tif i == n - 1:\n\t\t\tcompare = 0\n\t\telse:\n\t\t\tcompare = i + 1\n\t\tif arr[compare] == '-' and arr[compare] == arr[i]:\n\t\t\tcount += 1\n\t\telif arr[compare] == '-' and arr[compare] != arr[i]:\n\t\t\tcount += 2\n\t(flagc, flagac) = (0, 0)\n\tfor i in range(n):\n\t\tif arr[i] == '>':\n\t\t\tflagc = 1\n\t\tif arr[i] == '<':\n\t\t\tflagac = 1\n\tif flagc != flagac or flagc == flagac == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(count)\n", "def main():\n\tn = int(input())\n\ts = input()\n\tif '>' not in s:\n\t\tprint(n)\n\telif '<' not in s:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tl = (i - 1 + n) % n\n\t\t\tif s[i] == '-' or s[l] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\nfor _ in range(int(input())):\n\tmain()\n", "import sys, os, io\n\ndef rs():\n\treturn sys.stdin.readline().rstrip()\n\ndef ri():\n\treturn int(sys.stdin.readline())\n\ndef ria():\n\treturn list(map(int, sys.stdin.readline().split()))\n\ndef ws(s):\n\tsys.stdout.write(s + '\\n')\n\ndef wi(n):\n\tsys.stdout.write(str(n) + '\\n')\n\ndef wia(a):\n\tsys.stdout.write(' '.join([str(x) for x in a]) + '\\n')\nimport math, datetime, functools, itertools, operator, bisect, fractions, statistics\nfrom collections import deque, defaultdict, OrderedDict, Counter\nfrom fractions import Fraction\nfrom decimal import Decimal\nfrom sys import stdout\n\ndef main():\n\tstarttime = datetime.datetime.now()\n\tif os.path.exists('input.txt'):\n\t\tsys.stdin = open('input.txt', 'r')\n\t\tsys.stdout = open('output.txt', 'w')\n\tfor _ in range(ri()):\n\t\tn = ri()\n\t\ts = list(rs())\n\t\td = Counter(s)\n\t\ts = [s[-1]] + s + [s[0]]\n\t\tif d['<'] == 0 or d['>'] == 0:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tans = 0\n\t\t\tfor i in range(1, n + 1):\n\t\t\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\t\tans += 1\n\t\t\tprint(ans)\n\tendtime = datetime.datetime.now()\n\ttime = (endtime - starttime).total_seconds() * 1000\n\tif os.path.exists('input.txt'):\n\t\tprint('Time:', time, 'ms')\n\nclass FastReader(io.IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, fd, chunk_size=1024 * 8):\n\t\tself._fd = fd\n\t\tself._chunk_size = chunk_size\n\t\tself.buffer = io.BytesIO()\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self, size=-1):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\nclass FastWriter(io.IOBase):\n\n\tdef __init__(self, fd):\n\t\tself._fd = fd\n\t\tself.buffer = io.BytesIO()\n\t\tself.write = self.buffer.write\n\n\tdef flush(self):\n\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass FastStdin(io.IOBase):\n\n\tdef __init__(self, fd=0):\n\t\tself.buffer = FastReader(fd)\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n\nclass FastStdout(io.IOBase):\n\n\tdef __init__(self, fd=1):\n\t\tself.buffer = FastWriter(fd)\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.flush = self.buffer.flush\nsys.stdin = FastStdin()\nsys.stdout = FastStdout()\nmain()\n", "import collections\n\ndef returnable(N, belts):\n\ttotal = 0\n\tlooking = {}\n\td = {'<': 0, '>': 0, '-': 0}\n\tfor i in range(len(belts)):\n\t\td[belts[i]] += 1\n\tfor i in range(-1, len(belts) - 1):\n\t\tif belts[i] == '-' or belts[i + 1] == '-':\n\t\t\tcontinue\n\t\tif belts[i] != belts[i + 1]:\n\t\t\ttotal += 1\n\t\telse:\n\t\t\tif belts[i] == '<':\n\t\t\t\tc = '>'\n\t\t\telse:\n\t\t\t\tc = '<'\n\t\t\tif d[c] > 0:\n\t\t\t\ttotal += 1\n\treturn N - total\nT = int(input())\nfor t in range(T):\n\tN = int(input())\n\tbelts = input()\n\tprint(returnable(N, belts))\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tl = set()\n\tif len(set(s)) == 1 or (len(set(s)) == 2 and '-' in s):\n\t\tprint(n)\n\telse:\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tl.add(i)\n\t\t\t\tl.add((i + 1) % n)\n\t\tprint(len(l))\n", "for i in range(int(input())):\n\tn = int(input())\n\ts = input()\n\ts = list(s)\n\ta = True\n\tb = True\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\ta = False\n\t\tif s[i] == '<':\n\t\t\tb = False\n\tif a or b:\n\t\tprint(n)\n\telse:\n\t\tcount = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\t\tcount += 1\n\t\tprint(count)\n", "def solve():\n\tn = int(input())\n\ts = input()\n\tl = m = r = 0\n\tfor i in s:\n\t\tif i == '-':\n\t\t\tm = 1\n\t\telif i == '>':\n\t\t\tr = 1\n\t\telse:\n\t\t\tl = 1\n\tif not l or not r:\n\t\tprint(n)\n\t\treturn\n\tres = 0\n\tfor i in range(n - 1):\n\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\tres += 1\n\tif s[0] == '-' or s[-1] == '-':\n\t\tres += 1\n\tprint(res)\nt = int(input())\nfor _ in range(t):\n\tsolve()\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tans = 0\n\tclockwiseflag = 1\n\tantiflag = 1\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tantiflag = 0\n\t\tif s[i] == '<':\n\t\t\tclockwiseflag = 0\n\tif clockwiseflag or antiflag:\n\t\tprint(n)\n\t\tcontinue\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "from math import *\nt = int(input())\nfor i in range(0, t):\n\tn = int(input())\n\ts = input()\n\tb = s.count('>') + s.count('-') == len(s) or s.count('<') + s.count('-') == len(s)\n\tif b:\n\t\tprint(n)\n\telse:\n\t\tk = 0\n\t\tl = list(s)\n\t\tfor j in range(0, n):\n\t\t\tif l[j % n] == '-' or l[(j - 1) % n] == '-':\n\t\t\t\tk += 1\n\t\tprint(k)\n", "TC = int(input())\nfor tc in range(TC):\n\tn = int(input())\n\ts = input()\n\thasCW = False\n\thasCCW = False\n\tfor c in s:\n\t\tif c == '>':\n\t\t\thasCW = True\n\t\tif c == '<':\n\t\t\thasCCW = True\n\tif hasCW and hasCCW:\n\t\ts += s[0]\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\n", "for _ in ' ' * int(input()):\n\tn = int(input())\n\ts = input()\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tif s[i - 1] != '-':\n\t\t\t\tans += 1\n\t\t\tans += 1\n\tif all((x == '-' or x == '>' for x in s)) or all((x == '-' or x == '<' for x in s)):\n\t\tans = n\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = list(input())\n\ts.append(s[0])\n\tans = 0\n\t(x, y, z) = (0, 0, 0)\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\tans += 1\n\t\tif s[i] == '>':\n\t\t\tx += 1\n\t\telif s[i] == '<':\n\t\t\ty += 1\n\t\telse:\n\t\t\tz += 1\n\tprint(ans if not max(x, y) + z == n else n)\n", "import sys, functools, collections, bisect, math, heapq\ninput = sys.stdin.readline\nsys.setrecursionlimit(300000)\nmod = 10 ** 9 + 7\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input().strip()\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tbreak\n\telse:\n\t\tprint(n)\n\t\tcontinue\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tbreak\n\telse:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "def solve():\n\tans = 0\n\tcumuRight = 0\n\tcumuLeft = 0\n\tfor i in range(len(arr)):\n\t\tif arr[i] == '>' and arr[(i + 1) % n] == '<':\n\t\t\tans += 1\n\t\telif arr[i] == '<' and arr[(i + 1) % n] == '>':\n\t\t\tans += 1\n\t\telif arr[i] == '<' and arr[(i + 1) % n] == '<':\n\t\t\tcumuLeft += 1\n\t\telif arr[i] == '>' and arr[(i + 1) % n] == '>':\n\t\t\tcumuRight += 1\n\tif '>' in arr:\n\t\tans += cumuLeft\n\tif '<' in arr:\n\t\tans += cumuRight\n\treturn n - ans\nT = int(input())\nfor t in range(T):\n\tn = int(input())\n\tarr = list(input())\n\tans = solve()\n\tprint(ans)\n", "q = int(input())\nfor _ in range(q):\n\tn = int(input())\n\ts = input()\n\tcnt = 0\n\t(left, right) = (0, 0)\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tright += 1\n\t\telif s[i] == '<':\n\t\t\tleft += 1\n\tcnt = n\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i - 1 + n) % n] == '-':\n\t\t\tcontinue\n\t\tif s[i] == '>' and s[(i - 1 + n) % n] != '-' and (left != 0):\n\t\t\tcnt -= 1\n\t\t\tcontinue\n\t\tif s[i] == '<' and s[(i - 1 + n) % n] != '-' and (right != 0):\n\t\t\tcnt -= 1\n\tprint(cnt)\n", "z = int(input())\nwhile z > 0:\n\tz -= 1\n\tp = int(input())\n\ts = input()\n\ts = list(s)\n\tq = 1\n\ta = 0\n\tb = 0\n\tc = 0\n\tfor i in range(p - 1):\n\t\tif s[i] == '<':\n\t\t\ta = 1\n\t\telif s[i] == '>':\n\t\t\tb = 1\n\t\telif s[i + 1] == '-':\n\t\t\tc += 1\n\t\telse:\n\t\t\tc += 2\n\tif s[p - 1] == '<':\n\t\ta = 1\n\telif s[p - 1] == '>':\n\t\tb = 1\n\telif s[p - 1] == '-':\n\t\tif s[0] == '-':\n\t\t\tc += 1\n\t\telse:\n\t\t\tc += 2\n\tif a == 1 and b == 1:\n\t\tif c == 0:\n\t\t\tprint(0)\n\t\telse:\n\t\t\tprint(c)\n\telif a == 0 or b == 0:\n\t\tprint(p)\n", "def main():\n\tfor _ in range(int(input())):\n\t\tn = int(input())\n\t\ta = list(input())\n\t\tif a.count('-') == n or a.count('>') == 0 or a.count('<') == 0:\n\t\t\tprint(n)\n\t\telse:\n\t\t\ti = 0\n\t\t\trev = {'<': '>', '>': '<'}\n\t\t\tr = 0\n\t\t\t(x, y) = (a.count('>'), a.count('<'))\n\t\t\tfor i in range(n):\n\t\t\t\tif a[i] == '-' or a[(i - 1) % n] == '-':\n\t\t\t\t\tr += 1\n\t\t\tprint(r)\nmain()\n", "t = int(input())\nfor tt in range(t):\n\tn = int(input())\n\ts = input()\n\tif '<' not in s or '>' not in s:\n\t\tans = n\n\telse:\n\t\tz = [0] * n\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tz[i] = 1\n\t\tans = sum(z)\n\tprint(ans)\n", "from sys import stdin, stdout\ntest = int(stdin.readline())\nfor _ in range(test):\n\tn = int(stdin.readline())\n\ts = stdin.readline().strip()\n\t(c1, c2, c3) = (s.count('>'), s.count('<'), s.count('-'))\n\tif c1 == 0 or c2 == 0:\n\t\tprint(n)\n\t\tcontinue\n\tif c3 == 0:\n\t\tprint(0)\n\t\tcontinue\n\t(ans, cnt) = (0, 1)\n\tch = 0\n\tstart = 0\n\tfor i in range(n):\n\t\tif s[i] != '-':\n\t\t\tstart = i\n\t\t\tbreak\n\ti = 0\n\tch = 0\n\twhile i < n:\n\t\tif s[start] != '-':\n\t\t\tif ch:\n\t\t\t\tans += cnt\n\t\t\tcnt = 1\n\t\t\tch = 0\n\t\telse:\n\t\t\tcnt += 1\n\t\t\tch = 1\n\t\tstart = (start + 1) % n\n\t\ti += 1\n\tif cnt != 1:\n\t\tans += cnt\n\tprint(ans)\n", "for t in range(int(input())):\n\tn = int(input())\n\tc = 0\n\ts = input()\n\tl = []\n\tfor i in s:\n\t\tif i != '-':\n\t\t\tl.append(i)\n\tl = set(l)\n\tif len(l) == 1:\n\t\tprint(n)\n\t\tcontinue\n\tfor i in range(0, n - 1):\n\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\tc += 1\n\tif s[n - 1] == '-' or s[0] == '-':\n\t\tc += 1\n\tc2 = 0\n\tfor i in range(1, n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tc2 += 1\n\tif s[n - 1] == '-' or s[0] == '-':\n\t\tc2 += 1\n\tprint(max(c, c2))\n", "total_num = int(input())\nwhile total_num != 0:\n\tnum = int(input())\n\ts = input()\n\tlength = len(s)\n\tans = 0\n\tcw = False\n\tacw = False\n\tfor i in s:\n\t\tif i == '>':\n\t\t\tcw = True\n\t\tif i == '<':\n\t\t\tacw = True\n\tif cw and acw:\n\t\ts += s[0]\n\t\tfor i in range(length):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(length)\n\ttotal_num = total_num - 1\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\tdirects = input()\n\tboth = set()\n\tall = True\n\tlast_seen = '-'\n\ti = 0\n\tfor direct in directs:\n\t\tif direct != '-':\n\t\t\tif last_seen == '-':\n\t\t\t\tlast_seen = direct\n\t\t\telif direct == '>' and last_seen == '<':\n\t\t\t\tall = False\n\t\t\telif direct == '<' and last_seen == '>':\n\t\t\t\tall = False\n\t\telse:\n\t\t\tboth.add(i)\n\t\t\tboth.add((i + 1) % n)\n\t\ti += 1\n\tif all:\n\t\tprint(n)\n\telse:\n\t\tprint(len(both))\n", "import sys\nimport random\nfrom typing import NamedTuple\ninput = sys.stdin.readline\nT = int(input())\nfor t in range(T):\n\tN = int(input())\n\tA = input().strip()\n\tright_loop = '<' not in A\n\tleft_loop = '>' not in A\n\tif left_loop or right_loop:\n\t\tprint(N)\n\t\tcontinue\n\tans = 0\n\tfor i in range(N):\n\t\tprev = (i - 1) % N\n\t\tif A[i] == '-' or A[prev] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "def solve(n, s):\n\tl = True\n\tr = True\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tl = False\n\t\tif s[i] == '<':\n\t\t\tr = False\n\tif l or r:\n\t\treturn n\n\telse:\n\t\tcnt = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\t\tcnt += 1\n\t\treturn cnt\nt = int(input())\nwhile t:\n\tn = int(input())\n\ts = input()\n\tprint(solve(n, s))\n\tt -= 1\n", "def inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s)])\n\ndef invr():\n\treturn map(int, input().split())\nn = inp()\nfor _ in range(n):\n\tt = inp()\n\ts = insr()\n\tleft = 0\n\tright = 0\n\tans = 0\n\tidx = 0\n\tprev = 0\n\twhile idx < len(s):\n\t\tif s[idx] == '<':\n\t\t\tleft += 1\n\t\t\tprev = 0\n\t\tif s[idx] == '>':\n\t\t\tright += 1\n\t\t\tprev = 0\n\t\tif s[idx] == '-':\n\t\t\tans += 2 - prev\n\t\t\tprev = 1\n\t\tidx += 1\n\tif right == 0 or left == 0:\n\t\tprint(len(s))\n\telse:\n\t\tif s[0] == '-' and s[-1] == '-':\n\t\t\tans -= 1\n\t\tprint(ans)\n", "import sys\n\ndef minp():\n\treturn sys.stdin.readline().strip()\n\ndef mint():\n\treturn int(minp())\n\ndef mints():\n\treturn map(int, minp().split())\n\ndef solve():\n\tn = mint()\n\ts = minp()\n\tc = 0\n\tr = True\n\tl = True\n\tfor i in range(n):\n\t\tr = r and (s[i] == '<' or s[i] == '-')\n\t\tl = l and (s[i] == '>' or s[i] == '-')\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tc += 1\n\tif r or l:\n\t\tprint(n)\n\telse:\n\t\tprint(c)\nfor i in range(mint()):\n\tsolve()\n", "import sys\nimport math\nimport bisect\nfrom sys import stdin, stdout\nfrom math import gcd, floor, sqrt, log\nfrom collections import defaultdict as dd\nfrom bisect import bisect_left as bl, bisect_right as br\nfrom collections import Counter\ninp = lambda : int(input())\nstrng = lambda : input().strip()\njn = lambda x, l: x.join(map(str, l))\nstrl = lambda : list(input().strip())\nmul = lambda : map(int, input().strip().split())\nmulf = lambda : map(float, input().strip().split())\nseq = lambda : list(map(int, input().strip().split()))\nceil = lambda x: int(x) if x == int(x) else int(x) + 1\nceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1\nflush = lambda : stdout.flush()\nstdstr = lambda : stdin.readline()\nstdint = lambda : int(stdin.readline())\nstdpr = lambda x: stdout.write(str(x))\nstdarr = lambda : map(int, stdstr().split())\nmod = 1000000007\nfor _ in range(stdint()):\n\tn = stdint()\n\ts = input()\n\tif len(set(s)) == 1:\n\t\tprint(n)\n\telif len(set(s)) == 2 and '-' in s:\n\t\tprint(n)\n\telse:\n\t\tl = [False] * n\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tl[i] = True\n\t\t\t\tl[(i + 1) % n] = True\n\t\tprint(l.count(True))\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tc = s.count('>')\n\tac = s.count('<')\n\tb = s.count('-')\n\tif c + b == n or ac + b == n:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tif s[0] == '-' or s[-1] == '-':\n\t\t\tans += 1\n\t\tif s[-1] == '-' or s[-2] == '-':\n\t\t\tans += 1\n\t\tfor i in range(1, n - 1):\n\t\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nfor tests in range(t):\n\tn = int(input())\n\tS = input().strip()\n\tif '>' in S and '<' in S:\n\t\tANS = 0\n\t\tfor i in range(n):\n\t\t\tif S[i] != '-' and S[i - 1] != '-':\n\t\t\t\tANS += 1\n\t\tprint(n - ANS)\n\telse:\n\t\tprint(n)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = str(input())\n\tarr = [-1] * n\n\treq = -1\n\ttemp = False\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tarr[i] = 1\n\t\t\tarr[(i + 1) % n] = 1\n\t\telif s[i] == '>' and temp == False:\n\t\t\treq = 0\n\t\t\ttemp = True\n\t\telif s[i] == '<' and temp == False:\n\t\t\treq = 1\n\t\t\ttemp = True\n\t\tif req == 0 and s[i] == '<':\n\t\t\treq = -1\n\t\telif req == 1 and s[i] == '>':\n\t\t\treq = -1\n\tif req != -1:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in arr:\n\t\t\tif i == 1:\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "def ii():\n\treturn int(input())\n\ndef mi():\n\treturn map(int, input().split())\n\ndef li():\n\treturn list(map(int, input().split()))\nt = int(input())\nfor _ in range(t):\n\tn = ii()\n\ts = str(input())\n\tsl = s.count('<')\n\tsg = s.count('>')\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tans += 1\n\t\telif s[i] == '>' and sl == 0:\n\t\t\tans += 1\n\t\telif s[i - 1] == '<' and sg == 0:\n\t\t\tans += 1\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\nI = lambda : list(map(int, input().split()))\n(t,) = I()\nfor _ in range(t):\n\t(n,) = I()\n\ts = input().strip()\n\t(a, b) = (s.count('<'), s.count('>'))\n\tif a == 0 or b == 0:\n\t\tprint(n)\n\telse:\n\t\tan = 2 * s.count('-')\n\t\tfor i in range(n):\n\t\t\tif s[i] == s[(i + 1) % n] and s[i] == '-':\n\t\t\t\tan -= 1\n\t\tprint(an)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tres = 0\n\ta = 0\n\tb = 0\n\tc = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\tres += 1\n\t\tif s[i] == '-':\n\t\t\ta += 1\n\t\tif s[i] == '<':\n\t\t\tb += 1\n\t\tif s[i] == '>':\n\t\t\tc += 1\n\tif a + b == n or a + c == n:\n\t\tprint(n)\n\telse:\n\t\tprint(res)\n", "import sys, math, cmath, time, collections\nstart_time = time.time()\n\ndef solve():\n\tn = inp()\n\ts = insr()\n\tqw = len(s)\n\tif len(set(list(s))) == 1:\n\t\tprint(len(s))\n\telif '-' not in s:\n\t\tprint(0)\n\telif len(set(list(s))) == 2:\n\t\tprint(len(s))\n\telse:\n\t\tq = [0] * len(s)\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == '-':\n\t\t\t\tq[i] = 1\n\t\t\t\tq[(i + 1) % qw] = 1\n\t\tprint(q.count(1))\n\ndef main():\n\tglobal tt\n\tif not ONLINE_JUDGE:\n\t\tsys.stdin = open('input.txt', 'r')\n\t\tsys.stdout = open('output.txt', 'w')\n\tt = 1\n\tt = inp()\n\tfor tt in range(1, t + 1):\n\t\tsolve()\n\tif not ONLINE_JUDGE:\n\t\tprint('Time Elapsed :', time.time() - start_time, 'seconds')\n\t\tsys.stdout.close()\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\treturn input().strip()\n\ndef invr():\n\treturn map(int, input().split())\n\ndef counter(a):\n\tq = [0] * max(a)\n\tfor i in range(len(a)):\n\t\tq[a[i] - 1] = q[a[i] - 1] + 1\n\treturn q\n\ndef counter_elements(a):\n\tq = dict()\n\tfor i in range(len(a)):\n\t\tif a[i] not in q:\n\t\t\tq[a[i]] = 0\n\t\tq[a[i]] = q[a[i]] + 1\n\treturn q\n\ndef string_counter(a):\n\tq = [0] * 26\n\tfor i in range(len(a)):\n\t\tq[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1\n\treturn q\n\ndef factorial(n, m=1000000007):\n\tq = 1\n\tfor i in range(n):\n\t\tq = q * (i + 1) % m\n\treturn q\n\ndef factors(n):\n\tq = []\n\tfor i in range(1, int(n ** 0.5) + 1):\n\t\tif n % i == 0:\n\t\t\tq.append(i)\n\t\t\tq.append(n // i)\n\treturn list(sorted(list(set(q))))\n\ndef prime_factors(n):\n\tq = []\n\twhile n % 2 == 0:\n\t\tq.append(2)\n\t\tn = n // 2\n\tfor i in range(3, int(n ** 0.5) + 1, 2):\n\t\twhile n % i == 0:\n\t\t\tq.append(i)\n\t\t\tn = n // i\n\tif n > 2:\n\t\tq.append(n)\n\treturn list(sorted(q))\n\ndef transpose(a):\n\t(n, m) = (len(a), len(a[0]))\n\tb = [[0] * n for i in range(m)]\n\tfor i in range(m):\n\t\tfor j in range(n):\n\t\t\tb[i][j] = a[j][i]\n\treturn b\n\ndef power_two(x):\n\treturn x and (not x & x - 1)\n\ndef ceil(a, b):\n\treturn -(-a // b)\n\ndef seive(n):\n\ta = [1]\n\tprime = [True for i in range(n + 1)]\n\tp = 2\n\twhile p * p <= n:\n\t\tif prime[p] == True:\n\t\t\tfor i in range(p ** 2, n + 1, p):\n\t\t\t\tprime[i] = False\n\t\tp = p + 1\n\tfor p in range(2, n + 1):\n\t\tif prime[p]:\n\t\t\ta.append(p)\n\treturn a\nONLINE_JUDGE = __debug__\nif ONLINE_JUDGE:\n\tinput = sys.stdin.readline\nmain()\n", "import sys, math, itertools, collections, copy\ninput = sys.stdin.readline\n\ndef solve():\n\tn = int(input())\n\tcircle = True\n\ts = input()\n\ts = s[:-1]\n\tfirst = None\n\tfor i in range(len(s)):\n\t\tif first is None and (s[i] == '<' or s[i] == '>'):\n\t\t\tfirst = s[i]\n\t\tif first != s[i] and s[i] != '-':\n\t\t\tcircle = False\n\t\t\tbreak\n\tif circle:\n\t\tprint(n)\n\telse:\n\t\tcnt = 0\n\t\tfor i in range(len(s)):\n\t\t\tif s[i] == '-':\n\t\t\t\tcnt += 1\n\t\t\t\tcontinue\n\t\t\tif i == 0:\n\t\t\t\tif s[n - 1] == '-':\n\t\t\t\t\tcnt += 1\n\t\t\telif i == n - 1:\n\t\t\t\tif s[n - 2] == '-':\n\t\t\t\t\tcnt += 1\n\t\t\telif s[i - 1] == '-':\n\t\t\t\tcnt += 1\n\t\tprint(cnt)\nT = int(input())\nfor t in range(T):\n\tsolve()\n", "for t in range(int(input())):\n\tn = list(range(int(input())))\n\ti = list(map(str, input()))\n\ti[0].split('(?!^)')\n\tk1 = all((c == '>' or c == '-' for c in i[0:]))\n\tk2 = all((c == '<' or c == '-' for c in i[0:]))\n\tk3 = all((c == '-' for c in i[0:]))\n\tcount = 0\n\tk = 0\n\th = 0\n\tif k1 == True or k2 == True or k3 == True:\n\t\tcount = count + len(n)\n\t\th = 1\n\telse:\n\t\tfor x in i:\n\t\t\tif x == '-':\n\t\t\t\tif count == 0:\n\t\t\t\t\tcount = count + 2\n\t\t\t\telif k == 1:\n\t\t\t\t\tcount = count + 2\n\t\t\t\t\tk = 0\n\t\t\t\telse:\n\t\t\t\t\tcount = count + 1\n\t\t\t\tif count == len(n):\n\t\t\t\t\tbreak\n\t\t\tif x == '<' and count > 0:\n\t\t\t\tk = 1\n\t\t\tif x == '>' and count > 0:\n\t\t\t\tk = 1\n\tif i[0] == '-' and i[len(i) - 1] == '-' and (h == 0):\n\t\tcount = count - 1\n\tprint(count)\n", "import sys\ninput = lambda : sys.stdin.readline().strip()\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tans = [0] * n\n\tif '<' in s and '>' in s:\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tans[i] = 1\n\t\t\t\tans[(i + 1) % n] = 1\n\telse:\n\t\tans = [1] * n\n\tprint(sum(ans))\n", "for i in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tans = 1\n\tcheck = s[0]\n\tfor j in range(n):\n\t\tif s[j] != '-':\n\t\t\tcheck = s[j]\n\t\t\tbreak\n\tif check == '-':\n\t\tprint(n)\n\telse:\n\t\tfor j in range(n):\n\t\t\tif s[j] == '-' or s[j] == check:\n\t\t\t\tpass\n\t\t\telse:\n\t\t\t\tans = 0\n\t\tif ans == 1:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tx = 0\n\t\t\tfor j in range(n):\n\t\t\t\tif s[j] == '-' or s[j - 1] == '-':\n\t\t\t\t\tx += 1\n\t\t\tprint(x)\n", "t = int(input())\nfor q in range(t):\n\tflag = 1\n\tn = int(input())\n\ta = input()\n\tcount = 0\n\ttemp = None\n\tfor i in a:\n\t\tif temp == None:\n\t\t\tif i == '>':\n\t\t\t\ttemp = '>'\n\t\t\telif i == '<':\n\t\t\t\ttemp = '<'\n\t\telse:\n\t\t\tif i == '<' and temp == '>':\n\t\t\t\tflag = 0\n\t\t\t\tbreak\n\t\t\tif i == '>' and temp == '<':\n\t\t\t\tflag = 0\n\t\t\t\tbreak\n\tif flag == 1:\n\t\tprint(len(a))\n\t\tcontinue\n\tfor i in range(len(a)):\n\t\tif a[i] == '-' or a[i - 1] == '-':\n\t\t\tcount += 1\n\tprint(count)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\tcounter = 0\n\ta = [j for j in input()]\n\tif not ('>' in a and '<' in a):\n\t\tcounter = n\n\telse:\n\t\tfor j in range(n):\n\t\t\tif a[j] == '-' or a[j - 1] == '-':\n\t\t\t\tcounter += 1\n\tprint(counter)\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input().rstrip()\n\tans = 0\n\tif n == 2:\n\t\tif s[0] == '>' and s[1] == '<' or (s[1] == '>' and s[0] == '<'):\n\t\t\tans = 0\n\t\telse:\n\t\t\tans = 2\n\telif s.count('<') == 0 or s.count('>') == 0:\n\t\tans = n\n\telse:\n\t\tans = s.count('-')\n\t\tflg = 0\n\t\ts += s[0]\n\t\tfor j in range(n + 1):\n\t\t\tif s[j] != '-':\n\t\t\t\tflg = 1\n\t\t\tif flg == 1 and s[j] == '-':\n\t\t\t\tflg = 0\n\t\t\t\tans += 1\n\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = input().strip()\n\t(ans, k, c) = (0, 0, '')\n\td = {'>': 0, '<': 0}\n\tfor i in range(n):\n\t\tif s[i] == '>' or s[i] == '<':\n\t\t\tif c == '':\n\t\t\t\tk += 1\n\t\t\t\tc = s[i]\n\t\t\telse:\n\t\t\t\tans += k\n\t\t\t\tc = s[i]\n\t\t\t\tk = 1\n\t\t\td[s[i]] += 1\n\t\telse:\n\t\t\tk = 0\n\t\t\tc = ''\n\tif s[0] == '>' or s[0] == '<':\n\t\tif c == '':\n\t\t\tk += 1\n\t\t\tc = s[0]\n\t\telse:\n\t\t\tans += k\n\t\t\tc = s[0]\n\t\t\tk = 1\n\telse:\n\t\tk = 0\n\t\tc = ''\n\tif d['>'] == 0 or d['<'] == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(n - ans)\n", "from collections import defaultdict as dd\nimport sys\ninput = sys.stdin.readline\nt = int(input())\nwhile t:\n\tn = int(input())\n\ts = input().split()[0]\n\ttot = len(s)\n\tif '>' in s and '<' in s:\n\t\tfor i in range(1, len(s)):\n\t\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tcontinue\n\t\t\telse:\n\t\t\t\ttot -= 1\n\t\tif s[0] == '-' or s[-1] == '-':\n\t\t\titsok = 0\n\t\telse:\n\t\t\ttot -= 1\n\tprint(tot)\n\tt -= 1\n", "from functools import reduce\nimport os\nimport sys\nfrom collections import *\nfrom math import *\nfrom bisect import *\nfrom heapq import *\nfrom io import BytesIO, IOBase\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\ndef value():\n\treturn tuple(map(int, input().split()))\n\ndef arr():\n\treturn [int(i) for i in input().split()]\n\ndef sarr():\n\treturn [int(i) for i in input()]\n\ndef starr():\n\treturn [str(x) for x in input().split()]\n\ndef inn():\n\treturn int(input())\n\ndef svalue():\n\treturn tuple(map(str, input().split()))\n\ndef parr():\n\treturn [value() for i in range(n)]\nmo = 1000000007\ninf = 1e+18\ndiv = 998244353\nfor _ in range(inn()):\n\tn = inn()\n\ta = input()\n\tln = len(set(a))\n\tif ln == 1:\n\t\tprint(n)\n\telse:\n\t\ti = 0\n\t\tc1 = 0\n\t\tc2 = 0\n\t\tans = [0] * n\n\t\twhile i < n:\n\t\t\tif a[i] == '-':\n\t\t\t\tans[i % n] = inf\n\t\t\t\tans[(i + 1) % n] = inf\n\t\t\t\ti += 1\n\t\t\telif a[i] == '>':\n\t\t\t\tc1 += 1\n\t\t\t\ti += 1\n\t\t\telse:\n\t\t\t\tc2 += 1\n\t\t\t\ti += 1\n\t\tres = 0\n\t\tfor i in ans:\n\t\t\tif i == inf:\n\t\t\t\tres += 1\n\t\tif c1 == 0 or c2 == 0:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tprint(res)\n", "from functools import reduce\nimport collections\nimport math\nimport sys\n\nclass Read:\n\n\t@staticmethod\n\tdef string():\n\t\treturn input()\n\n\t@staticmethod\n\tdef int():\n\t\treturn int(input())\n\n\t@staticmethod\n\tdef list(delimiter=' '):\n\t\treturn input().split(delimiter)\n\n\t@staticmethod\n\tdef list_int(delimiter=' '):\n\t\treturn list(map(int, input().split(delimiter)))\n\ndef main():\n\tt = Read.int()\n\tfor _ in range(t):\n\t\tn = Read.int()\n\t\ta = list(Read.string())\n\t\tc = collections.Counter(a)\n\t\tif len(c) == 3:\n\t\t\tres = 0\n\t\t\ta.append(a[0])\n\t\t\tfor i in range(n):\n\t\t\t\tif a[i + 1] == '-' or a[i] == '-':\n\t\t\t\t\tres += 1\n\t\t\tprint(res)\n\t\telif len(c) == 2 and (c['<'] == 0 or c['>'] == 0) or len(c) == 1:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tprint(0)\nmain()\n", "t = int(input())\nfor w in range(t):\n\tn = int(input())\n\ts = input()\n\tfrom collections import Counter\n\tcount = Counter(s)\n\tif count['>'] == 0:\n\t\tprint(n)\n\telif count['<'] == 0:\n\t\tprint(n)\n\telse:\n\t\tcount1 = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\t\tcount1 += 1\n\t\tprint(count1)\n", "import sys\ninput = sys.stdin.readline\n\ndef main():\n\tn = int(input())\n\tS = input().strip()\n\tif '>' not in S or '<' not in S:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif S[i - 1] == '-' or S[i] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\nfor _ in range(int(input())):\n\tmain()\n", "def room(s):\n\thascw = s.count('>') > 0\n\thascl = s.count('<') > 0\n\tif hascl and hascw:\n\t\ts += s[0]\n\t\tans = 0\n\t\tfor i in range(len(s) - 1):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\treturn ans\n\treturn len(s)\nfor i in range(int(input())):\n\ta = input()\n\ts = input()\n\tprint(room(s))\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ta = input()\n\ta = list(a)\n\tct = 0\n\tl = a.count('<')\n\tr = a.count('>')\n\tif l * r == 0:\n\t\tct = n\n\telse:\n\t\tfor j in range(n):\n\t\t\tif j == 0 and a[j] == '-':\n\t\t\t\tif a[n - 1] == '-':\n\t\t\t\t\tct += 1\n\t\t\t\telse:\n\t\t\t\t\tct += 2\n\t\t\telif a[j] == '-':\n\t\t\t\tif a[j - 1] == '-':\n\t\t\t\t\tct += 1\n\t\t\t\telse:\n\t\t\t\t\tct += 2\n\tprint(ct)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ta = list(input())\n\tans = 0\n\tfor i in range(n - 1):\n\t\tif a[i] == '<' and a[i + 1] == '>' or (a[i] == '>' and a[i + 1] == '<'):\n\t\t\tans += 1\n\tif a[0] == '<' and a[n - 1] == '>' or (a[0] == '>' and a[n - 1] == '<'):\n\t\tans += 1\n\tflag = False\n\t(c1, c2) = (0, 0)\n\togr1 = 0\n\togr2 = 0\n\tfor z in range(n):\n\t\tif a[z] == '<':\n\t\t\togr1 = 1\n\t\t\tbreak\n\tfor z in range(n):\n\t\tif a[z] == '>':\n\t\t\togr2 = 1\n\t\t\tbreak\n\tfor i in range(n - 1):\n\t\tif a[i] == '>' and a[i + 1] == '>':\n\t\t\tc1 += 1\n\t\tif a[i] == a[i + 1] == '<':\n\t\t\tc2 += 1\n\tif a[0] == '>' and a[n - 1] == '>':\n\t\tif ogr1 == 1:\n\t\t\tc1 += 1\n\tif a[0] == a[n - 1] == '<':\n\t\tif ogr2 == 1:\n\t\t\tc2 += 1\n\tif flag:\n\t\tprint(n)\n\telif c1 == c2 == 0:\n\t\tprint(n - ans)\n\telse:\n\t\tprint(n - ans - c1 * ogr1 - c2 * ogr2)\n", "from itertools import permutations\nfrom collections import defaultdict\nfrom math import *\nimport os\nimport sys\nfrom io import BytesIO, IOBase\nfrom heapq import nlargest\nfrom bisect import *\nimport copy\nimport itertools\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\n\ndef input():\n\treturn sys.stdin.readline().rstrip('\\r\\n')\nt = int(input())\nwhile t:\n\tt -= 1\n\tn = int(input())\n\ts = input()\n\td = defaultdict(int)\n\tdd = defaultdict(int)\n\tfor i in range(n):\n\t\tdd[s[i]] = 1\n\t\tif s[i] == '-':\n\t\t\td[i] == 1\n\t\t\td[(i + 1) % n] == 1\n\tif dd['>'] == 0 or dd['<'] == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(len(d))\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tb = []\n\tfor j in s:\n\t\tb.append(j)\n\tj = 0\n\tf = 0\n\tans = 0\n\twhile j < n:\n\t\tif b[j] == '-' or b[(j + 1) % n] == '-':\n\t\t\tans += 1\n\t\tj += 1\n\tif b.count('>') == 0 or b.count('<') == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(ans)\n", "cases = int(input())\nresultados = list()\n\ndef DetCiclo(vertices):\n\tCycRight = CycLeft = False\n\tciclo = True\n\tfor n in range(len(vertices)):\n\t\tif CycRight == False and CycLeft == False:\n\t\t\tif vertices[n] == '>':\n\t\t\t\tCycRight = True\n\t\t\telif vertices[n] == '<':\n\t\t\t\tCycLeft = True\n\t\telse:\n\t\t\tif CycLeft == True:\n\t\t\t\tif vertices[n] == '>':\n\t\t\t\t\tciclo = False\n\t\t\t\t\tbreak\n\t\t\tif CycRight == True:\n\t\t\t\tif vertices[n] == '<':\n\t\t\t\t\tciclo = False\n\t\t\t\t\tbreak\n\treturn ciclo\nfor n in range(cases):\n\trooms = int(input())\n\tbelts = input()\n\tciclo = DetCiclo(belts)\n\tcw = ccw = off = CUENTA = 0\n\tif ciclo == True:\n\t\tCUENTA = rooms\n\telse:\n\t\tfor n in range(rooms):\n\t\t\tif belts[n] == '-' or belts[n - 1] == '-':\n\t\t\t\tCUENTA += 1\n\tresultados.append(CUENTA)\nfor n in range(len(resultados)):\n\tprint(resultados[n])\n", "def f(s):\n\ta = []\n\tk = 0\n\tnach = True\n\tfor c in s:\n\t\tif c == '-':\n\t\t\tk += 1\n\t\telif k > 0:\n\t\t\ta.append(k)\n\t\t\tk = 0\n\t\tnach = False\n\tif k > 0:\n\t\ta.append(k)\n\tans = len(a)\n\tif s[0] == s[-1] == '-':\n\t\tans -= 1\n\treturn ans\nt = int(input())\nfor ti in range(t):\n\tn = int(input())\n\ts = input()\n\tif s.replace('-', '>') == '>' * n or s.replace('-', '<') == '<' * n:\n\t\tans = n\n\telif s.count('-') > 0:\n\t\tans = s.count('-') + f(s)\n\telse:\n\t\tans = 0\n\tprint(ans)\n", "from sys import stdin, stdout\nimport math\nimport heapq\nimport collections\ninput = stdin.readline\n\ndef inputnum():\n\treturn int(input())\n\ndef inputnums():\n\treturn map(int, input().split())\n\ndef inputlist():\n\treturn list(map(int, input().split()))\n\ndef inputstring():\n\treturn [x for x in input()]\n\ndef inputstrings():\n\treturn [x for x in input().split()]\n\ndef inputstringnum():\n\treturn [ord(x) - ord('a') for x in input()]\n\ndef inputmatrixchar(rows):\n\tarr2d = [[j for j in input().strip()] for i in range(rows)]\n\treturn arr2d\n\ndef inputmatrixint(rows):\n\tarr2d = []\n\tfor _ in range(rows):\n\t\tarr2d.append([int(i) for i in input().split()])\n\treturn arr2d\nt = int(input())\nfor q in range(t):\n\tn = inputnum()\n\ts = inputstring()\n\tl = False\n\tr = False\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tl = True\n\t\tif s[i] == '>':\n\t\t\tr = True\n\tif not (l and r):\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(n + i - 1) % n] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tcl = s.count('>')\n\tacl = s.count('<')\n\tboth = s.count('-')\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i - 1) % n] == '-':\n\t\t\tans += 1\n\t\telif cl == 0 or acl == 0:\n\t\t\tans += 1\n\tprint(ans)\n", "for t in range(int(input())):\n\tn = int(input())\n\tclkwise = [0 for i in range(n)]\n\tanticlkwise = [0 for i in range(n)]\n\tedges = input()\n\tclk_count = 0\n\tanticlk_count = 0\n\tboth = 0\n\tfor i in range(n):\n\t\tif edges[i] == '>':\n\t\t\tclkwise[i] = 1\n\t\t\tclk_count += 1\n\t\tif edges[i] == '<':\n\t\t\tanticlkwise[i] = 1\n\t\t\tanticlk_count += 1\n\t\tif edges[i] == '-':\n\t\t\tclkwise[i] = 1\n\t\t\tanticlkwise[i] = 1\n\t\t\tclk_count += 1\n\t\t\tanticlk_count += 1\n\tif clk_count == n or anticlk_count == n:\n\t\tprint(n)\n\telse:\n\t\tfor i in range(n):\n\t\t\tif clkwise[i] == 1 and anticlkwise[i] == 1 or (clkwise[i - 1] == 1 and anticlkwise[i - 1] == 1):\n\t\t\t\tboth += 1\n\t\tprint(both)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tcond1 = False\n\tcond2 = False\n\tfor c in s:\n\t\tif c == '>':\n\t\t\tcond1 = True\n\t\tif c == '<':\n\t\t\tcond2 = True\n\tif cond1 and cond2:\n\t\ts += s[0]\n\t\trjesenje = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\trjesenje += 1\n\t\tprint(rjesenje)\n\telse:\n\t\tprint(n)\n", "t = int(input())\nwhile t:\n\tt -= 1\n\tn = int(input())\n\ts = input().strip()\n\tleft = right = both = 0\n\tfor c in s:\n\t\tif c == '<':\n\t\t\tleft += 1\n\t\telif c == '>':\n\t\t\tright += 1\n\t\telif c == '-':\n\t\t\tboth += 1\n\tans = 0\n\tif not right or not left:\n\t\tprint(n)\n\telse:\n\t\tfor i in range(len(s)):\n\t\t\tif i == 0:\n\t\t\t\tif s[0] == '-':\n\t\t\t\t\tans += 1\n\t\t\t\tcontinue\n\t\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tans += 1\n\t\tif s[0] != '-' and s[-1] == '-':\n\t\t\tans += 1\n\t\tprint(ans)\n", "rn = lambda : int(input())\nrns = lambda : map(int, input().split())\nrl = lambda : list(map(int, input().split()))\nrs = lambda : input()\nyn = lambda x: print('Yes') if x else print('No')\nYN = lambda x: print('YES') if x else print('NO')\npl = lambda l: print(' '.join(list(map(str, l))))\nfor _ in range(rn()):\n\tn = rn()\n\ts = rs()\n\tans = 0\n\tmodes = set(s)\n\tcircle = False\n\tif len(modes) == 1 or (len(modes) == 2 and '-' in modes):\n\t\tcircle = True\n\tif circle:\n\t\tans = n\n\telse:\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\tpos = input()\n\tif not '>' in pos or not '<' in pos:\n\t\tprint(n)\n\telse:\n\t\tcnt = 0\n\t\tfor j in range(n):\n\t\t\tb1 = j\n\t\t\tb2 = (j - 1) % n\n\t\t\tif pos[b1] == '-' or pos[b2] == '-':\n\t\t\t\tcnt += 1\n\t\tprint(cnt)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tbelts = input()\n\tcb = [i for i in belts]\n\tc = cb.count('>')\n\ta = cb.count('<')\n\te = cb.count('-')\n\tif c + e == n or a + e == n:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tprev = (i - 1) % n\n\t\t\tnext = i\n\t\t\tif cb[prev] == '-' or cb[next] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "import sys\nfrom collections import deque\ninput = sys.stdin.readline\nfor _ in range(int(input())):\n\tn = int(input())\n\ta = input().strip('\\n')\n\tgraph = [[] for i in range(n)]\n\tif '>' not in a or '<' not in a:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tif a[i] == '-' or a[i - 1] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\n\ndef main():\n\tfor _ in range(int(input())):\n\t\tn = int(input())\n\t\ts = list(input())\n\t\taset = set(s)\n\t\tantiClock = False\n\t\tClock = False\n\t\tif '<' in aset:\n\t\t\tantiClock = True\n\t\tif '>' in aset:\n\t\t\tClock = True\n\t\tcnt = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tcnt += 1\n\t\t\tif s[i] == '>' and (not antiClock or s[(i - 1) % n] == '-'):\n\t\t\t\tcnt += 1\n\t\t\tif s[i] == '<' and (not Clock or s[(i - 1) % n] == '-'):\n\t\t\t\tcnt += 1\n\t\tprint(cnt)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "import math\nteststring = '1\\n5\\n>>-<-\\n'\nonline = 'Problem_B' not in __file__\n(true, false) = (True, False)\nif True:\n\n\tdef spitout():\n\t\tfor c in teststring.splitlines():\n\t\t\tyield c\n\t_ito = spitout()\n\tif not online:\n\n\t\tdef input():\n\t\t\treturn next(_ito)\n\n\tdef build_enum(*a):\n\t\tbuilt = dict()\n\t\tfor (i, c) in enumerate(a):\n\t\t\tbuilt[c] = i\n\t\treturn lambda x: built[x]\nT = int(input())\nfor ti in range(1, T + 1):\n\tn = int(input())\n\ts = input()\n\tr = [0] * n\n\tb = true\n\tb1 = b2 = 0\n\tans = 0\n\tfor i in range(n):\n\t\tp = (i - 1) % n\n\t\tif s[i] == '-' or s[p] == '-':\n\t\t\tr[i] = 1\n\t\t\tif s[i] == '>' or s[p] == '>':\n\t\t\t\tb1 += 1\n\t\t\telif s[i] == '<' or s[p] == '<':\n\t\t\t\tb2 += 1\n\t\telif s[i] == '>' and s[p] == '<':\n\t\t\tr[i] = -1\n\t\t\tb = false\n\t\telif s[i] == '<' and s[p] == '>':\n\t\t\tr[i] = -1\n\t\t\tb = false\n\t\telif s[i] == '>' and s[p] == '>':\n\t\t\tb1 += 1\n\t\telif s[i] == '<' and s[p] == '<':\n\t\t\tb2 += 1\n\tif b and (b1 == 0 or b2 == 0):\n\t\tans = n\n\telse:\n\t\tfor i in range(n):\n\t\t\tif r[i] == 1:\n\t\t\t\tans += 1\n\tprint(ans)\n", "from sys import stdin, stdout\nfrom math import gcd\ninput = stdin.readline\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = input()[:-1]\n\ta = b = 0\n\tfor i in s:\n\t\ta |= i in '>'\n\t\tb |= i in '<'\n\tif a and b:\n\t\tvis = [0] * n\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tvis[i] = vis[(i + 1) % n] = 1\n\t\tprint(sum(vis))\n\telse:\n\t\tprint(n)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tss = set(s)\n\tif '>' in ss and '<' in ss:\n\t\trr = [False] * n\n\t\tfor (i, c) in enumerate(s):\n\t\t\tj = (i + 1) % n\n\t\t\tif c == '-':\n\t\t\t\trr[i] = True\n\t\t\t\trr[j] = True\n\t\tprint(sum(rr))\n\telse:\n\t\tprint(n)\n", "t = int(input())\nwhile t > 0:\n\tt -= 1\n\tn = int(input())\n\tbelts = input()\n\tior = [0] * n\n\tif str.__contains__(belts, '>') and str.__contains__(belts, '<'):\n\t\tfor i in range(n):\n\t\t\tif belts[i] == '-':\n\t\t\t\tior[i] = ior[(i + 1) % n] = 1\n\t\tprint(sum(ior))\n\telse:\n\t\tprint(n)\n", "import sys\ninput = sys.stdin.readline\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tN = int(input())\n\t\tS = input().strip()\n\t\ttokei = [-1] * N\n\t\thantokei = [-1] * N\n\t\tif S.count('<') == 0 or S.count('>') == 0:\n\t\t\tprint(N)\n\t\t\tcontinue\n\t\ts = set()\n\t\tfor i in range(N):\n\t\t\tif S[i] == '-':\n\t\t\t\ts.add(i)\n\t\t\t\tif i == N - 1:\n\t\t\t\t\ts.add(0)\n\t\t\t\telse:\n\t\t\t\t\ts.add(i + 1)\n\t\tprint(len(s))\nmain()\n", "import sys\nfrom collections import defaultdict as dd\nfrom collections import Counter as cc\nfrom queue import Queue\nimport math\nimport itertools\ntry:\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\nexcept:\n\tpass\nfor _ in range(int(input())):\n\tw = int(input())\n\tq = input()\n\te = 0\n\tr = set(q)\n\tif len(r) == 1:\n\t\tprint(w)\n\telif len(r) == 2 and '-' in r:\n\t\tprint(w)\n\telse:\n\t\tfor i in range(w):\n\t\t\tif q[i] == '-':\n\t\t\t\te += 1\n\t\t\telif q[i - 1] == '-':\n\t\t\t\te += 1\n\t\tprint(e)\n", "import sys\ninput = sys.stdin.readline\n\ndef solve():\n\tn = int(input())\n\ts = input().strip()\n\tif not ('>' in set(s) and '<' in set(s)):\n\t\tprint(n)\n\t\treturn\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tans += 1\n\tprint(ans)\nfor _ in range(int(input())):\n\tsolve()\n", "def can_make_loop(belts):\n\tif '<' not in belts:\n\t\treturn True\n\tif '>' not in belts:\n\t\treturn True\n\treturn False\n\ndef solve(belts):\n\tlength = len(belts)\n\tif can_make_loop(belts):\n\t\treturn length\n\tres = 0\n\tfor i in range(length):\n\t\tif belts[i] == '-' or belts[(i - 1 + length) % length] == '-':\n\t\t\tres += 1\n\treturn res\nT = int(input())\nfor _ in range(T):\n\tn = int(input())\n\ts = input()\n\tprint(solve(s))\n", "t = int(input())\nfor case in range(t):\n\tn = int(input())\n\ts = input()\n\tif all((r != '<' for r in s)) or all((r != '>' for r in s)):\n\t\tprint(n)\n\telse:\n\t\tr = 0\n\t\tfor (a, b) in zip(s[-1] + s[:-1], s):\n\t\t\tif a == '-' or b == '-':\n\t\t\t\tr += 1\n\t\tprint(r)\n", "N = int(input())\nfor _ in range(N):\n\tn = int(input())\n\ts = input()\n\tisCircleRight = True\n\tisCircleLeft = True\n\tfor i in s:\n\t\tif i != '>' and i != '-':\n\t\t\tisCircleRight = False\n\t\t\tbreak\n\tfor i in s:\n\t\tif i != '<' and i != '-':\n\t\t\tisCircleLeft = False\n\t\t\tbreak\n\tif isCircleLeft or isCircleRight:\n\t\tprint(n)\n\telse:\n\t\tres = n\n\t\tfor i in range(n):\n\t\t\tif (s[i - 1] == '<' or s[i - 1] == '>') and (s[i] == '<' or s[i] == '>'):\n\t\t\t\tres -= 1\n\t\tprint(res)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tarr = list(input())\n\tcount = 0\n\tc1 = 0\n\tfor i in range(n):\n\t\tif arr[i] == '-':\n\t\t\tc1 += 1\n\t\telse:\n\t\t\tif c1 > 0:\n\t\t\t\tcount += c1 + 1\n\t\t\tc1 = 0\n\tif arr[0] == '-' and arr[-1] == '-' and (n != 2):\n\t\tcount -= 1\n\tif c1 > 0:\n\t\tcount += c1 + 1\n\tg1 = 0\n\tfor i in range(n):\n\t\tif arr[i] == '>':\n\t\t\tg1 += 1\n\t\t\tbreak\n\tg2 = 0\n\tfor i in range(n):\n\t\tif arr[i] == '<':\n\t\t\tg2 += 1\n\t\t\tbreak\n\tif g1 == 0 or g2 == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(count)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\t(first, second) = (0, 0)\n\tfor elem in s:\n\t\tif elem == '>':\n\t\t\tfirst += 1\n\t\telif elem == '<':\n\t\t\tsecond += 1\n\tif first == 0 or second == 0:\n\t\tprint(n)\n\telse:\n\t\tcnt = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tif s[i - 1] == '>' or s[i - 1] == '<':\n\t\t\t\t\tcnt += 2\n\t\t\t\telse:\n\t\t\t\t\tcnt += 1\n\t\tprint(cnt)\n", "for w in range(int(input())):\n\tn = int(input())\n\ts = str(input())\n\tif s.count('<') == 0 or s.count('>') == 0:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tstring = input()\n\treturnable = [0] * n\n\tclockwise = False\n\tanticlockwise = False\n\tfor (i, ch) in enumerate(string):\n\t\tif ch == '-':\n\t\t\tj = (i + 1) % n\n\t\t\treturnable[i] = returnable[j] = 1\n\t\tif ch == '>':\n\t\t\tclockwise = True\n\t\tif ch == '<':\n\t\t\tanticlockwise = True\n\tif clockwise and anticlockwise:\n\t\tprint(sum(returnable))\n\telse:\n\t\tprint(n)\n", "import sys\ninput = sys.stdin.readline\ntest_case_num = int(input())\nfor i in range(test_case_num):\n\tcnt = 0\n\troom = int(input())\n\tbelt_list = input()\n\tfor j in range(room):\n\t\tif belt_list[j] == '-' or belt_list[(room - 1 + j) % room] == '-':\n\t\t\tcnt += 1\n\t\t\tcontinue\n\t\telse:\n\t\t\tif belt_list[j] == '<':\n\t\t\t\tif not '>' in belt_list:\n\t\t\t\t\tcnt += 1\n\t\t\tif belt_list[j] == '>':\n\t\t\t\tif not '<' in belt_list:\n\t\t\t\t\tcnt += 1\n\tprint(cnt)\n", "testcases = int(input())\nfor testcae in range(testcases):\n\tn = int(input())\n\ttemparr = input()\n\tarr = []\n\tdash = 0\n\tforw = 0\n\tback = 0\n\tfor i in temparr:\n\t\tarr.append(i)\n\t\tif i == '-':\n\t\t\tdash += 1\n\t\tif i == '>':\n\t\t\tforw += 1\n\t\tif i == '<':\n\t\t\tback += 1\n\tans = 0\n\tfor i in range(n):\n\t\tif arr[i] == '-':\n\t\t\tans += 1\n\t\t\tcontinue\n\t\tif i == 0 and arr[-1] == '-':\n\t\t\tans += 1\n\t\t\tcontinue\n\t\tif i != 0 and i != arr[i - 1] == '-':\n\t\t\tans += 1\n\t\t\tcontinue\n\t\tif back == n or forw == n or back + dash == n or (forw + dash == n):\n\t\t\tans += 1\n\tprint(ans)\n", "for t in range(int(input())):\n\tn = int(input())\n\ts = input()\n\ta = '>' in s\n\tb = '<' in s\n\tif not (a and b):\n\t\tprint(n)\n\telse:\n\t\tline = False\n\t\tans = 0\n\t\tj = 0\n\t\tfor i in s:\n\t\t\tj += 1\n\t\t\tif i != '-' and line:\n\t\t\t\tans += 1\n\t\t\t\tline = False\n\t\t\tif i == '-':\n\t\t\t\tans += 1\n\t\t\t\tline = True\n\t\t\t\tif j == n and s[0] != '-':\n\t\t\t\t\tans += 1\n\t\tprint(ans)\n", "t = int(input())\nwhile t > 0:\n\tt -= 1\n\tn = int(input())\n\tarr = input()\n\trightforcount = 0\n\trightbackcount = 0\n\tleftforcount = 0\n\tleftbackcount = 0\n\tans = 0\n\tfor i in range(n):\n\t\tif arr[i] == '>':\n\t\t\trightforcount += 1\n\t\telif arr[i] == '<':\n\t\t\trightbackcount += 1\n\tif arr[0] == '-' or arr[-1] == '-':\n\t\tans += 1\n\telif arr[0] == '>':\n\t\trightforcount -= 1\n\t\tif rightbackcount == 0 and leftbackcount == 0:\n\t\t\tans += 1\n\t\tleftforcount += 1\n\telif arr[0] == '<':\n\t\trightbackcount -= 1\n\t\tif rightforcount == 0 and leftforcount == 0:\n\t\t\tans += 1\n\t\tleftbackcount += 1\n\tfor i in range(1, n):\n\t\tif arr[i] == '-' or arr[i - 1] == '-':\n\t\t\tans += 1\n\t\telif arr[i] == '>':\n\t\t\trightforcount -= 1\n\t\t\tif rightbackcount == 0 and leftbackcount == 0:\n\t\t\t\tans += 1\n\t\t\tleftforcount += 1\n\t\telif arr[i] == '<':\n\t\t\trightbackcount -= 1\n\t\t\tif rightforcount == 0 and leftforcount == 0:\n\t\t\t\tans += 1\n\t\t\tleftbackcount += 1\n\tprint(ans)\n", "import sys\nsys.setrecursionlimit(10 ** 7)\ninput = sys.stdin.readline\nf_inf = float('inf')\nmod = 10 ** 9 + 7\n\ndef resolve():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tn = int(input())\n\t\tS = list(input().rstrip())\n\t\tif '<' in set(S) and '>' in set(S):\n\t\t\tres = [False] * n\n\t\t\tfor i in range(n):\n\t\t\t\tif S[i] == '-':\n\t\t\t\t\tres[i] = True\n\t\t\t\t\tres[(i + 1) % n] = True\n\t\t\tprint(res.count(True))\n\t\telse:\n\t\t\tprint(n)\nresolve()\n", "def zip_sorted(a, b):\n\t(a, b) = zip(*sorted(zip(a, b)))\n\tsorted(zip(a, b), key=lambda x: x[1])\n\treturn (a, b)\nt = int(input())\nfor t1 in range(t):\n\tn = int(input())\n\ts = list(str(input()))\n\ta = []\n\tb = []\n\tsum1 = []\n\tsum2 = []\n\tfor k3 in range(len(s)):\n\t\tif s[k3] == '>':\n\t\t\ta.append(1)\n\t\t\tb.append(0)\n\t\telif s[k3] == '-':\n\t\t\ta.append(1)\n\t\t\tb.append(1)\n\t\telse:\n\t\t\ta.append(0)\n\t\t\tb.append(1)\n\tif sum(a) == n or sum(b) == n:\n\t\tprint(n)\n\telse:\n\t\tcount = 0\n\t\tfor k3 in range(len(s)):\n\t\t\tif k3 != 0:\n\t\t\t\tif s[k3] == '-' or s[k3 - 1] == '-':\n\t\t\t\t\tcount = count + 1\n\t\t\telif s[k3] == '-' or s[-1] == '-':\n\t\t\t\tcount = count + 1\n\t\tprint(count)\n", "t = int(input())\nwhile t > 0:\n\tn = int(input())\n\ts = str(input())\n\tflag1 = 1\n\tfor i in range(len(s)):\n\t\tif s[i] == '<':\n\t\t\tflag1 = 0\n\t\t\tbreak\n\tflag2 = 1\n\tfor i in range(len(s)):\n\t\tif s[i] == '>':\n\t\t\tflag2 = 0\n\t\t\tbreak\n\tif flag1 == 1 or flag2 == 1:\n\t\tans = n\n\telse:\n\t\tans = 0\n\t\ts = s + s[0]\n\t\tfor i in range(0, n, +1):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans = ans + 1\n\tprint(ans)\n\tt = t - 1\n", "t = int(input(''))\nfor _ in range(t):\n\tn = int(input(''))\n\ts = input('')\n\tcnt = 0\n\tif s.count('>') == 0:\n\t\tprint(n)\n\telif s.count('<') == 0:\n\t\tprint(n)\n\telse:\n\t\tdp = [0] * n\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tif i == n - 1:\n\t\t\t\t\tdp[i] = 1\n\t\t\t\t\tdp[0] = 1\n\t\t\t\telse:\n\t\t\t\t\tdp[i] = 1\n\t\t\t\t\tdp[i + 1] = 1\n\t\tprint(sum(dp))\n", "def hi(s):\n\ts = list(s)\n\tl = len(s)\n\tc = 0\n\t(a1, a2, a3) = (0, 0, 0)\n\tfor i in range(l):\n\t\tif s[i] == '-':\n\t\t\ta1 += 1\n\t\tif s[i] == '>':\n\t\t\ta2 += 1\n\t\tif s[i] == '<':\n\t\t\ta3 += 1\n\tif a1 + a2 == l and a3 == 0 or (a1 + a3 == l and a2 == 0):\n\t\treturn l\n\tfor i in range(l):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tc += 1\n\t\telif s[i] != s[i - 1]:\n\t\t\tpass\n\treturn c\nt = int(input())\nb = []\nfor i in range(t):\n\tk = int(input())\n\ts = input()\n\tb.append(hi(s))\nfor i in range(len(b)):\n\tprint(b[i])\n", "for _ in range(int(input())):\n\tn = int(input())\n\ta = input()\n\tblock1 = False\n\tblock2 = False\n\ta1 = a.replace('-', '<', a.count('-'))\n\tfor i in range(n):\n\t\tif a1[i] + a1[i - 1] == '<>' or a1[i] + a1[i - 1] == '><':\n\t\t\tblock1 = True\n\t\t\tbreak\n\ta1 = a.replace('-', '>', a.count('-'))\n\tfor i in range(n):\n\t\tif a1[i] + a1[i - 1] == '<>' or a1[i] + a1[i - 1] == '><':\n\t\t\tblock2 = True\n\t\t\tbreak\n\tif not block1 & block2:\n\t\tprint(n)\n\telse:\n\t\tdec = {}\n\t\tfor i in range(n):\n\t\t\tif a[i] == '-':\n\t\t\t\tdec[i] = 1\n\t\t\t\tdec[(i + 1) % n] = 1\n\t\tprint(len(dec))\n", "def beltedRooms(n, array):\n\tarray = list(array)\n\tans = [0] * n\n\tflag_left = 0\n\tflag_right = 0\n\tfor x in range(n):\n\t\tif array[x] == '>':\n\t\t\tflag_left = 1\n\t\telif array[x] == '<':\n\t\t\tflag_right = 1\n\tif flag_left != flag_right:\n\t\treturn n\n\telse:\n\t\tif array[-1] == '-' or array[0] == '-':\n\t\t\tans[0] = 1\n\t\telse:\n\t\t\tans[0] = 0\n\t\tfor x in range(n - 1):\n\t\t\tif array[x] == '-' or array[x + 1] == '-':\n\t\t\t\tans[x + 1] = 1\n\t\t\telse:\n\t\t\t\tans[x + 1] = 0\n\tc = 0\n\tfor x in ans:\n\t\tif x == 1:\n\t\t\tc += 1\n\treturn c\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tprint(beltedRooms(n, s))\n", "def solve(n, s):\n\t(count1, count2, count3) = (0, 0, 0)\n\tans = 0\n\tfor c in s:\n\t\tif c == '<':\n\t\t\tcount1 += 1\n\t\telif c == '>':\n\t\t\tcount2 += 1\n\t\telif c == '-':\n\t\t\tcount3 += 1\n\tif count1 == 0 or count2 == 0:\n\t\treturn n\n\telse:\n\t\tfor i in range(n):\n\t\t\tif s[(i + 1) % n] == '-' or s[i % n] == '-':\n\t\t\t\tans += 1\n\t\treturn ans\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = list(input())\n\tprint(solve(n, s))\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tflag = 0\n\tenter = 0\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tenter = 1\n\t\t\tfor j in range(i, n):\n\t\t\t\tif s[j] == '<':\n\t\t\t\t\tflag = 1\n\t\t\t\t\tbreak\n\t\telif s[i] == '<':\n\t\t\tenter = 1\n\t\t\tfor j in range(i, n):\n\t\t\t\tif s[j] == '>':\n\t\t\t\t\tflag = 1\n\t\t\t\t\tbreak\n\t\tif enter == 1:\n\t\t\tbreak\n\tif flag == 0:\n\t\tprint(n)\n\telse:\n\t\tcount = 0\n\t\tfor i in range(n):\n\t\t\tif i == 0:\n\t\t\t\tif s[i] == '-' or s[n - 1] == '-':\n\t\t\t\t\tcount += 1\n\t\t\telif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tcount += 1\n\t\tprint(count)\n", "for i in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tc = []\n\tif len(list(set(s))) == 1:\n\t\tprint(n)\n\telif len(list(set(s))) == 2 and '-' in s:\n\t\tprint(n)\n\telse:\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tc.append(i)\n\t\t\t\tc.append((i + 1) % n)\n\t\tprint(len(list(set(c))))\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tif '>' not in s or '<' not in s:\n\t\tprint(n)\n\t\tcontinue\n\telse:\n\t\tr = [0] * n\n\t\tp = 0\n\t\tfor j in s:\n\t\t\tif j == '-':\n\t\t\t\tr[p] = 1\n\t\t\t\tif p == n - 1:\n\t\t\t\t\tr[0] = 1\n\t\t\t\t\tcontinue\n\t\t\t\tr[p + 1] = 1\n\t\t\tp += 1\n\tprint(sum(r))\n", "import sys\ninp = sys.stdin.buffer.readline\ninar = lambda : list(map(int, inp().split()))\ninin = lambda : int(inp())\ninst = lambda : inp().decode().strip()\nwrt = sys.stdout.write\npr = lambda *args, end='\\n': wrt(' '.join([str(x) for x in args]) + end)\nenum = enumerate\ninf = float('inf')\ncdiv = lambda x, y: -(-x // y)\nmod = 1000000007\n_T_ = inin()\nfor _t_ in range(_T_):\n\tn = inin()\n\ts = inst()\n\tcs = s[:]\n\ts = set(s)\n\tif s == {'<', '-'} or s == {'-'} or s == {'-', '>'} or (s == {'<'}) or (s == {'>'}):\n\t\tprint(n)\n\telif s == {'>', '<'}:\n\t\tprint(0)\n\telse:\n\t\tvis = set()\n\t\tfor i in range(n):\n\t\t\tif cs[i] == '-':\n\t\t\t\tvis.add(i)\n\t\t\t\tvis.add((i + 1) % n)\n\t\tprint(len(vis))\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tbelt = input()\n\tif belt.count('>') == 0 or belt.count('<') == 0:\n\t\tprint(n)\n\telse:\n\t\ts = set()\n\t\tfor i in range(n):\n\t\t\tif belt[i] == '-':\n\t\t\t\ts.add(i)\n\t\t\t\ts.add((i + 1) % n)\n\t\tprint(len(s))\n", "test = int(input())\nwhile test:\n\ttest = test - 1\n\tn = int(input())\n\tx = input()\n\tf1 = False\n\tf2 = False\n\tans = 0\n\tx = x[n - 1] + x\n\tfor i in range(1, n + 1):\n\t\tif x[i] == '-' or x[i - 1] == '-':\n\t\t\tans += 1\n\t\tif x[i] == '>':\n\t\t\tf1 = True\n\t\tif x[i] == '<':\n\t\t\tf2 = True\n\tif f1 and f2:\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\n", "t = int(input())\nfor test in range(t):\n\tn = int(input())\n\ts = input()\n\tst = set(s)\n\tif st == {'<'} or st == {'>'} or st == {'<', '-'} or (st == {'>', '-'}) or (st == {'-'}):\n\t\tprint(n)\n\telse:\n\t\tct = 0\n\t\tfor i in range(len(s)):\n\t\t\tif i == 0:\n\t\t\t\tt = (s[-1], s[0])\n\t\t\telse:\n\t\t\t\tt = (s[i], s[i - 1])\n\t\t\tif '-' in t:\n\t\t\t\tct += 1\n\t\tprint(ct)\n", "for i in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif len(set(s)) == 1 or (len(set(s)) == 2 and '-' in s):\n\t\tprint(n)\n\t\tcontinue\n\tl = 0\n\tp = [1 for i in range(n)]\n\tfor i in range(n):\n\t\tif s[i] == '-' and p[i]:\n\t\t\tl += 1\n\t\t\tp[i] = 0\n\t\t\tif p[(i + 1) % n]:\n\t\t\t\tl += 1\n\t\t\t\tp[(i + 1) % n] = 0\n\t\telif s[i] == '-' and p[(i + 1) % n]:\n\t\t\tl += 1\n\t\t\tp[(i + 1) % n] = 0\n\tprint(l)\n", "for _ in range(int(input())):\n\tn = int(input())\n\td = input()\n\tif '<' not in d or '>' not in d:\n\t\tprint(n)\n\telse:\n\t\ta = [0] * n\n\t\tfor i in range(n):\n\t\t\tif d[i] == '-':\n\t\t\t\ta[i] = a[(i + 1) % n] = 1\n\t\tprint(sum(a))\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\tmot = input()\n\tnbpg = 0\n\tnbpp = 0\n\tfor x in mot:\n\t\tif x == '<':\n\t\t\tnbpp += 1\n\t\tif x == '>':\n\t\t\tnbpg += 1\n\trep = 0\n\tfor i in range(n):\n\t\tj = (i + 1) % n\n\t\tif mot[i] == '-' or mot[j] == '-':\n\t\t\trep += 1\n\t\telif mot[i] == mot[j]:\n\t\t\tif nbpp == 0 or nbpg == 0:\n\t\t\t\trep += 1\n\tprint(rep)\n", "from sys import stdin, stdout\nimport math, bisect\nfrom collections import Counter, deque, defaultdict\nL = lambda : list(map(int, stdin.readline().strip().split()))\nM = lambda : map(int, stdin.readline().strip().split())\nI = lambda : int(stdin.readline().strip())\nS = lambda : stdin.readline().strip()\nC = lambda : stdin.readline().strip().split()\n\ndef pr(a):\n\treturn ' '.join(list(map(str, a)))\n\ndef solve():\n\tn = I()\n\tans = 0\n\ts = S()\n\tif s.count('>') == 0 or s.count('<') == 0:\n\t\tprint(n)\n\telse:\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\nfor _ in range(I()):\n\tsolve()\n", "from __future__ import division, print_function\nfrom fractions import Fraction\nimport sys\nimport os\nfrom io import BytesIO, IOBase\nfrom itertools import *\nimport bisect\nfrom heapq import *\nfrom math import ceil, floor\nfrom copy import *\nfrom collections import deque, defaultdict\nfrom collections import Counter as counter\nfrom itertools import combinations\nfrom itertools import permutations as permutate\nfrom bisect import bisect_left as bl\nfrom operator import *\nfrom bisect import bisect_right as br\nfrom bisect import bisect\nBUFSIZE = 8192\nfrom sys import stderr\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n\ndef print(*args, **kwargs):\n\t(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))\n\tat_start = True\n\tfor x in args:\n\t\tif not at_start:\n\t\t\tfile.write(sep)\n\t\tfile.write(str(x))\n\t\tat_start = False\n\tfile.write(kwargs.pop('end', '\\n'))\n\tif kwargs.pop('flush', False):\n\t\tfile.flush()\nif sys.version_info[0] < 3:\n\t(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))\nelse:\n\t(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\nfrom types import GeneratorType\n\ndef iterative(f, stack=[]):\n\tprint(stack)\n\n\tdef wrapped_func(*args, **kwargs):\n\t\tif stack:\n\t\t\treturn f(*args, **kwargs)\n\t\tto = f(*args, **kwargs)\n\t\twhile True:\n\t\t\tif type(to) is GeneratorType:\n\t\t\t\tstack.append(to)\n\t\t\t\tto = next(to)\n\t\t\t\tcontinue\n\t\t\tstack.pop()\n\t\t\tif not stack:\n\t\t\t\tbreak\n\t\t\tto = stack[-1].send(to)\n\t\treturn to\n\treturn wrapped_func\nmod = 1000000007\n\ndef inp():\n\treturn sys.stdin.readline().rstrip('\\r\\n')\n\ndef out(var):\n\tsys.stdout.write(str(var))\n\ndef lis():\n\treturn list(map(int, inp().split()))\n\ndef stringlis():\n\treturn list(map(str, inp().split()))\n\ndef sep():\n\treturn map(int, inp().split())\n\ndef strsep():\n\treturn map(str, inp().split())\n\ndef fsep():\n\treturn map(float, inp().split())\n\ndef nextline():\n\tout('\\n')\n\ndef testcase(t):\n\tfor p in range(t):\n\t\tsolve()\n\ndef pow(x, y, p):\n\tres = 1\n\tx = x % p\n\tif x == 0:\n\t\treturn 0\n\twhile y > 0:\n\t\tif y & 1 == 1:\n\t\t\tres = res * x % p\n\t\ty = y >> 1\n\t\tx = x * x % p\n\treturn res\nfrom functools import reduce\n\ndef factors(n):\n\treturn set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))\n\ndef gcd(a, b):\n\tif a == b:\n\t\treturn a\n\twhile b > 0:\n\t\t(a, b) = (b, a % b)\n\treturn a\n\ndef prefix_sum(ar):\n\treturn list(accumulate(ar))\n\ndef suffix_sum(ar):\n\treturn list(accumulate(ar[::-1]))[::-1]\n\ndef N():\n\treturn int(inp())\nfrom collections import defaultdict\n\ndef numberOfSetBits(i):\n\ti = i - (i >> 1 & 1431655765)\n\ti = (i & 858993459) + (i >> 2 & 858993459)\n\treturn ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24\n\ndef solve():\n\tn = N()\n\ts = inp()\n\tc_ = 0\n\ta = True\n\tb = True\n\tfor c in s:\n\t\tif c == '<':\n\t\t\ta = False\n\t\tif c == '>':\n\t\t\tb = False\n\tif a or b:\n\t\tprint(n)\n\t\treturn\n\tse = set()\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tse.add(i)\n\t\t\tse.add((i + 1) % n)\n\tprint(len(se))\ntestcase(int(inp()))\n", "import sys\n\ndef input():\n\treturn sys.stdin.readline().rstrip()\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\tinp = input()\n\thasAdvantage = 0\n\tgtCount = 0\n\tltCount = 0\n\tfor i in range(0, n):\n\t\tif inp[i] == '-' or inp[i - 1] == '-':\n\t\t\thasAdvantage += 1\n\t\tif inp[i] == '>':\n\t\t\tgtCount += 1\n\t\tif inp[i] == '<':\n\t\t\tltCount += 1\n\tif ltCount > 0 and gtCount > 0:\n\t\tprint(hasAdvantage)\n\telse:\n\t\tprint(n)\n", "T = int(input())\nfor t in range(1, T + 1):\n\tn = int(input())\n\ta = list(input())\n\t(d, g, ans) = (0, 0, 0)\n\tfor i in range(n):\n\t\tif a[i] == '-':\n\t\t\tif i > 0:\n\t\t\t\tif a[i - 1] == '-':\n\t\t\t\t\tans = ans + 1\n\t\t\t\telse:\n\t\t\t\t\tans = ans + 2\n\t\t\telse:\n\t\t\t\tans = ans + 2\n\t\telse:\n\t\t\tif a[i] == '>':\n\t\t\t\td = d + 1\n\t\t\tif a[i] == '<':\n\t\t\t\tg = g + 1\n\tif d * g != 0:\n\t\tif (a[0] == '-') & (a[n - 1] == '-'):\n\t\t\tprint('{}'.format(ans - 1))\n\t\telse:\n\t\t\tprint('{}'.format(ans))\n\telse:\n\t\tprint('{}'.format(n))\n", "def main():\n\tn = int(input())\n\ts = input().strip()\n\tleft = False\n\tright = False\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tleft = True\n\t\telif s[i] == '>':\n\t\t\tright = True\n\tif left and right:\n\t\tcnt = 0\n\t\tfor i in range(n):\n\t\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\t\tcnt += 1\n\t\tprint(cnt)\n\telse:\n\t\tprint(n)\nfor _ in range(int(input())):\n\tmain()\n", "n = int(input())\nfor _ in range(n):\n\tk = int(input())\n\ts = input().strip()\n\tif s.count('>') == 0 or s.count('<') == 0:\n\t\tprint(k)\n\t\tcontinue\n\tsm = 0\n\tfor (i, v) in enumerate(s):\n\t\tif v == '-':\n\t\t\tsm += 1\n\t\telif s[i - 1] == '-':\n\t\t\tsm += 1\n\tprint(sm)\n", "import os\nfrom io import BytesIO, IOBase\nimport sys\nfrom collections import defaultdict, deque, Counter\nfrom bisect import *\nfrom math import sqrt, pi, ceil\nimport math\nfrom itertools import permutations\nfrom copy import deepcopy\n\ndef main():\n\tfor t in range(int(input())):\n\t\tn = int(input())\n\t\ta = list(input().rstrip())\n\t\tans = 0\n\t\tb = a.count('>')\n\t\tc = a.count('<')\n\t\tfor i in range(n):\n\t\t\tif a[i] == '-':\n\t\t\t\tans += 1\n\t\t\telif a[i] == '<' and b == 0 or a[i - 1] == '-':\n\t\t\t\tans += 1\n\t\t\telif a[i] == '>' and c == 0 or a[i - 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "import sys\nii = lambda : sys.stdin.readline().strip()\nidata = lambda : [int(x) for x in ii().split()]\n\ndef solve():\n\tn = int(ii())\n\ts = ii()\n\tif s.count('>') == 0 or s.count('<') == 0:\n\t\tprint(n)\n\telse:\n\t\tdata = [0] * n\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tdata[i] = 1\n\t\t\t\tdata[(i + 1) % n] = 1\n\t\tprint(sum(data))\n\treturn\nfor t in range(int(ii())):\n\tsolve()\n", "from collections import Counter as ctr\ninp = lambda : int(input())\nstrl = lambda : list(input().strip())\nseq = lambda : list(map(int, input().strip().split()))\n\ndef results(arr, n):\n\tiscw = False\n\tisccw = False\n\tfor i in arr:\n\t\tif i == '>':\n\t\t\tiscw = True\n\t\tif i == '<':\n\t\t\tisccw = True\n\tif iscw and isccw:\n\t\tans = 0\n\t\tarr += arr[0]\n\t\tfor i in range(n):\n\t\t\tif arr[i] == '-' or arr[i + 1] == '-':\n\t\t\t\tans += 1\n\t\treturn ans\n\telse:\n\t\treturn n\n\ndef main():\n\tt = inp()\n\tfor _ in range(t):\n\t\tn = inp()\n\t\ta = input()\n\t\tresult = results(a, n)\n\t\tprint(result)\nmain()\n", "from __future__ import division, print_function\nimport os, sys\nfrom io import BytesIO, IOBase\nif sys.version_info[0] < 3:\n\tfrom __builtin__ import xrange as range\n\tfrom future_builtins import ascii, filter, hex, map, oct, zip\n\ndef ii():\n\treturn int(input())\n\ndef si():\n\treturn input()\n\ndef mi():\n\treturn map(int, input().strip().split(' '))\n\ndef msi():\n\treturn map(str, input().strip().split(' '))\n\ndef li():\n\treturn list(mi())\n\ndef dmain():\n\tsys.setrecursionlimit(1000000)\n\tthreading.stack_size(1024000)\n\tthread = threading.Thread(target=main)\n\tthread.start()\nimport sys\ninput = sys.stdin.readline\nscanner = lambda : int(input())\nstring = lambda : input().rstrip()\nget_list = lambda : list(read())\nread = lambda : map(int, input().split())\nget_float = lambda : map(float, input().split())\n\ndef ceil(x):\n\tif x != int(x):\n\t\tx = int(x) + 1\n\treturn x\n\ndef factorial(x, m):\n\tval = 1\n\twhile x > 0:\n\t\tval = val * x % m\n\t\tx -= 1\n\treturn val\n\ndef fact(x):\n\tval = 1\n\twhile x > 0:\n\t\tval *= x\n\t\tx -= 1\n\treturn val\n\ndef swaparr(arr, a, b):\n\ttemp = arr[a]\n\tarr[a] = arr[b]\n\tarr[b] = temp\n\ndef gcd(a, b):\n\tif b == 0:\n\t\treturn a\n\treturn gcd(b, a % b)\n\ndef lcm(a, b):\n\treturn a * b // math.gcd(a, b)\n\ndef is_integer(n):\n\treturn math.ceil(n) == math.floor(n)\n\ndef nCr(n, k):\n\tif k > n:\n\t\treturn 0\n\tif k > n - k:\n\t\tk = n - k\n\tres = 1\n\tfor i in range(k):\n\t\tres = res * (n - i)\n\t\tres = res / (i + 1)\n\treturn int(res)\n\ndef primefs(n):\n\tprimes = {}\n\twhile n % 2 == 0 and n > 0:\n\t\tprimes[2] = primes.get(2, 0) + 1\n\t\tn = n // 2\n\tfor i in range(3, int(n ** 0.5) + 2, 2):\n\t\twhile n % i == 0 and n > 0:\n\t\t\tprimes[i] = primes.get(i, 0) + 1\n\t\t\tn = n // i\n\tif n > 2:\n\t\tprimes[n] = primes.get(n, 0) + 1\n\treturn primes\n\ndef power(x, y, p):\n\tif y == 0:\n\t\treturn 1\n\tres = 1\n\tx = x % p\n\tif x == 0:\n\t\treturn 0\n\twhile y > 0:\n\t\tif y & 1 == 1:\n\t\t\tres = res * x % p\n\t\ty = y >> 1\n\t\tx = x * x % p\n\treturn res\n\ndef swap(a, b):\n\ttemp = a\n\ta = b\n\tb = temp\n\treturn (a, b)\n\ndef find(x, link):\n\tp = x\n\twhile p != link[p]:\n\t\tp = link[p]\n\twhile x != p:\n\t\tnex = link[x]\n\t\tlink[x] = p\n\t\tx = nex\n\treturn p\n\ndef union(x, y, link, size):\n\tx = find(x, link)\n\ty = find(y, link)\n\tif size[x] < size[y]:\n\t\t(x, y) = swap(x, y)\n\tif x != y:\n\t\tsize[x] += size[y]\n\t\tlink[y] = x\n\ndef sieve(n):\n\tprime = [True for i in range(n + 1)]\n\t(prime[0], prime[1]) = (False, False)\n\tp = 2\n\twhile p * p <= n:\n\t\tif prime[p] == True:\n\t\t\tfor i in range(p * p, n + 1, p):\n\t\t\t\tprime[i] = False\n\t\tp += 1\n\treturn prime\n\ndef phi(n):\n\tresult = n\n\tp = 2\n\twhile p * p <= n:\n\t\tif n % p == 0:\n\t\t\twhile n % p == 0:\n\t\t\t\tn = n // p\n\t\t\tresult = result * (1.0 - 1.0 / float(p))\n\t\tp = p + 1\n\tif n > 1:\n\t\tresult = result * (1.0 - 1.0 / float(n))\n\treturn int(result)\n\ndef is_prime(n):\n\tif n == 0:\n\t\treturn False\n\tif n == 1:\n\t\treturn True\n\tfor i in range(2, int(n ** (1 / 2)) + 1):\n\t\tif not n % i:\n\t\t\treturn False\n\treturn True\n\ndef next_prime(n, primes):\n\twhile primes[n] != True:\n\t\tn += 1\n\treturn n\nMAXN = int(100000.0 + 5)\n\ndef spf_sieve():\n\tspf[1] = 1\n\tfor i in range(2, MAXN):\n\t\tspf[i] = i\n\tfor i in range(4, MAXN, 2):\n\t\tspf[i] = 2\n\tfor i in range(3, ceil(MAXN ** 0.5), 2):\n\t\tif spf[i] == i:\n\t\t\tfor j in range(i * i, MAXN, i):\n\t\t\t\tif spf[j] == j:\n\t\t\t\t\tspf[j] = i\nspf = [0 for i in range(MAXN)]\n\ndef factoriazation(x):\n\tres = []\n\tfor i in range(2, int(x ** 0.5) + 1):\n\t\twhile x % i == 0:\n\t\t\tres.append(i)\n\t\t\tx //= i\n\tif x != 1:\n\t\tres.append(x)\n\treturn res\n\ndef factors(n):\n\tres = []\n\tfor i in range(1, int(n ** 0.5) + 1):\n\t\tif n % i == 0:\n\t\t\tres.append(i)\n\t\t\tres.append(n // i)\n\treturn list(set(res))\n\ndef int_array():\n\treturn list(map(int, input().strip().split()))\n\ndef float_array():\n\treturn list(map(float, input().strip().split()))\n\ndef str_array():\n\treturn input().strip().split()\n\ndef binary_search(low, high, w, h, n):\n\twhile low < high:\n\t\tmid = low + (high - low) // 2\n\t\tif check(mid, w, h, n):\n\t\t\tlow = mid + 1\n\t\telse:\n\t\t\thigh = mid\n\treturn low\n\ndef check(moves, n):\n\tval = (moves + 1) // 2\n\trem = moves - val\n\tsol = (val + 1) * (rem + 1)\n\treturn sol < n\n\ndef sortSecond(val):\n\treturn val[1]\nMOD = int(1000000000.0) + 7\nCMOD = 998244353\nINF = float('inf')\nNINF = -float('inf')\nalphs = 'abcdefghijklmnopqrstuvwxyz'\nfrom itertools import permutations\nimport math\nimport bisect as bis\nimport random\nimport sys\nimport collections as collect\nimport functools as fnt\nfrom decimal import Decimal\n\ndef solve():\n\tn = scanner()\n\tbelt = string()\n\tif belt.count('>') == 0 or belt.count('<') == 0:\n\t\tprint(len(belt))\n\t\treturn\n\tif belt.count('-') == 0:\n\t\tprint(0)\n\t\treturn\n\tcounts = 0\n\tgroups = 0\n\tfor i in range(n):\n\t\tif belt[i] == '-' and belt[(i + 1) % n] != '-':\n\t\t\tgroups += 1\n\tprint(belt.count('-') + groups)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n\ndef print(*args, **kwargs):\n\t(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))\n\tat_start = True\n\tfor x in args:\n\t\tif not at_start:\n\t\t\tfile.write(sep)\n\t\tfile.write(str(x))\n\t\tat_start = False\n\tfile.write(kwargs.pop('end', '\\n'))\n\tif kwargs.pop('flush', False):\n\t\tfile.flush()\nif sys.version_info[0] < 3:\n\t(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))\nelse:\n\t(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nt = scanner()\nfor i in range(t):\n\tsolve()\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = list(input())\n\tif s.count('>') != 0 and s.count('<') != 0:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tif s[i - 1] != '-':\n\t\t\t\t\tans += 2\n\t\t\t\telse:\n\t\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\n", "for y in range(int(input())):\n\tn = int(input())\n\tst = input()\n\tif '<' not in st or '>' not in st:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tif st[0] == '-' or st[-1] == '-':\n\t\t\tans += 1\n\t\tfor i in range(n - 1):\n\t\t\tif st[i] == '-' or st[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "from collections import deque\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = list(input())\n\tis_ok_p = 1\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i] == '>':\n\t\t\tpass\n\t\telse:\n\t\t\tis_ok_p = 0\n\t\t\tbreak\n\tis_ok_n = 1\n\tfor i in range(n):\n\t\tif s[-1 - i] == '-' or s[-1 - i] == '<':\n\t\t\tpass\n\t\telse:\n\t\t\tis_ok_n = 0\n\t\t\tbreak\n\tif is_ok_p or is_ok_n:\n\t\tans = n\n\telse:\n\t\tans = 0\n\t\tp = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tp += 1\n\t\t\telif p >= 1:\n\t\t\t\tans += p + 1\n\t\t\t\tp = 0\n\t\tif p >= 1:\n\t\t\tans += p + 1\n\t\tif s[0] == s[-1] == '-':\n\t\t\tans -= 1\n\tprint(ans)\n", "t = int(input())\nwhile t > 0:\n\tt -= 1\n\tn = int(input())\n\ts = input()\n\tcw = False\n\tccw = False\n\tfor c in s:\n\t\tif c == '>':\n\t\t\tcw = True\n\t\tif c == '<':\n\t\t\tccw = True\n\tif cw and ccw:\n\t\ts += s[0]\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\n", "T = int(input())\n\ndef solve(N, s):\n\tans = N\n\tt = '-'\n\tfor i in range(len(s) * 2):\n\t\ti = i % len(s)\n\t\tif s[i] == '-':\n\t\t\tcontinue\n\t\tif t == '>' and s[i] == '<':\n\t\t\tbreak\n\t\tif s[i] == '>':\n\t\t\tt = s[i]\n\telse:\n\t\treturn N\n\th = []\n\tc = 0\n\tfor i in range(len(s)):\n\t\tif s[i] == '-':\n\t\t\tc += 1\n\t\telif c > 0:\n\t\t\th.append(c)\n\t\t\tc = 0\n\tif s[-1] == '-':\n\t\th.append(c)\n\tif len(h) >= 2 and s[0] == '-' and (s[-1] == '-'):\n\t\th[0] += h[-1]\n\t\tdel h[-1]\n\treturn sum(h) + len(h)\nfor _ in range(T):\n\tN = int(input())\n\ts = input()\n\tprint(solve(N, s))\n", "import io, os\nimport sys\nfrom sys import stdin\nfrom bisect import bisect_left, bisect_right\nfrom collections import defaultdict, deque, namedtuple\nfrom math import gcd, ceil, floor, factorial\nfrom itertools import combinations, permutations\ninput = sys.stdin.readline\n\ndef work():\n\tans = 0\n\treturn\n\ndef main():\n\ttest = int(input())\n\tfor idt in range(test):\n\t\tn = int(input())\n\t\ts = input().strip('\\r\\n')\n\t\tbid = set()\n\t\ta = s.count('<')\n\t\tb = s.count('>')\n\t\tans = 0\n\t\tfor (i, ch) in enumerate(s):\n\t\t\tif ch == '-':\n\t\t\t\tans += 1\n\t\t\telif ch == '<':\n\t\t\t\tif b == 0 or s[(i - 1 + n) % n] == '-':\n\t\t\t\t\tans += 1\n\t\t\telif a == 0 or s[(i - 1 + n) % n] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\treturn\nmain()\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tpath = list(map(str, input().strip()))\n\tAll = 0\n\tco = 0\n\tif '>' not in path or '<' not in path:\n\t\tAll = 1\n\treturnable = [0] * n\n\tfor i in range(n):\n\t\tif path[i] == '-':\n\t\t\treturnable[(i + 1) % n] = 1\n\t\t\treturnable[i] = 1\n\ttotal = 0\n\tfor i in range(n):\n\t\ttotal += returnable[i]\n\tif All == 1:\n\t\tprint(n)\n\telse:\n\t\tprint(total)\n", "for i in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tk = s.count('-')\n\ta = s.count('<')\n\tb = s.count('>')\n\tif a == 0 or b == 0:\n\t\tprint(n)\n\telif k == 0:\n\t\tprint(0)\n\telse:\n\t\ts += s[0]\n\t\tc = 0\n\t\tfor j in range(n):\n\t\t\tif s[j] == '-' or s[j + 1] == '-':\n\t\t\t\tc += 1\n\t\tprint(c)\n", "a = int(input())\nfor x in range(a):\n\tb = int(input())\n\tc = input()\n\tt = c + c[0]\n\td = c.count('>')\n\te = c.count('<')\n\th = c.count('-')\n\tif d + h == b or e + h == b:\n\t\tprint(b)\n\telse:\n\t\tl = 0\n\t\tc = c + c[0]\n\t\tfor y in range(1, b + 1):\n\t\t\tif c[y] == '-' or c[y - 1] == '-':\n\t\t\t\tl += 1\n\t\tprint(l)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif '>' in s and '<' in s:\n\t\ti = 0\n\t\tc = 0\n\t\twhile i < n:\n\t\t\tif s[i] == '-':\n\t\t\t\tj = i + 1\n\t\t\t\twhile j < n and s[j] == '-':\n\t\t\t\t\tj += 1\n\t\t\t\tc += j - i + 1\n\t\t\t\ti = j\n\t\t\telse:\n\t\t\t\ti += 1\n\t\tif s[0] == '-' and s[-1] == '-':\n\t\t\tprint(c - 1)\n\t\telse:\n\t\t\tprint(c)\n\telse:\n\t\tprint(n)\n", "t = int(input())\ni = 0\nwhile i < t:\n\tn = int(input())\n\tS = str(input())\n\tif '>' not in S and '<' not in S:\n\t\tprint(n)\n\telif '>' not in S:\n\t\tprint(n)\n\telif '<' not in S:\n\t\tprint(n)\n\telse:\n\t\tanswer = 0\n\t\tvalid = 1\n\t\tj = 0\n\t\twhile j < n:\n\t\t\tif S[j] == '-':\n\t\t\t\tif j == n - 1:\n\t\t\t\t\tif S[0] == '-':\n\t\t\t\t\t\tif valid:\n\t\t\t\t\t\t\tvalid = 0\n\t\t\t\t\t\t\tanswer += 1\n\t\t\t\t\telif valid:\n\t\t\t\t\t\tvalid = 0\n\t\t\t\t\t\tanswer += 2\n\t\t\t\t\telse:\n\t\t\t\t\t\tanswer += 1\n\t\t\t\telif valid:\n\t\t\t\t\tvalid = 0\n\t\t\t\t\tanswer += 2\n\t\t\t\telse:\n\t\t\t\t\tanswer += 1\n\t\t\telse:\n\t\t\t\tvalid = 1\n\t\t\tj += 1\n\t\tprint(answer)\n\ti += 1\n", "for t in range(int(input())):\n\tx = int(input())\n\tbelt = list(input())\n\tif belt.count('>') == 0:\n\t\tprint(x)\n\t\tcontinue\n\tif belt.count('<') == 0:\n\t\tprint(x)\n\t\tcontinue\n\tif belt.count('-') == 0:\n\t\tprint(0)\n\t\tcontinue\n\tcount = 0\n\tfor i in range(x):\n\t\tincoming = belt[i - 1]\n\t\toutgoing = belt[i]\n\t\tif incoming == '-' or outgoing == '-':\n\t\t\tcount += 1\n\tprint(count)\n", "import sys\ninput = iter(sys.stdin.read().splitlines()).__next__\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tif '>' not in s or '<' not in s:\n\t\tprint(n)\n\telse:\n\t\trooms = 0\n\t\tfor i in range(n - 1):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\trooms += 1\n\t\tif s[-1] == '-' or s[0] == '-':\n\t\t\trooms += 1\n\t\tprint(rooms)\n", "import sys\nfrom collections import defaultdict\ninput = sys.stdin.readline\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = list(input().strip())\n\tss = set(s)\n\tif len(ss) == 1 or ss == {'>', '-'} or ss == {'<', '-'}:\n\t\tprint(n)\n\t\tcontinue\n\tc = 0\n\tfor i in range(n):\n\t\tif s[(i - 1) % n] == '-' or s[i] == '-':\n\t\t\tc += 1\n\tprint(c)\n", "def main():\n\tn = int(input())\n\ts = input()\n\ts = s + s[0]\n\tc = 0\n\t(f, b, both) = (0, 0, 0)\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tf = 1\n\t\telif s[i] == '<':\n\t\t\tb = 1\n\tif f and b:\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tc += 1\n\t\tprint(c)\n\telse:\n\t\tprint(n)\nfor _ in range(int(input())):\n\tmain()\n", "import sys\ninput = sys.stdin.readline\n\ndef inp():\n\treturn int(input())\n\ndef inlt():\n\treturn list(map(int, input().split()))\n\ndef insr():\n\ts = input()\n\treturn list(s[:len(s) - 1])\n\ndef invr():\n\treturn map(int, input().split())\n\ndef solution():\n\tt = inp()\n\tfor _ in range(t):\n\t\tn = inp()\n\t\ts = input().strip()\n\t\tprint(solve(n, s))\n\ndef solve(n, s):\n\tcount = 0\n\tflag1 = False\n\tflag2 = False\n\tdead = 0\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tcontinue\n\t\tif s[i] == '>':\n\t\t\tflag1 = True\n\t\telse:\n\t\t\tflag2 = True\n\t\tif s[i - 1] == '-':\n\t\t\tcontinue\n\t\tif s[i] == s[i - 1]:\n\t\t\tcount += 1\n\t\telse:\n\t\t\tdead += 1\n\treturn n - dead - count if flag1 and flag2 else n - dead\nsolution()\n", "import sys, math\ninput = sys.stdin.readline\nt = int(input())\nfor r in range(t):\n\tn = int(input())\n\ts = input().strip('\\n')\n\tclockwise = True\n\tantiClockwise = True\n\tfor i in range(n):\n\t\tif s[i] == '>' or s[i] == '-':\n\t\t\tcontinue\n\t\telse:\n\t\t\tclockwise = False\n\t\t\tbreak\n\tfor i in range(n):\n\t\tif s[i] == '<' or s[i] == '-':\n\t\t\tcontinue\n\t\telse:\n\t\t\tantiClockwise = False\n\t\t\tbreak\n\tif clockwise == True or antiClockwise == True:\n\t\tprint(n)\n\telse:\n\t\tcount = 0\n\t\tfor i in range(n):\n\t\t\tif i == 0:\n\t\t\t\tif s[i] == '-' or s[n - 1] == '-':\n\t\t\t\t\tcount += 1\n\t\t\telif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tcount += 1\n\t\tprint(count)\n", "t = int(input())\nfor tt in range(t):\n\tn = int(input())\n\tnumgr = 0\n\tnumle = 0\n\tnumeq = 0\n\tbelts = input()\n\tsegments = 0\n\tfor i in range(len(belts)):\n\t\tif belts[i] == '-':\n\t\t\tnumeq += 1\n\t\t\tif belts[i - 1] != '-':\n\t\t\t\tsegments += 1\n\t\tif belts[i] == '>':\n\t\t\tnumgr += 1\n\t\tif belts[i] == '<':\n\t\t\tnumle += 1\n\tif numgr == 0 or numle == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(numeq + segments)\n", "import os\nimport sys\nfrom math import *\nfrom collections import *\nfrom heapq import *\nfrom bisect import *\nfrom io import BytesIO, IOBase\n\ndef vsInput():\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nALPHA = 'abcdefghijklmnopqrstuvwxyz/'\nM = 1000000007\nEPS = 1e-06\n\ndef Ceil(a, b):\n\treturn a // b + int(a % b > 0)\n\ndef value():\n\treturn tuple(map(int, input().split()))\n\ndef array():\n\treturn [int(i) for i in input().split()]\n\ndef Int():\n\treturn int(input())\n\ndef Str():\n\treturn input()\n\ndef arrayS():\n\treturn [i for i in input().split()]\nfor _ in range(Int()):\n\tn = Int()\n\ts = input()\n\tans = 0\n\tfor i in range(1, n + 1):\n\t\tnext = s[i % n]\n\t\tprev = s[i - 1]\n\t\tif next == '-' or prev == '-':\n\t\t\tans += 1\n\tif '<' not in s or '>' not in s:\n\t\tans = n\n\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tl = input()\n\tl = l[n - 1] + l\n\tm = 0\n\tu = 1\n\tfor i in range(1, n + 1):\n\t\tif l[i] + l[i - 1] == '><' or l[i] + l[i - 1] == '<>':\n\t\t\tu = 0\n\tfor i in range(1, n + 1):\n\t\tif l[i - 1] == '-' or l[i] == '-':\n\t\t\tm += 1\n\tif u == 1:\n\t\tif '>' in l and '<' in l:\n\t\t\tjkl = 0\n\t\telse:\n\t\t\tm = n\n\tprint(m)\n", "import math\nimport random\nimport heapq, bisect\nimport sys\nfrom collections import deque, defaultdict\nfrom fractions import Fraction\nimport sys\nfrom collections import defaultdict\nmod = 10 ** 9 + 7\nmod1 = 998244353\nimport os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\nclass TreeNode:\n\n\tdef __init__(self, k, v):\n\t\tself.key = k\n\t\tself.value = v\n\t\tself.left = None\n\t\tself.right = None\n\t\tself.parent = None\n\t\tself.height = 1\n\t\tself.num_left = 1\n\t\tself.num_total = 1\n\nclass AvlTree:\n\n\tdef __init__(self):\n\t\tself._tree = None\n\n\tdef add(self, k, v):\n\t\tif not self._tree:\n\t\t\tself._tree = TreeNode(k, v)\n\t\t\treturn\n\t\tnode = self._add(k, v)\n\t\tif node:\n\t\t\tself._rebalance(node)\n\n\tdef _add(self, k, v):\n\t\tnode = self._tree\n\t\twhile node:\n\t\t\tif k < node.key:\n\t\t\t\tif node.left:\n\t\t\t\t\tnode = node.left\n\t\t\t\telse:\n\t\t\t\t\tnode.left = TreeNode(k, v)\n\t\t\t\t\tnode.left.parent = node\n\t\t\t\t\treturn node.left\n\t\t\telif node.key < k:\n\t\t\t\tif node.right:\n\t\t\t\t\tnode = node.right\n\t\t\t\telse:\n\t\t\t\t\tnode.right = TreeNode(k, v)\n\t\t\t\t\tnode.right.parent = node\n\t\t\t\t\treturn node.right\n\t\t\telse:\n\t\t\t\tnode.value = v\n\t\t\t\treturn\n\n\t@staticmethod\n\tdef get_height(x):\n\t\treturn x.height if x else 0\n\n\t@staticmethod\n\tdef get_num_total(x):\n\t\treturn x.num_total if x else 0\n\n\tdef _rebalance(self, node):\n\t\tn = node\n\t\twhile n:\n\t\t\tlh = self.get_height(n.left)\n\t\t\trh = self.get_height(n.right)\n\t\t\tn.height = max(lh, rh) + 1\n\t\t\tbalance_factor = lh - rh\n\t\t\tn.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)\n\t\t\tn.num_left = 1 + self.get_num_total(n.left)\n\t\t\tif balance_factor > 1:\n\t\t\t\tif self.get_height(n.left.left) < self.get_height(n.left.right):\n\t\t\t\t\tself._rotate_left(n.left)\n\t\t\t\tself._rotate_right(n)\n\t\t\telif balance_factor < -1:\n\t\t\t\tif self.get_height(n.right.right) < self.get_height(n.right.left):\n\t\t\t\t\tself._rotate_right(n.right)\n\t\t\t\tself._rotate_left(n)\n\t\t\telse:\n\t\t\t\tn = n.parent\n\n\tdef _remove_one(self, node):\n\t\treplacement = node.left or node.right\n\t\tif node.parent:\n\t\t\tif AvlTree._is_left(node):\n\t\t\t\tnode.parent.left = replacement\n\t\t\telse:\n\t\t\t\tnode.parent.right = replacement\n\t\t\treplacement.parent = node.parent\n\t\t\tnode.parent = None\n\t\telse:\n\t\t\tself._tree = replacement\n\t\t\treplacement.parent = None\n\t\tnode.left = None\n\t\tnode.right = None\n\t\tnode.parent = None\n\t\tself._rebalance(replacement)\n\n\tdef _remove_leaf(self, node):\n\t\tif node.parent:\n\t\t\tif AvlTree._is_left(node):\n\t\t\t\tnode.parent.left = None\n\t\t\telse:\n\t\t\t\tnode.parent.right = None\n\t\t\tself._rebalance(node.parent)\n\t\telse:\n\t\t\tself._tree = None\n\t\tnode.parent = None\n\t\tnode.left = None\n\t\tnode.right = None\n\n\tdef remove(self, k):\n\t\tnode = self._get_node(k)\n\t\tif not node:\n\t\t\treturn\n\t\tif AvlTree._is_leaf(node):\n\t\t\tself._remove_leaf(node)\n\t\t\treturn\n\t\tif node.left and node.right:\n\t\t\tnxt = AvlTree._get_next(node)\n\t\t\tnode.key = nxt.key\n\t\t\tnode.value = nxt.value\n\t\t\tif self._is_leaf(nxt):\n\t\t\t\tself._remove_leaf(nxt)\n\t\t\telse:\n\t\t\t\tself._remove_one(nxt)\n\t\t\tself._rebalance(node)\n\t\telse:\n\t\t\tself._remove_one(node)\n\n\tdef get(self, k):\n\t\tnode = self._get_node(k)\n\t\treturn node.value if node else -1\n\n\tdef _get_node(self, k):\n\t\tif not self._tree:\n\t\t\treturn None\n\t\tnode = self._tree\n\t\twhile node:\n\t\t\tif k < node.key:\n\t\t\t\tnode = node.left\n\t\t\telif node.key < k:\n\t\t\t\tnode = node.right\n\t\t\telse:\n\t\t\t\treturn node\n\t\treturn None\n\n\tdef get_at(self, pos):\n\t\tx = pos + 1\n\t\tnode = self._tree\n\t\twhile node:\n\t\t\tif x < node.num_left:\n\t\t\t\tnode = node.left\n\t\t\telif node.num_left < x:\n\t\t\t\tx -= node.num_left\n\t\t\t\tnode = node.right\n\t\t\telse:\n\t\t\t\treturn (node.key, node.value)\n\t\traise IndexError('Out of ranges')\n\n\t@staticmethod\n\tdef _is_left(node):\n\t\treturn node.parent.left and node.parent.left == node\n\n\t@staticmethod\n\tdef _is_leaf(node):\n\t\treturn node.left is None and node.right is None\n\n\tdef _rotate_right(self, node):\n\t\tif not node.parent:\n\t\t\tself._tree = node.left\n\t\t\tnode.left.parent = None\n\t\telif AvlTree._is_left(node):\n\t\t\tnode.parent.left = node.left\n\t\t\tnode.left.parent = node.parent\n\t\telse:\n\t\t\tnode.parent.right = node.left\n\t\t\tnode.left.parent = node.parent\n\t\tbk = node.left.right\n\t\tnode.left.right = node\n\t\tnode.parent = node.left\n\t\tnode.left = bk\n\t\tif bk:\n\t\t\tbk.parent = node\n\t\tnode.height = max(self.get_height(node.left), self.get_height(node.right)) + 1\n\t\tnode.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)\n\t\tnode.num_left = 1 + self.get_num_total(node.left)\n\n\tdef _rotate_left(self, node):\n\t\tif not node.parent:\n\t\t\tself._tree = node.right\n\t\t\tnode.right.parent = None\n\t\telif AvlTree._is_left(node):\n\t\t\tnode.parent.left = node.right\n\t\t\tnode.right.parent = node.parent\n\t\telse:\n\t\t\tnode.parent.right = node.right\n\t\t\tnode.right.parent = node.parent\n\t\tbk = node.right.left\n\t\tnode.right.left = node\n\t\tnode.parent = node.right\n\t\tnode.right = bk\n\t\tif bk:\n\t\t\tbk.parent = node\n\t\tnode.height = max(self.get_height(node.left), self.get_height(node.right)) + 1\n\t\tnode.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)\n\t\tnode.num_left = 1 + self.get_num_total(node.left)\n\n\t@staticmethod\n\tdef _get_next(node):\n\t\tif not node.right:\n\t\t\treturn node.parent\n\t\tn = node.right\n\t\twhile n.left:\n\t\t\tn = n.left\n\t\treturn n\n\nclass SegmentTree1:\n\n\tdef __init__(self, data, default=300006, func=lambda a, b: min(a, b)):\n\t\tself._default = default\n\t\tself._func = func\n\t\tself._len = len(data)\n\t\tself._size = _size = 1 << (self._len - 1).bit_length()\n\t\tself.data = [default] * (2 * _size)\n\t\tself.data[_size:_size + self._len] = data\n\t\tfor i in reversed(range(_size)):\n\t\t\tself.data[i] = func(self.data[i + i], self.data[i + i + 1])\n\n\tdef __delitem__(self, idx):\n\t\tself[idx] = self._default\n\n\tdef __getitem__(self, idx):\n\t\treturn self.data[idx + self._size]\n\n\tdef __setitem__(self, idx, value):\n\t\tidx += self._size\n\t\tself.data[idx] = value\n\t\tidx >>= 1\n\t\twhile idx:\n\t\t\tself.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])\n\t\t\tidx >>= 1\n\n\tdef __len__(self):\n\t\treturn self._len\n\n\tdef query(self, start, stop):\n\t\tif start == stop:\n\t\t\treturn self.__getitem__(start)\n\t\tstop += 1\n\t\tstart += self._size\n\t\tstop += self._size\n\t\tres = self._default\n\t\twhile start < stop:\n\t\t\tif start & 1:\n\t\t\t\tres = self._func(res, self.data[start])\n\t\t\t\tstart += 1\n\t\t\tif stop & 1:\n\t\t\t\tstop -= 1\n\t\t\t\tres = self._func(res, self.data[stop])\n\t\t\tstart >>= 1\n\t\t\tstop >>= 1\n\t\treturn res\n\n\tdef __repr__(self):\n\t\treturn 'SegmentTree({0})'.format(self.data)\n\nclass SegmentTree:\n\n\tdef __init__(self, data, default=0, func=lambda a, b: a + b):\n\t\tself._default = default\n\t\tself._func = func\n\t\tself._len = len(data)\n\t\tself._size = _size = 1 << (self._len - 1).bit_length()\n\t\tself.data = [default] * (2 * _size)\n\t\tself.data[_size:_size + self._len] = data\n\t\tfor i in reversed(range(_size)):\n\t\t\tself.data[i] = func(self.data[i + i], self.data[i + i + 1])\n\n\tdef __delitem__(self, idx):\n\t\tself[idx] = self._default\n\n\tdef __getitem__(self, idx):\n\t\treturn self.data[idx + self._size]\n\n\tdef __setitem__(self, idx, value):\n\t\tidx += self._size\n\t\tself.data[idx] = value\n\t\tidx >>= 1\n\t\twhile idx:\n\t\t\tself.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])\n\t\t\tidx >>= 1\n\n\tdef __len__(self):\n\t\treturn self._len\n\n\tdef query(self, start, stop):\n\t\tif start == stop:\n\t\t\treturn self.__getitem__(start)\n\t\tstop += 1\n\t\tstart += self._size\n\t\tstop += self._size\n\t\tres = self._default\n\t\twhile start < stop:\n\t\t\tif start & 1:\n\t\t\t\tres = self._func(res, self.data[start])\n\t\t\t\tstart += 1\n\t\t\tif stop & 1:\n\t\t\t\tstop -= 1\n\t\t\t\tres = self._func(res, self.data[stop])\n\t\t\tstart >>= 1\n\t\t\tstop >>= 1\n\t\treturn res\n\n\tdef __repr__(self):\n\t\treturn 'SegmentTree({0})'.format(self.data)\n\nclass Factorial:\n\n\tdef __init__(self, MOD):\n\t\tself.MOD = MOD\n\t\tself.factorials = [1, 1]\n\t\tself.invModulos = [0, 1]\n\t\tself.invFactorial_ = [1, 1]\n\n\tdef calc(self, n):\n\t\tif n <= -1:\n\t\t\tprint('Invalid argument to calculate n!')\n\t\t\tprint('n must be non-negative value. But the argument was ' + str(n))\n\t\t\texit()\n\t\tif n < len(self.factorials):\n\t\t\treturn self.factorials[n]\n\t\tnextArr = [0] * (n + 1 - len(self.factorials))\n\t\tinitialI = len(self.factorials)\n\t\tprev = self.factorials[-1]\n\t\tm = self.MOD\n\t\tfor i in range(initialI, n + 1):\n\t\t\tprev = nextArr[i - initialI] = prev * i % m\n\t\tself.factorials += nextArr\n\t\treturn self.factorials[n]\n\n\tdef inv(self, n):\n\t\tif n <= -1:\n\t\t\tprint('Invalid argument to calculate n^(-1)')\n\t\t\tprint('n must be non-negative value. But the argument was ' + str(n))\n\t\t\texit()\n\t\tp = self.MOD\n\t\tpi = n % p\n\t\tif pi < len(self.invModulos):\n\t\t\treturn self.invModulos[pi]\n\t\tnextArr = [0] * (n + 1 - len(self.invModulos))\n\t\tinitialI = len(self.invModulos)\n\t\tfor i in range(initialI, min(p, n + 1)):\n\t\t\tnext = -self.invModulos[p % i] * (p // i) % p\n\t\t\tself.invModulos.append(next)\n\t\treturn self.invModulos[pi]\n\n\tdef invFactorial(self, n):\n\t\tif n <= -1:\n\t\t\tprint('Invalid argument to calculate (n^(-1))!')\n\t\t\tprint('n must be non-negative value. But the argument was ' + str(n))\n\t\t\texit()\n\t\tif n < len(self.invFactorial_):\n\t\t\treturn self.invFactorial_[n]\n\t\tself.inv(n)\n\t\tnextArr = [0] * (n + 1 - len(self.invFactorial_))\n\t\tinitialI = len(self.invFactorial_)\n\t\tprev = self.invFactorial_[-1]\n\t\tp = self.MOD\n\t\tfor i in range(initialI, n + 1):\n\t\t\tprev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p\n\t\tself.invFactorial_ += nextArr\n\t\treturn self.invFactorial_[n]\n\nclass Combination:\n\n\tdef __init__(self, MOD):\n\t\tself.MOD = MOD\n\t\tself.factorial = Factorial(MOD)\n\n\tdef ncr(self, n, k):\n\t\tif k < 0 or n < k:\n\t\t\treturn 0\n\t\tk = min(k, n - k)\n\t\tf = self.factorial\n\t\treturn f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD\n\ndef powm(a, n, m):\n\tif a == 1 or n == 0:\n\t\treturn 1\n\tif n % 2 == 0:\n\t\ts = powm(a, n // 2, m)\n\t\treturn s * s % m\n\telse:\n\t\treturn a * powm(a, n - 1, m) % m\n\ndef sort_list(list1, list2):\n\tzipped_pairs = zip(list2, list1)\n\tz = [x for (_, x) in sorted(zipped_pairs)]\n\treturn z\n\ndef product(l):\n\tpor = 1\n\tfor i in range(len(l)):\n\t\tpor *= l[i]\n\treturn por\n\ndef binarySearchCount(arr, n, key):\n\tleft = 0\n\tright = n - 1\n\tcount = 0\n\twhile left <= right:\n\t\tmid = int((right + left) / 2)\n\t\tif arr[mid] < key:\n\t\t\tcount = mid + 1\n\t\t\tleft = mid + 1\n\t\telse:\n\t\t\tright = mid - 1\n\treturn count\n\ndef countdig(n):\n\tc = 0\n\twhile n > 0:\n\t\tn //= 10\n\t\tc += 1\n\treturn c\n\ndef binary(x, length):\n\ty = bin(x)[2:]\n\treturn y if len(y) >= length else '0' * (length - len(y)) + y\n\ndef countGreater(arr, n, k):\n\tl = 0\n\tr = n - 1\n\tleftGreater = n\n\twhile l <= r:\n\t\tm = int(l + (r - l) / 2)\n\t\tif arr[m] > k:\n\t\t\tleftGreater = m\n\t\t\tr = m - 1\n\t\telse:\n\t\t\tl = m + 1\n\treturn n - leftGreater\n\nclass TrieNode:\n\n\tdef __init__(self):\n\t\tself.children = [None] * 26\n\t\tself.isEndOfWord = False\n\nclass Trie:\n\n\tdef __init__(self):\n\t\tself.root = self.getNode()\n\n\tdef getNode(self):\n\t\treturn TrieNode()\n\n\tdef _charToIndex(self, ch):\n\t\treturn ord(ch) - ord('a')\n\n\tdef insert(self, key):\n\t\tpCrawl = self.root\n\t\tlength = len(key)\n\t\tfor level in range(length):\n\t\t\tindex = self._charToIndex(key[level])\n\t\t\tif not pCrawl.children[index]:\n\t\t\t\tpCrawl.children[index] = self.getNode()\n\t\t\tpCrawl = pCrawl.children[index]\n\t\tpCrawl.isEndOfWord = True\n\n\tdef search(self, key):\n\t\tpCrawl = self.root\n\t\tlength = len(key)\n\t\tfor level in range(length):\n\t\t\tindex = self._charToIndex(key[level])\n\t\t\tif not pCrawl.children[index]:\n\t\t\t\treturn False\n\t\t\tpCrawl = pCrawl.children[index]\n\t\treturn pCrawl != None and pCrawl.isEndOfWord\n\nclass Node:\n\n\tdef __init__(self, data):\n\t\tself.data = data\n\t\tself.count = 0\n\t\tself.left = None\n\t\tself.right = None\n\nclass BinaryTrie:\n\n\tdef __init__(self):\n\t\tself.root = Node(0)\n\n\tdef insert(self, pre_xor):\n\t\tself.temp = self.root\n\t\tfor i in range(31, -1, -1):\n\t\t\tval = pre_xor & 1 << i\n\t\t\tif val:\n\t\t\t\tif not self.temp.right:\n\t\t\t\t\tself.temp.right = Node(0)\n\t\t\t\tself.temp = self.temp.right\n\t\t\t\tself.temp.count += 1\n\t\t\tif not val:\n\t\t\t\tif not self.temp.left:\n\t\t\t\t\tself.temp.left = Node(0)\n\t\t\t\tself.temp = self.temp.left\n\t\t\t\tself.temp.count += 1\n\t\tself.temp.data = pre_xor\n\n\tdef query(self, xor):\n\t\tself.temp = self.root\n\t\tfor i in range(31, -1, -1):\n\t\t\tval = xor & 1 << i\n\t\t\tif not val:\n\t\t\t\tif self.temp.left and self.temp.left.count > 0:\n\t\t\t\t\tself.temp = self.temp.left\n\t\t\t\telif self.temp.right:\n\t\t\t\t\tself.temp = self.temp.right\n\t\t\telif self.temp.right and self.temp.right.count > 0:\n\t\t\t\tself.temp = self.temp.right\n\t\t\telif self.temp.left:\n\t\t\t\tself.temp = self.temp.left\n\t\t\tself.temp.count -= 1\n\t\treturn xor ^ self.temp.data\nfor ik in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tc = 0\n\tans = 0\n\td = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tans += 1\n\t\tif s[i] == '>':\n\t\t\tc += 1\n\t\telif s[i] == '<':\n\t\t\td += 1\n\tif d == 0 or c == 0:\n\t\tprint(n)\n\t\tcontinue\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\trooms = input()\n\troomslist = list(rooms)\n\tanti = False\n\tclk = False\n\tif '<' in rooms:\n\t\tanti = True\n\tif '>' in rooms:\n\t\tclk = True\n\tcnt = 0\n\tif (anti and clk) is True:\n\t\tfor i in range(len(roomslist)):\n\t\t\troomslist.append(rooms[0])\n\t\t\tif roomslist[i] == '-' or roomslist[i + 1] == '-':\n\t\t\t\tcnt += 1\n\t\tprint(cnt)\n\telse:\n\t\tprint(len(rooms))\n", "def solve(n, s):\n\tcw = s.count('<')\n\tac = s.count('>')\n\tif cw == 0 or ac == 0:\n\t\treturn n\n\tok = [0 for i in range(n)]\n\tfor i in range(n - 1):\n\t\tif s[i] == '-':\n\t\t\tok[i] = 1\n\t\t\tok[i + 1] = 1\n\tif s[-1] == '-':\n\t\tok[-1] = 1\n\t\tok[0] = 1\n\treturn sum(ok)\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tprint(solve(n, s))\n", "import bisect\n\ndef solve(s):\n\tif '>' not in s or '<' not in s:\n\t\treturn len(s)\n\tislands = 0\n\tcnt = 0\n\ts = s + [s[0]]\n\tfor j in range(1, n + 1):\n\t\tif s[j - 1] == '-':\n\t\t\tcnt += 1\n\t\t\tif s[j] == '-':\n\t\t\t\tcontinue\n\t\t\telse:\n\t\t\t\tislands += 1\n\t\tpass\n\treturn cnt + islands\nt = int(input())\nans = []\nfor i in range(t):\n\tn = int(input())\n\ts = list(input())\n\tans.append(solve(s))\nfor test in ans:\n\tprint(test)\n", "x = int(input())\nansl = []\nfor i in range(x):\n\tl = []\n\tn = int(input())\n\ts = input()\n\tfor i in s:\n\t\tl.append(i)\n\tvalid = 0\n\tfor i in range(len(l)):\n\t\tif l[i] == '-':\n\t\t\tif i == 0:\n\t\t\t\tvalid += 2\n\t\t\telif l[i - 1] == '-':\n\t\t\t\tif i == len(l) - 1 and l[0] == '-':\n\t\t\t\t\tvalid += 0\n\t\t\t\telse:\n\t\t\t\t\tvalid += 1\n\t\t\telif i == len(l) - 1 and l[0] == '-':\n\t\t\t\tvalid += 1\n\t\t\telse:\n\t\t\t\tvalid += 2\n\tif not '<' in l or not '>' in l:\n\t\tvalid = len(l)\n\tansl.append(valid)\nfor i in ansl:\n\tprint(i)\n", "for j in range(int(input())):\n\tn = int(input())\n\tr = input()\n\tz = 0\n\ts = 1\n\tfor i in range(n):\n\t\tif r[i] == '<':\n\t\t\ts = 0\n\t\t\tbreak\n\tz += s\n\ts = 1\n\tfor i in range(n - 1, -1, -1):\n\t\tif r[i] == '>':\n\t\t\ts = 0\n\t\t\tbreak\n\tz += s\n\tif z > 0:\n\t\tprint(n)\n\telse:\n\t\ta = [0] * n\n\t\tfor i in range(n):\n\t\t\tif r[i] == '-':\n\t\t\t\ta[i] = 1\n\t\t\t\ta[(i + 1) % n] = 1\n\t\tprint(a.count(1))\n", "def answer(n, A):\n\tclock = True\n\tanticlock = True\n\tfor i in range(n):\n\t\tif A[i] == '<':\n\t\t\tclock = False\n\t\t\tbreak\n\tfor i in range(n - 1, -1, -1):\n\t\tif A[i] == '>':\n\t\t\tanticlock = False\n\t\t\tbreak\n\tif clock or anticlock:\n\t\treturn n\n\tcount = 0\n\tfor i in range(n):\n\t\tif A[i] == '-' or A[i - 1] == '-':\n\t\t\tcount += 1\n\treturn count\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\tA = input()\n\tprint(answer(n, A))\n", "import sys\ninput = lambda : sys.stdin.readline()\nq = int(input())\nres = []\nfor _ in range(q):\n\tn = int(input())\n\ts = input().strip()\n\tc = set(s)\n\tif '>' not in c or '<' not in c:\n\t\tans = n\n\telse:\n\t\tans = n\n\t\tfor i in range(n):\n\t\t\tx = s[i - 1]\n\t\t\ty = s[i]\n\t\t\tif x != '-' and y != '-':\n\t\t\t\tans -= 1\n\tres.append(ans)\nprint('\\n'.join(map(str, res)))\n", "import sys\ninput = sys.stdin.readline\nfor f in range(int(input())):\n\tn = int(input())\n\ts = input()\n\ts = s[0:n]\n\tr = 0\n\tc = 0\n\tac = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tr += 1\n\t\tif s[i] == '<':\n\t\t\tc = 1\n\t\tif s[i] == '>':\n\t\t\tac = 1\n\tif c * ac == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(r)\n", "from sys import stdin\ninput = stdin.readline\n\ndef solve():\n\tn = int(input())\n\td = input().strip()\n\tres = 0\n\ts = set(d)\n\tif len(s) == 1 or (len(s) == 2 and '-' in s):\n\t\tprint(n)\n\t\treturn\n\telse:\n\t\tfor i in range(n):\n\t\t\tright = d[i]\n\t\t\tleft = d[i - 1]\n\t\t\tif right == '-' or left == '-':\n\t\t\t\tres += 1\n\tprint(res)\nt = int(input())\nfor _ in range(t):\n\tsolve()\n", "def f(n, s):\n\tif s.find('>') == -1 or s.find('<') == -1:\n\t\treturn n\n\tans = 0\n\tprev_sym = s[-1]\n\tfor item in s:\n\t\tif item == '-':\n\t\t\tans += 1\n\t\t\tif prev_sym != '-':\n\t\t\t\tans += 1\n\t\tprev_sym = item\n\treturn ans\nt = int(input())\nfor i in range(t):\n\tprint(f(int(input()), input()))\n", "from sys import stdin\ninput = stdin.readline\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input().strip()\n\tif not '>' in s or not '<' in s:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tans += '-' in (s[i], s[(i + 1) % n])\n\tprint(ans)\n", "from sys import stdin\nfrom collections import Counter\nfrom random import choice\ninput = stdin.readline\nfor test in range(int(input())):\n\tn = int(input())\n\tx = '><-'\n\tlst = list(input().strip())\n\tcnt = Counter(lst)\n\t(a, b, c) = (cnt.get('>', 0), cnt.get('<', 0), cnt.get('-', 0))\n\tif a and b:\n\t\tif c:\n\t\t\tss = set()\n\t\t\tif lst[-1] == '-':\n\t\t\t\tss.update((0, n - 1))\n\t\t\tfor i in range(n - 1):\n\t\t\t\tif lst[i] == '-':\n\t\t\t\t\tss.update((i, i + 1))\n\t\t\tprint(len(ss))\n\t\telse:\n\t\t\tprint(0)\n\telse:\n\t\tprint(n)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tclock = True\n\tanticlock = True\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tclock = False\n\t\telif s[i] == '>':\n\t\t\tanticlock = False\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\tans += 1\n\t\telif s[i - 1] == '>' or s[i] == '>':\n\t\t\tif clock:\n\t\t\t\tans += 1\n\t\telif s[i - 1] == '<' or s[i] == '<':\n\t\t\tif anticlock:\n\t\t\t\tans += 1\n\tprint(ans)\n", "import sys, math\nimport io, os\nfrom bisect import bisect_left as bl, bisect_right as br, insort\nfrom heapq import heapify, heappush, heappop\nfrom collections import defaultdict as dd, deque, Counter\n\ndef data():\n\treturn sys.stdin.readline().strip()\n\ndef mdata():\n\treturn list(map(int, data().split()))\n\ndef outl(var):\n\tsys.stdout.write('\\n'.join(map(str, var)) + '\\n')\n\ndef out(var):\n\tsys.stdout.write(str(var) + '\\n')\nINF = float('inf')\nmod = 10 ** 9 + 7\nfor t in range(int(data())):\n\tn = int(data())\n\ts = data()\n\tf = 1\n\tb = 1\n\tans = 0\n\tif '>' in s:\n\t\tb = 0\n\tif '<' in s:\n\t\tf = 0\n\tfor i in range(n):\n\t\tif f == 1 or b == 1 or s[i - 1] == '-' or (s[i] == '-'):\n\t\t\tans += 1\n\tout(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tarr = []\n\tfor c in input():\n\t\tarr.append(c)\n\treturnable = []\n\tfor i in range(n):\n\t\treturnable.append(False)\n\tfor i in range(n - 1):\n\t\tif arr[i] == '-':\n\t\t\treturnable[i] = True\n\t\t\treturnable[i + 1] = True\n\tif arr[n - 1] == '-':\n\t\treturnable[n - 1] = True\n\t\treturnable[0] = True\n\tallRight = True\n\tallLeft = True\n\tfor i in range(n):\n\t\tif not arr[i] == '-' and (not arr[i] == '>'):\n\t\t\tallRight = False\n\tfor i in range(n):\n\t\tif not arr[i] == '-' and (not arr[i] == '<'):\n\t\t\tallLeft = False\n\tans = 0\n\tif allRight:\n\t\tans = n\n\telif allLeft:\n\t\tans = n\n\telse:\n\t\tfor e in returnable:\n\t\t\tif e:\n\t\t\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tif '<' not in s or '>' not in s:\n\t\tprint(n)\n\telse:\n\t\tcount = 0\n\t\ts = s[-1] + s\n\t\ts = '.'.join(s)\n\t\tfor i in range(1, len(s), 2):\n\t\t\tif s[i - 1] == '-' or s[i + 1] == '-':\n\t\t\t\tcount += 1\n\t\tprint(count)\n", "import os\nimport sys\nfrom io import BytesIO, IOBase\nimport math\nfrom decimal import *\ngetcontext().prec = 25\nfrom itertools import permutations\nMOD = pow(10, 9) + 7\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nfor _ in range(int(input())):\n\tn = int(input())\n\tl = input()\n\td = {}\n\tfor i in range(n):\n\t\td[l[i]] = d.get(l[i], 0) + 1\n\tx = d.get('-', 0)\n\td['-'] = 0\n\tif max(d.values()) + x == n:\n\t\tprint(n)\n\telse:\n\t\tc = n\n\t\tfor i in range(n):\n\t\t\tif l[i] == '>' or l[i] == '<':\n\t\t\t\tif l[i - 1] == '<' or l[i - 1] == '>':\n\t\t\t\t\tc -= 1\n\t\tprint(c)\n", "import sys\nimport os\nfrom math import sqrt, log, log2, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial\nfrom copy import copy, deepcopy\nfrom sys import exit, stdin, stdout\nfrom collections import Counter, defaultdict, deque\nfrom itertools import permutations\nimport heapq\nfrom bisect import bisect_left as bl\nfrom bisect import bisect_right as br\nfrom bisect import bisect\nmod = 1000000007\niinp = lambda : int(sys.stdin.readline())\ninp = lambda : sys.stdin.readline().strip()\nstrl = lambda : list(inp().strip().split(' '))\nintl = lambda : list(map(int, inp().split(' ')))\nmint = lambda : map(int, inp().split())\nflol = lambda : list(map(float, inp().split(' ')))\nflush = lambda : stdout.flush()\n\ndef permute(nums):\n\n\tdef fun(arr, nums, cur, v):\n\t\tif len(cur) == len(nums):\n\t\t\tarr.append(cur.copy())\n\t\ti = 0\n\t\twhile i < len(nums):\n\t\t\tif v[i]:\n\t\t\t\ti += 1\n\t\t\t\tcontinue\n\t\t\telse:\n\t\t\t\tcur.append(nums[i])\n\t\t\t\tv[i] = 1\n\t\t\t\tfun(arr, nums, cur, v)\n\t\t\t\tcur.pop()\n\t\t\t\tv[i] = 0\n\t\t\t\ti += 1\n\t\treturn arr\n\tres = []\n\tnums.sort()\n\tv = [0] * len(nums)\n\treturn fun(res, nums, [], v)\n\ndef subsets(res, index, arr, cur):\n\tres.append(cur.copy())\n\tfor i in range(index, len(arr)):\n\t\tcur.append(arr[i])\n\t\tsubsets(res, i + 1, arr, cur)\n\t\tcur.pop()\n\treturn res\n\ndef sieve(N):\n\troot = int(sqrt(N))\n\tprimes = [1] * (N + 1)\n\t(primes[0], primes[1]) = (0, 0)\n\tfor i in range(2, root + 1):\n\t\tif primes[i]:\n\t\t\tfor j in range(i * i, N + 1, i):\n\t\t\t\tprimes[j] = 0\n\treturn primes\n\ndef bs(arr, l, r, x):\n\tif x < arr[0] or x > arr[len(arr) - 1]:\n\t\treturn -1\n\twhile l <= r:\n\t\tmid = l + (r - l) // 2\n\t\tif arr[mid] == x:\n\t\t\treturn mid\n\t\telif arr[mid] < x:\n\t\t\tl = mid + 1\n\t\telse:\n\t\t\tr = mid - 1\n\treturn -1\n\ndef isPrime(n):\n\tif n <= 1:\n\t\treturn False\n\tif n <= 3:\n\t\treturn True\n\tif n % 2 == 0 or n % 3 == 0:\n\t\treturn False\n\tp = int(sqrt(n))\n\tfor i in range(5, p + 1, 6):\n\t\tif n % i == 0 or n % (i + 2) == 0:\n\t\t\treturn False\n\treturn True\n\ndef solve():\n\tn = iinp()\n\ts = inp()\n\tone = True\n\ttwo = True\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tone = False\n\t\tif s[i] == '<':\n\t\t\ttwo = False\n\tif one or two:\n\t\tprint(n)\n\t\treturn\n\tcount = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\tcount += 1\n\tprint(count)\nfor _ in range(iinp()):\n\tsolve()\n", "for it in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif '<' not in s or '>' not in s:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i + n - 1) % n] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tarr = [0]\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tarr[-1] += 1\n\t\telif arr[-1] != 0:\n\t\t\tarr.append(0)\n\tif len(arr) > 1 and s[-1] == '-' and (s[0] == '-'):\n\t\ttemp = arr[-1]\n\t\tarr[0] += temp\n\t\tarr = arr[:-1]\n\tret = sum(arr) + len(arr)\n\tif arr[-1] == 0:\n\t\tret -= 1\n\tif s.count('>') == 0 or s.count('<') == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(min(n, ret))\n", "import io\nimport os\nfrom collections import Counter, defaultdict, deque\n\ndef solve(N, S):\n\tisCircle = '<' not in S or '>' not in S\n\tif isCircle:\n\t\treturn N\n\tcount = 0\n\tfor i in range(N):\n\t\tif S[i] == '-' or S[(i - 1) % N] == '-':\n\t\t\tcount += 1\n\treturn count\ninput = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline\nTC = int(input())\nfor tc in range(1, TC + 1):\n\t(N,) = [int(x) for x in input().split()]\n\tS = input().decode().rstrip()\n\tans = solve(N, S)\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tc = int(input())\n\tc_arr = input()\n\tresult = 0\n\tcan_loop_left = True if c_arr.count('>') == 0 else False\n\tcan_loop_right = True if c_arr.count('<') == 0 else False\n\tif can_loop_right or can_loop_left:\n\t\tprint(c)\n\t\tcontinue\n\tfor i in range(c):\n\t\tif c_arr[i] == '-' or c_arr[(i - 1) % c] == '-':\n\t\t\tresult += 1\n\t\t\tcontinue\n\tprint(result)\n", "t = int(input())\nwhile t:\n\tt -= 1\n\tn = int(input())\n\ts = input()\n\tif not ('<' in s and '>' in s):\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(1, n + 1):\n\t\tif s[i - 1] == '-' or s[i % n] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nwhile t > 0:\n\tn = int(input())\n\ts = input()\n\tcount = 0\n\ttemp = [0] * len(s)\n\tfor i in range(len(s)):\n\t\tif i == 0 and s[i] == '-':\n\t\t\ttemp[i] = 1\n\t\t\ttemp[i + 1] = 1\n\t\telif i == len(s) - 1 and s[i] == '-':\n\t\t\ttemp[i] = 1\n\t\t\ttemp[0] = 1\n\t\telif s[i] == '-':\n\t\t\ttemp[i] = 1\n\t\t\ttemp[i + 1] = 1\n\tc1 = s.count('<')\n\tc2 = s.count('>')\n\tif c1 != 0 and c2 != 0:\n\t\tans = sum(temp)\n\telse:\n\t\tans = len(s)\n\tprint(ans)\n\tt -= 1\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ta = list(input())\n\tk = a.count('>')\n\tm = a.count('<')\n\tans = 0\n\tif k == 0 or m == 0:\n\t\tprint(n)\n\t\tcontinue\n\telse:\n\t\tfor i in range(n):\n\t\t\tif i == 0:\n\t\t\t\tif a[n - 1] == '-' or a[i] == '-':\n\t\t\t\t\tans = ans + 1\n\t\t\telif a[i - 1] == '-' or a[i] == '-':\n\t\t\t\tans = ans + 1\n\tprint(ans)\n", "def solve(n, s):\n\tone = True\n\ttwo = True\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tone = False\n\t\tif s[i] == '<':\n\t\t\ttwo = False\n\tif one or two:\n\t\treturn n\n\telse:\n\t\tcnt = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\t\tcnt += 1\n\t\treturn cnt\nt = int(input())\nwhile t:\n\tn = int(input())\n\ts = input()\n\tprint(solve(n, s))\n\tt -= 1\n", "from collections import Counter, OrderedDict\nfrom itertools import permutations as perm\nfrom collections import deque\nfrom sys import stdin\nfrom bisect import *\nfrom heapq import *\nimport math\ng = lambda : stdin.readline().strip()\ngl = lambda : g().split()\ngil = lambda : [int(var) for var in gl()]\ngfl = lambda : [float(var) for var in gl()]\ngcl = lambda : list(g())\ngbs = lambda : [int(var) for var in g()]\nmod = int(1000000000.0) + 7\ninf = float('inf')\n(t,) = gil()\nfor _ in range(t):\n\t(n,) = gil()\n\ts = g()\n\tb = Counter(s)\n\tif len(b) == 1:\n\t\tprint(n)\n\telif len(b) == 2 and '-' in b:\n\t\tprint(n)\n\telif len(b) == 2 and '-' not in b:\n\t\tprint(0)\n\telse:\n\t\tprev = [s[0]]\n\t\tcnt = [1]\n\t\tfor i in range(1, n):\n\t\t\tif s[i] == prev[-1]:\n\t\t\t\tcnt[-1] += 1\n\t\t\telse:\n\t\t\t\tcnt.append(1)\n\t\t\t\tprev.append(s[i])\n\t\tif prev[0] == prev[-1] and prev[0] == '-':\n\t\t\tprev.pop()\n\t\t\tcnt[0] += cnt.pop()\n\t\tans = 0\n\t\tfor i in range(len(cnt)):\n\t\t\tans += cnt[i] + 1 if prev[i] == '-' else 0\n\t\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif '<' not in s or '>' not in s:\n\t\tprint(n)\n\t\tcontinue\n\tif n == 2:\n\t\tif '>' in s and '<' in s:\n\t\t\tprint(0)\n\t\telse:\n\t\t\tprint(2)\n\t\tcontinue\n\tc = f = 0\n\tfor i in s:\n\t\tif i == '-':\n\t\t\tif c > 0:\n\t\t\t\tf += 1\n\t\t\telse:\n\t\t\t\tf += 2\n\t\t\t\tc += 1\n\t\telse:\n\t\t\tc = 0\n\tif s[0] == '-' and s[-1] == '-':\n\t\tf -= 1\n\tprint(f)\n", "from itertools import groupby\n\ndef main():\n\tnum_testcases = int(input())\n\tresults = []\n\tfor _ in range(num_testcases):\n\t\tnum_rooms = int(input())\n\t\tstrip = input().strip()\n\t\tif not ('>' in strip and '<' in strip):\n\t\t\tresults.append(num_rooms)\n\t\telse:\n\t\t\tminus_groups = [''.join(g) for (k, g) in groupby(strip) if k == '-']\n\t\t\tresult = sum(map(len, minus_groups)) + len(minus_groups)\n\t\t\tif strip[0] == strip[-1] == '-':\n\t\t\t\tresult -= 1\n\t\t\tresults.append(result)\n\tfor res in results:\n\t\tprint(res)\nmain()\n", "import sys\ninput = lambda : sys.stdin.readline().rstrip()\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tans = 0\n\tcnt = set()\n\tfor i in range(n):\n\t\tif s[i] in ['<', '>']:\n\t\t\tcnt.add(s[i])\n\tif len(cnt) != 2:\n\t\tprint(n)\n\telse:\n\t\tcnt = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tcnt += 1\n\t\t\telse:\n\t\t\t\tif cnt > 0:\n\t\t\t\t\tans += cnt + 1\n\t\t\t\tcnt = 0\n\t\tif s[0] == '-':\n\t\t\tans += cnt\n\t\telif cnt > 0:\n\t\t\tans += cnt + 1\n\t\tprint(ans)\n", "test_cases = range(int(input()))\nfor test_case in test_cases:\n\tn = int(input())\n\ts = input()\n\tis_cycle = True\n\tcycle_direction = None\n\tcount = n\n\tfor d in s:\n\t\tif d == '>':\n\t\t\tif cycle_direction is None:\n\t\t\t\tcycle_direction = '>'\n\t\t\telif cycle_direction == '<':\n\t\t\t\tis_cycle = False\n\t\t\t\tbreak\n\t\tif d == '<':\n\t\t\tif cycle_direction is None:\n\t\t\t\tcycle_direction = '<'\n\t\t\telif cycle_direction == '>':\n\t\t\t\tis_cycle = False\n\t\t\t\tbreak\n\tif is_cycle == True:\n\t\tprint(n)\n\t\tcontinue\n\telse:\n\t\tfor i in range(n - 1):\n\t\t\tif s[i] != '-' and s[i + 1] != '-':\n\t\t\t\tcount -= 1\n\t\tif s[0] != '-' and s[n - 1] != '-':\n\t\t\tcount -= 1\n\t\tprint(count)\n\t\tcontinue\n", "import sys\nimport math\ninput = sys.stdin.readline\n\ndef algo(s, n):\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] != '-':\n\t\t\tcontinue\n\t\tif s[(i + 1) % n] == '-':\n\t\t\tans += 1\n\t\telse:\n\t\t\tans += 2\n\tt = [0, 0]\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tt[0] = 1\n\t\tif s[i] == '<':\n\t\t\tt[1] = 1\n\tif sum(t) <= 1:\n\t\treturn n\n\telse:\n\t\treturn ans\nfor _ in range(int(input())):\n\tn = int(input())\n\tstring = input().strip()\n\tres = algo(string, n)\n\tprint(res)\n", "def solve():\n\tn = int(input().strip())\n\tconveyors = list(input().strip())\n\n\tdef run(start, lookup):\n\t\ttarget = start\n\t\twhile conveyors[start] in lookup:\n\t\t\tstart = (start + 1) % n\n\t\t\tif start == target:\n\t\t\t\treturn True\n\t\treturn False\n\tif run(0, '->'):\n\t\treturn n\n\tif run(0, '-<'):\n\t\treturn n\n\tdirect_reachable = set()\n\tfor c in range(n):\n\t\tif conveyors[c] == '-':\n\t\t\tdirect_reachable.add(c)\n\t\t\tdirect_reachable.add((c + 1) % n)\n\treturn len(direct_reachable)\nfor _ in range(int(input().strip())):\n\tprint(solve())\n", "import sys\ninput = lambda : sys.stdin.readline().rstrip()\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tans = 0\n\tok = s.count('>') == 0 or s.count('<') == 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\tans += 1\n\t\telif ok and s[i] == s[(i + 1) % n]:\n\t\t\tans += 1\n\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tres = 0\n\tli = list(input())\n\tli.append(li[0])\n\tc = False\n\tac = False\n\tfor i in range(n):\n\t\tif li[i] == '-' or li[i + 1] == '-':\n\t\t\tres += 1\n\t\tif li[i] == '>':\n\t\t\tc = True\n\t\tif li[i] == '<':\n\t\t\tac = True\n\tif c == True and ac == True:\n\t\tprint(res)\n\telse:\n\t\tprint(n)\n", "from sys import stdin\nt = int(stdin.readline())\nfor _ in range(t):\n\tn = int(stdin.readline())\n\ts = stdin.readline().strip()\n\tlefts = 0\n\trights = 0\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tlefts += 1\n\t\t\trights += 1\n\t\telif s[i] == '>':\n\t\t\trights += 1\n\t\telse:\n\t\t\tlefts += 1\n\tif lefts == n or rights == n:\n\t\tprint(n)\n\telse:\n\t\ttotal = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\t\ttotal += 1\n\t\tprint(total)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = 0\n\tl = input()\n\tx = ''.join(l.split('-'))\n\tfor i in range(n):\n\t\tif l[i] == '-':\n\t\t\tif l[(i - 1) % n] != '-':\n\t\t\t\ts += 2\n\t\t\telse:\n\t\t\t\ts += 1\n\tprint((n, s)['<>' in x or '><' in x])\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tfl = 1\n\tcnt1 = s.count('-')\n\tcnt2 = s.count('<')\n\tcnt3 = s.count('>')\n\tif cnt2 > 0 and cnt3 > 0:\n\t\tfl = 0\n\tif fl == 1:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i + n - 1) % n] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tN = int(input())\n\tS = input()\n\tleft = 0\n\tright = 0\n\tans = 0\n\tflag = False\n\tf = False\n\tfor i in range(N):\n\t\tif S[i] == '>' or S[i] == '-':\n\t\t\tright += 1\n\t\tif S[i] == '<' or S[i] == '-':\n\t\t\tleft += 1\n\t\tif S[i] == '-':\n\t\t\tf = True\n\t\t\tans += 1\n\t\telif f:\n\t\t\tf = False\n\t\t\tans += 1\n\tif S[0] != '-' and f:\n\t\tans += 1\n\tif left == N or right == N:\n\t\tflag = True\n\tif flag:\n\t\tans = N\n\tprint(ans)\n", "from math import *\nimport sys\nfrom sys import stdin\nfrom sys import stdout\nfor __ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif '<' not in s:\n\t\tprint(n)\n\telif '>' not in s:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif i == 0:\n\t\t\t\tif s[i] == '-' or s[n - 1] == '-':\n\t\t\t\t\tans += 1\n\t\t\telif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "from math import *\nt = int(input())\nwhile t:\n\tt = t - 1\n\tn = int(input())\n\ts = input()\n\tcnt = 0\n\tflag = [0 for i in range(n)]\n\tcnt1 = 0\n\tcnt2 = 0\n\tcnt3 = 0\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tcnt1 += 1\n\t\telif s[i] == '<':\n\t\t\tcnt2 += 1\n\t\telif s[i] == '-':\n\t\t\tcnt3 += 1\n\t\t\tflag[i] = 1\n\t\t\tflag[(i + 1) % n] = 1\n\tif cnt1 + cnt3 == n:\n\t\tprint(n)\n\telif cnt2 + cnt3 == n:\n\t\tprint(n)\n\telse:\n\t\tprint(flag.count(1))\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\ta = s.count('>')\n\tb = s.count('<')\n\tif a == 0 or b == 0:\n\t\tprint(n)\n\telse:\n\t\ts = s[-1] + s\n\t\tans = 0\n\t\tfor i in range(1, n + 1):\n\t\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "for test in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tnv = s.count('>')\n\tnm = s.count('<')\n\tnr = s.count('-')\n\tif nv == 0 or nm == 0:\n\t\tprint(n)\n\telse:\n\t\tst = s.find('>')\n\t\tpr = False\n\t\trad = 0\n\t\tres = 0\n\t\tfor i in range(1, n + 1):\n\t\t\tif s[(st + i) % n] == '-':\n\t\t\t\tif pr:\n\t\t\t\t\trad += 1\n\t\t\t\t\tres += 1\n\t\t\t\telse:\n\t\t\t\t\tpr = True\n\t\t\t\t\trad += 1\n\t\t\t\t\tres += 1\n\t\t\telif pr:\n\t\t\t\tres += 1\n\t\t\t\tpr = False\n\t\tprint(res)\n", "from math import *\nfrom sys import *\nt = int(stdin.readline())\nfor i in range(t):\n\tn = int(stdin.readline())\n\ta = input()\n\tf = 0\n\tflag = 0\n\tx = '-'\n\tfor i in range(n):\n\t\tif a[i] != '-':\n\t\t\tx = a[i]\n\t\t\tf = 1\n\t\t\tbreak\n\tif f == 1:\n\t\tfor i in range(n):\n\t\t\tif a[i] != '-' and a[i] != x:\n\t\t\t\tflag = 1\n\t\t\t\tbreak\n\tif flag == 0:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\td = {}\n\t\tb = []\n\t\tfor i in range(n):\n\t\t\tb.append(i)\n\t\t\td[i] = 0\n\t\tb.append(0)\n\t\tfor i in range(n):\n\t\t\tif a[i] == '-':\n\t\t\t\tif d[b[i]] == 0:\n\t\t\t\t\td[b[i]] = 1\n\t\t\t\t\tans += 1\n\t\t\t\tif d[b[i + 1]] == 0:\n\t\t\t\t\td[b[i + 1]] = 1\n\t\t\t\t\tans += 1\n\t\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\t(a, b) = (0, 0)\n\ts = [i for i in input()]\n\tfor i in s:\n\t\tif i == '<':\n\t\t\ta += 1\n\t\telif i == '>':\n\t\t\tb += 1\n\tif a == 0 or b == 0:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tans += 1\n\t\t\tcontinue\n\tprint(ans)\n", "import sys\nimport math\n\ndef input():\n\treturn sys.stdin.readline().strip()\n\ndef iinput():\n\treturn int(input())\n\ndef rinput():\n\treturn map(int, sys.stdin.readline().strip().split())\n\ndef get_list():\n\treturn list(map(int, sys.stdin.readline().strip().split()))\nmod = int(1000000000.0) + 7\nfor _ in range(iinput()):\n\tn = iinput()\n\ts = input()\n\tst = set(s)\n\tl = len(st)\n\tc = s.count('-')\n\tif l == 3:\n\t\tans = 0\n\t\ti = 0\n\t\twhile i < n:\n\t\t\tif s[i] == '-':\n\t\t\t\tj = 1\n\t\t\t\twhile i < n - 1 and s[i + 1] == '-':\n\t\t\t\t\tj += 1\n\t\t\t\t\ti += 1\n\t\t\t\tans += j + 1\n\t\t\ti += 1\n\t\tif s[0] == s[-1] == '-':\n\t\t\tprint(ans - 1)\n\t\telse:\n\t\t\tprint(ans)\n\telif l == 2:\n\t\tif c == 0:\n\t\t\tprint(0)\n\t\telse:\n\t\t\tprint(n)\n\telse:\n\t\tprint(n)\n", "import time, math as mt, bisect, sys\nfrom sys import stdin, stdout\nfrom collections import deque\nfrom fractions import Fraction\nfrom collections import Counter\nfrom collections import OrderedDict\npi = 3.141592653589793\n\ndef II():\n\treturn int(stdin.readline())\n\ndef IO():\n\treturn stdin.readline()\n\ndef IP():\n\treturn map(int, stdin.readline().split())\n\ndef L():\n\treturn list(map(int, stdin.readline().split()))\n\ndef P(x):\n\treturn stdout.write(str(x) + '\\n')\n\ndef PI(x, y):\n\treturn stdout.write(str(x) + ' ' + str(y) + '\\n')\n\ndef lcm(a, b):\n\treturn a * b // gcd(a, b)\n\ndef gcd(a, b):\n\tif a == 0:\n\t\treturn b\n\telif b == 0:\n\t\treturn a\n\tif a > b:\n\t\treturn gcd(a % b, b)\n\telse:\n\t\treturn gcd(a, b % a)\n\ndef bfs(adj, v):\n\tvisited = [False] * (v + 1)\n\tq = deque()\n\twhile q:\n\t\tpass\n\ndef sieve():\n\tli = [True] * 1000001\n\t(li[0], li[1]) = (False, False)\n\tfor i in range(2, len(li), 1):\n\t\tif li[i] == True:\n\t\t\tfor j in range(i * i, len(li), i):\n\t\t\t\tli[j] = False\n\tprime = []\n\tfor i in range(1000001):\n\t\tif li[i] == True:\n\t\t\tprime.append(i)\n\treturn prime\n\ndef setBit(n):\n\tcount = 0\n\twhile n != 0:\n\t\tn = n & n - 1\n\t\tcount += 1\n\treturn count\nmx = 10 ** 7\nspf = [mx] * (mx + 1)\n\ndef SPF():\n\tspf[1] = 1\n\tfor i in range(2, mx + 1):\n\t\tif spf[i] == mx:\n\t\t\tspf[i] = i\n\t\t\tfor j in range(i * i, mx + 1, i):\n\t\t\t\tif i < spf[j]:\n\t\t\t\t\tspf[j] = i\n\treturn\n\ndef readTree(v):\n\tadj = [set() for i in range(v + 1)]\n\tfor i in range(v - 1):\n\t\t(u1, u2) = In()\n\t\tadj[u1].add(u2)\n\t\tadj[u2].add(u1)\n\treturn adj\n\ndef solve():\n\tn = II()\n\ts = input()\n\t(cnt0, cnt1) = (0, 0)\n\tfor ele in s:\n\t\tif ele == '>' or ele == '-':\n\t\t\tcnt0 += 1\n\t\tif ele == '<' or ele == '-':\n\t\t\tcnt1 += 1\n\tif cnt0 >= n or cnt1 >= n:\n\t\tprint(n)\n\t\treturn\n\ti = 0\n\tans = [0] * n\n\twhile i < n:\n\t\tif s[i] == '-':\n\t\t\tans[i % n] = 1\n\t\t\tans[(i + 1) % n] = 1\n\t\ti += 1\n\tprint(ans.count(1))\n\treturn\nt = II()\nfor i in range(t):\n\tsolve()\n", "import sys\ntests = int(sys.stdin.readline())\nfor i in range(tests):\n\trooms = int(sys.stdin.readline())\n\tbelts = sys.stdin.readline().strip()\n\tif '<' not in belts:\n\t\tprint(rooms)\n\t\tcontinue\n\tif '>' not in belts:\n\t\tprint(rooms)\n\t\tcontinue\n\tif '<' not in belts and '>' not in belts:\n\t\tprint(rooms)\n\t\tcontinue\n\tret_rooms = 0\n\tfor room in range(rooms):\n\t\tif belts[room % rooms] == '>' and belts[(room + 1) % rooms] == '<':\n\t\t\tpass\n\t\telif belts[room % rooms] == '-' or belts[(room + 1) % rooms] == '-':\n\t\t\tret_rooms += 1\n\tprint(ret_rooms)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tans = 0\n\trr = 1\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\trr = 0\n\trl = 1\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\trl = 0\n\tif rr == 1 or rl == 1:\n\t\tprint(n)\n\telse:\n\t\tfor i in range(n):\n\t\t\tif s[i % n] == '-' or s[(i + 1) % n] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "import math\nfrom sys import stdin\nfrom sys import setrecursionlimit\nsetrecursionlimit(100000)\n\ndef put():\n\treturn map(int, stdin.readline().split())\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif s.count('<') == 0 or s.count('>') == 0:\n\t\tprint(n)\n\telse:\n\t\tsm = 0\n\t\tans = 0\n\t\tfor i in s:\n\t\t\tif i == '-':\n\t\t\t\tsm += 1\n\t\t\telif sm > 0:\n\t\t\t\tans += sm + 1\n\t\t\t\tsm = 0\n\t\tif sm > 0:\n\t\t\tans += sm + 1\n\t\tif s[0] == '-' and s[-1] == '-':\n\t\t\tans -= 1\n\t\tprint(ans)\n", "from sys import stdin\n\ndef main():\n\tinput = lambda : stdin.readline()[:-1]\n\tT = int(input())\n\tfor _ in [0] * T:\n\t\tN = int(input())\n\t\tS = input()\n\t\tcw = [0] * N\n\t\tccw = cw[:]\n\t\tfor (i, s) in enumerate(S):\n\t\t\tif s != '<':\n\t\t\t\tcw[i] = 1\n\t\t\tif s != '>':\n\t\t\t\tccw[i] = 1\n\t\tif sum(cw) == N or sum(ccw) == N:\n\t\t\tans = N\n\t\telse:\n\t\t\t(ans, n) = (0, set())\n\t\t\tfor i in range(N):\n\t\t\t\tif cw[i] and ccw[i]:\n\t\t\t\t\tn.add(i)\n\t\t\t\t\tif i + 1 == N:\n\t\t\t\t\t\tn.add(0)\n\t\t\t\t\telse:\n\t\t\t\t\t\tn.add(i + 1)\n\t\t\tans = len(n)\n\t\tprint(ans)\nmain()\n", "t = int(input())\nwhile t > 0:\n\tt -= 1\n\tn = int(input())\n\ts = input()\n\ta = False\n\tb = False\n\tfor i in s:\n\t\tif i == '>':\n\t\t\ta = True\n\t\tif i == '<':\n\t\t\tb = True\n\tif a and b:\n\t\ts += s[0]\n\t\tc = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tc += 1\n\t\tprint(c)\n\telse:\n\t\tprint(n)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tb = 0\n\tif s[0] == s[-1] == '-':\n\t\tb = 1\n\tif '>' not in s or '<' not in s:\n\t\tprint(n)\n\telif '-' not in s:\n\t\tprint(0)\n\telse:\n\t\ts = ' '.join(' '.join(s.split('<')).split('>')).split()\n\t\ta = 0\n\t\tfor i in s:\n\t\t\ta += len(i) + 1\n\t\tprint(a - b)\n", "t = int(input())\nfor i in range(0, t):\n\tm = int(input())\n\tstr1 = input()\n\tcc = 0\n\tac = 0\n\tbc = 0\n\tans = 0\n\tcont = 0\n\tfor j in range(0, m):\n\t\tif str1[j] == '>':\n\t\t\tcc += 1\n\t\telif str1[j] == '<':\n\t\t\tac += 1\n\t\telse:\n\t\t\tbc += 1\n\tif cc == 0 or ac == 0:\n\t\tans = m\n\telse:\n\t\tfor j in range(0, m):\n\t\t\tif str1[j] == '-' and cont == 0:\n\t\t\t\tans = ans + 2\n\t\t\t\tcont = 1\n\t\t\telif str1[j] == '-' and cont == 1:\n\t\t\t\tans = ans + 1\n\t\t\telif str1[j] == '>' or str1[j] == '<':\n\t\t\t\tcont = 0\n\t\tif str1[0] == '-' and str1[-1] == '-':\n\t\t\tans -= 1\n\tprint(ans)\n", "t = int(input())\nwhile t != 0:\n\tt = t - 1\n\tn = int(input())\n\ts = input()\n\tsf1 = 0\n\tsf2 = 0\n\tsf3 = 0\n\tfor i in s:\n\t\tif i == '>':\n\t\t\tsf1 = sf1 + 1\n\t\telif i == '<':\n\t\t\tsf2 = sf2 + 1\n\t\telse:\n\t\t\tsf3 = sf3 + 1\n\tif sf1 == n or sf2 == n or sf3 == n or (sf1 + sf3 == n) or (sf2 + sf3 == n):\n\t\tprint(n)\n\t\tcontinue\n\telif sf3 == 0:\n\t\tprint('0')\n\telse:\n\t\tcnt = 0\n\t\tans = 0\n\t\tfor i in s:\n\t\t\tif i == '-':\n\t\t\t\tif cnt == 0:\n\t\t\t\t\tcnt = cnt + 2\n\t\t\t\telse:\n\t\t\t\t\tcnt = cnt + 1\n\t\t\telse:\n\t\t\t\tans = ans + cnt\n\t\t\t\tcnt = 0\n\t\tans = ans + cnt\n\t\tif s[0] == '-' and s[n - 1] == '-':\n\t\t\tans = ans - 1\n\t\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = str(input())\n\ts = s[-1] + s + s[0]\n\tE = 0\n\tr = 0\n\tl = 0\n\tp = 0\n\tfor i in range(1, n + 1):\n\t\tif s[i] == '<':\n\t\t\tl += 1\n\t\telif s[i] == '>':\n\t\t\tr += 1\n\t\telse:\n\t\t\tp += 1\n\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\tE += 1\n\tif l == 0 or r == 0:\n\t\tE = n\n\tprint(E)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tp = s\n\tp += s[0]\n\tans = 0\n\tind = -1\n\tflag1 = 0\n\tflag2 = 0\n\tc = 0\n\tfor j in range(1, n + 1):\n\t\tif p[j] == '<':\n\t\t\tflag1 = 1\n\t\telif p[j] == '>':\n\t\t\tflag2 = 1\n\tfor j in range(1, n + 1):\n\t\tif p[j] == '-' and p[j - 1] == '-':\n\t\t\tc += 1\n\t\telif p[j] == '-':\n\t\t\tc += 2\n\tif flag1 and flag2:\n\t\tprint(c)\n\telse:\n\t\tprint(n)\n", "from sys import stdin, stdout\nst = lambda : list(stdin.readline().strip())\nli = lambda : list(map(int, stdin.readline().split()))\nmp = lambda : map(int, stdin.readline().split())\ninp = lambda : int(stdin.readline())\npr = lambda n: stdout.write(str(n) + '\\n')\nmod = 1000000007\n\ndef solve():\n\tn = inp()\n\ts = st()\n\tif '<' not in s and '>' in s or ('<' in s and '>' not in s):\n\t\tpr(n)\n\t\treturn\n\tp = set()\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tp.add(i)\n\t\t\tp.add((i + 1) % n)\n\tpr(len(p))\nfor _ in range(inp()):\n\tsolve()\n", "rw = int(input())\nfor wewq in range(rw):\n\tn = int(input())\n\ts = input()\n\tsp = s.count('>')\n\tsl = s.count('<')\n\tss = s.count('-')\n\tf = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tf += 1\n\t\telif s[i] == '>' and sl == 0:\n\t\t\tf += 1\n\t\telif s[i - 1] == '<' and sp == 0:\n\t\t\tf += 1\n\tprint(f)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\ttemp = [-1] * n\n\tprev = s[0]\n\tcycle = False\n\tcount = 0\n\tc1 = 0\n\tc2 = 0\n\tc3 = 0\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tc1 += 1\n\t\telif s[i] == '>':\n\t\t\tc2 += 1\n\t\telse:\n\t\t\tc3 += 1\n\tif c1 + c2 == n or c1 + c3 == n:\n\t\tcycle = True\n\tfor i in range(1, n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tcount += 1\n\tif s[0] == '-' or s[-1] == '-':\n\t\tcount += 1\n\tif cycle:\n\t\tprint(n)\n\telse:\n\t\tprint(count)\n", "t = int(input())\nfor inx in range(t):\n\tn = input()\n\ts = input()\n\tnum = 0\n\tif s[0] == '-' or s[-1] == '-':\n\t\tnum = 1\n\tl = r = False\n\tcp = s[0]\n\tif cp == '<':\n\t\tl = True\n\tif cp == '>':\n\t\tr = True\n\tfor c in s[1:]:\n\t\tif c == '-' or cp == '-':\n\t\t\tnum += 1\n\t\tif c == '<':\n\t\t\tl = True\n\t\tif c == '>':\n\t\t\tr = True\n\t\tcp = c\n\tif l and r:\n\t\tprint(num)\n\telse:\n\t\tprint(n)\n", "import sys\ninput = sys.stdin.readline\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tout = 0\n\tlCycle = True\n\trCycle = True\n\tfor c in s:\n\t\tif c == '<':\n\t\t\tlCycle = False\n\t\tif c == '>':\n\t\t\trCycle = False\n\tif lCycle or rCycle:\n\t\tprint(n)\n\telse:\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[(i - 1) % n] == '-':\n\t\t\t\tout += 1\n\t\tprint(out)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tstri = input()\n\tset_of_string = set(stri)\n\tcount = 0\n\tif set_of_string in [{'<'}, {'>'}, {'<', '-'}, {'>', '-'}, {'-'}]:\n\t\tprint(n)\n\t\tcontinue\n\tfor i in range(len(stri)):\n\t\tnext_ = (i + 1) % n\n\t\tif '-' == stri[next_] or '-' == stri[i]:\n\t\t\tcount += 1\n\tprint(count)\n", "t = int(input())\nwhile t > 0:\n\tt -= 1\n\tn = int(input())\n\ts = input()\n\ts = list(s)\n\tq = 1\n\ta = 0\n\tb = 0\n\tc = 0\n\tfor i in range(n - 1):\n\t\tif s[i] == '<':\n\t\t\ta = 1\n\t\telif s[i] == '>':\n\t\t\tb = 1\n\t\telif s[i + 1] == '-':\n\t\t\tc += 1\n\t\telse:\n\t\t\tc += 2\n\tif s[n - 1] == '<':\n\t\ta = 1\n\telif s[n - 1] == '>':\n\t\tb = 1\n\telif s[n - 1] == '-':\n\t\tif s[0] == '-':\n\t\t\tc += 1\n\t\telse:\n\t\t\tc += 2\n\tif a == 1 and b == 1:\n\t\tif c == 0:\n\t\t\tprint(0)\n\t\telse:\n\t\t\tprint(c)\n\telif a == 0 or b == 0:\n\t\tprint(n)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tbelts = input()\n\tif '>' in belts and '<' in belts:\n\t\tresult = 0\n\t\tfor i in range(n):\n\t\t\tif belts[i] == '-' or belts[(i + 1) % n] == '-':\n\t\t\t\tresult += 1\n\telse:\n\t\tresult = n\n\tprint(result)\n", "cases = int(input())\nfor _ in range(cases):\n\tn = int(input())\n\ts = input()\n\tclock = False\n\tcclock = False\n\tfor c in s:\n\t\tif c == '>':\n\t\t\tclock = True\n\t\tif c == '<':\n\t\t\tcclock = True\n\tif clock and cclock:\n\t\ts += s[0]\n\t\ttot = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\t\ttot += 1\n\t\tprint(tot)\n\telse:\n\t\tprint(n)\n", "def comp(a, b):\n\tif a == '>' and b == '<':\n\t\treturn 0\n\telif a == '<' and b == '>':\n\t\treturn 0\n\telif a == '<' and b == '<':\n\t\treturn 0\n\telif a == '>' and b == '>':\n\t\treturn 0\n\telse:\n\t\treturn 1\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\ts += s[0]\n\tans = 0\n\tif s.count('<') == 0 or s.count('>') == 0:\n\t\tans = n\n\telse:\n\t\tfor i in range(n):\n\t\t\tans += comp(s[i], s[i + 1])\n\tprint(ans)\n", "import sys, os\nfrom math import sqrt, gcd, ceil, log, floor\nfrom bisect import bisect, bisect_left\nfrom collections import defaultdict, Counter, deque\nfrom heapq import heapify, heappush, heappop\ninput = sys.stdin.readline\nread = lambda : list(map(int, input().strip().split()))\nMOD = 998244353\n\ndef main():\n\tans_ = []\n\tfor _ in range(int(input())):\n\t\tn = int(input())\n\t\ts = input()\n\t\ta = s.count('>')\n\t\tb = s.count('<')\n\t\tif a == 0 or b == 0:\n\t\t\tans_.append(str(n))\n\t\telse:\n\t\t\tsett = set()\n\t\t\tfor i in range(n):\n\t\t\t\tif s[i] == '-':\n\t\t\t\t\tsett.add(i % n)\n\t\t\t\t\tsett.add((i + 1) % n)\n\t\t\tans_.append(str(len(sett)))\n\tprint('\\n'.join(ans_))\nmain()\n", "for i in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tnum = 0\n\tright = s.count('>')\n\tleft = s.count('<')\n\tboth = s.count('-')\n\tif right + both == n or left + both == n:\n\t\tprint(n)\n\telse:\n\t\tfor j in range(n):\n\t\t\tif s[j] == '-':\n\t\t\t\tnum += 1\n\t\t\t\tif s[(j + 1) % n] != '-':\n\t\t\t\t\tnum += 1\n\t\tprint(num)\n", "import sys\n\ndef take_int(line):\n\treturn int(line)\n\ndef take_strings(line):\n\treturn list(line.split())\n\ndef take_character_list(line):\n\treturn list(line[:len(line) - 1])\n\ndef take_int_list(line):\n\treturn list(map(int, line.split()))\ni = 0\nn = 0\nstrs = []\nnums = []\nfor line in sys.stdin:\n\tif i == 0:\n\t\tn = take_int(line)\n\telif i % 2 == 1:\n\t\tnums.append(take_int(line))\n\telse:\n\t\tstrs.append(take_character_list(line))\n\ti += 1\nfor s in strs:\n\tnum_bar = 0\n\tleft = False\n\tright = False\n\tn = len(s)\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i + n - 1) % n] == '-':\n\t\t\tnum_bar += 1\n\t\tif s[i] == '<':\n\t\t\tleft = True\n\t\tif s[i] == '>':\n\t\t\tright = True\n\tif left and right:\n\t\tprint(num_bar)\n\telse:\n\t\tprint(len(s))\n", "import sys\ninput = lambda : sys.stdin.readline().strip()\ninp = lambda : list(map(int, input().split()))\nfor _ in range(int(input())):\n\tn = int(input())\n\ta = str(input())\n\tl = a.count('<')\n\tg = a.count('>')\n\tif l > 0 and g > 0:\n\t\tans = [False for i in range(n)]\n\t\tfor i in range(n):\n\t\t\tleft = i % n\n\t\t\tright = (i + 1) % n\n\t\t\tif a[i] == '-':\n\t\t\t\tans[left] = True\n\t\t\t\tans[right] = True\n\t\tprint(ans.count(True))\n\telse:\n\t\tprint(n)\n", "import sys, math\n\ndef check_cyclic(s_arr, pos1, pos2):\n\tcyclic = True\n\tc = -1 if s_arr[b1] == '<' else 1\n\tpos = pos1 if s_arr[b1] == '>' else pos2\n\tpos_ = pos1 if s_arr[b1] == '<' else pos2\n\twhile pos != pos_:\n\t\tpos = (pos + c + n) % n\n\t\tif s_arr[pos] == s_arr[pos_] or s_arr[pos] == '-':\n\t\t\tpass\n\t\telse:\n\t\t\tcyclic = False\n\t\t\tbreak\n\treturn cyclic\nN = int(input())\nfor i in range(N):\n\tn = int(input())\n\ts_arr = sys.stdin.readline().strip()\n\tcount = n\n\tcyclic = None\n\tfor i in range(n):\n\t\t(b1, b2) = (i, (i + (n - 1)) % n)\n\t\tif s_arr[b1] == '<' and s_arr[b2] == '>' or (s_arr[b1] == '>' and s_arr[b2] == '<'):\n\t\t\tcount -= 1\n\t\telif s_arr[b1] == s_arr[b2] and s_arr[b1] != '-':\n\t\t\tif cyclic == None:\n\t\t\t\tcyclic = check_cyclic(s_arr, b1, b2)\n\t\t\tif cyclic == False:\n\t\t\t\tcount -= 1\n\tsys.stdout.write(str(count) + '\\n')\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tcoun = 0\n\tclock = s.count('>')\n\tanti = s.count('<')\n\tboth = s.count('-')\n\tfor i in range(n):\n\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\tcoun += 1\n\t\telif s[i - 1] == '>' and s[i] == '<':\n\t\t\tcontinue\n\t\telif clock == 0 or anti == 0:\n\t\t\tcoun += 1\n\tprint(coun)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tn = len(s)\n\tresult = 0\n\tlastDouble = float('-inf')\n\t(numLeft, numRight) = (0, 0)\n\tfor (i, c) in enumerate(s):\n\t\tif c == '>':\n\t\t\tnumRight += 1\n\t\telif c == '<':\n\t\t\tnumLeft += 1\n\t\telif c == '-':\n\t\t\tnumLeft += 1\n\t\t\tnumRight += 1\n\t\t\tif i == lastDouble + 1 or (i == n - 1 and s[0] == '-'):\n\t\t\t\tif i == lastDouble + 1 and i == n - 1 and (s[0] == '-'):\n\t\t\t\t\tpass\n\t\t\t\telse:\n\t\t\t\t\tresult += 1\n\t\t\telse:\n\t\t\t\tresult += 2\n\t\t\tlastDouble = i\n\t\telse:\n\t\t\tassert False\n\tif numLeft == n or numRight == n:\n\t\tprint(n)\n\telse:\n\t\tprint(result)\n", "def run():\n\timport sys\n\tsys.stdin = open('/home/punit/Documents/Cpp Programs/input.txt', 'r')\n\tsys.stdout = open('/home/punit/Documents/Cpp Programs/output.txt', 'w')\n\tfrom math import ceil, sqrt, floor\nfor _ in range(int(input())):\n\tn = int(input())\n\tx = input()\n\ta = x.count('<')\n\tb = x.count('>')\n\tif a == n or b == n:\n\t\tprint(n)\n\telif a == 0 and b != 0:\n\t\tprint(n)\n\telif a != 0 and b == 0:\n\t\tprint(n)\n\telif a == 0 and b == 0:\n\t\tprint(n)\n\telse:\n\t\tli = [0] * n\n\t\tfor i in range(n):\n\t\t\tif x[i] == '-':\n\t\t\t\tli[i] = 1\n\t\t\t\tli[(i + 1) % n] = 1\n\t\tans = 0\n\t\tfor i in li:\n\t\t\tif i == 1:\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "from collections import Counter\nd = {'-': 0, '>': 1, '<': -1}\ncases = int(input())\nfor t in range(cases):\n\tn = int(input())\n\ts = input()\n\tsd = Counter(s)\n\tl = ['!' if i % 2 == 0 else s[i // 2] for i in range(2 * n)]\n\tout = 0\n\tv = 2 * n\n\tfor i in range(0, v, 2):\n\t\tif l[(i - 1) % v] == '-' or l[(i + 1) % v] == '-':\n\t\t\tout += 1\n\tval = n - sd['-']\n\tif sd['>'] == val or sd['<'] == val:\n\t\tprint(n)\n\telse:\n\t\tprint(out)\n", "t = int(input())\nwhile t > 0:\n\tj = 0\n\tn = int(input())\n\tls = input()\n\tls = ls + ls[0]\n\tif '>' in ls and '<' in ls:\n\t\tfor i in range(n):\n\t\t\tif ls[i] == '-' or ls[i + 1] == '-':\n\t\t\t\tj = j + 1\n\t\tprint(j)\n\telse:\n\t\tprint(n)\n\tt = t - 1\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tans = 0\n\tdict = {}\n\tfor i in range(n):\n\t\tdict[i] = 0\n\tfor i in range(n - 1):\n\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\tdict[i + 1] = 1\n\tif s[0] == '-' or s[n - 1] == '-':\n\t\tdict[0] = 1\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tbreak\n\telse:\n\t\tans = n\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tbreak\n\telse:\n\t\tans = n\n\tif ans == 0:\n\t\tfor i in dict:\n\t\t\tif dict[i]:\n\t\t\t\tans += 1\n\tprint(ans)\n", "MOD = 1000000007\nfrom collections import defaultdict as dd, Counter, deque\n\ndef si():\n\treturn input()\n\ndef ii():\n\treturn int(input())\n\ndef li():\n\treturn list(map(int, input().split()))\n\ndef mi():\n\treturn map(int, input().split())\n\ndef out(v):\n\tprint(v)\n\ndef spout():\n\tprint(v, end=' ')\n\ndef d2b(n):\n\treturn bin(n).replace('0b', '')\n\ndef twod(n, m, num):\n\treturn [[num for x in range(m)] for y in range(n)]\n\ndef vow():\n\treturn ['a', 'e', 'i', 'o', 'u']\n\ndef let():\n\treturn [chr(i) for i in range(97, 123)]\n\ndef gcd(x, y):\n\twhile y:\n\t\t(x, y) = (y, x % y)\n\treturn x\n\ndef ispow2(x):\n\treturn x and (not x & x - 1)\n\ndef prime_factors(n):\n\ti = 2\n\tfactors = []\n\twhile i * i <= n:\n\t\tif n % i:\n\t\t\ti += 1\n\t\telse:\n\t\t\tn //= i\n\t\t\tfactors.append(i)\n\tif n > 1:\n\t\tfactors.append(n)\n\treturn list(factors)\nt = ii()\nwhile t:\n\tt -= 1\n\tn = ii()\n\ta = si()\n\tgc = a.count('>')\n\tlc = a.count('<')\n\tif gc == 0 or lc == 0:\n\t\ts = n\n\telse:\n\t\ts = 0\n\t\tfor i in range(n):\n\t\t\tif i == 0 and (a[0] == '-' or a[-1] == '-'):\n\t\t\t\ts += 1\n\t\t\telif i == n - 1 and (a[-1] == '-' or a[-2] == '-'):\n\t\t\t\ts += 1\n\t\t\telif a[i - 1] == '-' or a[i] == '-':\n\t\t\t\ts += 1\n\tprint(s)\n", "for tests in range(int(input())):\n\tn = int(input())\n\tS = input()\n\tif '>' in S and '<' in S:\n\t\ta = 0\n\t\tfor i in range(n):\n\t\t\tif S[i] != '-' and S[i - 1] != '-':\n\t\t\t\ta += 1\n\t\tprint(n - a)\n\telse:\n\t\tprint(n)\n", "from collections import defaultdict\nimport sys\ninput = sys.stdin.readline\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\tdire = [i for i in input() if i != '\\n']\n\t(anti, clock, both) = (dire.count('<'), dire.count('>'), dire.count('-'))\n\tif anti == 0 or clock == 0:\n\t\tprint(n)\n\telse:\n\t\tans = set()\n\t\tfor i in range(n):\n\t\t\tif dire[i] == '-':\n\t\t\t\tans.add(i)\n\t\t\t\tans.add((i + 1) % n)\n\t\tprint(len(ans))\n", "from sys import stdin\n\nclass Input:\n\n\tdef __init__(self):\n\t\tself.it = iter(stdin.readlines())\n\n\tdef line(self):\n\t\treturn next(self.it).strip()\n\n\tdef array(self, sep=' ', cast=int):\n\t\treturn list(map(cast, self.line().split(sep=sep)))\n\ndef testcases(unknown=False):\n\tinpt = Input()\n\n\tdef testcases_decorator(func):\n\t\t(cases,) = [float('Inf')] if unknown else inpt.array()\n\t\twhile cases > 0:\n\t\t\ttry:\n\t\t\t\tfunc(inpt)\n\t\t\t\tcases -= 1\n\t\t\texcept StopIteration:\n\t\t\t\tbreak\n\treturn testcases_decorator\n\n@testcases()\ndef solve(inpt):\n\t(n,) = inpt.array()\n\ts = inpt.line()\n\tcw = s.count('>')\n\tccw = s.count('<')\n\tbi = s.count('-')\n\tif cw == 0 or ccw == 0:\n\t\tprint(n)\n\telse:\n\t\tm = [False for i in range(n)]\n\t\tfor i in range(n):\n\t\t\tj = (i + 1) % n\n\t\t\tif s[i] == '-':\n\t\t\t\tm[i] = True\n\t\t\t\tm[j] = True\n\t\tprint(m.count(True))\n", "from sys import stdin, gettrace\nif gettrace():\n\tinputi = input\nelse:\n\n\tdef input():\n\t\treturn next(stdin)[:-1]\n\n\tdef inputi():\n\t\treturn stdin.buffer.readline()\n\ndef solve():\n\tn = int(input())\n\tss = input()\n\tif not any((s == '>' for s in ss)) or not any((s == '<' for s in ss)):\n\t\tprint(n)\n\t\treturn\n\tres = 0\n\tfor i in range(n):\n\t\tif ss[i] == '-' or ss[(i - 1) % n] == '-':\n\t\t\tres += 1\n\tprint(res)\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tsolve()\nmain()\n", "t = int(input())\nwhile t > 0:\n\tn = int(input())\n\ts = input()\n\ts1 = '<' * n\n\ts2 = '>' * n\n\tans = 0\n\tif s == s1 or s == s2:\n\t\tprint(n)\n\t\tt = t - 1\n\t\tcontinue\n\tif '<' not in s or '>' not in s:\n\t\tprint(n)\n\t\tt = t - 1\n\t\tcontinue\n\telse:\n\t\ts = s + s[0]\n\t\tfor j in range(0, n):\n\t\t\tif s[j] == '-' or s[j + 1] == '-':\n\t\t\t\tans = ans + 1\n\tprint(ans)\n\tt = t - 1\n", "import math\n\ndef dtb(n):\n\treturn bin(n).replace('0b', '')\n\ndef btd(n):\n\treturn int(n, 2)\nt = int(input())\nfor k in range(t):\n\tn = int(input())\n\ts = input()\n\t(c1, c2, c3) = (0, 0, 0)\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tc1 += 1\n\t\tif s[i] == '<':\n\t\t\tc2 += 1\n\t\tif s[i] == '>':\n\t\t\tc3 += 1\n\tif c1 == 0:\n\t\tif c2 == n or c3 == n:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tprint(0)\n\t\tcontinue\n\tif c2 == 0:\n\t\tprint(n)\n\t\tcontinue\n\telif c3 == 0:\n\t\tprint(n)\n\t\tcontinue\n\tcount = 0\n\ta = []\n\tfor i in range(n):\n\t\ta.append(0)\n\ti = 0\n\twhile i < n:\n\t\tif s[i] == '-':\n\t\t\tif i == n - 1:\n\t\t\t\ta[n - 1] = 1\n\t\t\t\ta[0] = 1\n\t\t\t\tbreak\n\t\t\ta[i] = 1\n\t\t\ta[i + 1] = 1\n\t\t\ti += 1\n\t\telse:\n\t\t\ti += 1\n\tfor i in range(n):\n\t\tif a[i] == 1:\n\t\t\tcount += 1\n\tprint(count)\n", "from sys import stdin, stdout\nimport math, sys, heapq\nfrom itertools import permutations, combinations\nfrom collections import defaultdict, deque, OrderedDict\nfrom os import path\nimport random\nimport bisect as bi\n\ndef yes():\n\tprint('YES')\n\ndef no():\n\tprint('NO')\nif path.exists('input.txt'):\n\tsys.stdin = open('input.txt', 'r')\n\tsys.stdout = open('output.txt', 'w')\n\n\tdef I():\n\t\treturn int(input())\n\n\tdef In():\n\t\treturn map(int, input().split())\nelse:\n\n\tdef I():\n\t\treturn int(stdin.readline())\n\n\tdef In():\n\t\treturn map(int, stdin.readline().split())\n\ndef dict(a):\n\td = {}\n\tfor x in a:\n\t\tif d.get(x, -1) != -1:\n\t\t\td[x] += 1\n\t\telse:\n\t\t\td[x] = 1\n\treturn d\n\ndef find_gt(a, x):\n\ti = bi.bisect_left(a, x)\n\tif i != len(a):\n\t\treturn i\n\telse:\n\t\treturn -1\n\ndef main():\n\ttry:\n\t\tn = I()\n\t\tl = list(input())\n\t\t(forward, back, duo) = (0, 0, 0)\n\t\tcount = 0\n\t\tan = 0\n\t\tfor x in range(n):\n\t\t\tif l[x] == '-':\n\t\t\t\tcount += 1\n\t\t\t\tduo += 1\n\t\t\telif l[x] == '>':\n\t\t\t\tforward += 1\n\t\t\t\tif count:\n\t\t\t\t\tan += count + 1\n\t\t\t\t\tcount = 0\n\t\t\telse:\n\t\t\t\tback += 1\n\t\t\t\tif count:\n\t\t\t\t\tan += count + 1\n\t\t\t\t\tcount = 0\n\t\tif count:\n\t\t\tif l[-1] == '-' and l[0] == '-':\n\t\t\t\tan += count\n\t\t\telse:\n\t\t\t\tan += count + 1\n\t\tif forward + duo == n or back + duo == n:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tprint(min(an, n))\n\texcept:\n\t\tpass\nM = 998244353\nP = 1000000007\nfor _ in range(I()):\n\tmain()\n", "import sys\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\trooms = []\n\tfor i in range(n):\n\t\tl = i - 1\n\t\tr = i\n\t\tif l == -1:\n\t\t\tl = n - 1\n\t\tif r == n:\n\t\t\tr = 0\n\t\trooms.append([s[l], s[r]])\n\tcnt = 0\n\tcwfullc = True\n\tccwfullc = True\n\tonlycw = 0\n\tonlyccw = 0\n\tfor i in range(n):\n\t\t(l, r) = rooms[i]\n\t\tif l == '-' or r == '-':\n\t\t\tcnt += 1\n\t\telif l == '<' and r == '<':\n\t\t\tonlyccw += 1\n\t\telif l == '>' and r == '>':\n\t\t\tonlycw += 1\n\t\tif l == '>' or r == '>':\n\t\t\tccwfullc = False\n\t\tif l == '<' or r == '<':\n\t\t\tcwfullc = False\n\tans = cnt\n\tif cwfullc:\n\t\tans += onlycw\n\telif ccwfullc:\n\t\tans += onlyccw\n\tprint(ans)\n", "def solve():\n\tnumber = int(input())\n\tstring = input()\n\tans = 0\n\thimanshu = string.count('<')\n\tnnn = string.count('>')\n\tfor i in range(number):\n\t\tif i == 0:\n\t\t\tif string[i] == '-' or string[number - 1] == '-':\n\t\t\t\tans += 1\n\t\t\telif string[i] == '<':\n\t\t\t\tif nnn == 0:\n\t\t\t\t\tans += 1\n\t\t\telif string[i] == '>':\n\t\t\t\tif himanshu == 0:\n\t\t\t\t\tans += 1\n\t\telif string[i] == '-' or string[i - 1] == '-':\n\t\t\tans += 1\n\t\telif string[i] == '<':\n\t\t\tif nnn == 0:\n\t\t\t\tans += 1\n\t\telif string[i] == '>':\n\t\t\tif himanshu == 0:\n\t\t\t\tans += 1\n\treturn ans\nfor testcase in range(int(input())):\n\tprint(solve())\n", "import sys\nt = int(input())\nfor tc in range(t):\n\tn = int(input())\n\ts = input()\n\tseta = set()\n\tsetch = set()\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tseta.add((i + 1) % n)\n\t\t\tseta.add(i % n)\n\t\telse:\n\t\t\tsetch.add(s[i])\n\tif len(setch) > 1:\n\t\tprint(len(seta))\n\telse:\n\t\tprint(n)\n", "import sys\nreader = (s.rstrip() for s in sys.stdin)\ninput = reader.__next__\n\ndef gift():\n\tfor _ in range(t):\n\t\tn = int(input())\n\t\tbelt = input()\n\t\ttr = 0\n\t\ttl = 0\n\t\tans = 0\n\t\tcl = 0\n\t\tcr = 0\n\t\tfor i in range(n):\n\t\t\t(l, r) = (belt[i], belt[(i - 1) % n])\n\t\t\tif l == '-' or r == '-':\n\t\t\t\tans += 1\n\t\t\telse:\n\t\t\t\tif r == '>':\n\t\t\t\t\ttr += 1\n\t\t\t\tif l == '<':\n\t\t\t\t\ttl += 1\n\t\t\tif l == '>':\n\t\t\t\tcr += 1\n\t\t\tif l == '<':\n\t\t\t\tcl += 1\n\t\tif tr > 0 and cl == 0:\n\t\t\tans += tr\n\t\telif cr == 0 and tl > 0:\n\t\t\tans += tl\n\t\tyield ans\nt = int(input())\nans = gift()\nprint(*ans, sep='\\n')\n", "t = int(input())\nfor q in range(t):\n\tn = int(input())\n\tch2 = input()\n\ti = 0\n\twhile i < n and ch2[i] == '-':\n\t\ti += 1\n\tch = ch2[i:] + ch2[0:i]\n\tif ch.count('>') > 0 and ch.count('<') > 0:\n\t\tL = []\n\t\tfor i in ch:\n\t\t\tif i == '-':\n\t\t\t\tL.append(1)\n\t\t\telse:\n\t\t\t\tL.append(0)\n\t\tL2 = [0]\n\t\tfor i in range(len(L)):\n\t\t\tif L[i] != 0:\n\t\t\t\tL2[-1] += L[i]\n\t\t\telse:\n\t\t\t\tL2.append(0)\n\t\tnb = 0\n\t\tfor i in L2:\n\t\t\tif i != 0:\n\t\t\t\tnb += i + 1\n\t\tprint(nb)\n\telse:\n\t\tprint(n)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\th1 = 0\n\th2 = 0\n\tfor j in range(len(s)):\n\t\tif s[j] == '>':\n\t\t\th1 = 1\n\t\tif s[j] == '<':\n\t\t\th2 = 1\n\tif h1 and h2:\n\t\ts += s[0]\n\t\tans = 0\n\t\tfor k in range(n):\n\t\t\tif s[k] == '-' or s[k + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\tans = 0\n\tk_ans = 0\n\tkey = True\n\tr = input()\n\tr = r + r[0]\n\t(ri, le) = (0, 0)\n\tfor i in range(n):\n\t\tif r[i] == '<':\n\t\t\tri += 1\n\t\telif r[i] == '>':\n\t\t\tle += 1\n\t\tif r[i] == '-' or r[i + 1] == '-':\n\t\t\tans += 1\n\t\tif r[i] == '>' and r[i + 1] == '>' or (r[i] == '<' and r[i + 1] == '<'):\n\t\t\tk_ans += 1\n\t\tif r[i] == '>' and r[i + 1] == '<' or (r[i] == '<' and r[i + 1] == '>'):\n\t\t\tkey = False\n\tif ri == 0 or le == 0:\n\t\tans += k_ans\n\tif n == ri or n == le:\n\t\tprint(n)\n\telse:\n\t\tprint(ans)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tcount = 0\n\tif s.find('>') == -1 or s.find('<') == -1:\n\t\tcount = n\n\telse:\n\t\tfor i in range(n):\n\t\t\tif '-' in s[i] + s[(i + 1) % n]:\n\t\t\t\tcount += 1\n\tprint(count)\n", "from sys import stdin, stdout\nfor _ in range(int(stdin.readline())):\n\tn = int(stdin.readline())\n\ts = input()\n\tcl = s.count('>')\n\tan = s.count('<')\n\tbi = s.count('-')\n\tif cl + bi == n or an + bi == n:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tif i == 0:\n\t\t\taage = s[i]\n\t\t\tpeeche = s[-1]\n\t\telif i == n - 1:\n\t\t\taage = s[i]\n\t\t\tpeeche = s[i - 1]\n\t\telse:\n\t\t\taage = s[i]\n\t\t\tpeeche = s[i - 1]\n\t\tif aage == '-' or peeche == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "for i in range(int(input())):\n\tn = int(input())\n\tp = list(input())\n\tif '>' in p and '<' in p:\n\t\tp += p[0]\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif p[i] == '-' or p[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\n", "for test in range(int(input())):\n\tn = int(input())\n\ts = list(input())\n\tif '>' not in s:\n\t\tprint(n)\n\telif '<' not in s:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor x in range(n):\n\t\t\tif s[x] == '-' or s[(x - 1) % n] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "import os\n\ndef main():\n\ttest_cases = int(input())\n\tans = [None] * test_cases\n\tfor t in range(test_cases):\n\t\tn = int(input())\n\t\tbelts = input()\n\t\tunique = set(belts)\n\t\tif unique == set('<>') or unique == set('<>-'):\n\t\t\tsubs = []\n\t\t\t(start, end) = (False, False)\n\t\t\tacc = 0\n\t\t\tfor i in range(len(belts)):\n\t\t\t\tif belts[i] == '-':\n\t\t\t\t\tacc += 1\n\t\t\t\t\tif i == 0:\n\t\t\t\t\t\tstart = True\n\t\t\t\t\tif i == len(belts) - 1:\n\t\t\t\t\t\tend = True\n\t\t\t\t\t\tsubs.append(acc)\n\t\t\t\telif acc > 0:\n\t\t\t\t\tsubs.append(acc)\n\t\t\t\t\tacc = 0\n\t\t\tif start and end:\n\t\t\t\tsubs[0] += subs[-1]\n\t\t\t\tsubs.pop()\n\t\t\tans[t] = sum(subs) + len(subs)\n\t\telse:\n\t\t\tans[t] = n\n\tos.write(1, '\\n'.join(map(str, ans)).encode())\nmain()\n", "import sys, io, os\nZ = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline\nY = lambda : int(Z())\no = []\nfor i in range(Y()):\n\tn = Y()\n\ts = Z().strip()\n\tm = s[-1]\n\ta = b = r = 0\n\tfor i in range(n):\n\t\tif s[i] == 45:\n\t\t\tr += 1\n\t\telse:\n\t\t\tif s[i] == 60:\n\t\t\t\ta += 1\n\t\t\telse:\n\t\t\t\tb += 1\n\t\t\tif m == 45:\n\t\t\t\tr += 1\n\t\tm = s[i]\n\tif min(a, b) == 0:\n\t\to.append(str(n))\n\telse:\n\t\to.append(str(r))\nprint('\\n'.join(o))\n", "def testcase():\n\tn = int(input())\n\ts = input()\n\tvi = [False for _ in s]\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tvi[i] = True\n\t\t\tvi[(i + 1) % n] = True\n\tif '>' not in s:\n\t\tfor i in range(n):\n\t\t\tif s[i] == '<':\n\t\t\t\tvi[(i + 1) % n] = True\n\tif '<' not in s:\n\t\tfor i in range(n):\n\t\t\tif s[i] == '>':\n\t\t\t\tvi[i] = True\n\tprint(vi.count(True))\n\treturn\nt = int(input())\nfor _ in range(t):\n\ttestcase()\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input().rstrip()\n\tc = d = e = 0\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tc += 1\n\t\telif s[i] == '>':\n\t\t\td += 1\n\t\telse:\n\t\t\te += 1\n\tif c == 0 or d == 0:\n\t\tprint(n)\n\telif e == 0:\n\t\tprint(0)\n\telse:\n\t\te = 0\n\t\ts += s[0]\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tif s[i + 1] == '-':\n\t\t\t\t\te += 1\n\t\t\t\telse:\n\t\t\t\t\te += 2\n\t\tprint(e)\n", "import sys\n\ndef In():\n\treturn sys.stdin.readline()\n\ndef Out(x):\n\treturn sys.stdout.write(str(x) + '\\n')\nfor _ in range(int(In())):\n\tn = int(In())\n\ts = In()\n\tif '>' in s and '<' in s:\n\t\tc = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[(i - 1) % n] == '-':\n\t\t\t\tc += 1\n\t\tOut(c)\n\telse:\n\t\tOut(n)\n", "tt = int(input())\nfor ii in range(tt):\n\tn = int(input())\n\ts = input()\n\td = 0\n\tl = 0\n\tr = 0\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tl = 1\n\t\tif s[i] == '<':\n\t\t\tr = 1\n\tif s[0] == '-' or s[n - 1] == '-':\n\t\td += 1\n\tfor i in range(1, n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\td += 1\n\tif s[0] != '-' and s[n - 1] != '-' and (l + r == 1):\n\t\td += 1\n\tfor i in range(1, n):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tcontinue\n\t\tif s[i] == '>' and l + r == 1:\n\t\t\td += 1\n\t\tif s[i] == '<' and l + r == 1:\n\t\t\td += 1\n\tprint(d)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tr = s.count('>')\n\tl = s.count('<')\n\tif not (r > 0 and l > 0):\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\ti = 0\n\t\twhile i < n:\n\t\t\tif s[i] == '-':\n\t\t\t\tans += 1\n\t\t\t\twhile i < n and s[i] == '-':\n\t\t\t\t\ti += 1\n\t\t\t\t\tans += 1\n\t\t\ti += 1\n\t\tif s[0] == s[n - 1] == '-':\n\t\t\tans -= 1\n\t\tprint(ans)\n", "import sys\ninput = sys.stdin.readline\n(T,) = map(int, input().split())\nfor _ in range(T):\n\t(N,) = map(int, input().split())\n\ts = input().strip()\n\tf = 0\n\tfor i in range(N):\n\t\tif s[i] in '<':\n\t\t\tf = 1\n\t\t\tbreak\n\tif not f:\n\t\tprint(N)\n\t\tcontinue\n\tf = 0\n\tfor i in range(N):\n\t\tif s[i] in '>':\n\t\t\tf = 1\n\t\t\tbreak\n\tif not f:\n\t\tprint(N)\n\t\tcontinue\n\tc = 0\n\tfor i in range(N):\n\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\tc += 1\n\tprint(c)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tst = input()\n\ts = set()\n\tc1 = 0\n\tc2 = 0\n\tflag = 0\n\tfor i in range(n):\n\t\tif st[i] == '<':\n\t\t\tc1 += 1\n\t\telif st[i] == '>':\n\t\t\tc2 += 1\n\t\telse:\n\t\t\ts.add(i)\n\t\t\tif i + 1 == n:\n\t\t\t\ts.add(0)\n\t\t\telse:\n\t\t\t\ts.add(i + 1)\n\tif c1 == 0 or c2 == 0:\n\t\tprint(n)\n\telse:\n\t\tprint(len(s))\n", "t = int(input())\nwhile t > 0:\n\tt = t - 1\n\tn = int(input())\n\tstr = input()\n\tarr = []\n\tfor i in range(n):\n\t\ta = str[i]\n\t\tarr.append(a)\n\tcount = 0\n\tanti = False\n\tclock = False\n\tfor i in range(n):\n\t\tif arr[i] == '<':\n\t\t\tanti = True\n\t\tif arr[i] == '>':\n\t\t\tclock = True\n\tfor i in range(n):\n\t\tif arr[i] == '-' or arr[i - 1] == '-':\n\t\t\tcount = count + 1\n\t\telif arr[i] == '<' and arr[i - 1] == '>':\n\t\t\tcontinue\n\t\telse:\n\t\t\tif arr[i] == '<':\n\t\t\t\tif clock:\n\t\t\t\t\tcontinue\n\t\t\t\telse:\n\t\t\t\t\tcount = count + 1\n\t\t\tif arr[i] == '>':\n\t\t\t\tif anti:\n\t\t\t\t\tcontinue\n\t\t\t\telse:\n\t\t\t\t\tcount = count + 1\n\tprint(count)\n", "t = int(input())\nfor test in range(t):\n\tn = int(input())\n\ta = input()\n\thasLeft = False\n\thasRight = False\n\tfor i in range(n):\n\t\tif a[i] == '<':\n\t\t\thasLeft = True\n\t\telif a[i] == '>':\n\t\t\thasRight = True\n\tif hasLeft == False or hasRight == False:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tif a[n - 1] == '-' or a[0] == '-':\n\t\t\tans += 1\n\t\tfor i in range(n - 1):\n\t\t\tif a[i] == '-' or a[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\ti = 0\n\tans = 0\n\tif '<' in s and '>' in s:\n\t\tif '-' in s:\n\t\t\ti = 0\n\t\t\twhile i < n - 1:\n\t\t\t\tif s[i] == '-':\n\t\t\t\t\tans += 2\n\t\t\t\t\tif i > 0 and s[i - 1] == '-':\n\t\t\t\t\t\tans -= 1\n\t\t\t\ti += 1\n\t\t\tif s[-1] == '-':\n\t\t\t\tif s[-2] == '-':\n\t\t\t\t\tans -= 1\n\t\t\t\tif s[0] == '-':\n\t\t\t\t\tans -= 1\n\t\t\t\tans += 2\n\t\t\tprint(ans)\n\t\telse:\n\t\t\tprint(0)\n\telse:\n\t\tprint(len(s))\n", "def process_test_case(i_t):\n\tn = int(input())\n\ts = input()\n\tdistinct_dir = set(s)\n\tboth_dir_available = '<' in distinct_dir and '>' in distinct_dir\n\tsnake_vec = [0] * n\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\tsnake_vec[i] = 1\n\t\telif s[i] != s[(i + 1) % n]:\n\t\t\tsnake_vec[i] = 0\n\t\telse:\n\t\t\tsnake_vec[i] = 0 if both_dir_available else 1\n\tprint(sum(snake_vec))\n\treturn None\nn_tests = int(input())\nfor i_test in range(1, n_tests + 1):\n\tprocess_test_case(i_test)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = str(input())\n\tk = s[n - 1] + s\n\tcount = 0\n\tkeyc = 0\n\tif '<' in k:\n\t\tkeyc = 1\n\tkeya = 0\n\tif '>' in k:\n\t\tkeya = 1\n\tfor i in range(n):\n\t\tif k[i] == '<' and k[i + 1] == '>' or (k[i] == '>' and k[i + 1] == '<'):\n\t\t\tcount += 1\n\t\telif k[i] == '>' and k[i + 1] == '>':\n\t\t\tif keyc == 1:\n\t\t\t\tcount += 1\n\t\telif k[i] == '<' and k[i + 1] == '<':\n\t\t\tif keya == 1:\n\t\t\t\tcount += 1\n\t\telse:\n\t\t\tpass\n\tprint(n - count)\n", "import sys\ninput = sys.stdin.readline\n\ndef solve():\n\tn = int(input())\n\tdr = input().strip()\n\tif '>' not in dr or '<' not in dr:\n\t\treturn n\n\tcnt = 0\n\tfor i in range(n):\n\t\tif dr[i] == '-' or dr[(i - 1) % n] == '-':\n\t\t\tcnt += 1\n\treturn cnt\nfor _ in range(int(input())):\n\tprint(solve())\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tss = list(set(s))\n\tl = len(ss)\n\tif l == 1:\n\t\tprint(n)\n\telif l == 2:\n\t\tif ss[0] == '-' or ss[1] == '-':\n\t\t\tprint(n)\n\t\telse:\n\t\t\tprint(0)\n\telse:\n\t\tx = set()\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tx.add((i + 1) % n)\n\t\t\t\tx.add(i)\n\t\tprint(len(x))\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif len(set(s)) == 1 or (len(set(s)) == 2 and '-' in set(s)):\n\t\tprint(n)\n\telse:\n\t\tcount = 0\n\t\tfor i in range(n):\n\t\t\tif s[i % n] == '-' or s[(n - 1 + i) % n] == '-':\n\t\t\t\tcount += 1\n\t\tprint(count)\n", "import sys, io, os\nBUFSIZE = 8192\n\nclass FastIO(io.IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = io.BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(io.IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n\ndef print(*args, **kwargs):\n\t(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))\n\tat_start = True\n\tfor x in args:\n\t\tif not at_start:\n\t\t\tfile.write(sep)\n\t\tfile.write(str(x))\n\t\tat_start = False\n\tfile.write(kwargs.pop('end', '\\n'))\n\tif kwargs.pop('flush', False):\n\t\tfile.flush()\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nT = int(input())\nfor _ in range(T):\n\tN = int(input())\n\tS = input()\n\tcnt_l = 0\n\tcnt_r = 0\n\ttr = 0\n\tc_old = S[-1]\n\tfor c in S:\n\t\tif c == '<':\n\t\t\tcnt_l += 1\n\t\t\tif c_old != '-':\n\t\t\t\ttr += 1\n\t\telif c == '>':\n\t\t\tcnt_r += 1\n\t\t\tif c_old != '-':\n\t\t\t\ttr += 1\n\t\tc_old = c\n\tif cnt_l == 0 or cnt_r == 0:\n\t\tprint(N)\n\t\tcontinue\n\tprint(N - tr)\n", "def types(s, n):\n\tdict = {'>': False, '-': False, '<': False}\n\tfor i in range(n):\n\t\tif s[i] in dict:\n\t\t\tdict[s[i]] = True\n\tif dict['>'] == True and dict['<'] == True:\n\t\treturn False\n\telse:\n\t\treturn True\nfor _ in range(int(input())):\n\tn = int(input())\n\ts = [ch for ch in input()]\n\tif types(s, n) == True:\n\t\tprint(n)\n\telse:\n\t\tcount = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tcount += 1\n\t\tprint(count)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tif s.count('<') * s.count('>') == 0:\n\t\tprint(n)\n\t\tcontinue\n\to = s.index('>')\n\ts = s[o:] + s[:o]\n\tcur = 0\n\tres = 0\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tcur += 1\n\t\telif cur > 0:\n\t\t\tres += cur + 1\n\t\t\tcur = 0\n\tif cur > 0:\n\t\tcur += 1\n\tprint(res + cur)\n", "for t in [0] * int(input()):\n\tn = int(input())\n\tst = list(input())\n\tb = 0\n\tm = 0\n\tr = 0\n\tpo = 0\n\tpr = st[-1]\n\tfor i in st:\n\t\tif i == '<':\n\t\t\tm += 1\n\t\telif i == '>':\n\t\t\tb += 1\n\t\telse:\n\t\t\tif pr == '-':\n\t\t\t\tpo += 1\n\t\t\tr += 1\n\t\tpr = i\n\tif m and b:\n\t\tif r:\n\t\t\tprint(2 * r - po)\n\t\telse:\n\t\t\tprint(0)\n\telif not m:\n\t\tprint(b + r)\n\telse:\n\t\tprint(m + r)\n", "for t in range(int(input())):\n\tn = int(input())\n\tar = [-1 for i in range(n)]\n\ts = input()\n\tm1 = 1\n\tif '>' in s:\n\t\tif '<' in s:\n\t\t\tm1 = 0\n\ts = s[n - 1] + s\n\tfor i in range(n):\n\t\tif s[i] + s[i + 1] == '<>' or s[i] + s[i + 1] == '><':\n\t\t\tar[i] = 0\n\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\tar[i] = 1\n\tfor i in range(n):\n\t\tif ar[i] == -1:\n\t\t\tar[i] = m1\n\tans = sum(ar)\n\tprint(ans)\n", "for i in range(int(input())):\n\tk = input()\n\ts = input()\n\tf = 0\n\tt = 0\n\tn = 0\n\tfor j in range(len(s)):\n\t\tif s[j] == '>':\n\t\t\tt = t + 1\n\t\tif s[j] == '-':\n\t\t\tn = n + 1\n\t\t\tif j + 1 < len(s) and s[j + 1] == '-':\n\t\t\t\tf += 1\n\t\t\telse:\n\t\t\t\tf += 2\n\tif s[0] == '-' and s[-1] == '-':\n\t\tf = f - 1\n\tif t == 0 or t == len(s) or len(s) == t + n:\n\t\tprint(len(s))\n\telse:\n\t\tprint(f)\n", "T = int(input())\nwhile T > 0:\n\tn = int(input())\n\tarr = input()\n\tret = [False] * n\n\tchain = True\n\tprev = -1\n\tfor i in range(n):\n\t\tif arr[i] == '-':\n\t\t\tret[i] = True\n\t\t\tret[(i + 1) % n] = True\n\t\telif arr[i] == '>':\n\t\t\tif prev == 1:\n\t\t\t\tchain = False\n\t\t\telif prev == -1:\n\t\t\t\tprev = 0\n\t\telif prev == 0:\n\t\t\tchain = False\n\t\telif prev == -1:\n\t\t\tprev = 1\n\tif chain is True:\n\t\tprint(n)\n\telse:\n\t\tres = ret.count(True)\n\t\tprint(res)\n\tT -= 1\n", "for _ in range(int(input())):\n\tn = int(input())\n\tx = list(input())\n\tcl = '<'\n\tacl = '>'\n\tbi = '-'\n\tcl = x.count(cl)\n\tacl = x.count(acl)\n\tbi = x.count(bi)\n\tif cl == 0 or acl == 0:\n\t\tprint(n)\n\telif bi == 0:\n\t\tprint(0)\n\telse:\n\t\ti = 0\n\t\ts = set()\n\t\twhile i < n:\n\t\t\tif x[i] == '-':\n\t\t\t\ts.add(i)\n\t\t\t\ts.add((i + 1) % n)\n\t\t\ti += 1\n\t\tprint(len(s))\n", "ncases = int(input())\nfor tcase in range(ncases):\n\tn = int(input())\n\tdirs = [s for s in input()]\n\tfull_circle = True\n\tright = False\n\tleft = False\n\tfor c in dirs:\n\t\tif c == '>':\n\t\t\tright = True\n\t\t\tif left:\n\t\t\t\tfull_circle = False\n\t\t\t\tbreak\n\t\telif c == '<':\n\t\t\tleft = True\n\t\t\tif right:\n\t\t\t\tfull_circle = False\n\t\t\t\tbreak\n\tif full_circle:\n\t\tprint(n)\n\t\tcontinue\n\tcount = 0\n\tfor i in range(len(dirs)):\n\t\tif dirs[i - 1] == '-' or dirs[i] == '-':\n\t\t\tcount += 1\n\tprint(count)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tS = input()\n\tX = [False for _ in range(n)]\n\tclo = 0\n\tanti = 0\n\tfor i in range(n):\n\t\tif S[i] == '>':\n\t\t\tclo += 1\n\t\telif S[i] == '<':\n\t\t\tanti += 1\n\t\telse:\n\t\t\tX[i] = True\n\t\t\tX[(i + 1) % n] = True\n\tif anti == 0 or clo == 0:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif X[i] == True:\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "for i in range(int(input())):\n\tn = int(input())\n\ts = input()\n\ta = 0\n\tif '>' not in s or '<' not in s:\n\t\tprint(n)\n\telse:\n\t\tfor i in range(n):\n\t\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\t\ta += 1\n\t\tprint(a)\n", "def seq(l):\n\tk = 0\n\ti = 0\n\tl = 2 * l\n\twhile i < len(l):\n\t\tb = False\n\t\twhile l[i] == '-':\n\t\t\ti += 1\n\t\t\tb = True\n\t\t\tif i > len(l) - 1:\n\t\t\t\tbreak\n\t\tif b:\n\t\t\tk += 1\n\t\ti += 1\n\treturn (k, l)\nimport math\nn = int(input())\nfor _ in range(n):\n\tw = input()\n\tl = list(input())\n\tif l.count('<') == 0 or l.count('>') == 0:\n\t\tprint(len(l))\n\telse:\n\t\t(k, l) = seq(l)\n\t\tx = l.count('-')\n\t\tprint((x + 1 * k) // 2)\n", "import sys\nreadline = sys.stdin.readline\nT = int(readline())\nAns = [None] * T\nfor qu in range(T):\n\tN = int(readline())\n\tS = [1 if s == '>' else -1 if s == '<' else 0 for s in readline().strip()]\n\tif 1 not in S or -1 not in S:\n\t\tAns[qu] = N\n\t\tcontinue\n\tans = [0] * N\n\tfor i in range(N):\n\t\tif not S[i]:\n\t\t\tans[i] = 1\n\t\t\tans[i - 1] = 1\n\tAns[qu] = sum(ans)\nprint('\\n'.join(map(str, Ans)))\n", "for u in range(int(input())):\n\tn = int(input())\n\ts = input()\n\t(x, y, z) = (s.count('>'), s.count('<'), s.count('-'))\n\tif x + z == n:\n\t\tprint(n)\n\telif y + z == n:\n\t\tprint(n)\n\telse:\n\t\tl = set()\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-':\n\t\t\t\tl.add(i % n)\n\t\t\t\tl.add((i + 1) % n)\n\t\tprint(len(l))\n", "for i in range(int(input())):\n\tnums = int(input())\n\tarr = input()\n\ta = 0\n\tb = 0\n\tc = 0\n\tfor k in range(nums):\n\t\tif arr[k] == '<':\n\t\t\ta += 1\n\t\telif arr[k] == '>':\n\t\t\tb += 1\n\tif a == 0 or b == 0:\n\t\tprint(nums)\n\telse:\n\t\tfor j in range(nums):\n\t\t\tif arr[j] == '-' or arr[(j + nums - 1) % nums] == '-':\n\t\t\t\tc += 1\n\t\tprint(c)\n", "for _ in range(int(input())):\n\tn = int(input())\n\tx = list(input().strip(''))\n\tone = True\n\ttwo = True\n\tfor i in range(n):\n\t\tif x[i] == '>':\n\t\t\tone = False\n\t\tif x[i] == '<':\n\t\t\ttwo = False\n\tif one or two:\n\t\tprint(n)\n\telse:\n\t\tmove = [0] * n\n\t\tcount = 0\n\t\tfor i in range(n):\n\t\t\tif x[i] == '-':\n\t\t\t\tmove[i] = 1\n\t\t\t\tmove[(i + 1) % n] = 1\n\t\tfor i in move:\n\t\t\tif i == 1:\n\t\t\t\tcount += 1\n\t\tprint(count)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ta = input()\n\tk = 0\n\ts = set(a)\n\tif len(s) == 1 or (len(s) == 2 and '-' in s):\n\t\tprint(len(a))\n\t\tcontinue\n\tfor i in range(len(a)):\n\t\tif a[i - 1] == '-' or a[i] == '-':\n\t\t\tk += 1\n\tprint(k)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ta = input()\n\tc = 0\n\tleft = a.count('<')\n\tright = a.count('>')\n\tif left == 0 and right != 0:\n\t\tprint(n)\n\telif left != 0 and right == 0:\n\t\tprint(n)\n\telif left == 0 and right == 0:\n\t\tprint(n)\n\telse:\n\t\td = [0] * n\n\t\tfor i in range(n):\n\t\t\tif a[i] == '-':\n\t\t\t\td[i] = 1\n\t\t\t\td[(i + 1) % n] = 1\n\t\tprint(d.count(1))\n", "t = int(input())\n\ndef Find(x, par):\n\tif par[x] < 0:\n\t\treturn x\n\telse:\n\t\tpar[x] = Find(par[x], par)\n\t\treturn par[x]\n\ndef Unite(x, y, par, rank):\n\tx = Find(x, par)\n\ty = Find(y, par)\n\tif x != y:\n\t\tif rank[x] < rank[y]:\n\t\t\tpar[y] += par[x]\n\t\t\tpar[x] = y\n\t\telse:\n\t\t\tpar[x] += par[y]\n\t\t\tpar[y] = x\n\t\t\tif rank[x] == rank[y]:\n\t\t\t\trank[x] += 1\n\ndef Same(x, y, par):\n\treturn Find(x, par) == Find(y, par)\n\ndef Size(x, par):\n\treturn -par[Find(x, par)]\nfor _ in range(t):\n\tn = int(input())\n\ts = str(input())\n\tS = set(list(s))\n\tif '>' not in S or '<' not in S:\n\t\tprint(n)\n\t\tcontinue\n\tpar = [-1] * n\n\trank = [0] * n\n\tfor i in range(n):\n\t\tif i != n - 1:\n\t\t\tif s[i] == '-':\n\t\t\t\tUnite(i, i + 1, par, rank)\n\t\telif s[i] == '-':\n\t\t\tUnite(i, 0, par, rank)\n\tans = 0\n\tfor i in range(n):\n\t\tif par[i] < -1 or par[i] >= 0:\n\t\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tcl = 0\n\tacl = 0\n\toff = 0\n\tfor j in s:\n\t\tif j == '>':\n\t\t\tcl += 1\n\t\telif j == '<':\n\t\t\tacl += 1\n\t\telse:\n\t\t\toff += 1\n\tans = 0\n\tif cl == 0 or acl == 0:\n\t\tprint(n)\n\telse:\n\t\tfor j in range(n):\n\t\t\tif j == 0:\n\t\t\t\tif s[0] == '-' or s[-1] == '-':\n\t\t\t\t\tans += 1\n\t\t\telif s[j % n] == '-' or s[(j - 1) % n] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "def function(param):\n\tn = len(param)\n\tchara = '-'\n\tfor index in range(len(param)):\n\t\tif param[index] != '-' and param[index] != chara:\n\t\t\tif chara == '-':\n\t\t\t\tchara = param[index]\n\t\t\telse:\n\t\t\t\tchara = ' '\n\tif chara != ' ':\n\t\treturn n\n\tsumm = 0\n\tfor index in range(len(param)):\n\t\tif param[index] == '-' or param[(index + 1) % n] == '-':\n\t\t\tsumm = summ + 1\n\treturn summ\ntotal = int(input())\nfor index in range(2 * total):\n\tline = input()\n\tif index % 2 == 0:\n\t\tpass\n\telse:\n\t\tresult = function(line)\n\t\tprint(result)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = input()\n\tcycle1 = True\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i] == '<':\n\t\t\tcontinue\n\t\telse:\n\t\t\tcycle1 = False\n\t\t\tbreak\n\tcycle2 = True\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[i] == '>':\n\t\t\tcontinue\n\t\telse:\n\t\t\tcycle2 = False\n\t\t\tbreak\n\tcycle = cycle1 or cycle2\n\tif cycle:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i % n] == '-' or s[(i + 1) % n] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "a = int(input())\nfor i in range(0, a):\n\tn = int(input())\n\ts = input()\n\tarr = []\n\tfor i in s:\n\t\tif i == '-':\n\t\t\tarr.append(0)\n\t\telif i == '<':\n\t\t\tarr.append(-1)\n\t\telse:\n\t\t\tarr.append(1)\n\ts = set(arr)\n\tif n == 2:\n\t\tif 0 not in s and len(s) == 2:\n\t\t\tprint(0)\n\t\telse:\n\t\t\tprint(2)\n\telif len(s) == 1:\n\t\tprint(n)\n\telif 0 in s and len(s) == 2:\n\t\tprint(n)\n\telif len(s) == 2 and 0 not in s:\n\t\tprint(0)\n\telse:\n\t\tcount = 0\n\t\tfor i in range(1, len(arr)):\n\t\t\tif arr[i - 1] == 0 or arr[i] == 0:\n\t\t\t\tcount = count + 1\n\t\tif arr[len(arr) - 1] == 0 or arr[0] == 0:\n\t\t\tcount = count + 1\n\t\tprint(count)\n", "T = int(input())\nfor __ in range(T):\n\tn = int(input())\n\ts = input()\n\tok = all((c in '-<' for c in s)) or all((c in '->' for c in s))\n\tcnt = 0\n\tfor i in range(n):\n\t\tj = (i + 1) % n\n\t\t(c1, c2) = (s[i], s[j])\n\t\tif c1 == '-' or c2 == '-':\n\t\t\tcnt += 1\n\t\telse:\n\t\t\tcnt += 1 if ok else 0\n\tprint(cnt)\n", "import os\nimport math\nimport statistics\ntrue = True\nfalse = False\nfrom functools import reduce\nis_dev = 'vscode' in os.environ\nif is_dev:\n\tinF = open('in.txt', 'r')\n\toutF = open('out.txt', 'w')\n\ndef ins():\n\treturn list(map(int, input_().split(' ')))\n\ndef inss():\n\treturn list(input_().split(' '))\n\ndef input_():\n\tif is_dev:\n\t\treturn inF.readline()[:-1]\n\telse:\n\t\treturn input()\n\ndef ranin():\n\treturn range(int(input_()))\n\ndef print_(data):\n\tif is_dev:\n\t\toutF.write(str(data) + '\\n')\n\telse:\n\t\tprint(data)\nepsilon = 1e-07\n\ndef prev_i(ii):\n\treturn (ii - 1) % n\n\ndef next_i(ii):\n\treturn (ii + 1) % n\nfor _ in ranin():\n\tn = int(input_())\n\ta = input_()\n\tis_cycle = all((aa == '>' or aa == '-' for aa in a)) or all((aa == '<' or aa == '-' for aa in a))\n\tif is_cycle:\n\t\tprint_(n)\n\t\tcontinue\n\tcan_flow = 0\n\tfor i in range(n):\n\t\tif a[i] == '-' or a[next_i(i)] == '-':\n\t\t\tcan_flow += 1\n\tprint_(can_flow)\nif is_dev:\n\toutF.close()\n\n\tdef compare_file():\n\t\tprint(open('out.txt', 'r').read() == open('outactual.txt', 'r').read())\n\tcompare_file()\n", "from sys import stdin\nimport sys\ntt = int(stdin.readline())\nfor loop in range(tt):\n\tn = int(stdin.readline())\n\ts = stdin.readline()[:-1]\n\tif '<' not in s or '>' not in s:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tif s[(i - 1) % n] == '-' or s[i] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tl = 0\n\tr = 0\n\tk = 0\n\tfor j in range(n):\n\t\tif s[j] == '>':\n\t\t\tr += 1\n\t\telif s[j] == '<':\n\t\t\tl += 1\n\t\tif s[j] == '-' or s[j - 1] == '-':\n\t\t\tk += 1\n\tif min(l, r) == 0:\n\t\tprint(n)\n\telif k != 0:\n\t\tprint(min(n, k))\n\telse:\n\t\tprint(0)\n", "import sys\nfor i in range(0, int(sys.stdin.readline())):\n\tl = sys.stdin.readline()\n\ts = list(sys.stdin.readline())\n\ts = s[0:len(s) - 1]\n\trr = 0\n\tpc = s[len(s) - 1]\n\tfor c in s:\n\t\tif c == '-':\n\t\t\tif pc != '-':\n\t\t\t\trr += 1\n\t\t\trr += 1\n\t\tpc = c\n\tif not '>' in s or not '<' in s:\n\t\trr = len(s)\n\tsys.stdout.write(str(rr))\n\tsys.stdout.write('\\n')\n", "def solve():\n\tN = int(input())\n\tA = input()\n\tif all((a == '>' or a == '-' for a in A)):\n\t\treturn N\n\tif all((a == '<' or a == '-' for a in A)):\n\t\treturn N\n\tcnt = 0\n\tfor i in range(N):\n\t\tif A[i] == '-' or A[i - 1] == '-':\n\t\t\tcnt += 1\n\treturn cnt\nTC = int(input())\nfor _ in range(TC):\n\tprint(solve())\n", "T = int(input())\nfor _ in range(T):\n\tn = int(input())\n\ts = input()\n\tif s.count('-') == 0 and (s.count('>') == n or s.count('<') == n):\n\t\tprint(n)\n\telif s.count('>') == 0 or s.count('<') == 0:\n\t\tprint(n)\n\telif s.count('-') == 0:\n\t\tprint(0)\n\telse:\n\t\ti = 0\n\t\tcnt = 0\n\t\twhile i < n:\n\t\t\tnex = (i + 1) % n\n\t\t\tif s[i] == '-' or s[nex] == '-':\n\t\t\t\tcnt += 1\n\t\t\ti += 1\n\t\tprint(cnt)\n", "import sys\nfrom functools import lru_cache, cmp_to_key\nfrom heapq import merge, heapify, heappop, heappush, nsmallest\nfrom math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log\nfrom collections import defaultdict as dd, deque, Counter as C\nfrom itertools import combinations as comb, permutations as perm\nfrom bisect import bisect_left as bl, bisect_right as br, bisect\nfrom time import perf_counter\nfrom fractions import Fraction\nfrom decimal import Decimal\nmod = pow(10, 9) + 7\nmod2 = 998244353\n\ndef data():\n\treturn sys.stdin.readline().strip()\n\ndef out(var):\n\tsys.stdout.write(str(var) + '\\n')\n\ndef outa(*var, end='\\n'):\n\tsys.stdout.write(' '.join(map(str, var)) + end)\n\ndef l():\n\treturn list(sp())\n\ndef sl():\n\treturn list(ssp())\n\ndef sp():\n\treturn map(int, data().split())\n\ndef ssp():\n\treturn map(str, data().split())\n\ndef l1d(n, val=0):\n\treturn [val for i in range(n)]\n\ndef l2d(n, m, val=0):\n\treturn [l1d(n, val) for j in range(m)]\nfor _ in range(int(data())):\n\tn = int(data())\n\ts = list(data())\n\tif '>' not in s or '<' not in s:\n\t\tout(n)\n\t\tcontinue\n\ttemp = set()\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\ttemp.add(i)\n\t\t\ttemp.add((i + 1) % n)\n\tout(len(temp))\n", "import os, sys\nfrom collections import defaultdict, Counter\nfrom io import BytesIO, IOBase\n\ndef main():\n\tfor i in range(int(input())):\n\t\tn = int(input())\n\t\ts = input().strip()\n\t\tz = Counter(s)\n\t\tif z['<'] == 0 or z['>'] == 0:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tan = 0\n\t\t\tfor j in range(1, n):\n\t\t\t\tif s[j] == '-':\n\t\t\t\t\tif s[j - 1] == '-':\n\t\t\t\t\t\tan += 1\n\t\t\t\t\telse:\n\t\t\t\t\t\tan += 2\n\t\t\tif s[0] == s[-1] == '-':\n\t\t\t\tan += 1\n\t\t\telif s[0] == '-':\n\t\t\t\tan += 2\n\t\t\tprint(an)\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\nmain()\n", "import itertools\nimport math\nimport sys\nfrom collections import defaultdict\n\ndef stdinWrapper():\n\tdata = '4\\n4\\n-><-\\n5\\n>>>>>\\n3\\n<--\\n2\\n<>\\n\\n'\n\tfor line in data.split('\\n'):\n\t\tyield line\nif '--debug' not in sys.argv:\n\n\tdef stdinWrapper():\n\t\twhile True:\n\t\t\tyield sys.stdin.readline()\ninputs = stdinWrapper()\n\ndef inputWrapper():\n\treturn next(inputs)\n\ndef getType(_type):\n\treturn _type(inputWrapper())\n\ndef getArray(_type):\n\treturn [_type(x) for x in inputWrapper().split()]\n\ndef tuplerize(method):\n\n\tdef wrap(*args, **kwargs):\n\t\tres = method(*args, **kwargs)\n\t\tif not isinstance(res, (tuple, list)):\n\t\t\tres = (res,)\n\t\treturn res\n\treturn wrap\n\n@tuplerize\ndef solve(r):\n\tright = 0\n\tleft = 0\n\tneutral = 0\n\tfor x in r:\n\t\tif x == '>':\n\t\t\tright += 1\n\t\telif x == '<':\n\t\t\tleft += 1\n\t\telse:\n\t\t\tneutral += 1\n\tif right != 0 and left == 0 or (left != 0 and right == 0):\n\t\treturn len(r)\n\tstucks = 0\n\tfor i in range(-1, len(r) - 1):\n\t\tif r[i] in '<>' and r[i + 1] in '<>':\n\t\t\tstucks += 1\n\treturn len(r) - stucks\nt = getType(int)\nfor _ in range(t):\n\tn = getType(int)\n\tif '--debug' not in sys.argv:\n\t\tr = input()\n\telse:\n\t\tr = getType(str)\n\tres = solve(r)\n\tprint(*res)\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tseq = input()\n\tif seq == '<' * n or seq == '>' * n or seq == '-' * n:\n\t\tprint(n)\n\telse:\n\t\tR = [0] * n\n\t\tleft = False\n\t\tright = False\n\t\tboth = False\n\t\tfor i in range(n):\n\t\t\tif seq[i] == '>':\n\t\t\t\tright = True\n\t\t\tif seq[i] == '<':\n\t\t\t\tleft = True\n\t\t\tif seq[i] == '-':\n\t\t\t\tboth = True\n\t\t\t\tR[i] = 1\n\t\t\t\tR[(i + 1) % n] = 1\n\t\tif not right or not left:\n\t\t\tprint(n)\n\t\telse:\n\t\t\tprint(sum(R))\n", "import itertools\n\ndef lmi():\n\treturn list(map(int, input().split()))\n\ndef rle(iterable):\n\tfor (k, v) in itertools.groupby(iterable):\n\t\tyield (k, len(list(v)))\n\ndef main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tn = int(input())\n\t\ts = input()\n\t\tresult = solve(n, s)\n\t\tprint(result)\n\ndef solve(N: int, S: str) -> int:\n\tif S.count('>') == 0 or S.count('<') == 0:\n\t\treturn N\n\tans = 0\n\tfor (k, v) in rle(S):\n\t\tif k == '-':\n\t\t\tans += v + 1\n\tif S[0] == S[-1] == '-':\n\t\tans -= 1\n\treturn ans\nmain()\n", "import sys, io, os, time\nfrom collections import defaultdict\nfrom collections import Counter\nfrom collections import deque\nfrom itertools import combinations\nfrom itertools import permutations\nimport bisect, math, heapq\nalphabet = 'abcdefghijklmnopqrstuvwxyz'\nfor ii in range(int(input())):\n\tn = int(input())\n\ts = input()\n\tg = defaultdict(list)\n\tone = True\n\ttwo = True\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tone = False\n\t\tif s[i] == '<':\n\t\t\ttwo = False\n\tif one or two:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "n = int(input())\nfor _ in range(n):\n\tlength = int(input())\n\tbelts = input()\n\tleft = right = False\n\tcnt = 0\n\tfor i in range(length):\n\t\tc = belts[i]\n\t\tif c == '<':\n\t\t\tleft = True\n\t\telif c == '>':\n\t\t\tright = True\n\t\telif i == length - 1:\n\t\t\tif belts[0] == '-':\n\t\t\t\tcnt += 1\n\t\t\telse:\n\t\t\t\tcnt += 2\n\t\telif belts[i + 1] == '-':\n\t\t\tcnt += 1\n\t\telse:\n\t\t\tcnt += 2\n\tif left and right:\n\t\tprint(cnt)\n\telse:\n\t\tprint(length)\n", "from collections import defaultdict\ncases = int(input())\nfor _ in range(cases):\n\tn = int(input())\n\tbelt = input()\n\tsi = 0\n\tcircle = False\n\twhile belt[si] != '<':\n\t\tsi = (si + 1) % n\n\t\tif si == 0:\n\t\t\tprint(n)\n\t\t\tcircle = True\n\t\t\tbreak\n\tif circle:\n\t\tcontinue\n\tsi = n - 1\n\twhile belt[si] != '>':\n\t\tsi = (si + n - 1) % n\n\t\tif si == n - 1:\n\t\t\tprint(n)\n\t\t\tcircle = True\n\t\t\tbreak\n\tif circle:\n\t\tcontinue\n\tgood = set()\n\tfor i in range(n):\n\t\tif belt[i] == '-':\n\t\t\tgood.add(i)\n\t\t\tgood.add((i + 1) % n)\n\tprint(len(good))\n", "t = int(input())\nfor _ in range(t):\n\tn = int(input())\n\tdirs = input()\n\thaveCW = False\n\thaveCCW = False\n\tfor dir in dirs:\n\t\tif dir == '>':\n\t\t\thaveCW = True\n\t\tif dir == '<':\n\t\t\thaveCCW = True\n\t\tif haveCW and haveCCW:\n\t\t\tbreak\n\tif haveCW and haveCCW:\n\t\tans = 0\n\t\tdirs += dirs[0]\n\t\tfor i in range(n):\n\t\t\tif dirs[i] == '-' or dirs[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\t(x, y, z) = (0, 0, 0)\n\tfor c in s:\n\t\tif c == '-':\n\t\t\tx += 1\n\t\telif c == '<':\n\t\t\ty += 1\n\t\telif c == '>':\n\t\t\tz += 1\n\tif y == 0 or z == 0:\n\t\tprint(n)\n\t\tcontinue\n\tans = 0\n\tfor i in range(n):\n\t\tif s[i] == '-' or s[(i + 1) % n] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "import sys\nsys.setrecursionlimit(100000)\nimport math\nfrom collections import Counter, defaultdict, deque\n\ndef canCompleteClk(p):\n\tfor node in range(len(p) - 1, 0, -1):\n\t\tif p[node - 1] == '<' or p[node - 1] == '-':\n\t\t\tcontinue\n\t\telse:\n\t\t\treturn False\n\treturn p[-1] == '<' or p[-1] == '-'\n\ndef canCompleteAclk(p):\n\tfor node in range(len(p) - 1, 0, -1):\n\t\tif p[node - 1] == '>' or p[node - 1] == '-':\n\t\t\tcontinue\n\t\telse:\n\t\t\treturn False\n\treturn p[-1] == '>' or p[-1] == '-'\n\ndef f(n, p):\n\tnr = 0\n\tnode = 0\n\tclk = canCompleteClk(p)\n\taclk = canCompleteAclk(p)\n\twhile node < n:\n\t\tif p[node] == '-':\n\t\t\tpass\n\t\telif p[node] == '>' and p[node - 1] == '<' or (p[node] == '<' and p[node - 1] == '>'):\n\t\t\tnr += 1\n\t\telif (p[node] == '<' and p[node - 1] == '<') and (not clk):\n\t\t\tnr += 1\n\t\telif (p[node] == '>' and p[node - 1] == '>') and (not aclk):\n\t\t\tnr += 1\n\t\tnode += 1\n\treturn n - nr\nt = int(input())\nresult = []\nfor i in range(t):\n\tn = int(input())\n\tp = input()\n\tresult.append(f(n, p))\nfor i in range(t):\n\tprint(result[i])\n", "T = int(input())\n\ndef short(n, s):\n\t(cc, ac) = (False, False)\n\t(Count, H) = (0, {})\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tcc = True\n\t\tif s[i] == '<':\n\t\t\tac = True\n\t\tif s[i] == '-':\n\t\t\tif not i in H:\n\t\t\t\tCount += 1\n\t\t\t\tH[i] = True\n\t\t\tif not (i + 1) % n in H:\n\t\t\t\tCount += 1\n\t\t\t\tH[(i + 1) % n] = True\n\tif cc == False or ac == False:\n\t\treturn n\n\treturn Count\nfor i in range(T):\n\tn = int(input())\n\ts = input()\n\tprint(short(n, s))\n", "import sys\nfrom math import gcd, sqrt, ceil, log2\nfrom collections import defaultdict, Counter, deque\nfrom bisect import bisect_left, bisect_right\nimport math\nfrom itertools import permutations\nimport os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\n\nclass FastIO(IOBase):\n\tnewlines = 0\n\n\tdef __init__(self, file):\n\t\tself._fd = file.fileno()\n\t\tself.buffer = BytesIO()\n\t\tself.writable = 'x' in file.mode or 'r' not in file.mode\n\t\tself.write = self.buffer.write if self.writable else None\n\n\tdef read(self):\n\t\twhile True:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tif not b:\n\t\t\t\tbreak\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines = 0\n\t\treturn self.buffer.read()\n\n\tdef readline(self):\n\t\twhile self.newlines == 0:\n\t\t\tb = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))\n\t\t\tself.newlines = b.count(b'\\n') + (not b)\n\t\t\tptr = self.buffer.tell()\n\t\t\t(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))\n\t\tself.newlines -= 1\n\t\treturn self.buffer.readline()\n\n\tdef flush(self):\n\t\tif self.writable:\n\t\t\tos.write(self._fd, self.buffer.getvalue())\n\t\t\t(self.buffer.truncate(0), self.buffer.seek(0))\n\nclass IOWrapper(IOBase):\n\n\tdef __init__(self, file):\n\t\tself.buffer = FastIO(file)\n\t\tself.flush = self.buffer.flush\n\t\tself.writable = self.buffer.writable\n\t\tself.write = lambda s: self.buffer.write(s.encode('ascii'))\n\t\tself.read = lambda : self.buffer.read().decode('ascii')\n\t\tself.readline = lambda : self.buffer.readline().decode('ascii')\n(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))\ninput = lambda : sys.stdin.readline().rstrip('\\r\\n')\n\ndef get_sum(bit, i):\n\ts = 0\n\ti += 1\n\twhile i > 0:\n\t\ts += bit[i]\n\t\ti -= i & -i\n\treturn s\n\ndef update(bit, n, i, v):\n\ti += 1\n\twhile i <= n:\n\t\tbit[i] += v\n\t\ti += i & -i\n\ndef modInverse(b, m):\n\tg = math.gcd(b, m)\n\tif g != 1:\n\t\treturn -1\n\telse:\n\t\treturn pow(b, m - 2, m)\n\ndef primeFactors(n):\n\tsa = set()\n\tsa.add(n)\n\twhile n % 2 == 0:\n\t\tsa.add(2)\n\t\tn = n // 2\n\tfor i in range(3, int(math.sqrt(n)) + 1, 2):\n\t\twhile n % i == 0:\n\t\t\tsa.add(i)\n\t\t\tn = n // i\n\treturn sa\n\ndef seive(n):\n\tpri = [True] * (n + 1)\n\tp = 2\n\twhile p * p <= n:\n\t\tif pri[p] == True:\n\t\t\tfor i in range(p * p, n + 1, p):\n\t\t\t\tpri[i] = False\n\t\tp += 1\n\treturn pri\n\ndef check_prim(n):\n\tif n < 0:\n\t\treturn False\n\tfor i in range(2, int(sqrt(n)) + 1):\n\t\tif n % i == 0:\n\t\t\treturn False\n\treturn True\n\ndef debug(l, r):\n\tmaxi = -1\n\tans = -1\n\tfor i in range(l, r + 1):\n\t\tz = bin(i).count('1')\n\t\tif z > maxi:\n\t\t\tmaxi = z\n\t\t\tans = i\n\treturn ans\nt = int(input())\nfor _ in range(t):\n\tn = int(input())\n\ts = list(input())\n\tflag = 0\n\tcnt1 = s.count('>')\n\tcnt2 = s.count('-')\n\tcnt3 = s.count('<')\n\tif cnt1 + cnt2 == n or cnt2 + cnt3 == n:\n\t\tprint(n)\n\telse:\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i - 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n", "def main():\n\tt = int(input())\n\tfor _ in range(t):\n\t\tn = int(input())\n\t\ts = input()\n\t\tif '>' not in s or '<' not in s:\n\t\t\tprint(n)\n\t\t\tcontinue\n\t\ttotal = 0\n\t\tfor i in range(n):\n\t\t\tif s[i - 1] == '-' or s[i] == '-':\n\t\t\t\ttotal += 1\n\t\tprint(total)\nmain()\n", "def connected_rooms(n: int, dirs: str):\n\tamount_right = 0\n\tamount_left = 0\n\tres = 0\n\tfor i in range(n):\n\t\tif dirs[i] == '-' or dirs[i - 1] == '-':\n\t\t\tres += 1\n\t\tif dirs[i] == '>':\n\t\t\tamount_right += 1\n\t\telif dirs[i] == '<':\n\t\t\tamount_left += 1\n\tif amount_left == 0 or amount_right == 0:\n\t\treturn n\n\telse:\n\t\treturn res\nt = int(input())\nfor i in range(t):\n\tn = int(input())\n\tdirs = input()\n\tprint(connected_rooms(n, dirs))\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\td = list(input())\n\tb = 0\n\tm = 0\n\tr = 0\n\tg = 0\n\tprev = d[-1]\n\tfor i in d:\n\t\tif i == '>':\n\t\t\tb += 1\n\t\telif i == '<':\n\t\t\tm += 1\n\t\telse:\n\t\t\tif prev == '-':\n\t\t\t\tg += 1\n\t\t\tr += 1\n\t\tprev = i\n\tif b and m:\n\t\tif r:\n\t\t\tprint(2 * r - g)\n\t\telse:\n\t\t\tprint(0)\n\telif not m:\n\t\tprint(b + r)\n\telse:\n\t\tprint(m + r)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ts = input()\n\t_l = False\n\t_r = False\n\tfor i in s:\n\t\tif i == '<':\n\t\t\t_l = True\n\t\tif i == '>':\n\t\t\t_r = True\n\tans = 0\n\tif _l and _r:\n\t\tfor (l, r) in zip(s, s[1:] + s):\n\t\t\tif l == '-' or r == '-':\n\t\t\t\tans += 1\n\t\t\t\tcontinue\n\telse:\n\t\tans = n\n\tprint(ans)\n", "t = int(input())\nfor you in range(t):\n\tn = int(input())\n\ts = input()\n\tposs = 1\n\tfor i in range(n):\n\t\tif s[i] == '>':\n\t\t\tposs = 0\n\t\t\tbreak\n\tif poss:\n\t\tprint(n)\n\t\tcontinue\n\tposs = 1\n\tfor i in range(n):\n\t\tif s[i] == '<':\n\t\t\tposs = 0\n\t\t\tbreak\n\tif poss:\n\t\tprint(n)\n\t\tcontinue\n\tans = [0 for i in range(n)]\n\tfor i in range(n):\n\t\tif s[i] == '-':\n\t\t\tans[(i + 1) % n] = 1\n\t\t\tans[i % n] = 1\n\tprint(sum(ans))\n", "tc = int(input())\nfor i in range(tc):\n\tn = int(input())\n\ts = input()\n\tans = 0\n\tif s.count('-') + max(s.count('<'), s.count('>')) == n:\n\t\tprint(n)\n\t\tcontinue\n\tfor i in range(len(s)):\n\t\tif s[i] == '-' and s[(i - 1) % n] != '-':\n\t\t\tans += 2\n\t\telif s[i] == '-':\n\t\t\tans += 1\n\tprint(ans)\n", "from collections import deque\nABC = int(input())\nfor j in range(ABC):\n\tn = int(input())\n\ts = input()\n\tvalue_b = False\n\tvalue_a = False\n\tfor c in s:\n\t\tif c == '>':\n\t\t\tvalue_b = True\n\t\tif c == '<':\n\t\t\tvalue_a = True\n\tif value_b and value_a:\n\t\ts += s[0]\n\t\tans = 0\n\t\tfor i in range(n):\n\t\t\tif s[i] == '-' or s[i + 1] == '-':\n\t\t\t\tans += 1\n\t\tprint(ans)\n\telse:\n\t\tprint(n)\n", "for _ in range(int(input())):\n\tn = int(input())\n\ta = input()\n\to = ''\n\tfor i in range(n):\n\t\tif a[i] != '-':\n\t\t\to = a[i]\n\t\t\tbreak\n\tu = 0\n\tif o != '':\n\t\tfor i in range(n):\n\t\t\tif a[i] != '-' and a[i] != o:\n\t\t\t\tu = 1\n\t\t\t\tbreak\n\tif u == 0:\n\t\tprint(n)\n\t\tcontinue\n\tx = 0\n\tfor i in range(n):\n\t\tif a[i] == '-' or a[i - 1] == '-':\n\t\t\tx += 1\n\tprint(x)\n", "t = int(input())\nfor i in range(t):\n\tn = int(input())\n\ts = input()\n\tif s.count('-') == n or s.count('>') == n or s.count('<') == n:\n\t\tprint(n)\n\telif s.count('>') == 0 or s.count('<') == 0:\n\t\tprint(n)\n\telse:\n\t\tsum = 0\n\t\tfor j in range(n):\n\t\t\tif s[j] == '-' and s[(j + 1) % n] == '-':\n\t\t\t\tsum += 1\n\t\t\telif s[j] == '-' and s[(j + 1) % n] != '-':\n\t\t\t\tsum += 2\n\t\tprint(sum)\n"]

difficulty: EASY

source: codeforces

raw_problem:
B. Belted Rooms

time limit per test
1 second

memory limit per test
256 megabytes

input
standard input

output
standard output

In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$$$ and $$$2$$$, $$$\ldots$$$, $$$n-2$$$ and $$$n-1$$$, $$$n-1$$$ and $$$0$$$ are connected with conveyor belts.

The $$$i$$$-th conveyor belt is in one of three states:

 If it is clockwise, snakes can only go from room $$$i$$$ to $$$(i+1) \bmod n$$$.

 If it is anticlockwise, snakes can only go from room $$$(i+1) \bmod n$$$ to $$$i$$$.

 If it is off, snakes can travel in either direction.

Above is an example with $$$4$$$ rooms, where belts $$$0$$$ and $$$3$$$ are off, $$$1$$$ is clockwise, and $$$2$$$ is anticlockwise.

Each snake wants to leave its room and come back to it later. A room is returnable if the snake there can leave the room, and later come back to it using the conveyor belts. How many such returnable rooms are there?

Input

Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows.

 The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms.

 The next line of each test case description contains a string $$$s$$$ of length $$$n$$$, consisting of only '<', '>' and '-'.

 If $$$s_{i} = $$$ '>', the $$$i$$$-th conveyor belt goes clockwise.

 If $$$s_{i} = $$$ '<', the $$$i$$$-th conveyor belt goes anticlockwise.

 If $$$s_{i} = $$$ '-', the $$$i$$$-th conveyor belt is off.

It is guaranteed that the sum of $$$n$$$ among all test cases does not exceed $$$300\,000$$$.

Output

For each test case, output the number of returnable rooms.

Example

Input

4
4
-><-
5
>>>>>
3
<--
2
<>

Output

3
5
3
0

Note

In the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement.

 In the second test case, all rooms are returnable by traveling on the series of clockwise belts.

question:
In the snake exhibition, there are $$$n$$$ rooms (numbered $$$0$$$ to $$$n - 1$$$) arranged in a circle, with a snake in each room. The rooms are connected by $$$n$$$ conveyor belts, and the $$$i$$$-th conveyor belt connects the rooms $$$i$$$ and $$$(i+1) \bmod n$$$. In the other words, rooms $$$0$$$ and $$$1$$$, $$$1$$$ and $$$2$$$, $$$\ldots$$$, $$$n-2$$$ and $$$n-1$$$, $$$n-1$$$ and $$$0$$$ are connected with conveyor belts.
The $$$i$$$-th conveyor belt is in one of three states:
 -  If it is clockwise, snakes can only go from room $$$i$$$ to $$$(i+1) \bmod n$$$. -  If it is anticlockwise, snakes can only go from room $$$(i+1) \bmod n$$$ to $$$i$$$. -  If it is off, snakes can travel in either direction.  ![image](1.png) Above is an example with $$$4$$$ rooms, where belts $$$0$$$ and $$$3$$$ are off, $$$1$$$ is clockwise, and $$$2$$$ is anticlockwise.
Each snake wants to leave its room and come back to it later. A room is returnable if the snake there can leave the room, and later come back to it using the conveyor belts. How many such returnable rooms are there?

Input
Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \le t \le 1000$$$): the number of test cases. The description of the test cases follows.
 The first line of each test case description contains a single integer $$$n$$$ ($$$2 \le n \le 300\,000$$$): the number of rooms.
 The next line of each test case description contains a string $$$s$$$ of length $$$n$$$, consisting of only '<', '>' and '-'.
 -  If $$$s_{i} = $$$ '>', the $$$i$$$-th conveyor belt goes clockwise. -  If $$$s_{i} = $$$ '<', the $$$i$$$-th conveyor belt goes anticlockwise. -  If $$$s_{i} = $$$ '-', the $$$i$$$-th conveyor belt is off. It is guaranteed that the sum of $$$n$$$ among all test cases does not exceed $$$300\,000$$$.

Output
For each test case, output the number of returnable rooms.

Example
Input
4
4
-><-
5
>>>>>
3
<--
2
<>

Output
3
5
3
0

Note
In the first test case, all rooms are returnable except room $$$2$$$. The snake in the room $$$2$$$ is trapped and cannot exit. This test case corresponds to the picture from the problem statement.
 In the second test case, all rooms are returnable by traveling on the series of clockwise belts.

data_split: test