Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <algorithm>
- using namespace std;
- int main() {
- int ans = 0, x = 0;
- std::string s;
- getline(std::cin, s);
- for (uint8_t byte : s) {
- if (x != 0) {
- x--;
- } else {
- ans++;
- for (int i = 7; i >= 0; --i) {
- if ((byte & (1 << i)) != 0) {
- x++;
- } else {
- break;
- }
- }
- x = max(0, x - 1);
- }
- }
- cout << ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement