import java.util.*;
import java.util.regex.*;

class Ideone {
	public static void main (String[] args) {
        String str = "word1_word2-word3";
		str = Pattern.compile("[-_]([a-zA-Z0-9])")
    .matcher(str)
    .replaceAll(mr -> mr.group(1).toUpperCase());
        System.out.println(str);
	}
}
