-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1263.cpp
40 lines (37 loc) · 841 Bytes
/
1263.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
#include<bits/stdc++.h>
using namespace std;
int main()
{
char s[1000000];
while(~scanf(" %[^\n]",s))
{
char *p=strtok(s," ");
vector<string>v;
while(p!=0)
{
char q[10006];
sscanf(p," %s",q);
p=strtok(NULL," ");
v.push_back(q);
}
int cont=0;
char c=tolower(v[0][0]);
int flag=0;
for(int i=1;i<v.size();i++)
{
char q=tolower(v[i][0]);
if(c==q && flag==0)
{
cont++;
flag=1;
}
else if(c!=q)
{
c=q;
flag=0;
}
}
printf("%d\n",cont);
}
return 0;
}