Preparing NOJ

JavaScript

2000ms 1048576K

Description:

JavaScript is one of the most important computer languages now. It is high-level and multi-paradigm. It supports functional and imperative programming styles. However, the ICPC World Finals does not offer JavaScript for problem solving.

JavaScript is considered as a weakly typed language. It sometimes implicitly converts values of one type into another type. For example, the minus operator (-) does not have any meaning on strings; it is defined to operate on numbers. When the minus operator is applied on two strings, JavaScript will convert the operands from strings into numbers and then apply the minus operation. That is why "2" + "2" - "2" evaluates to 20 in JavaScript. Moreover, JavaScript converts a string into NaN (Not-a-Number) if the string does not represent a number. If any operand of a minus operation is NaN, then the result of the operation must be NaN. For example, "a" + "2" is NaN.

Given two strings x and y, please write a program to compute the result of x - y in JavaScript.

Input:

There is only one line containing two space-separated non-empty strings x and y.

  • $$$x$$$ and $$$y$$$ consist of only English letters and digits.
  • Both $$$x$$$ and $$$y$$$ have lengths less than 6.
  • If $$$x$$$ contains an English letter, then you may assume that JavaScript converts $$$x$$$ into NaN.
  • If $$$y$$$ contains an English letter, then you may assume that JavaScript converts $$$y$$$ into NaN.
  • You may assume that the result is not a number if it is not an integer.

Output:

Print the result of the minus operation (x - y) on one Line. If the result is an integer, please print it without the decimal point. If the result is not a number, please print NaN.

Sample Input:

22 2

Sample Output:

20

Sample Input:

a 2

Sample Output:

NaN

Sample Input:

12345 x1y2z

Sample Output:

NaN

Info

CodeForces Gym

Provider CodeForces Gym

Origin 2021 ICPC Asia Taiwan Online Programming Contest

Code GYM103373J

Tags

Submitted 0

Passed 0

AC Rate 0%

Date 10/31/2021 14:46:15

Related

Nothing Yet