Count Words in CamelCase String
Duration: 4 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- Section A | English: Vocabulary, Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Preposition, Sentence Correction (Error Correction), Sentence Completion (Fill in the blanks), Articles, Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Verbal Analogy (Word Based Analogy)
- Section A | Quant Aptitude: Ratio and Proportion (Ratios), Mixture and Alligation, Permutation and Combination, Number System, HCF LCM, Sequence and Series (Series), Speed Time and Distance, Arithmetic, Algebra, Powers and Exponents (Surds and Indices), Average, Age Problems, Percentage, Profit and Loss, Partnership, Time and Work, Simple Interest and Compound Interest, Mensuration and Geometry, Probability, Pipe and Cistern
- Section A | Reasoning: Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Calendar, Clock, Blood Relations, Directions (Direction Test), Seating Arrangements, Ranking, Order and Sequence, Puzzle Solving (Puzzles)
- Section B | C Programming: C Programming by Yash Sir, Coding Questions by Yash Sir
- Section B | Data Structures: Algorithm Analysis, Greedy Algorithms, Time Complexity Analysis, Sorting Algorithms, Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs
- Section B | OOP (C++): Object Oriented Programming (OOPS), Programming in C++
- Section B | OS: Introduction to OS, Process Management, CPU Scheduling, Process Synchronization, Threads & Process Creation, Deadlock, Memory Management, Virtual Memory, Disc Scheduling, File Management, Windows OS
- Section B | Networking: Introduction to CN, Data Communication, DLL: Access Control, DLL: Flow Control, DLL: Error Control, DLL: Framing, Data Link Layer - Ethernet, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Net Layer:Routing Protocol, Transport Layer Services, TL: Congestion & UDP, Application Layer, Hardware basics
- Section B | AI & Big Data Basics: AI & ML by Arun Sir, Big Data Systems
- Section C | Digital Electronics: Digital Systems & Boolean Basics, Logic Gates & Hardware, Boolean Expression, Boolean Minimization, Combinational Circuit, Sequential Circuits, Number System, Number Representation, Analog-Digital Conversion
- Section A, C | Comp. Fundamentals, COA: Basics of COA, Floating Point Rep, Cache Memory Organization, Input Output Organisation, Pipelining, Instr Formats & Modes, Control Unit Design, Register Transfer and Microoperations, Multiprocessors, Programming the Basic Computer
- MOCK TEST:
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This video is a programming tutorial from Knowledge Gate that teaches how to count words in a string based on specific capitalization rules. The instructor first presents a problem where the first word is entirely lowercase, and all subsequent words start with an uppercase letter followed by lowercase letters. The task is to count the total number of words in the string. The solution involves iterating through the string and identifying word boundaries by checking for uppercase letters. The instructor then demonstrates the solution in C, using a for loop and an if condition to check if a character is an uppercase letter (ASCII 65-90). The code is implemented and tested in an online C compiler, where the input "saveChangesInTheEditor" correctly outputs 5 words, and another test case "iAmShubam" outputs 3 words. The video concludes with a discussion on the logic and a final code run.
Chapters
0:00 – 2:00 00:00-02:00
The video begins with the Knowledge Gate logo, followed by a slide detailing a programming problem. The problem states that a sequence of words is written with the first word in lowercase and all subsequent words starting with an uppercase letter and the rest in lowercase. The task is to count the number of words in a given string. The input is a single line of text, and the output is the word count. The constraints specify the string length is between 1 and 10^5. An example is provided: the input "saveChangesInTheEditor" should output 5, and "iAmShubam" should output 3. The instructor, Yash Jain Sir, explains the problem, emphasizing that the first word is all lowercase and each subsequent word starts with an uppercase letter. He uses a red pen to circle the first word and the uppercase letters in the subsequent words, visually reinforcing the rule. He then explains that the solution involves counting the number of uppercase letters, which indicates the start of a new word, and adding one for the first word.
2:00 – 3:38 02:00-03:38
The instructor transitions to coding the solution in C. The code is displayed on a screen, showing the inclusion of string.h and stdio.h, and the main function. A character array `st[10000]` is declared to hold the input string, and an integer `cnt` is initialized to 0. The `scanf` function reads the input string. A for loop iterates through the string using `strlen(st)`. Inside the loop, an if condition checks if the current character `st[i]` is an uppercase letter by verifying if its ASCII value is between 65 and 90. If true, the counter `cnt` is incremented. After the loop, `printf("%d", cnt+1);` is used to print the total word count, which is the number of uppercase letters plus one for the first word. The instructor explains this logic, highlighting the `cnt` variable and the `printf` statement. The code is then run in an online C compiler. The input "saveChangesInTheEditor" is entered, and the output is 5. The instructor then tests another input, "iAmShubam", which correctly outputs 3, confirming the solution works.
The video provides a clear, step-by-step tutorial on solving a word counting problem with specific capitalization rules. It starts with a well-defined problem statement, uses visual aids to explain the pattern, and then implements a logical solution in C. The core concept is that the number of words is equal to the number of uppercase letters (indicating new words) plus one for the initial lowercase word. The demonstration in the online compiler validates the solution, making it a practical and effective learning resource.

