-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path1303A.cpp
More file actions
42 lines (35 loc) · 850 Bytes
/
1303A.cpp
File metadata and controls
42 lines (35 loc) · 850 Bytes
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
#include <bits/stdc++.h>
#define ll long long int
#define db double
#define pb push_back
#define mpr make_pair
#define andl "\n"
#define f first
#define s second
#define mset(x,y) memset(x,y,sizeof(x))
#define fr(i,n) for(long long int i=0;i<n;i++)
#define trace(it,x) for(auto it = (x).begin(); it != (x).end(); it++)
#define mod 1000000007
#define fastio ios::sync_with_stdio (false); cin.tie (0); cout.tie (0);
#define runtime cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
using namespace std;
void solve()
{
string a;
cin>>a;
ll l=0, r=a.size()-1,ans=0;
while(l<=r && a[l]=='0') ++l;
while(r>=l && a[r]=='0') --r;
for(ll i=l;i<=r;i++) ans+=(a[i]=='0');
cout<<ans<<andl;
}
int main()
{
fastio
ll t;
cin>>t;
while(t--){
solve();
}
runtime;
}