def printExpr(inpGrp):
  exprMap={"(0,0)":"ABF","(0,1)":"ABC","(0,2)":"DBC","(0,3)":"DBF","(1,0)":"AEF","(1,1)":"AEC", "(1,2)":"DEC","(1,3)":"DEF"}
  inpGrp = inpGrp.replace("|","")
  tmpExp=[inpGrp[i:i+5] for i in range(0, len(inpGrp), 5)]

  findRepExp=""
  for e in tmpExp:
    findRepExp =  findRepExp + exprMap.get(e);
  if (findRepExp.find("A")!=-1 and findRepExp.find("D")!=-1):
    findRepExp= findRepExp.replace("A","").replace("D","")
  if (findRepExp.find("B")!=-1 and findRepExp.find("E")!=-1):
    findRepExp= findRepExp.replace("B","").replace("E","")
  if (findRepExp.find("C")!=-1 and findRepExp.find("F")!=-1):
    findRepExp= findRepExp.replace("C","").replace("F","")
  from collections import OrderedDict
  findRepExp = "".join(OrderedDict.fromkeys(findRepExp)).replace("D","~A").replace("E","~B").replace("F","~C")
  return findRepExp;

def sortArray(x):
    checkLen = len(x)
    for i in range(checkLen):
        for j in range(i+1,checkLen):
            if len(x[i]) < len(x[j]):
                temp = x[i]
                x[i] = x[j]
                x[j] = temp
    return x

def getGroups(inputBinaryStr):
  totRow, totCols = (2, 4) 
  
  formArray = [[0 for i in range(totCols)] for j in range(totRow)] 
  k=0
 
  for i in range(totRow):
    for j in range(totCols):
      formArray[i][j]=int(inputBinaryStr[k])
      k=k+1
  getGrp=""
  for i in range(totRow):
    for j in range(totCols):
      if(formArray[i][j]==1):
        if(j+1