fork download
  1. import itertools
  2. c = 0
  3. for s in itertools.permutations('aaabbcc'):
  4. s0 = s[0]
  5. for s1 in s[1:]:
  6. if s0 == s1:
  7. break
  8. s0 = s1
  9. else:
  10. c += 1
  11. print(c)
  12.  
Success #stdin #stdout 0.09s 8888KB
stdin
Standard input is empty
stdout
912