top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Given a string and a non empty word string, return a string made of each char just before and just after every am..?

+2 votes
630 views

Given a string and a non empty word string, return a string made of each char just before and just after every appearance the word in the string.
Ignore cases where there is no char before or after the word, and a char may be included twice if it is between two words.

If inputs are abcXY123XYijk and XY output should be c123

posted Apr 17, 2017 by Atindra Kumar Nath

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+2 votes

I want a java method which will take input as a string and return a string with char count, please help.

+2 votes

Given 2 strings, a and b, return a string of the form shorterString+longerString+shorterString, with the shorter string on the outside and the longer string on the inside. The strings will not be the same length, but they may be empty (length 0). If input is "hi" and "hello", then output will be "hihellohi".

+2 votes

Return a version of the given string, where for every star (*) in string the star and thr chars immediately to its left and right are gone. So "ab*cd" yields "ad" and "ad**cd" also yields "ad".

+4 votes

Design an algorithm to accept a string from the user. Count and print the number of times each character occurs in the given string. Example –
input string = "malayalam"
Output must be –
m – 2
a – 4
l – 2
y - 1

+3 votes

Implement a code that counts the occurrences of each word in an input file and write the word along with corresponding count in an output file sorted by the words alphabetically.

Sample Input

Gaurav is  a Good Boy
Sita is a Good Girl
Tommy is  a Good Dog
Ram is a Good person

Sample Output

D:\>Java FileWordCount inputFile.txt outputFile.txt
    Boy : 1
    Dog : 1
    Gaurav : 1
    Girl : 1
    Good : 4
    Ram : 1
    Sita : 1
    Tommy : 1
    a : 4
    is : 4
    person : 1
...