Baekjoon Algorithm | Problem 11654: ASCII Code

Source

https://www.acmicpc.net/problem/11654

Problem

Solve Baekjoon Online Judge problem 11654, ASCII Code.

Input

Follow the input format and constraints given in the original problem statement.

Output

Print the answer required by the problem.

Sample Input 1

A

Sample Output 1

65

Sample Input 2

C

Sample Output 2

67

Sample Input 3

0

Sample Output 3

48

Sample Input 4

9

Sample Output 4

57

Sample Input 5

a

Sample Output 5

97

Sample Input 6

z

Sample Output 6

122

Algorithm Classification

  • Implementation

Solution

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            final int x =  br.readLine().charAt(0);

            System.out.println(x);
        }
    }
}
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {

        final int x =  System.in.read();

        System.out.println(x);
    }
}