Find Your Solution Here

Codeforces

codeforces solution 711A – Bus to Udayland

Problem link—711A – Bus to Udayland
/*

Harun-or-Rashid

CSEDU-23rd Batch

*/
By coder_87, contest: Codeforces Round #369 (Div. 2), problem: (A) Bus to Udayland, Accepted, #


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,i,x=0,j;
    cin>>n;
    char s[n][5];
    for(i=0; i<n; i++)
    {
        for(j=0; j<5; j++)
        {
            cin>>s[i][j];
        }
    }
    for(i=0; i<n; i++)
    {
        for(j=0; j<4; j++)
        {
            if(s[i][j]=='O'&&s[i][j+1]=='O')
            {
                x=1;
                s[i][j]=s[i][j+1]='+';
                break;
            }
        }
        if(x==1)
            break;
    }
    if(x==1)
    {
        cout<<"YES"<<endl;
        for(i=0; i<n; i++)
        {
            for(j=0; j<5; j++)
            {
                cout<<s[i][j];
            }
            cout<<endl;
        }
    }
    else
        cout<<"NO"<<endl;

    return 0;
}

Leave a Reply