FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-for-coding-test/12/2.java at master · ndb796/python-for-coding-test · GitHub
ndb796
/
python-for-coding-test
Public
Notifications
You must be signed in to change notification settings
Fork
830
Star
2.4k
Code
Issues
129
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-for-coding-test
/
12
/
2.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
37 lines (30 loc) · 1.07 KB
Breadcrumbs
python-for-coding-test
/
12
/
2.java
Copy path
File metadata and controls
37 lines (30 loc) · 1.07 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
java
.
util
.*;
public
class
Main
{
public
static
String
str
;
public
static
ArrayList
<
Character
>
result
=
new
ArrayList
<
Character
>();
public
static
int
value
=
0
;
public
static
void
main
(
String
[]
args
) {
Scanner
sc
=
new
Scanner
(
System
.
in
);
str
=
sc
.
next
();
// 문자를 하나씩 확인하며
for
(
int
i
=
0
;
i
<
str
.
length
();
i
++) {
// 알파벳인 경우 결과 리스트에 삽입
if
(
Character
.
isLetter
(
str
.
charAt
(
i
))) {
result
.
add
(
str
.
charAt
(
i
));
}
// 숫자는 따로 더하기
else
{
value
+=
str
.
charAt
(
i
) -
'0'
;
}
}
// 알파벳을 오름차순으로 정렬
Collections
.
sort
(
result
);
// 알파벳을 차례대로 출력
for
(
int
i
=
0
;
i
<
result
.
size
();
i
++) {
System
.
out
.
print
(
result
.
get
(
i
));
}
// 숫자가 하나라도 존재하는 경우 가장 뒤에 출력
if
(
value
!=
0
)
System
.
out
.
print
(
value
);
System
.
out
.
println
();
}
}
Back
|
FazBrowse Home
|
New Git URL