UVA 12599 - Black and White

Problem PDF

Solution:

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define ll long long
#define sc scanf
#define pf printf
#define pi 2*acos(0.0)
using namespace std;
int main()
{
    int t,n;
    string s;
    cin>>t;
    while(t--)
    {
        cin>>s;
        n=s.size();
        vectorv;
        int f=0;
        if(s[0]=='W'||s[n-1]=='B')
        {
            cout<<"IMPOSSIBLE"<3)
                break;
        }
        if(c==1)
        {
            cout<<"1"<
https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/12599/12599.cpp