HashiCorp interview question

Find multiple approach to a problem statement and execute one which takes less time to execute. Problem statement: Find substring from given string.