#!/usr/bin/python3

import sys
import re
import heapq

def checkBaB(AbAs,strings):
    resCheck = False
    for local in AbAs:
        resAba = False
        for aba in local:
            bab = aba[1] + aba[0] + aba[1] 
            for string in strings:
                if bab in string:
                    resAba = True 
                    return True
                    break
            if resAba == True:
                break
    return resCheck


def findAbA(strings):
    abas = []
    for string in strings:
        local = []
        for idL in range(len(string)-2):
            if string[idL] != string[idL+1] and string[idL] == string[idL+2]:
                local.append(string[idL:idL+3])
        if len(local) > 0:
            abas.append(local)
    return abas

if __name__ == "__main__":
    fo = open(sys.argv[1],"r")
    lines = fo.readlines()

    cpt = 0
    for line in lines:
        line = line.strip()
        #get the hypernets
        hypernets = re.findall("\[([a-z]+)\]",line)
        #get the rest
        strings = re.sub(r"\[[a-z]+\]",".",line).split(".")
        abas = findAbA(strings)
        if len(abas) > 0:
            if checkBaB(abas,hypernets) == True:
                cpt += 1
                print(line)
                print(abas)
    print(cpt)

5b5e00142c27ef8174582cb72c496f75299e1992
<mask token>


def checkBaB(AbAs, strings):
    resCheck = False
    for local in AbAs:
        resAba = False
        for aba in local:
            bab = aba[1] + aba[0] + aba[1]
            for string in strings:
                if bab in string:
                    resAba = True
                    return True
                    break
            if resAba == True:
                break
    return resCheck


<mask token>

<mask token>


def checkBaB(AbAs, strings):
    resCheck = False
    for local in AbAs:
        resAba = False
        for aba in local:
            bab = aba[1] + aba[0] + aba[1]
            for string in strings:
                if bab in string:
                    resAba = True
                    return True
                    break
            if resAba == True:
                break
    return resCheck


def findAbA(strings):
    abas = []
    for string in strings:
        local = []
        for idL in range(len(string) - 2):
            if string[idL] != string[idL + 1] and string[idL] == string[idL + 2
                ]:
                local.append(string[idL:idL + 3])
        if len(local) > 0:
            abas.append(local)
    return abas


<mask token>

<mask token>


def checkBaB(AbAs, strings):
    resCheck = False
    for local in AbAs:
        resAba = False
        for aba in local:
            bab = aba[1] + aba[0] + aba[1]
            for string in strings:
                if bab in string:
                    resAba = True
                    return True
                    break
            if resAba == True:
                break
    return resCheck


def findAbA(strings):
    abas = []
    for string in strings:
        local = []
        for idL in range(len(string) - 2):
            if string[idL] != string[idL + 1] and string[idL] == string[idL + 2
                ]:
                local.append(string[idL:idL + 3])
        if len(local) > 0:
            abas.append(local)
    return abas


if __name__ == '__main__':
    fo = open(sys.argv[1], 'r')
    lines = fo.readlines()
    cpt = 0
    for line in lines:
        line = line.strip()
        hypernets = re.findall('\\[([a-z]+)\\]', line)
        strings = re.sub('\\[[a-z]+\\]', '.', line).split('.')
        abas = findAbA(strings)
        if len(abas) > 0:
            if checkBaB(abas, hypernets) == True:
                cpt += 1
                print(line)
                print(abas)
    print(cpt)

import sys
import re
import heapq


def checkBaB(AbAs, strings):
    resCheck = False
    for local in AbAs:
        resAba = False
        for aba in local:
            bab = aba[1] + aba[0] + aba[1]
            for string in strings:
                if bab in string:
                    resAba = True
                    return True
                    break
            if resAba == True:
                break
    return resCheck


def findAbA(strings):
    abas = []
    for string in strings:
        local = []
        for idL in range(len(string) - 2):
            if string[idL] != string[idL + 1] and string[idL] == string[idL + 2
                ]:
                local.append(string[idL:idL + 3])
        if len(local) > 0:
            abas.append(local)
    return abas


if __name__ == '__main__':
    fo = open(sys.argv[1], 'r')
    lines = fo.readlines()
    cpt = 0
    for line in lines:
        line = line.strip()
        hypernets = re.findall('\\[([a-z]+)\\]', line)
        strings = re.sub('\\[[a-z]+\\]', '.', line).split('.')
        abas = findAbA(strings)
        if len(abas) > 0:
            if checkBaB(abas, hypernets) == True:
                cpt += 1
                print(line)
                print(abas)
    print(cpt)

#!/usr/bin/python3

import sys
import re
import heapq

def checkBaB(AbAs,strings):
    resCheck = False
    for local in AbAs:
        resAba = False
        for aba in local:
            bab = aba[1] + aba[0] + aba[1] 
            for string in strings:
                if bab in string:
                    resAba = True 
                    return True
                    break
            if resAba == True:
                break
    return resCheck


def findAbA(strings):
    abas = []
    for string in strings:
        local = []
        for idL in range(len(string)-2):
            if string[idL] != string[idL+1] and string[idL] == string[idL+2]:
                local.append(string[idL:idL+3])
        if len(local) > 0:
            abas.append(local)
    return abas

if __name__ == "__main__":
    fo = open(sys.argv[1],"r")
    lines = fo.readlines()

    cpt = 0
    for line in lines:
        line = line.strip()
        #get the hypernets
        hypernets = re.findall("\[([a-z]+)\]",line)
        #get the rest
        strings = re.sub(r"\[[a-z]+\]",".",line).split(".")
        abas = findAbA(strings)
        if len(abas) > 0:
            if checkBaB(abas,hypernets) == True:
                cpt += 1
                print(line)
                print(abas)
    print(cpt)
