time limit per test1 second

memory limit per test256 megabytes

inputstandard input

outputstandard output

You are given a text consisting of n lines. Each line contains some space-separated words, consisting of lowercase English letters.

We define a syllable as a string that contains exactly one vowel any arbitrary number (possibly none) of consonants. In English alphabet following letters are considered to be vowels: ‘a’, ‘e’, ‘i’, ‘o’, ‘u’ and ‘y’.

Each word of the text that contains at least one vowel can be divided into syllables. Each character should be a part of exactly one syllable. For example, the word “mamma” can be divided into syllables as “ma” and “mma”, “mam” and “ma”, and “mamm” and “a”. Words that consist of only consonants should be ignored.

The verse patterns for the given text is a sequence of n integers p1, p2, …, pn. Text matches the given verse pattern if for each i from 1 to n one can divide words of the i-th line in syllables in such a way that the total number of syllables is equal to pi.

You are given the text and the verse pattern. Check, if the given text matches the given verse pattern.

Input

The first line of the input contains a single integer n (1 ≤ n ≤ 100) — the number of lines in the text.

The second line contains integers p1, …, pn (0 ≤ pi ≤ 100) — the verse pattern.

Next n lines contain the text itself. Text consists of lowercase English letters and spaces. It’s guaranteed that all lines are non-empty, each line starts and ends with a letter and words are separated by exactly one space. The length of each line doesn’t exceed 100 characters.

Output

If the given text matches the given verse pattern, then print “YES” (without quotes) in the only line of the output. Otherwise, print “NO” (without quotes).

Examples

input

3

2 2 3

intel

code

ch allenge

output

YES

input

4

1 2 3 1

a

bcdefghi

jklmnopqrstu

vwxyz

output

NO

input

4

13 11 15 15

to be or not to be that is the question

whether tis nobler in the mind to suffer

the slings and arrows of outrageous fortune

or to take arms against a sea of troubles

output

YES

Note

In the first sample, one can split words into syllables in the following way:

in-tel

co-de

ch al-len-ge

Since the word “ch” in the third line doesn’t contain vowels, we can ignore it. As the result we get 2 syllabels in first two lines and 3 syllables in the third one.

【题解】



a,e,i,o,u,y被认为是元音字母。

求一个字符串里面有x个元音字母。它就能被分成x个SMG;判断和所给的相不相同就可以了。

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string> using namespace std; int a[200];
string s; int main()
{
//freopen("F:\\rush.txt", "r", stdin);
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++)
scanf("%d", &a[i]);
getchar();
for (int i = 1; i <= n; i++)
{
getline(cin, s);
int len = s.size();
int num = 0;
for (int i = 0; i <= len - 1; i++)
if (s[i] == 'a' || s[i] == 'i' || s[i] == 'e' || s[i] == 'o' || s[i] == 'u' || s[i] == 'y')
num++;
if (num != a[i])
{
puts("NO");
return 0;
}
}
puts("YES");
return 0;
}

【57.14%】【codeforces 722B】Verse Pattern的更多相关文章

  1. 【dp入门题】【跟着14练dp吧...囧】

    A HDU_2048 数塔 dp入门题——数塔问题:求路径的最大和: 状态方程: dp[i][j] = max(dp[i+1][j], dp[i+1][j+1])+a[i][j];dp[n][j] = ...

  2. 【 BowWow and the Timetable CodeForces - 1204A 】【思维】

    题目链接 可以发现 十进制4 对应 二进制100 十进制16 对应 二进制10000 十进制64 对应 二进制1000000 可以发现每多两个零,4的次幂就增加1. 用string读入题目给定的二进制 ...

  3. 【57.97%】【codeforces Round #380A】Interview with Oleg

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  4. 【34.57%】【codeforces 557D】Vitaly and Cycle

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  5. 【中途相遇法】【STL】BAPC2014 K Key to Knowledge (Codeforces GYM 100526)

    题目链接: http://codeforces.com/gym/100526 http://acm.hunnu.edu.cn/online/?action=problem&type=show& ...

  6. 【77.78%】【codeforces 625C】K-special Tables

    time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...

  7. 【codeforces 754D】Fedor and coupons

    time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  8. 【codeforces 760A】Petr and a calendar

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  9. 【codeforces 750E】New Year and Old Subsequence

    time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

随机推荐

  1. Android ImageView设置图片原理(上)

    本文来自http://blog.csdn.net/liuxian13183/ ,引用必须注明出处! 首先关于图片加载到ImageView上,我们来讨论几个问题: 如下: imageView.setIm ...

  2. [TypeScript] Make Properties and Index Signatures Readonly in TypeScript

    TypeScript 2.0 introduced the readonly modifier which can be added to a property or index signature ...

  3. 2.FastJson公司--阿里巴巴开源的速度最快的Json和对象转换工具

    转自:https://blog.csdn.net/gongpulin/article/details/52062532 这是关于FastJson的一个使用Demo,在Java环境下验证的 这是关于Fa ...

  4. spring定时器完整

    介绍:在开发中,我们经常需要一些周期性就进行某一项操作.这时候我们就要去设置个定时器,Java中最方便.最高效的实现方式是用java.util.Timer工具类,再通过调度java.util.Time ...

  5. axios封装http请求

    import axios from 'axios' const HTTP_TIMEOUT = 15000; export function httpPost(url, params = {},head ...

  6. 【CS Round #46 (Div. 1.5) E】Ultimate Orbs

    [链接]链接 [题意] n个人从左到右站在一条直线上.每个人都有一个能力值g[i],然后每个人可以将相邻的一个人打败. 然后它的能力值能够增加相应的能力值(就是打败了的那个人的能力值). A能够打败B ...

  7. 洛谷 P2646 数数zzy

    P2646 数数zzy 题目描述 zzy自从数学考试连续跪掉之后,上数学课就从来不认真听了(事实上他以前也不认真听).于是他开始在草稿纸上写写画画,比如写一串奇怪的字符串.然后他决定理♂性♂愉♂悦♂一 ...

  8. Fragment事务管理源代码分析

    转载请标明出处:http://blog.csdn.net/shensky711/article/details/53132952 本文出自: [HansChen的博客] 概述 在Fragment使用中 ...

  9. Cocos2d 游戏状态机

    加cocos2d 是标题党. 事实上跟cocos2d无关. 1.游戏背景介绍 比方有这么一个"记忆"类的比赛游戏.你和电脑对战.轮到谁的回合,谁翻两张牌.假设两张牌一样,就消掉这两 ...

  10. 初探springmvc

    Springmvc是什么 Springmvc(spring web mvc)是一种基于Java的实现了Web MVC设计模式的请求驱动类型的轻量级Web框架,即使用了MVC架构模式的思想,将web层进 ...