NOIP2015 阅读程序
3.
#include <iostream> #include <string> using namespace std; int main() { string str; int i; int count; count = 0; getline(cin,str); for (i = 0; i < str.length(); i++) { if(str[i] >= 'a' && str[i] <= 'z') count++; } cout << "It has " << count << " lowercases" << endl; return 0; }
输入:NOI2016 will be held in Mian Yang.
输出:
发表评论