-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path32.1 String__replace_indexOf.java
39 lines (27 loc) · 1.2 KB
/
32.1 String__replace_indexOf.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
You need to create an application for a company, who is planning to maintain passwords of his employees, so to manage passwords company officials are thinking about of python case format. In Python case format, particular String is concerted into complete lower case and space is replaced by special character “$”. In this format , password which is taken as string that must consist with more than 1 word.
Input Format
In first line , you need to enter Password
Constraints
make password is of string type only
Output Format
convert entered password into python case format which is mentioned in question statement
Sample Input 0
Hello World
Sample Output 0
hello$world
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc = new Scanner(System.in);
String password = sc.nextLine();
if(password.indexOf(" ")!=-1 && password.lastIndexOf(" ")!=password.length()-1)
{
password = password.toLowerCase().replace(" ","$");
System.out.print(password);
}
}
}