AquaMoon has a string $a$ consisting of only $0$ and $1$. She wants to add $+$ and $-$ between all pairs of consecutive positions to make the absolute value of the resulting expression as small as possible. Can you help her?


-----Input-----

The first line contains a single integer $t$ ($1 \leq t \leq 2000$)  – the number of test cases. The description of test cases follows.

The first line of each test case contains a single integer $n$ ($2 \leq n \leq 100$) — the length of $a$.

The second line of each test case contains a string $a$ of length $n$, consisting of only $0$ and $1$.


-----Output-----

For each test case, output a string of length $n - 1$ consisting of $-$ and $+$ on a separate line. If there is more than one assignment of signs that produces the smallest possible absolute value, any of them is accepted.


-----Examples-----

Input
3
2
11
5
01101
5
10001
Output
-
+-++
+++-


-----Note-----

In the first test case, we can get the expression $1 - 1 = 0$, with absolute value $0$.

In the second test case, we can get the expression $0 + 1 - 1 + 0 + 1 = 1$, with absolute value $1$.

In the third test case, we can get the expression $1 + 0 + 0 + 0 - 1 = 0$, with absolute value $0$.

Difficulty: EASY
Tags: Mathematics

Constructive algorithms

Starter code:

Solutions:
import sys

def fn(s):
	checked = s[0] == '1'
	output = ''
	for char in s[1:]:
		if char == '1':
			if checked:
				output += '-'
				checked = False
			else:
				output += '+'
				checked = True
		else:
			output += '+'
	return output
input = sys.stdin.readlines()
t = int(input[0].strip('\n'))
for i in range(t):
	input_string = input[2 * i + 2].strip('\n')
	print(fn(input_string))


import sys
import math

def input_parse_expression(input_lines, case_num):
	length = int(input_lines[2 * case_num + 1])
	s = input_lines[2 * case_num + 2]
	return (length, s)

def solve(test_case_input):
	(n, s) = test_case_input
	sum = int(s[0])
	ans = ''
	for c in s[1:]:
		if c == '1':
			ans += '-' if sum else '+'
			sum = 1 - sum
		else:
			ans += '+'
	return ans

def main():
	input_str = sys.stdin.read()
	input_lines = input_str.strip().split('\n')
	n_cases = int(input_lines[0])
	for i in range(n_cases):
		test_case_input = input_parse_expression(input_lines, i)
		solution = solve(test_case_input)
		print(solution)
main()


import sys

def solve():
	inp = sys.stdin.readline
	n = int(inp())
	now = 0
	r = []
	for v in inp().strip():
		if v == '1':
			if now == 1:
				r.append('-')
			else:
				r.append('+')
			now ^= 1
		else:
			r.append('+')
	r.pop(0)
	print(''.join(r))

def main():
	for i in range(int(sys.stdin.readline())):
		solve()
main()


def solve(s):
	ans = ''
	flag = False
	for char in s:
		if char == '1':
			if flag == True:
				flag = False
				ans += '-'
			else:
				flag = True
				ans += '+'
		else:
			ans += '+'
	return ans[1:]
t = int(input())
for _ in range(t):
	n = int(input())
	print(solve(input()))


import sys
input = sys.stdin.readline

def readList():
	return list(map(int, input().split()))

def readInt():
	return int(input())

def readInts():
	return map(int, input().split())

def readStr():
	return input().strip()

def solve():
	n = readInt()
	a = readStr()
	curr = int(a[0])
	ans = []
	for i in range(1, n):
		if a[i] == '0':
			ans.append('+')
		elif curr:
			ans.append('-')
			curr = 0
		else:
			ans.append('+')
			curr += 1
	return ''.join(ans)
for _ in range(int(input())):
	print(solve())


import sys
input = sys.stdin.readline
import math

def print_str_line(str):
	sys.stdout.write(str + '\n')

def print_number(number):
	print_str_line(f'{number}')

def ans(string):
	count_1 = 0
	if string[0] == '1':
		count_1 = 1
	ans = []
	for i in range(1, len(string)):
		if string[i] == '0':
			ans.append('+')
		elif count_1 == 0:
			ans.append('+')
			count_1 = 1
		else:
			ans.append('-')
			count_1 = 0
	return ''.join(ans)
number_of_inputs = int(input())
for i in range(number_of_inputs):
	string_len = input()
	string = input()[:-1]
	_ans = ans(string)
	print_str_line(_ans)


