No one should share his/her Accepted solution during a live contest.
However, suppose someone shares an accepted solution during the live contest to his friends or public telegram channels. In that case, good people should feed the code to a plagiarism checker[currently we don't have such functionality on codeforces MikeMirzayanov ].
The plagiarism checker will easily find the original author and others who copied the code. It is similar to hacking post-contest, but we submit plags during a live contest here. There should be a reward for the first plag finder.
This will surely discourage solution-sharing during live contests.