about | help | code help+videos | done | prefs |
Given an input String, first decide if the String contains "I am (something)", like "I think I am hungry". If it does not contain "I am (something)", return "I don't understand". Note that this problem is just like the previous one, except it's more flexible - "I am (something)" could occur anywhere in the input. If it does contain "I am (something)", return a response that includes part of the input in the form "Why are you (rest of input)?" If you are still confused, see the input/output test cases. HINT: use substring to capture the rest of the input, which becomes part of the output.apcsaChatbotsRearrangeContainsIAm("I am hungry") → "Why are you hungry?" apcsaChatbotsRearrangeContainsIAm("I was hungry") → "I don't understand" apcsaChatbotsRearrangeContainsIAm("What if I am hungry") → "Why are you hungry?" ...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: 210
Copyright Nick Parlante 2017 - privacy