passing-the-parcel_9752
Have you ever been a part of the exciting game Passing the Parcel ? Sid is on a school picnic with his classmates. The teacher decides to make the whole class play the game of Passing the Parcel. Since the 
winner of the game gets lots of chocolates and ice cream as his/her prize, all the students are over-excited 
about the game, including Sid. Here are the rules of the game:
For the purpose of the game, our Parcel here is a football.
There are a total of N students in the class. Their roll numbers being 1, 2, 3... N.
All N students are made to sit uniformly in a circle in roll number order (ie. from 1 to N in clockwise direction).
The Parcel is first handed over to the student with roll number 1.
The teacher starts playing a song using a loud stereo system. The lyrics of the song are denoted by a
string which consists of only letters 'a' and 'b'. Assume that each lyric of the song is a single letter.
If the lyric 'a' occurs in the song, the student who is currently holding the Parcel passes it on to the next student. This passing takes place in clockwise direction. 
If the lyric 'b' occurs in the song, the student who is  currently holding the Parcel loses his/her chances of winning the game. He/she hands over the parcel to the next student (in clockwise direction) and moves out. 
The game continues until a single student survives in the end. He/she will be the winner of the game.
Note that the song repeats continuously ie. while the game is going on, if at all the song ends, the stereo 
system will automatically start playing the song from the start without any delay.

Given N the number of students in the class and the lyrics of the song, you have to find out the roll number of 
the student who wins the game.

Input :

The input consists of 2 lines. The first line consists of N, the number of students in the class. The next line consists of a string denoting the lyrics of the song the teacher plays. 

Output :

Print a single integer denoting the roll number of the student who wins the game.

Constraints :

2 ≤ N ≤ 1000

1 ≤ |S| ≤ 1000, where |S| denotes the length of the input string. It is guaranteed that at least 1 lyric in the song will be a 'b'

SAMPLE INPUT
6
abba

SAMPLE OUTPUT
5

Explanation

a : 1 -> 2
b : 2 goes out, handing over the parcel to 3
b : 3 goes out, handing over the parcel to 4
a : 4 -> 5
a : 5 -> 6
b : 6 goes out, handing over the parcel to 1
b : 1 goes out, handing over the parcel to 4
a : 4 -> 5
a : 5 -> 4
b : 4 goes out

Hence winner is 5.
num = int(raw_input())
song = raw_input()
students = list(range(1,num+1))
ballpointer = 0
# problem
while len(students) > 1:
    for lyrics in song:
        if len(students) == 1:
            break
        if lyrics == 'b':
            del students[ballpointer]
        if lyrics == 'a':
            ballpointer += 1
        if ballpointer == len(students):
            ballpointer = 0
print(students[0])
6
abba

SAMPLE 6
bbba

SAMPLE 6
abaa

SAMPLE 6
abba

ELPMAS 6
babb

RAMPLE 6
baab

RAMPLE 6
bbba

RAMPLE 6
bbba

ELPMAS 6
bbba

DLPMAS 6
abba

FLPMAS 6
bbba

SAMPLD 6
abba

FKPMAS 6
bbba

S@MPLD 6
abaa

FKPMAS 6
bbab

S@MPLD 6
bbaa

FKPMAS 6
bbab

DLPM@S 6
abba

SAMPKF 6
abbb

SAMPKF 6
bbab

SAMPKF 6
bbab

SAMPKG 6
abba

RAMPLE 6
bbba

SEMPLA 6
abbb

RAMPLE 6
abaa

ELPMAS 6
abba

ELPMAT 6
bbba

EKPMAS 6
baab

ELPMAR 6
bbba

RAMPLD 6
abba

FKPNAS 6
bbba

S@MPMD 6
abaa

SAMPKF 6
bbab

DKPM@S 6
bbaa

FJPMAS 6
bbab

ELPM@S 6
abab

SAMPKF 6
bbaa

SAMPKF 6
babb

SAMPKG 6
abab

RAMPLE 6
abbb

SEMPLA 6
aabb

RAMPLE 6
abaa

ELPM@S 6
abba

EMPLAT 6
abba

FKQNAS 6
abaa

SALPKF 6
bbab

S@MPKD 6
bbaa

FJPMAT 6
bbab

ELSM@P 6
abab

FKPMAS 6
bbaa

SAMQKF 6
babb

GKPMAS 6
abab

ELPMAR 6
aabb

SEMPLA 6
aabb

PAMRLE 6
abaa

ELPM?S 6
abba

TALPME 6
bbaa

FKQNAS 6
bbab

S@KPMD 6
bbab

ELSN@P 6
bbaa

FKQMAS 6
babb

GKPMAR 6
abab

ELPMBR 6
aabb

SFMPLA 6
aabb

ELRMAP 6
abbb

TALPME 6
bbaa

FKPNAS 6
babb

S@KPMD 6
bbab

P@NSLE 6
bbaa

FKQMAT 6
babb

GKPNAR 6
abab

RBMPLE 6
aabb

SFMPL@ 6
bbaa

ELRMAP 6
bbba

TALPME 6
babb

S?KPMD 6
bbab

N@PSLE 6
bbaa

FKQM@T 6
bbab

GKPNAR 6
bbaa

EMRMAP 6
bbab

S?KPMD 6
babb

N@PSLE 6
abaa

FKQM@T 6
bbaa

PAMRME 6
babb

NEPSL@ 6
abaa

FLQM@T 6
babb

@LSPEN 6
abaa

TLQM@F 6
bbba

MKPEAS 6
bbba

R@MPLE 6
abaa

SAMPKE 6
bbab

ELPMAS 6
babb

REMPLA 6
bbba

DLPMSA 6
abba

FLQMAS 6
aaab

RAMPLE 6
bbba

DAMPLS 6
abba

FKQMAS 6
abbb

S@MPLD 6
abba

FKOMAS 6
babb

S@MPLD 6
bbab

FKPMAS
5
 4
 3
 5
 6
 2
 4
 4
 4
 5
 4
 5
 4
 3
 3
 4
 3
 5
 5
 3
 3
 5
 4
 5
 3
 5
 4
 2
 4
 5
 4
 3
 3
 4
 3
 5
 4
 6
 5
 5
 6
 3
 5
 5
 3
 3
 4
 3
 5
 4
 6
 5
 6
 6
 3
 5
 4
 3
 3
 4
 6
 5
 6
 6
 5
 4
 6
 3
 4
 6
 5
 6
 4
 4
 6
 3
 4
 3
 4
 3
 6
 3
 4
 6
 3
 6
 3
 4
 4
 3
 3
 6
 4
 5
 5
 4
 5
 5
 5
 6
 3
