# 스택 정렬하기
## 문제
여분의 스택을 사용하여, 스택 A를 정렬된 상태 B로 만드시오.
```
| | | |
| 3 | | 0 |
| 1 | | 1 |
| 6 | | 2 |
| 5 | | 3 |
| 0 | | 4 |
| 2 | | 5 |
| 4 | | 6 |
----- -----
A -> B
```
## 뼈대코드
```
import java.util.Stack;
/**
* Sorting
*/
public class Sorting {
public static void main(String[] args) {
Stack<Integer> stack = new Stack<Integer>();
int[] numbers = { 4, 2, 0, 5, 6, 1, 3 };
for (int n : numbers) {
stack.push(n);
}
Stack<Integer> sortedStack = sort(stack);
prettyPrint(sortedStack);
}
private static Stack<Integer> sort(Stack<Integer> input) {
Stack<Integer> output = new Stack<Integer>();
/* 해당 알고리즘을 구현하시오. */
return output;
}
private static void prettyPrint(Stack<Integer> stack) {
System.out.println("| |");
while (!stack.isEmpty()) {
System.out.printf("| %d |\n", stack.pop());
}
System.out.println("-----");
}
}
```
## 출력 예
```
| |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
-----
```