第三题比较简单,One small letter, surrounded by EXACTLY three big bodyguards on each of its sides. 即一个小写字母,两边各有不多不少的三个大写字母。 用正则表达式搞定。
import re
if __name__ == '__main__':
# put the mess from the page source into 3.txt
f = open('3.txt', 'r')
text = f.read()
list = re.findall('[^A-Z][A-Z]{3}[a-z][A-Z]{3}[^A-Z]', text)
print(''.join(x[4:5] for x in list))
f.close();