B. Verse Pattern

time limit per test:1 second
memory limit per test:256 megabytes
input:standard input
output:standard 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 ton 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 3syllables in the third one.

两个坑点,1.y也是元音 2.数出来的元音必须正好等于pi。

 //2016.10.1
#include <iostream>
#include <cstdio>
#include <cstring>
#define N 105 using namespace std; int p[N]; int main()
{
int n;
string str;
while(scanf("%d", &n)!=EOF)
{
bool fg = true;
for(int i = ; i < n; i++)
scanf("%d", &p[i]);
getchar();
for(int j = ; j < n; j++)
{
getline(cin, str);
if(!fg)continue;
int cnt = ;
for(int i = ; i < str.length(); i++)
if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u' || str[i]=='y')cnt++;
if(cnt!=p[j])fg = false;
}
if(fg)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
} return ;
}

CodeForces 722B的更多相关文章

  1. CodeForces 722B Verse Pattern (水题)

    题意:统计元音,这里多加一个元音,y. 析:直接统计就好了. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000" ...

  2. 【57.14%】【codeforces 722B】Verse Pattern

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

  3. codeforces722B

    Verse Pattern CodeForces - 722B You are given a text consisting of n lines. Each line contains some ...

  4. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  5. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  6. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  7. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  8. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  9. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

随机推荐

  1. C++ Builder多线程编程技术经验谈(转)

    源:C++ Builder多线程编程技术经验谈 线程之可行性   在很多情况下,可能需要为程序创建线程.这里给出其中一些可能性: (1)如果创建的是一个多文档接口(Multiple Document ...

  2. ural1126 Magnetic Storms

    Magnetic Storms Time limit: 0.5 secondMemory limit: 64 MB The directory of our kindergarten decided ...

  3. 《accelerated c++》---------第六章

    本章主要讲了算法部分.就是<algoruthm>里面的算法.

  4. windows2003 IIS6 部署MVC3和MVC4程序

    1.服务器上安装SP2 和 IIS6 2.安装.Net Framework3.5 SP1(完整安装包,包含2.0 2.0SP1,237MB那个安装包) 3.安装.Net Framework4.0 4. ...

  5. 转载:org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.Annotation

    转载:org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.Annotation (2012 ...

  6. curl调用openstack API总结

    curl命令是Linux下一个可以使用多种协议收发数据的工具,包括http协议.openstack的API接口都是URL地址:http://controller:35357/v3可以使用curl命令进 ...

  7. 【转】 完美配置Tomcat的HTTPS

    Tomcat配置HTTPS的文章到处都有,过程也比较简单,随后文中会转一段过来. 但对于启用APR情况下报异常“java.lang.Exception: Connector attribute SSL ...

  8. Appium的安装和使用

    <!DOCTYPE html><html><head><title>Appium的安装和使用</title><meta http-eq ...

  9. mysql的python api

    我采用的是MySQLdb操作的MYSQL数据库.先来一个简单的例子吧: 1 2 3 4 5 6 7 8 9 10 import MySQLdb   try:     conn=MySQLdb.conn ...

  10. 编译时.test文件报错无法解决的方法,关闭test编译

    有几次遇到从网上下载到的iOS开源代码编译报错,报错位置为Test Target的源文件,我就挺奇怪我又没做测试为啥会编译Test Target的源文件,之前的暴力解决方法是把Test Target直 ...