This repository contains a beginner-friendly Python program that solves 10 classic string problems in one run. The program asks for inputs once and then prints all results step by step.
- Count vowels and consonants
- Check if a string is a palindrome
- Reverse each word in a sentence
- Count uppercase and lowercase letters
- Remove punctuation from a string
- Character frequency counter
- Replace vowels with
*
- Find the longest word in a sentence
- Remove duplicate characters
- Check if two strings are anagrams
-
Clone this repository:
git clone https://github.com/<your-username>/string-ops-python.git cd string-ops-python
-
Run the program:
python main.py
-
Enter:
- A main string (used in most problems)
- A sentence (used in sentence-based problems)
- A second string (used for the anagram check)
The program will display results for all 10 problems together.
Input:
Enter a string: HelloWorld!!
Enter a sentence: Python is amazing
Enter another string (for Anagram check): dlroWolleH
Output:
--- Results ---
1. Vowels: 3 Consonants: 7
2. Not Palindrome
3. Reversed each word: nohtyP si gnizama
4. Uppercase: 2 Lowercase: 8
5. Without punctuation: HelloWorld
6. Character frequencies: {'h': 1, 'e': 1, 'l': 3, 'o': 2, 'w': 1, 'r': 1, 'd': 1}
7. Replace vowels: H*ll*W*rld!!
8. Longest word: amazing
9. After removing duplicates: HeloWrd!
10. Anagrams
main.py
— Python program with all 10 string problemsREADME.md
— this documentation
MIT License (you can change it if you prefer)