Skip to content

moon1139/ParenthesesFormatter

Repository files navigation

Run by online IDE

Run by go command

Run by executable file

  • Please build the executable file first if you want to use this method
  • For windows environment, use powershell or command line .\ParenthesesFormatter.exe to run.
  • For Mac you should able to run by ./hello once executable is built
  • ParenthesesFormatter will take stdin as input and output to stdout (need to ctrl+c to stop then you can see stdout)
  • Support mutiple line input
  • For example,

input file:

(A*(B+C))
1*(2+(3*(4+5)))
2+(3/-5)

output file:

A*(B+C)
1*(2+3*(4+5))
2+3/-5
  • Also if you're using powershell. There will also console messages for human.

console output:

(A*(B+C)) => A*(B+C)
1*(2+(3*(4+5))) => 1*(2+3*(4+5))
2+(3/-5) => 2+3/-5

Build executable file

Run tests via VScode

Some constraints about the function

  • In this function, I am assuming all of the input would contains valid parentheses pairs.
  • That is we will see something like (()) but not (().
  • Since if we want to auto correct invalid pairs like (a*(b+c).
  • The result could be a*(b+c) or (a*b+c), causing our ParenthesesFormatter will have different output.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages