Skip to main content
1 of 4
RoToRa
  • 11.4k
  • 1
  • 23
  • 51

#Variable Names

Your variables names are unnecessarily abbreviated and genetic. Also suffixes such as Arr are usually unnecessary. Here some example I'd use:

  • str => sentence
  • strArr => words
  • strTemp => word

#Algorithm

You could drop copying the strings into the character array, by using strArr directly and simply checking if j exceeds the length of the word and printing a space if it does.

Also getting the maximal word length could also be avoided, if you check during output, iff all strings are shorter than j.

RoToRa
  • 11.4k
  • 1
  • 23
  • 51