Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. #include <string>
  5. #include <cmath>
  6. #include <map>
  7. #include <queue>
  8.  
  9. using namespace std;
  10. using ld = long double;
  11. using ll = long long;
  12. using ull = unsigned long long;
  13.  
  14. int main() {
  15.     ios::sync_with_stdio(0);
  16.     cin.tie(0);
  17.     cout.tie(0);
  18.  
  19.     string s1, s2;
  20.     cin >> s1 >> s2;
  21.  
  22.     int i = 0;
  23.     int length = 1;
  24.  
  25.     while ((i < s1.size()) && (s1[i] == s2[i])) {
  26.         i++;
  27.         if (s1[i] == s1[i-1]) length++;
  28.         else length = 1;
  29.     }
  30.  
  31. //    int ans = length;
  32.     int ans = i;
  33.     i++;
  34.  
  35.     while (i < s1.size()) {
  36.         if (s1[i] != s2[i-1]) {
  37.             cout << "0\n";
  38.             return 0;
  39.         }
  40.         i++;
  41.     }
  42.  
  43.     cout << length << "\n";
  44.     for (int j = ans - length + 1; j <= ans; j++) {
  45.         cout << j+1 << " ";
  46.     }
  47.  
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement