Aricent Interview Question for Software Engineers
- 0of 0 votes
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.- misterraj.ruchit February 18, 2017 in India
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.
foo = 3;
bar = 4;
Foo and Bar are only two variables used inside the statements so answer is 2.
| Report Duplicate | Flag | PURGE
Aricent Software Engineer Java
Interview Type: Written Test
Open Chat in New Window