Skip to content

Commit c87f60b

Browse files
feat(abbreviation): add abbrevation challenge
1 parent 55813f7 commit c87f60b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

abbreviation/abbreviation.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# internationalization - i18n
2+
# foobar - f4r
3+
# it - it
4+
5+
6+
def abbrevation(word):
7+
if not word or len(word) < 3:
8+
return word
9+
10+
return word[0] + str(len(word) - 2) + word[-1]
11+
12+
13+
print(abbrevation('internationalization'))
14+
print(abbrevation('foobar'))
15+
print(abbrevation('it'))
16+
print(abbrevation('a'))

0 commit comments

Comments
 (0)