All Tracks Algorithms String Algorithms Basics of String Manipulation Problem

Lexical Analyzer
Tag(s):

Ad-Hoc, Easy, String Algorithms, approved

Problem
Editorial
Analytics

Alex has recently decided to learn about how to design compilers. As a first step he needs to find the number of different variables that are present in the given code.

So Alex will be provided $$N$$ statements each of which will be terminated by a semicolon(;). Now Alex needs to find the number of different variable names that are being present in the given statement. Any string which is present before the assignment operator denotes to a variable name.

Input Format: :

The first line contains a single integer $$N$$.

Each of the next $$N$$ lines contains a single statement.

It is guaranteed that all the given statements shall be provided in a valid manner according to the format specified.

Output Format: :

Print the number of different variable name that are present in the given statements.

Constraints: :

$$ 1 \le N \le 10^5 $$

$$ 1 \le |Statement| \le 100$$

SAMPLE INPUT
2
foo = 3;
bar = 4;
SAMPLE OUTPUT
2
Explanation

Foo and Bar are only two variables used inside the statements so answer is 2.

Time Limit: 2.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

Alacriti Infosystems

Challenge Name

Alacriti Fresher Hiring Challenge

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications