Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
41020 张志勇 指针遍历字符串 C++ Accepted 2 MS 272 KB 271 2022-10-23 12:25:59

Tests(2/2):


Code:

#include<iostream> #include<cstring> using namespace std; int main() { int o=0; char str[31]; char c; cin>>str; char*p=str; for(int i=0;i<strlen(str);i++) { c=str[strlen(str)-1]; if(*p==c) { o++; } *p++; } cout<<o; return 0; }