"""
    Kata source :

        https://www.codewars.com/kata/the-hashtag-generator/train/python

    The marketing team is spending way too much time typing in hashtags.

    Let's help them with our own Hashtag Generator!

    Here's the deal:

        It must start with a hashtag (#).
        All words must have their first letter capitalized.
        If the final result is longer than 140 chars it must return false.
        If the input or the result is an empty string it must return false.

    Examples

        " Hello there thanks for trying my Kata"  =>  "#HelloThereThanksForTryingMyKata"
        "    Hello     World   "                  =>  "#HelloWorld"
        ""                                        =>  false

    Sample Tests :

        Test.describe("Basic tests")
        Test.assert_equals(generate_hashtag(''), False, 'Expected an empty string to return False')
        Test.assert_equals(generate_hashtag('Do We have A Hashtag')[0], '#', 'Expeted a Hashtag (#) at the beginning.')
        Test.assert_equals(generate_hashtag('Codewars'), '#Codewars', 'Should handle a single word.')
        Test.assert_equals(generate_hashtag('Codewars      '), '#Codewars', 'Should handle trailing whitespace.')
        Test.assert_equals(generate_hashtag('Codewars Is Nice'), '#CodewarsIsNice', 'Should remove spaces.')
        Test.assert_equals(generate_hashtag('codewars is nice'), '#CodewarsIsNice', 'Should capitalize first
            letters of words.')
        Test.assert_equals(generate_hashtag('CodeWars is nice'), '#CodewarsIsNice', 'Should capitalize all letters
            of words - all lower case but the first.')
        Test.assert_equals(generate_hashtag('c i n'), '#CIN', 'Should capitalize first letters of words even when
            single letters.')
        Test.assert_equals(generate_hashtag('codewars  is  nice'), '#CodewarsIsNice', 'Should deal with unnecessary
            middle spaces.')
        Test.assert_equals(generate_hashtag('Looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
            oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong Cat'), False,
                'Should return False if the final word is longer than 140 chars.')
"""


def generate_hashtag(s):
    # your code here
    return "#" + s.title().replace(" ", "") if 0 < len(s) <= 140 else False
