Cisco interview question

How to compare two string effectively.(o(n))