genetic-code

Saurabh is designing the genetic code for a new type of algae to efficiently produce fuel. Specifically, Saurabh is focusing on a stretch of DNA that encodes one protein. The stretch of DNA is represented by a string containing only the characters 'A', 'T', 'G' and 'C'.

Saurabh has determined that if the stretch of DNA contains a maximal sequence of consecutive identical nucleotides that is of even length, then the protein will be nonfunctional. For example, consider a protein described by DNA string "GTTAAAG". It contains four maximal sequences of consecutive identical nucleotides: "G", "TT", "AAA", and "G". The protein is nonfunctional because sequence "TT" has even length.

Saurabh is trying to obtain a functional protein from the protein he currently has. Saurabh can insert additional nucleotides into the DNA stretch. Each additional nucleotide is a character from the set {'A', 'T', 'G', 'C'}. Saurabh wants to determine the minimum number of insertions necessary to make the DNA encode a functional protein.

Input
The input consists of a single line, containing a string s of length n (1 ≤ n ≤ 100). Each character of s will be from the set {'A', 'T', 'G', 'C'}.

Output
The program should print on one line a single integer representing the minimum number of 'A', 'T', 'G', 'C' characters that are required to be inserted into the input string in order to make all runs of identical characters have odd length

SAMPLE INPUT
GTTAAAG

SAMPLE OUTPUT
1

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
s=input()
k=s[0]
c=1
ans=0
for i in range(1,len(s)):
	if s[i]==k:
		c=c+1
	else:
		if c%2==0:
			ans=ans+1
		c=1
	k=s[i]
if c%2==0:
	ans=ans+1
print(ans)