import java util Scanner import java util ArrayList public class Econo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import java.util.Scanner;
import java.util.ArrayList;
public class Econom {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
String str = new String ();
ArrayList strs = new ArrayList();
int i=0,j=0,k=0,scan,operand=0,open=0,close=0,f=0;
str=sc.next();
int len=str.length();
for (i=0;i<len-1;i++)
{
if(str.charAt(i)=='@' ||str.charAt(i)=='#' || str.charAt(i)=='$')
{
operand=0;
scan=i+1;
k=1;
open=0;
close=0;
while(operand<2) {
if (str.charAt(scan) == '(') {
open++;
scan++;
k++;
while(close<open)
{
if (str.charAt(scan) == '(')
open++;
if (str.charAt(scan) == ')')
close++;
k++;
scan++;
}
operand++;
}
else{
k++;
scan++;
operand++;
}
}
//System.out.print(i);
//System.out.print("- - - - -");
//System.out.println(scan - 1);
if(j>0)
for(f=0;f<j;f++)
{
if(str.substring(i,scan).equals(strs.get(f)))
{
f=100;
}
}
if(f!=101)
{
strs.add(str.substring(i,scan));
//System.out.println(strs.get(j));
j++;
}
}
}
System.out.println(j);
}
}