// #牛客春招刷题训练营# https://www.nowcoder.com/discuss/726480854079250432 // 模拟题,如果把一个一个的char输入改成string输入,可能可以减少系统API调用次数,提高性能 #include <iostream> using namespace std; int main() { char last, c; int ans = 1; cin >> last; while(cin >> c){ if (c == last){ cout << ans; return 0; } else{ ans++; last = c; } } cout << ans; return 0; } // 64 位输出请用 printf("%lld")