code to detect word