forked from SharmaManish/Spoj
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEDIT.cpp
More file actions
64 lines (42 loc) · 1.11 KB
/
EDIT.cpp
File metadata and controls
64 lines (42 loc) · 1.11 KB
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
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cctype>
using namespace std;
int main()
{
char s[1010];
while(scanf("%s",s) !=EOF)
{
int len=strlen(s);
int count=0;
char c='a';
for(int i=0;i<len;i++)
{
if(isupper(s[i]) && c=='a')
count++;
else if(islower(s[i]) && c=='A')
count++;
if(c=='A')
c='a';
else if(c=='a')
c='A';
}
c='A';
int count2=0;
for(int i=0;i<len;i++)
{
if(isupper(s[i]) && c=='a')
count2++;
else if(islower(s[i]) && c=='A')
count2++;
if(c=='A')
c='a';
else if(c=='a')
c='A';
}
(count<count2)?printf("%d\n",count):printf("%d\n",count2);
}
system ("pause");
return 0;
}