B. 【例题2】移位包含
解析
判断是否是子串,可以将这个一个环
#include <bits/stdc++.h> using namespace std; int f = 0; string a, b; int main() { cin >> a >> b; for (int i = 0; i < a.size (); ++ i) { char c = a[0]; a = a.substr (1, a.size() - 1); a = a + c; if (a.find (b, 0) != string::npos) { cout << "true"; f = 1; break; } } if (!f) cout << "false"; return 0; }