Generally, the best way to handle this is using the public suffix list: https://publicsuffix.org/
org.hk is an entry in it, which means you should display the next section "up" from that, so that would be hkispa.org.hk as wanted here.
org.hk is an entry in it, which means you should display the next section "up" from that, so that would be hkispa.org.hk as wanted here.
ac.uk: https://github.com/publicsuffix/list/blob/master/public_suff...
go.th: https://github.com/publicsuffix/list/blob/master/public_suff...
For example, the maintainers of .ac.uk should very much care about the owner of "foo.ac.uk" not being able to set a cookie for "bar.ac.uk", which is partly what the PLS is used for!