class Solution {

public:

```
int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
long long length = ((long long)min(C, G) - max(A, E)) > 0 ? ((long long)min(C, G) - max(A, E)) : 0;
long long width = ((long long)min(D, H) - max(B, F)) > 0 ? ((long long)min(D, H) - max(B, F)) : 0;
return (C-A)*(D-B) + (H-F)*(G-E) - length * width;
}
```

};

//length : intersection of two rectangle along X-axis

//width : intersection of two rectangle along Y-axis