import res = 'puk muk mek kek pok'c = 'p' result, num = re.subn(rf'\b{c}(\S+)\b', lambda m: m[0][::-1], s)print(num, result)
Standard input is empty
2 kup muk mek kek kop
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!