Problem Statement | |||||||||||||
A string is considered to be a composite of several maximal segments of identical characters. For example, "aaabbaaac" is a composite of the segments: "aaa", "bb", "aaa" and "c". Given a string, return the average length of all the segments which form that string. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | A return value with either an absolute or relative error of less than 1.0E-9 is considered correct. | ||||||||||||
Constraints | |||||||||||||
- | s will contain between 1 and 50 characters, inclusive. | ||||||||||||
- | s will contain only lowercase letters ('a'-'z'). | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
|