Skip to content

Commit b01b73f

Browse files
committed
solution
1 parent f471898 commit b01b73f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/main/kotlin/mate/academy/MakeAbbreviation.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ package mate.academy
22

33
fun makeAbbr(source: String) : String {
44
val sb = StringBuilder()
5-
for(s in source.split(' ')) {
6-
if (s.isNotEmpty()) {
7-
sb.append(s[0])
5+
6+
for (word in source.split(' ')) {
7+
if (word.isNotBlank()) {
8+
sb.append(word.first())
89
}
910
}
11+
1012
return sb.toString().uppercase()
1113
}

0 commit comments

Comments
 (0)