New Year and Counting Cards

Posted 给杰瑞一块奶酪~

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了New Year and Counting Cards相关的知识,希望对你有一定的参考价值。

Your friend has n cards.

You know that each card has a lowercase English letter on one side and a digit on the other.

Currently, your friend has laid out the cards on a table so only one side of each card is visible.

You would like to know if the following statement is true for cards that your friend owns: "If a card has a vowel on one side, then it has an even digit on the other side." More specifically, a vowel is one of ‘a‘, ‘e‘, ‘i‘, ‘o‘ or ‘u‘, and even digit is one of ‘0‘, ‘2‘, ‘4‘, ‘6‘ or ‘8‘.

For example, if a card has ‘a‘ on one side, and ‘6‘ on the other side, then this statement is true for it. Also, the statement is true, for example, for a card with ‘b‘ and ‘4‘, and for a card with ‘b‘ and ‘3‘ (since the letter is not a vowel). The statement is false, for example, for card with ‘e‘ and ‘5‘. You are interested if the statement is true for all cards. In particular, if no card has a vowel, the statement is true.

To determine this, you can flip over some cards to reveal the other side. You would like to know what is the minimum number of cards you need to flip in the worst case in order to verify that the statement is true.

Input

The first and only line of input will contain a string s (1 ≤ |s| ≤ 50), denoting the sides of the cards that you can see on the table currently. Each character of s is either a lowercase English letter or a digit.

Output

Print a single integer, the minimum number of cards you must turn over to verify your claim.

Example
Input
ee
Output
2
Input
z
Output
0
Input
0ay1
Output
2
Note

In the first sample, we must turn over both cards. Note that even though both cards have the same letter, they could possibly have different numbers on the other side.

In the second sample, we don‘t need to turn over any cards. The statement is vacuously true, since you know your friend has no cards with a vowel on them.

In the third sample, we need to flip the second and fourth cards.

 

字母卡牌aeiou另一面必须是偶数,这样才是正确的,问最少要揭开多少张牌来验证是否正确,需要验证的就是带aeiou的牌和带奇数的牌(奇数牌另一面不能是aeiou)

代码:

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
int main()
{
    char s[51];
    cin>>s;
    int ans = 0;
    for(int i = 0;i < strlen(s);i ++)
    {
        if(isdigit(s[i]) && s[i] % 2)ans ++;
        else if(s[i] == a || s[i] == e || s[i] == i || s[i] == o || s[i] == u)ans ++;
    }
    cout<<ans;
}

 

以上是关于New Year and Counting Cards的主要内容,如果未能解决你的问题,请参考以下文章

New Year and Domino 二维前缀和

Lunar New Year and a Wander

New Year and Buggy Bot

Codeforces 908 D New Year and Arbitrary Arrangement

CF 750C New Year and Rating(思维题)

New Year and Permutation