EDIT - Edit Distance Again

no tags 

 

As any experienced programmer must know the famous problem of "Edit Distance", however this
problem is considered an “alternating chain” if you have alternately made case sensitive.
Example:
"AaAaAbB" "B" "a" "aBaCdEf"
Alternating chains are considered in our problem.
We only have one operation that is permitted in exchange for a lower or upper case Latin letter.
Given a string giving the minimum number of changes to be considered an alternating chain.

 

As any experienced programmer must know the famous problem of "Edit Distance", however this

problem is considered an “alternating chain” if you have alternately made case sensitive.

Example:

"AaAaAbB" "B" "a" "aBaCdEf"

Alternating chains are considered in our problem.

We only have one operation that is permitted in exchange for a lower or upper case Latin letter.

Given a string giving the minimum number of changes to be considered an alternating chain.

 

 

Input

 

A string with no spaces line containing only uppercase and lowercase letters, one for each line of

maximum length 10 ^ 3 until end of file

 

Output

 

For each line print the minimum number of changes to the chain is a "chain alternately"

 

Example

Input:
AaAaB
ABaa
a

Output:
0
2
0

Added by:Paulo Costa
Date:2012-02-01
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel Pentium G860 3GHz)
Languages:All except: SCM chicken
Resource:PUCP

hide comments
sai krishna: 2015-05-20 10:08:11

http://www.codechef.com/FEB15/problems/CHEFCH
similar problem

Jumpy: 2013-12-14 13:14:35

be aware of this case :
AAaAaAA

Somesh Maurya™: 2013-10-27 07:36:34

feeling like a kid.
a trick test case:-
aaAaAa
answer is 1

Pranshul Agarwal: 2012-06-16 04:38:42

some tricky test cases:-
aaAa
AAaAaAA
AAAAAa


o/p:-
1
2
2

Avinash: 2012-04-17 12:44:50

the problem description is not clear and why is it even named "Edit Distance Again"?

Last edit: 2012-04-17 12:45:39
fitcat: 2012-02-26 06:06:25

For those getting WA, note that "exchange" here means "toggle". The only operation allowed is toggling the case of the letters. The resultant string has the same length of the original's.

hibernating: 2012-02-07 15:35:59

why WA?? Every test case give me correct answer....