This is blog will help you to disable the SharePoint or Office 365 buttons from the ribbon menu using basic css and see the below instructions .
Option1
I would suggest you If you can edit the master page and add the following CSS, you can hide both words. This will only impact pages using the master page, so it will not impact "modern UI" pages
Option 2
Add script file to your master page with below code. To hide Office 365 & SharePoint buttons from the ribbon.
Option1
I would suggest you If you can edit the master page and add the following CSS, you can hide both words. This will only impact pages using the master page, so it will not impact "modern UI" pages
// add this below code in your css file .o365cs-nav-brandingText { display:none !important; }
Option 2
Add script file to your master page with below code. To hide Office 365 & SharePoint buttons from the ribbon.
// add this below code in your css file .o365cs-rsp-tn-hideIfAffordanceOn {display: none;}