Stroke styles and stroke counts are the two important parameters for calculating swimming efficiency indices for swimmers. Assume that swimmers wear accelerometers when swimming. In this paper, we design a swimming analysis scheme, which can distinguish swimming styles and count strokes in realtime. The proposed scheme is composed by a data processing phase and a stroke analysis phase. First, the data processing phase gathers linear acceleration values, eliminates floating data, and finds feature points in the perceived sensory data. According to the data from the data processing phase, the stroke analysis phase identifies the stroke style that the swimmer is performing, and then adopts the concept of correlation coefficient to count strokes. We implement the proposed scheme on a water-proof Android platform. The experiment results indicate that the proposed scheme can identify swim styles and count strokes with high accuracy.