Which character is first among 4 characters in c++ - c++

In my project I take a string from user and then I need to check if vowels a, e, I, O, U are present. If so, I have to find out which one comes first in the string and which one comes next after that. For example, if a user gave input something like this:
char expr[] = "this is for something real";
I comes first, then I again, then O and so on. I checked whether the characters are in the string or not using strchr(expr,'character here'). To find which character comes first, I find the index of each character using
const char *ptr = strchr(expr, characters here);
if(ptr) {
int index = ptr - expr;
}
After that I check which index is bigger. But this is very long process.
Is there a smarter way to do this?

If you don't need the locations in the original string, but only the order, you can use std::remove_copy_if with a functor that detects non-vowel characters (i.e. returns true for vowels):
std::string only_vowels;
std::remove_copy_if( std::begin(expr), std::end(expr),
std::back_inserter(only_vowels),
[]( char ch ) { char upper = toupper(ch);
return upper!='A'
&& upper!='E'
&& upper!='I'
&& upper!='O'
&& upper!='U'; } );
(Using C++11 features to obtain the iterators and a lambda instead of creating a functor, but the same can be written in C++03 with a bit of extra boiler plate code. Code is untested)
After the algorithm completes, only_vowels will contain only the vowels present in the original string and in the exact order where they appeared. Case is not modified by the algorithm.
Alternatively you can iterate manually over the elements in the string, and test each character to see whether it is a vowel, then print it or do whatever needs to be done. If this is homework, this is probably what is expected from you.

This can be done pretty easily by simply iterating over the input expression and noting when the target letters are encountered. Here's a C++11 way that will fill a std::vector with the vowels in the order they are seen in the input expression. If you just need to print them out, then just don't fill the results vector (print them instead).
char expr[] = "this is for something real";
std::vector<char> results;
std::for_each(
expr,
expr + strlen(expr),
[&results] (const char c)
{
switch(c)
{
case 'a':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U':
results.push_back(c);
}
});

Here's a method that gives you the characters found, as well as the indices (in order automatically). It also makes use of some C++ features, rather than C:
int main() {
std::string expr = "this is for something real";
std::string toCheck = "AaEeIiOoUu"; //checking for these letters
std::map<int, char> indices; //stores index-character pairs
for (char c : toCheck) { //go through each char in string (ranged-for, C++11)
if (expr.find (c) != std::string::npos)
indices [expr.find (c)] = c; //map sorts itself by key
}
for (const auto &element : indices) { //print results
std::cout << "'" << element.second << "'"
<< " found at index " << element.first << '\n';
}
}
I'm not sure if it offers anything else you need over David's answer, but it's one way to do it, and does allow for more information to be pulled. The current code, however, will only give you the first occurrence of each. I'm not sure whether you wanted all or the first, but it is adaptable. At that point, though, David's answer fits in quite nicely.

Related

How do I make an alphabetized list of all distinct words in a file with the number of times each word was used?