from math import sqrt

def getDist(x1, y1, x2, y2):
	return (x1 - x2) ** 2 + (y1 - y2) ** 2
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	ans = ['+'] * (n - 1)
	one = int(s[0] == '1')
	for i in range(1, n):
		if s[i] == '0':
			continue
		elif one:
			one -= 1
			ans[i - 1] = '-'
		else:
			ans[i - 1] = '+'
			one += 1
	print(''.join(ans))


def sol(n, s):
	f = 0
	if s[0] == '0':
		f = 1
	r = ''
	c1 = s.count('1')
	f1 = 0
	if c1 % 2 == 1:
		f1 = 1
	for i in s[1:]:
		if i == '1':
			if f1 == 1 and c1 == 1:
				r += '+'
				continue
			if f == 1:
				r += '+'
				f = 0
			else:
				r += '-'
				f = 1
			c1 -= 1
		else:
			r += '+'
	return r
for _ in range(int(input())):
	n = int(input())
	s = input()
	print(sol(n, s))


import sys

def in_int():
	return int(sys.stdin.readline())

def in_str():
	return sys.stdin.readline().rstrip()

def in_map_int():
	return map(int, sys.stdin.readline().split())

def in_arr_int():
	return list(map(int, sys.stdin.readline().split()))

def in_arr_str():
	return sys.stdin.readline().split()

def is_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if n % i == 0:
			return True
	return False

def solve(n, a):
	ans = ''
	d = 0
	if a[0] == '1':
		d = 1
	for i in range(1, n):
		if d == 1 and a[i] == '1':
			d = 0
			ans += '-'
		elif d == 0 and a[i] == '1':
			d = 1
			ans += '+'
		else:
			ans += '+'
	return ans

def main():
	t = in_int()
	for _ in range(t):
		n = in_int()
		a = in_str()
		print(solve(n, a))
main()


import sys

def solution(st):
	flag = 0 if st[0] == '0' else 1
	res = ''
	for i in range(1, len(st)):
		if st[i] == '0':
			res += '+'
		elif flag == 0:
			res += '+'
			flag = 1
		else:
			res += '-'
			flag = 0
	return res
ip = sys.stdin.read().splitlines()
for i in range(2, 2 * int(ip[0]) + 1, 2):
	print(solution(ip[i]))


def main():
	n = int(input())
	s = input()
	total = 0 if s[0] == '0' else 1
	res = []
	for c in s[1:]:
		if c == '0':
			res.append('+')
		elif total > 0:
			res.append('-')
			total -= 1
		else:
			res.append('+')
			total += 1
	print(''.join(res))
for _0 in range(int(input())):
	main()


def solve():
	n = int(input())
	a = input()
	ans = ''
	c = 0 if a[0] == '0' else 1
	for i in range(1, len(a)):
		if a[i] == '0':
			ans += '+'
		elif c == 0:
			c += 1
			ans += '+'
		else:
			c -= 1
			ans += '-'
	print(ans)
tst = int(input())
for i in range(tst):
	solve()


def ans(n, a):
	r = ''
	s = 0
	for i in range(n):
		if s == 0 and a[i] == '0':
			r = r + '+'
		elif s == 0 and a[i] == '1':
			s = 1
			r = r + '+'
		elif s == 1 and a[i] == '0':
			r = r + '+'
		else:
			r = r + '-'
			s = 0
	return r[1:]
t = int(input())
l = []
for i in range(t):
	n = int(input())
	a = input()
	l.append(ans(n, a))
for i in range(t):
	print(l[i])


for _ in range(int(input())):
	n = int(input())
	s = input()
	res = ''
	if s[0] == '0':
		suma = 0
	else:
		suma = 1
	for el in s[1:]:
		if el == '0':
			res += '+'
		elif el == '1' and suma == 0:
			res += '+'
			suma += 1
		else:
			res += '-'
			suma -= 1
	print(res)


def main():
	t = int(input())
	result = []
	for i in range(t):
		n = int(input())
		a = [char for char in input()]
		count_one = 0
		assignment_signs = []
		for j in range(0, n):
			if a[j] == '1':
				count_one += 1
				if count_one % 2 == 0:
					assignment_signs.append('-')
				else:
					assignment_signs.append('+')
			elif a[j] == '0':
				assignment_signs.append('+')
		assignment_signs.pop(0)
		result.append(''.join(assignment_signs))
	print(*result, sep='\n')
