0

For instance you have provided an extra space . Such things are difficult to notice . I dont find any difference in the following two outputs but it still gives wrong answer as the answer

My Output

-150 can be fitted in:
* short
* int 
* long
150000 can be fitted in:
* int 
* long
1500000000 can be fitted in:
* int 
* long
213333333333333333333333333333333333 can't be fitted anywhere.
-100000000000000 can be fitted in:
* long

Expected output

-150 can be fitted in:
* short
* int
* long
150000 can be fitted in:
* int
* long
1500000000 can be fitted in:
* int
* long
213333333333333333333333333333333333 can't be fitted anywhere.
-100000000000000 can be fitted in:
* long
Madhawa Priyashantha
  • 9,633
  • 7
  • 33
  • 60

2 Answers2

0

You can output to a text file and use diff to compare it to what you expect.

Lawrence Aiello
  • 4,560
  • 5
  • 21
  • 35
  • the command to use diff is 'diff inputFile outputFile'. You may direct your output to a file. Linux provides this utility in it OS kit. – Satish Chalasani Jul 15 '15 at 14:28
0

There are many Java libraries for this particular purpose. I would recommend diff-match-patch. Also see the answers to this SO question for more recommendations.

Community
  • 1
  • 1
Anders
  • 8,307
  • 9
  • 56
  • 88