Implementation
Time Complexity:
import java.io.*;public class UdderedButNotHerd {public static void main(String[] args) throws IOException {BufferedReader input = new BufferedReader(new InputStreamReader(System.in));String cowphabet = input.readLine();char[] word = input.readLine().toCharArray();int numTimes = 1; // There must be at least one humming sequence.for (int i = 0; i < word.length - 1; i++) {
Join the USACO Forum!
Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!