main()


import sys

def solve():
	inp = sys.stdin.readline
	n = int(inp())
	s = inp()
	s = s.strip()
	type = 0
	ans = []
	for i in range(n):
		if s[i] == '1':
			if type == 1:
				ans.append('-')
			else:
				ans.append('+')
			type ^= 1
		else:
			ans.append('+')
	ans.pop(0)
	print(''.join(ans))

def main():
	for i in range(int(sys.stdin.readline())):
		solve()
main()


case = int(input())

def function(num, a):
	newstring = ''
	n = int(a[0])
	for i in range(1, num):
		if a[i] == '0':
			newstring = newstring + '+'
		elif a[i] == '1' and n == 0:
			newstring = newstring + '+'
			n = 1
		else:
			newstring = newstring + '-'
			n = 0
	return newstring
plm = []
for i in range(1, case + 1):
	n = int(input())
	word = str(input())
	plm.append(function(n, word))
for i in range(1, case + 1):
	print(plm[0])
	del plm[0]


import math

def solve():
	n = int(input())
	s = input()
	res = 0
	ans = []
	if s[0] == '1':
		res += 1
	for i in s[1:]:
		if i == '0':
			ans.append('+')
		elif res == 0:
			ans.append('+')
			res += 1
		else:
			ans.append('-')
			res -= 1
	print(''.join(ans))
for _ in range(int(input())):
	solve()


def sol(n, a):
	a = str(a).zfill(n)
	a = list(a)[:n]
	num_of_one = a.count(1)
	ans = ''
	ind_of_one = 0
	for x in a:
		if x == '0':
			ans = ans + '+'
		else:
			ind_of_one += 1
			if ind_of_one % 2 or ind_of_one == num_of_one:
				ans = ans + '+'
			else:
				ans = ans + '-'
	return ans[1:]
tc = int(input())
i = 0
while i < tc:
	i += 1
	n = int(input())
	a = int(input())
	print(sol(n, a))


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
res = ''
result = []
for x in range(n):
	i = inp()
	a = insr()
	sign = True
	for char in a:
		if char == '1':
			if sign:
				res += '+'
				sign = False
			else:
				res += '-'
				sign = True
		else:
			res += '+'
	result.append(res[1:])
	res = ''
	sign = True
for x in result:
	print(x)


def solve(n: int, a: str) -> str:
	res = ''
	count = 0
	for i in range(n):
		if a[i] == '1':
			count += 1
			if count % 2 == 0:
				res += '-'
			else:
				res += '+'
		else:
			res += '+'
	return res
t = int(input())
for _ in range(t):
	n = int(input())
	a = str(input())
	res = solve(n, a)
	print(res[1:])


def solve_test_case():
	characters_qty = int(input())
	characters = input()
	must_add = characters[0] == '0'
	signs = ''
	for character_index in range(1, characters_qty):
		character = characters[character_index]
		if character == '0':
			signs += '+'
		else:
			if must_add is True:
				signs += '+'
			else:
				signs += '-'
			must_add = not must_add
	return signs

def main():
	test_cases = int(input())
	for _ in range(test_cases):
		print(solve_test_case())
main()


n = int(input())
for i in range(n):
	input()
	s = input()
	if s[0] == '0':
		f = 0
	else:
		f = 1
	ans = ''
	for j in s[1:]:
		if j == '0':
			ans += '+'
		elif f == 0:
			ans += '+'
			f = 1
		else:
			ans += '-'
			f = 0
	print(ans)


def pm(no):
	o = ''
	c = 0
	for i in no:
		if i == '0':
			o += '+'
		elif c % 2 == 0:
			o += '+'
			c += 1
		else:
			o += '-'
			c += 1
	return o[1:]

def main():
	n = int(input())
	out = []
	for i in range(n):
		m = input()
		no = input()
		out.append(pm(no))
	print(*out, sep='\n')
main()


def create_output(k, s):
	val = s[0]
	out = ''
	for i in range(1, k):
		if val == '0' and val == s[i]:
			out += '+'
		elif val == '1' and val == s[i]:
			out += '-'
			val = '0'
		elif val == '1' and val != s[i]:
			out += '+'
			val = '1'
		elif val == '0' and val != s[i]:
			out += '+'
			val = '1'
	print(out)
t = int(input())
for j in range(t):
	k = int(input())
	s = input()
	create_output(k, s)


