1 solutions
-
0
C++ :
#include<bits/stdc++.h> using namespace std; int main() { string st[8]={"apples","bananas","peaches","cherries","pears","oranges","strawberries"}; string s; while(getline(cin,s)) { int pos=-1,t=0; for(int i=0;i<7;i++) { pos=s.find(st[i]); if(pos>=0) { s.replace(pos,st[i].size(),"fruit"); t=1; cout<<s<<endl; break; } } if(t==0) cout<<"You must not enjoy fruit."<<endl; } return 0; }
- 1
Information
- ID
- 1047
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By