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

  1. 3
    2 2 3
    intel
    code
    ch allenge

output

  1. YES

input

  1. 4
    1 2 3 1
    a
    bcdefghi
    jklmnopqrstu
    vwxyz

output

  1. NO

input

  1. 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

  1. YES

Note

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

  1. 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。

  1. //2016.10.1
  2. #include <iostream>
  3. #include <cstdio>
  4. #include <cstring>
  5. #define N 105
  6.  
  7. using namespace std;
  8.  
  9. int p[N];
  10.  
  11. int main()
  12. {
  13. int n;
  14. string str;
  15. while(scanf("%d", &n)!=EOF)
  16. {
  17. bool fg = true;
  18. for(int i = ; i < n; i++)
  19. scanf("%d", &p[i]);
  20. getchar();
  21. for(int j = ; j < n; j++)
  22. {
  23. getline(cin, str);
  24. if(!fg)continue;
  25. int cnt = ;
  26. for(int i = ; i < str.length(); i++)
  27. if(str[i]=='a'||str[i]=='e'||str[i]=='i'||str[i]=='o'||str[i]=='u' || str[i]=='y')cnt++;
  28. if(cnt!=p[j])fg = false;
  29. }
  30. if(fg)cout<<"YES"<<endl;
  31. else cout<<"NO"<<endl;
  32. }
  33.  
  34. return ;
  35. }

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. Delphi中register, pascal, cdecl, stdcall, safecall(转)

    源:http://blog.sina.com.cn/s/blog_552c78120100hsr9.html 注: 使用错误,或者在该加的地方没有加,可能会出现"privileged ins ...

  2. 生成R文件

    aapt package -f -m -J H:/workspaces/java_android/Test2/gen -S H:/workspaces/java_android/Test2/res - ...

  3. -linux删除大量文件----rm,rsync

    要在linux下删除海量文件,比如有数十万个文件,此时常用的rm -rf * 就会等待时间很长.这时我们可以使用rsync快速删除大量文件. 1.建立一个空目录 mkdir -p /tmp/rsync ...

  4. UIP源码之ARP过程分析

    之前我们使用UIP实现了tcp和udp通讯今天来说说UIP的实现流程,当然,这篇文章里面只会涉及tcp和udp,暂时还没办法说DHCP,因为UIP的DHCP实现使用了协程的概念,下一章将协程之后再说D ...

  5. Spring Junit 读取WEB-INF下的配置文件

    假设Spring配置文件为applicationContext.xml 一.Spring配置文件在类路径下面 在Spring的java应用程序中,一般我们的Spring的配置文件都是放在放在类路径下面 ...

  6. camstar --飞达上料

    业务场景:某工厂的SMT车间接到生产PCB(3151502),数量1000片.如果实现飞达进行上料,并在贴片机工作时,系统自动进行物料消耗.3151502的BOM为1107790,1107792,11 ...

  7. Docker学习小计

    1.自动下载并且创建容器 Now verify that the installation has worked by downloading the ubuntu image and launchi ...

  8. OO设计原则 -- OO设计的原则及设计过程的全面总结

    这部分增加一点自己的感想,OO设计原则下面讲述的很清晰;看完之后有点感想如果我们在实际开发当中能够把这些原则熟烂于心的话那我们的代码质量和个人能力会有很显著的提神.根据自己的实际经验看很多开发者在开发 ...

  9. Treap初步

    模板题 bzoj3224: Tyvj 1728 普通平衡树 #include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i ...

  10. JavaScript------处理Json数据

    //JSON相关函数 JSON.parse(); //将JSON字符串转换为JavaScript对象JSON.stringify(); //将JavaScript值转换为JSON字符串 1.//JSO ...