If I understand you correctly you've got part 1 sorted.

The first part of part 2 is easy enough. Just compare name1 with name2, and name2 with name3, and if both equality tests are true then the three strings are identical.

The second part is a little more involved, but not difficult. First you need to parse the *.*.#.* string (let's call it str) to find out which parts are * and which parts are #. This could be as easy as just looking at str[0], str[2], str[4] and str[6], and I'd probably do it as follows:
Code:
```if (str[0]=='#')
{
//  compare first bit
}
if (str[2]=='#')
{
// compare second bit
}```
and I'll leave it to you to figure out the 3rd and 4th parts of that.

For the comparison, one approach could be to count the dots to find the location of substrings, then use strncmp to compare a fixed length string; let's say we've worked out for the 3rd part of name1 that name1part3start=17 and n1len=6 (count the characters: name1="government.india.public.property")

and to make things a bit more difficult let's say name3=rural.india.public.sales, so name3part3start=12 (we don't really need the length, although obviously if n1len!=n3len then the strncmp will also fail), we would then do:
Code:
```if (strncmp(&name1[name1part3start], &name3[name3part3start], n1len))
// then they're equal```
Another approach could be to split the strings into vectors of substrings, so for example we would split
name1 into "government" "india" "public" "property" (let's call this vec1). There's probably an STL function to do this. Similarly let's split name3 into "rural" "india" "public" "sales" and call it vec3, then we just do:
Code:
```if (str2[4]=='#' && vec1[2]==vec3[2])
// then they're equal```