Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <fstream>
- #include <algorithm>
- using namespace std;
- string w, s;
- unsigned int g, N;
- unsigned int res = 0;
- ifstream in("input.txt");
- ofstream out("output.txt");
- int main() {
- in >> g >> N;
- in >> w >> s;
- sort(w.begin(), w.end());
- for(int i = 1; i <= N-g+1; i++) {
- string temp = s.substr(i, g);
- sort(temp.begin(), temp.end());
- if(w == temp) ++res;
- }
- out << res;
- in.close();
- out.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement