Added solution for alternating characters