def main():
	_ = int(input())
	a = input()
	res = []
	s = int(a[0])
	for num in a[1:]:
		if num == '0':
			res.append('+')
		elif s == 0:
			s = 1
			res.append('+')
		else:
			s = 0
			res.append('-')
	print(''.join(res))
for _ in range(int(input())):
	main()


def max_sum(str):
	ans = ''
	status = 0
	if str[0] == '1':
		status = 1
	for i in range(1, len(str)):
		if (str[i] == '1') & (status == 1):
			ans += '-'
			status = 0
		else:
			if (str[i] == '1') & (status == 0):
				status = 1
			ans += '+'
	return ans
t = int(input())
res_arr = []
for i in range(t):
	n = int(input())
	res_arr.append(max_sum(str(input())))
for s in res_arr:
	print(s)


def sol(a):
	out = ''
	cum = a[0]
	for i in range(1, len(a)):
		if cum == a[i] == '1':
			out += '-'
			cum = '0'
		elif cum == a[i] == '0':
			out += '+'
			cum = '0'
		else:
			out += '+'
			cum = '1'
	return out
a = '0100000001'
test = int(input())
for ii in range(test):
	n = int(input())
	a = input()
	print(sol(a))


t = int(input())
for _ in range(t):
	n = int(input())
	a = input()
	lin = int(a[0])
	res = ''
	for i in range(1, n):
		if a[i] == '0':
			res += '+'
		elif lin == 0:
			res += '+'
			lin = 1
		else:
			lin = 0
			res += '-'
	print(res)


import sys
import math
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	ans = ''
	c = int(s[0])
	s = s[1:]
	for i in s:
		if i == '0':
			ans += '+'
		elif c == 1 and i == '1':
			c = 0
			ans += '-'
		else:
			ans += '+'
			c = 1
	print(ans)


def exe():
	f = 0
	cnt = 0
	st = ''
	if s[0] == '1':
		cnt += 1
	for i in range(1, n):
		if s[i] == '1':
			cnt += 1
			if cnt % 2 == 0:
				f = 1
				st += '-'
			else:
				f = 0
				st += '+'
		else:
			st += '+'
	return st
for i in range(int(input())):
	n = int(input())
	s = input()
	print(exe())


tests = int(input())
for j in range(tests):
	l = int(input())
	n = input()
	pCount = 0
	word = ''
	if n[0] == '1':
		pCount += 1
	for i in range(1, len(n)):
		if n[i] == '0':
			word += '+'
		else:
			pCount += 1
			if pCount % 2 != 0:
				word += '+'
			else:
				word += '-'
	print(word)


def operate(num: str, len: int) -> str:
	add = 0
	result = ''
	for i in num:
		if i == '0':
			result += '+'
		if i == '1':
			if add == 0:
				result += '+'
				add += 1
			else:
				result += '-'
				add -= 1
	return result[1:]
t = int(input())
for i in range(t):
	len = int(input())
	num = input()
	print(operate(num, len))


t = int(input())
ans = ''
track = 1
for test in range(t):
	n = int(input())
	s = input()
	for i in s:
		if i == '0':
			ans += '+'
		elif track:
			ans += '+'
			track = 0
		else:
			ans += '-'
			track = 1
	ans = ans[1:]
	print(ans)
	ans = ''
	track = 1


t = int(input())
while t:
	n = int(input())
	s = input()
	flag = int(s[0])
	ans = ''
	for i in range(1, n):
		if s[i] == '0':
			ans += '+'
		elif flag:
			ans += '-'
			flag = 0
		else:
			ans += '+'
			flag = 1
	print(ans)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	s = input()
	one = s.count('1')
	if n == 2:
		print('-')
	else:
		res = ['+'] * n
		f = False
		for i in range(n):
			if f and s[i] == '1':
				f = False
				res[i] = '-'
			elif not f and s[i] == '1':
				f = True
		ans = ''
		ans = ''.join(res[1:])
		print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(input())
	k = []
	c = 0
	if l[0] == '1' and l[1] == '1':
		k.append('-')
	else:
		k.append('+')
		if l[0] != '0' or l[1] != '0':
			c += 1
	for i in range(2, len(l)):
		if l[i] == '1':
			if c == 0:
				c += 1
				k.append('+')
			elif c > 0:
				c -= 1
				k.append('-')
		else:
			k.append('+')
	print(''.join(k))


