-
Notifications
You must be signed in to change notification settings - Fork 2
/
A_Erasing_Zeroes.cpp
72 lines (62 loc) · 1.74 KB
/
A_Erasing_Zeroes.cpp
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
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mp make_pair
#define mod (int)1e9+7
#define eps (double)1e-9
#define INF 1011111111
#define pi 3.1415926535897932384626433832795
#define sz(a) ((int)(a.size()))
#define all(a) a.begin(), a.end()
#define cin1(x) cin >> (x)
#define cin2(x,y) cin >> (x) >> (y)
#define cin3(x,y,z) cin >> (x) >> (y) >> (z)
#define cout1(x) cout << (x) << endl
#define cout2(x,y) cout << (x) <<" "<< (y) << endl
#define cout3(x,y,z) cout << (x) <<" "<< (y) <<" "<< (z) << endl
#define UNIQ(a) a.erase(unique(all(a)), a.end())
#define FREIN(FILE) freopen(FILE,"rt",stdin)
#define FREOUT(FILE) freopen(FILE,"wt",stdout)
#define endl "\n"
template <typename T> T sqr(T a) {return (a) * (a);}
template <typename T> T dist(T x1, T y1, T x2, T y2) {return sqrt(sqr(x1-x2) + sqr(y1-y2));}
template <typename T> T angle(T x1, T y1, T x2, T y2){ return atan2(double(y1-y2) , double(x1-x2));}
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;
string s;
void solve() {
cin1(s);
int l = 0;
int r = 0;
int n = s.size();
for (int i = 0; i < n; i++) {
if(s[i] == '1') {
l = i;
break;
}
}
for (int i = n; i >= 0; i--) {
if(s[i] == '1') {
r = i; break;
}
}
int ans = 0;
for (int i = l + 1; i < r; i++) {
if(s[i] == '0') ans++;
}
cout1(ans);
}
int main() {
ll testCases; cin >> testCases;
while (testCases--) { solve(); }
}