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. Springboot2.0访问Redis集群

    Redis 是一个开源(BSD许可)的,内存中的数据结构存储系统,它可以用作高性能的key-value数据库.缓存和消息中间件,掌握它是程序员的必备技能,下面是一个springboot访问redis的 ...

  2. 南阳oj 士兵杀敌(二) 题目116 NYOJ 数据结构

     /*士兵杀敌(二) 时间限制:1000 ms  |  内存限制:65535 KB 难度:5 描写叙述 南将军手下有N个士兵.分别编号1到N.这些士兵的杀敌数都是已知的. 小工是南将军手下的军师, ...

  3. 微信小程序实现tab页面切换功能

    wxml <scroll-view scroll-x="true" class="ip_tab_comtainer"> <view class ...

  4. WPF 入门《数据绑定》

    简单而言, 数据绑定是一种关系, 这种关系告诉WPF 从一个源目标对象中提取一些信息, 并且使用该信息设置为目标对象的属性.目标属性总是依赖项属性, 并且通常位于WPF元素中. 然而, 源对象可以是任 ...

  5. PowerApps和Flow,Power BI开发

    为PowerApps和Flow,Power BI开发自定义连接器 作者:陈希章 发表于 2017年12月20日 前言 我在之前用了几篇文章来介绍新一代微软商业应用平台三剑客(PowerApps,Mic ...

  6. 12. ZooKeeper之Java客户端API使用—创建会话。

    转自:https://blog.csdn.net/en_joker/article/details/78686649 客户端可以通过创建一个ZooKeeper(org.apache.zookeeper ...

  7. HttpClient FormUrlEncodedContent System.UriFormatException: 无效的 URI: URI 字符串太长问题解决方案

    1.问题描述: HttpClint 使用FormUrlEncodedContent 调用接口时 报错 System.UriFormatException: 无效的 URI: URI 字符串太长: 2. ...

  8. asp.net mvc 中的自定义验证(Custom Validation Attribute)

    前言

  9. jquery的滚动事件

    $(selector).scroll(function);当滚动到合适的条件下,就触发某个函数. 现在基本就是前端利用AJAX对数据进行拼接操作,渲染进html的DOM结构中.

  10. 第一个Python程序(全面)

    说明:该篇博客是博主一字一码编写的,实属不易,请尊重原创,谢谢大家! 一.Windows系统 1.编写Python程序方式之Sublime文本编辑器: 1>打开sublime,创建hello.p ...