A + B

Source: Internet
Author: User

Description

Given two integers A and B, the expression is: each three digits are separated by commas.
Calculate the result of A + B and output it in the normal form.

Input

The input contains multiple groups of data. Each group occupies one row and consists of two integers A and B-10 ^ 9 <A, B <10 ^ 9 ).

Output

Calculate the result of A + B and output it as normal. Each group of data occupies one row.

Sample Input

-234,567,890 123,456,789

1,234 2,345,678

Sample Output

-111111101

2346912

The Code is as follows:

# Include <iostream>

# Include <string>

Using namespace std;

Int main ()

{

String a1, a2;

While (cin> a1> a2 ){

Int l1 = a1.size ();

Int l2 = a2.size ();

Int x1, x2;

X1 = x2 = 0;

Int f = 1;

For (int I = 0; I <l1; I ++)

{

If (a1 [I] = '-') {f =-1; continue ;}

If (a1 [I]! = ','){

X1 = x1 * 10 + a1 [I]-'0 ';

}

}

X1 = x1 * f;

F = 1;

For (int I = 0; I <l2; I ++ ){

If (a2 [I] = '-') {f =-1; continue ;}

If (a2 [I]! = ','){

X2 = x2 * 10 + a2 [I]-'0 ';

}

}

X2 = x2 * f;

Cout <x1 + x2 <endl;

}

// System ("pause ");

Return 0;

}


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.