Hacker News new | ask | show | jobs
by matheusmoreira 878 days ago
Make it infinite times and stop after the output stabilizes to a constant string!
1 comments

I think this is actually a correct solution. Although not particularly elegant or efficient. If as long as if the string is unsafe the string will be modified. Then looping infinitely will never return an unsafe string. If it is also true that the modifications only delete characters then you will eventually arrive at a safe (or empty) string.