FastPrepFastPrep
Problem Brief

Create New Version

INTERNOA
See Cisco online assessment and hiring insights

Create a new version of the given string by following the given rules.

Note

The digits in the input string can be negative, in which case you will append the current output string once to the output. If you encounter 0 or 1, do not append anything to the current output.

𓈒ㅤׂㅤ𓇼 ࣪ 𓈒ㅤׂㅤCredit to Charlotte⭒ 𓆡 ⭒ㅤ𓈒ㅤׂ 🫧

1Example 1

Input
s = "cisco"
Output
"cisco"
Explanation

The given string is "cisco" and contains all letters so add it to the output string (using rule number 1). So, the output will be "cisco".

2Example 2

Input
s = "cisco2india"
Output
"ciscociscoindia"
Explanation

The given string is "cisco2india" which contains one digit '2' after "cisco" so by using rule number 2, we get "ciscocisco" and the remaining substring "india" it is added to the output string using rule number 1. So, the output is "ciscociscoindia".

Constraints

Limits and guarantees your solution can rely on.

🍅🍅
public String createNewVersion(String s) {
  // write your code here
}
Input

s

"cisco"

Output

"cisco"

Sign in to submit your solution.