0
Need your help to realized the function!
How many points are in the line, then how many elements from the end of the line must be removed, including the point itself. https://code.sololearn.com/cwSGZE17DkGD/?ref=app
10 Answers
+ 6
Salamander ,
i have done a trial in python, and it looks like it is working as expected. may be it can help you to see how it could be done in kotlin.
good success and happy coding!
https://code.sololearn.com/ct33Y190NghR/?ref=app
here my try in kotlin:
https://code.sololearn.com/cK7LgDD3U495/?ref=app
+ 2
.... Yeap, it's just two different examples. if we write "abc." in input we need take "ab" in output, so delete the last and the previous element. How many "." in line then we delete so many elements in front of it.
These input lines can be anything,for example: "Hello." and in output we should take "Hell".
+ 2
Sucheta It's a very informative answer! I understand everything! Thank a lot!
+ 2
Sucheta listen, if write in line "abc.11" so in output i have "abc1". But how realized when i write "abc.11" for result will "ab11". I mean that if i have one '.' the program in output delete this '.' and the last element before it?!
+ 2
Lothar thank a lot! It's very useful! Happy coding too!
+ 1
Sucheta thank a lot! Everything is working fine. But can you explain me more detail what doing the line
"return s.replace(".","").dropLast(countDots(s))"
I'm really junior in programmer world, didn't read and understand all code in full force.đ„