[Codeforces Round #163 (Div. 2)]A. Stones on the Table

地址:http://codeforces.com/contest/266/problem/A

可以看作是记录连续重复序列的长度和

 1 #include<stdio.h>
 2 
 3 int n;
 4 char in[55];
 5 
 6 int main()
 7 {
 8     int i,count=0;
 9     scanf("%d",&n);
10     scanf("%s",in);
11     for(i=0;i<n-1;i++)
12     {
13         if(in[i]==in[i+1])
14         {
15             count++;
16         }
17     }
18     printf("%d\n",count);
19     return 0;
20 }

 

posted @ 2013-01-23 15:17  tjsuhst  阅读(139)  评论(0编辑  收藏  举报