코딩응급실
프로그래머스: JadenCase 문자열 만들기 본문
import java.util.*;
class Solution {
public String solution(String s) {
String answer = "";
String[] words = s.toLowerCase().split("");
boolean flag = true;
for(String str : words) {
answer += flag ? str.toUpperCase() : str;
flag = str.equals(" ") ? true : false;
}
return answer;
}
public static void main(String[] args) {
String s = "3people unFollowed me";
Solution sol = new Solution();
String result = sol.solution(s);
System.out.println(result);
}
}
'Java' 카테고리의 다른 글
프로그래머스: 올바른 괄호 (0) | 2024.03.02 |
---|---|
프로그래머스: 최솟값 만들기 (0) | 2024.03.02 |
프로그래머스: 폰켓몬 (0) | 2024.03.02 |
프로그래머스: 2016년 (0) | 2024.03.02 |
프로그래머스: 가운데 글자 가져오기 (0) | 2024.03.02 |