+ 1

No numerals test 3 failed

I don't know why, but the "No Numerals" code coach solution is not working https://code.sololearn.com/cZpcMMsrl242/?ref=app

27th Dec 2019, 6:06 PM
Sarthak
Sarthak - avatar
5 Antworten
+ 6
Sarthak 🇳🇵 I edited your code little bit and now it works https://code.sololearn.com/cg6cNDodsRC7/?ref=app
28th Dec 2019, 6:19 PM
r8w9
r8w9 - avatar
+ 8
Input: 1 2 3 4 5 6 7 8 9 10 Output: one two three four five six seven eight nine onezero
27th Dec 2019, 6:12 PM
SoundInfinity
SoundInfinity - avatar
+ 3
hey this is how its solved f=input() ften=f.replace("10","ten") f1=ften.replace("1","one") f2=f1.replace("2","two") f3=f2.replace("3","three") f4=f3.replace("4","four") f5=f4.replace("5","five") f6=f5.replace("6","six") f7=f6.replace("7","seven") f8=f7.replace("8","eight") f9=f8.replace("9","nine") f0=f9.replace("0","zero") print(f0)
24th Jul 2020, 12:39 PM
Timi Toba
Timi Toba - avatar
+ 2
C++ program of No Numerals #include<iostream> #include<string> using namespace std; int main(){ string s; getline(cin,s); for(int i=0;i<s.length();i++){ char c=s[i]; if(s[i]=='1'&&s[i+1]=='0'){ s.replace(i,2,"ten"); } else if(c=='0'){ s.replace(i,1,"zero"); } else if(c=='1'){ s.replace(i,1,"one"); } else if(c=='2'){ s.replace(i,1,"two"); } else if(c=='3'){ s.replace(i,1,"three"); } else if(c=='4'){ s.replace(i,1,"four"); } else if(c=='5'){ s.replace(i,1,"five"); } else if(c=='6'){ s.replace(i,1,"six"); } else if(c=='7'){ s.replace(i,1,"seven"); } else if(c=='8'){ s.replace(i,1,"eight"); } else if(c=='9'){ s.replace(i,1,"nine"); } } cout<<s; return 0; }
14th Aug 2020, 9:16 AM
namrata singh
namrata singh - avatar
20th Oct 2020, 6:21 AM
イデリセ{非活性}
イデリセ{非活性} - avatar