Repeating the names of directions describes a finer direction. For example, northwest is the direction halfway between north and west, and northnorthwest is the direction halfway between north and northwest.
This problem fixes the directions between north and west by the following rules.
- "north" means 0 degrees.
- "west" means 90 degrees.
- If a direction string dir means a degrees and the sum of the occurrences of "north" and "west" in dir is n (n≥1), then "north"dir, the concatenation of "north" and dir, means a−2n90 degrees, and "west"dir means a+2n90 degrees.
Compute the angle in degrees that the given direction means.