Anton and Letters

Practice this coding question on Coding Gurukul.

Problem statement

A classroom whiteboard records a set of letter tiles using braces and comma-separated entries. Students sometimes list the same tile letter more than once. The inventory assistant needs the number of different lowercase letters present, not the number of written entries. Whitespace and punctuation belong to the notation and must not be treated as tiles. Your task Read the entire line, which has the form {a, b, c} or {} for an empty collection. Count the distinct lowercase English letters appearing inside it. Ignore braces, commas and spaces. Print a single integer for the number of different letters. Important details The empty collection has size zero. Repeated letters count once even when separated by other entries. Reading only the first whitespace-delimited token would lose part of the collection. Worked example The line {a, c, a, z} contains three different letters: a, c and z. Its inventory size is 3.

Input format

One line containing the brace-delimited collection.

Output format

Print the number of distinct lowercase letters.

Constraints

Line length is 2..1000; entries, if any, are lowercase English letters.

Sample input

{a, c, a, z}

Sample output

3

Sign in to run or submit a solution in C++, Java or Python.