public static int getTotalTimeQueue(List<Character>tasks, int cooldown) {
		Queue<Integer>q1=new ArrayDeque<>();
		Queue<Character>q2=new ArrayDeque<>();
		int ct=0;
		for (Character c:tasks) {
			Iterator<Integer> iter1=q1.iterator();
			Iterator<Character>iter2=q2.iterator();
			boolean delay=false;
			for (;iter2.hasNext()&&!delay;) {
				int t=iter1.next();
				if (iter2.next().equals(c)) {
					ct=t+cooldown+1;
					delay=true;
				}
			}
			if (!delay)
				++ct;
			
			while (!q1.isEmpty()&&q1.peek()<ct-cooldown) {
				q1.poll();
				q2.poll();
			}
			
			q1.offer(ct);
			q2.offer(c);
		}
		
		return ct;
	}