def is_cpctf_like(sub): return ( len(sub) == 5 and sub[0] == sub[2] and len(set([sub[0], sub[1], sub[3], sub[4]])) == 4 ) def count_cpctf_like(s): n = len(s) count = 0 for i in range(n - 4): if is_cpctf_like(s[i:i+5]): count += 1 return count # Sample inputs print(count_cpctf_like("NEOSHOWCASE")) # Output: 16 print(count_cpctf_like("PPC")) # Output: 0 print(count_cpctf_like("CPCTFCPCTFCPCTFCPCTFCPCTFCPCTF")) # Output: 4011