Hello all, 

Thanks in advance, please help me to finish this assignment

You are given a string S consisting of letters 'a' and 'b'. You want to 
split it into three separate non-empty parts. The lengths of the parts can 
differ from one another. In how many ways can you split S into three parts, 
such that each part contains the same number of letters 'a'?

Write a program that accepts a string as a parameter from the command 
prompt and print an integer value as an output. Given a string S of length 
N, returns the number of possible ways of splitting S as described above.

1. Given S='babaa', the function should return 2. The possible splits are: 
'ba | ba | a' and 'bab | a | a'.

2. Given S='ababa', the function should return 4. The possible splits are 
'a | ba | ba','a| bab | a', 'ab | a | ba' and 'ab | ab | a'.

 3. Given S='aba', the function should return 0. It is impossible to split 
S as required.

4. Given S='bbbbb', the function should return 6. The possible splits are: 
'b | b | bbb', 'b| bb | bb', 'b | bbb | b', 'bb | b | bb', 'bb | bb | b' 
and 'bbb | b | b'. Each part contains the same number of letters 'a' that 
is 0 *

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/54fe7695-efa4-467e-84be-6cf28adfda62n%40googlegroups.com.

Reply via email to