I want to extract website names from the url. For e.g. <https://plus.google.com/in/test.html>
should give the output as - "plus google" 

Some more testcases are - 

1. WWW.OH.MADISON.STORES.ADVANCEAUTOPARTS.COM/AUTO\_PARTS\_MADISON\_OH\_7402.HTML

Output:- OH MADISON STORES ADVANCEAUTOPARTS

2. WWW.LQ.COM/LQ/PROPERTIES/PROPERTYPROFILE.DO?PROPID=6054

Output:- LQ

3. WWW.LOCATIONS.DENNYS.COM

Output:- LOCATIONS DENNYS

4. WV.WESTON.STORES.ADVANCEAUTOPARTS.COM

Output:- WV WESTON STORES ADVANCEAUTOPARTS

5. WOODYANDERSONFORDFAYETTEVILLE.NET/

Output:- WOODYANDERSONFORFAYETTEVILLE

6. WILMINGTONMAYFAIRETOWNCENTER.HGI.COM

Output:- WILMINGTONMAYFAIRETOWNCENTER HGI

7. WHITEHOUSEBLACKMARKET.COM/

Output:- WHITEHOUSEBLACKMARKET

8. WINGATEHOTELS.COM

Output:- WINGATEHOTELS

```
string = str(input("Enter the url "))
new_list = list(string)
count=0
flag=0

if 'w' in new_list:
    index1 = new_list.index('w')
    new_list.pop(index1)
    count += 1
if 'w' in new_list:
    index2 = new_list.index('w')
    if index2 != -1 and index2 == index1:
        new_list.pop(index2)
        count += 1
if 'w' in new_list:
    index3= new_list.index('w')
    if index3!= -1 and index3== index2 and new_list[index3+1]=='.':
        new_list.pop(index3)
        count+=1      
        flag = 1
if flag == 0:
    start = string.find('/')
    start += 2
    end = string.rfind('.')

    new_string=string[start:end]
    print(new_string)
elif flag == 1:
    start = string.find('.')
    start = start + 1
    end = string.rfind('.')

    new_string=string[start:end]
    print(new_string)

```

The above works for some testcases but not all. Please help me with it. 

Thanks