Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <bits\stdc++.h>
  2.  
  3. #ifdef LOCAL
  4. #define dbg(x) cerr << #x << " = " << (x) << endl;
  5. #else
  6. #define dbg(x)
  7. #endif
  8. #define int long long
  9. #define endl "\n"
  10. #define x first
  11. #define y second
  12. #define len(x) ((int)(x).size())
  13.  
  14. using namespace std;
  15.  
  16. void solve(); signed main() {
  17. #ifdef LOCAL
  18. freopen("input.txt", "r", stdin);
  19. freopen("output.txt", "w", stdout);
  20. #endif
  21. ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  22. cout.setf(ios::fixed); cout.precision(15);
  23. solve();
  24. }
  25.  
  26. void solve() {
  27. string s;
  28. cin >> s;
  29. int ans, length;
  30. string t;
  31. cin >> ans >> length >> t;
  32. int cnt = 0;
  33. for (int i = 0; i < len(s) - len(t) + 1; ++i) {
  34. string curr = s.substr(i, length);
  35. if (curr == t) {
  36. cnt++;
  37. }
  38. }
  39.  
  40. cout << (ans == (cnt * len(t))) << endl;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement