Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits\stdc++.h>
- #ifdef LOCAL
- #define dbg(x) cerr << #x << " = " << (x) << endl;
- #else
- #define dbg(x)
- #endif
- #define int long long
- #define endl "\n"
- #define x first
- #define y second
- #define len(x) ((int)(x).size())
- using namespace std;
- void solve(); signed main() {
- #ifdef LOCAL
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
- cout.setf(ios::fixed); cout.precision(15);
- solve();
- }
- void solve() {
- string s;
- cin >> s;
- int ans, length;
- string t;
- cin >> ans >> length >> t;
- int cnt = 0;
- for (int i = 0; i < len(s) - len(t) + 1; ++i) {
- string curr = s.substr(i, length);
- if (curr == t) {
- cnt++;
- }
- }
- cout << (ans == (cnt * len(t))) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement