import java.util.*;
public class Solution {
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
while(sc.hasNextLine()){
StringBuffer s=new StringBuffer();
s.append(sc.nextLine());
if(s.length()>=1&&s.length()<=10)
{
int j=0;
for(int i=0;i<s.length()-1;i++){
if(s.charAt(i)==s.charAt(i+1)){
j++;
s.setCharAt(i+1,‘Z‘);//替换特定字符
}
}
System.out.println(j);
}
else continue;
}
}
}
时间: 2024-10-05 06:16:25