I am writing a program using Microsoft Visual C++. In the program I must read in a text file and print out an alphabetized list of all distinct words in that file with the number of times each word was used.
I have looked up different ways to alphabetize a string but they do not work with the way I have my string initialized.
// What is inside my text file
Any experienced programmer engaged in writing programs for use by others knows
that, once his program is working correctly, good output is a must. Few people
really care how much time and trouble a programmer has spent in designing and
debugging a program. Most people see only the results. Often, by the time a
programmer has finished tackling a difficult problem, any output may look
great. The programmer knows what it means and how to interpret it. However,
the same cannot be said for others, or even for the programmer himself six
months hence.
string lines;
getline(input, lines); // Stores what is in file into the string
I expect an alphabetized list of words with the number of times each word was used. So far, I do not know how to begin this process.
It's rather simple, std::map automatically sorts based on key in the key/value pair you get. The key/value pair represents word/count which is what you need. You need to do some filtering for special characters and such.
EDIT: std::stringstream is a nice way of splitting std::string using whitespace delimiter as it's the default delimiter. Therefore, using stream >> word you will get whitespace-separated words. However, this might not be enough due to punctuation. For example: Often, has comma which we need to filter out. Therefore, I used std::replaceif which replaces puncts and digits with whitespaces.
Now a new problem arises. In your example, you have: "must.Few" which will be returned as one word. After replacing . with we have "must Few". So I'm using another stringstream on the filtered "word" to make sure I have only words in the final result.
In the second loop you will notice if(word == "") continue;, this can happen if the string is not trimmed. If you look at the code you will find out that we aren't trimming after replacing puncts and digits. That is, "Often," will be "Often " with trailing whitespace. The trailing whitespace causes the second loop to extract an empty word. This is why I added the condition to ignore it. You can trim the filtered result and then you wouldn't need this check.
Finally, I have added ignorecase boolean to check if you wish to ignore the case of the word or not. If you wish to do so, the program will simply convert the word to lowercase and then add it to the map. Otherwise, it will add the word the same way it found it. By default, ignorecase = true, if you wish to consider case, just call the function differently: count_words(input, false);.
Edit 2: In case you're wondering, the statement counts[word] will automatically create key/value pair in the std::map IF there isn't any key matching word. So when we call ++: if the word isn't in the map, it will create the pair, and increment value by 1 so you will have newly added word. If it exists already in the map, this will increment the existing value by 1 and hence it acts as a counter.
The program:
#include <iostream>
#include <map>
#include <sstream>
#include <cstring>
#include <cctype>
#include <string>
#include <iomanip>
#include <algorithm>
std::string to_lower(const std::string& str) {
std::string ret;
for (char c : str)
ret.push_back(tolower(c));
return ret;
}
std::map<std::string, size_t> count_words(const std::string& str, bool ignorecase = true) {
std::map<std::string, size_t> counts;
std::stringstream stream(str);
while (stream.good()) {
// wordW may have multiple words connected by special chars/digits
std::string wordW;
stream >> wordW;
// filter special chars and digits
std::replace_if(wordW.begin(), wordW.end(),
[](const char& c) { return std::ispunct(c) || std::isdigit(c); }, ' ');
// now wordW may have multiple words seperated by whitespaces, extract them
std::stringstream word_stream(wordW);
while (word_stream.good()) {
std::string word;
word_stream >> word;
// ignore empty words
if (word == "") continue;
// add to count.
ignorecase ? counts[to_lower(word)]++ : counts[word]++;
}
}
return counts;
}
void print_counts(const std::map<std::string, size_t>& counts) {
for (auto pair : counts)
std::cout << std::setw(15) << pair.first << " : " << pair.second << std::endl;
}
int main() {
std::string input = "Any experienced programmer engaged in writing programs for use by others knows \
that, once his program is working correctly, good output is a must.Few people \
really care how much time and trouble a programmer has spent in designing and \
debugging a program.Most people see only the results.Often, by the time a \
programmer has finished tackling a difficult problem, any output may look \
great.The programmer knows what it means and how to interpret it.However, \
the same cannot be said for others, or even for the programmer himself six \
months hence.";
auto counts = count_words(input);
print_counts(counts);
return 0;
}
I have tested this with Visual Studio 2017 and here is the part of the output:
a : 5
and : 3
any : 2
be : 1
by : 2
cannot : 1
care : 1
correctly : 1
debugging : 1
designing : 1
As others have already noted, an std::map handles the counting you care about quite easily.
Iostreams already have a tokenize to break an input stream up into words. In this case, we want to to only "think" of letters as characters that can make up words though. A stream uses a locale to make that sort of decision, so to change how it's done, we need to define a locale that classifies characters as we see fit.
struct alpha_only: std::ctype<char> {
alpha_only(): std::ctype<char>(get_table()) {}
static std::ctype_base::mask const* get_table() {
// everything is white space
static std::vector<std::ctype_base::mask>
rc(std::ctype<char>::table_size,std::ctype_base::space);
// except lower- and upper-case letters, which are classified accordingly:
std::fill(&rc['a'], &rc['z'], std::ctype_base::lower);
std::fill(&rc['A'], &rc['Z'], std::ctype_base::upper);
return &rc[0];
}
};
With that in place, we tell the stream to use our ctype facet, then simply read words from the file and count them in the map:
std::cin.imbue(std::locale(std::locale(), new alpha_only));
std::map<std::string, std::size_t> counts;
std::string word;
while (std::cin >> word)
++counts[to_lower(word)];
...and when we're done with that, we can print out the results:
for (auto w : counts)
std::cout << w.first << ": " << w.second << "\n";
Id probably start by inserting all of those words into an array of strings, then start with the first index of the array and compare that with all of the other indexes if you find matches, add 1 to a counter and after you went through the array you could display the word you were searching for and how many matches there were and then go onto the next element and compare that with all of the other elements in the array and display etc. Or maybe if you wanna make a parallel array of integers that holds the number of matches you could do all the comparisons at one time and the displays at one time.
EDIT:
Everyone's answer seems more elegant because of the map's inherent sorting. My answer functions more as a parser, that later sorts the tokens. Therefore my answer is only useful to the extent of a tokenizer or lexer, whereas Everyone's answer is only good for sorted data.
You first probably want to read in the text file. You want to use a streambuf iterator to read in the file(found here).
You will now have a string called content, which is the content of you file. Next you will want to iterate, or loop, over the contents of this string. To do that you'll want to use an iterator. There should be a string outside of the loop that stores the current word. You will iterate over the content string, and each time you hit a letter character, you will add that character to your current word string. Then, once you hit a space character, you will take that current word string, and push it back into the wordString vector. (Note: that means that this will ignore non-letter characters, and that only spaces denote word separation.)
Now that we have a vector of all of our words in strings, we can use std::sort, to sort the vector in alphabetical order.(Note: capitalized words take precedence over lowercase words, and therefore will be sorted first.) Then we will iterate over our vector of stringWords and convert them into Word objects (this is a little heavy-weight), that will store their appearances and the word string. We will push these Word objects into a Word vector, but if we discover a repeat word string, instead of adding it into the Word vector, we'll grab the previous entry and increment its appearance count.
Finally, once this is all done, we can iterate over our Word object vector and output the word followed by its appearances.
Full Code:
#include <vector>
#include <fstream>
#include <iostream>
#include <streambuf>
#include <algorithm>
#include <string>
class Word //define word object
{
public:
Word(){appearances = 1;}
~Word(){}
int appearances;
std::string mWord;
};
bool isLetter(const char x)
{
return((x >= 'a' && x <= 'z') || (x >= 'A' && x <= 'Z'));
}
int main()
{
std::string srcFile = "myTextFile.txt"; //what file are we reading
std::ifstream ifs(srcFile);
std::string content( (std::istreambuf_iterator<char>(ifs) ),
( std::istreambuf_iterator<char>() )); //read in the file
std::vector<std::string> wordStringV; //create a vector of word strings
std::string current = ""; //define our current word
for(auto it = content.begin(); it != content.end(); ++it) //iterate over our input
{
const char currentChar = *it; //make life easier
if(currentChar == ' ')
{
wordStringV.push_back(current);
current = "";
continue;
}
else if(isLetter(currentChar))
{
current += *it;
}
}
std::sort(wordStringV.begin(), wordStringV.end(), std::less<std::string>());
std::vector<Word> wordVector;
for(auto it = wordStringV.begin(); it != wordStringV.end(); ++it) //iterate over wordString vector
{
std::vector<Word>::iterator wordIt;
//see if the current word string has appeared before...
for(wordIt = wordVector.begin(); wordIt != wordVector.end(); ++wordIt)
{
if((*wordIt).mWord == *it)
break;
}
if(wordIt == wordVector.end()) //...if not create a new Word obj
{
Word theWord;
theWord.mWord = *it;
wordVector.push_back(theWord);
}
else //...otherwise increment the appearances.
{
++((*wordIt).appearances);
}
}
//print the words out
for(auto it = wordVector.begin(); it != wordVector.end(); ++it)
{
Word theWord = *it;
std::cout << theWord.mWord << " " << theWord.appearances << "\n";
}
return 0;
}
Side Notes
Compiled with g++ version 4.2.1 with target x86_64-apple-darwin, using the compiler flag -std=c++11.
If you don't like iterators you can instead do
for(int i = 0; i < v.size(); ++i)
{
char currentChar = vector[i];
}
It's important to note that if you are capitalization agnostic simply use std::tolower on the current += *it; statement (ie: current += std::tolower(*it);).
Also, you seem like a beginner and this answer might have been too heavyweight, but you're asking for a basic parser and that is no easy task. I recommend starting by parsing simpler strings like math equations. Maybe make a calculator app.

Map enum key and value using function pointer in C++

i am very new to C++ programming. I am doing my master and working on one problem given by professor. the problem is regarding performing the basic operations on binary search tree. i have one file which has below format :
I 1015291402
I 729831403
I 1005116371
F 757970570
D 1005116371
F 729831403
I 1218751282
D 1015291402
I 582339464
I 92421221
There are three basic operations Insert, Delete and Find can be done on search tree. so i need to read this file perform operation line by line. Below is the code i wrote so far.
string line;
ifstream infilesmall("inputfile_small.txt");
//ifstream infilelarge("inputfile_small.txt");
while (getline(infilesmall, line))
{
istringstream iss(line);
vector<string> tokens;
copy(istream_iterator<string>(iss), istream_iterator<string>(), back_inserter(tokens));
string str = ((tokens)._Myfirst)[0];
cout<< ((tokens)._Myfirst)[1];
//char operation = new char(((tokens)._Myfirst)[0]);
/*typedef void (*funcPointer)(int);
void String1Action(int arg);
void String2Action(int arg);
map<string, funcPointer> stringFunctionMap;
stringFunctionMap.add("string1", &String1Action);*/
insert(t,10);
find(t,0);
//Delete(t,10);
}
so the question what is ideal way of calling Insert, Delete and Find by splitting the line? i need to take care the performance. One approach i found out is to create enum with key and value pair and having function pointer. so depending on the key value ("I","D","F") the appropriate function will be called with it's respective value. Can you please suggest me/correct my approach and guide me on this code. Appreciate your time. Thanks
Your code is needlessly complex. You can read the operator and the number from the file, one pair at a time, and use the number appropriately based the value of the operator.
char op;
int number;
while ( infilesmall >> op >> number )
{
switch (op)
{
case 'I':
insertData(number);
break;
case 'D':
deleteData(number);
break;
case 'F':
findData(number);
break;
default:
std::err << "Unknown operator, " << op << std::endl;
}
}

