Advertisement
Nekruz

123

Dec 6th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n, k, temp, i = 0;
  6. cin >> n >> k;
  7. string s, c = "";
  8. cin >> s;
  9.  
  10. while(c[k - 1] != s[n - 1])
  11. {
  12. c = s.substr(i, k);
  13. temp = s.find(c);
  14. ///cout << "c = " << c << " " << "temp = " << temp << " " << "i = " << i << endl;
  15. if(temp != i) {cout << "YES"; return 0;}
  16. i++;
  17. }
  18. cout << "NO";
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement