package pro_04_08;
import java.util.Scanner;
public class ReverseString {
public static void main(String[] args) {
// TODO Auto-generated method stub
String str;
int length;
int index;
char ch;
String rest;
String outputStr = "";
Scanner scan = new Scanner(System.in);
System.out.println("길이가 3인 문자열을 입력하세요 : ");
str = scan.next();
System.out.println("입력 문자열 : " + str);
length = str.length();
index = str.indexOf("궁");
ch = str.charAt(length-1);
rest = str.substring(1,length-1);
outputStr = str.substring(0, length-2);
//System.out.println("length : " + length);
//System.out.println("rest : " + rest);
//System.out.println("ch : " + ch);
//System.out.println("index : " + index);
//System.out.println("outputstr : " + outputStr);
System.out.println("출력 문자열 : " + ch + rest + outputStr );
}
}
Comments
Post a Comment