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

26th May 2021, 12:19 PM
Andrey Rudnev
Andrey Rudnev - avatar
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
26th May 2021, 5:59 PM
Lothar
Lothar - avatar
+ 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".
26th May 2021, 1:10 PM
Andrey Rudnev
Andrey Rudnev - avatar
+ 2
Sucheta It's a very informative answer! I understand everything! Thank a lot!
26th May 2021, 3:05 PM
Andrey Rudnev
Andrey Rudnev - avatar
+ 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?!
26th May 2021, 3:38 PM
Andrey Rudnev
Andrey Rudnev - avatar
+ 2
Lothar thank a lot! It's very useful! Happy coding too!
27th May 2021, 7:55 AM
Andrey Rudnev
Andrey Rudnev - avatar
+ 2
Sucheta , Lothar Thank you for your solutions💛
27th May 2021, 9:02 AM
Andrey Rudnev
Andrey Rudnev - avatar
+ 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.đŸ˜„
26th May 2021, 2:43 PM
Andrey Rudnev
Andrey Rudnev - avatar