Aaaaaaa to a

Report a typo

Write a program that reads a string, then replaces all repeatedly occurring "a" letters in it with a single "a" (e.g., "aaAAaaa" must be replaced with one "a" character), and prints the resulting text. Your code must be case insensitive.

See examples for better understanding.

Note, you need to replace a single "A" with "a".

Input: text: String

Output: newText: String

Sample Input 1:

And I will aalwaaaaaays love you. I will Aaalways love you.

Sample Output 1:

and I will always love you. I will always love you.

Sample Input 2:

Mamaaa, life had just begun, But now I've gone and thrown it all awaaaaAAAay

Sample Output 2:

Mama, life had just begun, But now I've gone and thrown it all away
Write a program in Kotlin
fun main() {
val text = readln()
// write your code here
}
___

Create a free account to access the full topic