Created
March 19, 2023 17:11
-
-
Save qjatn0120/e3f009bd4f3a97fb0ef651fd4ef32296 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int main(){ | |
cin.tie(nullptr), ios::sync_with_stdio(false); | |
int t; | |
cin >> t; | |
while(t--){ | |
int n; | |
string s; | |
cin >> n >> s; | |
vector <int> chk1(26), chk2(26); | |
for(int i = 0; i < n; i++){ | |
if(i & 1) chk1[s[i] - 'a']++; | |
else chk2[s[i] - 'a']++; | |
} | |
bool flag = true; | |
for(int i = 0; i < 26; i++) if(chk1[i] && chk2[i]) flag = false; | |
cout << (flag ? "Yes\n" : "No\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment