Work obtained from Rankine cycle vs Carnot cycle In this diagram,

We can say that the work obtained from Carnot cycle is greater than the work obtained from the Rankine cycle because the area enclosed by the curve is greater. 
However, if we try to find the work obtained from each cycle by adding up the work done in adiabatic expansion and compression from the enthalpies at each stage,
we get $$W_{rankine}=(h_{d}-h_{e}+h_{f})-h_{a}$$
$$W_{carnot}=(h_{d}-h_{e}+h_{f})-h_{g}$$
Since $h_{g}>h_{a}$, $W_{carnot}<W_{rankine}$. 
Why am I getting this contradiction?
 A: UPDATE:
The following update is in response to the original question and the follow up comments as to whether or not the Carnot cycle should include point (g) in the drawing, and as to the work being greater in the Carnot cycle than the Rankine cycle.
The diagram presented appears to be taken directly from an MIT web course on thermodynamics (MIT.edu). Nevertheless, I believe there are issues with the diagram that have led you to find the contradiction. In particular, I question the feasibility of process f-g. This is an isentropic compression of liquid water. Compression of liquid water should not result in any significant temperature increase.  Consider the following example:
Let the pressure at the condenser be 10 KPa (point f). From the saturated steam table we have the following data for saturated liquid water:
$P=10kPa$, $T = 46 C$, $h = 192.6$, $s = 0.65166$
Let the pressure of the boiler by 15 MPa (point on the saturated liquid curve corresponding to $T_1$).  We isentropically compress the saturated liquid water to this pressure. At the end of the compression we have the same entropy.  So we have:
$P=15MPa$, $s=0.65166$
In order to find the temperature and enthalpy of the compressed water, we refer to a table for compressed liquid water properties (re: Ohio.edu) which gives the following data for $P=15MPa$:
$$T=40 C$$
$$s=0.5666$$
$$h=180.8$$
$$T=60 C$$
$$s=0.8234$$
$$h=248.6$$
Based on these data, the temperature of the liquid water at the output of the compressor should be less than 60 C and the enthalpy less than 248.6. Even if we compressed it isentropically to 30 MPa (the max in the compressed liquid water properties table), the temperature would still be less that 60 C.
Work vs Efficiency:
It was stated, “We can say that the work obtained from Carnot cycle is greater than the work obtained from the Rankine cycle because the area enclosed by the curve is greater”. I think what we can say is the Carnot cycle produces work more efficiently than the Rankine cycle. 
Figures A and B below show a Carnot cycle and an ideal Rankine cycle without superheat (saturated vapor enters the turbine). Note that the area enclosed by the Rankine cycle is greater than the Carnot cycle, indicating that it produces more work. However, the Carnot cycle efficiency is greater than the Rankine efficiency for the following reasons.
All the heat added in the Carnot cycle occurs isothermally (a-b) at the maximum temperature $T_1$. For the Rankine cycle only part of the heat added (a-b) occurs isothermally at maximum temperature. The remainder of the heat added occurs  isobarically (e-a) at temperatures below $T_1$, or at some average or mean temperature below $T_1$, we will call $T_m$.
The efficiency of the Carnot cycle is
$$ζ_{Carnot}=1-\frac{T_2}{T_1}$$ 
The efficiency of the Rankine cycle is
$$ζ_{Rankine}=1-\frac{T_2}{T_m}$$
Since
$T_m < T_1$
$$ζ_{Rankine}< ζ_{Carnot}$$
The Rankine cycle with superheat improves the efficiency by increasing the mean high temperature, but still won’t equal the Carnot.
Hope this helps.

