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. LightOJ 1063 Ant Hills

    Ant Hills Time Limit: 2000ms Memory Limit: 32768KB This problem will be judged on LightOJ. Original ...

  2. 版本管理系统:svn和git

    svn是常用的版本管理系统,解决团队协作开发和版本管理问题, 一.服务器端:是一个文件存储仓库,可以设置用户并管理其访问的权限.主要功能包括 ①设置文件存储路径,是管理文件版本的基础 ②设置用户:可以 ...

  3. FineUI 页面跳转

    要加 EnableAjax=false; <f:Button ID="btn1" EnableAjax="false" OnClick="btn ...

  4. ORA-10458: standby database requires recovery

    搭建DG最后一步打开时报错如下:   SQL> alter database open read only; alter database open read only * ERROR at l ...

  5. 洛谷 P2067 Cytus-Holyknight

    P2067 Cytus-Holyknight 题目背景 本人最初作 以此纪念伟大的ios.安卓.PSV平台音乐游戏<cytus> 后续将不断更新. -------------Chapter ...

  6. [NPM] Publish npm packages using npm publish

    In this lesson we will publish our package. We will first add a prepublish script that runs our buil ...

  7. [Javascript] Different ways to create an new array/object based on existing array/object

    Array: 1. slice() const newAry = ary.slice() 2. concat const newAry = [].concat(ary) 3. spread oprea ...

  8. Qt 图片浏览器 实现图片的放大缩小翻转等功能

    图片的功能 源码: wiget.h #ifndef WIDGET_H #define WIDGET_H #include <QPixmap> #include <QImage> ...

  9. VPS的centOS6安装远程桌面

    VPS的centOS6安装远程桌面 64位系统的需要编译安装 ttp://www.landui.com/help/Show-991.html xrdp是在图形界面下使用的,首先要确定您的centos系 ...

  10. 26.SpringBoot事务注解详解

    转自:https://www.cnblogs.com/kesimin/p/9546225.html @Transactional spring 事务注解 1.简单开启事务管理 @EnableTrans ...