Using Facebook on a public computer, or even on a friend's computer, can be risky. Facebook stores a cookie in the browser that enables the user to get into the site without actually logging in. This would make it possible for someone else to easily gain access to your account. Instead of avoiding Facebook entirely, there is a way you can still use it and prevent someone else from being able to get in — by using a one-time password.
In order to make use of one-time passwords, you'll have to have a registered mobile phone number in Facebook. Then, when you want to sign in somewhere, just text "OTP" to 32665. Facebook will reply with a unique 6-character temporary password. Just type that password into the login section of Facebook. After you're logged in, that password cannot be used again.
An even better way to secure your Facebook account is to turn on two-factor authentication. You can enable this by going to Settings > Security and Login after you sign into Facebook. There are several authentication methods you can use when logging in from an unrecognized computer or device, including text message, a code generator, codes from a third party app, approving the login from a recognized device, or using a printed recovery code.