复赛一:标题统计(title)

洛谷:P5015
OJ: P4959

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include<iostream>
#include <string>
using namespace std;

int main(){
    string str;
    int a,n=0;
    getline(cin, str);
    a=str.length();
    for (int i = 0; i <a; i++)
    if((str[i]>='a'&&str[i]<='z')||(str[i]>='A'&&str[i]<='Z')||(str[i]>='0'&&str[i]<='9'))n++;
    cout<<n;
}
Scroll to Top