Suffix Rule
This works like a small word-processing rule: choose which suffix to add based on how the word ends. Write a function add_ing_ly that takes a string s. If the string has fewer than 3 characters, return it unchanged. If it already ends with ing, add ly; otherwise, add ing.
Примеры
Ввод
"abc"Вывод
"abcing"Ввод
"string"Вывод
"stringly"Ввод
"ab"Вывод
"ab"Нужно реализовать
def add_ing_ly(s: str) -> str:
Теги
strings
Accedi per vedere la cronologia degli invii
AccediAccedi per usare l'AI Mentor
AccediVisible tests
1
Input
"abc"Expected
"abcing"2
Input
"string"Expected
"stringly"3
Input
"ab"Expected
"ab"4
Input
"do"Expected
"do"5
Input
"read"Expected
"reading"6
Input
"ABC"Expected
"ABCing"Focus radio
Paused · SomaFM · Fluid