Filtering and transforming a list using lambda expressions
Kotlin
Medium
lambdas
Task «Filtering and transforming a list using lambda expressions»
Write a program in Kotlin that reads an integer N, then N lines. Each line contains an integer and a word separated by a space. Using lambda expressions and higher-order functions (filter, map, forEach), you need to filter only those lines where the number is positive, then convert each word to uppercase and output them in the same order as they were in the original list. If no elements remain after filtering, output "NO DATA".
Input Format
First line: an integer N (1 ≤ N ≤ 100). Then N lines, each containing an integer and a word (only Latin letters, length from 1 to 20).
Output Format
Strings with transformed words, each on a new line. If there are no suitable elements, output "NO DATA".
Examples
Example 1
INPUT
3
-5 cat
-2 dog
-1 fish
OUTPUT
NO DATA
Example 2
INPUT
1
7 hello
OUTPUT
HELLO
Example 3
INPUT
3
1 500
2 1500
3 200
OUTPUT
500
1500
200
main.kt