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. (中等) CF 555E Case of Computer Network,双连通+树。

    Andrewid the Android is a galaxy-known detective. Now he is preparing a defense against a possible a ...

  2. linux权限---【600,644,700,755,711,666,777】 - - 博客频道 - CSDN.NET

    body { font-family: "Microsoft YaHei UI","Microsoft YaHei",SimSun,"Segoe UI ...

  3. iOS开发——获取手机当前WiFi名和MAC地址

    获取手机WiFi信息. iOS9以前的方法,还是能用,警告就警告吧!iOS9以后使用的是苹果最新的API框架,NetworkExtension/NEHotspotHelper.h,这个框架,第一次开放 ...

  4. bitmap格式分析(转)

    源:bitmap格式分析 参考:bitmap图像介绍 最近正在着手开发一个图片库,也就是实现对常见图片格式的度写操作.作为总结与积累,我会把这些图片格式以及加载的实现写在我的Blog上. 说到图片,位 ...

  5. UE4上传图片到服务器

    客户端代码: void AHttpTestCharacter::MyHttpCall(FString Url){ // TexturePath contains the local file full ...

  6. 【Xilinx-Petalinux学习】-05-OpenCV程序测试

    占位, 通过上一次编译的opencv库,运行程序,实现图像处理

  7. java学习(四) excel读取

    private static void readExcel() { String filePath = "C:/Standardzid.xls"; File file = new ...

  8. Backbone视图渲染React组件

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title&g ...

  9. window下Git和github入门

    tip:使用简单的例子来制作一个使用指南过程,默认文件夹为demo.看了3个早晨,写一下留个记录,可能有些不成熟,如有错误欢迎指正. 参考一:http://www.liaoxuefeng.com/wi ...

  10. GitHub优秀的Android 开源项目

    GitHub上优秀Android开源项目 转载自 : http://my.eoe.cn/sisuer/archive/3348.html http://my.eoe.cn/sisuer/archive ...