https://www.acmicpc.net/problem/10926
Quenston
준하는 사이트에 회원가입을 하다가 joonas라는 아이디가 이미 존재하는 것을 보고 놀랐다. 준하는 놀람을 ??!로 표현한다. 준하가 가입하려고 하는 사이트에 이미 존재하는 아이디가 주어졌을 때, 놀람을 표현하는 프로그램을 작성하시오.
Input
첫째 줄에 준하가 가입하려고 하는 사이트에 이미 존재하는 아이디가 주어진다. 아이디는 알파벳 소문자로만 이루어져 있으며, 길이는 50자를 넘지 않는다.
example input 1
joonas
example input 2
baekjoon
Output
첫째 줄에 준하의 놀람을 출력한다. 놀람은 아이디 뒤에 ??!를 붙여서 나타낸다.
example output 1
joonas??!
exapmle output 2
baekjoon??!
Answer
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String input = br.readLine();
String srprs = "??!";
System.out.println(input + srprs);
}
}
Code Explanation
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
InputStreamReader 클래스로 바이트 기반 스트림을 문자 기반 스트림으로 연결시켜 준다.
BufferedReader 클래스로 사용자가 입력한 문자 스트림을 읽는다.