Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- string cad;
- cin >> cad;
- int p = 0, f = 0;
- for(int i = 0; i < cad.size(); ) {
- if((cad[i]-'0') == 1) {
- p++;
- i += 4;
- }
- else {
- p++;
- i+=3;
- }
- }
- for(int i = cad.size()-1; i >=0; ) {
- if((cad[i-4]-'0') == 1) {
- f++;
- i -= 4;
- }
- else {
- f++;
- i-=3;
- }
- }
- cout << p << " " << f;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement