about | help | code help+videos | done | prefs |
Write a method that accepts an input string representing chemical compounds or combinations of chemical compounds. Multiple copies are indicated by a number followed by a "/" character. The "~" character is used as a divider. So "5/H~2~O" represents five molecules of water. The desired result is to represent the same chemicals without the special divider symbols. For example, "5/H~2~O" as an input parameter should return "5H2O" as the return value. Look at the test data for other examples. The ONLY string methods you are allowed to use are .length, .charAt, .substring, .equals. In fact, you only NEED two of these string methods! (Or maybe even just one if you are really sneaky and know some advanced stuff) feb27_2018_APSLHL_chemistry("H~2~O") → "H2O" feb27_2018_APSLHL_chemistry("") → "" feb27_2018_APSLHL_chemistry("C~O~2") → "CO2" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy