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bqnkMllUmHzLvEuSarSlNlNHsWvYlfhjMEA
epYTjoRGZeAAtURFeDfDxTYmOmONuQQBdcdncFGjhHmKlwqmUWoXuIXIxaaXnNThgPGtIlynrUIPLQTG
xXhattDrfBGbZRveKbgjzxJLdYREQlMeLtcIEUoyJocdAfUbymxuFLVjGkOQniiPParqoyQYfDYAQTkM
WLicLxpEFkBbwlKrTyYilKTtYkpVGxtOjYmcBDOrwFhFiGutmpTyTarUbVUeSevBTdaPDpjRkaEmLJMg
WsMhSGfIcBChcqrRKgKpjvGnFipjswgjetRtniMagakbCXAjpzWTtMlgZGCJwGyglpcLebrKWhgwJfWV
qGifWNEpCtjuejHoyVCdIxzMYGnfoslgTNAJdtVBWDVoGLzHSAVBTnhNIvAOExQNiJOIPPiHkdaRbfaP
ixDDoCDOOeAqvQJFxLWDICfGmufyxmaMshbvcrtjqqVtffZTnbtCOQfzRMGwOQEKaAmSWjnYdNgvdkmd
dQmaKZSdqKNrnvJlcyVMKuNWmuoOeyKecgjXbmSqnpjwJEaDYoehEklEgJyiksGxdEKgfYRXQecRZgfe
qKWGc'''

countA = 0  # 统计前边的大写字母
countB = 0  # 统计小写字母
countC = 0  # 统计后边的大写字母
lengch = len(str1)      # 统计字符串的长度
# print(lengch)

for i in range(lengch):     # 取出每个字母
    if str1[i] == '\n':     # 判断是否是换行符
        continue            # 判断为换行符，跳过本次循环，进行下次循环

    '''
    | 如果str1[i]是大写字母：
    |-- 如果已经出现小写字母：
    |-- -- 统计后边的大写字母
    |-- 如果未出现小写字母：
    |-- -- 清空后边大写字母的统计
    |-- -- 统计前边的大写字母
    '''
    if str1[i].isupper():   # 判断取出的字母是大写时，执行判断体内语句
        if countB:          # 判断是否记录小写字母，
            countC += 1     # 记录了小写字母，统计后边的大写字母
        else:               # 没有记录小写字母
            countC = 0      # 清空统计后边的大写字母
            countA += 1     # 统计前边的大写字母

    '''
    如果str[i]是小写字母：
    |-- 如果小写字母前边不是三个大写字母（不符合条件）：
    |-- -- 清空所有记录，重新统计
    |-- 如果小写字母前边是三个大写字母（符合条件）：
    |-- -- 如果已经存在小写字母：
    |-- -- -- 清空所有记录，重新统计（出现两个小写字母）
    |-- -- 如果该小写字母是唯一的：
    |-- -- -- countB记录出现小写字母，准备开始统计countC
    '''
    if str1[i].islower():   # 判断取出的字母时小写的，执行判断体内语句
        if countA != 3:     # 判断前边的字母不是3个大写字母，不符合条件，countA、B、C清空，重新统计
            countA = 0
            countB = 0
            countC = 0
        else:               # 满足前边的字母时3个大写字母，满足条件
            if countB:      # 判断是否已经存在小写字母，存在就清空统计
                countA = 0
                countB = 0
                countC = 0
            else:           # 不存在小写字母，小写字母存入countB里面
                countB = 1
                countC = 0
                target = 1

    '''
    |如果前边和后边都是大写字母：
    |-- 如果后边第四个字母也是大写字母（不符合条件）：
    |-- -- 清空记录B和C，重新统计
    |-- 如果后边仅有三个大写字母（符合所有条件）：
    |-- -- 打印结果，并清空所有记录，进入下一轮统计
    '''
    if countA == 3 and countC == 3:
        if i+1 != lengch and str1[i+1].isupper():
            countB = 0
            countC = 0
        else:
            print(str1[target],end='')
            countA = 3
            countB = 0
            countC = 0