Implement the function below // return true iff the set of letters in s is same
ID: 3562636 • Letter: I
Question
Implement the function below
// return true iff the set of letters in s is same as the set in t .
// e.g. "tattoo" and "oat" are samesets.
// precondition: s and t contain only lowercase letters {'a'... 'z'}
bool isSameSet(const string &s, const string &t) ;
Do not write the entire program or create any other functions for this problem.
Here is my solution:
bool isSameSet(const string &s, const string &t)
{
int i = 0, j = 0;
int k = s.length()-1;
while(t[i])
{
if(t[i] != s[j])
{
i++;
}
else
{
i++;
j++;
}
}
if(j != k)
{
return false;
}
else
{
return true;
}
}
MyProgrammingLab is not accepting this answer. It also gave me these hints that I should use:
? You almost certainly should be using: '
? You almost certainly should be using: a
? You almost certainly should be using: for
Can someone post the correct solution for this problem?
Explanation / Answer
contact on timacs12@gmail.com