String challenge

[pair<string, string> strPair[100];]:-What does this statement does and when & where it should be used and also why it is used???
2.int convertToInt(string s) {
int ans = 0;
int p = 1;
for (int i = s.length() - 1; i >= 0; i–) {
ans += ((s[i] - ‘0’) * p);
p = p * 10;
}
return ans;
I can’t understand what is happening here Please explain this??
3.key1 = s1.second;
key2 = s2.second;
what does .second means here??

hey Gauarav,

  1. pair<string,string> can hold two strings at a time, where .first and .second is used to reference both strings.
  2. a string “48” can be converted to int by – 81 + 410, this is how its implemented.
  3. answer is in 1.

what about s1.second s2.seco

if we want to compare triplets so we can use triplet<string,string,string>is it same or different??

no pair is inbuilt container type whereas triplet is not. however you can define structure as
struct triplet{
string first,second,third;
};