remove SLASH on single_post but KEEP on categories and parent pages

My current permalink structure is  /%category%/%postname%/  which produce urls as:
(category_base removed using "FV Top Level Categories" Plugin)

category: example.com/class-10/science/    ◀▬ SLASH is GOOD for directories & ↙ parent pages     page: example.com/legal/      post: example.com/class-10/science/ch-1-atoms/    ◀▬ but BAD for single_post, ↖ child pages &     page: example.com/legal/terms/     page: example.com/about/    ◀▬ standalone pages 

So, I want to
keep TRAILING SLASH "/" on:

  • categories and child categories
  • parent pages

remove TRAILING SLASH "/" on:

  • single_posts
  • standalone page (who don’t have any child pages)
  • child pages

AND "301" Redirect  "/"  version of these ↖ pages to NON  "/"  version pages