How to read data from standard input--java language

Enter basic questions to consider

Algorithm competition topics generally have multiple test cases, and the data is sent to the program by means of redirection.
Then observe whether the output of the program is consistent with the expected results.
In most cases, these test cases will exist in the form of files. This pays attention to the following issues:

  1. There are multiple items of data in each line, and the delimiter is not completely determined, such as: one or more spaces.
  2. It may not be known how many items of data are on each row. Continues until the end of the bank.
  3. The total number of lines may not be known until the end of the file.
  4. The last line may not have a carriage return and line feed, directly encountering EOF (end of file marker)
  5. Under different operating systems, the way of wrapping may be different.
  6. When supplying a string, it may contain spaces.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325166418&siteId=291194637