EDIT - Edit Distance Again

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.


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


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




hide comments
daman007: 2017-05-12 21:53:43

Number of testcases is not given here, So can anyone tell me how can I stop taking input

cake_is_a_lie: 2017-03-03 20:27:55

The statement is of very poor quality, but got AC first try so it's not bugged.

vivek4434: 2017-02-22 15:52:02

Again and again it is showing WA ??
same type of problem I solved on codechef was accepted in one Go :/

Last edit: 2017-02-22 15:52:15
apurvgs: 2017-01-24 15:25:34

Last edit: 2017-01-24 15:51:15
dwij28: 2016-06-27 00:10:35

This is not even remotely a DP problem. Pure Ad-hoc.

epsilon: 2016-02-27 17:36:45

it's an insult to dp if this belongs to dp category !!! :P

vedang: 2015-12-01 12:52:40

Why is this problem even tagged as DP? It's should be ad-hoc.

Karun : 2015-10-22 23:34:51

dont know why using toupper/tolower is giving WA... but comparing by ASCII value works... wierd

sharad mahajan: 2015-09-17 21:00:26

give syntax of eof

SangKuan: 2015-07-11 11:59:25

every test right,but still got ac

Added by:Paulo Costa
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64