-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2093b.cpp
More file actions
32 lines (30 loc) · 721 Bytes
/
2093b.cpp
File metadata and controls
32 lines (30 loc) · 721 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
#include <bits/stdc++.h>
using namespace std;
#define NO cout<<"NO\n"
#define YES cout<<"YES\n"
#define F first
#define S second
#define cases int _; cin >> _; while(_--)
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef set<int> si;
void solve() {
string s; cin >> s;
pi chosenOne = {INT_MAX, INT_MAX}; int a = s.size();
for(int i = a-1; i >= 0; i--) {
if(s[i]!='0') {chosenOne.first = s[i]; chosenOne.second = i; break;}
}
int deletes = a-1;
for(int i = chosenOne.second; i >= 0; i--) {
if(s[i] == '0') deletes--;
}
cout << deletes << '\n';
}
int main() {
cases {
solve();
}
return 0;
}