Minimus set of strings

Problem link-https://hack.codingblocks.com/app/practice/5/1020/problem

In constraints it is defined that size of the string is up to 3.
I am trying to find out the strings ABC and finding out the minimum of the costs. But the below code is not passing a test case. Can you tell me why?

int main() {

int n,res=INT_MAX;
cin>>n;
vector<string> s(n);
for (int i = 0; i <n ; ++i) {
    cin>>s[i];
    sort(s[i].begin(),s[i].end());
}
vector<int> c(n);
for (int i = 0; i < n; ++i) {
    cin>>c[i];
    if(s[i]=="ABC"){

     res=min(res,c[i]);
    }
}
cout<<res<<endl;

}

Can you tell me what is wrong with this code