Character to Double && Reading from file problems for RPN Calculator implementation

I asked a question previously but I've been bumping into a couple of problems along the way still. I am currently reading from a text file that contains a series of numbers, some with white space in between. This is for an RPN calculator implementation that I am doing. What I am currently having trouble with is reading whether the character that is being read is a digit or not. I am using isdigit, which I know doesn't work for a string type, hence the placement of the character c. But when I try to translate this character into a double (since my vector stack is for doubles only), I cannot just do one character at a time.
How can I edit my implementation for it to do so?
string line;
char c;
while (!infile.eof()){
line = infile.get();
c = line[0];
if (!isdigit(c)){
//this item is a digit
rpn_stack.push_back(atof(line.c_str()));
}
}
I appreciate it greatly!
You still haven't changed the EOF detection.
Try this:
std::string text_from_user;
int number_from_user;
while (getline(infile, text_from_user)
{
// The text is now in text_from_user.
// Now to parse the text
std::string::size_type position = 0;
number_from_user = 0;
// Get length of string, as the limit in the loop.
const std::string::size_type length = text_from_user.length();
bool building_number = false;
// Let's look at each character individually
for (position = 0; position < length; ++position)
{
// Although there are many methods for this, this
// method illustrates the fundamental principles.
// Extract the character from the string.
const char c = text_from_user[position];
// Dispatch according to the kind of character:
if (std::isdigit(c))
{
// Build an integer
number_from_user *= 10; // Left shift the number by decimal digit.
number_from_user += c - '0'; // Convert from text to internal representation.
// Process the next character:
continue;
}
switch (c)
{
case '*':
case '/':
case '+':
case '-':
Process_Operator(c);
continue;
case '(':
case ')':
Process_Grouping(c);
continue;
}
}
}
The above program demonstrates building of an integer. And recognizing (dispatching) based on character type. It purposely has defects as an exercise for the reader to remove. :-)
A better algorithm would use a state machine with one or more states for building integers and doubles. Search the web for "C++ parse double" for more examples.
You could cheat and see what other people have done by searching the web for "c++ RPN calculator" or "c++ prefix calculator".

Returning a string from a function in C++