for i in range(int(input())):
	length = int(input())
	string = input()
	count = 0
	if string[0] == '1':
		count = 1
	ans = ''
	for i in range(1, length):
		if string[i] == '0':
			ans += '+'
		elif count & 1:
			ans += '-'
			count += 1
		else:
			ans += '+'
			count += 1
	print(ans)


t = int(input())
for j in range(t):
	n = input()
	s = input()
	ans = []
	temp = 0
	for i in s:
		if i == '1' and temp <= 0:
			temp += 1
			ans.append('+')
		elif i == '1' and temp > 0:
			temp -= 1
			ans.append('-')
		else:
			ans.append('+')
	output = ''.join(ans[1:])
	print(output)


for i in range(int(input())):
	n = int(input())
	s = input()
	total = int(s[0])
	ans = ''
	for i in range(1, n):
		if s[i] == '1':
			if total == 0:
				total += 1
				ans += '+'
			elif total == 1:
				total -= 1
				ans += '-'
		else:
			ans += '+'
	print(ans)


for t in range(int(input())):
	n = int(input())
	s = str(input())
	a = 0
	c = ''
	if s[0] == '1':
		a += 1
	for i in range(1, n):
		if s[i] == '0':
			c += '+'
		elif a == 0:
			c += '+'
			a += 1
		else:
			c += '-'
			a -= 1
	print(c)


def solve():
	n = int(input())
	st = input()
	s = ''
	k = 0 if st[0] == '1' else 1
	for i in range(1, n):
		if k % 2 == 0 and st[i] == '1':
			s += '-'
			k += 1
		else:
			if st[i] == '1':
				k += 1
			s += '+'
	print(s)
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	t = input()
	ll = ''
	x = ''
	s = 0
	if t[0] == '1':
		s = 1
	for i in range(1, n):
		if t[i] == '0':
			ll += '+'
		elif s == 0:
			ll += '+'
			s += 1
		else:
			ll += '-'
			s -= 1
	print(ll)


t = int(input())
ch = ''
for i in range(t):
	n = int(input())
	a = input()
	x = int(a[0])
	for j in range(1, len(a)):
		if a[j] == '0':
			ch += '+'
		elif 1 + x > 1:
			x -= 1
			ch += '-'
		else:
			x += 1
			ch += '+'
	ch += '\n'
print(ch)


for i in range(int(input())):
	n = int(input())
	s = input()
	ans = ''
	ones = s.count('1')
	flag = s[0]
	for i in range(1, n):
		if s[i] == '1':
			if flag == '1':
				ans += '-'
				flag = '0'
			else:
				ans += '+'
				flag = '1'
		else:
			ans += '+'
	print(ans)


def add_plus_minus(strg, size):
	output = ''
	is_one = False
	for i in range(0, size):
		if strg[i] == '0':
			output += '+'
		elif is_one:
			output += '-'
			is_one = False
		else:
			output += '+'
			is_one = True
	return output[1:size]
t = int(input())
for i in range(0, t):
	n = int(input())
	strg = input()
	op = add_plus_minus(strg, n)
	print(op)


for _ in range(int(input())):
	l = int(input())
	s = input()
	hasOne = s[0] == '1'
	ans = []
	for c in range(1, len(s)):
		if s[c] == '0':
			ans.append('+')
		elif s[c] == '1' and hasOne:
			ans.append('-')
			hasOne = False
		else:
			ans.append('+')
			hasOne = True
	print(''.join(ans))


t = int(input())
for r in range(t):
	n = int(input())
	s = input()
	c = 1 if s[0] == '1' else 0
	res = ''
	for i in s[1:]:
		if i == '0':
			res += '+'
		else:
			if c % 2 == 0:
				res += '+'
			else:
				res += '-'
			c += 1
	print(res)


for _ in range(int(input())):
	n = input()
	l = input()
	s = l[0]
	out = ''
	for i in l[1:]:
		if i == '0':
			out += '+'
		elif s == '0':
			out += '+'
			s = '1'
		else:
			out += '-'
			s = '0'
	print(out)


t = int(input())
for _ in range(t):
	n = int(input())
	a = input()
	out = ''
	current_net = 1 if a[0] == '1' else 0
	for c in a[1:]:
		if c == '1':
			if current_net > 0:
				out += '-'
				current_net -= 1
			else:
				out += '+'
				current_net += 1
		else:
			out += '+'
	print(out)


