#pragma GCC optimize("O3") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using P = pair; using T = tuple; template inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;} template inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;} constexpr int MOD = 1e9 + 7; constexpr int inf = 1e9; constexpr long long INF = 1e18; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; vector makeTable(string &s){ int n = s.size(); vector ret(n+1); ret[0] = -1; int j = -1; for(int i=0; i= 0 && s[i] != s[j]) j = ret[j]; ret[i+1] = ++j; } return ret; } vector kmp(string &str, string &word){ vector table = makeTable(word), ret; int m = 0, i = 0, n = str.size(); while(m + i < n){ if(word[i] == str[m+i]){ if(++i == (int)(word.size())){ ret.emplace_back(m); m += i - table[i]; i = table[i]; } } else{ m += i - table[i]; if(i > 0) i = table[i]; } } return ret; } int main(){ cin.tie(0); ios::sync_with_stdio(false); string s, t; cin>>s>>t; if(t.size() == 1){ for(int i=0; i