forked from beastxumair/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcake.cpp
More file actions
42 lines (36 loc) · 802 Bytes
/
Copy pathcake.cpp
File metadata and controls
42 lines (36 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<bits/stdc++.h>
#define nl "\n"
#define f(i,a,n) for(int i=a;i<=n;i++)
#define rf(i,n,a) for(int i=n;i>=0;i--)
#define ll long long int
#define in_arr(a) for(auto &e : a) {cin>>e;}
#define out_arr(a) for(auto e: a) {cout<<e<<" ";} cout<<"\n";
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define testcase int tc; cin>>tc; while(tc--) { solve(); }
using namespace std;
void solve()
{
string s; cin>>s;
int l=s.size();
int b=0;
map<char,int> mp;
f(i,0,l-1)
{
mp[s[i]]++;
}
for(auto i:mp)
{
if(i.second==l-i.second)
{
cout<<"YES"<<nl;
return;
}
}
cout<<"NO"<<nl;
}
main()
{
fast
testcase
// solve();
}