About Me

About Me : I have been working as a Software Engineer for various international companies for four years.Currently, I am working as a full stack Javascript developer in Petronas(Malaysia).

Skills

Skills • Javascript •Typescript •Python •C •Java •ReactJs • Redux • VueJs • NestJs • React Testing Library • Django• PostgreSQL • MySQL • NodeJs • Git • Docker • Jira • Visual Studio Code • Slack

শুক্রবার, ২ জানুয়ারী, ২০১৫

UVA SOLUTION : 10361 Automatic poetry


#include <iostream>
#include<cstdio>
#include<cstring>

using namespace std;

int main()
{
   // freopen("in.txt","r",stdin);
    string s,r,s2,s4,s3,s5;
    int test;
    cin>>test;
    getchar();
    while(test--)
    {
        getline(cin,s);
        getline(cin,r);
        int cn=0,flag=0;
        for(int i=0; i<s.size(); i++)
        {

            if(s[i]=='<')
            {

                flag=1;
                cn++;

            }
            if(s[i]=='>')
            {
                flag=0;
            }
            if(flag==1)
            {
                if(cn==1)
                {
                    if(s[i]!='<')s2+=s[i];
                }
                else
                {
                    if(s[i]!='<') s4+=s[i];
                }
            }

        }

        cn=0;
        flag=0;
        for(int i=0; i<s.size(); i++)
        {

            if(s[i]=='>')
            {

                flag=1;
                cn++;

            }
            if(s[i]=='<')
            {
                flag=0;
            }
            if(flag==1)
            {
                if(cn==1)
                {
                    if(s[i]!='>')s3+=s[i];
                }
                else
                {
                    if(s[i]!='>') s5+=s[i];
                }
            }

        }
        for(int i=0; i<s.size(); i++) if(s[i]!='>'&&s[i]!='<') putchar(s[i]);
        printf("\n");
        for(int i=0; i<r.size(); i++)
        {
            if(r[i]=='.')
            {
                cout<<s4<<s3<<s2<<s5;
                break;
            }
            else putchar(r[i]);
        }

        printf("\n");
        s2.clear();
        s3.clear();
        s4.clear();
        s5.clear();
        //cout<<s2<<" "<<s4<<" "<<s3<<" "<<s5<<endl;
    }


    return 0;
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন