FZU 1771 Counting in English

 

Counting in English
Time Limit:1s Memory limit:32M
Accepted Submit:54 Total Submit:74

Problem Description

Given two positive integers a and b, count from a to b, in English.

Input

The first line containst (1 <= t <= 10), the number of test cases followed. Each line contains two strings a and b(1 <= a <= b <= 10), in lowercase.

OutPut

For each test case, count from a to b in a single line. Each two consecutive words should be separated by a single space. Every English word must be in lowercase.

Sample Input

3 
one four
five nine 
ten ten

Sample Output

one two three four
five six seven eight nine
ten

Original: 2009 NIT Cup National Invitation Contest Practice Session

 解题:        水题。关于字符串的。 #include <iostream> #include <string> using namespace std; int main() { int n,i,length; string s1,s2; cin>>n; string s="one two three four five six seven eight nine ten "; while (n--) { s1="";s2=""; cin>>s1>>s2; s1=strstr(s.c_str(),s1.c_str()); s2=strstr(s.c_str(),s2.c_str()); length=s1.size()-s2.size(); length+=s2.find_first_of(' ',0); for (i=0;i<length;i++) { cout<<s1[i]; } cout<<endl; } return 0; }

你可能感兴趣的:(session,input,each)