-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoj1427.java
More file actions
25 lines (24 loc) · 733 Bytes
/
Boj1427.java
File metadata and controls
25 lines (24 loc) · 733 Bytes
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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Boj1427 {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String N = br.readLine();
int[] arr = new int[N.length()];
for(int i=0; i<N.length();i++) {
arr[i] = Character.getNumericValue(N.charAt(i));
}
Arrays.sort(arr);
int[] reverseArr = new int[arr.length];
for(int i=reverseArr.length-1, j=0 ; i>=0 ;i--,j++) {
reverseArr[j] = arr[i];
}
String num = "";
for(int i =0 ; i<arr.length;i++) {
num+=reverseArr[i];
}
System.out.println(num);
}//main
}//class