# Description
Given 2 directions, which are left and right, several cars are moving on the road (in form of 1D array) to either of the directions with the same speed.
Find out how many pairs of cars that will pass through each other.
**Example 1**
```ruby
| → → → → |
| ← ← |
```
Input: ["right", "left", "right", "right", "left", "right"]
Output: 4
Explanation: "right" from index 0 will pass 2 "left"s from indices 1 and 4, "right" from index 2 will pass 1 "left" from index 4, and "right" from index 3 will pass 1 "left" from index 4, while "right" from index 5 won't pass any car because nothing "left", no pun intended. so 2 + 1 + 1 = 4
**Example 2**
```ruby
| → → → |
| ← ← ← |
```
Input: ["left", "left", "right", "left", "right", "right"]
Output: 1
Explanation: only the "right" car from index 2 will pass 1 "left" car from index 3
# Idea
1. For i=0; i++; i<n
for j=i+1; j++; j<n-1
if a[i] == "right" && a[j] == "left"
count++
end
end
end
2. Draft
right = 0, 2, 3, 5
left = 1, 4
for i=0; i++; i<n
if a[i] == "right"
right << i
else
left << i
end
i = 0; j = 0
while i < right.lengh && j < left.length
if right[i] < left[j]
counter++
i++
else
j++
end
end