Suppose a full path like dir1/dir2/dir3/mydir is supplied during the execution of a shell script where dir1,dir2,dir3 and mydir are directory names. Write a shell script, which creates these directories if they do not exist and change to the last directory in the list. Also check for the possibility that there might exist a file with the same name as any of the directory names present in the supplied path.