-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
69 lines (60 loc) · 1.41 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
using namespace std;
int main()
{
int n=0, len=0, ans=0, ans2=0, K, E, Y;
bool f = true;
//string st;
//st ="Joyce enjoyed eating pancakes with ketchup. Going from child, to childish, to childlike is only a matter of time. There were three sphered rocks congregating in a cubed room."
char arr[] = "Joyce enjoyed eating pancakes with ketchup using a key. Going from child, to childish, to childlike is only a matter of time. There were three sphered rocks congregating in a cubed room.";
len = strlen(arr);
cout<<len<<endl;
for(int i=0; i<len; i++)
{
if(arr[i] == ' ')
{
ans++;
}
}
for(int i=0; i<len; i++)
{
if(arr[i] == '.')
{
ans2=i;
break;
}
}
for(int i=0; i<len; i++)
{
if(arr[i] == 'k')
{
K++;
}
if(arr[i] == 'e')
{
E++;
}
if(arr[i] == 'y')
{
Y++;
}
}
cout<<ans<<endl;
cout<<ans2<<endl;
if(K>1)
{
cout<<"K"<<endl;
}
if(E>1)
{
cout<<"E"<<endl;
}
if(Y>1)
{
cout<<"Y"<<endl;
}
return 0;
}