FRQ 1

// part a
public String scrambleWord(String word){
    String scrambled = "";

    for(int i = 1; i < word.length(); i++){
        word.substring(i-1,i+1);
        if(word.substring(i-1, i).equals("A") && !word.substring(i, i+1).equals("A")){
            scrambled += word.substring(i, i+1);
            scrambled += word.substring(i-1, i);
            i++;
        } else{
            scrambled += word.substring(i-1, i);
            if(i == word.length() - 1){
                scrambled += word.substring(i, i+1);
            }
        }

    }

    
    return scrambled;
}

System.out.println(scrambleWord("ABRACADABARA"));
BARCADABARA

FRQ 2