for _ in range(int(input())):
	n = int(input())
	s = input()
	a = ''
	flag = 0
	for i in s:
		if i == '0' and flag == 0:
			a += '+'
		elif i == '0' and flag == 1:
			a += '+'
		elif i == '1' and flag == 0:
			flag = 1
			a += '+'
		elif i == '1' and flag == 1:
			flag = 0
			a += '-'
	print(a[1:])


def chck_sm(len_str: int, inpt_str: str):
	answr = int(inpt_str[0])
	str_answr = ''
	for i in range(1, len_str):
		if inpt_str[i] == '1' and answr == 0:
			answr += 1
			str_answr = str_answr + '+'
		elif inpt_str[i] == '1' and answr == 1:
			answr -= 1
			str_answr = str_answr + '-'
		elif inpt_str[i] == '0':
			str_answr = str_answr + '+'
	return str_answr

def main():
	cnt_str = input()
	for i in range(int(cnt_str)):
		len_str = int(input())
		inpt_str = input()
		print(chck_sm(len_str, inpt_str))
main()


def solution(a, n):
	sum = 0
	if a[0] == '1':
		sum = 1
	signs = ''
	for i in range(1, n):
		if sum == 1 and a[i] == '1':
			signs += '-'
			sum = 0
		elif sum == 1 and a[i] == '0':
			signs += '+'
			sum = 1
		elif sum == 0 and a[i] == '1':
			signs += '+'
			sum = 1
		elif sum == 0 and a[i] == '0':
			signs += '+'
			sum = 0
	print(signs)
t = int(input())
for i in range(t):
	n = int(input())
	a = input()
	solution(a, n)


t = int(input())
for ti in range(t):
	n = int(input())
	a = input()
	sum = int(a[0]) - int('0')
	res = ''
	for i in range(1, n):
		if a[i] == '0':
			res += '+'
			continue
		op = 1 if sum == 0 else -1
		sum += op
		res += '+' if op == 1 else '-'
	print(res)


n = int(input())
r = []
for i in range(n):
	p = int(input())
	ar = str(input())
	list(ar)
	s = []
	y = len(ar)
	sum = 0
	if ar[0] == '1':
		sum = 1
	for j in range(1, y):
		if sum == 1 and ar[j] == '1':
			sum = 0
			s.append('-')
		elif sum == 0 and ar[j] == '1':
			sum = 1
			s.append('+')
		else:
			s.append('+')
	r.append(s)
for i in range(n):
	print(''.join(r[i]))


import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
for _ in range(int(input())):
	n = inp()
	s = input()
	ans = ''
	total = int(s[0])
	for i in range(1, n):
		if s[i] == '1':
			if total == 0:
				total += 1
				ans += '+'
			else:
				ans += '-'
				total -= 1
		else:
			ans += '+'
	print(ans)


t = int(input())
for o in range(t):
	n = int(input())
	a = input()
	b = int(a[0])
	c = ''
	for i in a[1:]:
		if i == '1':
			if b == 1:
				b = b - 1
				c = c + '-'
			else:
				b = b + 1
				c = c + '+'
		else:
			c = c + '+'
	print(c)


n = int(input())
for i in range(n):
	ans = ''
	cnt = int(input())
	num = list(input())
	a = int(num[0])
	if a == 0:
		x = 0
	else:
		x = 1
	for j in range(cnt - 1):
		if num[j + 1] == '0':
			ans += '+'
		else:
			x += 1
			if x % 2 == 0:
				ans += '-'
			else:
				ans += '+'
	print(ans)


import sys
import os
tc = int(input())
for _ in range(tc):
	n = int(input())
	arr = input()
	isGenap = arr[0] == '0'
	res = []
	for i in range(1, n):
		if arr[i] == '0':
			res.append('+')
		else:
			if isGenap:
				res.append('+')
			else:
				res.append('-')
			isGenap = not isGenap
	print(''.join(res))


for _ in range(int(input())):
	n = int(input())
	s = input()
	c = int(s[0])
	ans = ''
	for x in s[1:]:
		if x == '0':
			ans += '+'
		elif c:
			ans += '-'
			c = 0
		else:
			ans += '+'
			c = 1
	print(ans)


for _ in [0] * int(input()):
	n = int(input())
	a = list(input())
	ans = ''
	s = int(a[0])
	for i in a[1:]:
		if i == '0':
			ans += '+'
		elif s != 0:
			ans += '-'
			s -= 1
		else:
			s += 1
			ans += '+'
	print(ans)