Implement the `IntoIterator` trait for the `RomanNumber` type to enable using a for loop notation. This implementation must allow taking ownership, borrowing and borrowing mutably.
1. Taking ownership (this consumes the RomanNumber)
```rust
for digit in number {
...
}
```
2. Borrowing immutably (this preserves the RomanNumber)
```rust
for digit in &number {
}
```
3. Borrowing mutably (this allow you to modify the RomanNumber without having to return the ownership)
```rust
for digit in &mut number {
}
```
Implement the `Iterator` trait for the `RomanNumber` type. You should use the code from the previous exercise roman_numbers.
Write a **program** which takes a `string` which contains an equation written in `Reverse Polish Notation` (RPN) as its first argument,
which evaluates the equation, and which prints the result on the standard output followed by a newline (`'\n'`).
Write a **program** which takes a `string` that contains an equation written in `Reverse Polish Notation` (RPN) as an argument. The **program** must evaluate the equation, and then:
`Reverse Polish Notation` is a mathematical notation in which every operator follows all of its operands. In RPN,
every operator encountered evaluates the previous 2 operands, and the result of this operation then becomes the first of
the two operands for the subsequent operator. Operands and operators must be spaced by at least one space.
- If the `string` is not valid or if there is not exactly one argument, `Error` must be printed on the standard output followed by a newline.
- If the `string` has extra spaces it is still considered valid.
The following operators must be implemented : `+`, `-`, `*`, `/`, and `%`.
`Reverse Polish Notation` is a mathematical notation in which every operator follows all of its operands. In RPN, every operator encountered evaluates the previous 2 operands, and the result of this operation then becomes the first of the two operands for the subsequent operator. Operands and operators must be spaced by at least one space.
If the `string` is not valid or if there is not exactly one argument, `Error` must be printed on the standard output followed by a newline.
If the `string` has extra spaces it is still considered valid.
The following operators must be implemented : `+`, `-`, `*`, `/`, and `%`.
All the given operands must fit in a `i64`.
@ -55,7 +52,7 @@ For receiving arguments from the command line you should use something like: