Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define itloop(it,x) for(auto it=x.begin();it!=x.end();it++)
- #define reloop(i,e,b) for(auto i=e;i>=b;i--)
- #define loop(i,b,e) for(auto i=b;i<=e;i++)
- #define ALL(x) x.begin(),x.end()
- #define SZ(x) x.size()
- #define PB push_back
- #define MP make_pair
- #define F first
- #define S second
- #define sf scanf
- #define pf printf
- typedef long long LL;
- typedef vector<int> VI;
- typedef vector<LL> VLL;
- typedef pair<int,int> PI;
- typedef pair<LL,LL> PL;
- int n,un,x,y,z;
- string c;
- int main()
- {
- cin >> n >> c;
- loop(i,0,c.length()-1) {
- if(c[i] == '?')
- un++;
- }
- if(un == 0 || un == 1)
- cout << "No";
- else {
- loop(i,0,c.length()-1) {
- if(c[i] == '?') {
- if(c[i-1] != 'C' && c[i+1] != 'C')
- c[i] = 'C',x++;
- if(c[i-1] != 'Y' && c[i+1] != 'Y')
- c[i] = 'Y',y++;
- if(c[i-1] != 'M' && c[i+1] != 'M')
- c[i] = 'M',z++;
- }
- }
- puts(min(x,min(y,z)) == 0 ? "Yes" : "No");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement