Google kick start Round A 2022 Speed Typing (5pts, 9pts) Solution

 




Problem Link :  https://codingcompetitions.withgoogle.com/kickstart/round/00000000008cb33e/00000000009e7021

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,t,ts,i,r,a,j;
    cin>>t;
    for(ts=1; ts<=t; ts++)
    {
        string s,s1;
        cin>>s>>s1;
        a=j=0;
        for(i=0; i<s.size(); i++)
        {
            while(1)
            {
                if((s[i]==s1[j])||(j>=s1.size()))
                {
                    break;
                }
                else
                {
                    j++;
                }
            }
            if(s[i]==s1[j])
            {
                a++;
                j++;
            }
        }
        if(s.size()==a)
        {
            printf("Case #%d: %d\n",ts,s1.size()-a);
        }
        else
            printf("Case #%d: IMPOSSIBLE\n",ts);
    }
}



 

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.