There was an error while loading. Please reload this page.
1 parent f471898 commit b01b73fCopy full SHA for b01b73f
1 file changed
src/main/kotlin/mate/academy/MakeAbbreviation.kt
@@ -2,10 +2,12 @@ package mate.academy
2
3
fun makeAbbr(source: String) : String {
4
val sb = StringBuilder()
5
- for(s in source.split(' ')) {
6
- if (s.isNotEmpty()) {
7
- sb.append(s[0])
+
+ for (word in source.split(' ')) {
+ if (word.isNotBlank()) {
8
+ sb.append(word.first())
9
}
10
11
12
return sb.toString().uppercase()
13
0 commit comments