+ 3

Where is the fault?

hey guys, my code works but i don't know why the Test Case not accept my result. Somebody have a idea? Q: You have been asked to make a special book categorization program, which assigns each book a special code based on its title. The code is equal to the first letter of the book, followed by the number of characters in the title. For example, for the book "Harry Potter", the code would be: H12, as it contains 12 characters (including the space). You are provided a books.txt file, which includes the book titles, each one written on a separate line. Read the title one by one and output the code for each book on a separate line. For example, if the books.txt file contains: Some book Another book Your program should output: S9 A12 my Code: https://code.sololearn.com/ca1659A2a9A4

15th Jul 2021, 6:23 AM
Marco Hoheneder
Marco Hoheneder - avatar
3 Réponses
+ 7
All lines, except the last one, contain a \n at the end, which should not be included in the character count.
15th Jul 2021, 6:38 AM
JaScript
JaScript - avatar
+ 2
Hi! in all lines, you must exclude the newline character, except for the last one. he's not there. you should take this into account
15th Jul 2021, 6:55 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Ty
15th Jul 2021, 6:40 AM
Marco Hoheneder
Marco Hoheneder - avatar