Run ID:109630

提交时间:2025-02-10 09:09:59

#include<bits/stdc++.h> using namespace std; int main() { char a[301]; // 定义字符数组 int k; cin >> k; cin >> a; int n = strlen(a); bool t = false; for (int i = 0; i <= n - k; i++) { bool match = true; for (int j = 1; j < k; j++) { if (a[i] != a[i + j]) { match = false; break; } } if (match) { for (int j = 0; j < k; j++) { cout << a[i + j]; t = true; break; } } } if (!t) { cout << "No"; } return 0; }