-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathB.java
96 lines (78 loc) · 3.37 KB
/
B.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
/$$$$$ /$$$$$$ /$$ /$$ /$$$$$$
|__ $$ /$$__ $$| $$ | $$ /$$__ $$
| $$| $$ \ $$| $$ | $$| $$ \ $$
| $$| $$$$$$$$| $$ / $$/| $$$$$$$$
/$$ | $$| $$__ $$ \ $$ $$/ | $$__ $$
| $$ | $$| $$ | $$ \ $$$/ | $$ | $$
| $$$$$$/| $$ | $$ \ $/ | $$ | $$
\______/ |__/ |__/ \_/ |__/ |__/
/$$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$ /$$$$$$$$ /$$$$$$$
| $$__ $$| $$__ $$ /$$__ $$ /$$__ $$| $$__ $$ /$$__ $$| $$$ /$$$| $$$ /$$$| $$_____/| $$__ $$
| $$ \ $$| $$ \ $$| $$ \ $$| $$ \__/| $$ \ $$| $$ \ $$| $$$$ /$$$$| $$$$ /$$$$| $$ | $$ \ $$
| $$$$$$$/| $$$$$$$/| $$ | $$| $$ /$$$$| $$$$$$$/| $$$$$$$$| $$ $$/$$ $$| $$ $$/$$ $$| $$$$$ | $$$$$$$/
| $$____/ | $$__ $$| $$ | $$| $$|_ $$| $$__ $$| $$__ $$| $$ $$$| $$| $$ $$$| $$| $$__/ | $$__ $$
| $$ | $$ \ $$| $$ | $$| $$ \ $$| $$ \ $$| $$ | $$| $$\ $ | $$| $$\ $ | $$| $$ | $$ \ $$
| $$ | $$ | $$| $$$$$$/| $$$$$$/| $$ | $$| $$ | $$| $$ \/ | $$| $$ \/ | $$| $$$$$$$$| $$ | $$
|__/ |__/ |__/ \______/ \______/ |__/ |__/|__/ |__/|__/ |__/|__/ |__/|________/|__/ |__/
*/
import java.io.*;
import java.util.*;
public class cf
{
// static class pair{
// int i;
// int v;
// public pair(int i, int v){
// this.i=i;
// this.v=v;
// }
// }
// static class sort implements Comparator<pair>{
// public int compare(pair x,pair y){
// return x.v-y.v;
// }
// }
// static int solve(int a[],int n,int N){
// if(n>=N ){
// n--;
// return 0;
// }
// if(dp[n]!=-1)
// return dp[n];
// return dp[n]= a[n]+solve(a,n+a[n],N);
// else
// return dp[n]=solve(a,n+1,N);
// }
static int dp[];
public static void main(String args[])throws IOException
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
HashSet<Integer> set=new HashSet<>();
int n=sc.nextInt();
String s=sc.next();
int x=0;
int y=0;
for(int i=0;i<n;i++){
if(s.charAt(i)=='-'){
set.add(i);
set.add((i+1)%n);
}
else if(s.charAt(i)=='<'){
x++;
}
else {
y++;
}
}
if(x==0 || y==0){
System.out.println(n);
}
else{
System.out.println(set.size());
}
}
}
}