728x90
반응형
SMALL
자가진단1 : 602
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] arr = new String[5];
for(int i = 0; i < 5; i++) arr[i] = sc.nextLine().trim();
for(int i = 4; i >= 0; i--) System.out.println(arr[i]);
}
}
자가진단2 : 603
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine().trim();
String[] arr = str.split("\\s+");
for(int i = 0; i < arr.length; i++){
if((i+1)%2 != 0) System.out.println(arr[i]);
}
}
}
자가진단3 : 604
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] arr = new String[10];
for(int i = 0; i<10; i++){
arr[i] = sc.nextLine().trim();
}
char ch = sc.next().charAt(0);
for(String i : arr) if(i.charAt(i.length()-1) == ch) System.out.println(i);
}
}
자가진단4 : 605
public class Main {
public static void main(String[] args) {
String str = "Hong Gil Dong";
String answer = new String(str);
System.out.println(answer);
}
}
자가진단5 : 606
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine().trim();
System.out.println(str + "fighting");
}
}
자가진단6 : 607
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine().trim();
String[] arr = str.split("\\s+");
System.out.println(arr[0].substring(0,2)+arr[1].substring(2) + arr[0].substring(0,2));
}
}
자가진단7 : 608
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine().trim();
String answer = "";
if(str.contains("c")) answer +="Yes";
else answer+="No";
answer += " ";
if(str.contains("ab")) answer += "Yes";
else answer += "No";
System.out.println(answer);
}
}
자가진단8 : 609
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] arr = new String[3];
String str = sc.nextLine().trim();
arr = str.split(" ");
Arrays.sort(arr);
System.out.println(arr[0]);
}
}
자가진단9 : 610
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] arr = new String[5];
for(int i = 0; i < 5; i++) arr[i] = sc.nextLine().trim();
Arrays.sort(arr, Collections.reverseOrder());
for(int i = 0; i < 5; i++) System.out.println(arr[i]);
}
}
자가진단10 : 611
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String input = scanner.next().trim();
String[] arr = input.split("\\*|&|%|$|#|@");
System.out.println(Arrays.toString(arr));
scanner.close();
}
}
자가진단11 : 612
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();
String[] arr = str.split("\\s+");
String answer = "";
for(String i:arr) answer += i;
int i= 0;
while(true){
if(i>=answer.length()) break;
if(i+3 > answer.length()) System.out.println(answer.substring(i,answer.length()));
else System.out.println(answer.substring(i,i+3));
i+=3;
}
}
}
728x90
반응형
LIST
'프로그래밍 > 자바' 카테고리의 다른 글
[자바 / 기본] Class란? (1) | 2023.10.07 |
---|---|
[자바] 정올 189 ~ 194 && 215, 216, 237 : 문자열2 - 형성평가 1 ~ 9 (1) | 2023.10.04 |
[자바] 정올 182 ~ 188 : 문자열1 - 형성평가1 ~ 7 (0) | 2023.10.04 |
[자바] 정올 593 ~ 601 : 문자열1 - 자가진단1~9 (1) | 2023.10.04 |
[자바] 정올 231 ~ 236 : 함수3 - 형성평가1~6 (0) | 2023.10.03 |