using System.Collections; using System.Collections.Gene…