문제
입력으로 Base64 Decoding 된 String이 주어졌을 때, 해당 String 을 Encoding 하여, 출력하는 프로그램을 작성하시오.
입력
Life itself is a quotation. |
출력
TGlmZSBpdHNlbGYgaXMgYSBxdW90YXRpb24u |
코드
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
import java.util.*;
class Solution
{
public static void main(String args[]) throws Exception
{
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
byte[] bytesToEncode = input.getBytes();
byte[] encodedBytes = Base64.getEncoder().encode(bytesToEncode);
String output = new String(encodedBytes);
System.out.print(output);
}
}
|
cs |
'SW expert Academy > D2' 카테고리의 다른 글
[SW Expert Academy] 1284번 수도 요금 경쟁 (0) | 2023.05.17 |
---|---|
[SW Expert Academy] 1288번 새로운 불면증 치료법 (0) | 2023.05.17 |
[SW Expert Academy] 1928번 Base64 Decoder (0) | 2023.05.12 |
[SW Expert Academy] 1940번 가랏! RC카! (0) | 2023.05.12 |
[SW Expert Academy] 1946번 간단한 압축 풀기 (0) | 2023.05.12 |