0
Did I complicate too much in this challenge?
I solved "Pig Latin" but I was wondering if there was an easier or simpler way to do it. I want to know this because I want to understand how hard should medium difficulty challenges be. https://code.sololearn.com/c7JrmUVQfdh8/?ref=app
2 Answers
+ 3
1. make a better function name, repl doesnt make any sense and it's better to use a function name that explains what the function is doing. ex toPigLatin(string a)
2. add the "ay" at the end of the string on function repl. i don't understand why you'd add the "ay" when you are about to print it.
3. don't manually loop each string to separate the words, use the split function instead.
4. the added space at the end of the string is unnecessary, there's a way to do it without using them.
extra tip: you only need 1 for loop for this challenge, your solution is a bit too inefficient.
0
I see, that would have saved a lot of time and effort. Thank you!