├── README.md ├── LICENSE └── Sentence-Reader.algo /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Sentence Reader - Algorithm 3 | 4 | This program reads a sentence character by character and computes the following: 5 | - **Length of the sentence** (excluding the final period) 6 | - **Number of words** (words are counted based on spaces) 7 | - **Number of vowels** (both uppercase and lowercase) 8 | 9 | ### How It Works: 10 | 1. Reads characters until a period (`.`) is found 11 | 2. Counts the total number of characters, spaces, and vowels. 12 | 3. Adjusts the word count by adding 1 at the end. 13 | 4. Outputs the results. 14 | 15 | 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 CYBER+CODE+CLOUD 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Sentence-Reader.algo: -------------------------------------------------------------------------------- 1 | BEGIN 2 | length_counter := 0 // Counter for sentence length 3 | word_counter := 0 // Counter for number of words 4 | vowel_counter := 0 // Counter for number of vowels 5 | 6 | // Read 1st character 7 | READ character 8 | 9 | // Process the sentence until the point is reached 10 | WHILE character != '.' DO 11 | // Increment the length counter for each character 12 | length_counter := length_counter + 1 13 | 14 | // Check if the character is a vowel 15 | IF character IN ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] THEN 16 | vowel_counter := vowel_counter + 1 17 | END_IF 18 | 19 | // Check if the character is a space to count words 20 | IF character = ' ' THEN 21 | word_counter := word_counter + 1 22 | END_IF 23 | 24 | // Read the next one 25 | READ character 26 | END_WHILE 27 | 28 | // Add 1 to word_counter to account for the last word 29 | word_counter := word_counter + 1 30 | 31 | // Output 32 | WRITE "Length: ", length_counter 33 | WRITE "No. of words: ", word_counter 34 | WRITE "No. of vowels: ", vowel_counter 35 | END 36 | --------------------------------------------------------------------------------