Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <vector>
- #include <string>
- #include <cmath>
- #include <map>
- #include <queue>
- using namespace std;
- using ld = long double;
- using ll = long long;
- using ull = unsigned long long;
- int main() {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- string s1, s2;
- cin >> s1 >> s2;
- int i = 0;
- int length = 1;
- while ((i < s1.size()) && (s1[i] == s2[i])) {
- i++;
- if (s1[i] == s1[i-1]) length++;
- else length = 1;
- }
- // int ans = length;
- int ans = i;
- i++;
- while (i < s1.size()) {
- if (s1[i] != s2[i-1]) {
- cout << "0\n";
- return 0;
- }
- i++;
- }
- cout << length << "\n";
- for (int j = ans - length + 1; j <= ans; j++) {
- cout << j+1 << " ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement