P17951 [GeeksforGeeks] Remove all characters other than alphabets4923
普及-
题目描述

Given a string S, remove all the characters other than the alphabets.
Example 1:
Input: S = "$Gee*k;s..fo, r'Ge^eks?"
Output: GeeksforGeeks
Explanation: Removed charcters other than
alphabets.

Example 2:
Input: S = "{{{}}> & ^%)"
Output: -1
Explanation: There are no alphabets.

Your Task:
You don't need to read input or print anything. Your task is to complete the function removeSpecialCharacter() which takes string S as input parameter and returns the resultant string. Return "-1" if no alphabets remain.

Expected Time Complexity: O(|s|)
Expected Auxiliary Space: O(|s|)

Constraints:
1 <= |S| <= 10^{5}

输入格式

见题面

输出格式

见题面

样例输入
S = "$Gee*k;s..fo, r'Ge^eks?"
样例输出
GeeksforGeeks