您的位置:首页 > 其它

周赛问题 福州 B - Somali Pirates

2013-11-18 22:16 323 查看
DescriptionIt is said that the famous Somali Pirates hate digits. So their QQ passwords never contain any digit. Given some lines of candidate passwords, you are asked to delete all the digits in the passwords and print other characters in their original order. Sothe Somali Pirates can use them as their QQ passwords^^InputThere are multiple test cases. The first line of input is an integer T (T <= 10) indicating the number of test cases.Each case contains a line indicating a candidate password. The length of the password is between 1 and 20, inclusive. Besides, the password consists of only digits and English letters.OutputFor each candidate password, delete all the digits and print the remaining characters in a line.Sample Input
2
BeatLA123
1plus1equals1
Sample Output
BeatLA
plusequals
#include <iostream>#include <cstring>using namespace std;int main(){int t;while(cin>>t){while(t--){string a;cin>>a;//int l=strlen(a);int l=a.size();for(int i=0; i<l; i++){if(a[i]>='0'&&a[i]<='9'){a[i]=' ';}}for(int i=0; i<l; i++){if(a[i]==' ')continue;elsecout<<a[i];}cout<<endl;}}return 0;}
[/code]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: