Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- char st[100];
- int l = 0;
- gets_s(st);
- int n = strlen(st);
- if (st[n - 1] == '1') st[n] = '0';
- else st[n] = '1';
- cout << endl;
- if (n < 2) return 1;
- for (int i = 0; i < n; i++)
- {
- if (st[i] != st[i + 1]) {
- if (((i - l) + 1) % 2 == 0){
- for (int j = l; j < i + 1; j++) {
- cout << st[i] << " ";
- }
- cout << endl;
- }
- l = i+1;
- }
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement