public class D {
    
    /** = s with adjacent pairs of chars swapped.
      *   e.g if s = "abcde" answer is "badce" */
    public static String swap(String s) {
        L1: if (s.length() <= 1)    // BASE CASE
        L2: return s;
        
        // s has at least 2 characters
        L3: return s.charAt(1) +
           (s.charAt(0) + swap(s.substring(2)));
    }
    
    
    /** = b ^ c (b multiplied by itself c times).
      *   Precondition: c >= 0 */
    public static double exp(double b, int c) {
        if (c == 0)
            return 1;
        
        // c > 0
        if (c%2 == 0)
            return exp(b*b, c/2);

        // c < 0 and odd
        return b * exp(b, c-1);
    }
}