Like the situation in the US, Canadian copyright law distinguish ideas, which are not protected, from expression, which is protected. See Deeks v. Wells, OR 818. Person B is not allowed to copy (including copy and modify, copy modify and reproduce) a work produced by person A, so in the lawsuit, A must establish that B did copy. One form of evidence would be a video of B caught red-handed actually copying, but that is not the only way (indeed, it hardly if ever happens). Exact identity could easily establish copying and would be applicable to illegal downloading and other forms of IP piracy. In a case like Deeks, the question is whether two works are similar enough that it constitutes proof of copying.
In literary texts, the probability of coincidental exact identity in two paragraph of 300 words is effectively zero. Changing two or three words doesn't change that, but changing enough words does (e.g. the simultaneous existence of about 10% of words in any two texts of English is virtually guaranteed). The law doesn't have a fixed formula for distinguishing between coincidence and copy, and in Deeks there is much discussion of the expert testimony surrounding the question of copying. An example of a factor relevant to the coincidence / copy question is that certain writing styles are more templatic (see for example legal pleadings) and therefore a higher degree of similarity will arise because the authors have adopted the same abstract style.
Assuming you mean "exactly the same text", and that the text is at least a paragraph of two sentences, it is unreasonable to hold that the two texts are coincidentally the same. However, tweet-identity is fairly likely, not only because of the shortness of a tweet, but also because authors draw on recurring literary memes. If it is possible that B copied from A (the work could have been available to B) and expert analysis of the texts does not make a coincidence analysis reasonable, A would prevail in an infringement case – even if in fact B had written his work independently. B has no way to prove that theirs was an independent creation.