QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#585060#8248. Is Y a Vowel?Amy621AC ✓0ms3808kbC++14496b2024-09-23 18:42:222024-09-23 18:42:23

Judging History

你现在查看的是最新测评结果

  • [2024-09-23 18:42:23]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3808kb
  • [2024-09-23 18:42:22]
  • 提交

answer

#include <iostream>
#include <unordered_map>

using namespace std;
int main() {

    unordered_map<char, int> vowels;

    string in;
    cin >> in;

    int len = in.size();

    for (char ch = 'a'; ch <= 'z'; ch++) {
        vowels[ch] = 0;
    }

    for (int i = 0; i < len; i++) {
        vowels[in[i]]++;
    }

    int sum = vowels['a'] + vowels['e'] + vowels['i'] + vowels['o'] + vowels['u'];
    int sum2 = sum + vowels['y'];

    cout << sum << " " << sum2;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3580kb

input:

asdfiy

output:

2 3

result:

ok single line: '2 3'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

asdeyy

output:

2 4

result:

ok single line: '2 4'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

y

output:

0 1

result:

ok single line: '0 1'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

masiwbtuqcbhfebhiehrfynodgmdujstvivcamakuqsulxjfni

output:

14 15

result:

ok single line: '14 15'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

hbbfiriglpvpzhqgloaezhbbduyeppuydieusencegnaoxigus

output:

17 19

result:

ok single line: '17 19'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

qwerty

output:

1 2

result:

ok single line: '1 2'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3760kb

input:

yyyyy

output:

0 5

result:

ok single line: '0 5'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

asde

output:

2 2

result:

ok single line: '2 2'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

qwqwplkjhgfdsxncmnbvzxc

output:

0 0

result:

ok single line: '0 0'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

aiuoefgh

output:

5 5

result:

ok single line: '5 5'