0

Jungle Camping - TEST #3

TEST case #3 is faild. Does anyone know why ;)? #include <string> #include <iostream> using namespace std; int main() { int index; string sound; getline(cin, sound); while ((index = sound.find("Rawr")) != string::npos) { string newSound = "Tiger"; sound.replace(index, newSound.length() - 1, newSound); } while ((index = sound.find("Grr")) != string::npos) { string newSound = "Lion"; sound.replace(index, newSound.length() - 1, newSound); } while ((index = sound.find("Ssss")) != string::npos) { string newSound = "Snake"; sound.replace(index, newSound.length() - 1, newSound); } while ((index = sound.find("Chirp")) != string::npos) { string newSound = "Bird"; sound.replace(index, newSound.length() - 1, newSound); } cout << sound; return 0; }

27th Aug 2020, 7:19 PM
Ambrozja 🇵🇱
Ambrozja 🇵🇱 - avatar
2 Antworten
27th Aug 2020, 8:12 PM
Ambrozja 🇵🇱
Ambrozja 🇵🇱 - avatar