πŸ“˜ Day 11 – Teacher's Day Challenge | String Task

TanishiTanishi
2 min read

πŸ—“οΈ Date: August 04, 2025
🧩 Platform: Codeforces
πŸ”’ Problems Solved Today: 1
🎯 Focus Topic: Strings, Character Filtering, Case Handling


πŸ”— Table of Contents


🧩 Problem 1 – String Task

πŸ“š Difficulty: Easy
🧠 Concepts: Character Iteration, Lowercasing, Vowel Removal, String Building


πŸ“„ Problem Statement (Summary):
Given a string with uppercase and lowercase Latin letters, perform the following:

  • Remove all vowels (A, O, Y, E, U, I and lowercase variants).

  • Convert all uppercase consonants to lowercase.

  • Insert . before every consonant that remains.

Output the final processed string.

Examples:
Input: tour β†’ Output: .t.r
Input: Codeforces β†’ Output: .c.d.f.r.c.s
Input: aBAcAba β†’ Output: .b.c.b


πŸ’‘ Approach:

  • Read input string.

  • Iterate through each character:

    • Convert it to lowercase.

    • Skip if it’s a vowel.

    • Otherwise, append "." + character" to result.

  • Print final result.


πŸ§ͺ Code (C++):

#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>
using namespace std;
int main()
{
    string str, result;
    cin >> str;

    for (char ch : str)
    {
        ch = tolower(ch);
        if (ch == 'a' || ch == 'o' || ch == 'y' || ch == 'e' || ch == 'u' || ch == 'i')
            continue;
        result += ".";
        result += ch;
    }
    cout << result;
    return 0;
}

πŸ“Έ Submission Screenshot:


βœ… Key Takeaways:

  • tolower() simplifies case normalization.

  • Filtering is easy using continue in loops.

  • Vowels are explicitly checked; all others are treated as consonants.

  • Concatenating strings in loops is fine for small input sizes.


πŸ“ˆ Daily Summary

MetricValue
Problems Solved1
Topics CoveredStrings, Case Handling
Tools UsedC++
Next FocusFrequency Maps, String Arrays
Day11 / 30

🏷️ Tags:
#codeforces #strings #tolower #filtering #cpp #dsa #43DaysChallenge

0
Subscribe to my newsletter

Read articles from Tanishi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Tanishi
Tanishi