fork download
  1. import java.util.*;
  2.  
  3. class A {
  4. public static void main(String[] args) {
  5. Scanner s = new Scanner(System.in);
  6. String a = s.next(), b = s.next();
  7. String c = "" + (new Integer(a) + new Integer(b));
  8. int x = new Integer(c.replaceAll("0", ""));
  9. int y = new Integer(a.replaceAll("0", ""))
  10. + new Integer(b.replaceAll("0", ""));
  11. System.out.println((x==y)?"YES":"NO");
  12. }
  13. }
  14.  
Success #stdin #stdout 0.06s 213888KB
stdin
105
106
stdout
NO