Skip to content

Commit 65e58ae

Browse files
Create 37.1 past continue sentences to present continue tense.java
1 parent b65e20e commit 65e58ae

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
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.
3+
4+
Input Format
5+
6+
This was a beautiful Flower.
7+
8+
Constraints
9+
10+
All the sentences should be is the past continue sentences only.
11+
12+
Output Format
13+
14+
This is a beautiful Flower.
15+
16+
Sample Input 0
17+
18+
He was having ten pens and all pens were in good condition.
19+
Sample Output 0
20+
21+
He is having ten pens and all pens are in good condition.
22+
Sample Input 1
23+
24+
he is working in bank
25+
Sample Output 1
26+
27+
Invalid
28+
*/
29+
import java.io.*;
30+
import java.util.*;
31+
32+
public class Solution {
33+
34+
public static void main(String[] args) {
35+
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
36+
Scanner sc = new Scanner(System.in);
37+
//input
38+
String input = sc.nextLine();
39+
if(input.indexOf("was")!=-1 || input.indexOf("were")!=-1 || input.indexOf("Was")!=-1 || input.indexOf("Were")!=-1)
40+
{
41+
input = input.replaceAll("was","is").replaceAll("were","are");
42+
System.out.print(input);
43+
}
44+
else
45+
{System.out.print("Invalid");}
46+
}
47+
}

0 commit comments

Comments
 (0)