cms = ["say", "man"]
Bs = "This is command"
for l in cms:
if l in Bs:
bs = Bs.replace(l, l.upper())
print(bs)
import re
pattern = ''.join(rf'\b{word}\b|' for word in cms)[:-1]
pattern = f'({pattern})'
def repl(match):
return match.group(1).upper()
bs = re.sub(pattern, repl, Bs)
print(bs)