1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Degger [83]
2 years ago
14

You will be given a string, containing both uppercase and lowercase alphabets(numbers are not allowed).

Computers and Technology
1 answer:
murzikaleks [220]2 years ago
6 0

Answer:

The Java code is given below with appropriate comments

Explanation:

import java.util.*;

class Main {

   static Set<String> set = new HashSet();

   static void printPerms(char ch[], int ind){

       //If end of string is reached, add it to set

       if(ind==ch.length){

           set.add(new String(ch));

           return;

       }

       for(int i=ind;i<ch.length;i++){

           //Only swap if lower case

           if((ch[i]>='a' && ch[i]<='z')&&((ch[ind]>='a' && ch[ind]<='z'))){

               char t  = ch[i];

               ch[i] = ch[ind];

               ch[ind] = t;

           }

           printPerms(ch,ind+1);

           if((ch[i]>='a' && ch[i]<='z')&&((ch[ind]>='a' && ch[ind]<='z'))){

               char t  = ch[i];

               ch[i] = ch[ind];

               ch[ind] = t;

           }

       }

   }

   public static void main(String[] args) {

       printPerms("aBbCc".toCharArray(),0);

       System.out.println(set);

   }

}

You might be interested in
An employee sets up an automation that transfers files in a specific folder on their PC to a remote drive for archiving, provide
Yuri [45]

Answer:

Rule based automation

Explanation:

8 0
2 years ago
What is this affect in photography?? pls help!!
dlinn [17]
Its called tilt shift effect
3 0
3 years ago
Write a method that accepts a String object as an argument and returns a copy of the string with the first character of each sen
emmainna [20.7K]

Answer:

The programming language is not stated; However, the program written in C++ is as follows: (See Attachment)

#include<iostream>

using namespace std;

string capt(string result)

{

result[0] = toupper(result[0]);

for(int i =0;i<result.length();i++){

 if(result[i]=='.' || result[i]=='?' ||result[i]=='!')  {

 if(result[i+1]==' ') {

  result[i+2] = toupper(result[i+2]);

 }

 if(result[i+2]==' ')  {

  result[i+3] = toupper(result[i+3]);

 }

 } }

return result;

}

int main(){

string sentence;

getline(cin,sentence);

cout<<capt(sentence);

return 0;

}

Explanation:

<em>The method to capitalize first letters of string starts here</em>

string capt(string result){

<em>This line capitalizes the first letter of the sentence</em>

result[0] = toupper(result[0]);

<em>This iteration iterates through each letter of the input sentence</em>

for(int i =0;i<result.length();i++){

This checks if the current character is a period (.), a question mark (?) or an exclamation mark (!)

if(result[i]=='.' || result[i]=='?' ||result[i]=='!')  {

 if(result[i+1]==' '){  ->This condition checks if the sentence is single spaced

  result[i+2] = toupper(result[i+2]);

-> If both conditions are satisfied, a sentence is detected and the first letter is capitalized

 }

 if(result[i+2]==' '){ ->This condition checks if the sentence is double spaced

  result[i+3] = toupper(result[i+3]);

-> If both conditions are satisfied, a sentence is detected and the first letter is capitalized

 }

}

}  <em>The iteration ends here</em>

return result;  ->The new string is returned here.

}

The main method starts here

int main(){

This declares a string variable named sentence

string sentence;

This gets the user input

getline(cin,sentence);

This passes the input string to the method defined above

cout<<capt(sentence);

return 0;

}

Download cpp
7 0
3 years ago
What is the keyboard shortcut for copying text?<br><br> Ctrl+P<br> Shift+P<br> Ctrl+C<br> Ctrl+P
iren2701 [21]

Answer:

ctrl+c

Explanation:

6 0
3 years ago
Read 2 more answers
In Microsoft Word, a user can find the Customize Keyboard dialog box in the Customize Ribbon section of the
MissTica

Answer:

view tab

Explanation:

I think that is the answer

5 0
2 years ago
Other questions:
  • The _____ establishes that the destination device is present on the network, verifies active service, and informs the destinatio
    13·1 answer
  • The name of the opening that lets light into any camera is called ________.
    11·2 answers
  • Describe how you believe technology will impact our society in 50 years.
    6·1 answer
  • Courteous behavior on the road will
    10·2 answers
  • Nothin to see here just browsin
    15·1 answer
  • If you want to wrap text so that it fits a particular cell, which formatting section would you use?
    13·1 answer
  • Taking a group of recipes and identifying the similarities is an example of _____.
    13·1 answer
  • Which one causes concerns for institutions or businesses when they are collected stores and they aren’t secured properly?
    5·1 answer
  • Which statement best describes the Tell Me feature in PowerPoint 2016?
    13·1 answer
  • Five programs are currently being run in a computer. Program 1 is using 10 GiB of RAM, program 2 is using 5 GiB of RAM, program
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!