It is the mark of an educated mind to be able to entertain a thought without accepting it.
Do you allow yourself to entertain impure thoughts?
Sinful acts begin as attitudes or temptations in your mind and emotions.
For from within, out of men's hearts, come evil thoughts, sexual immorality, theft, murder, adultery, greed, malice, deceit, lewdness, envy, slander, arrogance and folly (Mark 7:21-22). Each one is tempted when, by his own evil desire, he is dragged away and enticed. Then, after desire has conceived, it gives birth to sin; and sin, when it is full-grown, gives birth to death (James 1:14-15). What causes fights and quarrels among you? Don't they come from your desires that battle within you? (James 4:1).  Paul says," I face death everyday." (1 Corinthians 15:31). Impure thoughts are not sin; they become sin when we entertain them. Everybody has impure thoughts of one type or another. That's part of the package of being alive. Having an impure thought come into your mind is not a sin by itself; choosing to entertain the thought is a sin. A good guideline is not to allow yourself to consider or dwell on anything God would not want you to do. Don't allow yourself to think about sinning or ways you could go about sinning. Clothe yourselves with the Lord Jesus Christ, and do not think about how to gratify the desires of the sinful nature (Romans 13:14). 
Do you think you can't control your thoughts? If so, you are not alone. Many people think thoughts are like rain—there’s not much we can do about them. But that’s not true. You can discipline your mind and decide what to think about. Make it a habit to think about things that are pure and true. Those who live according to the sinful nature have their minds set on what that nature desires; but those who live in accordance with the Spirit have their minds set on what the Spirit desires (Romans 8:5).
 Finally, brothers, whatever is true, whatever is noble, whatever is right, whatever is pure, whatever is lovely, whatever is admirable—if anything is excellent or praiseworthy—think about such things (Philippians 4:8). It's inevitable that you and I will sin from time-to-time. The Bible tells us to aim for perfection (2 Corinthians 13:11). However, we all come short, and God's Word encourages us not to give up! When we ask the Lord to forgive us, he does!.We all stumble in many ways. If anyone is never at fault in what he says, he is a perfect man, able to keep his whole body in check (James 3:2). If we claim to be without sin, we deceive ourselves and the truth is not in us. If we confess our sins, he is faithful and just and will forgive us our sins and purify us from all unrighteousness. If we claim we have not sinned, we make him out to be a liar and his word has no place in our lives. My dear children, I write this to you so that you will not sin. But if anybody does sin, we have one who speaks to the Father in our defense—Jesus Christ, the Righteous One (1 John 1:8-2:1).