Is this what you mean?
text = raw_input ('Enter a text:') count_a = 0 count_b = 0 count_c = 0 for letter in text: if letter == 'a': count_a += 1 if letter == 'b': count_b += 1 if letter == 'c': count_c += 1 if count_a > count_b and count_c: print 'a' elif count_b > count_a and count_c: print 'b' elif count_c > count_a and count_b: print 'c' else print 'balanced'