//Here is my code
#include<iostream>
#include<string>
using namespace std;
int main(){
int testcase = 0,i = 0,cnt = 0;
cin>>testcase;
string s;
if(testcase>1 && testcase<=7)
for(;testcase>0;testcase--){
cin>>s;
cout<<s.size();
if(s.size()>=1 && s.size()<=100000)
for(i=0;i<s.size();i++){
if(s[i] == '+'){
if(s[i+1] == '-'){
}else{
s[i+1] = '-';
cnt++;
}
}else{
if(s[i+1] == '+'){
}else{
s[i+1] = '+';
cnt++;
}
}
}
cout<<cnt<<endl;
cnt = 0;
}
return 0;
}