I need to write a program that identifies a lowercase letter surrounded by three uppercase letters on each side.
For example:
"AEIoSDE" == "o"
I wrote the code as follows:
# coding: utf-8
letra = raw_input()
for i in range(1, len(letra) - 7):
if letra[i].isupper() and not letra[i-1].isupper():
if letra[i+1].isupper():
if letra[i+2].isupper():
if letra[i+3].islower():
if letra[i+4].isupper():
if letra[i+5].isupper():
if letra[i+6].isupper() and not letra[i+7].isupper():
print letra[i+3]
I just need to do this for a massive amount of data, so I saved it to a .txt
file and entered the Linux terminal and typed:
python criptografia.py < entrada.txt
But it returns only one letter and does not read the other strings.
How can I resolve?