전체 코드
4장/이상한_문자_만들기.java
public class Solution {
public String solution(String s) {
StringBuilder builder = new StringBuilder();
boolean toUpper = true;
for (char c : s.toCharArray()) {
if (!Character.isAlphabetic(c)) {
builder.append(c);
toUpper = true;
} else {
if (toUpper) {
builder.append(Character.toUpperCase(c));
} else {
builder.append(Character.toLowerCase(c));
}
toUpper = !toUpper;
}
}
return builder.toString();
}
}