-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDay37_prob1.java
More file actions
49 lines (34 loc) · 1.1 KB
/
Day37_prob1.java
File metadata and controls
49 lines (34 loc) · 1.1 KB
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
40
41
42
43
44
45
46
47
48
49
/*
Ram was writing the essay and by mistakely he wrote in past continue tense inspite of present continue tense so write a program by using String class method to replace all.
Input Format
This was a beautiful Flower.
Constraints
All the sentences should be is the past continue sentences only.
Output Format
This is a beautiful Flower.
Sample Input 0
He was having ten pens and all pens were in good condition.
Sample Output 0
He is having ten pens and all pens are in good condition.
Sample Input 1
he is working in bank
Sample Output 1
Invalid
*/
// Kirtan Jain
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 s = sc.nextLine();
if(s.contains("is") || s.contains("are")){
System.out.println("Invalid");
return;
}
s=s.replaceAll("was","is");
s=s.replaceAll("were","are");
System.out.println(s);
}
}