## Left and Right Handed

Time limit: 2000 ms

Memory limit: 65536 KB

### Description

Some students are seated in a row next to each other. Each of them is either left-handed or right-handed. The students are trying to write down lecture notes. Whenever a left-handed person sits immediately to the right of a right-handed person, their elbows collide when they both try to write at the same time. Compute and return the number of elbow collisions, assuming that all students in the row attempt to write at the same time.

### Input Format

First line contains an integer N (1 <= N <= 50), the number of students. The next line contains of N characters, each character of **S** is either ‘L’ or ‘R’, representing a left-handed or a right-handed person, respectively. The characters describe the row from the left to the right: for all i, the person described by character i+1 sits to the right of the person described by character i.

### Output Format

An integer, the number of collisions.

### Sample Input 1

1 L

### Sample Output 1

0

### Note

There’s only one person in the row so there are no collisions.

### Sample Input 2

3 RRR

### Sample Output 2

0

### Note

Everybody is right-handed so there are no collisions.

### Sample Input 3

6 LRLRLR

### Sample Output 3

2

### Note

There will be two collisions: one of them between the second and the third person from the left (described by **S**[1] and **S**[2]) and the other between the fourth and the fifth person.

### Sample Input 4

6 LLLRRR

### Sample Output 4

0

### Sample Input 5

6 RLRLRL

### Sample Output 5

3

## SOLUTION

#include #include int main() { int N,i,counter = 0; scanf("%d",&N); if(N>=1 && N <=50){ char temp[N]; scanf("%s",&temp); for(i=0;i<N-1;i++){ if(temp[i]!=temp[i+1]&&(temp[i] == 'R'||temp[i] == 'r')){ counter++; } } printf("%d\n",counter); } return 0; }