Mid-Central USA Programming Contest 2018

#### Start

2018-11-03 09:30 AKDT

## Mid-Central USA Programming Contest 2018

#### End

2018-11-03 14:30 AKDT
The end is near!
Contest is over.
Not yet started.
Contest is starting in -811 days 6:04:27

5:00:00

0:00:00

# Problem BExam

Compute the maximum possible score you could have gotten.

## Input

The first line contains a single integer $k$, the number of correct answers on your friend’s exam.

The second line contains a string of characters, the answers you wrote down. Each letter is either a ‘T’ or an ‘F’. The length of the string is the number $n$ of exam questions.

The third line also contains a string of $n$ characters, the answers your friend wrote down. Each letter is either a ‘T’ or an ‘F’.

Bounds are $0 \leq k \leq n \leq 1\, 000; 1 \leq n$.

## Output

The output is one line containing the maximum number of questions you could have gotten correct.

Sample Input 1 Sample Output 1
3
FTFFF
TFTTT

2

Sample Input 2 Sample Output 2
6
TTFTFFTFTF
TTTTFFTTTT

9