Skip to content

Commit d9833c5

Browse files
authored
Merge pull request #1167 from AlgorithmWithGod/LiiNi-coder
[20251019] PGM / LV2 / JadenCase 문자열 만들기 / 이인희
2 parents 1e9e11a + f14ed8a commit d9833c5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
```java
2+
import java.util.*;
3+
4+
class Solution {
5+
public String solution(String s) {
6+
StringBuilder answer = new StringBuilder();
7+
boolean isStartOfWord = true;
8+
for (int i = 0; i < s.length(); i++) {
9+
char c = s.charAt(i);
10+
11+
if (c == ' ') {
12+
answer.append(c);
13+
isStartOfWord = true;
14+
} else {
15+
if (isStartOfWord) {
16+
answer.append(Character.toUpperCase(c));
17+
} else {
18+
answer.append(Character.toLowerCase(c));
19+
}
20+
isStartOfWord = false;
21+
}
22+
}
23+
return answer.toString();
24+
}
25+
}
26+
27+
```

0 commit comments

Comments
 (0)