Lambada Expressions - More Exercises: Lambda and LINQ
IT Researchers at the MIT (Massachusetts Institute of Technology) have discovered that, at certain (room) temperatures, the lambda expressions in their code are acting strange. In particular, a dancing behavior has been observed in them. The specialists choose to call this phenomenon – The Lambada expressions.
You will be given several input lines in the following format:
{selector} => {selectorObject}.{property}
All elements of the input are strings. You need to store every lambada expression, as it is given.
In some rare cases you will receive the input “dance”, which indicates that the lambada expressions are starting to dance. When that happens, you must DOUBLE the selectorObject, so that it becomes “{selectorObject}.{selectorObject}”
in every lambada expression’s condition.
In other words, if you have “x => x.Value”, and you say “dance”, you should get “x => x.x.Value”.
Check the examples for more info.
If you meet a selectorObject which already, you must replace its property with the given new one.
When you receive the command “lambada” you must end the input sequence. When that happens, you must print all lambada expressions.
Examples
Input |
Output |
x => x.Key object => object.Property entry => entry.Name lambada |
x => x.Key object => object.Property entry => entry.Name |
x => x.Key x => x.Value x => x.Name dance dance dance lambada |
x => x.x.x.x.Name |
Нещо не мога да разбера условието и примерите. Някои ще може ли да ми обясни защо при положение ,че е казано "In some rare cases you will receive the input “dance”, which indicates that the lambada expressions are starting to dance. When that happens, you must DOUBLE the selectorObject" т.е ,че се удвоява селектора , то той в 2ри пример не се удвоява ,а просто се добавя 1 и не трябва ли да изглежда :"x => x.x.x.x.Name , а x => x.x.x.x.x.x.x.x.Name" ?
И също така не трябва ли всичките "lambada expression" да се променят и принтират ?