C - Haiku

Problem description

Haiku is a genre of Japanese traditional poetry.

A haiku poem consists of 17 syllables split into three phrases, containing 5, 7 and 5 syllables correspondingly (the first phrase should contain exactly 5 syllables, the second phrase should contain exactly 7 syllables, and the third phrase should contain exactly 5 syllables). A haiku masterpiece contains a description of a moment in those three phrases. Every word is important in a small poem, which is why haiku are rich with symbols. Each word has a special meaning, a special role. The main principle of haiku is to say much using a few words.

To simplify the matter, in the given problem we will consider that the number of syllable in the phrase is equal to the number of vowel letters there. Only the following letters are regarded as vowel letters: "a", "e", "i", "o" and "u".

Three phases from a certain poem are given. Determine whether it is haiku or not.

Input

The input data consists of three lines. The length of each line is between 1 and 100, inclusive. The i-th line contains the i-th phrase of the poem. Each phrase consists of one or more words, which are separated by one or more spaces. A word is a non-empty sequence of lowercase Latin letters. Leading and/or trailing spaces in phrases are allowed. Every phrase has at least one non-space character. See the example for clarification.

Output

Print "YES" (without the quotes) if the poem is a haiku. Otherwise, print "NO" (also without the quotes).

Examples

Input

on  codeforces 
beta round is running
a rustling of keys

Output

YES

Input

how many gallons
of edo s rain did you drink
cuckoo

Output

NO
解题思路:只要符合俳句(由“五-七-五”,共十七字音组成,题目要求这些字音是必须都是元音字母)就输出"YES",否则输出"NO",java水过!
AC代码:
 1 import java.util.Scanner;
 2 public class Main {
 3     final static char[] obk={'a','e','i','o','u'}; 
 4     public static void main(String[] args) {
 5         Scanner scan = new Scanner(System.in);
 6         String[] s1=scan.nextLine().split(" ");
 7         String[] s2=scan.nextLine().split(" ");
 8         String[] s3=scan.nextLine().split(" ");
 9         int n1=r(s1,0),n2=r(s2,0),n3=r(s3,0);
10         if(n1==5&&n2==7&&n3==5)System.out.println("YES");
11         else System.out.println("NO");
12     }
13     public static int r(String[] s,int n){
14         for(int i=0;i<s.length;++i){
15             for(int j=0;j<s[i].length();++j){
16                 for(int k=0;k<5;++k)
17                     if(s[i].charAt(j)==obk[k])n++;
18             }    
19         }
20         return n;
21     }
22 }
 
  

转载于:https://www.cnblogs.com/acgoto/p/9180924.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值