Codeforces Whose sentence is it?

/*
Lionel Messi is such a player that you may catch him, you may touch him, you may feel him
and definitely you may Love him.
Lionel Messi is Messi. A little Magician in this World.

*/

#include<bits/stdc++.h>

using namespace std;

#define fast ios_base::sync_with_stdio(0)
#define bfast cin.tie(0)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf
#define nl puts("")
#define psb push_back

typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;
typedef vector<string>vs;

const int mod = 1000007;
const int high = 100;

class out
{
public:

    void noregonize()
    {
        cout << "OMG>.< I don't know!\n";
    }

    void lala()
    {
        cout << "Freda's\n";
    }

    void miao()
    {
        cout << "Rainbow's\n";
    }
};

int main()
{
    fast;
    out obj;
    int n , i , len , j , k;
    string s;
    char ch[200];

    while(cin >> n)
    {
        cin.getline(ch, 102);

        while(n--)
        {
            cin.getline(ch, 102);

            s.assign(ch);

            //outn(s);
            len = s.length();

            if(len < 5) obj.noregonize();

            else
            {
                bool lala=false, miao=false;

                if(s.substr(len-5 , 5) == "lala.")
                {
                    if(s.substr(0 , 5) == "miao.")
                    {
                        lala = true;
                        miao = true;
                    }

                    else lala=true;
                }

                else if(s.substr(0, 5) == "miao.")
                {
                    miao = true;
                }

                if(lala==true and miao==true) obj.noregonize();
                else if(lala==true and miao==false) obj.lala();
                else if(lala==false and miao==true) obj.miao();
                else obj.noregonize();
            }
        }
    }

    return 0;
}

Comments

Popular posts from this blog

SPOJ-CMG - Collecting Mango

LightOJ 1009 - Back to Underworld

LeetCode Palindrome Number