
import re


'''
Hint:
One small letter surrounded by EXACTLY three big bodyguards on each of
its sides.
'''


def main():
    with open('bodyguard.txt', 'r') as bodyguard:
        pattern = re.compile(r'[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]')
        littles = ''
        text = bodyguard.read()
        littles = re.findall(pattern, text)

    print(''.join(littles))
    return 0

# Keyword: linkedlist


if __name__ == '__main__':
    main()


import re


def main():
    '''
    Hint:
    One small letter surrounded by EXACTLY three big bodyguards on each of
    its sides.
    Page source text saved in bodyguard.txt
    '''
    with open('bodyguard.txt', 'r') as bodyguard:
        pattern = re.compile(r'[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]')
        littles = ''
        text = bodyguard.read()
        littles = re.findall(pattern, text)

    print(''.join(littles))
    return 0


if __name__ == '__main__':
    main()

Refactor code, add hints from page
Refactor code, add hints from page

  
  import re
  
  
- '''
- Hint:
- One small letter surrounded by EXACTLY three big bodyguards on each of
- its sides.
- '''
- 
- 
  def main():
+     '''
+     Hint:
+     One small letter surrounded by EXACTLY three big bodyguards on each of
+     its sides.
+     Page source text saved in bodyguard.txt
+     '''
      with open('bodyguard.txt', 'r') as bodyguard:
          pattern = re.compile(r'[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]')
          littles = ''
          text = bodyguard.read()
          littles = re.findall(pattern, text)
  
      print(''.join(littles))
      return 0
  
- # Keyword: linkedlist
- 
  
  if __name__ == '__main__':
      main()
  
Refactor code, add hints from page
## Code Before:

import re


'''
Hint:
One small letter surrounded by EXACTLY three big bodyguards on each of
its sides.
'''


def main():
    with open('bodyguard.txt', 'r') as bodyguard:
        pattern = re.compile(r'[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]')
        littles = ''
        text = bodyguard.read()
        littles = re.findall(pattern, text)

    print(''.join(littles))
    return 0

# Keyword: linkedlist


if __name__ == '__main__':
    main()

## Instruction:
Refactor code, add hints from page
## Code After:

import re


def main():
    '''
    Hint:
    One small letter surrounded by EXACTLY three big bodyguards on each of
    its sides.
    Page source text saved in bodyguard.txt
    '''
    with open('bodyguard.txt', 'r') as bodyguard:
        pattern = re.compile(r'[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]')
        littles = ''
        text = bodyguard.read()
        littles = re.findall(pattern, text)

    print(''.join(littles))
    return 0


if __name__ == '__main__':
    main()