I have a bit of code that is to make a reference code from a string of a last name. It should take the first char whether vowel or not, then search each remaining char in the array discarding the vowels storing consonants only in a temp string, then return the temp string to string refCode; The code was given to me in C and I converted it to C++. The code compiles assigns the first value correctly, but if the if returns true it will fail upon attempting to assign the second value to the temp string. The code is over 5 external .cpps and 4 .hs so I'll start with the minimal amount and will post more as needed.
Protytpe:
string makeRefCode(string lastname, int cNo);
Call:
refCode = makeRefCode(e[c].lastname, cNo); cout << refCode;//Prints nothing
Function Defs:
string makeRefCode(string lastname, int cNo)
{
string tStr;
unsigned int i, j = 1;
unsigned int x;
x = lastname.length();
tStr[0] = lastname[0];
cout << tStr[0];//Prints correct value
for (i = 1; i < x; i++)
{
if (!isVowel(toupper(lastname[i])))
{
//tStr[j] = lastname[i];//
j++;
}
}
//refCode[j] = '0'; // add string terminator
return tStr;
}
bool isVowel(char aChar)
{
switch (aChar) //<ctype>
{
case 'A':
case 'E':
case 'I':
case 'O':
case 'U': return true; break;
default: return false;
}
}
As I've tried resolving this issue I've gotten Assertion, Access violation, and a string error that seems like it's saying the string isn't big enough. Any help would be greatly appreciated.
String don't automatically grow in size. If your string starts at zero length (like tStr does) then you need to use push_back to add characters to the end of the string.
tStr.push_back(lastname[0]);
and
tStr.push_back(lastname[i]);
When you assign single characters to a string, make sure that the string has allocated those characters.
The following code is wrong:
string tStr;
//...
tStr[0] = lastname[0];
Because, it assigns a value to the first character in tStr. But tStr is empty at this point.
You want to append/push_back the character:
string tStr;
//...
tStr.push_back( lastname[0] );
Additionally, you should ensure that lastname is not empty.
You mustn't say tStr[0] on an empty string! Surely, the target string must be big enough to contain the result. Either say tStr.push_back(lastname[0]); or tStr += lastname[0];, or initialize the string large enough (like with std::string tStr(lastname.size())) and then truncate it when you're done.
You need to add check for 0 length:
if (x==0) ....
And you need to replace commmented code tStr[j] = ... with:
tStr.push_back(lastname[i]);

C++: Removing all asterisks from a string where the asterisks are NOT multiplication symbols

