@@ -0,0 +1,768 @@
+// https://community.topcoder.com/stat?c=problem_statement&pm=6442%0A%0Apublic class StringSegment %7B%0A%09public static double average(String s) %7B%0A%09%09int totalSequenceLength = 0;%0A%09%09int sequenceCount = 0;%0A%09%09%0A%09%09char currentSequenceChar = s.charAt(0);%0A%09%09int currentSequenceLength = 0;%0A%09%09%0A%09%09for (int i = 0; i %3C s.length(); ++i) %7B%0A%09%09%09if (s.charAt(i) == currentSequenceChar) %7B%0A%09%09%09%09currentSequenceLength++;%0A%09%09%09%7D%0A%09%09%09else %7B%0A%09%09%09%09totalSequenceLength += currentSequenceLength;%0A%09%09%09%09sequenceCount++;%0A%09%09%09%09%0A%09%09%09%09currentSequenceLength = 1;%0A%09%09%09%09currentSequenceChar = s.charAt(i);%0A%09%09%09%09%0A%09%09%09%09if (i == s.length()-1) %7B%0A%09%09%09%09%09totalSequenceLength += currentSequenceLength;%0A%09%09%09%09%09sequenceCount++;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09double average = (double) totalSequenceLength / sequenceCount;%0A%09%09%0A%09%09return average;%0A%09%7D%0A%7D%0A

Create StringSegment.java