-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAutori.cpp
68 lines (37 loc) · 1.13 KB
/
Autori.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <bits/stdc++.h>
using namespace std;
/*
USE STRINGSTREAM FOR VARIABLE STRING.
*/
/*
N is no. of char.
so max is O(100);
*/
int main(void){
string input;
getline(cin,input); // cin the input phrase
vector <string> str; //empty string to store the intials
stringstream check(input); // to break up the words in (input) . stringstream name is "check"
string output; // to store individual words ("output" is the string for each and every individual word)
while(getline(check,output,'-')){
str.push_back(output); //store the individual words in one vector str
}
//cout << str.front(); //to print the first word
//printing the vector, str
for(int i=0; i< str.size(); i++){
string first_char;
first_char = str[i].substr(0,1);
cout << first_char ;
//cout <<str[i] <<endl ; // will display the entire word
}
return 0;
}
// string word;
// string sentence;
// for (int i = 0; i < 10; ++i)
// {
// cin >> word;
// sentence += word + " ";
// }
//
// cout << sentence;