思路

找单词

第一个 单词 是小写

然后 后面的单词 第一位 都是大写

刚开始 初始化 ans = 1

然后 往后遍历

碰到 大写的 更新答案

AC代码

#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <climits>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <limits> using namespace std;
typedef long long LL; const double PI = 3.14159265358979323846264338327;
const double E = 2.718281828459;
const double eps = 1e-6; const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 5;
const int MOD = 1e9 + 7; int main()
{
string s;
cin >> s;
int len = s.size();
LL ans = 1;
for (int i = 0; i < len; i++)
{
if (s[i] >= 'A' && s[i] <= 'Z')
ans++;
}
cout << ans << endl;
}

HackerRank - camelcase 【字符串】的更多相关文章

  1. webstrom官方的活动模版介绍

    编辑模板变量对话框 文件|设置|生活模板--编辑变量Windows和LinuxWebStorm |偏好|生活模板--编辑变量在OS XCtrl + Alt + S 当你点击对话框打开 编辑变量按钮模板 ...

  2. IntelliJ IDEA实时模板变量

    返回由当前方法返回的值的类型IntelliJ IDEA 实时模板中的模板变量允许用户输入.扩展模板后,变量将作为输入字段显示在编辑器中. IntelliJ IDEA 声明实时模板变量 模板中的变量以下 ...

  3. webstorm的live templates快速编辑功能,让你的css JS代码书写速度飞起来

    前言: Emmet的前身是大名鼎鼎的Zen coding,如果你从事Web前端开发的话,对该插件一定不会陌生.它使用仿CSS选择器的语法来生成代码, 大大提高了HTML/CSS代码编写的速度,比如下面 ...

  4. HackerRank - beautiful-binary-string 【字符串】

    题意 给出一个 N 位的 01 串 然后 每次 改动 可以将其中的 (0 -> 1) 或者 (1 -> 0) 然后 求 最少几次 改动 使得 这个 01 串 当中 不存在 连续的 010 ...

  5. jQuery静态方法noop,camelCase,nodeName,trim使用和源码分析

    noop方法 jQuery.noop()函数是一个空函数,它什么也不做. 当某些时候你需要传入函数参数,而且希望它什么也不做的时候,你可以使用该函数,也无需再新建一个空的函数. 示例: // 传入一个 ...

  6. jQuery 源码中的 camelCase

    先看一下源码 //65-72行 // Matches dashed string for camelizing //匹配连字符 ‘-’ 和其后的第一个字母或数字,如果是字母,则替换为大写,如果是数字, ...

  7. JSONModel - 字符串换转实体类

     JSONModel https://github.com/icanzilb/JSONModel/ 一. 获取属性的元数据 const char *attrs = property_getAttrib ...

  8. 【JavaScript】字符串处理函数集合

    var $string = {}, toString, template, parseURL, buildURL, mapQuery, test, contains, trim, clean, cam ...

  9. *[hackerrank]Sam and sub-strings

    https://www.hackerrank.com/contests/w3/challenges/sam-and-substrings DP.注意到以N[i]结尾的每个字符串的子数字和有规律: 53 ...

随机推荐

  1. C#趣味程序---水仙花数

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  2. epoll使用详解(精髓)(转)

    epoll - I/O event notification facility 在linux的网络编程中,很长的时间都在使用select来做事件触发.在linux新的内核中,有了一种替换它的机制,就是 ...

  3. iOS 11之Vision人脸检测

    代码地址如下:http://www.demodashi.com/demo/11783.html 大道如青天,我独不得出 前言 在上一篇iOS Core ML与Vision初识中,初步了解到了visio ...

  4. Android应用程序开发以及背后的设计思想深度剖析

    1 http://www.uml.org.cn/mobiledev/201211063.asp 2 ...

  5. SpannableString 设置一段文字中部分字体颜色

    SpannableString strTitle = new SpannableString("病情描述(必填项,请至少填写20个字)"); strTitle.setSpan(ne ...

  6. css 猫头鹰选择器

    除了第一个以外的兄弟选择器.由于看起来像猫头鹰,也叫猫头鹰选择器 .TD-Breadcrumb > li + li:before { padding: 0 5px; color: #ccc; c ...

  7. 给定一个字符串s,你可以从中删除一些字符,使得剩下的串是一个回文串。如何删除才能使得回文串最长呢? 输出需要删除的字符个数。

    // ConsoleApplication1.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<iostream> ...

  8. 使用ffmpeg下载m3u8流媒体

    安装 编译好的windows可用版本的下载地址(官网中可以连接到这个网站,和官方网站保持同步): http://ffmpeg.zeranoe.com/builds/ 或者: 百度网盘https://p ...

  9. Android Handler警告,SimpleDateFormat警告

    1:Handler// This Handler class should be static or leaks might occur: IncomingHandler    @SuppressLi ...

  10. 嵌入式开发之web服务器---boa移植

    近段时间在做ti8148的编解码器又涉及到boa web服务器的移植.在移植到ARM开发板的过程中,遇到很多的问题.原先的自带thttpd 由于功能没有boa完善,比如在ubuntu下面的utf-8编 ...