#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Appitizer ios_base::sync_with_stdio(false); cin.tie(NULL);
#define chkvow(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<int>())
#define all(v) v.begin(),v.end()
#define mnv(v) *min_element(v.begin(),v.end())
#define mxv(v) *max_element(v.begin(),v.end())
#define countv(v,a) count(v.begin(),v.end(),a)
int main()
{
int t;
cin>>t;
while(t--)
{
string s;
cin>>s;
ll paps=0,k=0,d=0;
for(int i=0;i<s.size();i++){
if(s[i]=='_') d++;
else{
//cout<<d<<endl;
if(d!=0)k+=(d-1);
d=0;
}
}
if(s[0]=='_') k++;
if(s[s.size()-1]=='_') k++;
if(d!=0) k+=(d-1);
if(s.size()==1 && s[0]=='^')k=1;
cout<<k<<endl;
}
}
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |