Code not working properly

Why this code is giving wrong output?

#include<bits/stdc++.h>
using namespace std;
template
int s(T arr[],int n,T key){
for(int i=0;i<n;i++){
if(arr[i]==key){
return i;
}
return -1;
}
}
int main(){
string a[]={“Mango”,“Apple”,“Banana”,“Kiwi”,“Orange”};
int l=sizeof(a)/sizeof(int);
string k=“Kiwi”;
cout<<s(a,l,k)<<endl;

return 0;
}

@sasanand786
return -1 outside for loop.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.