Created
August 3, 2015 00:34
-
-
Save danielsaad/03e5e2047fd7e12db673 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* File: 1234.cpp | |
* Author: daniel | |
* | |
* Created on 2 de Agosto de 2015, 20:31 | |
*/ | |
#include <iostream> | |
#include <string> | |
#include <algorithm> | |
#include <bits/c++config.h> | |
using namespace std; | |
/* | |
* | |
*/ | |
//p -> f | |
//s -> f | |
//j -> f | |
//v -> f; | |
//x -> f; | |
//b -> f; | |
// | |
int main(int argc, char** argv) { | |
string str; | |
while(getline(cin,str)){ | |
replace(str.begin(),str.end(),'p','f'); | |
replace(str.begin(),str.end(),'s','f'); | |
replace(str.begin(),str.end(),'v','f'); | |
replace(str.begin(),str.end(),'x','f'); | |
replace(str.begin(),str.end(),'b','f'); | |
replace(str.begin(),str.end(),'j','f'); | |
replace(str.begin(),str.end(),'z','f'); | |
replace(str.begin(),str.end(),'P','F'); | |
replace(str.begin(),str.end(),'S','F'); | |
replace(str.begin(),str.end(),'V','F'); | |
replace(str.begin(),str.end(),'X','F'); | |
replace(str.begin(),str.end(),'B','F'); | |
replace(str.begin(),str.end(),'J','F'); | |
replace(str.begin(),str.end(),'Z','F'); | |
string str2; | |
for(unsigned int i=0;i<str.size();){ | |
char f = str[i]; | |
while(i<str.size() && tolower(str[i])=='f' && tolower(str[i+1])=='f'){ | |
i++; | |
} | |
str2.push_back(f); | |
i++; | |
} | |
cout << str2 << "\n"; | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment