brute force implementation *800

Please click on ads to support us..

Python Code:

card={ 'a', 'e', 'i', 'o', 'u'}
a=input()
x=0
for c in a:
	if c in card:
		x+=1
	elif c.isdigit() and int(c)%2==1:
		x+=1
print(x)

C++ Code:

#include <bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std;
int32_t main()
{
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
    string s;cin>>s;
    int cnt=0;
    for(auto x : s){
        if(x=='a' or x=='e' or x=='i' or x=='o' or x=='u'
           or x=='1' or x=='3' or x=='5'
           or x=='7' or x=='9')cnt++;
    }
    cout<<cnt<<endl;
}


Comments

Submit
0 Comments
More Questions

1523B - Lord of the Values
1406C - Link Cut Centroids
2409. Count Days Spent Together
2410. Maximum Matching of Players With Trainers
1604C - Di-visible Confusion
997A - Convert to Ones
218A - Mountain Scenery
486B - OR in Matrix
1405A - Permutation Forgery
1733A - Consecutive Sum
1733B - Rule of League
1733C - Parity Shuffle Sorting
1264A - Beautiful Regional Contest
1695A - Subrectangle Guess
467B - Fedor and New Game
252C - Points on Line
735C - Tennis Championship
992A - Nastya and an Array
554A - Kyoya and Photobooks
79B - Colorful Field
265B - Roadside Trees (Simplified Edition)
1362C - Johnny and Another Rating Drop
1214C - Bad Sequence
1091B - New Year and the Treasure Geolocation
244A - Dividing Orange
1061C - Multiplicity
1312A - Two Regular Polygons
801A - Vicious Keyboard
510B - Fox And Two Dots
616D - Longest k-Good Segment