Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <iterator>
- #include <cmath>
- #include <ctime>
- #include <vector>
- #include <stack>
- #include <deque>
- #include <queue>
- #include <set>
- #include <map>
- #include <stack>
- #include <string>
- #include <random>
- #include <numeric>
- #include <unordered_set>
- typedef long long ll;
- typedef long double lb;
- #define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
- #define file_in freopen("input.txt", "r", stdin);
- #define file_in_out freopen("inverse.in", "r", stdin); freopen("inverse.out", "w", stdout);
- #define mp make_pair
- #define all(x) (x).begin(), (x).end()
- #define fi first
- #define se second
- using namespace std;
- template<typename T>
- istream& operator>>(istream &in, vector<T> &v) {
- for (auto &it : v) {
- in >> it;
- }
- return in;
- }
- template<typename T>
- ostream& operator<<(ostream &out, vector<T> &v) {
- if (!v.empty()) {
- out << v.front();
- for (int i = 1; i < v.size(); ++i) {
- out << " " << v[i];
- }
- }
- return out;
- }
- int main()
- {
- fast
- // file_in
- // file_in_out
- string s;
- cin >> s;
- int ans = 0;
- for (int i = 0; i < s.size() / 2; ++i) {
- if (s[i] != '0') {
- ++ans;
- }
- }
- if (s.size() % 2 == 0) {
- for (int i = s.size() / 2; i < s.size(); ++i) {
- if (s[i] < s[i - s.size() / 2]) {
- --ans;
- break;
- } else if (s[i] > s[i - s.size() / 2]) {
- break;
- }
- }
- }
- cout << ans;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement