Menu
Question Index
...

Given the input word as a character array, then write a program to suffix every character in the input word.

Input (char[], char) Output (char[])
{'B', 'o', 'o', 'k'}, 'T' {'B', 'T', 'o', 'T', 'o', 'T', 'k', 'T'}
{'D', 'h', 'o', 'n', 'i'}, 'E' {'D', 'E', 'h', 'E', 'o', 'E', 'n', 'E', 'i', 'E'}
{'M', 'o', 't', 'h', 'e', 'r'}, 'O' {'M', 'O', 'o', 'O', 't', 'O', 'h', 'O', 'e', 'O', 'r', 'O'}
{'W', 'e', 'l', 'c', 'o', 'm', 'e'}, 'R' {'W', 'R', 'e', 'R', 'l', 'R', 'c', 'R', 'o', 'R', 'm', 'R', 'e', 'R'}
{'T', 'a', 'b', 'l', 'e'}, 'P' {'T', 'P', 'a', 'P', 'b', 'P', 'l', 'P', 'e', 'P'}



class SuffixEveryCharacterInArray
{
    public static void main(String s[])
    {
        char input[] = {'B', 'o', 'o', 'k'};
        char result[] = suffixEveryCharacter(input, 'T');
        System.out.print("After suffixing every character in the input word : ");
        for (char ch : result)
        System.out.print(ch + " ");

    }


    public static char[] suffixEveryCharacter(char[] input, char suffix) {
    }

}

Doubts

Problems

Topic: Learn Arrays And Loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App