Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- #include<cstring>
- using namespace std;
- ifstream fin("cifre006.in");
- ofstream fout("cifre006.out");
- int main()
- {
- char s[20];
- int k, i, l, ap = 0;
- fin>>s;
- fin>>k;
- l = strlen(s);
- for(i = 0; i < l; i++)
- if(s[i] - '0' == k) ap++;
- fout<<ap<<'\n';
- for(i = 0; i < ap; i++)
- fout<<(char)('0' + k);
- for(i = 0; i < l; i++)
- if(s[i] - '0' != k) fout<<s[i];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement