Codeforces B. Verse Pattern

//Next Codeforces Round #354 (Div. 2)
#include<bits/stdc++.h>

//#include<cstdio>
//#include<iostream>
//#include<algorithm>
//#include<vector>
//#include<cstring>
//#include<cmath>
//#include<map>

using namespace std;

#define fast ios_base::sync_with_stdio(false)
#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("")

typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;
typedef map<char, int>mpci;

int main()
{
    fast;
    int n , i , x , len , j , cnt;
    string s;
    vii v;
    mpci mp;

    while(cin >> n)
    {
        v.clear();
        mp.clear();

        for(i=0; i<n; i++)
        {
            cin >> x;
            v.push_back(x);
        }

        bool f=true;

        cin.ignore();

        for(i=0; i<n; i++)
        {
            s.clear();

            getline(cin , s);

            len = s.length(); //cout << "len = " << len << "\n";

            cnt=0;

            for(j=0; j<len; j++)
            {
                if(s[j]=='a' or s[j]=='e' or s[j]=='i' or s[j]=='o' or s[j]=='u' or s[j]=='y')
                {
                    cnt++;
                }
            }

            //cout << "cnt = " << cnt << "; ";

            if(cnt != v[i])
            {
                //cout << "cnt = " << cnt;
                f=false;
            }
        }

        if(!f) outn("NO");
        else outn("YES");
    }

    return 0;
}

Comments

Popular posts from this blog

SPOJ-CMG - Collecting Mango

LightOJ 1009 - Back to Underworld

LeetCode Palindrome Number