6 kyu
Simple Fun #305: Typist
743 of 1,613myjinxin2015
Description:
Task
John is a typist. He has a habit of typing: he never use the Shift
key to switch case, just using only Caps Lock
.
Given a string s
. Your task is to count how many times the keyboard has been tapped by John.
You can assume that, at the beginning the Caps Lock
light is not lit.
Input/Output
[input]
string s
A non-empty string. It contains only English letters(uppercase or lowercase).
1 ≤ s.length ≤ 10000
[output]
an integer
The number of times John tapped the keyboard.
Example
For s = "a"
, the output should be 1
.
John hit button a
.
For s = "aa"
, the output should be 2
.
John hit button a, a
.
For s = "A"
, the output should be 2
.
John hit button Caps Lock, A
.
For s = "Aa"
, the output should be 4
.
John hit button Caps Lock, A, Caps Lock, a
.
Fundamentals
Similar Kata:
Stats:
Created | May 25, 2017 |
Published | May 25, 2017 |
Warriors Trained | 2562 |
Total Skips | 35 |
Total Code Submissions | 3959 |
Total Times Completed | 1613 |
JavaScript Completions | 743 |
Python Completions | 773 |
Groovy Completions | 14 |
Ruby Completions | 48 |
COBOL Completions | 4 |
C Completions | 67 |
Go Completions | 22 |
Total Stars | 45 |
% of votes with a positive feedback rating | 96% of 302 |
Total "Very Satisfied" Votes | 278 |
Total "Somewhat Satisfied" Votes | 23 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 6 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |