Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- using namespace std;
- void LlegirParaules(vector<string>& cas, string& paraula) {
- while (paraula != "FI") {
- cas.push_back(paraula);
- cin >> paraula;
- }
- }
- int count_vocal(string p){
- int count = 0;
- for(int i = 0; i < p.length();i++){
- char c = p[i];
- if (c == 'A' or c == 'E' or c=='I' or c == 'O' or c=='U') count++;
- }
- return count;
- }
- int main(){
- string palabra;
- while(cin >> palabra){
- if(palabra == "FI") cout << "-" << endl;
- else{
- vector<string>s;
- bool hay = false;
- LlegirParaules(s,palabra);
- /*for(int i = 0; i < s.size()-1; i++){
- if (count_vocal(s[i]) == count_vocal(s[s.size()-1])){
- cout << s[i] << ", " << i << endl;
- hay = true;
- }*/
- int i = 0;
- while(i< s.size()-1 and not hay){
- if (count_vocal(s[i]) == count_vocal(s[s.size()-1])){
- cout << s[i] << ", " << i << endl;
- hay = true;
- }
- i++;
- }
- if(not hay) cout << "-" << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement