Menu

Hackerrank > Algorithms > Strings > String Construction

January 7, 2017 - Hackerrank

Language: Python

import sys

n = int(raw_input().strip())
for a0 in xrange(n):
    s = raw_input().strip()
    pset = set()
    p = ''
    res = 0
    for i in s:
        if i not in pset:
            res += 1
            pset.add(i)
    print res

(114)

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on VK

Author of this post : Unknown Author

Leave a Reply

Your email address will not be published. Required fields are marked *