I want to create a stack of Integer stack. So that I can push a new integer stack in main stack.
How to create it? I have done the following code for that:
import java.util.*;
import java.io.*;
public class Containers{
static Stack<Integer> subStack = new Stack<Integer>();
static Stack<subStack> main = new Stack<subStack>();
public static int addToStatck(char cont){
//for(int j=0;j<)
return 0;
}
public static void main(){
Scanner sc = new Scanner(System.in);
String container = sc.next();
Stack sub = new Stack();
sub.push(container.charAt(0));
main.push(sub);
int ans = 0;
for(int i=0;i<container.length();++i){
ans+=addToStatck(container.charAt(i));
}
}
}
