Codeforces 118A. String Task solution in C/CPP

118A. String Task problem link

Codeforces 118A. String Task solution in C

#include<stdio.h>

int main() { int i; char s[101]; gets(s); strlwr(s); for(i=0;s[i]!='\0';i++) { if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='A'||s[i]=='E'||s[i]=='O'||s[i]=='I'||s[i]=='U'||s[i]=='y'||s[i]=='Y') { continue;

} else { printf(".%c",s[i]); } } printf("\n"); return 0; }

Codeforces 118A. String Task solution in CPP

#include <iostream>

 #include <cstring>

 #include <cctype>

using namespace std;

int main() { 

string s; 

getline(cin, s);

 for (char &c : s) c = tolower(c);

 for (char c : s) { if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y')

 { 

continue;

 } 

else { cout << "." << c; } 

}

 cout << endl; 

return 0; 

}

Codeforces 236A. Boy or Girl  Solution

2 thoughts on “Codeforces 118A. String Task solution in C/CPP”

Leave a Comment