Subscribe Us

Responsive Advertisement

Advertisement

1644A Doors and Keys codeforces solution i cpp

1644A Doors and Keys codeforces solution i cpp

by ujjal roy



#include<bits/stdc++.h>

using namespace std;

main()

{

    int t,r,g,b,i;

    cin>>t;

    while(t--)

    {

        r=0,g=0,b=0;

        int ans=0;

        string s;

        cin>>s;

        for(i=0;i<s.size();i++)

        {

            if(s[i]=='r') r=1;

            if(s[i]=='g') g=1;

            if(s[i]=='b') b=1;

            if(s[i]=='R'&&r!=1) ans=1;

            if(s[i]=='G'&&g!=1) ans=1;

            if(s[i]=='B'&&b!=1) ans=1;



        }

        if(ans) cout<<"NO"<<endl;

        else cout<<"YES"<<endl;

    }


    return 0;

}

 

Post a Comment

0 Comments