We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 57eccb5 commit f5dc144Copy full SHA for f5dc144
1794A-PrefixAndSuffixArray.cpp
@@ -0,0 +1,23 @@
1
+#include <iostream>
2
+#include <algorithm>
3
+
4
+int main(){
5
6
+ std::ios_base::sync_with_stdio(false);
7
+ long t; std::cin >> t;
8
+ while(t--){
9
+ long n; std::cin >> n;
10
+ std::string x(""), y("");
11
+ for(long p = 0; p < 2 * n - 2; p++){
12
+ std::string cur; std::cin >> cur;
13
+ if(cur.size() == n - 1){
14
+ if(x.size() == 0){x = cur;}
15
+ else{y = cur;}
16
+ }
17
18
19
+ std::reverse(x.begin(), x.end());
20
+ std::cout << (x == y ? "YES" : "NO") << std::endl;
21
22
23
+}
0 commit comments