Codeforces Round #776 (Div. 3) 1650A - Deletions of Two Adjacent Letters Solution



 Problem Link:https://codeforces.com/problemset/problem/1650/B

Solution in C++:

///La ilaha illellahu muhammadur rasulullah
///******Bismillahir-Rahmanir-Rahim******///
///Abul Hasnat  Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long n,l,i,f,t;
    cin>>t;
    while(t--)
    {
        string s,s1;
        f=0;
        cin>>s>>s1;
        for(i=0;i<s.size();i++)
        {
            if((s[i]==s1[0])&&(i%2==0))
            {
                f=1;
                break;
            }
        }
        if(f==1)
        cout<<"YES"<<endl;
        else
        cout<<"NO"<<endl;
    }
}
 



No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h &g...

Powered by Blogger.