Strings
Strings
Strings
Programs
1. Write a program to input a sentence and convert it into uppercase and count and
display the total number of words starting with a letter ‘A’.
Output
2.Special words are those words which starts and ends with the same letter.
Examples:
EXISTENCE
COMIC
WINDOW
Palindrome words are those words which read the same from left to right and vice
versa
Examples:
MALAYALAM
MADAM
LEVEL
ROTATOR
CIVIC
All palindromes are special words, but all special words are not palindromes. Write a
program to accept a word, check and print whether the word is a palindrome or only
special word.
Output
3. Write a program to initialize the seven Wonders of the World along with their
locations in two different arrays. Search for a name of the country input by the user.
If found, display the name of the country along with its Wonder, otherwise display
“Sorry Not Found!”.
Seven wonders — CHICHEN ITZA, CHRIST THE REDEEMER, TAJMAHAL, GREAT WALL
OF CHINA, MACHU PICCHU, PETRA, COLOSSEUM
Locations — MEXICO, BRAZIL, INDIA, CHINA, PERU, JORDAN, ITALY
Example — Country Name: INDIA Output: INDIA-TAJMAHAL
Country Name: USA Output: Sorry Not Found!
4.Write a program to assign a full path and file name as given below. Using library
functions, extract and output the file path, file name and file extension separately as
shown.
Input C: / Users / admin / Pictures / flower.jpg
Output path: C: / Users/admin/Pictures/
File name: flower
Extension: jpg
5.Write a program that encodes a word into Piglatin. To translate word into a Piglatin
word, convert the word into uppercase and then place the first vowel of the original
word as the start of the new word along with the remaining alphabets. The
alphabets present before the vowel being shifted towards the end followed by “AY”.
Sample input (1) : London, Sample output (1) : ONDONLAY
Sample input (2) : Olympics, Sample output (2) : OLYMPICSAY
6.Write a program to accept a string. Convert the string to uppercase. Count and
output the number of double letter sequences that exist in the string.
Sample Input: “SHE WAS FEEDING THE LITTLE RABBIT WITH AN APPLE”
Sample Output: 4
7. Write a program to accept a word and convert it into lowercase if it is in
uppercase, and display the new word by replacing only the vowels with the
character following it :
Example :
Sample Input : computer
Sample Output : cpmpvtfr
8. Write a program in Java to accept a string in lower case and change the first letter
of every word to upper case. Display the new string.
Sample input: we are in cyber world
Sample output: We Are In Cyber World
9.Define a class to accept a string and print the characters with the upper case and
lowercase reversed, but all other characters should remain the same as before.
Example : WelCoMe_2023
Output: wELcOmE_2023
10. Define a class to accept two strings of same length and form a new word in such
a way that , the first character of the first word is followed by the first character of
the second word and so on.
Example:
Input string 1 – BALL
Input string 2 - WORD
Output
BWAOLRLD
Binary Search in descending order array
Soumia Prasanth
9400841344