ABC145 B - Echo
Table of contents
# Problem
https://atcoder.jp/contests/abc145/tasks/abc145_b
Given a string , report if is twice repetitions of a string or not.
# Explanation
If the length of is odd, report No
.
Otherwise, split in the middle into and .
If equals to , report Yes
.
# Time complexity
Half of the length of .
# Solution
Int N;
string S;
void input() {
cin >> N >> S;
}
void solve() {
if (N % 2 == 1) {
cout << "No" << endl;
return;
}
if (S.substr(0, N/2) == S.substr(N/2)) cout << "Yes" << endl;
else cout << "No" << endl;
}
int main(void) {
input();
solve();
return 0;
}
Shun
Remote freelancer. A web and mobile application enginner.
Traveling around the world based on East Asia.
I'm looking forward to your job offers from all over the world!