|
| 1 | +/* |
| 2 | +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. |
| 3 | + |
| 4 | +Input Format |
| 5 | + |
| 6 | +In first line , you need to enter Password |
| 7 | + |
| 8 | +Constraints |
| 9 | + |
| 10 | +make password is of string type only |
| 11 | + |
| 12 | +Output Format |
| 13 | + |
| 14 | +convert entered password into python case format which is mentioned in question statement |
| 15 | + |
| 16 | +Sample Input 0 |
| 17 | + |
| 18 | +Hello World |
| 19 | +Sample Output 0 |
| 20 | + |
| 21 | +hello$world |
| 22 | +*/ |
| 23 | +import java.io.*; |
| 24 | +import java.util.*; |
| 25 | + |
| 26 | +public class Solution { |
| 27 | + |
| 28 | + public static void main(String[] args) { |
| 29 | + /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ |
| 30 | + Scanner sc = new Scanner(System.in); |
| 31 | + String password = sc.nextLine(); |
| 32 | + if(password.indexOf(" ")!=-1 && password.lastIndexOf(" ")!=password.length()-1) |
| 33 | + { |
| 34 | + password = password.toLowerCase().replace(" ","$"); |
| 35 | + System.out.print(password); |
| 36 | + } |
| 37 | + |
| 38 | + } |
| 39 | +} |
0 commit comments