엘리스와 개구리 대화
입력
안녕 나는 엘리스야
출력
개굴개굴 개굴개굴 개굴개굴개굴개굴
풀이
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String str = scan.nextLine();
String output ="";
String gegul = "개굴";
int len = str.length();
for(int i = 0; i < len; i++){
if(str.charAt(i) !=' '){
output = output + gegul;
}
else{
output = output + " ";
}
}
//System.out.println(str);
System.out.println(output);
}
}
'JAVA > JAVA 연습' 카테고리의 다른 글
Do it! 자바 프로그래밍 : 연산자 01 (0) | 2022.10.01 |
---|---|
JAVA 토끼와 거북이 (최대 공약수 ,최소공배수) (0) | 2022.09.30 |
Do it! 자바 프로그래밍 : 변수와 자료형 02 (0) | 2022.09.25 |
Do it! 자바 프로그래밍 : 변수와 자료형 01 (0) | 2022.09.25 |
Do it! 자바 프로그래밍 : 맛보기 (0) | 2022.09.25 |