So basically, I might have some string that looks like: "hey this is a string * this string is awesome 97 * 3 = 27 * this string is cool".
However, this string might be huge. I'm trying to remove all the asterisks from the string, unless that asterisk appears to represent multiplication. Efficiency is somewhat important here, and I'm having trouble coming up with a good algorithm to remove all the non-multiplication asterisks from this.
In order to determine whether an asterisk is for multiplication, I can obviously just check whether it's sandwiched in between two numbers.
Thus, I was thinking I could do something like (pseudocode):
wasNumber = false
Loop through string
if number
set wasNumber = true
else
set wasNumber = false
if asterisk
if wasNumber
if the next word is a number
do nothing
else
remove asterisk
else
remove asterisk
However, that^ is ugly and inefficient on a huge string. Can you think of a better way to accomplish this in C++?
Also, how could I actually check whether a word is a number? It's allowed to be a decimal. I know there's a function to check if a character is a number...
Fully functioning code:
#include <iostream>
#include <string>
using namespace std;
string RemoveAllAstericks(string);
void RemoveSingleAsterick(string&, int);
bool IsDigit(char);
int main()
{
string myString = "hey this is a string * this string is awesome 97 * 3 = 27 * this string is cool";
string newString = RemoveAllAstericks(myString);
cout << "Original: " << myString << "\n";
cout << "Modified: " << newString << endl;
system("pause");
return 0;
}
string RemoveAllAstericks(string s)
{
int len = s.size();
int pos;
for(int i = 0; i < len; i++)
{
if(s[i] != '*')
continue;
pos = i - 1;
char cBefore = s[pos];
while(cBefore == ' ')
{
pos--;
cBefore = s[pos];
}
pos = i + 1;
char cAfter = s[pos];
while(cAfter == ' ')
{
pos++;
cAfter = s[pos];
}
if( IsDigit(cBefore) && IsDigit(cAfter) )
RemoveSingleAsterick(s, i);
}
return s;
}
void RemoveSingleAsterick(string& s, int i)
{
s[i] = ' '; // Replaces * with a space, but you can do whatever you want
}
bool IsDigit(char c)
{
return (c <= 57 && c >= 48);
}
Top level overview:
Code searches the string until it encounters an *. Then, it looks at the first non-whitespace character before AND after the *. If both characters are numeric, the code decides that this is a multiplication operation, and removes the asterick. Otherwise, it is ignored.
See the revision history of this post if you'd like other details.
Important Notes:
You should seriously consider adding boundary checks on the string (i.e. don't try to access an index that is less than 0 or greater than len
If you are worried about parentheses, then change the condition that checks for whitespaces to also check for parentheses.
Checking whether every single character is a number is a bad idea. At the very least, it will require two logical checks (see my IsDigit() function). (My code checks for '*', which is one logical operation.) However, some of the suggestions posted were very poorly thought out. Do not use regular expressions to check if a character is numeric.
Since you mentioned efficiency in your question, and I don't have sufficient rep points to comment on other answers:
A switch statement that checks for '0' '1' '2' ..., means that every character that is NOT a digit, must go through 10 logical operations. With all due respect, please, since chars map to ints, just check the boundaries (char <= '9' && char >= '0')
You can start by implementing the slow version, it could be much faster than you think. But let's say it's too slow. It then is an optimization problem. Where does the inefficiency lies?
"if number" is easy, you can use a regex or anything that stops when it finds something that is not a digit
"if the next word is a number" is just as easy to implement efficiently.
Now, it's the "remove asterisk" part that is an issue to you. The key point to notice here is that you don't need to duplicate the string: you can actually modify it in place since you are only removing elements.
Try to run through this visually before trying to implement it.
Keep two integers or iterators, the first one saying where you are currently reading your string, and the second one saying where you are currently writing your string. Since you only erase stuff, the read one will always be ahead of the writing one.
If you decide to keep the current string, you just need to advance each of your integers/iterators one by one, and copying accordingly. If you don't want to keep it, just advance the reading string! Then you only have to cut the string by the amount of asterisks you removed. The complexity is simply O(n), without any additional buffer used.
Also note that your algorithm would be simpler (but equivalent) if written like this:
wasNumber = false
Loop through string
if number
set wasNumber = true
else
set wasNumber = false
if asterisk and wasNumber and next word is a number
do nothing // using my algorithm, "do nothing" actually copies what you intend to keep
else
remove asterisk
I found your little problem interesting and I wrote (and tested) a small and simple function that would do just that on a std::string. Here u go:
// TestStringsCpp.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <string>
#include <iostream>
using namespace std;
string& ClearAsterisk(string& iString)
{
bool bLastCharNumeric = false;
string lString = "0123456789";
for (string::iterator it = iString.begin(); it != iString.end() ; ++it) {
switch (*it) {
case ' ': break;//ignore whitespace characters
case '*':
if (bLastCharNumeric) {
//asterisk is preceded by numeric character. we have to check if
//the following non space character is numeric also
for (string::iterator it2 = it + 1; it2 != iString.end() ; ++it2) {
if (*it2 != ' ') {
if (*it2 <= '9' && *it2 >= '0') break;
else iString.erase(it);
break; //exit current for
}
}
}
else iString.erase(it);;
break;
default:
if (*it <= '9' && *it >= '0') bLastCharNumeric= true;
else bLastCharNumeric = false; //reset flag
}
}
return iString;
}
int _tmain(int argc, _TCHAR* argv[])
{
string testString = "hey this is a string * this string is awesome 97 * 3 = 27 * this string is cool";
cout<<ClearAsterisk(testString).c_str();
cin >> testString; //this is just for the app to pause a bit :)
return 0;
}
It will work perfectly with your sample string but it will fail if you have a text like this: "this is a happy 5 * 3day menu" because it checks only for the first nonspace character after the '*'. But frankly I can't immagine a lot of cases you would have this kind of construct in a sentence.
HTH,JP.
A regular expression wouldn't necessarily be any more efficient, but it would let you rely on somebody else to do your string parsing and manipulation.
Personally, if I were worried about efficiency, I would implement your pseudocode version while limiting needless memory allocations. I might even mmap the input file. I highly doubt that you'll get much faster than that.